comments edit

Bush PraysSaw this going around the web. Classic!

Dear President Bush, Thank you for doing so much to educate people regarding God’s law. I have learned a great deal from you and try to share that knowledge with as many people as I can. When someone tries to defend the homosexual lifestyle, for example, I simply remind them that Leviticus 18:22 clearly states it to be an abomination. End of debate. I do need some advice from you, however, regarding some other elements of God’s Laws and how to follow them:

​1. Leviticus 25:44 states that I may possess slaves, both male and female, provided they are purchased from neighboring nations. A friend of mine claims that this applies to Mexicans, but not to Canadians. Can you clarify? Why can’t I own Canadians?

​2. I would like to sell my daughter into slavery, as sanctioned in Exodus 21:7. In this day and age, what do you think would be a fair price for her?

​3. I know that I am allowed no contact with a woman while she is in her period of menstrual uncleanliness (Lev. 15:19-24). The problem is, how do I tell? I have tried asking, but most women take offense.

​4. When I burn a bull on the altar as a sacrifice, I know it creates a pleasing odor for the Lord (Lev. 1:9). The problem is my neighbors. They claim the odor is not pleasing to them. Should I smite them?

​5. I have a neighbor who insists on working on the Sabbath. Exodus 35:2 clearly states that he should be put to death. Am I morally obligated to kill him myself, or should I ask the police to do it?

​6. A friend of mine feels that, even though eating shellfish is an abomination (Lev. 11:10), it is a lesser abomination than homosexuality. I don’t agree. Can you settle this? Are there “degrees” of abomination?

​7. Lev. 21:20 states that I may not approach the altar of God if I have a defect in my sight. I have to admit that I wear reading glasses. Does my vision have to be 20/20, or is there some wiggle-room here?

​8. Most of my male friends get their hair trimmed, including the hair around their temples, even though this is expressly forbidden by Lev. 19:27. How should they die?

​9. I know from Lev. 11:6-8 that touching the skin of a dead pig makes me unclean, but may I still play football if I wear gloves?

​10. My uncle has a farm. He violates Lev. 19:19 by planting two different crops in the same field, as does his wife by wearing garments made of two different kinds of thread (cotton/polyester blend). He also tends to curse and blaspheme a lot. Is it really necessary that we go to all the trouble of getting the whole town together to stone them (Lev. 24:10-16)? Couldn’t we just burn them to death at a private family affair, like we do with people who sleep with their in-laws (Lev. 20:14)?

I know you have studied these things extensively and thus enjoy considerable expertise in such matters, so I am confident you can help.

comments edit

Time to get political. I loved how Kerry caught Bush off-guard when he pointed out that in 2002, Bush said he wasn’t concerned with Osama. Realize this is at the same time our troops were in Afghanistan looking for the bastard. I think that beats the out of context “nuisance” quote by a mile, because even in context, Bush’s quote is damning.

comments edit

Colin sent me an email pointing me to an add-in he wrote for VS.NET that allows you to copy selected source code to the clipboard as syntax highlighted HTML.

By selecting some code and right clicking the code editor, you’ll see an option to Copy Source as HTML.

Selecting that menu item brings up a dialogue where you can configure some options. It’s based on my favorite code to HTML formatter by Manoli.

Below is an example of a code snippet using this tool:

/// <SUMMARY>
/// Sets the stack trace for the given lock target 
/// if an error occurred.
/// </SUMMARY>
/// <PARAM name="lockTarget">Lock target.</PARAM>
public static void ReportStackTrace(object lockTarget)
{
  lock(_failedLockTargets)
  {
    if(_failedLockTargets.ContainsKey(lockTarget))
    {
        ManualResetEvent waitHandle = 
            _failedLockTargets[lockTarget] 
                 as ManualResetEvent;
        if(waitHandle != null)
        {
            waitHandle.Set();
        }
        _failedLockTargets[lockTarget] = new StackTrace();
        //TODO: Now's a good time to use your
        //favorite logging framework.
    }
  }
}

Colin, thanks for pointing me to this. This is freakin’ awesome!

