Monthly Archives: May 2006

Unsupported Frameworks…

Programming with a framework that you’ve developed can be annoying, when you compare it to the ease of IDE-supported frameworks. MFC is a nice framework primarily because Visual C++ has so much built-in support for it.

My little framework has no such support (and I have no ambitions to build in IDE support for it) and that can make it frustrating to do all the repetitive stuff (making the initial window, message handling, for examples).

Another thing that MFC does that I want to avoid is make extensive use of macros. Macros are evil in my book. I’ve been bitten. I know they can be useful in limited circumstances, but MFC accomplishes a lot of its magic with macros. And unfortunately, that’s why it can sometimes be a problem–it becomes magic instead of straightforward code.

Esha

 

We miss our sweet Esha. She has really left a big empty spot in our house and in our hearts. This is how we will remember her; sitting in her favorite place; watching over the front garden.

2 Feb 1996 – 15 May 2006

 

 

Windows Media Player 11

The best media player just got better.

At work, I just downloaded the new version of Windows Media Player 11 in beta. From what little I’ve used it, it’s a HUGE improvement.

One potential thing I slightly miss is that I can’t view albums in the left-hand “browser” and the tracks in the right-hand “content” view. This allowed me to easily move tracks to differently-named albums during editing. But maybe there is a way to do it, or a completely different technique altogether that works just as well.

Also, the readme notes that there are potential problems with IE7 Beta 2, which I have at home. I’ll give it a try anyway and blog my results.

 

Flightplan

We just watched Flightplan on DVD, and I have to say I thought it was a pretty good movie. It was interesting how it made you feel by taking place completely on an airplane (albeit a very large one). There were some weak moments, but all in all it kept me interested.

Programming as a hobby

People are often amazed when I tell them that programming is not just a job–it’s also my hobby. I know that it’s one of the main reasons I was immediately considered for the job I have now. After looking at my cv, my now-manager headed to my web-site and saw that I had done a number of personal projects.

It’s the whole reason I think I have excelled beyond everything I’ve learned in school in the last few years. It’s one of the reasons I’m learning so much practical knowledge. Working on my own projects lets me do fun things at my own pace (I still try to apply some pressure to get things done). I always try to do things I’ve never done before.

I learned a TON making BRayTracer–about program organization, unit testing, optimization, user interface design, architectural levels, and a whole lot about .Net. There are still so many things I want to add to it so I can learn more.

It’s not something you can do just in an attempt to prove to future employers that you’re hard-core. You have to love it. There are a lot of other fun things in life. I just happen to love writing code, and I try to spend a lot of time outside work doing just that.

All other things being equal, somebody who programs as a hobby will be a better programmer than one just in it for a job.

Finding time is always difficult, though. Work is stressful, and sometimes you need to get off the computer. Still, I’ve got some cool utilities planned, a pocket pc game, and who knows. I’m keeping track of ideas, and I’ll just have to start small and work on one at a time.

What’s Wrong with this code? – 2 – Answer

In the last post, I showed some code that had a very simple problem.

The problem is that when you call HIWORD, it converts the 16 bits into an unsigned short, which then gets passed as an int padded with zeros–not sign extended (it’s not signed). It will NEVER be less than zero. The solution is to cast it to a signed short before calling the function or change the function parameters to be signed short instead of int.

 

The First Thing in an XML file needs to be…

I just discovered a fun tidbit of information. I was using NUnit to test a number of assemblies in a single project, and many functions need an app.config file. The instructions on how to do this can be found in various places, but I was having a problem that nobody else seemed to have.

My config file looked like this:

<!– config values for nunit –>
<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
    <appSettings>
       <add key=”…” value=”……” />
    </appSettings>
</configuration>
    
    
   

Every time NUnit started up that project, it would fail with an assembly load error:

System.IO.FileNotFoundException : File or assembly name nunit.core, or one of its dependencies, was not found.

For further information, use the Exception Details menu item.

My first thought to that was “Huh?!” It was a highly annoying problem, because I thought I was following the instructions exactly and it should have worked!

Do you see the problem? It’s this line:

< ?xml version="1.0" encoding="utf-8" ?>

It needs to be the first line in the file (or taken out completely). Voila, everything works.