Archive for October, 2007

Appendix D Visual Studio .NET Debugger 1327 by

Monday, October 22nd, 2007

Appendix D Visual Studio .NET Debugger 1327 by experienced programmers to debug large, complex projects consult the Visual Studio .NET documentation for more details on these features. In this appendix we demonstrated several techniques for debugging programs, methods and classes. The Visual Studio .NET debugger is a powerful tool, which allows programmers to build more robust, fault-tolerant programs. SUMMARY Debugging is the process of finding logic errors in applications. Syntax errors (or compilation errors) occur when program statements violate the grammatical rules of a programming language. These errors are caught by the compiler. Logic errors are more subtle than syntax errors. They occur when a program compiles successfully, but does not run as expected. Debuggers can suspend a program at any point, which allows programmers to examine and set variables and call methods. A breakpoint is a marker set at a line of code. When a program reaches a breakpoint, execution is suspended. The programmer then can examine the state of the program and ensure that the program is working properly. Fig. D.23 Fig. D.23Fig. D.FiFi23g. D.23g.D.23Expanded class in Watch window. Fig. D.24 Fig. D.24Fig. D.FiFi24g. D.24g.D.24Expanded array in Watch window.
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

Web server - 1326 Visual Studio .NET Debugger Appendix D 54

Sunday, October 21st, 2007

1326 Visual Studio .NET Debugger Appendix D 54 // constructor 55 public DebugClass( string stringData, 56 object objectData ) 57 { 58 someString = stringData; 59 privateObject = objectData; 60 } 61 62 // accessor property for someString 63 public string SomeString 64 { 65 get 66 { 67 return someString; 68 } 69 70 set 71 { 72 someString = value; 73 } 74 } // end property SomeString 75 76 } // end class DebugClass 77 78 } // end namespace ClassDebug Fig. D.21 Fig. D.21Fig. D.FiFi21g. D.21g.D.21Object debugging example. (Part 2 of 2.) Fig. D.22 Fig. D.22Fig. D.FiFi22g. D.22g.D.22Breakpoint location for class debugging. To assist class debugging, Visual Studio .NET allows the programmer to expand and view all data members and properties of a class, including privatemembers. In any of the three windows (i.e., Watch, Locals, Autos and This), a class that has data members is displayed with a plus (+) (Fig. D.23). When a programmer clicks the plus box, all the object s data members and their values display. If a member references an object, the object s data members also can be listed by clicking the object s plus box. Many logic errors are the result of incorrect array calculations. To simplify the identification of such errors, the debugger includes the ability to display all the values in an array. Figure D.24 displays the contents of the list array. The object at index 0 is and int array, which is expanded to show its contents. Index 1contains a DebugClassobject expanded to show the object s private data members, as well as a public property. Index 2contains a Randomobject, defined in the Framework Class Library (FCL). The Visual Studio debugger contains several other debugging windows, including Threads, Modules, Memory, Disassembly and Registers. These windows are used
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Appendix D Visual Studio .NET Debugger 1325 (Virtual web hosting) //

Sunday, October 21st, 2007

Appendix D Visual Studio .NET Debugger 1325 // Fig. D.21: DebugClass.cs // Console application to demonstrate object debugging. using System; namespace ClassDebug { // creates array containing three different classes public class DebugEntry { public int someInteger = 123; private int[] integerArray = { 74, 101, 102, 102 }; private DebugClass debugClass; private Random randomObject; private object[] list = new object[ 3 ]; // constructor public DebugEntry() { randomObject = new Random(); debugClass = new DebugClass( “Hello World”, new object() ); list[ 0 ] = integerArray; list[ 1 ] = debugClass; list[ 2 ] = randomObject; } // display values retrieved from three objects public void DisplayValues() { Console.WriteLine( randomObject.Next() ); Console.WriteLine( debugClass.SomeString ); Console.WriteLine( integerArray[ 0 ] ); } // main entry point for application [STAThread] public static void Main() { DebugEntry entry = new DebugEntry(); entry.DisplayValues(); } } // end class DebugEntry // demonstrates class debugging public class DebugClass { // private variables private string someString; private object privateObject; Fig. D.21 Fig. D.21Fig. D.FiFi21g. D.21g.D.21Object debugging example. (Part 1 of 2.)
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

