Difference between revisions of "Assignment 1 (Fall 2013) Q & A"

From CDOT Wiki
Jump to: navigation, search
Line 28: Line 28:
 
Q8: What is the purpose and functionality of the "strOffset" parameter? This explanation is confusing: "strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field." Please answer it in simpler terms, maybe with an example as well. -- Fries'n'burg
 
Q8: What is the purpose and functionality of the "strOffset" parameter? This explanation is confusing: "strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field." Please answer it in simpler terms, maybe with an example as well. -- Fries'n'burg
 
* The 'strOffset' allows the string to be moved if the fieldlength is shorter than a string itself and the cursor is beyond the string. To do that it points to a int value which is the index of the string. i.e if the string is "abcdefghi" and the field length is 5, the string will be shown as "abcde"; when you move the cursor beyond 'e' it should display "bcdef" and so on. Hopefully this helps.  -(Team 2)
 
* The 'strOffset' allows the string to be moved if the fieldlength is shorter than a string itself and the cursor is beyond the string. To do that it points to a int value which is the index of the string. i.e if the string is "abcdefghi" and the field length is 5, the string will be shown as "abcde"; when you move the cursor beyond 'e' it should display "bcdef" and so on. Hopefully this helps.  -(Team 2)
 +
* Take a look at the diagram that we posted below - it helped us understand how this works (Team 4)
  
  
'''Q:''' What is the difference betweem '''consolelineedit.h''' and '''consoleplus.h''' ? <br> '''Submitted by:''' Rafid Daoud and Arnold Goncharenko, Team 8 <br><br>
+
'''Q:''' What is the difference between '''consolelineedit.h''' and '''consoleplus.h''' ? <br> '''Submitted by:''' Rafid Daoud and Arnold Goncharenko, Team 8 <br><br>
 
* There is no file named consolelineedit.h. There is only consoleplus.h in which all your prototype functions are declared.(Team 2)
 
* There is no file named consolelineedit.h. There is only consoleplus.h in which all your prototype functions are declared.(Team 2)
  

Revision as of 14:37, 26 September 2013

Q1: How do I submit "two individual reports that consist of peer evaluation, programming experience and team work experience"?

  • Answer: Submit them individually at Blackboard. For peer evaluation, use a scale from 0 (lowest) to 5 (highest).

Q2: When trying to display the value of the col number received in the display function, we saw the ascii char value instead of the integer decimal value that we expected. Can anyone suggest how to display the integer decimal value?

  • Answer: It seems that you've assigned a character (e.g. '7') to an int variable (e.g. x). The value of x is the ASCII value of '7'. If you display the value of x, that's what you will get. The solution is to do the proper conversion (from char to int, and vice versa) correctly. I hope this helps. -- Peter

Q3: Are we supposed to make two brand new files named consolelineedit.cpp and consoleplus.h and compile them with the original console.cpp and console.h or are we supposed to modify the original console.cpp and console.h files and name them consolelineedit.cpp and consoleplus.h?

  • Answer: Keep console.h and consoleplus.h as separate files, same with console.cpp and consolelineedit.cpp.
  • Answer 2: Yes, make two brand new files and don't edit the original files given. (Team 4)
  • Answer 3: Do not forget to use the namespace "cio" when you declare the display and edit funcitons! -- Peter

Q4: To get the offset of the string when moving right or left would we have to allocate memory since we are unable to return the offset to the display function? -- Kabeer

  • Answer: During LEFT or RIGHT we do not need to allocate memory, we just subtract (--) for LEFT or add (++) for RIGHT to change the offset. And we don't need to call the display function during RIGHT/LEFT keys since you just need to set the cursor position at that point. -- Huda (Team 1)

Q5: The curPosition parameter points to the "index of the character in the field at which the cursor is initially placed". Is this where the cursor position is placed before displaying the string or after? And if it is for before the string is displayed: is there a standard location the cursor should be sent after displaying the string? -- Justin

Q6: Is there supposed to be a second edit() function that accepts no parameters?

  • Answer: No. there is only supposed to be one function that accepts parameters, there is no need for a non-value edit function. This section was misleading:
The edit() function always displays blanks in any part of the field that is not occupied by the string.
UNDER NO CIRCUMSTANCES DOES THE FUNCTION CHANGE ANY POSITION ON THE SCREEN OUTSIDE THE FIELD.
For example, the function does not display status information (such as "INS" or "OVR") elsewhere
on the screen, since such displays limit the programmer's ability to design their own screen layouts.

Q7: Can we use memmove() function to insert a character to the string?(team 3)

  • Answer: yes you can use it.


Q8: What is the purpose and functionality of the "strOffset" parameter? This explanation is confusing: "strOffset points to an int variable that holds the initial offset of the string within the field; that is, the index of the character in the string that initially occupies the first character position in the field." Please answer it in simpler terms, maybe with an example as well. -- Fries'n'burg

  • The 'strOffset' allows the string to be moved if the fieldlength is shorter than a string itself and the cursor is beyond the string. To do that it points to a int value which is the index of the string. i.e if the string is "abcdefghi" and the field length is 5, the string will be shown as "abcde"; when you move the cursor beyond 'e' it should display "bcdef" and so on. Hopefully this helps. -(Team 2)
  • Take a look at the diagram that we posted below - it helped us understand how this works (Team 4)


Q: What is the difference between consolelineedit.h and consoleplus.h ?
Submitted by: Rafid Daoud and Arnold Goncharenko, Team 8

  • There is no file named consolelineedit.h. There is only consoleplus.h in which all your prototype functions are declared.(Team 2)


Features/Assignment Information

  • When compiling code on Matrix; SSH handles keys differently than putty. However you are able to change how keys are handle on putty by doing the following steps:
     - On putty configuration go to Connections > Data
     - On the Terminal-type string change the "xterm' to "linux"
     - On the Session press the 'load' button and connect to matrix.

This will allow the buttons such as 'Home','END', etc to work properly when testing/compiling.


USEFUL DIAGRAM - we found this posted from a previous class... we found it helpful to help understand the curPosition and the strOffset (Team 4)

A1 Diagram.png