Dec 10

Wow, it’s been a busy year. Last month I passed the foundation exam for my Microsoft Certified Technology Specialist exam and started on the second module. You only need two modules to get the certification: the hefty foundation exam and then a choice from WPF, WinForms, ASP.NET, WCF and a few more. I haven’t done much WPF but thought this would be a fine chance to learn and aim to hit full qualification by the end of February.

The foundation course covers the fundamentals which every .net developer ought to know: threading, appdomains, file access and streams, events, permissions, deployment and so on. Pretty basic stuff but covered in depth. It’s a shame that many developers are still cynical about these types of certification, but I think it’s an easy way to demonstrate a base level of skill. And the exams are apparently a lot harder now than they used to be. Still, if you do know your stuff I don’t think it’s too much hard work and it won’t take an age to complete. It’s possible to study for the exam purely by reading and completing the exercises in the textbook and without paying for expensive courses. It took me a couple of hours each weekend for about six weeks and then two days of cramming before the exam.

While I’m on the subject of learning, I’d also recommend this SQL Server book. We build a lot of data intensive apps and tend to do most of the data processing on the SQL Server to reduce latency. This makes query performance a likely bottleneck and concurrency a likely issue. Unfortunately SQL seems to be one of those languages like VBA and Javascript that developers just pick up on the job and learn by the Google Method. If you want to know how to safely and efficiently execute dynamic SQL, use transactions, prevent locking and generate efficient execution plans, then this book is a good place to start.

Tagged with:
Feb 24

Regex is something that’s scared me for a long time. Previously I thought it only to be understood by Indiana Jones coders and only with the help of a wax crayon, a sheet of tracing paper and a secret book of biblical drawings. But this morning I discovered otherwise.

I’ve been studying for the Microsoft Certified Technology Specialist foundation exam, reading through and writing code from this big book. I whizzed through the first two chapters with massive enjoyment, then came to regex in the third chapter and hid the book in a drawer for a month being too busy to look at it. It’s not that it’s overly tough, it’s just tough enough to put you off with loads of weird characters in undecipherable sequences that are not very intuitive and require committing to memory. Check this out:

        static bool IsZip(string s)
        {
            return Regex.IsMatch(s, @"^\d{5}(\-\d{4})?$");
        }

It’s a piece of regex to accept US zip codes which can either look like 90210 or 90210-1111 (5 digits or five digits dash four digits). It doesn’t look too inviting does it? But let’s break it down:

^ Means match from the start of the line

\d{5} Means match 5 digits (5 numerical characters)

\- Means match a dash

\d{4} Means match 4 digits

(\-\d{4})? Together means optionally match a dash followed by four digits. The ? means optional and the parentheses means you have to have a dash AND four digits. So it will accept a dash and four digits, or nothing, but not a dash alone, or four digits alone.

$ Means match the end of the line. This is important. If you miss this you could end up accepting 90210beverlyhillscopsucks as a valid zip code.

Piece it all together and you feel a bit like Indiana Jones. Unfortunately deciphering this regex string hasn’t led to a quest to the Brazilian rainforest to dig for skulls in haunted caves, but we’ll see what the rest of the MCTS book brings.

The important thing is that like Mac and that water heater thing in the basement from Home Alone - I’m not afraid anymore.

Tagged with: