The Coding Monkey

Wednesday, November 30, 2005

Not On the Flock Bandwagon Yet?

I don't blame you one bit as Flock is still pretty raw... but if you use Firefox, and also use, you need this plugin. You can read about all the features at the blog. Enjoy!

Monday, November 21, 2005

Research We Can All Use

First off, Slashdot points us to this very important bit of research... How to write unmaintainable code. Before you go there thinking this will actually be an informative article on good programming practices, think again. This really is an informative article on bad programming practices, and why you would want to use them. If you read this, and then say to yourself, "Gee, I should start doing this stuff too", then stop coming here. I don't ever want to see you again. OK... maybe it's mostly written tongue in cheek... but I am serious about disowning you. Don't think I won't.

On a more serious note, the Microsoft Font Blog has an interesting post on the way that we raed mssipelled words. It's actually very enlightening, and a pretty cool look into how our brains work. As a small aside, after reading this I don't feel nearly as bad about how I sometimes have to correct my blog weeks later. Being somewhat of a perfectionist, I often times get upset at myself when I re-read what I've written and find little spelling goofs (and quickly correct them, even weeks later). I do edit my work when I write it, but my eyes often times glance over casual mistakes because the thoughts that I wrote are still fresh in my head, and I still see those thoughts on the screen, instead of the actual words.

Saturday, November 19, 2005

Microsoft's Education Problem

I recently was talking to my brother-in-law about a whole slew of different programming topics. My brother-in-law in many ways has been a mentor to me in my software career, and is a brilliant software engineer (even though he doesn't have an engineering degree). He really needs to get back to blogging, because he could provide a lot of good insight. During our discussion, he brought up the fact that he just found out that you could embed files as a resource stream in a .NET assembly. I was taken back for a moment... not because I didn't know you could that, but because he didn't know you could do that. That's actually one of the common tools in my programming arsenal. Later on that night it really struck me. Microsoft doesn't do a good enough job in educating it's programmers with .NET.

Microsoft has created a huge framework in .NET. It's so huge in fact, that people don't really know how big it is, or what is contained in it for you to use. I don't know how many times I've gone into a company and seem them writing code to do some task, when the majority of that code is already contained in the framework somewhere if they just knew where to look for it. The majority of Microsoft's marketing and educational campaigns to date have concentrated on two main things. First they push their languages, and second they push their tools. People know a lot about the nuts and bolts of C# and VB.NET, and they know a lot about the productivity enhancements contained in the various versions of Visual Studio.

But did you know that the Windows Forms editor is actually a part of the .NET framework which you could host inside your own application if you knew how? Did you know that if you wanted to output well formatted HTML to a text file in a windows forms application (as opposed to an ASP.NET app) that you could use the XmlTextWriter to do it, and it would be significantly easier than using simple strings or StringBuilder? A lot of people know that .NET has a support for regular expressions, but did you know that it also has the ability to create an assembly of precompiled regular expressions that you can use as a regular expression library?

Of course I'm really just scratching the surface here, but you get the idea. So as a public service to the .NET community, I'm going to start a new series of posts here at The Coding Monkey called "Did You Know You Could Do That?" where I'll hopefully shine the light on a feature of the framework that you didn't know existed before, or that you didn't know how to use. Look for it soon.

Thursday, November 17, 2005

More on Pronunciation

A couple days ago I blogged about confusion in the software industry over certain terms... and ended by talking about confusion with pronunciation of other terms. A friend of mine decided to send me links to a couple things on Bjarne Stroustrup's site that seem especially relevant. The funniest was his FAQ, which among other things explains how to pronounce his name:

It can be difficult for non-Scandinavians. The best suggestion I have heard yet was "start by saying it a few times in Norwegian, then stuff a potato down your throat and do it again :-)" Here is a wav file.

For people who can't receive sound, here is a suggestion: Both of my names are pronounced with two syllables: Bjar-ne Strou-strup. Neither the B nor the J in my first name are stressed and the NE is rather weak so maybe Be-ar-neh or By-ar-ne would give an idea. The first U in my second name really should have been a V making the first syllable end far down the throat: Strov-strup. The second U is a bit like the OO in OOP, but still short; maybe Strov-stroop will give an idea.

Yes, this probably is the most frequently asked question :-)

P.S. My first name is Bjarne - not Bjorn (not a name), Bjørn (a related but different name), nor Barney (an unrelated name). My second name is Stroustrup - not Stroustroup, Stroustrop, Strustrup, Strustrop, Strustroup, Straustrup, nor Straustroup (documents using each of these misspellings can be found using google).

He's really pretty funny. Too bad he doesn't have a blog.

Tuesday, November 15, 2005

Name That Term

I had a conversation recently with another programmer... which was a bit confusing... if only because we kept using terms that we thought the other would understand, but didn't because they understood that term to mean something else. Understand?

Our industry is chalk full of buzzwords, paradigms, and models, and a lot of other things that generate confusion. So what are some of them?

Object: The most overused word of them all! The object of this object is to objectify the objective of this other object. Everything is an object, whether someone is actually referring to a class definition, a physical instance of a class in memory, or a requirement for a class. It's not just women who have to deal with objectification... programmers deal with it on a daily basis.

Metaprogramming: This one got me last night. When I hear metaprogramming, I think immediately of metadata... which makes me think of Attributes being used to mark classes, methods, and assemblies in .NET for use in Reflection. This got super confusing because the other person was talking about metaprogramming in its more traditional sense where one program is used to write or manipulate other programs. In this case, it was using C++ template specialization to do some hard core stuff with the template preprocessor. They are related... but really involve two very different aspects of the same concept.

