Showing posts from 2009

Seven Segment Display in Inkscape

Today I got a little sidetracked while working on my key-train (keyboard training) project.  I thought I might spruce it up a little by using a seven segment display for the digits (say for the words per minutes), similar to what kTouch has.  I found an open source font, but it appears to be difficult to just use a ttf font in GTK.
So I figured, it's only 10 images, I'll just make them in svg.

I vaguely remembered a heathenx inkscape podcast describing how to make an LCD display and decided to use that at my base. Unfortunately, they didn't provide any source files in the show-notes (as far as I could see) so I had to watch and redo the drawings myself!

By naming each of the seven segments I could create the 10 digits simply by deleting a few elements in one template svg file.  I can create the template as beautiful as I like and quickly create the 10 derived images with theseprograms.

Unfortunately, both ImageMagick and GraphicsMagick don't handle svg blur properly so …

Choo choo, get on the Key-Train

Well I've done it again, started another open source project. Renata and I want Victor to learn how to touch type, but these days, it's hard to find a school that teaches just that.

So I looked at what available in open source and found KTouch.  It's pretty good however I found some issues with it:
The lecture files aren't very obvious. It's not clear, for example, that it has already loaded the default lecture file.The keyboard is rather plain looking.The scrolling text area you type in is nifty, but gets in the way for advanced users.  My typing speed is limited to how fast it can scroll back.  Also, as you get near the end of the line it's becomes difficult to see what characters are coming up, slowing you down and creating additional errors.Like many other typing tutor programs, it shows only one line of text at a time, it's not obvious how many lines you have left to do. The first time I ran it I thought it was going to go on forever.It doesn't teac…

Keyboard Monitor is being used

I saw this week that Meet the Gimp is using my keyboard monitor program and gave me nice plug as well.
It was thrill, but bittersweet, since key-mon still doesn't support the Wacom table (and I don't know how to fix it).
I also feel it could look a little better (at least that I can fix).

Feeling a little homesick

Street view has some great shot's of Lennoxville.

Bishop's University

View Larger Map

Lion's Pub

View Larger Map

Also of the the house I grew up in in Montreal.

Exibir mapa ampliado

No street view for Kingston yet. But there's this areal view of where I used to go windsurfing.

Exibir mapa ampliado

Additions to key-mon

I've been busy and did lots of updates to key-mon, my keyboard status monitor.

The big news is that it's now resizable!

Normal size:

Small size:

Larger size:

It can be scaled to any size not just three, here it is at 2x without the mouse and showing the meta (Windows) key:

Heathenx is helping me get nicer looking images, especially at smaller sizes. For the really small sizes I needed to change the look a bit,  so now I have two sets of SVG files, one for the normal size and another for the smaller size.

Creating the different sizes was a bit of a pain. GTK wants to read the svg from disk so any changes made to svg needs to be dumped to a temporary file.  Also GTK doesn't seem to have a parameter to load and resize, so I end up manipulating the svg so that it is scaled larger or smaller.

The extra work was worth it, I think.  Some screencasts today are high resolution, so the key status monitor will be tiny.  Other screen casts are very small, so the key status monitor take…

Created another open source utility key-mon

This weekend I was watching a video podcast about Inkscape with the Miro player. Heathenx had to apologize that his key status monitor wasn't displaying mouse activity.  This wasn't the first time I've seen problems with this utility, earlier in the year Meet the Gimp also had some problems getting it to work.

I downloaded the program and put in on my machine, and sure enough the mouse wasn't working for me either. Looking at the output, it complained that I have more than one mouse and it was going to pick the last one.  It lied, I looked at the code and it actually picked the the first one. I changed the code so that it did pick the last mouse and it worked.  I thought of submitting a patch, but I realized that arbitrarily picking the last one might break the program for others for which it was working.

To my delight the code was written in Python, using PyGTK. It wasn't even that much code, I could probably write a similar program to …

More Timelapse

Here's the camera taking images of the evening sky.  I stopped it when it got so dark that it was taking nearly 4 seconds of exposure per shot.

Here's the movie made at 25 fps with 900 photos at 5 second intervals.

Canon EOS 450D triggered by an Arduino

I was finally able to track down a 2mm stereo plug here in Belo Horizonte (Eletronica Guarani) so I can remotely control my Canon SLR from the Arduino.

