Monthly Archive for August, 2006

PAGIS Presentation Tomorrow

Tomorrow we are doing a presentation for the Portland Area GIS User Group. I think someone from the Oregonian is going to be there. Yikes! We’ll be sure to report back on how it goes.

Portland Data Update

A couple days ago we updated the Portland region data. This was like a bug-fix release for software–no major changes were made, but a lot of little things here and there were improved and/or fixed.

Related to this (but still quite separate), we improved (hopefully!) the way routes are found. In particular, we made big changes for when the safer option is selected.

Please let us know what you think.

Foray Into Pylons (Python Web Framework)

For a while now I’ve been planning to start using one of the many available Python Web frameworks in the development of the trip planner. Over the course of the project we have built an ad hoc, application-specific, CGI framework (of sorts). Using a “real” framework will allow us to stop refining those wheels we reinvented and instead focus more on the specifics of our application.

Deciding which framework to use has been tough. In the past year or so it seems Web frameworks have become all the rage, with several interesting Python projects and all the Ruby on Rails hype. I had initially narrowed it down to two choices, having researched just about all the competitors: TurboGears and Django. I don’t remember Pylons in that first round of research, but maybe I just missed it. Once I noticed it, it was added to the list too.

So, the idea had been floating around for a while and I had created several test applications with various frameworks but still hadn’t gotten around to making a definite decision and switching over. Recently, I listened to a podcast interview of Guido van Rossum[1]. In it he mentioned that Django is his favorite Web framework. He didn’t say much about why except that he likes the way the project is being run. (”They really get open source.”)

Having heard that and having also narrowed the field to just Pylons versus Django, I decided, “OK, well I’m going to go ahead with Django then.” I ordered up a new Ubuntu VPS[2] to host the new version of the trip planner on and got to work. It was exciting to finally make a decision and move forward.

Getting started was easy and I really liked the admin interface, but about five minutes into it, I realized Django wasn’t going to work for me. There was only one reason: the tightly coupled ORM. Sure, I could just not use that part and use a different ORM, but somehow that seems “impure.” Maybe that seems silly, but remember that I had only decided to use Django on, essentially, a whim.

The reason I don’t want to use the built-in ORM is, I want the Web interface to be orthogonal to the core functionality. I want them completely separate, as they are now in the CGI version. I want to keep database access in the back end and be able to create other interfaces as necessary. Now, I suppose I could just use the Django ORM in the back end (?), but there’s another ORM you may have heard of, SQLAlchemy, that I was/am interested in trying out.

This led me back to Pylons and thinking about some of its good points: it’s WSGI from the start, Routes seems like a really cool way to map URLs, and the (Myghty) templates use Python.

Thinking about it, Pylons seems more like the “natural” choice for this project and its architecture. On the other hand, I think Django would be great for projects that don’t need such separation between the front and back ends (or where there is no back end as such).

I’ve just gotten started with the CGI=>Pylons conversion and so far it’s been a pleasure. I’ll report in more detail once I’ve gotten further into it. One “gotcha” that came up, that I don’t think this is specific to Pylons, was creating a controller with the same name as the top-level package. Don’t do something like this:

paster create –template=pylons tripplanner
paster controller tripplanner

Python will be unable to import the controller.

[1] The creator of Python (which I mention for non-technical readers)
[2] vpslink.com (seems good so far)

WordPress Upgrade and K2

Today we upgraded to WordPress 2.0.4. It’s a security release. Upgrading is easy: just copy the new directory over the old (being careful to save any customizations first, although if you created new directories for your custom themes, you won’t have to do anything).

We also moved from the old default theme, Kubrick, to a new version of it called K2. This version makes a lot of things easier, and it looks better out of the box. One day we might customize it.

Article in the Portland Tribune

The article mentioned in this post has been published. It feels a little odd reading about ourselves, but I think it’s a good article overall. Thanks to the Portland Tribune, the writer, and the photographer.

There is one factual error in the article. It states that “…the Portland application currently is restricted to the city limits” and will cover the tri-county area and Clark County (Vancouver) in the future. Washington, Multnomah and Clackamas counties are all already covered, and we are planning to add Clark County in the near future.

Blog Announcement

We went and got ourselves a blog. Some things that we might have sent here [the announcements list] will be posted there instead. We’ll now reserve this list for major announcements. The blog will include the announcements plus other odds and ends–whatever seems at least somewhat relevant and half way interesting.

The blog is located at http://byCycle.org/. Our home page also shows selected items posted to the blog (ones tagged as news).

=== No need to read this line or the ones below ===

To keep track of our blog or others, you might be interested in a program known as an RSS Aggregator. Try the following search to learn more: http://www.google.com/search?q=RSS+Aggregator

Speaking of blogs, how come *you* don’t have one? Blogs are an interesting way of sharing information, and there is just tons of useful bloggery out there. (All those electrons really add up.)