Now, if I could have a short-cut that would use the default options and immediately put the selected source in the clip-board, that would just rock my world. Also, one minor niggle I’ve had with the Manoli formatter is that the xml comments tags and the triplle slashes (such as /// ) should be gray to mimic VS.NET instead of all green. How hard would it be to fix that?

comments edit

Dave Winer points to a blog posting by Erik Speckman calling Google Desktop Search a disappointment. One complaint that Dave shares is that Google search only works with certain file formats. He wants to be able to add plug-ins for file formats it doesn’t already understand.

Well first of all, this is a BETA technology. I think it’s a tad bit premature to call it a disappointment just yet. It’s already far better than any other free desktop search utility out there.

Secondly, it may well be as extensible as Dave and Erik would like, but as a BETA product, we can’t be sure yet because such interfaces are not published. Scott Hanselman started digging into it a bit and noticed various dlls used to implement searching across IE and Outlook. That suggests that there might be a plug-in architecture they will expose later (perhaps after getting feedback during the BETA trial). In any case, Scott’s peek inside is a worthwhile read.

UPDATE: Erik notes in reply on his blog that I have a valid point regarding Google Desktop’s BETA status, but that the point of a BETA is to gather criticism. I agree wholeheartedly and I think he gives some solid suggestions to the Google team. The title of his reply is “Google Desktop Search BETA is a disappointment” (emphasis mine). That clears it up for me. :)

If you’re a Windows, Office, and Outlook user like me, I think you’ll find the BETA worthwhile. If not, Google has some work to do to make sure the final product isn’t a disappointment for users like Erik and Dave. Hopefully we’ll see an extensibility framework come out for it.

code comments edit

By now you probably think I have an unhealthy obsession over the TimedLock struct. Well, you’re right. I think it’s emblematic of the right way to do things and shows that the right way isn’t always the easiest way.

In Ian’s last post on the TimedLock, he talked a bit about the performance considerations with my solution to keeping track of stack traces in a multi-threaded situation. To sum, my solution is pokey in certain situations. As always, measure measure measure.

However, Ian mentioned a solution outlined by Marek Malowidzki that avoids creating a stack trace on every lock acquisition. Instead, he only stores the stack trace when a lock timeout occurs, thus avoiding the performance penalty of my implementation. Unfortunately, there’s no source code posted for examination.

So I decided to implement Marek’s solution based on Ian’s write up. As Ian mentioned, it would probably be best if the blocking thread didn’t throw an exception, but logged diagnostic information if it detects that some other thread timed out while trying to acquire a lock on the target. I put a very helpful //TODO: right where that should happen since everyone has their own preferred logging framework.

As stated in the write-up, when thread fails to acquire a lock, it adds the object it was trying to lock to a Hashtable as a key with a NULL value. When the blocking thread is about to exit the synchronization block, it checks this hash table and if it finds the object it is locking in there, it will set the value for the Hashtable item as its own stack trace.

Thus if you catch the LockTimeoutException, you can have it try to obtain the stack trace from the Hashtable (supplying a wait since it might not be there immediately). However, there’s one potential problem here. If you don’t remove that object from the Hashtable after you’ve looked at it, the next time you lock on that object and then release it, your blocking thread will think an error occured and log some diagnostic information. This isn’t too bad since it doesn’t cause a LockTimeoutException to be thrown.

One thought I had was to check the Hashtable when I first successfully acquire the lock on a target and remove the target if its already there. However, that’s not safe as it’s quite possible that another thread failed after the blocking thread acquired the lock but before it examines the Hashtable.

Instead, when you call GetBlockingStackTrace, it retrieves the stack trace from the Hashtable, stores a reference locally, and then removes it from the Hashtable.

In any case, I’ve posted the source code in my TimedLock repository on GitHub.

DISCLAIMER: The code to keep track of stack traces is designed for debugging only and is turned on by setting the conditional compilation variable #DEBUG = true. I make no guarantees and pity the fool who deploys this version of TimedLock.cs in a production system with #DEBUG = true. Please let me know if you see any problems with this implementation. So far it passes my tiny suite of unit tests.

UPDATE: I accidentally linked to the old TimedLock. The link above has been updated.

UPDATE #2: Eric discovered a subtle bug in my older implementation of TimedLock which he describes here. Nice work in tracking that down!

comments edit

Found this on Boing Boing. School photos will never be the same. I always thought the point was to look miserable.

\ Mrs. Xiang sex-ed class demonstrate a keen knowledge of their studies.

Click the pic for the larger image.

UPDATE: Found a news story about this particular photo here.

blogging, humor comments edit

PubSub is no longer around, so those links will be broken. I’ve written a new post that provides fresh opportunities for being a vain blogger.

Vanity I’m not the first to say it and I probably won’t be the last. But blogging is pure vanity, and new services out there just make it easier and easier to inflate one’s head.

