Welcome

You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

The Road To Recovery

Posted by Keith Elder | Posted in General | Posted on 25-08-2009

10

Last week I blogged I was having two surgeries.  I had one surgery on Wednesday and then another on Thursday.  I have to say back to back surgeries were not fun but more importantly the second surgery is the one that took the wind out of my sails. I did ok on the first surgery.  After a couple of days I would have been fine and able to go back to work.

The second surgery I had was an eye surgery.  The official name of the surgery is called “Scleral buckle and vitrectomy”.  Don’t worry I didn’t know what it was either.  The doctor explained this is what he needed to do to repair my eye due to the detached retina.  If you are REALLY curious as to what this surgery entails I invite you to watch the following YouTube video (caution, not for the faint of heart!).

 

While I was in eye surgery, my wife took pictures of the video monitor where family could watch the surgery.  This is me on the operating table.  The surgery took about 1.5 hours.

photo

After surgery I was wheeled out to the front and given some crackers and a diet coke to make sure I wasn’t going to get sick.

photo

The next morning (Friday) at 10:30 AM I had to go into the doctor’s office to get the bandage removed.  At first I couldn’t see anything from my eye and then eventually I was able to see at least two fingers about eight inches from my face.

The good news is the doctor said and I quote: “Keith don’t take this the wrong way but you look beautiful”.  He was referring to my eye of course and that was good to hear.

So I could block out the bad eye to see with the good eye, we bought an eye patch.  The patch was worth every penny because it allowed me to at least see and get around the house.  Covering one eye though is weird as it totally messes with ones perception.  My computer time has been limited to spurts of about 5 minutes since the surgery.  As a matter of fact, it has taken me 5 days to write this blog post.  Very slow going.

Here is a picture of what my eye looked like one day after surgery.  As you can see it is totally swollen shut for the most part.  Don’t let my smile fool you, that’s the pain killers smiling!  You can’t see it from the picture but my eye is completely red. If you have watched the video, you’ll understand why.

photo

 

 

 

 

 

Each day my eye has improved.  To give you an idea how things looked from my view after surgery I took the picture of me sitting in a wheel chair above and simulated what it looked like from my perspective.  The thing I couldn’t simulate was the glare, and a shut eye lid, but hopefully it’ll give you an idea.  As you can see there were big improvements the first few days and then the last several days there are smaller improvements.

DAY 1 VISION

image

DAY 2 VISION

image

DAY 3 VISION

image

DAY 4 VISION

image

DAY 5 VISION

image

It is going to take some time to recover.  I hope by the end of the week I can at least feel well enough to sit down at my computer in the office.  My office has lots of sun light in it and the light hurts my eyes.  Plus having four large LCDs giving off light hurts and creates lots of glare.  While I recover I’m spending my days with the lights off in the living room.

THANK YOU!

I wanted to say thank you publically to my family, friends and the community who have put me in their prayers and continued support through Twitter, Facebook, phone calls, text messages and carrier pigeons.

The next several days I’m going to continue taking it easy to get back to zero.  See you soon.

Two Surgeries In One Week

Posted by Keith Elder | Posted in Uncategorized | Posted on 18-08-2009

31

A few weeks ago I was shopping with my lovely wife and her Mother in Jackson, Ms.  I bumped into a rack of clothes with my chest and it was painful, very sore.  I got to feeling around why I was sore and discovered a lump on my right breast. 

Surgery #1

A few days later I saw a doctor and then another and got scheduled to have surgery.  Tomorrow morning, (Wednesday August 19th 2009), I will be having a procedure called “Subcutaneous Mastectomy”.  Basically the tissue or whatever alien object that is in my breast is going to be removed.  At first I thought cancer, but the doctor gave me the odds that men get breast cancer is 1 in 10,000.  It happens, but apparently men get these lumps more often than most people think.

Surgery #2

