Lachlan B's Blog

Yeah, it was but whatchagonna do

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 here's a personal favourite:

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.

Modernising church worship music vs keeping it traditional

Mark Peterson recently wrote an article titled Contemporary v Traditional: 8 reasons it's hard to choose. I'd like to comment on this issue as it is one that is very close to my heart!

To be upfront - I play guitar. Not wimpy acoustic guitar, but screaming 80's metal guitar. I like to lather on the distortion and see how fast I can play:

I don't have much of a choice. I love heavy metal. I LOVE it. I can't play piano, I can't play hymns, and I don't have a clasically trained voice. With that in mind, I think there are some guidelines that we can follow to determine if we should be playing contemporary or traditional music at our church.

Let's say I turn up to church, and there's one hundred people in the congregation. Everyone is older than 70, and they are eager to get down and start belting out the hymns. If I was to turn up with a big rock band, cranked it up and started playing Hillsong tunes, it just wouldn't work. People wouldn't be able to sing, the rhythm that I'd be using would put them off, songs wouldn't sound how people are used to hearing them... it would be a disaster. The purpose of playing music is to encourage people to worship God with their voices, and boy would the music style be absolutely detrimental. It would honestly be better if I hadn't played at all, and perhaps a better option would be just to sing the songs acapella.

On the flip side, if I turn up to a Planet Shakers youth service and start playing "Onwards Christian Soldier" on an organ, people wouldn't know what to do. They wouldn't know the song, wouldn't be able to sing, etc, it just wouldn't work.

So in these specific scenarios it's actually quite easy to determine the style of music needed. So what do we do when we're in a grey area? What if there are a broad mixture of ages and cultures at our congregation? (The way church should be?) Perhaps one solution is to do both. Two hymns on the organ, two modern contemporary songs. But this isn't going to work. The oldies will hate the new stuff and the youngies will hate the old stuff. Unless you have a complete congregation of very mature and graceful Christians (and really, you shouldn't!), this too isn't going to work.

This is where the difficulty sets in.

Ultimately what most people do is to find a mixture of the two. Play a few contemporary songs in a way that isn't too in-your-face, but will still encourage everyone to sing. Do a couple of hymns but incorporate a solid 4/4 beat. Change the tempo, change the key, change the rhythm, anything to make it work. (Except don't change the lyrics... pick a different song instead :) If you're in a fortunate position where you have enough gifted musicians it can work amazingly well. With enough prayer you can satisfy the needs of the majority of the mixed congregation.

This is where most people call it quits. Try to please everyone, find a middle ground, and voila. Everyone's happy.

But is this what we're aiming for? Are we just trying to please everyone within the congregation? Hang on, isn't our job to encourage people to worship God? Or are we just trying to make them happy?

In the past 50 years or so there has been an explosion of new musical styles. From 50's rock'n'roll to modern hip hop, a huge number of styles have been introduced and revolutionalised music. Jazz, Reggae, Rap, Pop, Electronic Dance music, Heavy Metal, the ever-expanding sub genres of Rock, Country music & Folk music to give a quick list. Alongside with the development of pop culture, religion is rapidly being seen as outdated, irrelevant and antiquated in a modern, civilised society. This is a photo my band playing a gig... it doesn't really look like church music to me.

Toehider rockin out

As church music leaders, we have an obligation to ensure that church music, and therefore Christianity, does not have a perception of "belonging in the past".

Monday morning's conversation at work normally goes "So, get up to anything on the weekend?" I cannot tell you the number of times where I have told people that "Yeah, I played drums at church" and the response is normally astonishment. Most people don't believe me. I tell them that we had drums, bass, guitar and few singers and to some people the concept of modern music in church is unheard of. "You can't do that" or "What do the (old) people say?" are the usual responses, as the average Australian pictures "church" as being a bunch of old people sitting in pews, doing their weekly penance and singing a few hymns. In their view, in a few decades the church will have disappeared as the older generation dies out, and civilisation can move on from those dark times. This is genuinely the perception that most Australians have. Unless they actually know someone under the age of 30 who goes to church. I have met a lot of Australians who in their mid-thirties have never even met a christian. To meet a Christian who seems like "one of them" (or at least can converse with them in their language) is often a revelation.

