Blog

During the course of the day I encounter lots of challenges, some of which take minutes to solve and others that take much longer. My goal for this section is to keep track of these challenges and their solutions. I will turn the longer ones into articles, while the shorter ones will stay as blog entries. You can expect topics to range from very specific programming challenges to broader topics like life.

Below is a list of the recent blog entries. You can also browse the blog by using the tags on the right side, or if you know what you are looking for then you can use the search box at the top right.

Amazing Seattle / Tacoma Weather

Notice how slippery the road is.  Also, notice the stuck semi in the background, blocking the road completely.

I had to come to Seattle for work, and the day that I picked to be here was the day that Washington had the worst weather in almost 20 years! My flight landed in Seattle around 9:45pm and my drive to the hotel in Tacoma, which was about 21 miles, took almost eight hours!! That is not a typo, it took me EIGHT hours!! It was amazing, the traffic was stopped for hours and hours! My average speed for the first seven hours was about 1.5 miles per hour!

All of this was because it usually doesn’t snow much in Washington, so they don’t have the right equipment to deal with it; and it snowed about two inches before my flight landed. Again, that is two inches. Add to that the fact that most people hadn’t driven in snow before, so they were either going extra slow, or extra fast, resulting in accidents; both of which added to the delays. And if that wasn’t enough, the temperature were below freezing, so the roads just became an ice rink. Want more? The roads in and around Seattle and Tacoma are generally sloped, at some places, at quite an angle. So if you had a rear-wheel drive, you can forget about making it any further on that rink!

Here is a van that ran out of gas and is being PUSHED by a tow truck

Want even more? There is more! Because of the long delays, cars started running out of gas. So, there were cars abandoned in the middle of the road. Most of the people couldn’t even push their cars to the side of the road because the roads were so slippery; and anyone who wanted to try would probably end up on the road. What an amazing eight hours it were! 🙂 You could walk quicker!

One of the factors was the Seattle Seahawks vs. Green Bay Packers game that increased the normal traffic to crazy amounts.

Yup, that is a bus stuck in the MIDDLE of the road at a busy traffic intersection

A lot of people are saying that this happened mainly due to the Seattle drivers, I disagree. No matter where you live, you couldn’t drive on these ice covered roads without ice chains on your tires or other specialized tires. From my experience, I haven’t seen many people with ice chain, even in the cities that get lots of snow. The main reason that only two inches of snow caused such massive delay was that the snow wasn’t plowed right away. If this was done in time then this wouldn’t have been a problem, as all of you folks living on the eastern part of the US know.

I was listening to radio as other drivers, stuck on other routes, reported what they were seeing: trucks and city buses stuck in the middle of the road, people abandoning their cars because they ran out of gas, cars in the ditches, accidents, bumps, slipping and sliding vehicles, amazing stuff!

All this brings one main question to the mind: Global Warming, is it real?

First version of Site5 Capistrano Setup Posted!

I just finished posting the first version of the Capistrano tutorial specifically geared towards Site5. It took quite a lot of work on my part, but I also learned a lot about Capistrano. I will be adding more things to this article as I learn more about Capistrano. Check it out, and make sure you let me know how it is.

Cygwin complaining “: command not found”

I generally don’t upgrade my Cygwin installation as often as some of the other software that I use, but yesterday I upgraded it and found a surprise.

cygwin window showing the error

Every time I would start Cygwin, it would give me several “: command not found” lines and syntax errors. After I got a chance to look into the problem, it turned out to be a very simple one. Basically my ~/.bashrc and ~/.aliases were using the dos line ending, instead of unix. Given that fact, all I had to do was:

  1. Open these files in vim
  2. :set fileformat=unix
  3. :wq
  4. Restart cygwin

What do you know, the errors are gone!

Check out this cygwin announcement If you are curious about the details.

Microsoft Launches the Zune!

Microsoft Zune

Yesterday Microsoft launched their first version of the “MP3 player,” Zune. Microsoft has made a fairly late entry in this market considering that the Apple iPod has been in the market for a few generations! There are gazillions of a accessories for the iPod, including integration in higher end cars. Add to that Creative’s entry into this market with their Zen Vision:M in the last few months, and you get a fairly competitive market.

Zune Desktop Theme

Apple started it’s iPods at $399 price tag, Creative started it’s Vision:M’s at $320, and guess where Microsoft landed? $249! I think that is an awesome price for a 30 gig MP3 player with FM tuner, and supports WiFi! Microsoft doesn’t need much press for their launch because Zune has been hyped on gadget websites for a while now, getting labeled as the iPod killer. Zune does look pretty exciting but I personally think that the coolest part if the WiFi.

