Thursday 23 October 2008

One of life little problems - solved!

How long have I been programming? Since I was 8... that's 23 years, and hence I'm a little annoyed that I've only just come up with something that seems so obvious in retrospect.

It is a solution to the classic program formatting dilemma.

First a couple of examples;

// Java Standard
try {
XMLDocument response = agent.request(xmlRequest, logger);
} catch( FailureReport failureReport ) {
throw new GSSystemException(failureReport);
}

// C/C++ Standard
try
{
XMLDocument response = agent.request(xmlRequest, logger);
}
catch( FailureReport failureReport )
{
throw new GSSystemException(failureReport);
}
The above illustrates the difference between the 2 notations. The first, the IBM Standard Java format, is something I've never really liked since everything looks so bunched up - bunched up code is much harder to read - I end up putting random whitespace in anyway, but with no level of consistancy.

The C/C++ notion is much better in terms of readability, but doesn't have the symemtry of the Java Standard and suffers from a fatal flaw; it's not Java Standard!! :)

But we have the solution! How to write *almost* standard Java code with out any of the issues;
// Colin's much better method

try {

XMLDocument response = agent.request(xmlRequest, logger);
}
catch( FailureReport failureReport ) {

throw new GSSystemException(failureReport);
}
As you can see, it's exactly the same as the C/C++ notion, but with the brackets at the end, a la Java Standard but with the whitespace preserved... see what I mean about it being obvious?

The great thing is the only bit that isn't really standard is the fact that the "catch" clause is dropped to the next line - but I'm not sure that is specified anyway, since I've since lots of code with the dropped line... and no - I can't be bothered to check!

Wednesday 8 October 2008

Why I stopped worrying and learnt to love the UK MegaBase

Oooh - check me out and my multiple posts with in a month... :)

There has been a lot of talk for many years about producing a massive database of everything ever, so that the Government can spy on us, frame us for crimes we didn't commit and... er... tell us to pick up litter and the like. It's never going to actually catch terrorists, as well we all know. The latest idea being touted is another variation on the theme, only this time is just the secret service as opposed to the actual government, for all the difference that makes.

So... this is Government IT project... how much fear can be levelled at such a thing? Personally, for all the reactionary emotions it envokes in me, I can't actual worry about it. Not even for a minute. For a start the only comparable project was the 2.3bn HNS database which ended up costing 12bn... that is a ratio of 6:1 over budget. I'd also hazard a guess, the bigger the project, the larger the ratio by a matter of a an exponent rather than a fraction. Regardless, a 12bn project is going to cost at least 72bn if we take the model of the NHS database. This coupled with choice facts such as, would the project even be able to deliver all of it's functionality or would be massively scaled down to the point of uselessness - if indeed the bloody thing was ever actually delivered, again reduces my fear by significant amounts.

But the real clincher is this, if by some miracle the government can muster the exorbitant funds needed to achieve it, that it actually gets delivered, that it actually does a fraction of what it's supposed to do on the tin - what will have been created? We are talking a massive amount of data in what is most likely the most unsecure system ever built - this is the government remember - security is hardly a specialism when it comes to data. This is down to it's nature - the system is going to have everything (or lots of things depending on the variations of scenarios) fed into it, from so many channels it will intrinsically unsecure. But to stretch the scenario in the governments favour, even if it was relatively secure, breaches will happen - it's inevitable.

So... you are Mr. Hacker McBlackHat and you've finally cracked into the UK MegaBase and you've yottabytes of data you could steal, but obviously you've got to be selective - you can't nick everything after all, even with your massive hard drive, it isn't exactly UK MegaBase size - so what do you go for? Personally, any hacker breaking into the UK MegaBase is going to have some political motivation or if no politcial motivations at least a sense of irony, so I guess you'll be going for the details of politicians? That CCTV camera footage of them with an attractive young lady when their phone record told their wife they'd told their wife they be in meetings with foreign dignitaries? The addition of £100,000 to their private bank account when they'd suddenly changed their mind on a political issue? The politicians pastoral best-friend being caught on camera with a lade? For everything that common Joe Public should fear of being caught of politicians should have that fear 10 fold.

Now, tell me, when the politicians see their colleagues careers being destroyed due to a spotty teenager running a script, when it's cost gazillions of pounds and still doesn't actually work, and when a another, different, government could easily be voted in to simply oppose this one issue... how long it is ever going to last...?

Thursday 2 October 2008

A Daily WTF

Ah! The first blog post that was never followed up... how many of them must exist...? I do have some valid excuses - I've split with my 3 year long girlfriend (nearly typed "3 year old girlfriend" then, but caught myself), I've been trying to sort out the decimated state of my flat, the company I've been working for is going down the shit pan and my band has split up. Yes, I possibly should've blogged this as I went along, but it was necessarily foremost in my mind. I will be getting back on this, tho'. I guess there'll be less reviews as I've no longer the company of the person whom I watch so much sci-fi with, but there you go!

The Daily WTF is one of my favourite sites - it's much like, say, the stupid things people have said thread, but for dump arse computer code - a stupid things people have coded thread, if you like. I've had a nice work based WTF today, which I'd like to share.

Since I need some dental work done, I'm planning to sign up for my works dental heath care scheme. I phone the companies benefits people and I'm told that I'm not on the HR system... which is funny considering how much they are willing to pay someone who apparently doesn't work for them. So, I ask the girl if I could have HR's number and I was told that they wouldn't actually speak to me, and that I'd have to go through my manager. Turns out, they don't actually have a phone number - just an email address. For a department who's primary function is to deal with employees it seems slightly ridiculous that there is actually no facility or ability for those employees to speak to them - even managers aren't allow direct contact...!

Anyway - I'm sure to make another post later - keep on a roll! :)