Friday, 18 December 2009

Healthcare IT Doesn't Reduce Costs

A study in the Harvard Medical Journal shows that healthcare IT doesn't reduce costs, and perhaps provides a very marginal increase in quality of care. The authors speculate that one of the reasons may be that the cost of obtaining and running the system outweighs the benefit. No kidding. That fits what I've seen completely.

It's a short article, and worth reading. Thanks to Andrew for pointing me to it.

Saturday, 28 November 2009

Ubuntu Local Committee Install and Tweak

The ever-fantastic Ubuntu Vancouver Local Committee is organizing a Support Saturday. Come on down and learn about the world's most popular free operating system. If you already use Ubuntu, get some help to make your experience even better.

The details:

Saturday Dec 5th, 2009 11am - 2pm
Vancouver Community College
1155 East Broadway (Broadway Campus)
Building B, Room 219G

The poster is at: http://is.gd/560zM (a pdf).

Sunday, 20 September 2009

Ubuntu Breaks Thinkpad Yet Again

Sometime in the last couple of weeks the brightness controls on my Thinkpad x300 stopped working.

I fixed it by creating /etc/modprobe.d/thinkpad_acpi.conf and putting this line in it:
options thinkpad_acpi hotkey=enable,0xfdffff
Then you have to remove and reinstall the module to read the new options:
sudo rmmod thinkpad_acpi
sudo modprobe thinkpad_acpi
I'm not sure I'm getting all the brightness I should, but at least the control works to put the brightness up to make the screen readable.

Whine: This isn't the first time some part of the interface between Ubuntu and my laptop has broken due to an update. I can sympathize with the developers and the difficulty of testing all laptops out there, but I can sympathize more with the user who isn't going to put up with an O/S that mysteriously starts and stops working as updates are installed.

Tuesday, 11 August 2009

DHCP Not Updating DNS

So I had a weird problem -- suddenly my DHCP server stopped updating my DNS server when my main laptop that I use all the time renewed its DHCP lease. It seemed to be working fine for all other machines on my network.

After much fooling around and some reading, I discovered in the middle of some document a statement that the DHCP server keeps track of whether it thinks it has updated the DNS server, to avoid one round trip when renewing a lease. This means that if the DHCP server thinks it has updated DNS, it won't try again and if the DNS server doesn't have that address, it'll never get it.

Well, the DNS server will never get it until you do the following on the DHCP client machine to force a release of the lease:
sudo dhclient -r
Once you do that and then renew the lease again (e.g. disconnect and connect the network) everything is fine.

Saturday, 18 July 2009

Firefox Disappears when Changing Display Settings

After a year without problems, suddenly I started having a problem where Firefox disappeared when I switched between the laptop screen and my external monitor. Firefox was still running, but I couldn't make it appear.

It turns out that somehow it was ending up on outside the screen and therefore it wasn't being shown on the bottom panel. Here's how to fix:

  1. Right click on the bottom panel ("task bar" in Windows talk) and select "Preferences".
  2. Select "Show windows from all workspaces". Then the Firefox button will at least appear on the bottom panel.
  3. If you can't see the window, right click on its button in the bottom panel and click "Move". Then you can pull the window onto the current display and click again to drop it there.

Friday, 10 July 2009

iPhone Tethering Notes for Ubuntu Vancouver LoCo

I gave a lightning talk at the Ubuntu Vancouver Local Committee July 9, 2009 on accessing the Internet from an Ubuntu computer through the iPhone.
  • Use the instructions from the Ubuntu forums here. This other page gives the underlying commands used by the script from the Ubuntu forum. You may find it helpful if the script doesn't work for you.
  • During installation, when you're asked to make the iPhone discoverable, go to Settings-> General-> Bluetooth and turn on Bluetooth.
  • Part way through the instructions in the Ubuntu forum you're asked to "pair" your iPhone with the computer. To "pair" your iPhone with your computer:
  1. Click on the blue icon with white triangles that you'll find amount the other notification icons, typically in the upper-right corner of your screen.
  2. Select "Set up new device..."
  3. Click "Forward".
  4. Wait for your iPhone to appear in the list. If it doesn't, go back to Settings-> General-> Bluetooth on the iPhone and make sure Bluetooth is on. Also, make sure your iPhone is less than a 1/2 metre from your computer.
  5. Select your iPhone in the list and click "Forward".
  6. Ubuntu will show you a four-digit code and ask you to enter it on the device. The iPhone will have a keypad showing. Enter the code.
  7. Ubuntu will ask if you want to allow the connection. Select "Always allow" and click "OK".
  8. You're now paired.
  • Before trying to tether your computer to the iPhone, go back to Settings-> General-> Bluetooth. Your computer's name with "-0" appended should appear below the on/off button. If it says "Not connected" beside your computer's name, click on the computer name and wait for it to change to "Connected".
  • Using Network Manager, turn off other network connections you may have running before tethering.
  • Finally, before running the script, don't forget to turn on Internet Tethering on the iPhone. Go to Settings-> General-> Network-> Internet Tethering and turn Internet Tethering on.
  • Keep the iPhone with 1/2 metre of your computer. (You can try more, but I suspect that the flaky connection I sometimes experience may be associated with the distance between the phone and the computer.)
  • After running the script, you still won't be able to browse the Internet. (You don't have any usable DNS servers defined on your computer.) Do the following in a terminal:
sudo cat >>/etc/resolv.conf <<-END nameserver 208.67.220.220 nameserver 208.67.222.222 END
  • I put the above in my uit.sh script at the appropriate place.
  • Remember to turn off Internet Tethering and Bluetooth on the iPhone when you're done.
  • Disconnect tethering on your computer by running: sudo ./uit.sh -d
  • Don't forget to reconnect your computer to your usual networks after you turn off tethering.
Troubleshooting
  • My experience is that you have to do everything in exactly the right order. If something goes wrong, do the following and then start over:
  1. On the iPhone, go to Settings-> General-> Network-> Internet Tethering and turn Internet Tethering off.
  2. On the iPhone, go to Settings-> General-> Network-> Bluetooth and turn Bluetooth off
  3. On your computer, run the disconnect script: sudo ./uit.sh -d
  4. On your computer, restart Bluetooth: sudo /etc/init.d/bluetooth restart
  • The Bluetooth connection seems to be unreliable. Sometimes I can browse a page or two and then it stops working. Sometimes it just doesn't connect at all. After two or three tries I usually get a reliable connection. Every time it fails, be sure to do all the steps in the above list.

Friday, 26 June 2009

Tethered iPhone

I'm posting this from my laptop sitting outside Marc's Karate dojo with my iPhone in my pocket providing my Internet connection over Bluetooth. I can't help but be geekily happy about this. I never bothered to set up the tethering before OS 3.0, so it's new to me. This is old news to the hardcore users.

