In Loki We Trust The many projects of Lokkju, Inc


Setting up PostGIS 1.5 on PostgreSQL 8.4.1 (on Debian)

I found that getting the template database for postgis set up was somewhat poorly documented - so:

First, create a role that will own the tables within the template database:
psql -c "CREATE ROLE gisgroup;"

Second, create and populate the template database:

createdb -E UNICODE template_postgis
createlang -d template_postgis plpgsql
psql -d template_postgis < /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
psql -d template_postgis < /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
psql -d template_postgis < /usr/share/postgresql/8.4/contrib/postgis_comments.sql

Third, set the ownership to the role you created:

psql -c "ALTER TABLE geometry_columns OWNER TO gisgroup;" template_postgis
psql -c "ALTER TABLE spatial_ref_sys OWNER TO gisgroup;" template_postgis

Fourth, we create the user for our database:

psql -c "CREATE USER yourgisuser WITH PASSWORD 'yourpassword';"
psql -c "GRANT gisgroup TO yourgisuser;"

Fifth, and last, we create a new postgis enable database:
createdb -T template_postgis -O yourgisuser your_new_postgis_database


Using Office Automation on IIS7

Though there are a lot of articles out there on office automation in dotnet (most of them telling you not to do it), there are very few covering how to get office automation up and running under IIS7 on a 64bit machine - and it is possible.

I needed to do this recently, and found one hint on how to get it working at . They key is to use Process to launch the application you need, then attach to it.

Sample code in C#:

Microsoft.Office.Interop.Word.Application app = null;
Process proc = null;
Document doc = null;
ProcessStartInfo procinfo = new ProcessStartInfo(WORD_PATH, "");
procinfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
procinfo.CreateNoWindow = true;
procinfo.WindowStyle = ProcessWindowStyle.Hidden;
proc = Process.Start(procinfo);
app = (Microsoft.Office.Interop.Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
if (app == null) { throw new Exception("Word not found"); }
app.Visible = false;
app.DisplayAlerts = WdAlertLevel.wdAlertsNone;
#region Declare Params
object fileName = filename;
object ConfirmConversions = false;
object ReadOnly = true;
object AddToRecentFiles = Type.Missing;
object PasswordDocument = Type.Missing;
object PasswordTemplate = Type.Missing;
object Revert = Type.Missing;
object WritePasswordDocument = Type.Missing;
object WritePasswordTemplate = Type.Missing;
object Format = Type.Missing;
object Encoding = Type.Missing;
object Visible = false;
object OpenAndRepair = Type.Missing;
object DocumentDirection = Type.Missing;
object NoEncodingDialog = Type.Missing;
object XMLTransform = Type.Missing;
doc = app.Documents.Open(ref fileName, ref ConfirmConversions, ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate, ref Revert, ref WritePasswordDocument, ref WritePasswordTemplate, ref Format, ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection, ref NoEncodingDialog, ref XMLTransform);
object saveChanges = WdSaveOptions.wdDoNotSaveChanges;
object OriginalFormat = Type.Missing;
object RouteDocument = Type.Missing;
((_Document)doc).Close(ref saveChanges, ref OriginalFormat, ref RouteDocument);
doc = null;
catch { }
((Microsoft.Office.Interop.Word._Application)app).Quit(ref saveChanges, ref OriginalFormat, ref RouteDocument);
app = null;
catch { }
catch { }


PDX Hackerspace is a reality

We've finally managed to find space (and get together the money) to start a Portland Hackerspace!

Check it out at


Installing Hyper-V Linux Integration Components v2 in CentOS 5.2

Microsoft still hasn't released a CentOS or RHEL RPM for Hyper-V's Linux Integration Components, so you still have to build them yourself. Of course, since neither RHEL or CentOS are supported platforms, Microsoft won't help you much.

So, with help from Julian Field's work log on installing the original LIC v1, I've put together a minimal instruction set for performing a LIC v2 install on a fresh CentOS 5.2 install.

I started with an absolute minimal install, so there should be no packages other then those below that are needed.

Lines starting with "$" are shell commands.
Lines starting with "#" are something you need to do.

# In Hyper-V: Mount CentOS 5.2 ISO image

$ mkdir -p /media/cdrom
$ mount /dev/cdrom /media/cdrom
$ yum --disablerepo=\* --enablerepo=c5-media install gcc make gnupg kernel-devel
$ umount /dev/cdrom

# In Hyper-V: Mount Linux Integration Components ISO image

$ mkdir -p ~/linux_ic2
$ mount /dev/cdrom /media/cdrom
$ cp /media/cdrom/drivers/dist/* ~/linux_ic2/ -R
$ cd ~/linux_ic2/
$ make install
$ reboot


To verify, look for the new seth* network interface.

Wasn't that easy?

Tagged as: , 4 Comments

VMWare Fusion: “Error loading operating system”

If you are using VMWare Fusion under OS X 10.5 (Leopard) with bootcamp, and get an "Error loaded operating system message", there is finally a simple fix.
Open your *.vmx file for your virtual machine, and add the following line:


that should do the magic!

Filed under: Projects No Comments

Mobile Portland Slides Spotlighted on

Mobile Portland Group's Slideshare.Net slides have been spotlighted on the front page of

My iPhone Development presentation slideshow:


dnsEditor: Ajaxified Update

Thanks to Quintin at, dnsEditor now supports Batch adding of zones, zone defaults, and some extra configuration options.

- Now has "Click to Edit" instead of empty fields
- Configuration option to hide the "update servers" button
- Batch add zones
- Zone field defaults, for multiple or single A, MX, CNAME, TXT, etc records to be created automatically in a new zone



Filed under: Code, Projects 10 Comments

EMET: subModal

Even More Enhancements to subModal:

subModal is a nice, simple, javascript lightbox script that uses iframes. It is quite useful, especially after enhancements done by Todd Huss (Enhancements to subModal).
Two annoying things about it are that it modifies the history of our browser, and that the loading indicators go away to early. Attached is a simply replacements for it, that is drop in except that instead of settings the "loader.html" file, you need to set the "loader.gif" file.
The code is pretty self explanatory, and you can see a demo by clicking the "Map" icon at Kent Price Realty.

Filed under: Code, Projects No Comments

GreaseMonkey SmugMug Browser

A Browser for SmugMug Galleries, because SmugMug uses incrementing gallery ids

This will add a small div in the top right corner of your screen when on SmugMug. You can then click the Previous and Next links on that div to go to the next or previous gallery, based on the id.
Because of how SmugMug works, this will let you view non-password-protected private galleries... have fun!
You can either get it from or the code itself is after the break.


Small iPhoneFS update

just a quick note that iPhoneFS has been updated to use the new WinFUSE libraries. The disk access is a bit quicker, and more stable. Still no write support though - sorry!
There is a new download for it located on the homepage, or you can update through SVN.

Filed under: Code, Projects 6 Comments