820 Appendix A . Media using the Gentoo (Web design portfolio)

December 25th, 2007

820 Appendix A . Media using the Gentoo CD to install Gentoo on your computer. The procedure described in that chapter has you building much of the Gentoo operating system from scratch, specifically for your computer hardware, and downloading needed packages from the Internet. Damn Small Linux Damn Small Linux is set up to boot directly from the CD that accompanies this book. We have also included an ISO image of Damn Small Linux on the same CD that can fit on a mini-CD (less than 50MB). This distribution illustrates how a useful desktop Linux distribution, which includes full network connectivity and some useful productivity applications, can fit in a very small space. Information on burning the Damn Small Linux distribution to CD appears later in this appendix. See Chapter 19 for information on using Damn Small Linux. Inside Security Rescue Toolkit Inside Security Rescue Toolkit (INSERT) is a small, bootable Linux distribution that contains a variety of useful tools for checking, repairing, and recovering computers and networks. INSERT is small enough to fit on a bootable business card CD or mini- CD. While many of its tools are text-based, INSERT includes a simple graphical interface (using X and FluxBox window manager) and a few graphical tools. An ISO image of INSERT is on the CD that comes with this book. Information on burning INSERT to CD appears later in this appendix. Refer to Chapter 19 for descriptions of what s inside INSERT. System Rescue CD Like INSERT, System Rescue CD is a bootable Linux that includes a variety of tools for checking and fixing your installed computer systems. It includes tools for managing and fixing file systems, checking for viruses, monitoring the network, and checking whether a machine has been hacked. Find the System Rescue CD ISO image on the CD that comes with this book. Descriptions later in this appendix provide information about burning CDs from the images with this book. Refer to Chapter 19 for further information about System Rescue CD. Coyote Linux Although not considered a major Linux distribution, Coyote Linux is an excellent illustration of a useful Linux distribution that fits on a floppy disk (1.4MB). You can
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

Appendix A . Media 819 Later in this (Web hosting bandwidth)

December 25th, 2007

Appendix A . Media 819 Later in this appendix, you ll find out how to burn Slackware ISO images to CD from the DVD. Chapter 14 tells how to install Slackware on your computer from that CD. Chapter 3 describes how to configure a simple window manager for Slackware. Ubuntu 5.1 The Ubuntu 5.1 (Breezy Badger) installation CD image is contained on the DVD that comes with this book. That image can be used to install a desktop system or a minimal server system. Further software installation can be done from the Internet, after the basic install is done. The procedure for installing Ubuntu 5.1 is found in Chapter 17. A procedure for burning the Ubuntu ISO image to CD appears later in this appendix. Finding Linux Distributions on the CD The CD that comes with this book boots directly to a Debian network install or a live boot of Damn Small Linux. ISO images containing software for installing Gentoo, Debian, INSERT (security CD), Slax, and system rescue CD are included on this CD. Coyote Linux is contained on a tar/gzip that you copy to a hard disk and build into a floppy Linux distribution from instructions in Chapter 18. Debian GNU/Linux The network install ISO image of Debian GNU/Linux distribution is contained on the CD. Debian offers thoroughly tested releases that many Linux consultants and experts use because of its excellent software packaging and stability. Debian is used as the sample distribution for creating a Web server (LAMP) and mail server, as described in Chapters 24 and 25, respectively. You can install Debian directly from the CD that comes with this book. The procedure for installing Debian is included in Chapter 9. Gentoo Linux The Gentoo Minimal install CD ISO image is included on the CD. With the Gentoo CD, you can install a usable Linux system, to which you can add any of the nearly 7,000 software packages that are available with Gentoo. Those packages can be obtained over a network connection or from a local CD, DVD, or hard disk. (A network install of those additional packages is described in Chapter 13.) Procedures for burning the Gentoo ISO image from the CD that comes with this book to CD appear later in this appendix. Refer to Chapter 13 for information on
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

818 Appendix A . Media Fedora Core 4

December 25th, 2007

