Category Archives: Technobabble

Jasmine in XULRunner, part 1: Started, help wanted

I’m working on my Verbosio templates repository, which is where I’m going to try (again) to build my XML templates project. The first thing I’ve been working on is getting Jasmine working with the Gecko SDK.  It’s going really well.  I’ve written some Python scripts to fetch a Gecko SDK build (in my case, Aurora builds), to concatenate JavaScripts together for Jasmine to use as specifications, and to build a XULRunner application to run the Jasmine specs.  I also have code to launch the XULRunner app with the Gecko SDK, so I can see the results. My goal is to offer the baseline as a separate, clean repository for Jasmine testing from XULRunner or XPCShell.

To get where I want to be, though, I need a little help:

  • The Gecko SDK also includes xpcshell, which means it shouldn’t be too hard to add Jasmine testing in XPCShell.  I could then do lightning-quick test runs from the command-line.  Tomas Brambora from Salsita Software’s already done some work along these lines.  I just need his code updated for this project, and MPL tri-licensed for check-in.
  • Only about 5% of the code I’m planning to write needs a XUL environment.  With tools like Firebug, ordinary HTML and “content JavaScript” is much easier to debug.  So I need to integrate downloading a Firebug XPI into my project, and I need a new Jasmine reporter which runs in the HTML and sends message events (postMessage, anyone?) to the privileged XUL Jasmine reporter.  Then I can tie the two together to do most of my work in the very well supported HTML Jasmine debugging environment.
  • (Alternatively, I could modify my project to download a Firefox Aurora build… but where’s the fun in that?  It would be quick, though.  The reason I don’t like this is Mac development becomes more painful:  Mac binaries are in .dmg images.  Installation, maintenance overhead, no thanks.  The Gecko SDK approach feels better for this.)
  • For some reason, the stack trace blocks for test failures are really thin vertically; a little CSS should fix it.
  • I could also use some code and developer usability reviews.

However, I think having a Python build script pull a prebuilt SDK and assemble my JavaScript modules for me is a winner.  It”ll save me valuable hours I’d otherwise spend building Mozilla code.  Once I get a stable development environment, I’m going to clone the repository as-is and maintain it separately for anyone who wants a pure Jasmine+XULRunner+XPCShell environment to start with.

If you can spare a few hours to bring me these last few bits, write me a comment.  I think the Mozilla community at large could really use this.

Check-out and build instructions:

hg clone verbosio-templates
cd verbosio-templates
python --update-sdk
# Wait a few minutes for it to get XULRunner; it's a one-time cost
python --test-xul
# XULRunner will open in another window, but it will block the python script from exiting.

When did SourceForge become so nice?

Many years ago, I tried being a developer on SourceForge. It was thoroughly unpleasant, and I couldn’t figure out how to do it.  Last night, I tried again, and oh, my goodness, was it nice:

  • An extremely friendly web interface for admins
  • Multiple repositories at the drop of a hat for one project
  • SSH was a breeze
  • OpenID support
  • A very simple bug tracking system

Mercurial’s ability to push from one repo to another hosted somewhere else made life a little easier, too, and the convert extension meant I could bring over the old CVS-based checkins pretty easily.

Considering the number of times I’ve had to restart, and the fact I’m still going it alone, this is almost perfect. I chose Google Code for DimensionalMap at the time because I was in a hurry. I chose Mozdev for Verbosio because it seemed like a good idea at the time. SourceForge beats both of them for me, for all of the above reasons.

I am a happy developer.

It’s been a really good week.

7 days ago, Jason Orendorff checked in a new feature to the JavaScript engine, the Map constructor.  His timing could not have been better for me, as I was just finishing up a critical part of my DimensionalMap project: getting all tests passing with WeakMaps for object keys.  (DimensionalMap is about a JavaScript-based hashtable in two or more dimensions.)  It didn’t take me long to create a “nativemap” branch and convert my code to work for keys of all types.

That alone would have been cause to celebrate.  I figure Jason’s work here shaved a couple of months off of this project.

However, thanks to Olli Pettay, Jonas Sicking, Ben Bucksch, and Dão Gottwald, among others, my patch for adding timeout support to XMLHttpRequests landed on Thursday.  DOM Workers support for timeouts will have to wait a bit longer, as I’m still a little busy and workers require special JSAPI incantations which I have not yet mastered.  Help wanted!

It feels nice to see both of these happen.  I haven’t been able to contribute much code to Mozilla lately, so anytime I can get something meaningful in, it’s a good week.

Whither Amaya?

