Saving Key Strokes can bring a World of Pain

Developers seem to fall into two schools of thought on this one. Limit the amount of code you write or leverage the syntax to assure no mistakes are made. I've flirted between the two, but right now I'm heavily in favor of the latter approach. What am I talking about? Well two things in particular. Firstly the use of chaining declarations in JavaScript and secondly omitting curly braces in single line if statements. Both of these things have caught me out recently. Let me give you some examples: Chaining Declarations in JavaScript function SomeObject() { var span = document.createElement('span'), li…

Read More

403 Error and .NET Bundling

Came across this one the other day whilst using the .NET bundling functionality. All was fine in debug mode but as soon as I pushed it to production everything went pear shaped. The combined file kept returning a 403 error. After a bit of prodding around it turned out the problem was due to me naming my bundle the same as the directory I kept my files in. So this: var bundle = new Bundle("~/Scripts"); bundle.AddFile("~/Scripts/jquery-1.6.2.js"); bundle.AddFile("~/Scripts/jquery-ui-1.8.11.js"); bundle.AddFile("~/Scripts/modernizr-2.…

Read More