Regex from the dark lagoon

November 13th, 2013

Filed under: Computers and Technology , Work/Professional

Tags: , , ,

As a software developer or system admin have you ever encountered regular expressions that are just a bit too hard to understand? Kind of frustrating, right? As a rule, regular expressions are often relatively easy to write, but pretty hard to read even if you know what they are supposed to do. Then there is this bugger:

/^(?:([0-9]{4})[\-\/:]?(?:((?:0[1-9])|(?:1[0-2]))[\-\/:]?(?:((?:0[1-9])|(?:(?:1|2)[0-9])
|(?:3[0-1]))[\sT]?(?:((?:[0-1][0-9])|(?:2[0-4]))(?::?([0-5][0-9])?(?::?([0-5][0-9](?:\.[0-9]+)?)?
(Z|(?:([+\-])((?:[0-1][0-9])|(?:2[0-4])):?([0-5][0-9])?))?)?)?)?)?)?)?$/x

This is the most complex regex I’ve ever had need to write and I just had to share. Can you guess what it might do? ;-)

Continue Reading »

Further north and farther east — an exploration of Nova Scotia

September 11th, 2013

Filed under: Life and Everything Else

Tags: , , , , ,

This entry was original published as a Ride Report on the Adventure Rider (ADVrider) forums. The only changes are reformatting to flow as a single article.

Prologue

I’m continually thankful that I get to live in one of the more scenic corners of the planet. Central Vermont boasts numerous twisty roads that tie together charming villages over rolling farmland and steep mountainsides. While my back-yard riding options are nothing to take for granted, it was traveling by motorcycle that attracted me to riding in the first place. I have the travel-bug and long to explore exotic places. Reading the fabulous trip reports at ADVrider has only fueled a greater hunger to step out of my day-to-day environment and explore new places. Since the Rocky Mountains are too far to fit into my vacation schedule this summer, I settled on maritime Canada (and Nova Scotia in particular) as a suitable destination from my two-week end-of-summer trip. As an inlander, the sea-coast provides a novel and ever changing landscape to feast my eyes upon and the population density seems about right to allow me to get a bit of wilderness fix while never being too far from the next town. I also wanted to try my hand at locating camping spots on deserted beaches and former logging cuts as a way to get away from the RV crowd at public campgrounds. While I wasn’t quite sure what to expect on the ground, zooming around in Google Earth seemed to indicate many likely-suitable spots in Canada and Maine where no one would notice or mind a tent for the night.

My best guess at a planned route:

(The actual route can be seen below at the end of this post)

While the vacation itself is certainly the goal, at least 25% of the fun is thinking about and preparing for the adventure. In the weeks leading-up to the trip I took care of various maintenance on the bike, changing the oil and tires as well as adding a top-case and a few other bits and bobs. This trip also gave me an excuse to refresh my camp stove and a few other pieces of gear I haven’t needed in a while. One of the things I thought I’d try out was this brand new super-hydrophobic-and-oleophobic coating called “NeverWet”. After watching their YouTube videos I thought, “this would be perfect to keep water/mud off my boots/riding-pants”. I’ll come back to this later, but the moral of the story: don’t. Preparations began in earnest a week out and by the night before I had the house clean, the bike packed, and was ready to go.

Continue Reading »

curvature.py — find the most twisty-turny roads around

December 5th, 2012

Filed under: Computers and Technology , Software

Tags: , , , , , , , ,

Update October, 2013: Google Earth KML files generated by curvature.py are now available covering the entire world.

In the process of taking up motorcycling this summer I also gained an additional hobby: scouring maps and travel guides to find the roads that would be most fun to ride. While I’ve had great times on dirt roads through farmland and wide open highways, there just isn’t anything that compares to the thrill of leaning through the corners on a winding road.

