Erlang Web Development Frameworks
Thursday, December 18, 2008 at 04:11PM Web Frameworks.
I'm going to mention the two of the most interesting web frameworks out there. They choose a very different path and I would call both of them production ready. As they are both projects in active development you might have a problem with a new release breaking a few things.
Nitrogen
Nitrogen is the new kid on the scene but has quickly become my favorite framework. Unlike most frameworks it's event driven. I enjoy it even more than Rails at the moment. It's dead simple to get started in and very powerful. It's in very active development and new and cool features are added almost weekly. The last new feature added was the simplest but one of the most powerful Comet implementation out there.
ONe of it's drawbacks is that there is no routing system in it. Paths are defined by the module names. So web_index.erl becomes /web/index or /web and web_blog_comment.erl becomes /web/blog/comment. Some might find this a bit limiting.
There are many cool features planned and one of the most interesting is implementing Erlangs power to be a distributed web frameworks. Thus solving many of the problems of scalability that many other web frameworks have
Pros:
- Dead simple.
- Nice bindings system.
- Kick ass Comet support.
- Interesting future ideas.
Cons:
- No routing at the moment.
- A little too simple on the template side.
- Really young so no real documentation yet.
Erlang Web
I have not much experience with Erlang Web but many seem to have started using it. It's and MVC framework built on OTP principles and uses many standard Erlang practices. It's template system on first view reminds me a bit of good old WebObjects. Currently it supports INETS and Yaws but not MochiWeb at the moment.
Pros:
- Very Flexible.
- Powerful template language.
- OTP Principles.
Cons:
- Could be simpler.
- Needs way better documentation.
Template Languages
Sometimes you may just want something simpler. Just a little template engine on a custom built web server to show some dynamic data. Or for use in your own web framework. Here are 2 notable template engines.
HERML
HERML is an erlang implementation of the HAML markup language. It's quick and simple but remember that this skips HTML altogether so it might not be for everyone.
ErlyDTL
ErlyDTL is an erlang implementation of the Django Template Language. I personally found DTL to be Django's most anoying feature but as many people like it it's best to mention it.
5 Minute Blog Using Nitrogen and CouchDB
Friday, December 12, 2008 at 03:16AM Hey. Today I'm going to show you how to create a really, really simple blog in a few minutes using Rusty's Nitrogen Web Framework and the CouchDB document system. I presume you have basic erlang skills but this should be simple for anyone. I also presume you have already seen the Nitrogen Screencasts and are familiar with the basic behavior of Nitrogen.
Ingredients
Here is what yo will need:
- Nitrogen
- CouchDB (or CouchDBX)
- Ecouch
- My Project Skeleton
I assume that Ecouch and Nitrogen are set up in the library path (see here for info). If you need any further help on this see this post
If you are using Mac OS 10.5 I recommend you use my implementation of CouchDBX to get you started quickly.
My CouchDBX version
Sunday, November 23, 2008 at 09:31PM Hey people.
I have been playing with Jan's CouchDBX a bit and thought someone might enjoy what I did. CouchDBX is a nice little Mac OS X tool to run CouchDB without the need to set up Erlang or anything.
There are 3 major changes that I did. First of the UI is gone and everything is now in a status bar menu. Should make for quicker access to it and also stay out of the way. There is also a new transparent log window if you need to see what is happening on the Erlang level. The third an most important change is that CouchDBX now stores it's database in ~/Documents/CouchDB. Before the database was inside the Application bundle itself and all the data disappeared every time you downloaded a new release of CouchDBX.
I have not renamed it or anything in case Jan would like to incorporate these changes to the original code or something.
EDIT 26. Nov: There was a serious error in my old version that made the javascript engine not run correctly. This has now been fixed and you need to redownload.

Why do you dislike me Apple?
Saturday, November 22, 2008 at 09:02AM Dear Apple. I am a loyal customer of Apple product. Out of my top 10 favourite things I own propably 6 of them are from Apple. You make some the greatest products available today. Your attention to detail and ease of use is legendary. So it makes me wonder why in the world you dislike me so much.
I have myself an iPod Touch. And even though you have allowed me to buy it you have deemed me not worthy of using it. You have decided that I should not be allowed to run 3rd party applications on it since my country (Iceland) is not worthy of the holy iTunes store. You have also deemed me not worthy of upgrading it for the same reason. I am not even worthy of developing applications for it since I don't live in the list of countries approved for iPod/iPhone development. And I just must ask you why?
I also have the Apple TV which you allowed me to buy. And again I was allowed to buy it just not use it. I'm not allowed to rent or buy movies. Why? I'm allowed to buy music and movies from Amazon or any other store and have it shipped to me. Suddenly when it's in digital form it's like it's a crime for me to shop it? What gives. And as many Apple TV owners I have installed Boxee to it so I can enjoy some extra features. But you have decided that is not allowed and in your latest update you removed it??!?!? This seems to be on purpouse this time and not some accidental breakage because of things you needed to update. It seems to me like you decided to remove it. And what gives you the right to enter my computer and remove things. I know for a fact that AppleTV is just a Mac Mini with Tiger and an app runnin full screen. I sometimes see glimpses of the window border and the close/minimize/zoom buttons. This is in no way different than if you would use your software update to remove competitor software like Microsoft Office on my iMac. How is this ok? And why would you do that to begin with? It's not like Boxee is in competition with you. I still use Apple TV's built in media player.
I know that the reason for why I'm not allowed to use the iTunes store is because of requirements from the record companies. But let me remind you that it is illegal for you to shut me out of it. It is actually 100% illegal for you to deny me shopping on the Danish iTunes store. I'm not kidding you check with your legal team. Europe is one big economic area and according to European laws I am allowed to shop in any European country and I should pay the same price + shipping and handling. So even though the record companies asked you it does not make it less of a crime. If laws have any meaning to you open up my access to the store. You know that sooner or later someone will force you to do that and force you to pay fines while doing that. So why not just do it now?
So please Apple. Stop hating me.
Regards. A Loyal Customer.
A knock knock joke
Friday, November 21, 2008 at 12:07PM Just a quick one in the morning.
-module(knockknock).
-compile(export_all).
start_joke() ->
register(person_1, erlang:spawn(knockknock, person1, [])),
register(person_2, erlang:spawn(knockknock, person2, [])),
person_1 ! start_joke.
relay(Person, Message) ->
io:format("------- ~p -------~n", [Message]),
Person ! Message.
person1() ->
receive
start_joke ->
relay(person_2, "Knock, Knock");
"Who's There?" ->
timer:sleep(100000),
relay(person_2, "Java")
end,
person1().
person2() ->
receive
"Knock, Knock" ->
relay(person_1, "Who's There?");
"Java" ->
relay(person_1, "Ha Ha")
end,
person2().

