Archive for the 'Coldfusion' Category

Geocities web hosting - CHAPTER 2 BUILDING C# APPLICATIONS 47 Learning

Friday, February 8th, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 47 Learning the Lay of the Land: SharpDevelop SharpDevelop provides numerous productivity enhancements and in many cases is as feature rich as Visual Studio .NET 2003 (but not currently as powerful as Visual Studio 2005). Here is a hit list of some of the major benefits: Support for the Microsoft and Mono C# compilers IntelliSense and code expansion capabilities An Add Reference dialog box to reference external assemblies, including assemblies deployed to the GAC A visual Windows Forms designer Various project perspective windows (termed scouts) to view your projects An integrated object browser utility (the Assembly Scout) Database manipulation utilities A C# to VB .NET (and vice versa) code conversion utility Integration with the NUnit (a .NET unit test utility) and NAnt (a .NET build utility) Integration with the .NET Framework SDK documentation Impressive for a free IDE, is it not? Although this chapter doesn t cover each of these points in detail, let s walk through a few items of interest. If you require further details of SharpDevelop, be aware that it ships with very thorough documentation accessible from the Help .Help Topics menu option. The Project and Classes Scouts When you create a new combine, you can make use of the Project Scout to view the set of files, referenced assemblies, and resource files of each project (see Figure 2-11). When you wish to reference an external assembly for your current project, simply right-click the References icon within the Project Scout and select the Add Reference context menu. Once you do, you may select assemblies directly from the GAC as well as custom assemblies via the .NET Assembly Browser tab (see Figure 2-12). Figure 2-11. The Project Scout
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Free web hosting music - CHAPTER 2 46 BUILDING C# APPLICATIONS As

Wednesday, February 6th, 2008

CHAPTER 2 46 BUILDING C# APPLICATIONS As you may agree, TextPad is a step in the right direction when contrasted to Notepad and the command prompt. However, TextPad does not (currently) provide IntelliSense capabilities for C# code, GUI designers, project templates, or database manipulation tools. To address such needs, allow me to introduce the next .NET development tool: SharpDevelop. Building .NET Applications Using SharpDevelop SharpDevelop is an open source and feature-rich IDE that you can use to build .NET assemblies using C#, VB .NET, Managed Extensions for C++, or CIL. Beyond the fact that this IDE is completely free, it is interesting to note that it was written entirely in C#. In fact, you have the choice to download and compile the *.cs files manually or run a setup.exe program to install SharpDevelop on your development machine. Both distributions can be obtained from http://www.icsharpcode. net/OpenSource/SD/Download. Once you have installed SharpDevelop, the File .New .Combine menu option allows you to pick which type of project you wish to generate (and in which .NET language). In the lingo of SharpDevelop, a combine is a collection of individual projects (analogous to aVisual Studio solution). Assume you have created a C# Windows Application named MySDWinApp (see Figure 2-10). Note Be aware that version 1.0 of SharpDevelop is configured to make use of the C# 1.1 compiler. To make use of the new C# 2005 language features and .NET Framework 2.0 namespaces, you will need to activate the Project . Project options menu item and update the compiler version from the Runtime/Compiler option page. Figure 2-10. The SharpDevelop New Project dialog box
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

CHAPTER 2 (Affordable web design) BUILDING C# APPLICATIONS 45 3.

