Search

воскресенье, 25 сентября 2011 г.

Edit Function 3 - Finale

*14:00*
I will try to finish it today. I need to make and test those changes:
- Offset setting. 90% (Double check and testing)
- Cursor setting 90%  (Double check and testing)
- Cursor moving 90% (Double check and testing)
- Too many characters 40% (Writing and testing)
This shouldn't take too much time, but I'm pretty sure I'll miss something important and it won't be finished completely, but I tried at least. I also found that bag from backspace case I was talking about last time, so i need to fix it as well.

*15:00*
Everything so working.. except the INSERT part. I need to code it based to the conditions I have... That might take a while...

*16:40*
Aaaannnnddd.... Yes. I think it's done. I mean, I'm pretty sure, there are at least A Lot of thing I didn't test for, and somehow missed while reading the conditions for a few times, but it looks good, I didn't find any bugs and it at least meats Most of the conditions. So yeah... fingers crossed.

*16:47*
Nope! Wait. One last this.
- The user terminates editing cases. 0%
So, I'm going to Save everything into temp variables and then put everything back.

*17:15*
Ok, if the way I do it is the right way, I'm going die of laugh. On one hand it's logical - make separate cases for separate keys, but having same 4 lines in each and every case makes me giggle. I guess it will change in the future but I still have my doubts.
Any way... Fingers crossed... Again.

суббота, 24 сентября 2011 г.

Edit Function 2

*13:40*
Ok, so, where was I last time?
1. Fix DEL case. - 99%
2. Write BACKSPACE case.  - 80% (Needs testing + 1 or 2 small fixes)
3. Fix LEFT case. - 90% (Needs testing)
4. Write RIGHT case. - 99%
5. Write HOME and END cases. - 5%
6.
Work on INSERT mode. - 0%
Yep... Nothing major. Let's start.

*13:55*
Ok, one down, few to go.
BACKSPACE case. - 99%
Ok, so now... I had a problem with the display function... Or my Left function, but I think there is a problem with option "if fieldLen is less then a sting length". But this needs further investigation.

