Despite reports to the contrary…

…I’m still alive and plugging away at BeerRiot code. I thought you all might just like to hear that despite the fact that I haven’t made a post here in a while, or updated the news section on the site, development is far from dead. There are things in the works, and I hope they will be ready soon.

But, I’m running into the oldest code-project slow-down in the book.[1] New code is making me rethink old code. Especially since I was much more of an Erlang amateur at the start of this project, my old code often looks ugly now. So, since my new code is doing very similar things to some of the oldest code here, I’m reworking the old stuff - mainly to avoid duplication, of course, but also because I understand the domain better now.

Unfortunately for you, the user, I’m still having quite a fun time slinging Erlang around, so it’s hard for me to just say, “Enough - post it!” But, I think I’ve defined the final goals, and the web of changes is starting to contract. The updates should happen soon (probably within a week), and then there will be lots of new toys to play with. :)

[1] Okay, so actually, there are older slowdowns in the book, but I ran into them too (that is, real life has demanded extra attention recently). But I think there’s a lull in them for a while, so things should progess faster now.

Why YOU Should Drink Green

Wait! Before you skip this post thinking that I’m just another “tree hugger” ranting about saving the planet, I want to tell you that I’m going to divide this post into two parts. The first part will be reasons you should drink green that only affect your enjoyment of the beer. Only the second part will be about why drinking in this manner also saves the planet. I’ll let you know before the switch.

Okay, well let’s get on with it!

First of all, there are several things you should be doing to ensure that you’re drinking green. In no particular order, here are my top several:

  • Drink from a glass.
  • Drink local beer.
  • Drink seasonal beer.
  • Drink ales.
  • Drink barley.
  • Enjoy cellar temperature.
  • Love yeast.

Some of those are going to need explaining. So, here are the reasons for each of them, in how they relate your your beer enjoyment.

Drink from a glass. If you’re drinking from a bottle, you’re severly limiting your ability to taste the beer. A large portion of a human’s taste sensation comes from smell. A glass allows your nose to get right down in the aroma.

Drink local beer. For all of its exploits, all around the world, beer is, at some level, a fragile, tempermental beverage. It needs to be stored in a dark place, at a proper temperature. Even then, it has a maximum shelf life of only a few months. Drinking locally means that you have the best chance of enjoying that beer before it has been subjected to terrible storage practices.

Drink seasonal beer. Same as above, beer has a maximal shelf life, and should be drunk as soon as it’s ready. Find out what’s in season and drink it in its prime.

Drink ales. The world of ales is vast. Pale, IPA, Brown, Strong, Stout, Porter, Wheat, Red - and that’s not even making a dent. If you’re looking for a particular flavor, there is an ale to match it.

Drink barley. If you’re a typical American, you get your daily fill of corn without even thinking about it. Demand that your beer supply you with something else. Barley has a complex flavor all its own, and nutrients to match. Seek the different roasts, and never be bored.

Enjoy cellar temperature. Ice-cold serving does one thing: numbs your taste buds. You’re drinking a fine beverage - why would you want to avoid its taste? Store and enjoy your beer at cellar temperature - you’ll find more flavor that way.

Love yeast. Yeast is a very simple organism that plays a very large role in beer’s flavor. Some beers (include real ale, unfiltered wheats, and bottle-fermented varieties) still have yeast (alive and/or dead) in the beer while you drink it. This adds yet another flavor for your tongue to ponder. Yeast is also a great source of vitamin B - so it’s good for more than just your tongue.

Alright, this is the point where I go all tree-hugger on you. Hopefully I’ve caught enough of your interest with the points above that you’d like to know why these things are important for more than just taste. If so, read on.

Drink from a glass. If you’re drinking from a glass, you most likely had your beer poured from a keg. That means no extra energy was wasted on making a bottle, cleaning a bottle, or transporting a bottle. Just make sure it’s a reusable glass.

Drink local beer. If your beer is made locally, much less energy has been used in getting it to you.

Drink seasonal beer. It takes extra energy to provide conditions in which to brew unseasonal beer out of season. Embrace the cycle.

Drink ales. Lagers must ferment (and be stored) at much lower temperatures than ales. If you know someone that still makes lagers by burying casks in caves, covering them with ice harvested from a lake in the winter, then good for you, and drink up. However, most lagers are brewed by refrigerating large warehouses, and delivered in refrigerated trucks.

Drink barley. Americans are practically made of corn. Barley is an excellent source of nutrition, and encouraging its growth means that our farms have other profitable crops to fall back on when weather ruins corn crops. It’s unhealthy for the planet to run farming monocultures.

Enjoy cellar temperature. Even if you’re not drinking a lager, if your ale is served ice-cold, it’s being refrigerated in a way that is completely unnecessary. Turn the thermostate up a few degrees, and save some watts.

Love yeast. Naturally-fermented beer requires no extra piping of CO2, no extra pump pressure to force beer through a filter, and no extra cooling. And, you get smaller bubbles (which make for thicker head) without bothering with a Guinness-style nitrogen “widget”.

