Posts

Showing posts from 2006

2007 Predictions

It's always fun to make some predictions so you can make a fool of yourself in 12 months time. So here it goes:
The Nintendo Wii will outsell the XBox 360, although it may take all year. Most XBox 360 owners will also have a Wii.
The US economy will do worse in 2007 than in 2006. A part of the reason will be because of lowered housing prices.Brazil will do marginally better in 2007 than 2006.The OLPC will have a rough start mostly because of political reasons and an extended smear campaign but will be an utter success as 2008 rolls around.We'll start seeing more machines with Linux pre-installed on it instead of Windows in 2007 or with a sticker saying "linux ready" or some such.
We'll slowly start seeing companies putting Linux on their employees desktops instead of windows because it is easier to administer and catches less viruses.People will start understanding that DRM is evil and will actively try to avoid it, despite the lack of legal choices. Some smaller…

When regular Sudoku just isn't hard enough for you

Image
There's 3D sudoku

Dot to Png

Image
For fun I wasted some time creating diagrams using the dot language. It's pretty fast to get a diagram out, except that there are a lot of things you can't do, like make shadows or rounded and filled rectangles. With this dot code:digraph "User Clicks" {
node [
shape="rectangle"
style="filled"
]

server [label="Server"]
java [shape="ellipse" label="Java\nCode"]
provider [label="Service\nProvider"]
browser [label="Firefox"]

browser->server[label=<&#9312; AJAX Sends Session ID>];
server->java[label=<&#9313; Confirms Session ID>];
java->provider[label=<&#9314; Makes HTTPS call>];
provider->java[label=<&#9315; Results>];
java->server[label=<&#9316; Results>];
server->browser[label=<&#9317; Results>];
}
You can click on the image to see the SVG rendered in Firefox, if you use that. I wrote a little python program to call the dot command o…

Brazil's Obsession with Languages

On the way to and from work, I pass three English, one Japanese and one Mandarin Chinese school. If I drive one block off my regular route I can also pass infront of Portuguese, French, German, Spanish and Italian schools (although some do double duty). These little schools are more common in Brazil than Starbucks are in the US.
It reminded me when I was working at my previous job, there was this new guy who started working next to me. He wanted to learn 4 languages. I didn't know what to say. I mentioned that I speak four languages, but it never really helped me get a job. Even in Brazil where knowing English can really be an asset (and thus all the English schools), I hardly ever had a chance to speak it at work. For a while, I was even working for an American company in São Paulo (Convergys) and the only time I got to speak English was when I went out to a bar with the Americans.
I just didn't have the heart to tell him that he should really learn another computer language…

Messed up Ubuntu, again

Image
I've not been having great luck with Ubuntu recently. Two weeks ago I tried an upgrade and failed miserably (see thread). I was able to backup and essentially reinstall from CD and start all over (which isn't all that hard with Synaptic, it's just click and install and rsync to recover my 45 gig backup).

You'll notice that there are no window borders and the console is actually on top of the panel at the top of the screen.Then this week I was playing with vnc2swf and somehow I killed my window manager. Basically, my machine would start up but had no borders around the window, they are unmovable and I can't Alt-Tab to different programs. I 'knew' the problem was with the window manager, but what is that called, and how do I set it up properly? At first I thought it was GDM (the GNOME Display Manager) , but after fiddling with that for a bit I realized (eventually) that I was wrong. Some more surfing and I realized that it is probably metacity (although t…

I've Gotta Wii

I forgot to post that I managed to get a Wii. For a while I tried from Amazon, even wrote a python program to check the various Amazon pages periodically and put it in my shopping basket the minute it's available. It was finally through the XP Bargains Wii tracker that I was able to find one available via gamestop.com. It came with 6 games and an extra remote. The extras games besides Wii Sports are Zelda, Trauma Center, Red Steel, Marvel Ultimate Alliance, Super Monkey Ball, and Madden NFL - it's not a bad list of games.
I ordered it on 24th of November and it arrived at my mom's on 6th of December. I had a colleague who was at Mountain View who was able to bring it to me the 11th of December (17 long days since I order it). So this was my first wiikend with the Wii. Basically, Victor and I played Zelda until our eyes bled.
Looks like I was pretty lucky, people are still queuing up all night to get one. That link points out the sad tale of 200 people lining up all nigh…

New version of wxOptParse released

Image
I got an e-mail from a user of my open source project wxoptparse, he had some problems and even provided some patches. I downloaded my code from subversion and found that it was still missing some important features and had some other serious issues, which I have since fixed.
This program is a union of Python's option-parser (optparse) and wxPython. My program hijacks optparse and creates a dialog box of the parameters and shows it in a gui. Then by selecting checkboxes, combo-boxes or typing in edit boxes you can choose the parameters to call the program. This is pretty handy for utilities you don't use very often. As long as your python program uses optparse, you have to change anything in your program.
Another handy feature is that it remembers your previous values, so you don't have to type it in again.
There are still a lot of features I can think of to add, but it helps when I get some feedback (sorta like Warnock's Dilemma).

Detecting copy-and-pasted Code

I came across this interesting little program to detect code that appears to be copied and pasted from one place to another. It's about $20.00 and is free to try for Linux and Windows and works with any text.
It doesn't seem like a difficult program to write, sounds like it might be similar to the rsync algorithm. Differences would be that you would chunk into n lines instead of bytes and you would store all the checksums in a hash table, to find duplicates. Maybe cleaning up whitespaces and removing comments might also improve the algorithm.

No Wii for me

Yesterday, I was hoping that maybe I could at least get on a list to buy the Nintendo Wii, but no luck. I tried Amazon.com but they sold out in less than a minute.
We are currently out of stock: We sold out of our initial supply of the Wii on Sunday morning, November 19, in less than one minute. We expect to receive periodic shipments of the Wii from Nintendo throughout the holidays and we will post availability updates in this section of the product detail page as well as in the customer discussions below.
Looks like they were selling the bundle and I was looking mostly at the basic Wii console package. If you don't mind 100%+ markup you can get the Wii on e-bay and from various other places. Even if they mark it up 270%, it's still cheaper than a PS3!

Linux to take over the desktop?

This topic is brought up quite a bit on the internet (google search), but there are some new reasons that we may see a greater takeover of the desktop.
Microsoft's new Vista is expensive, has too many versions,Vista requires a beefy computer,Vista's DRM is possibly killingitself.Microsoft has to lock down their operating system because of malware. This will make it more difficult for other software and hardware to work with Windows, and for users to set up their computer the way they want.
Compellinggaming consoles and increased PC graphic card costs may kill PC gaming.
The big advantage of PC gaming was that you had a better screen, a keyboard and the possibility of stealing games from the Internet. Also, you had a good excuse to purchase a kick-ass computer. Now with high definition televisions and gaming consoles with special remotes, all of a sudden installing games on a PC seems like a lot more work.Really super easy installs with the Synaptic package manager, and it'…

OLPC Presentation

Mark J. Foster gave a longish presentation about the OLPC ($100.00 laptop) project which you can watch here. It's one of the best explanations I've seen yet about the project and goes into some details of the hardware. I've mentioned before that this project can make sense solely as an e-book reader and Foster says that (vindicating my guess). He mentions that most countries spend more than $100.00 over five years in books for children, if they buy the laptop and download the books they would not only save money, but have something that does more than what paper books can do.
Other things that were new to me is that the laptop will have a light to see the keyboard. I already knew about the web cam but he gave a nice scenario about the first time you turn on the device. When you first turn it on, through diagrams and audio it help you take a picture of your face and creates an avatar. As others turn on their laptops and go through the process you should start seeing the…

Unscheduled layover in Dallas

My flight back to Brazil was supposed to be San Jose, Dallas, São Paulo, Belo Horizonte. The first leg I had 40 minutes to get to my next plane (which means that it's likely that my bags would not make it). We left the gate of San Jose maybe five minutes late and then sat around the tarmac for another 5 minutes, so we took off about ten minutes late. The Dallas airport is huge and we have to taxi for what seems like forever and it made us 15 minutes late at the gate. So now I have 25 minutes to make the connection - and there's no way my bags will ever make it.
Except I'm at the very back of the plane, it takes another 10 minutes to get off so now I have 15 minutes. I run to the area where the train is and it just leaves as I arrive. Another 5 minutes waiting - plus running for a few minutes. Finally, I get on the train and I see that I have a huge number of stops to do. I'm at terminal A and I have to go to terminal D, there must be 7 stops I'll have to do …

Halloween Costumes

Snopes has an interesting list of the most popular Halloween costumes. What I find interesting is that it appears that little girls overwhelmingly want to dress up as a princess, but when they grow up, they want to dress as a witch. But men and boys consistently want to be a pirate.

Country Codes

Wikipedia is my favorite source for all kinds of information and they did a nice job on the country codes. Unfortunately, the page goes by the name ISO 3166-1 so it's not as easy as it could be to find.
Link

Funny Web Search

Ms. Dewey is a really well done flash application that happens to do web search (badly). What makes it so compelling is the beautiful and funny Janina Gavankar who becomes your search avatar. The first search I put in was for "hammer" (I don't know why) and I was amazed that she actually pulled out a hammer! Turns out this is an experiment by Microsoft.
Here are more funny searches to try:
ho - gives a great bleeped out scree.you are so hot - try more than once.
illegal drugs - more than oncenude - do a few times and she'll undo a few buttons, bring out a crocket mallet.
george bushdance - try a few times, she'll do the robotrun - try a few times and a monster might chase herJanina Gavankarmurderstorm - she'll get rained onarts - shoots a paintballbeer - fills up a big beer mug.comicstvsafetychristmas
DiggMetafilter

Sorry for all the posts

I just realized that I've been posting to the wrong blog these past few weeks, so I'm copying all the posts over. Seems that google reordered my blogs so I kept clicking the first blog, which was the wrong one.

Another good programming post

I found this post via programming.reddit.com. It's Five Principles of Programming it's a long post but worth the read.

Take my research, please!

On of my favorite Canadians, David Suzuki (who wrote an article for my dad's magazine - Chimo!) wrote this article. In it he responds to complaints, by others, that some politicians have taken research that his foundation has published and and used it in their own policies (without reference etc.). Basically, his response is: take my research on enviromental and social concerns, please!

New Programing Styles

I just learned of two new (bad) programming styles I never hear of before:
Cowboy Programming :
"It is characterised by a single programmer jumping into the writing of the software often working from his own idea of what the software should do."Shotgun Programming:
"The way a shotgunner approaches programming is to blindly start shooting first and ask questions later. And when something does work, well, don't sit around worryin' about why, just start doin' it again!". I actually worked with more than one person who coded like that. If left alone for two weeks (on a problem that should take two days) I got code that worked (barely) but was so fragile and full of bugs that suggesting a change would bring tears to their eyes.

Making cool globe maps with Matplotlib

Image
My favorite plotting package combination (matplotlib, SciPy and Python) has a neat example how to use the 'basemap' toolkit to make maps. In 18 lines of code you have a globe. Another 12 you can show some cities and another 10 lines and you are plotting curves along the surface of the globe. Take a look.
via Simon Willison

The break-dancing chicken

Stevey Yegge has a long postrant about agile programming on his blog. It's a long post but it's funny as hell.
... I only had one high-level takeaway, one marketing message I wanted to get out to developers everywhere: It's OK to say No to Agile....Well, any time you find a community whose overall Humor Level is rated at "Homeland Security", it's a pretty good indicator that you don't ever want to have to deal with them. Ever.
As I've done for a great many other programming languages, I've bashed on Perl's technical weaknesses at length in the past. To my continued amazement, the Perl folks are the only ones who never get upset. They just say "Haha, yeah, boy, you're right, it sure is ugly. Heh. Yeah, so, um, anyway, I'm going to get back to work now..." It's awesome. I've gained so much respect for them. It's almost enough to make me go back to programming in Perl.

Well, almost.
If there's one thing I've lea…

Yooooooootube

So Google buys YouTube! I read the rumours, but didn't believe it. Google video is so much better. If Google would have waited a few more months it would just implode anyway (or Yahoo! would have bought it). Then I read that YouTube signed a deal with Universal, Sony BMG and CBS, well that sweetens things a bit, maybe. Truth be told, I have no idea why YouTube had become so popular compared to say, Google Video. Whatever the reason, YouTube got a great deal of the market and is a prime place for Google to advertise. Also, Google's purchase may have happened solely so that it's arch rival, Yahoo!, did not buy YouTube, and thus become the defacto leader in online video. In either case, online video is immensely popular and important and now Google is the leader, by far.

Hole in the Wall

Image
I came across this article from business week (2000!) it asks the question: "What would happen if you put a computer in a public place with a high speed internet connection?" The answers are surprising. Kids (mostly 6-12) in slums who can't read English were able to draw pictures, play music and browse the net. The computer had no keyboard and was protected behind a wall, and yet it was a success. Kids used it and when they suggested taking it away the parents said "no!". A failure, in my estimation, would have been if the computer was left running and nobody used it.
I think this bodes well for the OLPC project. The big difference is that the $100 laptop would be one kid's computer, a computer they can keep and take home. They can explore the world and their mind at their own leisure. They can download tens of thousands of books (from the Gutenberg Project, for instance) and you don't have to worry about the libraries budgetary constraints, or if …

Try Google Reader Again

If you tried the RSS feed reader called Google Reader before, and didn't like it (like I didn't), you should try the new version which has just launched, it's great. It works a lot more like Bloglines which previously was my reader of choice. But bloglines has lots of bugs and the user interface is pretty clunky. Google Reader is fast, AJAXy and has great keyboard support. I've stopped using bloglines and am now hooked on the Google Reader.

OLPC

Image
The One Laptop Per Child project has been going ahead steadily. There are sample boards and people are working on getting all the applications to behave properly so that it can go to sleep when idle. Lots of programs, including Python+GLib, wake up every 100 milliseconds making it difficult for the laptop to go to sleep and thus use less power. Fixes are in so that the programs that are installed on the laptop behave properly. The project is also creating it's own BIOS which doesn't use ACPI to suspend/resume, they want something even faster. There a tickless patch to the kernel by RedHat which should bring the laptop to less than 3 watts of power when idle.
In other news, India says they are going to make a $10.00 laptop, in three years! Yeah, right. By that time the OLPC laptop should cost around $50.00 anyway. My take is that India is still sore about their flopped attempt of a cheap laptop - the simputer, and their previous experience with the MIT media lab. They have…

New PostgreSQL Version

Version 8.2 of PostgreSQL is in beta now and is said to be 20% faster overall. It has a new Generalized Inverted Index which works well for text searches terabytes in size, and is the only open source database of it's kind which has this feature.

Shangri-La Update

Image
It's been a while since I posted about my diet progress, probably because I haven't been doing as well. I had two colds in a row and I found that I ate a little more during this period. I also missed a few days here and there because of weekends or other activities. Now working at Google I need to find a new routine. The least-squares fit line show's that I'm loosing about 1 pound a week which is pretty slow. I've started weight training twice a week so this might increase my weight a little bit (since muscle is heavier than fat). I'm still quite happy with the quality of the food I'm eating (although it's easy here in Brazil). Once I'm over this cold and into my new routine I hope to be back on track with this diet.

New Blogger Beta and New Layout

Since I'm working at Google, I need to eat my own dogfood - and I've moved over to the beta version of blogger.com. I've also changed the style which becomes wider if your browser window is wider, which I much prefer. The new version of blogger appears to be faster and nicer to use. I especially like the ability to add labels to each post - very nice.

Critiquing Nintendo's Wii Launch Details

This post has some problems with the Wii launch information. Scanning the comments below it shows that a lot of other people have issues with Nintendo as well. Here's my take on the whole issue:
$250.00 should include two remotes with nunchucks partly because the Wii is supposed to be a family console and a family has more than one person!
The remotes are probably very expensive: Bluetooth wireless, 3D motion detection, 3D spacial coordinates, speaker, and memory. Yet $60.00 for the pair is expensive. They should sell these things at a loss if it comes to it.November 19th launch. It's very odd that they are launching after the Sony PS3 (although only by a few days). It may be a brilliant move since Sony will spend tons of money for advertising and perhaps all the parents remember is that there's a new gaming console coming out. Also as it they both come out the press will be all over it comparing and contrasting the two (more free advertising).The article complains tha…

Real Media (rm) Download

I just listened to Winning the Oil Endgame given by Amory Lovins. You may also want to download the PDF which goes into much more detail and was written in 2005. Here's two snippets from the executive summary:
...The cornerstone of the next industrial revolution is therefore winning the Oil Endgame. And surprisingly, it will cost less to displace all of the oil that the United States now uses than it will cost to buy that oil....
...Investing $180 billion over the next decade to eliminate oil dependence and revitalize strategic industries can save $130 billion gross, or $70 billion net, every year by 2025....
In his talk he shows how nearly all oil dependance can be removed and no draconian policies or taxes need to be implemented. In addition saving oil by being more efficient makes you more profitable, we just need to make companies see the light.
His talk, amazingly, doesn't even cover wind-farms, nuclear energy or anything really exotic. The only 'cutting edge' tec…

Added AdSense

Since I'm going to be working for Google I though I would help their (our) bottom line by adding AdSense to my blog. I'm not sure if it's working or not, there's a blank space at the top my blog and sometimes there appears an ad (and sometimes not). Could be that the firefox addblock extension is blocking it sometimes, or that adsense hasn't decided what to put on my blog yet.

Wishful Nintendo Wii Speculation

The latest news is that the Wii will come out November 17th 19th and cost USD$250.00. This is a little different from my predictions which was late October and $200.00. I realized after the fact that I based my prediction on wishful thinking. I'm going to be in the US in October, so naturally I wanted it released in October. I thought they would offer a more expensive version with two Wiimotes, despite all the ads I saw on the internet with only one wiimote. It's obvious now that I just wanted to play together with my son, more wishful thinking.

What I'll probably buy right off the bat:
Nintendo Wii ($250.00)Extra remote ($35.00)Classic Controller ($15.00)Extra nunchuck ($15.00)Wii Sports (included)
The Legend of Zelda ($60.00)Red Steel ($50.00?)Total $465.00 so more than $500.00 with shipping tax etc.
Possibles
Metal Slug Anthology ($50.00?)Rayman Raving rabbits ($50.00?)The Wii will also include some interesting internet applications. A news and weather channel, and a ph…

Reverse Grafitti

Image
Grafitti by cleaning a dirty surface with a brush, soap and water:

Interesting in legal terms.
via boingboing.

My Nintendo Wii Speculation

This Thursday and Friday (Sept 14th and 15th) should be the days they announce the pricing and release schedule for the new game console Nintendo Wii. It's always fun speculating, so here goes my guesses:
The Nintendo Wii will sell for $200.00 USD with one Wii controller and one game (Nintendo Sports). I reason that Nintendo has sold their all their other consoles at $200 and they don't want to jinx it. Some have said it'll be $150.00 but I find that too close to their Nintendo DS price.For $250.00 you'll get two controllers and one more Nintendo game of your choosing.
The Wii will go one sale in North America at the end of October (around the 27th). I reason that they are worried about shortages and need the time to ramp up production. There will be shortages no matter what they do but if they stock up a bit before release it won't be as bad. For this reason they may even delay until early November.They won't have a worldwide launch. They may do the US an…

I got this googly feeling in the pit of my stomach

The cat is out of the bag, I'm leaving Sysmap to go work for Google. I'm happy are leaving on amicable terms, although it's a little like leaving your wife for a super model rather than, say, her sister. I had fun working here and in the cell phone industry (Telemig, Vivo, and Tim), but it's time to move on and do something exiting. Google is coming out with new and interesting programs every day and works in ways that I like:
hires smart people vs. people who match the job specification keywords,work hard to weed out bad hires early,give great machines to the developers (two 21" LCDs per workstation)etc.
Google Brasil is moving offices and I'll be starting work in their new digs. It's close to where I'm working now and I can even take the same bus to get to work - sweet.

Disney Fruit not as Stupid as It First Appears

Here's a CNN article mentioning that Disney will begin selling fruits and vegetables with Disney branding on it (i.e. Mickey, Goofy, Sponge Bob, etc.). It seems like a stupid idea but if you watched the NBC dateline segment called Food Fight you would have learned that kids overwhelmingly pick items branded with the characters they love.
First they offered the children cupcakes with either the American Flag or a picture of Spiderman or SpongeBob. The children always picked the SpiderMan or SpongeBob cupcake. Then they offered the children a plain cupcake or a banana covered with "spokes-character" stickers. Every single kid picked the banana[...] link

Three programs

DeVeDe is a nicely implemented Python program to create a DVD from video file on your computer. In a few clicks I had the first two episodes of the Sopranos burnt on a DVD with no problems. It takes a long time to build the ISO file and then you have to find it and burn it do disk, but it was otherwise painless.Peppy is designed to be an emacs clone built with wxPython. It's still early days yet, and is pretty ambitious, but the excellent Scintilla component does most of the heavy lifting.XML Copy Editor is a full featured validating XML editor with spell checker.

Unbutu, Linux - Act Different

Mark Shuttleworth's response to a little snafu last week is very laudable. I don't get this kind of public apology for larger mistakes made by other, larger, operating system companies.

Yay, OLPC 2B1 has no Caps Lock key

Image
I've cropped and rotated this image to get a good look at the 2B1 ($100 laptop) keyboard. You'll notice that the Ctrl key is in place of the Caps Lock key, some people will be happy! I'm happy to see the inverted 'T' for the cursor keys snuggled in close to the shift key, very nice. The backslash (\) key has moved next to the enter key. The enter key is a little farther away because of this but it's a nice big target. Dedicated help and Undo keys is very interesting, every program has that and it makes sense to have it on the keyboard. There are only 6 function keys which is quite a change from the standard 101 keyboard.
One thing I'm not too fond of is the Home/End/Insert/Delete keys on the cursor keys which you get to via the Fn key on the left. I would have used Home/End/PgUp/PgDown instead. And use the X a little to the left as a delete key, but that's just me. Overall I think it's a well thought out keyboard design that dares to deviate …

Blu-Ray and HD-DVD not doing so well...

It's with a great deal of schadenfreude that I announce that early sales of Blu-Ray (and HD-DVD) is dissapointing. Part of the reason is that these devices are very expensive, and a great deal of that expense is DRM. Another good reason is that people are loathe to buy more movies in yet another format. I still have VHS tapes that I would love if they were DVD, but it's too expensive for me to convert them and buying them yet again seems like a painful proposition.
Part of my schadenfreude is that IpredictedthatSony's upcoming PS3 will flop and I like to be proven right. Also, I've decided to buy a Nintendo Wii when it comes out and any competing consoles takes resources (i.e. game developers) away from my console. This wired article (Can the PS3 save Sony) also paints a bleak picture for Sony. The article goes on to say that they are banking a lot on the PS3 which they probably will be selling at a loss for quite a while. There are some rumours that the Nintendo Wi…

OLPC Update

Image
The $100 laptop
OLPC
CM1 (Children's Machine 1)
2B1 laptop project has some news. For one, it has a new name: 2B1. The 2B1 promises to have a built in WiFi mesh network - i.e. you turn it on and it connects and extends any nearby networks. It has a high resolution (1200x900 pixel at 200 DPI) screen that is usable in sunlight (unlike a normal laptop). They've got it working with less than 2 watts of power (very impressive). It looks like they are going with Fedora Linux (I was kinda hoping for Ubuntu Linux).
What's very interesting is that a 640x480 video camera will also be standard. It sports both a built in microphone and built in speakers plus separate jacks for both earphones and an external microphone. The microphone jack also doubles as an analog input for science experiments (which is wonderful idea). It would be cool if they could double the headphone jack as 5 V output as well.
I'm glad so see that this project has exceeded their original plans, it looks like …

Putting programs where you like in Linux

These days, to save a little money and the environment I turn off my computer at night and in the afternoon when I'm at work. With Gnome and Ubuntu you can tell it to start up programs on start up, but the windows don't appear in the right workspace. A little bit of searching and I found what I needed: devilspie
This oddly named1 program runs scripts which you write and put in your ~/.devilspie folder and (and need to name with a .ds extension). Having this program run at startup will watch windows and when they appear will put them where you asked them to be, on the workspace you ask it to be on.
The tricks I've learned is that to find out the position of a window run xwininfo and then click on the window you want to find out about. Listed in the output is -geometry in the format that devilspie likes.
Another useful trick it to create a file called, say, debug.ds with the sole contents (debug). This way if you run devilspie from the command line you'll get informati…

Another useful python script

Today I was helping a colleague debug a program and I found myself doing the same thing over and over. I would download the log from the server, zip the file and then e-mail the zipped file to him. The second time doing this I decided this is too much work so I wrote a little python program to do all the steps. Here's how it's run:

sendFile.py --mailto "Bob Jones" --comment "Here's the log you wanted" testserver:/aplic/jboss/server/default/log/server.log
It gets the file via scp (10 lines), zips it up (another 10 lines), mails it (11 lines using a helper class). and then cleans up the temporary files (3 lines).

Here's the code minus the stuff for talking to outlook (via win32com).

#!/usr/bin/env python

from subprocess import call
import os
import zipfile
import OutlookMail

class SendFile:
def __init__(self, dbInfo):
self.tempfilename = None
self.zippedfile = None

def getFile(self, filename):
fname = os.path.basename(filename)

Shangri-La Diet Chart

Image
Here's the complete code, you need pylab (i.e. matplotlib) to draw the graph.
# -*- coding: iso-8859-1 -*-<br /><br />from pylab import *<br />from datetime import date<br /><br />import os<br />import csv<br /><br /># Shangri-La diet at http://www.sethroberts.net/<br /><br />numDays = 50 # How many days ahead should we make the chart?<br />slope = 0.7/7.0 # 1 kilo a week = 1/7kg per day<br /><br />kg2lbs = 2.2046226218487757 # From frink calculator http://futureboy.homeip.net/frinkdocs/<br /><br />vals = []<br />for datestr, weight in csv.reader(open("myweight.csv")):<br /> year, mon, day = datestr.split('-')<br /><br /> vals.append((date(int(year), int(mon), int(day)), float(weight)))<br /><br />startDate, startWeight = vals[0] # Get starting info<br /><br /><br />days = [ (x[0] - startDate).days for x in vals ]<…

Simple compile on a remote machine

Normally, I try and compile and run programs locally and then upload a working, tested version to the final machine for more testing. This time, however, it was too difficult to compile and run it locally, and I needed to run and test on one of the HP servers. I set up my ssh account so that I could copy file without a password as shown here. But it was still more work than I wanted to do. Edit - Save - Switch local command line and copy - switch remote server make - run, repeat.
So I wrote a little python program to upload only files I recently updated and to compile and run on the server. It's all setup in SciTE so that F5 does it all and the output goes in the errorlist window. I can even press the F4 key and go directly to the first error, if any.
<br />#!/usr/bin/env python<br /># -*- coding: iso-8859-1 -*-<br /><br />from subprocess import Popen, PIPE, STDOUT, call<br />import os, re<br /><br />host = 'kangaru'<br />t…

My linux prompt

Just a note to myself. This is what I'm putting in my .bashrc file for the prompt
PS1='-- cd \w --\n[\u@\H] $ '
export PS1Looks like this:
-- cd /home/scott --
[scott@sysbh17] $ _
I put the cd in there so I can copy and paste to older directories even easier. I also like to put my prompt on two lines with the path first so that I don't get punished for long paths.

Links:
The Bash Prompt HOWTO has more informationAnd Giles Orr has more samples.

Shangri-La Diet Update

Image
The diet is still working for me. A trick I found was to 'dilute' the oil with some water (like a vinaigrette), making it a little more palatable to drink. I'm eating less and eating a lot better, which I'm really happy about. Even if the diet isn't working at least I'm eating better! I was hoping to loose about 1 kg (2.2 lbs) a week but I'm loosing more like 0.7 kg (1.5 lbs) a week instead. I've added a least squares fit to the chart as you can see above. Tomorrow I start exercising as well, which I haven't been doing hardly at all.

Shangri-La Diet Update

Image
The diet continues, but the weight is not going down as fast as I was aiming for; I may have to increase the amount of calories slightly. On the plus side, I'm still eating quite a bit less and I'm eating a lot better. I'm finding that a plate of salad looks very appetizing and I'm having lots of legumes (beans, basically) at each meal. I sometimes feel really stuffed at meals (which is probably why I've not been loosing as much weight!).
Update: For those more used to pounds, I've added that to the chart (the chart is made with matplotlib and Python)

Choo, Choo - here comes the trainreck

This week was a doozy for the PS3. First we hear that PS3 owners will need to by an adapter if they want to play their PS2 games. This means that PS2 owners will need to keep their old PS2 around or fork out the money. For a game console that's already in trouble, this seems to be a bad move.
Then later this week we learn that the Blu-ray drives won't be able to play Blu-Ray movies. Getting a free Blu-ray player in the PS3 was one possible excuse for blowing $600.00 on this console. Now that even this reason is gone I think spending that much money on a console that is unlikely to succeed is risky indeed.

More Wii good news and bad news for PS3:
Wii's MASSIVE Launch Lineup: 27 TitlesWii development costs 1/4 to 1/2 of PS3/360FROM software PS3 lineup cancelledNext Gen Titles in Development
Update: It's Sony's Blu-ray drive that can't play videos not the PS3, oops.

Shangri-La Update

Image
Well the diet hasn't gone as well the past few days. One excuse is that I went to a party and had some beer, chicken wings and other foods I haven't had in a while and overdid it a bit. Also, at home we've been having home-made french fries and I couldn't resist.
But there are two more reasons that I think it wasn't working as well as it was before. Before I was more careful in measuring out the two tablespoons of oil. Later I just used a soup spoon. But I testes the soup spoon and it appears to hold about 1/2 of a tabelspoon. Another reason I think the diet wasn't working was that I was taking Fish Oil pills. I figured that I could take them with my sugar water with no problems but I found that soon after I had a kind of pleasant fishy breath. And I was starting to look forward to this fishy breath feeling after a few days. I think that shows that the pills were starting to count as a 'taste' and ruining the diet a little.
Another thing that changed a bi…

My Nintendo DS Reviews

Image
I have the Nintendo DS and the Nintendo DS Lite handheld games and am very happy with the purchase. My son and I play against each other regularly and it's fun, the other day I tried playing on the internet using my new WiFi connection and that was mixed. It took a while to find a game to play. The games I have are:
The New Super Mario Bros. - Excelent game, great valueNintendogs (Retriever) - I bought this one because my son wanted a dog. He hasn't played it hardly at all and neither have I. Looks like too much work.Mario Cart DS - This is a fun game, but I wish there were more race tracks. One nice thing is you can play against a friend even if they don't have the cartridge.Metroid Prime: Hunters - Very good FPS with some puzzle solving. You play using the pen like a mouse and the + pad for movement. You can play against others over the internet. I tried it once was was totally outclassed by my opponent.Viewtiful Joe: Double Trouble - Very fun game, perhaps the …

I´m pageranked higher than I thought

The other day I needed to get the São Paulo address of the company that I'm working for (Sysmap) and to my surprise, my name came up before theirs. My guess is that I've been careful to keep my résumé in the same location at the same site and that's what it's finding. For Andyne Computing (where I once worked but doesn't exist anymore) you'll find my name on google's second page. By strange coincidence, if you try "queen's bishop's university" you may see my name mentioned because I got an NSERC grant (but no link to my résumé).
So it pays to put your résumé on the Internet (I've had at least 3 calls because of it). I've used Monster Jobs and other job hunting sites in the past and found them to be effective for maybe the first week. It seems that employers are looking only for people who recently put their résumé online.

SLD Update

Image
Yesterday was interesting, I woke up and didn't feel like breakfast. Had lunch, not very much as well. Then in the late afternoon somebody opened up a package of wafer type cookies and everybody had some and it didn't interest me at all. I just looked at the ingredients and commented that the ingredient list starts with sugar, flour and vegetable oil. I guess what is nice about this diet is how much self control you seem to have. It's easy to pass up on the junk food. It's easier to have a second helping of salad, that seems to be more appealing now.
I'm having more of the fish oil (6 grams of oil=6 pills) and started on vitamin C too (2 grams a day = 4 chewable pills). My desk is starting to look like a drug store.
If you are interested in the book Fantasic Voyage: live long enough to live forever, you can find a great deal of information at their site. You can buy the book, but It's the size of a dictionary and has almost too much information (and seems to…

Not using XGL anymore

Well XGL and Compiz was fun, but I'm not using it anymore. What disappointed me was that playing games was hit and miss (mostly miss). If it worked at all, it would run at 2 frames-per-second. My son would ask to play a game on my system and I would have to tell him that it didn't work, or we would try one and be disappointed. Another thing I didn't like about Compiz was the it took over some common keys like F8 for it's own purpose, or if used the scroll-wheel too close to the edge it flipped the window.
When I tried to go back to Gnome the programs started but without window borders! Eventually I figured out that I could open a terminal and type "gnome-wm &" to start the window manager. Then I would tell the session to save the session so that this program would run the next time. What a pain to figure this all out. Maybe in a few months these issues might be wrinkled out and I'll go back to XGL.

Shangri-La Diet Update

Image
The fantastic voyage book recommends fish oil because it is high in EPA and DHA. I'm taking (only) six capsules a day which according to the label is 1080 mg of EPA and 720 mg of DHA. Since it's in capsule form it doesn't have any taste so it should be OK for the Shangri-La diet. Unfortunately, 6 capsules is only 60 kcal (according to the label), so it's not a lot of calories. On the plus side these pills are cheap, not everything that Kurzweil recommends you do is inexpensive. The first time I took a fish oil pill I didn't have a glass of water and I found it very hard to swallow. By the time I got to the kitchen to get some water the gelatin capsule had started to melt and I could begin tasting the oil. Tastes like something my dog would roll in.

Looks like I may have gained a little weight this weekend and my birthday (see the chart). Yesterday I got home and realized I wasn't hungry, and this morning at breakfast I didn't feel like eating anything so…

Python is just too easy

The other day I needed to create an HTML form for an online questionnaire I'm writing for my wife. I thought that I would look for some online Python library for something like this. After a few minutes of searching I didn't find anything that caught my fancy. I thought about it and realized that I don't need anything fancy, I just wanted to be able to make the necessary tags quickly, easily and safely. Writing the code only took a few lines:
<br />from xml.sax.saxutils import escape, quoteattr<br />def makeTag(tagname, dict, bClosed = True):<br /> list = ['%s=%s' % (x, quoteattr(str(y))) for x, y in dict.items()]<br /> if bClosed:<br /> return '<%s %s />' % (tagname, ' '.join(list))<br /> else:<br /> return '<%s %s>' % (tagname, ' '.join(list))<br />
The close tag is even easier:
<br />def closeTag(tagname):<br /> return '</%s>…

How the DS beat the PSP

How the DS beat the PSP (and how the Wii will do the same against the PS3) is a article I'm in complete agreement with. Basically, the PSP is too expensive and so it will be for the PS3 as well. Parents and kids will compare the two machines and will decide that they can get far more bang for the buck buying a Nintendo DS or Nintendo Wii than a PSP or PS3, respectively.
Of course price isn't the only thing and the PS3 is far more powerful than the Wii. Also for those considering buying a blu-ray player the PS3 almost looks like a deal. But even there I think there will be some sticker shock, I don't see Blu-ray movies selling for cheap and I predict the PS3 games are going to be more expensive than the Wii games (on average). A consumer might total up the PS3 plus a few games plus a few movies and compare it to the Wii and a lot of games and have money left over to buy an HD-DVD player and even more movies.
On top of that there's a good chance that Sony might stumble …

Noise cancelling earphones really work

Image
At the duty free store I bought these noise cancelling earphones for the plane. It's not perfect, but it does a great job of cancelling most of the noise. Now I walk around town with these things (I know, I look like a dork), but it's wonderful not having to crank up the volume to 11 just to hear podcasts. The batteries last a very long time (weeks for me) unless I forget to turn them off.

Shangri-La Diet Update

Image
I went and bought a scale So that I can keep track of my Shangri-La Diet (SLD). I also wrote a little python program, using Matplotlib to draw a chart showing my progress as well. I don't know what my real starting weight was, since I bought the scale a week later. I thought it might be 100kg but 99kg produced a nicer graph. My target is about a kilo a week (2 pounds). I'll post new graphs every few weeks.

Why it's important to read the source

Somewhere I saw a post mentioning The Environmental Paradox of Bicycling (pdf), hinting that bicycling may not be the the best solution of our environmental woes. So I read the article and it's conclusion was that bicycling may not reduce the environmental impact because -- people will live longer. In other words, bicycles are more efficient than single occupand vehicles and it's better for people, the problem is that when people get exercise they live longer, and people who live longer use more resources than those who die off earlier.
I suppose that Bush save the environment even more by encouraging everyone to take up smoking, so that they die off sooner.

Weekly del.icio.us bookmarks

Shared bookmarks for del.icio.us user scott_kirkwood
Non-Errors in English -- tagged as: [english language grammar reference]SourceForge.net: GTK Ora -- Free Oracle frontend tagged as: [gnome opensource oracle tools]Python Web frameworks, Part 2: Web development with TurboGears and Python -- TurboGears tutorial on IBM's developer network tagged as: [article programming python tutorial]Istanbul - GNOME Live! -- Create a screencast in python (creates Ogg & Theora) tagged as: [flash graphics gnome linux opensource screencast python]Javassist -- To do metaprogramming in Java tagged as: [java library opensource]Video Encoding - FlowPlayer -- Encoding FLV files on Linux tagged as: [linux flash video]

Shangri-la Diet Update

It's been less than a week and I'm already seing some improvements. I noticed that my pants were a little too loose, so I tighted my belt. It was a belt hole that I had never used before!
So these are other things I've noticed:
Eating less sometimes it's like 1/2 other times or like 2/3rds from normal.I find that the healthier foods are suddenly a lot more appealing to me. Perhaps since I crave less calories I'm not diving for the meats as much.I'm drinking a little less. Normally I would drink two glasses of wine, now I'm happy with just one.I'm eating slower than before. I normally ate more than everyone else and finished first, now I'm eating less and finishing almost last. I'm chewing and savoring the food more.
I'm not more tired or groggy and I'm sleeping normally. I would have expected eating less calories would make me tired, but it hasn't at all.I prefer the oil to the sugar water. I take the sugar water at work, but I…

Weekly del.icio.us bookmarks

Shared bookmarks for del.icio.us user scott_kirkwood
Sugar - OLPCWiki -- This is the interface to the OLPC project. tagged as: [olpc graphics]Mondo Rescue - GPL disaster recovery solution -- I really need to do a backup..... tagged as: [backup dvd linux tools]http://nexgenwars.com/ -- Digged, look at the console sales in real-time? Unfortunately, only XBox 360 is selling (PS3 & Wii to come). tagged as: [games toread]Edgewall Software: Python Sidebar -- tagged as: [development extension firefox python reference]kbarcode.net: Home -- Print barcodes, may be useful if I get a barcode scanner. tagged as: [linux software barcode util]TAZ Forum :: A Computer, Gaming, and Social Network Community of Friends :: View topic - Tutorial - Spiffing Up Ubuntu 6.06 -- Alright, maybe I'll finally try out XGL tagged as: [graphics linux setup ubuntu]http://everythingisnt.com/hosts -- hosts file to block adds etc. tagged as: [computer linux security]DropTeam Current News -- Has tanks tagged as: …

Shangri-la Diet

I've started my first ever diet. Of course, I have been trying to eat well but never followed a diet in a book before. The Shangri-la Diet appeals to me (as a programmer) since it's more like a brain hack. The idea is that there is a trick to lower your "set point" the point a which you feel full and at the weight that your body wants to be. If you lower that point you eat less, if you eat less you loose weight. You'll never feel hungry because you are eating until you feel full, as you would normally. This diet has a lot of advantages:
There no restrictions on what to eatIt's cheap (practically free)You simply add something to your daily intake, sort of like taking a medicineIt's perfectly safeYou never feel hungry
You can choose how much weight you want to loose you can adjust things as you go alongIt's fast, you'll notice a change in eating habits in a day (or two).If you go off the 'diet' you wont bounce back to your old weight as …

Shortest Sudoku solver in Python

Mark Byer's site has some more Sudoku solvers here's a short one in Python that's only 178 bytes long:def r(a):i=a.find('0');~i or exit(a);[m
in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for
j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18]
from sys import*;r(argv[1]) On the site is also shown a longer Perl version at 185 bytes:
use integer;sub R{for$i(grep!$A[$_],@x=0..80){%t=map{$_/27-$i/27|$_%9/3-$i%9/3&&amp;amp;amp;$_
/9-$i/9&&($_-$i)%9?0:$A[$_]=>1}@x;R($A[$i]=$_)for grep!$t{$_},1..9;return$A[$i]=0}
die@A}@A=split//,<>;R I think the Python version is slightly easier to understand, although they are both quite cryptic.
I'm not sure why I find these programs fascinating. I think it reminds me that any program can be written in such a way that it's cryptic, even in Python. In addition, the code is small enough that you should be able to figure out how it works, and may learn something the process.
Related is:
how to sol…

Python 2.5 in beta

Somewhere in August is expected the stable release of Python 2.5. This version has some additions that I welcome:
The excellent sqlite3 library is included as standard (called pysqlite). Sqlite is a great, SQL database that supports a great deal of the SQL92 standard (more than many commercial databases). It's nice that it'll be available for any Python installation and should introduce beginners with some good SQL practices. Also, the database is very fast and uses only one file. Programs like Amarok use SQLite. The only problem I've experience with SQLite is it's lack of backwards compatibility. I you point a pysqlite3 program to a sqlite2 database it'll just complain.
ElementTree, this is a great library and it's great that it's part of the standard distribution. The C version is particularly fast and uses very little memory. What makes this library so great is that it's very intuitive and has read/write access. For some projects I was using …

Red Had Summit Videos

Image
If you haven't seen Cory Doctorow's dog and pony show, you should. There are some other videos here which are interesting as well.

AMD stock goes down?

Image
I was a little surprised that AMD's stocks went down today because of a small forecast warning for the next quarter. I like the AMD chips (more than the Intel chips) because they are faster and cheaper and came out first with a good 64 version (although for laptops I hear the Intels chips are cooler). What I really interests me in AMD is:
Their support for the OLPC (aka $100 laptop). They are making 1.0 watt Geode chips for this device.
Oops, I thought AMD was making the chips for the Nintendo Wii, but I got confused with ATI (which AMD is sometimes rumored to buy).
AMD signs a deal with Dell. Although Dell is months late in doing this and they are probably only doing this to strong arm Intel.Google may be switching to AMD chips. It makes sense for Google to go 64 bit since it may make some algorithms simpler (and would allow machines with more than 2 GB of RAM).

Barcodes in the news

Way back before there were many laser printers I wrote a piece of software (for fun!) to print out barcodes on a dot matrix printer. Ever since then I've been somewhat interested in barcodes, I guess it's the idea of organizing my life.
Some recent links:
Somebody decided to make barcodes more beautiful. Here's there's a free, community based database of barcodes (barecodepedia) If I write a program to keep track of groceries (or whatever) I'd put and get the information from here. I've been looking to print out barcodes and slashdot people appear to recommend kbarcode for linux.My idea is to have a book of barcodes for commands. Use cases:
Add a book
Scan "My library" barcode found in book, to put the program in that mode.Scan "Add Book" barcode to put the program in a mode to add a book that's in my library.Scan the book's ISBN andCheck if the ISBM is already in my library, if notGet book information from Amazon.comCheckout a bookSca…

Xgl for Linux is cool

Image
I've been avoiding adding Xgl since I normally have problems with my dual head setup, but I tried it a lunch and it works brilliantly. I followed TAZ's instructions and worked the first time.
It actually has some features which are a bit more than just "eye candy":
You can easy fade out (make transparent) your current window. This is useful to type in text from another location that happens to be hidden underneath the current window.Switching desktops is so much fun that you are more likely to use it.The non-active window is darker than the active window. With lot's of windows open on two screen it used to happen that I would type in the wrong window, this should happen less often.
Magnify. Here you can magnify what you're looking at temporarily. My eyes aren't as young as they used to be, so this can be useful.There is more movement when windows to come up, which help get to your attention.

Weekly del.icio.us bookmarks

Shared bookmarks for del.icio.us user scott_kirkwood
The Linux Action Show! Podcast -- To add to podnova. tagged as: [podcast linux]Fcron : a periodical command scheduler for Unix and Linux systems -- A cron that works assuming your machine is not turned on all the time. tagged as: [linux util tools]ardour | the new digital audio workstation -- Competitor to audacity? tagged as: [audio tool linux opensource]Boodler: a programmable soundscape tool -- Make pink noise and other sounds with python. tagged as: [python tool linux audio]Classic Texts In Computer Science -- tagged as: [article books free library reference research computer]Enlightened Gnome: The Ultimate in Ubuntu Eye Candy - Ubuntu Forums -- How to install E17 and E16 tagged as: [linux ubuntu enlightenment]Snowball -- Word stemmer for various language and language types. tagged as: [algorithm library python programming]HardInfo -- System information plus some benchmarks in a GUI tagged as: [hardware tools linux]GNOME Sudoku