Sunday morning I awoke from Devlink 2009 at the hotel in Nashville, TN and it felt like my eye had something on it.  I thought it was a dirty contact lens or something like that but it didn’t go away.  Monday it was worse and my eyes watered all day.  By today (Tuesday) I had had enough, it wasn’t getting better.  Eyes are something I don’t mess with.  I went to the eye doctor and got an immediate referral into a specialist to look at my eye.  It was fast too.  At 4:15 EST I was in the office and by 4:30 I had already seen the doctor and was on my way to the specialist.  Turns out I have a detached retina.  What the…..!  The doctor said he wanted to operate on my eye right then and there or the next day (Wednesday). I explained I was already going in for surgery the next morning so we scheduled it for Thursday.

That is TWO major surgeries in one week.  What in the wide wide world of sports is going on!?  At first I wasn’t going to say anything about my mastectomy but now that I have to have two surgeries, blogging is the only way I can peacefully cope with all of this.  Too much for one person for one week.

Keep me in your prayers the next several days.

Fun With the ?? Operator in C#: if { } or ?? – Which is Faster?

Posted by Keith Elder | Posted in C# | Posted on 06-08-2009

7

Yesterday evening at work a team member and I were pair programming.  We had a disagreement about how to code a few lines.  The question was around whether to use the ?? operator or to use an if statement using String.IsNullOrEmpty.  We settled it like most developers do and that is with a benchmark.  Here’s the fun we had.

To give you an idea as to what we were doing here’s some context.  We had a function that took an object.  We wanted to add extra context data to the object, but only if the object didn’t have it set.  In other words, the data may have already been set somewhere else in the application and we didn’t want to override what was already set.  There were two ways to do this and since I was typing I started typing the following.

   1: private void AddContextData(LogEntry entry)

   2: {

   3:     entry.Url = entry.Url ?? HttpContext.Current.Request.Url.ToString();

   4:     entry.UserIpAddress = entry.UserIpAddress ?? HttpContext.Current.Request.UserHostAddress;

   5:     entry.UserName = entry.UserName ?? HttpContext.Current.User.Identity.Name;

   6: }

My pairing partner started in on me immediately.  He was thinking it should be written like this.

   1: private void AddContextData(LogEntry entry)

   2: {

   3:     if (String.IsNullOrEmpty(entry.Url)) entry.Url = Context.Current.Request.Url.ToString();

   4:     if (String.IsNullOrEmpty(entry.UserIpAddress)) entry.UserIpAddress = HttpContext.Current.Request.UserHostAddress;

   5:     if (String.IsNullOrEmpty(entry.UserName)) = entry.UserName = HttpContext.Current.User.Identity.Name;

   6: }

The ?? for those that aren’t familiar with it is called the “null coalescing” operator. Scott Gu wrote about it late 2007 if you want some additional information and samples.  It is a fun little operator and can save you a lot of typing in more places than you think.  Most developers though don’t think to use it and instead code the long handed version doing a check using a if block. 

In the end we decided to settle our disagreement and go with the one that was the fastest.  Thus we whipped up a quick benchmark to test one vs. the other.  Here’s the benchmark code for both samples.

?? Operator Benchmark Code

   1: string x = "foo bar";

   2: Stopwatch watch = new Stopwatch();

   3: long ticks = watch.Time(() => x = x ?? "bar foo", 100000);

   4: textBox1.Text += "??: " + ticks.ToString() + Environment.NewLine;

 

Note: If you copy the above code, it will not work on your machine unless you have a Time() extension method as part of your arsenal. 

if { } Benchmark Code

   1: string x = "foo bar";

   2: Stopwatch watch = new Stopwatch();

   3: long ticks = watch.Time(() =>

   4:                             {

   5:                                 if (String.IsNullOrEmpty(x))

   6:                                 {

   7:                                     x = "bar";

   8:                                 }

   9:                             }

  10:                 , 100000);

  11: textBox1.Text += "if: " + ticks.ToString() + Environment.NewLine;

The Results

The results were not all that exciting. Really it only proved there was wasn’t any difference in speed, if anything giving a very very slight edge to the ?? operator.  At any rate it was a fun side bar to end the evening.  Happy null coalescing!

image