comments edit

We went camping in Sequoia National Park a couple of weekends ago, a weekend which happened to coincide with our first anniversary! Somehow I convinced my lovely wife that a weekend of camping in the woods among the bears is much preferable to a stay at a nice hotel resort. I mean who wants to be pampered and massaged?

Sequoia National Park is the home of some truly immense trees. I mean really really big trees. The kind of trees that give you a big cramp in the back of your neck if you try to stare at the top for too long, forcing you to walk around staring at the sky causing everyone around you to wonder what the hell you’re looking at. Redwoods may be taller, but no trees have the volume and bulk of the giant sequoias. These things almost seem to generate their own gravity.

Hello In There \ The author loses his head, once again.

This trip found us reuniting with a several members of our intrepid Buring Man 2002 crew. Upon arriving I nearly lost my head at the astounding dimensions of the trees. Pictured above is a little tunnel carved out of a fallen tree. That’s me sticking my head where the sun don’t shine. This fallen tree is one of many among the myriad of trails within the park. If a tree falls in the woods, will it muss up my wife’s pretty pink hat?

The Source of Evian \ The tree was no match for the power of the hat.

Sequoias are notable for the crazy tree people (though so is Green Peace). If you look carefully, you can see them hiding within the burnt trunk of a large tree. Counterintuitively, Sequoias thrive on fire (though not in the same way Cheech and Chong did). They need the occasional forest fire to to survive and thrive. Fires burn off the undergrowth, removing competition for good soil and water, basically keeping out the riffraff. When procreation becomes a priority, they drop off cones containing hundreds of seeds. The seeds remain safely huddled inside until a fire heats up the cone enough to cause the seeds to release. Wandering through the forest, you’ll notice a large number of trees that have grown a thick layer of bark around the scars from forest fires.

Dane Hiding In a Tree Trunk \ The last surviving member of Ponce De Leon’s crew.

Like a runaway pituitary gland, it’s seems that a giant sequoia never stops growing. They can live for a little over 3000 years and have a diameter (at the base) of up to 36.5 feet. If a tree survives fires and other hazards to reach a massive size, the typical cause of death is falling over from its own weight, much like the Lakers did in the finals recently. As can be seen below, its roots don’t run very deep. They dig in a mere three feet.

Roots \ So how do we drag this thing home?

We had this sequoia surrounded, but it wouldn’t be bullied by us and didn’t give up its wallet.

Hands across a sequoia \ Hands across America…a tree.

When camping in Sequoia, the rangers go to great pains to make sure you observe proper bear safety. They’ll go on and on about keeping all food and scented items safely stored away in bear containers. Don’t keep any food in your tent. Don’t feed the bears, no matter how cute they seem or how many GMail invites they offer. Apparently feeding a bear human is equivalent to giving them bear crack. They quickly acquire a taste for it and will go to great lengths to get more. They’ve been known to peel down the window of a car to get at the potential food inside. Sadly, this typically leads to the bears being put down. There were several bear sitings within the campgrounds, including the one sneaking up from behind me in the following photo.

Attacked By Ed Bear \ Unbeknownst to Gandalf, a feral Frodo approached.

A nearby campsite had a black bear crawl on top of their truck and scratch it up a bit, apparently looking for the keys to take it for a joy ride. We spotted the culprit the next morning relaxing in the sun.

Black Bear \ BooBoo was relieved to finally get rid of that annoying Yogi.

sql comments edit

I found a nice tip for selecting random rows from within a SQL Server 2000 database. Well actually, pseudorandom. Since my undergraduate thesis was on the topic of pseudorandom number generation, I might as well be precise. For some reason, my non-geek friends find it awfully funny when I mention pseudorandom numbers.

I digress. In order to select 10 records from some table at random, try this:


Now for my homework, I should find out just how random this is. There’s a whole slew of statistical tests I can run to gauge the randomness of pseudorandom number generator such as the Chi-square Test, Serial Correlation Coefficient, and 2-D Random Walk Test to name a few.

IMPORTANT: Please note that this will NOT work in SQL 7 on NT4 because the NEWID() function there generates sequential results (Bad SQL! Bad!).

UPDATE: My friend Erik referred me to this article that has an overview of several methods for random sampling. Thanks e.

comments edit

Michael MooreI found this scathing review on Slate of Michael Moore and his upcoming flick, Fahrenheit 9/11 I have yet to see the movie but plan to soon. It’s good to read a critical review to make sure I have a balanced view of the movie.