1324 Visual Studio .NET Debugger Appendix (Web server application) D Control

Saturday, October 20th, 2007

1324 Visual Studio .NET Debugger Appendix D Control Button Shortcut Key Description Continue F5 Continues program execution. Execution continues until either a breakpoint is encountered or the program ends (through normal execution). Stop Debugging Shift + F5 Stops debugging and returns to Visual Studio design mode. Step Over F10 Advances to next statement, does not step into method calls. Step Into F11 Executes next statement. If the statement contains a method call, control transfers to the method for line-byline debugging. If the statement does not contain a method call, Step Into behaves like Step Over. Step Out Shift + F11 Finishes executing the current method and suspends program execution in the calling method. Fig. D.19 Fig. D.19Fig. D.FiFi19g. D.19g.D.19Debug program control features. Programmers can use the Immediate window, discussed in Section D.3 for testing method arguments passed to a method (Fig. D.20). Testing the arguments helps determine if a method is functioning properly. D.6 Additional Class Debugging Capabilities In most sophisticated C# programs, a large portion of program data is contained in objects. For these purposes, Visual Studio includes class debugging features, which allow programmers to determine the current state of objects used in a program. We demonstrate some class debugging features using the code presented in Fig. D.21. To examine an instance of class DebugEntry, we place a breakpoint at line 43, as shown in Fig. D.22. [Note: A C# file may contain multiple classes, as is the case with this example.] Fig. D.20 Fig. D.20Fig. D.FiFi20g. D.20g. D.20Using the Immediate window to debug methods.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.

Appendix D Visual Studio .NET Debugger 1323 Most (Windows 2003 server web)

Friday, October 19th, 2007

Appendix D Visual Studio .NET Debugger 1323 Most recently called method Fig. D.17 Fig. D.17Fig. D.FiFi17g. D.17g. D.17Call Stack window. Double-clicking any line in the Call Stack window displays the next line to be executed in that method. This allows the programmer to determine how the result of each method will affect the calling method s execution. Visual Studio .NET highlights the line in green and displays the tooltip shown in Fig. D.18. Visual Studio .NET also provides additional program-control buttons for debugging methods. The Step Over button executes one statement in a method, then pauses program execution at the following line. Using Step Over, if an evaluated statement invokes a method, the method is invoked, and execution stops at the next statement. Using Step Into, if a statement invokes a method, control transfers to the method for line-by-line. The Step Out button finishes executing the current method and returns control to the line that called the method. Testing and Debugging Tip D.7 Use Step Out to finish a method that was stepped into accidentally. Figure D.19 lists each program-control debug feature, its shortcut key and a description. Experienced programmers often prefer using these shortcut keys to access menu commands. Fig. D.18 Fig. D.18Fi.Fig. D18g. D.18D.18 IDE displaying a method s calling point. Fig.
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

1322 Visual Studio .NET Debugger Appendix D D.5 (Make my own web site)

Thursday, October 18th, 2007

