Below are my latest posts which are taken from my latest blog posts. You can go directly to my blog at this URL: meloveyouruntime.com

Umbraco Lucene Date Range fun

You know days when you think everything is fine, then you hit a snag and it takes the rest of the day? Yup. That happened today. The issue this time was with an Umbraco implementation I am working on at the moment. With searching using indexes in Umbraco it's all rather...

Setting up Sitecore on Amazon RDS

This week I have had a bit of a nightmare setting up a client's site using Amazon's Relational Database Service (RDS). The issue arises because you can't just restore a .bak file on RDS as there is no access to the service's file system. I read a blog post here:...

Replaceable token issue with config ConnectionString transforms

I ran into a little conundrum the other day trying to make a .net C# project build and deploy. I was making a build using MSBuild which also transforms config files. This was all working, but in the config's ConnectionStrings element, the transform was coming out with: <add name="Connection" connectionString="$(ReplacableToken_ProjectName-Web.config Connection...

Remove your Webforms ViewEngine for MVC

I learnt something interesting today. When we use MVC and the Razor view engine, we can end up with a bit of a performance hit. In fact, Razor can end up running much slower than Webforms because we don't clear the Webform view engine (up to half as fast!), so...

SQL Migration to Azure

I've been playing about with Azure at work recently to test it out and see if it will work as we need for clients. For the most part it has been blindingly easy to set up. But one thing I had a few issues with was migrating my SQL data...

Returning a default with generics

Today I was working on a generic method which gets a querystring and converts it. If the querystring exists, it would convert the type and return it. However, I'd also need to return a default if the querystring doesn't exist. As it was a generic method, I couldn't rely on...

Upgrading Sitecore causes Global.asax to not work

AAAAAHHHH! This fix, I hope, will save you a lot of time. Recently we have been upgrading some clients to the latest Sitecore. Generally that works fine, however, on re-compile, then running the application, I get a nasty StructureMap Exception Code: 202 (we use this lovely little nugget for IoC)....

TestCaseSource in Nunit 2.5

Recently, one my team mates discovered the TestCaseSource attribute in Nunit 2.5. I have been using the TestCase attribute for a little while. It enables you to tes multiple inputs with one test: [TestCase(12,3,4)] [TestCase(12,2,6)] [TestCase(12,4,3)] public void DivideTest(int n, int d, int q) { Assert.AreEqual( q, n / d ); } This is useful for various reasons,...

Sitecore desktop freezes

While working on a site recently, I noticed that trying to get to the Desktop version of Sitecore, it would get stuck just in a request state, nothing happening. This was always after logging in, the Sitecore login page itself worked fine. It would also not log any issues in...

What's that duck for?

I've written about this before in my last, not so focused blog, but I'll write it again. There are a few simple non-programming programmer rules I like to adhere to. These would be things like KISS (Keep It Simple Stupid) etc. Another lesser known one of these is Rubber Duck...

Supersized Jquery library

I keep saying this: if .net and C# (or just back end technologies), then HTML, Javascript and CSS (front end technologies) are my mistress. I love to dabble with these lovely pieces of simple but great technologies. One of my latest things is to take a library off Github (let's not...

Remotely disconnect an RDP session

If you find someone doesn't log off their session after using RDP and just disconnects, you may need to regularly ask them to log off, or force a log off. But you can also log off their session remotely by doing the following in your command line (this should work...

Fonts and MsDeploy

While trying to deploy a site this morning using MsDeploy triggered by my build server, most worked well, apart from the fonts I was using being pushed as well. Some fonts are called from the CSS and need to be in there too. These didn't upload with the deploy at...

Setting up SSH and Git on PC

Today at lunch, the tech team at work sat down for a lunch at learn to work out Git, which we are currently migrating to. We had a few learning issues with setting up SSH keys within Git Extensions, so I thought I'd write my findings down here. For this, you'll...

Resetting Oracle SYSTEM user password

I recently got locked out of my Oracle DB (before you think I am an Oracle fan, I am not, but hopefully this will help others who have had the struggle). Someone had changed the SYSTEM user password and not noted it down. I managed to work out a way...

Unit Testing Data Annotations

For home projects done in asp.net I tend to use the DataAnnotations on my models for validation. Of course anyone would want to write a unit test to make sure this is all in order. Let's take some very simple test, I want to check my model is not validating...

NVelocity & calling functions

The other day a dev was using NVelocity for templating emails. He realised that When sending an email, you would need to html encode the data to stop Cross Site Scripting (XSS). Not so much javascript, but being able to embed an image or link which could be malicious. He...

Don't forget your (XPATH) descendants

Recently at work, we've been getting into Selenium tests for regression testing. With this comes a lot of XPath. I love a bit of XPath, and along with Regex and XSLT as long as you use the KISS principle, everything will be ok. A developer was working on getting each link...

MS package and deploy

I've been looking into better ways of deploying recently. Microsoft have released their deploy tool which seems very capable, but it is quite tricky (mainly as it is a product which needs to cater for all types of environment setup within .net). It's very simple to set up within Visual...

Sitecore media and an mp3 player

