Showing posts with label bugzilla. Show all posts
Showing posts with label bugzilla. Show all posts

Monday, April 12, 2010

Fixing Bespin Bug 558783 - Release 0.2

Yesterday I decided to put the Java-EE and the accompanying tribulations to rest for the night and
work on OSD. I had previously spoken to jviereck about a bug involving implementing TM's SmartMove. I was able to accomplish this last night. Much to my advantage, Harjinder had just worked on bug 557135 involving implementing the indent feature, and since TM's SmartMove is basically a fancy way of saying, 'make the cursor jump over a tab where tab was pressed', he had the foundation by knowing that 'tabstop' in the JavaScript files were the default size of a tab. Combined with Skype and TeamViewer (using TeamViewer because Harjinder could not run Skype on Linux and could not run Bespin on Windows), we banded together to work on bug 558783 and successfully completed it before the sun came up. We finished our work at 3:30 am, at which point I was still at the school because my DSL modem at my apartment appears to have broken down and needs to be replaced (at probably one of the worst possible times...).

I encountered a few issues while working on the patch, but for the most part they were mistakes caused by it being a late night and having worked on other things all day. These problems included, but were not limited to:

var line = lines[range.start.end];

instead of

var line = lines[range.start.row];

or little algorithm issues such as:

if(((count * 1) * -1) >= tabstop){
count = tabstop;
count = count * -1;
}
else{
count = -1;
}

in the moveLeft function instead of

if((count * -1) >= tabstop){
count = tabstop;
count = count * -1;
}
else{
count = -1;
}

which would end up making the if statement evaluate count as a negative instead of a positive which would end up having the cursor's behaviour unpredictable and incorrect once the left cursor was pressed. A lot of the time, however, when different changes were made, it would just break the function altogether and when left was pressed, the cursor would be at a standstill.

You can find the bug page here and the source code that was required to implement this smart-move behaviour in Bespin here

Tuesday, March 30, 2010

Helping Out

So last night I was working away on C++ while talking to Harjinder and he was telling me that he was having some issues with a bug for Bespin. He said that jviereck wanted him to do the 'indent' bug, where it jumps 4 spaces to the right when tab is pressed. He was able to solve that part on his own but he wanted some help with the 'unindent' portion when you press shift + tab. I spent some time in text.js and found something in Canon/keyboard.js that could be the code for detecting whether shift was being held down. It was late so we ended early, but we'll be getting back to it shortly. I also have to do two bugs by the end of OSD and I'm pretty jam-packed with other homework...this will undoubtedly be a busy few weeks.

Sunday, February 21, 2010

Uploaded Patch For Bug # 540112

Introduction
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
Conclusion
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.

Bug 540112

I have been working on my bug for quite some time now, which seems to be, for the majority, trying different things to make it work and reviewing my JavaScript...I am a little out of practice with JavaScript at the moment as I have not done it since second semester in INT222. I missed it, it's a good language...unfortunately nothing I do to make this cursor blink is working...I will need to use an SC.Timer to make it blink but I think I'd have to pass parameters into the timer, as the function that draws the cursor has two parameters: rect, and context. I remember having to make or call a fire method, or something like it, to fire off the function in question but that would also need parameters and you can't send in parameters with the timer's action property.
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

Trying to complete my build of FireFox to work on lab

Sooo I am having a bit of trouble with my bug so I thought I would let my mind dwell deep into the caverns of JavaScript and hopefully it would come up with something while I tried to build FireFox. Unfortunately, while trying to build FireFox, after installing the SDK and hoping that it would all be good from here on out, it's telling me that my gcc that came with cygwin can not execute binary files??
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

Well, Mr Patrick Walton, who seems to be a lead developer on Bespin, gave me bug 542578 yesterday when I found out that my bug was outdated and asked him if there are any current ones available. Unfortunately, that bug was also outdated...so this morning I was talking to a Mr Julian Viereck and he gave me a tried, tested and true bug that he said he wanted to work on but he'd save it for someone just starting out with Bespin. Lucky for me, I am that fellow, and he's guided me along with finding its location. I was somewhat frustrated last night after finding out that bug after bug seems to already be resolved, but after a good night's sleep and a bug truly in need of fixing, my mood is lifted and I am feeling much better.
Thank you Mr Julian Viereck, you have made my day...

Friday, February 19, 2010

Initial Project Plan - Bug 540112

I'll be working on Bespin for Mozilla and have requested to be assigned a few bugs I found on Bugzilla. I have requested to contribute to issue 516852, about how the scrollbar cursor doesn't change to the correct cursor when it's over the custom scrollbars in the editor, and issue 521823 about how commented code doesn't display as being 'greyed-out' when the cursor is near the bottom of the file, but becomes greyed out once you move the cursor to the top of the comment block. I chose to work on these two issues because I thought it would give me an introduction to the Bespin code, give me some access to the code, and begin my understanding of the inner-workings of Bespin. Unfortunately, I was denied working on issue 521823, due to the fact that 'it's unclear to me(Kevin Dangoor) when we will bring the debugging functionality back. There are significantly more important things on our plate than that...'. That is unfortunate because I was looking forward to working on it a lot, but that will have to wait. It also appears that bug 516852 has already been resolved so that is also out of the picture. My latest and hopefully final bug for this iteration is bug number 542578. Apparently, adding new lines to the buffer causes a one pixel wide line in the color of the selection to appear on the left side of the editor view.
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!!

So I have been working on this bug for a number of hours now and was curious as to how some of the things I did was not fixing the issue. It seemed like they really should have...but then I thought I'd check something out. I went on the bespin client located at http://bespin.mozilla.com and realized that some things were much different between that one and mine. On the online version, the cursor is an I while it's in the Bespin editor, but on my local copy, it stays as the regular windows arrow. This is really the only difference I care about...the others are things like...the front page is different (mine has Italian or some foreign language on the start-up page while the Bespin one just has instructions, but I'm sure they tweaked that), and there are no buttons on the top in mine whereas there are buttons on the top in the online one. On irc, they said that the button issue and the foreign language differences were supposed to happen, but at that time I didn't think to ask whether the cursor should be an I, as I didn't realize it was supposed to be.

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.