Category Archives: Software

All Change on the Desktop (Again)

My ThinkPad and What I Do With It

By way of preamble, the computer I use on a daily basis is a Lenovo ThinkPad Z61m 9451NTM. Whilst this is not the computer that I hoped it would be when I bought it – it has serious overheating issues and seems to have drifted away from the quality of IBM ThinkPads since going over to the new manufacturer – it is quite a powerful machine better considered as a desktop replacement rather than something that one can use on one’s lap. (If the weight doesn’t crush your knees, the overheating will burn them. And other bits.)

At the moment, this machine is running Gentoo Linux with my own customised LAMP stack and the fast, minimal, Fluxbox as my desktop environment. This machine runs all the services that my web servers run plus the GUI desktop environment.

I am not the most demanding user in that I do not deal with graphics, games or anything that requires much in the way of computing power. However, as a developer I run VMware Workstation so that I can test with web user agents running on Windows XP (not to mention running iTunes.) This machine came as standard with 0.5Gb of RAM; I bought an extra 1.0Gb when I got it but had to upgrade to 3Gb to be able to run VMWare guest operating systems reliably and without dragging down performance.

The ThinkPad is normally run dual-screen with xinerama using an Asus VW223U 22″ widescreen monitor as my primary, with the laptop display as the secondary. Input is via a Microsoft (a company I usually avoid!) Natural (ergonomic/split) keyboard and a Logitech TrackMan Marble optical trackball. It should be noted that I actually have to have 2 config files for the X server – one for single and one for dual monitor. Running without the external monitor in dual mode makes the keyboard/internal monitor unusable; I now have a special startx script to ask which configuration I am running before starting the X server.

The supplied 80Gb hard disc proved to be inadequate for my demands (virtual machines can take up a lot of room) after about 6 months. The 160Gb 5400rpm disc I put in as a replacement – copying the old disc straight over – was not the wisest of investments as I have now, a further 18 months down the track, had to acquire a 320Gb 7200rpm disc for my next move. (Note that both replacement discs are Hitachi TravelStars as per the original equipment, to provide design continuity.)

This machine is my “everything” machine. It is the machine I work with, the machine I use for electronic design and would also be the machine I use as a DAW (Digital Audio Workstation) were it not for serious limitations of the Gentoo Linux distribution currently installed.

Greetings to Deb and Ian

Having used Unix-derived operating systems for some 22 years, when I first started working for myself in 2001, I was very quick to dump Windows as my desktop operating system and move to Linux. The distribution in question was SuSE as I had experience with this from my previous life, using it on test servers based on 486DX4-100 machines. For a while I was satisified with SuSE but every upgrade caused more problems and, back in 2006, with my old Toshiba was suffering from loss of a memory socket, became totally unusable. It was then that I migrated to Gentoo Linux.

Gentoo has served me well over the last two-and-a-bit years, both on the desktop and on my web servers. However, it appears that the AMD64 version of Gentoo is far less well maintained than it could be and the maintenance burden of running ebuilds on 3 servers plus the laptop has become unviable. In addition to that, I am unable to run and/or build various audio applications such as Rosegarden, Qtractor, Audacity and others. With the restriction in working (or able to use computer) hours that my health situation enforces on me, I have decided that it is time to go back to binary Linux distributions. I have sworn off RPM-based for life (I ran a RedHat web server once as well as my SuSE boxes) – never, ever, again. Whilst the popular choice of Linux distribution (other than RedHat and the now Novell SuSE) would appear to be Ubuntu, this distribution does not appeal to me as it appears to be aimed (and good on ’em for doing it) at the non-technical market.

My next move will be to Debian, an old, established distribution and that from which the popular Ubuntu is derived.

How to Migrate Without Inconvenience

Many of the tools that I use I wrote are one-offs. They were never designed to work on other machines or outside of my current working environment. My LAMP stack is customised, but I have few scripts (especially for the Perl part) that would enable me to re-install it quickly on a new machine or hard disc.

