Wednesday, February 24, 2010
Firefox - debug build
Should have just done that from the beginning...
Tomorrow will be a day of labs. I intend to do the Firefox Lab as well as the lab about fixing a bug in Thunderbird. It shall be good fun...isn't it always?? :)
Sunday, February 21, 2010
Uploaded Patch For Bug # 540112
I was able to complete my bug over the course of the weekend after a few frustrations and getting reacquainted with a language that I had not used for a good two years. It was nice to revisit it and it feels good to get that patch done and uploaded. Details about the bug can be found on my wiki.
Specifications
For my bug, I had to make the text-cursor in the editor blink when the editing area had focus, like a cursor regularly does in a text-editor. The file that I had to edit was
bespinclient/plugins/supported/editor/views/text.js
.There wasn't too much editing in regards to this patch, but I had to make a timer function which called the drawInsertionPoint function, which placed the cursor on the page, and I had to make it so it would blink...so I used a boolean that would change every time the function was called so it would either colour the cursor the same colour as the background or colour it the colour that the cursor is supposed to be (blue). I had a lot of help from Julian Viereck in finding the right file and about the file system of Bespin. When I was struggling with getting it to work, Harjinder helped me to debug it and we worked together to find what was wrong with it. He was a huge help.
What I learned
- Learned how to iterate through large pieces of code
- Learned that I should check to see if the bug is still current/test it to see if the issue is still occuring
- Memorized how to update my files using Mercurial (hg pull -u). Previously, kept forgetting that syntax
- Learned how important communication is in the open source community
- When you work together you're bound to resolve the problem quicker because each person has a different approach to the problem, more things are noticed, and different solutions are brought to the table
The cursor now blinks in Bespin and my code is up for its first review. I hope it gets accepted but either way I am looking forward to the constructive criticism.
My Idea - Prototype 1
Here is a short description of why I did what I did on this prototype:
- I used Robert's early template of what it could look like as a starting point and added buttons using Paint to come up with my product.
- DASH is an invention by Steven on his version of the prototype, which was submitted first, so I thought I'd just go with it. It could be our codename for the creation process...(Derek Anthony Steven Harjinder)
- MyFiles is where the user will go to load files that he has previously created and saved. It is in an area above their controls that they will so frequently use (play/pause, stop, reload) so sublminally they will unconsciously know where it is because they will so frequently see it out of the corner of their eyes and register in their memories without them realizing it/having to look. That's the plan anyway...
-New and Save are side by side beside the play controls, easy to access and in plain site.
-Beside Save are the tabs, that will contain the files that are opened simultaneously. The file that is on the forefront will be bolded and underlined in the tab for clarification that it is the one that is being displayed at the moment.
-I thought there could be an 'Examples' field for syntax examples and little demo programs that the user could run, if they are new or just feel like procrastinating, to get a feel for processing.js and understand what it is and how it is different than other languages if they did not already know. It could be a way to learn syntax/processing.js all from within the confines of our IDE.
-About, beside the IDE's name, is simply stating information about the IDE's developers and what it's purpose is.
-Help is more about the particular functions and buttons within the IDE
-Reference is where they could look up the list of Processing.js functions, and the search bar underneath would be where they would look up specific functions tailored to what they are looking for.
-The left panel is where the coding would go and the right panel is where the action would take place (IE the processing.js code would run after pressing the 'play' button. The left panel is transparent and you would be able to see through it, only it would have a transparency effect, as is why the fellow on the left's line is lighter blue (it is supposed to symbolize that it's being viewed through another panel).
I thought the play button could also turn into a stop button because I don't know what the difference between pause and stop would be, except maybe that stop might clear the right panel, but then reload would also do that but I guess reload would more 'reset' the right panel and keep it going, and pause could just 'freeze' it in place.
Anyway, it is just my first idea of what this prototype could look like, and there will be some definite changes in the future.
Bug 540112
What I have now is...
The cursor drawing function...
_drawInsertionPoint: function(rect, context) {
var range = this._selectedRange;
var characterRect = this.get('layoutManager').
characterRectForPosition(range.start);
context.save();
context.strokeStyle = this.get('theme').cursorStyle;
context.beginPath();
context.moveTo(characterRect.x + 0.5, characterRect.y);
context.lineTo(characterRect.x + 0.5,
characterRect.y + characterRect.height);
context.closePath();
context.stroke();
context.restore();
},
The timer function...
_cursorBlinkTimer: function() {
this._cursorBlinkTimer = SC.Timer.schedule({
target: this,
action: '_fireDrawInsertionPoint', /*Had _drawInsertionPoint but can't pass in parameters with this */
interval: 250,
repeats: true
});
},
I thought it needed some sort of other method to send in the parameters but that would need to be called using parameters in the action: property above so that couldn't work...
_fireDrawInsertionPoint: function(rect, context) {
if(this.get('isFirstResponder')) {
drawInsertionPoint(rect, context);
}
},
The place that calls the cursor drawing function...
_drawSelection: function(rect, context) {
if (this._rangeIsInsertionPoint(this._selectedRange)) {
this._drawInsertionPoint(rect, context); //Thought this had to be this._cursorBlinkTimer()
} else {
this._drawSelectionHighlight(rect, context);
}
},
So I'm in a bit of a bind and have been looking around for quite some time but am not coming up with much to go on. I even asked Yahoo Answers lol and they said the way it was coded would be tricky. A fellow on irc told me that I should look into property-observing functions of SC...for something like an isCursorVisible property...I've been looking but haven't been coming up with much and that is much different than what I have done so far but anything is acceptable as long as it works and is it good taste. Hmm. Tricky.
Saturday, February 20, 2010
Firefox Build Finally Complete
Trying to complete my build of FireFox to work on lab
To be exact...it says...
checking for gcc... cl
checking whether the C compiler (cl ) works... no
configure error: installation or configuration problem: C compiler cannot create executables.
*** Fix above errors and then restart with "make -f client.mk build"
Now...why in the world wouldn't my C compiler be working properly. It's obviously detected and it is evident that it is there...why in the world...would it...not be...working?
Frustrating.
Latest Bug 542578 Also Outdated
Thank you Mr Julian Viereck, you have made my day...
Friday, February 19, 2010
Initial Project Plan - Bug 540112
UPDATE: I just found out late last night that the bug in question...542578...is also a thing of the past and have been blessed, finally, with a bug that needs to currently needs to be fixed. This bug is bug number 540112 about how the Bespin cursor doesn't blink when it's inside the text editing area. Well, I'm going to fix that right now.
Background
Bespin is an online IDE developed by Mozilla Labs. It allows users to create and edit code, similar to Microsoft Visual Studio, from within a web-browser with no client-side installation necessary. It will allow multiple users to work on and discuss a single piece of code/program collaboratively. It is also a piece of open-source software...a very attractive option to developers everywhere.
Progress Tracking
I will be tracking this progress on my wiki. I will also post things that other developers would find important on the issue page (540112). They will be able to follow me through my wiki and through my posts on the issue pages listed above. I expect to have looked at the code for these issues by February 19th and to have issue 540112 finished by February 20th. Yes, there's not a lot of time but this bug is due the week of February 15th and according to all logic, Saturday is still a part of the week. Sometimes you run into obstacles and you just need to kick them down and run over them a few times, and that is what I plan on doing. This little setback of my original bug not really being a bug anymore will not keep me down.
Different Versions of Each Release
As stated previously, I don't have long to do it so I'm going to tackle it head on. It shouldn't be too big anyway, at least I hope not. For issue 540112, I plan on it being done for February 20th. I will then continue to work on more bugs to help out the mozilla community. I will discuss my issues with Julian Viereck for assistance and guidance with the issue. He has already been a big help in guiding me to it's general location and giving me a truly current bug.
Overall
I will be using JavaScript since that is what the majority of files in Bespin are coded in. It has been a little while since I've used it but I reviewed it while working on the last fail of a bug, so it's coming back to me. I was talking to Julian Viereck on irc about the issue and he said it was still open and needed to be resolved. I will use Google for help with syntax as well as clarify my questions about the issue with Julian Viereck. I've already experienced a few barriers, namely the bug I was working on previously and spent a good amount of time on was obsolete, but I am sure to experience new barriers as time progresses. I will be talking to people over irc and learn on my own using google to overcome barriers. We shall see how it works in the end. I think it'll be good to look around in bespin some more but understanding it all is pretty impossible since it's a massive repository.
My Bespin Bug Was Outdated!!
Unfortunately, I was just on IRC talking to pwalton and it seems that the issue has been resolved and it was outdated. http://bespin.mozilla.com uses version 0.0.4 and the recent version is 0.0.7. Joy!!!!!!!!!! That was a good use of a multitude of hours. Well, so much for that. He assigned me to another bug now...bug # 542578. So, I better get to work. I'll make another initial project plan for it since the last one is obsolete.
Joy.
I guess life is in fact winning this round.
Thursday, February 18, 2010
Bug in Bespin ... the search...
_isHighlighted: function() {
return this._isMouseOver === true
this._mouseDownScreenPoint !== null;
},
which is just the first of many similar lines but that goes to show you it's discussing whether the scrollbar is highlighted based on the mouse-event, which is pretty close to focusing on my bug, being that the custom scrollbar doesn't change when the mouse scrolls over the scrollbar. It just stays as the regular mouse cursor, and that ain't right...unfortunately my brain is pretty fried right now due to my 3 hours of sleep last night so I will have to resume it in the morning. Wish me luck, world.
Problem with bespin locally
Why? I'm not sure. I followed the instructions on the website to a tee but unfortunately that's how it goes sometimes. It is 4 am right now so unfortunately no one is on IRC to ask but I'm sure the solution is just out of reach. I shall resume my endeavours tomorrow, finally...I've been waiting for the moment to be able to work on this bug but unfortunately sometimes life likes to throw little obstacles at you...well we'll see who'll win this round 'life'.
Quite tired.
Features of Web Based Processing.js Editor
Processing.js's code is also known as sketches. There will be an area where the user can test their code out and see it in action. There will be a play button and a reload button that will give them easy access to perform these tasks. There will also be quick reference to processing.js syntax and documentation, allowing the user to search for processing.js functions to check a) if they exist, b) how they can be used and c) syntax examples.
Tonight, Harjinder, Steven, Anthony and myself collaborated and came up with a prototype located below of one of the ways that this editor could look. Under the 'Active' tab is where the proposed demonstration of the code that has been compiled using the 'play' button can be found, and Reference is where the processing.js references can be found. They can also be searched for using the search box beside it. When Reference is pressed, the processing.js references will likely be sorted in alphabetical order. We think that the below looks like a nicely designed IDE but it is just one of the ways that it could be designed, and we are still in the early stages. No matter how beautiful it looks like in the end, which it undoubtedly will, we will enjoy working on it and it will definitely be both a good experience and incredibly rewarding.
Monday, February 15, 2010
Did some testing for processing.js 0.5
Built Bespin Locally
plugins/supported/Editor/views/canvas.js
and is called from this file:
plugins/supported/Editor/views/text.js
This seems like a good place to start looking. Thank you Julian, wherever you are...
Thursday, February 11, 2010
Must get working on these bugs
Wednesday, February 3, 2010
Firefox Build
I opened up a few websites, but only really looked at one page in particular. The author seemed to explain things very well, and it was clear and easy to follow. He said he was new at building Firefox, as was I so that was a promising commonality, but the main difference is he did it on visual studio 2005 and I was running it on visual studio 2008, so I had to change a few things in the batch setup file, being the directory.
It was all good and well until we came to the .mozconfig file that we had to create. The first error was that it was saying I didn't have it set to create .mozconfig.mk automatically. After I fixed that, it was saying I didn't have MOZ_PROJECT_CO or something along those lines set to a variable, yet scanning through the files I found a MOZ_PROJECT_CO=browser line, so I do not know what it was talking about there. I went searching on the web and stumbled across this page from mozilla that had this set up for the .mozconfig file
echo '. $topsrcdir/browser/config/mozconfig' > mozconfig # let's build Firefox...
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig # ...in this directory...
echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig # ...quickly.
however that didn't work either, and had the same moz_project_co issue. I was two seconds away from asking in the firefox channel of irc and had typed out half of the message, but then on my way to pastebin to paste what was happening, I decided to try something. I made a combination of the two and ended up with this...
# Building Firefox Trunk with Debugging
. $topsrcdir/browser/config/mozconfig > mozconfig
# Put all obj files in one place, not in src tree
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-objdir >> mozconfig
ac_add_options --disable-static
ac_add_options --enable-shared
# Debug Build Setup Options
ac_add_options --disable-optimize
ac_add_options --enable-debug
# I'm using Canvas for my work
ac_add_options --enable-canvas
and voila! after a quick
make -f client.mk checkout
it began!! Success!! At least for the checkout... There were a few 'command not found's at the beginning of the build but that was something in the .mozconfig file and it seemed to have been minuscule. The line numbers of the issues were, 3, 8, and 12, and those are the lines that are blank, so of course no command is found on a blank line...
I then ran
make -f client.mk build
hoping that it would all work out, but unfortunately it did not. It said to build the installer, I would need makensis, and to build without the installer, to reconfigure using --disable-installer. It is late now, and I am tired, so I thought I would speed up the process and disable the installer. Lo and behold, it ran for a little bit longer but ... not long enough ... as a new error has been brought to the surface...an error unlike any other...and error, full of unorganized and very confusing lines.
/cygdrive/c/proj/mozilla/build/cygwin-wrapper /cygdrive/c/proj/moztools/bin/nsinstall -m 644 ../mozilla-config.h /cygdrive/c/proj/mozilla/config/nsStaticComponents.h ../dist/include
/cygdrive/c/proj/mozilla/build/cygwin-wrapper: line 75: /cygdrive/c/proj/moztools/bin/nsinstall: Permission denied
/cygdrive/c/proj/mozilla/build/cygwin-wrapper: line 75: /cygdrive/c/proj/moztools/bin/nsinstall: No error
make[4]: *** [export] Error 1
make[4]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/config'
make[3]: *** [export_tier_base] Error 2
make[3]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make[2]: *** [tier_base] Error 2
make[2]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make: *** [build] Error 2
...Yea. Sooo...I guess something is wrong with cygwin-wrapper. That, or permission is denied to nsinstall. or both...line 75 in cygwin-wrapper is simply
exec $prog $args
Prog being the first argument after exec is run, and args being what follows after that...
I guess the issue is that nsinstall's permission is denied. I looked at it in windows explorer, and it does have a little administrators icon on the icon. Time to look to irc and see what they say...
I asked irc and there is no response. It is troublesome because recently my internet is not really working at home and I am stuck at the library most of the time. The only time my internet works reliably is after midnight...other than that downloads will stop not far in and productivity is hindered. I asked some irc folks but I guess it's too late for a response? Either way, I will continue to pick away at it, at 2 in the morning, after 5 unsuccessful hours in the library...maybe if I download these mozilla build tools, things will get better.
I downloaded the build tools that are defined as a prerequisite on Mozilla's development wiki, but unfortunately, it encountered a new error...
make[1]: Leaving directory `/c/proj/mozilla'
make -C /c/proj/mozilla/firefox-objdir
make[1]: Entering directory `/c/proj/mozilla/firefox-objdir'
Makefile:45: /cygdrive/c/proj/mozilla/config/config.mk: No such file or directory
Makefile:69: /cygdrive/c/proj/mozilla/browser/build.mk: No such file or directory
Makefile:91: /cygdrive/c/proj/mozilla/config/rules.mk: No such file or directory
make[1]: *** No rule to make target `/cygdrive/c/proj/mozilla/config/rules.mk'. Stop.
make[1]: Leaving directory `/c/proj/mozilla/firefox-objdir'
make: *** [build] Error 2
No rule to make target mozilla/config/rules.mk ehh ... well, that's odd because there's a rules.mk in the mozilla/config directory, so why do you need a rule to make it?? Bah!
I tried to just build it with the command make -f client.mk as it says in mozilla's site... only adding -B at the end to make all targets...and I will hope for the best. Sleep would be nice, but I think it's a thing of the past since I have to work on some C++ which is due tomorrow and I have not been able to find the time to work on it. I haven't watched tv for so long :(. I have re-enabled the installer to be built by the way since I am taking another route and using the mozilla build tools. An installer is definitely an integral part of any application, and it should be there.
Whoa...it's been running for a good 10 minutes. I may have something here. Maybe all I ever needed was that -B...never mind. Same problem. I don't understand why it's saying it's not making rules.mk when, for one, it's already made, and two, I did set a rule to make all targets (also known as rules.mk)...
make -B -f client.mk build ???
please.
nope
make -B -k -f client.mk build?
nope
So I have decided to scrap everything and just go with what it says on the mozilla developers website. If this works, then ... good. It should, why wouldn't it...? I have just run the first step, being
hg clone http://hg.mozilla.org/mozilla-central/
but it is taking forever. It's been about a half an hour and I don't think it's even half through. I can thank my internet connection for that. I am going to bed. In the morning, I will continue with the
make -f client.mk
Anndddd I tried to run make -f client.mk but unfortunately, I do need the Windows 7 sdk. The biggest problem with that is finding a connection that'll be able to get it in less than 6 hours, since it's 2.5 gb. My connection won't do it, since the sun is up and it'll continuously drop, but I am at school now and have begun the download...only 10 hours left...then hopefully there will be some success.