Sunday, February 28, 2010

keep failing on building thunderbird

Since last Wednesday my first try on building thunderbird(blog), it keeps failing on building thunderbird, and, now, I have total no idea why that happen.

Suggestion

I talked about that with David on Thursday class. He said he didn't know exactly why this happen. There is a funny thing that my firewall detected and removed the crash testing file 485217.xsl...
Anyway, David told me some method that may help me on my build.
ac_add_options --disable-tests // ignore all the testing when it build
make -f client build >log.txt 2>&1 // this is a remind. put all the output into a file called log.txt

What I get

Basically, I use two different way to build thunderbird.

One is I build thunderbird basic on my previous failure build. It looks like it just enter the directory, nothing to be done, leave that, again and again. Finally, it said there are "No targets specified and no makefile found", then error, error, error and exit.(screen shot)(build log)

Another way is I remove everything about thunderbird, then clone the the source code again and build. And it just pause on some point (screen shot). then I close the command line, build it again, same result as my first situation.


I have no idea what is going on and just try to build it again and again. If I still cannot get it built tonight, then, I will go to ask someone inside the community tomorrow.

Thursday, February 25, 2010

build Thunderbird

Yesterday I was trying to build Thunderbird. I try more than 10 times in three different way, and all of them have failed.

At first, I google how to build Thunderbird, and I found an instruction on Mozilla. I thought I could use the same one I build Firefox, but it is wrong. It failed. It said I don't have the mail/build.mk file.

I thought, perhaps it was because I can build it on there or is something wrong on my mozilla source. Then, I cloned the source following the instruction, and built it again. However it still fail.

on the third try, I gave up the software(TortoiseHg) I used to clone the source, and used the command line from mozilla build. I cloned the source, and run the "python client.py checkout", and build it. Everything looks good. but failed agian in some where.
To here, I don't how to go the next step. I should bring the question to class since i have the test on the next day.

Monday, February 22, 2010

breaking the firefox

Since last Thursday when Dave taught us how to use ms visual studio(ms vs) to attach a process to debug, I started to want to figure how Firefox call its functions that inside the js files.

What I did last Thursday 
I attached to Firefox and went through the source code about how it handle the windows message event. However, I could only be able to work on that for three hours, and then I have to concentrate my attention on my project management course. And it keeps me busy until this after.

What I did today afternoon
At last time, I already saw some familiar windows api. Therefore, this time, I directly setup a break point at the message WM_LBUTTONUP(line 4139 of /widget/src/windows/nsWindow.cpp). What I want is try to find out where it connect to the js source code. Then I step into, step over again and again. I suddenly I lost on there. It looks like a maze. I am going to the same source code again and again. and then I realize my thought that the message WM_LBUTTONUP triggers the addTab(definition)(my previous post) directly is wrong. It is INDIRECTLY! There are many other message have been called between them. The ms vs is very slow, so that I can't go through them one by one.

To solve this problem 
I put a line 'printf("zbhuang1 Msg: %d", (int)msg);' before line 3739 of /widget/src/windows/nsWindow.cpp. By the way, when you are holding the scroll bar of debug terminal, the minefield will be pause. Ok, the build is done. I click the "open a new tab" button at the tab bar,then pause the browser, release it, pause it... try to get the message which show up when a new Tab is display.

What I get
3 Full HD 1080p screen shot, no.0, no.1, no.2.
What I wonder is the message 133 and 144, because they only display once each time. Then, I setup the break point at there like this. It turns out that actually the message 15 display the tab which doesn't make sense for me.

What I go to do next
I put a 'print("disk cache read broken!");' (copy and paste, and forgot to change. lol) into addTab. Now it is building. Hope it will tell me which windows message call it. And I need to prepare my dinner :)

Concision
Maybe what I have done so far is meaningless, but that kind of structure have seeded in my mind. There are many many questions in my mind now. Why they use such a difficult structure? How they make Mozilla cross platform? How they make the Cpp program call a js function?
There are so many questions I cannot answer by this time, but I know if I keep going I will fine the answer.

Thursday, February 18, 2010

Let Firefox listens to my order

I was breaking the source code of Firefox last night. It was assigned by Dave. All I need to do is changing the code of Firefox, and let it directs to the homepage while it opens a new tab. Since I forgot the exactly filenames of source code for how to create a new tab, I have to search their location again.

Beginning
I targeted on the navigator bar because it has the new tab button and the home button, which creates a new tab and opens the homepage. Then I went to mxr and searched the label of new tab button, "Open a new tab". follow that was searching, searching and searching.

Found the place
I don't remember how long I spent to find the right place. There are two critical files:
\browser\base\content\tabbrowser.xml line 1256
\browser\base\content\browser.js line 1720
the function addTab() inside the first file response open a new tab. the function gHomeButton.getHomePage() in the second file return the url of homepage.

What I changed
What I changed is I put two lines inside tabbrowser.xml
 
  if(!aURI)
   aURI = gHomeButton.getHomePage();

before

  var blank = !aURI || (aURI == "about:blank");

then, I built the Firefox, and it works.(actually, I built 6 times last night to reach this T_T )

Concision
It is a great experience to modify such a huge open source project. Although it is not much work to do, it still prove I have the ability, possibility and permission to do what I want to do.
BTW, I am read the post from G-Lewis and Scott Downe. They also have a very good post and they remind me I also need to enable the user to optionally set the tab to open homepage or to remain with blank page. Maybe I will try to accomplish that later.

Wednesday, February 17, 2010

pjs text() release 0.1



I am working on the ticket #213 of processing.js(pjs) this three weeks. I separated this ticket into three parts - 2D text, 3D text, dependent functions(previous post "Project plan initialization"). In this release(related to previous post "initialize git & detail of release 0.1"), I have completed the 2D text - text(val), text(val,x,y,w,h).

How it looks like now
this is the test (click to see the example):
By this moment, I have implemented almost everything about 2D text. One thing left is the processing for "\n" inside the text(val,x,y). I want to do this by substring something, but my knowledge doesn't cover that yet.

My Solution - diff(changes in line 469 and 4176)
Basically, only text(val,x,y)(line 4200) actually draw the text, and it will become text(val,x,y,z) in the next release by the way.
Every time the functions such as text(val),text(val,x,y,w,h) are called. They will do anything they need, and finally call text(val,x,y)(line 4200) to draw the text.
This is similar to the original processing source code. It reduces the difficulty for maintaining the code, and reduces the file size.
I am not satisfied with its performance because text(val,x,y,w,h) draws the text letter by letter(line 4274). I will change it as soon as I find out something like substring.


Conclusion
It is only some work for two or three days, but I spent three weeks. Anyway, as I knew nothing about JavaScript and this project three weeks ago, it is not a bad result. However, no matter what, I have to speed up in the next release.
Now I am waiting for the first review. Hope everything goes smoothly.