Lachlan B's Blog

An ASP.NET bug from 1973

Today, I was coding an ASP.NET 4.5 REST api using WebApi 2, and was caught out by a problem caused by a technical decision made forty two years ago.

I think I need to repeat that again. FORTY TWO years ago. (Yes, it's spelt f-o-r-t-y, not f-o-u-r-t-y, thanks anonymous pedantic reader!)

1973! The year when Aerosmith released their debut album! The year Elvis Presley's concert in Hawaii had more watchers than the moon landing!

Apparently, in ASP.NET, having a URL end in "AUX" causes it to throw a 404 error.

This might happen if you were building a RESTful web service that validated country codes. For example, you might make a request to this URL

Which would return "New Zealand".

Or maybe you're testing Australia:

And then of course, you want to test your web service to see what would happen if you passed through invalid country code:

Which gives you a 404 error, thanks to CP/M, an operating system coded in 1973.

Microsoft have a fix for this, but it's not enabled by default. Yes, it's NOT enabled by default. Seriously.

So anyway, what's the weirdest/oldest bug you've come across in a framework?

Succeeding at every job interview

The HR boss of google, Laszlo Bock, is spruiking his new "Work Rules!" book. As part of the promotion campaign he has written a very popular linkedin post explaining "How to win every interview with these 6 steps".

Now apart from the obvious clickbaity title, which I'm prepared to give a little bit of leeway, I would like to point out just how wrong he is.

Normally I would leave these kind of clickbaity promotional marketing articles alone and treat them with the contempt they deserve, but in this case, it's coming from the HR manager of google, who you assume would know better. I also feel that this type of article rather is also extremely demotivating to the job seeker, and Mr Bock should know better.

So to start with the positive aspects of this article. In general, these tips will probably help differentiate you from some of the competition. Doing your research, having a pre-prepared list of questions and answers are all a smart way to prepare. Rehearsing your answers is a great idea.

But will it help you win every interview?


You know why?

  • People are unpredictable. They might have gone for you yesterday, but today, they are extra tired. Yesterday they wanted to take a gamble on someone like you, but today, they just aren't feeling up to depending their decision.

  • Interviewers are biased. To put it bluntly, you may be too young, too old, too smart, too dumb, too expensive, too cheap, a female, a male, not a coffee drinker, not the cousin of the boss, not an drinker, too loud, too forthright, too quiet, not diplomatic enough, not tall enough, too religious, not religious enough. The list goes on. The person interviewing you will never admit to any of these factors, and often doesn't even realise that these things have been the deciding factors for him or her. Some people will scream bloody murder and say "that's not true, I'm never biased! I've attending 300 training courses on how not to discriminate! My best friend is a 90 years old Albanian zoroastrian!". I'm not saying your not consciously discriminating, but the decision to hire someone is inevitably be affected by your past experience. Admit it, you're biased. If a tall-skinny-25-year-old-white-enthusiastic-male-agnostic-glasses-wearing-nerd applied for a computer programming job, he's going to have to work a little bit less harder than a short-fat-60-year-old-black-quiet-female-muslim-contact-wearing-unnerd is.

  • By the own article's own logic, the interviewer will have made up their mind in the first 10 seconds (and everything else is just confirmation bias). Is this really true? Maybe for some people. I think he's made a mistake here. People's first impressions may take only 10 seconds, but that's why they are called first impressions. A good interviewer will not make up their mind in the first 10 seconds.

  • This article reeks of "you are 100% responsible for your success" mentality. This is common amongst CEO's and upper management types who like to feel that they deserve their vast success, and that none of it is up to luck. They're a self made wo/man! The problem with this mentality is that if you have no job, and are finding it difficult to get a job, then it's 100% your own fault. Homeless? It's your fault. Poor? It's your fault. You don't deserve any help, you just need to try harder and make different choices. Self determination baby.

While this may be an uncomfortable truth for many, personally I believe that luck is a major factor in your life. The perfect job may have been available last week, and they would have hired you in a flash... but it's taken. You're looking for a job this week. There's nothing around this week. What can you do about it? Nothing. Someone might have accidently missed the brake and gone through that red light and hit you with their car. Bad luck. Self determination? I don't think so.

Now having said all of that, I think there's heaps of things you can do to improve your odds. You can figure these out for yourself and none of them take a genius to work out. Research the company. Learn how to partake in interviews. Volunteer with a company or industry in your area. Meet people. Get experience. Stay positive. Keep plugging away at it, you'll find something eventually (hopefully). Keep going and never give up.

Generating barcodes with zen barcode generator

Someone asked me on Sunday if it would be possible to generate a PDF that had a barcode in it. I haven't generated a "normal" boring 2D barcode before, so I thought I'd give it a crack. I find a library named Barcode Rendering Framework, downloaded it, looked for the documentation on how to use it... and there isn't any.

I mean, there is literally none. The answer is "look at the code samples". This attitude drives me up the wall. It would seriously take the developer 10 minutes to write a good document explaining how the thing works and how to use it. But can they be bothered? Nope. So after much head scratching and stuffing around I figured it out.

private string getBarcode(int type)
	BarcodeSymbology s = BarcodeSymbology.Code39C;
	BarcodeDraw drawObject = BarcodeDrawFactory.GetSymbology(s);
	var metrics = drawObject.GetDefaultMetrics(60);
	metrics.Scale = 2;
	var barcodeImage = drawObject.Draw("1234123132", metrics);

	using (MemoryStream ms = new MemoryStream())
	    barcodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
	    byte[] imageBytes = ms.ToArray();

	    return Convert.ToBase64String(imageBytes);

And then to embed it on the page I just use an image tag:

 <img src="data:image/png;base64,bytearraydatagoeshere" /> 

Which produces this:

Plenty more amazing samples on my amazing barcodes page.

Moving from classic ASP to MVC5

So the past few weeks I've been re-writing my website. Previously it was written in Classic ASP (yes, you read that right) and it was running off a Microsoft Access database. Yes, you read that right too.

The code has served me well since I launched in 2006, and can I point out, that was NINE years ago. I have to salute classic ASP for doing a pretty bang up job. The site rarely went down, it was never hacked (apart from a mountain of comment spam) and it was all-in-all, pretty good fun.

But the past couple of years has seen a huge improvement in website coding. It's all so much easier and more fun now, so I figured I might as well rewrite it in ASP.NET and move it to MVC. So here's the full stack of technologies:

  • Bootstrap for the front end - fantastic library once you get your head around it

  • JQuery for the little ajaxed archive box over to the right

  • ASP.NET MVC4 for the back end

  • Entity framework for talking to the DB

  • SQL Server for the DB

The whole thing was coded using Visual Studio community edition and SQL Server express. Half was written on my desktop, and the other half was written on my MacBook air running a windows 7 VM using Parallels - a process that ran surprisingly well. I synced the code between the two machines using Git Gui, another process that ran surprisingly well.

So what's great about the new technology stack and what's not so great?

Friendly URLs - Good

Nice URLs in classic ASP weren't impossible, but they weren't exactly easy. Nice URLs in Webforms was possibly even harder! But in MVC... URLs can be super, super friendly. The routing options are many and super variable, and it's all pretty cool. It's quite fiddly to setup, but it's pretty powerful and very nice. You'll see that each blog entry URL on this site has the format /year/month/title. Easy to setup and makes a lot of sense.

Entity Framework Good

I love the entity framework. For basic CRUD operations it's a life saver. Super easy to setup and use, it's amazing. If you've never had to go down the whole "1 stored proc for each database query" you have no idea just how much time you're saving. For anything more complicated than simple queries I'll be using stored procs (stored procs are ace) but for the basics, Entity Framework is awesome.

Javascript + CSS bundling and minification Good

I love bundling and minifying my javascript and CSS. Your site loads quicker, it uses less bandwidth, it's a win-win. The new bundling and minifying libraries are awesome. Easy to setup and use and do the job perfectly. Great job microsoft.

What's not so great?

Config Files Bad

Haven't we learnt enough from the horror that is Java??? I was super happy to move away from Java 10 years ago. It had become XML configuration file hell. The web.config file is great, but boy can it be over-complicated. On top of that a typical MVC project can have multiple web.config files (mine has 3). As far as I know there's no nice easy to read reference for the web.config file format, and I'm always discovering more undocumented "features" that need to be set. (minFreeMemoryPercentageToActivateService I'm looking at you). Please, Microsoft, continue simplifying the web.config file, not complicating it.

