Monday 30 August 2010

Sunday: Deathwatch!!!

Deathwatch

As you may know, I have an interest in role playing games. It stems from when I was at University and was a member of the games club where I first played Traveller (I'm not a big fan of D&D). Recently, Games Workshop have collaborated with Fantasy Flight Games and produced a W40K series of role playing games, the latest of which is Deathwatch (it's best to pronounce the name with as much Gothic melodrama as you can muster: I do). Fantasy Flight have quite a good marketing strategy for these games. They produce a cut-down introductory adventure which can be played without the core rule book and just a set of percentile dice (two D10's, one for tens, the other for units). The Deathwatch adventures are called Final Sanction and Oblivion's Edge and are available as free PDF's.

Jobs

I've been a little busy recently coding in Delphi (?!?). The week before last, an agent rang me up and asked me for a copy of my most recent CV. The agent normally recruits payroll administrators, but one of his clients had asked for a Delphi programmer and he'd seen an old CV of mine on Planet Recuit. I sent him my latest CV and heard nothing more. The following week he phoned me back and asked me if I could attend an interview in London (Finsbury) on Thursday 2nd September. I'll be given a technical test but also, unusually, they wanted a sample of my existing work. The only Delphi work I've done at home in the recent past was to sort out problems at work: I'd e-mail a fragment of code to home from work and then e-mail the solution back, but I don't have anything standalone. So I've set about creating a little cryptographic application using the RC4 algorithm I mentioned previously. I've got a nice little front-end with big buttons and nice icons:

Crypto.png

and I've used TDD for most of the class work. I'll also do a little documentation to explain how it works and the design ideas behind it.

Tuesday 24 August 2010

Digital Ciphers

Digital ciphers have become very important due to the Internet and the desire for secure communications. They break down into three distinct types:
Sometimes included with in this list are message digest algorithms, but I've excluded these for the moment and I'll cover them at a later date.

Public Key Ciphers

Up until the 1970's, most ciphers, both stream ciphers and block ciphers, involved the use of a single key to operate. You use the same key to encrypt the message and to decrypt it. The problem with this is that the key becomes critical to the security of the system: if a third-party gets hold of it, the security is compromised. In the 70's two groups, one in the UK working for GCHQ and some academics at MIT in the US, came up with the idea that you can have one algorithm that encrypts using one key, a public key, and another algorithm that decrypts using another key, a private key.

The mathematics behind public/private key cryptography is complex, involving a branch of mathematics called number theory, and involved the use of huge prime numbers. This gives rise to the problem that public key ciphers are generally slower compared to the equivalent block or stream cipher.

Stream Ciphers

As explained before, stream ciphers operate on a bit stream, one bit at a time, XORing the plain text stream with a stream of pseudo-random bits to produce the cipher text stream:

Stream Cipher.png

Stream ciphers are extremely fast, much faster than block ciphers, but are less secure. For this reason, they tend to be used where speed is a critical factor, such as mobile phone telephony. The clever bit about stream ciphers is in the design of the algorithm that produces the key stream, as it must be able to produce a stream of bits which looks random, but is seeded from a unique key. I'll discuss the design of a simple yet surprisingly strong cipher, RC4, at a later date.

Block Ciphers

Instead of working on a single bit at a time, a block cipher works, as the name suggests, on a block of bits, encrypting the same block over and over. The most common way of doing this is using a design known as a Feistel Network. This splits the block into two halves. The right half gets swapped with the left half and the left half is encrypted using a function of the right half and part of the key:

Feistel Network.png

Block ciphers are, generally, more secure than stream ciphers and faster than public key ciphers, so they are used for encrypting large quantities of data, such as files and web pages. Also block ciphers can support different modes of operation, such as cipher block chaining, which can enhance strength of the encryption even further.

Monday 23 August 2010

Monday: Christmas at Oxfam

I only did a short shift today at Oxfam, just enough that Claire was able to do some book sorting instead of having to be on the till all the time.

We also got our first delivery of Christmas cards, about thirty boxes, so Merry Christmas, everybody, for when it comes.

Sunday: A Rainy Day in Lewes

I dislike being in the flat for more than a day so, for a change, I decided to go on a trip to Lewes in East Sussex. Lewes lives, to some extent, in the shadow of it's neighbour Brighton so there tends to be fewer tourists, especially on a wet day. The town also has a more business-like feel to it, being the county town, and I've always liked it.

After a two-hour journey (with a twenty minute stop-over) I was glad to pull over in a nice little car park. I walked around aimlessly for an hour or two, taking photographs, when it started to rain quite hard. I ducked into the local Cafe Nero, bought a cappuccino and did a number puzzle for a while. The rain didn't seem to be letting up, so I went back out, umbrella in hand, and wandered a little through the town and back to the car.

I got lost going back and ended up going through East Grinstead before ending up back at the M25.

Saturday 21 August 2010

Java and C#

A recent conversation reminded me of the debate about Java and C#. The subject is not as clear cut as might appear and there are things to consider beyond the purely technical reasons for using either.

Java's Age

Java has been around for a while now, since 1995, and was one of the first major commercial object-oriented languages designed as such. C# is relatively new, released in 2002, and has features, such as reflection, that have been invented since Java was released. Java has either only partially included these new features or not at all. The reason for this conservatism in language design is that Sun has been focused on backward compatibility, even at the byte code level, and has been reluctant to implement new features that break this. Microsoft has had a reputation for being somewhat careless about backward compatibility, although this has changed somewhat as they've tried to promote .Net as an open standard.

Java's age, however, is also a head-start and there are many application frameworks and tool suites for Java, such as Spring, Hibernate, and the Apache Jakarta project, which are very mature. C#, or rather .Net, equivalents are only just starting to develop, and some of those that exist are actually ports of Java systems, such as Spring.Net and NHibernate.

Web Enabled

From the start, .Net has been designed for use in web applications. The effect of .Net on ASP, for example, has been almost revolutionary. In particular, .Net has libraries which make the development of web services and SOA much easier than before. Java, on the other hand, has had web services introduced retrospectively, through changes to J2EE and frameworks like Spring and languages like JSP.

UI Applications

Like web applications, .Net has been geared up to produce Windows applications right from the start, although not to the degree that Delphi has. Java has the Swing library, which, although cross-platform, produces very poor applications. It may be worth noting, however, that Vuze, one of the most popular bittorrent clients, is implemented in Java.

Cross Platform

From the start, Java was designed to be cross-platform. The Java slogan has always been, "build once, run anywhere" and Java applications can be built on a Linux box and run on Windows. .Net applications can only be run on Windows and .Net web applications only on IIS, Microsoft's web server. There are ports of .Net to other platforms, such as Mono, but these are not compatible with .Net to in the same way that different implementations of Java are.

The cross-platform limitation of .Net also makes it easier to take advantage of features only available in Windows and nowhere else. This is particularly true of Windows applications.

Politics

Java has evolved in a very open culture at Sun, Java going open source in 2007. Even though Sun held the licences to Java, it included interested groups in it's decision making process, what Sun called the Java Community Process. This is probably because the focus at Sun was hardware, which is where it made the bulk of it's money, rather than software. With the buyout of Sun by Oracle, this may change as Oracle are a software vendor, like Microsoft, although not development tools.

In contrast, .Net is very proprietary. Microsoft have not developed a port for .Net to Linux, for example, because of the licencing problems involved with the GPL and because Microsoft has no control over the development of the Linux operating system. In other words, if you want to use .Net, you are stuck with Windows and Microsoft. In anti-pattern terms, this is known as "vendor lock-in".

Conclusion

The choice between .Net and Java is not an easy one. There are a lot of technical factors to be considered, as well as the one's I've listed above. I tend to go for Java, but this is based on the cross-platform nature of Java, in addition to it's maturity and the vendor lock-in aspect. There are good arguments for .Net, however, including Microsoft's considerable support for it for the for the foreseeable future, and it's close relation with the Windows operating system. It also depends on the nature of the work being done. If it's going to be mostly Windows applications, then .Net is the obvious choice. With web applications, it's more complex, but, again, if it's going to be based on Windows, .Net seems to be the right choice. There are other choices than .Net and Java for the web, however, Ruby and PHP for example.

Another consideration is how much is it going to cost to move to these development languages from wherever you are now. Java and C# are syntactically very similar (the claim that C# is a clone of Java has some truth), so the jump from, say, Delphi or Visual Basic, would be the same to some extent.

A good idea is to look at other companies and see the choices they made, but understanding why they made those choices. For example, why do Google use C++, Java and Python, especially Python? Wikipedia is made using PHP, which is also cross-platform independent.

And, of course, the worst choice is one made from blind ignorance.

Friday 20 August 2010

Friday: A Trip to the Science Museum

It's been a while since I went to the Science Museum in London. They've got an exhibition called "Who am I?" all about human beings. I remember something about it a few years ago, but it was a very small exhibit at the time. They've now expanded it and it's huge, covering an entire floor. It was quite interesting, but there were hundreds of kids milling about and you couldn't get anywhere near any of the interactive suff, which was a shame.

The Space exhibit was quite fantastic and they had a J2 rocket motor, used to power the giant Saturn V Apollo rockets:



Brilliant!! They also had the Apollo 10 re-entry capsule:



While there, I also bought some CyberClean to get rid of the gunge on my laptop keyboard.

Thursday 19 August 2010

Ciphers

Running on from the previous article about codes, I thought I'd write some more, this time about ciphers.

A cipher differs from a code, in that a cipher replaces letters, or numbers, with another, whereas a code can replace many letters or words with just one. For example, the phrase "Meet me tonight" can be replaced by the code 1254, or "blue", or whatever. If we encypher the message, however, by replacing the individual letters with the key to the right on the keyboard we get "<rry ,r ypmohjy". This is known as a substitution cipher. The other type of cipher is called transposition. This is simply taking the letters of the message and re-arranging them, as in an anagram:

M M N T
E E I X
E T G Y
T O H Z

Reading the letters vertically produces the message, with a little extra letters to make a square number. Horizontally produces the code, MMNT EEIX ETGY TOHZ.

Digital Ciphers

Instead of working on letters of the alphabet, digital ciphers work on bits, or blocks of bits, usually using an XOR function. For example, convert the message to ASCII:

M e e t
m e
77 101 101 116 32 109 101
1001101 1100101 1100101 1110100 0100000 1101101 1100101

The XOR function changes the bits such that unequal bits produce a 1, while equal bits produce a 0. If we now use an ASCII key phrase:

Plaintext M e e t
m e
ASCII (Decimal) 77 101 101 116 32 109 101
Binary 1001101 1100101 1100101 1110100 0100000 1101101 1100101
Keytext S e n d
t h
ASCII (Decimal) 83 101 110 100 32 116 104
Binary 1010011 1100101 1101110 1100100 0100000 1110100 1101000
XOR Result 0011110 0000000 0001011 0010000 0000000 0011001 0001101
Decimal 30 0 11 16 0 25 13

The result of XORing is a series of mostly unprintable ASCII characters, but the stream now bears no relation to the original message. For example, the three "e"'s in the message are now all different, 0, 11, and 13.

The mechanism above is roughly how a Stream Cipher works. Instead of a key phrase, the cipher generates an endless stream of seemingly random bits which are XOR'd with the plaintext stream to produce the cipher stream.

Tuesday 17 August 2010

Tuesday: Ergo Proxy

Tuesday being a quiet day, I've been watching DVD's.

I picked up a DVD from the shop the other day. It's an anime TV series from Japan called Ergo Proxy and I got sold on the blurb on the back of the DVD case:
"The domed city of Romdo is an impenetrable would-be utopia where humans and robots coexist, and everything is under complete government control, or so it appears."
It had me at "would-be utopia". Normally I wouldn't touch manga/anime with a barge pole, it's just too manufactured for me, but this seemed a little different from the norm, plus the image on the back of the case helped:



Unfortunately, the plot's a little turgid and it's been stretched thin in order to make a TV series, and I've only managed to find the first four episodes.

Monday 16 August 2010

Monday: Drupal

Drupal

I've been playing around with Drupal over the past few days. Actually, it's taken so long to sort out the LAMP stack that I haven't had chance to do any real development yet, so it's very much a work in progress. I had a look at Drupal a few years ago when I was looking at developing a Wiki. In the end I found MediaWiki, which handled all the problems for me, but I quite liked the idea of a web development framework which didn't require any real programming. When I did it, it was Drupal 5, but Drupal 7 is about to come out and there was recently an article in Linux User & Developer magazine which sparked my interest again.

Sunday 15 August 2010

Friday: Job Interview

Funny. I never thought I'd be sad about a job interview.

I went to an interview for a web developer job at South Essex College. The job title was actually "Informations Service Analyst", but you read the job spec. and it was HTML, ASP, JavaScript, VBScript, etc. and Oracle. None of these skills I have in abundance, other than a bit of Oracle I did many years ago when I was a contractor. How I managed to get an interview I don't know, but the money was a bit low (£20k) for anybody experienced.

So if I got the interview, why was it sad? There was another candidate for the job, a chap called Frank. He was about late forties, early fifties, a bit dishevelled, hadn't shaved properly, so nervous his hands were shaking and was generally a bit of a mess. As we talked throughout the day (the interview process lasted about three hours) it turned out that he'd been made redundant from some firm that specialised in pharmaceutical software about two years ago and hadn't had an interview since November.

It's the first time I'd been interviewed like this, at least as far as I can remember. Mostly, you are interviewed on your own and, although you are aware that you are not the only candidate, you don't normally see the others face-to-face.

We were both shown around the place, although the job was in Thurrock, not Southend, and given a technical test. Most of the SQL was straight forward enough, although there was some Oracle I just guessed at. There wasn't really much web stuff, no HTML for example, and there was some basic object-oriented design questions I could do in my sleep, but obviously no Delphi or Java. We were sent to lunch while they marked the test and then afterwards they told Frank that they wouldn't be interviewing him. Why they couldn't have done so, I don't know: it wouldn't have cost them anything other than time, and he may have shined in the interview.

My interview went OK, but was over in about twenty minutes. They asked me a few stock questions, actually written out in front of them. Although it was all very professional, it did seem like they were going through the motions: I clearly wasn't the guy they wanted, but I was the only to survive the technical test.

The punchline is, I didn't get the job. It did strike me that Frank was me in two years time, assuming that I don't find anything. He'd worked faithfully for a firm for twenty years and here he was scrabbling around for a job. A sobering thought.

On a different tack, I re-applied to the FTSE, but instead of doing it through the job site, I did it through the company web site. This gives me a bit of feedback.

Tuesday 10 August 2010

Codes

In both Rubicon and Sherlock last week, by bizzare coincidence, the plots involved the use of something called a Book Code (in Rubicon, one of the characters refers to it as "old school"). The method is simple.

Say you want to communicate with someone secretly. You both buy the same copy of a book, To Kill a Mocking Bird, by Harper Lee. It has to be the same edition, identical. You want to send the message "Meet me tomorrow at the station". "Meet" is on page 31, and is the second word on line 33, "me" is on page 183, the fourth word on line 7 (this is not the first occurance), and so on. "Station" doesn't occur in the book, but "stationed" does, page 112, line 5, fourth word. It'll do. You end up with a string of numbers:

31, 2, 33; 183, 4, 7;...

In Sherlock, these are translated into ancient Chinese numerals; in Rubicon, a string of letters by splitting the numbers up into groups that add up to less than 26. In the example:

3, 12, 3, 3, 18, 3, 4, 7, ...

which becomes:

CLCC RCDG...

In Rubicon, the protagonist figures out straight away that the letters represent numbers, probably because of the number of C's, D's etc. The receiver of the code reverses the process. The strength of the code is that without the book, the code is meaningless.

The KGB and GRU (Russian Army Intelligence) used a similar method. They had a purpose designed code book using four figure numbers, so "meet" would have been 5268, "me" 171, and so on. If there was a word that wasn't in the code book, the letters would have specific numbers, "a" 358, "b" 1051, etc. Encoding the example would, again, give a string of numbers:

5268, 171, 5454, ...

The agents had what was called one-time pads. These had random numbers printed on celuloid, which burns very quickly, and which were unique to each agent. These numbers would be added to first string, only being used once, thus the name. If we add the random numbers 8235, 2760, and 6473, modulus 10000 to give us four figure numbers, to the example we get:

3503, 2931, 1927...

These can then be translated into letters as before to make transmitting in Morse easier.

Tuesday: Rain! Rain! Rain!!

It's finally raining after what seems to be weeks of dry weather. It started lashing it down about six this morning, hard enough to wake me from my slumbers. I've checked the weather on the Met Office web site and it looks like it's in for most of the morning.

Oxfam

I did my shift at the shop yesterday and worked from 8:45AM to 4:45PM, with a half-hour break for lunch. It was mostly sitting behind the counter and shifting large boxes full of books into and out of the little lift that we have. We got the delivery from the book bank, based at Sainsbury's in Springfield, a suburb of Chelmsford, which was huge, in addition to a couple of house moves, so, as you can imagine, I was knackered yesterday evening.

I did manage to listen to some tunes in the morning, though. I got through the latest Mojo freebee CD, which had a selection of old blues numbers selected by Robert Plant. Not bad, plus I got part way though the previous months as well which was also quite good.

We also got shop-lifted. I was out at lunch, but apparently a customer saw someone slip books and a few records into his bag while in the shop. Everyone got a code red (we had to change the bulb), Gill phone the police, and Mark, who'd turned up for the afternoon shift, tracked him through the shop and out into the high street. He'd twigged that he was being followed and put a sheaf of records that he'd nicked back onto the shelf and scarpered. The cops came round and took descriptions off people. They said that they would look on the CCTV footage for the shopping area to see if they could find anyone of fitting the description we gave them. Good luck with that, boys.

Jobs

Half way through the morning, I got word from an agent about a Delphi job at the London Business School. This started a few weeks ago, but they've only just put together a shortlist, so here's hoping.

Also I've applied for another £65k/year job that's just popped up on the web, so you never know.

Friday 6 August 2010

Friday: Jobs

Since being made redundant from City Financials (the web site still exists, I noticed, even if the company doesn't), I've been casting around for a job.

I've been interviewed by JHC, a big firm up near London Bridge who were looking for an experienced Delphi developer. After three interviews over four or five weeks, they withdrew the job vacancy. Although this was a bit disappointing, I get the feeling that the job would have been quite a tough one and I'd have been on a learning curve for the next few years, although it would have been quite a rewarding role. Their attitude toward software development is very professional, plus I would have been doing Java as well as Delphi, which is the direction I want to go in. So mixed feelings about that one.

However, two other roles have sprung up at the same time. The first is another (Senior) Delphi role at the FTSE. This is for the unbelievable amount of £65k. So, obviously, I applied for it and just for good measure, I applied for the team leader role as well.

The other role my sister found me. It's a Senior DotNet Developer role at the NHS hospital where she works (she called it "DotNot", which was unintentionally funny. Or maybe dotnot), right in Basildon. I might not suitable for it: there was lots of web stuff, which I've avoided these past years, but there's enough connectivity stuff which is my speciality, so you never know. Plus it's local. Even if it was in Chelmsford or Southend, it would be a reasonable journey. I filled in the online application form and I'll keep my fingers crossed.

Finally, I got an interview at South Essex College for a Information Service Analyst, a sort of support/programmer job, at Thurrock (cheers, Pete). A good mix of different technologies and answering the phone. It doesn't pay much, but it might be just the thing.

Thursday 5 August 2010

Thursday: Oxfam, The Design Museum and Lizard Men

Oxfam

Today was supposed to be me at Oxfam most of the morning, but the person I was supposed to be covering for turned up unexpectedly, so no music this morning. After a few hours sorting through books in the basement, I decided to call it a day and leave early. Gill was okay with it as about five other people had turned up as well, so it was a bit overcrowded. At one point there was NINE of us in the shop. As I said to Andrew, there were more staff than customers (we had three customers at the time).

The Design Museum

I was up in London on Tuesday and went to The Design Museum, which is on the South Bank near Tower Bridge (over the road from Boris Johnson's current residence). It's modern structure right on the river bank:


It's more of an exhibition space than a museum and the current major exhibition, for which I got a catalogue and a free T-shirt, is Brit Insurance Design of the Year Award, the winner being a folding three-pin plug, which I thought was very innovative. Also on display was an electric aeroplane, component furniture made from bamboo laminate and some hurricane-proof architecture for Mississippi, my personal favourite.

Lizard Men

I've started to paint the Warhammer Lizard Men I assembled and basecoated a while ago. The aim is to get them looking something like this:


A long, slow process, knowing me.

Monday 2 August 2010

Sherlock and Rubicon

There have been two TV programmes recently which have caught my attention. One is very popular, prime-time fare and the other is obscure and possibly the best I've seen in a while.

Sherlock

Most of the people I've spoken to have complimented the latest adaption of Conan-Doyle's creation, transporting the Victorian sleuth and his companion into 21st century London. I've now watched it and I have to say that it's a very slick, knowing production. A sincere homage, from the Afghan War parallels to references to Study in Scarlet. The actors are good and well cast, from Martin Freeman's Doctor Watson and Mark Gattis' Mycroft Holmes to the lead played by Benedict Cumberbatch, who makes a very good Holmes. Even 221b Baker Street looks like the Victorian original.

I think that it will do until an original drama comes along, which doesn't seem to be happening any time soon. BBC drama seems to like grave robbing at the moment, ripping off The Sweeney (Life on Mars), A For Andromeda, Doctor Who, Quatermass and now Sherlock Holmes. They do it very well and it seems aimed for consumption by the American market.

If you look at the BBC web site from outside the UK, you get a totally different perspective on the organisation. Click on the TV section from outside and you don't get a list of the UK channels, what programmes are on when and how the licence fee is being spent. You get a (large) list of the commercial channels the BBC provides. The bedrock of BBC funding is the licence fee (£145 per household, per year), but the rest of the funding is increasingly coming from abroad, particularly the USA and Canada. The BBC is becoming a player, albeit a minor one, in the lucrative commercial American market. That's why Sherlock Holmes has been turned into CSI London.

Rubicon

So after that little rant, it seems a bit much for me to go on about an TV series just starting in the States. Rubicon is something you don't really get in the US, and something we used to do rather well. It's a paranoid conspiracy thriller, and a very good one it is too. The premise is very similar to an old Robert Redford film, Three Days of the Condor, but updated for the 21st Century and with a Grand Conspiracy, like the Illuminati, thrown in for good measure. It's got Peter Gerety, from Homicide and The Wire, and even Miranda Richardson (Queeney from Blackadder 2). I like it already.

Remember, you heard it here first.

Monday: W40K books

When I read books, I tend to go through phases of reading. I read very intensely for a few weeks and then read hardly anything at all for about a month or so, and so on. When an intense phase ends, it's usually because I get distracted by this machine (programming) or because the book I'm about a third of the way through starts getting a bit difficult. I think at the moment I'm entering an intense phase. This is helped by reading Warhammer 40,000 books (W40K), published by The Black Library, a subsidiary of Games Workshop.

W40K books are pulp military science fiction, but this is no indicator of quality as there are some very good authors, specifically Gav Thorpe, Graham McNeill and Dan Abnett. I've just finished Thorpe's Path of the Warrior and I'm about a third of the way through Abnett's Ravenor omnibus, having read the Eisenhorn omnibus previously.

Mostly, the books are from the human perspective, but Path of the Warrior has an Eldar, an ancient humanoid race, as it's protagonist.


Gav Thorpe does a very decent job of conveying the "otherness" of the Eldar, but the book takes a bit to get going and there are too few battles in it for my taste. How the protagonist progresses from warrior to "exarch" (leader) after only two battles isn't sufficiently explained, plus the novel, which is meant to be part one of a series, concludes with the death and transformation of the character.

Ravenor is much more mainstream, part of Abnett's Inquisition series.


In W40K, human religion is based on a semi-dead God-Emperor, opposed by demons, aliens and heretics. The Inquisition is intended to oppose these forces, and the novels are a bit like a kind of baroque sci-fi spy/horror novel. Sort of advanced steampunk, but without the steam and with a bit of Lovecraft thrown in for good measure. And they're great. The plots are a cut above the average W40K Space-Marines-kill-everything novel but there's enough shooty stuff so you don't get to miss it too much.