James Crisp

Software dev, tech, mind hacks and the occasional personal bit

Multi-touch two finger scrolling on Samung N150 with Ubuntu 10.04 (Lucid Lynx)

After much googling, trial and error, finally, a solution for enabling two finger scrolling on Ubuntu 10.04 on my new Samsung n150 netbook.

For some reason, it is not possible to enable it through the Mouse configuration in GNOME – the two finger scrolling option is grayed out (disabled).

You may need to fine tune the MinW and MinZ values – they are configured to work well for my fingers 🙂

synclient VertTwoFingerScroll=1
synclient HorizTwoFingerScroll=1
synclient EmulateTwoFingerMinW=5
synclient EmulateTwoFingerMinZ=48

To make these settings sticky, add the synclient calls into a script that runs when you log in.

nRake now on IronRuby

nRake, the premier project and build template for .NET projects using the Rake build system now has a branch for .NET4 using IronRuby. Projects are also updated to VS2010 format, and Albacore gems are now updated to 0.1.5.

Check out the IronRuby .NET 4 branch of nRake.

or the check out the IronRuby .NET 2 / 3.5 branch of nRake.

Master branch is still using MRI ruby 1.9. However, plans are to change over to IronRuby for master branch in the future. IronRuby is now performing well enough and sufficiently compatible to support .NET builds. IronRuby has advantages around size (smaller download) and more exciting interop possibilities with .NET code.

Podcast from ALM Conference

At the ALM Conference, Richard interviewed me for a podcast on the Ultimate ALM Environment circa 2010 as well as a little on build and deployment automation. Check out the podcast on Talking Shop!

Australian ALM Conference, and slides from ‘The Ultimate ALM Environment circa 2010’

The inaugural Australian ALM Conference has been an interesting 2 days. The first day had a number of insightful talks, especially interesting to hear Sam Guckenheimer on how Microsoft has been reshaping their internal development practices into a more agile model. Today, I enjoyed Richard‘s agile adoption talk (hear hear!) and the other highlight was the last presentation of the day, explaining what’s gone into the design of the new Windows 7 Mobile OS (though some things still seem under wraps). Also a pleasure to catch up with some old friends at the conference.

Conference organisation was very good (thanks to Anthony Borton and his team). The focus was very Microsoft centric, but next year, the plans are for a much wider variety of content. Lunar Park was a cosy conference venue and fun to go outside during the breaks and see kids screaming on rides and the sun shining on the bridge and harbour.

My presentation was 8.30am this morning (aargh!) but despite the early hour, there was a reasonable turn out and quite a few interested people asking questions. The plan was to co-present with Jason Yip, but he was called away to Perth so I presented solo. Unlike most other presentations at the conference, Visual Studio and TFS were barely mentioned. Instead I focused on current problems in each area of ALM, coming up with a criteria to assess this area, and what we usually do on projects to meet this criteria – eg, story walls, story maps, automated build and deploy etc. You can find the Powerpoint slides here. The slides are promises for a conversation (ie, mainly images with some notes), so don’t hesitate to contact me if you want to chat.

Also, thanks Richard for this photo from the presentation:

James Crisp presenting ‘The Ultimate ALM Environment circa 2010′

Talk: The ultimate (circa 2010) ALM environment

Jason Yip and I will be presenting on “The ultimate (circa 2010) ALM environment” at the Australian ALM Conference on 14 April. We’ll be talking about using agile methods and tools for ALM, rather than a vendor suite.

Here’s the blurb:

Based on our experiences in the field on projects and consulting with other teams, we will describe what we consider to be the ultimate development environment (which is not just about vendor tools). This session will discuss principles, practices, tools, and physical workspace design.

Hope to see you there!

nRake – Rake builds for .NET

Fed up with XML based builds that are hard to maintain, refactor and extend? Rather than trying to fix this with more xml and community tasks, or re-invent the wheel, let’s use Rake. Rake is a mature build system developed by the ruby community which can be applied equally well in the .NET world.

To help you get started quickly, I’ve put together nRake. nRake provides a template C# .NET solution with a nice directory structure (src, tools, lib, etc), a Rake build, NUnit tests, templated app and web configs for different environments (eg, dev, uat, prod, etc) and Continuous Integration server sample config files. It comes with everything you need – no additional libraries or downloads required, and all the plumbing work has been done for you.

