Playing with Programs

trying out wordpress 2.5 release candidate I

At times I am becoming a laggard when it comes to upgrading stuff… However, I love upgrades that focus solely on usability. A while back I switched a couple of wordpress blogs over to subversion. Before that, upgrading was a pain (download zip, unzip, move files around, hope that it works etc.), now it is easy - kudos to the wordpress team!

I got curious after reading the sneak peek announcement. I started looking for a 2.5 tag in subversion  - turns out there isn’t one yet, so I switched to trunk (’trunk’ is a subversion naming convention for the latest version of something):

svn sw http://svn.automattic.com/wordpress/trunk

And it seems to work flawlessly so far! If you want to see which tags are available in subversion, they have a subversion browser , and a how to use subversion. If you haven’t done so already, I recommend you switch your existing wordpress over to subversion. It makes (security) updates much, much easier to install. Even if you want to play on the safe side and use only stable versions (in the browser they are located under ‘tags’), I recommend you read up on how to update your wordpress with subversion, and give it a spin.

Something else that’s working well for me is keeping a separate blog (this one) for testing/experimental purposes, and a ‘main’ blog elsewhere.

fluid layout experiment

As you may see, I’m experimenting here with fluid layouts, using Yahoo’s YUI Grids CSS.

At first using a template from guihackrz - but it’s not called pre-1.0-something for nothing - the template has some defects.

I’m thinking of re-creating a fluid wordpress theme based on another theme, and using for instance the The YUI Grids Builder
to create a fitting layout.

Today I got at least a header image in (examples on the Yahoo site I saw so far were text and blocks) - simply adding a style with a link to the image for the #hd element was enough.

The theme from buzzdroid seems promising. It’s missing the tags in the post body, but that can be ‘re-used’ from the out of the box kubrick theme.

yslow - more performance measurements

I’ve made good use of firebug to measure and improve performance on a number of websites - . A participant in a course recommended yslow when I mentioned firebug. Yslow is an extension for firebug that gives you a list of recommendations for making your web page load faster. Looks good - I’ll give it a try, even though I’m quite satisfied after the first round of firebug-inspired optimizations (making sure the cache settings of various sites actually work - so that a browser requests most rarely changing items like graphics and stylesheets only once).

Like with the firebug measurements, it does not help you with suggestions on how to make the inside of your website faster (e.g. number of database queries). However, with things like caching, you first reduce the number of page loads, so that you can later focus on the most important ‘inside’ things to improve.

Seeing more in your page with firebug

firebug is a plugin for firefox that makes configuring out html pages and the stuff in it a lot easier - inspecting and modifying html, css, javascript and, last but not least, showing all the files that are loaded when a page loads. The last thing is great to check which things are cached (that makes a page much faster to load, and decreases the things your server has to serve - thus increasing its’ capacity).

I’m working on a couple of sites, and firebug has been very helpful. I especially like the javascript console, that helped me to get some difficult FireWatir tests to run - the console allows me to see what javascript works in the page, and do little experiments that I can then transfer to the test script once it works.

The only downside is that firebug does not seem to play nicely with some other firefox extensions (most notably web developer toolbar and possibly selenium), so if you try it out you might want to do so in a separate profile. I find the effort worth it though - firebug makes my try-automated integrationtest-code cycle a lot quicker…

Right now I have firebug side by side with jssh (the javascript shell needed by FireWatir), and that works well.

Javascript tips and tricks links

I’m brushing up on basic javascript.

I stumbled across links to kryogenix. Kryogenix has some very unobtrusive ways to do sortable tables, search keyword highlighting and explorer like tree views and more. Each of them requiring only that you include a javascript file, add a few lines of CSS stylesheet code, and (for the tree view and the table), add a “class” to one table or list. They are unobtrusive, in that your site will still work if javascript is disabled, or your browser does not support everything.

A simple explanation for adding and removing elements on a web page (using document object model (DOM) and javascript): javascript tutorial - dom nodes and tree .

The reason I’m brushing up on javascript, is that I want to write integration tests with FireWatir for pages that have a TinyMCE editor in them. I did an experiment and had it working before, I threw it away accidentally and have to re-create it. Throwing something away is a good way to really learn something (although it takes more time…). So the second time, I’m taking the time to understand more about modifying pages with javascript, documenting my trail for the next time, and save the results in subversion…

wordpress plugins

This list of favourite wordpress plugins is worth checking out. I’ve been only using a few so far, and am very happy with: akismet (anti-spam), Ultimate tag warrior (tagclouds) and some of the links in this post will be created by sh-autolink. I’m also still very happy with wordpress itself :)

plugins from the list that look attractive:

this list of related entry plugins contains a snippet for ultimate tag warrior that lists related posts based on their tags. Seems worth checking out.

