From 670bd2a8213d2ba70d4efbc5a7c6ddf0c3818207 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 5 Oct 2011 06:43:00 -0400 Subject: [PATCH] codes --- 1_context/0_philosophy.md | 34 ++++++++++---- 1_context/1_herecy.md | 0 2_problem/0_problem.md | 96 +++++++++++++++++++++++++++++++++++++++ 3_proposal/0_proposal.md | 0 4 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 1_context/1_herecy.md create mode 100644 2_problem/0_problem.md create mode 100644 3_proposal/0_proposal.md diff --git a/1_context/0_philosophy.md b/1_context/0_philosophy.md index f59f786..4e9982d 100644 --- a/1_context/0_philosophy.md +++ b/1_context/0_philosophy.md @@ -1,23 +1,39 @@ !SLIDE # Part I: Philosophy +!SLIDE +# Dark Pasts + +- Perl +- Java +- PHP +- ColdFusion +- Classic ASP + !SLIDE code # The Zen of Python. >>> import this !SLIDE -# Beautiful is better than ugly. - +> Beautiful is better than ugly. !SLIDE -# There should be one—and preferably only one—obvious way to do it. - +> Explicit is better than implicit. !SLIDE -# How to install Python? - -A show of hands, please. - +> Readability counts. !SLIDE -# Exactly. \ No newline at end of file +> Although practicality beats purity. + +!SLIDE +> If the implementation is hard to explain, it's a bad idea. + +!SLIDE +# Welcome to paradise. + +!SLIDE +> There should be one—and preferably only one—obvious way to do it. + +!SLIDE +# LIES! diff --git a/1_context/1_herecy.md b/1_context/1_herecy.md new file mode 100644 index 0000000..e69de29 diff --git a/2_problem/0_problem.md b/2_problem/0_problem.md new file mode 100644 index 0000000..f6cfd5e --- /dev/null +++ b/2_problem/0_problem.md @@ -0,0 +1,96 @@ +!SLIDE +# Part II: Beginnings + +So, let's say we're new to Python. + +Let's get started! + +!SLIDE +# Step 1: Pick a Release. +Pick carefully. + + +!SLIDE incremental +# Step 2: Install Python. + +Decisions, decisions. + +* Download installer from python.org? +* 32bit or 64bit? +* Build from source? +* If so, Unix or framework build? + +!SLIDE +# Step 3: Profit! + +Let's play around. Maybe play with the GitHub API? + + +!SLIDE small code execute +# Ruby. + @@@ ruby + require 'net/http' + require 'uri' + + uri = URI.parse('https://api.github.com/user') + + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + + req = Net::HTTP::Get.new(uri.request_uri) + req.basic_auth('username', 'password') + + r = http.request(req) + + puts r + +!SLIDE smaller code execute +# Python. + @@@ python + import urllib2 + + gh_url = 'https://api.github.com/user' + + req = urllib2.Request(gh_url) + + password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() + password_manager.add_password(None, gh_url, 'user', 'pass') + + auth_manager = urllib2.HTTPBasicAuthHandler(password_manager) + opener = urllib2.build_opener(auth_manager) + + urllib2.install_opener(opener) + + handler = urllib2.urlopen(req) + + print handler.read() + +!SLIDE +# http/url/lib/2 + + + +!SLIDE +# Step 3: Install Packages. + +* MySQL-Python + + +!SLIDE +# Common Pitfalls +* easy_uninstall? + +!SLIDE +# Installing Dependencies + +* Pip? Virtualenv? Never mentioned in the docs. +* python-mysql +* mod_wsgi + +# Integration Time + +!SLIDE +# PIL + +(On OSX, this is simple) + diff --git a/3_proposal/0_proposal.md b/3_proposal/0_proposal.md new file mode 100644 index 0000000..e69de29