Friday, May 23, 2008

Dojo Widget for in-browser editor CodeMirror

CodeMirror, a very impressive in-browser code editor for Javascript, XML/HTML or CSS (or any language, you just have to plug in a your own parser) made some nice progress in the last months. CodeMirror has no dependency on other frameworks or libraries. If you want to use it in a dojo environment as a dojo compatible widget, here I am gonna share here a little tutorial how to write such a thing:

First download CodeMirror and transform CodeMirror.js (the main file which loads the other files into an iframe), into something like this:

dojo.provide("mystuff.widget.CodeMirror");
dojo.require("dijit._Widget");


dojo.declare("mystuff.widget.CodeMirror", dijit._Widget, {

initialized: false,

// currently supported: 'xml' (HTML), 'js' or 'css'
type: 'xml',

options: {
stylesheet: "",
path: "/static/codemirror/js/",
parserfiles: [],
basefiles: ["codemirror_iframe.js"],
linesPerPass: 15,
passDelay: 200,
continuousScanning: false,
saveFunction: function() {
console.log('save');
},
content: " ",
undoDepth: 20,
undoDelay: 800,
disableSpellcheck: true,
textWrapping: true,
readOnly: false,
width: "100%",
height: "100%",
parserConfig: null
},

postMixInProperties: function() {
this.options.stylesheet = "/static/codemirror/css/" + this.type + "colors.css";
this.options.parserfiles = ["parse" + this.type + ".js"];
},

postCreate: function() {
this.inherited(arguments);
},

startup: function() {
if (dijit._isElementShown(this.domNode.parentNode))
this.initialize();
},

initialize: function() {
if (this.initialized)
return;

frame = document.createElement("IFRAME");
frame.style.border = "0";
frame.style.width = this.options.width;
frame.style.height = this.options.height;
// display: block occasionally suppresses some Firefox bugs, so we
// always add it, redundant as it sounds.
frame.style.display = "block";

this.domNode.appendChild(frame);

// Link back to this object, so that the editor can fetch options
// and add a reference to itself.
frame.CodeMirror = this;
this.win = frame.contentWindow;

var _this = this;
var html = ["<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"" + this.options.stylesheet + "\"/>"];
dojo.forEach(this.options.basefiles.concat(this.options.parserfiles), function(file) {
html.push("<script type=\"text/javascript\" src=\"" + _this.options.path + file + "\"></script>");
});
html.push("</head><body style=\"border-width: 0;\" class=\"editbox\" spellcheck=\"" +
(this.options.disableSpellcheck ? "false" : "true") + "\"></body></html>");

var doc = this.win.document;
doc.open();
doc.write(html.join(""));
doc.close();

this.initialized = true;
},

getCode: function() {
return this.editor.getCode();
},

setCode: function(code) {
this.editor.importCode(code);
},

focus: function() {
this.win.focus();
},

jumpToChar: function(start, end) {
this.editor.jumpToChar(start, end);
this.focus();
},

jumpToLine: function(line) {
this.editor.jumpToLine(line);
this.focus();
},

currentLine: function() {
return this.editor.currentLine();
},

selection: function() {
return this.editor.selectedText();
},

reindent: function() {
this.editor.reindent();
},

replaceSelection: function(text, focus) {
this.editor.replaceSelection(text);
if (focus) this.focus();
},

replaceChars: function(text, start, end) {
this.editor.replaceChars(text, start, end);
},

getSearchCursor: function(string, fromCursor) {
return this.editor.getSearchCursor(string, fromCursor);
}
});
Then your should concatenate and minifiy (I use YUI compressor) all the JS files:

util.js, stringstream.js, select.js, undo.js, editor.js
=> codemirror_iframe.js

Also minify the parsers: parsejavascript.js, tokenizejavascript.js, parsecss.js, parsexml.js

At this point you can embed the widget into a test page:
<div
id="html_editor"
dojoType="mystuff.widget.CodeMirror"
type="xml"
style="height:100%;">
</div>
Now comes the tricky part: the editor does not initialize automatically at page load, because with dojo, chances are very high, you are gonna use this widget inside a container, where the editor is hidden at page load, and that would cause trouble with some browsers. So you need to subscribe to an event which triggers the visibility of the editor, so it can be lazy-initialized at first time it becomes visible. For example to use CodeMirror inside a tab container with a tab with id 'html_editor_tab' I do something like this:
dojo.declare("MyApp", null, {
main_tab_selected: function(page) {
if (page.id == 'html_editor_tab'){
dijit.byId('html_editor').initialize();
}
}
});

var myAppInstance = new MyApp();

dojo.subscribe("main_tabs-selectChild", myAppInstance, "main_tab_selected");
Update: Uhh, where was my brain when I wrote this article, I accidentally "misspelled" CodeMirror with CodePress at several places, including the title, it's corrected now ...

New Erlang web framework by Torbjorn Tornkvist

Tobbe just announced the very first release of a new, very simple Erlang based web framework fully integrated into erlware. It has support for sgte templates. Tobbe also has a collection of other highly interesting web related projects in his git repositry, including domerl, a simple, yaws and JQuery based Comet lib.

Hard to find technical docs about dojo internals

Of course an open source framework has no real untold secrets, but digging into the source code can be time consuming and and without in-deep documentation it's difficult to extract the authors thoughts behind it, so I was pleasantly surprised when I stumbled upon this links about dojo internals (which currently can't be found, or at least not by me, at dojo documentation):

Wednesday, May 14, 2008

Next flashplayer ships with speex audio codec

See the release notes. Speex is one of the best codecs for VoIP, and it is patent-free and open source. Related to this is also a new UDP-based network protocol called RTMFP for faster realtime media and P2P-capable, which will be part of flashplayer 10, now let's hope Adobe will release this protocol as part of their open specification initiative, but I guess they will try to keep RTMFP proprietary (at least until it gets reverse engineered), so they can sell their overpriced Media streaming servers.

Google JS library released

As part of Google's effort to better document the open web, they released today some of their Javascript libraries. I browsed a bit through the code, it is well documented and one thing grabbed my attention: the code structure looks similar to dojo, e.g. below a snippet from their DOM lib with ''provide" and "require" statements:
goog.provide('goog.dom');
goog.provide('goog.dom.DomHelper');
goog.provide('goog.dom.NodeType');

goog.require('goog.array');
goog.require('goog.math.Coordinate');
goog.require('goog.math.Size');
goog.require('goog.object');
goog.require('goog.string');
goog.require('goog.userAgent');
...

XHTML or HTML

I never really understood why people were using XHTML and I usually tried to clarify by pointing to articles by respected Web experts (e.g.: Ian Hickson, Brad Neuberg).
Today I read this and collected some more links about use and misuse of XHTML:

Thursday, May 01, 2008

Adobe "opening" a few more bits of Flash

Their new initiative is called Open Screen Project and is dedicated to drive consistent rich Internet experiences across devices. It is not about open sourcing the flash player, just about opening some specifications, such as FlashCast protocol and the AMF protocol. But AMF for example has been reverse engineered long time ago, in 2003 when I contributed to JavaAMF, this protocol has already been implemented in numerous other languages.

