Posts Tagged ‘Programming’

This Is Pretty Handy

January 1st, 2006 No comments

This website is probably the best introduction to BSD socket programming that I have seen. It breaks down a lot of the information into clear chunks, and even explained somethings that I still had some questions over.

The only slight problem with it is that it falls into the trap a lot of other tutorials have, and does not properly use PF_INET and AF_INET in the appropriate places, and instead just uses AF_INET (which is wrong, but will still work).

Categories: Uncategorised Tags: , ,

Oooh, Good Point

December 16th, 2005 No comments

I quite often read “The Old New Thing“, one of the Microsoft MSDN blogs – it actually contains some quite useful Windows API programming info, as well as quite a nice insight into the workings of Microsoft, and the historical reasons for the way Windows works.

Any, today he’s posted about why running applications off of a USB memory stick is probably not a good idea.

Categories: Uncategorised Tags: , ,

This is truely amazing

December 13th, 2005 No comments

You need to understand the story of this one, and have an understanding of how relational databases should work for it to make any sense.

This guy “Jay”, should be fired. That’s not a joke. If he is using a relational database system, and he is creating a new table per order, then he does not understand any of the principal rules, and workings, of an RDBMS. I would hate to think what his code would look like, and the speed at which the information would execute is just ridiculous. Essentially, he has created a new file (with the database table overhead, once per file) for every single customer order – that is just wrong, incorrect, and incompetent.

Fire him!

Categories: Uncategorised Tags: , ,


December 7th, 2005 No comments

Jesus! How dodgy is this bit of code?

  * $Id: clearmem.c,v 1.1 2003/06/29 20:41:33 decibel Exp $
  * Utility to clear out a chunk of memory and zero it. Useful for  flushing disk buffers
int main(int argc, char *argv[]) {
     if (!calloc(atoi(argv[1]), 1024*1024)) { printf("Error allocating memory.
"); }

Categories: Uncategorised Tags: , ,


September 29th, 2005 1 comment

Following on from Richard’s recent Rant about XML being too complicated (a sentiment that I whole heartedly agree with), a colleague of mine discovered “OpenLaszlo“.

A quick look at the “The OpenLaslo Platform” section on the home page says it all:OpenLaszlo applications are written in XML and JavaScript — just like DHTMLNo, no no no no! It’s just wrong! XML is not designed to be used for writing applications! It is a data description language, not an event driven architecture!

To all you system designers out there: XML is a file format. Nothing else. It can be used for lots, agreed, may be even too much, but it is nothing more than that. Stop using it for every bloody application you can put your mind too – find a more appropriate tool. It is like using a screwdriver handle to bang in a nail – it will get the job done, but you’ll knacker the screwdriver, it will take bloody ages, and you’ll end up putting the screwdriver tip through your hand!

Categories: Uncategorised Tags: , ,

Life And Death Balances Around the Letter E

August 30th, 2005 No comments

OK, so I write software for a living. I’ve always known that there are people out there who write some very critical software (e.g. Hospital heart monitors, Aeroplane control systems, etc, etc), but I’ve stayed clear of that so far, and instead my stuff is fairly non critical.

On Thursday of last week, I wrote a recursive procedure for something. We don’t use them very much on our project as there isn’t much need, but for my purposes, it suited it to a tee. I’d spent ages working on it, to make sure that it did eventually reach a base case, and therefore it wouldn’t end up looping infinitely.

Unfortunately, when I ran it, it blew up the database (to be more precise, the “Before Image” of that Webspeed Broker reached the maximum extent – for those of you who know Progress 4GL and Webspeed!). I eventually tracked it down to an error in the procedure which was causing it to loop infinitely. I was quite annoyed as I’d spent ages making sure this wouldn’t happen.

Anyway, I tracked down the bug to one line. Instead of checking if a date was greater than an input date (“GT” operator), I had checked if it was greater than or equal to the input date (“GE” operator). It’s amazing how much effect that one letter has.

Today, I was thinking, “Bloody hell, I blew up a database with one letter. What if I’d been writing Aeroplane controls. I would have killed several hundred people.” I know that those kind of software projects are formally specified, and have code reviews, etc, etc, but the potential is still there for this sort of thing to happen. Hopefully, this would have been found in testing, but things do slip the net (and quite frequently).

I’d better learn to type more accurately…..

Categories: Uncategorised Tags: ,

An Interesting Bit Of Info

August 23rd, 2005 2 comments

This is an interesting bit of information, as it presents a graph of KDE’s CVS (and now SVN) commits (per month) since the project started. (Click on the graph picture to get a bigger version)

It shows the standard peaks and troughs as you would expect, and the fact that the number of developers working on the project has increased, etc, etc.

The really interesting thing is this: The project founder “Coolo” has peaks and troughs in the number of commits per month (as is to be expected), but his peaks and troughs seem to roughly match those of the entire project commits.

So what goes on in those months that seems to completely flounder KDE development?

Categories: Uncategorised Tags: , ,


July 23rd, 2005 No comments

I’m beginning to truely understand now the real power of Object Oriented Programming. I’ve known about objects and reuse and all that stuff for ages, but I don’t think that you can truely grasp it until you end up doing what I’ve just done.

I have just added 2 new pages to the next version of this website (one of which was an RSS feed), with about 5 minutes work on each page. Everything just worked. Brilliant.

What makes it even more enjoyable, is the fact that I designed and created everything myself. God, I’m good!

P.S. Next version of website is coming soon – similar look and feel, more features, fewer bugs and XHTML.

Categories: Uncategorised Tags: , ,

UML Description

July 1st, 2005 No comments

I’ve been using Umbrello on KDE for sometime, and unfortunately it’s pretty unstable (especially when generating code), however, I don’t think that this is an unsolveable problem, so hopefully the product will mature with time (I wish though, that the developers would spend more time on this issue rather than adding new features).

What I did discover the other day though (and although I’ve read this several times, it never really sank it how it is!) is that it has a very good description of UML, and how to use it, as part of it’s help system. If you’re new to UML, or just aren’t sure on how it all works (which is how I sometimes feel), then I would advise reading the manual – it really does seem to explain it in a way that a programmer would understand.

Categories: Uncategorised Tags: , ,

XML Music Library

June 7th, 2005 1 comment

I’ve been thinking recently about an standard XML music library format (I’m probably thinking about reinventing the wheel here – some one shout if this kind of things exists already, which is probably does). I reckon it would be pretty easy to create one which would defeat a lot of the problems that I have discovered with other systems.

My main advantage would be tagging, and referencing. First I should explain that I am going to base the library around a “Song” (N.B. – This does not mean a file). I can then give the song a name, a main artist, year of release, etc. I can then employ tagging to tag a series of genres to the song (letting me classify it into a series of genres, not just one), tag a song into a series of albums (think compilation CDs and “greatest hits” albums), tag extra artists to the song (think “featuring xyz”).

I can then use referencing to do the clever bits. Imagine I make a hash of the song name and artist (the actual hash function wouldn’t matter – you could [again] tag the song with multiple hashes, each one specifying the algorithm name), and store that as a “reference”. I could then link a song to another song simply by specifying the original song reference, therefore I could take in to account things like live versions, cover versions, mixes, album versions, new versions by the same artist, etc.

And seeing as it is XML, you could take it anywhere – cross platform, simple file format (so can be editted by hand if needs be), can be interpretted (either SAX or DOM) by a lot of applications, easy to backup, and can be interpretted into/exported out from a database.

Agreed the file could get quite large, but I think the benefits outweigh the costs.

Anyone got any objections?

Categories: Uncategorised Tags: , ,