To add to the excitement, Microsoft has also introduced a new Windows theme that matches the Zune’s default color scheme. Obviously I had to try it out! Check out this screenshot.

Let’s see if it can really grab a chunk of the MP3 market, and if really is an iPod killer!

Previous reviews have been imported

I am proud to announce that I have implemented the reviews section and the imported the previous reviews, with all the images! So go check them out!

Once I am done with the GMAT, I am planning on posting a review for the Creative Zen Vision:M, which I have owned since they were introduced. My preparation for GMAT is going a little slow and I was a little disappointed with my performance on the data sufficiency section, it looks like I have got some work to do on that specific section. Wish me luck!

What’s up with all the warnings?

Does anyone know what’s up with all the warnings I get when running rake?

Rails Warnings

Why Contact Information is Important!

I was trying to post a comment to http://rails.co.za but for some reason I get a message saying “Ip blocked by SpamProtection.” So I start looking for contact information so I can see why this is the case, but guess what, there is NO contact information for the web masters! Its possible that I missed the contact info but I doubt it because I have looked all over.

I decided to see how many comments these guys get by looking at the comment feed, and there is only one comment! My guess is that this is because the comment module is probably bombed, but there is no way I can tell them to look into it, because there is no contact information! Make sure you always put some sort of contact information so people can contact you.

Indexes

The data structure used at my work is fairly low level and it is amazing how much difference that makes in the performance. If you were to talk to an average web programmer about what an index was, most probably, they would have a very vague idea. This is because they can easily write statements like SELECT * FROM mytable WHERE mycolumn = 123 without much concern, and then move on. With the data structure at work it becomes apparent why this is a bad idea and why indexes are important. Without the index we have to manually step through each row and look for whatever the WHERE part of the query specifies. Just to give you an idea about what I mean, look at the SELECT statement, if mycolumn wasn’t the primary key then it probably wouldn’t be indexed by default; which would mean that you will end up iterating through all of the rows in that table!

I am guilty of not using indexes but as soon as I was exposed to indexes (before this job) I realized how important they were and quickly caught up to speed. I remember taking over for a project at my previous job where we had minimal number of indexes. The difference before and after the indexes was almost a ten folds! If indexes are always good then why not index every column? You have to be careful with indexes because just like everything else, indexes have good and bad parts. Every index adds to the time that it takes that database server to do an insert and some times updates because the database server has to do the extra step of actually indexing the column. Bottom line, make sure you know what indexes and use them when appropriate.

This and this pages are some further readings about indexes.

Search and RSS Feeds Added

Over the last weekend I spent some time implementing the atom feed (see the “blog feed” icon on the left) and searching capability. Why these two specific features? As I was going through and updating the content from the previous site I found a need for searching, plus with for a blog to be useful, you pretty much have to have searching capability because very few people are going to sit and page through the past entries. Similarly, a blog feed is important for those people who prefer using an aggregator.

Since I have the basic functionality for the site in place now, I am thinking of switching gears and concentrating on GMAT preparation, which I am planning on taking towards the end of November. My goal is to at least have a masters degree before concentrating on the job/business world. Who knows, maybe if I get bored studying for GMAT, I will implement the article and review sections.

Microsoft Word’s Insufficient Memory Error

As a side project I have been working on a Microsoft Word document concordance generator. The goal of the application is to loop through each word of all documents in a given directory and compose a concordance list. Obviously there is more to it, but that should give you the gist of it. I am using the Microsoft Word API and .Net 2.0 to implement the solution. The Word API is great because it pretty much exposes everything that you can normally do in Word but through an API. Everything has good and bad parts, that was the good part, the bad part is the speed. The API is slow, which is understandable especially considering that I have a special layer between (the .Net wrapper) so I have had to come up with alternatives. One of the problems that I encountered right away was the “Insufficient Memory Error”. The problem with this was the actual physical dialog box asking the user to confirm that they want to continue.

Word has insufficient memory. You will not be able to undo this action once it is completed. Do you want to continue?

To get around this I had to clear out the undo history manually, at regular intervals. To do this you have to call the ClearUndo function

wdDoc.ClearUndo()   // wdDoc is the Word.Document object

This was my first .Net 2.0 project and I was amazed the data structures that .Net 2.0 provides; things like the templated list and dictionaries. Additionally, I really enjoyed how easy it was to created a threaded application where the thread can report back on it’s progress. Threading is a whole beast that probably deserves an article. If you are interested check out the BackgroundWorker class.