Monday, December 15, 2008

One more step!

Progress is being made on Portable Canvas!!

I'm starting to mark my progress heavily, in comparison to before. It may be too little and too late, but the habit will likely help in future projects.

On the Windows side of things, 0.3 is almost done! I've restricted browsing to c3dl.org as before, but I've also enabled local files to be opened. At the moment, you can type in a local file path to an html file with the proper JavaScript, and it'll load the 3d Canvas element properly! The last step is to shift this from text box to GUI; otherwise, this wouldn't be a quality release worthy of the title "final project of the term".

On the Mac side, I have the application running. The trouble is, I don't have the Mac equivalent of Canvas 3d's dll file, so the program can't load the Canvas elements properly. This should just take 10 minutes of coordination with a Mac user on the c3dl project.

Combining the two sides should be simple. The project-specific code is all in jar files, and should be cross platform by nature; the interface work on the Windows side should carry over nicely to the Mac side. I'll be posting two separate downloads to simplify my work; one for each platform. In theory, I may be able to combine the two for a later release...

Wednesday, December 10, 2008

Found and lost

As I scramble away in the middle of exam week, I feel the need for good documentation the first time through a project, even if you fully (and truly) understand the methods used. Memory will fail, and this fact will likely come back to bite you. T.T

In phase 3 of the Portable Canvas project, I had resolved to get the program working on Macs as well as Windows. Now, I'm stuck trying to figure out how to build on said Mac, because I mentioned that I "compiled" MyBrowser for Windows back in phase 1. Does it mean I really compiled it, like I'd compile Firefox with Mozbuild? Does it mean it isn't really compiled, just a bunch of JS files that call XUL functions? I can't even remember the search terms I used to find the XUL documentation anymore.

Alas, agony is the seed of wisdom. If I survive this, good things will come. ^^;;

On the bright side, I've got Canvas 3D examples running on my local machine now... =D

Tuesday, December 2, 2008

Back to Episode One

The final stretch of DPS 909 rolls in, but the work hasn't gotten any easier. I've learned so much, yet it seems I'll never run out of stuff to learn. This is both good and bad.

There was the comment on my v0.2 Portable Canvas; it doesn't work on Mac. The solution seems simple enough; compile it on Mac, just like I did on Windows. But, after all the trials and tribulations that came *after* the simple compile the first time around, I've forgotten how to build the thing! It's like starting 0.1 all over again, and that took a while...

The next major obstacle is the new feature I've set for myself (with Cathy's approval). I want Portable Canvas to be able to load a local file. Such a simple goal represents a mountain of dirt to dredge through...

For one, there's no such thing as a Canvas 3d file. C3d creates objects by modifying data within a canvas element tag, so the state of the tag is constantly changing. The complexity is enormous, never mind the fact that I haven't created a working example online yet.

Next up is the modification of code. I've never written a serious JavaScript application in my life, and now I'll have to write one that dynamically creates local content. Tom Aratyn was kind enough to perform a guest lecture on JS; it'll be a big help for sure, though I still feel a little under-prepared.

The word of the day is "worry", because there'll be plenty of it. ^^;;

Tuesday, November 4, 2008

Mozilla in Cahoots with Ghostbusters?