818 Appendix A . Media Fedora Core 4 Linux The DVD includes the entire Fedora Core 4 distribution that normally comes on four installation CDs. This is the recommended Linux distribution for trying out most of the procedures in this book. You can install Fedora Core 4 directly from the DVD without having to create CDs from the DVD to install separately. Because the complete Fedora Core 4 Linux distribution is included, you have access to a broad range of software packages (more than 1,600), allowing you to get a feel for using Linux as a desktop, server, or programmer s workstation. Details on installing and using Fedora Core 4 are in Chapter 8. If you find that you like Fedora Core 4, consider getting Red Hat Fedora and Enterprise Linux 4 Bible (Wiley Publishing, 2005) to learn more about that distribution. While some of the material overlaps with this book s, you will get more complete coverage of installation and different kinds of servers available with Fedora Core 4. SUSE Linux The complete five-CD SUSE 10.0 OSS installation set (also referred to as OpenSUSE 10.0) images included on the DVD lets you install the complete OpenSUSE operating system. SUSE Linux is developed and supported by Novell, which offers SUSE as part of a wider range of Enterprise-ready Linux and NetWare software. OpenSUSE is the Novell-sponsored, community-supported free Linux. To install SUSE from the ISO images included on the DVD, you must first burn those images to CD, as described later in this appendix. Then, follow the installation instructions in Chapter 10. KNOPPIX Linux The KNOPPIX 4.0 LiveCD Linux distribution is configured to boot by default from the DVD that comes with this book. KNOPPIX is the most popular bootable Linux and offers some unique features to set it apart from other bootable Linux distribution. Information on using KNOPPIX and configuring it in various ways is in Chapter 11. Slackware 10.1 The DVD contains the complete Slackware 10.1 distribution on two CDs. Slackware is the oldest surviving Linux system and continues to have a loyal following among Linux enthusiasts. Note
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Web hosting resellers - Media The DVD and CD that accompany Linux

December 24th, 2007

Media The DVD and CD that accompany Linux Bible 2006 Edition contain 12 different Linux distributions. Two of those distributions can be booted directly from the DVD and run live (KNOPPIX) or installed to your hard disk (Fedora Core). Two can be booted and run live from the CD (Damn Small Linux) or installed to your hard disk (Debian). The others can be burned to a CD-ROM from one of those two media and installed separately. General information on installing or booting the various Linux distributions on the DVD is in Chapter 7. Specific instructions for using and installing each Linux distribution are contained in the other chapters in Part III (see Chapters 8 through 19). The software contained on the CD and DVD is covered under the GNU Public License (GPL) or other licenses included on the medium for each software distribution. Use the software on the DVD and CD (as you would any GPL software) at your own risk. Refer to README, RELEASENOTES, and any licensing files delivered with each distribution, and be sure that you agree with the terms they spell out before using the software. Finding Linux Distributions on the DVD The following sections describe the five Linux distributions on the DVD that accompanies this book. Fedora Core and KNOPPIX are immediately bootable from the DVD. The other distributions are in ISO images in the distros directory on the DVD. Caution AAPAP E N D I X
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Chapter 29 . Programming Tools and (Photography web hosting) Utilities 815

December 24th, 2007

Chapter 29 . Programming Tools and Utilities 815 To locate the next occurrence of a particular string in the current file, use the search string command. Use reverse-search string to find the previous occurrence of string. If you want to find the previous occurrence of the word return in debugme.c (see Listing 29-5), for example, use the command reverse-search return. GDB obliges and displays the text: (gdb) reverse-search return 17 return ret; The search and reverse-search commands are especially helpful in large source files that have dozens or hundreds of lines. One common use of the reversesearch command is to find the file and/or line in which a variable is first used or in which it is defined. The search command similarly enables you to locate with relative ease each location in which a program symbol (variable, macro, or function) is used, perhaps to find the use that changes a variable unexpectedly or the place where a function is called when it shouldn t be. Summary This chapter took you on a whirlwind tour of a few of the most common programs and utilities used by Linux programmers. You learned how to use GCC to compile programs, how to use make to automate compiling programs, and how to find information about programming libraries using programs such as ldd, nm, and ldconfig. You also learned enough about the source code control systems RCS and CVS to be comfortable with the terminology and how to use their most basic features. Finally, you learned how to use the GNU debugger GDB to figure out why, or at least where, a program fails. . . .
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

814 Part VI . Programming in Linux (gdb)

December 23rd, 2007