What I would like to see is RTMP (the Flash Video transport protocol) as open specification, so let's hope they consider this at their next round of "opening".

Wednesday, April 30, 2008

Firefox extensions for JS disabling and Python integration

My collection of Firefox extensions is mostly just the usual stuff you need for web development, such as Firebug, MeasureIt, ColorZilla, S3Fox, FlashSwitcher and a few more. After Firebug, for long time I didn't spot anything comparable spectacular. But recently I discovered some interesting extensions:
  • QuickJava: Finally an extension which makes it dead simple to disable/re-enable Javascript (I use that often to see how Ajax enriched webpages look like without Javascript). Just one click on a status bar button to enable/disable and reloading the page. Here there is even room for improvement: I would like to have enabling/disabling optionally coupled with reloading. Anyway, other extensions which provide the same functionality require a lot more GUI interaction.
  • Pyxpcomext: Python bindings (PyXPCOM). This extension doesn't provide any direct end user functionality, but makes it possible to write extensions in Python instead of Javascript. Just for fun I installed the Python Shell. I can think of many potential use cases, e.g. integration with the Python based App Engine SDK, so that web designers not comfortable with command line interfaces could easily interact with the local App Engine test webserver via such an extension, when testing their templates and stylesheets.

Friday, April 25, 2008

The missing feature of the Web: a DNS REST API

I have been waiting for years, that a quality DNS provider will a offer a REST API for setting DNS Records, but there is still no such a thing on the market. There is a SOAP based offering from Nettica (unfortunately I have an SOAP allergy). And there are the REST APIs some service providers are exposing for updating dynamic IPs.
DNS Made Easy, one of my preferred DNS providers, told me about a year ago they were working on such an API. I am still waiting. Anyway, if anybody is aware of such a service, please let me know.

