Archive for the 'development' Tag  

The Middlebury Town Plan

September 24th, 2012

Filed under: Life and Everything Else

Tags: , , ,

Today I found unexpectedly good reading in Middlebury’s new 2012 Town Plan. The document is really well done and its quality highlights the vigorous engagement between the town, its citizenry, and businesses that makes this a fabulous place to live.

While all 226 pages are worthwhile, I found Section 2.13  “Land Use – Conservation and Development Plan” to be especially moving. I mean “moving” in a totally serious, non-ironic way. Coming from a town (Carlisle, PA) with rampant “Miracle Mile” commercial development and suburban sprawl, this forward-looking vision of how the town should be developed and improved in coming decades reassures me that 30 years from now Middlebury will be an even better place to live than it is today.

My favorite quote is from Section 2.13, page 151:

A fundamental objective of this Town Plan is to maintain Middlebury as a traditional Vermont town and to prevent incremental change to “anywhere USA”. This is not merely an aesthetic notion, it is a recognized economic development strategy for Middlebury and Vermont. This Plan supports architecture that is designed to fit its context in Middlebury and does not support standardized trade-marked or corporate prototypes.

In 2005 James Howard Kunstler (author of The Geography of Nowhere among other titles) gave a great talk at Middlebury College on human-scale urban development and the lack thereof in much of American urban planning. In his talk he justly derided our own little “Miracle [1/2] mile” by the Hannaford Shopping center. As an avid bicycle commuter who lived south of the village for many years I felt the effects of this poor zoning and development planning on a daily basis as I tried to safely navigate the no-shoulder/no-sidewalk turning-lane and fore-court infested section of road without getting killed. I am very pleased to see that slowly remedying these past lapses is part of the town’s plan for the future.

In addition to spending several hours reading the 2012 Middlebury Town Plan, I heartily recommend taking another hour to watch William H. Whyte’s The Social Life of Small Urban Spaces – The Street Corner. My favorite part is at 12:00: “People tend to sit where there are places to sit.”

Git Tip: Grouping feature-branch commits when merging.

December 12th, 2010

Filed under: Computers and Technology , Work/Professional

Tags: , ,

Let’s say you are working on a large feature or update that requires a bunch of commits to complete. You finish up with your work and are then ready to merge it onto your master branch.

For example, here is the history of my drupal repository after some work updating the cas module to the latest version (and to support the new version of phpCAS):

As you can see, I have a number of commits, followed by a merge in with the new module code, followed by some more commits.

Now, if I merge my feature branch (master-cas3-simple) into the master via

git merge  master-cas3-simple

then the history will look like this:

While the history is all there, it isn’t obvious that all of the commits beyond “Convert MS Word quote…” are a single unit of work. They all kind of blend together because git performed a “fast-forward” commit. Usually fast-forward commits are helpful since they keep the history from being cluttered with hundreds of unnecessary merge commits, but in this case we are loosing the context of these commits being a unit of work.

To preserve the grouping of these commits together I can instead force the merge operation to create a merge commit (and even append a message) by using the --no-ff option to git merge:

git merge --no-ff -m "Upgraded CAS support to to cas-6.x-3.x-dev and phpCAS 1.2.0 RC2.5" master-cas3-simple

This results in the history below:

As you can see, merging with the --no-ff option creates a merge commit which very obviously delineates work on this feature. If we decided that we wanted to roll back this feature it would be much easier to sort out where the starting point before the feature was.

Thanks to Vincent Driessen for turning me onto the utility of the the --no-ff merge option via his post “A successful Git branching model“.

Setting up CAS development on OS X

June 19th, 2009

Filed under: Work/Professional

Tags: , , , ,

Central Authentication Service (CAS) is a single-sign-on system for web applications written in Java that we have begun to deploy here at Middlebury College. Web applications communicate with it by forwarding users to the central login page and then checking the responces via a web-service protocol.

A few months ago Ian and I got CAS installed on campus and began updating applications to work with it rather than maintaining their own internal connections to the Active Directory server. Throughout this process we ran into a few challenges (such as returning attributes with the authentication-success response) and a bug in CAS, but we worked through these and got CAS up and running successfully.

We are now at a point where we need to do some customizations to our CAS installation to deal with changes to the group structure in the Active Directory. As well, the bug I reported was apparently fixed in a new CAS version, an improvement I need to test before we update our production installation. Both of these require a bit more poking at CAS than we can do safely in our production environment, so I am now embarking on the process of setting up a Java/Tomcat development environment on my PC. I’m documenting this process here both for my own benefit (when I have to set this up again on my laptop) and in case it helps anyone else.

Read on for my step-by-step instructions for setting up a CAS development environment on OS X.
Continue Reading »

Ruby and Rails Thoughts

February 3rd, 2009

Filed under: Computers and Technology

Tags: , , ,

