Latest News
With a small bit of scripting, I have created a cron task on my XO laptop to take pictures every minute and upload them to taskboy.com. You can see the result on my spycam page.
The camera is positioned in a second story window looking out on my amazing backyard. Will you see a deer? A cat? Chupacabra? You'll have to keep coming back to find out!
The script on my XO looks like this:
#!/usr/bin/perl -- -*-cperl-*-
use strict;
use POSIX qw[strftime];
my $outfile="foo.png";
my $web_dir="/path/to/spy";
my $ssh_id = q[user@myhost.com];
my $remote_name=strftime("%Y-%m-%d_%H-%M-%S.png",
localtime());
my $delete_horizon=7;
# Take the picture
my $cmd = qq[gst-launch-0.10 v4l2src ! ffmpegcolorspace ]
. qq[! pngenc ! filesink location=$outfile ]
. qq[> /dev/null 2> /dev/null];
system($cmd);
# Is this picture mostly empty?
if (-s $outfile < 80_000) {
exit 1;
}
# Upload to taskboy
$cmd = qq[scp -q $outfile $ssh_id:$web_dir/$remote_name];
system($cmd);
# Remove old link ; relink to new file
$cmd = qq[ssh $ssh_id 'cd $web_dir && rm current.png;]
. qq[cd $web_dir && ln -s $remote_name current.png'];
system($cmd);
# Remove older pictures
$cmd = qq[ssh $ssh_id "find $web_dir -name '*.png' ]
. qq[-ctime +$delete_horizon -exec 'rm' '{}' ';'"];
system($cmd);
# Remove local file
unlink($outfile);
In other news, did you know the XO appears to have sshd running by default? Very useful for those of us that just want a command line anyway.
I am at the very pinnacle of 1997 technology.
The built-in webcam in the XO laptop fascinates me, in the same way parrots are fascinated by mirrors. I like to pick at it to see what I can do. I've been trying to find a simple command line invocation to take a picture and I have found it here:
gst-launch-0.10 v4l2src ! ffmpegcolorspace ! pngenc ! filesink location=foo.png
Please note that the first parameter in that list is in all caps V4L2SRC, not V412SRC, as this post points out. That typo caused no little end of annoyance for me.
This command snaps a photo and creates a PNG file called foo.png in the current directory.
The key to understanding video on the XO is learn about GStreamer, a Gnome multimedia interface that works on pipelines. That is, you build up commands with gstreamer like you uses command pipes in shell programming. Obviously, if you're not familiar with shell programming, GStreamer is likely to be quite opaque for a while.
In any case, GStreamer can be used to capture pictures, video and audio. It can also play audio files and stream video to other servers. Pretty strong ju-ju.
Also see this python hack for making the XO into a spy camera.
Behold: Ubuntu Linux on the XO laptop!
Since I already had an 8GB SD disk for my XO, I had the storage capacity to handle the new distro. I did need to apply for a developer key, which is needed to unlock the openfirmware "BIOS" system build into the XO. For reasons that aren't clear, it took 24 hours to generate the key.
While I appreciate the accomplishment of the default Sugar interface (I've got the latest 707 build running), I find that it gets in my way more than not. And it seems a little too pokey.
Ubuntu has a build just for the XO that uses the lightweight XFCE shell and comes with Firefox. Aside from that, there's not much in the way of apps for this system. For instance, no Flash support for Firefox. Also, I'm sad that I lost the camera functionality. And pygame isn't installed. All of these things are correctable, of course. The XO makes a pretty servicable netbook.
Picture of me at the Javaroom in Chelmsford taken with my Macbook's Photobooth app. Compare to the one I took here with my XO.
UPDATE: The Chelmsford Public Library is #^(%ing great. It's clean, brightly lit, full of electrical outlets and WIFI! Of course, PPTP, FTP, SMTP and some other ports are blocked, but not SSH. W00t!
Although the XO laptop is constrained on memory (256M), it has a lot of hardware features.
I shoved a 2GB USB drive into the XO, along with an apple keyboard and an MS optical mouse. I wanted to record a video with the Record activity, but I was low on disk space. Most of the pre-installed "activities" save files in /home/olpc/.sugar/default/org.laptop.[ACTIVITY]. I simply repointed org.laptop.RecordActivity/instance to /media/KINGSTON. That gave me room for videos. Unfortunately, the RecordActivity seems to allow only 45 seconds of video to be recorded. That's not really true. It only *offers* you 45 seconds. Since most of the sugar UI is python, and the RecordActivity is python, I was able to add the following to /usr/share/activities/Record.activity/constants.py:
DURATIONS.append(600)
That changed the UI to allow 10 minute recordings.
I'd like to hack the UI to tell me the filename of the recording. That's not too much to ask, is it?
Also, I'm using my emacs blogging tools from the XO to write and publish this. That means I had to shove Perl and GPG on here. It's getting pretty crowded on the 1GB drive.
Another note to jjohn: since you can't figure out how to import keys into gpg, just move the *gpg files in the blog project to where gpg expects them. Not you. No one cares where you think these files should go. This is the second blog post I've had to make to you about this. Perhaps you need to write an article about using GPG so that you don't forget again? Still, GPG bets the hell out of X509 certificates. What a bureaucratic nightmare those are.

Well, here I am at the Javaroom in Chelmsford with my XO. It's a cool, if underpowered little device. It continues to draw more attention than even those fancy mac Air notebooks. I think its the lime green rabbit ears. Or maybe it's my own rabbit ears.
The file upload HTML widget works weirdly on the Browse Activity. Recall that the XO attempts to hide the filesystem from the user and instead has a "journal" that remembers everything you did. So the file upload, instead of presenting a file chooser dialog, presents this weird version of the journal.
Must get firefox on this bad boy someday...
Still, I can blog from my XO.
I'm waiting at SFO for my flight back to Boston. I'm about 6 hours early. Well, I wasn't that early until my flight got delayed. Then I switched flights. bah.
As I'm on a business trip, I'd like to note how badly business folk get ripped off on trips. After health care, it's America's most important crisis.
Also note that I'm blogging this from my XO laptop. Apparently, it works with tmobile just fine. The keyboard is pretty unusable for any serious work.
Wish me luck.
UPDATE: Given the time on my hands, I started playing with this XO laptop. Amazingly, I was able to install the pptpclient from Fedora without too much trouble. That means, given a more solid net connection, I could use this laptop for business as a thin client! Wow.
I also installed Doom and SimCity. Where's my O'Reilly interview?
About this blog
The taskboy blog is a exploration of computer technology by Joe Johnston. Topics of posts include practical examples Perl, PHP, Python and Java as well as book reviews, industry insights and miscellaneous good stuff.
Current Status
Watching _Brass Latern_. Ah IF, your coyness is your charm.
Posted: Sun Sep 05 16:02:15 +0000 2010
Latest Feedbag
- Do It Anyway
- Reader recommendation: Atlas, Schmatlas
- Scientists Cut Greenland Ice Loss Estimate By Half
- (Video) George Parker: Agencies Need To Buy Themselves Back
- Android Is As Open As The Clenched Fist Id Like To Punch The Carriers With
- Eden Ventures Joins The Super Angels Gang, Five Investments Down
- Human Translation Startup myGengo Raises Seed Round From International Investors
- Another Instant Music Video
- DARPA Wants Extreme Wireless Interference Buster
- Film Industry Hires Cyber Hitmen To Take Down Pirates
Generated: 04:52 on 09/Sep/2010
Recent posts
- Very quick git primer for basic functionality
- Tips for spammers: don't insult me
- CakePHP vs. Symfony: a quick note
- Creating events for Yahoo and Google calendars
- SANs on a budget: iSCSI under Ubuntu
- iPad, iTouch and Kindle: Which is the better mousetrap?
- Rise of the Ad-Hocracy, Part II
- Rise of the Ad-Hocracy, Part I
- Small Hiatus