Project Layout Bad

MVC straightjackets you into a particular project layout. You basically have to put your Controllers into /Controllers, your Views into /Views, your javascript into /Scripts, etc etc etc. Now I'm well aware that technically you don't have to, but if you want NuGet to play properly and if you want Visual Studio to play properly, you're going to have to meet it halfway. This is not a lot of fun, especially when the standard layout is pretty, erm, weird. Adding areas to your project just makes it more confusing. Not cool.

NuGet Bad

Ok I'm going out on a limb here. I'm not crazy about NuGet. It does weird things to your project without telling you what it's done. Trying to find the "official" or "right" version of a library is difficult. Trying to figure out dependencies (and dependencies of dependencies) is even more difficult.

Ok end of whinge.

Big thanks to the master of security Troy Hunt for his excellent security scanning tool which I've run the website through.

Are there any other libraries or tools that I should be considering?

Top 10 guitar solos of all time

A few days ago I saw this. And I think it's an abomination. I guess I deserve all that I get reading anything from the nme :)

So in an attempt to give a bit more credence to the guitarists who actually, you know, know how to play the guitar, here's the guitar solo's that I think really re-defined the art of the electric guitar.

1. Deep Purple - Lazy

In 1972 Deep Purple decided to record the rock album of all time. Every solo on this album is a killer, and every song is a killer. Deep purple have always been an amazing live band and this really shows up in their chemistry.