I guess a new thing is that Fido is cool with the fact that I've tethered. Not that I care what they think, but phone companies are vindictive enough to actually cut you off if they detected you were tethering, so I feel a little better that it's legit. (Make sure you read the details to be sure you're legit.)

The best instructions I found are here. The instructions here show the actual commands, which is useful to know when you're debugging. It wasn't smooth for me because I didn't do the sequence in perfect order, and it looks like once I messed it up I just couldn't get it to connect. By going System-> Preferences-> Bluetooth and undoing the Bluetooth pairing, I was able to go through the steps from the start and get it working.

The part I had out of order is that I didn't check to see that the iPhone was actually connected to my laptop before attempting to tether from the laptop. The Bluetooth screen on the iPhone has to say "Connected", not just show the name of your laptop.

While writing this I lost my connection and couldn't get it back until I restarted Bluetooth on my laptop (sudo /etc/init.d/bluetooth restart). I have no idea what that's about, but I've seen others on the Internet complain that the connection isn't always reliable.

Thursday, 25 June 2009

Keyboard Layouts Disappear when Plugging In Keyboard

I have USA and Spanish (Spain) keyboard layouts defined on my laptop, with USA being the default. When I plug in my external keyboard I can no longer choose the Spanish layout either from the keyboard layout indicator in the panel or via the keyboard shortcut I've defined. If I bring up the keyboard preferences, the Spanish keyboard is still in the list. To work around the problem, I either delete it and re-add the Spanish layout, or restart Gnome (log out and log in).

Sometimes after unplugging and plugging in the keyboard, attempting to switch layouts will cause the keyboard indicator to display "??" instead of "USA" or "Esp". Sometimes it simply displays "USA". In either case, the keyboard responds with the USA layout, meaning no easy access to the Spanish characters.

I'm running on a Lenovo Thinkpad x300. The original Ubuntu install was 8.04 and I've upgraded (using the upgrade process via Synaptic, not by reinstalling) to 8.10 and now 9.04. I have an external PS/2 keyboard in Spanish/Spain physical layout that I plug in to the laptop through a PS/2 to USB cable. The laptop has a USA physical layout.

I first noticed this with 8.10, but I can't say for sure that it wasn't a problem in 8.04 as I didn't use the external keyboard very much with 8.04. On 8.10, the problem also happened when I suspended and resumed, but that seems to be fixed in 9.04. I can suspend and resume and the Spanish layout is still available. However, if I actually unplug the external keyboard and plug it back in, I lose the Spanish layout.

UPDATE: There is a fix: Add the jaunty-proposed packages to your package source list. Through the GUI that's System-> Administration-> Software Sources. Then run System-> Administration-> Update Manager.

Here's the original fix:

  1. Read about updating from PPAs here: https://help.launchpad.net/Packaging/PPA#Installing%20software%20from%20a%20PPA
  2. Add Sergey's PPA to your apt sources: https://launchpad.net/~sergey-udaltsov/+archive/ppa
  3. Update your software, making sure that one of the packages updated is "libxklavier - 3.9-0ubuntu3"
  4. Restart your computer
This is Ubuntu bug #363169.

I spent a lot of time flailing around the Internet looking for a solution to this problem. I posted my problem to Ubuntu's Launchpad in mid-May and no one appears to have even looked at it except me. In the meantime, bug #363169 was posted in mid-April, and all my searches hadn't turned it up. Only when I posted the bug to Gnome (thinking it was a Gnome problem, not Ubuntu), did Sergey helpfully see it and point it back over to the correct Ubuntu bug, with a fix.

I've tried to update a few places in Launchpad where I was looking for solutions, but I fear that others having this same problem won't see it. That's why I've made this blog post.

Wednesday, 17 June 2009

Google Wave

I just watched the Google Wave preview video. What I find intriguing about Wave is that they may have made version control accessible to the masses. Of course, they don't call it version control. That name is part of the reason why it's never been accessible to the masses.

Click here to see my del.icio.us links to the URLs they give at the end of the video.

Monday, 15 June 2009

Open Web Vancouver 2009

I went to Open Web Vancouver 2009 last week. It's a two day, low-key conference about open technologies for developers, testers and others at that level of the business. It's a very well-run, well-attended and interesting conference, and very inexpensive.

The most interesting thing I heard about was PhoneGap. It's JavaScript that runs on all the major smart phones, so you have fewer cross-platform issues. And it gives web applications access to some of the functionality in the phone not normally accessible to a web application. On the iPhone, this means the current location and vibration.

There was a good workshop with City of Vancouver staff about their recent direction to open up the city's data, as well as moving to open standards and open source software. The first priority is the data. They're hoping that people will take the City's data and mash it up in useful ways. There's a Google Group about this at http://groups.google.com/group/vancouver-data.

18 months ago there was a lot of stuff about Ruby on Rails at this conference. This time the Drupal community was big. There was a presentation from Momentum magazine about how a volunteer built their website in Drupal. I thought they'd found money to have a professional develop the site, it's so good.

And Mozilla Messenging (i.e. Mozilla Thunderbird) is based in Vancouver. Who knew?

Thursday, 14 May 2009

Ubuntu VMs and Time

Ubuntu 8.04 in VMs under VMWare Server 2.0.1 need the kernel parameter "clocksource=acpi_pm" when they boot. Edit /boot/grub/menu.lst and add "clocksource=acpi_pm" to the end of the line that starts "# kopt=". Don't remove the "#". In this context it's not a comment. After you save the file, run "sudo update-grub" and then reboot.

If the guest doesn't have this kernel parameter specified, time runs backwards on the guest O/S, or time hangs or gets stuck. This was showing up especially on my backup server running bacula, and the backup clients that had large amounts of data. I suspect that high loads exacerbate the problem.

Wednesday, 13 May 2009

xsane Problems

This morning I scanned a small French reader that Marc particularly liked. At noon I had to scan two pages for Angela, because she'd left them at home. When I went to scan I got this: "Failed to start scanner: Invalid argument".

After much flailing, including re-installing hplip and xsane, and doing sudo
ln -s /usr/lib/libhpmud.so.0 libhpmud.so
I finally got brave and simply moved ~/.sane/xsane to ~/.sane/xsane.old, then started xsane and it worked.

After the fact, I figured out that the problem started when I clicked on the preview pane in xsane and set the size of the area I was scanning to 0. The message wasn't very helpful. (I figured it out by diff'ing the xsane.conf that worked with the one in xsane.old.)

In addition, hp-check reports there's no plug-in installed for my printer, even though everything seems to be working. Go figure.

All this under Ubuntu 9.04 using an HP CM1312nfi MFP.

Sunday, 10 May 2009

Getting Identity From Active Directory