I’ve decided to learn a few new programming languages and web frameworks over the next year or so to broaden my experience and just to have fun. I figured that I’d start with Ruby and its Rails framework. Python (and its Django framework) are also at the top of my list, but I seem to run into Ruby programs more often and the Rails fanatics are loudest, so I’m starting there.

After about 5 evenings of documentation and tutorial reading intermixed with a bit of programming I’m about 1/3 of the way through my first real Rails application and am beginning to have a few thoughts on Ruby, Rails, and the process of learning new languages and frameworks:

Languages are Easy…
This might have something to do with how my brain works, but I find learning new programming languages quite easy and extremely interesting. Some of the things I find really neat about the Ruby language:

  • Full-on object-oriented — I really like the consistency
  • Blocks and Iterators — I fell in love with blocks in SmallTalk, they are a great concept and so much easier to use than named callback functions
  • Method names can end in equals such as name=(newName), parentheses are optional, and spaces seem to be allowed in method names that include ‘=’, so attribute-setting methods can look syntactically identical to variable assignment operators. Example: adam.name=('Adam') is equivalent to adam.name = ('Adam') and is equivalent to adam.name = 'Adam'. Sweet syntactical sugar.
  • All instance variables are private. Always. The snazzy setter/getter syntax can spoof the idea of public attributes while still retaining actual methods to do the work. (I never got the point of public attributes other than as a way to avoid other languages’ painful getter/setter syntactical requirements.)
  • Classes are never closed — can always add a method
  • Single-inheritance prevents ambiguity in the class-hierarchy, but there is this concept of ‘Mix-ins’ where the un-closed nature of classes (I think) allows for a class to obtain method implementations from another class without inheriting from it. It sounds interesting, but I haven’t played with it yet

The Ruby language may have some blemishes (and apparently a slow interpreter), but it seems like a pretty nice language in general and pretty devoid of major syntactical or conceptual warts.

…Frameworks are hard
While I feel like I can [mostly] get my head around Ruby in a few days, Rails is another matter. Rails follows a few architectural concepts very strictly: convention over configuration, DRY, MVC, etc. One of the problems (at least with the tutorials and documentation on the Rails website) is that few of the convention have descriptions on how they should be applied and the documentation is scattered and can be hard to follow. A lot of magic happens behind the scenes when things are named a certain way and it can be hard to sort out what’s up when something goes wrong.

One problem I ran into that took me forever to debug was that by naming one of my classes Connection and using it in a has_many relationship I collided with something internal to ActiveRecord which caused an indecipherable error when trying to save my object. Connection is not one of the reserved words listed for Rails.

It may just be that I need to find a good book for Rails, but the official online documentation seems to be rather sparse, disorganized, and/or scattered. I don’t mean to complain too much and I believe that Rails will become much easier to use after I have a bit more time in the saddle, but it is a complex system that is not easy to learn a bit at a time.

I don’t want to dwell on on comparisons, but I must note that I have been very spoiled by PHP’s excellent official documentation at PHP.net and for the Zend Framework. PHP has more warts than, well, something with a lot of warts, (it has many, many warts), and doesn’t begin to compare to Ruby in syntactical elegance, but good documentation is also a valuable thing.

With all this said, I now have only 5 evenings in Ruby on Rails and I plan to give it at least twice that more. I hope by the end of this first project I’ll be comfortable enough with it to use it on other small to medium-sized applications with relative speed and ease.

Git Tip of the Day: Stage Hunks

January 13th, 2009

Filed under: Computers and Technology , Work/Professional

Tags: , ,

One of the great things about the Git version-control system is the ability to incrementally commit your changes on a private branch to keep a step-by-step record of your thought and writing process on a fix or a feature, and then merge the completed work onto your main [or public] branch after your feature or fix is all done and tested. By keeping an incremental log of your changes — rather than just committing one giant set of code with changes to 30 files — it becomes much easier to know why a certain line was changed in the future when bugs are discovered with it.

One thing that often happens to me though, is that I work for about a half hour to an hour trying to get a new piece of code working and in the process make several sets of changes to one file that are only loosely related.

Let’s say that I am fixing a bug in my ‘MediaLibrary’ class and while doing so notice some some spelling mistakes in some comments that I fix. Now my one file has two changes my bug fix, and the spelling fix. Rather than committing both changes together with one comment describing both changes, I can highlight one of the changes in git-gui and select the “Stage Hunk for Commit” option.

Screen-shot of Staging a Hunk of code

With that one hunk staged I can now commit with a message applicable to that change. Other changes can then be staged and committed with their own messages resulting in a very understandable history of changes.

“Stage Hunk for Commit” can also be used to commit important changes while not including debugging lines inserted in your code.

WordPress Enclosure Adder

September 6th, 2007

Filed under: Computers and Technology , Software

Tags: ,