It uses two SPDT relay switches, one for the shutter and one for focus.  The way it's setup, there's no way I can cross the wires and hurt my camera, even after a few beers.  In the photo the black wire is hooked to ground and the blue wire to pin 12 on the Arduino (or Seeeduino in my case).  So far I've only used the shutter and have left auto-focus off.
Here's my first attempt of a timelapse movie with this setup:

You'll find the code here. This page helped me figure out to hook-up the plug.

Making the movie is a little tricky on Linux.  First you'll need to installed GraphicsMagick (a faster version of ImageMagick):
sudo aptitude install graphicsmagick
Then you'll need to downloaded and compile from source mpeg2encode to that it can do the conversion to mpeg (this doesn't come included with GraphicsMag…

Halloween Fun with Arduino and LCD

For Halloween this year I did two things. I redid my spinning POV hat. I basicallly, just made it stronger, and lighter since it fell apart last year.  To make it lighter I used the Arduino Pro (5V) and two coin style batteries (CF2032) instead of the normal Arduino and the heavier 9 volt battery.  I didn't have much time to perfect it so the effect wasn't perfect (code).  I really need to put a sensor on it that senses every time it spins around for it to work correctly, at the moment I just guess how fast it's spinning and put in a delay based on that guess.  What came out doesn't look that hot:

The second device I made was a little more successful. It was a 16x2 line LCD from sparkfun (GDM1602K rev 2.1) display connected to a button so that every time you pressed it one more friend would be added.  I would go up to people and say "Press the button to be my friend on orkut".

There's a colloquialism here in Brazil: "Me Add" which is both a short…

I need a weedwacker for my fish tank

I think there are some fish in there somewhere...

Here's what I ended up taking out.

Here's what it looks like now

Making an Arduino Controlled Power Outlet

Over the weekend I created a Arduino controlled power outlet based on this design.

With this connected to a the Arduino I can control the two plugs independently.  One end (which I cut an old US style plug) I plug into the mains power, the other end I connect to the Arduino (four connections):

The fit was a bit tight!

I did some tests to see if when the solenoids are on whether is would heat up too much.

After about about a 1/2 hour it did heat up to 32 C° which isn't too bad.  So now I'm all set to scare some animals.

Arduino Sonar Trigger Part 2

The idea this weekend was to setup the sonar with the Arduino so that I can get a shot of the Siriemas that pass daily at the farm, or maybe a hummingbird.

Well that didn't work out so well, turns out that the sonar is affected by the wind. Adding a bit of hysteresis to the code, fixed it for the most part.

I used lua to program the camera, except that it looks like there some issues with it and my Canon SD450.  Calling get_shooting() repeatedly causes problems, for example. I got my intervalometer code to work correctly only after removing that test.  Here's some timelapse photography that did work.

Canon SD450 Triggered by Sonar and the Arduino

This weekend I played with my Canon PowerShot SD450 (aka IXUS 55) and the CHDK along with the Arduino and the MaxBotix MaxSonar LV-EZ1.  The idea is to automatically take pictures when an object moves into frame.
Part of the job involved hacking a USB cable to hook up to the Arduino which I promptly did, as you can see below.

Unfortunately, I was supposed to hack a Mini-USB cable (of which I have a dozen) and instead hacked my (only) Micro-USB cable (oops).
The end I soldered two break away headers and then encased the whole thing with hot glue.

Here's the setup. You can see the sonar on the right.  I soldered a female header to it instead of soldering wires directly to the board.  The hacked USB cable is connected to ground and pin 13.  For the sonar I've plugged it into Ground, 5V, and pin 7.

You may also note that I'm not using the AN (analog) pin on the MaxSonar, but instead the PW (pulse width) pin, unlike most code I saw on the web.  The code is near the bottom on this

Has the Web Made Us Better Readers?

In the recent past, when writers used expressions like "Procrustean bed" or "Sisyphean task", they might have been considered rather 'snobby', even if those expressions might have been appropriate.

Today, of course, we can link to the definitions or have the reader search for the definition easily. It think, as long as the article isn't full of these types of references, it isn't too much work for the percentage of readers that may not remember their greek mythology.

Today, writers don't even need to go back to ancient Greece for their archetypes:

