Learning Perl, 6th Edition

Chapter 1 : Introduction

Questions and Answers
What Does “Perl” Stand For?
How Can I Get Perl?
How Do I Make a Perl Program?
A Whirlwind Tour of Perl
Exercises

Chapter 2 : Scalar Data

Numbers
Strings
Perl’s Built-in Warnings
Scalar Variables
Output with print
The if Control Structure
Getting User Input
The chomp Operator
The while Control Structure
The undef Value
The defined Function
Exercises

Chapter 3 : Lists and Arrays

Accessing Elements of an Array
Special Array Indices
List Literals
List Assignment
Interpolating Arrays into Strings
The foreach Control Structure
Scalar and List Context
in List Context
Exercises

Chapter 4 : Subroutines

Defining a Subroutine
Invoking a Subroutine
Return Values
Arguments
Private Variables in Subroutines
Variable-Length Parameter Lists
Notes on Lexical (my) Variables
The use strict Pragma
The return Operator
Non-Scalar Return Values
Persistent, Private Variables
Exercises

Chapter 5 : Input and Output

Input from Standard Input
Input from the Diamond Operator
The Invocation Arguments
Output to Standard Output
Formatted Output with printf
Filehandles
Opening a Filehandle
Fatal Errors with die
Using Filehandles
Reopening a Standard Filehandle
Output with say
Filehandles in a Scalar
Exercises

Chapter 6 : Hashes

What Is a Hash?
Hash Element Access
Hash Functions
Typical Use of a Hash
The %ENV hash
Exercises

Chapter 7 : In the World of Regular Expressions

What Are Regular Expressions?
Using Simple Patterns
Character Classes
Exercises

Chapter 8 : Matching with Regular Expressions

Matches with m//
Match Modifiers
Anchors
The Binding Operator =~
Interpolating into Patterns
The Match Variables
General Quantifiers
Precedence
A Pattern Test Program
Exercises

Chapter 9 : Processing Text with Regular Expressions

Substitutions with s///
The split Operator
The join Function
m// in List Context
More Powerful Regular Expressions
Exercises

Chapter 10 : More Control Structures

The unless Control Structure
The until Control Structure
Expression Modifiers
The Naked Block Control Structure
The elsif Clause
Autoincrement and Autodecrement
The for Control Structure
Loop Controls
The Conditional Operator ?:
Logical Operators
Exercises

Chapter 11 : Perl Modules

Finding Modules
Installing Modules
Using Simple Modules
Exercises

Chapter 12 : File Tests

File Test Operators
The stat and lstat Functions
The localtime Function
Bitwise Operators
Exercises

Chapter 13 : Directory Operations

Moving Around the Directory Tree
Globbing
An Alternate Syntax for Globbing
Directory Handles
Recursive Directory Listing
Manipulating Files and Directories
Removing Files
Renaming Files
Links and Files
Making and Removing Directories
Modifying Permissions
Changing Ownership
Changing Timestamps
Exercises

Chapter 14 : Strings and Sorting

Finding a Substring with index
Manipulating a Substring with substr
Formatting Data with sprintf
Advanced Sorting
Exercises

Chapter 15 : Smart Matching and given-when

The Smart Match Operator
Smart Match Precedence
The given Statement
Using when with Many Items
Exercises

Chapter 16 : Process Management

The system Function
The Environment Variables
The exec Function
Using Backquotes to Capture Output
External Processes with IPC::System::Simple
Processes as Filehandles
Getting Down and Dirty with Fork
Sending and Receiving Signals
Exercises

Chapter 17 : Some Advanced Perl Techniques

Slices
Trapping Errors
Picking Items from a List with grep
Transforming Items from a List with map
Fancier List Utilities
Exercises

Appendix : Beyond the Llama
Further Documentation
Regular Expressions
Packages
Extending Perl’s Functionality
Databases
Other Operators and Functions
Mathematics
Lists and Arrays
Bits and Pieces
Formats
Networking and IPC
Security
Debugging
Command-Line Options
Built-in Variables
Syntax Extensions