I needed a test environment where I could test mounting and accessing Windows shares on a Linux machine, using identities and permissions obtained from Active Directory (AD). After the initial setup, I wanted to run a processes periodically in the background, without user intervention. Therefore, having the user enter the password each time wasn't an option. Also, the background process would be run periodically forever in the future. I didn't want to store passwords because the processes would fail after the user changed their password (and it's not a good idea to store passwords anyway).

The Kerberos authentication scheme in Windows and Linux uses tickets, which can be used to prove that a process is acting on behalf of a user. A user gets a ticket by requesting one and providing their password. Until that ticket expires, processes that support Kerberos can be run with the permissions of that user.

So let's say we want to access a Windows share as user "testa", which is a Windows user known to the AD server. The Linux machine asks for a ticket for testa, using testa's password. The AD server validates the password and gives the Linux machine a ticket. The Linux machine can then mount the Windows share using Kerberos authentication. Accesses to the files and directories on the share will then be allowed or denied based on testa's permissions.

I built an AD server on Windows 2003 Server SP2. The client machine was Ubuntu Desktop Edition 9.04.

Here's how I went about it:
  1. Build an Active Directory server accepting the defaults. This included allowing it to set up its own DNS server. I already have DNS servers in my network, but I'm not a DNS expert. I've had bad luck changing my DNS setup in the past, so for this test I just let AD do its thing.
  2. Install required packages on the Linux machine:

  3. sudo apt-get install krb5-user keyutils

  4. Replace the installed /etc/krb5.conf with the following. You have to replace "my.domain.tld" with your own domain, of course. Be careful to copy uppercase and lowercase:

  5. [libdefaults]
    default_realm = MY.DOMAIN.TLD
    default_checksum = rsa-md5


    [realms]
    MY.DOMAIN.TLD = {
    kdc = ADServer.my.domain.tld
    }

    [domain_realm]
    .my.domain.tld = MY.DOMAIN.TLD
    my.domain.tld = MY.DOMAIN.TLD

  6. Add the following line to /etc/request-key.conf. The order of the lines is important. I put it last and nothing changed. I put it first and everything worked:

  7. create cifs.spnego * * /usr/sbin/cifs.upcall %k %d

  8. Get a key with kinit. Run kinit with sudo. The ticket you get is for the AD user testa whether you run as sudo or not, but the place that kinit stores the ticket depends on the Linux user who runs kinit. Since the mount command runs as root, you have to get a ticket for root or mount won't find the ticket

  9. sudo kinit -f testa

  10. Mount the share, replacing "FileServer", "Share", and "/tmp/mnt" with appropriate values for your systems:

  11. sudo mount -t cifs -o sec=krb5i //FileServer/Share /tmp/mnt
For a while I was getting "mount error(2): No such file or directory" when I tried to mount. It was because I hadn't installed the keyutils package.

I've tested this up to and including the mount. I haven't finished testing the background process I originally wanted to build. I may modify this post based on my testing experience, so check back later.

Thursday, 30 April 2009

Whither the CBC

The CBC like many media outlets has been in crisis recently. On top of repeated cuts in government funding over the last twenty years, they're suffering from the collapse of advertising revenue to traditional media, due to the television services' dependency on ad revenue.

(U.S. readers: The CBC is the government-funded public television and radio broadcaster in Canada, like the BBC in the UK or the ABC in Australia.)

To me, the role of the CBC is to provide channels for Canadian cultural expression. Market forces will inevitably regurgitate what is produced by the massively-productive American media machine, so we need someone to provide the infrastructure for cultural dissemination. Nothing in that says that the CBC has to be a radio or television network in the traditional sense.

In the post-network, post-newspaper world, I think there are a lot of exciting opportunities for public broadcasters to facilitate even greater promotion of Canadian (or British, or Australian, or South African or New Zealand or ...) culture. So here's my road map for CBC over the next decade. It consists of two themes, distribution and production:

It should be obvious that people don't think of network television or radio as their primary way of getting information or entertainment anymore. Music comes on a iPod. Video comes from YouTube. I want to listen to my local CBC radio morning show on my iPhone, because that's what I take with me when I walk my dog. And I want to view CBC TV on all those devices, too.

CBC should stream all its content, in local timezones, and in open source formats. This means CBC should support open source projects that develop and/or package codecs and whatever other software is needed to ensure that users of all platforms have access to CBC audio and video content: Mac, Linux, Windows, iPhone, Blackberry, Android and other phone platforms. A lot of this technology is available already, but much of it is only accessible to us hard core geeks. It needs to be really easy for anyone to use.

Even more exciting is the possibility for production: Enable the public to produce their own high-quality podcasts and video. This means, again, funding open source projects to develop and package audio and video production tools. Having done a bit of screencasting, I know it's not easy for the general public to do today, but we're not a long way from it being easier.

The CBC, or Canadian universities, could also produce a series of screencasts or videos to show people how to produce content: A sort of on-line journalism and documentary production school. And there's no reason to limit this to news and documentaries. The CBC, NFB and universities

This is technically feasible. I believe it's economically feasible within a budget that CBC has or could get. Maybe they can cut real costs (rather than cutting services) from the traditional parts of the broadcast system by moving programs around on the Internet, instead of via satellite or other dedicated pipes. Maybe they can increase their budget, by showing the government they're more relevant than they've been in years (not likely with Harper as PM, but he'll be gone someday).

The real challenge is the mindset change that would have to take place within the CBC bureaucracy. Therefore, this is a call to action to those who know people in the CBC or that can influence the CBC's direction. Start spreading this idea. The important thing is that we start discussing how we're going to create and distribute Canadian content in the Internet age, and then start acting on it.

Friday, 17 April 2009

Showing Lists of Events in Drupal 6

I wanted to have a page in Drupal that showed upcoming events for the Parent Advisory Council of my son's school, with a tab making it easy to show past events. The idea was to have one place to go to find out about upcoming events, or to find previous events so you could get materials from the event (e.g. handouts provided by speakers).

Drupal has a pretty good module for showing calendars, but it shows them on day, week or month views in a calendar. My users wanted to see a list of events. Our events are more spread out, so a list or table view is actually easier to work with.

So to summarize, we want:
  • A menu in Drupal's primary menu for "Events"
  • The menu takes the user to a page that shows upcoming (in the future) events
  • There is a tab on the page for "All Events". Clicking the tab shows all events, paged with 20 events per page
  • There is also a tab for "Upcoming Events". Clicking it takes you back to just the future events
  • Events have to have a start and end time, and may have an additional description and attachments (e.g. agenda, minutes, hand-outs)
The high level overview of what I did is:
  1. Install and enable some contributed modules
  2. Create a "content type" for events. This defines what information you're going to store for each event
  3. Define a "view" and two "displays" for the view. The view and its displays are partly a query of the information you want to appear, and partly the definition of the menus that get you to the information. The format of the information is defined by your theme, which I won't talk about in this post
  4. Put the menu in the right place
  5. Create some events and test it out. Testing is really important. It's almost impossible to get this right the first time
A small warning before you get started: The smallest error in anything can lead to very bizarre behaviour, or simply to some part of the page not showing up, with no apparent connection to the error. It took me days to get this working (with a lot of side-tracks into Drupal esoterica). Don't expect to get it right the first time, even with detailed instructions.