"Jumped the Shark" is a great expression for when something has become passé (follow the link if you don't know this one).

"Streisand Effect" is when the attempt to suppress information backfires and just makes it even more widely publicized.

"Take the redpill" when you need to leave your fantasy world and meet reality.

"Dialed Up to Eleven" for when something e…

What I'm working On

At Google we have lots of internal tools, many for the command line. On occasion some googler will take one of these tools and make it into an internal web site.
Usually, when this happens I think "Why? The command line tool is much more convenient!". At first, the web site isn't all that useful, but week by week, features get added until the web version is faster, and has more useful features than the command line version. I started thinking that I have some old programs that I wrote, years ago, which could be better off on the web.
One program I did this to is mm2notes which takes FreeMind MindMap and creates meeting notes. The original version was only for the command line. Already I can see the web version could be far more useful than running from the command line. For instance, I can e-mail the action items to the people that have something to act upon.
Another program that I wrote, even longer ago, was a program to help me learn Portuguese. It had two parts, one…

I'm Liking Mercurial

I've been a longtime user of subversion for source control, and with Google's Project Hosting, that was the only choice.
For a new project I'm working on I decided to try mercurial, instead.

I think I'll stick with mercurial from now on:
It's very close to subversion for most commands.It's incredibly fast.I can perform commits without an internet connection.It uses only one hidden folder for the whole tree.
The only issue I've found so far is that the default Mercurial version for Ubuntu is before version 1.3 which allows you to store the password in a ~/.hgrc file. So, for now, I need to type in the password every time I do a push.

First Wave Robot

I took advantage of the fact that some wave developers were passing by our office and wrote a wave robot during a jam session. This robot monitors what is being typed and makes it easy to convert to different units. If you type "100kg (? lbs)" it will replace the ? with the correct value of 220 after you type the closing parenthesis, for example.

I went a bit further and tried to be sensible with the significant figures. I didn't want it say '220.462262 lbs. So I examine the number of significant figures from the original number and try to duplicate it in the result. If you say "100 kg" it'll put "220 lbs". If instead you enter "100.0 kg" it'll put "220.5 lbs".

Test revealed, however, that this wasn't good enough. If I put in "1 inch" in would convert this to "3cm", a 18% error. I put in an extra rule to increase the precision if the error was greater than 10%, which got these corner cases…

Grub Could be A lot Simpler

Today I reinstalled Windows XP on my son's machine (my old machine). Ubuntu works perfectly with sound, video, and internet, but Windows...
In Windows, I had no sound, no internet, and problems with the video card. Then when I tried to update, it said I can't use and English version of XP in Brazil!
So I reinstalled with a Brazilian version of XP which blew away the boot sector (and thus the menu for selecting Ubuntu is gone).
There are some good instructions here on how to restore grub, but jeez, such a simple program has to be so much work:
Worse, it's even picky about spaces, you need to put a space (shown above as '␣') or you'll get an error message, you've got to be kidding me. If you forget the sudo, it gives you useless error message instead of mentioning that running as root is probably a good idea.
I suggest they fix grub with tab completion so that I can just press "r" and get:

Speakers Housing Part II

Today's a holiday (Tiradentes Day) , so I finished off my speakers!
This time I even tested them (last time I was so exhausted that I didn't even want to know if they worked or not).
I ended up putting the screw covers on with contact cement - I don't know how long they stay up there.
One project completed!

Speaker Housing

This weekend I finished my speaker housing so I can have some sound on the veranda.
It was a lot more work that I had hoped, I'm still sore. My reciprocating saw didn't survive the experience either.

Unfortunately, I still have some work to do:
put some edge strip laminate in the missing partsplane down this piece so that it's flush.Hide the screws. I bought some covers, but I realize now they won't work, all my screws are flush and they must be protruding.

How I'd Improve the Nintendo Wii

Nintendo is coming out with the Wii MotionPlus, which improves the already revolutionary controller. It started me thinking on what else Nintendo could do.

For instance, one or two cameras could be mounted on the TV pointing to the players. This has been done before and makes for some fun games. It also could be used to improve the playability of the games. Imagine a sword fight where you can physically jump out of the way of the sword!

Today if I want to play a quick game on the Wii Fit, I have to:
Drag out the Wii Fit platform and turn it on.Find the Wii Fit DVD.Eject the game that's already in the console, hope that my son saved his game and put the DVD somewhere.Put the Wii Fit DVD in the console and restart the console.Move and click the cursor to select the Wii Fit game.
Go through several screens and warnings.Select which player I am.Start playing, whew!It could be a lot easier. Putting in a DVD to select a game seems sooo 2001. I can't remeber the last time I put in…

Wake on lan works

I previously tried to get wake-on-lan to work and had no luck. I was never sure if my code was wrong, or if a firewall was filtering the command of if my motherboard just doesn't support it (probably the latter).
Today I got a new computer and the old worked!

So here's the program that works for me.

#!/usr/bin/env python

import socket
import struct
import sys

def wake_on_lan(macaddress):
""" Switches on remote computers using WOL. """

# Check macaddress format and try to compensate.
if len(macaddress) == 12:
elif len(macaddress) == 12 + 5:
sep = macaddress[2]
macaddress = macaddress.replace(sep, '')
raise ValueError('Incorrect MAC address format')

# Pad the synchronization stream.
data = ''.join(['FFFFFFFFFFFF', macaddress * 20])
send_data = ''

# Split up the hex values and pack.
for i in range(0, len(data), 2):
send_data = ''.join([send_data,

Weight Log

I've put together a web site to track my weight and exercise.
But mostly it's to play with Google App Engine.

In the process I discovered two things I didn't know about before:
The Google Visualization API. It's a very neat way of putting up charts easily. One nice feature is the separation of data to data views. You can, for instance, download (via AJAX) one table with six columns and produce 5 charts from it with 5 views, very neat.You can use some libraries for free (i.e. it's doesn't count for your application's quota, and you get updates without having to manage it). For my app I used the dojo library.I figure the more of these web application I make the easier it will become.

I'm not going to do an app a week like Web App Wednesday, but Google's sure making it easy to put up a site.

Hard Drive Cloning in Ubutnu

I'm buying a new computer, but the new computer is without a hard drive nor a video card. My computer is going to Victor who's has increasingly found it difficult to buy games for his computer, even games that are 4 years old. Victor will get my old 120 Gig drive and I'll just use the 450 Gig drive that's also been on my computer for a while.
I've been running my computer off an older 120 Gig Maxtor with another 450 Gig used for backup and some larger files. My idea was to offload all the files off the 450 Gig (to my 1 TB drive my video server) and move all my stuff from the 120 to the 450 and just use the 450.
I searched the Internet but it was not clear what the best method was to use.
In short I:
Copied off all the old files off my 450 Gig drive using rsync.I used GParted to clone the 120 GB drive to 450 GB (using copy-paste!). I created a bootable "live" version of GParted CD from here.
I unplugged the 120GB drive and just left the 450GB in it's pl…

Toilet seat up or down?

These are some of the important questions in life.

The Way Women See It
If I didn't have you in my life, I would never have to bring the toilet seat down.
If I forget to check that it's down, I'll end up sitting in toilet water.Men could pee sitting down, if they wanted to.
You are already getting free sex, it's the least you can do.The Way Men See It
If I didn't have you in my life, I would (almost) never have to put the toilet seat down.
9 times out of 10 when I go to the toilet it's to urinate. Having to both lift the seat up and put the seat back down seems like a lot of work.Peeing sitting down takes longer, and doesn't get the last drops (especially when you get a little older).You're being selfish for not put up the seat for me, why shouldn't I be selfish and not put the seat down for you?The Solution
Put both the seat and the seat cover (lid) down.
If you have to put the seat down, it takes as much work to put one down as two.It can make the bathr…

The Tipping Point

I just finished reading the Tipping Point and started thinking.

I realized that a site like Good Reads, is a place for "mavens", people who love books come there and tell others what books they should read. The whole publishing industry should pay for this site and encourage these mavens to flock there and give their opinions.
It also made me realize that Good Reads needs more work on developing their network. Make it easier to find others that have the same interests as you do.

Also from my work on orkut I realize that competition is very powerful. You see that your friends have 300 'friends' and you feel inadequate, and work to build up your list of friends. The same could happen to books, you see someone with 100 books that they have reviewed and you start wondering what's wrong with you. You start buying, and reading more books - and giving opinions about these books.

Love the Canon Xsi

I bought the Canon Rebel XSi (aka EOS 450D) digital SLR and have taken somepictures. After using the typical consumer compact camera (like the Canon Powershot SD) for a a few years using these modern digital SLRs is like going from a Corolla to a Porshe. The speed a which it can focus and shoot is incredible, I could depress the button for 4 hours and take pictures at 3.5 pictures per second until the battery runs out. I also got a 8 gig memory card (only about $20.00 these days) and am thrilled that I can take more than a 1000 pictures with no problems.
I tried my wifes older Canon EOS film SLR lenses and they worked flawlessly. I was surprised that the image I saw in the viewfinder was the same as what came out in the final image as well.
Having the large 3" LCD means I can reliably review my image and make decisions about what to delete which I used to always do on the computer.
I've been waiting for years to buy a digital SLR but it had hovered around a $1000 for what I …