Cesar’s Vanilla Blog

White and creamy wtf

Thoughts on Javascript

In one of my courses at school, I had to do a project that involved a ton of web work. I have done enough web work before, using php/perl/asp, and I even had a course that explained a bit of javascript. After going through that, I came to the conclusion that php/asp are here to stay and perl/javascript are going to die soon enough (in fact, I was with two profs when they were talking about organizing one of the other diploma programs. They were thinking of replacing a perl course with python. AFAIK, they haven’t done it yet).

Right now, of course, I’m nose deep in javascript, and with that exposure I am beginning to think about it in a whole different way.

When I did server-side programming, I never thought of actually incorporating javascript into the application for anything else other than simple validation. That was what I was taught, do client side validation using javascript … then do it again on the server side in case they turned javascript off or something.

With such redundancy, it wasn’t even worth the effort, other than saving a call back to the server. Coming into Mozilla, I never understood the attraction to the language. It’s too simple, ugly, confusing, and just.. well, going back to the punch card. It seemed obsolete, and I wondered how far this joke of improving the language was going to last.

Then again, I was (and still am) completely ignorant about AJAX and the power of the language. The most exposure to AJAX I got pre-mozilla was when we incorporated a calendar and ajax popup into a web page. And that was so far off from client validation, that I didn’t even think of it as javascript.

With new libraries coming out like FUEL and jQuery, it seems worth it to take another look. Especially once you realized that javascript, and the Mozilla Platform has been even been used in some complex applications.

One of my favorite demos yet, and something that I was trying to reproduce is the image gallery javascript demo. I started a subproject (called photowheel), which sucks compared to the link. This started after a few people recklessly put up images using flash.


You know who you are.


Next you’ll be asking me to download Air to view your text-only document.

I don’t think javascript is perfect. Javascript heavy websites (zimbra, gmail) are pretty slow to load up. This may be for a number of different reasons, but its not pleasant to wait for your browser to respond to a new tab and take up >50% your CPU.


July 5, 2007 Posted by | Mozilla, Seneca | Leave a comment


Passively Multiplayer Online Game. That was a brown bag topic here at Mozilla, which I have rather forgotten a good portion of it. But the goal sticks; reward people for surfing the web.

The most attractive aspect of the game is that it is passive, which is rather unique. It doesn’t command, nor require your complete attention. So what’s the point?

In my day-to-day work schedule I rather view on a selected few sites. I may rarely visit more than a dozen sites. mozilla.org would be one, mozilla.com, xulplanet.com,… bugzilla, but that falls under mozilla.org… google.com,….google.ca,…. that’s about it. Far less than the dozen I estimated.

On my spare time, I visit my personal sites. I won’t outline them here, of course. I may visit a few more sites.

PMOG rewards people for exploration and exploitation. You earn points by visiting different websites, and exploit them by setting up ‘mines’ so other people lose points. You complete quests, which gives you even more points. (Is it just me, or is it starting to sound less like a passively multiplayer game?)

Once you have accumulated all these points, into the thousands, and tens of thousands, and heaven forbid the hundreds of thousands. You can have a beer, and say you waste your time surfing the internet.

PMOG is a firefox extension that tracks where you go on the web. As creepy as that initially sounds, they claim only to take the url and date/time and discarding the url afterwards. Although I wouldn’t earn many points. I don’t explore the web as much as some people do.

I took it out for a test run under a new profile, and did the drugs quest and the ‘tools of the web’-type quest. Although fun, its also very slow to load. I think the images are even pulled from the web.

One thing that is preventing me from using it, and others too, is the very nature that its tracking everywhere you go. Whether it discards the url afterwards is irrelevant (to me anyways). Although now its for targeted to people ‘like us’, I’m less than thrilled about something sending information to some foobot about where I go. Are my fears even justified? Have I no faith in these people? Everywhere I go, information can get tracked and logged.

June 25, 2007 Posted by | Mozilla, Seneca, Uncategorized | 1 Comment

pardon, je suis anglais

Paris Devday is coming, and I couldn’t be more excited and nervous. Frankly, I can’t tell which is which, I let my stomach decide. Excited to see what the conference holds, and I get to see some presentations. Nervous that I am part of it, and going to go through the first real test of my presentation skillz (or lack of it!). There are a few things I still need to take care of before I go, but that’s not what this post is about. This is a Paris preparation post.

For starters, lets figure out how to get from the Airport to the Hotel. After about an hour of searching (the Paris bus maps are really awful, so I used a combination of their maps and Google maps). I came up with this. I am looking forward to anyone from Mozilla France to proving there is a better way. But here is a way, just in case. You may want to invest in a map, or print out some pages.


This way is the bus way to get from CDG airport to the hotel. You have to walk, but it is about 2km, so not terribly far.

From the airport, find and take the ROISSYBUS and get comfortable until you hit Opera, its a 45 to 60 minute bus ride

Go east on “Boulevard des Italiens”. You should pass train tracks and in about three roads, pass “Rue du Helder”. Keep going until you hit the end of “Boulevard des Italiens”.

You’ll find it intersects “Rue de Richelieu”, “Boulevard Montmartre”, and “Boulevard Haussman” (lol, a quadsection) at the end of the road. Go down Boulevard Montmartre. You should still be going east.

You should pass the street “Rue Vivienne”, and go until you hit “Rue du Faubourg Montmarte”. You should turn left (going North now).

Turns right (east) on Rue Bergere. Here is your Hotel.

June 18, 2007 Posted by | Mozilla | 5 Comments

How to fake success

