It doesn’t get cooler than NASA! I would have loved to have been an astronaut! Space walkin’.
Category: Technology
All things geeky.
Doug’s Mantras
McCaughan’s Law of Solutions:
Ask five different programmers the same thing and you will get five different answers…and they will all be correct.
Today’s Programming Advice – Code for the impossible
Always code for the impossible case! The impossible tends to happen surprisingly often. The programming language is irrelevant. Whether you code in C, C++, F#, ColdFusion, PHP, JavaScript, or whatever, conditional statements and case statements should always accommodate the unexpected value.
Right now I am dealing with some code that involves a list of 1 or more items. The actionable part of the code involves clicking on one of the items in the list therefore at least 1 item must exist. Having zero items is impossible because if there were no items then I could not click on the item to start the actionable part of the code. So why waste time coding of the zero items case? This is not the best example since this is a multi-user, client/server web application and the zero case can be created quite simply by having two users pull up the same list and then one user deletes an item before the other. But that answers the question of why waste time coding for the impossible? Because it does happen. My code frequently has conditional statements that end with a default case or a special case that simply outputs "This is impossible. Please contact the administrator." and includes some debugging information. In my career, doing this has saved me hours and hours of debugging time on more than a couple of occasions.
Losing My Google-fu
Yesterday Cathy had the great idea to post the Human H1N1 Swine Flu Map. (there are dozens but this one in particular by a person nicknamed Niman is particularly excellent) I followed her lead and also posted the map because I assume that Domestic Psychology and Reality Me have slightly different audiences albeit with some natural overlap. Her post stayed off the radar and mine jumped to the number one position in Google’s search results, Dogpile’s search results and CNN’s search results for the keywords "swine flu map" which was pretty cool. The post even hit digg (a first for me). The Internet is a fickle place. At the time I began composing this post, I was in 4th position on Google and not even on page 1 for CNN or Dogpile. By the time I finished typing this I was in 5th position on Google. The programmer in me wants to jump over to Cathy’s site and figure out why mine seems to have SEO’d well and hers didn’t. The marketer in me is kicking me for not having redesigned the appearance of Reality Me yet to make it more inviting for visitors to want to continue reading. The bounce rate on this moment of fame was incredibly high. Basically, the landing page gave the visitor no reason to stay on the site. That will have to be fixed…in June. Never judge a web developer by his own site. My time needs to be spent on my clients’ sites. Now back to work!
That itch that won’t go away
My computer has been performing poorly. So this morning I ran my virus scanner with its toughest settings for piece of mind. Instead I found a virus:
- C:\Documents and Settings\Doug McCaughan\Application Data\Google\mupd1_2_12916358.exe Malware name:Win32-Trogan-gen {Other} Virus/Worm
Guess it is time to do a security sweep of the home network. I bet the kids computers are overrun.
How is Firefox reading my mind and will it cause cancer?!
In Firefox’s search box, I typed "Mysql error no. 1130" and almost as fast as I typed the individual letters, the drop down box was recommending potential searches. It does this incredibly accurately and quickly for bizarre terms that under normal circumstances would never be put together. How are they doing this?! Programmaticly I can conjecture at how they’ve pulled this off. It’s a very impressive feature! (particularly if it really is using mind reading)
This just says so much!
It’s simply amazing a how you can derive about a person in 140 characters.
OOOooh NO!
Starting on or about the third week of April, users still running IE6 or IE7 on Windows XP, Windows Vista, Windows Server 2003, or Windows Server 2008 will get will get a notification through Automatic Update about IE8. This rollout will start with a narrow audience and expand over time to the entire user base. On Windows XP and Server 2003, the update will be High-Priority. On Windows Vista and Server 2008 it will be Important. [Source, IEBlog, Prepare for Automatic Update distribution of IE8]
Thank you!
I banged my head against a wall last night until it bled. I woke at 3:30am this morning to pound on the wall some more. I consulted peers on IRC. I Googled. I Blingo‘d. Finally I began to type my situation here.
On one of my projects, I am using a modal dialog to present forms to the user. These forms submit the user input to the server via ajax and depending upon the return from the server either present an error message or perform and action then close. The staple of a good programmer is code reuse. In my case, I have written a module to pop up the dialog box and, based upon a variable passed into the module, populate the dialog box with the correct form.
I proceeded to type an abbreviated, generic version of the code segment that was giving me grief. And as I neared the end, I saw my typo! Problem resolved. Life can move on. Now that’s a good use of a blog!
2nd Place: “Women Were Designed For Homemaking”
Maybe the Creationists are onto something!
Jonathan Goode (grade 7) applied findings from many fields of science to support his conclusion that God designed women for homemaking: physics shows that women have a lower center of gravity than men, making them more suited to carrying groceries and laundry baskets; biology shows that women were designed to carry un-born babies in their wombs and to feed born babies milk, making them the natural choice for child rearing; social sciences show that the wages for women workers are lower than for normal workers, meaning that they are unable to work as well and thus earn equal pay; and exegetics shows that God created Eve as a companion for Adam, not as a co-worker. [Source, OBJECTIVE: Ministries, Fellowship Baptist Creation Science Fair 2001 Article by Dr. Richard Paley & FBCSF Staff]
Other winners:
- Elementary School Level
- 1st Place: "My Uncle Is A Man Named Steve (Not A Monkey)"
- 2nd Place: "Pine Cones Are Complicated"
- Middle School Level
- 1st Place: "Life Doesn’t Come From Non-Life"
- 2nd Place: "Women Were Designed For Homemaking"
- High School Level
- 1st Place: "Using Prayer To Microevolve Latent Antibiotic Resistance In Bacteria"
- 2nd Place: "Maximal Packing Of Rodentia Kinds: A Feasibility Study"
The Creation Science Fair honorable mentions are equally as great with my favorite being a tie between "Pokemon Prove Evolutionism Is False" and "Thermodynamics Of Hell Fire."
Networking Madness
Last night our wireless networking seemed to quit working. The wired network seemed fine. So I attempted to log into my favorite router, my D-Link DIR-615, only to find it would not accept my administrator password. A wave of panic washed over me. Didn’t I change that password so Cathy could block the children’s Internet access when they needed a little guidance? If I did, I certainly don’t recall telling her how to access the router’s management software. I searched for a way to hack my own equipment hoping there was a reset option that would reset the password without losing the logs, security settings, etc. I efforts turned up nothing. All I could do was hold down that reset switch to return the router to factory defaults. On the positive side, it kept the firmware updates in place. I’ve dorked with the router settings enough that this exercise was probably necessary anyway. So how did it happen? The only thing I can figure is that when I tripped breakers for the water heater repair this past weekend the router probably got borked.
Links of Interest
The stuff that I’ve been working with today:
- jQuery Plugin: Validation See also: demos
- metadata plugin
- form plugin for AJAX submit
- Mastering Ajax, Part 10: Using JSON for data transfer
ShareThis WordPress Plugin Broken – Easy Fix!
I recently added a ShareThis link to each of my posts. I chose ShareThis.com because it seems to be very robust while leaving a relatively small footprint on the blog and appears relatively unintrusiveness and benign. Of course, some folks will be quick to point out that the tracking features and having the icon linked back to sharethis.com is very intrusive and anything but benign. In this instance, I don’t see it as that big a deal. One of the attractions to ShareThis.com was its WordPress plugin making setup as easy as going to the website to generate the widget code, then inserting that code in the settings box on the admin screen in your WordPress blog. But it didn’t work.
At ShareThis.com, a publisher generates a script that looks like this:
<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345&type=wordpress&embeds=true&post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&headerTitle=Thank%20you%20for%20sharing!"></script>
After updating, the code will have a 2nd publisher id appended to the end. With two publisher ids, ShareThis will not register your site nor collect statistics.
<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345&type=wordpress&embeds=true&post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&headerTitle=Thank%20you%20for%20sharing!&publisher=a1b2c3d4-ijkl-mnop-qrst-u4w2y10a2r4d"></script>
After reviewing the plugin code, I realized the way ShareThis generates the script must have changed overtime. Crowd Favorite wrote a great plug-in but it expects the publisher=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx to be at very end and if it does not find a publisher id at the end, it puts one there which is why you will end up with two publisher ids. To fix this, simply move the publisher id to the end of the script before pasting the code into the ShareThis settings box in the WordPress admin:
<script type="text/javascript" src="http://w.sharethis.com/button/sharethis.js#type=wordpress&embeds=true&post_services=facebook%2Cdigg%2Cdelicious%2Cybuzz%2Ctwitter%2Cstumbleupon%2Creddit%2Ctechnorati%2Cmixx%2Cblogger%2Ctypepad%2Cwordpress%2Cgoogle_bmarks%2Cwindows_live%2Cmyspace%2Cfark%2Cbus_exchange%2Cpropeller%2Cnewsvine%2Clinkedin%2Cfriendfeed&headerTitle=Thank%20you%20for%20sharing!&publisher=abcdefgh-ijkl-mnop-qrst-uvwxyz012345"></script>
Note: In the settings box, the & will be converted to just & but the code correctly uses & with the post. Your code will still be xhtml compliant.
URL Shorteners Causing a Stir
The Internet is in an uproar this morning. This uproar will probably be done in the next couple of hours for all but a few select people like the programmers at Twitter and Delicious. The debate? Are URL shorteners good or evil?
URLURI shorteners take a long URL like http://realityme.net/2008/08/21/can-you-rely-on-twitter-for-breaking-news/ which search engines love for the embedded keywords and reduce them to as few characters as possible like http://tinyurl.com/43abj6 which search engines may or may not like. Joshua Schachter has posted about the evils of URL shorteners with a plethora of comment from people on both sides of the fence. Dave Winer, who pioneered RSS, says that URL shortners are risky. Basically the concern is that we are creating a situation where broken links may abound on the Internet. Since two URIs go to the same place, content is being duplicated in search engines and bookmarking services and since some of these services use 301 redirects while others use 302 redirect we have no good way of crediting the link to the source. (301 means the uri has been permanently moved to a new uri, ie. the original long uri, and 302 means that the uri has been temporarily moved meaning the search engine or bookmarking service should record the short uri as the permanent resource). Other concerns revolve around archiving and longevity of these shortening services. If Twurl goes out of business, most of my shortened uris will break. As an example of this, Twurl.nl is no longer Twurl.nl but is now Tweetburner. After reading this analysis of uri shortening services, I don’t think I will be using Twurl/Tweetburner anymore anyway; I love their stats but a 302 redirect is deplorable.
To shorten or not to shorten, that is the question. A proposed solution is that publishers should automatically offer their own shortened URLs which could hurt your searchengine-fu. Personally I am going to keep my long URIs but I think I’ll switch to bit.ly or tinyurl.com while they are using 301 redirects (that is until the day they decide not to use 301 redirects…letting other people control your data is confusing isn’t it?!).
Aside: A URL is a subset of a URI. There is some debate about whether URL has be deprecated or not. See Yuri not Earl.
ZZZzzzz Programming
I’m not sure how many different careers allow you to work in your sleep. Probably most of them when you come down to it since our dreams seem to be where we work out our issues. As a programmer, I have solved a variety of problems in my sleep and I love it! Last night I lay down with this complex conditional statement I was going to have to write to finalize yesterday’s coding. I woke up at 4am knowing how to solve the problem in one line of code. Now that’s the way to start your day!