Archive for the '.net' Category

shp2sqlserver – command line shapefile loader for sql server 2008

Monday, November 3rd, 2008

There are other tools, but in the process of working on something else, I put together a command line tool for loading shapefiles into Sql Server 2008. It is modeled after PostGIS's shp2pgsql, except that it loads directly into the db instead of writing sql to stdout. Here is the usage:

shp2sqlserver.exe -h
Usage: shp2sqlserver.exe [OPTIONS]+ [...]

a simple mvc pattern for use with gtk#

Tuesday, October 28th, 2008

Contents:

The Problem
The underlying data object
The solution: A controller class
Binding the views to the controller
Flaws?
Unit Testing
Summary

I'm going to illustrate a simple model-view-controller (mvc) pattern that I've discovered after much trial and error. Also, there is nothing specific to gtk-sharp about it, you could use it for any UI toolkit.
The Problem
According to Wikipedia, the MVC pattern [...]

dividing integers into a double in C#

Thursday, October 23rd, 2008

A subtle bug I'll sometimes get is when I divide two integers by zero into a double variable:

int x = 1;
int y = 2;
double z = x / y;

You expect the compiler to read your mind and do the division keeping the remainder for your double, but what in fact happens is that (x/y) is [...]

adventures in unmanaged land

Friday, October 10th, 2008

First some background: I need to render polygons in my project, cumberland. The problem is that openGL can only render convex polygons, so we must convert each concave polygon into multiple convex polygons:

Luckily, GLU, the openGL utility library, can do that for you via its tessellator. Unfortunately, getting this functional in a [...]