With all that in mind this is a long way of pointing out that if we don't continue to modernise the music at our churches, the church will indeed turn into a relic of a by-gone era. This is indisputable. If we stuck to pipe organs in churches, only a few die-hards will remain and over a few years it will all fizzle out. How much we modernise and to what extent remains a variable that must always be examined given the unique situation of your church.

By the way, the tenth commandment isn't "You must make your music sound MODERN". But I do think I think that deliberately modernising the music at church is an appropriate response to our current cultural situation in Australia.

A favourite passage of mine is from Psalm 150:1-6:

Praise the Lord!
Praise God in his sanctuary;
praise him in his mighty heavens!
Praise him for his mighty deeds;
praise him according to his excellent greatness!

Praise him with trumpet sound;
praise him with lute and harp!
Praise him with tambourine and dance;
praise him with strings and pipe!
Praise him with sounding cymbals;
praise him with loud clashing cymbals!
Let everything that has breath praise the Lord!
Praise the Lord!

Yeah! That's what we want. (I particularly like the LOUD CLASHING CYMBALS part.)

So what's the essense of this chapter in psalms? "Let everything that has breath praise the Lord!" Everything!

Will playing contemporary music guarantee the survival of your church? Not at all. Will people be saved due to the music alone? Probably not. Will it guarantee that your church won't disappear? Probably not. Should we be ensuring that our church remains relevant to our society and culture? Of course we should. It is our duty to talk to non-christians, answer their questions, get to know them and love them (and our joy). By playing daggy songs from the 70's every week and expecting them to "put up with it" or somehow realise that we're not stuck in the past, we are essentially thumbing our noses at our culture and putting a giant obstacle in the way of their faith.

It is our job to encourage "everything that has breath" to praise the Lord. So as a result, I play acoustic guitar most weeks. (I had to go out and buy one!). I don't play guitar solos. I encourage everyone to sing, and I try to make it as relevant as possible to everyone who attends. It has been a very long and drawn out battle - possibly the longest of my life, but we are getting there.

I only hope that other worship leaders will do the same.

(If I had my way, all church worship music would be like this).

Mick mc: Hey Lachlan
Some good thoughts there. As a 50+ proud ACOUSTIC guitarist who has been playing worship music of one flavour or another for over 30 years now, I totally get where you're coming from.
For me it has more to do with "what culture is the leadership of the church trying to grow, foster, develop & or model?
Every aspect of ministry within a particular church should be part of that discussion; every ministry should be using all of its ability to help the church fulfil that mission/vision in any given season.
For my part that has been long seasons of turning up & just serving the church with my playing, balanced against seasons where I have been given free reign to help design & create moments of wonderful depth. People think it's about the volume, or the instruments, or the multi media or the style of music. Essentially it isn't; it's about the culture of the church & how we all best serve that culture. What we do has to be defined by that.
Mind you, I like it loud too!
18th of Mar, 2012 11:26

Rob G: Lachlan, your are a product of your environment! Just like everyone else is. Just because the oldies environment uses an organ for worship, that is what they are comfortable with. If it wasn't for your dad playing guitar, jazz, rock, 80's stuff, then you might like worship using the flugal horn perhaps!!
I agree everything we do praises the Lord. How we do that is making that connection with our own spirit, that intensely spiritual process in the use of music. By the way I love your you tube stuff.
19th of Mar, 2012 4:27

Kim Jong Il knew how to turn on a light

Hey look, according to the official North Korean news, Kim Jong Il knew how to turn on a light for chickens!

Hey and for bonus news, a fire happened somewhere in Australia.

Incredible news reporting.