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