Update: Found a possible solution (but I haven't actually tested their service yet): Slicehost, a similar service as Amazon EC2, they seem to have an API which allows to manipulate DNS records. But your domain has to be hosted on slicehost.

Update II: WorldwideDNS is another option.

Thursday, April 24, 2008

It's getting cloudy - Yahoo Application Platform

Just read this on TechCrunch:
... Yahoo Application Platform (YAP) - which will be a direct competitor to Google App Engine. Users can host their independent applications on Yahoo’s bandwidth, storage, database and CPU resources. At first they’ll support SecurePHP applications only, but they’ll expand to additional languages over time. The model will be very similar to Google’s - free usage up to a point, metered after that. They’ll also offer various developer tools as well.
With Yahoo offering cloud based PHP app hosting, I hope Google will focus on soon adding the already announced really useful features to App Engine, and not waste engineering efforts for supporting PHP.

Tuesday, April 22, 2008

Cryptography API for Google Gears

Gears will provide native cryptography to web applications, at least this is what Google Summer of Code student Mike Ter Louw is planning to implement in the coming months. While it is possible to implement browser side cryptography in Javascript (e.g.: dojox.encoding), only few Ajax applications use this functionality, because it is slow and for communication purposes it only adds a very thin layer of security (requiring lots of tricks) , compared to HTTPS.
But HTTPS is a bit of a problem in todays clouding computing platforms, because it requires static IPs tied to a domain name for a valid certificate. So gears maybe will become a preferred option to increase poor man's web application security.

Saturday, April 19, 2008

Flash done right and on Google App Engine

Often I criticize the usage of Flash for content centric pages, because often Flash is implemented in a way it causes a disastrous user experience (from arbitrarily resizing browser to sound which you can't turn off and fonts which you can't resize, just to mention the worst mistakes). Now I came across a new project, which advocates to do Flash the right way: gaeswf by Aral Balkan, a client and server side open source framework, based on a collection of best practices for using Flash on Google App Engine, in a way that Flash does NOT suck. The proof-of concept (live demo) implements techniques such as:
  • Embedding Flash with SwfObject
  • Deep linking (based on SwfAddress)
  • Flash content that obeys browser text-size changes

Tuesday, April 15, 2008

Google App Engine Team fixing issues quickly

Toying around a bit today on Google App Engine, I found a minor issue (not security related, very easy to work around and only affecting Mac users) in an add-on for the actual SDK. Only 32 minutes after I reported the issue they had fixed it !

Sunday, April 13, 2008

Amazon announced persistent storage for EC2

If Google App Engine does not provide enough flexibility for you, then there is some good news from Amazon: one of the missing pieces, persistent storage for EC2, has just been announced.

Exploring some lesser known Ajax GUI toolkits

I have only been exposed so far to Dojo and ExtJS, and I believe both are bleeding edge technology, provide a great user experience and are widely accepted. But there are about 50 more Ajax GUI toolkits out there. And some of them occasionally appear on my Google Ads, so out of curiosity I took a quick look at some randomly chosen ones:
  • SmartClient Ajax GUI System: Lots of widgets, but they are all table based and look desktop-like, that makes it a very Web 1.0 experience.
  • Icefaces: An Ajax GUI toolkit for integration into J2EE systems. Also lots of widgtes, looks a bit less desktop-like, but here as well I see tables (e.g. their tab container) where I think pure DIVs and a bit more CSS provide a better user experience (smother loading). I am not a J2EE guy (anymore), so I did not look closer at this product.
  • Nitobi: Their website looks nice and well organized, so I head high expectations. But I switch randomly between browsers and at the time I tried the Nitobi demos, I was using Safari 3,1. Unfortunately I could not load the demo (then I tried on Firefox and there everything worked fine and looked good). But then came the ugly part: They provide a free trial version with a 30 day evaluation period and beyond that you are expected to buy a license, prices start at $ 429 US and go up to $ 3699 for the enterprise version !!!
  • Telerik RadControls for ASP.NET: Even more expensive: prices start at $ 799 US. And you have to register on their site just to download the trial version. At least I could load the online demo, even on Safari. And it looks good, very good, nearly as good as ExtJS.
Lesson learned: there is a reason these Ajax GUI toolkits are lesser known !

Scaling down - the least talked about feature of GAE

It launched less than a week ago and now all over the blogosphere people are discussing the Google App Engine (GAE). Most talk is about scaling up, about potential lock-ins, even if the SDK is based on open source software. Only one thing where developers seem generally to agree: with Python, Google has made a good choice (maybe those not knowing Python yet but desperately looking forward to learn it, don't know that Python dictates line indention, actually the only thing I had difficulty to get used to). That is interesting by itself, because developers usually are highly opinionated in regard to programming languages. Or is it just the early adapter mentality which is more flexible ? Anyway - in this article I want to talk about something I haven't found mentioned yet at 100 other places:

scaling down


I see a growing number of businesses reducing or eliminating their IT department by using Google Apps (gmail & Co. on custom domain) for e-mail and other standard tasks covered by the Google Apps suite. Custom built applications for streamlining their non-standard, probably also simple but business specific work-flow has been beyond the budget of small organizations. So they used the available standard tools, which are often more complex than necessary for those tasks. But now the creation and especially the maintenance of custom built web applications is getting cheaper with GAE, because problems like authentication, deployment, high availability and even data redundancy (as probably-good-enough backup-strategy) are solved already and the cost for hosting gets completely eliminated (scaling down means just few concurrent users per application, little resource usage and the app will probably stay within the quotas for free usage of GAE). So the saved money from traditional in-house or outsourced IT administration, spent on development of custom applications will allow organization to improve their efficiency. And Google of course still will make good money with this scenario, because some companies will choose Google Apps Premier Edition over free/limited edition and will pay Google 50 $ per user account / per year.

Thursday, April 10, 2008

Google App Engine - Niall Kennedy's summary

Great summary about the Google App engine, by Niall Kennedy. He even provides some insights about the people behind it, and according to his first hand knowledge, this is just the beginning of what Google is rolling out:
I met with the App Engine's team leads on Monday morning for an in-depth overview of the product, its features, and its limitations. Google has been working on the Google App Engine since at least March 2006 and has only just begun revealing some of its features.

Wednesday, April 09, 2008

Erlang R12B-2 released - with native PNG drawing

It's a bugfix release and I had no big expectations when scanning through the release notes, but then I spotted this:
--- percept-0.7 ------------------------------------------------------------

OTP-7162 Percept no longer depends on external c-libraries. The
graphical rendering is now done via erlang code.
Thats huge, if you are interested in generating PNG images and don't wanna have dependencies on c-libraries (as you would have using my cairo wrapper erlycairo). Egd won't win any speed competition and has a limited feature set, but runs out of the box on any Erlang supported platform !

Tuesday, April 08, 2008

Google App Engine - Quotes and thougts

From the many blog posts about the Google App Engine, my favorite quote comes from Dave Winer:
Now, what Google announced is really exciting! I'm not kidding. It's even better than I hoped. Yes, it's only Python, but IBM's PC-DOS was only BASIC and Pascal when it first came out, and it didn't matter. Yeah, I preferred C, but I coded in Pascal because that's what you had to do to get an app running. What you're going to see here that you've never seen before is shrinkwrap net apps that scale that can be deployed by civillians. That's a mouthful, but that's what's coming. Why? Because here is a standardized platform that can be stamped out in the billions of units. Maybe Google can't do it, but the perception is that they can. Who is willing to stand up and say Google hasn't nailed scaling? What PCs did in the 80s, Google is doing now. PCs took the black magic out of owning a computer. Now Google is taking the black magic out of operating a scalable web app. Python is the new BASIC.
There were also lots of negative thoughts, e.g. Donna Bogatin:

Google’s latest attempt at Internet shock and awe replays the by now traditional Google routine of “giving away” Web services under the guise of disinterested benevolence while the Web cheers the supposed Googley revolutionary Internet disruption and forecasts doom for existing players, such as Amazon, for this example.
In typical Google fashion, though, “free” comes at a very high price. In fact, the Google App Engine product unveiled by the high-flying corporation is in contention for the scariest Google move to date.
Not only do startups using Google App Engine unwittingly put control of their businesses in the sole discretionary hands of Eric Schmidt and company, unwitting consumer users of Google App Engine hosted services automatically “share” all of their personal, proprietary data with Google, whether they really want to or not.
Generally people are comparing the App Engine with Amazon's AWS offerings and either seem to be interested in the one or the other. I think these two services can be combined for easy creating scalable web applications which go beyond what you can do with a limited amount of time and money, compared to the scenario where you would use just one of the services. Let me elaborate: For the simple, stateless stuff, for static and dynamic HTML pages and for persisting data, Google App Engine is perfect. For advanced stuff like Comet HTTP push, video streaming or batch processing, Amazon EC2 instances could be used on demand just for that.

Trying out Google App Engine

Yesterday night Google launched App Engine, a highly scalable web application platform, which has the potential to become a game changer. I was lucky to grab a developer account, which is currently tied to several limitations:
  • only 10000 developer accounts available
  • applications have to be coded in Python
  • only three applications per developer
  • bandwidth, storage and CPU usage limitations
  • no road map, no info about future pricing model
On the other hand, it's free for now, you can use the Django open source web framework and template language, you can locally develop and test your app with the cross platform Google App Engine SDK (download size only 2.3 MB - on Mac OS X), you get a powerful administration interface at your Google account and most important, it is extremely easy to get started with, in no time you have a schema-less, database driven helloworld web application deployed on Google's server farm.

The internet users may start their own home business by having business deals with the global entrepreneurs. The different brands of computers have been manufacturing the latest and stylish models of different sizes and shapes for the computing clients. The main features of hosting plans of godaddy are reputable among the potential customers. You may get hosting services of high quality in affordable rates by joining powweb, reliable web host.

Sunday, April 06, 2008

Skype and PostgreSQL database

PostgreSQL is my favorite open source relational database. Some time ago I wrote some experimental code (currently unmaintained) for integrating it with erlyweb. The guys at Skype seem to like PostgreSQL as well. In regard to the current Google Skype takeover rumors (or was it just a 1st of April joke which went out of control ?) and to this article: Skype Plans for PostgreSQL to Scale to 1 Billion Users, I took a look at the Skype open source projects and found a few interesting ones related to PostgreSQL:
  • PL/Proxy: Horizontal data partitioning, based on a hashed database field (for distributing large amount of data among several physical servers).
  • SkyTools: DB cluster management software for replication, message queues, fail over and Python integration.
  • PgBouncer: connection pooling.

The most advanced features of backup software are very assistive for exclusive disaster recovery of data. The web site design services are also the main part of some hosting plans of the service providers. The benefits of affiliate marketing have been attracting a number of investors and entrepreneurs of this global business community rapidly. The webmaster is responsible for administering all web applications expertly.

Wednesday, April 02, 2008

Easy git on Emacs with emacs-git

I have been using emacs-git for the last few days and and it proved incredible useful. It let's you do interactively most of the basic git operations such as creating, cloning or importing a repository, it inidcates graphically the git status of the current file with a colored LED-like icon at the Emacs bottom status line and it also facilitates adding / removing files to the repo, ignoring files, tagging, merging and conflict resolution.
Emacs-git works only on Emacs (and not on X Emacs) and requires a very recent version of Emacs (I am using it on a nightly build of aquamacs, which is based on Emacs from CVS).

Monday, March 31, 2008

Emacs on Ajax with Steve Yegge's new js2-mode

Steve Yegge just released a new Javascript Emacs mode. I installed it and played around a bit and syntax highlighting and indention seemed to work perfectly. The feature list is impressive (copy-pasted from project page):
The best news comes now: according to his blog, this is just the beginning:
This is part of a larger project, in progress, to permit writing Emacs extensions in JavaScript instead of Emacs-Lisp. Lest ye judge: hey, some people swing that way. The larger project is well underway, but probably won't be out until late summer or early fall.

My new editing mode is called js2-mode, because eventually I plan to support JavaScript 2, also known as ECMAScript Edition 4. Currently, however, it only supports up through JavaScript 1.7, so the name is something of a misnomer for now.
Plenty of reason to switch back to Emacs for those like me who thought that TextMate was the future.

The Power of Javascript - by Glenn Vanderburg

Wanna listen to an in-depth introduction to Javascript, not just the technical but also the historical side ? Then this talk by Glenn Vanderburg recorded at JAOO 2007 is the right choice (direct link to the media - flash .flv video).

The talk mentions Douglas Crockford's famous article: The World's Most Misunderstood Programming Language from 2001. Just for completeness, here is Crockford's recent follow-up article: The World's Most Misunderstood Programming Language Has Become the World's Most Popular Programming Language.

Saturday, March 29, 2008

What sucks most about the Mac

.. are those nearly weekly software updates which require a reboot. I didn't buy a Mac because I was influenced by those all-day-long digging mac fanboys, I bought it because I wanted to run some graphics and video editing software which is not available for Ubuntu Linux (my previous desktop system, from windows I stay away as far as possible) and for paying about twice the price compared to a similar Dell or noname hardware configuration capable of running Linux, I really expected a better user experience in every possible aspect, as promised in their glorified advertisement. But the requirement to reboot the machine for those nearly weekly minor updates really puts the Mac back into the stone age of computing !

Friday, March 28, 2008

Doloto - Javascript Rewriting paper by Microsoft

I just read the reseach paper (pdf) about Doloto a Microsoft project for speeding up Web 2.0 applications by serverside Javascript static code analysis, AST transformations and code splitting. They claim that with this technique the loading time of monolithic (all Javascript loaded at once) Ajax applications can be significantly reduced. In my opinion, a better approach is to build right away non-monolithic apps (Javascript libraries like dojo provide support for that).

Wednesday, March 26, 2008

Crary - A new Erlang lightweight web server

Beside of featherlight iserve and battle proved mochiweb (at MochiMedia), there is now an additional choice for lightweight Erlang HTTP servers: Crary, which shares similar design goals but provides a different interface. According to its author Scott Parish:
Crary, a HTTP server for the REST of us.

The intention is that its small enough and flexible enough to be used for most any HTTP server need. While it isn't a stand-alone system, nor does it have its own web-framework, these things can easily be built on top of crary. Crary should be easily embedded into the release of a larger application to provide a web interface or to create a web service interface.
Below a tiny little snippet illustrating how to write a hello world program with crary:
start() ->
crary:start(8080, {?MODULE, handler, []}).

handler(#crary_req{method = "GET", uri = #uri{path = "/favicon.ico"}} = Req) ->
crary_dir_listing:write_file(Req, filename:join([my_doc_root(), "favicon.ico"]));
handler(#crary_req{method = "GET", uri = #uri{path = "/test"}} = Req) ->
crary:r(Req, ok, [{"content-type", "text/html"}], <<"hello world">);
handler(#crary_req{method = "GET"} = Req) ->
crary:not_found(Req);
handler(Req) ->
crary:not_implemented(Req).
To get your copy of crary just clone it from its git repository, or install it via erlware.

Tuesday, March 25, 2008

New YouTube player - Nice, but still not ready for HD screencasts

Geoff Stern, the Google guy who recently rewrote the YouTube player, just posted an interesting demo, mashing up the video player with the Google maps API, demonstrating the new player's Javascript integration capabilities.

Other examples out there:
This brings new possibilities for screencasts (or video presentations / podcasts), for syncing the audio/video with text caption or any HTML content along the audio/video timeline. Now I am just waiting for YouTube not destroying anymore the HD quality of uploaded quicktime videos when they convert it to flash (requiring cumbersome hacks like this for online HD flash video), so that YouTube can eventually be used for high quality screencasts and video enabled online presentations.

Update: more chromeless players:

Sunday, March 23, 2008

Erlang processes benchmarked against threads of other languages

We all know that the result of benchmarks are only significant for that specific piece of code which is getting tested, and usually the benchmark authors favorite products are tuned to outperform its competitors. Nevertheless, below a summary of a benchmark recently discussed on reddit. The benchmark itself is just a few lines of source code (at least in Erlang), spawning a bunch of processes and doing some simple message passing between those processes. Thread implementations in other languages:
  • C (pthread - GNU gcc): 8.5 times slower
  • Python: 15 x slower, 1.4 x more memory
  • Java: 20 x slower, 5.8 x more memory
  • Ruby: 282 x slower, 3.4 x more memory
More numbers, details and the benchmark source code in all the different languages at the language shootout site.

Monday, March 17, 2008

The gBrowser is coming - disguised as Google Gears

At least this is the impression I get when I take a look at the Google Gears developer documentation , especially the wiki pages with label DesignDoc and the discussions in the contributor mailing list. Here a few examples to illustrate what I am talking about and what will hopefully soon come to any browser near you:
  • AudioAPI: Playback, Recording, Mixing and Editing of WAV, OGG and MP3 audio.
  • LocationAPI: Provides geolocation.
  • ImageManipulationAPI: mentioned in the BlobApi description.
  • OpenGL vector drawing: discussed in this thread.
Upgrading existing browsers with Javascript APIs providing HTML5-compliant functionality is much better for a healthy, accessible, easy indexable and open standards oriented near future of the web, than relying on proprietary plugins such as the flashplayer for specific functions which can' t be provided by HTML/CSS/Javascript of todays browsers.

Wednesday, March 12, 2008

Podcast: Joe Armstrong on Erlang

I am currently listening to this Podcast by Joe Armstrong, creator of Erlang. It's a great overview and has lots of historic and other background information.
In case you are new to Erlang, and need something more entertaining and haven't seen yet the classic, "Monty Python" Erlang video, you must see it !

Saturday, March 08, 2008

ErlyDTL now has date and time formating

ErlyDTL, the Erlang version of the Django Template Language is progressing nicely. Most of the common tags and filters are implemented. Recently Colm Dougan joined the development team and added date and time formating.

Let's take a look at some examples with fictive dates:

Template: {% var1|date "r" %}
Rendered Output: Thu, 21 Dec 2000 16:01:07 +0200

Template: {% var2|date "jS F Y H:i" %}
Rendered Output: 27th February 2008 01:24

Template: It is the {% var3|date "jS o\f F Y" %}
Rendered Output: It is the 4th of September 2007

Friday, March 07, 2008

Diving into Core Erlang

Inspired by Robert Virding's LFE - Lisp flavored Erlang, I recently started to evaluate Core Erlang as base for ErlyJS, the Erlang Javascript compiler I am working on. The current approach is based on Erlang Abstract Syntax trees. Erlang Core is more low level and looks more like a LISP dialect than Erlang. Following a short summary about Core Erlang's design goals (copy pasted from the spec):
  • Core Erlang should be as regular as possible, to facilitate the development of code-walking tools.
  • Core Erlang should have a clear and simple semantics.
  • Core Erlang should be straight-forward to translate to every intermediate code used in any Erlang implementation; similarly, it should be straightforward to translate from Erlang programs to equivalent Core Erlang programs.
  • There should exist a well defined textual representation of Core Erlang, with a simple and preferably unambiguous grammar, making it easy to construct tools for printing and reading programs. This representation should be possible to use for communication between tools using different internal representations of Core Erlang.
  • The textual representation should be easy for humans to read and edit, in case the developer wants to check what the Erlang source looks like in Core Erlang form, inspect – or modify – the results of code transformations, or maybe write some Core Erlang code by hand.
You wanna see how Core Erlang looks like ? Take any Erlang source code and compile it as binary and with the to_core compiling option and with core_pp:format/1 you can pretty-print the output. Core Erlang is an intermediate step between Erlang AST representation and VM internal representation. So far I see the following advantages by using Core Erlang for ErlyJS:
  • It is less tied to Erlang the language and therefore just a more natural choice.
  • There exist `let` expressions which seem to provide a cleaner way to handle Javascript variable reassignments (you can't directly reassign variables in Erlang).
  • And last and least, Ecmascript 4 Reference implementation is written in Standard ML, which is more similar to Core Erlang than to normal Erlang. Maybe this point will have relevance one day in the future.
Unless I will discover a show stopper, there will be soon a complete rewrite of ErlyJS to Erlang Core (but I am using git now and only pushing to googlecode SVN major changes in bulk).

Thursday, March 06, 2008

Erlang and Fuse

The Dukes of Erl guys have created an Erlang implementation of FUSE called fuserl. From reading their blog, it seems they need it for interacting with RRDtool, a open source software for realtime data logging and the ultimate goal for fuserl is a distributed filesystem based on mnesia: walkenfs (the idea is not new, Ulf Wiger has something similar as part of erlhive). Now I just read about another possible use case for fuserl:

The advanced strategies of internet marketing are employed by the different internet marketers to promote E-businesses. The web site design and web development programs are organized by the different IT companies. The cheapest domain name registration services are very useful for the medium kind of entrepreneurs who can’t afford expensive rates. The cheap hosting services of various web hosts are available to facilitate the individuals who run small businesses.

Saturday, March 01, 2008

When to use Ruby and when not

Just read this interesting article by Zed Shaw about Ruby, Ruby in the enterprise, Ruby on virtual machines and more ...

Saturday, February 23, 2008

ErlyJS - translating Javascript to Erlang

I have lately invested many hours of coding in ErlyJS, my open source attempt of writing a Javascript compiler for the Erlang virtual machine and crossed today the barrier of 100, for the number of commits and also for the number of test cases. There is still a long way to go, because nobody (including myself) will actually use the compiler in a real project, unless it is 100% Javascript compliant. But at least, most of the basic stuff is now halfway implemented:
  • Literals
  • Global / local variable handling
  • Operators (except of dot operator, for objects)
  • Functions
  • Built-in global functions
The next big task will be object handling (and implementing the built-in objects and their functions)

I am not targeting the Erlang VM directly (beside of the Erlang compiler source code, there doesen't exist any formal specification or at least documentation about the Erlang VM internals in general and specifically the VM opcodes). What I do is transforming the Javascript source code AST to an Erlang AST. This involves a lot of trickery, because Erlang doesn't allow variable re-assignments (this is good and also necessary in the context of Erlang concurrency), but most Javascript code is just a bunch of variable re-assignments, so I have to model it somehow and I have choosen to model it differently for global Javascript variables (Erlang process dictionary) and local variables (normal Erlang variables). One interesting thing about having an Erlang AST of Javascript source code is the possibility of pretty-printing Erlang source code. Let's take a look at a Javascript example from the test cases:
function test() {
var a=0, b="Bananas";

switch (b) {
case "Oranges":
a = 1;
break;
case "Apples":
a = 2;
break;
case "Papayas":
case "Bananas":
a = 2.5;
a = 3;
break;
default:
a = 4;
}

return a;
}

If I pretty print the AST (just before compiling it, and this is even done automatically at verbose ErlyJS compiling settings) I get the following Erlang source code:
js_test() ->
V78 = 0,
V80 = "Bananas",
{V152} = case V80 of
"Oranges" -> V170 = 1, {V170};
"Apples" -> V88 = 2, {V88};
X when X == "Papayas"; X == "Bananas" ->
V270 = 2.5, V288 = 3, {V288};
_ -> V32 = 4, {V32}
end,
V152.
This kind of source code translation is extremely useful while developing and debugging the ErlyJS compiler and analyzing test cases.

Friday, February 22, 2008

Dojo theming tutorial and more at dojocampus

Ever wanted to know how to create flexible-size background images for rounded corners or other CSS effects specifically for custom-theming Dojo widgets ? Unless you have already intimate knowledge of the Sliding Doors technique and CSS sprites, you should checkout the "Rounded tabs" tutorial on the recently started DojoCampus site. There is also other great stuff there such as a video about the dojo grid and Firebug tips.

Tuesday, February 19, 2008

Discontinuing ErlyMate

My attempt of better integrating Erlang with TextMate has been an interesting trip into foreign territory (Objective C and Desktop applications), but I never considered it as a serious project, it was more a kind of overreaction to my inability of mastering all Emacs key bindings even at sleep. And I also don't like to put lots of time into an open source project to erlangify a proprietary, Mac-only software from a one-man-company. Anyway, if this are non-issues for anybody who wants to resurrect the project, I will be available to answer initial questions. Ok, this was probably my last post about ErlyMate here.

Erlang – The CEO’s View - by Gordon Guthrie

An interesting article about Erlang from the business point of view, by Gordon Guthrie the CEO/CTO of hypernumbers.net.

Saturday, February 16, 2008

Interfacing Erlang with C - explained by Joel Reymont

Great tutorial on how speeding up Erlang with linkedin C code. But hopefully you won't have to do it because it makes your software hard to maintain and the C part might crash your program. But if you have to interface with C, then first check whether a C-node (as for example done in ErlyCairo) has enough performance, a C-node uses it's own memory space and doesn't crash your Erlang program, in case things go wrong. But if your C code is very robust, and you really need the performance, Joel's tutorial is a great introduction to that topic.

Thursday, February 14, 2008

Django Template Language - the dojo implementation

Beside of Erlang based ErlyDTL (by Evan Miller and myself) there exists (at least) one other non-Python project which implements the Django Template Language: the dojo Javascript version: dojox DTL (documentation) for creating dynamically and template-based HTML layouts inside the Web browser (opposed to traditional approaches of creating HTML layouts at server-side). Today dojox DTL reached feature completeness, implementing all original Django tags and filters, at least that is what I guess from reading the SVN changes for the README:
--- This aims to be a 1:1 match with the Django Template Language as outlined in
+++ This is a 1:1 match with the Django Template Language as outlined in
While dojox DTL is a very interesting concept and brings new possibilities to separate client-side logic and presentation, I haven't seen yet a killer example. Maybe I just haven't looked far enough. But one thing is sure: if you use a template language at server side and at Javascript client side, and it can be the same template language, that's a huge benefit.

Wednesday, February 06, 2008

Erlang Style Concurrency - explained by Ulf Wiger

That is probably all you ever wanted to know about Erlang style concurrency, put into a great summary by Ulf Wiger, who has been using Erlang since 1992.

Friday, February 01, 2008

New book "Mastering Dojo" - beta PDF now available

For those who prefer to learn new Javascript stuff by reading a real book, Mastering Dojo (500 pages) has been announced today. It will be relesed in June, but the beta PDF is already available. Alex Russell, one of the initial developers of dojo, is a co-author of that book.

Update: I ordered the PDF version, right after writing this post, but haven't received the e-mail with the download-link yet, so all what is really available right now, are the two example chapters at the publisher's site.

Tuesday, January 29, 2008

More on serverside Javascript - Rhino on Rails

Dion Almaer has recently interviewed Steve Yegge about his project of porting Rails to Javascript, you can listen to it right here:

Tuesday, January 22, 2008

Serverside Javascript with Jaxer

Today Aptana (mostly known for their eclipse based Ajax IDE) launched Jaxer, an open source based Ajax server for using Javascript as server side scripting language. It is built on top of the Apache Web server and and the Spidermonkey Javascript engine and has an API which covers most developers needs: File and database access, logging, email and all kind of other utility functions.

So what are Jaxers major selling points ?
  • Write entire applications or presentation layers in Ajax.
  • Share code between browser and server.
  • Database and file access from JavaScript.
  • Integration with Aptana Studio (their Ajax IDE).
The most important question for me of course is how it compares to erlyjs, my Javascript-to-Erlang compiler project with main purpose of running Javascript at the serverside for Ajax web applications. Obviously Jaxer is available today and now and erlyjs is work-in-progress far from being ready to use yet. Both share the same vision and both use Spidermonkey. But while on Jaxr the Javascripts really run within the Spidermonkey engine, erlyjs uses Spidermonkey only for parsing the Javascript, then compiles the parsed Javascript to Erlang beam files, for running on the Erlang virtual machine. I believe my approach gives significant performance and scalability advantages (and integrates better with the rest, in those rare cases where the rest is written in Erlang as well ...)

Thursday, January 17, 2008

Hypernumbers whitepapepr: comparing Erlang and LAMP web stacks

Using Erlang In A Web Start-Up is a whitepaper (PDF) by Gordon Guthrie, pointing to advantages from the business point of view when choosing Erlang.

Tuesday, January 15, 2008

ErlyDTL - the Django template language in Erlang

I have been working on a new template language called ErlyDTL. Let's compare it first with the other, established players in the Erlang open source template languages field:
  • ErlTL by Yariv Sadan. ErlTL is used in ErlyWeb and therefore probably the most popular Erlang template language. It exposes the full Erlang language to the template author, that is good, if the template author is an experienced Erlang developer, but bad, if the template author does not know Erlang. ErlTL compiles templates to beam files.
  • sgte by Filippo Pacini. An Erlang implementation of StringTemplate. Enforces separation between model and view. Templates get evaluated at runtime. Used at erlware (if you install the erlware launcher, sgte is one of the core packages used internally for the various erlware templates)
  • ErlyDTL by Evan Miller and myself: based on the Django template language. It does not expose Erlang to the template author, it compiles templates to beam files, pre-renders as much as possible at compilation time and supports a lot of features such as template inheritance, presetting variables at compilation time, automatic HTML escaping and lots of Django tags and filters. But it is not feature complete yet, just the more important tags and about half of the django filters are currently implemented.
If you wanna learn more about ErlyDTL, check out the code or take a look at the examples, there are a bunch of ErlyDTL demo and test templates at he googlecode project and also the resulting, rendered output files.

Update: There are more Erlang template engines out there: seethrough which is specifically for XML/XHTML and internally uses xmerl to do its magic. It is rather simple compared to the others, but depending on the use case that can be an advantage.

The search engine optimizers are very much expert to manage ppc productivity in an efficient manner. The main function of web hosting service provider is to help the individualistic web sites to have direct accessibility to worldwide immediately. The website design templates are designed by the professional web designers which can be downloaded from different web directories free of charges. The internet service providers offer their latest services of dsl which are reliable and affordable for internet users.

Sunday, January 13, 2008

CodeMirror - an AST aware in-browser code editor

I have been following for a while now the development of Javascript based code editors and web IDEs (see here and here), I even started to build one myself, because I thought there is no such AST aware editor out there, at least until I discovered codemirror, which comes with support for Javascript and HTML, and with support I mean it has a real parser (and a CSS file for syntax highlighting) for those languages. Marijn Haverbeke, the author of this masterpiece of functional Javascript programming has released today a new version, which makes it easy to integrate it with a different Javascript libraries (codemirror itself uses MochiKit).

Codemirror has the following features:
  • syntax highlighting
  • automatic code indentation of current line on pressing TAB or RETURN
  • if some code it selected, automatic indentation of current selection on pressing TAB
  • works with all common modern browsers
  • highly configurable: additional languages, performance settings, etc.

Sunday, January 06, 2008

Zed Shaw on Rails (Ghetto)

The new year started with an explosion in the Rails community: Zed Shaw's Rails rant, where he points to some well known Ruby/Rails-people, explains why they are "assholes" and brings up some "general thoughts" such as:
This is exactly what makes Rails a ghetto. A bunch of half-trained former PHP morons who never bother to sit down and really learn the computer science they were too good to study in college.
Zed is the author of Mongrel, that made him well known and highly respected within the Rails community. But now I see people from the whole software industry blogging about him and his famous rant. Zed got mentioned on techcrunch and today I saw even a post from Rickard Oeberg about Ted's rant. A few years ago, Rickard was blogging in a very similar style, highly informative but also entertaining about the nasty things around the JBoss community (Rickard was the most important initial developer of the JBoss application server).

Friday, December 28, 2007

Erlang on Javascript

While I am working on a Javascript to Erlang compiler for running Javascript code on the Erlang virtual machine, others do the opposite: Alex Graveley has written Er.js, a Javascript library for using Erlang-style concurrency with JavaScript, even with an Erlang like syntax !

Javascript does not support natively any kind of threads, therefore a lot of tricks (like using the asynchronous timer callback) went into this and other narrative Javascript based threading libraries to make it look and feel like real multithreading.

Wednesday, December 26, 2007

Gmail insecurity - check your filters - you may have been hacked

David Dairey's .com domain name got stolen by an online criminal, exploiting a gmail security vulnerability (now fixed). The scary thing about this is that the exploit added a filter to gmail, so even after Google fixed the security whole, any malicious inserted filter continues to do its evil actions. Read the entire story and check your filters !

Saturday, December 15, 2007

How to put HD video on the web with latest flashplayer

First I want to make it clear that I am all for open web standards and requiring the latest flashplayer for showing some video on your site always degrades the user experience, no matter how much effort you put into avoiding that. So if you wanna depend on latest flashplayer, there must be a strong reason for it. Flashplayer 9.0.125 (released about a week ago) offering high quality codecs (h264/HE-AAC) might be such as strong reason, the audio/video quality is excellent and filesize of the videofiles is relatively small. Here the required steps to produce such a video and how to put it on a webpage without degrading the user experience too much.

Let's assume you already have your original video file in high quality and large file size, either form a HD video camera, a screen recording application or most probably as a result of post processing with a video editing software.

First you must transcode your media to h264 video / HE-AAC audio and put it in a mp4 fileformat. I assume there exists some software from Adobe which does that for you, but I am not familiar with their current commercial offerings. In my case I put together an open source toolchain to perform the transcoding.

Now you have the video as a *.mp4 file. Next you need to prepare your website to embed the video with a flash videoplayer (there are others which work equally well, just the code below probably neds to be slightly modified). The tricky part is that you require the latest flashplayer, so I suggest embedding via Javascript and with SwfObject, that allows to upgrade to the latest flashplayer via Adobe ExpressInstall, if Javascript is enabled. And what if Javascript is not enabled or not available at all ? There is a solution for that: "Extended" markup, which results in either the video or an alternative content (bur no easy upgrade via flashplayer ExpressInstall). Here the embedding steps in detail:

Load swfobject.js (Javascript library):
<script type="text/javascript" src="{{ path }}/swfobject.js"></script>
Register the video (via Javascript):
<script type="text/javascript">
swfobject.registerObject("{{ video-DOM-ID }}", "9.0.115", "{{ path
}}/expressInstall.swf");
</script>
Extended HTML markup for embedding video:
<object id="{{ video-DOM-ID }}"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800"
height="620">
<param name="movie" value="{{ path }}/mediaplayer.swf">
<param name="allowfullscreen" value="true">
<param name="menu" value="false">
<param name="flashvars" value="file={{ path_to_video }}&image={{
path_to_preview_image}}">
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="{{ path
}}/mediaplayer.swf" width="800" height="620">
<param name="allowfullscreen" value="true">
<param name="menu" value="false">
<param name="flashvars" value="file={{ path_to_video }}&image={{
path_to_preview_image}}">
<!--<![endif]-->
<h2>To view the video:</h2>
<p>
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player">
</a>
</p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>