Modal/Modeless: I discussed earlier what happens when non-technical people try to sound technical by using terms that don't exist. Confusing modal and modeless is a great example of that.

ActiveX: I haven't done COM programming in a few years now, but back in the day I was pretty hardcore into COM/ATL and ActiveX. When I was working at Rockwell Automation... towards the end of the ActiveX reign on the Windows world... it was hilarious to see the marketing guys push ActiveX on us. Everything had to be ActiveX. They wanted to start using it just as everyone was stopping using it. Someone in that department heard the term, love it, thought it was all the rage, and so whether it made sense or not, we all needed to be writing them. Of course they didn't really know what they were for... but that never stops someone in marketing. In reality though, there were lots of programmers who were just as confused by ActiveX and how it differed from COM and OLE. To be clear for those who don't know... an ActiveX control was a specific type of COM control which implemented a specific set of interfaces (there were 13 I believe). If you didn't implement them all, it wasn't an ActiveX control.

Of course... it's hardly fair to talk about terms, without talking about how people pronounce certain terms. You'd be amazed at how serious some people get about it... almost to the point of religious fervor. Is GUID a Gooid, or a Gwid? And should you even use the term GUID anymore... and instead use UUID? Is it Linux pronounced with a long or short i? There are some who confuse matters even more by pronouncing the u in different ways. Is SQL pronounced S-Q-L or Sequel? Is OLE spelled out too... or is it Olé?

Are we all a bunch of geeks for caring so much about something so unimportant? Well... duh.

Saturday, November 05, 2005

Meet the Flockers

I have a pretty general rule about my computer. I don't install two programs that both do the same thing on my machine unless I have a very good reason to. I find one program that does what I want it to do, and I learn how to use that program very well. Once I have decided on the program for my particular purpose, it is generally very difficult to get me to switch away. You have to make a very good case for it. As you can probably guess from my blog, I'm a Microsoft junkie. I've grown up in my programming with Microsoft technologies, and have gotten very good at using them, so it should come as no surprise then that I use Internet Explorer. I used to use Netscape way back when during the old browser wars, but they eventually lost my allegiance when they tried to shove too much into the browser that I didn't use or want. Around that time Internet Explorer had matured enough to win my favor, and it's had it ever since.

When Firefox came out, I will admit I briefly toyed with it. I emphasize briefly. Having sold myself long ago to the Microsoft devil, the "Use Firefox because Microsoft is evil" argument never persuaded me. I don't use one software package just to spite the other company. If a package does what I want it to do, and does it well, then I use it. Believe it or not, the "Firefox is more secure" argument never did much for me either. My contention has always been, and I think recent security reports verify the belief, that Firefox is just as insecure as Internet Explorer. The reason it appeared not to be was because it wasn't popular enough to be a target. As soon as enough people started using it, hackers decided it was worth their time. So for a short time it may have been artificially more secure, but that is quickly changing. In the end I looked at Firefox and saw a less mature piece of software that did the same things that Internet Explorer does. So why should I switch?

Then came Flock. For those not familiar, Flock is a new browser that is based off the Mozilla source branch (like Firefox). The reason it intrigued me when I first saw it talked about on Slashdot was because I saw that it wasn't just another browser that does the same things all browsers have always done. For some time now, I've been for managing my Favorites. Sure Firefox and Internet Explorer can make use of them, but it's not elegant. I've always felt like my favorites were glued onto the side of my browser, instead of built in. Flock uses specifically for managing Favorites, and makes it an integrated piece of the program. Now that is cool.

Obviously I also blog... you are reading this after all aren't you? Sure there are plenty of third party applications that I could use to publish to my blog, but all of them are once again either separate applications, or crappy popup windows that I get in an Internet Explorer or Firefox toolbar. If I want to blog about something I read somewhere, it takes all sorts of extra steps to go from that blog, to my own. Once again, it always felt like my blogging experience was duct taped to the side of my browser. Flock goes to the trouble of integrating those features as first class parts of the browser. Have a Flickr photo album? You can browse through your album (or any other), post pictures to your album, and post photos to your blog all in one step, integrated right in the browser.

Some have suggested that Flock is an answer to a question that nobody asked. Perhaps for many this is true. But at least for me, it is the answer to a question I didn't know I could ask, but wish I had. If you don't use Flickr,, or don't blog, then it's true that there is no reason for you to switch to Flock. But if you do use any or all of them, then Flock will offer you an experience that is very worthwhile. Now then, with all that said, I'm not making the full switch yet. I still primarily use Internet Explorer. But Flock is installed, and I use it now and then to see how things work, and I'm definitely following the builds as they are posted. It's not ready for prime time yet, but of all the browsers I've tried so far, this is the one that has the best chance of replacing Internet Explorer for me.

Wednesday, November 02, 2005

How Come The Application Broke?

Today one of my project leaders came by and asked for help figuring out why one of our production systems that I helped work on broke suddenly. We hadn't touched the code in months, so we had no clue what would have suddenly changed. My initial thought was that because it threw an unknown exception at application startup, some needed libraries had been removed or something. After doing a couple minutes of debugging, we found out the problem was a little simpler than that:

StartDate = New Date(Now.Year, Now.Month + 2, 1)

EndDate = Date.Now.AddMonths(2)

And yesterday was November 1st! Doh! Sadly... there is no 13th month in the year, and the Date constructor doesn't rollover properly in this case. Thanfully I didn't write this code... but still had to help fix it. Don't you hate it when really trivial stuff kills you? Hmmm... sorta like Office Space:

Michael Bolton: Ok! Ok! I must have, I must have put a decimal point in the wrong place or something. Shit. I always do that. I always mess up some mundane
Peter Gibbons: Oh! What is this fairly mundane detail, Michael?!!!!!