Kip

State of the art stereo sound

Written by Kip on Saturday, March 1, 2008 at 8:58 am (EST)
Tagged as:

I mentioned not long ago that I sent in my copy of Guitar Hero 3 to get a replacement with stereo sound.  Yesterday I got my replacement, which was faster than I was expecting (only fifteen days).  Having heard the game in stereo now, I can say that the difference is huge, and immediately apparent.  And now that I know that, I can’t see how this got through QA.  You’d think some of the same people who were testing the Wii version would have tested or at least been exposed to the PS2, PS3, or 360 versions of the game, and would have said “hey, why does the game sound like crap on the Wii?”  I mean, it is a music game after all.  Oh well.

No Comments
Kip

Texas Ninja

Written by Kip on Tuesday, March 4, 2008 at 3:17 pm (EST)
Tagged as:

I was at home with the flu for a few days last week (not an experience I would recommend to anyone), and I did something I’ve never done before.  I watched a few episodes of Walker: Texas Ranger.  I had always assumed, based on the title I suppose, that the show was about your typical tougher-than-nails-cowboy-who-lives-by-his-own-rules-but-has-a-heart-of-gold type.  Turns out, it’s mainly about jumping out of helicopters onto people, and then proceeding to kick them.  A lot.  Like, I think there have been kick-boxing matches with less kicking.  Now I get all those Chuck Norris facts which set the internets abuzz a few years ago.

I also caught a few episodes of Ninja Warrior.  It’s kinda like Gladiators, only without the gladiators themselves (an improvement), and with the difficulty turned up about ten difficulty units.  And that’s on a scale of five.  You should totally check it out.

Now if only we could get Chuck Norris to compete on Ninja Warrior...

No Comments
Kip

Macrolicious

Written by Kip on Thursday, March 6, 2008 at 4:03 pm (EST)
Tagged as:

I recently came across a clever way of writing preprocessor macros, and I figured that I would share.

Let’s say that for some reason you need to write a macro: MACRO(X,Y)1.  You want this macro to emulate a function call in every way2.

Example 1: This should work as expected.

1
2
3
if (x > y)
  MACRO(x, y);
do_something();

Example 2: This should not result in a compiler error.

1
2
3
4
if (x > y)
  MACRO(x, y);
else
  MACRO(y - x, x - y);

Example 3: This should not compile.

1
2
3
do_something();
MACRO(x, y)
do_something();

The naïve way to write the macro is like this:

1
2
3
4
#define MACRO(X,Y)                       \
cout << "1st arg is:" << (X) << endl;    \
cout << "2nd arg is:" << (Y) << endl;    \
cout << "Sum is:" << ((X)+(Y)) << endl;

This is a very bad solution which fails all three examples, and I shouldn’t need to explain why.

Now, the way I most often see macros written is to enclose them in curly braces, like this:

1
2
3
4
5
6
#define MACRO(X,Y)                         \
{                                          \
  cout << "1st arg is:" << (X) << endl;    \
  cout << "2nd arg is:" << (Y) << endl;    \
  cout << "Sum is:" << ((X)+(Y)) << endl;  \
}

This solves example 1, because the macro is in one statement block.  But example 2 is broken because we put a semicolon after the call to the macro.  This makes the compiler think the semicolon is a statement by itself, which means the else statement doesn’t correspond to any if statement!  And lastly, example 3 compiles OK, even though there is no semicolon, because a code block doesn’t need a semicolon.

The solution is kind of clever, I thought:

1
2
3
4
5
6
#define MACRO(X,Y)                         \
do {                                       \
  cout << "1st arg is:" << (X) << endl;    \
  cout << "2nd arg is:" << (Y) << endl;    \
  cout << "Sum is:" << ((X)+(Y)) << endl;  \
} while (0)

Now you have a single block-level statement, which must be followed by a semicolon.  This behaves as expected and desired in all three examples.  I have noticed this macro pattern before, but I never really thought about why it was written this way.  Mainly because I don’t often write macros to begin with.

1 You should first ask yourself why you can’t just write a regular function and declare it inline, so that the compiler will do the work for you.  I’m going to assume there is some good reason why you must use a macro.
2 Every way, that is, except that it can’t return a value.  That gets much trickier and involves heavy abuse of the ?: operator, if it is even possible at all.
No Comments
Kip

Monster hangers

