Thursday, December 23, 2004

Site overhaul on the way

I finally figured out how to kludge categories in a convincing, and effective way, so I am going to overhaul the crap out of this place once I finish working the kinks out in my dev region. I think you will observe little or no difference style wise but I will be adding categories to the right hand nav, and you will see posts with [something] in their titles. These [] will be their categories, and you will be able to use the left hand nav to view the current posts from those categories, or to view archives of a specific category. Here's hoping it all works out!

Geoff

Wednesday, December 22, 2004

Character Encoding in Java

Usually I wouldn't comment on work, but this is so generic, and so weird I had to. I have had a problem where a java byte array was converted to a String and then back to a byte array, and in the process changed. I thought this was strange, and it was causing a problem with my application, so I investigated. For those kids with computers at home you can follow along with this code sample.

import java.io.UnsupportedEncodingException;

public class TestBuffers {
public static void main(String[] args) {
byte[] bytes = new byte[256];

for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) i;
}
try {
String s1 = new String(bytes, "IBM-037");
byte[] b1 = s1.getBytes();
byte[] b2 = s1.getBytes("IBM-037");

for (int i = 0; i < b2.length; i++) {
String temp =
i
+ " "
+ Integer.toHexString(bytes[i])
+ " "
+ Integer.toHexString(b2[i]);
System.out.print(temp);

if (bytes[i] != b2[i]) {
System.out.print(" different");
}
System.out.println("");
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}


So if you run this what do you see? Well it is pretty normal except for IBM-037 0x25, which magially becomes IBM-037 0x15.

Essentailly the first conversion turns an EBCDIC LF to a Unicode LF, then the second coversion turns the Unicode LF into a EBCDIC NL, weird eh?

The Last Christmas

Those great guys over at PA have done it again, other then bringing in a wallop of toys and cash for kids at children's hospitals all over the States (http://www.childsplaycharity.org/). They have also crafted a timeless Christmas tale for a new generation. Beware, it includes Cthulhu. They have posted the first few pages, and the rest are forthcoming, presumably it will also be published in a physical format. I think this just proves me right, that terrifying and horrible things are great topics for children's books. I originally wanted these guys (in my imagination) to illustrate my stupid Spinal Fairy story, which still makes me chuckle (worry about my sanity, but chuckle.) I mean this is raw fairy tail material, dating right back to those crazy Brother Grim who fed Grandma to the wolf, and stuffed a bunch of fat Hungarian children into the oven. Over time these tales got toned down as kids got wussy, but at their heart they were bizarre and strange.

We now return you to your regularly scheduled program.

Don't Panic

I give you this friendly and helpful recommendation because it is pertinent, and topical. First of all this post is about the Hitchhikers Guide to the Galaxy,

In fact, it was probably the most remarkable book ever to come out of the great publishing corporations of Ursa Minor--of which no Earthman had ever heard of either.
Not only is it a wholly remarkable book, but it is a highly successful one--more popular than the Celestial Home Care Omnibus, better selling than Fifty-Three More Things to Do in Zero Gravity, and more controversial than Oolon Colupbid's trilogy of philosophical blockbusters, Where God Went Wrong, Some More of God's Great Mistakes, and Who Is This God Person Anyway?
In many of the more relaxed civilizations on the Outer Eastern Rim of the Galaxy, the Hitchhiker's Guide has already supplanted the great Encyclopedia Galactica as the standard repository of all knowledge and wisdom, for though it is inaccurate, it scores over the older, more pedestrian work in two important respects.


and like the last post it is about a book that is being turned into a movie that is very different from the book. If you look here you can watch the trailer for the new movie, whose tagline is something along the lines of "Go on the greatest adventure in the universe, that starts after the world ends." Then if you dig around on that site some more, you can get all sorts of news about the movie, including that the screenplay was mostly written by that mostly harmless fellow Douglas Adams, premortem. Further more the story is supposed to be from a whole new angle, with new characters, new plot elements, and apparently Zaphod's second head is up his nose! So here is hoping its good, I know I'll go watch it.

Now the endearing and heart warming part of this story is that my younger brother Alex, who is one hip and groovy frood saw the trailer in the theater and cheered (alone.) Thus giving lie to his hip and groovy froodness and asserting his inner nerd. There is hope for him yet.

The Bourne Identity, Robert Ludlum

Wow, what a book, I haven't been grabbed so tightly and taken for such a ride by a book in a while, mostly because I am reading Ed Greenwood, and his work has really gone down the crapper, but enough about Ed. From my book slump I decided it was time to branch into something new and random, or buy a bunch of hard covers. My pocket book being empty I opted for something in the new, random, and cheap pile. So I went to the library (cheapest pile of all.) Well almost cheapest, I had almost $10.00 worth of fines on my account, but they were mostly from my brother, I digress.

Since my usual fare is Sci-fi and Fantasy, I thought a little bit of cloak and dagger would be a nice change. Little did I know that the cloak and dagger / spy genre was actually the SUPPPPPPPPPER THRILLLLLLLLER genre! I actually discovered this much later, (in fact after I finished reading the book, I read the 'about the author' section, and discovered that Robert Ludlum was a master of the super thriller genre.

To insure an easy first step into this world, I figured go with what you know. Having recently watch the movie of The Bourne Identity, and enjoyed it, I figured the original novel was a good candidate. So off to the library I went, paid some fines, and carried away the book, much like a k-9 follows a command obediently for promise of a treat.

Since then I have been quite enamored with the book, it is a well written, interesting, and exciting book (much more so then that bland review of it.) What amazed me was that in spite having seen the movie I pretty much only knew one secret that the book had to reveal, and that was the main characters name was Jason Bourne (sort of,) but I mean the cover gives half of that away anyways.

Like I know books often get lost in translation, and a good book often doesn't always equate to a good movie, but to have a good book, and a good movie based on it, and then realize that the two of them are about as different as night and day was startling.

So in conclusion, if you liked the movie, you should like the book, but if you have seen the movie, you haven't spoiled the book, so go read it!

"I'm Listening" and mostly to myself

I've always enjoyed the show Frasier for a long time, I've always had a sort of kinship with the main character, and I don't think I have ever realized why until last night / today. It all started with an episode, that I watched last night, where Frasier finally realizes why he is so unlucky in love. The rational is because subconsciously he compares every woman he has ever dated with the next one, and he pushes away those who would be good with him, or picks ones who he can find flaws in. The reason being that he makes sure it's easy to reject them before he gets rejected, stemming from all the women who have left him in the past, (three wives and his mother.) The root is that he over analyses everything as a defense mechanism.

In a way I think this is my problem with a lot of things, mostly likely my contentment, I am generally not all that content a person, I in fact have an inexplicable power to discontent myself with anything and everything, and I think it is because my mind works at about a mile a minute, and that's on a slow day. It's strange, but when I am disappointed (at anything) I can focus my mind in such a way as to turn all possible causes on myself, and further my melancholy. I can really over emphasize any emotion by just thinking myself into it, but it seems easier with the broody-moody ones. The quandary of it all is that stress is both the cause and the cure. When times are stressful it gets worse, but when times are REALLY REALLY stressful, when there is hardly time to breath, let alone think, I am fine. When my focus is at its strongest on a problem that needs solving I am on my game, but when the pressure eases back, and fatigue sets in, BOOM I'm right back in it. I just wish there was a less stressful ways to filter and focus the old noggin, because it has a nasty habit of spoiling things for me, not the least of which is my mood.

So really what I am saying is the some days, I really piss me off, and I'm not even schizophrenic.

Darkness

Darkness shrouds the city; rain dusts the streets and muffles the sounds of morning. Orange beacons of light are quenched by the gloom, and here I am, awake, waiting. The rain slicks off my trench coat, rivulets of water form between the folds in the cloth. The wide brim of my fedora catches most of what rain was headed for my face, but still water beads across my lens, giving what light remains a twinkling appearance. Cold in my hand is my revolver, the steel bites at my hand sucking out the warmth, as if draining the very life from me. The gun gleams, proclaiming to the world, I shall take a life tonight.

As a rule, I don't like to kill, but my quarry has made it clear he has no such qualms with that particular deed. The cold icy rain is juxtaposition to the hot life the poured out of my partner's chest. I liked that dame, and there wasn't a damn thing she did to deserve those to slugs, and I was going to make sure they got back to their owner.

I was as taut as the cables on the Golden Gate Bridge, and I felt like I was carrying just as much weight. I felt the slightest move and I might shatter into a million pieces. Every out of place sound seemed to rake on my nerves, until all I noticed were the little things, and not the big black car that drove past. Unfortunately, the car noticed me. With squealing tires, the car came about.

I had found my man; the problem was he had found me first. Like a jack rabbit, I leapt out of the way, and rolled through a deep puddle. Standing up, I bolted as the driver once more skidded around to bear down on me. I ran, behind me the demon eyes of his black Cadillac. With a spryness not seen since my youth I fled, up the sidewalk. Risking a glance over my shoulder, I cocked my revolver and let fly hot lead. The recoil shook my soul, hammering home the choice I made; it was my life, or his.

The bullet did not find its mark, but left one in his grill, in my head I counted 'one.' Realizing the limit of my chances; the size of a man's head behind the wheel of a monstrous car; and the unsteadiness of my hand I had come too the only rational conclusion I could: get him out of the car.

In the distance, my solution, a parked dump truck whose brute like girth stoically waiting in the dark of night. With keen incite I cultivated my plan, timing would have to be perfect, and time I was running out of. Quickly I redirected my path towards the rear of the truck, and with reckless abandon opened fire on my pursuer.

'two,'
'three,'
'four,'
'five,'

The cacophony of death, muted by gloom that held the city in its thrall, rang from my hand. Each bullet ripped through the air with unlikely precision, as if my hand guided by Athena, and my enemy's heel exposed. Each one found its mark, and that mark was the radiator of my foe's chariot.

Banshees of steam erupted from beneath the hood, screaming with a fury that could curdle your blood. With his vision blocked my hunter lost control of his car. He quickly discovered that he was now holding his sword by the blade. His fate sealed I dived out of the way as his car careened into the waiting truck. Steel on Steel they tested each others mettle, but his car was no David, and so Goliath won.

From the smoking wreckage, I heard a noise, it was almost a whimper, almost a moan, but it meant he was alive, at least for now. I moved quickly to his window and made to shatter it with the butt of my gun, but the crash has already done that job for me.

With one hand holding, a now steady, aim on his head, the other reached into his pocket and removed the small, unassuming, statue that had cause such carnage. His body seemed to relax as it the falcon statue had weighed greatly on him. His ease lasted only moments as I cocked my revolver. His eyes widened, his pupils dilated, he stammered out,
"You got what you came for. Now go!"

I paused, not to consider my next action, but to let him suffer in the moment. Dangling hope and mercy that he would never have given me, and then I let him know as much.
"Oh, the falcon bought your life, but now you have to pay for hers."
'six'

Once more into the cold I set out, this time the revolver was warm in my hand, contented to not leach away my life, as it was sated with the one it had ended. Dawn was coming, the dawn after the storm, it would still be gray, it's always gray, but it would be lighter, and so would the burden I carry.

Next Post

The next post I am about to make is a story I wrote a few weeks back, but never finished. It doesn't come from any darker part of me, so people who might be worried don't be, I just wrote something that would let me do a few things. The first was let be abuse the English language, I wield some literary devices around like a neural surgeon with a baseball bat. The second was to amuse myself, I always have had a quirky thing for cliche's and detective stories, so I thought something in that genre might be fun. The third was because the morning I started it was raining, the city was muted, and my glasses were all speckled with water, so I was inspired.
I write a lot of things like this, that is randomly inspired oddments, and most of them end up getting deleted, but I tripped over it at lunch and figured it only required a little bit of work to be serviceable. So I serviced it and now here it is.

Monday, December 20, 2004

Soooo cold


cold, originally uploaded by gcpeart.

Well the mercury says it all, today is a cold one. Hell the car barely started, and took a while to warm up enough that it would drive. I hope it warms up soon, I would hate to spend a week commuting at these temperatures.

Saturday, December 18, 2004

House n'Stuff

Well there are the weekly pictures of the house, and it is doing pretty good. We also had a chance to meet some of our neighbors down the street and like us they are a young couple, who could, but can't affoard to close early. I think their names were Andrea and Adam, but I could be wrong. In any case they seemed like nice people, and about our age, which will be cool.

In other news I am now a Sun Certified J2SE Programmer. I wrote the test on Friday, and have been studying for a quite a while. I'm glad I wrote it both to cement my knowledge, and to shore up my resume. Next up Sun Certified J2EE Business Component Developer!

This week ahead is looking kind of crazy, between work and Christmas shopping, it's going to be a busy one. At least it will end in vacation!

Until next time!