While I’ve had some good successes in locating roads by map (such as Tracy Road), one of the shortcomings of a map is the tight curves you can really lean into tend to be below the resolution for many maps. Atlases and electronic maps like Google Earth allow you to zoom in, but then there is the problem of finding the gems in the sea of data. What I realized I needed was a way to highlight just the most curvy roads so that I would know where to explore next.
Continue Reading »

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.”

Vermont to Michigan on a motorcycle

July 13th, 2012

Filed under: Life and Everything Else

Tags: ,

In 2005 I took a 3-week trip around Turkey with my parents and brother. Mid-way through this fabulous trip we met the affable Roland Pfitzenmaier, a German man touring the middle east on a Triumph motorcycle. While I am someone who usually travels with a full load of gear — bicycles, kayaks, and all the rest — the minimalism of Roland’s trek was intriguing. This summer my father was kind enough to lend me the use of his motorcycle (a 1993 BMW R100R) and I figured that there was no time like the present to try a long-distance motorcycle tour. Now, I’m well aware that for serious iron butts a 2,000 mile round-trip isn’t all that far — but for someone who is just getting into riding and has only done day-trips, four straight days on the road each way would be a significant journey.

My family has a small cabin on a lake in northern Michigan where I every summer growing up. Since moving to Vermont 14 years ago my attendance has slipped somewhat as the trip lengthened to a driving time of 15-17 mind-numbing hours along the flats of the New York Throughway and various mid-western highways. That said, I still try to make it to the lake at least once every few years. Since I took the full month of July off from work I figured I’d make the trip via motorcycle this time and learn if this sort of travel was for me.

To keep things interesting I planned a route out that would avoid expressways as much as possible and give me a chance to see the landscape of central Ontario — a region I haven’t seen before.

Total distance: 1077
Total moving time: 23 hours, 17 minutes
Average speed: 46 mph


View Larger Map
Key: blue line – planned route, red line – actual route

Continue Reading »

Black Bean Crostini

June 15th, 2011

Filed under: Life and Everything Else

Tags: , ,

252/365: Tomatos in SacksOne of the joys of participating in a CSA is exploring new vegetables and foods that I otherwise wouldn’t have known about or thought to eat. Last year we received husk cherries, red carrots, bok choy, several types of kale, purple potatoes, and at least 4 varieties of beets in addition to many more standard vegetable varieties. I don’t consider myself sheltered in terms of food, but many of these were simply things I never would have thought to look for even if they are available in a grocery store.

241/365: Red CarrotsFor the past two weeks our CSA share from the Gildrien Farm has included several cups of dried black beans, a food I’ve eaten many times but never really cooked with. In their weekly letter Jeremy and Caitlin helpfully included a recipe for Puerto Rican Black Beans, a tasty-sounding launching pad for the evening’s dinner.

Since I didn’t have any bacon grease on hand I figured I would just fry up several large pieces of bacon and use both the meat and the grease. I had planned to make a fritata as the main course for the evening, but after sampling the beans, decided to add some more veggies and put them on bread as our main course. Unfortunately, the result was so delicious that the crostini never made it out of the kitchen for a photo shoot.

Black Bean Crostini

  • 1 cup dry black beans, soaked overnight
  • 1 large onion, diced as small as possible
  • 1/2 a red pepper, diced
  • 1/4 lb of bacon (4-5 pieces)
  • 1 cup of cherry tomatoes, quartered
  • salt
  • 1 baguette
  1. Soak the beans overnight to soften, then simmer over medium heat for 45 minutes until tender.
  2. While the beans are cooking, fry the bacon in a skillet over medium heat until it is crispy and most of the fat has melted off. Pull the bacon strips out of the pan and let cool, trying to keep as much of the grease in the skillet as possible.
  3. Turn down the heat on the skillet to low. Add the diced onion and some salt to the bacon grease in the skillet and cook for 15 minutes, slowly letting the onion turn clear and caramelize.
  4. Drain the majority of the water from the beans (leaving about a half cup) and add the beans and their water to the skillet with the onion and bacon grease. Stir together with the red pepper. Raise the heat to medium and stew for another 15 minutes or so, until the beans begin to fall apart.
  5. Mash the beans in the skillet with a utensil of some sort until you have chunky bean paste interspersed with red-pepper and bean husks. Crumble the bacon and stir it into the beans. Salt to taste.
  6. Cut the baguette into thin slices. Pile a large dollop of beans on each slice and top with diced cherry tomatoes.

