python a comprehensive programming language

Post on 08-Jan-2016

64 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

Python A Comprehensive Programming Language. 胡崇偉 marr@citi.sinica.edu.tw Open Source Software Foundry. 自由軟體鑄造場. 營運網站以提供自由軟體專案進駐開發 提供系統技術與工具以協助軟體開發 研究開放源碼軟體授權條款與法律政策議題並提供諮詢 媒合促成以自由軟體為基礎的本地成功案例 報導國內外產業及社群新聞 進行人才培育及國際交流活動. Service and Resource. 專案管理. Service and Resource. 共同筆記. 版本管理. - PowerPoint PPT Presentation

TRANSCRIPT

Python

A ComprehensiveProgramming Language

胡崇偉marr@citi.sinica.edu.tw

Open Source Software Foundry

自由軟體鑄造場

• 營運網站以提供自由軟體專案進駐開發• 提供系統技術與工具以協助軟體開發• 研究開放源碼軟體授權條款與法律政策議題並提供諮詢

• 媒合促成以自由軟體為基礎的本地成功案例

• 報導國內外產業及社群新聞• 進行人才培育及國際交流活動

Service and Resource

專案管理

Service and Resource

專案管理

版本管理

共同筆記

檔案下載

通信論壇

統計資訊

待辦事項

Service and Resource

專案管理

版本管理

共同筆記

檔案下載

通信論壇

統計資訊

待辦事項

資源目錄 人才資料

授權條款精靈

研究報告教學文件

電子報

推廣光碟

Python ?

Python is a

DynamicObject-Oriented

Programming Language

Run-Time Typing

• Python's run time must work harder than Java's.

• a + b = ?– inspect the objects a and b to find out their type,

which is not known at compile time.– 7 + 11.0– ‘Hello’ + ‘world’– (1, 2, 3) + (4, 5, 6)

Interactive with Interpreter

Read-Eval-Print Loop

Edit

Compile

Deploy

DebugWait

Read

Eval

Print

>>> 是提示符號

Built-in DataTypes

• Number

• String

• List

• Tuple

• Dictionary

7, 11.0

‘Hello World’

[7, 11, ‘store’]

(7, 11, ‘shop’)

{‘name’:’marr’, ‘home’:’taipei’}

elementselements

MIT to Try Python in CS Courses

Other Features

• Cross Platform and Porting• Excellent Modules• Small• Efficient• Popular

Nokia PyS60

Indexing and Slicing

• myString = “I Love Python”

• myString[0] == “I”

• myString[-1] == “n”

• myString[7:-2] == “Pyth”

I L o v e P y t h o n

[0

1

2

7

-6

-2

-1

↓]

Code Indenting

• No explicit begin or end

• No curly braces

if age > 18: print “You are old enough.”else: print “You are too young.”

Function Example

def myFunc(score): “”” document strings “”” import math math.sqrt(score) * 10

File Handling

fileobj = open(“myfile”, “r”)lines = fileobj.readlines()for line in lines: print line

Socket Creation

import socket

s = socket.socket( socket.AF_INET, socket.SOCK_STREAM)s.connect( ("www.mysite.com", 80))

Python Package Index

RestructuredText

• http://docutils.sourceforge.net/

• Support Formats: HTML,XML,S5,LaTeX

• rst2html < myRST.txt > myRST.html

Version Control

• Mercurial

GUI Library and Toolkit

Wingware IDE

PyGame

PyGame

Blender

Elephants Dream

SQLAlchemy

Web Frameworks

Python Hosting

Plone …

a CMS

Built on Zope

Written in Python

Blog (CoreBlog)

Portal (CIA, USA)

Portal (NASA, USA)

Network Management (ZenOSS)

Issue Tracker (Poi)

Download Installer• http://plone.org/products/plone

Windows Installer

Windows Installer

Windows Installer

Plone Controller

Filesystem Listing

• Python

• Zope