I’ve recently developed a small PHP script, the WPEnclosureAdder (source | try) that goes through each item in an RSS feed, looks for links to YouTube videos or GoogleVideo videos, and then adds an enclosure tags for the videos. If multiple videos are found embedded in a post, then that post is duplicated in the feed for each additional URL to provide compatibility with the many RSS readers/video-podcast viewers that expect a single enclosure per post.

I wrote this script because I have been recently making heavy use of Miro (formerly known as “The Democracy Player“) to download videos from YouTube in order to watch them off-line. Miro also provides a nice UI for aggregating videos and remembers my spot when I go back to watching later (nice for long documentaries). Miro however, expects links to videos in RSS enclosure tags, something that WordPress (and probably other blogging software) doesn’t do for embeded videos.

Throw Away Your Telescreen is a video blog done by one of my favorite geo-political bloggers, Dave on Fire, and a few others. In it they link out to the most interesting “documentaries, lectures, and interviews that follow a different editorial line” from the corporate press. I highly recommend all of the videos on it that I have seen.

Throw Away Your Telescreen has all the makings of an indie-news channel, perfect for Miro which was developed to encourage participatory media and culture. The only thing missing was to get the videos embedded in Throw Away Your Telescreen’s posts in such a way that Miro can find them. With the WPEnclosureAdder, this has now been done. Use this feed to view Throw Away Your Telescreen in Miro.


More about the WPEnclosureAdder:

  • View the source-code of the latest version. (save-as to download)
  • License: GNU General Public License (GPL) version 3 or later
  • Requirements (for hosting it yourself): PHP version 5.2 or later
  • Git Repository: http://www2.adamfranco.com/WPEnclosureAdder.git

I wrote this script with Throw Away Your Telescreen in mind, but it should work with any other WordPress blog, and probably with RSS feeds generated from other blogging tools. To point it at another blog’s RSS feed, enter the feed url in the form below:

Using my version will use my default search strings for YouTube and GoogleVideo videos. If you would like to change what is being searched for, please download the script, change the configuration, and host it on your own website. I have licensed the WPEnclosureAdder under the GNU General Public License (GPL) version 3 or later, so you are free to copy and modify this script as per the terms of that license.

KML Joiner

August 29th, 2007

Filed under: Computers and Technology , Software

Tags: , , ,

As of a few days ago, I am now able to generate KML versions of Flickr photosets for viewing in Google Earth/Maps. With that taken care of, I also want to easily combine these KML documents of images together with other KML files that show additional information, such as paths traveled, points of interest, etc.

To accomplish this task, I have written a new script, the KML Joiner that will combine any KML documents on the web together into a single (referenced) KML document. (try it out)

More Detail: for those interested in KML
The resulting document is a collection of network links, each of which points to one of the KML URLs specified. Doing this rather than combining their text together into a static KML document prevents style collisions as well as allows changes in the source data to propagate to the combined document.

Refresh intervals can optionally be specified for every source document allowing for a server-friendly combination of static data with rapidly changing data. By default, no refresh interval is specified, making the linked documents load only once when first accessed.

Example:

View the KML Joiner with fields filled in that generates the map below.


View Larger Map

The map above is of the trip mentioned in a previous blog post, but this time the data sources (1. a static KML file with the path and house placemark, 2. a dynamic KML document generated with my Photo set to KML script) joined together with the KML Joiner script instead of manually put together with a text editor.

Usage:
You are welcome to use this script hosted on my site, or you can download it and run it on your own computer/webserver.

This script is available under the GNU General Public License (GPL) version 3 or later. (Source Code)

Please post any suggestions for fixes or changes. Thanks!

Blogspot/Blogger RSS generator

May 16th, 2007

Filed under: Computers and Technology , Software

Tags: ,

Quite a few of my friends and relatives make use of Blogger/Blogspot for their weblogs. While Blogger seems to be a great service and very easy to use, what annoys me is that RSS feeds are often disabled on Blogger weblogs. Maybe people are setting this on purpose, maybe they are turning off RSS feeds unintentionally, or maybe that is the default. Either way, I read all of my news and blogs in an RSS reader. Friends & family blogs and photo-streams make up about 25 of the 100+ feeds I subscribe to. If a blog doesn’t have an RSS feed for me to subscribe to, I’m never going to remember to read it.

So, my work-around for Blogger was to write a screen-scraping RSS generator that creates an RSS feed from a Blogger weblog. BlogspotRSS is a simple PHP5 script that makes use of XPATH queries to turn the Blogger weblog into an RSS document. If you have a web server with PHP5, please download BlogspotRSS and run it on your own web server to save my bandwidth.

The BlogspotRSS script is licensed under the GNU General Public License (GPL).

Notes:

  • It seems that some of the Blogger themes change the HTML quite a bit. I’ll have to fix up the RSS generator to make it work with a few more themes than the ones I tested it on…