Showing posts with label MMCR. Show all posts
Showing posts with label MMCR. Show all posts

Wednesday, March 3, 2010

OOP344: Logic problem

Part of my contribution to this first programming project was to code the section of the function that would actually let the user insert characters into a line. (Project specs here. The function I'm working on with everyone is bio_edit()). On and off during the week of the due date, I had successes, but the last hurdle stumped me. At some point in time, everything was working perfectly--it's simple logic--and then I just had to re-do someone else's code, and everything with regards to insertMode stopped working.

Someone suggested using memmove when shifting the string, but since I was (and still am) afraid to use a function I hadn't used before, I decided to stick to a for-loop. It didn't work as well as I thought. I coded it so that when inserting characters, everything from the end of the string to the current cursor position was shifted to the right, and the character typed would be inserted in the current cursor position (*curpos). However, the characters being shifted included those beyond *curpos, and any letters I typed were basically overwritten by whatever was to the left of the cursor.

I isolated this section still got the same results. My code looked like this:
Then I got it fixed with this:


Line 645 now takes into account *offset where it didn't use to (line 508 in the first screenshot). The really bad part about trying to debug this was programmer failure--I kept forgetting the fact that *curpos is related only to length of the editing field and not the str being edited. *offset + *curpos is the index of any character in str. Whenever I tried doing a walkthrough, everything made sense. At some point, I stared at my long enough to realize it. Massive failure.

Though the project has been submitted, I'm still going to attempt using memmove to reduce the number of lines. (That is, if playing Prototype doesn't get in the way, haha.)

Friday, January 22, 2010

Mystery solved

Mystery at the HQ Solved!

Two of the three new Coding Rangers have been identified in class. From first impression, one looked a lot friendlier than the other, but yours truly is trying not to be judgmental because the wind blew the wrong way on her face when she was pouting. Could've happened the same to the other dude.

Coding Styles

The Coding Rangers had their first (informal) meeting last Thursday to decide on the most basic coding styles. We agreed on most topics without trouble, like tabbing instead of spacing and placing the opening curly bracket on the same line as the condition or function that opened it. (I like Cindy Laurin's style of placing the opening moustache on the next line by itself. I think it looks neater, but I was defeated in this discussion.)

My professors have tried to sell students on their preferences. Last semester, a classmate lost marks in an assignment for using spacing. Mark Fernandes told her to use tabs. Now Fardad Soleimanloo is telling us to use spacing. (I think his argument is that the length of tabs differ between editors.) Anthony Austin wants everyone to use vi and ssh. Use ftp or telnet and you're going to find "YOU R OWN3D" in your home directory. (He's pretty darn serious. He spent 10 minutes on the topic.)

I've personally made up my mind to use vi and do 2-space tabs for programs and spaces for html.

Wednesday, January 20, 2010

Mighty Morphin' Coding Rangers

Trouble at the Coding Rangers HQ!!!

The Coding Rangers, formed on the first day of class and baptized two days later (thanks to Chris), announced that they are still looking for 2-3 members to join them.

And now 2-3 members have! The problem: yours truly have NO IDEA who these 2-3 members are. She suspects someone does, but no one is speaking up--YET.

The Coding Rangers are a group of OOP344 students who will be working together (OPEN SOURCE!) on a yet-to-be-determined project. They are an amalgamation of two pre-existing groups: Annie, Chris, and yours truly, and Dachuan and Shengwei. Strangers to each other still, they have yet to really communicate.

Stay tuned! See how this level 1 Communication Failure will be resolved (or not resolved--uh-oh!).