May. 27th, 2008

GTD Goodness: Get the computer to tell you the time

Rich Mintz (richmintz.com seems empty) gave me a great tip for keeping focused.

He's a Mac user and OS X makes it easy to get the computer to say the time every 15 minutes. It isn't so easy on Ubuntu, but it is doable. Since I put this in place, I've found that it does help me focus more. It can also help keep me from working too late (not that it has yet).

Anyway, here is the bit of magic that you need:
(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|espeak --stdout|sox -q -V0 -t wav - -t alsa pulse")|crontab -

Update:
(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|padsp espeak")|crontab -
will also work, but you may get emails filled with error messages from cron.

Breaking it down
  1. (crontab -l; ...) | crontab -
    This part dumps the current crontab out, appends the new line (elided here, see the next step) and then, with the "crontab -" after the pipe, creates an entirely new crontab with the results. This way, we just add a new cronjob to the list of ones you may already have.

  2. echo "0,15,30,45 * * * * ..."
    The first part of any crontab file gives a schedule for execution. Since I just want this to run every 15 minutes, I haven't set up anything besides that, but you could tell it "only during business hours during the work week" which might look something like "0,15,30,45 9-17 * * 1-5". I recommend you RTFM for help on that, though.

  3. (echo it is now;date \+\%I:\%M\%p )
    Print out two lines that are what you'll hear. If you don't want to hear "It is now", then you can leave out that echo statement and the parenthesis. The date command just formats the current time in HH:MM AM/PM time format. One problem is that at the top of the hour you have "00" which the synthesizer reads as "zero zero". Oh well, all is not perfect.

  4. | espeak --stdout
    Every 15 minutes when the cron job is run, espeak reads the bit from date and produces a wav file with the sounds that your computer should play. Normally, espeak would just play this out on your speakers, but you might be listening to music. If the speakers were otherwise engaged (by, say, Rhythmbox), then you won't hear the sound and cron will send you an email full of strange error messages.

  5. | sox -q -V0 -t wav - -t alsa pulse
    To get the sound to mix properly with other sound apps, it has to play out through pulseaudio (the new, default sound server in Hardy). Strangely enough, even though pulseaudio was supposed to Fix the Linux audio mess once and for all, we still have to jump through hoops.


There is a chance that saytime will just work for you. But, because of that "audio mess" that still exists in Ubuntu, it didn't work for me.
Tags:

Apr. 10th, 2008

Shell history stats

Today is the day for shell history stats:
mah@spawn:~$ history|awk '!/=/ {a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
107 ssh
55 sudo
27 bzr
18 ls
18 host
17 xrandr
17 ping
16 cd
9 ledger
9 ifconfig
(Modified slightly to skip some ledger lines from when I was doing taxes.)

You won't see most of what I do because it's all in Emacs.
Tags:

Feb. 27th, 2008

Rwanda, Day 3

I was thoroughly exhausted this morning and slept 2 hours past the time I was supposed to meet the others for breakfast.  Ouch!

I finished setting up the developer laptop and used bzr to download the source code for iHRIS Manage to the laptop.  I'll customize the software for the Ministry of Health using the laptop and then, if we're able to hire a Rwandan to do in-country development, they'll have everything ready to go with php-mode set up in emacs and (of course) a link to my PPA so they can get updates easily.  Up till now, I've been pretty scared of the customizations they needed since I have to finish them up in the next few days. Once Vanessa started sending them to me, I was really relieved.  Most of it does look pretty simple.  "Add a field here, change a label there."

Speaking of in-country developers, I was pleasantly surprised to find out that dcm and Vanessa were able to find someone with LAMP experience.  One can always hope.

In the afternoon I met with the head of IT at the Ministry of Health and installed Ubuntu on the server for them.  He doesn't know much about Linux but seemed willing to learn.  I'd like to have someone here that I can talk to if we have problems, so I've been trying to at least get him or one of his underlings comfortable with Linux.

We walked back up the hill to the hotel and dcm soon crashed.  I guess it was his turn to be worn out

Overall, I'm really pleased with the way things are turning out.  I came into this really scared, but I'm getting more confidence by the day.

One thing I would like to see is more support for Rwanda in Linux and especially Ubuntu.  When I'm setting up Ubuntu, "Rwanda" is not a choice for either the French or English language.  And, despite lots of work being done on Linux translations to Kinyarwanda, where "Ubuntu" is actually a word native to the Language, I can't choose that language as the default in the installer.  This affects other areas of the installer, too.  When it comes time to pick a timezone, I can't.  I have to tell the installer I'm in South Africa, which means that za.archive.ubuntu.com is picked for the Ubuntu mirror -- a far better choice for the network connections I've used is still one of the U.S.-based mirrors.  (I'm not the only one to think Linux distributions should be more aware of Rwanda, either.)

Finally, it would be great if RwandaTel or some other organization took an interest in promoting Linux in Rwanda.  They could set up a kernel.org mirror so that I could get my Linux fix faster!

Feb. 26th, 2008

Rwanda Day 2 continued

I stayed at the Capacity offices as long as I could.  I could feel the fatigue hitting me pretty hard, but after lunch (including some kind of purplish yam and a good dose of caffeine) I managed to get the System 76 Laptop in some kind of working order.

I should give props here to dcm who suggested that I “download the internet” and take it with me to Rwanda.  I managed to get around 175GB of the Ubuntu repository mirrored onto a disk.  This proved invaluable when I was installing the system and applying updates.  For a little while I switched to the usual web-based mirror and was told it would take a couple of hours to download everything I needed (for perspective, at home, the download times take no more than five or ten minutes).  Having the disk handy meant I could install packages directly.  The mirror isn't complete, so some things did have to be downloaded, but the majority of stuff was right there.

One bug I ran into showed up after I did an “aptitude dist-upgrade” after doing a clean install.  All of the sudden I couldn't log in via GDM.  (The last time I had problems with a gutsy upgrade, it was using XFS so probably not something that was a core concern.) Weary from lack of sleep and not really in the mood for too much trouble-shooting, I ended up purging “ubuntu-desktop” (and its dependent packages) and then reinstalling it.  Strangely enough, that did the trick (for the most part).

After that, I told Vanessa I was ready to give in to sleep.  We walked back to the hotel with me snapping pictures like a madman on the way back.  I saw some armed police standing outside and asked if I could photograph them.  “It is not allowed.”  Fine, no close ups for you!

Once back I crashed in the hotel.  The turndown service woke me up twice.  First when they came in un-announced — or maybe I didn't hear them knock and only woke up when they opened the door — and the second time when they called me (two times in a row).  I was so confused I thought they were asking for someone named “Tom”.  I was pretty annoyed, but it didn't keep me from falling back to sleep quickly.

Finally dcm woke me up so we could go have dinner at the Mille Colline.  Curried Veg, yum!
Tags: ,

Feb. 25th, 2008

Day Two

(You may want to see my first post on my visit to Rwanda if you missed it.)

Right now, I'm sitting in the Sentenary House, the home of the Capacity Project in Rwanda, upgrading a System 76 laptop with Ubuntu Gutsy.  I hope to prepare this laptop for a Rwandan developer for the iHRIS project I've been working on.  Of course, that'll mean Emacs.  I hope to spread the Church of Emacs to Rwanda.

In my last post I kind of left you hanging on the Mille Colline.  Yes, I had a coke there but I should tell you how disappointed I was that the movie showed a completely different building then the actual Hotel.  I'm sure they had their reasons (they always do) but I really do expect movies to give me an accurate portrayal of places I'm extremely unlikely to visit.  Just in case, you know, I visit.

Also, we had a brush with fame.  The hotel I'm staying in (the Kigali Serena) is where Tony Blair was staying.  For a brief moment, we saw President Kagame rush in and then quickly back out.  I had no time to request an autograph.  Mostly because I didn't recognize him.

Dramatic difference between Kigali and the US: the number of gates and guards.  It seems that every major intersection has one or two men in uniform carrying AK-47s.  Almost every building and home has at least a guard and, unless it is right on the road, a fenced in courtyard with razor wire or shards of glass atop the walls.

I remember similar gates and glass-topped walls in Haïti, but the guards are an unsettling addition. Vanessa told me that, in part, the practice started as a way to employ men who have been fighting most of their lives and hadn't developed any marketable skills.  Fair enough.

Another thing about Rwanda is the number of people walking along the road and the street vendors walking about.  Some (evidently) sell SIM cards or minutes for your phone.  This is in addition to a wireless shop on every other corner.  I was amused by the portable phones they carry that look similar to a desk phone, but without the desk.

Finally, though I seemed to be on a normal sleep schedule after my first night here, I couldn't sleep at all last night.  Seriously, I saw the sun rise.  I'm sure part of it was that I was up hacking away till 4 in the morning ("just one more thing") but, still, right now I'm tired.  Thank God Rwanda's primary export is coffee.  I need it now!

Feb. 13th, 2008

Ubuntu Packages and PHP

(Hello, Planet Ubuntu Users!  I'm looking for a second MOTU on my php-xdebug package as well as someone to revu my libapache-test-perl package.  Any takers?)

Emacs CVS now includes XFT (i.e. smooth fonts) in the main branch, so I'm discontinuing my old emacs-xft-snapshot build.  Still, the other emacs-snapshot package is targeted to Debian and I'm running Ubuntu Gutsy.  So I've uploaded a snapshot build to my PPA on Launchpad.

One thing that I included is flymake support for PHPCarl asked me earlier today if I knew how to get the compilation mode in Emacs to work with PHP's lint function to find highlight problems.  I said flymake would be better, but didn't know how to do that right off, either.

After a bit of twiddling, I figured it out and, as a bonus, got compilation mode figured out, too.

If you want to enable flymake for PHP-mode (yes, I have a Debian package for that, too) in a version of Emacs you already have installed, add the following code to your .emacs file:
;; Flymake PHP Extension
(require 'flymake)
(unless (fboundp 'flymake-php-init)
  (defun flymake-php-init ()
    (let* ((temp-file (flymake-init-create-temp-buffer-copy
                       'flymake-create-temp-inplace))
           (local-file (file-relative-name
                        temp-file
                        (file-name-directory buffer-file-name))))
      (list "php" (list "-f" local-file "-l")))))

(let ((php-ext-re "\\.php[345]?\\'")
      (php-error-re
       "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)"))
  (unless (assoc php-ext-re flymake-allowed-file-name-masks)
    (add-to-list 'flymake-allowed-file-name-masks
                 (list php-ext-re
                   'flymake-php-init
                   'flymake-simple-cleanup
                   'flymake-get-real-file-name))
    (add-to-list 'compilation-error-regexp-alist-alist
                 (list 'compilation-php
                   php-error-re  2 3 nil nil))
    (add-to-list 'compilation-error-regexp-alist 'compilation-php)
    (add-to-list 'flymake-err-line-patterns
                 (list php-error-re 2 3 nil 1))))
Now, whether you're using the emacs you started with or the latest emacs-snapshot, you need to tell emacs to use flymake on PHP files.  Add:
(add-hook 'php-mode-hook (lambda () (flymake-mode t)))
to your .emacs file and you're good to go.

Feb. 5th, 2008

keeping /etc under revision control

A while back I saw a blog post about keeping /etc under version control.  The particular article talked about using Mercurial for this and built on an article that used git to do the same thing.

The nice thing about this approach was that it hooked directly into Debian's apt and made sure that your repository was synced before and after each package installation ... which means that if you forget to sync your changes to the machine's configuration yourself, the system will take care of it for you.

I set out to do something similar myself and, just as I finished, I discovered Joey Hess's etckeeper which supports git and Mercurial, but not Bazaar, my DVCS of choice.

So I added it.

The biggest problem I found was that bzr doesn't support pre-commit hooks the same way that git and Mercurial do, but since etckeeper has pre-commit hooks, I just put the action there.

This means that some of the meta-data could get out of sync if you do a "bzr commit" by hand, but until the start-commit hook is added, I think that is just the way things will have to be.
Tags:

Jan. 26th, 2008

Ubuntu hates XFS

I was a little worried that the hard drive in my laptop was dying (though, looking at the Load_Cycle_Count, I don't think it is Ubuntu's fault, at least not because of cycle time) and since I was on-site, I was able to get a loaner laptop.  I decided to use XFS (/boot would be ext3).

Big Mistake.

Everything worked great on the installation, but as soon as I installed all the updates and rebooted, gnome-terminal wouldn't start. Took a little doing, but I discovered that my XFS partition had become corrupted.  Ran xfs_repair and it dumped a few files in /lost+found. But now things work.

Take heed.
Tags: ,

Jan. 25th, 2008

Linux on the desktop is definitely here

In talking to some people about my mother's experience with Ubuntu, I decided that the one thing Canonical could do to make it all easier would be to build a Windows- or C#-based downloader-and-cd-burner. (C# so that it would work on a Mac or Linux as well as Windows.)

Using this hypothetical app, people like my mother could download an ISO, fetch and verify a GPG-signed MD5 checksum, and burn a cd using a single application. No more fumbling with multiple unfamiliar applications to accomplish a single task.

Still, with prominent mention of Dell computers on Ubuntu's front page, with the advent of $200 computers loaded with Linux, with nerdy sons like me, even the streamlined ISO burner may not be as urgent to get Ubuntu on Grandma's desktop.

But it would really help.
Tags: ,

Jan. 22nd, 2008

The Freetard gives his Mama a bit of Ubuntu

How is it that some fancy-pants framework is always the right tool for an abstract job and PHP is the right tool for a real job? (The right tool for the slob)

Exactly. Though I would say "Why do all these freetards talk about freedom, but then give their Mama a Mac?"

So it is good that an idealist, freetard like myself actual tests his ideals in the real world. In this case, the test subject was an important one: my mother.

A couple of weeks ago, Mark Pilgram's post about switching his father to Ubuntu reminded me that I had told my mother she should try Ubuntu since her Windows laptop was slowing down. That weekend, I mentioned it to her again in email. Her response was “Ubuntu is what? ... oh I see something about printing. That would be GREAT if I could communicate from my computer to the printer.” (You can read our whole email exchange, if you like.)

Given her limited knowlege of Linux, I asked her to try it out. In fact, I made it more challenging. I pointed her to the Ubuntu download page and asked her to download the ISO and burn it … and I wouldn't help her. She managed to get a Dapper installation CD burned (I didn't tell her which version to try) but ended up thinking she had failed because the MD5 checksum process didn't work. Or maybe it did and the download was bad. Still, I was able to use the CD when we met up a week later.

In the end, that part of the experiment showed part of the failures of Ubuntu's efforts. At least when it come to 56 year-old grandmothers, Ubuntu's download page is too filled with jargon to be really useful. And I don't know where to report this bug.

Even though we live a thousand or so miles apart, we happened to be getting together the next weekend. So I got a Gutsy CD ready so that I could walk her through the Ubuntu installation and finish it up.

Even then, my faith in Ubuntu was shattered. When I asked her to boot off the CD, she did, but she started it in safe mode (which probably created other problems). Still, there were a few bright spots.

Perhaps the biggest thing Ubuntu got right was converting her existing Windows user, including bookmarks and IM account, over to the equivilent programs in Linux. That feat, in and of itself, makes me almost forgive all else.

Still, there were a number of things that the installation didn't get right:
  1. When it is converting the only existing Windows user, it asks for a username and password. And then it asks for the “default” username and password on the next screen. Why?
  2. Resizing the disk when you want to preserve the existing Windows installation is too confusing. Still.
  3. The Live CD installation tells you to “remove the CD and reboot”, but you can't remove it when the Live CD environment is still running.
  4. The boot splash screen was a blank screen and you would have thought the installation failed if you hadn't seen this before and watched the drive activity light
  5. She has a widescreen laptop, but it defaulted to 1024x768 and a VESA driver instead of 1280x768 and an ATI driver
  6. Suspend on her Compaq Pressario V2000 doesn't work.
  7. Her broadcom wireless meant I had to download drivers on my laptop and transfer them to hers.
(Yes, I still need to report these bugs.)

But even after all this, I was still encouraged when I explained that we wanted to preserve her Windows partition and she asked “Why? I won't be needing it any more!”

In the end, she went home with Ubuntu running on her laptop and seemed pretty happy with it. Hopefully, in a few weeks I can write more about any snags she has run into.
Tags: ,

Dec. 1st, 2007

Ubuntu Emacs + misc.

I have been having a lot of fun with my Launchpad PPA. In addition to org-mode, I've packaged color-theme and a snapshot of the Unicode+XFT branch of Emacs using the package name emacs-xft-snapshot so it doesn't conflict with existing packages.

I also put a package for PHP's Xdebug (which does a decent job of profiling PHP code and can be used to make pretty call graphs) and one for eMusic/J.

Feb. 6th, 2007

Mac Vs. PC

My mother called me up the other day: “Hey! Have you seen these new Mac vs. PC commercials?” she asked. “You should show your kids!”

They are funny, but, they've gone on for too long. The PC guys are even (finally) coming up with some nice come-backs.

Besides, I've been a Free Software user and contributor, advocate of programming freedom for too long to get sucked into the platform wars that Microsoft, Apple, and others foment.

You like Windows? Great! OS X? Wonderful! So what Beryl only now beginning to do things that OS X has done for decades? I'm a geek and I value my freedom more than the latest GeeWhizGottaHaveIt feature that Steve Jobs has decided is cool.

I'm also patient. I have to be. The Gnome desktop doesn't do everything a PC or Mac does right now, but in a couple of years (at the most) that oh-so-unique feature on your proprietary platform of choice will be commodified to the point of ubiquity. Ubuntu has already begun to make a credible effort at this, attempting to steal market share from the established leader.

Yeah, your BMW is nice, but my used minivan gets me where I need to go, and I didn't have to spend a mint on it.
Tags:

Aug. 6th, 2006

Converting Redhat to Ubuntu in colo

At BusyTonight, trying to see how much bandwidth we can consume crawling sites. Bandwidth tends to be pricy, so we haven't had much chance to really test our wings till now.

We got a colo'd server with a 10mb unmetered pipe. Problem was, it had RedHat installed and our software is written to be installed as Debian packages on Ubuntu.

So, how do you manage convert the operating system of a server you don't have physical access to? Well, Debian makes it (relatively) easy.

The debootstrap tool that Ubuntu inherited from Debian make it possible to set up a spare partition (swap, if need be) as a boot disk into which you can temporarily install Ubuntu. Once you have that up, you can tweak Grub, reboot with your fingers crossed, and — provided everything works smoothly the first time — you've got a Ubuntu system running.

Of course, nothing works smoothly the first time.

Luckily, I had kvm access for a few hours. So, I used it to struggle with the kernel. Too late, I realized I needed a custom kernel. Since I didn't have to figure out which bits were missing from the Ubuntu kernel or what bits were included that shouldn't have been, I just used the stock RedHat kernel to run the Ubuntu OS. It works enough to test out some ideas we have. And, if we need to do this in the future, I've a good idea of where to start.
Tags:

Jul. 27th, 2005

Where do real programmers work?

I came across Joel Spokely’s assertion that “… the most satisfying careers, if you're a software developer, are at actual software companies.” Something here didn’t sound quite right. “What about Open Source Software?” I thought.

Then I saw POSSE: Portland Open Source Software Entrepreneurs (POSSE) is a local organization of entrepreneurs who rely on and develop OSS to help businesses succeed.

See, there’s this whole other group of programmers besides the money-and-fame rock stars that Joel is talking about. Sure, they’re awesome developers and they’re excited about what they do. But people who work on Free Software are doing amazing things, too. Usually, it has been in their free time, often for their own use, so it doesn’t have the spit-and-polish that commercial software has. Even that is changing, though. Things like Beagle, Firefox and Ubuntu Linux show us that even Free Software has the power to be “remarkable software.” The sort of stuff the Joel says you need rock stars for.
Tags: