Saturday, August 19, 2006

Yet another geeky post :-)

I have just added the last features to the database application and squished the last bugs. I must admit that I feel proud when I look at this little program. The 77 KB of source code is probably miniscule compared to what other people are writing, but it's by far my biggest project so far. And I'm quite pleased with the result:

  • User friendly GUI using wxWidgets.
  • XML based database, making it easy to import/export data.
  • Cryptography based on XTEA (in CBC mode) and MD5.
  • Portability (should compile on Linux, Mac and MS Windows with only minor changes).
  • Stability. I have written several test cases and spent a lot of time on error handling.
The thing I like the most i probably the XML library that I wrote. Using XML is neat because it is so flexible. And it's easy to import/export between different programs as well. A reader of this blog (Gamegod) suggested that XML might be too slow. Fortunately, the worst-case scenario is about 5000 records in the whole database, and only one search per second, so speed is not really a concern.

Writing and testing the program took a lot longer than expected, but I've heard that it's often like that in the software development business. Overall, I'm quite satisfied, but there are a number of things that I would probably do differently if I got another programming task like this one.


Language: C++

I like C/C++, but now I'm beginning to understand why people like Python and similar languages so much. I spent too much time manually allocating memory and making sure it was released again and similar things that higher-level languages take care of automatically. I think Python might have been a better choice, even if I had to learn how to use it first. Its superior string and list handling capabilities would probably have saved me a lot of time.

Another thing about C++ is the long compile times. A typo, a misspelled identifier, a missing semi-colon etc. that cause the compiler to fail, is very time consuming and an interpreted language like Python would make development much faster. If I had an IDE with built-in syntax checking, that would help a lot, though.


IDE: Dev-C++

Using Dev-C++ was nice in the beginning, but it has a lot of shortcomings and a few bugs. Using another IDE with better code completion features and better stability could have saved me quite a bit of time, especially because I'm quite new to most of these things and don't know the function names and their syntax by heart.



GUI library: wxWidgets

wxWidgets is a nice library. It's easy to use and has a lot of features. However, combined with C++, the compile time becomes annoying. Using wxWidgets with Python would probably have been a better solution. Another thing is that I didn't know wxGlade when I started coding, so I spent a lot of time writing GUI code that could have been written for me automatically. wxGlade is a great tool and highly recommended if you use wxWidgets. On the other hand, I probably learned more about wxWidgets from writing the code myself than I would if I had used wxGlade right from the start.

wxWidgets' error handling, though, is an entirely different matter: it's virtually non-existent. This cuased me a lot of headaches when my program mysterioysly started to crash whenever I closed certain dialog windows. After hours of work, it turned out that you shouldn't make pointers to wxSizer members of a wxDialog. I don't know why, and I didn't find anything about it in the documentation. An error message from the library would have been very helpful, since I was left pretty much in the dark by the standard crash messages in Windows.


Anyway, I won't be programming much in the near future, so stay tuned even if you don't care about technical gibberish ;-)

Monday, August 14, 2006

24 reasons not to update your blog

He can take out an army all by himself. He saves presidents and prevents nuclear holocaust. And more importantly: he saves manages to entertain me at a time where I must admit that I'm rather bored and much in need of any kind excitement. Three words: Jack is back (ie. season 5, on Danish tv). I know from experience that the episodes will probably get gradually less and less entertaining, but right now, I don't care. They're showing a new episode every day, which is why I haven't written anything here the last few days, and why I have to end this post here ;-)

Friday, August 11, 2006

Being a software developer

My father has hired me to develop a database application for his company. I don't have much practical experience, so development has been slow, but these last days I feel like I'm really getting somewhere. For the geeks reading this blog: I decided to use XML for the data, because it's more flexible than eg. an SQLite database. I decided to write my own XML parser from scratch. That way I'd probably learn more than by using an existing XML library. It took me a while to write, but it's almost done now and it saves and loads simple XML files. For the GUI I decided to use wxWidgets, because it's cross-platform and because it supports printing, unlike eg. FLTK. The only major downside of wxWidgets at the moment is the long compile times.

It's getting late, so I'll continue this later. Hopefully there won't be so long between updates in the future :-)

Friday, August 04, 2006

Back from the dead

It happens to all bloggers at some point: life catches up with you. And I am no exception. It caught up with me, and hopefully will continue to do so once in a while :-)

Sorry to keep you waiting. I didn't realize it's been over a month. But then again, I have been busy with a lot of things.


The festival, Roskilde 2006, was great. First of all there was the music. We had Arctic Monkeys, Tool, Bob Dylan and many others, both Danish and International bands palying there. The best experience was my discovery of some great jazz bands (I don't remember the names right now). I've never really listened much to Jazz, but I guess that's about to change.

Then there the movies. There was a free cinema with movies playing all the time. I'll save the in-depth reviews for a later time, but for now I'll just recommend Kiss Kiss Bang Bang and Dark Water to all of you reading this blog.

And finally there were a lot of old friends, whom I wish I'd see more often.


Afterwards, I went to Spain for a week for the IUSY Festival, but that's a whole other chapter.


Touching on the subject of music again, I have been practicing, perhaps not as much as I should, but more than I'm used to, so I guess things are moving in the right direction. For those who're interested in that sort of thing, the pieces I'm currently practicing are Impromptu Fantasie by Chopin and the maddeningly difficult Etude in C# minor Op. 42, nr. 5 by Scriabin.

So the conclusion, I guess, must be that I'm actually back from the living, but that would sound silly as a headline :-)