Remarks:
  • all {{ path }} variables need to be replaced with the actual path or URL where you have your static content.
  • {{ path_to_video }} : the path or URL of the actual video file
  • {{ path_to_preview_image }} : path or URL of a preview image
Example:

Friday, December 14, 2007

ErlyComet article and screencast

Today my article "Getting started with Comet on Erlang" got published at CometDaily, there is also a screencast there (scroll down there, to the ErlyComet section) if you prefer to watch and listen ...

Update: Some users could not load the screencast / did not like to get asked for upgrading the flashplayer. I halfway expected this. It's not that I haven't put in efforts to avoid that kind of bad user experience, but my efforts apparently failed. Let me explain in detail: the video is encoded in h264/HE-AAC and that only works on flashplayer 9.0.125. If the flashplayer is not the very latest one, a dialog should inform the user (and provide direct link) to upgrade the flashplayer, if he wishes to watch the video. Uploading the original QuicktTime screencast to youtube or google video results in bad, mostly unreadable text quality, similar to all those RubyOnRails screencasts which have been originally recorded in QuickTime.
Nevertheless, here is the google video version (bad quality).

The web hosting services of different hosting companies include the most additional features of domain registration free of charge. The web site design of varied websites is developed by the professional web designers who have artistic touch of Excellency. If you want to have direct and fast internet access, you should subscribe reliable broadband service providers. The website development services are offered by the different IT companies to boost up the significance of web site into the main search engine.

