Archive for April, 2008

Final thoughts of OSD600

Phew…. The projects are done. Semester is over. Exams are finished (and good thing with the TTC strike coming up). It now time to collect my thoughts and look back about this course. Might be useful for anyone reading this and plan to take OSD soon.

The Tough Beginning

There are lots of projects to choose from. All which would be amazing to add to Mozilla. But then, the fear comes in. Like many who started this course, just the sheer size of the Mozilla codebase is enough to get people scared. Javascript is new to most people (1 week tutorial in INT222 is not enough). And the question that we all have is, how do we begin?!? But like Dave said, you just have to dive into it and start taking baby steps. We all went into the depths of unknown and just started trying, experimenting, coding, whatever!

The Hardest Assignment is the 0.1

Like I said above, the question is how to begin. And that alone is the hardest part of 0.1. Just finding where to actually hack into and start working. What functions to use and what are available. Looking and researching through the codebase like a needle in a haystack. But all the work you do in 0.1 is well worth it. When you start working on 0.2 and 0.3, you just start coding like crazy :D. This is because you already know where to work and what not to touch.

Help is around the corner

There is lots of resources to help you. MXR to search around the code. You can talk to developers on IRC. Both Chris and Dave are there too. And fellow classmates. Unfortunately for us, we all did very different projects that had very little in common.

Final Thoughts

This was a very wonderful experience for me. It is different than other courses in the way it is structured. And I worked on something that I actually WANT to do (unlike other courses where you have to do assignments whether you like it or not). I have to agree with Peter that both Chris and Dave are definitely the right teachers for this.

All right. That’s the last post for OSD. Thanks to all my fellow peers and teachers. See ya around!

Mario in Javascript

Just for fun blog post as I end the course. Here’s a nice Super Mario Bros. done in Javascript! Only 14KB and even has music! It is pretty amazing.

Hmm… maybe there will soon be a Mozilla Game Engine? Code in Javascript. XUL for GUI interfaces. SQLite for data storage. And with Canvas 3D project being worked on… Who knows 😉

Linky: http://www.nihilogic.dk/labs/mario/mario_large_music.htm

Road to Code v0.3

Here is the final version for OSD600. Only a little change from v0.2 though. Not as big as v0.1 to v0.2. Here are my highlights going to v0.3.

slideshow-gallery-v03.JPG

Hiding the current image view

This was suppose to be in v0.2 but I was going through over and over and couldn’t get it to work. I was going through each tag in the email (I think) and try to put in a inline style in it but didn’t work. But then I realized, I was like using a bazooka to fix this problem. CSS has a built-in method to do this. It is with the media. I am only hiding this from view and vice-versa hiding my stuff in print. The solution was in my CSS, which styles my stuff, to have only apply to screen which is your display. And it worked. So I just put in some styles to hide the current method of displaying images and that was that 🙂

Apply to also Message View

As Radovan suggested, was to have this work also when viewing a message by itself. I currently have it on only the 3-panel view. So I just did a overlay to messageWindow.xul in my chrome.manifest and it already works like a charm. Nice! No extra work to do 😀

Adding the Next/Prev/Pause buttons

In v0.2, I had to use menu items to use this functions (not very accessible). So I added the buttons in the slideshow gallery. I didn’t have time to actually style them and shift them into correct positions though :S but at least it is functional.

User Preferences

Currently the only user preference is the time delay in the slideshow. Default is 10 seconds and now you can set it as many seconds as you want 😀

Bugs

  • Using low seconds in the delay like 1 second will display the slideshow weird as the transitions and switch conflict.
  • I didn’t have time to make it autoload. It still has to be manually started by going to Tools>Initialize Slideshow Gallery

Where to go from here?

As stated, this is the end of OSD600. I’m not taking the next course, OSD700 as I’m graduating (yay :D). But that means the end of this extension? Nope. I actually plan to continue this extension as it is still not polished to my liking. As I did this primarly for OSD class to get it done but as I worked on it, I now thought of changes of the design. This extension was done in a whim, with little planning and more try+error and experimenting. Once more polished, I may add it to Thunderbird Add-Ons as suggested by Chris.

So nope this is not the end. I will most likely stay in touch. Like being in IRC or just more blogging.

If you like to help or contribute or anything, by all means contact me.

Here is the extension if you like to give it a try.

slideshowgalleryjosephcresencia.xpi

Late Blog Posts – Thunderbird Bug Fix Lab

When we were doing this lab in the ORI, we had some initial troubles. First for some reason, we weren’t able to compile Thunderbird in one of the machines. Strange as we used the same .mozconfig that I used to compile Thunderbird on my laptop. But pressed for time, we decided to just used my (slow) laptop.

Our initial plan was to replace the email address detection with a whole new regular expression function to detect only email address (yeah going a bit overboard). But then realize, the function is in C++. IIRC C++ doesn’t have built-in support for regular expressions. Most likely Mozilla included some form of regex in there but we didn’t really check. So we used some C++ function found on the internet to validate emails and just slapped it in. And of course, it doesn’t work. As Mozilla has support for unicode (and is specific to mozilla it seems) and the function we have was meant for ASCII and of course casting won’t help.

So using the list of invalid emails in the wiki, we noticed that the only one that failed were the ones with mutiple consecutive dots like the message example. So it was already smart enough to notice like “s@y” was not an email address. In the message example the reason why it turned to an email link was the dots after “s@y” make it seem like it had a TLD (top level domain) even though it didn’t.

So this time we actually analyzed the code. And here is what we found….

if there is an @ symbol

and after the text if not not found (which mean it is found. really hate that.) a dot (.) then it is a email.

So this why the “s@y…” is turned to an email link. It found a @ and anything after it found a dot.  Really simple way to detect an email. I guess for speed considerations since by the looks of it, (I assume) it breaks the all words in the email by spaces and check each and every word if it is a email or a web address to make it a hyperlink.

Our plan was to do the following… After finding a dot, just check if the next character right after it is dot as well. If so, then don’t convert to a link and if not, then we can assume we have a valid email.

The issue then was how to get the position. It is not as easy as ASCII where we can just put str[pos+1] == ‘.’ (as we thought it would be) as we are dealing with unicode which can be a double byte character. But time ran out for us, and class was over. So we didn’t have a chance to fully test our plan. Hopefully, we will look into it eventually.

Late Blog Posts – MXR/LXR

Well, catching up on late blog posts so you will see a bunch of them as I try to squeeze some marks in :D. This is about searching for code using MXR and LXR for Week 4.

During the progression of my extension, I had to look for code in the mozilla codebase to find like functions that will help me with my extension. I primarly used MXR. For what reason, I don’t know. In fact, I forgot the difference between MXR and LXR (if there are any?). Anyway these tools were definitely helpful because searching through hundreds if not thousand or dare to say millions of files and skimming through lines of codes to find just a snipplet of code would be painful.

How well did it go? Well, in the end I did find the functions that I needed. As well, help understand the layout through the XUL. I even spent time analysing C++ code for the fun of it. But how was it in the beginning? Painful. I went into loops. Functions just calling other functions. A path that leads you one way, that ends up as a dead end. I spent much time searching than I was coding that’s for sure. The main reason for that is that I don’t know what to search for. Luckily names are pretty obvious like getMessageBrowser(). Would be helpful if there is some big guide that tells what each object is and all their methods, what global variables are available and such. Kinda like in our lab where we had to modify adding a new tab to be placed relative to the right. We went through XUL, DTD and to the JS and finally find the actual code of the function is in some XML :S. For me, a beginner, this was pretty confusing. How I wish for something like Intellisense.