I have finally approached the point where I can sign a directory (I’m still a kilometre off from signing an extension, and a galaxy away from being done). I got manifest.mf and zigbert.sf/zigbert.rsa to be created inside a META-INF directory.

Now before a celebration can take place, I have a confession to make. I cheated.

The problem I have, and that I will continue to have is that the functions I need aren’t in a library. They are used once, and have been placed inside a C file, and designed in such a way to make it difficult for it to be reused. So one way to get at them is to take the object files and link them with my library. Which turns out is a fantastic idea, and would save me a lot of valuable time.
Or so I thought. Later I find out that the main program (signtool.c) contains global variables that are being used by the very function I need. If I call the function directly, it blows up in a humiliating stacktrace.

What else is there to do? I wasn’t even sure if I was going in the right direction with this. There was one quick.. but unpleasant.. solution. Take signtool.o, and link it in with my library.

And that’s what I did.

I now call the function main(), and pass it arguments.

This process is identical to taking nsIProcess and calling the signtool from javascript. Which would have avoided doing any XPCOM work. But fuck, where’s the fun in that?

The solution of taking signtool.o and linking it with my library was not the most desirable solution to the problem (the way I see it). However, right now I am looking for any result to keep my spirits up.

Combining all the time and energy spent so far on Notary, it begs the question of whether I am taking a complicated solution to a simple problem.

I had another problem yesterday where it was failing to find a function that I was statically linking it (an undefined reference error). After quadruple checking the function signature, I wondered if a library wasn’t being linked that was being used by the function I needed, which could have been causing it (that’s a ridiculous theory once you think about it). So I began linking libraries, until I ran out of libraries and still had my problem. I later found out that I was trying to link C/C++ object files without ‘extern “C” {}’. I was beginning to suspect that I would have to copy+paste the function to my own files just to use it (which was stupid, I’ll admit).

The solution was simple, but I think sometimes it is human nature to take the complicated approach because we see it as a complicated problem. But all complicated problems are really a series of simple problems.

June 14, 2007 Posted by | Uncategorized | 1 Comment

XUL Explorer 0.4 is out

Finally, it’s here! Well, some of the stuff has been dumped in trunk within the past weeks, but its finally wonderful that we hit 0.4 (take that sunbird!). Even more wonderful is that I am now one of the contributors, which makes me feel warm and fuzzy. My extension testing patch has been cleaned up, pimped out, and integrated.

Big thanks to Mark Finkle for helping me out, and making this all possible. I don’t think I can handle both Firebug and Notary 🙂

We’re now looking for contributors and feedback. If you try it, you can probably pick out a bug or two, or a few inconsistencies. We look forward to bug reports, enhancements, and patches.

I don’t really have much more to say other than what already has been said in Mark’s blog. Other than go try it if your interested and never touched XUL but had an interest in it.

June 13, 2007 Posted by | Seneca, Uncategorized | Leave a comment

Inching towards completion

This week has been reasonably prosperous. I patched my patch, and hopefully it will land in trunk soon. Its been reorganized, localized, and wizard..-ized.

Another big plus is that I managed to get a simple XPCOM example working, which is a big step forward into signing directories.

One thing while starting to learning XPCOM is that even something that is simple as a function that takes a string and appends “Hello” to it is long and difficult to understand. The actual appending to a string is a single line, but you need an additional 40 lines to get JavaScript to talk to C++.

June 9, 2007 Posted by | Uncategorized | Leave a comment

Uneventful week

I was going to post a long bitchy rant titled “Why people who don’t write documentation go to hell”, but it would not accomplish anything.

Summary : What I need to do isn’t documented and isn’t obvious.

I have spent a nice week, all last week, reading and experimenting. This week, I am going to finish what I started on XULExplorer. Mainly because that is what I am going to present on Dev Day June 23rd. I need to start finishing the presentation so I can practice.

Notary is going to have to take a back seat, before I get completely sick of it. It has come down to a tough decision (failure is always an option). In the meantine, if anyone knows a XPCOM function that I can call from JS that signs zipped files and/or creates the META-INF/* files I need; suggestions?

June 4, 2007 Posted by | Uncategorized | Leave a comment


Notary is a XUL application that allows extension developers to sign their extensions, although it isn’t clear how well this will work. Signing is ridiculously expensive, and to cover hundreds of extensions would easily cost many tens of thousands. But we have options.

The bare bones of the project has been put up on the wiki. But I am open to suggestions, especially from extension developers on features they want to see.

There isn’t a solid timeline, because much/all of the security XPCOM stuff is undocumented. I put up notes on the wiki about things that are not obvious. Maybe someone should start putting this all together before someone else goes through what I went through.

May 29, 2007 Posted by | Mozilla | 1 Comment

XUL Explorer Extension Testing

For those that don’t know, XUL Explorer is a (I was going to say lightweight IDE, but it really isn’t. It’s more of a tool for begineers) for creating a XUL GUI. It allows you to quickly experiment with different XUL elements (such as tabs, buttons, grids, etc). It was originally created by Mark Finkle. You can checkout his developer’s page for more information.

I have submitted a enhancement patch to Mark Finkle (a beefy 1100 lines, but I only wrote 400 of those lines. 700 lines is an RDF library that I want to get rid of, because it should be 4 lines). The purpose of the patch is to bypass the steps created in testing an extension. It should be a simple, and just allows you to experiment your stuff in firefox. I haven’t tested thunderbird, but it may work there too.

I also documented how to use Extension Testing.

May 22, 2007 Posted by | Mozilla | 1 Comment