If Michael Moore had had his way, Slobodan Milosevic would still be the big man in a starved and tyrannical Serbia. Bosnia and Kosovo would have been cleansed and annexed. If Michael Moore had been listened to, Afghanistan would still be under Taliban rule, and Kuwait would have remained part of Iraq. And Iraq itself would still be the personal property of a psychopathic crime family, bargaining covertly with the slave state of North Korea for WMD.

I don’t doubt that Michael Moore is biased and self-serving. His movie is designed to provoke a strong reaction, and whether the facts are misinterpreted or self-contradicting, that’s not important to his goals. I figure I will have to take his message with a grain of salt. Many will see his movie once, while they watch Fox news every day. The truth probably lies somewhere in the middle.

As a counterpoint to the scathing review, I offer up another review that points out the great lengths the Moore team went to fact check all their assertions. The review does point out that Moore does insert his prejudices in places, but that his central assertion is well-founded.

Moore is on firm ground in arguing that the Bushes, like many prominent Texas families with oil interests, have profited handsomely from their relationships with prominent Saudis, including members of the royal family and of the large and fabulously wealthy bin Laden clan, which has insisted it long ago disowned Osama.

comments edit

Margaret Cho RevolutionWe recently saw Margaret Cho try out some new material in Claremont. I think she’s absolutely hilarious and poignant. Some say she relies way too much on her Korean mother, but having a Korean mother myself, I think she’s spot on with the impression.

I’m looking forward to seeing her next big movie Revolution. Here’s a nice review from

comments edit

RSS Bandit Logo Plug-ins are a powerful way for users to dynamically enhance the functionality of an installed application. Is there a high priority feature you want that is low priority for the developers? Perhaps you can write a plug-in.

Many RSS aggregators support the ability to add plug-ins through the IBlogExtension interface. Started by Simon Fell, the IBlogExtension is intended to provide news aggregators an extensibility point so that they can be hooked into 3rd party blogging tools such as w.Bloggar.

RSS Bandit is one such aggregator. I recently added documentation which includes a walkthrough for building a very simple plug-in. Please let me know if it is helpful or if you find any errors by commenting here or in the RSS Bandit IBlogExtension forum.

I’m working on a more advanced plug-in complete with configuration settings and a GUI that I will present later.

comments edit

CompilerRegarding Syntax Highlighting, Daniel Turini pointed out that SnippetCompiler has the ability to export code to the clipboard (and to a file) as HTML.

Snippet Compiler has a lot of nice features and is a welcome addition to my toolbox, but purely for syntax highlighting, it has a few disadvantages compared to the website I mentioned previously. First of all, although you can view snippets with line numbers, the line numbers aren’t exported to HTML like Manoli does. Secondly, Manoli handles XML/HTML along with C# and VB, while SnippetCompiler seems to do well only with C# and VB.NET. Lastly, Manoli uses CSS for styling and you can have it embed the CSS definitions in the generated HTML, or reference the provided stylesheet. This is a really nice feature.

One thing I do like about the SnippetCompiler is how the summary tags in the comments are gray while the actual comment is green. That’s a nice touch.


///Manages cool things
public class ThisIsSoCool
    /// This is seriously neat. 
    public void YouShouldTryThis()

comments edit

I’ve probably read a hundred or so posts of people looking for a way to syntax highlight source code listings in HTML. Maybe I’m the last to discover this site, but is the answer for me so far. Just cut and paste some C#, VB, html/xml/aspx code int the text box and click “format my code” and voila! You get some clean HTML displaying nicely formatted code.

The tool allows you to optionally format the code with alternating line colors and line numbers if you so desire.

public class ThisIsSoCool
  ///      /// This is seriously neat.      ///      
  public void YouShouldTryThis()

Let’s try it with line numbers.


   1:  public class ThisIsAlsoCool

   2:  {

   3:    /// 

   4:    /// Look at me ma! I’m using line numbers

   5:    /// 

   6:    public void YouShouldTryThis()

   7:    {}

   8:  }

code comments edit

You’ve probably heard the term Impedance Mismatch thrown around when discussing object relational mapping. I’m sure it comes up every morning at the water cooler. Maybe you’ve even thrown it around yoursef a few times. Do you know what the term means?

Object relational mapping refers to the process of mapping your relational data model to your object model. Object Spaces is a highly publicized framework for doing just that. The mismatch I refer to is a result of the differences in structure between a normalized relational database and a typical object oriented class hierarchy. One might say Databases are from Mars and Objects are from Venus. Databases do not map naturally to object models. It’s alot like trying to push the north poles of two magnets together.