814 Part VI . Programming in Linux (gdb) break filename:linenum (gdb) break filename:funcname Conditional breakpoints are usually more useful. They enable you to temporarily halt program execution if or when a particular condition is met. The correct syntax for setting conditional breakpoints is as follows: (gdb) break linenum if expr (gdb) break funcname if expr In the preceding code, expr can be any expression that evaluates to true (non-zero). For example, the following break command stops execution at line 24 of debugme when the variable i equals 15: (gdb) break 24 if i == 15 Breakpoint 1 at 0×80483cb: file debugme.c, line 24. (gdb) run Starting program: /home/kwall/code/debugme Breakpoint 1, index_to_the_moon (ary=0xbffff4b0) at debugme.c:24 24 ary[i] = i; Stopping when i equals 15 is an arbitrary choice to demonstrate conditional breaks. As you can see, gdb stopped on line 24. A quick print command confirms that it stopped when the value of i reached the requested value: (gdb) print i $1 = 15 To resume executing after hitting a breakpoint, type continue. If you have set many breakpoints and have lost track of what has been set and which ones have been triggered, you can use the info breakpoints command to refresh your memory. Working with Source Code Locating a specific variable or function in a multi-file project is a breeze with GDB, provided you use the -d switch to tell it where to find additional source code files. This is a particularly helpful option when not all of your source code is located in your current working directory or in the program s compilation directory (which GCC recorded in its symbol table). To specify one or more additional directories containing source code, start GDB using one or more -d dirname options, as this example illustrates: $ gdb -d /source/project1 -d /oldsource/project1 -d /home/b ubba/src killerapp
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Chapter 29 . Programming Tools and Utilities 813 (Linux web host)

December 23rd, 2007

Chapter 29 . Programming Tools and Utilities 813 GDB also can tell you the types of variables using the whatis command. GDB s whatis command is comparable to the man -f command, which searches the whatis database of system commands for short descriptions of those system commands (the manual page whatis database is totally separate from the whatis command used by GDB). While man s whatis database works on system commands, GDB s whatis command describes the types of variables and other data structures used in a program. (gdb) whatis i type = int (gdb) whatis ary type = int * (gdb) whatis index_to_the_moon type = void (int *) This feature may seem rather useless because, of course, you know the types of all the variables in your program (yeah, right!). But, you will change your mind the first time you have to debug someone else s code or have to fix a multi-file project for which you haven t seen the source files for a couple of months. The whatis command can also help you track down bugs that result from assigning an inappropriate value to a variable. Setting Breakpoints As you debug problematic code, it is often useful to halt execution at some point. Perhaps you want to stop execution before the code enters a section that is known to have problems. In other cases, you can set breakpoints so you can look at the values of certain variables at a given point in the execution flow. In still other situations, you might find it useful to stop execution so you can step through the code one instruction at a time. GDB enables you to set breakpoints on several different kinds of code constructs, including line numbers and function names, and also enables you to set conditional breakpoints, where the code stops only if a certain condition is met. To set a breakpoint on a line number, use the following syntax: (gdb) break linenum To stop execution when the code enters a function, use the following: (gdb) break funcname In either case, GDB halts execution before executing the specified line number or entering the specified function. You can then use print to display variable values, for example, or use list to review the code that is about to be executed. If you have a multi-file project and want to halt execution on a line of code or in a function that is not in the current source file, use the following forms:
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Web hosting directory - 812 Part VI . Programming in Linux where

December 22nd, 2007

812 Part VI . Programming in Linux where it crashes on your system depends on several variables. Those variables could include the system s memory layout, the process s memory space (especially the kernel s stack space), the amount of available memory on your system, and other factors. The result of the second command (print ary[i]) makes it pretty clear that the program does not have access to the memory location specified, although it does have legal access to the preceding one. The expression $1 is an alias that refers to an entry in GDB s value history. GDB creates value history entries for each command you type that produces computed results. The alias numbers increment sequentially each time you execute a command that produces some sort of computed output. As a result, you can access these computed values using aliases rather than retyping the command. For example, the command $1-5 produces the following: (gdb) print $1-5 $2 = 719 Notice that the alias incremented to $2. If you later need to use the value 719, you can use the alias $2. The value history is reset each time you start GDB and the values are not accessible outside of GDB. You are not limited to using discrete values because gdb can display the addresses of data stored in an arbitrary region of memory. For example, to print the first 10 memory locations associated with ary, use the following command: (gdb) print ary@10 $3 = {0xbffffc90, 0×40015580, 0×400115800, 0×0, 0×1, 0×2, 0c3, 0×4, 0×5} The notation @10 means to print the 10 values that begin at ary. Say, on the other hand, that you want to print the five values stored in ary beginning with the first element. The command for this would be the following: (gdb) print ary[1]@5 $4 = {1, 2, 3, 4, 5} Why go to the trouble of printing variable or array values? Although it isn t necessary in this particular example because you know where the trouble occurs, it is often necessary to see the value of a variable at a particular point in a program s execution so you monitor what is happening to variables. In the case of arrays, a command that prints the values in an array, such as print ary[1]@5 in the preceding example, enables you to confirm at a glance the values are what you expect them to be. If the values don t match up with your expectations, however, that is a clue that some code is altering the array in a way you didn t intend. As a result, you can focus your bug hunting on a specific section of code.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Web proxy server - Chapter 29 . Programming Tools and Utilities 811

