tech

Z60t ThinkPad

I am lucky enough at work to be able to switch laptops every 6 months (if I want to). I stuck to my last IBM T42 for quite a while, though (nearly two years), and loved it. But yesterday I took the plunge and moved over to a new widescreen Lenovo (ex. IBM) Z60t. It is a beauty, and Ubuntu Dapper runs on it like a dream. Everything works except the built-in wireless, but I'm putting up with wireless PC card for now. Suspend worked out of the box without me doing anything. The keyboards on these things are superb. It's a minor upgrade for me: 1.5Gb of RAM, Pentium M processor 2.00GHz, and a slightly bigger hard drive. Lovely.

The advantages of Linux over Windows really came home to me while doing the switch:

  • No hunting for driver disks or downloading off the internet: they're all there.
  • Synchronising my old files to the new machine was easy (via rsync).
  • When there's an application missing, I can install it in seconds with apt-get install <package>.
  • No nagging to register my application, or having to dig out registration codes.

Anyway, I highly recommend this machine for Linux. They're not cheap, but even if I had to pay for it myself, I think I would fork out for one. The only down side is that it weighs a ton.

LUGRadio Live nearly here

Tomorrow sees the start of LUGRadio Live. If you're in the West Midlands this weekend, come along to Wolverhampton and get involved. It's going to be great; there are some brilliant speakers lined up, plus Jono will be shaving his beard off. Jono has poured his heart and soul into this for the past few months (as have his other LUGRadio pals), so come and make his little eyes light up. Only £5 to get in, and they've got better speakers than OSBC (which cost about 200 times as much)!

I'm hosting the Ruby on Rails BOF and giving a presentation on Ruby on Rails. In all honesty, I'm a bit nervous: it's going to be a technical audience, so I really need to be on my toes. But hopefully there will be something of interest for attendees. It will be great to catch up with Dave, who I've been corresponding with through blog comments for a while now. His blog always throws up loads of great links and ideas, so it will be good to see him in the flesh. Plus Nick Zeeb is going to be around, so it will be good to catch up with him over a drink. No doubt there will be lots of other familiar faces. Looking forward to it!

The mother of all demos

Paul did a presentation this morning called Top Ten Open Source Tools. It was a fun one to do, and we spent a good amount of time discussing which products we'd cover. We both agreed on the number one spot, but the others were numbered fairly arbitrarily. The other constraint was that we wanted things an IT consultant could apply to their business fairly readily, or which offer opportunities to small businesses. So, to retain a sense of expectancy, here they are in reverse order.