It’s been over a year since the W3C released a new version of its Amaya prototype XHTML editor.  This is not good.  I’d go so far as to call it ++ungood.  With apologies to Daniel Glazman and the many people who’ve worked on Composer-based tools, I’ve long preferred and used Amaya when it comes to writing HTML these days.  It’s had support for MathML and SVG forever, and its UI provides a lot of power without being in the way.  Oh, and it works on Windows, Linux and Macintosh… kind of like another code base I also love…

I realize Mozilla’s probably in no position to fund Amaya development, and I don’t believe they should.  I’m posting this to call attention to this project I find extremely useful, and inspirational (for Verbosio, my XML editor project).  Maybe someone out there among the W3C members or the global software community can help out a bit.

Why I’m attending college: trying to explain my thinking

A couple months ago, I started taking classes at Chabot College.  One reason is to get the degree that shows what I’m talking about.  But there’s another reason, even more fundamental:  filling in the gaps in my own knowledge.

Case in point, I’ve been thinking long and hard about building a JavaScript-based DOM.  The problem I’m facing is that to do everything I want – shadow content, undo/redo transactions, etc. – I need a specialized data structure.  Specifically, I need a data structure much like a multi-dimensional array or hashtable.

(The first dimension would be a set of object keys – the DOM nodes.  Another dimension represents undo history, like a timeline.  A third dimension could be the shadow content.  I could define other dimensions might exist for building an individual transaction until it is completed, or otherwise creating a “workspace” for experimenting.)

About 24 hours ago, I had an idea, related to my multi-part keys for hashtables implementation.  Typically, in designing a data structure class, I think about how to give each piece of data an address first, then I implement ways to store data by that address.  The idea is to flip that approach around:  to define an API that lets the user place an object with an address, and then add new dimensions to the address space as the user needs them.

If I’m not making any sense, that’s fine.  In fact, that’s why I’m writing this blog entry.  I’m having lots of trouble articulating last night’s idea formally.  I can see it crystal-clear, and I can write JavaScript to implement it, but I don’t have the language to describe it yet in English.  I spoke briefly with my Calculus instructor tonight, to figure out what area of mathematics my idea might fall into, and he suggested linear algebra (that my idea relates to vectors in some way).  Which I can’t take a class in until I complete Math 1 and Math 2 (both are Calculus classes; I’m enrolled in Math 1).  The name of the linear algebra class, at Chabot, is Math 6.

This underlines why I’m going to college after at least six years as a professional software developer.  It’s a gap in my knowledge.

Some people, like me, enter this field with a talent built upon years and years of tinkering, of experimenting and of thinking.  The software industry can really take a person like that quite a ways.  Others enter the industry having taken computer programming courses – and that’s really hit or miss for an inexperienced person.  (No offense intended to the software engineers who started through college!)

I wonder if taking up college classes after you’ve been in the industry a while is actually the best approach of all:  continuing the education, helping clarify what you’re working on and expanding the imagination with new possibilities.

I wonder how many current software engineers have decided to go back to college after being in the field a while, to push themselves and their capabilities even further.

Welcome to my new digital home. Watch out for falling bytes.

Well, it was time.  I finally decided to launch my own web site, again.  Truth be told, I didn't even have a website all these years that I had a blog.  I didn't feel I really needed one.  Many thanks to the MozillaZine crew for hosting me all these years.

So why'd I move?  There's a few reasons:

  • I needed a home for JavaScript demos, and free blogs just don't cut it for that.  (Which is why I didn't end up at
  • I've been playing with WebGL a bit, and HTML 5 Audio.  Fifteen seconds of Ogg Vorbis audio is around 200 KB, even for just speech! When I want to do five minute shows, that's a non-starter on a free blog.
  • To be honest, I've been a bit of a cheapskate, too. The free ride had to end sometime.

I've also gone ahead and purchased HTTPS hosting. Why? Admittedly, it's overkill. But at the same time, I want you to know that the files on this site are coming from me. In particular, I want people who don't trust the Web (NoScript, anyone?) to trust me. This really is just a personal site for me, to showcase my public works of Web technology.

