4 Nov 2007

javascript implementation of a php/javascript/css/sql/perl and html editor

Codepress is a really nice html/javascript/php/perl/sql/java and css editor. It will display your code color coded (syntax highlighting) and can give you syntax completion features.

batch conversion from svg to png

I often need icons in different sizes as raster graphics. It seems to be easier to create/maintain these graphics as vector images and the convert them in all needed sizes as raster images.

Formats
I have decided to use svg as vector format. It can be conveniently and freely be edited with inkscape. The output format is svg because I need these images in web pages. png does offer transparent gradients (in contrast to gif, which only allows one indexed color to be transparent). Internet explorer does not handle png transparency by default, you must use a filter. Dean edwards' /IE7/ remove many quirks from ie6 and lower by using clever js and css tricks. alpha transparency for png can also be enabled with /IE7/.


Batch conversion
I have been using the ImageMagick command line utilites for scripted image manipulation with a lot of joy. Unfortunately ImageMagick is only capable of manipulating raster graphics. Fortunately, though, inkscape comes with a quiet hand command line interface to get this job done. inkscape can export svg images in various png sizes (and loads more).

Example

inkscape --without-gui --file=lib/icons/scalable/apps/calc.svg \
--export-png=calc.png --export-width=48 \
--export-height=48 && eog calc.png


This command will convert an svg image (lib/icons/scalable/apps/calc.svg) into a png image (calc.png) with a size of 48*48 pixels. Wehn the conversion comamnd (inkscape) succeeds, the result is dispalyed in gnomes image viewer ( eoc calc.png).

for converting a directory structure to different sizes of png sets, I have used the following script:
#!/usr/bin/env bash

# abort if we don't have a lib directory
if [[ ! -d lib/ ]]; then
echo "Must be run from the application's main directory."
exit 1;
fi

# config
TARGET=lib/stockitems
SIZES="12 16 24 32 48 72 96";
FILES=`find ./lib/icons/scalable -name "*.svg"`;

# purge target dir
if [[ -d "$TARGET" ]]; then
rm -R "$TARGET";
fi
mkdir "$TARGET";

# convert all files to the $SIZES dimensions
for size in $SIZES; do
echo $size;
for file in $FILES; do
target="$TARGET/${size}x$size/"`echo $file | sed -e \
's/^\.\/lib\/icons\/scalable\///; s/svg$/png/'`;
parent=`dirname $target`;
if [[ ! -d "$parent" ]]; then mkdir -p "$parent"; fi
inkscape --without-gui --file=$file --export-png=$target \
--export-width=$size --export-height=$size;
done
done

exit 0;

1 Nov 2007

eclipse and database management

I just stumbled over a usefull Database browser and query editor called Eclipse SQL Explorer.

Installation does not work from within eclipse. I couldn't add the provided channel and had to download the zip file then extracted it in the eclipse directory.





Drivers


Drivers don't ship withthe tool. these must first be fetched maually or every product.

Fortunately SUN has a list of available JDBC Drivers which helps to find (mostly commercial) drivers. Open Drivers I have used: