Vincent Lam’s Weblog

On Open Source

Our 0.2

 I think I have a pretty good idea on what we want to build/code for this project: 
our 0.1 is to makes a change to file(s) “color to colour”
our 0.2 is a directory walk that “walk” all directory and file in a folder.
our 0.3 will be to support multiple translations, instead of just “color to colour” and if we have time we will fix the “key changing problem” 

It seems like the research and practice on python has pay off decently.  Yesterday, Armen and Rueen went to my house to work on our 0.2.  Armen arrived at 10:11am and Rueen arrived at 10:42am.  We want to have it done eary because we know that we are going to be extremely busy deeper into the semister.  Reading week is our chance to get “something” done again. 

And yes, at the end of the day, we done it again.  We have “something”. our 0.1 make changes to all file in the current directory. now, our 0.2 make changes to not only the current directory but all the child and sub directory files. At first, i wanted to do it recursively just as what I did before in another course.  We had a few options:

1. reuse the code from Axel, because the code seems to have a directory walk function called zipwalk.  that would take us a few hours to understand and modify/reuse
2. use my recursive testing code in python that has not been tested. that would take a few hours to fix and modify..
3. do a search a find a simple & working directory walk code online.

Since directory walk is such a common task, I just know that they already exist somewhere.  So? why waste our time to recode the exact same thing.  Moreover, Dave encourages us to reuse existing code? Didn’t he?  ^^” It took me less than a minute to find one.  And yes, it works perfectly.  It did walk every file and folder.  But we want it to do more than just that.  We want the code to use our translation function and apply change to all DTD and Propertise file.  We made a few adjustment.  We completely rewrite some of our code, did a lot of copy and paste. 

Fixing the indentation is not fun.  Python rely on indentation so much that if the indentation is wrong the program wouldn’t work at all.  No a problem.  I just has to do a lot of copy and paste of the indentation.  Moving things around.  I know the code will work… just that the identation is a little messy. 

Now comes to think of it? There should probably be “an Automatic Indentation Fixing Tool/Function for Python” out there we could use.  If they don’t? Here come another open source project which will be greatly welcomed by all python developer 🙂


October 24, 2007 Posted by | open source | 2 Comments

re: my Watching@bugzilla begins

I have watched a few days (almost a week) but I got nothing. I must have done something wrong. I log back in Bugzilla and check my “Preferences”-> “Email Preferences”

User Watching: That looks ok….I have the name/address

Field/recipient specific options: Oh no, I forgot the check on “CCed”, silly me. Anyway, problem solved

I received 6 emails in an hour from regards a bug on Unix & Windows.

I am able to see the conversation between the person who I am watching with others. Watching is a great tools to get to know a person work and his/her involvement in the bugzilla. I just wish there is some kind of tool out there that help me filter/organizes these emails.

for example: only the messages which includes the word “locale; en-GB; en-CA; python; etc” are being forwarded to avoid information overloading.

maybe a “search mail function” that go though all the emails in the mailbox, so that only the mail with the given word will show. Oh wait, Gmail has this already.

October 18, 2007 Posted by | open source | 2 Comments

Modifying the Browser Lab (continued! done)

I restarted my adventure on this yesterday with Rueen and Vijey, and we got this to work. I will post my patch to my wiki shortly.

i had a problem with this lab. my codes are not being pick up when I complie. I have been trying to add “printf”. so that i can pin point the line that i would like to edit, but it does not work at all. I do not understand why… ? I have a few mozilla build (c:/ff/; c:/mozilla) I am sure I was editing and building the correct one but it just doesn’t work (tried with ff and mozilla). This is strange…and I ran out of idea… that’s why this lab took me a few days…

my solution to this is to rebuild it to a new directory (yes… i have 3 build now) at c:/ffm. finally, my changes worked.

now i have to make changes to the code. from my previous blog, i found loadOneTab and mTabContainer. From these, I found the appendchild function. I tested the code by copying appendchild function and repeated that a few times… I tested it with “Ctrl + T”, and a few new tab pop up. Nice.

I started my research on appendchild. I think? I should “reverse append child” or something similar.

looked up mxr (learned that from class), looked up “” (Armen was doing that last Thursday, so I figure I should give that a try) and yes, i find a bunch of functions:

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener, appendChild, dispatchEvent, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeEventListener, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS

at first, appendChild, HasChildNode, removeChild and ReplaceChild catch my attention, but insertBefore just pop my eye out (Moreover, I hear Cathy & Dave & Michael was talking about that in class on Thursday, so… it makes sense.). they has an example on how to “insert” stuff before “another” too, basically follow that and make change accordingly. 🙂

replace appendchild, figure out what to put inside insertbefore, update the counter/index/etc. relax a little then just build is done.

October 17, 2007 Posted by | open source | Leave a comment

Modifying the Browser Lab

I am working on this lab: 

I worked 5 hours on Thursday, a few hours yesterday and a few hours today (after finishing the 0.1).  I don’t want to cheat by reading the solution.  *sob* I need to some how find more time to concentrate on this lab.  This is one of the most interesting lab so far. lol~ I am not saying the other labs are boring… but you know, this lab is different.

I used MXR and I ended up in the tabbrowser file. I think I am in the right track.  I was looking at loadOneTab and I am looking at mTabContainer.  I am trying to make sense out of the container.  hmmm… maybe i should start coding/testing, instead of trying to understand it fully.  just as dave said, you are not suppose to understand it – -” just code and share ideas with your friends…….. there aren’t any one else working on this tho… people seems to be either busy with their 0.1 or their assignment/midterm *sob*

anyway @@” I will get this to work asap. please forgive me if i don’t have it done by monday *sob*  afterall, what i learn from this is more important than getting it done quickly.

btw, I hear we have to use some java script.  I am not very good at java script and I have never programed with java script before… my focuses were in c/c++, asp, c#, java, and now python. Moreover, BSD doesn’t teach java script.

So, this is my chance to understand java script better but i need time.

Is anyone working on this now? I hear a few people finished this already (2 -3 people?)

October 14, 2007 Posted by | open source | 1 Comment

my Watching@bugzilla begins

hm? I never “watch” someone on bugzilla before, but i am learning quickly. would watching someone be like spying on people?  I am watching a few people now and I will post my finding in a day or two.

October 14, 2007 Posted by | open source | Leave a comment

Our 0.1 Beta

just to recap, our project is to create an automatic build tool that uses the standard en-GB localization folder/files to generate/uses as a different type of english such as en-IN, en-CA and en-US.

Rueen, Armen and I have worked on the actual code, and we think we did made “something happened”. this “something” is working exactly as what we want it to be.

Here is how we get to the point where we are in now.

1. we study python for weeks, knowing where to get the code/function we need and learnt the basic structure.

– file IO, class, if, for, listdir, parser

2. a lot of research on which/what file/folder to use/change/work on/create

– l10n tool, testing/test/lib/ directory,, en-GB

3. we check-out the necessary code, l10n tool

3. followed with 6-7 hours coding yesterday. basically, put everything we understand into the code.

the code ended up to be exactly the same as what I have mentioned from “my idea of the 0.1

1. we have file io that read all the .dtd file

2+3. we have a function that identify the changes need to be made and do it

4. finally, we have it output in the screen/ouput as a file

for more information please visit our website or here @ bugzilla

October 13, 2007 Posted by | open source | Leave a comment

my idea of the 0.1

Rueen, Armen and I are trying to figure out what to write for our 0.1.  This is difficult because we do not have enough information.  I have been learning python, in hope of being helpful in the technical aspect of this project but so far, our team has no idea what 0.1 should be.  what would 0.1 be? would it be a file that read localization code? or would it be something else? we are not sure.

for this particular tools, i think we need the following:
1. file io that read a localization file.
2. organize the information that was read (somewhat like a parser)
3. make necessary translation
4. output/build

October 7, 2007 Posted by | open source | 3 Comments


I have been studying python for weeks.  It is not a difficult language, it just takes time to practice and testing.

here is what you need to do to learn python.

1. download python 2.5.1
2. read the tutorial
3. open “IDLE (Python GUI)”
4. Start Coding

i went thought most of the tutorial and i think i am pretty good at it now.  object, class, file io, control flow, data structure, no problem.

October 7, 2007 Posted by | open source | 2 Comments

So that’s how you apply the Patch!

Good Job Vijey! You are correct. The patch will works if you put it in the xpcom folder. Yeah!

Lesson Learned: Read about the patch (from where it comes from) before applying it.

October 1, 2007 Posted by | open source | Leave a comment