Migration from Gentoo to Debian by starting with a clean disc could take upwards of a week – time I cannot afford.

My solution, that which I have just started within the last couple of weeks, is to do the migration in stages. This is possible due to the fact that my ThinkPad is able to boot from an external, USB-connected, hard disc. The vendor from whom I obtained the new 320Gb disc happened to be clearing external USB to SATA disc enclosures for $5 AUD a piece. My new disc is mounted in one of these so I am able to dual-boot between my day-to-day environment and the fledgling Debian environment. I even have an entry in the Grub menu of my internal disc to allow me to boot the external one.

Issues So Far

I have only encountered three issues so far with the migration progress:

  1. If I boot from the external disc, I can’t get Grub to boot anything – either the internal or external disc. I can only guess that for some reason the disc IDs are different when booting thus.
  2. Time. I simply don’t have enough at the moment to devote to this work. However, because I can do it bit-by-bit, this is not a significant issue.
  3. Last but not least, the afore-mentioned over-heating issue is the main problem. The only way to get this machine to work – other than in the depths of Winter – is to use a kernel that has the IBM ACPI module and tools and to start the fan running at full speed as soon as boot is complete. As things stand, I think I will have to build an appropriate kernel whilst booted into my regular environment, copy it to the new disc and try from there. Either that or pull the thing apart and hard-wire the fan.

The Future

Once I have a working system and have copied everything across, I will move the external hard disc into the laptop. I will then build myself a realtime kernel and see if I can’t get those audio applications working.

Due to the lack of portability of the this ThinkPad – or at least the inconvenience of portability – I have decided to move to a Netbook for use elsewhere in the house. This will not be an Eeeeeeeeeeeeee or any such beast but an elderly and very slimline ThinkPad (a real one, from IBM.) Lacking any removable media devices or even USB, this machine does have a PCMCIA slot so that I can have WIFI access. I plan to replace the 4Gb hard disc with an adapter and a Compact Flash device (might have to get the soldering iron out if I can’t buy a suitable adapter) and re-stuff the battery.

This little wonder will probably be running the Slackware Linux distribution as I have had success with this before on old hardware. It is a really nice (and light) machine – I look forward to its rejuvanation.

Note: if anyone can suggest a light-weight web browser (user agent) that runs well on a low-resourced system (Flash and other plugins NOT required), please let me know.

Update 1

I have attempted to install my Gentoo kernel onto the Debian disc, but it won’t boot properly.  Now installing the “official” way but booted into Gentoo and then chroot’ed to the mounted Debian disc.  This allows me to apt-get everything I want without having to actually boot into Debian.

Open Source MIDI Control Surface

I am in the process of designing a MIDI control surface so that I can control knob-less synthesisers and also control virtual sliders in Digital Audio Workstation applications like Qtractor, Rosegarden, Ardour, etcetera.

The design is made around an 8-bit Atmel AVR microcontroller, a Texas Instruments ADS7961 16-channel, 8-bit ADC, an array of 16 potentiometers, a cheap 2-line character LCD, some buttons and possibly a numeric keypad, although my current thought on that is ‘bloat’.

Firmware will be written in C, compiled with avr-gcc with the avr-libc C library.

I’m currently struggling over how to avoid sending MIDI ‘noise’ from the pots. I can foresee that the ADC will be picking up changing values without the pots being touched. How to determine whether a change is ‘real’ and needs to be transmitted as a value and what to ignore is the issue. Average a number of samples and then send only if the value has changed from the last average, ignoring any changes smaller than the two LSBs? I don’t know and am open to suggestions.

Software will allow each pot to be assigned a MIDI channel and controller. I’ll probably set it up so that assignments can be saved as programmes which can be recalled depending on what one is controlling.

