Difference between revisions of "Assignment 1: Q & A"

From CDOT Wiki
Jump to: navigation, search
(Q & A)
 
(20 intermediate revisions by 10 users not shown)
Line 32: Line 32:
 
'''A:''' I have (Kevin from Team 9). What kind of crash are you talking about? Everything works fine when I compile.<br>
 
'''A:''' I have (Kevin from Team 9). What kind of crash are you talking about? Everything works fine when I compile.<br>
 
'''Q:'''It compiles, but when we edit the line for the first time and then press enter, then it crashes.<br>
 
'''Q:'''It compiles, but when we edit the line for the first time and then press enter, then it crashes.<br>
'''A:''' Make sure that you aren't overwriting the null byte at any point in the editing. After terminating the edit() function, a1test does a strcmp() of str and the successful string. If str is missing a null byte, it might be strcmp() crashing your program. Are you getting a seg fault? (Submitted by: Team 9)
+
'''A:''' Make sure that you aren't overwriting the null byte at any point in the editing. After terminating the edit() function, a1test does a strcmp() of str and the successful string. If str is missing a null byte, it might be strcmp() crashing your program. Are you getting a seg fault? (Submitted by Team 9)<br>
 +
'''A:''' Make sure your console window is long enough. The a1test.cpp sets ROW_ERRORS to 22 and then does row++ after every error. If your console is smaller than ~30 rows this makes the program try and print outside the screen and it crashes! (Answered by Team 6)<br>
 +
'''A:'''Julian Burton solved my problem. At the beginning I declared <br>
 +
char* original; original = new char[strlen(str) + 1]; strcpy(original, str);<br>
 +
but the size wasn't enough, so instead of strlen(str) + 1, I changed that to new char[maxStrLength + 1], and then it worked.<br>
 +
'''Submitted by:''' Shayan Vaghei & Mohamed Baig Team4<br><br>
  
  
Line 38: Line 43:
 
<br>
 
<br>
 
