This document provides an introduction to the Python programming language. It discusses Python's easy to learn syntax and powerful data structures. The document contains tutorials on Python's basic concepts like data types, control flow, functions, modules and exceptions. It also covers more advanced topics like object oriented programming with classes, inheritance and generators. The goal is to help readers write Python modules and programs and learn more about its extensive standard library.
Red Hat Enterprise Linux 4: Introduction to System Administration is a documentation guide that covers:
1. The philosophy of system administration including automating tasks, documenting processes, communicating with users, understanding resources and security.
2. Resource monitoring on Linux systems using tools like free, top, vmstat and the Sysstat suite to monitor CPU, memory, storage and bandwidth usage.
3. Managing bandwidth and processing power on Linux including monitoring techniques in Red Hat Enterprise Linux and improving performance by addressing bottlenecks.
This document provides an overview of reviewing and customizing your hosting package in Plesk:
- View resource allotments such as IP address, SSL certificate, disk space quota, and permissions.
- Customize your control panel interface by selecting an interface language and theme, and adding custom buttons.
- Review physical hosting settings including IP address, SSL support, FTP credentials, and disk space quota.
- Manage permissions for server access via Remote Desktop.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
Perl <b>5 Tutorial</b>, First Editiontutorialsruby
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document provides a user guide for the Trace File Analyzer Collector (TFA Collector). It describes TFA Collector's architecture and components, how to install, patch, and uninstall it, how to control and manage TFA using the tfactl command line tool, how to perform diagnostic collections both automatically and on demand, and how to use TFA to collect data from Exadata storage servers. The document also covers data redaction, troubleshooting TFA, and known issues.
This document provides an introduction to the Python programming language. It discusses Python's easy-to-learn and powerful features such as its efficient data structures and object-oriented approach. The document also covers Python's syntax, dynamic typing, scripting capabilities, extensive standard library, and ability to be extended via C/C++. It is intended to introduce readers to Python's basic concepts and features in an informal manner.
The document is a reference manual for the BASIC programming language. It describes the BASIC language elements, data types, variables, expressions, operators, commands, and functions. The manual provides details on the syntax and usage of these different components of the BASIC language to help programmers write and troubleshoot BASIC programs.
The document provides a quick introduction to the Perl scripting language. It discusses variables including scalars, arrays, hashes, and references. It also covers basic concepts like conditionals, subroutines, string manipulation, modules/packages, object-oriented programming, and debugging in Perl. The goal is to enable readers to quickly learn Perl fundamentals and become proficient at writing simple programs.
Red Hat Enterprise Linux 4: Introduction to System Administration is a documentation guide that covers:
1. The philosophy of system administration including automating tasks, documenting processes, communicating with users, understanding resources and security.
2. Resource monitoring on Linux systems using tools like free, top, vmstat and the Sysstat suite to monitor CPU, memory, storage and bandwidth usage.
3. Managing bandwidth and processing power on Linux including monitoring techniques in Red Hat Enterprise Linux and improving performance by addressing bottlenecks.
This document provides an overview of reviewing and customizing your hosting package in Plesk:
- View resource allotments such as IP address, SSL certificate, disk space quota, and permissions.
- Customize your control panel interface by selecting an interface language and theme, and adding custom buttons.
- Review physical hosting settings including IP address, SSL support, FTP credentials, and disk space quota.
- Manage permissions for server access via Remote Desktop.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
Perl <b>5 Tutorial</b>, First Editiontutorialsruby
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document provides a user guide for the Trace File Analyzer Collector (TFA Collector). It describes TFA Collector's architecture and components, how to install, patch, and uninstall it, how to control and manage TFA using the tfactl command line tool, how to perform diagnostic collections both automatically and on demand, and how to use TFA to collect data from Exadata storage servers. The document also covers data redaction, troubleshooting TFA, and known issues.
This document provides an introduction to the Python programming language. It discusses Python's easy-to-learn and powerful features such as its efficient data structures and object-oriented approach. The document also covers Python's syntax, dynamic typing, scripting capabilities, extensive standard library, and ability to be extended via C/C++. It is intended to introduce readers to Python's basic concepts and features in an informal manner.
The document is a reference manual for the BASIC programming language. It describes the BASIC language elements, data types, variables, expressions, operators, commands, and functions. The manual provides details on the syntax and usage of these different components of the BASIC language to help programmers write and troubleshoot BASIC programs.
The document provides a quick introduction to the Perl scripting language. It discusses variables including scalars, arrays, hashes, and references. It also covers basic concepts like conditionals, subroutines, string manipulation, modules/packages, object-oriented programming, and debugging in Perl. The goal is to enable readers to quickly learn Perl fundamentals and become proficient at writing simple programs.
Plesk 8.2 for Linux/Unix Domain Administrator's Guidewebhostingguy
1. Click on the "Domain Administrator" option in the navigation pane.
2. On the "Domain Administrator" page, select your preferred language and skin from the dropdown menus.
3. Click "OK" to save the changes and customize the interface language and theme of your control panel.
This document is a user manual for the GNU Gatekeeper (GnuGk) that explains how to compile, install, configure and monitor it. The document contains sections on installation, basic configuration, routing, RAS configuration, authentication, and accounting. It is maintained by Jan Willamowius and is currently at version 2.3.2 from May 2010.
This document outlines the goals and requirements for Project 3, which involves writing a kernel from scratch. It discusses hardware primitives, the boot process, device drivers, context switching, scheduling, system calls, building and loading user programs, the programming environment, hints for implementing a kernel, and debugging strategies. The project involves implementing an operating system kernel that supports interrupts, scheduling, and basic system calls.
This document provides an overview of a project that aims to predict airfares for flights using random forests. It discusses the purpose, scope and definitions for the project. It also outlines the software requirements specification, including functional and non-functional requirements. The high-level design is presented, including system architecture diagrams and use case diagrams. Detailed design considerations are also covered.
This module prints a simple "Hello world 1" message when loaded and "Goodbye world 1" when unloaded. It implements the basic init_module and cleanup_module functions required for all kernel modules, which are called when the module is loaded and unloaded respectively. The module demonstrates the simplest form of a kernel module and introduces the printk function for printing from a module.
This document is the Red Hat Enterprise Linux 7 System Administrator's Guide. It was written by 14 authors from Red Hat Engineering Content Services and covers topics such as basic system configuration, package management, infrastructure services, and server configuration. The guide includes chapters on topics like users and groups, package management with Yum, system services with systemd, OpenSSH, and configuring mail, web, directory, file, and time servers. It is intended to help system administrators deploy, configure, and administer Red Hat Enterprise Linux 7 systems.
This document provides information about configuring and using the SAP Event Stream Processor Cockpit user interface. It describes how to start and stop the SAP ESP Cockpit server, log in and out of the interface, and view node statistics. It also outlines how to configure various aspects of the ESP Cockpit like collection jobs, logging, backups, ports and memory usage. Sections cover user management features and using the ESP Cockpit console.
This document is the table of contents for the SQL-Front manual, which outlines the program's features and functions. It lists 5 main parts: 1) Introduction 2) Features 3) Shareware 4) Contact 5) Program. Part 5 lists the program files and their functions, including opening, importing, exporting, editing, searching and viewing SQL files and database tables. The document provides a high-level overview of the topics that will be covered in the SQL-Front manual.
The document provides step-by-step instructions for setting up an email server using Red Hat Linux 7. It discusses installing Red Hat Linux, configuring the network settings, installing and configuring DNS (BIND), sendmail, POP3, IMAP, and LDAP. The document contains details on installing necessary packages and configuring files to set up these various services and enable email functionality.
This document provides a summary of the Spring Framework reference documentation for version 2.5.5. It includes an overview of the framework and its key components, including the inversion of control container, aspect-oriented programming support, resources, validation, data binding, transaction management and testing.
Using ZFS Snapshots With Zmanda Recovery Manager for MySQL on ...webhostingguy
This article describes how to deploy Zmanda Recovery Manager (ZRM) 3.0 for MySQL on an OpenSolaris 2008.11 operating system using ZFS snapshots for data protection. It discusses configuring the system, including creating ZFS pools and file systems, installing dependencies for ZRM using either pkgadd or IPS, and installing ZRM. It also describes performance testing ZRM backups with MySQL databases under different load conditions.
This document is the user guide for PL/SQL Developer 8.0. It contains 11 chapters that describe how to install and use the various features of PL/SQL Developer 8.0. These features include writing and testing PL/SQL programs, performing ad hoc SQL queries, using the command window, creating and modifying database objects, using the DBMS scheduler, creating diagrams of database objects, and generating various reports. The document provides detailed instructions and reference information on each major feature area to help users be productive with PL/SQL Developer.
This document describes the design of a Hangman game application for Android mobile devices. It includes use cases, UI mockups, class diagrams, and other design documents. The application allows users to play the classic Hangman game on their Android device by guessing letters to solve a mystery word. Key features include starting new games, continuing incomplete games, playing with touch, keys, or navigation buttons, getting hints, and adjusting settings like enabling music. Storyboards and screenshots demonstrate example user flows through the app. The technical documentation provides details on app architecture, components, and development strategy.
This document provides instructions for installing and administering R, the open-source statistical software and programming language. It covers obtaining R sources, installing on Unix-like and Windows systems, installing add-on packages, internationalization, and other topics. Permission is granted to distribute verbatim or modified copies of the manual under certain conditions.
Plesk 8.2 for Linux/Unix Domain Administrator's Guidewebhostingguy
1. Click on the "Domain Administrator" option in the navigation pane.
2. On the "Domain Administrator" page, select your preferred language and skin from the dropdown menus.
3. Click "OK" to save the changes and customize the interface language and theme of your control panel.
This document is a user manual for the GNU Gatekeeper (GnuGk) that explains how to compile, install, configure and monitor it. The document contains sections on installation, basic configuration, routing, RAS configuration, authentication, and accounting. It is maintained by Jan Willamowius and is currently at version 2.3.2 from May 2010.
This document outlines the goals and requirements for Project 3, which involves writing a kernel from scratch. It discusses hardware primitives, the boot process, device drivers, context switching, scheduling, system calls, building and loading user programs, the programming environment, hints for implementing a kernel, and debugging strategies. The project involves implementing an operating system kernel that supports interrupts, scheduling, and basic system calls.
This document provides an overview of a project that aims to predict airfares for flights using random forests. It discusses the purpose, scope and definitions for the project. It also outlines the software requirements specification, including functional and non-functional requirements. The high-level design is presented, including system architecture diagrams and use case diagrams. Detailed design considerations are also covered.
This module prints a simple "Hello world 1" message when loaded and "Goodbye world 1" when unloaded. It implements the basic init_module and cleanup_module functions required for all kernel modules, which are called when the module is loaded and unloaded respectively. The module demonstrates the simplest form of a kernel module and introduces the printk function for printing from a module.
This document is the Red Hat Enterprise Linux 7 System Administrator's Guide. It was written by 14 authors from Red Hat Engineering Content Services and covers topics such as basic system configuration, package management, infrastructure services, and server configuration. The guide includes chapters on topics like users and groups, package management with Yum, system services with systemd, OpenSSH, and configuring mail, web, directory, file, and time servers. It is intended to help system administrators deploy, configure, and administer Red Hat Enterprise Linux 7 systems.
This document provides information about configuring and using the SAP Event Stream Processor Cockpit user interface. It describes how to start and stop the SAP ESP Cockpit server, log in and out of the interface, and view node statistics. It also outlines how to configure various aspects of the ESP Cockpit like collection jobs, logging, backups, ports and memory usage. Sections cover user management features and using the ESP Cockpit console.
This document is the table of contents for the SQL-Front manual, which outlines the program's features and functions. It lists 5 main parts: 1) Introduction 2) Features 3) Shareware 4) Contact 5) Program. Part 5 lists the program files and their functions, including opening, importing, exporting, editing, searching and viewing SQL files and database tables. The document provides a high-level overview of the topics that will be covered in the SQL-Front manual.
The document provides step-by-step instructions for setting up an email server using Red Hat Linux 7. It discusses installing Red Hat Linux, configuring the network settings, installing and configuring DNS (BIND), sendmail, POP3, IMAP, and LDAP. The document contains details on installing necessary packages and configuring files to set up these various services and enable email functionality.
This document provides a summary of the Spring Framework reference documentation for version 2.5.5. It includes an overview of the framework and its key components, including the inversion of control container, aspect-oriented programming support, resources, validation, data binding, transaction management and testing.
Using ZFS Snapshots With Zmanda Recovery Manager for MySQL on ...webhostingguy
This article describes how to deploy Zmanda Recovery Manager (ZRM) 3.0 for MySQL on an OpenSolaris 2008.11 operating system using ZFS snapshots for data protection. It discusses configuring the system, including creating ZFS pools and file systems, installing dependencies for ZRM using either pkgadd or IPS, and installing ZRM. It also describes performance testing ZRM backups with MySQL databases under different load conditions.
This document is the user guide for PL/SQL Developer 8.0. It contains 11 chapters that describe how to install and use the various features of PL/SQL Developer 8.0. These features include writing and testing PL/SQL programs, performing ad hoc SQL queries, using the command window, creating and modifying database objects, using the DBMS scheduler, creating diagrams of database objects, and generating various reports. The document provides detailed instructions and reference information on each major feature area to help users be productive with PL/SQL Developer.
This document describes the design of a Hangman game application for Android mobile devices. It includes use cases, UI mockups, class diagrams, and other design documents. The application allows users to play the classic Hangman game on their Android device by guessing letters to solve a mystery word. Key features include starting new games, continuing incomplete games, playing with touch, keys, or navigation buttons, getting hints, and adjusting settings like enabling music. Storyboards and screenshots demonstrate example user flows through the app. The technical documentation provides details on app architecture, components, and development strategy.
This document provides instructions for installing and administering R, the open-source statistical software and programming language. It covers obtaining R sources, installing on Unix-like and Windows systems, installing add-on packages, internationalization, and other topics. Permission is granted to distribute verbatim or modified copies of the manual under certain conditions.
Government Contractors Association is a national trade association for 8a, hubzone, sdvosb, wosb, vosb, sdb, and all other companies interested in the government market. Our membership is also made up of government agencies from the federal, state and local level, as well as, universities, non-profits and other government entities.
This document provides an introduction to the Python programming language. It discusses Python's easy-to-learn and powerful features such as its efficient data structures and object-oriented approach. The document also covers Python's syntax, dynamic typing, scripting capabilities, extensive standard library, and ability to be extended via C/C++. It is intended to introduce readers to Python's basic concepts and features in an informal manner.
This document provides an overview and instructions for installing and configuring Slackware Linux. It covers getting and installing Slackware, system requirements, partitioning disks during setup, selecting and compiling kernels, configuring network hardware and network protocols like TCP/IP, and setting up dial-up connections using PPP. The table of contents provides additional details on topics like file system layout, finding files on the system, and managing kernel modules.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document contains an introduction to programming concepts, getting started with Perl, manipulating data structures in Perl like scalars, lists, arrays and hashes. It also covers operators, conditionals, loops, subroutines and other Perl concepts. The author provides their contact information and requests feedback to improve the quality of the publication.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to help readers learn Perl programming.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003. The document covers topics such as what Perl is, getting started with Perl, manipulating data structures, operators, conditionals, loops, and subroutines. It includes over 20 chapters to guide readers through learning Perl programming.
This document provides an overview and tutorial on the Python programming language. It introduces Python's main features like lists, dictionaries, functions, object-oriented programming and modules. The tutorial includes example code and explanations of Python concepts like data types, scope, exceptions, classes and inheritance. It also covers debugging tools and accessing Python's online documentation. The goal is to quickly teach the essentials of Python in a painless manner.
The document describes the ns network simulator. It provides documentation on the simulator's architecture and key components. The simulator is written in C++ and uses OTcl as a configuration and command interface. It has been improved since version 1, with simpler object decomposition and a separate interface to the OTcl interpreter. The documentation covers the simulator classes and objects, including nodes, packets, scheduling, and routing classification.
In a vSphere 5.0 environment, virtual network switches provide connectivity for virtual machines running on VMware® ESXi™ hosts to communicate with each other as well as connectivity to the external physical infrastructure. Network administrators want more visibility into this traffic that is flowing in the virtual infrastructure. This visibility will help them monitor and troubleshoot network issues. VMware vSphere 5.0 introduces two new features in the Distributed Switch that provide the required monitoring and troubleshooting capability to the virtual infrastructure.
This document provides code conventions for writing Java code, including recommendations for file names, file organization within source code files, indentation, comments, declarations, statements, white space, naming conventions, and programming practices. It aims to improve code readability and maintainability. The conventions are based on the Java Language Specification from Sun Microsystems and aim to make the code as well-organized and clean as possible.
This thesis describes the development of a language, toolchain and experimental evaluation for the SubLeqXorShr (SLXS) single-instruction processor architecture. An assembly-like language was created to facilitate programming for the SLXS. A toolchain including a macro assembler and simulator was implemented to compile and run SLXS code. Two algorithms (AES and PRESENT) were implemented on the SLXS language to evaluate the toolchain. The AES implementation required similar clock cycles as a lower-level version, showing the language achieves the same efficiency. While the PRESENT implementation had a sevenfold increase in cycles compared to a microcontroller, the SLXS architecture's higher clock frequency means results are promising for its use in
This document provides guidelines for using the new Odoo 8.0 ORM API, which introduces the concepts of Environment and Recordset. It describes how Models now return Recordsets instead of direct records, and how Recordsets allow set-like operations on records. Key aspects covered include how inheritance and fields work with the new API, useful helpers for filtering, sorting, and mapping recordsets, and how the ids attribute works with Recordsets.
The document provides guidelines for formatting Java code, including file naming conventions, file organization, indentation, comments, declarations, statements, whitespace, naming conventions, and programming practices. Key points include recommending .java and .class file extensions, putting a single public class per source file, using package and import statements at the top, and separating sections with blank lines and comments.
This document describes the OpenFlow switch specification version 1.3.0 including:
- The components and architecture of an OpenFlow switch including tables, ports, and pipelines
- Details of the OpenFlow protocol and messages for communication between controllers and switches including modifying flow tables, group tables, and meters
- Matching, instructions, and actions that can be applied to packets within an OpenFlow switch
This document specifies the Linked Media Layer architecture and describes its key components. The architecture includes a repository layer for media storage and metadata, an integration layer, and a service layer. It also describes modules for unstructured search using Apache Nutch/Solr, media collection from social networks, searching media resources with latent semantic indexing, and participation in the MediaEval 2013 benchmarking initiative for video search and hyperlinking tasks.
This document is a 241-page tutorial on the Perl 5 programming language. It was written by Chan Bernard Ki Hong and published in 2003 under a Creative Commons license. The document provides an introduction to Perl and teaches the fundamentals of Perl programming, including data structures, operators, conditionals, loops, subroutines, references and more. It aims to help readers learn Perl and further improve the quality of the tutorial through reader feedback.
This document is a Python tutorial that provides an overview of the Python programming language. It covers topics like using the Python interpreter, basic syntax, data structures, modules, input/output, exceptions, classes and inheritance, and the standard library. The tutorial is intended for new Python programmers to help them learn the essential aspects of the language.
The document evaluates five implementations of the SPARQL query language for the Semantic Web. It first provides background on the Semantic Web and SPARQL, including the data model and query language specifications. It then describes the methodology for testing each implementation using a dataset from DBpedia.org and sample queries. Each implementation - OpenRDF Sesame, OpenLink Virtuoso, Jena, Pyrrho DBMS, and AllegroGraph - is installed and evaluated based on documentation, loading data efficiently, and computing query results in a reasonable time. The conclusion finds that while some implementations are advanced, they still have problems processing basic SPARQL queries as specified.
This document provides guidelines for formatting Java code through conventions for file names, file organization, indentation, comments, declarations, statements, whitespace, naming, programming practices, and examples. It recommends using suffixes like .java and .class for files, and placing package and import statements before class declarations in source files. The document provides formatting recommendations for elements like comments, declarations, statements and more to improve code readability and maintenance.
This document provides information about login scripts in Novell, including:
- Where login scripts should be located and common login script commands
- Examples of sample login scripts for containers, profiles, users, and default scripts
- Descriptions of specific login script commands and variables like MAP, IF/THEN, and INCLUDE
This presentation was provided by Rebecca Benner, Ph.D., of the American Society of Anesthesiologists, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...EduSkills OECD
Andreas Schleicher, Director of Education and Skills at the OECD presents at the launch of PISA 2022 Volume III - Creative Minds, Creative Schools on 18 June 2024.
Temple of Asclepius in Thrace. Excavation resultsKrassimira Luka
The temple and the sanctuary around were dedicated to Asklepios Zmidrenus. This name has been known since 1875 when an inscription dedicated to him was discovered in Rome. The inscription is dated in 227 AD and was left by soldiers originating from the city of Philippopolis (modern Plovdiv).
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...TechSoup
Whether you're new to SEO or looking to refine your existing strategies, this webinar will provide you with actionable insights and practical tips to elevate your nonprofit's online presence.
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumMJDuyan
(𝐓𝐋𝐄 𝟏𝟎𝟎) (𝐋𝐞𝐬𝐬𝐨𝐧 𝟏)-𝐏𝐫𝐞𝐥𝐢𝐦𝐬
𝐃𝐢𝐬𝐜𝐮𝐬𝐬 𝐭𝐡𝐞 𝐄𝐏𝐏 𝐂𝐮𝐫𝐫𝐢𝐜𝐮𝐥𝐮𝐦 𝐢𝐧 𝐭𝐡𝐞 𝐏𝐡𝐢𝐥𝐢𝐩𝐩𝐢𝐧𝐞𝐬:
- Understand the goals and objectives of the Edukasyong Pantahanan at Pangkabuhayan (EPP) curriculum, recognizing its importance in fostering practical life skills and values among students. Students will also be able to identify the key components and subjects covered, such as agriculture, home economics, industrial arts, and information and communication technology.
𝐄𝐱𝐩𝐥𝐚𝐢𝐧 𝐭𝐡𝐞 𝐍𝐚𝐭𝐮𝐫𝐞 𝐚𝐧𝐝 𝐒𝐜𝐨𝐩𝐞 𝐨𝐟 𝐚𝐧 𝐄𝐧𝐭𝐫𝐞𝐩𝐫𝐞𝐧𝐞𝐮𝐫:
-Define entrepreneurship, distinguishing it from general business activities by emphasizing its focus on innovation, risk-taking, and value creation. Students will describe the characteristics and traits of successful entrepreneurs, including their roles and responsibilities, and discuss the broader economic and social impacts of entrepreneurial activities on both local and global scales.
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
18. import os
filename = os.environ.get(’PYTHONSTARTUP’)
if filename and os.path.isfile(filename):
execfile(filename)
10 Chapter 2. Using the Python Interpreter ¦^PythonAºì
21. To iterate over the indices of a sequence, combine range() and len() as follows:
s‡ƒ“óv¢Ú'{§Xe¤«@ܦ^range() Úlen() µ
a = [’Mary’, ’had’, ’a’, ’little’, ’lamb’]
for i in range(len(a)):
... print i, a[i]
...
0 Mary
1 had
2 a
3 little
4 lamb
3.4 break and continue Statements, and else Clauses on Loops
Ú
break continue , Šé ±9Ì‚¥
else fé
The break statement, like in C, breaks out of the smallest enclosing for or while loop.
break ŠéÚC ¥'aq§^uaÑg'˜?for ½while Ì‚
The continue statement, also borrowed from C, continues with the next iteration of the loop.
continue Šé´lC ¥G5'§§v«Ì‚U‰‰Ie˜gƒ“
Loop statements may have an else clause; it is executed when the loop terminates through exhaustion of the list (with
for) or when the condition becomes false (with while), but not when the loop is terminated by a break statement.
This is exemplified by the following loop, which searches for prime numbers:
Ì‚Œ±k˜‡else fé;§QÌ‚ƒ“‡v£éufor ¤½‰I^‡false £éuwhile ¤ž‰
I§¢Ì‚break ¥Ž'œ¹eج‰I±e|¢ƒê'«~§ƒü«
ù‡féµ
for n in range(2, 10):
... for x in range(2, n):
... if n % x == 0:
... print n, ’equals’, x, ’*’, n/x
... break
... else:
... # loop fell through without finding a factor
... print n, ’is a prime number’
...
2 is a prime number
3 is a prime number
4 equals 2 * 2
5 is a prime number
6 equals 2 * 3
7 is a prime number
8 equals 2 * 4
9 equals 3 * 3
3.4. break and continue Statements, and else Clauses on Loops break Úcontinue Šé, ±9Ì13
‚¥'else fé
23. The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function
when it is called; thus, arguments are passed using call by value (where the value is always an object reference, not
the value of the object).1 When a function calls another function, a new local symbol table is created for that call.
¼êÚ^'¢SëêQ¼êx^žÚÛÜÎÒv§Ïd§¢ëo´DŠx^£ùp'Šo´˜‡é–Ú
^§Ø´Té–'Š¤ ˜‡¼ê,˜‡¼êx^ž§˜‡5'ÛÜÎÒvQx^v§¥Mï
2
A function definition introduces the function name in the current symbol table. The value of the function name has a
type that is recognized by the interpreter as a user-defined function. This value can be assigned to another name which
can then also be used as a function. This serves as a general renaming mechanism:
¼ê½ÂQ¨cÎÒv¥Ú¼ê¶Š^r½Â¼ê§¼ê¶k˜‡Aºì@Œ'aFŠù‡Š
Œ±D‰Ù§·¶§¦ÙUŠ˜‡¼ê5¦^ùÒ”˜‡·¶Å›µ
fib
function fib at 10042ed0
f = fib
f(100)
1 1 2 3 5 8 13 21 34 55 89
You might object that fib is not a function but a procedure. In Python, like in C, procedures are just functions that
don’t return a value. In fact, technically speaking, procedures do return a value, albeit a rather boring one. This value
is called None (it’s a built-in name). Writing the value None is normally suppressed by the interpreter if it would be
the only value written. You can see it if you really want to:
ŒU@fibØ´˜‡¼ê£function ¤§´˜‡v§£procedure ¤Python ÚC ˜$§v§´˜‡
vkˆ£Š'¼ê¢Sþ§lEâþù§v§k˜‡ˆ£Š§,´˜‡Ø?U'ù‡Š¡
None £ù´˜‡S˜·¶¤Xt˜‡Š´None '{§Ï~Aºìج!˜‡None Ñ5§Xtý
Ž‡¦w§'{§Œ±ù$‰µ
print fib(0)
None
It is simple to write a function that returns a list of the numbers of the Fibonacci series, instead of printing it:
±e«~ü«
XÛl¼ê¥ˆ£˜‡¹™Å@êê'êŠóv§Ø´‹§µ
def fib2(n): # return Fibonacci series up to n
... Return a list containing the Fibonacci series up to n.
... result = []
... a, b = 0, 1
... while b n:
... result.append(b) # see below
... a, b = b, a+b
... return result
...
f100 = fib2(100) # call it
f100 # write the result
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
1 Actually, call by object reference would be a better description, since if a mutable object is passed, the caller will see any changes the callee
¯¢þ§¡ƒN^é–Ú^ܷϘ‡ŒCé–D4?5 §N^öŒ±wN^é–?Û?U£XQóL¥¢
makes to it (items inserted into a list).
2
˜‡#f‘¤
3.6. Defining Functions ½Â¼ê 15
24. This example, as usual, demonstrates some new Python features:
Ú±c˜$§ù‡~fü«
˜5'Python õUµ
• The return statement returns with a value from a function. return without an expression argument returns
None. Falling off the end of a procedure also returns None.
return Šél¼ê¥ˆ£˜‡Š§Ø‘vˆª'return ˆ£Nonev§@å ¬ˆ£None
• The statement result.append(b) calls a method of the list object result. A method is a function that
‘belongs’ to an object and is named obj.methodname, where obj is some object (this may be an expression),
and methodname is the name of a method that is defined by the object’s type. Different types define different
methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define
your own object types and methods, using classes, as discussed later in this tutorial.) The method append()
shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is
equivalent to ‘result = result + [b]’, but more efficient.
Šéresult.append(b) ¡óvé–result '˜‡{£method ¤{´˜‡/áu0
,‡é–'¼ê§§·¶obj.methodename §ùp'obj ´,‡é–£ŒU´˜‡vˆ
ª¤§methodename ´,‡QTé–aF½Â¥'{'·¶ØÓ'aF½ÂØÓ'{
ØÓaFŒUkÓ$¶i'{§¢Ø¬· £¨½ÂgC'é–aFÚ{ž§ŒU¬Ñyù
«œ¹§)H ¡'Ù3¬HXÛ¦^a.¤«~¥ü«'append(){dóv閽§
§•óv¥˜‡5£ƒQ«~¥§1Óu‘result = result + [b]’§Øv¨Çp
3.7 More on Defining Functions ¼ê½Â
It is also possible to define functions with a variable number of arguments. There are three forms, which can be
combined.
kžs‡½Âëê‡êŒg'¼êkn‡{Œ±ˆ 8'§·‚Œ±|ܦ^§‚
3.7.1 Default Argument Values ëê%@Š
The most useful form is to specify a default value for one or more arguments. This creates a function that can be called
with fewer arguments than it is defined to allow. For example:
k^'Gª´‰˜‡½õ‡ëê½%@Šù$Mï'¼êŒ±^¨'ëê5x^~Xµ
def ask_ok(prompt, retries=4, complaint=’Yes or no, please!’):
while True:
ok = raw_input(prompt)
if ok in (’y’, ’ye’, ’yes’): return True
if ok in (’n’, ’no’, ’nop’, ’nope’): return False
retries = retries - 1
if retries 0: raise IOError, ’refusenik user’
print complaint
This function can be called either like this: ask_ok(’Do you really want to quit?’) or like this:
ask_ok(’OK to overwrite the file?’, 2).
ù‡¼ê„Œ±^±e'ªx^µask_ok(’Do you §½ö”ù
$µask_ok(’OK to overwrite the file?’, 2)
really want to quit?’)
This example also introduces the in keyword. This tests whether or not a sequence contains a certain value.
ù‡«~„H
9…iin §uÿ˜‡ƒ¥´Ä¹,‡‰½'Š
16 Chapter 3. More Control Flow Tools )6§››
25. The default values are evaluated at the point of function definition in the defining scope, so that
%@ŠQ¼ê½ÂãAÛ§Xe¤«µ
i = 5
def f(arg=i):
print arg
i = 6
f()
will print 5.
±þ“謋5
Important warning: The default value is evaluated only once. This makes a difference when the default is a mutable
object such as a list, dictionary, or instances of most classes. For example, the following function accumulates the
arguments passed to it on subsequent calls:
def f(a, L=[]):
L.append(a)
return L
print f(1)
print f(2)
print f(3)
This will print
ù¬‹Ñµ
[1]
[1, 2]
[1, 2, 3]
If you don’t want the default to be shared between subsequent calls, you can write the function like this instead:
XtØŽQØÓ'¼êx^ƒm¡ëê%@Š§Œ±Xe¡'¢~˜$c!¼êµ
def f(a, L=None):
if L is None:
L = []
L.append(a)
return L
3.7.2 Keyword Arguments
Functions can also be called using keyword arguments of the form ‘keyword = value’. For instance, the following
function:
¼êŒ±Ïv9…iëê'Gª5x^§GX‘keyword = value’ ~X§±e'¼êµ
3.7. More on Defining Functions )¼ê½Â 17
26. def parrot(voltage, state=’a stiff’, action=’voom’, type=’Norwegian Blue’):
print -- This parrot wouldn’t, action,
print if you put, voltage, volts through it.
print -- Lovely plumage, the, type
print -- It’s, state, !
could be called in any of the following ways:
Œ±^±e'?˜{x^µ
parrot(1000)
parrot(action = ’VOOOOOM’, voltage = 1000000)
parrot(’a thousand’, state = ’pushing up the daisies’)
parrot(’a million’, ’bereft of life’, ’jump’)
but the following calls would all be invalid:
Øv±eA«x^´Ã¨'µ
parrot() # required argument missing
parrot(voltage=5.0, ’dead’) # non-keyword argument following keyword
parrot(110, voltage=220) # duplicate value for argument
parrot(actor=’John Cleese’) # unknown keyword
In general, an argument list must have any positional arguments followed by any keyword arguments, where the
keywords must be chosen from the formal parameter names. It’s not important whether a formal parameter has a
default value or not. No argument may receive a value more than once — formal parameter names corresponding to
positional arguments cannot be used as keywords in the same calls. Here’s an example that fails due to this restriction:
Ï~§ëêv¥'z˜‡9…iÑUv5guGªëê§z‡ëêÑkéA'9…iGªëêkvk
%@Š¿Ø‡¢SëêØU˜gDõ‡Š))GªëêØUQÓ˜gx^¥Óž¦^ ˜Ú9…i”
½Šùpk˜‡~fü«
Qù«!åe¤Ñy'”}œ¹µ
def function(a):
... pass
...
function(0, a=0)
Traceback (most recent call last):
File stdin, line 1, in ?
TypeError: function() got multiple values for keyword argument ’a’
When a final formal parameter of the form **name is present, it receives a dictionary containing all keyword argu-
ments except for those corresponding to a formal parameter. This may be combined with a formal parameter of the
form *name (described in the next subsection) which receives a tuple containing the positional arguments beyond the
formal parameter list. (*name must occur before **name.) For example, if we define a function like this:
Ú˜‡GX**name 'ëꞧ§Â˜‡iY §TiY¹
¤k™ÑyQGªëêv¥'9…i
ëêùpŒU„¬|ܦ^˜‡GX*name 'Gªëꧧ˜‡£|£e˜3¥¬[H¤§
¹
¤kvkÑyQGªëêv¥'ëꊣ*name UvQ**name ƒcÑy¤~X§·‚ù$½Â˜
‡¼êµ
18 Chapter 3. More Control Flow Tools )6§››
27. def cheeseshop(kind, *arguments, **keywords):
print -- Do you have any, kind, ’?’
print -- I’m sorry, we’re all out of, kind
for arg in arguments: print arg
print ’-’*40
keys = keywords.keys()
keys.sort()
for kw in keys: print kw, ’:’, keywords[kw]
It could be called like this:
§Œ±”ù$x^µ
cheeseshop(’Limburger’, It’s very runny, sir.,
It’s really very, VERY runny, sir.,
client=’John Cleese’,
shopkeeper=’Michael Palin’,
sketch=’Cheese Shop Sketch’)
and of course it would print:
¨,§¬UXeSN‹µ
-- Do you have any Limburger ?
-- I’m sorry, we’re all out of Limburger
It’s very runny, sir.
It’s really very, VERY runny, sir.
----------------------------------------
client : John Cleese
shopkeeper : Michael Palin
sketch : Cheese Shop Sketch
Note that the sort() method of the list of keyword argument names is called before printing the contents of the
keywords dictionary; if this is not done, the order in which the arguments are printed is undefined.
5¿sort(){Q9…iiYSN‹cx^§Äu'{§‹ëêž'^ƒ´™½Â'
3.7.3 Arbitrary Argument Lists ŒCëêL
Finally, the least frequently used option is to specify that a function can be called with an arbitrary number of argu-
ments. These arguments will be wrapped up in a tuple. Before the variable number of arguments, zero or more normal
arguments may occur.
§˜‡Ø~^'Àt´Œ±4¼êx^Œg‡ê'ëêùëêCc˜‡£|QùŒg
‡ê'ëêƒc§Œ±k õ‡ÊÏ'ëêµ
def fprintf(file, format, *args):
file.write(format % args)
3.7. More on Defining Functions )¼ê½Â 19
30. def my_function():
... Do nothing, but document it.
...
... No, really, it doesn’t do anything.
...
... pass
...
print my_function.__doc__
Do nothing, but document it.
No, really, it doesn’t do anything.
22 Chapter 3. More Control Flow Tools )6§››
31. CHAPTER
FOUR
Data Structures êâ(¨
This chapter describes some things you’ve learned about already in more detail, and adds some new things as well.
)Ù3)ù㘮²ÆSv'Àܧ¿…„
5'SN
4.1 More on Lists óL
The list data type has some more methods. Here are all of the methods of list objects:
óvaFkéõ{§ùp´óvaF'¤k{µ
append(x)
Add an item to the end of the list; equivalent to a[len(a):] = [x].
r˜‡£ƒV óv'@—§ƒ¨ua[len(a):] = [x]
extend(L)
Extend the list by appending all the items in the given list; equivalent to a[len(a):] = L.
ÏvV½óv'¤k£ƒ5*¿óv§ƒ¨ua[len(a):] = L
insert(i, x)
Insert an item at a given position. The first argument is the index of the element before which to in-
sert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to
a.append(x).
Q½ ˜¢˜‡£ƒI˜‡ëê´O#¢ Ùc¡'@‡£ƒ'¢Ú§~
Xa.insert(0,x) ¬¢ ‡óvƒc§a.insert(len(a), x) ƒ¨ua.append(x)
remove(x)
Remove the first item from the list whose value is x. It is an error if there is no such item.
íØóv¥Šx'I˜‡£ƒXtvkù$'£ƒ§Ò¬ˆ£˜‡†Ø
pop([i ])
Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes
and returns the last item in the list. (The square brackets around the i in the method signature denote that
the parameter is optional, not that you should type square brackets at that position. You will see this notation
frequently in the Python Library Reference.)
lóv'½ ˜íØ£ƒ§¿òÙˆ£Xtvk½¢Ú§a.pop() ˆ£ ˜‡£ƒ£ƒ
‘=lóv¥íØ£{¥i üb')Òv«ù‡ëê´ŒÀ'§Ø´‡¦Ñ˜é)
Ò§¬²~QPython ¥ëÃþ¥‘ ù$'sP¤
index(x)
Return the index in the list of the first item whose value is x. It is an error if there is no such item.
ˆ£óv¥I˜‡Šx '£ƒ'¢ÚXtvkš''£ƒÒ¬ˆ£˜‡†Ø
23
35. def sum(seq):
... def add(x,y): return x+y
... return reduce(add, seq, 0)
...
sum(range(1, 11))
55
sum([])
0
؇”«~¥ù$½Â µÏÜOêŠ
Don’t use this example’s definition of sum(): since summing numbers is such a common need, a built-in function
´˜‡Ï^'s¦§Q ‡¥§Jø
S˜' ¼ê
sum(sequence) is already provided, and works exactly like this. sum()
2.3 sum(sequence) New in version 2.3.
4.1.4 List Comprehensions óLíª
List comprehensions provide a concise way to create lists without resorting to use of map(), filter() and/or
lambda. The resulting list definition tends often to be clearer than lists built using those constructs. Each list
comprehension consists of an expression followed by a for clause, then zero or more for or if clauses. The result
will be a list resulting from evaluating the expression in the context of the for and if clauses which follow it. If the
expression would evaluate to a tuple, it must be parenthesized.
óvíªJø
˜‡Mïóv'{ü廧Ãs¦^map()§filter() ±9lambdaˆ£óv'½Â
Ï~‡9Mïùóv˜ßz˜‡óvíª)Q˜‡for Šéƒ 'vˆª§½õ‡for½if
Šéˆ£Š´dfor ½ifféƒ 'vˆª '£ƒ|¤'óvXtŽ‡ ˜‡£|§Uv‡
þ)Ò
freshfruit = [’ banana’, ’ loganberry ’, ’passion fruit ’]
[weapon.strip() for weapon in freshfruit]
[’banana’, ’loganberry’, ’passion fruit’]
vec = [2, 4, 6]
[3*x for x in vec]
[6, 12, 18]
[3*x for x in vec if x 3]
[12, 18]
[3*x for x in vec if x 2]
[]
[[x,x**2] for x in vec]
[[2, 4], [4, 16], [6, 36]]
[x, x**2 for x in vec] # error - parens required for tuples
File stdin, line 1, in ?
[x, x**2 for x in vec]
^
SyntaxError: invalid syntax
[(x, x**2) for x in vec]
[(2, 4), (4, 16), (6, 36)]
vec1 = [2, 4, 6]
vec2 = [4, 3, -9]
[x*y for x in vec1 for y in vec2]
[8, 6, -18, 16, 12, -36, 24, 18, -54]
[x+y for x in vec1 for y in vec2]
[6, 5, -7, 8, 7, -5, 10, 9, -3]
[vec1[i]*vec2[i] for i in range(len(vec1))]
[8, 12, -54]
4.1. More on Lists )óv 27
38. combination of tuple packing and sequence unpacking!
ù‡x^¡S
µš~Ü·ƒµ‡¦†ý'gþê8†ƒ'£ƒ‡êƒÓ‡5¿'´Œ
gëê£multiple assignment ¤Ù¢´£|µCÚƒµ'˜‡@Üœ
There is a small bit of asymmetry here: packing multiple values always creates a tuple, and unpacking works for any
sequence.
ùpk˜XØ页µCõëêÏ~¬M£|§µöŠŒ±Š^u?Ûƒ
4.4 Sets 8Ü
Python also includes a data type for sets. A set is an unordered collection with no duplicate elements. Basic uses
include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like
union, intersection, difference, and symmetric difference.
„¹
˜‡êâaF))set£8ܤ8Ü´˜‡ÃƒØE£ƒ'8Ä)õU)9X
ÿÁÚžØE£ƒ8Üé–„|±union£éܤ§intersection£¢¤§difference£¤Úsysmmetric
Python
difference£é¡8¤1êÆ6Ž
Here is a brief demonstration:
±e´˜‡{ü'ü«µ
basket = [’apple’, ’orange’, ’apple’, ’pear’, ’orange’, ’banana’]
fruit = set(basket) # create a set without duplicates
fruit
set([’orange’, ’pear’, ’apple’, ’banana’])
’orange’ in fruit # fast membership testing
True
’crabgrass’ in fruit
False
# Demonstrate set operations on unique letters from two words
...
a = set(’abracadabra’)
b = set(’alacazam’)
a # unique letters in a
set([’a’, ’r’, ’b’, ’c’, ’d’])
a - b # letters in a but not in b
set([’r’, ’d’, ’b’])
a | b # letters in either a or b
set([’a’, ’c’, ’r’, ’d’, ’b’, ’m’, ’z’, ’l’])
a b # letters in both a and b
set([’a’, ’c’])
a ^ b # letters in a or b but not both
set([’r’, ’d’, ’b’, ’m’, ’z’, ’l’])
4.5 Dictionaries i;
Another useful data type built into Python is the dictionary. Dictionaries are sometimes found in other languages
as “associative memories” or “associative arrays”. Unlike sequences, which are indexed by a range of numbers,
dictionaries are indexed by keys, which can be any immutable type; strings and numbers can always be keys. Tuples
can be used as keys if they contain only strings, numbers, or tuples; if a tuple contains any mutable object either
30 Chapter 4. Data Structures êâ@¨
40. dict([(’sape’, 4139), (’guido’, 4127), (’jack’, 4098)])
{’sape’: 4139, ’jack’: 4098, ’guido’: 4127}
dict([(x, x**2) for x in (2, 4, 6)]) # use a list comprehension
{2: 4, 4: 16, 6: 36}
Later in the tutorial, we will learn about Generator Expressions which are even better suited for the task of supplying
key-values pairs to the dict() constructor.
Q€H ¡'SN¥§·‚ò¬ÆS·udict() ¨iìA¤…Šé'A¤ìvˆª
When the keys are simple strings, it is sometimes easier to specify pairs using keyword arguments:
¦^{üiÎGŠ9…i'{§Ï~^9…iëê{ü
dict(sape=4139, guido=4127, jack=4098)
{’sape’: 4139, ’jack’: 4098, ’guido’: 4127}
4.6 Looping Techniques Ì‚Eâ
When looping through dictionaries, the key and corresponding value can be retrieved at the same time using the
iteritems() method.
QiY¥Ì‚ž§9…iÚéA'ŠŒ±¦^iteritems(){ÓžAÖÑ5
knights = {’gallahad’: ’the pure’, ’robin’: ’the brave’}
for k, v in knights.iteritems():
... print k, v
...
gallahad the pure
robin the brave
When looping through a sequence, the position index and corresponding value can be retrieved at the same time using
the enumerate() function.
Qƒ¥Ì‚ž§¢Ú ˜ÚéAŠŒ±¦^enumerate()¼êÓž
for i, v in enumerate([’tic’, ’tac’, ’toe’]):
... print i, v
...
0 tic
1 tac
2 toe
To loop over two or more sequences at the same time, the entries can be paired with the zip() function.
Ӟ̂ü‡½õ'ƒ§Œ±¦^zip() NAÖ
32 Chapter 4. Data Structures êâ@¨