Some plugins by Alex King that seem worth checking out :

  • Articles - make a list of articles that you select outside the chronology
  • Link Harvest - This plugin will go through all of your posts and pages and compile a list of all external links.
  • Popularity contest - This plugin will help you see which of your posts are most popular

post modern programming contest 2 - horoscopes

Charles Weir and yours truly made a small script to combine multiple horoscopes into one (the exercises some people come up with….:)

We completed a minimal implementation - only for taurus (could easily be parameterized in the next bit). It consists of a shell script that downloads a horoscope from yahoo, and downloads one from astrology online. It’s two scripts, since we extracted the extraction code for astrology online to a script called …extract.pl.

rm -f taurus*
rm -f daily.htm*
wget http://www.astrology-online.com/daily.htm 2> wget1.out
./extract.pl daily.htm > first.txt

wget http://astrology.yahoo.com/astrology/general/dailyoverview/taurus 2> wget2.out
cat taurus | grep Quickie  | sed 's/<.*b>(.*).*>/1/' > second.txt

cat *.txt

extract.pl :

#!/usr/bin/perl -w

while ( <> )
{
if (/CHANGE TAURUS/)
{
$printing = 1;
next;
}
if (/END TAURUS/)
{
$printing = 0;
}
if ($printing)
{ print ;}

}

postmodern programming contest

I’m at the postmodern programming conference in London today (pomopro) . Part of the day consists of a scrapheap challlenge - you might know the program scrapheap challenge from Discovery Channel.

Part of the challenge is we post our results on a blog… so here goes…
Emmanual Gaillot and yours truly paired up to produce something that plots a graph of the sloppiness of a progam in a subversion repository over time. We had ninety minutes to do so.

Emmanuel learnt svn, pmd and cpd (copy paste detection). I learnt grep -c..
here is the code:

#!/usr/bin/ruby
require 'fileutils'
revision = 54

#puts system('svn co http://stclass.tigris.org/svn/stclass/trunk/src_4x/src/java/org/stclass/runtime --username guest --password "" -r' + revision.to_s)

FileUtils.cd 'runtime'

outputs = []

(20..59).each do | revision |
	`svn up -r #{revision.to_s}`
	result = `java net.sourceforge.pmd.cpd.CPD –minimum-tokens 10 –files . |  grep -c “^Found a” `
	outputs << revision.to_s + “t” + result.to_s
end

puts outputs.join(”")

The Rails bandwagon keeps moving

It seems the number of weblog engines written in Ruby on Rails is slowly but steadily increasing, seeing choosing a rails blogging engine. For programmers who read german, there is a free book on beginning with rails .

Travelling e-mail with Cached IMAP

I’m working on a user story form myself:

As a travelling consultant, I would like to have a public or
semi-public agenda on the web, so people around me can see where I am’

As a consequence, i’m looking into web calendaring software. I found a few most notably webcalendar and egroupware) that can synchronize with desktop calendaring and mail software (e.g. outlook, kontact, evolution). Therefore, I’m looking into kontact again. Kontact is kde’s personal information manager, with the mail application kmail and agenda softaware korganizer as main attractors.

Looking at kmail again turns out to be a pleasant surprise. I switched from kmail to thunderbird as my main e-mail client over half a year ago. I switched, so I could assist people who were switching to thunderbird on other platforms (unlike kmail that runs only on linux, thunderbird runs on all major operating systems). I like thunderbird for its easy adaptive junk-mail filtering system and the simple and powerful ways it has for searching and sorting e-mail.

The one thing I do not particularly like about thunderbird, is the way it handles the IMAP protocol for downloading mail. When I use IMAP, it does not automatically refresh all my mail folders, only my inbox folder. I have over 20 folders outside my inbox, for instance separate folders for some organizations I work for. I have missed e-mail sent to me by colleagues, because I did not see there was new mail in their folder.
I have thought about removing all folders, except the one for mailing lists, and just working with an inbox. That would be simple, except for the spam I’m still getting - all the filtered folders are virtually spam-free.

Anyway, kmail has this new feature called cached IMAP. Googling for it, I found this term mentioned only on pages about kmail, so I assume this is experimental. What it does is it combines the best of IMAP (all mail stored on server, so accessible anywhere, e.g. from my laptop(s), deskttop and webmail) and POP (mail stored on the client, so it e.g. travels on thetrain).

So far, I’m happy with it. It seems somewhat slow at times, as the server side
seems to have no support for caching and synchronizing differences. It is stable, unlike an earlier (uncached) implementation of IMAP in kmail, which was another reason I switched to thunderbird.
I’m going to try it out for a while, and let you know how it goes. Have to go now, my train has arrived at the station ;)

PP is powered by WordPress and the YUI-Mainstream 750 Theme by Buzzdroid.com

Valid xhtml