Once I get to that stage, links to schematics and source code will be posted on this page. This will all be released under a Creative Commons Attribution-Share Alike license. (So yes, you could build this and sell if if you wanted to.)

Anyone interested in this project, please get in touch. There is an e-mail address at the bottom of the page, if you don’t already have one for me.

What About Midibox?

A couple of people have asked me if this is like or had I seen Midibox. To this I would answer not really. This project:

  • Is aimed at producing a very basic/simple/cheap device. Midibox is modular and far more sophisticated.
  • Will be using a different family of Microcontrollers (I’m an AVR man, not a PIC man) although the level of simplicity that I’m looking at should make it fairly easy to adapt to other families such as HC08, 8052 – or PIC.
  • Won’t have an operating system.

So it’s about minimalism, whereas Midibox is about modularity and flexibility (as far as I can see). And the reason that I’m doing this as opposed to re-creating an existing design (like Midibox) is because I want to. I like doing things from scratch.

CPU

I have decided to use an AT90S8515 for development purposes since:

  1. I have worked with these before.
  2. I have an STK500 development board/programmer.
  3. I have a couple of devices kicking around in my office in PDIP packages, which are easy to get probes on when doing diagnostics.

Whilst this device is technically obsolete its replacement, the ATMEGA8515, is compatible and very cheap at approximately $4 AUD from my regular suppliers, Soanar Plus. (This supplier may not have a huge range, but prices of single/low volume items are often considerably cheaper than the likes of RS, Farnell, etcetera.)

 

MySQL 5.1 – General Release at last!

From the Inbox:

We are proud to present to you the MySQL Server 5.1.30 GA release, the
first 5.1 production version of the popular open source database.

MySQL 5.1.30 is recommended for use on production systems.

MySQL 5.1 provides a number of new enhancements including:

  • Table and index partitioning
  • Row-based and mixed replication
  • Built-in job scheduler
  • Improved XML handling with XPath support
  • New SQL diagnostic aids and performance utilities
  • The return of the embedded library (libmysqld)

For a more complete look at what's new in MySQL 5.1, please see http://dev.mysql.com/doc/refman/5.1/en/mysql-nutshell.html

I have been working with MySQL 5.1 for quite some time and am delighted to see it come into a full production state.

Web Accessibility Techniques workshop in Adelaide on 20 November 2008

Just passing on this communication from Vision Australia:

Vision Australia is running their popular Web Accessibility Techniques workshop in Adelaide on 20 November 2008.

This full-day workshop run by Vision Australia is targeted at web-development team leaders, corporate communications professionals along with content authors, web programmers and designers and web contract managers. A basic knowledge of HTML is helpful.

This workshop provides a thorough overview of accessibility issues and the techniques used to address them. It covers the World Wide Web Consortium’s Content Accessibility Guidelines and their implementation.

Course outline & registration details here.

sql-o-matic

I have just released the code for my sql-o-matic at Perl Monks.

This is a partial version of a re-write of a system that I have been using for a few years to eliminate much reptitive coding by generating both SQL and Perl code directly from a database schema.

The new version is different from previous ones in two ways:

  1. It runs from the command line rather than as a web application.
  2. Rather than generating MySQL statements that are run from Perl, SQL is provided to create stored procedures.  Perl subroutines to call these stored procedures are also provided.

The code that I have released is not my finished version of sql-o-matic.  There is more work to be done on this and it will not be going on public release since what I will be doing from now on will not be creating universal code, but code that is very specific to my own coding standards and modii operandi.

Foxy Add-Ons: Tab Mix Plus

I have looked at a lot of Firefox extensions over time. One of the most useful that I have come across of late is Tab Mix Plus.  This extension gives the user vastly more control over tabbed browsing than un-extended Firefox. 

Whilst I have had the standard Firefox settings configured to open all new windows in new tabs, my online banking (ANZ) has persistently opened its logged-in session in a separate Window.  Due to some problems that I have been experiencing with the Fluxbox window manager and xinerama, the banking window inevitably opened very small on my smallest screen.  Not any more!  Now when I log into banking, I get a nice, new tab in my existing window.  That single feature makes Tab Mix Plus worthwhile for me. 