For starters, the vain blogger will subscribe to his own RSS feed (or ATOM feed) in his favorite RSS reader. The vain blogger will assure you that this is for quality assurance purposes, but the astute reader can see right through that smokescreen. Obviously this is just the blogger’s vain longing to gaze at his own writing akin to staring at a mirror.

The next step is to install the Google Toolbar so the vain blogger can check his Google PageRank every day, in hopes of seeing even the slightest climb validating his pathetic existence.

“Hey! Look at that. It moved up a notch from 3 to 4!!! I’m a GOD! You really love me! Now please click on the ads below and make me RICH!”

Naturally, if the vain blogger is using .TEXT, he’ll religiously check the admin section hourly for page view and aggregator stats and pore over the referrer lists looking for that lone referral that is NOT a result of a Google search.

The more sophisticated vain blogger realizes poring through referrer logs is futile and steps it up a notch by using tools such as Technorati, Feedster (no longer around), and PubSub (also gone bye-bye). These tools enable the vain blogger to register his or her blog on their search engines and then subscribe to a feed of blogs that mention or link to his own. Ah… this takes the blogger to the next level of vanity. But it doesn’t stop there.

Pubsub provides a link rank page. Enter a domain and it displays where it ranks in the blogosphere. Today my blog jumped from 2048 to 1893! Wohoo!…I think. I have no idea what that number means or what the total range is, but that’s inconsequential to the vain blogger. It’s a number, and it’s better than it was. That’s all that matters.

What is vanity if there is nobody around to behold it. Thus the vain blogger whores himself out by linking to Scoble or Dave Winer in hopes of a back referral and perhaps endorsement. Better yet, he’ll try to get link to his blog posted on BoingBoing to drive some real traffic to the site.

Ah yes, as we see, blogging is pure vanity. As the author of this respectable blog, I vow not to drag it and its readers through the dirt of such degrading procedures. No no. I will not debase myself in such manner and will strive to stay on the high ground. I will retain my dignity and integrity.

Unless of course you can get me on Slashdot…

UPDATE: One tool on the vain blogger’s utility belt I forgot to mention is blatant self promotion. Got that one from Brian Bailey’s tips for a better blog, but it applies just as well to vanity.

Tags: blogging, Meta blogging

comments edit

My knee is now to the point that I’m ready to play in a local soccer league. My first game is this Sunday in Van Nuys. Wish me luck and no injuries. I’ve been watching World Cup Highlights so I’m ready to samba the beautiful game.

comments edit

So Twiggy’s a fast learner. She now knows that the proper place to do her thing is outside and not in the house. She even knows to whine if she needs to go so. The vet removed her stitches and she has an appointment to get spayed soon. We’re a little worried about it as we hear it can be a difficult operation, but I’m sure she’ll do fine.

\ Twiggy in her favorite spot

She’s also a friendly dog. She scared this poor chihauha puppy by trying to run up to it and greet it. The only time Twiggy barks is when she can hear a dog nearby and wants to play.

\ Twiggy on alert for terrorists while the shadows approach.

We’re waiting for some sweaters and a parka we ordered for her. She’s all skin and bones and we hope to take her along when we visit my folks in Alaska for Christmas.

\ Giving us the evil eye.

In any case, we’re doing all we can to provide her with a good home and she seems happy for it. She never comes to me when I call her to, but the instant I sit on a couch, she shows us her true speed with a mad dash and a hop by my side.

\ With her mommy.

The next step for Twiggy is to start her off on some elementary topics in OO design and hopefully progress to an understanding of how to build enterprise systems using the .NET platform. The expense is getting to the point that she needs to earn her keep. Besides, I hope this to be a technical blog and she should be providing content. Her first assignment is to provide an overview of generics in .NET 2.0. Good girl! Good girl!

code comments edit

When conducting phone interviews, I like to ask a few technical questions just to make sure that a candidate isn’t trying to blow smoke up my… well we don’t need to be overly illustrative do we?

I absolutely do not intend the questions to be nitpicky. Nor do I feel they are totally representative of an interviewee’s depth of knowledge. I save the probing questions for an in-person interview.

However, if a candidate claims to have one or two years experience working with ASP.NET, there are some basic facts and principles that a mid-level developer should know.

For example, please compare and contrast the result when calling Response.Redirect and Server.Transfer from within a Page class. It boggles my mind that most candidates I talked to couldn’t answer this question. These methods are used quite commonly and the differences are important.