Recently, I had a bit of a pain with adding an mp3 player to pages for playing files held in Sitecore. Here's a bit of background to the issue: the client wanted an mp3 player like a sister site of theirs has on their site. The sister site does have...

Mercurial: Adding a remote repository

For home projects I have started using Mercurial. I have a fairly good grasp of Git and DVCS. I have been using Bitbucket for this and it's pretty damn slick. But one thing they don't say is how to add a remote repository to your existing code. It just shows...

ORA-28001: the password has expired

Recently, I have been working with a client who uses Oracle as their database. We have been running Sitecore from this and it works ok, bar a few bugs. However, one day, without warning, we started getting the following error: ORA-28001: the password has expired Great. After some searching, we realised it is...

Micro ORMs

I've always been a little wary of ORMs. Linq to SQL, Entity Framework, NHibernate. They're all powerful, great to use and ease up development time quite a bit. The reason I'm not sure about them is the Select n+1 issue, general performance, tweakability and, well, DBAs don't particularly like them,...

CruiseControl.net Log Cleanup

I've recently got well into CruiseControl.net. Having a server building, testing and even packaging for you is, well, brilliant for so may reasons which I will not get into here. However, at my current work, we constantly use up space with log files, every build builds a log file, and as...

Static Content in IIS7

Everytime I start a new server install on IIS7 I forget one thing, I install IIS and its management console and also .net 3.5 and 4.0, but always forget to check that Static Content is checked. This means that when I start my site, it generally works straight away, but no...

Rails on 64-bit Windows 7

Recently I have decided to try out Ruby on Rails again. Ok, I have done one or two projects with it, but I want to have another go. I'm going to share my thoughts here about it and what's got me. After some time with C#, most error messages don't...

Cookie Versioning

Working on some major sites in the past. I have noticed one thing a lot of devs (including me) don't do. Version cookies. We are taught as developers that code changes and we must make sure our code is easily maintainable because of that. Cookies tend to be forgotten though. Take...

ByteArray to file

I work a lot with Flash developers (or actionscripters) and most of the time Flash will need to post a form to the server to process or something similar. A server side developer will then write some services to receive or return data to the Flash. Sometimes the data isn't...

[CSS3] System Selection

A new selector is available in CSS3. It goes something like: ::selection and it allows the user to change the highlight colour of the page. e.g. .red::selection { background: #ff0000; } It's a small step, but nice and it gracefully degrades (or progressively enhances, depending on your outlook on life) if...

New web features

So I will promised a quick HTML5/CSS3 series, but I've just realised a site which demonstrates the new Javascript API, HTML 5 and CSS 3. And it really is very good. I will post about my discoveries as well, I'm not being lazy, but this really is good: http://apirocks.com/html5/html5.html

JsonRequestBehavior.AllowGet

I recently had an issue with the JsonResult controller type. I tried to connect to an API to return some JSON and received the error: "This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request." Hmmm, I thought....

Dot Less

I recently attended the Microsoft Techdays. They've really got it down with these things. This time it was in a cinema (Vue) in Fulham Broadway for developers and in Shepherds Bush for IT professionals. In the evening they had fringe events. On Wednesday evening I decided to go to the...

Favicon.ico 404 issue

So, sometimes you will find that browsers look for the favicon.ico file at the root of your site. A lot of the time you haven't yet/won't add one of these. As the browser looks for this, it can cause a 404 error in asp.net MVC. It can be made to...

HTML5 & CSS3, exciting times

After rebuilding my site in HTML5 and using CSS3 I have decided to do a small series of what can be done. HTML5 is very exciting and powerful and CSS3 finally adds some features that designers have wanted for years but developers have cried over (drop shadows for example, or...

C# Password generator

I recently wrote a small amount of code to generate a password without using a GUID or something. Pretty simple stuff, but good for a library. string pwdChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789"; char[] pwdElements = pwdChars.ToCharArray(); Random random = new Random(); StringBuilder builder = new StringBuilder(); //Generate password in loop for(int i = 0; i < passwordLength;...

Exception Development

This is more to get into my head than anything. Catching errors and reporting them is a good thing. 'm not talking about try and catch blocks round every part of your code, but rather using HTTP Modules and the Global.asax to catch all errors thrown, and a. sending to...

Date Validation (check user age)

I'm going to admit now that I have issues with validating date formats. Not so much the format itself, but finding whether user x is a certain age. Working on some alcohol projects in the past, it has caused a bit of pain whichever language. The main issue comes from...

Amazon Web Services for .net

Amazon web services are really amazing. A growing line of products which are really useful for the developer to use for storage or queues, a simple database, up to full hosting solutions. I've been shying away from the services a little for commercial sites as I imagined having to write a...

SQL Server Password blocked

Recently I tried to log into my SQL server install. Getting the password wrong a few times it blocked me out. The problem is, most of the web explains how to reset the password if you are already logged into SQL server. If you do get blocked, you can run...

Intro to the new Dev Blog

Well well, another blog. I've decided to set this one up as a coding reference. Things I've found, quirks, etc. for me to reference back to. Hopefully it'll help you too. Good luck, any feedback is welcome.