Here's what I did. I don't guarantee that I've covered every single thing, so please let me know by commenting on this story if I missed anything. (I assume you know how to do Drupal basics like install modules.)
  1. Install the Content Creation Kit (CCK), Views, Date, and Advanced Help modules. Date module version 6.x.2.1 won't work for the use case we're trying to implement. The filter relative to a date (e.g. "now") is broken, which means you won't be able to show upcoming events. Use date-6.x-2.x-dev (see http://drupal.org/node/426990) until the fix gets rolled into the release version
  2. Enable the "Content" part of CCK
  3. Enable all parts of Date except "Date Locale" and "Date Tools", unless you want them for other reasons. Also, if you're running on PHP5 you don't need "Date PHP4"
  4. Enable the "Views" and "Views UI" parts of Views
Now, create the content type for events:
  1. Administration-> Content Management-> Content Types
  2. Click on the "Add content type" link at the top of the "Content types" area
  3. Enter the name "Event" and type "event". There are many options to set, and the help text is pretty self-explanatory. Under "Workflow settings", "Attachments", make sure they're enabled (since we said that was a goal of what we're doing). Most of the other options depend on your needs, although under "Workflow settings" it's likely you'll want to turn off "Promoted to front page" under "Default options"
  4. Click the "Save content type" button at the bottom of the page
  5. Click on "Manage fields" beside the Event content type
  6. Under "Add", "Existing field", select "Datetime: field_event_datetime..." You may have to scroll down to see the existing fields. If you don't see an existing field called "field_event_datetime", then create one under "Add", "New field"
  7. Click "Save"
  8. You will be presented with another page allowing you to set a bunch of options. Set them according to your needs
  9. Click "Save"
Now create the view. You really should read the Drupal Views documentation, which you have available because you installed the Advanced Help module. Read it now. Click on Administer-> Site building-> Views and you'll be given a link to the documentation near the top of the "Views" area

Now, here's my summary of what's important in the Views documentation:
  • A view can have several displays. The display determines where the view is seen, and can also override some parts of the view's default settings. In the rest of this post, I use "view" and "display" in these specific meanings
  • Set up the common aspects of the view first in the Default display. In our case, that means the output format (a table), the fields to be viewed, and some of the filters
  • Be very careful when editing non-default displays to click "Override" before editing anything that you want to be unique to the display. If you don't explicitly click "Override", you'll change the default which will affect other displays that use the default value
So what we have to do is:
  1. Create the view
  2. Set up the default for the view the way we want it
  3. Create a "Page" display for the "Upcoming Events" tab
  4. Move the menu to the right place
  5. Enter some test events
  6. Check that the "Upcoming Events" tab works
  7. Create another "Page" display for the "All Events" tab
  8. Check that the "All Events" tab works
Here are the steps:
  1. Administer-> Site building-> Views
  2. Click the "Add" link at the top of the "Views" area
  3. Put "event_list" in the "View name" field, and "Event List" in the "View tag"
  4. Make sure the "View type" is node and click "Next"
  5. This brings you to the Views UI page. I found this page to be extremely unintuitive. You have to be patient and always remember to scroll down after clicking on something, because many links simply change what's displayed below what's likely visible when you click on the link
Set the defaults for the view:
  1. Under "Basic Settings", click "Unformatted" under "Style". Scroll down. You'll see some radio buttons. Click "Table" and click "Update". Ignore the error message that appears about no fields defined. We'll get to that later
  2. Beside ""Use pager", click "No". Scroll down. Select the "Mini pager" radio button and click "Update"
  3. Beside "More link", click "No". Scroll down. Select the "Create more link" check box and click "Update"
  4. Under "Fields", click on the "+" beside "Fields"
  5. Scroll down. Click on the check boxes for "Content: Event Dat and Time... From date". Don't check the box for the corresponding "To Date" field. Both are included in the "From date". Click on the check boxes for "Node: Body", "Node: Title", and "Upload: Attached files". Click "Add"
  6. You'll now be presented with a number of pages to allow you to set options for each field. For "Event Date...", accept the defaults by clicking "Update"
  7. For "Node: Body", accept the defaults by clicking "Update"
  8. For "Node: Title", click the "Link this field to its node" checkbox and click "Update"
  9. For "Upload: Attached file", click the "Link this field to download the file" checkbox and click "Update"
  10. Now, put the fields in the order you want: Click the up and down arrows by "Fields". Scroll down. Drag "Title" up to the top and click "Update"
  11. Set the sort order: By "Sort criteria", click the "+". Scroll down. Select "Content: Event date and time" and click "Add"
  12. In the next page, select "Ascending", so the next event will appear at the top of the list. Click "Update"
  13. Choose the nodes you want to display, specifically the published event nodes. Click the "+" beside "Filters". Scroll down. Select the checkbox for "Node: Published" and "Node: Type" and click "Add"
  14. On the page for "Node: Published", click the "Yes" radio button and click "Update"
  15. On the "Node: Type" page, click the "Event" checkbox under "Node type" and click "Update"
  16. Click "Save". We have our default view set up.
Create the "Upcoming Events" page:
  1. Click the "Add Display" button (the drop down box above it should read "Page" already)
  2. Under "Basic settings", click on "Page" beside "Name". Scroll down. Type in "Upcoming Events" and click "Update"
  3. Click on "None" beside Title. Scroll down. Click "Override". Enter "Upcoming Events" and click "Update"
  4. Under "Page settings", click on "None" beside "Path". Scroll down. Enter "events/upcoming_events" and click "Update"
  5. Click on "No menu" beside "Menu". Scroll down. Select the "Default menu tab" radio button. Enter "Upcoming Events" under "Title". Click "Update"
  6. On the next page, click on the "Normal menu item" radio button, and enter "Events" under "Title". Click "Update"
  7. Click on the work "Filters". Scroll down. Click on "Override" and then "Update". This overrides the filter selection but makes a copy of the two filters that we set as default
  8. Click on the "+" beside "Filters". Scroll down. Click on the checkbox beside "Date: Date (node)". Make sure you get the right one. There are three fields that start with "Date:". Click "Add"
  9. Scroll down until you see a heading that says "Date field(s)". Select the checkbox beside "Content: Event Date and Time... From date". Click "Update"
  10. On the next page that appears, under "Operator", pick "Is greater than or equal to". Under "Date default", enter "now". Click "Update"
  11. Click "Save". Note that after clicking "Save" you're again editing the default settings, not the upcoming events display. Be careful to select the display you mean to edit. I got that wrong lots of times
Set up the menus correctly:
  1. The above puts the menu under the site navigation menu. We want it under the Primary Links menu. Click on Administer-> Site building-> Menus
  2. Click on "edit" beside "Events"
  3. Under the "Parent item" heading, select "" from the drop-down list
  4. Click "Save". The "Events" menu will show up at the end of your primary menu. Drag it to the appropriate place in the list and click "Save configuration"
Create an event to test what you have so far:
  1. Go to "Create Content"
  2. Click on "Event"
  3. Enter an event on the your current day or sometime in the future. It should be self-evident how. Watch that you end date is after the start date. The user interface doesn't automatically do it like some other programs do. Click "Save"
  4. Enter another event with a date in the past. Again, make sure the end date is the same as the start date
  5. Click on the "Events" menu on your primary menu. You should see the one future event you just entered, but not the past event