Blogging doesn’t replace talking (or whatever other forms of communicating people are into these days). No, I’d say it complements it, and it’s good mental exercise.

So, on the off chance that someone out there is interested, I will offer[1] to help *you* set up your very own Web hosting with a blog, or just the blog if you’ve already got a site, or *just* a blog if you don’t want a site. My guess is that no one will respond, or perhaps one person, so this is a perfectly safe offer for someone with very little free time to make.

TTFN

[1] Sorry, this offer has expired :(

Installing Trac

Today I installed Trac. “Trac is an enhanced wiki and issue tracking system for software development projects.” We plan to use it to keep track of issues with the trip planner and any other software projects we might undertake.

Issues (AKA bugs) with the trip planner can now be reported at http://trac.bycycle.org/newticket. This is somewhat developer-oriented, but users can (and should!) use it too.

Also, since Trac contains a Wiki, anyone can contribute useful information about the trip planner, which might be documentation, tips and tricks, or anything else that’s relevant.

Here is the high-level outline of our Trac installation:

  • Create a directory to contain Trac projects; each project will live in a subdirectory
  • Create a subdomain at trac.bycycle.org for accessing Trac projects
    • The files for this will live in the html subdirectory of the main Trac directory
    • Each project will have a subdirectory in the html directory that contains a simple script to make the project accessible from the Web

Dependencies

  • Subversion 1.3.2
    • Berkeley DB 4.4.20
  • ClearSilver 0.10.3
  • SQLite 3.3.6
  • PySQLite 2.3.2 (Python bindings for SQLite)

Install Subversion

  • First install BDB
    • cd build_unix
    • ../dist/configure –prefix=$HOME
    • make && make install
  • ./configure –prefix=$HOME –with-berkeley-db=$HOME
  • make && make install
  • cd subversion/bindings/swig/
  • make swig-py
  • make install-swig-py
  • echo ~/lib/svn-python > ~/lib/python2.4/site-packages/subversion.pth

Install ClearSilver

  • ./configure –prefix=$HOME –with-python=$HOME/bin/python –disable-ruby –disable-java –disable-perl –disable-csharp
  • make && make install

Install SQLite

  • ./configure –prefix=$HOME
  • make && make install

Install PySQLite

For some reason, this was the hardest thing to install.

  • Edit setup.cfg, changing the values of these variables as shown
    • include_dirs=/home/u6/bycycle/include
    • library_dirs=/home/u6/bycycle/lib
  • python setup.py build
  • py setup.py install

Install Trac

  • python setup.py install

Set Up and Configure Trac

  • Create a trac subdomain at trac.bycycle.org
    • Create ~/bycycle.org/trac — projects will live here
    • Create ~/bycycle.org/trac/html — each project will have a Web-accessible directory here
  • Create a .htaccess file in ~/bycycle.org/trac/html that points all requests to any subdirectoy of trac.bycycle.org to the index.cgi bootstrap program in the subdirectory

Create a Trac Project Environment for the Trip Planner

  • cd ~/bycycle.org/trac
  • trac-admin ./tripplanner initenv
  • Edit tripplanner/conf/trac.ini
  • cd bycycle.org/trac/html/tripplanner
  • cp ~/share/trac/cgi-bin/trac.cgi .
  • Edit trac.cgi, adding these two lines at the very beginning of the try clause
    • import os
    • os.environ['TRAC_ENV'] = ‘/home/u6/bycycle/bycycle.org/trac/tripplanner’
  • Create a simple c program, index.c, that puts LD_LIBRARY_PATH=/home/u6/bycycle/lib in the environment and then calls trac.cgi; compile it to index.cgi (Questions: why can’t we use Python instead? Why can’t we add that to os.environ in trac.cgi and get rid of index.cgi)
  • Visit http://trac.bycycle.org/tripplanner/ and make sure it works

TODO

  • Serve static files statically instead of via CGI
  • Look into authentication if necessary
  • Add content!

Keyboard Shortcuts for the Trip Planner Map

Somebody requested keyboard shortcuts for the map a long time ago, and we finally got around to adding them. I actually attempted to do it back then but must have done something wrong because it didn’t seem to work. Then I forgot about it…

For those that don’t know about this, after you click on the map, you can use the keyboard to navigate. You can use the arrow keys to move the map continuously; the page up, page down, home, and end keys to move in larger steps; and the + and - keys to zoom in and out.

Photos for the Portland Tribune

We just had our photos taken for an article on byCycle that’s coming out in the Portland Tribune in its new Sustainable Life section. We’ve heard that the article is coming out next week (Tuesday, August 8th), but we don’t know for sure. Keep an eye out for it, and we’ll post here when we know it’s out.

PS In case anyone is unsure, byCycle is pronounced as two words, like “buy sigh-cle.”