Archive for 2007

UNIX Magic

Saw this via digg earlier today, and couldn’t help but appreciate the “magic” of UNIX for the nth time.

My first foray into the UNIX world (years ago) was the result of a colleague (Mike Adair, of mapbuilder fame) who advised me to take UNIX training. I needed to script and chain processes together as part of a system to create a ground control point database. The rest, as they say, is history.

As the years go by, and as things become more packaged, “easier to use”, and “frameworks” popping up everywhere, I have found time and time again that the trusty UNIX command line and tools have saved the day when the pressure was on (this includes stuff like perl and [recently] python scripting), without the overhead of setting up grandiose configurations and such.

How did you get started with UNIX? Stories involving hacks and / or someone over your shoulder looking in amazement are welcome 🙂

Disaster Steak

(preamble: if you know me well enough, you’ll know that I use the term “disaster” in multiple modes / contexts. In this case, “disaster steak” is a good thing).

the beginning

This was a steak night. I had some friends over this weekend and sparked up the BBQ. I picked up some (big) sirloin steaks from Costco, made sure beer was stocked and away I went. Here’s how one makes a simple steak to die for:

  • wash down steaks with cold water
  • place steaks in a large bowl
  • douse steaks with balsamic vinegar (white or red) and rub
  • douse steaks with olive oil and rub
  • sprinkle steaks with Montreal steak spice (you can make your own if you really want)
  • seal the bowl and place in the fridge for an hour or so to let the steaks marinate
  • heat up the BBQ and slap on the steaks (N.B. have booze, appetizers, both, or whatever you want along the way — it’s always better than everyone just sitting there watching [and waiting]!)

appetizerson the BBQ

  • cook steaks as desired (I like mine _well_ done)
  • serve and enjoy!

bon appetite!

Click on any of the photos to see the whole process in pictures. Pretty simple, not much fuss and tastes awesome — disaster!

Anyone have any pointers or other ideas? I’d be glad to hear them!

MacBook, baby

I cashed in some Aeroplan points and decided to pick up a MacBook. Now I have to wait for the Aeroplan redemption to arrive via postal mail (they have security codes which have to be physically issued / used, so can’t do it until then), and then I’m in. I should have it sometime this week, at which point I’ll post my experiences.

I currently use FC7 at home, and have always been intrigued by Macs, so I’m looking forward to this! Until then, any advice / helpers / lessons learned out there would be great!

OWSlib and mapscript

My first major code contribution to MapServer was a server side implementation of OWS Common 1.0.0. For those who are not aware, OWS Common is a specification which unifies common XML constructs, etc. used by OGC specifications, such as Capabilities metadata, exception reports and bounding box encodings. The benefit of OWS Common is that specifications, and subsequently server implementations, can focus on their core specific functionality while leveraging the common bits.

A good example here is MapServer’s SOS server support, which leverages mapowscommon.c, making mapogcsos.c alot lighter as a result. Client implementations can additionally write OWS Common parsers as reusable functionality which they can then use when writing their, say, WFS and SOS clients. I really believe that this is a benefit for those developing SDI components (i.e. why should contact information be encoded differently for WMS and WFS, really?); just imagine the reduction in code as a result of OWS Common!

Sean recently pointed me to OWSlib, a python lib for working with OGC Web Services. I initially thought it would be great to write an OWS Common client / parser for OWSlib, so that when WFS 1.1.0 and SOS 1.0.0 clients are developed, they can use an OWS Common class between them.

But then I thought why not just implement this in MapServer, and have the functionality exposed via mapscript?

Reprojecting in Python

My previous post declared my plugging my nose and jumping into Python GIS stuff. Advice and info from Sean have been valuable in getting familiar with things, though I’ll be the first to admit I’m still green (writing Python like a Perl / C hack 🙂 ).

So here’s one of my first attempts at solving a real world problem: reprojecting a bunch of points from a CSV file:

#!/usr/bin/python
import sys
import mapscript

if (len(sys.argv) == 1):
	print sys.argv[0] + " <csvfile>"
	sys.exit(1)