Tuesday, February 5th, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 45 3. If you wish, rename csc.exe to a more descriptive label (Compile C#) by clicking the tool name and then clicking OK. 4. Finally, activate the Configure .Preferences menu option once again, but this time select Compile C# from the Tools node, and specify *.cs as the sole value in the Parameters field (see Figure 2-8). With this, you can now compile all C# files in the current directory using your custom Tools menu item. Enabling C# Code Snippets Before leaving behind the world of TextPad, there is one final free add-on you might wish to install. Navigate to http://www.textpad.com/add-ons/cliplibs.html and download csharp_1.zip using the C# clip library provided by Sean Gephardt. Extract the contained csharp.tcl file and place it in the Samples subdirectory. When you restart TextPad, you should find a new clip library named C Sharp Helpers available from the Clip Library drop-down list (see Figure 2-9). Double-clicking any item will insert the related C# code in the active document at the location of the cursor. Figure 2-8. Creating a Tools menu item Figure 2-9. C# code snippets la TextPad
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

CHAPTER 2 44 BUILDING C# APPLICATIONS 3. (Anonymous web server)

Monday, February 4th, 2008

CHAPTER 2 44 BUILDING C# APPLICATIONS 3. Enter the directory containing the input files via the Initial folder text box (C:TextPadTestApp in this example). 4. If you wish TextPad to capture the compiler output directly (rather than within a separate command window), select the Capture Output check box. Figure 2-6 shows the complete compilation settings. At this point, you can either run your program by double-clicking the executable using Windows Explorer or leverage the Tools .Run menu option to specify myApp.exe as the current command (see Figure 2-7). When you click OK, you should see the program s output ( Hello from TextPad ) displayed in the Command Results document. Associating Run Commands with Menu Items TextPad also allows you to create custom menu items that represent predefined run commands. Let s create a custom item under the Tools menu named Compile C# Console that will compile all C# files in the current directory: 1. Activate the Configure .Preferences menu option and select Tools from the tree view control. 2. Using the Add button, select Program and specify the full path to csc.exe. Figure 2-6. Specifying a custom Run command Figure 2-7. Instructing TextPad to run myApp.exe
You want to have a cheap webhost for your apache application, then check apache web hosting services.

CHAPTER 2 (Http web server) BUILDING C# APPLICATIONS 43 Figure

Sunday, February 3rd, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 43 Figure 2-5. TextPadTest.cs Configuring the *.cs File Filter The next configuration detail is to create a filter for C# source code files displayed by the Open and Save dialog boxes: 1. Activate the Configure .Preferences menu option and select File Name Filters from the tree view control. 2. Click the New button, and enter C# into the Description field and *.cs into the Wild cards text box. 3. Move your new filter to the top of the list using the Move Up button and click OK. Create a new file (using File .New) and save it in a convenient location (such as C:TextPadTestApp) as TextPadTest.cs. Next, enter a trivial class definition (see Figure 2-5). Hooking Into csc.exe The last major configuration detail to contend with is to associate csc.exe with TextPad so you can compile your C# files. The first way to do so is using the Tools .Run menu option. Here you are presented with a dialog box that allows you to specify the name of the tool to run and any necessary command-line flags. To compile TextPadTest.cs into a .NET console-based executable, follow these steps: 1. Enter the full path to csc.exe into the Command text box (e.g., C:WindowsMicrosoft.NET Frameworkv2.0. 50215csc.exe). 2. Enter the command-line options you wish to specify within the Parameters text box (e.g., /out:myApp.exe *.cs). Recall that you can specify a custom response file to simplify matters (e.g., @myInput.rsp).
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.

CHAPTER 2 42 BUILDING C# APPLICATIONS Figure (Free web hosting with ftp)

Saturday, February 2nd, 2008

CHAPTER 2 42 BUILDING C# APPLICATIONS Figure 2-4. Setting TextPad s C# preferences TextPad is an editor you can use to author and compile code for numerous programming languages, including C#. The chief advantage of this product is the fact that it is very simple to use and provides just enough bells and whistles to enhance your coding efforts. To obtain TextPad, navigate to http://www.textpad.com and download the current version (4.7.3 at the time of this writing). Once you have installed the product, you will have a featurecomplete version of TextPad; however, this tool is not freeware. Until you purchase a single-user license (for around US$30.00 at the time of this writing), you will be presented with a friendly reminder each time you run the application. Enabling C# Keyword Coloring TextPad is not equipped to understand C# keywords or work with csc.exe out of the box. To do so, you will need to install an additional add-on. Navigate to http://www.textpad.com/add-ons/syna2g.html and download csharp8.zip using the C# 2005 link option. This add-on takes into account the new keywords introduced with C# 2005 (in contrast to the C# link, which is limited to C# 1.1). Once you have unzipped csharp8.zip, place a copy of the extracted csharp8.syn file in the Samples subdirectory of the TextPad installation (e.g., C:Program FilesTextPad 4Samples). Next, launch TextPad and perform the following tasks using the New Document Wizard. 1. Activate the Configure .New Document Class menu option. 2. Enter the name C# 2.0 in the Document class name edit box. 3. In the next step, enter *.cs in the Class members edit box. 4. Finally, enable syntax highlighting, choose csharp8.syn from the drop-down list box, and close the wizard. You can now tweak TextPad s C# support using the Document Classes node accessible from the Configure .Preferences menu (see Figure 2-4).
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Figure 2-3. Debugging with cordbg.exe CHAPTER 2 (Web hosting top)

Saturday, February 2nd, 2008

Figure 2-3. Debugging with cordbg.exe CHAPTER 2 BUILDING C# APPLICATIONS 41 Debugging at the Command Line Before you can debug your application using cordbg.exe, the first step is to generate debugging symbols for your current application by specifying the /debug flag of csc.exe. For example, to generate debugging data for TestApp.exe, enter the following command set: csc @testapp.rsp /debug This generates a new file named (in this case) testapp.pdb. If you do not have an associated *.pdb file, it is still possible to make use of cordbg.exe; however, you will not be able to view your C# source code during the process (which is typically no fun whatsoever, unless you wish to complicate matters by reading CIL code). Once you have generated a *.pdb file, open a session with cordbg.exe by specifying your .NET assembly as a command-line argument (the *.pdb file will be loaded automatically): cordbg.exe testapp.exe At this point, you are in debugging mode and may apply any number of cordbg.exe flags at the (cordbg) command prompt (see Figure 2-3). When you wish to quit debugging with cordbg.exe, simply type exit (or the shorthand ex). Again, unless you are a command-line junkie, I assume you will opt for the graphical debugger provided by your IDE. If you require more information, look up cordbg.exe in the .NET Framework 2.0 SDK documentation. Building .NET Applications Using TextPad While Notepad is fine for creating simple .NET programs, it offers nothing in the way of developer productivity. It would be ideal to author *.cs files using an editor that supports (at aminimum) keyword coloring, code snippets, and integration with a C# compiler. As luck would have it, such a tool does exist: TextPad.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Web server logs - The Default Response File (csc.rsp) The final point

Friday, February 1st, 2008

The Default Response File (csc.rsp) The final point to be made regarding response files is that the C# compiler has an associated default response file (csc.rsp), which is located in the same directory as csc.exe itself (e.g., C:Windows Microsoft.NETFrameworkv2.0.50215). If you were to open this file using Notepad, you will find that numerous .NET assemblies have already been specified using the /r: flag. When you are building your C# programs using csc.exe, this file will be automatically referenced, even when you supply a custom *.rsp file. Given the presence of the default response file, the current TestApp.exe application could be successfully compiled using the following command set (as System.Windows.Forms.dll is referenced within csc.rsp): csc /out:TestApp.exe *.cs In the event that you wish to disable the automatic reading of csc.rsp, you can specify the /noconfig option: csc @TestApp.rsp /noconfig Obviously, the C# command-line compiler has many other options that can be used to control how the resulting .NET assembly is to be generated. If you wish to learn more details regarding the functionality of csc.exe, look up my article titled Working with the C# 2.0 Command Line Compiler online at http://msdn.microsoft.com. The Command-Line Debugger (cordbg.exe) Before moving on to our examination of building C# applications using TextPad, I would like to briefly point out that the .NET Framework 2.0 SDK does ship with a command-line debugger named cordbg.exe. This tool provides dozens of options that allow you to debug your assembly. You may view them by specifying the /? flag: cordbg /? Table 2-3 documents some (but certainly not all) of the flags recognized by cordbg.exe (with the alternative shorthand notation) once you have entered a debugging session. Table 2-3. A Handful of Useful cordbg.exe Command-Line Flags Flag Meaning in Life b[reak] Set or display current breakpoints. del[ete] Remove one or more breakpoints. ex[it] Exit the debugger. g[o] Continue debugging the current process until hitting next breakpoint. o[ut] Step out of the current function. p[rint] Print all loaded variables (local, arguments, etc.). si Step into the next line. so Step over the next line. As I assume that most of you will choose to make use of the Visual Studio 2005 integrated debugger, I will not bother to comment on each flag of cordbg.exe. However, for those of you who are interested, the following section presents a minimal walk-through of the basic process of debugging at the command line. CHAPTER 2 40 BUILDING C# APPLICATIONS
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

Web design careers - CHAPTER 2 BUILDING C# APPLICATIONS 39 When

Thursday, January 31st, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 39 When you run the program again, the output is identical. The only difference between the two applications is the fact that the current logic has been split among multiple files. Referencing Multiple External Assemblies On a related note, what if you need to reference numerous external assemblies using csc.exe? Simply list each assembly using a semicolon-delimited list. You don t need to specify multiple external assemblies for the current example, but some sample usage follows: csc /r:System.Windows.Forms.dll;System.Drawing.dll *.cs Working with csc.exe Response Files As you might guess, if you were to build a complex C# application at the command prompt, your life would be full of pain as you type in the flags that specify numerous referenced assemblies and *.cs input files. To help lessen your typing burden, the C# compiler honors the use of response files. C# response files contain all the instructions to be used during the compilation of your current build. By convention, these files end in a *.rsp (response) extension. Assume that you have created a response file named TestApp.rsp that contains the following arguments (as you can see, comments are denoted with the # character): # This is the response file # for the TestApp.exe app # of Chapter 2. # External assembly references. /r:System.Windows.Forms.dll # output and files to compile (using wildcard syntax). /target:exe /out:TestApp.exe *.cs Now, assuming this file is saved in the same directory as the C# source code files to be compiled, you are able to build your entire application as follows (note the use of the @ symbol): csc @TestApp.rsp If the need should arise, you are also able to specify multiple *.rsp files as input (e.g., csc @FirstFile.rsp @SecondFile.rsp @ThirdFile.rsp). If you take this approach, do be aware that the compiler processes the command options as they are encountered! Therefore, command-line arguments in a later *.rsp file can override options in a previous response file. Also note that flags listed explicitly on the command line before a response file will be overridden by the specified *.rsp file. Thus, if you were to enter csc /out:MyCoolApp.exe @TestApp.rsp the name of the assembly would still be TestApp.exe (rather than MyCoolApp.exe), given the /out:TestApp.exe flag listed in the TestApp.rsp response file. However, if you list flags after a response file, the flag will override settings in the response file. Thus, in the following command set, your assembly is indeed named MyCoolApp.exe. csc @TestApp.rsp /out:MyCoolApp.exe Note The /reference flag is cumulative. Regardless of where you specify external assemblies (before, after, or within a response file) the end result is a summation of each reference assembly.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Figure 2-2. (Apache web server) Your first Windows Forms application Compiling

Wednesday, January 30th, 2008

Figure 2-2. Your first Windows Forms application Compiling Multiple Source Files with csc.exe The current incarnation of the TestApp.exe application was created using a single *.cs source code file. While it is perfectly permissible to have all of your .NET types defined in a single *.cs file, most projects are composed of multiple *.cs files to keep your code base a bit more flexible. Assume you have authored an additional class contained in a new file named HelloMsg.cs: // The HelloMessage class using System; using System.Windows.Forms; class HelloMessage { public void Speak() { MessageBox.Show(”Hello…”); } } Now, update your initial TestApp class to make use of this new type, and comment out the previous Windows Forms logic: using System; // Don’t need this anymore. // using System.Windows.Forms; class TestApp { public static void Main() { Console.WriteLine(”Testing! 1, 2, 3″); // Don’t need this anymore either. // MessageBox.Show(”Hello…”); // Exercise the HelloMessage class! HelloMessage h = new HelloMessage(); h.Speak(); } } You can compile your C# files by listing each input file explicitly: csc /r:System.Windows.Forms.dll testapp.cs hellomsg.cs As an alternative, the C# compiler allows you to make use of the wildcard character (*) to inform csc.exe to include all *.cs files contained in the project directory as part of the current build: csc /r:System.Windows.Forms.dll *.cs CHAPTER 2 38 BUILDING C# APPLICATIONS
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.