July 1st, 2010 by tgc
I recently completed a project that required me to write a handful of windows batch files. These files needed to be as universally compatible as possible. This unfortunately ruled out options such as cygwin, powershell, and vbscript, which would have offered me more convenience, power, and saved me significant time and headaches.
The job of the batch files was to run through a number of xml files, process them (using an external tool), and archive the results of the processing. After a few minutes researching how to write simple for loops, here is what I ended up with.
Read the rest of this entry »
Posted in Windows | No Comments »
October 1st, 2009 by tgc
Expanding on the PostgreSQL examples in our previous post, here we will look at taking advantage of some of the features in PostgreSQL 8.3 and modifying our zip_proximity function to avoid using cursors and instead define and return a set of our own composite type. From the postgres documentation “A composite type describes the structure of a row or record…”. Since we know that our stored procedure will return a row including: zip code, latitude, longitude, city, state, state abbreviation, and distance, we can create a composite type called, for example, ziprowtype.
Read the rest of this entry »
Posted in Postgres | No Comments »
January 14th, 2009 by tgc
On most retail and social networking websites (along with many others), you’ll have the capability to search for people, businesses, store locations, etc within a given distance of your location. This can be implemented in a number of ways both mathematically and programmatically. In an attempt to reduce the amount of code I (or others) have to write, be it in PHP, Python, or any number languages that may interface with our database, I have chosen to implement these zip code proximity and distance functions as stored procedures in the database.
Read the rest of this entry »
Posted in MySQL, Postgres | 1 Comment »