References
Tied Variables
Operator Overloading
Dynamic Loading
Embedding
Converting Other Languages to Perl
Converting find Command Lines to Perl
Command-Line Options in Your Programs
Embedded Documentation
More Ways to Open Filehandles
Threads and Forking
Graphical User Interfaces (GUIs)
And More…

Appendix : A Unicode Primer

Unicode
UTF-8 and Friends
Getting Everyone to Agree
Fancy Characters
Dealing with Unicode in Perl
Further Reading

Colophon

C++ In a Nutshell

Chapter 1 : Language Basics

-Compilation Steps
-Tokens
-Comments
-Character Sets
-Alternative Tokens
-Trigraphs

Chapter 2 : Declarations

-Declarations and Definitions
-Scope
-Name Lookup
-Linkage
-Type Declarations
-Object Declarations
-Namespaces

Chapter 3 : Expressions

-Lvalues and Rvalues
-Type Conversions
-Constant Expressions
-Expression Evaluation
-Expression Rules

Chapter 4 : Statements

-Expression Statements
-Declarations
-Compound Statements
-Selections
-Loops
-Control Statements
-Handling Exceptions

Chapter 5 : Functions

-Function Declarations
-Function Definitions
-Function Overloading
-Operator Overloading
-The main Function

Chapter 6 : Classes

-Class Definitions
-Data Members
-Member Functions
-Inheritance
-Access Specifiers
-Friends
-Nested Types

Chapter 7 : Templates

-Overview of Templates
-Template Declarations
-Function Templates
-Class Templates
-Specialization
-Partial Specialization
-Instantiation
-Name Lookup
-Tricks with Templates
-Compiling Templates

Chapter 8 : Standard Library

-Overview of the Standard Library
-C Library Wrappers
-Wide and Multibyte Characters
-Traits and Policies
-Allocators
-Numerics

Chapter 9 : Input and Output

-Introduction to I/O Streams
-Text I/O
-Binary I/O
-Stream Buffers
-Manipulators
-Errors and Exceptions

Chapter 10 : Containers, Iterators, and Algorithms

-Containers
-Iterators
-Algorithms

Chapter 11 : Preprocessor Reference

Chapter 12 : Language Reference

Chapter 13 : Library Reference

Appendix A : Compiler Extensions

-Borland C++ Builder and Kylix
-GNU Compiler Collection
-Microsoft Visual C++

Appendix B : Projects

-Blitz++
-Boost
-STLport

C++ Cookbook


Chapter 1 : Building C++ Applications

-Introduction to Building
-Obtaining and Installing GCC
-Building a Simple “Hello, World” Application from the Command Line
-Building a Static Library from the Command Line
-Building a Dynamic Library from the Command Line
-Building a Complex Application from the Command Line
-Installing Boost.Build
-Building a Simple “Hello, World” Application Using Boost.Build
-Building a Static Library Using Boost.Build
-Building a Dynamic Library Using Boost.Build
-Building a Complex application Using Boost.Build
-Building a Static Library with an IDE
-Building a Dynamic Library with an IDE
-Building a Complex Application with an IDE
-Obtaining GNU make
-Building A Simple “Hello, World” Application with GNU make
-Building a Static Library with GNU Make
-Building a Dynamic Library with GNU Make
-Building a Complex Application with GNU make
-Defining a Macro
-Specifying a Command-Line Option from Your IDE
-Producing a Debug Build
-Producing a Release Build
-Specifying a Runtime Library Variant
-Enforcing Strict Conformance to the C++ Standard
-Causing a Source File to Be Linked Automatically Against a Specified Library
-Using Exported Templates

Chapter 2 : Code Organization