Thursday, December 13, 2007

Erlang TextMate integration - Documentation lookup

I have made some progress with ErlyMate, my pet project for adding first class Erlang support to TextMate. Based on a new architecture with an Erlang background server (starts and stops together with TextMate, wrote a Cocoa plugin for that) I implemented a very first and highly experimental approach of edoc lookup. More technical details can be found at the googlecode project page.

And here a screencast to show you how it looks and feels like (requires latest flashplayer, and asks you to upgrade to it, if you don't have it, because video is h264/HE-AAC encoded):



To view the ErlyMate screencast:




Get Adobe Flash player





Monday, December 10, 2007

Rubinius - the next generation Ruby virtual machine

The guys at Engine Yard, a RubyOnRails application hosting company are serious about solving the Ruby performance issues (Ruby is interpreted) and they are developing a virtual machine. Straight from the Rubinius homepage:
Rubinius draws on the best virtual machine research and technology of the past 30 years and incorporates the newest research in dynamic language implementations. Rubinius implements the core libraries in Ruby, providing a system that is much more accessible, easier to develop and to extend.
And what's in the bag for an Ex-Ruby-developer (Ruby it is a great language, but since I am comfortable with Erlang, I don't have any use for Ruby anymore ...) ? Well, TextMate, my preferred editor has a lot of its functionality implemented as Ruby scripts, and if they run faster with Rubinius, that's fine for me.