10. Windows utilities: 7zip, Putty, Filezilla (FTP client), PDF Creator, Scite (text editor)
9. Thunderbird email client (my spam demo didn't work though); this incidentally involved demo'ing dovecot imap server too
8. CRM: SugarCRM and EGS
7. Trac and Subversion
6. Custom Linux (Paul talked about firewall distros, embedded distros, and demo'd OpenFiler)
5. EasyEclipse (every home should have one), plus how it integrates with Subversion and Trac
4. OpenOffice.org
3. XAMPP
2. Open source CMS: I mentioned Drupal, Plone, and Joomla!, and did a brief Joomla! demo
1. Firefox (of course), plus Web Developer Toolbar and Sage RSS reader extension

Attendance was pretty good (about 20 people). We demo'd all of the products above, which took about 1.5 hours, and was a bit nerve-wracking; but we pulled it off, thankfully. At one point, our poor 1Gb of RAM laptop was running AIXGL (for fancy spinny window effects), Ubuntu, Windows XP under the VMware player, a SugarCRM VMware appliance, an OpenFiler VMware appliance, XAMPP, EasyEclipse, dovecot, OpenOffice.org, and Firefox. I swear I saw sweat coming out of the USB sockets, but it managed to keep plodding on.

There were dozens of others we could have mentioned, of course, but we chose mostly our own favourites. Any suggestions from anyone else?

EasyEclipse

Many thanks to Paul, who came across EasyEclipse yesterday. They provide a range of distributions of Eclipse with plugins bolted in, plus a JRE (I think), bundled into packages for Mac, Windows, and Linux. From their website:

We select, assemble, test, patch, build installers and document a full IDE, offered as reliable distributions and plugins.

There is a distribution for Ruby on Rails, for example; and more usefully for me, one which bundles all the tools for LAMP development (including Ruby on Rails support via Ruby Development Tool and RadRails, PHP support via PHPEclipse, plus HTML editors and a database client).

My only complaint is that this distribution doesn't include the Subclipse plugin (for Subversion integration) by default. However, they do provide it as a separate download, and it took me about 5 minutes to install. They provide an installer for each plugin, but it didn't seem to work for me; however, manual installation is simple, so I did that.

Once I got the installation working, it was a simple matter of rerouting my desktop shortcuts to EasyEclipse (instead of my old custom Eclipse install). Excellent!

Yet more training

Today saw me running another PHP and MySQL course at OpenAdvantage. It's always good seeing people getting switched onto open source programming languages, and the whole thing went well overall.

At home, I'm working on a Tomcat course (as a contractor - I registered as self-employed this week), while at work I'm writing a two day Drupal course for the end of this month. At the end of this week, I'm doing a presentation on Making Money Because Of Open Source. And next week, one on Top 10 Open Source Tools for Consultants. Then, of course, we have LUGRadio Live, where I'm presenting (wrote my talk this week, after a lot of chopping and changing) and running a Rails Birds of a Feather session. So you could say I'm quite busy this month.

Which is a long way round to explain why there's no Ruby Tuesday this week. To be honest, I haven't had a chance to do any programming for about a month, so I've got no new nuggets to share. Sorry about that.

A Windows chain around my neck

I have a Nokia 770. It's a nice Linux-based PDA, with a Debian core plus some proprietary bits and bobs (e.g. Flash, RealPlayer) incorporated. I use it at home if I leave my laptop at work for simple web browsing and checking email. The main bonus being I can use it lying down :).

A couple of days ago, the latest firmware was released. As there were major improvements (e.g. fingertip input support, password saving in the web browser, GoogleTalk integration), I thought it was worthwhile to upgrade. And there my troubles began.

At the weekend, I had installed a Windows 2000 VMware image, so at least I had the tools available without having to take home a different laptop. But as soon as I tried to install the Nokia 770 firmware update wizard, I encountered a hulking, rusty chain of dependencies:

  • I wanted to use the Nokia 770 firmware update tool, which needs...
  • .NET Framework 2.0, which needs...
  • Microsoft Windows Installer 3.0, which requests...
  • Your Windows serial number to enable Windows Genuine Advantage; which needs...
  • Service Pack 3, which necessitated...
  • Windows Update, which required...
  • A new version of the Windows Update software to be installed

On my home machine, it took about an hour (over slow ADSL) to download all the bits of software, find my CD case with serial number, and install everything. The Nokia update took another 20 minutes on top of that. Hmmm, don't think I'll be switching to Windows any time soon. Granted, I am running an ancient version of Windows, but so are lots of businesses who, like me, can't afford to upgrade. It's so much easier on Ubuntu, with a nifty apt-get install. Anyhow, I suppose it's worth the effort to upgrade the Nokia, as the improvements make a big difference to usability.

Update: to add insult to injury, when I tried to follow the same procedure to update Jono's 770, it completely screwed the firmware, so it won't even boot. What is wrong with treating the 770 as a big USB hard drive and dropping the new firmware into a specially-named folder? (This is how I upgrade the firmware on my iAUDIO M3 - nice piece of kit, by the way, except I think the headphone jack socket is wearing out through over-use, and I get occasional wierd freezes which require a reset.)

Ruby Tuesday: FakeWeb

A while ago I write a thing called WAML, a small library for writing an HTTP client in Ruby, with support for tidying HTML, simple XML parsing, creating RSS feeds, and sending files over SSH (I wrote it to screen scrape pages, push them into RSS files, then send the output files to a website).

Like a good Rubyist, I included a whole bank of tests, including a few for the HTTP client stuff. However, at the time, I just pointed at pages on the internet, and my HTTP client tests would dutifully march out into the wilds to pick up web pages. This is not ideal: what if a website is down? or it changes? or I don't have a network connection?

I found a really neat solution called FakeWeb, which solved all my problems. This interposes between your testing code and the Net::HTTP libraries (the main HTTP libraries for Ruby). So you can run your test code against a "fake web": any HTTP requests sent through Net::HTTP are intercepted by FakeWeb and handled by it instead. Any pages you want to "mock up" are registered with FakeWeb using the register_uri method, and you can attach arbitrary headers, cookies, and page content to each registered URI. Here's an example of how I applied it, starting with my original test, which checks whether my HTTP client correctly sets cookies on redirected requests:

class TestHTTPClient < Test::Unit::TestCase
  def setup
    @client = Client.new :user_agent => 'Firefox'
  end

  # test passing of cookies gathered from one response to subsequent request
  def test_cookie_passing
    response = @client.post(:absolute_url => 'http://bloglines.com/login', 
    :post_parameters => { 'r' => '/myblogs', 'email' => 'elliot at townx.org', 
    'password' => 'notmyrealpassword', 'Sign In' => 'Log In'})
    
    assert_equal 'http://bloglines.com/myblogs', response.url
    assert_equal 'elliot@townx.org', response.cookies['BloglinesEmail']
    assert response.body.include?('<frame src="/info/myfeeds" name="basefrm" scrolling="yes" />')
  end
end

(I've left out all the requires to keep it neat.)

Note that this code physically logs into BlogLines by sending a post request, then checks that the client correctly follows the redirect to the /myblogs page and has a cookie set. There are a couple of problems with this:

  • You need a network to run the test.
  • It exposes my username and password to anyone I distribute the code to.
  • It hits Bloglines unnecessarily.

Here is the test, rewritten using FakeWeb, which fixes these issues. More verbose, yes, but friendly. Plus I can test any kind of arbitrary series of web pages without having to setup a special website to do so:

class TestHTTPClient < Test::Unit::TestCase
  def setup
    @client = Client.new :user_agent => 'Firefox'
    login_setup
  end

  # setup fakeweb to emulate login procedure
  def login_setup 
    base_url = 'http://pretend.web.com/'

    # URL where the agent will try to login
    @login_url = base_url + 'login'

    # URL to redirect to after login page
    @bloglist_url = base_url + 'myblogs'
    @bloglist_content = '<title>Logged In</title>'

    # email address to use during login and in cookie
    @email = 'elliot at townx.org'
    
    # custom build response from the login page, to redirect to the bloglist and set a cookie
    redirect_response = Net::HTTP::HTTPResponse.new('1.1', '302', 'Found')
    redirect_response['Location'] = @bloglist_url
    redirect_response['Set-Cookie'] = 'email=' + @email + 
    '; expires=Sun, 31-Jul-07 15:22:12 GMT; path=/'
    
    # register the two URIs with FakeWeb and attach their content
    FakeWeb.register_uri(@login_url, :response => redirect_response)
    FakeWeb.register_uri(@bloglist_url, :string => @bloglist_content)
  end

  # test passing of cookies gathered from one response to subsequent request
  def test_cookie_passing
    response = @client.post(:absolute_url => @login_url, 
    :post_parameters => { 'r' => '/blog_list', :username => @email, 
    'Sign In' => 'Log In'})
    
    assert_equal @bloglist_url, response.url
    assert_equal @email, response.cookies['email']
    assert response.body.include?(@bloglist_content)
  end
end

Note the quick and dirty way I setup the response returned by the login page, to emulate a redirect with a cookie (I deserve a slapped wrist for that baby, especially the manual date setting). I will probably extend FakeWeb to do this better. Plus I had to add a new method to Net::HTTPResponse to allow me to manually set a response body. But it works pretty nice now. It would also make sense for me to rewrite my FlickrLilli tests like this (they currently use Flickr directly, which means the tests can take a while).

The WAML gem is attached to the bottom of this post, for anyone interested. I haven't updated it for a while, but it still does its job.

A call to arms for Ruby HTTP client programmers

Can anyone recommend me an HTTP client library for Ruby? I know about Net::HTTP, but that's pretty low level: I'm looking for something like Apache Commons HTTPClient. I've written my own, but it's primitive. I basically need stuff like:

  • Following redirections automatically (to some pre-specified depth)
  • Automatically attaching cookies to requests (my current code does this, but not on a per-host basis, and not respecting cookie expirations, paths, secure etc.)
  • Enable me to parse HTML, tidy it, and extract parts of it

If there's nothing out there, I'll carry on building my own (codenamed: WAML [Web Automation Macro Language]). But it would be interesting to find out if anyone else is working on this already before I go too far.

Standards, competition, and commodity

I'm still trying to get my thoughts in order for a forthcoming seminar on making money because of open source. I found this short article on RFID, which encapsulates the arguments for standardisation and its effects on the market really concisely:

...standards won't turn RFID into a commodity. Standardization will increase competition, drive innovation and lead to products with meaningful differences.

We've seen the same thing happen with the web server market, and currently happening with content management. Not that there are meaningful standards among content management systems (at least, not PHP ones), but the fact that most CMSs provide equivalent base functionality has meant differentiation has had to move to other areas of the market: e.g. better user interfaces and better integration with external systems.

OSBC 2

I enjoyed OSBC last week, though I thought it was a bit pricey for what we got. Simon Phipps' presentation was very good indeed (plus he attacked IP indemnification firms as pointless scare-mongers); I enjoyed Trolltech's Eirik Chambe-Eng laying into Symbian, stating that Linux can scale down better and is more attractive for low-end phones (some bloke from Symbian stood up at the end, a bit miffed); Ian Howells from Alfresco had some interesting points about how the Enterprise Content Management market is ripe for exploitation by open source (monolithic, 15 year old code bases in existing systems are the opposite of agile); Mark Fleury bristled through the panel sessions; and Brian Behlendorf said some interesting stuff about using open source style development in large software houses (though the audience wasn't particularly responsive). Also met a couple of nice chaps from Sun.

A few observations:

  • The presence of masses of people from Symbian gives a hint that they are a bit scared about what open source might do to the phone market.
  • The audience seemed polarised between people and companies who "get" open source (Brian Behlendorf, Trolltech, Alfresco, Funambol, JBoss), and dived in long ago; and companies who are dipping their toes and either running away because the water's cold or standing there expecting armbands to be provided by "the community" (Microsoft, obviously; J.P. Morgan; Philips Medical Systems).
  • It's a bit distressing to see that IP issues are still the main stumbling block for larger firms, and that talks with titles like "Risks Propriety Software Vendors Face in Using Open Source" still attract a lot of people. I feel like the issue is not really about protecting yourself from open source: it's more about joining the party with the right attitude. This is where Sun have got it right by employing a "conscience" like Simon Phipps.
  • I attended one session about open standards, where proprietary vendors were attempting to defend standards with royalties attached. Why can't we have royalty-free standards (good for consumers), and let proprietary vendors compete with proprietary standards if they choose to? Would the internet be the massive monument to human ingenuity it now is if it had been proprietary? (gopher, anyone?). I would love to see the proprietary, non-free "standards"-based GSM mobile phone market (for example) decimated by cheap phones based on Linux using VOIP over WiMax. (I hate mobile phones in their current incarnation: the antithesis of free.)
Syndicate content