1322 Visual Studio .NET Debugger Appendix D D.5 Additional Method Debugging Capabilities In programs with many methods, it is often difficult to determine which methods may have been involved in incorrect calculations that resulted in a logic error. To simplify this process, the Visual Studio debugger includes tools for analyzing methods and method calls. We demonstrate some method-debugging tools in the following example (Fig. D.16). The Call Stack window contains the program s method call stack, which allows the programmer to determine the exact sequence of calls that lead to the current method and to examine calling methods on the stack. This window allows the programmer to determine the flow of control in the program that resulted in the execution of the current method. For example, a breakpoint is inserted in MyMethod, the call stack in (Fig. D.17) indicates that the program called method Mainfirst, followed by MyMethod. 1 // Fig. D.16: MethodDebugExample.cs 2 // Demonstrates debugging methods. 3 4 using System; 5 6 namespace Debug 7 { 8 9 // provides methods on which to demonstrate 10 // Visual Studio s debug tools 11 class MethodDebug 12 { 13 // entry point for application 14 static void Main( string[] args ) 15 { 16 // display MyMethod return values 17 for( int i = 0; i < 10; i++ ) 18 Console.WriteLine( MyMethod( i ) ); 19 20 Console.ReadLine(); 21 } // end method main 22 23 // perform calculation 24 static int MyMethod( int x ) 25 { 26 return ( x * x ) - ( 3 * x ) + 7; 27 } // end method MyMethod 28 29 // method with logic error 30 static int BadMethod( int x ) 31 { 32 return 1 / ( x -x ); 33 } // end method BadMethod 34 35 } // end class MethodDebug 36 37 } // end namespace Debug Fig. D.16 Fig. D.16Fig. D.FiFi16g. D.16g. D.16Debugging methods.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Appendix D Visual Studio .NET Debugger 1321 (Christian web host) Function

Wednesday, October 17th, 2007

Appendix D Visual Studio .NET Debugger 1321 Function tab File tab Address tab Data tab Fig. D.13 Fig. D.13Fig. D.FiFi13g. D.13g. D.13New Breakpoint dialog. Fig. D.14 Fig. D.14Fig. D.FiFi14g. D.14g. D.14Breakpoint Hit Count dialog. Fig. D.15 Fig. D.15Fig. D.FiFi15g. D.15g. D.15Breakpoint Condition dialog.
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.

1320 Visual Studio .NET Debugger Appendix D Disabled (Free web hosting services)

Tuesday, October 16th, 2007

1320 Visual Studio .NET Debugger Appendix D Disabled breakpoint Fig. D.12 Fig. D.12Fig. D.FiFi12g. D.12g. D.12Disabled breakpoint. Testing and Debugging Tip D.6 Disabled breakpoints allow the programmer to maintain breakpoints in key locations in the program so they can be reactivated when needed. Disabled breakpoints are always visible. In the Breakpoints window (Fig. D.11), the Condition field displays the condition that must be satisfied to suspend program execution at that breakpoint. The Hit Count field displays the number of times the debugger has stopped at each breakpoint. Double-clicking an item in the Breakpoints window moves the cursor to the line containing that breakpoint. A programmer can add breakpoints to a program by clicking the New button in the Breakpoints window. This causes a New Breakpoint dialog to display (Fig. D.13). The Function, File, Address and Data tabs allow the programmer to suspend execution at either a method, a line in a particular file, an instruction in memory or when the value of a variable changes. The Hit Count… button (Fig. D.14) can be used to specify when the breakpoint should suspend the program (the default is to alwaysbreak). A breakpoint can be set to suspend the program when the hit count reaches a specific number, when the hit count is a multiple of a number or is greater than or equal to a specific number. The Visual Studio debugger also allows execution to suspend at a breakpoint depending on the value of an expression. Clicking the Condition button opens the Breakpoint Condition dialog (Fig. D.15). The Condition checkbox indicates whether breakpoint conditions are enabled. The radio buttons determine how the expression in the text box is evaluated. The is true radio button pauses execution at the breakpoint whenever the expression is true. The has changed radio button causes program execution to suspend when it first encounters the breakpoint and again each time the expression differs from its previous value when the breakpoint is encountered. When the New Breakpoint dialog has been closed, the Breakpoints window displays the condition and hit count options for the new break point. Suppose we set x*i!=0 as the condition for the breakpoint in our loop, with the has changed option enabled. (We might choose to do this because the program produces an incorrect output of 0). Program execution suspends when it first reaches the breakpoint and records that the expression has a value of true, because x*i is 100 (or 10 if we fixed the earlier logic error). We continue, and the loop decrements i. While iis between 10 and 1, the condition s value never changes, and execution is not suspended at that breakpoint. When iis 0, the expression x*i!=0is false, and execution is suspended. At this point, the programmer identifies the second logic error in our program the final iteration of the forloop multiplies the result by 0. To return the IDE to design mode, click the Stop Debugging button on the Debug toolbar.
We recommend high quality webhost to host and run your jsp application: christian web host services.

