wnoronha's blog
Minutely Mapnik is the concept of keeping your PostgreSQL database in sync with changes made on the OpenStreetMap server. Changes made by OpenStreetMap user accounts are recorded in "replication files" by the minute and by the hour. The Osmosis java application is used to automate the process of downloading the proper "replication files" that are used to update your database with new changes. The Osm2pgsql application is then used to import those changes into your PostgreSQL database.
Lets start off by setting up our system to automatically import updates at various intervals
This is a simple walkthrough for creating a Rails 3 application that supports token based authentication.
This is written for Rails 3 but should work just fine for Rails 2.x
You can find the source code of the demo app on github:
http://github.com/wnoronha/device-auth-demo
Introduction
This is a simple copy and paste HOWTO document on setting up your own map server. This document is part of a series of 4-5 articles that cover buildings a map service. I assume that most of the readers are familiar with the the basics of using Ubuntu GNU/Linux and tools around it. You will also need some knowledge about the Open Street Maps tools.
A database program must show its data as two-dimensional tables, of columns and rows, but store it as one-dimensional strings. For example, a database might have this table.
| EmpId | Lastname | Firstname | Salary |
|---|---|---|---|
| 1 | Smith | Joe | 40000 |
| 2 | Jones | Mary | 50000 |
| 3 | Johnson | Cathy | 44000 |
Supervisor is a simple yet powerful client/server system to monitor and control processes on UNIX systems.
I have a number of Tornado servers that are already managed by supervisor. I have found it stable and flexible enough for most tasks.
Installing supervisor
The installation is pretty straight forward.
sudo easy_install supervisor
This will install supervisor and all the required dependencies.
#!/usr/bin/python # Original Code # <a href="http://github.com/turian/py80legsformat" title="http://github.com/turian/py80legsformat">http://github.com/turian/py80legsformat</a> by Joseph Turian import csv import hashlib import os import struct import sys import zipfile from cStringIO import StringIO from optparse import OptionParser class EightyLegs: def __init__(self, filename): self.filename = filename self.directory = filename.split('.')[0] def read(self, file): assert(struct.calcsize("i")) == 4 l = file.read(2*4) (classID, versionID) = struct.unpack("ii", l) assert (classID, versionID) == (218217067, 1) l = "not EOF" data = [] l = file.read(1*4) while l != "": (URLSIZE,) = struct.unpack("i", l) url = file.read(URLSIZE).decode("utf-8") l = file.read(1*4) (DATASIZE,) = struct.unpack("i", l) data = str(file.read(DATASIZE)) yield (url, data) l = file.read(1*4) def read_zip(self, file): zip = zipfile.ZipFile(file, 'r') for info in zip.infolist(): fname = info.filename if fname.endswith('.80'): data = zip.read(fname) for r in self.read(StringIO(data)): yield r def parse(self): if not os.path.exists(self.directory): os.makedirs(self.directory) tsv = csv.writer(open("%s.tsv" % self.directory, 'w'), delimiter='\t', lineterminator='\n') if self.filename.endswith('.zip'): e = self.read_zip(open(self.filename)) else: e = self.read(open(self.filename)) for url, data in e: print url f = open("%s/%s.html" % (self.directory, hashlib.md5(url).hexdigest()), 'w') f.write(data) tsv.writerow([hashlib.md5(url).hexdigest(), url]) def main(): usage = 'Usage: %prog -f 19970_20966_a_1.zip or %prog -f 19970_20966_a_1.80' parser = OptionParser(usage=usage) parser.add_option('-f', '--file', dest='filename', help='input file') (options, args) = parser.parse_args() if options.filename is None: parser.print_help() sys.exit(0) legs = EightyLegs(options.filename) legs.parse() if __name__ == '__main__': main()
Tornado is a web server built by Friend Feed. The framework is distinct from most mainstream web server frameworks (and certainly most Python frameworks) because it is non-blocking and reasonably fast. Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing connections, which means it is ideal for real-time web services. Tornado is also one of the few web servers built to address the C10K problem . If you have used other python frameworks like web.py or Google's webapp then you are going to feel right at home.
Installation
You will need to install the following before you install Tornado
sudo apt-get install python-dev python-pycurl python-simplejson
Once the installation is complete you can install Tornado by pasting the following into the terminal.
wget http://www.tornadoweb.org/static/tornado-0.2.tar.gz tar xvzf tornado-0.2.tar.gz cd tornado-0.2 python setup.py build sudo python setup.py install
Representational State Transfer (REST) was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation. Fielding is one of the principal authors of the Hyper Text Transfer Protocol (HTTP) specification versions 1.0 and 1.1.
Since my current application is just a bunch of REST services, I needed to test these calls before publishing them. Unfortunately there were no good tools I could use to test these calls. I spent some time searching for scripts or apps that can make my life easier till I ran into this jewel somewhere on the web
What is Jquery
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. -- From the Jquery Website.
Jquery is one of the many Javascript frameworks out there. Its competition includes YUI, Prototype, Moo etc.
Jquery UI
In additions to the framework; Jquery also has a powerful UI framework. Jquery and Moo have the most complete and easy to use UI framework now. It has widgets such as sliders, tabs, accordions, calendars, dialog and modal windows. It also has a very nice button framework.
You can find more information on their website http://ui.jquery.com.








