RedHotErlang2012-02-06T22:03:15+0100 eml - Erlang flavored by Some ML fab57dca867efb81e4020b5c3d006dda 2012-01-04T19:49:58+0100 tobbe Every third year or so I get this compiler itch that I need to scratch. This time I happend to come across ... Some rebar notes fab57dca867efb81e4020b5c3d00685f 2011-12-06T08:32:18+0100 tobbe Rebar is very nice! The documentation is not as nice. As soon as you look into a projects rebar.config you'll notice some new rebar configuration ... NYT, part 1 fab57dca867efb81e4020b5c3d00078a 2011-06-12T19:35:27+0200 tobbe I've been a great fan of the [New York Times Chrome App.][1] IMHO it is extremely slick and I wanted to explore how to create a Web app. that adjusted itself when being resized. So some months ago I came up with [nyt.redhoterlang.com][2]. Give it a t... Using SimpleBridge b4e6c0afca712a3b4f15869018000b2e 2011-03-05T09:38:23+0100 tobbe I like [SimpleBridge][1]; written by [Rusty][2] and part of [Nitrogen][3]. I often use it as a separate component, i.e without using Nitrogen. SimpleBridge provides an abstraction above the underlying HTTP engine. Apart from being a nice programmi... External access to Intranet Polish 98951c7196e0d91999bb238de5defe47 2011-02-24T20:25:02+0100 tobbe We are making heavy use of [Polish][1] for all our translation efforts. So far we have been using our in-house personnel to do the actual translation work. However, increasing demands for both quality and quantity made us look for external translator... Rewriting history in Subversion with the help of Erlang 7f18d73d4aed734cf3fe2544c2e10a8e 2011-01-03T22:31:25+0100 richardc Our development department at [Klarna](http://www.klarna.com) has grown quite a lot the last year, and because we are trying to be as agile as we can, using scrum and kanban, this has meant more teams, more branches, and more coordination and merging... SSH sign and verify ce13f30fd1b067039fadc639cedbf06e 2010-12-07T20:12:15+0100 tobbe I wanted to see if I could use my SSH keys to sign and verify data. Unfortunately, some of the necessary code are missing or simply not exported from the OTP SSH library (why?). This was easy to work around though, and here is the code: -module... POlish presented at EUC 2010 8af2641026c0dfa27e54cb0da57eb392 2010-11-16T23:35:15+0100 tobbe I and [Jordi][1] presented a new tool named [POlish][2] today at the EUC 2010 conference in Stockholm. It is a tool built on top of the [gettext][3] library that helps coordinating the translation efforts at [Klarna][4]. You can see a demo of Polish... Moving from Subversion to Git 70e5daca35bc70b06ea95d006996c9d9 2010-10-19T16:14:51+0200 tobbe When I returned to work after the summer vacations we had somehow taken the decision to move our repository from Subversion to Git. We had been discussing this on and off the last year(s) and even, right before summer, started to investigte if we co... Playing with LFE macros 55c9fafd59899d721907c9740d3386a1 2010-07-03T08:48:46+0200 tobbe Summertime, it's warm, it's sunny, I'm on vaccation, it's [LFE][1]-time. [Lisp macros][2] are cool. With a Lisp macro you do program transformations where you have the full language available to express these transformations. This means that you *ea... Dizzy thoughts 09fdf1b17aaa09df65e42d47fbf49bae 2010-06-22T22:52:43+0200 tobbe On the bus home today I was reading the first chapter of [Programming Clojure][1]. The text, which is excellent, discuss the motives behind Clojure. The bus however, was stinking hot and I started to doze off. I was in a strange state of being half a... Permutations a4ac64ecf68545ce5fd1fb27bc4e5931 2010-06-20T17:29:41+0200 tony Permutations ========== Permuting things is fun. Rearranging all the furniture's in a room is one kind of permutation. Generating all combinations of the string "ABC" will give you five more strings. "ACB" "BAC" "BCA" "CAB" "CBA" In general you w... Erlang Factory, London 2010 4fcdb6ceb9ed2729a80e9d9aca5fe97c 2010-06-19T19:22:08+0200 tobbe I went to London recently to attend the Erlang Factory conference. We were a bunch of people coming from [Klarna][1], as you can see below: [1]: http://www.klarna.com/ <img width="50%" src="/blob/ab62b2625d4ec6b6f16b631508b87c48"/> And if you do s... Rebar template support for gettext 138dc1b1f8720f5c4f38864e4f0c338f 2010-05-29T16:11:01+0200 tobbe I have added [gettext][1] support to my [rebar templates][2]. This makes it very easy to internationalize a Nitrogen webapp. To show how this works I'll create a simple example. First, we create the project using rebar: [1]: http://github.com/etnt/g... New Layout 47c625740ddd7217b7bf8f8bc722939e 2010-05-18T20:59:30+0200 tobbe RedHotErlang has got a new layout. The old layout had been around for some years now and I wanted to move the code base to use Nitrogen-2.0. So, gone is the desktop style structure with no visible page loads. Now the site is using a more normal page ... rebar templates 93c0d68814f9d92b2560492529fd14dd 2010-05-04T13:52:33+02:00 tobbe When I start a new little project of mine, I've had a big ugly shell script that creates the various source files I need. I can now say goodby to that script and instead make use of [rebar][1]'s template functionality. [Rebar][1] templates are locat... pingis.org 5343b863ee613035479eccda29dfca1e 2010-04-27T19:06:55+02:00 tobbe At my [work][1] we are keen Table Tennis players. So we just had to create a score registration system to create some ranking statistics and what not. Well, I and my collegue [Jordi][2] has now setup the first version of [pingis.org][3]. As usual, w... Collective Intelligence 6879d458a6e267d1eadd200dea4f9915 2010-04-12T19:41:00+0200 tobbe I'm reading a great book named: [Collective Intelligence][1]. I have only read the first three chapters so far. It takes time though, since I'm [re-implementing][2] the examples in Erlang, but it has also been great fun. [1]: http://oreilly.com/cata... Webmachine and multiple IP/Ports ee6664f1ad7efc0835b66f3b9696865d 2010-04-10T17:49:10+0200 tobbe I've been playing around with [Webmachine][1] lately and I like it a lot. In the 1.5 release Host specifications was added to the dispatch.conf file. This makes it possible to support several hosts in the same Webmachine system. It looks something li... Mercurial, DVCS and Agile methods 8c7f7e3fadddc7053e4ed84457f8356b 2010-03-22T20:39:45+0100 tobbe I've been reading the Mercurial book recently and liked it a lot. Although I've been using git and github for quite a while, I couldn't help myself from being impressed by the clean and simple approach of Mercurial. A simple base set of commands wi... Returning a file with Nitrogen 58024b56bab3e66cea6994b46deef85f 2010-03-02T20:41:01+0100 tobbe Let's say I want to create a file download link in my Nitrogen application. First I create a _src/pages/web_file.erl_ file, and fill it with some code: -module(web_file). -export([main/0, title/0, body/0, event/1]). -include_lib ("nitrog... Nurturing creativity and the passionate programmer 3a5df92bd3f8988b13c91c091592faba 2010-02-27T10:11:02+0100 tobbe I happened to read an article in the Harvard Business Review the other day. The article was about how Pixar was fostering creativity among their employees. I realized that I've been nurturing my creativit... inotify for erlang 10eba56758251baab8e1a657747da511 2010-02-06T17:44:06+0100 masse inotify is a cool linux kernel service, that lets you subscribe to file system events. For example, if you are interested in reacting to changes in the file "~/.emacs", and since you are not a lamer you abhor polling, you would like to be able to do ... Dialyzer 09275a52574173c08fb500f84dab50be 2010-02-05T22:59:19+0100 klacke At times you sit there at the typical Erlang conferences and hear Kostis Sagonis speak of dialyzer, typer and all the funky tools. It sounds just so great. The downside is of course that all the tools require an effort on your part. You need to read ... Websockets and Yaws de26edeba45fcb3453b604ed7f4b1127 2009-12-18T23:17:31+0100 klacke For years I've wanted to start tech blogging, however not having my own RSS/blogging software always put me off. After all, what lame webserver hacker am I, blogging on someone elses RSS software. Now, finally my friend Tobbe Tornquist did what I ... Migrating data from CouchDB version 0.8 to 0.10 9b3bbbdd39e95e5e8ca951f6c63fb70d 2009-11-23T00:16:16+0100 tobbe I'm in the process of replacing my old P-III server in the basement with a new mini-itx system that I put together. It is based on the [D945GCLF2][1] board containing an Intel Atom 330 chip. [1]: http://www.intel.com/products/desktop/motherboards/D... A simple Git browser page d35f732fdf3194fa6ab95aca54885401 2009-10-29T10:04:23+0100 tobbe Just for the fun of it, I made a very simple [Git][1] browsing page. When you click on _Git_ in the menubar, the following `log/1` function will be called: [1]: http://git-scm.com/ log(Delegate) -> log(Delegate, top_dir()). log(... A Twitter page 3b3c1499a548e3a93b178bf54976feb5 2009-10-27T09:30:00+0100 tobbe I recently added a simple [Twitter][1] page to [redhoterlang.com][2]. It didn't require many lines of code. First we have the main function: run() -> Url = twitter_atom_search_url("erlang"), Digest = base64:encode_to_string(twitt... redhoterlang.com and the use of Nitrogen 10807f2903db06ceab888e4b163d675a 2009-10-13T20:38:14+0200 tobbe Using [Nitrogen][1] I've been trying to create a desktop feeling with no visible page reloads. Most of the code is located in just one module named: `nav.erl`, where the navigation bar at the top is defined as: navbar() -> [{list,"List"... redhoterlang.com bc5f1562d88902411481e666aa8ea7eb 2009-10-07T21:10:03+0200 tobbe I have rewritten my blog application from scratch. Now I'm using [Nitrogen][1], [CouchDB][2] and [Blueprint][3]. Three projects (products?) that I highly recommend! [1]: http://nitrogenproject.com/ [2]: http://couchdb.apache.org/ [3]: http://bluepr... QLC power 61ea744e107dbeabc488a04dbf2d55d7 2009-07-03T14:08:31+0200 tobbe I've been doing some more work on my query DSL (described in an earlier [post][1]) for an internal project at my work. [1]: http://blog.tornkvist.org/blog.yaws?id=120596928596173 I had a number of 2GB sized Mnesia disk_only tables that I wanted to... The importance of side-effect free coding 7c4d8bdf18f2eac6cdb21e9ca9641b75 2009-04-07T14:38:57+0200 tobbe There has recently been some discussions about ugly coding patterns like: State1 = foo(State, ... State2 = bar(State1, ... State3 = baz(State2, ... People have argued that they want destructive assignment, variable rebinding and what no... Seethrough and Nitrogen bce1408f0f211d3e4951f972b6e9bdbf 2009-04-07T04:37:26+0200 tobbe I have made a little [proof of concept][1] of how [Seethrough][2] could be used as an alternative/complement to the current record-based way of constructing the HTML with [Nitrogen][5]. The generated HTML source can be compared to the [original][3]. ... RFC 4226 - HMAC-Based One-Time Password Algorithm d8c31c1feabe7b5020ad66c01260b6ce 2009-03-21T01:57:05+0200 tobbe I have recently implemented RFC 4226 and put it on [github][1]. The idea is to explore ways of providing One-Time passwords in for example an OpenID setting, or for mobile applications. An old technique where comercial solutions have been around for ... The OTP docs. c908dd5c3100ebe94cf8eaa19c26b217 2009-03-08T00:32:33+0200 tobbe I played around with Xmerl today and came up with yet another approach to parse the simple example in an earlier [post][1] of mine. [1]: http://blog.tornkvist.org/blog.yaws?id=1193209275268448 The OTP docs are good but unfortunately often a bit too... A frontend to xref 08e97e1db7cdc373e203d9a52297c0d1 2009-03-04T07:37:29+0200 tobbe I've uploaded a little program named: [exrefcheck][1], to [Github][2], that we are using at [Kreditor][3]. It is a front end to *xref* that can be run as a standalone program. I find it extremely useful and I have caught numerous errors using it (e.g... Tracing with Redbug f6f39230c396901515d7f984aa8ba41d 2009-02-20T09:23:50+0200 tobbe Have I told you about [redbug](http://code.google.com/p/eper/) ? It is a command line tool for tracing in production system. It is written by my collegue Mats Cronqvist, initially to be used for the Ericsson AXD exchange. Anyway, I find it very us... Erlang OpenID implementation be023e5181553216197369bbe32c4039 2009-02-12T01:07:17+0200 tobbe I just put up a demo of how to use my OpenID library, named [eopenid][]. The demo can be accessed [here][demo]. [eopenid]: http://github.com/etnt/eopenid/tree/master [demo]: http://www.tornkvist.org:8002/ The demo just register those who has succes... An Erlang HTML parser fb2d78ba5be3ce486275ec9ad5528bbe 2009-02-11T14:59:11+0200 tobbe It is amazing that there is no decent HTML parser in the OTP distro! As the cure, I suggest that OTP brings in the HTML parser from Mochiweb (if Bob Ippolito permits); or even better, bring in the whole of MochiWeb... Cheers, Tobbe ... Cleanup your code c11f06dcd1d041ae776196ea73978f85 2009-02-05T22:00:02+0200 tobbe Lots of non-emacs users are hacking Erlang nowadays it seems. This is all very good. However, the difference in indentation makes it a bit cumbersome when you want to contribute with some code. Here is a nice little command that you can run on your ... eldap at github d687965d4931c77628fe0cba471f4f64 2009-02-03T10:30:45+0200 tobbe I've put eldap, taken from jungerl, and put it at github. You'll find it here: [eldap at github](http://github.com/etnt/eldap/tree/master) This way it will be easer for people to contribute (I belive that e.g ejabberd has a separate copy of eldap t... Dart - A simple web framework c865a336d09a982eff6a1e518dfc3104 2008-08-13T16:35:02+0200 tobbe Just before summer I uploaded a little application to [Erlware](http://www.erlware.org/ "erlware.org") named *dart*. As an example, I can now generate a simple web-app for doing visitor registration in our reception. Dart make use of the [ewgi](http... The dsl_engine demo 7c97e354cda529b498f72127f4a28e00 2008-05-07T14:47:53+0200 tobbe I have been trying out [Erlware](http://www.erlware.org/ "erlware.org") recently; and I like it a lot! As an example, I created a demo application that show the use of the dsl_engine I wrote about earlier. Now, before I explain in more detail how ... Masterbrain - A 'rev-proxy' like dispatcher. f3f26755f82c4d3a0e517afec19a391e 2008-03-27T21:04:42+0200 tobbe On my server at home I'm running a number of experimental systems written in Erlang. Many of them have a ... Natural language DSL engine. 34e645f1c3cf42a516ce95486ad6a698 2008-03-20T00:28:05+0200 tobbe I got inspired by one of the talks at QCon 2008 in London the other week. This guy had made a DSL (Domain Specific Language) which resembled natural language. This, I thought, would be nice to have as a layer on top of Mnesia QLC comprehensions. Thi... Comet lib for Erlang 65afc8f75de25a7bf7fe89db2231b13c 2008-03-08T00:19:09+0200 tobbe I just wrota a little Erlang library that implements Comet. This makes it easy to manipulate the DOM in the browser from the Erlang server side. You can get the code from my git repository (*git clone git://www.tornkvist.org/domerl*). To use it, add... Easy load of recompiled code 4afe153ed1bea4a4b49694c8c6005202 2008-03-06T10:25:40+0200 tobbe The question often comes up: how can I reload my recompiled modules in an easy way. Here is some code (*curtesy some Russian Erlang hacker that I have lost my reference to, please add your name as a comment below to receive your well earned credit* :... HOWTO: Ajax request ac061493b201e3d1b4490cdc3f911068 2008-02-25T13:34:18+0200 tobbe Here is a simple example of an AJAX request. (this is an updated, and better, example compared to the original one). # Setup the DOM In the file ''ex1.html'' we create the DOM with a little HTML and add some Javascript that will talk with the Erlan... Arithmetic sequences in Erlang? 2d246bf17c81073b1289f57b06ede981 2007-11-12T23:41:50+0200 tobbe I think it would be nice to have arithmetic sequences in Erlang as they do in Haskell. For example: [2..5] => [2,3,4,5] [2,4..8] => [2,4,6,8] [2,1.8..1] => [2,1.8,1.6,1.4,1.2,1] The semantics is thus something like: [a,b..... Erlang sendfile driver ad9669921ec10a0d5cd1c9efcbd022fe 2007-11-08T00:41:16+0200 tobbe I just finished a little sendfile linked in driver. The idea was to explore the serving of static content. Somewhat disapointing, I couldn't notice any differences between a standard Yaws server and the iserve/ifile (sendfile) setup. On my LAN I got ... Bind Erlang to a certain IP/Port 77814cd8c7113d61fe1c8de4702213f1 2007-11-06T10:47:32+0200 tobbe If you want to make sure that your distributed Erlang node only listens to a particular IP address and/or port you can make use of the kernel parameters: *inet_dist_use_interface*, *inet_dist_listen_min*, *inet_dist_listen_max*. Note: by setting the ... iserve - A faster web server ef6467360aefa4bd360c3f6ba8218f5f 2007-10-31T22:27:23+0200 tobbe I have made the excellent *iserve* web server, described over at [trapexit.org](http://www.trapexit.org/A_fast_web_server_demonstrating_some_undocumented_Erlang_features), available at my [git repos](http://www.tornkvist.org/gitweb?p=iserve.git;a=s... XML processing in Erlang 32cdee0ffd53e9bb404c1ac27a073df8 2007-10-24T09:01:15+0200 tobbe There is a thread going on at the erlang-list, talking about XML processing. I'm just documenting a couple of solutions to the problem of parsing the following XML: <Export> <Product> <SKU>403276</SKU> <ItemName>Trivet</Ite... Haskerl - A Haskell to Erlang Core compiler. 60caccd0677c03953b1c8ba37f69fc24 2007-09-27T00:46:25+0200 tobbe Lets have a look at the current Erlang syntax and see if it can be improved upon. When we define a function we begin with the function name followed by the input arguments. For example, if we begin to define a function: `max(X,Y)...` , but wait! Why ... Compiling Haskell to Erlang 1bec21a921585d7294dbcf883e38282c 2007-07-27T23:26:22+0200 tobbe I decided to try and learn some Haskell this summer. What started this was some discussions on the Erlang mailing list about the Erlang syntax. At some point I suggested that an alternative syntax very well could be proposed as long as it could be ex... Recursive List Comprehensions 5b2c0e9452562e930d018a33c65cb961 2007-07-24T08:30:50+0200 tobbe We talked about the *perms/1* function below at the *#erlang* channel the other day: %% perms([1,2,3]) => %% [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] perms([]) -> [[]]; perms(L) -> [[H|T] || H <- L, ... ErlLounge in Stockholm c3a4c490342899d54965b5bf54e56755 2007-07-20T20:05:30+0200 tobbe On Tuesday 24th of July, there will be an ErlLounge in Stockholm. We will meet around 17:00 (5pm) on O'Learys bar, Vasagatan, close to the Central Station. We will drink some beer and chat about Erlang as usual :-) See you there! --Tobbe... How to use Yatsy, part 1 a5465a616ef4f845b2294362874b0649 2007-07-01T19:36:49+0200 tobbe # Deploying Yatsy, part 1. [Yatsy][1] (Yet Another Test Server + Yaws) is a test framework for Erlang applications. In this article I will show how to make use of it. The main idea of Yatsy is that it runs in an distributed Erlang node, executing te... #erlang at irc.freenode.net c184bc732892b1d436aa1fe7feca1425 2007-06-12T10:41:35+0200 tobbe Now, when Emacs 22 is released, it is even easier to get to the **#erlang** channel at **irc.freenode.net**. You just need to setup a couple of things in your **~/.emacs** and then type **M-x irc**. Begin by loading rcirc and define the IRC server,... The Erlang Debugger 77acc93a148388f95aa7ac65c77a522f 2007-06-05T00:16:00+0200 tobbe Erlang has a very useful debugger. Here comes a quick intro on howto get it running. First you must *debug compile* your code. 1> c(x, [debug_info]). {ok,x} 2> m(x). % check if it is debug compiled Module x compiled: Date: June 4 20... Eblog dissected, part 1 70b6544cd33aa064a8bc703b946f595c 2007-05-21T23:30:52+0200 tobbe Since I have separated all my HTML into [SGTE][3] templates, I have no need for lots of *.yaws* files anymore. I still have an *index.yaws* though, which dispatch the incoming request depending on the type of operation to perform. If no particular op... Erlang, Ajax and MVC df1defdf07c5b304b199a931238f88eb 2007-05-16T22:27:11+0200 tobbe I'm back again with a report from my forays into Erlang and Ajax land. This time I will try and be somewhat more consistent and keep my Blog updated continously. If you read my earlier blog [attempt][1] you may think (based on the look of the site) ...