Appendix D Visual Studio (Free php web host) .NET Debugger 1319 assignment

Monday, October 15th, 2007

Appendix D Visual Studio .NET Debugger 1319 assignment updated value Fig. D.9 Fig. D.9Fig. D.FiFi9g. D.9g. D.9Immediate window. The Breakpoints window displays all the breakpoints set for the program (Fig. D.11). A checkbox appears next to each breakpoint, indicating whether the breakpoint is active (checked) or disabled (unchecked). Lines with disabled breakpoints contain an unfilled red circle rather than a solid one (Fig. D.12). The debugger does not pause execution at disabled breakpoints. Show next Toggle Continue debugging Stop debugging Break all Restart statement Step into Step over Step out hexadecimal display Breakpoint window Fig. D.10 Fig. D.10Fig. D.FiFi10g. D.10g. D.10Debug toolbar icons. Fig. D.11 Fig. D.11Fig. D.FiFi11g. D.11g. D.11Breakpoints window.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

1318 Visual Studio .NET Debugger (Bulletproof web design) Appendix D A

Sunday, October 14th, 2007

1318 Visual Studio .NET Debugger Appendix D A programmer can evaluate expressions line-by-line in the Immediate window (Fig. D.9). To evaluate an expression, a programmer types this expression into the window and presses Enter. For example, when a programmer enters Console.WriteLine(i) and presses Enter, the value of i is output to the console window. A developer also can use the assignment operator (=) to perform assignments in the Immediate window. Notice that the values for i and xin the Locals window contain these updated values. Testing and Debugging Tip D.4 Use the Immediate window to call a method one time. Placing a method call inside the Watch window calls that method every time the program breaks. D.4 Program Control The Visual Studio .NET Debugger give programmers considerable control over the execution of a program. Using breakpoints and program-control commands provided by the debugger, programmers conveniently can analyze the execution of code at any point in a program. This is useful when a program contains multiple calls to methods that are known to execute properly. The Debug toolbar contains buttons that provide convenient access for controlling the debugging process (Fig. D.10). To display the Debug toolbar, select View > Toolbars > Debug. The debug toolbar in Fig. D.10 controls debugger execution. The Restart button executes the program from the beginning, pausing at the beginning of the program to allow the programmer to set breakpoints before the program executes again. The Continue button resumes execution of a suspended program. The Stop Debugging button ends the debugging session, and the Break All button allows the programmer to suspend an executing program directly (i.e., without explicitly setting breakpoints). After execution suspends, the yellow arrow appears indicating the next statement to be executed. Testing and Debugging Tip D.5 When a program is executing, problems such as infinite loops usually can be interrupted by selecting Debug > Break All or by clicking the corresponding button on the toolbar. Clicking the Show Next Statement button places the cursor on the same line as the yellow arrow. This command is useful when a programmer needs to return to the current execution point after setting breakpoints in a program that contains many lines of code. The Step Over button executes the next executable statement and advances the yellow arrow to the following line. If the next line of code contains a method call, the method is executed in its entirety as one step. This button allows the user to execute the program one line at a time without seeing the details of every method that is called. This is useful when a program contains multiple calls to methods that are known to execute properly. We discuss the Step Into and Step Out buttons in the next section. The Hex button toggles the display format of data. If enabled, Hex displays data in hexadecimal (base 16) format, rather than displaying data in decimal (base 10) format. Experienced programmers often prefer to read values in hexadecimal format especially large numbers because hexadecimal number representation is more concise and can be converted easily to binary (base 2) form. For more information about the hexadecimal and decimal number formats, see Appendix B, Number Systems.
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.