[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

Hacking the eeePC

[Comment]

January 27th, 2008 in Links

Run Leopard on the Asus eeePC? I can’t imagine that Apple will ignore this.

What if, another Apple rumour

[Comment]

November 2nd, 2007 in Links

Someone asks what if Apple released OSX for the PC? I can’t see it happening, mostly because random PC hardware tends to suck1.

  1. Drivers, MOBOs, flakiness, and other pain+suffering

Freeware, multi-platform iTunes replacement

[Comment]

January 21st, 2007 in Links

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.

Candy and application design

[Comment]

July 7th, 2006 in Links

The Top Ten Most Beautiful OS X Apps. Some examples of great looking OSX applications. Is the eye-candy good for you though?

Things KDE can learn from OS X

[Comment]

April 7th, 2006 in Links

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

[Comment]

November 19th, 2005 in Links

Mac OS X System Startup. I’m sure that I’ll need to know this someday.

Making Panoramas

[Comment]

May 1st, 2005 in Art. Projects. Weblog

I made my first today, stitching together a few pictures I took hiking last weekend. I used the , which are freely available for , , and .

The panorama

fire_creek_panorama.jpeg This is a wider view of one of our favorite 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 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
panorama_part_1.jpeg panorama_part_2.jpeg

The process

First off, I suggest you read the tutorials on the home page. It’s a complicated tool, and it took me a few passes before I understood what it was doing.

  1. Take some pictures that overlap (by hand, or on a tripod). Copy the images to a temporary directory.

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

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

WordPress Link Plugins

[Comment]

January 2nd, 2005 in WP-Plugins

I hacked together a few plugins today to add support for the 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 plugins for , which I plan to port in the next few weeks. For now, the plugins can be downloaded … sometime in the future, I’ll setup a wiki page for my plugins and hacks.

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 , mostly because the plugins can be ordered by priority (handy for text filters). It’s in though, which reminds me of my days working in GWBasic and DBase. seems so akward compared to , , and C++ (but it’s workable).

Calling Perl from Php

[Comment]

May 20th, 2004 in Howto. Perl

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.

Pipe dreams

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:

  1. Define what to do with the process’s pipes. Notice that the error pipe is mapped to a log file (which is appended on each call).
  2. Define some text to test with the Perl script.
  3. Open the process, which is our Perl script. This will fail if the script can’t be found, or if it isn’t executable.
  4. Write the test text to the input pipe of the Perl script.
  5. Read the output of the Perl script.
  6. Close the process. This is best done after all of the pipes are closed (otherwise it causes deadlock).

The PHP script:

< ?php
$handles = array(                             // 
   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;
}