Sunday, December 09, 2007

Benchmark - ErlyWeb vs. RubyOnRails

Yariv Sadan, the author of ErlyWeb, has benchmarked his Erlang MVC web framework against RubyOnRails 2.0 and according to his results, ErlyWeb is outperforming RubyOnRails by factor 47. [Corrected: it's 6 now, see Update]

If Ruby is on Rails, than ErlyWeb is on rocket engines !

Update: This number is far too good to be true ! In fact, Yariv had Mongrel running in non-production mode, in his corrected version the ErlyWeb outperforming factor went down to 6.

Thursday, December 06, 2007

Erlang R12B-0 on Leopard

Yesterday Erlang R12B-0 was released. Compilation on Leopard (with XCode development tools installed) was straight forward, except for one Erlang application: the new profiling tool percept, which got disabled because of missing libgd library at the ./configure step.

So I installed it via macports:
sudo port install gd2
unfortunately ./configure continued to complain. Finally today a solution for how to run ./configure was posted on the Erlang mailing list:
./configure --with-gd=/opt/local
and everything went without further problems ...

There a lots of new features and improvements, and I look forward to explore them one by one in the next weeks and months. Just the troublemaker percept I had to inspect immediately. It seems to be a powerful tool for performance analysis and it ships with a module called edg which wraps libgd and serves for creating 2D vector graphics (to visualize the percept profiling results), similar to my own erlycairo, but it produces*.gif files (erlycairo only outputs *.png files).

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 ...

Saturday, November 24, 2007

s3fox - a great Amazon S3 explorer and backup tool

I recently had to do some disaster recovery on my mac and made the painful experience that mozy sucks in every way one can imagine. After several failed attempts I managed to restore most of my stuff. Ok, mozy mac version is still in beta, and it is dirty cheap but it is also completly useless for the less experienced user, because it was not straight forward for me to restore large sets of files and it is useless for the more technical user, because it gives you little control of what it is doing and you can't even backup hidden files (e.g. a git repository) and when I asked them about that, I just received a non-answer from somebody who did not understand what I asked. This is my personal experience. I am sure there are plenty of happy mozy users out there.
So I had to reevaluate my options for personal backups. Because I was already a heavy user of Amazon S3 in relation with various web projects, I tried out some of the common S3 desktop tools:
  • JungleDisk (commercial, cheap) - sucks because what you store with JungleDisk you can only retrieve with JungleDisk (with additional effort you can do anything of course).
  • S3 Browser (free) - sucks because there is only a mac version and it has very limited functionality.
  • BucketExplorer (commercial, free while in beta) - sucks because it is written in Java and therefore looks ugly and just feels strange on the mac.
It's a crowded market and there are a lot of other S3 explorer and backup tools out there. I actually had been using one heavily and with great success when it came out: s3fox. It's a slick Firefox extension and it was the only one which exactly worked the way I actually expected it to work. But there was one problem: after initial release, the author did not maintain it, and Firefox evolved, the S3 protocol itself evolved and when I switched to a mac half a year ago, I couldn't use it anymore (I don't remember for what particular reason). Now I checked again and - nice surprise - there is a new version (0.4), which solved all the problems and even got drag & drop and some functionality for synchronizing local and remote folders. Easy to install, easy to use, free. I didn't have to look any further.