If the event doesn't show up, see the troubleshooting tips at the end of this post.

Create the "All Events" page:
  1. Click on Administer-> Site building-> Views
  2. Select "edit" for the "Event List"
  3. Click the "Add Display" button (the drop down box above it should read "Page" already)
  4. Under "Basic settings", click on "Page" beside "Name". Scroll down. Type in "All Events" and click "Update"
  5. Click on "None" beside Title. Scroll down. Click "Override". Enter "All Events" and click "Update"
  6. Under "Page settings", click on "None" beside "Path". Scroll down. Enter "events/all_events" and click "Update"
  7. Click on "No menu" beside "Menu". Scroll down. Select the "Menu tab" radio button. Enter "All Events" under "Title". Click "Update"
  8. Click "Save". Note that after clicking "Save" you're again editing the default settings, not the upcoming events display
Test again:
  1. Click on the "Events" menu
  2. You should see the table with the one future event. You should also see two tabs for "All Events" and "Upcoming Events"
  3. Click on "All Events". You should see both events in the table
  4. Click on "Upcoming Events". You should see just the future event again
Here are some troubleshooting tips:
  • If the events aren't sorting the way you think they should according to the display's "Sort Criteria", click on the little gear beside "Style" under "Basic Settings". Scroll down. If the radio button under "Default Sort" is anything but "None", the sort here will override the sort in "Sort Criteria". Click on the radio button beside "None"
  • With the Date module circa March-April 2009, you have to install a patch or you'll get error messages when creating events. Get the patch here and how to install it is here
  • If the menu doesn't appear on the primary menu, or the tabs don't appear, make sure the paths for each display are below the same name as I showed above. In other words, the display paths should be of the form "x/y" and "x/z", even though the user will never navigate to "x"
  • Recheck all your settings. This is tedious but essential. In my experience, any one being wrong can cause a mysterious and seemingly unrelated failure
  • Be sure that you didn't accidentally change the defaults instead of overriding them, or didn't accidentally override something that should be taken from defaults. Values taken from the default display are in italics when looking at other displays
I hope this helps someone.

Building a Website for a Grassroots Group

As I've been blogging about recently, I've been building a Drupal-based website for my son's school's Parent Advisory Council (PAC). As a geek, the technical nature of putting together a content management system like Drupal for a site is interesting, and I learned a lot. However, what really interested me is the social aspect of it.

You can't have a business it seems without having a website. That must mean there's value for a business to have a website. But is there value for a grassroots group to have one? If technology truly is neutral, then grassroots groups must be able to benefit from websites. (I'm not sure technology is inherently neutral, but that's another topic.)

When we started, the PAC has a static HTML website updated infrequently by a parent who knew some HTML and how to FTP files to his server. It was out-of-date, since the parent's children had moved on to high school and he was obviously not so active in the PAC. Members of the PAC did want some place to post meeting dates and minutes, and to publicize their activities, so I offered to help out.

We set up a committee with four members. I built a test site under my company's site (jadesystems.ca) and we started to work.

Right from the start a few people really took to it and started to use it in ways that I couldn't keep up with. This included translation into Chinese, especially after I enabled the translation modules in Drupal.

I also set myself up to do screencasts, and posted a number of them. It's still early, but I've got some feedback from people that they find them very useful. For grassroots groups, where you don't site face to face with people every day, I think screencasts are going to prove to be an excellent tool.

I think the main lesson I've learned so far is this: I like Drupal and it's allowed me to do a lot. However, I can't help feeling that I'm writing in assembly language for content management. What I mean is that I've had to learn too much about how the system works to get it to do what I want. We're still a long way from grassroots groups being able to set up a website without someone with technical skills.

My dream would be something analagous to blogging. You simply go to a website and create your own community site. The task is inherently more complicated than setting up a blog, so it will never be as simple, but the skill set should be relatively similar. You should be able to pick and choose based on functions the user wants (e.g. a list of upcoming events), not functions based on how the programmer delivers them (e.g. a Views module with an obtuse and fragile configuration screen that lets you cobble together a list of upcoming events if you bang your head on it long enough).

More on this later.

Parent Advisory Council Website

The Parent Advisory Council (PAC) website is live at http://hastingspac.ca/ and is in a relatively stable form. Much work remains on the translations, but the bones of the site are there and it's up to everyone else to put up the content (muscle).

I think we've got a pretty good site for a volunteer group. Our goal is to increase participation in the PAC to benefit the education of our children.

I'll be posting more about the technology behind the site (Drupal and content management systems) this morning.

I'd love to hear comments and ideas you might have about the site.

Thursday, 9 April 2009

Time Comparison in Ruby, especially on Rails

I had a bizarre failure in some test cases. The test case looked like this:
marker = Time.now
t.create(args)
assert t.created_at.between?(marker, Time.now)
In other words, take the time, create an object, and make sure it was created between the first time and now. Obviously true, but my test was failing.

The reason: Rails keeps the create time to the second, but Ruby keeps time to fractions of a second (depending on the resolution of your hardware clock). Both would have the same time (to the second) but the marker would have some microseconds more than t.created_at, so the assertion would fail.

The Ruby documentation actually warns you about this, but in way that's cryptic enough that it might not be obvious why your simple test case is failing in such a bizarre way.

The solution? Mine was make the time an integer and convert it back to a time using Time.at:
marker = Time.at(Time.now.to_i)
t.create(args)
assert t.created_at.between?(marker, Time.now)
This doesn't really merit a blog post, except that I Googled for solutions to the problem and didn't find much.

Monday, 6 April 2009

VMware Server 2 and Ubuntu 8.04 LTS

Some irritating behaviour that I couldn't resolve pushed me to the big upgrade of my virtual infrastructure. I was running VMWare Server 1.0.5 on Ubuntu 6.06 on a Dell SC440. Periodically all the VMs would just lock up for about five minutes. All the VMs would freeze, and even the time (as reported by date) would fall back by five minutes. The host ran just fine, and reported that nothing was happening (e.g. top(1) reported 100% idle).

I was having to endure too many frantic calls from my son that he couldn't get to lego.com, so it was time to do something.

Some Internet research turned up that I would need VMware Server 1.0.6 at a minimum for Ubuntu 8.04, so that meant I would need to do VMware first, and therefore go to VMware Server 2.

The upgrade to VMware Server 2 went fairly smoothly, but I had a couple of problems that sucked far more time than the solution eventually warranted:
  • The management interface didn't work. When I connected to vmhost:8222 I got the grey VMware background, but it didn't show the login window. I solved it by some combination of restarting the VMware management server on the VMware host (sudo /etc/init.d/vmware-mgmt restart) and clearing the cache in FireFox
  • Once the management interface was up, I couldn't get the console to open on many of my VMs. The error window told me to look at log files and report the problem. The VMs were version 4 of the "hardware". I upgraded the VMs' "hardware" to the current version (7 I think) from the management interface, and was able to open the console
  • When I was installing VMtools, I was unable to bring the network interfaces back up. I spent much time trying to figure out what was wrong with VMtools before I realized it was a simple as my DHCP server had gone away. My DHCP server is in a VM, but I don't know if anything about the upgrade is what shut down the DHCP server software
