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.

Saturday, February 13, 2010

Reference materials sort out

Since it is the last day of the year of the lunar calendar, a lot of things need to be done by this time. Assignments, my website, Greeting Call, going out and housework. Fortunately, release 0.1 is almost done and only little modify need to do. Therefore, I can relax and sort out what I have so far and get ready for release 0.2.

What I have so far

The most importance thing is a website I found when I was working on the processing.js(pjs) function text(val,x,y,w,h). The website introduces 3D text with canvas setTransform. Here is what it looks like (click to see the real example):
 
Although it is not done by pjs, it still a good start for me to implement 3d text(pjs function text(val,x,y,z)).

Second thing is remind myself there are some useful link for me to check on when I get lose.


Release 0.2 Plan (draft)

I am going to implement text(val,x,y,z), and text(val,x,y,w,h,z). However, as I said before, I may need the function called translate(). It may lead me heading to ticket #71. What is going next? I don't know, but just let it goes on. It must will be done.

Wednesday, February 10, 2010

before release 0.1 part2

In last post, I implemented text(val). Today, I was working on text(val,x1,y1,width,height).

To wrap the text, the very first thing came into my mind was TextArea. TextArea allows the text wrap automatically. If I can use get the text of each line inside the TextArea, I can use the same technique as I used in my last post. Then, I went to search how to do that. And it wasted me almost 6 hours. What I got for that is it is impossible to let TextArea return only one line of text.

When I was going to stop, I wonder why I don't take a look at the canvas instruction again. I looked at HTML 5 canvas - the basics, and search how to draw the text in canvas, and I got this page - Drawing text using a canvas. There is a method called mozMeasureText() which can actually solve the problem of my last post (why didn't I see this earlier). Anyway, I implemented text(val,x1,y1,width,height) and upgrade the text(val). Now they both look very good.

The next thing I need to do is, do my best to make the code better, and reorganize the tests.

this is the preview (see this in Firefox):

Monday, February 8, 2010

before release 0.1

I am working on text(val) of processing.js (ticket #213) this morning. The most challenge of that is it should be able to draw immediately right of the last string placed.

About how to do that, M. Lam mentions that it is possible if we draw the new text base on the length of the last string added. And I think it is good for a try.

Follow that clue, I look into the original source code of processing again.

How it work is, it calculate each char by char, and store the final offset plus the start position. When the text(val) is called, it calls text(val,x,y,z) with ending position of the last call instead.

I know how it work, but how to do it in JavaScript? Don't even need to think, I Google JavaScript font width. Then, a page call JavaScript/CSS Font Detector flash into my eyes.

How they do is, they create a span element, put the text into it and get the offsetWidth back.

Now, what I do is, I do the same thing as they do, but after I get the width back, I delete the element.

The result is good. However, there is an error. When the text is getting longer, the bigger offsetWidth than it should be is returned. Anyway, it is not perfect yet. I will come back to this after I finish the text(val,xl,yl,x2,y2).

the code is available on here.

Saturday, February 6, 2010

initialize git & detail of release 0.1

Since I have been watching the source code of text for couple days, today, I was working on setting up git on my computer. I installed msysgit on my windows, and cloned the source code from MinyXO. MinyXO's code have implemented the PMatrix3D which I think I am going to need it in the future. As I followed the tutorial (I lost the page but you will see it before you initialize), everything went smoothly until I try to upload my copy from my laptop. It needs to setup a SSH public key to before I upload, and I don't know what is that. Once again, I took a look at the tutorial, and there is a page talking about that.

After the Git has been setup, I reviewed my ticket once again. I couldn't do the 3D stuff before I clearly understand how it works on canvas. Therefore I am focusing on text(val) and text(val,xl,yl,x2,y2).

According to the ticket description and the original processing, there are some point I need to notice.
for text(val):
  • text must be placed to the immediate right of the last string placed using text()
  • doesn't need to wrap

for text(val,xl,yl,x2,y2):
  • wrap the text
  • doesn't need to display the text out of the rectangle.

It seem to be very easy butt think it will take me a while to figure out how to implement :)

Thursday, February 4, 2010

build FireFox cont

On my last post, I was building FireFox. This post is about what happened on that day and the day after.

So, I was building FireFox that night, and then, I fell asleep:) then, on the next day, when I woke up, it was done already. It didn't bring me to any problem. I think that is because I followed the Build Documentation exactly.

after that, I tried to build it again and this time it brought me some problem. There are some problem on me .mozconf file. Obviously, I wrote something wrong this time. then I changed it back, and it worked prefect again.

at that time, I have two debug build. I asked myself why not build a release. Then, I did it as I said. And it was still work perfectly.

I want some problems. What if I build it without the mozilla-build? What if I build other software? I gotta try it someday.

Tuesday, February 2, 2010

building firefox

On my today's open source class, Dave introduced us how to build the firefox. It is very exciting for me to build such a big program.

Now, I am building the firefox. My laptop is very slow when I write this post. Hope its T8300 2.4GHz cpu is strong enough to finish this before I go to bed. So far, it looks very good, and I have to say it is very easy to build the environment. Almost everything can be found on the web. and there is a very good tutorial on mozilla's website for that.
Oh, my cpu is getting hot, and now it is 83 degree. I have to stop here. Hope there will be another post later tonight.