So there you have it. Drinking green - good for both you and the Earth. If you’d like to read more about the benefits of drinking beer responsibly, I recommend Christopher Mark O’Brien’s Fermenting Revolution.

-Bryan

P.S. This post is part of Blog Action Day. Yes, I agree that actions speak louder than words, but I already act on the words I wrote above, so I figured adding the words couldn’t hurt.

P.P.S. I know it’s been a while since I posted here, and this post isn’t likely to be on the topic many of you were hoping. But, I assure you that there is BeerRiot development going on. I’ll be posting about it soon.

MySQL Death

Just a quick note this evening: BeerRiot was down from about 3:30am to 8am this morning. The MySQL server shut down. I restarted it as soon as I found it down.

Interesting: The MySQL server shut down, but the ErlyDB connection to it was still alive and waiting. As soon as the MySQL server came back up, ErlyDB automatically reconnected, and the site was live.

Sounds like as good of a reason as any to consider switching to Mnesia. I have to assume it’s easier to monitor that than to watch/restart MySQL.

Vimagi

If you hang around here for the tech instead of the beer, you may be interested to know that Yariv, the creator of ErlyWeb has released his own site, built with his creation.

It’s called Vimagi. It’s a way to share drawings with friends. You paint something, using his app, then show it off to people. They can watch a replay of your painting, comment, and rate your work.

Interesting to note that he’s also using some Flash and AJAX, proving ErlyWeb compatible with those technologies.

Check it out - you may even find my own [poor] artwork there, if you’re clever. ;)

DevHouse Boston Wrapup

Just got back from DevHouse Boston. Thought I’d spill a few thoughts here for reference later.

The day was amazing. Where else would you expect to walk up to a random brick house in the middle of a city at 10 on a Sunday morning and expect to find ten 20-something guys hanging around discussing the finer points of locking in the Python VM? Yep, that’s the kind of day it was - lots of guys who are fairly knowledgable about a wide set of web tools, ready to sling some code at whatever comes their way.

I spent the day hacking with four other guys at an idea that started for me at a blog post I read last week, but mutated in many ways as the day progressed. The blog post I read lamented the lame way that RSS readers do nothing but provide a big list of links to follow (okay, maybe with a snipet or two, but still just a big list).

The idea that finally took us through the day was to use an external site’s popularity metrics (Digg for us, since that was easy), and layout news stories with summaries in a way reminiscent of newspapers. More popular stories got prime placement with larger headlines. Topics were grouped into distinct sections. We were only able to get to proof-of-concept stage, but everyone who saw the demo was interested in seeing it progress.

I’m not sure I’ll be the one doing the progressing, though. We did everything in Python/Django, and I’m just not sure I’m interested in delving deeper into it. Although, it would probably be a good springboard for doing so, since I already understand what the app is supposed to do. The code’s in a Google Project, but I’m going to make you search for it, because if you really want to try it out, the search is going to be the easiest thing you do. You think there’s time to write documentation at one of these things?! ;)

Here’s a screen cap to prove I’m not making things up:

NewsGraf Demo

Anyway, as for the rest of the projects, visualization was a key theme. And, even more specific, simplification of visualization was big. A calendar that does nothing but let you write five lines of text on each day (no categorization, contacts, etc.). A wiki edits tracker that doesn’t bother with the specifics of edits, but only the fact that edits happened, and that they probably related to edits that happened on “nearby” pages. A way to just send REST requests and view their results, without having to get into lots of code. And that’s only covering half or less of the projects that presented - the rest were amazing too.

I have to say, the day made me miss college. There’s nothing like the feeling you get when you and a small group of people focus on some strange goal for a few intense hours. In the “real world”, I’ve tended to let “real world” things (like grocery shopping, car maintenance, a day job, etc.) get in the way of that. It’s good to get it back once in a while.

Anyway, a big thanks to Betahouse for the space, the sponsors for the food, and my team mates for keeping things going. I wish DevHouse Boston many more successful years.

Dev House Boston

If you’re in the Boston area, and interested in Erlang/ErlyWeb, and free next Sunday … I’ll probably be hanging around Dev House Boston.

It’s my first trip to one of these hackathons. I’ve never been to Foo/BarCamp, or any of the others. So, we’ll see how it goes.

My best idea for a project so far is an Emacs mode for ErlTL. But, mainly I’d be interested in helping people come up to speed with Erlang/Erlyweb and/or Facebook app development. I think ErlyWeb’s a great platform for web development, and I’d like to see more people put it through its paces.

I’m also familiar with plenty of other languages/systems, so I feel pretty confident that I’ll be able to hack on whatever comes up.

Erlang Facebook Code Example

I’ve finally prevented distraction long enough to finish an example use of the Erlang Facebook library I posted earlier.

If you grab the source from the erlang2facebook project, you’ll know find it comes with a bunch of stuff in an “erlprints” directory. The code in “erlprints” is a near literal translation of the “Footprints” app that comes with the standard Facebook PHP library.