Sure they both present the user with the contents of a new page. But how they do it has ramifications for you web app. With a call to Response.Redirect, the server basically sends an HTTP header back to the client browser with an HTTP status code stating that the object has moved along with the new location to find it.

See the snippet of an example HTTP header below when Response.Redirect("somewhere/newlocation.aspx") is called.

HTTP/1.1 302 Object movedServer: Microsoft-IIS/5.0Location: somewhere/newlocation.aspx

This tells the browser that the requested resource (page) can be found at a new location, namely somewhere/newlocation.aspx. The browser then initiates another request (assuming it supports redirects) to somewhere/newlocation.aspx loading its contents in the browser. This results in two requests by the browser.

One ramification of this is that if the initial request was a form POST, the posted form fields are not available in the second request. Likewise query string parameters are unavailable unless the page that issues the redirect explicitly tacks them on. Also, since the browser initiates the second request, it is possible to redirect to a page on an external site.

In contrast, Server.Transfer transfers execution from the first page to the second page on the server. As far as the browser client is concerned, it made one request and the initial page is the one responding with content (this point often confuses new ASP.NET developers as the browser still shows the URL of the initial page even though the content is generated by the second page. It all makes sense when you understand what is happening.).

The benefit of this approach is one less round trip to the server from the client browser. Also, any posted form variables and query string parameters are available to the second page as well (however these can be cleared by passing in false for the second parameter).

One thing to be aware of is that if the first page wrote something to the Response buffer and you don’t clear it, then any output from the second page will be appended to the output of the first. This is often the cause of a weird behavior where it seems that a page is returning two different pages. Also, since the transfer happens on the server, you cannot transfer a request to an external site.

You’ve been warned. Make sure you wow that next interviewer with your knowledge of ASP.NET.

For extra points, explain how ASP.NET sometimes returns a “View State Is Invalid” error message when you call Server.Transfer(“URL”, true). The explanation is here.

Also, note that the “Response” and “Server” objects I refer to are properties of the System.Web.UI.Page class. The types for these objects are System.Web.HttpRequest and System.Web.HttpServerUtility respectively.

If you like understanding how things work under the hood, I highly recommend Fritz Onion’s book, Essential ASP.NET 2.0. It is personally my favorite book on ASP.NET as it covers only what is essential, but at a deep enough level to really get something out of it.

His 2.0 book is actually a continuation on his 1.0 book, Essential ASP.NET With Examples in C#.

comments edit

Akumi’s mother is visiting us from Tokyo for a couple weeks. I have to say, if she decided she wanted to move in, I would not complain.

The other day she cooked us a fantastic Japanese dinner, with a couple dishes I had never tried before. When I got home yesterday, she had cleaned our back patio and fed the dog.

The only problem is that she doesn’t speak much English (though she understands more than she lets on) and I speak even less Japanese. So we don’t spend a lot of time in conversation, but she seems to enjoy my style of physical comedy (intentional or not).

comments edit

With my brother-in-law in town from Tokyo, it is important that we survey the local club scene. Serious business. The past two Saturdays we went out to see different DJs at Avalon. I’m not sure I want to go back any time soon.

One thing that bothers me is the price of a drink at a club. I expect a mark up, but $10 for a few squirts of alcohol in a plastic cup!? Give me a break! Those prices are insane and it literally sickened me. After my fourth drink.

comments edit

This is a hilarious video from the Conan O’Brien show.

What happens when you need a personal touch to your computer problem and your tech support department is in India? Most people would just call a tech support hotline, but not comedy writer Andy Blitz. He decides to fly to India with his computer and get it fixed in person.

Watch and find out.

comments edit

Ok, I just have to take a moment to rant a bit. We’re currently looking for some mid-level developers as well as a System Administrator. Naturally we posted a job description on Dice.com and craigslist.org. In general I find the best candidates through referral, but occasionaly I’ll get a few good ones through a job site.

If the crop of resumes and cover letters I received is a fair indication of the quality of developer job applicants out there (and I hope and believe this is not the case), then either the U.S. developer population is nearly fully employed (in which case I’m cool), or outsourcing to offshore countries is starting to make a lot of sense.

So let’s start of with an episode of:

Haacked.com’s 4 Tips For Job Seekers

1. Your cover letter and resume should be an example of the best work you can do. \ Initially, I have absolutely nothing to judge you by except your resume and cover letter. So take the time to get it right. If you’re applying to be a system administrator and you spell virus as viurs, I have to wonder if you’ll take the same care with our production servers.

