code formating

Friday, October 30, 2009

Supervising Mochiweb

Mochiweb is a lightweight Erlang library for building Web servers. It takes a very elegant approach using Erlang's built in OTP.It has also an MIT license and although, the project lacks documentation, you can always look at the source code.

I have been developing a little project on Erlang and decided to use Mochiweb for it. Mochiweb has it´s on Erlang application but I didn´t want to use this. However, I still wanted to create a supervision tree and have the web server supervised. Because Mochiweb is built using OTP principles, it´s pretty easy to do this. The image below shows an approximate illustration of mine. Note that the illustration is not precise but it helps to get an idea.
When you get to code it, the key element is the supervisor. It starts the Mochiweb server and passes your callback module to the server´s initialisation call.

Friday, October 16, 2009

Going crazy with dlls

I have recently been working on a Microsoft .NET platform and specifically using the MVC. I had MVC installed on my local machine as I was coding the first lines. Locally testing the web was easy too. Just press F5 and off you go.

However the problem, as there is often the case, came when publishing the code to live. I didn´t want to install MVC on the server and you can not expect the thing to work without the dlls, so I decided to copy the required dlls inside the project itself and try sipping it this way.

As soon as I copied the required System.Web.Mvc and System.Web.Routing to an assemblies folder inside the project and changed the reference paths, everything broke down. Now, I´m talking about the local testing environment here. I could not made my mind up as to how something that works on one path of one machine, doesn´t work on another. "Shall I blame Microsoft again" I thought to myself. As you can observe from a quick look of the rest of my posts, I tend not to use non free software much.

The truth is that it had a simple solution. On Visual Studio 2008 on the References tab (inside options), you can add and remove assembly references. Well, on the bottom, there is a "Imported namespaces" area. When changing the path to the assemblies, this box gets unchecked just check it back.

Also, to make it sure that is getting the local copy and not going to the GAC, double click on the path and inside the properties, set Copy Local to true.

This is it, ship the assemblies with the project and make your client happy!

Expose text from Emacs to another device via QR

Expose text from Emacs to another device via QR I am one of those who uses Emacs extensively. Particularly when it comes to keeping myself o...