How to change your default locale on Ubuntu Linux

One problem that has repeatedly cropped up when developing in Java is strange error messages in our unit tests for certain text manipulation tests when running on a freshly installed Ubuntu desktop.

They are all related to Ubuntu's default British locale: en_GB.UTF-8

This was causing files checked out of CVS to be in Unicode (UTF-8) format rather than ISO-8859-1 and so the British pound sign (£) was being encoded as a double-byte (rather than single-byte) character in the file.

To check which locale you currently have as your default just run: locale

Changing the default locale is a little different on Ubuntu compared to most Linux distros, these are the steps we needed to go through to get it changed:

Add the locale to the list of 'supported locales'
Edit /var/lib/locales/supported.d/local and add the following line:
en_GB ISO-8859-1

Regenerate the supported locales
Run sudo dpkg-reconfigure locales

Change the default locale
Edit /etc/environment and ensure the LANG and LANGUAGE lines read as follows:

UPDATE '09: An old collegue has suggested that this change should now be made in /etc/default/locale rather than /etc/environment - Thanks Guy!


Rerun locale to check that your default locale is now en_GB

Technorati Tags: , , , , ,

January's AgileNorth - Theory of Constraints (TOC)

The first AgileNorth of the new year was kicked off by an active session on the “Theory of Constraints” run by Kevin Rutherford and David Draper.

It was a re-run of a session from the Agile North conference - I'm not a Bottleneck, I'm a free man!

The Theory of Constraints (TOC) is a management philosophy that aims to continually achieve more of the goal of a system. Every system or process must have at least one constraint, which prevents the system from achieving a better result relative to it's goal. In order to increase the performance, these constraints must be identified and removed one by one.

There is a five-stage process to go through to follow TOC once you have clearly identify what the goal of the process is, e.g. better quality, more widgets, less wastage:

  1. Constraint
    Find the largest constraint that is holding you back from achieving that goal. Note: you are not trying to fix any and all problems or possible optimisations that you find, just the largest key bottleneck.
  2. Exploit
    Try to optimise the bottleneck to get maximum performance, e.g. remove any unnecessary tasks (timesheets, walking across the factory floor, etc.) from a worker who's duty has been highlighted as the bottleneck.
  3. Subordinate
    Move some of the constrained worker's tasks to other people/processes to free up the key worker to allow the bottleneck to be removed.
  4. Elevate
    If the above “free changes” (exploit and subordinate) don't help remove the constraint then introduce a “costly change” e.g. training, additional staff, etc.
  5. Repeat
    If the constraint has now moved, go back to step one and repeat the process.

The focus is always on one constraint at any one time – never attempt to address more than one problem area.

The main part of the evening was spent doing a practical exercise that demonstrated the Theory of Constraints quite clearly. The goal was to maximise the number of paper hats and boats pairs made in a short period of time. There were 6 of us attending so we formed a circle and were given different roles perform:

  • Analyst – received paper of differing sizes from the supplier and was told whether it would be a hat or a boat
  • Designer – would perform some of the critical early folds
  • Developer – did most of the folding of the paper
  • UI – added pictures to the sides
  • Tester – ensured that the made objects stood up, had the correct design, was neat and tidy, etc.
  • Production – checked quality and released 'product' - hat/boat pairs.

The first round started and we immediately noticed that all the paper was stocking up by the developer who was starting to rush and make mistakes, most of the rest of us were sat around doing nothing. Therefore the 'constraint' was the developer. We struggled to see how we could 'exploit' the developer so we 'subordinated' some tasks: we decided to ensure that it was clear whether the item was to be a hat or a boat (this had caused confusing during the first round) and would pass the paper to the developer in order, hat – boat – hat -boat to ensure enough 'product' was released.

On the second round we noticed that the bottleneck was still with the developer, the boats were taking nearly twice as much time to make as the hats. We decided to 'elevate' the constraint by 'training' the UI guy to take over the creation of the hats so that the developer could concentrate on the more complex boats. This time most of us were sat doing nothing for longer and yet we were able to get more products out the door – we were more productive whilst doing less work!

With the 'training' complete ;) we performed the third and final round and this time came out with some very positive results. This time the constraint had moved to the designer who was having to reject certain paper sizes due to it being too hard to make the hats and boats. This showed that if we had given the 'supplier' a template for the source paper we could have removed this bottleneck and sped up even further.

Here are the results of the three rounds:

source paper121012
completed products123
wastage/work in progress1062

It was a very interesting session and I think we all had some fun as well. It would have been good if we had more some spare time at the end to discuss possible ways in which you could spot the bottlenecks in a software environment. I enjoyed the active format and Kevin and David ran the session very well.

Technorati Tags: , ,

Problems with shell (sh) scripts on Ubuntu Edgy Eft? Find the fix here!

I use Ubuntu at work and recently upgrade from 6.0.6 (Dapper Drake) to 6.10 (Edgy Eft).

Today I found a problem with an SQL tool that we use - Oracle's SQLDeveloper. It runs from a shell script and was failing with a very strange error (it couldn't find a config file). After some head scratching and searching on the web I found the reason why:

Previous versions of Ubuntu (and probably most distributions of Linux) map sh to bash. Bash has more features and many scripts are written with Bash in mind.

Ubuntu 6.10 has changed this so that sh now uses dash - a faster-than-bash alternative that only supports what the original sh did. There is even an outstanding Ubuntu bug regarding this.

This was the reason why my script was failing - it was assuming a bash shell even though it mentioned #!/bin/sh at the top of the script, and dash just doesn't have bash's features.

The fix was simple:

In the /bin directory sh is linked to dash so you just need to update the link to point back to Bash:

cd /bin
sudo ln -sf bash sh

After that simple change SQLDeveloper fired right up!

Technorati Tags: , , , , , ,