If you are a developer, don’t tell me I spend 5 years working ASP.NET sites. Try to squeeze a preposition in there. I get absolutely giddy with joy when I receive a cover letter that is concise and well written. Compared to the other gruft I get, a well written cover letter is page gripper. I’ll take it to the beach and read it over and over.

2. Learn to use a spell-checker and have someone else proof-read your resume. \ As a developer, I understand that a spell checker chokes on the line where you list your skills as

Expert in C#/C++/C/PERL/J++/WMD/ASP.NET/Stamp Collecting/Java/J2EE/Oracle/Cisco/SQL/Table tennis/Chess/Jai-Alai/Math/

But you’re supposed to be a problem solver. Figure it out. If your resume has obvious spelling and grammar errors, it reflects poorly on yourself (see tip #1).

3. Provide working and professional contact info\ I kid you not, I received a resume with the email address WatchYoBack@[Domain Witheld].com.

Trust me, I’ll do exactly that by not calling you. In this particular situation I didn’t notice the email address and tried to call the applicant. Both his cell number and land line were disconnected. Apparently you didn’t watch yo phone bills.

I can’t imagine what would compel you to send me a resume with phone numbers that don’t work.

And why use such an email address when you can create one for free. It doesn’t have to be your name. It can be something obtuse or abstract. But I’d recommend against threatening people to watch their back in your email.

Another applicant had an email address where the domain name is slang for sexual intercourse. Something to do with uglies. That one I found funny, but would not recommend it as not everyone shares my sense of humor.

4. Lastly, do provide an updated resume \ I was speaking to one candidate and he started talking about recent employers that I could not find on his resume. His last job listed ended in 2003. When I asked about this discrepancy, he apologized and said that he hasn’t updated his resume in a while. That’s odd I thought, I downloaded this resume off his website like he asked me to. There were two links, one for a resume as a Word document and one for a resume as a PDF.

Apparently neither of those resumes were updated. I was supposed to click on a tab of his website with the word experience and look at his HTML formatted resume. Are you trying NOT to find a job? Do us all a favor, send a nicely formatted resume when you apply for the job, or don’t apply at all.


That’s it. Only four. I don’t have time to tell you how to look for a job. Besides, I think Joel Spolsky did a fine job in this article. You might be quite qualified, but you’ve disqualified yourself by using poor English, bad spelling, and general inability to communicate well. Undoubtedly I’m preaching to the choir. But if you know people looking for a job, remind them of these four tips.

And with that, I end my rant. Have a nice weekend everybody.

personal comments edit

My buddy Ed posted some pics from Burning Man this year. This pedal powered Ferris wheel particularly caught my eye. How cool is that!

Ferris Wheel \ When you can’t afford a hamster.

I wish I could have been there to try it. Visit Ed’s blog to see some more great pics.

NOTE: He’s got one of them stupid Xanga blogs so I can’t link directly to the entry. You might have to hit the “Next 5” link a few times if you see this much later. The pics were taken on September 29.

comments edit

Think back to the last week or month of IM conversations you’ve had. Perhaps you have archiving on and can actually read them. Now, I want you to take a megaphone and broadcast those conversations while at the same time emailing them to everyone in your address book. Don’t forget to print a copy for your coworkers and boss. Quick poll of hands, who’s willing to do this?

Except for you exhibitionists out there, there’s probably not too many hands in the air (you can put them down now). What not many people realize (and for you techies, tell your non-tech friends) is that using an IM tool is equivalent to broadcasting your conversations. Now, not every company is listening to those conversations, but all it takes is a widely available network sniffer and an inclination.

IM clients send messages in clear text over the network. So if big brother feels like listening in, no problem. Some companies employ tools for archiving IM conversations by their employees and analyzing them to see if corporate secrets are being leaked.

If you’re going to talk about sensitive topics, I’d recommend using an IM client that encrypts communications. The Jabber protocol provides encrypted communications. The client I’m using is Pandion (haacked@pandion.be).

You’re employer does NOT need to know about that suspicious rash you acquired after your business trip to Asia.

comments edit

You gotta love the Japanese for making such interesting products. The company that makes this disembodied arm pillow has sold 1000 units since last December. It’s actually genius if you think about it.

Disembodied Arm \ Aiko’s pillow attempts to cop a feel

My arm always falls painfully asleep when my wife lays on it like in the picture. I could get one of these and reclaim my arm. Just as long as the pillow doesn’t try to make any untoward moves.