else:
	projInObj  = mapscript.projectionObj("init=epsg:32619")
	projOutObj = mapscript.projectionObj("init=epsg:4326")
	print "id,geom,zone"
	f = open(sys.argv[1], 'r')
	for line in f:
		s = line.strip()
		k = s.split(",")
		wkt = "POINT(" + k[1] + " " + k[2] + ")"
		shape = mapscript.shapeObj.fromWKT(wkt) # man, I love WKT!!
		shape.project(projInObj, projOutObj)
		print k[0] + "," + shape.toWKT() + "," + k[3]
	f.close()

And that’s it! So now you can take the CSV output with the geometry encoded as WKT and hook it up to MapServer with some simple OGR OVF syntax in your mapfile:

CONNECTIONTYPE OGR
CONNECTION "<OGRVRTDataSource>
<OGRVRTLayer name='nb'>
<SrcDataSource>./nb.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<GeometryField encoding='WKT' field='geom'/>
</OGRVRTLayer>
</OGRVRTDataSource>"

Mind you, you might question why to reproject when MapServer can do this for you, but I digress. There’s probably more eloquent ways to do this than what’s been done above via mapscript, eh?

Getting into Python

Well, I’ve finally decided to give Python an honest try. A born and bred Perl hack, then dipping into PHP, I’ve seen much Python applause in the geospatial software community through many of Sean’s posts. Though I know Sean thinks mapscript is a disaster, it was via mapscript that I started to look more into Python.

So here’s what I typically start off with when doing development:

  • HTTP / URLs / Forms: for Perl, I use CGI; for PHP, I use the native, built in functions
  • XML Processing: for Perl, I use XML::Simple; for PHP, I use SimpleXMLElement
  • Database: for Perl, I use DBI; for PHP, I use the compiled in mysql support, for example

So far I’ve found urllib2 and ElementTree to be useful. Other than that, I’m finding the command line pretty awesome for one offs and testing.

If anyone’s got any other suggestions, that would be great!!

UPDATE (20 June 2007): Manual trackback and great post / response from Sean

Nice Stop Smoking Timeline

Check out this graphic I found (thanks digg), which shows the effects of smoking cessation. I also saw this recently in the doctor’s office, and found it really helpful and encouraging.

I’m glad to say I’ve been 100% smoke free (via Zyban for a month) for almost six months now (the only New Years Resolution that I’ve kept this long!).

My New Condo

My New CondoYesterday I got the keys to my new condominium. Awesome place, and well built (materials, craftsmanship, etc.). I think a great part about this place is the shared amenities (party / dining room, gym, pool, virtual golf, etc.). And the view of the city is quite nice from my balcony.

Be sure to check out all the photos!!

Tuning LAMP systems

Check out these articles from IBM on tuning LAMP applications. Being a longtime LAMP guy (the “P” being long time Perl hack, but slowly moving towards PHP), I found this useful for tweaks and optimizing my applications.

Part 1

Part 2

Looking forward to Part 3, which covers MySQL.

Update (10 June 2007): here’s Part 3.

New Geospatial Web Book

Check the out the latest title from Springer, The Geospatial Web: How Geobrowsers, Social Software and the Web 2.0 are Shaping the Network Society. If you’re into mashups, Web Services and GIS, this title is worth a read.

Casinos and the Network Society: The Intersection of Gambling and Technology

The rise of the internet and digital technologies has had a major impact on many industries, and the casino industry is no exception. With the advent of online casinos and mobile gambling apps like nye casino 2022, the way we experience casinos has changed dramatically.

But what exactly is the relationship between casinos and the network society? And how has technology transformed the casino industry in the 21st century?

One key aspect of the network society is the concept of connectivity. With the proliferation of smartphones and other devices, it’s easier than ever for people to connect and communicate with each other no matter where they are. This connectivity is also driving the growth of the online casino industry, as players can now access a wide range of games from the comfort of their own homes.

Online casinos offer a level of convenience and accessibility that traditional brick-and-mortar casinos can’t match. Players can choose from a wide range of games, including slots, table games, and even live dealer games, all with a few clicks of a button. And with the use of virtual reality technology, online casinos are even starting to replicate the immersive experience of a real-life casino.

But the rise of online gambling has also led to some challenges. One concern is the potential for increased problem gambling, as it’s easier for people to access games at any time of day. There is also the issue of regulation, as different countries have different laws and policies surrounding online gambling.

Despite these challenges, it’s clear that the intersection of casinos and the network society is here to stay. As technology continues to advance, it will be interesting to see how the casino industry evolves and adapts to the digital age.

Modified: 5 January 2023 04:32:38 EST