Tuesday, November 20, 2007

MochiWeb got a HTML parser

Since MochiWeb went open source I have been working with Tait Larson on a Comet server (HTTP push) built on top of MochiWeb. We are not there yet, but it has been a very pleasant experience so far, especially considering an earlier (failed) attempt of mine to build such a thing on top of yaws, where I had to patch yaws and deal with all kind of annoyances (don't get me wrong, yaws is great for 99% of all possible use cases, just HTTP Push belongs to the other 1%).

So today I was just doing some online housekeeping and I noticed that MochiWeb got a HTML parser. Thats great ! So far, it has been asked many times on the Erlang mailing list how to parse HTML. And sooner or later somebody points to the yaws HTML parser, which works reasonably well. One time it was me asking that question and when I got the answer, I started to play with that yaws HTML parser and some simple XHTML (if I remember properly) examples and everything looked fine. But things turned nasty when I tested the yaws parser with real world HTML.

Now I hope people are starting testing and crashing (I just did) the MochiWeb parser with real world HTML and provide feedback to the developers so they can further improve it !

Rounded corners with canvas tag graphics

There exist many different approaches for creating rounded corners on HTML pages, and each of these approach has its problems. Javascript based solutions consume too much CPU cycles (and even more if doing anti aliasing), background-image based solutions are complicated (and even more, if done properly, e.g. sliding-doors based) and involve additional HTTP requests and solutions based on a bunch of DIVs (with border and varying margin to emulate the corner radius) turn any page into a horrible tag soup. The slickest solution, with the cleanest HTML and Javascript code I have seen so far is Greg Houston's mocha. It uses the canvas HTML tag, which is supported by Firefox, Safari and Opera 9. The ugly part of this solution is the heavy work-around required for Internet Explorer.

Monday, November 19, 2007

Amazing browser-based Javascript IDE

A few months back I put together a summary about browser-based Javascript code editors. Then I tried myself to create one, with dojo, but I did not get very far. Then Nicola Rizzo released CodeTextArea, which is a dojo widget and a very promising approach. A demo is available and it currently best works with Firefox on MS Windows. Today I learned about TIDE, a full fledged browser-based Javascript IDE, which loads fast, looks amazingly good, provides a lot of typical IDE functionality and has even a bunch of working Javascript demos to play with. It uses the following open source libraries:

The webhosting reviews of the different hosting companies give very informative and useful details about their hosting packages. The basic aim of seo services is to provide all essential tools of search engine optimization to enhance the web ranking according to the criteria of main search engines. The domain registration service providers offer very affordable rates for registering domains. The one of most leading hosting service providers, dotster has been offering very reliable hosting packages for the potential clients in reasonable ratings.

Amazon S3 will soon support upload via HTTP POST

One limitation of Amazon S3 is its strict REST behavior: upload only via HTTP PUT, and that is not possible with most of the browsers. Today a proposal was published by Amazon staff, so the final solution is probably not too far away anymore.

Saturday, November 17, 2007

Easy Erlang compiling with TextMate

Today I created a custom command for easy Erlang compiling with TextMate. Errors (if there are any) are popping up hyper-linked on a HTML window, and if you click on them, you get straight to the file and line with that error.
This is work-in-progress and just compiles the current file. The following features will be added in future versions:

- only compile modified files
- parse Emakefile if available, otherwise:
- crawl directories to figure out src, include and ebin folders.
- code reload if node is running

Monday, November 12, 2007

Which Javascript library ?

Update: Simon Willison's Javascript library slides, which where embedded at this place, are not accessible any more, so I took out the embedded slide show.

If it is just about pepping up a webpage with some AJAX and some flash-imitating eye-candy, any of the popular Javascript will serve similarly well. But when it comes to full fledged web applications, the dojo toolkit is leading the pack. Vance Dubberly shares the same vision and today he has provided a detailed answer on the dojo mailing list, why he is choosing dojo:
Because it's an application development framework. Most of the
javascript libraries out there serve some special purpose, Ext is a
gui toolkit, Prototype is a util library, and everything else is
pretty much the same. Dojo holds a special place in the community in
that it provides a unified framework for developing applications in
javascript. What I mean by this is that it provides everything from
simple utility classes to full implementations of design patterns.
Dojo helps me organize my application layout, debug it's output, and
prepare it for distribution.

Drawbacks? The most glaring one is the horrible documentation. It's
gotten a lot better but it's still neither consistent, clear, nor
complete. The documenters are working mostly API style docs. The dojo
book reads like a brick wall. The project is badly in need of some
"Here is how to accomplish (X) style docs" Despite this the pay off is
high for those who invest the time and suffer through the exponetial
increase in 4 letter words coming from between their lips.

The widgets are a nice bonus but I gotta tell you I used it before .9
and wouldn't touch the widget system because it was heavy, slow, and
well, annoying. ( no longer an issue ) It has much to offer beyond
widgets. Take a look through the dojox directory ...

Large file sizes aren't really an issue anymore, and what's better is
that you can if you choose, optimize your builds to include only what
you want in the dojo.js file.

Oh and one last thing, a thing which I think is often overlooked. The
Dojo foundation isn't simply building a javascript library. They spur
and drive innovation in the community often developing or incubating
break through technology. This kind of behavior deserves to be
rewarded.

Sunday, November 11, 2007

First step in adapting Textmate for Erlang

I have been using Textmate for two weeks now, for all my coding needs, my productivity has increased (I know, all the real good programmers use Emacs or Vim, so I am not one of them). Today I spent some time on starting a little side project: improving Textmate Erlang integration. I have created templates with skeletons for a general Library module and also for the the following OTP behaviors:
  • application
  • gen_server
  • gen_event
  • gen_fsm
  • supervisor
  • supervisor_bridge
The module header details such as author, license, etc. can be specified via environment variables.
There is a long way to go, to create a complete Textmate bundle and reaching an Erlang integration as provided by Emacs. If anybody wants to join, you are welcome. An feel free to use the templates and adapt them to your own needs:

Download: Textmate Erlang templates

Note: if you set environment variable TM_MY_LICENSE to "MIT", then the MIT license gets included in the header as comment (more open source licenses to be added). Other custom environment variables I use: TM_MY_EMAIL and TM_MY_WEBSITE. You can set them in the preferences.

Tuesday, November 06, 2007

Mochiweb Erlang HTTP server toolkit now on googlecode

Mochiweb is a small and extensible web server written in Erlang. I have mentioned it before. Today Bob Ippolito and his team at Mochiads have started the mochiweb project on googlecode:
I already have hacked the sources a bit, just to make it better fit my needs (e.g.: adding fd_server) but the real fun begins when people start to extend it. I mean extensions which do not modify the core engine, and which can be separate projects at different repositories. Anybody interested in collaborating on OpenId, oAuth and COMET extensions ?