Interestingly enough, the term “Impedance”, now bandied about in software engineering circles, is borrowed from electronics. I’m going to do a disservice to electrical engineers all over the world by offering a very simple explanation. (My aplogies to you EEs out there).

Impedance is the measure of the amount that some object impedes (or obstructs) the flow of a current. Impedance might refer to resistance, reactance, or some complex combination of the two.

Perhaps an example is in order to illustrate impedance mismatching:

Imagine you have a low current flashlight that normally uses AAA batteries. Don’t try this at home, but suppose you could attach your car battery to the flashlight. The low current flashlight will pitifully output a fraction of the light energy that the high current battery is capable of producing. Likewise, if you attached the AAA batteries to Batman’s spotlight, you’ll also get low output. However, match the AAA batteries to the flashlight and they will run with maximum efficiency.

So taking this discussion back to software engineering, if you imagine the flow of data to be analogous to a current, then the impedance of a relational data model is not matched with the impedance of an object hierarchy. Therefore, the data will not flow with maximum efficiency, a result of the impedance mismatch.

comments edit

Quick! What is the definition of the word moot? I’ll use it in a sentence.

Upon reflection, Hezekiah realized that Ezekiel’s argument was a moot point.

If you said something along the lines of “irrelevant”, then you’re wrong. Or perhaps, right. You see, moot is one of those strange words that can be self contradictory. Originally, moot started off as a noun. It was a legal term for a hypothetical case argued by law students. Sometime around the mid 16th century, it changed affiliations and became more commonly used as an adjective.

Thus, in my example above, Hezekiah believes in his heart that Ezekiel’s argument is worthy of debate. However, around the 19th century, people started to use the word to mean “of no particular significance or relevance”, which is the typical usage today. How confusing is that for the foreigner who looks up the word in the dictionary and finds both definitions? Context is everything. Perhaps we can submit the english language to ECMA for standardization.

comments edit

A Short History of Nearly Everything I’m right in the middle of reading this book right now and I can’t heap enough praise upon it. This is a worthwhile read.

LONDON (Reuters) - U.S. author Bill Bryson, best known for his travel writing, has won a major award for something entirely different – popular science.

[Via Reuters: Science]

comments edit

Sequoia National ParkWe’ll be out enjoying the wilderness this weekend at Sequoia National Park. I once worked at a company with Sequoia in its name. This park is not owned by them.

code, personal, tech comments edit

UPDATE: I finally followed up with part 2, only 8 years later.

Typist In PainWhen you ask the average programmer what problems plague the practice of building software, you’ll probably hear responses such as:

The impedance mismatch between relational databases and object oriented code.

The difficulty of writing secure code.

Managing complexity and requirement changes..

Certainly, these are all worthy problems to tackle, but the problem that comes to my mind is how much pain I’m in when I write code and how few people really understand this. I hope to write a series of articles about typing pain and what to do about it based on my experience and research.

If you sit in front of the computer 8 or more hours a day, you’ve probably experienced pain at one point or another in your hands, wrists, shoulders, and/or back. Typically, if you’re like me, you’ll ignore it at first, maybe blame yourself for being weak, try hitting the gym more. However, at one point or another, you have to deal with it because it gets too painful to ignore. Friends and coworkers may not understand, but if you dig around, you’re almost guaranteed to find one or more coworkers who are silently dealing with this type of injury.

And yes, I do mean injury. Everybody seems to want to call it Carpal Tunnel Syndrome (CTS), but CTS is only one small type of injury within a family of injuries often grouped under the term Repetitive Stress Injury (RSI). RSI ailments include tendinitis, neuritis, CTS, etc…

The real difficulty of these types of injuries is that they are a relative newcomer in the annals of medicine and are thus quite misunderstood. From outward appearances, you’re sitting on your ass all day, how can you get injured? Well let me give you some stats.

At the end of an average eight-hour workday, the fingers have walked 16 miles over the keys and have expended energy equal to the lifting of 1 1/4 tons. - DataHand

This rapid increase in RSIs coincides with the increase of personal computer use. There are now an estimated 70 million PCs in the USA. Dr. Pascarelli estimates that RSIs now cost companies $20 billion a year. -

Hopefully the first quote highlights just how much work we make our little fingers do in a day, and the second quote appeals to your (and your employer’s) pocketbook. Much of these costs can be easily reduced dramatically by taking a proactive and preventive approach to RSI. For the company, that means saving a lot of money by not taking a short-sighted approach. Make sure your employees have the right equipment and an ergonomic evaluation. For you the individual, that means making sure you work in an ergonomic fashion and get help at the first sign of pain.