Yes, Verbosio, my prototype XML editor, is the main focus of those works. I'm considering moving it over here, as it never really was a good fit with MozDevGroup's aim of supporting extensions. (Mine's a full-fledged vaporware application.)

Speaking of WebGL, I've got a cheap prototype demonstration of circles in 3-D space going. Don't ask me why the circles are a little flattened. I'm hoping someone out there can tell me why. It's all leading towards a series of presentations I'm calling “Visualizing the DOM”, and the first installment's coming soon (probably in a month or less).

The college journey begins…

I’m taking college classes at Chabot College, for an Associate’s in Science degree (major: Computer Science, emphasis in Mathematics). My online classes start today. 🙂

Most people I’ve worked with were surprised when I told them I have no college education whatsoever. Oh, sure, I attended an A-School in the U.S. Navy to be a Journalist, but I don’t think that counts. I’m 33 years old, and I spent the last decade building up my resume. Now, it’s time.

Chabot recommends a person working full-time take no more than 6 units per semester. I’m starting with Real Estate Principles (3 units) and Sports Officiating (2 units) for the summer, then Math 1 (Calculus, 5 units) and Volleyball Beginners (1 unit) in the fall. If I think I can handle more, I’ll take more. If I think it’s too much, I’ll take less.

I put this off for a long, long time. I remember an incident shortly after my book was published in 2002: I was attending the OSCON, to promote the book. An employee of talked to me and said he wanted to hire me. I was more than willing. Then via e-mail he saw my resume had no degree on it, and he said he could not hire me. I’ve always remembered that, with sadness and a hint of bitterness. I was qualified to do the work then (at least, I thought so), and I would have enjoyed it. Alas, it was not to be. One of the reasons I’m going to college is to correct that hole in my resume, to show that I know what the hell I’m doing.

What’s this mean for my other projects? Well, work still takes first priority, even over college. But my pet projects like Verbosio (the prototype extensible XML editor) are probably going to be back-burnered again.

I’m not sure what I can do about Venkman. I’ve had five different people write me on my blog expressing interest in working on my proposed rewrite, and I think that’s great. I’d still be willing to mentor, but it needs a leader who’s willing to get his or her hands dirty and dive in. Last time I cited a need for dockable XUL panels. We need someone to step up, to create visual “mocks” of how they perceive this. Then we need to write some code.

Finally, I know I haven’t been very active in the Mozilla community lately. College means I’ll be even less active, and that does make me sad. I wish my own pet project was ready for others to play in, but it’s not. I wish I had the time to contribute to ongoing DOM Core or developer tools work, but I don’t.

I’ve said it before, and I’ll say it again: this community and platform has given me a career, and I am eternally grateful for that. If I ever do work for Mozilla, maybe my business card should say “Lizard bridge builder” or something like that. Because you guys have built bridges for me, so far, and I’m not giving up yet.

Make: It isn’t just for files

This weekend, I took a special break and headed over to the Maker Faire at the San Mateo County Event Center. In some ways, it was both entertaining and shocking (in a good way).

Highlights for me:

  • Meeting David Brin and getting his autograph on “Foundation’s Triumph”
  • Mike Rowe and Adam Savage taking questions (that they’ve probably answered a couple hundred times already)
  • Another musical artist, with the “Slaperoo” (warning: site plays sound right away on load)
  • The incredible amount and quality of stuff being built by hobbyists these days
  • A little story about who exactly made the Apollo space suits (it’s not who you might think!). (The site is down right now.)
  • Eepybird. Nuff said, except that they’ve switched to Coke Zero.
  • The large variety of very cool tee-shirts. I’ll be ordering another one very soon, based on a card I picked up earlier today.

About the only thing missing is an appearance by the Blue Man Group, in my opinion. They would’ve found some neat instruments to add to their collection. Oh, yeah, they’re coming to San Francisco, starting Tuesday. 🙂 I’d love to have some fellow Mozillians join me for that one. Anyone interested, we’ll do a get-together and buy some group tickets.

db48x, aka Daniel Brooks, joins APN

Just a quick note from my Batcave: I’ve got a new coworker, a fellow Mozillian. His name is Daniel Brooks, and he’s just moved to the SF Bay Area. He doesn’t have a Planet Mozilla blog, so I decided to announce it for him. 🙂

I’ll have to convince him to talk about some of what he’s done for the Mozilla community. It’s a pretty long list.

Gonzo programming (or “Fear and loathing in JavaScript”)

A few months ago, I took my ideas about DOM bindings and aggregation by proxy (I really should’ve called that “mix-in by proxy”), and started writing something… a little wild. A little out there. Of course, it’s not finished yet – very few great things in software ever are – so I still don’t have anything to show for it. (I will, though… I’m planning on posting a FF add-on demonstrating my work here, in miniature.)

In any case, with what FF4 betas gave me earlier, I kept thinking of where this was all going, and I realized the best way to say it was to “borrow” the words of Hunter S. Thompson:

“I had two bags of hash… sixty four bits of desktop machine… five sheets of high-powered design notes… a saltshaker half full of membrane… and a whole galaxy of multipurpose strings, numbers, booleans, functions… Also, a quart of tests, a quart of make, a case of select, a pint of raw pointers, and two dozen cookies. Fig newtons. Not that I needed it all for the hack, but once you get hold of a serious tool collection, the tendency is to push it as far as you can.

And yes, I do need somebody to love… (warning: NSFW @ 1:50)

Continue reading Gonzo programming (or “Fear and loathing in JavaScript”)