It’s not perfect, and there are certainly places where more Erlang-ish style could have been used, but I hope it’s good enough to give people a clue to how to use the library.

You’ll need to setup Erlang, ErlyWeb, and MySQL (not to mention getting a Facebook account and adding the developer app) before starting.

Good luck!

Erlang Facebook Code Open-source

Hi all. I’ve been meaning to do this for a while now, and the requests are only becoming more frequent, so - my Erlang-Facebook bridge code is now open for use. You can get it from the erlang2facebook Google Code project.

Big warning: the main reason I wasn’t releasing this code yet is because I don’t feel that it’s documented well enough. Anyone interested in using this code will likely need to have both the Facebook doc pages and the standard Facebook PHP code open, for comparison.

I’ve been working on recreating the sample “footprints” app to package with this code. I’ll post it as soon as I do (I keep getting distracted).

Also forgive me if I’ve committed some terrible Google Code faux pas. It’s my first project hosted there, so I’m sure I missed something.

BeerRiot - FB Approved!

Great news this evening! The BeerRiot Facebook app has been approved for listing in the app directory. Pudding (sensitive stuff blocked out, of course):

BeerRiot's Facebook app approval

I’ve been holding out on this for a while after the horror stories about apps and/or profiles being removed instead of just being denied. Either I successfully stayed on track, or that was all a bunch of hooey.

I hope those of you that have added the app are enjoying it. Please post reviews or send me feedback about things you’d like to see in it.

Feedback about non-Facebook functionality is welcome too, of course. ;) Sorry there hasn’t been much there, but there is stuff coming.

Two Birds, One Hot Code Load

I bet there are a lot of people still questioning the utility of hot code loading. Especially in the web app field, it can seem a little gratuitous. PHP apps don’t need any special hot load facility - the script just gets reread from disk every once in a while.

Well, even if we ignore that there are likely parts of web apps that do need to run all the time, and are not just executed at request time, there’s still the web server to think about. And, guess what I did last week.

Yaws provides lots of nice utility functions. One in particular is yaws_api:htmlize/1, which takes an IoList as an argument, and returns the “same” list with the four big offenders (ampersand, double-quote, less-than, and greater-than) replaced with their HTML entities (& et al.). This function does exactly what you need when serving HTML directly to a modern web browser.

Unfortuntately, htmlize/1 doesn’t work perfectly when sending “FBML” to Facebook. During Facebook’s translation, it converts all characters with ASCII values greater than 127 to unrecognizeable characters, which come out as some form of “?” in a browser.

The fix is simple - just HTML-encode all characters over 127 as HTML entities of the form &#X;, where X is the decimal representation of the ASCII value. In Yaws 1.68, just add the following two lines just before yaws_api.erl:590 (the line with the guard for integer(X)):

htmlize_l([X|Tail], Acc) when integer(X), X > 127 ->
    htmlize_l(Tail, [$;, integer_to_list(X), $#, $&|Acc]);

Compile the new code by running make in the base directory of the Yaws source. If you’re running Yaws from a directory other than the source directory, copy ebin/yaws_api.beam to that other ebin directory.

Edit: See dbt’s comment for a way to skip the next paragraph in the simple case.

Now for the magic. My prefered way to load new code is to open a console to the web server’s erlang node. First, run “erl -sname Name”, where Name is any name other than that of your webserver. Once erl starts up, type C-g (control-g, for you non-Emacs-ers). You’ll be asked for a “User switch command”. Typing “h” will get you help here, but what you actually want to do is type “r yaws@host”, where “yaws@host” is the node name of the webserver’s erlang node. Typing “j” should now show two shell sessions. Connect to the second one with “c 2″.

Now that you’re connected to your web server’s erlang node, just type “l(yaws_api)” to load the new code. Any module calling into the yaws_api module will now automatically use the new code. Meanwhile, any code that was in the middle of a yaws_api module call will finish the call with the old code.

Edit: You won’t need the next paragraph either, if you followed dbt’s instructions.

When you’re done mucking about (I know you’ve just spent the last half hour figuring out what other bits of your webserver you can touch from here), type C-g again, then kill the remote console with “k 2″. Connect back to your first console with “c 1″, then exit it in the normal manner.

So, voila, Á now comes out of htmlize/1 as Á. International beer names show up properly in Facebook, and (oh boy!) BeerRiot Local now works in IE6 (which couldn’t parse those letters from the XML tag file). Two birds, one stone, I love it.

On a couple of side notes:

Thanks for the versioning system suggestions. I’ve settled on Mercurial for now, and I’m quite happy with it so far. Bit of a pain upgrading Python versions, but I probably should have done that long ago anyway.

And, I’ve been doing more than just building a website around beer this summer. I’ve also been growing my own ingredients! I made my first hop harvest earlier this week. It was only an ounce wet, which turned into about 1/8 oz. dry, but I was proud to have some success anyway. Here’s the proof:

Cascade hops growing in my back yard

« Previous PageNext Page »