River Levels Widget v.1.2.2 available

March 23rd, 2011

Filed under: Computers and Technology , Software

Tags: ,

RiverLevels 1.0 Screen Shot

The RiverLevels widget provides an easy way to monitor the amount of water flowing in your favorite streams and rivers right from your Dashboard. The RiverLevels widget is of particular interest to whitewater kayakers and canoeists.

Once any United States Geological Survey (USGS) stream-gauge station is selected, it is automatically refreshed to always provide you with the latest graph of the water-level. As of version 1.2 you can choose between two graph styles: discharge in cubic feet per second (CFS) and water-height in feet.

This widget is Free software, licensed under the GNU General Public License (GPL) version 3 or later.

Requirements:

  • OS X – 10.4 “Tiger” or later

Change Log:
1.2.2 (2011-03-23)

  • Fix for image URL change in USGS site.

1.2.1 (2008-02-10)

  • New zip archive includes the ‘library’ directory missing in the 1.2 release.

1.2 (2008-02-06)

  • Fixed Leopard (10.5) compatability bug.
  • Added the ability to choose Gauge Height (ft) in addition to discharge (CFS).

1.1 (2007-01-08)

  • Fixed graphs extending off bottom of widget
  • Fixed invisibility of front refresh icon

Mission-Style Bookshelf

February 12th, 2011

Filed under: Life and Everything Else

Tags: ,

My current woodworking project is a Mission-style bookshelf that I designed to match the sofa table that I built last year. The bookshelf will sit below a window to the kitchen, so it is low and extra wide to fit that space. To support the weight of the books without sagging, sets of stiles transfers weight from the middle shelf to the frame above and below.

I am building the bookshelf out of cherry. Like the sofa table, all joinery is mortise and tenon. This time I am squaring out the mortises with a new set of mortising chisels rather than rounding off the tenons with a knife as I did on the sofa table — which is making the process go much faster.

If you like the design and wish to build one for yourself, you can download my SketchUp model as a starting point.

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“.

Mirroring a Subversion repository on Github

December 5th, 2010

Filed under: Computers and Technology , Work/Professional

Tags: , , , ,

For the past few months I have been doing a lot of work on the phpCAS library, mostly to improve the community trunk of phpCAS so that I wouldn’t have to maintain our own custom fork with support for the CAS attribute format we use at Middlebury College. The phpCAS project lead, Joachim Fritschi, has been great to work with and I’ve had a blast helping out with the project.

The tooling has involved a few challenges however, since Jasig (the organization that hosts the CAS and phpCAS projects) uses Subversion for its source-code repositories and we use Git for all of our projects. Now, I could just suck it up and use Subversion when doing phpCAS development, but there are a few reasons I don’t:

  1. We make use of Git submodules to include phpCAS along with the source-code of our applications, necessitating the use of a public Git repository that includes phpCAS.
  2. The git-svn tools allow me to use git on my end to work with a Subversion repository, which is great because…
  3. I find that Git’s fast history browsing and searching make troubleshooting and bug fixing much easier than any other tools I’ve used.

For the past two years I have been using git-svn to work with the phpCAS repository and every so often pushing changes up to a public Git repository on GitHub. Our applications reference this repository as a submodule when they need to make use of phpCAS. Now that I’ve been doing more work on phpCAS (and am more interested in keeping our applications using up-to-date versions), I’ve decided to automate the process of mirroring the Subversion repository on GitHub. Read on for details of how I’ve set this up and the scripts for keeping the mirror in sync.

Continue Reading »

Next »