-Introduction
-Making Sure a Header File Gets Included Only Once
-Ensuring You Have Only One Instance of a Variable Across Multiple Source Files
-Reducing #includes with Forward Class Declarations
-Preventing Name Collisions with Namespaces
-Including an Inline File

Chapter 3 : Numbers

-Introduction
-Converting a String to a Numeric Type
-Converting Numbers to Strings
-Testing Whether a String Contains a Valid Number
-Comparing Floating-Point Numbers with Bounded Accuracy
-Parsing a String Containing a Number in Scientific Notation
-Converting Between Numeric Types
-Getting the Minimum and Maximum Values for a Numeric Type

Chapter 4 : Strings and Text

-Introduction
-Padding a String
-Trimming a String
-Storing Strings in a Sequence
-Getting the Length of a String
-Reversing a String
-Splitting a String
-Tokenizing a String
-Joining a Sequence of Strings
-Finding Things in Strings
-Finding the nth Instance of a Substring
-Removing a Substring from a String
-Converting a String to Lower- or Uppercase
-Doing a Case-Insensitive String Comparison
-Doing a Case-Insensitive String Search
-Converting Between Tabs and Spaces in a Text File
-Wrapping Lines in a Text File
-Counting the Number of Characters, Words, and Lines in a Text File
-Counting Instances of Each Word in a Text File
-Add Margins to a Text File
-Justify a Text File
-Squeeze Whitespace to Single Spaces in a Text File
-Autocorrect Text as a Buffer Changes
-Reading a Comma-Separated Text File
-Using Regular Expressions to Split a String

Chapter 5 : Dates and Times

-Introduction
-Obtaining the Current Date and Time
-Formatting a Date/Time as a String
-Performing Date and Time Arithmetic
-Converting Between Time Zones
-Determining a Day’s Number Within a Given Year
-Defining Constrained Value Types

Chapter 6 : Managing Data with Containers

-Introduction
-Using vectors Instead of Arrays
-Using vectors Efficiently
-Copying a vector
-Storing Pointers in a vector
-Storing Objects in a list
-Mapping strings to Other Things
-Using Hashed Containers
-Storing Objects in Sorted Order
-Storing Containers in Containers

Chapter 7 : Algorithms

-Introduction
-Iterating Through a Container
-Removing Objects from a Container
-Randomly Shuffling Data
-Comparing Ranges
-Merging Data
-Sorting a Range
-Partitioning a Range
-Performing Set Operations on Sequences
-Transforming Elements in a Sequence
-Writing Your Own Algorithm
-Printing a Range to a Stream

Chapter 8 : Classes

-Introduction
-Initializing Class Member Variables
-Using a Function to Create Objects (a.k.a. Factory Pattern)
-Using Constructors and Destructors to Manage Resources (or RAII)
-Automatically Adding New Class Instances to a Container
-Ensuring a Single Copy of a Member Variable
-Determining an Object’s Type at Runtime
-Determining if One Object’s Class Is a Subclass of Another
-Giving Each Instance of a Class a Unique Identifier
-Creating a Singleton Class
-Creating an Interface with an Abstract Base Class
-Writing a Class Template
-Writing a Member Function Template
-Overloading the Increment and Decrement Operators
-Overloading Arithmetic and Assignment Operators for Intuitive Class Behavior
-Calling a Superclass Virtual Function

Chapter 9 : Exceptions and Safety

-Introduction
-Creating an Exception Class
-Making a Constructor Exception-Safe
-Making an Initializer List Exception-Safe
-Making Member Functions Exception-Safe
-Safely Copying an Object

Chapter 10 : Streams and Files

-Introduction
-Lining Up Text Output
-Formatting Floating-Point Output
-Writing Your Own Stream Manipulators
-Making a Class Writable to a Stream
-Making a Class Readable from a Stream
-Getting Information About a File
-Copying a File
-Deleting or Renaming a File
-Creating a Temporary Filename and File
-Creating a Directory
-Removing a Directory
-Reading the Contents of a Directory
-Extracting a File Extension from a String
-Extracting a Filename from a Full Path
-Extracting a Path from a Full Path and Filename
-Replacing a File Extension
-Combining Two Paths into a Single Path