*14:00*
Boom! I'm Smoking today! Probably doing it in the least efficient way possible... But I don't know the other ways, OR not in position to rebuild it (Maybe after I'm done with the Edit function). So yeah... 
Fix LEFT case. - 99%
Ok, now the Home and End cases again... I think at least, even though I totally told the same last time.

*14:10*
Ok there is something wrong... I'll the other way - I'm gonna test every function one by one, removing all the others. The problem is that I'm not sure is the bugs I get are display problems, or Left Right problems... Also, as a last way out I will consider downloading the original code and staring from the beginning, even though I don't wont to do that at all.
 So, even though my print shows that Offset is 0, I stand on "F" and can't move further (what a brilliant metaphor...). I can only assume that this is a Display bug. I'll see what I can do with that...

*14:20*
A few tests later I decided that I will try to recode the display function. This will take some time, but if it will work, it might save me...

*15:00*
I rewrote the display function. And so far everything works fine I hope that it Stays that way. It looks like I'm back on the right track. It might be a mistake, somehow, but I did some progress:
DEL case. - 99%
BACKSPACE case.  - 99% 
LEFT case. - 99% (Needs testing)
RIGHT case. - 99%
HOME and END cases. - 99%
So now the tricky part - Writing case. I need to re-read the info again, and I think I have a good chance of finishing this part and the entire task today.  


*15:45*
YES! I'm Done! Everything Works! There is only one problem - ONCE, Somehow, I managed to bug out the BACKSPACE case (it went deleting all the way into the null), but I couldn't repeat this so I guess it will do. There is also a thing about the string itself- if you write something to re-write this "0" (teacher put it to cover second part of the string) the string shows fully, and I'm not sure if that's the way it's supposed to be.
But hey! I'm done! Yaaaayyyyy!!!

*15:50*
Oh... I forgot that there are additional conditions - offset, length something else... Ehh... And that's what I hate about this profession. But anyway, that might take some time, but I'll be done today.

*16:40*
Ehh... I just spend A Lot of time doing the most basic stuff...  I'll finish it tomorrow, or today at night, I just can't do anything for some time. So, so far, I'm done.

четверг, 22 сентября 2011 г.

Edit Function 1

Ok, so, the Edit function, I have enough information to complete it... Unless I get into some kind of small problem as I did in the display function.
Thing I need to do, possibly today:
1. Fix DEL case.
2. Write BACKSPACE case. 
3. Fix LEFT case.
4. Write RIGHT case.
5. Write HOME and END cases.
6. Work on INSERT mode.

*20:10*
Ok, I just finished fixing DEL case. That was easy - basically one line of code. It's not that hard, once you realize that you need to put a NULL in the right place. Then, the will appear a problem… Ok, not a problem, but a bag – if you push Delete continuously, eventually you will pass the cursor and keep deleting, even though I need it to Stop once it reaches the cursor. This bag was solved in about half an hour, I just needed to experiment a little.
Also, a Good line of code for testing, just put it in Left/Right cases:


display("Cursor"/"Set   ", 20, 0);       
//Displays the way you are moving (cursor or offset)
std::cout<<"                       "<<*curPosition<<"  "<<fieldLength; 
//Displays values you need for testing, can only be use with values that are passed to the Edit function and values in this function


I know there is a better debuggers out there, especially considering the fact that I use Visual Studio, but I’m not doing something too large or difficult to compile, so I’m using those lines, just because I feel more comfortable with them. 
Now I'll start working on a BACKSPACE case...  

*21:20*
Heh, documenting everything takes A Lot of Time.
 So, where was I? Oh yes, BACKSPACE. This is not that hard, the basic thing you need to understand while writing it – backspace is LEFT and DEL cases combined.

*21:40*
Well that was easy… Left and Right commands can be tricky, but it took me about half an hour to make them work the way they are supposed to. Now I just going to make the easiest (I think) ones – HOME and END. Let’s see what I can do.

*21:50*
That wasn’t that easy, but I also found out about a few more bags in the Left function. That might take some time, but that’s why I love this subject so much…

*22:22*
It took a while, but I got rid of one more bag – I tried to make it move a bit further if you hit left and if cursor  position is 0, and apparently without proper If statements it just went TOO far into space… I mean… String.
Ok, I need to wake up tomorrow around 8 am, I guess I’m done for today.

Solved Design

So, it took me a few hours, but I found out what the problem was. And obviously it wasn't compiler's fault.
Basically the error was:
 error LNK2019: unresolved external symbol "public: void __thiscall cio::Console::display(char const *,int,int,int)" (?display@Console@cio@@QAEXPBDHHH@Z)
And the code I wrote was:
void display (const char* str, int row, int col, int fieldLen) 
  After a few hours of looking at the screen I realized what a stupid mistake I made. The right line of the code was supposed to be:
  void Console::display (const char* str, int row, int col, int fieldLen) 
 Now this seems obvious but I spend A Lot of time on this bag, just looking in the wrong direction.
The rest wasn't that hard. I had tree situations:
1.  If fieldLen is 0 or less.
 Just one cout and everything works.

2.  If fieldLen more then sting length.
Make another string, and fill it with spaces and print after the str sting. (I'm also thinking about doing another version of it without creating another string of spaces)
3.  If fieldLen less then sting length.
Make another string, and copy str to it. And the Cut it with Null value, and print it.
I might also take some time and think about other ways  of writing it.

суббота, 17 сентября 2011 г.

Assignment Start

 *14:10*
Ok, so it's Sunday, weather is no the best I've seen, but I don't care since it pretty warm inside and I can start working in the first assignment in this Semester. Coke - here, snacks - here, music - playing. Goals for today:
- Download Console Files
- Double check the requirements
- Write the Display Function
- Check the Display Function
- Submit
- Do the other homeworks/labs so I can rest tomorrow
So, let's start...

*14:55*
Ok, so... I have some problems with the Console code, for some reason it won't create the Console object. I guess it's the problem of the Matrix, so I should download Visual Studio and try there.  The problem is - I've never used Visual Studio... This might take a while...
Or I could also Google and figure out how compile with cmd on Windows... That also might take a while...

*17:00*
Ok, the good new are - I actually got a working Visual Studio... The Problem is... The Error I have still isn't fixed... I need to think about it...

*17:10*
Ok, so I spend around... 3 hours doing almost nothing, there are still no Updates on the Wiki web-site, and the SVN version of the console file tells "Still Incomplete"... I guess I'll give it a rest, write a letter to the professor (I HOPE it will get thought). So yeah. Now I'm gonna check other Blogs and  sites for info, and probably will do other subject's home work... Too bad...

четверг, 8 сентября 2011 г.

First Post

  So, this is my first... "post", I guess. I'm not sure what I'm going to do here, I've never used blogs before but it's not that hard to figure out. Sooo... Yeah. I little test.
My name is Dzmitry Kavalchyk, I am from Belarus,  and I'm a student of Seneca Collage in Toronto. I study Computer Programming, this a very interesting and challenging course. If you're reading this, that means that you are my teacher... or one of my classmates... or you're far in the future where I'm a very famous and rich person and people want to find out how it all started. (I had to re-write this part Twice - "Undo" function doesn't work well, but nothing major)
Any way, welcome, and thank you for spending your time on reading this.
Also, random code: 
#include "main.h"
#include "getPosInt.h"


int main() {
int i;

i = getPosInt(MAX);
cout << "You entered " << i << endl;

I think that went well...