Friday, November 30, 2007

Updated ErlyCairo

Did some housekeeping on my growing inventory of Erlang open source projects targeted to web development. I completely rewrote the Erlang part of ErlyCairo, the Erlang bindings for the Cairo 2D graphics library. Previously it had a hard coded node name for the C-node, now it is based on a much more flexible gen-server approach.

Below see how to use this software to create a simple, purple, 100px * 100px PNG image:
start() -> 
erlycairo:start_link().

%% if you run multiple C-Nodes, to avoid nodename conflicts
start(CNodeNumber) ->
erlycairo:start_link(CNodeNumber).

stop() ->
erlycairo:stop().

create_images()->
rect("rect.png", 100, 100, {1.0, 0.2, 0.7, 1.0}).

rect(File, Width, Height, {Red, Green, Blue, Alpha}) ->
case erlycairo:new_image_blank(Width, Height) of
ok ->
erlycairo:set_source_rgba(Red, Green, Blue, Alpha),
erlycairo:rectangle(0, 0, Width, Height),
erlycairo:fill(),
erlycairo:write_to_png(File),
erlycairo:close_image(),
ok;
{error, Reason} ->
exit(Reason)
end.

Wednesday, November 28, 2007

Amazon EC2 / S3 Network Performance

Thorsten von Eicken (CTO at RightScale) did some bandwidth measurements, here an overview of his analysis:

EC2 <-> EC2 (large instances):
  • one connection: totally 75 MB/s
  • three connections: totally 96 MB/s
S3 <- EC2 (large instance, HTTPS, download):
  • one connection: totally 12.6 MB/s
  • eight connections: totally 49.8 MB/s
the results for non-SSL (HTTP) are about the same.

S3 -> EC2 (large instance, HTTPS, upload):
  • one connection: totally 6.9 MB/s
  • twelve connections: totally 53.8 MB/s

Tuesday, November 27, 2007

TextMate is the most popular Rails development environment

So I am hopefully on the right track with my attempt to improve Erlang support for TextMate !
Tim Bray asked 1000 Ruby / RubyOnRails about their preferred development environment, below just the most popular ones, for the complete table go to Tim Bray's Ruby survey.


All%Ruby%Rails
%
TextMate47830.3521624.2426238.30
Vi family34521.9021724.3512818.71
NetBeans18411.689310.449113.30
Eclipse17511.1110111.347410.82
Emacs family19812.5713214.81669.65

Disaster recovery nightmare with mozy.com




Shit happens and usually when you don't expect it, in my case I lost some personal data on my mac (iTunes and iPhoto library). I had signed up with Mozy for automatically backing up my data and easily restoring it, so I thought it just needs a few mouse clicks and everything is fine again. Unfortunately that was not the case. The pictures above show how both restore methods they offer (online restore and download-file-and-restore) failed (even after multiple retries).

Mozy support staff seems to responsive and friendly, but that's all. The copy-pasted text below is from an email they sent me 21 hours ago:
I will continue to do more research on this, and tomorrow our mac specialist will be in the building and from there we can work on a more permanent solution.

Lessons learned:

  • Don't trust your data to a fast growing startup company. In my case it was Mozy. But I believe this can happen with any other of these over-hyped cheap-service companies.
  • Don't test the backup service by just restoring a simple file. Take the time to do a test restore of your real valuable data at its full size.
  • Choose at least two totally independent backup solutions.

Monday, November 26, 2007

Faster interaction between Erlang and TextMate

My first attempt of combining TextMate key bindings to Erlang scripts was fully based on escripts. Unfortunatley starting an escript costs some time (because of the startup of an Erlang VM), on my mac it is about 0.15 seconds. Not much, but enough to be perceived as short delay by the user. So I was looking for a faster way of interaction and Erlang core developer Bengt Kleberg pointed me to erlaunch, a kind of erlang scripting environment where the VM runs in the background and dosent need to be restarted for each script. So I guess something along that lines is the way to go for TextMate Erlang integration, probably a TextMate plugin written in C which takes care of the Erlang background VM during TextMate uptime. Need to learn now how to write a TextMate plugin ...