As mentioned in my previous post, I did some work this summer with manipulating Subversion dump files using Erlang. I've written a probably way too long text about this for the RedHotErlang blog maintained by my friend and colleague, the legendary Tobbe T.
If you're interested in this sort of thing - for example, if you're currently thinking about how to convert your messy Subversion repository to Git - you might want to read it. Or perhaps you just want something to help you go to sleep. Otherwise, you're forgiven if you don't follow that link.
Monday, 3 January 2011
Thursday, 23 December 2010
It's been a long time...
Wow - I've not updated the blog for a year and a half. Amazing how writing a book can turn you off all other kinds of written expression (apart from the odd Tweet). The book's been out for a month now and I'm quite happy with how it turned out. But following the release, I haven't had the energy to do anything creative when I get home after work, so I've just been playing video games and, well, not writing.
I've felt entitled to it, though: for the last year, I've not had time for anything else, so I've built up a huge backlog of books, films and games that I'm now suddenly able to start working my way through. The only problem with that is that it too can start to feel like work.
In particular, my long list of TODO-notes and feature requests for my pet programming projects has felt too overwhelming to try to pick up. In many cases, I've completely forgotten where I was, so it typically takes half a day just to look over the code and figure out how things work and where to continue hacking. But I'm building up to a point where I'm actually feeling the urge to program again. So maybe I'll be publishing some hacks again in a not too distant future.
It's been an eventful year in other respects as well: This summer I turned 40, and I and Elisabet got married in September (after 6 years of being engaged). At work, the company has kept growing like mad, and the size of our development department doubled (again), so we've been really busy. We also switched from Subversion to Git, and I should probably write about how we did that, because it turned out to be quite complicated.
Blogging is no longer à la mode, but I might be returning to it more regularly now that I have a life again. Meanwhile, have a merry Yule!
I've felt entitled to it, though: for the last year, I've not had time for anything else, so I've built up a huge backlog of books, films and games that I'm now suddenly able to start working my way through. The only problem with that is that it too can start to feel like work.
In particular, my long list of TODO-notes and feature requests for my pet programming projects has felt too overwhelming to try to pick up. In many cases, I've completely forgotten where I was, so it typically takes half a day just to look over the code and figure out how things work and where to continue hacking. But I'm building up to a point where I'm actually feeling the urge to program again. So maybe I'll be publishing some hacks again in a not too distant future.
It's been an eventful year in other respects as well: This summer I turned 40, and I and Elisabet got married in September (after 6 years of being engaged). At work, the company has kept growing like mad, and the size of our development department doubled (again), so we've been really busy. We also switched from Subversion to Git, and I should probably write about how we did that, because it turned out to be quite complicated.
Blogging is no longer à la mode, but I might be returning to it more regularly now that I have a life again. Meanwhile, have a merry Yule!
Monday, 22 June 2009
The midsummer report
While midsummer eve was as cold and foggy as any I can remember, these following days have been beautiful. The winds are still a bit chilly, which can be deceptive since it makes you forget how much sun you're actually exposing your poor skin to. I spent most of a day mowing the grass around the house, and got myself a really superb redneck tan.An hour or two ago, a White-tailed eagle circled a few times over our house, as usual supremely unimpressed by the gang of annoyed seagulls that tried to chase it away. A cuckoo is, well, cuckooing, in the distance, and the water is glittering. In fact, it's bloody hard to get any real work done in a place like this.
Over and out.
Wednesday, 3 June 2009
Yosemite
When I planned my trip to California for the Erlang Factory conference, I followed a friend's advice and set aside a couple of days to go and see Yosemite Valley. I don't regret it - it was absolutely fantastic. Yosemite is about 4 hours drive east from San Francisco, up in the high Sierra Nevadas, and it's one of the most stunning landscapes you can imagine. Nothing I had read about it beforehand had prepared me for the feeling of actually being there and seeing this amazing valley in real life; not even Google Earth (although I recommend trying that for yourself - the 3D detail is really good). Of course I took a lot of photos, but it's not until now that I'm done going through the lot of them (discarding more than half), so I've waited with writing about the trip.
I stayed two nights in Curry Village, a camp site of permanent tent-cabins (complete with beds, but no heat) that are the cheapest option if you don't bring your own camping equipment and want to stay one or more nights in the valley. ("Cheap" of course being relative in a place like this; a
night at the Ahwahnee Hotel will set you back $500, off season.) Since this was at the end of April - the 27th to 29th, more specifically - the nights could still be cold, but from what I could see on the web before the trip, it seemed like it would not be colder than 5-10 degrees centigrade. Well, it turned out that the 28th was a brilliant day followed by a clear, cold night, as can be seen from the graph here. My sleeping bag was not quite up to the task, and I can't remember ever shivering so much in the wee hours. Still no regrets, though.
One of the things with visiting Yosemite is that you get a whole load of instructions from pretty much everywhere about how to keep anything with a smell (food and other things) stored safely to avoid problems with bears breaking in to cars, tents, etc. It's still not likely that you'll actually see a bear, but they can come roaming around the camp in the nighttime, they have an acute sense of smell, and have been known to even bend up car doors. So, on the day I arrived, I made sure to empty the car and put everything in the bear-safe locker, but there was a fair amount of activity around and it didn't really feel like any bears would ever come near the place. After getting settled, I walked over to the food pavilion to grab some dinner, and with the sun beginning to fade, I went for a stroll afterwards to see a bit of the place before dark. Following the edge of a part of the camp that had been blocked off due to some rock slides earlier, I walked for just a few minutes, and as I stopped and looked up among the trees and boulders, I suddenly realized that I was looking straight at a bear. Less than 100 meters away, I'm sure it was quite aware of me, but it didn't so much as dignify me with a look, not even when I took some pictures. It just slowly sauntered away, apparently circling the camp. A good start to the visit, I thought.
I didn't have any specific plan for the next day; I had simply brought my walking shoes and thought I'd improvise. Mainly, I expected to follow some simple trail around the valley floor, looking up at all the scenery. On a whim, though, I dropped by the hiking equipment store after breakfast and asked one of the guys there if he could recommend any particular trail and maybe sell me a map. Thanks to him, I decided to go on a route marked as "very strenuous", all the way to the top of the Upper Yosemite Fall, which he said was perfect for the season (spring being when the waterfalls are the most spectacular) and would give me superb views, much better than from the bottom of the valley. So with a map in hand, off I went towards the start of that trail, picking up some food and drink on the way. It was a brilliant day, and instead of trying to describe the hike here, I'll just point you to the pictures I took. I started out around 10 in the morning, was up on the top at midday, and got back down again at four, very tired but happy.
After the second, very cold night in Curry Village, I had to drive back to San Francisco again, but first I made a stop at one of the few places where you can see giant sequoia trees. They were quite impressive, but I think the feeling that remained with me was one of sadness - none of the surviving trees were nearly as grand as the ones you could see in the black-and-white photographs on the signs, with lumberjacks posing beside huge sequoias that they were in the process of chopping down.
I stayed two nights in Curry Village, a camp site of permanent tent-cabins (complete with beds, but no heat) that are the cheapest option if you don't bring your own camping equipment and want to stay one or more nights in the valley. ("Cheap" of course being relative in a place like this; a
night at the Ahwahnee Hotel will set you back $500, off season.) Since this was at the end of April - the 27th to 29th, more specifically - the nights could still be cold, but from what I could see on the web before the trip, it seemed like it would not be colder than 5-10 degrees centigrade. Well, it turned out that the 28th was a brilliant day followed by a clear, cold night, as can be seen from the graph here. My sleeping bag was not quite up to the task, and I can't remember ever shivering so much in the wee hours. Still no regrets, though.One of the things with visiting Yosemite is that you get a whole load of instructions from pretty much everywhere about how to keep anything with a smell (food and other things) stored safely to avoid problems with bears breaking in to cars, tents, etc. It's still not likely that you'll actually see a bear, but they can come roaming around the camp in the nighttime, they have an acute sense of smell, and have been known to even bend up car doors. So, on the day I arrived, I made sure to empty the car and put everything in the bear-safe locker, but there was a fair amount of activity around and it didn't really feel like any bears would ever come near the place. After getting settled, I walked over to the food pavilion to grab some dinner, and with the sun beginning to fade, I went for a stroll afterwards to see a bit of the place before dark. Following the edge of a part of the camp that had been blocked off due to some rock slides earlier, I walked for just a few minutes, and as I stopped and looked up among the trees and boulders, I suddenly realized that I was looking straight at a bear. Less than 100 meters away, I'm sure it was quite aware of me, but it didn't so much as dignify me with a look, not even when I took some pictures. It just slowly sauntered away, apparently circling the camp. A good start to the visit, I thought.
I didn't have any specific plan for the next day; I had simply brought my walking shoes and thought I'd improvise. Mainly, I expected to follow some simple trail around the valley floor, looking up at all the scenery. On a whim, though, I dropped by the hiking equipment store after breakfast and asked one of the guys there if he could recommend any particular trail and maybe sell me a map. Thanks to him, I decided to go on a route marked as "very strenuous", all the way to the top of the Upper Yosemite Fall, which he said was perfect for the season (spring being when the waterfalls are the most spectacular) and would give me superb views, much better than from the bottom of the valley. So with a map in hand, off I went towards the start of that trail, picking up some food and drink on the way. It was a brilliant day, and instead of trying to describe the hike here, I'll just point you to the pictures I took. I started out around 10 in the morning, was up on the top at midday, and got back down again at four, very tired but happy.
After the second, very cold night in Curry Village, I had to drive back to San Francisco again, but first I made a stop at one of the few places where you can see giant sequoia trees. They were quite impressive, but I think the feeling that remained with me was one of sadness - none of the surviving trees were nearly as grand as the ones you could see in the black-and-white photographs on the signs, with lumberjacks posing beside huge sequoias that they were in the process of chopping down.
Saturday, 16 May 2009
SF and Alcatraz
A couple of weeks ago, I went to San Francisco for the Bay Area Erlang Factory. The conference was great, but I also took a few days off to be able to do some touristy things on my own first (not to mention working off the 9 hour jet lag). I had a lazy sunday in SF and took the opportunity to visit Alcatraz for the first time. I was really lucky with the weather and took a whole bunch of photos.
Thursday, 2 April 2009
News for nerds
"The Implementation of Functional Programming Languages", the classic book by Simon Peyton-Jones (et al.) has been out of print for years, but has now been released as a free book in several juicy formats. Just follow the link.
Labels:
books,
compilers,
functional programming,
languages
Wednesday, 18 February 2009
Erlang Text Elite
This last weekend, I somehow came to think about the wonderful old space trading game Elite, and the way it managed to cram a vast universe of planets with names, stats, and fun descriptions (along with the 3D space flight simulation, which was an amazing feat in itself) into the tiny 8-bit home computers of old. Only minutes later, I had found Ian Bell's Text Elite web page, where Ian, one of the two original authors of the game, has published a reconstruction in C of the main universe-generating algorithm, along with a simple text interface to actually let you "play", i.e., buy, sell, and jump between planets. Great!
So I rewrote it in Erlang. And had a lot of fun doing it. Apart from the nostalgic kick, there were two points with the exercise: First of all, I just wanted to see the main algorithm as cleanly implemented as possible. But second, I wanted to see what it would be like to rewrite a piece of classic game code that was very clearly not written with functional programming in mind (though of course already cleaned up a bit by being rewritten in C from the original 6502 assembler). I think I like how the result turned out; it's quite clean and readable, and the data flows are easy to follow. I also found and fixed a bug in the "goat soup" function.
The code can be found on GitHub, along with the two scripts for testing found on Ian's page. You can run them like this:
So I rewrote it in Erlang. And had a lot of fun doing it. Apart from the nostalgic kick, there were two points with the exercise: First of all, I just wanted to see the main algorithm as cleanly implemented as possible. But second, I wanted to see what it would be like to rewrite a piece of classic game code that was very clearly not written with functional programming in mind (though of course already cleaned up a bit by being rewritten in C from the original 6502 assembler). I think I like how the result turned out; it's quite clean and readable, and the data flows are easy to follow. I also found and fixed a bug in the "goat soup" function.
The code can be found on GitHub, along with the two scripts for testing found on Ian's page. You can run them like this:
erl -noshell -s txtelite main -s init stop < sinclair.txt(To play yourself, just skip the last "< sinclair.txt" part.) Of course, you need to compile the txtelite.erl file first. If you're new to Erlang, this is how:
erlc txtelite.erlIt's good to be back on Lave again!
Labels:
C,
computer games,
elite,
erlang,
text
Subscribe to:
Posts (Atom)