December 22nd, 2007

Chapter 29 . Programming Tools and Utilities 811 function was index_to_the_moon(), so, somewhere in the function, the segmentation fault occurred. Incidentally, the backtrace also shows that index_to_the_ moon() was called from line 15 of the main() function in debugme.c. It s not necessary to type complete command names while using GDB. Any sufficiently unique abbreviation works. For example, back suffices for backtrace. It would be helpful, however, to have some idea of the context in which the offending line(s) of code exist. For this purpose, use the list command, which takes the general form, list [m,n], where m and n are the starting and ending line numbers you want displayed. For example: (gdb) list 10,32 would display code lines 10 through 32. A bare list command displays 10 lines of code that includes the line where the error was first detected, as illustrated here: (gdb) list 15 index_to_the_moon(intary); 16 17 exit(EXIT_SUCCESS); 18 } 19 20 void index_to_the_moon(int ary[]) 21 { 22 int i; 23 for (i = 0; i < BIGNUM; ++I { 24 ary[i] = i; Examining Data One of GDB s most useful features is its ability to display both the type and the value of almost any expression, variable, or array in the program being debugged. It can print the value of any expression legal in the language in which your program is written. The command is, predictably enough, print. Here are a couple of print commands and their results: (gdb) print i $1 = 724 (gdb) print ary[i] Cannot access memory at address 0xc0000000. This example continues the earlier examples of debugging debugme.c because you are still trying to identify where and why debug me crashed. Although in this example, the program crashed at the point when the counter variable i equaled 724 (the expression $1 refers to an entry in GDB s value history, explained in a moment), Tip
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

810 Part VI . Programming in Linux After (Bulletproof web design)

December 21st, 2007

810 Part VI . Programming in Linux After you load the program and its core dump into the debugger, run the program in the debugger. To do so, type the command run at the GDB command prompt, (gdb), as the following example shows: (gdb) run Starting program: /home/kwall/code/debugme Program received signal SIGSEGV, Segmentation fault. 0×0804483db in index_to_the_moon (ary=0xbffff4b0) at debugme.c:24 24 ary[i] = i; This short output listing shows that the segmentation fault occurred in the function index_to_the_moon at line 24 of debugme.c. Notice the last line of the output; GDB displays the line of code, prefixed with the line number (24), where the segmentation fault occurred. It also shows the memory address (in hexadecimal format) at which the fault occurred, 0xbffff4b0. You can pass any arguments to the run command that your program would ordinarily accept. GDB also creates a full shell environment in which to run the program. Ordinarily, GDB uses the value of the environment variable $SHELL to create the simulated environment. If you want, however, you can use GDB s set and unset commands to set or unset arguments and environment variables before you use the run command to run the program in the debugger. To set command-line arguments to pass to the program, type set args arg1 arg2, where arg1 and arg2 (or any number of arguments) are options and arguments the program being debugged expects. Use set environment env1 env2 to set environment variables (again, env1 and env2 are placeholders for the environment variables you want to set or unset). Inspecting Code in the Debugger What is happening in the function index_to_the_moon that s causing the error? You can execute the backtrace (or bt or back) command to generate the function tree that led to the segmentation fault. The backtrace doesn t usually show you what the problem is, but it does show you more precisely where the problem occurred. Here s how the function trace for the example looks on my system: (gdb) backtrace #0 0×080483db index_to_the_moon (ary=0×7ffffc90) at debugme.c:24 #1 0×080483a6 in main (argc=104,argv=0×69) at debugme.c:15 A backtrace shows the chain of function calls that resulted in the error. The backtrace starts with the most recently called function index_to_the moon() in this case which resides at the hexadecimal memory address shown in the second column of the display (0×0800483db). The function index_to_the_moon()was called by the main() function. As you can see from the output, the most recently called
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.