2. Eddie Van Halen - Eruption

In 1979 Eddie Van Halen exploded all over his first album and boy was this a stunner. For years nobody could work out how he did it and called him a cheat! But we know the truth.. the guy was a genius!

3. Yngie Malmsteen - Far Beyond the Sun

In 1984 Malmsteen released "Rising Force" and defined a new style of metal - neoclassical. Similar to Van Halen a lot of people thought that his records were sped up - how could anyone play that fast?

4. Joe Satriani - Crushing Day

In 1987 Joe Satriani sat down and recorded the epitome of instrumental rock. The classic "Surfing with the alien". Too many great solo's to choose from, so I'll go with "crushing day".

5. Steve Vai - The Animal

In 1990, Joe Satriani's former student Steve Vai released his second instrumental album. A landmark in sonic textures, alien sounds and amazing solo's, this album holds up to this day and still sounds fresh.

6. John Petrucci (Dream Theater) - Under a glass moon

In 1991 metal was almost dead. Which was a shame because Dream Theater went on to be one of the biggest metal/prog bands in the world, but at the time, this stuff was incredibly uncool!

Now without hearing the full song this solo won't make a lot of sense... so here's the full song. The solo is at 4:37.

Ok it can't be helped... here's the master playing the solo!

7. Greg Howe - Joker's Wild - 1995

By the mid 90's grunge was in full swing and nobody wanted to have a bar of instrumental rock! Luckily for us, Greg Howe continued to record and release album after album of incredible music. Howe's ability to shred over extended crazy chord changes just freaks me out. He's also super funky. Setting the scene for upcoming future shredders, Howe was doing it all first, years before anyone had caught up.

8. Ron Jarzombek (Spastic Ink) - 1997

Every now and again there comes along a new guitarist who will just blow you away. The next man on the scene was Ron Jarzombek, and boy will this guy will just make you laugh. Everything he does is clearly insane. It must also be mentioned that it's his brother Bobby on drums who delivers an amazing performance on this tune:

9. Guthrie Govan - Sevens

