Filed under: Python
Recently we finished off a very aggressive sprint to release a new set of tools for one of our clients. Much fun had and the delivery and roll-out went very smooth – great teamwork all around and excellent interaction with the client internal IT department.
One item that crept up late in the development cycle (not that we didn’t know about it, just that we hadn’t thought through the full set of implications) was localization. This really hadn’t been an issue in previous releases but with adding new functionality and capability related to dates and times, well, of course it was now an issue.
The application needed to work regardless of the personal preferences each person had set for their date/time format. Hmmm, will that require a bunch of string manipulation and testing and checks, or maybe, just maybe the good folks behind the Python language have already crossed that bridge…and, of course, they had.
A word that comes up often when talking about Python and implementation is elegance, and this time was no exception. Simple solution to what could have been a nightmare coding effort in the final days. Hanging off of the datetime (and time) modules is strftime and one of its format strings does exactly what we needed, for example, the following interactive code shows how a datetime is return in my system (local) format – way cool!
>> import datetime
>> t = datetime.datetime.today()
>> print t
2009-03-26 08:25:29.160000
>> t.strftime(‘%x’)
‘03/26/09′
Where this really becomes a benefit is when working with an ESRI cursor object, and you’re wondering “How the heck should my date be specified so that it ends up in the database correctly?”, next time just wrap it with some %x and let the magic happen.
Filed under: GIS
I’ve been looking lately at Bluetooth technology, you know, how it works, what makes sense (i.e. not real time sound) for its use, range and a few other things. What got me on this topic is the seemingly small selection of Bluetooth mouse and keyboards — the computer peripherals that should be the mainstay of Bluetooth products.
In all that searching I have found a nice headset from Plantronics Pulsar 590A, and another from Motorola S9-HD — both are rechargeable and the range on the Plantronics is phenomenal. Favorite mouse has got to be the Logitech 470 with a close second being the Microsoft Notebook Mouse 5000 — battery life seems to be a tad bit better with the 470. Finally for keyboard/mouse combinations the Logitech DiNovo is slick, and the Microsoft Wireless Entertainment Desktop 7000/8000 are nice options too (although the mouse is a little heavy in the Microsoft bundle).
Not a Bluetooth keyboard, but check out this new one I picked up today today.
Filed under: GIS
Continuing on from a post back in January where we talked about a really nice database engine for road warrior development. The question, when posed to our internal development team, was “what about spatial?” — a very relevant question given the line of work we are in.
So in my travels (this time just meaning a cruise around the web), I stumbled on a really cool set of open source code that extends SQLite with spatial capabilities. The package is called SpatiaLite (http://www.gaia-gis.it/spatialite/) and offers up the very useful blend of SQLite relational database and GEOS library spatial operations, the result is a lightweight spatial database with built-in spatial operators.
If you check out the website you’ll also see something else that is fairly exciting – it’s called VirtualShape and it is a driver for SQLite that enables SQLite databases to access the data held in shapefiles. Wow! This might be the closest thing we’ve had to the live spatial operations we could easily perform using Avenue and theme definitions (and if you can remember writing something like [shape].contains(…) then please drop me an email).