So are 7 redeem codes for every atom of a human for every human on earth going to be enough?

This morning was back on to Java stuff. Got my client / server all working nicely together now. Just trying to add extras and robustness. Did take a bit of a break this afternoon to come up with something the produces ‘redeem codes’, you know the things that you get sent and they unlock x/y/z. Trying to produce unique codes is quite interesting. I worked on using a random number generator from a given seed, that then produced a combination of numbers. I’ve now managed to produce enough redeem codes for every atom in a human body for every human on earth. Oh and they can have seven of them and they will all be unique. Somehow I don’t think we will ever run out. Then it was back on to more Java network stuff. Added CRC32 checks and message lengths and things. Also adding support for multiple message and split packets.

Walked the dog, she found a tennis ball fairly early on and kept it in her mouth for the entire walk. She brought it back with her and now is asleep on the bed with it. Tomorrow I’m sure she’ll just eat it. Went to the gym and did Body Combat, was fun, replacement instructor today, she was fairly mad. Now I think it’s time for salad.

Non blocking sockets

Watched quite a heavy film last night so didn’t start the day with bells and whistles. Anyway, back on with Java, today’s task really was just to complete my conversion of my server code from C++. Spent the bulk of the day on the server side TCP handling. I’m not going for SSL straight away as that’s just going to complicate things. Now the usual way of doing this is to either create a number of threads and then each one of them listens on a socket and then creates a client or to have a main thread that listens and then create threads as new connections come in. Talking to the guys it appears there is another way to do it in Java. It uses a ‘Selector’, so what you do is set up a socket stream and then set that no non-blocking. You then create a selector and add the socket to it and tell it you want it to monitor ‘accept’. Then you just sit in a loop iterating over this selector array. On accepts you just create the client socket and say you want to monitor read and write. Reads are fairly straight forward, writes I’m not so sure about yet as normally output shouldn’t be blocked, but I’m thinking if writes are suddenly unavailable then may be this is good way of checking for disconnections. Anyway, got it all as far as running and accepting a connection and then crashing, but that’s a job for another day. Not sure how much more time I’ll be allowed to spend on it, but if I’m given a couple more days then I think I’ve pretty much got the new language mastered.

Other activities, well not a great deal. Walked the dog as it’s my turn on Friday’s. She was actually really good. I took some biscuits with me and rewarding her when she didn’t try and declare war on other dogs. Went to the gym and did pump. Now I think it’s time to shutdown, both the machine and myself.

Today I learnt the rest of Java

So started as I left yesterday, but as I didn’t sleep well last night I set myself a bit of a challenge to do with callbacks. Had an idea about how to solve them using interfaces and thankfully worked it out with no Googling. Then it was very much the case of working through the rest of the tutorial. So covered threads and syncronisation, streams and a few security type things.

It’s Jamie’s turn to walk the dog so I went cross country running. New compression tights arrived today, so wore them for the run and kept them on until this evening. Must admit I’ve had no muscle ache at all so they do a good job. Jamie still hasn’t walked the dog.

After I finished the tutorial I decided to try and convert the server side of the client / server app I was working on last week into Java. Certainly a learning experience, no problems so far and has been very interesting.

Last night there was a brewing ‘incident’. The airlock on the big brew barrel decided not to work and it blew the lid clean off with a hell of an explosion. The good news is none of the actual brew escaped. Managed to fix the lid and replace the airlock, dropped the temperature a bit and now it’s all bubbling nicely. Unlike the strawberry wine which seems to be fizzing a bit, but nothing in the way of major carbon dioxide. It’s meant to be ready in three weeks, it’s done about two, I reckon it’s going to need about six before the gravity drops. Still the big barrel should be done by about Tuesday.

So more of the same tomorrow, which I’m quite looking forward to. I think I need to get an iPod/iPad dock as trance from the iMac speakers is just shit.

It’s torture porn night, but tonight’s film isn’t the usual horror, I think it’s a bit of a thriller.

And today I learnt Java

Early start today, dog off to play group. She was so excited so didn’t even eat her breakfast. I was beautifully presented with a pile of piss on the kitchen floor though, I think it was the dog, I have no recollection of doing it.

Then it was back to Java, well rather C++ interfacing to Java both ways. Java calling a Windows DLL caused me a few issues but got there in the end. C++ calling Java on the other hand worked first time. I have a good understanding of it now, not sure if it will ever be used, but you never know when your suddenly going to be presented with a C only lib that you need to call from a Java server app. If I am, at least I know how to do it now.

Rang the cleaners, they were coming in about an hour, so went went out for a run of ‘about an hour’. Got back just before they arrived. I must say my Dyson is more effective than their Henry. I think the fine art of ‘rubbing your trainer over the carpet to lift the dog hair’ leaves something to be desired. Anyway, cleaning done, house now tidy.

So then spent the rest of the day into the evening learning Java. From classes, instantiation and initialision, all the way through system resources and exception handling. Must admit, like what I’ve seen so far, all makes sense. Still got a lot to cover, but I imagine I’ll have it all nailed by tomorrow. Learning a new language in a day, no problem, but then again I’ve been doing it for 27 years so I’ve kind of got the hang of it by now.

Picked up dog. She’s picked up a war wound off a bush. She’ll live. House now dirty again.

I’ve done my exercise for the day, so think I may just have a sit down now.