'''A:''' List any dynamic allocations you are using (and check for doubled delete [] statements), and refer to [http://www.efnetcpp.org/wiki/Heap_Corruption this page] for more information on potential problems.
 
'''A:''' List any dynamic allocations you are using (and check for doubled delete [] statements), and refer to [http://www.efnetcpp.org/wiki/Heap_Corruption this page] for more information on potential problems.
Also, make sure that you're not offsetting or repositioning past the end of the string allocation (maxStrLength). That could cause problems. (Answered by Team 9)<br>
+
Also, make sure that you're not offsetting or repositioning past the end of the string allocation (maxStrLength). That could cause problems. (Submitted by Team 9)<br>
'''A:''' I tracked the issue down. The a1test.cpp sets ROW_ERRORS to 22 and then does row++ after every error. This makes the program try and print outside the screen and it crashes! (Answered by Team 6)
+
'''A:''' I tracked the issue down. The a1test.cpp sets ROW_ERRORS to 22 and then does row++ after every error. If your console is smaller than ~30 rows this makes the program try and print outside the screen and it crashes! (Answered by Team 6)
'''Submitted by:''' Team 6 <br><br>
+
<br>'''Submitted by:''' Team 6 <br><br>
  
== Bug Report ==
 
* A1testborland.exe on A1 page has an error in its programming logic <br>
 
[http://oi45.tinypic.com/dx03g4.jpg Before] <br>
 
[http://oi50.tinypic.com/e7xxxe.jpg After]<br>
 
When in edit mode and when the cursor is over the second character, and the backspace key is used, the character not only gets deleted but the cursor moves right 4 characters. This is obviously not intentional.<br>
 
'''Submitted by:''' Danny Perrone and Michael LaMonaca<br><br>
 
*A1testborland.exe is inefficient when it comes to key presses. It calls the display function even if the string offset has not changed, causing the cursor-flicker when using left/right keys in quick succession. <br>
 
'''Submitted by: '''Team42.<br><br>
 
  
* A1testborland.exe has another error in its programming logic <br>
+
'''Q:''' Do i always assume that the field length given is not more than the width of the whole screen from the given column for display function?
When the string is at max length, if you press the left key and then right, the offset changes instead of the cursor position.
+
<br>
*Steps to recreate error
+
'''A:''' No, program your function in a way that it does follow the given instructions but it does not print any character passed the screen size and
**type until max length is reached
+
It should NOT print the rest on next line. (Answered by Team 1)
**press left key
+
<br>'''Submitted by:''' Team 1 <br><br>
**press right key
+
 
'''Submitted by: '''Team4.<br><br>
+
'''Q:''' Can I create 64-bit executable using borland compiler? <br>
 +
'''A:''' No you cannot create 64-bit executable. With Borland compiler you can only create 32-bit executable. <br>
 +
'''Submitted by:''' Shajinth Pathmakulaseelan and Auquib Rasul, Team 2 <br><br>
 +
 
 +
'''Q:''' Can ncurses package capture mouse events ? <br>
 +
'''A:''' Yes ncurses library in linux can capture events from mouse but in some environments, xterm is used under the X window system. <br>
 +
'''Submitted by:''' Shajinth Pathmakulaseelan and Auquib Rasul, Team 2 <br><br>
 +
 
 +
 
 +
 
 +
== Bug Reports ==
 +
# A1test.cpp sets const int ROW_ERRORS = 22. All the error message code using ROW_ERRORS makes the program crash if your console has less than ~30 rows (depending on number of errors you trigger)<br>'''Submitted by:''' Team 6<br>
 +
# A1testborland.exe on A1 page has an error in its programming logic.
 +
#*[http://oi45.tinypic.com/dx03g4.jpg Before]
 +
#*[http://oi50.tinypic.com/e7xxxe.jpg After]<br> When in edit mode and when the cursor is over the second character, and the backspace key is used, the character not only gets deleted but the cursor moves right 4 characters. This is obviously not intentional. <br>'''Submitted by:''' Danny Perrone and Michael LaMonaca
 +
# A1testborland.exe is inefficient when it comes to key presses. It calls the display function even if the string offset has not changed, causing the cursor-flicker when using left/right keys in quick succession. <br>'''Submitted by: '''Team42.
 +
# A1testborland.exe has another error in its programming logic. When the string is at max length, if you press the left key and then right, the offset changes instead of the cursor position.
 +
#*Steps to recreate error
 +
#**type until max length is reached
 +
#**press left key
 +
#**press right key <br>'''Submitted by: '''Shayan Vaghei & Mohamed Baig Team4.
 +
# Another bug in a1testBORLAND.exe
 +
#*When trying to backspace all characters, and then typing, the characters won't show off till you have typed as long as fieldLength's size. <br>'''Submitted by: '''Shayan Vaghei & Mohamed Baig Team4.
 +
# *On the a1test, once you've reached the part where you have to make A & Z lowercase again then pressing ESCAPE, the change in Z is retained. The specifications says that pressing ESCAPE shouldn't affect the current string.<br>'''Submitted by: '''Rubinder Singh & Radney Alquiza, Team11.
  
== Possible Additional Features: ==
+
== Possible Additional Features/Challenging & Interesting Enhancements ==
  
 +
=== Features Proposed by Team 42 ===
  
 
#[[:File:Dumb_word_wrapping.jpg|Dumb word wrapping]] - Cut off string at the end of line and wrap it (Proposed by Team42)
 
#[[:File:Dumb_word_wrapping.jpg|Dumb word wrapping]] - Cut off string at the end of line and wrap it (Proposed by Team42)
 
#[[:File:Smart_word_wrapping.jpg|Smart word wrapping]] - Smart word wrapping - words are not cut off mid-word while wrapping (Proposed by Team42)
 
#[[:File:Smart_word_wrapping.jpg|Smart word wrapping]] - Smart word wrapping - words are not cut off mid-word while wrapping (Proposed by Team42)
 
#Optimization - the 'test' compiled .exe has efficiency issues when scrolling around the string (Proposed by Team42)
 
#Optimization - the 'test' compiled .exe has efficiency issues when scrolling around the string (Proposed by Team42)
 +
#Colors - you can add color to the test program if you're making your own main
 +
#Timer - to keep track of how long the user has been running your custom main
 +
#Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original

Latest revision as of 20:02, 25 September 2013

Q & A

Q: How do I scroll through strings within a field?
A: To scroll through the string use pointer math. Use a pointer to point to where you want to start printing your string. Then use display to re-print your string using the new pointer instead of str.
Ex:
char* strStart;
strStart = str + yourOffsetHere;
display (strStart, row, col, fieldLength);
Submitted by: Jordan Theriault & Julian Burton

Q: What is the difference between terminating and aborting editing?
A: Terminating editing allows for the edited text to be saved, aborting it reverts the string to the original version.
Submitted by: Wes Hamilton & Joe Higginson

Q: Do we use consoleplus.cpp/.h or consolelineedit.cpp/.h for our A1 file compiling?
A: Your consolelineedit.cpp uses the consoleplus.h header file. There is no file named consoleplus.cpp or consolelineedit.h. (Submitted by Team42.)
Submitted by: Daniel Vescio & Alexandre Kostikov

Q: The parameter insertMode points to a bool variable that holds the current insert mode of the string. Do you want bool==true to be insert or overwrite? It isn't specified anywhere.
A: Since you're the one using your insertMode variable in your 'other letters' default case, you can set it to whatever you want and treat it as such Simply make sure you're being consistent in your code. (Submitted by Team42.)
Submitted by: Daniel Perrone and Michael LaMonaca

Q: In the program, we assume that the screen size is fixed. How would we change the program such that it prints the string for a variable field length i.e. the screen size can be changed at the user's discretion?
A: You can retrieve the screen size with console.getCols(); (or getRows() for rows) and use that value in your calculations for field-length, such as fieldLen=console.getCols()-4; (Submitted by Team42)
Submitted by: Gideon Thomas and Marie Karimizadeh

Q: When I try to run a1test on putty, my HOME key and END key don't work properly. What can I do to fix this?
A: Go to Connection >> Data, and change the string that says "xterm" to "linux". Make sure to save a new profile with this option; if you select a saved profile after making that change, it is not retained!
Submitted by: Kevin Kofler and Lucas Passarella, Team 9

Q: Has anyone compiled his program on matrix without any crashing? I think a1test.cpp has some problems and it causes crashing on matrix.
A: I have (Kevin from Team 9). What kind of crash are you talking about? Everything works fine when I compile.
Q:It compiles, but when we edit the line for the first time and then press enter, then it crashes.
A: Make sure that you aren't overwriting the null byte at any point in the editing. After terminating the edit() function, a1test does a strcmp() of str and the successful string. If str is missing a null byte, it might be strcmp() crashing your program. Are you getting a seg fault? (Submitted by Team 9)
A: Make sure your console window is long enough. The a1test.cpp sets ROW_ERRORS to 22 and then does row++ after every error. If your console is smaller than ~30 rows this makes the program try and print outside the screen and it crashes! (Answered by Team 6)
A:Julian Burton solved my problem. At the beginning I declared
char* original; original = new char[strlen(str) + 1]; strcpy(original, str);
but the size wasn't enough, so instead of strlen(str) + 1, I changed that to new char[maxStrLength + 1], and then it worked.
Submitted by: Shayan Vaghei & Mohamed Baig Team4


Q: How to avoid heap corruption? When I run a1test if I keep pressing RIGHT, the program crashes with heap corruption. Even whenI replace my custom line edit code with skeleton methods (display does nothing, edit returns RIGHT) the program still crashes with corrupt heap
A: List any dynamic allocations you are using (and check for doubled delete [] statements), and refer to this page for more information on potential problems. Also, make sure that you're not offsetting or repositioning past the end of the string allocation (maxStrLength). That could cause problems. (Submitted by Team 9)
A: I tracked the issue down. The a1test.cpp sets ROW_ERRORS to 22 and then does row++ after every error. If your console is smaller than ~30 rows this makes the program try and print outside the screen and it crashes! (Answered by Team 6)
Submitted by: Team 6


Q: Do i always assume that the field length given is not more than the width of the whole screen from the given column for display function?
A: No, program your function in a way that it does follow the given instructions but it does not print any character passed the screen size and It should NOT print the rest on next line. (Answered by Team 1)
Submitted by: Team 1

Q: Can I create 64-bit executable using borland compiler?
A: No you cannot create 64-bit executable. With Borland compiler you can only create 32-bit executable.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2

Q: Can ncurses package capture mouse events ?
A: Yes ncurses library in linux can capture events from mouse but in some environments, xterm is used under the X window system.
Submitted by: Shajinth Pathmakulaseelan and Auquib Rasul, Team 2


Bug Reports

  1. A1test.cpp sets const int ROW_ERRORS = 22. All the error message code using ROW_ERRORS makes the program crash if your console has less than ~30 rows (depending on number of errors you trigger)
    Submitted by: Team 6
  2. A1testborland.exe on A1 page has an error in its programming logic.
    • Before
    • After
      When in edit mode and when the cursor is over the second character, and the backspace key is used, the character not only gets deleted but the cursor moves right 4 characters. This is obviously not intentional.
      Submitted by: Danny Perrone and Michael LaMonaca
  3. A1testborland.exe is inefficient when it comes to key presses. It calls the display function even if the string offset has not changed, causing the cursor-flicker when using left/right keys in quick succession.
    Submitted by: Team42.
  4. A1testborland.exe has another error in its programming logic. When the string is at max length, if you press the left key and then right, the offset changes instead of the cursor position.
    • Steps to recreate error
      • type until max length is reached
      • press left key
      • press right key
        Submitted by: Shayan Vaghei & Mohamed Baig Team4.
  5. Another bug in a1testBORLAND.exe
    • When trying to backspace all characters, and then typing, the characters won't show off till you have typed as long as fieldLength's size.
      Submitted by: Shayan Vaghei & Mohamed Baig Team4.
  6. *On the a1test, once you've reached the part where you have to make A & Z lowercase again then pressing ESCAPE, the change in Z is retained. The specifications says that pressing ESCAPE shouldn't affect the current string.
    Submitted by: Rubinder Singh & Radney Alquiza, Team11.

Possible Additional Features/Challenging & Interesting Enhancements

Features Proposed by Team 42

  1. Dumb word wrapping - Cut off string at the end of line and wrap it (Proposed by Team42)
  2. Smart word wrapping - Smart word wrapping - words are not cut off mid-word while wrapping (Proposed by Team42)
  3. Optimization - the 'test' compiled .exe has efficiency issues when scrolling around the string (Proposed by Team42)
  4. Colors - you can add color to the test program if you're making your own main
  5. Timer - to keep track of how long the user has been running your custom main
  6. Files - Read string from file, use that string for editing, then write the result string to that file, overwriting original