Posts

Showing posts from August, 2006

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...

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 named 1 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 ...

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....

Shangri-La Diet Chart

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

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. #!/usr/bin/env python # -*- coding: iso-8859-1 -*- from subprocess import Popen, PIPE, STDOUT, call import os, re host = 'kangaru' todir = '/mnt/bmp/files/fontes/agglutldp' okFiles = [re.compile(x) for x in (...

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 PS1 Looks 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 information And 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 Titles Wii development costs 1/4 to 1/2 of PS3/360 FROM software PS3 lineup cancelled Next 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 b...

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 value Nintendogs (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, per...

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 ...

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...

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: from xml.sax.saxutils import escape, quoteattr def makeTag(tagname, dict, bClosed = True): list = ['%s=%s' % (x, quoteattr(str(y))) for x, y in dict.items()] if bClosed: return ' ' % (tagname, ' '.join(list)) else: return ' ' % (tagname, ' '.join(list)) The close tag is even easier: def closeTag(tagname): return ' ' % (tagname) And here's some example code where it was used: for n, radio in enumerate(question['questions']): lines.app...

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 stumbl...