Showing posts with label Wrox. Show all posts

Denise Gosnell

e-books shop
e-books shop
Purchase Now !
Just with Paypal

Book Details
 329 p
 File Size 
 12,029 KB
 File Type
 PDF format
 2005 by Denise Gosnell 

About the Author
Denise Gosnell is a software attorney with Woodard, Emhardt, Moriarty, McNett & Henry LLP
(, a worldwide intellectualproperty law firm based in Indianapolis, Indiana. Denise
has a unique background in both technology and law, and presently uses her deep technical and legal
expertise to counsel hightech clients on intellectual property and technical matters.
Denise has over ten years of experience creating software applications, ranging from standalone and
clientserver to enterprisewide applications. Denise has worked for leading software companies, such as
Microsoft and EDS, and has earned a worldwide reputation for her technology expertise. She received a
Bachelor of Arts degree in Computer Science – Business (summa cum laude) from Anderson University, and a Doctor of Jurisprudence degree from Indiana University School of Law in Indianapolis. Denise has coauthored six other software development books to date: Beginning Access 2003 VBA (Wiley Publishing, Inc.), Visual Basic .NET and SQL Server 2000: Building An Effective Data Layer (Wrox Press), Beginning Visual Basic.NET Databases (Wrox Press), Professional .NET Framework (Wrox Press), Professional SQL Server 2000 (Wrox Press), and MSDE Bible (IDG Books). Denise was a featured technology speaker at the Microsoft European Professional Developer’s Conference in December 2001 and has on numerous occasions
assisted Microsoft’s Training and Certification group in creating new exams for their MCSD and MCSE certifications. She herself holds the MCSD certification.
Denise can be reached at or

Web APIs are a set of application programming interfaces that can be called over standard Internet protocols. Web APIs and Web services are finally getting real attention in the mainstream. Various types of Web APIs are now available from leading technology companies such as Google, Amazon, eBay, Microsoft, and others. Federal Express, UPS, and many other leading companies have recently released or are working on Web APIs as well. Most of these companies offer a free account for limited use of their Web APIs, but some charge a fee for certain levels of usage.

If you like the idea of generating applications that capitalize on the services of some of these wellknown companies, or if you just want to learn from what these leading companies are doing to aid you in implementing your own Web APIs, then this is the book for you.

What This Book Covers
This book provides a handson guide to using some of the most popular Web APIs in software applications. It provides the nutsandbolts details on how several APIs work, and then offers numerous examples of how to use the APIs in real world situations.
While reading this book, you will learn:
❑ Basic concepts of Web APIs
❑ How Web APIs can be used for professional application development
❑ How to call Web APIs using SOAP over HTTP
❑ How to call Web APIs using HTTPGET (REST)
❑ How to call Web APIs using HTTPPOST
❑ How to use the Google API
❑ How to use the MapPoint API
❑ How to use the Amazon API
❑ How to use the eBay API and SDK
❑ How to use the PayPal API
❑ How to locate additional APIs
❑ Some thirdparty extensions of existing APIs
❑ How to create your own API
❑ How to call Web APIs from Microsoft Office applications
❑ How to call Web APIs from mobile devices
❑ How to use multiple APIs together in realworld case studies

Table of Contents
Acknowledgments ix
Introduction xvii
Chapter 1: Anatomy of a Web API 1
Web APIs versus Web Services 1
Web APIs as XML Web Services 2
What Is XML? 2
Invoking an XML Web Service 3
Summary 14
Chapter 2: Using the Google API 15
Google 101 15
cache: 16
daterange: 17
filetype: 17
inanchor: 18
info: 18
intext: 18
intitle: 18
inurl: 18
link: 19
phonebook: 19
related: 19
site: 19
Introduction to the Google API 19
Signing Up and Obtaining a Key 19
Anatomy of a Google API Query 23
Query Syntax 23
Executing a Query 25
Looping through Results 31
Five Creative Ways to Use the Google API 33
#1—Build a Google Search Feature 33
#2—Return Random Pages 36
#3—Save the Results of a Google Search to a File 37
#4—Use Google to Check Spelling 40
#5—Use the Google Cache to Retrieve a Web Site That Is No Longer Available 42
Other Ways to Use the Google API 45
Third-Party Google Extensions 46
Summary 48
Chapter 3: Using the MapPoint API 49
MapPoint 101 50
Introduction to the MapPoint API 51
Signing Up for an Evaluation Account 52
The MapPoint Software Developer’s Kit (SDK) 58
Anatomy of a MapPoint API Query 59
Available Services 59
Using the Test Environment versus Production 63
Executing a MapPoint Query 63
Five Creative Ways to Use the MapPoint API 71
#1—Obtain Driving Directions 72
#2—Retrieve a Map 75
#3—Perform a Geocode Lookup 77
#4—Find Nearby Places 80
#5—Obtain Information on Points of Interests 82
Other Ways to Use the MapPoint API 84
Third-Party MapPoint Extensions 85
Summary 85
Chapter 4: Using the APIs 87
Amazon 101 88
Introduction to the Amazon APIs 90
Supported Features 90
Signing Up for a Subscription ID 91
Anatomy of Amazon API Queries 96 E-Commerce Service API Query Syntax 97
Help Operation 102
Transaction Operation 102
Alexa Web Information Service API Query Syntax 102
Simple Queue Service API Query Syntax 103
Executing a Query Using HTTP-GET (REST) 104
Executing a Query Using SOAP 106
Looping Through Results 109
Five Creative Ways to Use the Amazon APIs 110
#1—Retrieve Feedback about a Seller with ECS 110
#2—Retrieve Product Pricing with ECS 110
#3—Look Up a Friend or Family Member’s Wish List with ECS 110
#4—Create an Shopping Cart with ECS 111
#5—Retrieve URL Information with Alexa Web Information Service 112
Other Ways to Use the Amazon APIs 112
Third-Party Amazon Extensions 113
Summary 115
Chapter 5: Using the eBay API 117
eBay 101 118
Introduction to the eBay API 118
Supported Features 119
Licensing Options 119
Joining the Developer’s Program and Establishing an Account 119
The eBay API Documentation 124
The eBay Software Developer’s Kit (SDK) 124
Anatomy of an eBay API Query 125
Query Syntax 125
Executing a Query Using HTTP-POST 127
Executing a Query Using SOAP 130
Five Creative Ways to Use the eBay API 132
#1—List an Item for Sale 133
#2—Retrieve a List of Categories 137
#3—Retrieve List of Pending Auctions for Seller 138
#4—Retrieve Winning Bidders of Dutch Auction 141
#5—Retrieve Feedback about a Seller 142
Other Ways to Use the eBay API 144
Third-Party eBay Extensions 145
Summary 146
Chapter 6: Using the PayPal API 147
PayPal 101 148
Introduction to the PayPal API 148
Supported Features 149
Getting Set Up to Use the PayPal API 149
Anatomy of a PayPal API Query 158
Query Syntax 158
Executing a Query 160
Other Ways to Use the PayPal API 162
Third-Party PayPal Extensions 162
Summary 162
Chapter 7: Other Web APIs 163
Faxing APIs 163
Setting Up a Free Developer Account 164
Sending a Test Fax 165
The UPS API 168
Setting Up a UPS Developer Account 168
Submitting a Request to the UPS API 170
The FedEx APIs 172
Setting Up a FedEx Developer Account 173
Submitting Transactions Using FedEx Ship Manager Direct 175
Bloglines Web API 176
Locating Additional Web APIs 178
Summary 180
Chapter 8: Calling Web APIs from Mobile Devices 181
What Devices Support XML Web APIs? 181
Windows Pocket PCs and Smartphones 182
Palm and Other Devices 183
Calling Web APIs from Pocket PC Applications 184
Example 1—Call MapPoint API Using SOAP Protocol to Retrieve Driving Directions 184
Example 2—Call API Using HTTP/GET (REST) Protocol 189
Summary 192
Chapter 9: Calling Web APIs from Microsoft Office 193
Calling Web APIs from VBA Code 193
Calling Web APIs Using VBA with HTTP/POST and HTTP/GET (REST) 194
Calling Web APIs Using SOAP Protocol 196
Calling a Web API from Microsoft Office Using .NET 202
Installing the Necessary Tools 203
Example—Calling Web Service from Word Using
Visual Basic .NET and SOAP 205
Summary 211
Chapter 10: Creating Your Own Web API 213
Designing the API 213
What Features Should the API Offer? 213
Which Protocols Should the API Support? 214
Should the Features Be Free or for a Fee? 215
Creating a Web API 215
Building an API Using Visual Studio .NET 216
Calling the Web API from a Client Application 222
Creating a Web API That Uses Other Programs or Services 224
Summary 224
Chapter 11: Case Study 1—Customer Relations
Management Application 225
Introduction to the Customer Relations Management (CRM) Application 225
Building the Project 228
Build the Database 228
Build the User Interface 230
Build the Modules 237
Touring the Completed Application 260
Summary 263
Chapter 12: Case Study 2—Executive Dashboard Application 265
Introduction to the Executive Dashboard Application 265
Building the User Interface 267
Creating the New Project 267
Adding References to the Web APIs 268
Adding Controls to the Form 270
Building the Code Modules 272
Touring the Completed Application 276
Summary 279
Index 281

e-book shop

Who This Book Is ForI
The ideal reader has had prior experience with Microsoft .NET development, such as WinForms and
WebForms applications because most or all code examples will be written with .NET. However, the book also provides general explanations that will be useful for people who are familiar with other languages. Thus, prior .NET development experience is not required, but people with prior .NET development experience will find the code examples more familiar and easier to follow.

István Novák, András Velvárt, Adam Granicz, György Balássy, Attila Hajdrik, Mitchel Sellers, Gastón C. Hillar, Ágnes Molnár, Joydip Kanjilal

at a Glance

History of Visual Studio
Visual Studio UI Enhancements
Visual Studio Code Snippets
Visual Studio Templates
Getting the Most Out of the IDE
Visual Studio Extensibility
 .NET Framework Version History
Modern UI Frameworks (WPF and Silverlight)
Windows Communication Foundation (WCF)
Enhancements to the .NET Core Framework
Enhancements to the .NET Workfl ow Framework
Enhancements to the .NET Data Framework
Enhancements to the .NET Communication Framework
NET Charting Components
ASP.NET Version History
ASP.NET Charting Controls
ASP.NET Dynamic Data
ASP.NET Model View Controller (MVC) 
ASP.NET Ajax Improvements
ASP.NET Ajax Control Toolkit and jQuery
History of Visual Basic
Visual Basic 10.0 Language Improvements
History of C#
C# 4.0 Language Improvements
Visual F# and the Other .NET Languages 

e-books shop
e-books shop
Purchase Now !
Just with Paypal

Book Details
 1274 p
 File Size 
 37,842 KB
 File Type
 PDF format
 978-1-118-00113-4 (ebk)
 978-1-118-00295-7 (ebk)
 978-1-118-00298-8 (ebk)
 2010 by Wiley Publishing, Inc 

ISTVÁN NOVÁK is an associate of Grepton, a Hungarian IT services company.
He works as a software architect and community evangelist. In the last 20 years, he
participated in more than 50 enterprise software development projects. In 2002,
he co - authored the fi rst Hungarian book about .NET development. In 2007, he was
awarded with the Microsoft Most Valuable Professional (MVP) title. He holds a
master ’ s degree from the Technical University of Budapest, Hungary, and also has
a doctoral degree in software technology. He lives in Dunakeszi, Hungary, with his wife and two
daughters. He is a passionate scuba diver. You may have a good chance of meeting him underwater
at the Red Sea in any season of the year.
ANDRÁS VELVÁRT is a Silverlight MVP, with a passion for user experience. As an
accomplished speaker, he gives talks at numerous conferences where Windows
Presentation Foundation (WPF) or Silverlight is the topic. Chapter 8 of this book
feeds from his experience at teaching many Silverlight and WPF classes and workshops.
He is also the owner of Response Ltd. ( ), a small consulting
and WPF/Silverlight development company in Hungary.
ADAM GRANICZ is the CEO of IntelliFactory, a leading provider of F# training, development, and
consulting services, as well as technologies that enable rapid functional, reactive web development.
As one of the fi rst F# users, he is a key community member and an active F# evangelist. He has been
the co - author of two F# books with Don Syme, the designer of the language. He is a regular speaker
at developer conferences and various industry partner events.
GYÖRGY BALÁSSY teaches web portal development as a lecturer at Budapest
University of Technology and Economics. He is a founding member of the local
MSDN Competence Centre (MSDNCC), having an important role in evangelizing the
.NET platform as a speaker, book author, and consultant. He provided leadership in
the foundation of the Hungarian .NET community as a key evangelist on Microsoft
events, technical forums, and as the head of the Portal Technology Group in the
MSDNCC. He is a regular speaker on academic and industrial events, presenting in - depth technical
sessions on .NET, ASP.NET, Offi ce development, and ethical hacking, for which he won the Best
Speaker and the Most Valuable Professional (MVP) Awards in SharePoint and ASP.NET multiple
times. He was selected to be the member of the ASPInsiders group. Since 2005, he has been the
Microsoft Regional Director in Hungary.
ATTILA HAJDRIK has worked in the IT industry for more than 14 years. He is the founder and lead
architect of Eyedea Ltd., a small independent software vendor (ISV) specializing in Rich Internet
Application (RIA) development. Before founding his own company, he worked for 6 years at
Microsoft as an Application Development Consultant, and later as a Senior Consultant in Microsoft
Services. He specialized in .NET - based custom development projects. In 2004, He was awarded an
ASP.NET Most Valuable Professional (MVP) title. He has experience with all .NET - related technologies
from the back end to the front end. He is addicted to Doman Specifi c Languages, model -
based development, and a big believer in design patterns. His favorite technologies are Silverlight,
Windows Presentation Foundation (WPF), and ASP.NET Model View Controller (MVC).
MITCHEL SELLERS specializes in software development using Microsoft technologies.
He is the CEO of IowaComputerGurus Inc., a Microsoft C# MVP, a Microsoft
Certifi ed Professional, and experienced technical writer. He enjoys spending time
sharing information with the development community through books, blog postings,
and public speaking events. He is also an active participant in the DotNetNuke
development community. For more information on him, visit his website at
GASTÓN C. HILLAR has been working with computers since he was 8 years old.
He began programming with the legendary Texas Instruments TI - 99/4A and
Commodore 64 home computers in the early 1980s. He has worked as developer,
architect, and project manager for many companies in Buenos Aires, Argentina.
He is now an independent IT consultant working for several American, German,
Spanish, and Latin American companies, and a freelance author. He has written four
books in English, contributed chapters to two other books, and has written more than 40 books in
Spanish. He contributes to Dr. Dobb ’ s Go  Parallel programming portal ( ), Dr. Dobb ’ s ( ), and is a guest blogger at Intel Software
Network ( ). He lives with his wife, Vanesa, and his son, Kevin.
When not tinkering with computers, he enjoys developing and playing with wireless virtual
reality devices and electronic toys with his father, his son, and his nephew, Nico. You can reach
him at . You can follow him on Twitter at . His blog is at .
ÁGNES MOLNÁR has been working with Microsoft technologies and SharePoint since 2001. After
a few years of working as a developer and SharePoint expert, she founded a SharePoint consulting
company in Hungary, Central Europe. She ’ s been working as a senior consultant, and has led
SharePoint implementations at numerous Central European companies. Her main focus is on
architecture, governance, information and knowledge management, and enterprise search. 
She ’ s a frequent speaker at conferences around the globe, and is also the co - author of various SharePoint books.
JOYDIP KANJILAL was awarded a Microsoft Most Valuable Professional (MVP) title in
ASP.NET in 2007, 2008, and 2009. He has more than 12 years of industry experience in IT, with
more than 6 years experience in Microsoft .NET and its related technologies. He was selected as
MSDN Featured Developer of the Fortnight (MSDN), and was also selected as Community Credit
Winner at several times. He has authored numerous books on
ASP - related topics.

DOUG PARSONS is a software architect and the director of Ohio Operations for NJI New Media.
His expertise is in web development with a specialization in political websites. Most notably, he has
worked on the 2008 John McCain presidential campaign website and, more recently, Mitt Romney ’ s
offi cial book tour website. In his downtime, he enjoys spending time with his lovely fi anc é e, Marisa,
and their four puppies.

IN THE .NET DEVELOPMENT WORLD, we have seen massive improvements and enhancements to the framework over the last several years. Since 2006, we have seen releases of .NET 3.0, .NET 3.5,
and .NET 4. We have also seen the introduction of many new technologies such as Windows
Communication Foundation (WCF), Windows Presentation Foundation (WPF), Windows
Workfl ow, and Silverlight that came as parts of the various releases.

Keeping up with all of this change can be diffi cult for all developers, both those new to the industry
and those who have been using .NET since its inception almost ten years ago. To help keep up
with this rapid change, this book serves as an “ all - in - one reference ” for the major changes and
enhancements and provides a glimpse into the specifi cs of the new technologies.

Table of Contents
Roots 4
The First Breakthrough: Visual Basic 4
Other Languages and Tools 4
Visual Studio 97 and 6.0 5
Visual Studio.NET 2002 and 2003 5
Visual Studio 2005 7
Visual Studio 2008 8
Visual Studio 2010 10
Changes in Editions 10
What’s New in Visual Studio 2010 12
Shift to WPF 12
Summary 13
Basic IDE Overview 15
Exploring the Start Page 15
Understanding Window Management 16
New Project Dialog Window 17
Creating New Projects in a New Way 19
Using the Add Reference Dialog Window 19
Using the Extension Manager 20
Exploring New Daily Development Features 20
Exploring the Code Editor Window 20
Code Navigation 22
Generate From Usage 24
Exploring the Visual Designers 25
WPF Designer 26
XML Schema Designer 27
New Tools for Architects 27
Summary 29
Understanding Code Snippets 32
Using Code Snippets 34
HTML, SQL, and JScript Code Snippets 37
Creating Code Snippets 38
Creating a Simple Code Snippet 38
The Code Snippet File Structure 41
Managing Code Snippets 51
The Code Snippet Manager 52
Code Snippet Storage 53
Adding and Removing Snippets 54
Importing Snippets 54
Advanced Code Snippet Features 56
Multiple Snippets in a File 56
Code Snippets in Other Languages 58
Building Online Code Snippet Providers 59
Snippet Editors 59
Export as Code Snippet Add-In 60
Snippet Designer 61
Snippet Editor 62
Summary 63
The Role of Templates 66
Project Templates 67
Item Templates 69
Creating Templates 70
Creating a Simple Project Template 71
Creating a Simple Item Template 76
Template Storage Structure 81
Template Folders 82
The Template Manifest File 84
Customizing Templates 98
Template Parameters 98
Custom Template Parameters 99
Wizards 101
Deploying Templates 110
Exporting and Importing Templates 111
Creating a Template Installation Kit 114
Summary 125
Window Management 128
Visual Studio Window Architecture 128
Tool Windows 131
Document Windows 132
Arranging Windows 134
Customizing Menus and Toolbars 138
The Customize Dialog 139
Adding Menus and Commands 140
Creating and Rearranging Toolbars 144
Context Sensitivity 145
IDE Confi guration 145
The Options Dialog 145
Changes in Option Pages 147
Visual Studio Settings 150
Reducing Eff orts with Keyboard Shortcuts 155
Command Routing and Command Contexts 155
Working with Keyboard Shortcuts 157
Working with Keyboard Mapping Schemes 160
Custom Start Pages 162
Creating Your First Custom Start Page 163
Changing the StartPage.xaml File 173
Accessing the Visual Studio Context 176
Accessing the Visual Studio Object Model 182
A Few More Points About Start Pages 186
Customizing the Toolbox 186
A Lap Around the Toolbox 186
Customizing Toolbox Tabs 189
Adding Items to the Toolbox 190
A Few More Points About Toolbox Customization 193
Visual Studio Gallery 193
Browsing the Visual Studio Gallery 194
Downloading and Installing Components 196
Adding Your Own Contributions to the Gallery 197
Working Together with the Community 198
Summary 198
The Visual Studio Shell and Packages 202
Package Integration 203
Extensibility Out of the Box 204
Extending Visual Studio by Customization 204
Using Macros to Automate Common Tasks 208
Visual Studio Add-Ins 209
Extensions with Visual Studio SDK 210
The Full Power of Extensibility 210
Visual Studio Package Development 211
Editor Extensibility 212
Creating Visual Studio Macros 213
Understanding the Structure of Macros 213
Using the Macros IDE 218
Recording and Developing Macros 221
Macro Samples 225
Creating Visual Studio Add-Ins 229
Add-In Architecture 229
Creating a Simple Add-In 230
Using the Automation Model 239
Going on with Add-In Development 241
Visual Studio Packages in a Nutshell 242
Creating a Package with a Simple Menu Command 242
Debugging the Package 254
Extending the New Editor 255
Extending the Editor with the Managed Extensibility Framework 256
Editor Extensibility Points 258
Creating a Simple Classifi er 260
Summary 275
Before the .NET Framework 279
Win/Win32 Programming in C 279
C++ Programming 280
Programming in Visual Basic 280
Programming in Delphi 281
COM Programming 281
The Origin and Goals of the .NET Framework 282
Evolution of the .NET Framework 283
.NET Framework 1.0 286
.NET Framework 1.1 286
.NET Framework 2.0 286
.NET Framework 3.0 287
.NET Framework 3.5 287
.NET Framework 4.0 288
.NET Compact Framework 289
.NET Micro Framework 289
.NET Framework Architecture 289
Common Language Run-time (CLR) 290
Base Class Library 291
Services of the .NET Architecture 292
Main Benefi ts of the .NET Framework 293
Summary 294
The Importance of User Experience 297
Developers Are from Vulcan, Designers Are from Venus 299
A New Generation of Presentation Frameworks 301
The Ten Pillars of Silverlight 303
XAML 304
Tools for Working with Silverlight (and WPF) 313
Layout 315
Data Binding 322
Styles 330
Templates 332
Animations 341
Media 345
Networking 352
Other Features 355
Windows Presentation Foundation 359
WPF Features not Available in Silverlight 361
Choosing Between WPF and Silverlight 366
Designer - Developer Cooperation in Silverlight and WPF 367
A Common Solution Format 367
Blendability 368
Design Time Sample Data in Blend 369
SketchFlow 370
Triggers, Actions, and Behaviors 371
Model-View-ViewModel Pattern 372
Summary 373
WCF Versus ASMX Web Services 375
A Quick Look at SOA 376
Service 377
Service Provider 377
Service Consumer(s) 377
Service Registry 377
Service Contract 377
Service Proxy 378
Service Lease 378
Message 378
Service Description 378
Advertising and Discovery 378
Building Blocks of the WCF Architecture 378
Getting Started With WCF 381
Creating the WCF Service 382
Defi ning Data Contracts 386
Specifying the Binding Information 387
Hosting the WCF Service 388
Creating the Service Proxy 389
Creating the Service Client — The Service Consumer 391
Working with an Ajax-Enabled WCF Service 392
REST and WCF 394
Implementing a WCF Service Declaratively 394
Defi ning the Service Contract 395
Hosting the Service 396
Implementing the Service Logic Declaratively 396
Summary 398
Changes in Common Language Run-time 400
In-Process Side-By-Side Execution 400
DLR Integration 402
Type Equivalence 411
Parallel Computing 415
The Challenge of Many-core Shift 416
The Microsoft Approach 418
Parallel LINQ 421
Task Parallel Library 428
Code Contracts 455
Managed Extensibility Framework 463
The Challenge 463
A Simple MEF Example 465
Basic MEF Concepts 471
Composition 477
A Few More Points on MEF 486
Summary 487
An Introduction to WF 4.0 490
The Workfl ow Design Surface 491
The Hello Workfl ow Application 492
Creating Flowcharts and Coded Workfl ows 499
Flowcharts in WF 4.0 500
Code-Only Workfl ows 505
Workfl ow Architecture 509
Workfl owApplication and Hosts 510
Activities 511
Extensions 512
Workfl ow Activity Model Changes 513
Workfl ow Activity Library 517
Primitive Activities 518
Flow Control Activities 518
Workfl ow Run-Time Activities 520
Flowchart-Specifi c Activities 521
Error-Handling Activities 522
Transaction-Handling Activities 523
Collection-Handling Activities 524
Messaging Activities 525
Using the Compensating Transaction Model 527
The ConferenceWorkfl ow Example 527
Implementing Cancellation, Confi rmation, and Compensation 528
Cancellation 530
Compensation 530
Persistence and Human Interactions 532
The DomainNameWorkfl ow Project 533
Workfl ow Tracking 544
Workfl ow Services 551
Creating a Workfl ow Service 551
Using Workfl owServiceHost 553
Summary 562
Language Integrated Query (LINQ) 563
LINQ Operators 564
LINQ Implementations 566
Parallel LINQ (PLINQ) 572
Entity Framework 573
Entity Framework Architecture 573
The Entity Data Source Control 579
Choosing Between LINQ to Entities and LINQ to SQL 579
Summary 579
Enhancements in WCF Framework 3.5 581
Enhancements in WCF Framework 4.0 583
Simplifi ed Confi guration 583
Standard Endpoints 585
Discovery 586
REST Improvements 588
Routing Service 589
Summary 592
Creating Charts 594
Creating a Simple Chart 594
Adding Data to the Chart Programmatically 598
Adding Charts to WPF Applications 603
Using Chart Controls 605
Elements of a Chart 606
The Chart Class 607
Chart Types 609
Chart Coordinate System 617
Three-Dimensional Charts 619
Appearance of Chart Elements 621
Axes and Related Chart Elements 623
Data Points 630
Advanced Chart Manipulation 633
Annotations 633
Binding Data to Series 638
The DataManipulator class 641
More Chart Manipulations 648
Summary 649
Development of the Web and Web Development 653
Enter ASP 654
Enter ASP.NET 655
ASP.NET Version History 657
ASP.NET 1.0 659
ASP.NET 1.1 659
ASP.NET 2.0 659
ASP.NET 3.0 664
ASP.NET 3.5 665
ASP.NET 3.5 SP1 667
ASP.NET 4.0 667
Summary 668
Creating Charts 670
Adding a Chart Control to a Page 670
Setting up Charts in an Event Handler Method 674
Binding Data to the Chart 676
Rendering ASP.NET Charts 679
Image URL Rendering 680
Using Charts with Legacy Web Sites 683
Binary Stream Rendering 684
Chart State Management 688
Saving Chart State 688
Advanced Chart State Management 690
User Interactivity 694
Using Tooltips 694
Handling Clicks on Data Points 696
Interactivity With Ajax 697
A Few More Points on User Interactivity 709
Summary 709
Creating a New Dynamic Data Web Site 711
Working Against a Data Model 711
Displaying Data from Existing Tables 716
Creating Simple CRUD Applications 718
Creating a Dynamic Data Application for Master-Detail Relationships 725
Working to Modify Implementation to Fit Business Needs 730
Understanding Dynamic Data’s Structure 730
Customizing the Look and Feel 732
Working with Page Templates 735
Working with Field Templates 738
Working with Entity Templates 741
Working with Filter Templates 744
Creating Custom Pages 746
Customizing Validations 747
Summary 750
Introduction to MVC 752
Similar Design Patterns 753
Microsoft and the Web Platform 753
What Is Microsoft ASP.NET MVC 2? 754
Extensibility in MVC 760
Creating an MVC 2 Application 761
The Project Structure 763
How Does it Work? 764
Adding New MVC 2 Pages 771
Create a Database 771
Create a Model 772
Listing Books 773
Adding Book Actions 779
Customization in MVC 2 790
Model Binding 790
Validation 795
UI Customization 804
Routing Details 816
Controller Factory 816
Infl uencing the Execution Flow 817
Authorization 819
Action and Result Filtering 821
Exception Filtering 822
ActionResult 822
Testing with MVC 2 824
Refactoring AcmeLibrary 824
Creating and Running Unit Tests 831
A Few More Points on MVC 2 834
Areas 834
Metadata Providers 834
Value Providers 834
Model Binders 835
Child Actions 835
Asynchronous Controllers 835
Summary 835
Understanding Ajax 838
The XMLHttpRequest Object 839
ASP.NET and Ajax 840
Using the ASP.NET Ajax Server Controls 841
Refactoring the Framework Libraries 844
Using the Microsoft CDN 846
Using the Microsoft Ajax Library 848
Working with DOM Elements 852
The Script Loader 855
Client-Side Data Binding with Templates 859
Advanced Data-Binding Scenarios 872
Working with Server-Side Data 878
Summary 892
First Look at the Ajax Control Toolkit 894
Installing the Ajax Control Toolkit 894
Creating a Simple Web Application with the Toolkit 896
Using the Controls of the Toolkit 908
New Server Controls 915
Control Extenders 938
Animations 957
The jQuery Library 962
“Hello, World” with jQuery 963
Selectors and Filters 965
Chaining and Utility Functions 970
Eventing Model and Event Handlers 971
Visual Eff ects and Animations 975
jQuery Ajax Features 976
Summary 977
The Roots of Visual Basic 982
Structured and Unstructured BASIC 982
Moving to “Visual” 984
Visual Basic in the 1990s 985
Visual Basic in the .NET Framework 986
Design Goals and Debates 986
Visual Basic .NET (7.0) and .NET 2003 (7.1) 987
Visual Basic 2005 (8.0) 989
Visual Basic 2008 (9.0) 997
Summary 1005
New Productivity-Improving Syntax 1008
Implicit Line Continuation 1008
Auto-Implemented Properties 1010
Collection Initializers 1012
Multiline Lambda Expressions 1018
Working with Dynamic Objects 1020
Late Binding in Visual Basic 2010 1021
Accessing an IronPython Library 1023
Variance 1026
Type Substitution 1026
Variance in Visual Basic 2010 1029
A Few More Points on Variance 1033
Summary 1038
The Evolution of C# 1041
Design Goals 1042
Short History 1042
Implementations 1043
C# 1.0 1044
Type System 1044
Memory Management 1045
Syntactic Sugar 1046
C# 1.1 1047
C# 2.0 1047
Generic Types 1048
Partial Types 1050
Static Classes 1051
Iterators 1052
Anonymous Methods 1052
Delegate Inference 1053
Delegate Covariance and Contravariance 1053
Nullable Types 1054
Property Accessors 1055
Null-Coalesce Operator 1056
Namespace Aliases 1056
C# 3.0 1056
Local Variable Type Inference 1057
Extension Methods 1057
Anonymous Types 1058
Lambda Expressions 1059
Query Expressions 1060
Expression Trees 1061
Automatic Properties 1062
Object Initializers 1062
Collection Intializers 1063
Partial Methods 1063
Summary 1064
Pains with Interoperability 1066
Creating the PainWithOffi ce Application 1066
Frustrating Issues 1069
Remove the Pain 1070
Dynamic Lookup 1072
Dynamic Binding 1072
The dynamic Type 1073
Dynamic Operations 1074
The Dynamic Language Run-time 1077
Named and Optional Parameters 1078
Using Optional Parameters 1079
Using Named Parameters 1081
Overload Resolution 1082
COM-Specifi c Interoperability Features 1084
Dynamic Import 1084
Omitting ref from Parameters 1084
Indexed Properties 1085
Compiling Without PIAs 1086
Variance 1087
Type Substitution 1087
Bird’s-Eye View of Variance 1089
Variance in C# 4.0 1090
A Few More Points on Variance 1094
Summary 1099
A Brief History of F# 1104
F# at First Glance 1105
Trying Things Out with F# 1106
Understanding Syntax 1107
Your First F# Project 1112
Programming with F# 1113
Namespaces and Modules 1113
Attributes 1115
Literals and Bindings 1115
Expressions 1120
Values and F# Types 1124
Type Augmentations 1137
Computation Expressions 1138
Sequences 1141
Range Expressions 1143
Sequence Expressions 1143
Asynchronous Workfl ows 1144
Pattern Matching 1146
Active Patterns 1149
Exceptions 1154
Units of Measure 1157
Lazy Computations 1159
Quotations 1160
Working with Database Queries 1161
A Larger Application in F# 1163
The Ast Module 1164
The Language Module 1164
The Evaluator Module 1166
The FunctionPlotter Module 1167
Running the Function Plotter 1170
Other .NET Languages 1170
IronRuby 1170
IronPython 1170
Summary 1171
INDEX 1173

e-books shop

This book was written with the experienced .NET developer in mind. Many of the chapters talk
specifi cally about the enhancements or changes that have been introduced with the new versions of
the .NET Framework. However, even those readers who are not fl uent in .NET development should
be able take a lot out of the detailed examples provided in this book.

For the experienced reader, a few “ history ” chapters have been added to help identify when various
functionality has been added so that you can quickly identify the needed toolset to be able to adopt
a specifi c feature.

Readers will need access to an edition of Visual Studio 2010; this book uses the Premium edition
of Visual Studio 2010 for most of the examples. 
However, other editions (including the Express editions) will work.

James Payne

Wrox Programmer to Programmer™

at a Glace

Part I: Dipping Your Toe into Python
Programming Basics and Strings
Numbers and Operators
Variables — Names for Values
Part II: Python Language and the Standard Library
Making Decisions
Classes and Objects
Organizing Programs
Files and Directories
Other Features of the Language
Building a Module
Text Processing 
Part III: Putting Python to Work
Writing a GUI with Python
Accessing Databases
Using Python for XML
Network Programming
Extension Programming with C
Numerical Programming
An Introduction to Django 
Web Applications and Web Services 
Integrating Java with Python
Part IV: Appendices
Appendix A: Answers to the Exercises
Appendix B: Online Resources
Appendix C: What’s New in Python 3.1
Appendix D: Glossary

e-books shop
e-books shop
Purchase Now !
Just with Paypal

Book Details
 2.00 USD
 628 p
 File Size
 4,519 KB
 File Type
 PDF format
 2010 by Wiley Publishing, Inc  

About the Author
James Payne (Margate, FL) is Editor-in-Chief of Developer Shed, Inc. and has been writing and
programming since the age of seven years old. Proficient in many languages, he has written over
400 articles covering practically every major programming language. As a contractor, he develops
proprietary software for the financial industry using Python and likes to dabble in Django in his
spare time.

Welcome to Python 3.1!
I’ve been working with Python for about ten years now, and every new version has caused me to fall in
love with the language all over again. Version 3.1 is no different. If you are new to Python, rest easy —
I’ll guide you every step of the way. If, on the other hand, you are an old Python hand exploring the new version, the book is structured so that you can learn the new information you need, without wasting
time on already-known information.
I wanted to write this book because I love Python. I love it! And I want to share my love with you. And,
maybe you’ll grow to love it as I do.

Who This Book Is For
If you’re computer-literate, and want to learn a fun programming language to better control your
computer, this book is for you.
If you are a system administrator who wants to learn a great language to help you better manage and
configure systems and networks, this book is for you.
If you already know Python, but are wondering what cool new features are available in version 3.1, this
book is for you. In summary, this book is for anyone interested in exploring Python programming with the newest and most full-featured, easy-to-use version, 3.1.

What This Book Covers 
This book is designed to cover Python 3.1. Python 3.1, released in 2009, is the latest major revision of the Python programming language. Since Python is a cross-platform language, the content and examples in the book are applicable in any platform (unless specified otherwise). When there is a choice to be made as to platform independence, the examples will be as cross-platform as possible.
In addition, since Python 3.1 is relatively new, not all supporting libraries have been updated to work in
Python 3.x. In those instances where this is the case and it is felt that the theory still needs to be
expounded upon, Python 2.6 will be used in lieu of version 3.1.
What You Need to Use This Book
There are some minimal requirements to use the material in this book. The following are
recommendations, as Python itself runs on many different platforms. However, the first chapters assume that you have access to a GUI such as is available in Windows, Mac OS X, or the X Window system on UNIX and Linux. Naturally, some chapters, such as the GUI chapter, require the GUI as well, and chapters involving networking will make much more sense if a network connection is in place.
Following are the suggested minimum requirements:
❑ A PC running Linux, a BSD UNIX, or Windows running at 500MHz or faster, or a G3 or later
Macintosh running Mac OS X version 10.2 or later
❑ 256MB of memory (at a minimum)
❑ A graphical user interface native to the platform you are on
❑ Necessary access to the computer you are on so that you may install required software
❑ Network access to a TCP/IP network such as the Internet or a campus network
❑ Internet access to download required software

Table of Contents
Introduction xxvii
Part I: Dipping Your Toe into Python 1
Chapter 1: Programming Basics and Strings 3
How Programming is Different from Using a Computer 3
Programming is Consistency 4
Programming is Control 4
Programming Copes with Change 5
What All That Means Together 5
The First Steps 5
Installing Python 3.1 on Non-Windows Systems 6
Using the Python Shell 6
Beginning to Use Python — Strings 7
What is a String? 7
Why the Quotes? 7
Why Three Types of Quotes? 8
Using the print() Function 8
Understanding Different Quotes 9
Putting Two Strings Together 11
Joining Strings with the Print() Function 12
Putting Strings Together in Different Ways 12
Summary 13
Exercises 14
Chapter 2: Numbers and Operators 15
Different Kinds of Numbers 15
Numbers in Python 16
Program Files 18
Using the Different Types 19
Basic Math 21
Some Surprises 23
Using Numbers 24
Order of Evaluation 24
Number Formats 25
Mistakes Will Happen 26
Some Unusual Cases 27
Summary 28
Exercises 29
Chapter 3: Variables — Names for Values 31
Referring to Data — Using Names for Data 31
Changing Data Through Names 33
Copying Data 33
Names You Can’t Use and Some Rules 34
Using More Built-in Types 34
Tuples — Unchanging Sequences of Data 34
Lists — Changeable Sequences of Data 37
Dictionaries — Groupings of Data Indexed by Name 39
Treating a String Like a List 41
Special Types 42
Other Common Sequence Properties 43
Referencing the Last Elements 43
Ranges of Sequences 44
Growing Lists by Appending Sequences 45
Using Lists to Temporarily Store Data 45
Working with Sets 46
Summary 47
Exercises 48
Part II: Python Language and the Standard Library 49
Chapter 4: Making Decisions 51
Comparing Values — Are They the Same? 51
Doing the Opposite — Not Equal 53
Comparing Values — Which One Is More? 54
More Than or Equal, Less Than or Equal 55
Reversing True and False 56
Looking for the Results of More Than One Comparison 56
How to Get Decisions Made 57
Repetition 60
How to Do Something — Again and Again 60
Stopping the Repetition 62
Handling Errors 65
Trying Things Out 65
Summary 67
Exercises 69
Chapter 5: Functions 71
Putting Your Program into Its Own File 71
Functions: Grouping Code under a Name 73
Choosing a Name 75
Describing a Function in the Function 75
The Same Name in Two Different Places 76
Making Notes to Yourself 78
Asking a Function to Use a Value You Provide 79
Checking Your Parameters 81
Setting a Default Value for a Parameter—Just in Case 83
Calling Functions from within Other Functions 84
Functions Inside of Functions 86
Flagging an Error on Your Own Terms 87
Layers of Functions 88
How to Read Deeper Errors 88
Summary 89
Exercises 90
Chapter 6: Classes and Objects 93
Thinking About Programming 93
What is an Object? 93
Objects You Already Know 94
Looking Ahead: How You Want to Use Objects 95
Defining a Class 96
How Code Can Be Made into an Object 96
Objects and Their Scope 104
Summary 107
Exercises 108
Chapter 7: Organizing Programs 111
Modules 112
Importing a Module So That You Can Use It 112
Making a Module from Pre-existing Code 113
Using Modules — Starting with the Command Line 115
Changing How Import Works — Bringing in More 118
Packages 118
Modules and Packages 120
Bringing Everything into the Current Scope 120
Re-importing Modules and Packages 121
Basics of Testing Your Modules and Packages 124
Summary 124
Exercises 125
Chapter 8: Files and Directories 127
File Objects 127
Writing Text Files 128
Appending Text to a File 129
Reading Text Files 130
File Exceptions 131
Paths and Directories 131
Exceptions in os 132
Paths 132
Directory Contents 135
Obtaining Information about Files 136
Renaming, Moving, Copying, and Removing Files 137
Example: Rotating Files 138
Creating and Removing Directories 140
Globbing 140
Summary 142
Exercises 142
Chapter 9: Other Features of the Language 143
Lambda and Filter: Short Anonymous Functions 143
Map: Short-Circuiting Loops 144
Decisions within Lists — List Comprehension 145
Generating Iterators for Loops 146
Special String Substitution Using Dictionaries 148
Featured Modules 149
Getopt — Getting Options from the Command Line 149
Using More Than One Process 152
Threads — Doing Many Things in the Same Process 154
Summary 156
Exercises 156
Chapter 10: Building a Module 157
Exploring Modules 157
Importing Modules 159
Finding Modules 159
Digging through Modules 160
Creating Modules and Packages 162
Working with Classes 163
Defining Object-Oriented Programming 163
Creating Classes 163
Extending Existing Classes 165
Finishing Your Modules 166
Defining Module-Specific Errors 166
Choosing What to Export 167
Documenting Your Modules 168
Testing Your Module 176
Running a Module as a Program 178
Creating a Whole Module 179
Installing Your Modules 183
Summary 187
Exercises 188
Chapter 11: Text Processing 189
Why Text Processing Is So Useful 189
Searching for Files 190
Clipping Logs 191
Sifting through Mail 192
Navigating the File System with the os Module 192
Working with Regular Expressions and the re Module 199
Summary 203
Exercises 204
Part III: Putting Python to Work 205
Chapter 12: Testing 207
Assertions 208
Test Cases and Test Suites 209
Test Fixtures 213
Putting It All Together with Extreme Programming 216
Implementing a Search Utility in Python 216
A More Powerful Python Search 222
Formal Testing in the Software Life Cycle 224
Summary 225
Chapter 13: Writing a GUI with Python 227
GUI Programming Toolkits for Python 228
Tkinter Introduction 229
Creating GUI Widgets with Tkinter 229
Resizing the Widget 230
Configuring Widget Options 231
Putting the Widgets to Work 231
Creating Layouts 232
Packing Order 233
Controlling Widget Appearances 233
Radio Buttons and Checkboxes 235
Dialog Boxes 236
Other Widget Types 237
Summary 238
Exercises 238
Chapter 14: Accessing Databases 239
Working with DBM Persistent Dictionaries 240
Choosing a DBM Module 240
Creating Persistent Dictionaries 241
Accessing Persistent Dictionaries 243
Deciding When to Use DBM and When to Use a Relational Database 245
Working with Relational Databases 245
Writing SQL Statements 247
Defining Tables 249
Setting Up a Database 250
Using the Python Database APIs 252
Downloading Modules 252
Creating Connections 253
Working with Cursors 253
Working with Transactions and Committing the Results 260
Examining Module Capabilities and Metadata 261
Handling Errors 261
Summary 262
Exercises 263
Chapter 15: Using Python for XML 265
What Is XML? 265
A Hierarchical Markup Language 265
A Family of Standards 267
What Is a Schema/DTD? 268
What Are Document Models For? 268
Do You Need One? 268
Document Type Definitions 268
An Example DTD 268
DTDs Aren’t Exactly XML 270
Limitations of DTDs 270
Schemas 270
An Example Schema 270
Schemas Are Pure XML 271
Schemas Are Hierarchical 271
Other Advantages of Schemas 271
XPath 272
HTML as a Subset of XML 272
The HTML DTDs 273
HTMLParser 273
XML Libraries Available for Python 274
What Is SAX? 274
Stream-based 275
Event-driven 275
What Is DOM? 275
In-memory Access 275
Why Use SAX or DOM 275
Capability Trade-Offs 276
Memory Considerations 276
Speed Considerations 276
SAX and DOM Parsers Available for Python 276
xml.sax 276
xml.dom.minidom 277
Intro to XSLT 280
Transformation and Formatting Language 280
Functional, Template-Driven 280
What Is lxml? 280
Element Classes 281
Adding Text to Elements 282
Parsing with lxml 283
Parsing Files 284
Summary 285
Exercises 285
Chapter 16: Network Programming 287
Understanding Protocols 289
Comparing Protocols and Programming Languages 289
The Internet Protocol Stack 290
A Little Bit About the Internet Protocol 292
Sending Internet E-mail 293
The E-mail File Format 294
MIME Messages 295
Sending Mail with SMTP and smtplib 303
Retrieving Internet E-mail 305
Parsing a Local Mail Spool with mailbox 305
Fetching Mail from a POP3 Server with poplib 307
Fetching Mail from an IMAP Server with imaplib 309
Secure POP3 and IMAP 313
Webmail Applications Are Not E-mail Applications 313
Socket Programming 314
Introduction to Sockets 314
Binding to an External Hostname 316
The Mirror Server 317
The Mirror Client 318
SocketServer 320
Multithreaded Servers 321
The Python Chat Server 322
Design of the Python Chat Server 323
The Python Chat Server Protocol 323
The Python Chat Client 329
Single-Threaded Multitasking with select 331
Other Topics 332
Miscellaneous Considerations for Protocol Design 333
The Peer-to-Peer Architecture 333
Summary 334
Exercises 335
Chapter 17: Extension Programming with C 337
Extension Module Outline 338
Building and Installing Extension Modules 340
Passing Parameters from Python to C 342
Returning Values from C to Python 345
The LAME Project 346
The LAME Extension Module 350
Using Python Objects from C Code 363
Summary 366
Exercises 366
Chapter 18: Numerical Programming 367
Numbers in Python 368
Integers 368
Long Integers 369
Floating-point Numbers 369
Formatting Numbers 370
Characters as Numbers 373
Mathematics 374
Arithmetic 374
Built-in Math Functions 375
Complex Numbers 378
Arrays 380
The array Module 382
Summary 384
Exercises 384
Chapter 19: An Introduction to Django 387
What Are Frameworks and Why Would I Use One? 388
Other Features of Web Frameworks 388
Django — How It All Began 389
Installing Django 389
Understanding Django’s Architecture 390
Initial Project Setup 391
Creating a View 394
Working with Templates 396
Using Templates and Views 398
Models 401
Creating a Model: First Steps — Configure the Database Settings 401
Creating a Model: Creating an Application 403
Working with Models: Installation 404
Summary 405
Exercises 406
Chapter 20: Web Applications and Web Services 407
REST: The Architecture of the Web 408
Characteristics of REST 409
REST Operations 410
HTTP: Real-World REST 411
The Visible Web Server 412
The HTTP Request 415
The HTTP Response 416
CGI: Turning Scripts into Web Applications 417
The Web Server Makes a Deal with the CGI Script 419
CGI’s Special Environment Variables 420
Accepting User Input through HTML Forms 422
HTML Forms’ Limited Vocabulary 422
The cgi Module: Parsing HTML Forms 423
Safety When Accessing Form Values 423
Building a Wiki 428
The BittyWiki Core Library 429
The BittyWiki Web Interface 432
Web Services 441
How Web Services Work 442
REST Web Services 442
REST Quick Start: Finding Bargains on 443
Introducing WishListBargainFinder 445
Giving BittyWiki a REST API 448
Wiki Search-and-Replace Using the REST Web Service 451
The XML-RPC Request 457
The XML-RPC Response 459
If Something Goes Wrong 459
Exposing the BittyWiki API through XML-RPC 460
Wiki Search-and-Replace Using the XML-RPC Web Service 463
SOAP 465
SOAP Quick Start 466
The SOAP Request 466
The SOAP Response 467
If Something Goes Wrong 468
Exposing a SOAP Interface to BittyWiki 468
Wiki Search-and-Replace Using the SOAP Web Service 470
Documenting Your Web Service API 472
Human-Readable API Documentation 473
The XML-RPC Introspection API 474
WSDL 475
Choosing a Web Service Standard 478
Web Service Etiquette 479
For Consumers of Web Services 479
For Producers of Web Services 479
Using Web Applications as Web Services 480
Summary 480
Exercises 480
Chapter 21: Integrating Java with Python 481
Scripting within Java Applications 482
Comparing Python Implementations 483
Installing Jython 483
Running Jython 484
Running Jython Interactively 484
Running Jython Scripts 485
Controlling the jython Script 486
Making Executable Commands 487
Running Jython on Your Own 488
Packaging Jython-Based Applications 488
Integrating Java and Jython 489
Using Java Classes in Jython 489
Accessing Databases from Jython 494
Writing Java EE Servlets in Jython 500
Choosing Tools for Jython 506
Testing from Jython 506
Embedding the Jython Interpreter 507
Calling Jython Scripts from Java 508
Handling Differences between C-Python and Jython 510
Summary 511
Exercises 512
Part IV: Appendices 513
Appendix A: Answers to the Exercises 515
Appendix B: Online Resources 549
Appendix C: What’s New in Python 3.1 553
Appendix D: Glossary 559
Index 569

e-books shop

How This Book Is Structured
As might be expected from a “Beginning” book, the book begins with an introduction to the language.
From there, you’ll move through the core of the language, then move on to more advanced and
specialized topics. The book is divided up into four parts.
Part I — Dipping Your Toe into Python
The first part will allow you to, as the title suggests, dip your toe in.
Programming Basics and Strings
First you’ll be introduced to Python. This chapter will explore what Python is, and why it is so useful
and powerful. Also explored will be Python’s history from its early development to the newest version,
which is the focus of this book. You’ll also learn about the scope of Python’s reach, and all the different
areas of application development in which Python plays a part. Finally, you’ll learn to work with your
first data type — strings.
Numbers and Operators
This chapter will guide you through the basics of working with numbers and operators. You will learn
the different types of numbers, how to perform simple — and complex — equations, and work with the
various operators. You will also learn about order of precedence and formatting numbers.
Variables — Names for Values
Ultimately, programming languages help you to manage different types of information — in other
words, data. An understanding of data types and how they are represented in Python is essential to
programming in Python. This chapter will help you to understand the best ways to represent different
data types in Python.
Part II — Python Language and the Standard Library
Of course, the core piece of knowledge you need to use a language is to know the language itself, and
familiarize yourself with its syntax and modules. This part will start small, with data types and
variables, and gradually introduce additional concepts until you have all the information you need to
develop fully functional Python programs.
You’ll want to read through these chapters sequentially –– each chapter builds on the information
presented in the previous chapter.
Making Decisions
Ultimately, there will come a point when your program must make a decision — do I take this path or
that path? And what happens when I take that path? In this chapter, you will learn how to compare data,
such as deciding if one value is greater than another, and use repetition to repeat repetitive tasks.  
This chapter will help you to expand on your Python knowledge by introducing you to functional
programming. Functions allow you to take advantage of powerful concepts like parameter passing and
code reuse. You’ll learn how to use functions to make your code more efficient and flexible.
Classes and Objects
Here you will be shown what objects are and learn to create classes. You will learn how to define them,
create objects in your classes, write methods, and discuss the scope of your objects.
Organizing Programs
When your programs get larger, you’ll want to divide them up into separate components. This chapter
will discuss Python modules. You’ll also explore packages, which are nothing but collections of modules.
Files and Directories
An important part of everyday programming is learning to work with files and directories. This chapter
focuses on creating, modifying, and working with files in general. In addition, you will learn how to
obtain data from files and how to interact with the various directories.
Other Features of the Language
Here you will learn about some of the other features the language has to offer, including how to make
decisions with lists, string substitutions with dictionaries, and some of the featured modules.
Building a Module
Modules help you save time by allowing you to reuse snippets of code. It also ensures fewer errors, as
the module you use will have been tested and used many times before. Here, we will learn to create our
own modules, as well as import and work with pre-existing modules –– something that makes Python
particularly powerful.
Text Processing
There are so many things you can do with text in programming and in essence, text is the key to
effectively communicating with your user. After all, without it, the only thing you are left with is images.
In this chapter you learn to process text in a variety of ways, including: working with regular
expressions, searching for files, and searching for files of a particular type.
Part III — Putting Python to Work
So, now that you know what Python is, and how to work with the language, what’s next, you ask? 
This final part explores many of the programming topics you’ll likely encounter or want to explore. 
These can be looked at sequentially, or in any order you like . . . these chapters are independent of each other.
There is only one way to ensure your program works before it is in the hands of the user, and that is by
testing your program. Here, you will learn not only the concepts behind properly testing your programs,
but the tools and frameworks available to you.
Writing a GUI with Python
Thus far in the book, all the programs work through the command line. In this chapter, you’ll be
introduced to the concept of GUI programming. You’ll also walk through creating a few GUI programs
with Tkinter, the most popular GUI toolkit used by Python programmers.
Accessing Databases
Databases store information that your program can use for an infinite amount of reasons. It also acts as a place for you to store information, and later retrieve that information for a given task. In this chapter you learn about the different types of databases and how to work with them.
Using Python for XML
XML is a powerful tool for processing data on the Internet. Here, you will learn the basics of XML
including the difference between schema and DTD, basic syntax, how to create and validate your own
XML, and more advanced topics such as using lxml.
Network Programming
Now that the Internet has wormed its way into our everyday lives, and has become more of a necessity
than a privilege, learning to programmatically send e-mails and allow users to communicate across the
web is essential. In this chapter, you will learn how to do just that.
Extension Programming with C
This chapter delves into programming with the C language, including working with C frameworks
and modules, the basics of C, and passing parameters from Python to C, and then returning value back
to Python.
Numerical Programming
Numbers were touched on briefly in the beginning of this book; now it is time to delve more deeply
below the surface. Here you will learn all there is to know about integers and floating point numbers, as
well as complex numbers, arrays, and working with built-in math functions and modules.
An Introduction to Django
Django is a web application framework written in Python, which utilizes the model-view-architecture
pattern. Originally created for managing news websites, Django has become popular for its ease of use,
allowing programmers to create complex websites in a simple fashion, including database-focused sites.
Here we will learn the basics of Django.
Web Applications and Web Services
Here you will learn the foundations of working with web applications and web services. You will learn
about the REST architecture, as well as how to work with HTTP Requests and Responses
Integrating Java with Python
In this chapter you learn the basics of Java, building a strong foundation before you delve blending the
two languages together. You will learn the various modules that allow you to work with Java in Python
and how to create simple, yet effective applications.
Part IV: Appendices
In the back of the book, there are some useful appendices to further your knowledge and fun with
❑ Answers to the Exercises
❑ Online Resources –– where do you go from here?
❑ What’s New in Python 3.1
❑ Glossary of terms
Loading... Protection Status