The Solstice Clock – Part 1

Preamble

My daily routines tend to be vague, imprecise and are subject to the fragilities of my heath, I am no slave to the clock. (The notable exception to this is when it is time to make the dinner; you can set your watch by it.) Over the last year, however, my fascination with the measurement of time, and the history of the same, has been on the increase.

For several years, I have been disenchanted by some of the artificial, arbitrary and often (to me) pointless aspects of modern, 'Western' timekeeping. Take daylight saving, for instance; I have read the various arguments for it, but have yet to see one which does not have a pertinent counter-argument or that justifies upsetting timekeeping around the globe. The changes in various countries and states are not even synchronous. (The USA and Europe are a couple of weeks apart in their change-over dates. In Australia, the state of Queensland does not even have daylight saving – and good for them, I say.)

A more recent annoyance that has come with my entering the age-group that might be termed 'grumpy old man' is the Gregorian calendar. Follow the link if you want to know more about this – I am not going to repeat at length what is recorded in innumerable places. I concede that the Julian calendar had a year that was a little too long and was getting further and further out of whack with the Tropical year. However, what really makes me grit my teeth is the totally arbitrary (in terms of the Tropical year) start point. The Vernal Equinox (Autumnal Equinox for those of us living in the Southern Hemisphere) tends to be the reference point for the Tropical year, but I can see that this would not fit in with the whole 'Rebirth of the Sun' thing, which would make the Winter (or Summer in the Southern Hemisphere) Solstice the reference point. But no, a point some 10 to 11 days after the Winter Solstice is what we've got to put up with.

Calendars

Let's turn our attention now to calendars in the physical sense. Without any further ranting about the artificial and arbitrary length of the weeks and months of the Gregorian calendar, what does this calendar mean to most of us? Generally, a set of 12 printed pages, broken down into grids so that we can see a correspondence between days of the week and days of the month. This grid may have pre-printed information telling us useful-to-know things like "Moon waxing gibbous" or "Sow mangold-wurzels now!". There may even be space to write our own information like "Wedding anniversary next week", "Wedding anniversary tomorrow", "Wedding anniversary", "Doh, missed it again! In dog house."

If we look at a clock, it tells us what time it is. If we look at the calendar described above, does it tell us what date it is? The answer is no. Despite the fact that calendars that tell you what the date is have been around for quite some time (e.g.: Stonehenge), the ubiquitous paper (or other medium) calendar gives us absolutely no idea of what date it is.

The Importance of Calendars: Food

What events of real importance are indicated by calendars? Irrespective of the calendar system used, the most important thing that I can think of that might be indicated by a calendar is the timings involved in agriculture – the sowing and harvesting of crops, the gestation of livestock, etc. Without these, we have no food. (I suspect that the world population is a little too large for a total reversion to a hunter-gatherer system.)

So, calendars can be of importance, in more widespread terms than the occasional murder due to forgetting one anniversary too many. Our graphic calendars, diaries and almanacs still do not help us know where we are in annual cycle. There are many seasonal indicators that can tell the farmer that it is time to start ploughing (like the snow may have melted so that there is actually ground visible to plough) and – of course – there are always the stars for those who know how to read them, and don't live somewhere that has a permanent overcast. The moon is always a good time-reckoner and many calendars are based on it – you still need a clear sky to watch it though and some way of keeping track of how many moons have passed since event X.

A Clock is a Fast Calendar

As I mentioned earlier, a clock can tell us what time it is. If we take a mechanical clock and add a few more gears (a divide-by-24 from the hour hand shaft), we can make it count days. If months were of a regular length, we could reduce further and have a months dial. Months of irregular lenght may also be dealt with, even for leap years – far more complex mechanics would be involved though.