The upgrade of Ubuntu went smoothly and quickly. The big gotcha for me was that I forgot to download the kernel headers before I rebooted the upgraded server. When I went to rebuild VMware Server for the new kernel, I couldn't and since my network depends on VMs, I had to do some manual network configuration to get out to the Internet and download the kernel headers.

P.S. The reason I decided I should try the upgrade is because the time handling in Linux kernels is now much more friendly to running in a VM, whereas the Ubuntu 6.06-era kernel wasn't. I haven't been running long enough to know if the upgrade has fixed the freezing problem.

Thursday, 26 March 2009

Tika and Solr

This is just a quick note to document another experience with Solr.

Background: To index Word, Excel, PDF and other "unstructured" documents, Solr uses Tika, another Apache project. Tika comes bundled in Solr and is ready to run in Solr. However, if you want to run Tika individually (e.g. you don't trust your installation, or you're just curious) you have to copy a few .jar files around (Java experts who can manage class paths will probably tell me there's a better way to do this).

I did
cd [Your path]/apache-solr-nightly/lib
cp commons-io-1.4.jar commons-codec-1.3.jar [Your path]/apache-solr-nightly/example/solr/lib
cp ~/.m2/repository/org/jempbox/jempbox/0.2.0/jempbox-0.2.0.jar [Your path]/apache-solr-nightly/example/solr/lib
(I have no idea where ~/.m2 came from. It may have been when I ran the Tika build.) Then I could run
java -jar tika-0.2.jar
in that directory.

Sunday, 22 March 2009

Solr and Rails

Well, after some long diversions I have Solr working in some simple test cases with Rails. The long diversion was partly caused by not understanding what was offered by the Rails Solr plug-in, so I'm going to give an overview here, and a link to detailed instructions for Solr in Rails at the end of this post.

The Rails plug-in for Solr from git://github.com/mattmatt/acts_as_solr.git includes a complete installation of Solr. You don't need to install Solr separately. (My "long diversion" is that I rushed off and installed Solr separately, and spent a fair bit of time getting it running due to my ignorance of how it worked.)

If you want to index Word, Excel, PDF, and other types of documents, there is a bit of additional configuration to do. To index those files types you have to get a nightly build of Solr from here, and copy some files and directories as described in the link at the end of this post. You have to add the following lines to example/solr/conf/solrconf.xml:
  <requestHandler name="/update/extract" class="org.apache.solr.handler.extraction.ExtractingRequestHandler">
<lst name="defaults">
<str name="ext.map.Last-Modified">last_modified</str>
<bool name="ext.ignore.und.fl">true</bool>
</lst>
</requestHandler>
The plug-in also includes rake tasks to start and stop instances of the Solr server for development, test and production -- very handy. Just type
rake solr:start RAILS_ENV=test 
to start the test Solr server (default environment is development). It also gives you a yaml file in your environment directory to configure the ports that each instance of Solr will use (as installed: production on 8983, test on 8981 and development on 8982).

One thing I learned on my diversion is that Solr comes with an administration user interface that shows how many documents are in the Solr database, and lets you try ad-hoc queries. It's a good way to test if Solr is actually running. For example, after running the rake task to start Solr for development, you can browse to localhost:8982/solr/admin and you should get the Solr administration page.

So that's the overview. The detailed write up is here. It's good. I just wish I had this overview first so I knew what I was getting and where I was going.

Friday, 20 March 2009

Rsync iPhone

If you're using the Cydia installer on your iPhone, there's a package for rsync. Just open Cydia and search for "rsync". You won't find a "BSD subsystem" package, because they say Cydia comes with BSD. It might, but it doesn't come with rsync hence the extra installation.

Thursday, 19 March 2009

Creating Screencasts on Ubuntu

I'm building a web site using Drupal 6 for my son's school's parent advisory council. The idea of the site is to facilitate community participation. Since we're a volunteer group and we aren't at the same workplace every day, I thought screencasts might be a great way to help people learn how to use the site.

This post covers the technical how-to for screencasts with Ubuntu 8.10 on a Lenovo x300. When we get some feedback about whether the screencasts are helpful, I'll post about the social part of the experience.

It took me an afternoon and a morning of thrashing to get everything working. Here's what I did:
  1. Install gtk-recordmydesktop and gnome-alsamixer:
  2. sudo apt-get install gtk-recordmydesktop gnome-alsamixer
  3. Open Applications-> Sound & Video-> GNOME ALSA Mixer and make sure the microphone is recording and isn't muted. The controls you have available in the ALSA Mixer depend on your sound hardware, so you may have to do some research on your own to find the right settings for your sound card. At this point, you should be able to record sound and video with RecordMyDesktop (Applications-> Sound & Video-> gtk_recordMyDesktop)
  4. If you find that the sound stutters on playing back your screencast, run recordmydesktop from a terminal window
    recordmydesktop
    If you see "Broken pipe: Overrun occurred.", the problem is when you record the screencast, not on playback. I installed the Jack audio server and that fixed it
To install Jack and use Jack,
  1. Install (I think this is right -- I installed using the Synaptic GUI)
    sudo apt-get install jackd libjack-dev
    Note that including the development library (libjack-dev) is very important. If you don't include it, you'll get and error when you start recording with RecordMyDesktop ("dlopen/dlsym error on libjack.so")
  2. Do Applications-> Sound & Video-> JACK Control
  3. Click on Start in the JACK window
  4. Do Applications-> Sound & Video-> gtk_recordMyDesktop
  5. Click on Advanced
  6. Click on the Sound tab and make it look like this
  7. Close the window
  8. Record the screencast (Select Window if you want, then click Record)
  9. When you're done, stop Jack and Quit from the control window before you try to play back the screencast. I found that playback would freeze up if Jack was still running. This is a moderately big nuisance, but I haven't found a way to make it work with Jack open.
recordmydesktop creates a video file in .ogv format, which isn't a commonly installed codec on Windows Media Player or Quicktime (on Windows, at least). However, if you upload the video to YouTube, it will be converted to a format watchable anywhere, as far as I can tell. You do seem to lose some quality of video in the conversion. There are video conversion tools available for Ubuntu, but I haven't tried to convert myself. I don't know if that would help the YouTube resolution anyway, as the more times you convert video the worse it tends to be.

Tuesday, 17 March 2009

Drupal Set-Up and Administration Tricks

I can't claim to be the world's Drupal expert yet, but I'm learning some interesting tricks that are worth documenting and sharing.

First, my Drupal installations typically include a lot of contributed modules. They're distributed as .tar.gz files, which you upload to your server and unpack in the appropriate place. This can get tedious and error prone (e.g. I forget to unpack one).

I built a template directory with a complete Drupal install on a Linux box (you could do something similar with Windows if you had cygwin or a similar set of Linux-like tools). I unpacked the Drupal version, then went into the modules directory and unpacked all the modules I typically use. That was easy to do with a script like this:
for f in module_directory/*.gz; do tar -xzf $f; done
Your mileage may vary with that script, depending on where you put the tar'd modules.

This allows a couple of nice things:
  • One module I use, fckeditor, requires that you unpack the basic (non-Drupal) installation for FCKeditor in a subdirectory of the Drupal fckeditor module. With a little playing around, you can easily do this in the template directory once, and then you have the deployment set up correctly
  • I need to set a higher PHP memory limit in Drupal's "settings.php" file. I can do it once in the template directory and deploy many sites reliably (read why here and here)
  • You need to temporarily change the permission of the "settings.php" file for installation, and create the "sites/default/files" folder before navigating to the Drupal site for the first time. I create them both and make them writable in the template directories
Then, tar and gzip the resulting directory tree. There's one big trick to this step. You need to make sure you get the .htaccess file, so I include it explicitly:
tar -czf ../drupal-6.10-template.tar.gz * .htaccess
There's a reason I don't just tar the template directory. That would give me a tar file that would create a directory and expand into it. On my hosting service, it's more convenient for me to expand into the existing "public_html" directory.

The other "trick" isn't so much a trick yet, as it is thoughts on running several Drupal sites from one installation. It seems to be a Drupal pattern to create "multisite" configurations where you have sub-domains running from the same Drupal source code (PHP files), but with different databases, and different configurations and themes.

This sounds good, and you would only have to update the files once for all your sites. However, I think it also causes some problems:
  • The technique for Drupal multisites that I found gives you a circular symbolic link in the sites directory hierarchy. I believe this causes problems when I try to copy the site prior to upgrading it (I copy to have a backup)
  • The recommended Drupal upgrade procedure requires that you take the site offline, disable all modules, and then re-enable all modules after you upgrade. That means all your sites are offline for the entire upgrade, rather than being able to do each site quickly
With the template approach, the pain of uploading the files is gone. The rest of the work you have to do for each site anyway, so it becomes almost the same amount of work to just run each site as a completely independent Drupal installation.

I'm going to try my template based upgrade and will post about the experience then.

Thursday, 12 March 2009

NetBeans, Gems, Rails, and Permissions

I've gone from being a shell/make/rcs guy to quite liking IDEs, or at least useful IDEs. I find NetBeans to be a pretty nice, light-weight (in the good sense) IDE, but it has some issues on Ubuntu and other properly secured OSs. Here's how I've got it to work. This applies to NetBeans 6.1 and 6.5, I believe.

First, you have to set up your Ruby platforms so they keep their gems in writable directories. Go to Tools-> Ruby Platforms. On NetBeans 6.5 (at least), the jRuby gems are in a writable, per user path by default. If you click on the "Autodetect Platforms" button and get the native Ruby platform, change the "Gem Home:" and "Gem Path:" directories to somewhere writable, like /home/reid/ruby/gems/1.8.

While you're here, make sure the version of /usr/bin/gem is 1.3.1 or higher. If it isn't, I think you have to upgrade from a shell. I did that upgrade a while ago, so I don't remember how to do it, but you can find out easily through Google. (Ubuntu users may want to look here.)

It should all look like this:

Now go re-install all the gems you need through Tools-> Ruby Gems.

At this point, you still may not be able to install plugins. You'll get the following message: "Missing the Rails 2.2.2 gem" (or whatever version NetBeans installed for you). Rake from within NetBeans seems to look at the system rails executable, and not the one installed through the NetBeans' own gem installer. But the environment.rb generated for a new application does use the version of Rails installed by NetBeans. What I did (yuck, because there's some redundancy here) is manually install the appropriate Rails version:
sudo gem install rails
I'm sure there's a better way, but I can't think of it right now and I really want to write some Rails code instead of fighting with NetBeans.

Cheap Hosting Part II

In an earlier post I described how I was running out of memory in PHP using a moderate set of Drupal contributed modules.

It turns out I was able to increase the PHP memory on my HostPapa hosted site. The method to use it to add the following line to Drupal's "settings.php" file in each site's "files" directory:
ini_set('memory_limit',             '48M');
Or if the line already exists, make sure the amount is '48M'.

One of the problems I think I had earlier is not changing the right settings.php file. I have multiple sites in multiple sub-domains, because the main purpose of this host is to do proofs-of-concept for clients. I probably thought changing the settings.php file didn't work because I changed the wrong one.

Suppose you installed Drupal under public_html. You have to change settings.php in public_html/sites/default to change the memory limit on your main domain (for example, "example.com"). For a sub-domain "test.example.com", you have to change settings.php in public_html/sites/test.example.com. And so on for any other sub-domains you have.

Tuesday, 3 March 2009

Securing Healthcare Data with MySQL

As a follow-up to an earlier post, I should mention that part of the reason I had healthcare data on my personal laptop was to do some data analysis with MySQL. Between MySQL and the command line tools, it was very easy for me to load data from other sources and run queries to monitor or predict the amount of medication we were packaging.

When I was done doing the data analysis, I wanted to scrub the data off my hard drive. On the version of MySQL that was installed via Synaptic on Ubuntu 8.10, the default database engine was MyISAM. When a table is dropped, it deletes the MyISAM file. No need to worry about deleted records retaining data in a "tablespace" file that one might have to worry about in other RDBMSs.

Then all I had to do was scrub the hard drive as I described in my earlier post.

Cheap Hosting and PHP Memory

(For an update, read this post.)

I've been working on a few websites: One for my son's school's parent advisory council (PAC) and one for some community health centres. It gives me a chance to get to know what's out there in the open source world for content management, wikis, and other collaboration tools that we're supposed to be using to make ourselves more effective and productive.

The first step was to find a hosting provider that let me run PHP, as the free hosting I get from my ISP is for static pages only. I was pleasantly surprised to find very cheap hosting with PHP, MySQL and everything I needed, many for less than C$10 per month. I chose HostPapa -- despite the somewhat odd name, they seemed to have a good reputation.

There's a catch, it turns out. I'm using Drupal 6, a well-established and widely used content management system. When I build a site with a reasonable set of contributed modules (calendars, translations, FAQs), it needs more than 32MB of memory in PHP (I get a white page with a message saying "memory exhausted"). And I'd like to add a number of other modules.

My hosting provider doesn't let me change the amount of PHP memory, so the whole hosting arrangement is mostly useless. (There are good instructions for how to increase the PHP memory in Drupal here, but not surprisingly the cheap providers don't allow you to take too much memory.)

I also originally considered using Joomla!. Once I ran into the problem with Drupal I did some searching of the Internet and found that it seems to be an issue with Joomla! as well. Neither runs comfortably in 32MB if you have a reasonable selection of add-on modules. (Instructions to increase PHP memory exist with Joomla! with the same caveat that the provider can prevent you from doing it.)

It's rather unfortunate. My idea was to have this space to be able to do proofs of concept or show potential clients what could be done with modern collaboration tools. It would be likely that any serious customer would be able to host their own server, or at least pay for a slightly more expensive hosting provider. I don't need a high volume website, but I do need a space where I can show the capabilities of the tools. I hate to have to pay more money on pure speculation that this will lead to work, but it looks like that's the case.

I don't know whether to be annoyed with the content management systems for being memory hogs, or the hosting providers for setting unreasonably low limits on accounts on which they should fully expect people to use a modern content management system. By the way, I'm not really annoyed at either. I can see their point of view: HostPapa is really cheap and they need to control costs somehow, and serious Drupal users will find the difference of $10 per month for better hosting to be inconsequential, or will be paying for a dedicated server anyway because they get so much traffic.

The obvious lesson: One of the big things to look at when evaluating hosting services is how much PHP memory they give you. It's easy to offer unlimited database space, unlimited sub-domains, and other such goodies when you know that no one can use serious website management tools anyway.

Tuesday, 17 February 2009

Securing Healthcare Data with Ubuntu Desktop

People's personal health care data has to be kept confidential. The reality of working in health care IT is that you have to put work on a USB stick or use a laptop. At least Ubuntu makes it easier to do the right thing.

I knew I had to do something about the data on my laptop (Ubuntu 8.10), so I sat down one day to figure out what to do. I knew the tools were there, but where to start? Almost absent-mindedly I right clicked on the folder I needed to encrypt, and saw that there's an "Encrypt..." command right there on the menu. (Note that you have to be pointing at the file or folder in the right pane of the Nautilus file manager.)

"That was easy," I said to myself. I selected the "Encrypt..." command. Since this was the first time, it took me through a number of steps to generate some keys. I just followed the dialogues. On my Lenovo x300 it took several minutes to generate the keys after I got through the dialogues. I was starting to worry if something was wrong, but patience prevailed.

Once the key is generated, I could go back to encrypting my folder. I selected the option to "Encrypt all files together in a package." After it was done, which wasn't long at all, I was left with the original folder, the folder.zip file, and a folder.zip.pgp file. The ".pgp" file is the encrypted one, so I deleted the original folder and the folder.zip file.

Then I had to make sure that the files can't be reconstructed by someone with the right tools and access to my laptop. I opened a terminal window and did this:
dd if=/dev/zero of=junk
rm junk
The first command takes quite a while. It writes zeros to all the free space on my disk. The more free space, the longer it takes. When it fills the disk, it stops. The second command deletes the file, so I have all my free space back. (If you don't know why I did this, read the last paragraph of this article.)

I've heard that there are ways to get data back from disks even if they've been completely re-written. Leave a comment if you know more about the practicality of restoring zeroed hard drives. The above approach certainly foils a relatively determined attempt to get the data back, and should put you in good stead with your privacy people.

Note that this process still isn't one I'd want to do every time I had to access some personal health care data on my laptop. It's a manual process, meaning I might forget to do it or won't have time to do it that one time just before I leave my laptop in the rental car at the airport. It also takes time, especially if you have a lot of free space on your disk.

If you don't know why you have to write zeros on all your free space, here's why: When you delete a file on your computer, you don't actually erase the data. You just mark it as available for re-use. Someone with the right knowledge (and there are many who have this knowledge) can reconstruct old data on your disk. If you write zeros over the free space, you ensure that there's no data for them to reconstruct.

Thursday, 12 February 2009

"Architecture" Gets a Time-Out

Anne Thomas Manes published a great post about how the economic downturn means the end of big IT projects being done for some vaguely defined "value". There's a good podcast about it here.

I think the key messages are:
  • IT can provide spectacular gains in business value only by transforming the IT department (people, processes and technology), not by changing the interface engine between the same set of disparate applications
  • SOA is dead not because the technology is necessarily wrong, but because business aren't going to spend money on projects that don't provide immediate business value
  • IT provides value by understanding the business and providing what the business needs. That's not a simple process and is fraught with political minefields within and outside the IT department
There's a great bit starting at minute 28:00 where she says, "Go take a look at the SOA success stories and invariably there's a new CIO in place. And it only happens because the CEO recognizes that he needs to fix IT, and he knows his current CIO isn't fixing it."

Saturday, 7 February 2009

Backlight with Ubuntu 8.10 and Lenovo X300

A recent kernel upgrade broke the backlight control on my X300 (along with a lot of other laptops, according to what I find with Google). To fix it, I'm running the following every time I log in:

sudo xrandr --output LVDS --set BACKLIGHT_CONTROL legacy

Friday, 6 February 2009

Favicon in Drupal

I'm using Drupal to put together a site for my son's school's Parent Advisory Committee (PAC). I'm impressed at how quickly you can get something up on Drupal. Getting something the way you want it is a little harder, as is always the case with computers.

One stumbling block has been the favicon. First, it appears that the HTML that Drupal generates requires a Windows Icon file type (favicon.ico). I've used favicon.png in other sites, but in Drupal it has to be a .ico file.

Also, the directory where you put the favicon.ico is write protected, and the file manager I was using on my hosted service didn't tell me I was trying to upload a file to a write protected directory. That resulted in another 10 minutes of muttering and fooling around trying to figure out where the file was going.

Wednesday, 4 February 2009

TikiWiki Modules Don't Appear

I'm using TikiWiki to propose to REACH Community Health Centre an idea about prescribing guidelines. I tried adding the search module. It would appear for the admin user but not for anyone else.

It turns out there is also a permission to allow users or groups to search. The module doesn't display unless you enable search for the users or groups. Judging by the name of some of the other permissions, there may be other modules that also require a permission to be set.

Sunday, 18 January 2009

iPhone UI Habits

I find myself trying to zoom documents on my laptop by pinching and spreading two fingers on the trackpad, like I would on my iPhone. The people at Apple sure have a knack for coming up with powerful user interface techniques.

Sunday, 4 January 2009

External Monitor Key on the X300

Out of the box, the external monitor key (Fn-F7) on my Lenovo X300 didn't work. I found a great post on the ThinkWiki that described how to do it. I followed the instructions up to and including the "set permissions and restart acpi" section.

There was one small problem with the bash script that you put in /usr/local/sbin/thinkpad-fn-f7. Lines 39 and 40 didn't get the right values when one of the monitors was off, but still connected. I changed them to:
INTERNAL_STATE=$($SU xrandr | sed -n "s/${INTERNAL_OUTPUT}\Wconnected\W\([0-9]\+[xX][0-9]\++[0-9]\++[0-9]\+\).*/\1/p")
EXTERNAL_STATE=$($SU xrandr | sed -n "s/${EXTERNAL_OUTPUT}\Wconnected\W\([0-9]\+[xX][0-9]\++[0-9]\++[0-9]\+\).*/\1/p")
and all was good.

I posted my experience to the ThinkWiki discussion on the topic, so hopefully by the time you read this the fix will have been made there.