I will talk a bit about my experience in upcoming postings. I continue to struggle with pain, but I currently have Workman’s Comp which pays for my treatments and hooked me up with an ergonomic chair.

Some references of note:

comments edit

Be aware that there is a PayPal scam going around. I received the following email which had a forged from address of “”. There’s a reason they don’t want you to reply, because it exposes the scam. They’d rather have you run the attached program. DO NOT DO IT! This is a scam. It is easy to forge the headers of an email. It didn’t come from PayPal.

Dear PayPal member,\ \ PayPal would like to inform you about some important information regarding your PayPal account. This account, which is associated with the email address\ \\ \ will be expiring within five business days. We apologize for any inconvenience that this may cause, but this is occurring because all of our customers are required to update their account settings with their personal information.\ \ We are taking these actions because we are implementing a new security policy on our website to insure everyone’s absolute privacy. To avoid any interruption in PayPal services then you will need to run the application that we have sent with this email (see attachment) and follow the instructions. Please do not send your personal information through email, as it will not be as secure.\ \ IMPORTANT! If you do not update your information with our secure application within the next five business days then we will be forced to deactivate your account and you will not be able to use your PayPal account any longer. It is strongly recommended that you take a few minutes out of your busy day and complete this now.\ \ DO NOT REPLY TO THIS MESSAGE VIA EMAIL! This mail is sent by an automated message system and the reply will not be received.\ \ Thank you for using PayPal.\ \ uiaumzem

code, tdd comments edit

Test First Development, the process of writing unit tests to test the code you are about to write, is one of my favorite software practices that has an impact on producing better written code. However, it’s no a panacea. It is true that I use the debugger much less often because of TDD, but there are still occasions where it’s important to manually step through code line by line.

Personally, I use NCover as my first line of defense. It highlights the lines of code that haven’t been executed by my unit tests. A lot of these turn out to be non-issues such as the last “}” in a method or an assertion that this line should never happen (for example in the default: section of a switch statement when I believe the default should never be reached).

There are those times, however, when you don’t have time to write a unit test to excercise a particular line of code. Stepping through it is a wise idea.

Also, unit tests won’t uncover errors of omission. Stepping through your code will often jog your memory and remind you that, Hey, I forgot to make the code jump rope here AND I forgot the jump rope test fixture.

comments edit

Google Logo with Burning

Sergey and Larry have moved up a couple of notches of coolness in my book. They’re burners! They attended Burning Man in the summer of 1999. The logo above is what they put on the Google site while they were out of town. In commemoration of the upcoming Burning Man, I’ll put up some picks later from 2002 when we went.

comments edit

ThreadTypically when you spawn a new thread, you want to give it a name to facilitate debugging. For example:

using System.Threading; //.. other stuff.... Thread thread = new Thread(new ThreadStart(DoSomething); thread.Name = "DoingSomething"; threat.Start();

The code in the method DoSomething (not shown) will run on a thread named “DoingSomething.”

Now suppose you’re writing a socket server using the asynchronous programming model. You might write something that looks like the following:

using System.Net.Sockets; using System.Threading; ManualResetEvent allDone = new ManualResetEvent(false); public static void Main() {     Socket socket = new Socket(...); //you get the idea     while(true)     {         allDone.Reset();         socket.BeginAccept(new AsyncCallback(OnSocketAccept), socket);         allDone.WaitOne();     } } public void OnSocketAccept() {     Thread.CurrentThread.Name = "SocketAccepted";     allDone.Set();     // Some socket operation. }

In the example above, we’re setting up a socket to call the method OnSocketAccept asynchronously when a new connection occurs.

When you run this, it may work just fine for a while. It might even pass all your unit tests. Don’t you just feel all warm and fuzzy when the green bar appears? Put this in production, however, and that warm and fuzziness may turn into cold dread as you’re guaranteed to run into anInvalidOperationException.

Why is that? Underneath the hood, when the OnSocketAccept method is called, the CLR rips a thread from from the CLR’s thread pool. When the method completes, the thread happily returns to the pool to finish its Pina Colada. Eventually, that thread will resurface, and that’s where the problem arises.

You can change the name of a thread, but you can only change it once.If you try to change it again, you’re greeted with an InvalidOperationException. When a thread is returned to the thread pool, it holds onto its name. Its happy to have a sense of identity and will hold onto it even when it resurfaces to execute another method. To protect from this, always check the name of a thread before setting it like so:

if(Thread.CurrentThread.Name == null)     Thread.CurrentThread.Name = "MyNameIsBob";

Your threads will thank you for it.