30670 Slices
Medium 9780596006105

C. GNU Free Documentation License—GNU Project—Free Software Foundation (FSF)

Robert Mecklenburg O'Reilly Media ePub

Version 1.2, November 2002

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

See All Chapters
Medium 9780596005535

Hack #33. Connecting to TiVo Serially

Raffi Krikorian O'Reilly Media ePub

With your TiVo offering a Bash shell prompt over its serial port, let's tap your computer into that flow of bits.

With Bash-over-serial [Hack #30] enabled, your TiVo is spitting bits over its serial port into the ether, just waiting for someone to access its Bash prompt. Your mission, if you choose to accept it, is to get those bits to your computer. Go on, you've already done the hard bits.

On the back of your TiVo is a port labeled "serial," which is just about, but not quite, like the RS-232 serial ports on the back of a PC. The only real difference is the connector; rather than a standard serial port, TiVo's resembles a headphone jack.

For some of you, TiVo's serial port might already be in use, to connect your TiVo unit to a cable box or satellite receiver. Unfortunately, you can't use the port simultaneously for both purposes. You can enable the prompt when you want to get access, and disable it later, but that can get to be a real hassle. There are other ways in; take a gander at [Hack #49].

See All Chapters
Medium 9780596005658

A. System Startup

Daniel P. Bovet O'Reilly Media ePub

This appendix explains what happens right after users switch on their computersthat is, how a Linux kernel image is copied into memory and executed. In short, we discuss how the kernel, and thus the whole system, is "bootstrapped."

Traditionally, the term bootstrap refers to a person who tries to stand up by pulling his own boots. In operating systems, the term denotes bringing at least a portion of the operating system into main memory and having the processor execute it. It also denotes the initialization of kernel data structures, the creation of some user processes, and the transfer of control to one of them.

Computer bootstrapping is a tedious, long task, because initially, nearly every hardware device, including the RAM, is in a random, unpredictable state. Moreover, the bootstrap process is highly dependent on the computer architecture; as usual in this book, we refer to the 80 86 architecture.

The moment after a computer is powered on, it is practically useless because the RAM chips contain random data and no operating system is running. To begin the boot, a special hardware circuit raises the logical value of the RESET pin of the CPU. After RESET is asserted, some registers of the processor (including cs and eip) are set to fixed values, and the code found at physical address 0xfffffff0 is executed. This address is mapped by the hardware to a certain read-only, persistent memory chip that is often called Read-Only Memory (ROM). The set of programs stored in ROM is traditionally called the Basic Input/Output System (BIOS) in the 80 86 architecture, because it includes several interrupt-driven low-level procedures used by all operating systems in the booting phase to handle the hardware devices that make up the computer. Some operating systems, such as Microsoft's MS-DOS , rely on BIOS to implement most system calls.

See All Chapters
Medium 9780596526740

3. Data Munging

Chromatic O'Reilly Media ePub

Hacks 19-27

Perl has always been in love with data. No matter where you find it, Perl happily processes and extracts and reports on files, databases, web pages, spreadsheets, other programs, and anything that produces data. Perl's so happy to do this that it even overlooks brute-force, rough manipulations. Hey, pragmatism works!

Perl can be gentle, too. A little subtlety, a little style and finesse, and you can write maintainable, easy-to-understand code that's just as powerful as the wild-eyed forge-ahead-at-all-costs just-do-the-job code. Why? It's often faster and more correctas well as more secure, more powerful, and shorter.

Sure, slinging data between sources sounds about as glamorous as slinging hash at the local diner, but it doesn't have to be that way. Here are several ideas to munge that yummy data with all of the elegance and style and power and clarity that you know you have.

Pretend a big stream of data on disk is a nice, malleable Perl data structure.

One of the big disappointments in programming is realizing that, although you can think of a text file as a long list of properly terminated lines, to the computer, it's just a big blob of ones and zeroes. If all you need to do is read the lines of a file and process them in order, you're fine. If you have a big file that you can't load into memory and can't process each line in order...well, good luck.

See All Chapters
Medium 9780596007973

14. Web Programming

Martelli, Alex O'Reilly Media ePub

Credit: Andy McKay

The Web has been a key technology for many years now, and it has become unusual to develop an application that doesn't involve some aspects of the Web. From showing a help file in a browser to using web services, the Web has become an integral part of most applications.

I came to Python through a rather tortuous path of ASP (Active Server Pages), then Perl, some Zope, and then Python. Looking back, it seems strange that I didn't find Python earlier, but the dominance of Perl and ASP (and later PHP) in this area makes it difficult for new developers to see the advantages of Python shining through all the other languages.

Unsurprisingly, Python is an excellent language for web development, and, as a batteries included language, Python comes with most of the modules you need. The relatively recent inclusion of xmlrpclib in the Python Standard Library is a reassuring indication that batteries continue to be added as the march of technology requires, making the standard libraries even more useful. One of the modules I often use is urllib, which demonstrates the power of a simple, well-designed modulesaving a file from the Web in two lines (using urlretrieve) is easy. The cgi module is another example of a module that has enough functionality to work with, but not too much to make your scripts slow and bloated.

See All Chapters

See All Slices