Hacking the eeePC
Run Leopard on the Asus eeePC? I can’t imagine that Apple will ignore this.
Run Leopard on the Asus eeePC? I can’t imagine that Apple will ignore this.
Someone asks what if Apple released OSX for the PC? I can’t see it happening, mostly because random PC hardware tends to suck1.
For anyone who doesn’t like iTunes, YamiPod v1.0.2 beta 1 is available. YamiPod is available for Linux (Gtk), Windows, and Mac OSX.
The Top Ten Most Beautiful OS X Apps. Some examples of great looking OSX applications. Is the eye-candy good for you though?
Nine things KDE should learn from Mac OS X, a contrast of the noisy (but configurable) popular Linux desktop environment and OS X.
Mac OS X System Startup. I’m sure that I’ll need to know this someday.
I made my first panorama today, stitching together a few pictures I took hiking last weekend. I used the hugin panorama tools, which are freely available for Linux, Microsoft Windows, and OSX.
This is a wider view of one of our favorite hikes in the area. The raw image measures 4,800 pixels wide (after cropping), which combines the two 2,400 pixel source images. I only used 7 control points in this test, so a few of the seams are slightly visible. Had I doubled the number of control points (or used a tripod), the image would have been seamless.
The wider view was created by stitching two hand-held digicam shots together. The process allows any number of images to be merged, but I only had two useful shots that overlapped. Here are the source images (scaled down a bit):
| panorama_part_1.jpeg | panorama_part_2.jpeg |
First off, I suggest you read the tutorials on the hugin panorama tools home page. It’s a complicated tool, and it took me a few passes before I understood what it was doing.
Take some pictures that overlap (by hand, or on a tripod). Copy the images to a temporary directory.
In the tool, add each image and tag with the overlap information. Use as many points as you can find between each image, as the tool works better with more control points.
Process and wait. 2 images, on my 2Ghz laptop takes about 3 minutes to process.
The software does a great job, and can stitch hundreds of images together. I’m going to try a few more complicated panoramas on the next hike, and maybe a few with my tripod at home.
I hacked together a few WordPress plugins today to add support for the MediaWiki linking syntax. The first plugin, wikifier.php, adds support for double-square-bracket wiki links (to a default wiki, or the specified wiki. The second plugin, magiclink.php adds single-square-bracked external-wiki links and Google I’m-feeling-lucky, similar to my MagicMarkup plugins for Blosxom, which I plan to port in the next few weeks. For now, the plugins can be downloaded here … sometime in the future, I’ll setup a wiki page for my WordPress plugins and hacks.
WordPress has a decent plugin system. It’s a basic callback registration system with priorities, and has many exposed function points. It’s a better approach than Blosxom, mostly because the plugins can be ordered by priority (handy for text filters). It’s in PHP though, which reminds me of my days working in GWBasic and DBase. PHP seems so akward compared to Perl, Java, and C++ (but it’s workable).
I’m working on extending Textpattern with some scripts I developed for Blosxom. Textpattern is a Php-based weblogging tool, and my scripts are all Perl-based plugins and command-line utilities. I don’t really want to port the scripts to Php, so I decided to find a way to call Perl from Php.
In a few minutes of searching, I only found one Perl binding for Php. It isn’t considered stable, and it isn’t available from my web host (Dreamhost). I did find an answer in the Php manual, but a googling on the specific topic of calling Perl from Php came up dry. So I decided to make it a bit more obvious.
All of my scrips are simple text processors, so the inputs and outputs can be passed using the stdin/stdout pipes. Using both the input and output pipes of a process is a bit more than the standard Php exec functions can handle, so we’ll be using the proc function family. Nearly every language has a set of these functions (and that’s a good thing).
You can download the demo script here. The script will need to be executable, it needs the correct path to the Perl interpreter, and the log file folder needs to be writable by the web-server process.
The Perl script reads text from stdin, and replaces spaces with underscores. From Php, we can call the Perl script and manage the standard in, out, and error pipes. The example is slightly modified from the Php manual.
The basic process:
The PHP script:
< ?php $handles = array( // 1 0 => array("pipe", "r"), // stdin 1 => array("pipe", "w"), // stdout 2 => array("file", "test-errors.txt", "a") // stderr ); $test_text = "This is a test"; $process = proc_open("./test.pl", $handles, $pipes); if (is_resource($process)) { fwrite($pipes[0], "$test_text"); fclose($pipes[0]); while (!feof($pipes[1])) { $output .= fgets($pipes[1], 1024); } fclose($pipes[1]); $r = proc_close($process); echo "Before: $test_text<br />"; echo "After : $outputn<br />"; } ?>>
And the perl script:
#!/usr/local/bin/perl
# replace spaces with _s in stdin
while(<>) {
s/ /_/g;
print;
}>