I thought it was supposed to be sunny?

grahams - - 1 min read

Going to be in California (or, as the new governor says, Kulheefourneyah) for 11 days… My flight is at 8:30a tomorrow, which means I have to get up at like 6 to leave myself enough time to get to the airport and get to the gate. and I are making the trip out to Palmdale for some business, but hopefully it will be a fun trip as well. I think I am going to stick to Phonepost (voice posts) to this journal while I am traveling…

Endianness

grahams - - 2 mins read

We were having endianness issues reading in some binary data in the Windows version of my project at work… While we were able to use the network byte-ordering routines ( htons(), etc) to swap the integer values, byteswapping floats were a bit trickier… After beating my head against the desk for a few hours yesterday, I gave up and went home… When I got home I read the IEEE Floating Point spec (IEEE 754) until I understood how they were represented in memory, and this morning I wrote this code to properly do the swapping:

double fswap( float f ) {
union {
float f;
unsigned char b[4];
} u1, u2;

u1.f = f;

u2.b[0] = u1.b[3];
u2.b[1] = u1.b[2];
u2.b[2] = u1.b[1];
u2.b[3] = u1.b[0];

return u2.f;
}

When I first learned C a gojillion years ago I thought to myself “What the hell could you possibly use a union for?” Guess I found the answer… :)

You’d have to change it up a bit to swap a double… Here’s a stab at an implementation for doubles, although I haven’t tested it:

double dswap( double d ) {
union {
double d;
unsigned char b[8];
} u1, u2;

u1.d = d;

u2.b[0] = u1.b[7];
u2.b[1] = u1.b[6];
u2.b[2] = u1.b[5];
u2.b[3] = u1.b[4];
u2.b[4] = u1.b[3];
u2.b[5] = u1.b[2];
u2.b[6] = u1.b[1];
u2.b[7] = u1.b[0];

return u2.d;
}

Thought y’all might find it interesting, and it might be good to add to your toolchest in case you ever run into this same problem.

The Donkeys Wish You A Merry Christmas

grahams - - 1 min read

Here is the cover of my Aunt & Uncle’s Christmas Card:

You may notice that one of their donkeys has a bell around it’s neck. This is because the horse is blind, and follows the sound of the bell.

Soft Restart

grahams - - 1 min read

Had a dentist appointment this morning at 9:45pm, which provided me an excuse to sleep in a bit, which definitely aided in my sleep schedule adjustment.. Had the crown prepped and the mold taken, and will have to go back in a few weeks (after my trip to CA) to have it installed. Got into work around noon, went straight to lunch, and have been playing catch-up for the rest of the day. Looks like I will be working on a new project soon, which sounds pretty interesting…

This weekend I just lazed around, although I did come up with caching versions of my CD List and DVD List. The old versions would hit the database server every time, these new versions check the table modified time first and rebuilds the cached version if necessary. This wasn’t a huge deal at CSH, but it was at sean-graham.com, since it was hitting up the CSH database, which was slow over the net. Those pages now load much faster, unless you are the unlucky soul who hits it when the cache is stale… :)

Happy New Year!

grahams - - 2 mins read

Had a great time yesterday, after a bit of a rough start… Before landed in Boston I needed to get to the store to do some preparations for the party we were throwing… I headed down to the Alewife area to hit up TRU to get a copy of Outburst that Corinna wanted. There is a Hippie Mart over there, so I figured I would get my grocery shopping done as well. Well, it took me like 20 minutes of searching the store to FIND the game, then another 20 minutes to check out. I made my way through the parking lot over to the supermarket, but there were so many people in the lot that THIS took 20 minutes before I gave up, not having enough time to shop before I had to be at the Airport.

Corinna landed safely, and I was there in time… We got back to the apartment, after stopping at the River St. Hippie Mart, and pretty much instantly set about preparing for the party… I also received my awesome hand-made slippers from Corinna’s Stepsister, .. Holy crap are they comfortable… I have to shrink them a bit to fit right, which will require some laundromat maneuvers, but it shouldn’t be that bad even for a laundry gimp like myself. Everyone started showing up around 7:30pm last night, , , Michelle, Audra, and all came over, and stayed well into the night (Audra spent the night). We made way too large of a commitment to food and drink preparations, but it wasn’t too bad. There are lots of leftovers, but they hopefully won’t be leftover for long. We celebrated the arrival of the new year on the roof of the building, watching the Boston Harbor fireworks in the distance… The view up there is truly beautiful (if you like cityscapes, that is.. :P).

Woke up pretty late this morning, around noon, but I wasn’t even tired when I tried to sleep at 3am last night, so it took a long while to fall asleep. I did all the dishes this morning, which was surprisingly not as shitty as I had expected… Now Corinna and I are going to settle in and watch our first movie of the new year, The Last Samurai, which I’m not expecting to be great, but want to see anyway.

The Movies I saw in 2004

grahams - - 4 mins read

Series: Yearly movie lists

Here’s a list of the movies I saw this year… If you compare it to last year’s list, you’ll notice that I saw a few more films in the theatre this year, more than one a week on average (which isn’t surprising since I head up the Boston Sunday Night Film Club). You might also notice that I saw fewer films on video this year… I guess that’s what getting a job’ll do to ya… Damn employment! :)