Written by Kip on Friday, March 7, 2008 at 2:48 pm (EST)
Tagged as:

In case no one ever told you, Monster cables are a waste of money.  It turns out, a coat hanger is just as effective as Monster Cable at transferring an audio signal.

Kip

Scientists create traffic jams: confirmed

Written by Kip on Wednesday, March 12, 2008 at 11:30 am (EDT)
Tagged as:

Scientists in Japan have succeeded for the first time in experimentally reproducing traffic jams.  You can read about it here or you can read about it here (both articles say basically the same thing).

You can also see a video of the experiment on YouTube.  It is pretty interesting, but I wish they had done more work to figure out how many cars it takes to cause a traffic jam.  Clearly, two or three cars on the track wouldn’t produce a shockwave.  Ten cars might produce one but it would take longer, for example.  Then maybe they could come up with a general equation to predict the capacity of a section of road.

No Comments
Kip

I’m in the New York Times

Written by Kip on Monday, March 17, 2008 at 11:39 am (EDT)
Tagged as:

Well, not quite.  But I was mentioned in a post on the Freakonomics site, which is now hosted on NYTimes.com.  I e-mailed them a link last week, which they proceeded to blog about.  But I didn’t expect my full name to show up in bold text or anything.  Kinda cool though I guess.

Kip

The little things in Firefox 3

Written by Kip on Tuesday, March 18, 2008 at 4:56 pm (EDT)
Tagged as:

A few weeks ago I installed Firefox 3 Beta onto my work laptop, in order to test if two add-ins I wrote would need any tweaking to work.  (These add-ins are simple search bars for people in my company to use to search our source code and our bug-tracking database.)  They worked fine, once I jumped through the necessary hoops to convince Firefox that they weren’t viruses.  But that’s irrelevant; this post is about two small “it’s about friggin time” improvements in Firefox 3.  You can read about the big changes elsewhere.

The first of these changes is the way Firefox handles hyphens in text wrapping.  After a long period of bickering, they finally decided that Firefox (like every other piece of software which displays text) can insert a line break after a hyphen character.  This is something that is particularly annoying to me, since I sometimes use long, hyphenated phrases.  (I’m sure there is a proper name for such a phrase, but I don’t know it.  I guess that’s what I get for not being an English professor.)

Take for example this post from a few weeks ago in, as viewed in FF2 and FF3:

Word-breaking in Firefox 2

Word-breaking in Firefox 3

See how FF2 treats the long line as a single word, rather than breaking the words on hyphens?  In Firefox 3 this has been corrected, which I think is super.

The other small thing is that tooltip text (usually from an object’s “title” attribute) is no longer truncated.  This is mainly a nuisance to me on webcomics xkcd and Dinosaur Comics, where the tooltip text is usually kind of a second punchline.  To demonstrate, here is a screenshot from a recent xkcd comic:

Title tooltips in Firefox 2

Title tooltips in Firefox 3

Much better in Firefox 3.  These two improvements (and the new address bar features) make me excited to use Firefox 3.  Of course, I won’t switch to it full-time until the final release, since most of my favorite add-ons don’t support FF3 yet.

Kip

Super Smash Bros. Brawl

Written by Kip on Monday, March 24, 2008 at 8:52 am (EDT)
Tagged as:

For anyone out there I haven’t exchanged Super Smash Bros. Brawl friend codes with yet, here is mine: 3437-2813-1377.  If you want to give me yours, leave it in a comment of just e-mail me and I’ll add you.

No Comments
Kip

Ice cream trucks

Written by Kip on Tuesday, March 25, 2008 at 9:59 am (EDT)
Tagged as:

A few weeks ago I started seeing an ice cream truck driving through our neighborhood.  This kind of surprised me.  I thought ice cream trucks were a relic of the past, much like newspaper boys and telephone operators.  You know, things that are only remembered in modern society due to their presence in 1950’s sitcoms.  I certainly don’t remember an ice cream truck ever coming through my neighborhood when I was a child (unless you count the Schwan’s man).  In fact, I now have the same reaction to ice cream trucks that I have to male gym teachers and men dressed as Santa Claus:  every time I see one I think “that has to be a pedophile.”  I mean, why else would a person drive an ice cream truck?

Kip

Right of way

Written by Kip on Thursday, March 27, 2008 at 11:24 am (EDT)
Tagged as:

Below is a sketch of an intersection that is the main bottleneck of my commute home from work.  I’ve had a question about right-of-way and I’m curious if any of you know the answer.  In the sketch below, if cars A and B both turned into lane 2, colliding with one another, who would be at fault?

Sketch of an intersection

Not to scale.  Lanes 1 and 2 are actually long enough to hold about 15-20 cars each.  Cars A and B would actually be nearly parallel to one another.

This is an unusual design; typically lane 2 would be created first, and then lane 1 would be created to the left of it.  Instead, we have a lane created in the middle of two lanes.  On the one hand, car A has already turned into lane 1, and now he’d be changing lanes back.  But on the other hand, car A has gotten into the left-turn lanes, and now he wants to pick which left turn lane to use.  It should also be noted that where lane 2 is created, both lines are marked with short dashes.  If one of them were marked with regular dashes it would be clear.

Now what makes this really annoying is that from around 5:00 to 5:45, there are a lot of people that need to turn left here.  So there is a line of cars backing up well into the area that is only two lanes, so there is a long line of cars in lane 3.  What happens is that nearly all of these cars end up turning only into lane 1.  But a few people go past the traffic in lane 4, then move left at the last moment to get into lane 2.  So they only have to wait for the stoplight to complete one or maybe two cycles, as opposed to four or five.  This makes the problem worse, because the line of cars coming out of lane 2 makes it practically impossible for a person who was waiting patiently in lane 3 to merge into lane 2.  I’ve often thought about going from lane 3 into lane 1, and then continuing straight into lane 2 (making the person who skipped the line have to wait).  But I’m afraid if that guy hit me it would be my fault, or we’d both be at fault.  And my sense of politeness keeps me from passing the line and merging into lane 2.  After all, I wouldn’t want anyone to road rage me.

So what I actually do when it’s backed up like this is take lane 4 straight through the intersection, then move left and make a U-turn at the next break in the median, then make a right turn onto the road I want to go on.  This is actually quite easy since a good two-thirds of the traffic either turns left or right at this intersection.

Kip

A Birth Day

Written by Kip on Saturday, March 29, 2008 at 2:36 pm (EDT)
Tagged as:

This is a quick note to let everyone know that Stephanie has successfully given birth.  Emma Leigh and her mommy are healthy and resting right now.  She seems to have gotten in a fight on her way out, so she has a black eye.  But the doctors say this is superficial and she will be okay soon.

Whenever someone at my office has a baby, usually they will send a photo around of the newborn.  And everytime I think “wow, that is gross, why would you share such a gross picture.”  I had always wondered if I would feel differently when it was my own child.  I can now tell you with confidence that I do.  So I hope you’ll forgive me for sharing a picture of our beautiful bruised 93-minute-old baby girl.  More pictures will be up later.

Emma Leigh at 93 minutes old

Kip

More on Emma Leigh

Written by Kip on Sunday, March 30, 2008 at 11:14 pm (EDT)
Tagged as:

Note: You can find the latest photos of Emma on our photos page.  I’ll warn you there are a few photos in there from the operating room.  Nothing graphic, but if you’re grossed out by blood, try not to focus on the BigGulp-sized clear plastic jug of blood that was pumped from Stephanie’s abdomen.

As I type this, Emma is about to turn thirty-six hours old, so I thought those of you out there in internet land were due for an update.  My last post was a little light on details, so I will make up for that here.

We went into the hospital Thursday afternoon in order for Stephanie to be induced, as she was eight days past her due date and they estimated the baby to be about 8.5 pounds.  So Stephanie was given a chemical via IV that caused her body to start having contractions.  Well, for some people induction does not cause the baby to come naturally.  Stephanie is one of those people.  On Friday evening, they decided to try induction again, leading to a long night of contractions, but still no baby delivery.

On Saturday morning Stephanie’s doctor came in and said “we can go take this baby out now by C-section, or we can try induction all day and then take her by C-section this afternoon at five, but she’s not going to come on her own.”  So, naturally, we decided to go ahead and have the C-section immediately.

Well at this point they rolled Stephanie back to the OR and handed me a set of scrubs and led me to an area outside of the OR (but closed off from the main hallway).  After prepping Stephanie for twenty minutes that seemed like an hour, a nurse told me I could come into the OR.

I started to describe the C-section, but then I remembered Gabe doing a much better job of describing the process on Penny-Arcade a while back.  So at this point I’ll just quote him:

They wheeled Kara into the operating room and I followed behind scared to death. I knew what a c section was, or at least I thought I did. I imagined the doctor cutting a little hole in my wife’s belly and then gently removing the baby as though she was taking a quarter out of a coin purse. What I did not expect to see was a doctor pulling with all his might on what looked like a crow bar in an effort to widen the incision enough for a second doctor to wrestle the baby out. It was like some kind of WWE event with doctors up on chairs and blood everywhere. I looked up at one point to see a doctor up to his elbows in my wife’s stomach and I just about lost it. Kara was still cool though and I figured if she could handle I sure as hell better.

That’s pretty much what my experience was, except I didn’t actually look over the curtain at any point.  Apparently Emma has quite a large head, they even had trouble getting her out through the incision they made.  Apparently in a C-section they use some kind of vacuum pump to hold onto the head and pull her out, and she moved her head just as they were putting it on her.  This is what caused the black eye, which is more like a large, really bad hickie.

Eventually they got her out, and we got to see her for the first time.  I am amazed that something that size could fit inside a human being!  They weighed her, cut the umbilical cord (by the way, the cord is not flesh-colored as I had imagined, it’s more like a translucent mucus filled eel-like thing).  They asked if I wanted to do the second cut of the cord, which was a little weird but I guess it’s the tradition.  Then I got to hold our bundle of joy for the first time, and bring her over for Stephanie to see.  She weighed in at 8 pounds, 9.4 ounces, and she was 20.5 inches long.  Which isn’t that much larger than average, but apparently Stephanie wasn’t made for natural childbirth; the doctor said any subsequent children would need to be delivered with a scheduled C-section.  But I guess she is very fortunate to have been born in modern times: two hundred years ago it would not have been likely for either Stephanie or Emma to have survived delivery.

Back to my narrative: next I went to the OR recovery area with Emma, while they finished cleaning off Stephanie.  At this point, there was a bit of a kerfuffle.  The doctor went out and told the grandparents they could come see the baby, but then a nurse told them they couldn’t but failed to explain why very clearly.  The reason was mainly that Stephanie wasn’t out of the OR yet, so she hadn’t even held her baby yet.  And mom gets to hold the baby before any grandparents do; that’s just fair.

But after Stephanie came out and recovered from the surgery for about an hour, we got to roll her and Emma back to the room and everyone got a chance to see her, but very briefly.  They paged an pediatric ophthalmologist to take a look at her eye and make sure there was no serious damage related to the bruises.  Fortunately, she determined that they were only superficial damages that will heal soon.  And I am happy to report now that her face looks much much better than when she was delivered a mere 36 hours ago.

In those last 36 hours, I have suffered from a level of sleep deprivation I don’t think I have experienced since high school, and Stephanie has been even more deprived as she is required to feed Emma every 2-3 hours.  I’ve also learned how to change a diaper and how to swaddle a baby.  Thus far Emma has met both sets of grandparents, her great-aunt Cindy, her uncle Scott and soon-to-be-aunt Sarah.  She also met our pastor and his wife, who came to visit us yesterday evening.

You have probably noticed that her name, when spoken naturally, is virtually indistinguishable from “Emily.”  This isn’t a coincidence, and until recently I adamantly said that I would refer to her as “Emily.”  This wouldn’t be that uncommon, lots of people go by nicknames that are slight variations of their real names (it makes much more sense than “Billy” being short for “William”).  But since she was been born I have found “Emma” to be much easier to say, and there is no long explanation needed when someone asks “and what’s her middle name?”

Well right now Emma has just gone to sleep I’m going to try to catch a little sleep too, before she wakes up again.  We will be in the hospital until sometime Tuesday, but I’m already sick and tired of being stuck in this place.  I haven’t seen too many hospital rooms in my life, but I don’t have fond memories associated with the ones I have seen.  These rooms are the least cold and lifeless of any I can remember seeing, but they still don’t feel comfortable.  But I guess I don’t have that much room to complain.  As far as reasons to be in a hospital go, having a baby isn’t so bad.

As I mentioned above, I have put up pictures of EmmaFor the time being they are on a Flickr account, for various reasons (mainly because I’m on an unsecured wifi network here). Update: the pictures are now hosted on this site.

RSS feeds: Kip's - Stephanie's - Both
Admin