Have you ever needed to extract columns from a delimited file? I find myself in these situations fairly often. Here are a few more interesting ways to do it than opening in Excel and persing the columns. If you need to process many files or you want to batch multiple such extractions, there are some utilities to help with that. Although these generally are included on Linux, you can install them on Windows and they work just as well.

Read more →

Basic testing with Go

Go

Recently I started dabbling in Go and inevitably reached the point to test what I had written. It turns out that Gos testing with its standard packages is as easy as it gets. The go tool provides a test command to execute tests. How to write a test? It is very simple: Create a test file Write a test function (should start with Test) Execute the tests Create a file with a name matching the pattern *_test.

Read more →

Continuing my previous post I will show you how I connected the HID ThinLine II reader and was able to read various RFID cards. Wiring the Arduino and HID ThinLilne II Here is how I connected the HID to the Arduino Uno. The battery minus is connected to the Arduino GND as well as to the BLACK wire on the HID Reader The battery plus is connected to the RED (VCC) of the HID reader The GREEN DATA0 wire from the HID is connected to Pin 2 on the Arduino The WHITE DATA1 wire from the HID is connected to Pin 3 on the Arduino Let’s see some code.

Read more →

Recently we were moving our office and in the new place there was a RFID reader that went to the thrash. I took it to see if I can make it read the several RFID cards I have… Here is what I did. I did some research on the hardware and what it does. Here is what I found out. The HID ThinLine II Reader Looking at the datasheet on HID’s web-site, I have noticed the following:

Read more →

An interesting coding issue I came across recently was a piece of code that is essentially illustrated by the following snippet: #include <iostream> using namespace std; int main(int argc, char** argv) { int i = 1; i = i++; cout << i << endl; return 0; } When compiled with gcc (I tried 4.8.3 on OSX and 4.8.1 on Windows) it generates a warning to hint you at the problem («main.

Read more →

I was writing a little utility to process a large number of polygons in a bunch of shape files, and wanted to have the area of each polygon. I thought I will do it using Python and OGR library. All my files are in WGS84 Latitude Longitude projection. For experiment I tried the following code: from osgeo import ogr driver = ogr.GetDriverByName('ESRI Shapefile') hinputfile = driver.Open(r'c:\GeoData\AZ.shp', 0) in_layer = hinputfile.GetLayer(0) feature = in_layer.

Read more →