Portland is fun

While the weather has not cooperated and given me many sunny days yet, I have been enjoying exploring the cyber-presence Portland has, in particular the Craigslist offerings. Today, however, brings a new entry in the NW Nerdery: a movement to rename 42nd Ave to Douglas Adams Blvd. The site, rename42nd.org, is making a serious effort to have the 42nd Ave renamed in honor of Douglas Adams, most notable for authoring the Hitchhiker's Guide to the Galaxy series. My inner geek smiles wide for this effort and hope they succeed. If you are a Portlander, support the movement. I know I am…

7 Days, 7 Nights, 7 Minutes

One of the projects I've been helping get off the ground is I Live Inspired, an inspirational text-messaging service. The site is good, and the concept is great. One can never have too much inspiration. The founders, Rob and Chris, are on a mission. They are seeking an audience with the Dalai Lama in Indiana and are walking 7 days in hopes of getting a 7 minute audience. They are also keeping a blog of their adventures. These guys are not much older than me and are trying to get a positive service off the ground. Whether they have audience with the Dalai Lama or not, the experience of the walk, the people they've met thus far, and the people they've yet to meet, will change their lives. And we get to share in that through their writing. So take a minute, read up on what the future of America is up to, and if you want some extra inspiration delivered to your phone daily, consider signing up for one of the many great communities at I Live Inspired. * Disclaimer: While I have helped create the site, I do not receive any compensation for spreading the word. I think its a great service and deserves notice.

Pambiche

While highlights abound on the Portland tour, one in particular deserves mention. I've dined at some pretty sweet places and eaten some fairly exotic foods. While they've all been good and memorable, I found that a little Cuban place in Portland has taken the top spot in my dining history. What's amazing about Pambiche is the unassuming atmosphere surrounding the restaurant. Walking up to, I had no idea what I was about to experience. Sadly, I was only able to eat there once while in the city, so I can only speak to one dish, Ajiaco. Described as a "one pot meal that comes brimming with a variety of tropical roots and vegetables, corn dumplings, creole seasoned pork and beef", this tasty meal was unlike any other food I'd tasted. Very subtle flavors and aromas with each spoonful pleased my tastebuds and tummy. And while Cuban food is not traditionally spicy, Pambiche had a homemade spicy sauce which complimented the dish wonderfully. I am not a food critic so it's hard to do the experience justice. Next time Portland dining is available, head over to 2811 NE Glisan and taste it firsthand. I plan on doing just that!

Don't call this number

Telemarketers suck. Soon they will be getting your mobile number. To prevent unsolicited phone calls, give a ringy dingy to 888-382-1222 and take a minute of your time to get on the national Do Not Call list. Make sure you are calling from the phone with the number you are registering. This public service announcement brought to you by the number 15, the number 17, and the letters C and D.

August 27th Emails

I just received an email about August 27th and the proximity of Mars to the Earth. The email claims that Mars will be close to 34 million miles from Earth, the closest it will get for another 2000 years, a distance which will cause it to appear as bright as the moon in the night sky. While the claim is valid, it is what the email leaves out that makes it annoying: the year. This event occurred in 2003, and while Mars was the 4th brightest object in the sky (behind the sun, moon, and Venus), it was still just a small point of light. You can read more at NASA's page concerning the hoax. It is dated from 2005, but explains the email hoax (which has been circulating since 2004) and what is true and misleading about it. So if you get the email, please don't forward it on. It's so 2003…

Portland Gets Greener

I admit, I was hesitant to believe I was actually going to relieve myself of my car when I moved to Portland. St. Louis definitely requires the car to get to almost anywhere I wanted to go. Plus when I need to haul stuff…you can only carry so much on your back and in your arms. So it was with great relief that I found Flexcar via EcoGeek. From Flexcar's site:

Welcome to a new era in personal transportation. It's called car-sharing and it's incredibly easy! You share access to hundreds of Flexcar vehicles, often within a five-minute walk of your home or work. You reserve a car online or by phone; you drive - to a meeting, to run errands, or to hit the lumber yard; and you return to the car's designated parking space, all for one hourly rate that covers gas, premium insurance and 150 free miles. All you pay for is the drive. How simple is that? Plus, Flexcar is convenient, affordable, reliable, and great for the planet. Join the transportation revolution that washingtonpost.com called the "wave of the future."

I looked at their monthly savings calculator and found the numbers quite pleasant: My average cost of ownership is about $550 per month, mostly depending on the number of miles (which affects gallons of gas purchased and oil changes needed) I drive per month. The cost of Flexcar, based on the number of hours per month, broke down like this: 5 hours per/month 45.00 10 hours per/month 85.00 25 hours per/month 200.00 50 hours per/month 375.00 So even at a high volume clip, I'm still saving $200-$300 a month. Plus, if I reduce my driving to almost none (which is my intention), that's $500 or so a month I get to keep in my account. Granted, there will be other costs, like bus passes and the like, but by and large, I'll be saving $6,000 a year, and that's nothing to scoff at.

Greener Communities

Given the buzz around a new site that ranks your location according to its "walk score", I thought I'd take a look at how the various places I've lived over my lifetime are stacking up today. The general idea is that a community with a higher score is easier to get around in on foot, there by reducing or removing the need for a car. I have to say, my upcoming move is highly motivated by the desire to be rid of my car for a while.

  • Strasburg, VA: 51
  • St. Louis, MO (High School): 26
  • Elsah, IL (College): 9
  • First house (STL): 54
  • First townhome (STL): 35
  • Second house (STL): 57
  • Upcoming move to Portland area: 82

