Creating a Collection

A collection is a stored search that can later be accessed anytime you like. From the Add New pull-down menu, choose Collection. The Add Collection dialog shown in Figure 8-20 will be displayed. Notice that many of the fields are the same as those that appear in the Add a Page dialog. Enter a title, a description, and body text as before. Below those fields are some options unique to the Collection type. The first set of fields is related to limiting search results, as shown in Figure 8-21. If...

Data Types and Identifiers

Python provides a rich collection of data types to enable programmers to perform virtually any programming task they desire in another language. One nice thing about Python is that it provides many useful and unique data types (such as tuples and dictionaries), and stays away from data types such as the pointers used in C, which have their use but can also make programming much more confusing and difficult for the nonprofessional programmer. Python is known as a dynamically typed language,...

Downloading the MySQL Community Server

In a web browser, navigate to http dev.mysql.com downloads. You will see a screen like the one shown in Figure B-1. Click the MySQL Community Server link on the sidebar on the left. After you are taken to the next page, you can scroll down to see a list of operating systems, as shown in Figure B-2. Linux (non RPM, Intel C C++ compiled, glibc-2.3) Red Hat Enterprise Linux 3 RPM.-(-xS6) Red Hat Enterprise Linux 3 RPM (AMD64 Intel EM64T) Red Hat Enterprise Linux 3 RPM (Intel IA64) Red Hat...

Exporting the List of DVDs to a CSV File

Often, it can be useful to have a list of the items in your database in a comma-separated value (CSV) file. If you type 5 and press Enter to do that, you'll get the following prompt Enter base filename (will be given a .csv extension) Type a base filename (the part before the extension) and press Enter. For example, if I decided to name my csv file jimsdvds.csv, I would type jimsdvds and press Enter. I'd then get the following output Enter base filename (will be given a .csv extension) jimsdvds...

How This Book Is Structured

This book is framed around the code itself. This is because developers are typically looking for how to do something and, as with many activities, you learn how to do something by watching how others do it and trying it yourself. If you want to know how a for loop works, you'll find for loops in my code, but that's not the thrust of the book. Instead, this book shows you how to do things how to build a content management system, how to build a test management system, how to set up a system for...

Obtaining Python and Installing It

If you go to www.python.org download you can find links to download the correct version of Python for your operating system. Follow the install instructions for your particular Python distribution instructions can vary significantly depending on what operating system you' re installing to. Although the examples in this book should work for any Python version above 2.0, it is best to install the latest stable build for your operating system. For Windows (which is the environment I primarily work...

Running the Install

After the download completes, the Welcome screen of the Setup Wizard will appear, as shown in Figure B-5. j MySQL Server 5.0 - Setup Wizard Is gJ Welcome to the Setup Wizard for MySQL Server 5.0 The Setup Wizard will install MySQL Server 5.0 release 5,0.51a on your computer. To continuej click Next. WARNING This program is protected by copyright law, Click Next. Figure B-6 shows the Setup Type dialog that will appear, from which you can select the appropriate install type. MySQL Server 5.0 -...

Running the Performance Profiler Client

You can find this application on the Wrox website (www.wrox.com). To run the client, simply type the following python webperf.py. When you do, you'll be presented with the following menu 1 - Test client connection to external web sites 2 - Test internal web server performance You have four options Connect to external websites and observe the performance from your client machine connect to internal Python web servers to observe internal HTTP network performance display the log file in Notepad...

The termios Module Access Unix Style TTY Interface

The termios module provides an interface to tty I O control. For a complete description ofthese calls, see the Linux or Unix manual pages. It is only available for those Unix versions that support POSIX termios style tty I O control. All functions in this module take a file descriptor as their first argument. This can be an integer, such as what is contained in sys.stdin.fileno(), or a file object, such as sys.stdin itself. The following example shows the termios module being used to accept a...

Using the Program

The program is available for download at www.wrox.com. To run it, simply go to a command prompt, and from the directory on your system where the Chapter 2 program files are located, type python dvd.py. This will bring up a menu like the one shown here This will bring up a menu like the one shown here From here, as you can see, you can add a DVD to the database, search the inventory for DVDs based on search criteria, modify fields in a DVD record, delete a DVD record, export the list of DVDs to...

Installing Apache

Apache is the most popular web server on the Internet. It is available for multiple operating systems, including Windows and Linux. Although Apache itself is extremely customizable, the installation of the web server is fairly straightforward. Although the examples in this chapter are all based on Windows including the installs , installation on Linux UNIX is fairly straightforward, and the instructions here can still be used as a basic guide to the order of install steps. Note also that the...

Running the Debugger

The Python debugger can be utilized in several different ways The pdb module is the Python debugger. You can access it by importing it directly either in a script or in the Python console With the debugger module imported, you then have access to many different functions for debugging. This is especially useful if you import the module from Python's interactive interpreter, so let's look at an example of doing that now. Download the supplemental code from the website for Chapter 10. From that...

Generating an HTML Test Report

If you type 4 and press Enter to generate an HTML test report, you'll get the following screen Type the date of an existing test run and press Enter. After the report is generated, you will see the following status displayed on the screen Enter the date of the test run in the following format '01-01-2008' 01-14-2008 -- HTML Report Generated -Press Enter to continue The report is stored in the test_report_html directory under the program directory, and is saved as mm - dd-yyyy.html. In other...

Downloading the Win All Package

Python For Windows Extensions

Win32All requires that Python minimum version 2.2 already be installed on a Windows system. In a web browser, navigate to You will see the Python for Windows Extensions window shown in Figure B-14. Click the Download the Python for Windows Extensions link. Scroll down the page to the section that is shown in Figure B-15. Notice that downloads are available for versions of Python from 2.2 through 2.6. Click the appropriate link for the version of Python you have installed and you'll get a prompt...

Running the Program Command Line Syntax

You can get to the program by navigating to the directory corresponding to this chapter. Once again, the files are available for download from the website www.wrox.com . To run the application, simply go to a command prompt, and from the directory on your system where the Chapter 7 program files are located, type the following python version_checker.py lt ip address gt lt applications gt Telnet is an Internet protocol used on Internet or Local Area Network LAN networks. Basically, Telnet...

The winreg Module Manipulate the Windows Registry

The Windows Registry is a database that contains program and system information and settings. Often it can be useful to access the Registry to read from it or write to it via a script. The winreg module makes this easy to do in Python. The following example queries a particular key in the Registry and outputs all the subkeys for that key list values owned by this registry key name, value, type _winreg.EnumValue explorer, i print repr name , i 1 The following is the output for this program I...

The winsound Module

The winsound module enables a script to access the sound-playing functionality of Windows platforms. It includes functions and several built-in constants. The module enables a script to play Windows system sounds or WAV files. The following example shows how to play various sounds with the winsound module import winsound print Play Windows exit sound. winsound.SND_ALIAS print Probably play Windows default sound winsound.PlaySound , winsound.SND_ALIAS print Play a message beep...