How to use

  • Git clone or Download nRake as a Zip
  • Rename PlaceHolder app and tests to reflect your project
  • Run rake in the root of the project. This will clean, compile, template config files and run unit tests.
  • Start developing your app! How easy was that 🙂
  • Note: nRake currently uses Ruby 1.9 since IronRuby start up time was prohibitively slow. Hopefully IronRuby will get faster, and then nRake can make use of it. Also nRake uses the Albacore Gem for .NET build tasks. Documentation on Albacore tasks here.

    Also check out the IronRuby update!

Buying Books Online in Australia – Alternatives to Amazon

In the past, I have been a happy customer of Amazon USA for technical books, and more recently, even for fiction. Australian bookshops seem to have very limited and expensive stock, so buying online is an attractive option.

Recently some of my colleagues recommended two other options:

  • Book Depository UK: good prices, free international shipping, fast delivery, but at first glance less books than Amazon
  • Booko book price comparison: compares multiple sites including Amazon and BookDepository. Presumably make money using affiliate links from search.

I’ll be giving these a go and posting on the experience in future.

Monitoring MySQL Slave Replication Status with Ruby and Cron

When offering higher levels of uptime on a web site backed by MySQL, a good approach is to set up a MySQL master-slave configuration for failover between servers. This generally works quite well, but once in a while, there is a problem or error that causes the replication to cease. The slave then ceases to process updates and gets out of sync with the master.

The script below is a quick and easy approach to monitoring the status of replication on the slave. If the slave thread or IO ceases, the slave gets more than 120 seconds behind the master, or there is an error, the script will email all the slave status information to an email address you specify to alert you that you need to log in and sort things out. I run the script from cron so that I get notified fairly soon if a problem arises.

RAILS_ENV = 'production'
ALERT_EMAIL_ADDRESS = '[email protected]'

require 'open3'
require 'socket'
require "#{File.dirname(__FILE__)}/../../config/environment.rb"

r = ActiveRecord::Base.connection.execute("show slave status").fetch_hash
unless  r["Slave_IO_Running"] == "Yes" && r["Slave_SQL_Running"] == "Yes" &&
  r["Last_Errno"] == "0" && r["Seconds_Behind_Master"].to_i < 120

    status = "*** STATUS ***\\n" + r.to_a.collect { |i| "#{i[0]}: #{i[1]}\\n" }.join
    subject = "MySQL Slave Replication Down on #{Socket.gethostname}"

    Open3.popen3("mail -s \"#{subject}\" #{ALERT_EMAIL_ADDRESS}") do |stdin, stdout, stderr|
       stdin.write(status)
    end
end

Note: This script relies on being part of a rails app to get a database connection. It would be fairly easy to modify it to include db credentials and open the connection.

Si-Hing (Wing Chun Junior Instructor)

Last Thursday, I finally took my Si-Hing (Junior Instructor) grading, and passed!

Si-hing sash & certificate

HTML to PDF Conversion Plugin For Rails (A fork of wicked pdf)

Once a business web application reaches a certain size, the need often arises to generate PDFs from HTML/CSS.

Up until recently, the story around this for a MRI Rails application was not good. You could either use tools like Prawn, which require a description of the layout in a specific DSL, or pay for a tool like Prince XML which can convert from HTML, but which costs quite a bit. Those using JRuby were in a stronger position as they could use the Java PDF library called Flying Saucer.

The good news is that PDF generation for MRI Ruby is now easy and free, thanks to webkit, the open source webkit wrapper called wkhtmltopdf and mileszs’s wickedpdf plugin. I was really excited to come across this plugin and started to use it right away. However, it had a couple of issues:

  • Temp file handling caused errors when two PDFs were being generated within the same second (eg, 2 requests at almost the same time)
  • Problems generating PDF were not reported

Galdomedia forked the code and updated it to use standard Ruby temp files. This was great for ruby 1.7, but not good for Ruby 1.6 which does not allow you to set the extension on temp files (wkhtmltopdf relies on having a .html extension).

As my production servers run Ruby 1.6, I needed a different approach. My fork uses streams rather than temporary files, and adds some basic error handling and basic integration tests.

To install in a rails app:

script/plugin install git://github.com/jcrisp/wicked_pdf.git

Or clone the code from GitHub.

Page 6 of 20

Powered by WordPress & Theme by Anders Norén