Definitely moving up the score ladder. I'd like to think that in a couple years I'll be able to get car that plugs into the grid rather than into a gas station pump. At the least I'd like a car that can run on ethanol (a great cellulosic ethanol infrastructure would be great) or biodiesel. But who knows, Portland may be destination forever, and public transportation, biking, and walking may meet my transportation needs. At any rate, I'm looking forward to the move on many different levels.

Eat local

It's no secret that to the best fresh fruit and veggies are the ones that travel the least to get to your kitchen. That's why it is so important to spend your time and money at your area farmer's markets. The benefits, short and long term, far outweigh the negatives. Sure, I can get corn 4/$1 at my local supermarket, but its pretty blah on its own and needs help. Conversely, locally grown corn purchased at the farmer's market near me is delicious without any help from seasonings. With that in mind, it is sometimes hard to know where these purveyors of fresh, local produce can be found. Fortunately there a plenty of websites that can get you started on your search. Two that I have found recently and like the cut of their gib include:

These only open the door to the possibilities near you. One thing to remember…it's perfectly okay to eat seasonal food in season and leave it when the item is out of season. Abstaining from out-of-season foods will liven up your menu by exposing you to a wider array of choices and who doesn't like variety? And sure, this all takes effort, but I think this is effort well spent. Enjoy your local markets!

Airplanes!

It has been a while since a good time wasting game came across my browser. This one is fun, but once you learn the secret, it's less challenging and more luck to get the super high distances. Throw a paper airplane and see where you stand. Me, I'm currently 5608 globally with a distance of 114.452m. [Update 6/19/2007 5:31 CST] 114.717m for a global ranking of 2766.

cribbage.erl

Coupling Cribbage and Erlang into a program sounds like a fun little program to write to aid in learning Erlang while writing a program that brings a game I like in life to the virtual world. Is it the most efficient? Probably not, but you gotta start somewhere. To the code! The first thing I wanted to do was create a method to calculate points. An ace is a 1, 2-10 are face value, and Jack, Queen, King are 11, 12, 13, respectively. Easy adjustments could be made to allow characters (A, J, Q, K) but for now, I like keeping it simple.

-module(cribbage).

-export([points/1]).

points([]) -> 0;
points(L) ->
    Hand = lists:sort(L),
    fifteens(Hand, 0) + runs(Hand, 0, 0) + pairs(Hand, 1, 0).

The above creates a module called cribbage and exports a function called points/1 which takes one parameter, a list of cards. There are three kinds of scoring in Cribbage: combinations of cards that equal 15, runs of three or more, and pairs (or sets or four of a kind). There is one other kind, but it's not part of this portion of the game.

cardval(C) when C > 9 -> 10;
cardval(C) -> C.

fifteens(_L, Total) when Total > 15 -> 0;
fifteens(_Hand, Total) when Total =:= 15 -> 2;
fifteens([], _Total) -> 0;
fifteens([H | T], Total) when Total < 15 ->
    fifteens(T, Total) + fifteens(T, Total + cardval(H)).

cardval is a function that converts the value of face cards (11-J,12-Q,13-K) to 10 and leaves other cards unchanged in value. This is useful in finding all combinations of 15 in the hand. When a combo equals 15, two points are added to the score. Runs were the trickiest of the three to get right. First, I defined a simple function to determine the points for a run of given length.

run(3) -> 3;
run(4) -> 6;
run(5) -> 12;
run(_Length) -> 0.

Some people may play with different values for runs of different lengths, so this allows for easy editing. Runs come in two flavors: 1) A normal run, and 2) A run where one or two of the cards are doubled. To account for this, I have runs/3 and runs/4. runs/3 handles the first case, and passes control to runs/4 when a run of the second case is encountered. Another special case is when a run has two different cards doubled (e.g. 3,4,4,5,5) where the run of three is doubled and doubled again.

%% two cases for runs
%%   1. A straight run - 4,5,6,7
%%   2. A run with a double in the sequence - 4,4,5,6 or 4,5,5,6
runs([], _Curr, Len) -> run(Len);
runs([H | T], Curr, Len) when H =:= (Curr+1) -> runs(T, H, Len + 1);
runs([H | T], Curr, Len) when H =:= Curr -> runs(T, Curr, Len, {H, 2});
runs([H | T], _Curr, Len) -> run(Len) + runs(T, H, 1).

runs([], _Curr, Len, {_Card, Mult}) -> Mult * run(Len);
runs([H | T], Curr, Len, {Card, Mult}) when H =:= (Curr+1) ->
    runs(T, H, (Len+1), {Card, Mult});
%% needed for special cases where multiple cards are doubled up
%% like 3,4,4,5,5
runs([H | T], Curr, Len, {Card, Mult}) when H =:= Curr, H > Card -> 
    runs(T, Curr, Len, {H, (Mult*2)});
%% handles a triple carding, like 2,2,2,3,4
runs([H | T], Curr, Len, {Card, Mult}) when H =:= Curr ->
    runs(T, Curr, Len, {Card, (Mult+1)});
runs([H | T], _Curr, Len, {_Card, Mult}) ->
    (Mult * run(Len)) + runs(T, H, 1).

For pairs, I do a similar thing: define a pair(Length) function that returns the point value given a number of similar cards. But it's all pretty straightforward.

pairs([], Pairs, _Curr) -> pair(Pairs);
pairs([H | T], Pairs, Curr) when H =:= Curr -> pairs(T, Pairs+1, Curr);
pairs([H | T], Pairs, _Curr) -> pair(Pairs) + pairs(T, 1, H).

pair(2) -> 2;
pair(3) -> 6;
pair(4) -> 12;
pair(_Length) -> 0.

That's it for now. Actual game play to come. You can get the code here.