• Plone

• Packages/Products

• Software Home

• Instance Home

One Database, Many Instances

HTTP Requests and Responses

Instance #1 Instance #2

ZEO Client #1 ZEO Client #2port 8080 port 8081

Data.fs

Front Page

Zope Management Interface (ZMI)

Site Setup

Guest View

Authenticated View

Tip for Trying Out -Different Browsers

forDifferent Users/Roles

One for Admin, Another for Regular User

Usecase #1

Create

a New User

Views Available After Login

• Personal Bar

• Content Views

Usecase #2

CreateNew Contents

(Page)

Default Content Types

Page

News Item

Event

Image

File

Link

Title to ID (Part of the URL)

Visual Editor

Content States

Default State and Workflow

Roles and Permissions

View Add Edit Review

Manager ✔ ✔ ✔ ✔

Reviewer ✔ ✔ ✔

Member ✔ ✔ ✔

Non-Login ?

Core Security Mapping

Transaction and Undo

Usecase #3

Manage

Portlets

Usecase #4

Enable

OpenID Support

Usecase #5

Change Theme (to NuPlone)

Free Themes

Better and Super Plone ?

Want More ?

Join the Community and Develop !

Starting Points• http://plone.org/documentation• http://marrtw.blogspot.com/2009/04/plone3-books.html

SQL Database Connection

MySQLDatabase

Connection

PgSQLDatabase

Connection

ODBCDatabase

Connection

Z SQLMethod

Z SQLMethod

Z SQLMethod

Z SQLMethod

Z SQLMethod

Z SQLMethod

Database Components

GadflyMySQL

MySQLDA

PostgreSQL

PsycopgDA

MSSQL

ODBCDA

Zope

Z SQL Method

Search Interface

DTML

Script

Page Template

HTML WYSWYG Editor

DatabaseAdapter

PloneSite

Developmentand

Management

DatabaseConnection

Designer Friendly Templates

• Work with WYSIWYG editors

• Zope Page Template (ZPT)– Template Attribute Language (TAL)– Macro Expansion Tag Attribute Language (METAL)

<title tal:content="here/title">Page Title</title>

AttributeName

XML Namespace

AttributeValue

name bodyTAL statement

ElementContent

Theme Designers ?

• AJAX / jQuery Support

• KSS = Kinetic Style Sheets

• Deliverance

• Must Read– Plone 3 Theming

Repeatable Development

buildout.cfg bin/buildout

editing running with

PythonPackageIndex

checking into

*.egg

*.tar.gz

downloadingproduct/package

installed as

Build Your Own Project

cd c:\C:\plone\python\Scripts\paster create plone3_buildout MyBuildout

cd MyBuildoutvim buildout.cfgbin\buildout.exe

buildout.cfg Sample

[buildout]http-address = 8080eggs = Plone my.packagezcml = my.packagedebug-mode = on

Summary

A Comprehensive CMS ?通用型的內容管理系統

The Web CMS Report

Ideaware Report

Web CMS 2007Content Production ServicesAuthoring & TransformationAggregationRepository ServicesMetadata/Taxonomy ManagementGlobalizationPromotion PathSystem Reporting

Content Delivery ServicesPersonalizationSite SearchScaling & PerformanceMultichannel & SyndicationContent RetentionUser-Generated ContentMicro-ApplicationsSite Analytics

Vendor IntangiblesMaintenance & SupportIntegration & Tech PartnershipsActive User GroupsServices & ChannelProduct QAStrategy & RoadmapGood Value

TechnologyStandardsDevelopmentAccess ControlTemplatingPage RenderingUsabilityInternationalization

Active Community

Multilingual Support

Open Source Projects

OpenPlans

ArgoUML

SchoolTool

Alternative Theming - Deliverance

Developer Baby Steps• Python Script + External Method

Plone Hosting

Thank You !

Question?

Email to marr.tw@gmail.com

top related