Along my journeys across Mozilla code, I couldn't help but notice this line:
var t = document.createElementNS
("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "tab");
The thing that stood out most was the strange, but almost deliberate, folder structure of the XUL include file.

The keymaster and gatekeeper were key characters (no pun intended) of a niche movie called "Ghostbusters" which appeared in the early 80's. The gatekeeper of that story also happens to go by the name of Zuul (pronounced XUL).

On top of that, Mozilla's JavaScript debugger (or de-ghoster?) shares its name with Peter Venkman, one of the lead Ghostbusters.

One must wonder if there's a connection...

Sunday, October 19, 2008

Released into the wild

Open source development has been a roller coaster ride in the most extreme sense.

It's been like trying to climb a vertical wall, and facing a challenge that just doesn't seem possible. Moments of "EUREKA!! I'VE GOT IT!!!!" are proceeded almost immediately with "Wait, that's not what I'm supposed to do at all...", and followed soon by "Yet another dragon to slay. *sigh*".

It's not like other courses, where intuition nets me a B+ and can finish assignments in a midnight rush. Here, my intuition leads me into confusion and circular mazes. I used to be able to think up contingency plans effortlessly until the problems get solved; with Open Source, none of these plans work out in the end... ever. It's like being Superman, but without the power of the yellow sun.

Here's how yesterday started:

I thought I had achieved a peak of pure genius when I changed MyBrowser's application.ini file to recognize Gecko 1.9 (which C3d needs). Sadly, it refused to install the extension through addons.mozilla.org. So, I default to using a Minefield build, which installed C3d just fine, but it didn't carry the extension when rar'd and sent to another computer.

At the brink of despair, I plodded back into #seneca, where I was greeted with welcome arms and a new strategy. Instead of hacking Firefox to store everything locally, I could just run "make profile" to do almost the same thing. Extensions became simple to include, too. I suppose I had wandered alone long enough to earn the one answer I needed to finally achieve the goal.

Then, mfinkle pops in and tells me I can still do what I need to do, but through MyBrowser instead. After several loops through editing rdf's and ini's, I am now back to coercing MyBrowser to use the C3d extension...

Here's the details on the mixed adventure, rephrased so I sound like I almost know what I'm doing.

Thursday, October 16, 2008

XULRunner progress

I look at the clock and groan.

Tweaking application.ini for MyBrowser lets me run it for Gecko 1.9 (the same platform that Canvas 3d is limited to), but it still won't let me install the C3D extension for it.

I decided that it'd be easier to start with Firefox and remove unnecessary features, than try to improve on Smedberg's MyBrowser. For one, Firefox has documentation...

I now have a Minefield build that can render a 3d context. Yay! But, as Jesse has pointed out, I can't just zip the bin folder and send it to someone; the homepage settings and installed extensions for it seem to be buried somewhere else in my computer. It's like ripping a heart out and expecting it to work without the veins.

I am now delving through source code, looking for places where FF stores data in "Documents and Settings" so that I can tell it to store data in the same location as the executable. Finding these places is one nightmare, figuring out how to change it is salt in the wound. Despite that, I plod onwards; there are people awaiting the results.

Sunday, October 5, 2008

A first look at XULRunner

I spent the weekend figuring out how to make extensions in Firefox. The goal is to figure out what's needed to port Canvas3D into XULRunner. It was supposed to be a straightforward operation, but reality is rarely kind. The ride went like this:
  1. Get recipe.
  2. Execute recipe.
  3. Taste the cake.
  4. The cake explodes.
  5. Look for another recipe...
One example? I download the XULRunner SDK, and it seems the SDK is more for building XULR rather than building extensions for XULR. (I could be wrong.) Another? The sample extension didn't appear like they promised, until I added a second test extension. Of course, the features overwrote each other.


So far, this guide has been the most helpful for getting something up and running to work with:
http://developer.mozilla.org/en/Building_an_Extension

At the end of the day, I've learned how to make a simple extension. Woo! Also, I've got a working version of Canvas3D 0.2 running on my main Firefox3, and it's looking good. Downloading the C3D extension wasn't quite the nightmare I was taught to fear.


Next on the todo list:
  • figure out what files are installed by Canvas3D
  • update my C3D Library 0.2 to the 0.5 version
  • build an extension that works on a portable XULRunner package
It seems running things in XULR will be a whole 'nother beast...

Tuesday, September 23, 2008

Dredging through The Source

The lab today is to pick a feature of Firefox's UI, and find the source code snippet that controls its behaviour. We were given a list of features to choose from, or we could pick our own.

The feature that bugs me most is that the back button in FF3 no longer has a dropdown option, like it did in FF2. The forward button has the drop-down, so I suspect the functionality is buried in there somewhere. I start my search by looking for the string "back button"...

I ended up finding several entries, listed here. NS_THEME_TOOLBAR_DUAL_BUTTON is defined as a macro for buttons that trigger drop-downs, like the back button used to.

At this point, I recall that Firefox offers theme customization. Within minutes of searching, I've found themes for FF3 that offer drop-down support for the back button. From this, I would assume that the back button must be called by the theme in order to appear...


From this, I learned that the back button's drop-down menu should be configured by editing the UI theme. It had nothing to do with the source code directly. However, I've definitely learned how to find out where such features of Firefox might be configured, and future searches will be much faster.

It was an awesome lab that quickly introduced a wide range of skills which are essential for working with Firefox, or any other large project.

Sunday, September 21, 2008

Minefield build!

Building Firefox was... not as mysterious as I had first expected.

I always knew FF was open source, and that the source code was out there somewhere. It would require a strange compiler setup and more symbolic links than pebbles at a beach. Since writing large amounts of source code was always an ordeal and linkers have rendered some projects dead for me, compiling browsers fits into the "arcane magic" category.

I was quite pleased to find that the compiler configuration was well-documented and largely automated. I also discovered the true advantages of utilities like "make".


The one quirk I ran into was this:
$ make -f client.mk build
If you follow the online documentation exactly, they will ask you to run this code. For me, it failed to start compiling. They didn't even suggest that there'd be other options, like running "make" without any arguments.

If my computer's specific configuration is an exception, I could understand. I suspect that other Windows users may run into similar problems. I'm curious to see if this command failed for anyone else.

It feels like the documentation is too fragmented. They'll link to several different setup processes for different OS's, and expect all of them to work exactly the same. "One size fits all" code (like that "make -f client.mk build") is just too good to be true, but the documentation buys into it anyways.


Full details on my adventure can be found here.

Special thanks to Zghansar, who made my experience magically easy.

Friday, September 12, 2008

One Crazy Ride

The object of this lab was to complete a task that none of use knew how to do; in short, to do the previously impossible. The specific example was writing commands for Ubiquity. You can find the lab here:

http://zenit.senecac.on.ca/wiki/index.php/Learning_Collaborative_Development_Lab_Fall_2008

Instead of writing one of the four suggested commands like everyone else, I dug around to see what the community was looking for. I found it: the URL noun.

They have a prototype for the URL noun (at bottom of this page), but it was missing a couple items. It would've been awesome if it could hook into awesomebar's data resources asynchronously, but async data transfer isn't simple enough for a novice to complete over a week.

Instead, I chose to improve on the regexp by allowing other protocols (instead of just http, https, and ftp), and adding syntax for subfolders. Here's my current work:



var noun_type_url = {
_name: "Valid URL",

suggest: function( text, html ) {
if (!text)
return [ CmdUtils.makeSugg("http://") ];


if(/^[A-Za-z0-9]+:\/\/([A-Za-z0-9_-]+)(\.([A-Za-z0-9_-]+))*(\/([A-Za-z0-9_-~#=]*))*(\/[A-Za-z0-9_]*\.[A-Za-z0-9_]+)?$/.test(text)){
return [ CmdUtils.makeSugg("valid! " + text) ];
}

else if(/^([A-Za-z0-9_-]+)(\.([A-Za-z0-9_-]+))*(\/([A-Za-z0-9_-~#=]*))*(\/[A-Za-z0-9_]*\.[A-Za-z0-9_]+)?$/.test(text)){
return [ CmdUtils.makeSugg("valid! " + "http://" + text) ];
}

return [ CmdUtils.makeSugg("What are you thinking. :V") ];
}
};

CmdUtils.CreateCommand({
name: "url",
takes: {"your shout": noun_type_url},
preview: function( pblock, theShout ) {
pblock.innerHTML = "Will verify: " + theShout.text;
},
execute: function( theShout ) {
var msg = theShout.text;
displayMessage( msg );
}
})



jono from #ubiquity on irc.mozilla.org was very helpful in this learning process. From the first few minutes of chat, I found out that I wasn't working alone on this noun type and that there are coders willing to review my work.

There's just a little more polish I can put into this code before considering my limits reached. Asynchronous data calls seems to deal with the Ubiquity source code, and compiling is a task for next week!

Wednesday, September 3, 2008

The Cathedral Crumbles

My inspiration in coding came from cathedrals.

Not literally.

I grew up alongside the early video game consoles and their 16-bit glory. The games were elegant and brilliantly built, much like the Notre Dame. Their almost infinite depth could be realized if you spent just a little time to look closer, and there was always something new to discover.

At that point my life's goal was to build the biggest and prettiest cathedral I could and see how many people I could impress. It was an innocent wish.





I stepped into this course, DPS 909, with the hope that I would figure out what this "Open Source" business was by the time I finished. After reading Eric Raymond's "The Cathedral and the Bazaar", I think I've gotten a solid idea of what "Open Source" means before the second class of the semester; much sooner than I had expected. The paper can be found here:

http://www.firstmonday.org/issues/issue3_3/raymond/

Traditional proprietary software is likened to a cathedral, where the masses it is designed to serve are kept ignorant until the grand opening. When it does open, the audience is awed and amazed at all the work and beauty thrust upon them. The architects hope dearly that the users don't notice any of the major flaws, lest they be chased out of the country.

Open source software is likened to a bazaar where the users influence most of its existence, from available products to daily price changes. No regular customers are surprised when they stop to shop; the bazaar just works. Whatever didn't work was cut out countless versions ago by the demands of the masses.

Rather than sit and wait for your users to (hopefully) enjoy the software upon a big release, Raymond suggests that the users be actively involved in evolving the software. It's an efficient way to gather a large pool of genius without high organization overhead. It is also efficient for ensuring that your software's scope will please the target.

The most modern example of a bazaar is alluded to near the end, when Raymond mentions a revolutionary leap by the Netscape company. Netscape takes a big gamble by releasing their source code, an unprecedented action for such a large player in the industry, in hopes of continuing competition against a free Internet Explorer. Sadly, the paper (and the Revolutionary OS video) stops there and leaves us hanging on the results. It didn't take long for me to realize that this was the seed from which Firefox would emerge and dominate the market.





The fact that this Bazaar model has produced a strong competing operating system (Linux) and one of the most popular browsers on the planet (Firefox) is enough to convince me that the Bazaar model really has something to offer. It will be taken into serious consideration as I contemplate the path of my future career.

If I ever achieve that life goal of mine, I will definitely share my source code; but perhaps only a header file or two.

First post!!

Hello all!!

Here marks the beginning of a blog which will be very active for the next 4 months.

As a student of the DPS 909 course at Seneca College, I've been tossed head-first into the open source community. Who knows, I might actually land on my feet and enjoy my stay there.