Chapter 11 : Science and Mathematics

-Introduction
-Computing the Number of Elements in a Container
-Finding the Greatest or Least Value in a Container
-Computing the Sum and Mean of Elements in a Container
-Filtering Values Outside a Given Range
-Computing Variance, Standard Deviation, and Other Statistical Functions
-Generating Random Numbers
-Initializing a Container with Random Numbers
-Representing a Dynamically Sized Numerical Vector
-Representing a Fixed-Size Numerical Vector
-Computing a Dot Product
-Computing the Norm of a Vector
-Computing the Distance Between Two Vectors
-Implementing a Stride Iterator
-Implementing a Dynamically Sized Matrix
-Implementing a Constant-Sized Matrix
-Multiplying Matricies
-Computing the Fast Fourier Transform
-Working with Polar Coordinates
-Performing Arithmetic on Bitsets
-Representing Large Fixed-Width Integers
-Implementing Fixed-Point Numbers

Chapter 12 : Multithreading

-Introduction
-Creating a Thread
-Making a Resource Thread-Safe
-Notifying One Thread from Another
-Initializing Shared Resources Once
-Passing an Argument to a Thread Function

Chapter 13 : Internationalization

-Introduction
-Hardcoding a Unicode String
-Writing and Reading Numbers
-Writing and Reading Dates and Times
-Writing and Reading Currency
-Sorting Localized Strings

Chapter 14 : XML

-Introduction
-Parsing a Simple XML Document
-Working with Xerces Strings
-Parsing a Complex XML Document
-Manipulating an XML Document
-Validating an XML Document with a DTD
-Validating an XML Document with a Schema
-Transforming an XML Document with XSLT
-Evaluating an XPath Expression
-Using XML to Save and Restore a Collection of Objects

Chapter 15 : Miscellaneous

-Introduction
-Using Function Pointers for Callbacks
-Using Pointers to Class Members
-Ensuring That a Function Doesn’t Modify an Argument
-Ensuring That a Member Function Doesn’t Modify Its Object
-Writing an Operator That Isn’t a Member Function
-Initializing a Sequence with Comma-Separated Values

Learning Unix for OS X Mountain Lion

Chapter 1 : Why Use Unix?

-The Power of Unix
-Folders or Directories?
-Thousands of Free Applications
-Commands Included with Unix
-A Simple Guided (Unix) Tour

Chapter 2 : Using the Terminal

-Launching the Terminal
-Customizing Your Terminal Session
-Working with the Terminal
-Customizing the Shell Environment
-Advanced Shell Customization
-The Unresponsive Terminal

Chapter 3 : Exploring the Filesystem

-The OS X Filesystem
-Listing Files and Directories
-Calculating File Size and Disk Space
-Protecting and Sharing Files
-Changing Your Password
-Superuser Privileges with sudo
-Exploring External Volumes

Chapter 4 : File Management

-File and Directory Names
-File and Directory Wildcards
-Looking Inside Files
-Creating and Editing Files
-Managing Files

Chapter 5 : Finding Files and Information

-The Oddly Named grep Command
-Finding Files with locate
-Using find to Explore Your Filesystem
-Shining a Light on Spotlight

Chapter 6 : Redirecting I/O

-Standard Input and Standard Output
-Pipes and Filters
-Printing

Chapter 7 : Multitasking

-Running a Command in the Background
-Checking on a Process
-Canceling a Process
-Launching GUI Applications

Chapter 8 : Taking Unix Online

-Remote Logins
-Transferring Files

Chapter 9 : Of Windows and X11

-X11
-GIMP, the X11 Graphics Editor

Chapter 10 : Where to Go from Here

-Documentation
-Customizing Your Unix Experience