Category Archives: Software

Stack Overflow: Programming Q&A

Today the new “Programming Q&A” site Stack Overflow launches. With the large tech crowd that follows founders Joel Spolsky (Joel on Software) and Jeff Atwood (Coding Horror), this new site should have no problem building an audience of its own.

According to the About page:

Stack Overflow is a programming Q & A site that’s free. Free to ask questions, free to answer questions, free to read, free to index, built with plain old HTML, no fake rot13 text on the home page, no scammy google-cloaking tactics, no salespeople, no JavaScript windows dropping down in front of the answer asking for $12.95 to go away. You can register if you want to collect karma and win valuable flair that will appear next to your name, but otherwise, it’s just free. And fast. Very, very fast.

Questions and answers are coming in at a steady stream right now. Seems to be a race to answer questions as quickly as possible. They’ve also implemented a reputation score system that rises as you perform various activities on the site. As your reputation score rises, your ability to do things like voting answers up/down and editing questions goes up as well.

The eventual goal for the site is to become the best reference site for programming questions. It’ll be interesting to see if their answers can bubble up in search results to get past all the other poor sites that are out there now. (Tip: Add “stack overflow” to your list of browser search providers. Works for Firefox 3, but not IE7 at the moment.)

stackoverflow.png

Delicious 2.0 Launched

Today Yahoo! launched version 2.0 of the Delicious bookmarking service:

The new Delicious is just like the old del.icio.us, only faster, easier to learn, and hopefully more delightful to use and to look at.

The major changes touted are improved speed, more powerful search, and a brand new UI design. They are also making “delicious.com” the primary domain (switching from the original “del.icio.us”). So far I find the UI changes pretty decent and the speed does seem better. As with many UI overhauls, there’s a bit of the “who moved my cheese?” aspect to it as I discover where everything moved. I suspect this will be a common reaction.

Speaking of reactions, see Techmeme for a bunch of links. Most of the stories are what you would expect, along the lines of “Yahoo! finally launches Delicious 2.0…”. My view is that with this release finally out of the way, the Delicious team will be able to tackle other important changes such as Yahoo! Search integration and improvements to the API. I don’t have any internal insight into the Delicious team, but I know this 2.0 project has been a huge effort that ran longer than anyone expected. If they’ve designed it right for the next level of scalability, the team should be back on feature changes and improvements.

Delicious 2.0 Screenshot

Movable Type Archive Widget Performance

As part of my Movable Type 4.1 upgrade project, I noticed that depending on my template settings, republishing the whole site would get extremely slow. Movable Type sometimes catches flak for this because it’s designed to serve static pages, so the "build" time tends to be a bit slower. (A good tradeoff in my opinion.)

There is much room for improvement on the rebuild times. It looks like the next release of Movable Type will focus on performance and scalability, so here’s my first contribution to that effort.

Archives Widget Example After some trial and error, I discovered that the Archives sidebar widget makes a big performance impact on rebuild. The Archives widget is designed to display links to different archive types available, depending on the page on which it’s being used. In my configuration, it will show the category and monthly archive links (with article counts) when shown on an individual entry page. (See screenshot at right.)

Because it’s showing information about other archive types, this widget needs to calculate that on the fly during a rebuild, resulting in lots of database lookups. What if it repeated that whole process for each page rather than computing it once and caching it?

To test the theory, I ran a series of test on my local MT installation running on my WinXP desktop. For MySQL, I enabled the general query log and did not turn on any caching. As such, the elapsed time numbers may not be that meaningful, but the relative performance should be.

I ran two performance tests — rebuild 10 entries, rebuild entire site — with the archives widget on and off. (The full site rebuild included 493 entries.) The results were as follows:

Rebuild 10 Entries

  No Archive Widget Archive Widget Delta
Elapsed Time (mm:ss) 1:30 3:23 +125%
Total MySQL Queries 3,243 6,014 +85%

Rebuild Entire Site

  No Archive Widget Archive Widget Delta
Elapsed Time (mm:ss) 8:10 41:20 +400%
Total MySQL Queries 18,104 101,257 +460%

The results are pretty interesting: even when rebuilding just 10 entries, you can see the effect the archives widget has on the numbers. When rebuilding the entire site, the number of SQL queries is over 5 times larger. I’m assuming that the number of queries is the main contributor to the build time. From this I’m concluding that the archives widget is a performance bottleneck during the rebuild process.

Next I’m going to try this same test with the special build of MT that includes performance logging to see if that provides any more insights.

Upgrade to MovableType 4.1 Complete

The code and design for this site have pretty stagnant for the last two years. Everything was functional, but the design was old and needed some serious improvement. With the recent release of MovableType 4.1, I decided to put some time into this and get it upgraded.

Many hours later, it’s done! I spent lots of time on this — probably too much — but wanted to come up with a clean upgrade process.

To back up a step and look at what I was trying to achieve, these were my goals for the upgrade:

  1. Create a more useful template for individual articles. The vast majority of visitors come from search engines or referrals and land on an individual article. My old individual article page was very simple and didn’t provide any links to other parts of the website.
  2. Make comments useful again. I haven’t touched the comment forms in a couple years and they’ve fallen far behind today’s best practices for letting real visitors leave comments while keeping the spammers away.
  3. Find or create a better visual design. By catching up with the latest MT templates, I should be able to find and/or modify a more interesting visual design for the site.

Because I decided to replace all of my existing templates with the latest ones shipped with MovableType, my upgrade process was a little trickier than previous upgrades. Some of the key points with the upgrade were:

  • Retain all existing articles/posts with the same URL scheme
  • Retain RSS & Atom feeds at the same URLs, but with updated templates
  • Keep the same archiving formats (by category and by month)
  • Refresh all templates to use the standard MT 4.1 set
  • Remove obsolete plugins

With the above goals and key points in mind, and after lots of experimentation, I came up with the following upgrade process:

  1. Install XAMPP and Movable Type 4.1 locally on Windows (steps)
  2. Clone MT database from live server to local system
  3. Upgrade local to MT 4.1, refresh all templates, then tweak to get everything right
  4. Install MT 4.1 on server
  5. Migrate database back to live server and publish

Of these, step #3 took the vast majority of the time, but the good news is I was able to play with everything locally without disrupting the live site.

Customize Website Based on Visitor’s Weather

The CSS-Tricks site has a cool article this week about using weather data to change your website’s appearance. Of note for Yahoo developers is that they’re using the Yahoo! Weather web service to fetch current conditions. The article has an accompanying sample page which focuses on the CSS and PHP code necessary to swap out the page appearance. The remaining work would be to intelligently identify where the visitor is coming from and fetch their weather automatically. Kind of a neat application for a service that probably doesn’t get a lot of attention.