Tag Archive for 'Javascript'

Let’s meet at JSConf in November!

I’m very happy to announce that my beloved open source project is announced over at JSConf EU as an Advanced Silver Sponsor!

Additionally, Ruben Daniels and I will be presenting about the new APF version and the insane stuff you can build with it:

Title: Building collaborative applications with Ajax.org Platform
Abstract/ About: Web trends and technologies today are converging to do one thing particularly well: collaborate.
All of us dream about the possibility to weave collaborative features from products like Google Wave, EtherPad, SubEthaEdit, Mozilla Bespin, Google Docs into our own applications.
Ajax.org Platform combines technology and open standards into a solution to build web applications with rich collaborative features at minimum expense.
The simple-yet-elegant, declarative API makes it easier to learn, while its openness in design allows it to be extended to the level you and your team are comfortable with.
Forget lock-in of vendors and other libraries or frameworks, forget waiting for the Big Boys to open source their latest inventions.
Start building your next - or first - collaborative web application today, visit ajax.org.

I’m really looking forward to meet all of the cool people that will be attending the very first JSConf in Europe!
The ones who are lucky enough to have obtained a ticket can really call themselves the avant-garde of the Javascript community ;)

I hope to see you there!

Did you know that JS can be weird sometimes?

Of course you did, otherwise you wouldn’t read this! Anyway, I found this little easter egg in Javascript land:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function test(){
    var privateVar = 10;
    function tryXs(){
        if (false) {
            var privateVar = 5;
        }
        alert(privateVar);
    }
    this.callme = function(){
        tryXs.call(this);
    }
}
 
var oTest = new test();
oTest.callme();

Now what do you think what will the alert() show us? UNDEFINED! Now why would that be???
Well, apparently the ‘var’ in

1
2
3
if (false) {
    var privateVar = 5;
}

screws things up for us; even though the if-statement is evaluated to FALSE at all times, thus never executing the statement body (’var privateVar = 5′). Reasonably, you’d expect the alert dialog to display the value ‘10′, but apparently it still parses the body of the if-statement and pulls a string of the variable scoping rules.
Want to hear something even more weird? It’s consistent behavior! This occurs in all major browsers (I tested IE 6, FF 3.0.1, Opera 9.51 and Safari 3.1.2) and the alert shows ‘10′ when you remove the ‘var’ from ‘var privateVar = 5′. That actually makes sense again!

I’m quite interested to see and hear if anyone can give me an explanation for this behavior, because I probably lack the skill(s) to see any practical use in this ‘feature’ ;).
Does anyone else know a weird Javascript nugget like this?

Fun with Ubiquity

Today I came across the most interesting announcement from Mozilla’s Aza Raskin: Ubiquity 0.1 alpha is out. That means I have a new toy to play with!

Ubiquity is an add-on for the Firefox browser that enables the user to interact with content like never before; contextual fragments of a webpage can be translated, sent by email, looked up with Google Maps, searched with by wikipedia, youtube, flickr and so much more. I suggest you watch the video!

As with every other new toy, I started playing with it right away and I immediately fell in love with the ‘email’ command. I could simply select some text, do ALT+SPACE, type ‘email this to ruben’, hit ENTER and go! It automatically fires up GMail, sets subject, to-address, body text and the only thing left to do is press ‘Send’.
Problem: I do like GMail, but I use it only for emergencies. When ALL my other mailboxes are unavailable, which happens, like…never. So I rolled my own little Ubiquity command called ‘mail’ that does the exact same thing as ‘email’, but uses the standard ‘mailto:’ interface to access your desktop email client.
Problem: it doesn’t support HTML mail, thus no fancy content like images and hyperlinks. I guess I could add a couple of regular expressions that parse the body text for links and replaces images with BBCode-like placeholders - [img src=http://path.to/image.jpg]. I’ll do that upon request, ok?

This is only a very simple, first tryout of what I could do with this Ubiquity alpha. There’s probably more to come, so check up on me regularly when you’re interested.

Enjoy!