Posts

Showing posts from 2008

Dynamic Typography

I'm fascinated with kinetic typography, especially the work of Lawrence Lessig. If you like to see more of the genre you can go search google.
I wanted to do my own. I could always try using open office Impress or PowerPoint, but they are too limited in what they can do and repeating the same fancy effect on two slides takes twice as long.
My first attempt was to use the Processing language, but it was a lot of work and the language is less than ideal (sort of old school).
My second attempt was with PyGame, which I've been meaning to learn more about. It could work, but I found that the font's weren't anti-aliased (but I think I was doing it wrong) and creating the library was proving to take a long time.
The I remembered Bruce, a presentation program written in Python and supposedly using PyGame. When I downloaded the latest source, I found that it was using Pyglet and Cocos2d instead. These two were exactly what I needed, powerful and flexible and I could animate a b…

The rise of programming for artists?

Image
I've been using the Wiring language for doing my Arduino programming and this week I played a little with it's big brother, Processing. I think Processing is a nice tool for beginners and has a great set of libraries, but not my cup of tea for programming. I think what it offers is one tools set (including IDE, libraries and language) so you don't have to waste time figuring out which libraries or IDE you'll need to download as well.

I've also just come across Context Free which is a language for making pretty pictures like the one above.

G1G1

I bought two OLPC (aka XO) laptops and gave one to a needy child through the G1G1 (Give One/Get One) promotion. In fact I gave two laptops since Google matched my donation (thanks Google!).
It's already arrived at my Mother's house, it'll be interesting to see how it's changed since the beta machine (which I still have, but I can't upgrade anymore without bricking it).
Maybe the dollar will go down in 2009 and the price of materials as well so that they can start selling the laptop at something near $100.00.

Got my wife on Unbuntu

My wife, Renata, has been complaining more and more that Windows is getting slower and it's a pain downloading and installing anti-virus software all the time. I occasionally tease that I don't have any of these problems, I don't even have an anti-virus installed on my Ubuntu machine.
So finally, this week, she said that she wants to a dual boot machine, like Victor has.
Compounding the issue is that over the past few weeks our Internet provider had been getting slower and slower, of course, making Windows appear even slower than normal.
I downloaded the DVD version of Ubuntu 8.10 which took a week with this slow connection and, of course, it didn't work (I believe her machine does like booting with a DVD). Luckily, some time on Friday our Internet provider fixed their problems and I was able to download the CD version of 8.10 in about 40 minuts.
In the meantime I backed up her machine to my hard drive which was much slower than it should have been (about 8 hours). I nee…

Launched

It's been a long road, but we launched Google Talk in Orkut.

Official Orkut Blog Post of the Launch

Build Status Monitor

Image
I bought the SparkFun LED matrix to go along with the Arduino and here's what I've built.
I basically smiles when the build is green and frowns when it's broken.
You can find the code at google code.
I wanted to have is scroll messages across and there's code to do that, but in the end it was just too annoying since it sits in front of my desk. I have a routine ready, however if I want to give someone a message.
To get the text I used wxPython and I draw the text in a buffer, then I look at the pixels one by one and those become the LEDs to turn on. One nice addition is that I can pass Unicode characters and thus it's relatively easy to show special characters like ⚘♂✔✖✈☝ although 8x8 pixels is often not enough and I have to fix them by hand.
Another bonus the that program works from the command line so you can print larger messages:

./text2pixels.py --size 30 --bold --font "Delphine" Arduino
###������������…

Fun with SmartFun's LED Matrix

I had some fun this weekend with the sparkfun LED matrix. It's a little bit expensive at $35.00, but looks like it could have a bunch of cool uses.
Programming it I had to learn about SPI and I ended up writing my own SPI routines in processing.
I've put the code up at led_matrix_tools and some of it is very reusable.

Note: I wrote this on October 12th, I just noticed now that I never sent it.

Electricity in Brazil

Brazil has a strange relationship with electricity. Something like 95% of the electricity in Brazil comes from hydroelectric, yet they charge an arm and a leg for it.
A few years ago we had the "Apag√£o" (big-unplug or big-turn-off) where you had to halve your electricity consumption from the same time last year. This was because it hadn't rained enough and the water was getting too low behind the dams to make electricity. The real problem, of course, is that the government hasn't been investing in new electric generation plants. Worse was, that after the emergency, everyone had learned how to use less electricity (by buying compact fluorescent lights (at twice the normal price), for example) and was being more energy efficient, so the hydro company increased the prices. Why? Because they weren't making enough revenue!
At my home they charge R$0.5684/kWh which is about USD$ 0.3072/kWh. That's 204% more than the New York region ($0.1508/kWh) or 217% more expen…

Portuguese Words that are Odd in English

Puxe (pronounced "push") - means pull
no - means "in" or "at", "no happy hour" would be "at 'happy hour'"
sex - means "Fri" or sexta feira. Sexo would be sex.
uai (pronounce "why") - it's an expression similar to "look", "well".

Old Games Still Attract

Image
We we cleaning out some closest and my son picked up an old game of mine: Baldur's Gate from 1998. It's pretty tough for him since it's all in English and it's pretty complicated, but he likes it. These old games still are lots of fun.

101010

So today I'm 101010 (in binary), or 33 in base 13, but nobody makes jokes in base 13*.

I guess most geeks know that 42 is the "Answer to the Ultimate Question of Life, the Universe, and Everything", unfortunately I need to explain the special significance to everyone else.

Somehow, I do feel wiser this year, perhaps it's just the senility making me forget my ignorance.

* *is also 42 in ASCII.

MAME Decal Mistakes

Image
The self adhesive poster came back from the printers and I quickly realized that I should have re-measured the MAME console.
The SVG file that I used was the original blueprints, but not exactly what I actually ended up cutting. My final console ended up being a bit deeper than the plan and some of the holes were placed by eye.
So you can see in the image that some decals that were supposed to be on the sides (like "Nintendo" and the packman ghosts) ended up appearing on the bottom. Also, some of the holes don't line up nicely with the text like "Start" and "Pause" are more obvious.
The resolution also isn't that great, I'm guessing that it's 100 DPI instead of 300 DPI which I was expecting.
But from a distance it looks pretty nice and I'm still glad that I went and did it. I'm a little wiser now - next time I'll make sure to remeasure.

Mame Console Art

Image
Here's my and my Son's effort for a MAME console design. Not the prettiest, but it was fun creating it. I've sent it to the printer's and it should be ready tomorrow.
The one I sent to the printer doesn't have the circles nor the black border which comes from my original design when I built it three years ago.
The format that they liked the best was the PDF version which Inkscape exported without any problems. The mistake I made was to not to shrink the "paper" to the size of all the boxes so I ended up paying for a little extra white that I probably won't need (it ended up being R$35.11). I think I should have also left cut marks in the diagram to make it easier to align and cut out the pieces, we'll see if that will be necessary.

Another Gimp Script

Image
I've been wanting to make a plastic print to cover my my son's MAME console for a while now (3 years already?). All I need to do is get some bitmaps, or even better some scalable vector images, from a couple of games, put them together and send it to the printer, right?
I knew I was in trouble, when after a few searches I got my own blog listed. Seems there aren't that many game fans making nice svg images of popular videos game characters. I did find, however, the spriters-resource.com which has the sprites from a lot of games, the problem is, they are all tiny.
For example, here's what Megaman looks like .

Zooming that up 8 times, for instance looks kinda crappy:

Using the cubic interpolation 8x does only a so-so job:


I tried various filters and effects and got the look I think I wanted which you can see here:

I wanted to fiddle with the steps so I put it all in a python plugin which you can find here (here's a direct link to the code which may have some useful rou…

My Backup Setup

Mostly my "backup" in the past has been putting everything into an offsite subversion repository. This works, but there are always things that I don't have saved that ends up being important and I don't normally save my large images.
On occasion, I'll also make copies to DVD (in sets like "pictures") and that works fairly well too, but I don't do it often enough.
I've wanted to setup a a real backup setup like provided with bacula, which is very complete and has a great name and subtitle ("It comes by night and sucks the vital essence from your computers."). Under Ubuntu is installs quite easily but getting it setup is quite daunting, it's more for a company wide backup solution. I like the fact that it's written in Python and that it can properly backup even Windows machines, by installing a small program on each machine. But in the end, after reading the whole manual, I never got it setup.
I just installed a new drive which w…

Google OpenSources Protocol Buffers

Google has open sourced Protocol Buffers which is used extensively at Google. It's used for storing data in big tables as well as for RPC communications between services. It's perhaps nothing revolutionary, except that it works and it's fast. The other day I realized there are two very nice features of protobuffers: You can have a zero sized protobuffer, which can still return (default) values.Protobuffers can be both forwards and backwards compatible.I suppose the easiest way to see the advantages is with a sample. Imagine you want to store some settings for a program. message Settings {
optional bool auto_backup = 1 [default=false];
optional int32 backup_frequency_sec = 2 [default=30];
optional string backup_fname = 3 [default="auto.sav"];
}By having everything optional and with defaults, even if the settings file is zero bytes long (or doesn't exist) that's still a valid protobuf file and you can create a protobuffer instance that will have the cor…

More Arduino Ideas

More ideas on what to make:
Make a bark stopper, like this one.Make a tennisballshooter.Make a binary clock.

Arduino Ideas

Image
I've been wanting to play with electronics, for years. Somewhat spur of the moment I decided to purchase a bunch of stuff in order to do that. I've been collecting old junk (dead printers etc.) and now is my chance to to use all that.

Here are some of the project ideas I've collected:
First this is probably Hello world.
Make an egg timer.Make adrumo drum pad.Have arduino play some drums, like in this robot band.Make a custom stoplight for when the build breaks.
Datalog something (light, temperature, humidity, footswitch).
Log the height of water in the water storage bin at the farm.Make a simple two wheeled robot that can be controlled from the computer.
Make a simple intercom.
Make a 2d table that draws or cuts something (CNC machine).Make a tiny Flickr frame.A Cylon or knight rider effectPersistance of Vision POV either hand-held or spinning.Take a photo based on motion in-front of the camera, may have to hack an old digital camera.Take a photo of a lightning flash.Make a two…

Bought some Microcontrollers

Image
For years I've been toying with the idea of playing more with electronics, specifically with microcontrollers, to build things like robots. I figure it's the perfect blend of my strengths (programming) with something different for me (electronics). In the past they were pretty expensive and underpowered, but thanks to Moore's Law they can be had for pretty cheap and they can do a lot in one tiny package.
I've ordered two Arduino Diecimila USB devices from SparkFun. These things come with the Atmel AVR ATmega168 with 16K RAM and runs at about 1 MIPS which, in comparison, is about the same speed as my first computer, the Atari 1040ST. Each of these cost $35.00 assembled (the chip itself is $5.00) and can be run off of a 9 volt battery.
When I looked at these things in the past the most popular ones for hobbyists ran BASIC which I though was stupid and expensive ($125 vs $35). As a programmer I'd much rather program in C or maybe Forth, besides, programming isn&…

Playing with long exposures at night

Image
img_0047.jpg
Today was Valantines day (Dias dos Namorados). I painted this with a laser pointer and a 10 second exposure.

Victor's a ghost!
This was another attempt, I had to do this indoors because the building next door has too much light.

Quadruplets

Image
This came out nicely and was pretty easy to do, thanks Meet the Gimp.

Two Great Podcasts

Image
I've been watching two great podcasts (or technically vodcasts) about two programs I'd like to use more often, Gimp and Inkscape.
I've been watching these with Miro which is a useful tool to get and watch podcasts. Miro used to be called Democracy and used to crash all the time in Linux, but this version is much more stable. My only complaint is that you can't multi-task: watch videos while browsing other content from within Miro.

One podcast I've been watching for a while is called Meet the Gimp. Ever since I've started watching this podcast I've been enthusiastic about cleaning up and improving my own digital photographs. Now I know how to efficiently cleanup my photos and I go and do it much more often.
For example Episode 42 shows how to to quickly improved the color of a photo that looked rather dull and also how to use the healing tool to remove some birds that are just in the way.
Or Episode 46 which uses two photographs (both taken without a tripod) …

My Aquarium

Image
When we built the home-office I decided that I also wanted to have a built in aquarium. I set it up so that it's visible from both our bedroom and from within the home office:

I knew this was a little risky. Most aquariums are up against a wall and you can only see in from once side. Being able to see from both sides makes it a little more difficult to setup the plants and rocks so that it looks nice from both sides.
Also, the aquarium gets twice as much light and has the risk of becoming green with algae. This normally doesn't happen very often, but it appears that this time of year it does:


My aquarium is filled with Cichlid type fish which are quite hardy and long lived and more intelligent as well. I didn't want a salt water aquarium, which would have been prettier, but much more expensive to setup and buy all the fish. I bought a large 95 gallons (360 liters) which can allow the fish to grow quite large.
My second risky decision was to have a planted aquarium. Normall…

Digital Photography with Flash No-Flash Image Pairs

Image
In the spirit of High Dynamic Range Imaging here's paper on how to improve digital photographs by taking two shots, one with flash and one without.
Just like there are lots of good tools for HDR imaging, I suspect there will be tools for flash/no-flash.

Of course there's always:

Unison Bash Completion

If you don't use unison to keep folders synchronized you really should, it's great. It's like a two way rsync program.
Problem is I end up synchronizing a bunchy of folders in different locations for different projects and I prefer to start unison at the command-line. What I want is bash completion for unison. It's not that difficult to setup.
I just created a file in /etc/bash_completion.d called "unison" and it looks like this:
_unison()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$(python -c 'import glob,os,os.path;x = glob.glob(os.path.expanduser("~/.unison/*.prf")); print " ".join([os.path.split(y)[-1][:-4] for y in x])')

COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _unison unison-gtk
The python part is all one line and it goes to my ~/.unison folder, lists all the *.prf files and then just gets the base name…

Upgrade to Hardy Heron (Ubuntu 8.04)

This Monday was a holiday here so I thought it might be a good time to upgrade my Linux, a couple of days before the official release. It took a long time to download all the updates, but it seemed to get everything and then started the installation process. I went inside to finish the last few episodes of Lost, I finally watched all 4 seasons of after beginning about a month ago. I have to say that the 4th season is a letdown so far. I mean seriously, you need to have an emotional "constant" for time travel? That really made me cringe, the writers need to stay as far away from math as possible.
When I came back to the computer to see how it was going I was at 1% and got an error already. I spent the rest of the night clicking "OK" buttons because it kept finding problems with the install. After a hundred of these it gave up and it quit the upgrade. But by that time, I had already started noticing that things had stopped working, like Gnome Nautilus, ugh.
So …

Other forms of evolution

Evolution of Conditioner Bottles
It's happened to me more than once that I got home from shopping and I picked up a bottle of conditioner instead of a bottle of shampoo. Conditioner bottles have evolved to look more like shampoo bottles, and get taken instead. I'm sure some time in the past, some designer created these two bottles of shampoo and conditioner because they looked nice together on the shelf. All of a sudden the sales people noticed a large increase in the sales of their conditioner. Bottle designs that confuse the consumer ended up selling more. These designs end up having more stickiness, until the entire population of conditioner bottles is like their shampoo brethren.
Evolution of Microwave Ovens Consoles
I remember when we got our first digital microwave oven from Panasonic. To start it up you had to press the "power" button 4 times to get "high", then press the minutes and second buttons, and finally start.
I look at microwaves now and …

Home Theater PC

This Friday I bought a new PC to be used as my Linux Home Theater PC (HTPC).
ATX 480WSlim HTPC cabinet
VGA 512 GFORCE 8500GT, PCI CPU Intel Core 2 DUO E6750DDR2 1GB 667 KingstonDVD/CD DL SamsungGigabyte GA-P35K - LGA 775SATA 500 Gig HD (Western Digital)Gyration Wireless 3d Mouse and Keyboard.I tried using the beta of Linux MCE, but it didn't work at all (video problems). I used an older version of Linux MCE and got it working a bit. But I didn't like the fact that it picked it's own name for my machine and user name. I gave up on that and am now using the 8.04 alpha (yes alpha, I never learn) of Mythbuntu.
Mythbuntu worked reasonably well out of the box except a lot of the configuration screens didn't fit my 480P. The OK or Next button would be off screen and I couldn't figure out how to move the window up so I could see it (Alt+Drag with the mouse is the trick).
Other problems I had was that Myth defaults to hiding your mouse cursor so you can't see were you&#…

Bash notes

As a regular linux user I have some hints and tips how to setup bash:
Create a ~/.bash_aliases file and store all your aliases and functions there. You'll need to source the file in ~/.bashrc, see below.
For common directories you visit create an alias that cd's to that folder starting with _. Using the underscore is short and sweet and doesn't pollute your namespace as much. Here are two examples (the latter also changes the window title):alias _mydir='cd /home/scott/my/dir'
alias _other='cd /home/scott/src/projects/other;echo -ne "\033]2;Other Project\007"'
Use these cd aliases:alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'Use these ls aliases. (h is for "human" file sizes, F is for adding a trailing / for directories)
alias ls='ls -hF --color=auto'
alias ll='ls -lhF --color=auto'
alias la='ls -AF --color=auto'
alias lrt='ls -lrthF'
functi…

New Year's Resolutions

My NewYear's Resolutions:
HealthHave a regular exercise program (3 times a week, tennis or squash counts for at least 8 months).Continue eating healthy, but eat little less meat and dessert (hard to quantify).Loose 12kg over the 12 months.Go back on the Shangri-La diet for at least 3 months.
Fix/BuildGet a new computerGive my old computer to Victor.Get another 500 Gig of space.
Make the practice greenIt won't be finished this year, but I plan to have the hole dug, the channels and gravel and the first level of sand done by December.
Do something with MAME.
I have an old computer it may be interesting to get it working as a dedicated MAME setup, if it can handle it and maybe leave it at the farm.Have a commercial printer print up a plasticized design that we draw up for Victor's MAME console I built.Work on my open source programsHave unit tests for all of them.Publish/revive one of my older stuff.
Make one new project this year.
Make 6 commits on some other OSS project that isn&…

Using Gimp

Image
I was thinking why I keep using GIMP instead of, say, Photoshop. Here are my main reasons in bullet form:
It's free and open source and I support that.It uses Python as one of it's scripting languages. I've created twomini utilities using that fact.
Using Python-Fu instead of say PIL is that it uses the same object and object names as GIMP uses. Learning more about Python-Fu makes me a better GIMP user since I know better how GIMP works.
Create the images using GIMP by hand I can decide later if it might be easy to script. If not, I'll just do it all by hand.
I can install GIMP on anyone's machine in minutes, no legal hassles or possibilities of installing a virus from pirated software.Once I install GIMP on a machine, I can use it immediately. I don't have to figure out the interface of a program I'm not familiar with.Some cool new features come out first for GIMP.GIMP can load files directly from the web or FTP.
GIMP has everything I need: clipping, masks, l…

Downloading projecteuler.net

Project Euler is having some problems, and in any event, I wanted to download the questions that I haven't completed yet so that I could work on some problems even when I'm off the net. I thought of use httrack which is made for this, but it doesn't seem to support passing cookies from firefox.
Wget is the swiss army knife for things like this here's what I did:
wget --load-cookies $COOKIE --convert-links --recursive --level=1 --restrict-file-names=windows $SITE Where COOKIE points to my firefox cookie file (~/.mozilla/firefox/.defulat/cookies.txt)
and SITE is the project euler site (http://projecteuler.net/index.php?section=problems)
The parameter --convert-links will update the links so that they work offline and --level is to go only one level deep. The restrict-file-names=windows is needed so that firefox can read files with ? or = in it.