Using OpenOffice.org Charts in LaTeX

Finding out how to get my charts into LaTeX took way longer than it should have. First, I tried pasting it into a Writer document and then using Save As Picture, but its EPS output resulted in 0-byte files, SVG output was broken, and raster images came out at screen resolution. (I couldn’t find a way to export higher-resolution charts in Excel either!) So here’s how I finally did it:

  1. Copy and paste the chart from OpenOffice.org Calc into OpenOffice.org Draw.
  2. Export the drawing as PDF.
  3. Use pdfcrop <image.pdf> (provided in the texlive-extra-utils package on Ubuntu 8.10) to crop out the whitespace
  4. Now just use the image with includegraphics{image-crop.pdf}.

The results are crisp and clean. Amazing!

Cryptic errors from mod_fcgid and Perl

For future reference, the cryptic error from mod_fcgid:

[Thu Feb 12 22:10:27 2009] [warn] (104)Connection reset by peer:
    mod_fcgid: read data from fastcgi server error.
[Thu Feb 12 22:10:27 2009] [error] [client X.X.X.X] Premature end of
    script headers: dispatch.fcgi

means that dispatch.fcgi failed to start. Possible reasons are:

  1. Missing Perl modules. Unfortunately, I don’t know where the stderr output ends up. Try running the script directly; e.g. perl dispatch.fcgi.
  2. Missing Perl modules that you installed locally (e.g. local::lib) but Apache doesn’t have it in $PERL5LIB.

Remember that the folder must not be group-writable, and that any executable must be run from the directory root that suEXEC was compiled for! These will fail with a more useful error though, complaining of “suexec policy violation: see suexec log for more details” (the log is at /var/log/httpd/suexec.log for CentOS systems).

Catalyst on Windows with Strawberry Perl

The Catalyst Framework is an elegant Model-View-Controller based web framework for Perl, with similarities to Ruby on Rails. It is a popular choice for Web 2.0 applications based on Perl, speeding up and simplifying development.

Catalyst is very nice to use, but has a reputation of being hard to use, particularly on Windows. Windows has historically been regarded as the “outcast” of Perl development environments—the lack of proper build tools had made installing most modules (including Catalyst) difficult, to say the least. ActiveState’s binary PPM packages are hard to find and often outdated. The effect has been that the complex dependencies of Catalyst were nearly impossible for the average mortal to manage on Windows.

I recently discovered Strawberry Perl, which has made building modules on Windows easier than ever. It includes a bundled MinGW toolchain for compiling and pure-Perl equivalents for other necessary tools. Now, it is no longer necessary to install Visual Studio or Dev-C++ just to build Perl modules. Using the CPAN installer from the command line Just Works.

If you have tried to install Catalyst on Windows before, you’ll know that hunting for PPMs and building the missing modules takes hours and leaves you with an installation that isn’t up-to-date. With Strawberry Perl, I was able to install the newest Catalyst fresh from CPAN in about 10 minutes.

Read on for easy instructions in 5 steps.

Inkscape for Open-Source Vector Graphics

Inkscape is a free, open-source program for drawing vector graphics. What is “vector graphics?” Instead of representing images as a grid of pixels with different colors, vector images are composed of shapes with lines and curves. This allows it to be scaled indefinitely without losing quality.

Inkscape compares with other vector graphics software such as Adobe Illustrator. Some of Inkscape’s advantages are that it’s completely free and open-source, as well as cross-platform. It’s strongest point to me, though, is its usability. It’s controls are very well thought-out.

  • Simplifying the toolbox without losing functionality. It may seem like less tools mean less flexibility, but do you really need a scissors, knife, pen, and node edit tool when all the functions can be accomplished with a single tool? Having used Adobe Illustrator before, I was frustrated by the 13×2 entire palette of tools, many of which could “expand” in a menu and become other tools! It was a constant hunt in the toolbox.
  • Great keyboard shortcuts. The toolbox, for example, is mapped intuitively to the F1, F2, etc. function keys. Boolean operations, such as union, subtraction, and intersection are mapped to Ctrl-+, -, *. Duplicate an object by Ctrl-D. It saves you from constantly moving the mouse between the toolbars, menus and the work.

Here are some examples of its ease of use:

  • Usable handles. When you click on an object, the standard handles appear on it for resizing it. But click on it again, and controls appear for skewing and rotating the object! No need to click through menus for “free transform” and the like.
  • Selecting obscured elements. If there’s an object behind another one, simply Alt-click where it is to select it. Eliminates the need for constantly changing the Z-order of elements or hiding layers.
  • Gradient editor. To fill an element with a gradient, you simply click the “gradient” icon for its fill and it automatically create a sensible default gradient–fading from the current color to transparent. The gradient fill gets handles in the artwork that can be dragged.

It has all the features necessary to easily to create “Web 2.0-style graphics,” with glossy highlights and drop shadows.

  • Gradients
  • Transparency
  • Gaussian blur

After only playing with it a little, I used it to create the header graphic for this site.

Bought a PSP!

I bought myself a sleek, black PSP over Thanksgiving break! It’s my early Christmas present to myself since I’ll be spending winter break in China. This is another great gadget! :-)

The $250 bundle from Fry’s came with the PSP Value Pack, a starter kit, and the games GripShift and Frantix. The first thing everybody notices about the PSP is its wonderful design (like all Sony products). It’s glossy black, with a large screen flush with the entire front of the PSP. There’s the standard cross-square-triangle-circle PlayStation buttons and four-button D-pad, and there are two clear shoulder buttons! And the low-profile analog stick does not protrude from the body because it’s flat–it slides when you push it around. The speakers are hidden in two small holes, and the headphone and power connectors are tucked neatly away on the bottom. Overall, the PSP is pleasing to the eye and its artful design stands out.

The 4.3″ widescreen LCD is bright and crystal-clear. The games are in full 3D, which looks impressive on a handheld. Movies play sharp thanks to it’s 480×272 resolution. The games come on UMD discs, which are small cartridges with what looks like a miniature CD inside. Each holds 1.8 GB of data!

The only drawback I see with UMDs is that recordable versions aren’t available. That means that any content like movies, pictures, and music must go on the Memory Stick. I ended up ordering a $50 Lexar 1GB Memory Stick Pro Duo just for this purpose.

Despite what I’ve heard about the battery life, it seems acceptable but I don’t have any super-graphically-intensive games yet. Still, I think 3-6 hours is still a reasonable battery life. After all, it has a super-bright, high-resolution screen, wireless capabilities, and spinning optical media! My starter kit included a car charger so I wouldn’t run out of power on a long road trip. Overall my experience with the PSP so far has been excellent.

Now, some games I’d like to get soon, most wanted first:

  1. Wipeout Pure – a futuristic racing game
  2. FIFA 2006 – soccer
  3. Ridge Racers – car racing game with great graphics
  4. SSX – extreme snowboarding
  5. Twisted Metal: Head On – a car/shooter game