If we were not concerned about displaying hours and minutes (and possibly seconds) on our mechanical clock, we could turn it into a calendar simply by making it tick slower – much slower.

The Slow Tick

If we take the Tropical year as being 365.24219 to 8 significant figures, we can calculate:

ns = 365.242 x 24 x 60 x 60 = 31556925 = seconds in a tropical year, to 8 significant figures.

If we decided that 12 hours on our clock was to represent a tropical year, we can divide the above number of seconds by the number of 1-second ticks of the clock (assuming that it has a 1-second tick) required to rotate the hands by 12 hours:

nt = number of ticks required to rotate hands by 12 hours = 60 x 60 x 12 = 43200

So, to work out the length of the tick that we would need to rotate the hands once in a Tropical year:

t = ns/nt = 730.48438 seconds, to 8 significant figures.

That means that our Slow Tick would occur roughly ever 12 minutes, 10.5 seconds.

A Tricky Escapement

I will leave it to some clever-clogs to work out how to make a mechanical clock escapement that only ticks every 12-and-a-bit minutes (no down-gearing allowed!)

As I am not particularly interested in modifying a traditional, purely mechanical clock for these purposes, I will look at how an electro-mechanical clock may be used instead.

Quartz clock movements may be obtained cheaply from hobby suppliers. However, entire clocks can be obtained even more cheaply from 'cheap' shops. With the latter, you get a face and a case thrown into the bargain, so have little to do in the way of mechanical construction.

My practical research for this article has so far extended to obtaining and dissecting a quartz clock obtained from a local supermarket for $12 AUD. Once the movement is removed, it looks very much like every other cheap quartz movement that I have seen over the last few years. The drive, contrary to what I suspected, does not consist of a solenoid that is simply pulsed every second with some kind of pawl and ratchet mechanism, but of a cylindrical magnet between the poles of a solenoid that would require a reversing field every second. (If a simple pulse train of fixed polarity were applied, the magnet would move possibly once, then just twitch slightly every time a pulse came along.)

Part 2 details some thoughts on the pulse generator which will drive the Solstice Clock and how it can become more than just a Solstice Clock.

VMware – No Developer Should Be Without It

Many years ago, a colleague told me how he no longer needed to use Windows on his laptop, because he had something called VMware.

The main attraction for me of VMware is that it allows me to test things on Windows without having to re-boot my computer or even fire up a separate machine.

At one point, I even acquired an evaluation license for VMware, but getting it all working just looked too hard.

In a recent correspondence with one of my learned colleagues at GAWDS, the – in my mind – unlikely combination of the words ‘VMware’, ‘installation’ and ‘easy’ came together. I thought then that maybe it was time to have another, and closer, look at this product.

After looking at various wikis, I was under the impression that it might be able to run my dual-boot Windows XP partition through VMware, under Linux. That is, I boot Linux, then run Windows in a virtual machine. The thought of being able to do this without having to reboot into the other operating system was very attractive – so much so that I purchased and downloaded VMware Workstation.

VMware Workstation is available both as an rpm package for those using RedHat and SuSE-derived distributions, and as a tarball. I had a quick look to see if there was a Gentoo ebuild available, but it appeared that all the recent editions were masked so I elected to use the ‘official’ tarball, as I might at least be able to get some support if things went wrong.

The installer in the VMware Workstation tarball assumes that somewhere on the system there are directories rc0.d through rc6.d. On Gentoo, this is not the case. I ended up creating these directories, just so I could get the installer to to its work. Installation went smoothly and none of the questions asked raised any issues or caused me to seek help. A reboot was required before things would work correctly and I had to invoke the programme thus:

VMWARE_USE_SHIPPED_GTK="yes" vmware