In the mid 2000's, this dude appeared on youtube. Pretty soon every guitarist in the world was saying "Who the hell is this guy?" and he became known as "that youtube guy". Expanding what could be done on the electric guitar, Guthrie has pushed the boundaries over what was previously believed to be possible. This is just one of his incredible songs, check out the improvised solo from 5:11 on:

10. Tosin Abasi - Wave of babies

In 2009 this was the most interesting thing that I'd heard in a long time. Tosin Abasi appeared out of nowhere and created an amazing sound!

So who's next?

Without having a crystal ball it's a bit hard coming up with who the next great guitarist will be of the 10's - but tell you what, Mattias has got to be a good bet.

And something extra... Steve Morse - Ted The Mechanic.

Steve Morse has done a million great solos so it's very hard to pick one. So here's something a bit out of left field - from Deep Purple's first album with Steve Morse, here's a rockin guitar solo.

Split Screen effect with Sony Vegas

A friend of mine was wondering how to do a split screen effect with Sony Vegas. I didn't know either, so after much stuffing around here's what I came up with.

First off I filmed a 60 second video. The first 30 seconds was me entering from camera left and sitting down. I then left the camera running, stood up, entered the screen from the right and then sat down for another 30 seconds. So starting with three video tracks:

Matt 1 image

I put the first 30 seconds from the video onto "First Video" track, and the second 30 seconds of the video onto the "Overlay Video" track:

Matt 1 image

then, click on this magic icon here:

Matt 3 image

click on this icon. This icon makes the "Overlay Video" a child of the "Matte" video track.

I then went to the "Media Generators" tab, and dragged the "Split Screen" onto the "Matte" video track, and dragged it to be of a length of 30 seconds.

Matt 4 image

I then clicked on the "Compositing Mode" icon on the "Matte" video track, and changed it to be "Multiply (Mask)":

Matt 5 image

I then right clicked on the split screen video and chose "edit generated media", then changed color 1 to be complete transparent by moving the slider all the way down or entering 0 in the "A" (alpha) box.

Then change color 2 to be completely white by moving the slider or entering 255 in R G and B.

Matt 6 image

Voila. You could then right click on the matte video, choose "Video Event Pan/Crop", and then move the matte image to be exactly where you need it. You could even keyframe it to move it around, which is what I did for this video, notice that the split actually moves a bit to the left.

Shoot Em Ups Album

Remember those cool games in the 80's where you shot everything in sight? Those were the best games. The music was sometimes pretty cool too - and made even better when bought into the present with some MASSIVE GUITARS.

Shoot 'Em Ups

This collection features Doom 2, Commander Keen 4, R-Type, Ghouls and Ghosts, Double Dragon, and two tunes from the obscure Japanese PC only shoot-em-up games named Touhou!

Track listing:

1. Deep Mountain (Touhou #7 Stage 1) - 03:06

This is the first song that I'd recorded in a while. I went for a different approach with contrasting between the clean guitars and then the monstrously heavy 7-string, and then back to the acoustic. Compositionally wise it's pretty simple, just repeating the main melody 3 times, but it's the arrangement that (hopefully) makes it interesting. Ideally I would have liked to expand the heavy section, but in a short burst it leaves you wanting more.

2. Love Coloured Master Spark (Touhou #8 Stage 4) - 01:55

It's very hard to do justice to the original with this version, so I went for an electronic drum sound similarly to the original, but threw in a keyboard solo at the end because I found such a rad patch. No I can't play the keyboard for nuts. Not yet anyway.

3. R-Type Medley (Arcade) - 06:24

Phew, the first monster. I really wanted to do at least one song from R-Type, so I downloaded all of the music and listened to a bunch of them.. then decided, the more the better right?? So what we've got here is about 5 or 6 stages all thrown together. It was a bit of a nightmare trying to piece them all together into one coherent bit of music - so I basically separated it into medium tempo and fast tempo ones. I'm really proud of the first 40 seconds because that's where the weird time signatures occur! (Though it's all a matter of interpretation, you could argue that it's all 4/4... Mike and I disagree). I decided to do a videoclip for this one:

4. Eat Your Vegetables (Commander Keen 4) - 01:57
I borrowed a friends awesome Warwick bass for a few of these songs and wanted to make good use of it. After playing through Commander Keen 4 for the seven hundreds time (classic game, much better then all the Mario's combined) I decided to do a cover of the super sleazy sounding "Blowfish Tune". It took a while to come up with a good arrangement, and I ended up sticking with almost exactly the same instrumentation as the original, minus a few things. Keeping it sparse added a real cool factor to it.

5. Ghouls And Ghosts (C64 Version Stage 1) - 03:15

In-tune with the game, this one was devilishly hard. The original is such a fantastic song that doing a cover of it seemed like a tragedy... so I ended up doing a bit of both. Most of the song is actually there in the background so this is almost a re-mix not a cover!

6. Dave D Taylor Blues (Doom 2 Stage 8) - 05:17

I've loved this song for years, all the way back to playing Doom 2 on my 486 DX40. It's actually just a really simple 12 bar blues. I tried to replicate the original almost exactly here - even making sure the triplet echo's on the guitar were spot on. For this tune I miked up the amp instead of using Amplitube - what do you think of the tone?

7. Double Dragon Medley (SNES) - 07:43

ARGHGHGHG. FIGHT FIGHT FIGHT. Smash his head in! Take that!

You can download the Shoot Em Ups Album for free!

Next covers album track 2

Track number 2 is a medley of tunes from R-Type:

It's an epic 6 minuter that syncs up exactly with the original version. Phew!

Next covers album..

The new covers album is coming along great. Seven songs recorded so far, about half an hours worth of music. Here's track number one:

This tune is from a game titled Perfect Cherry Blossom, which is the 7th in the LONG series of PC shoot-em-up games named "Touhou". They're a bit of a Japanese sensation (there's actually a massive conference each year dedicated to the games. The game is fantastic too, here's a video:

So I've got 6 more covers to release... all different games... if you want to keep up to date you can either use:

Facebook -


Youtube -


Twitter -

Julia Gillard on North Korea...

Hey Gillard,

I notice that you've recently been to the South Korea. It's fun hey! I went there a few years ago myself and learnt some pretty amazing things, and when I came home I told all of my friends. Now I noticed that when people asked you about stuff that goes on in North Korea, you basically had no idea what to say and stuck to what your script writer had written.

But you're our prime minister! You could be telling the Australian public and the world so many more important things! I can think of nine right now!

1. Why don't you say something about the 200,000 people that are detained in the concentration and detention camps, or how about the 400,000 people who have died due to torture, starvation, disease and execution?

2. Or how about mentioning the infanticides, the rounding up of the handicapped & elderly, the persecution of Christians, and the political manipulation of the Great famine?

3. Or about mentioning the great confiscation? You know, how at the end of last year everyone's money was confisticated and replaced with the new currency that wasn't worth anything?

4. Why don't you tell the people about Bureau 39 of the North Korean Workers' Party? You know, the group that are responsible for drug dealing, counterfeiting and missile sales all on behalf of the government?

5. Why don't you say something about how China forcibly send back all North Korean refugees to be "repatriated" which actually means to be killed? You know, those public executions that all of those eyewitnesses have seen? And how last month 31 people were sent back? You could have stood up for humanity!

6. Why don't you say something about how China continually props up the regime? Maybe you could sanction Chinese finanancial institutions that are acting as conduits for China's aid to North Korea?

7. Why don't you tell people that distributing mobile phones inside North Korea would be a great way to get the people to start communicating with each other? You know, so they can talk, meet up, and maybe start working out a way to get themselves out of this mess?

8. Or why don't you tell everyone how much it'll cost the world for when North Korea officially becomes a failed state? And that we haven't actually yet sat down with the South Koreans and the Chinese and worked out who will have what role when the country eventually collapses?

9. Or why don't we impress on the DPRK "three no's": No more bombs, no better bombs (which means preventing further nuclear testing), and no export, in return for one yes -- our willingness to seriously address North Korea's fundamental insecurity.

If you can come up with a tenth that'd be great.