I followed the appropriate instructions to set up my Windows partition to run as a virtual machine, started the virtual machine, selected the ‘Windows’ option on the Grub menu and had the whole machine freeze on me. This was starting to seem too much like hard work. The instructions advised that the preferred method was to install the guest system in a virtual disc rather than running from the physical disc. I decided that I wasn’t going to be nuts about trying to get the physical disc thing working, so dug out a Windows XP Home Edition DVD and key which I wasn’t using and installed from scratch.

I have to confess that I was expecting all sorts of horrible things to happen, but the installation and application of all the Windows updates since XP Service Pack 1 went without a hitch. Everything just worked.

The ultimate test was to see whether I could install iTunes, restore the iTunes directory from my backup (not a backup made through iTunes, I hasten to add) and get my iPod to synchronise. (As I am not doing much testing with Internet Explorer at the moment, iTunes is currently the most frequent reason for having to reboot into Windows.) My backup had been made by rsynch’ing the iTunes directory to my file server, under Cygwin. Once again, I was expecting something horrible to happen when I started the DRM-rich iTunes. Once again, nothing horrible did happen – I just got asked for my password and had to authorize the ‘new’ computer with the iTunes store.

Plugging in my iPod brought up a message saying that VMware was having to disconnect it from the regular driver (USB storage, through udev) to enable it to work with iTunes – I paniced a bit when I saw the message, but was quickly relieved when I saw my iPod appear in the iTunes window. I even purchased the album “She’s So Unusual” by Cyndi Lauper and installed it on my iPod.

The preload Windows partition is now – as far as I am concerned – totally redundant. In fact, I have now deleted it, formatted it as ext3 and now have the directory containing my virtual machine mounted on it. Important: before ‘blowing away’ the original Windows partition, I first went into iTunes and de-authorised the machine.  If I had not, my iTunes music would be authorised for only four computers – the other one being lost.  I don’t know if there is any way in which one can ask Apple to de-authorise a machine that no longer exists, but think it better to take this simple step rather than having the problem in the first place.

Whilst I think that VMware is an excellent piece of software – far easier to use than anticipated – and that every developer should have a copy, I would make one caveat: running virtual machines needs powerful hardware unless one likes having a machine that runs slightly slower than continental drift.  The laptop on which I am running VMware has a dual-core 1.85GHz processor and 1.5Gb RAM.  (0.5Gb allocated to VMware, along with 1 CPU core.)  I would not want to try running with less resources and am considering upgrading to 3Gb RAM so that the virtual machine can run with a full 1Gb, the rest being left for the GNU/Linux system.

 

Sun to buy MySQL

Sun Microsystems CEO, Jonathan Schwartz, has just announced in his blog that Sun Microsystems is to acquire MySQL AB, the company behind the MySQL database which underlies all the web applications that I have ever developed.

All the “big boys” in the IT game (barring Microsoft, of course) have been moving down the Open Source route, but possibly none to the degree of Sun.

The enviable collection of OpenSolaris, OpenOffice, Java, NetBeans and GlassFish (I’ve probably missed others) will now be joined by my favourite database. I use all those products listed, apart from Glassfish. In Schwartz’s words:

…we’re putting a billion dollars behind the M in LAMP.

I think – or at least sincerely hope – that this is Very Good News.

Perl 5.10 Now Available

Well, this is good news and no mistake – Perl 5.10 is now available!  Perl 5.10 has (or is supposed to have) a faster interpreter than 5.8 and previous, with a smaller memory footprint but for me the most exciting thing is that finally we get a switch statement.  The slightly confusing thing is that it’s not called ‘switch’, it’s called ‘given’.  It appears that this is a feature that was designed for Perl 6 but since Perl 6 is the ultimate in ‘vaporware’, it has been ported to Perl 5, which actually exists in the Real World.

The new switch (or given) statement relies on the new smart match operators – don’t ask me how they work yet because Perl 5.10 has yet to appear in Gentoo Portage, so I don’t have it on my machines.  Soon though, and l am certainly looking forward to it.

And lo, there was much rejoicing!