Presentation is loading. Please wait.

Presentation is loading. Please wait.

Python A Comprehensive Programming Language 胡崇偉 Open Source Software Foundry.

Similar presentations


Presentation on theme: "Python A Comprehensive Programming Language 胡崇偉 Open Source Software Foundry."— Presentation transcript:

1 Python A Comprehensive Programming Language 胡崇偉 marr@citi.sinica.edu.tw Open Source Software Foundry

2 自由軟體鑄造場 營運網站以提供自由軟體專案進駐開發 提供系統技術與工具以協助軟體開發 研究開放源碼軟體授權條款與法律政策 議題並提供諮詢 媒合促成以自由軟體為基礎的本地成功 案例 報導國內外產業及社群新聞 進行人才培育及國際交流活動

3 Service and Resource 專案管理

4 Service and Resource 專案管理 版本管理 共同筆記 檔案下載 通信論壇 統計資訊 待辦事項

5 Service and Resource 專案管理 版本管理 共同筆記 檔案下載 通信論壇 統計資訊 待辦事項 資源目錄 人才資料 授權條款 精靈 研究報告 教學文件 電子報 推廣光碟

6 Python ?

7 Python is a Dynamic Object-Oriented Programming Language

8 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)

9 >>> 是提示符號

10 Interactive with Interpreter Read-Eval-Print Loop Edit Compile Deploy Debug Wait Read Eval Print

11 Built-in DataTypes Number String List Tuple Dictionary 7, 11.0 ‘Hello World’ [7, 11, ‘store’] (7, 11, ‘shop’) {‘name’:’marr’, ‘home’:’taipei’} elements

12 MIT to Try Python in CS Courses

13 Other Features Cross Platform and Porting Excellent Modules Small Efficient Popular

14 Nokia PyS60

15 Indexing and Slicing myString = “I Love Python” myString[0] == “I” myString[-1] == “n” myString[7:-2] == “Pyth” ILovePython [ 0↓0↓ 1↓1↓ 2↓2↓ 7 -6 ↓ -2 ↓ ↓ ]

16 Code Indenting No explicit begin or end No curly braces if age > 18: print “You are old enough.” else: print “You are too young.”

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

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

19 Socket Creation import socket s = socket.socket( socket.AF_INET, socket.SOCK_STREAM) s.connect( ("www.mysite.com", 80))

20 Twisted - Networking Engine A web server, numerous chat clients, chat servers, mail servers and more. Supported protocols: Sample apps: BitTorrent, CIA Bot, BuildBot, apt-proxy2

21 RestructuredText http://docutils.sourceforge.net/ Support Formats: HTML,XML,S5,LaTeX rst2html myRST.html

22 Version Control Mercurial

23 GUI Library and Toolkit

24 Wingware IDE

25 Python Package Index

26 PyGame

27

28 Blender

29 Elephants Dream

30 SQLAlchemy from sqlalchemy import * db = create_engine(‘sqlite:///tutorial.db’) metadata = MetaData(db) users = Table(‘users’, metadata, Column(‘user_id’, Integer, primary_key=True), Column(‘name’, String(40)), ) users.create() i = users.insert() i.execute(name=‘marr’)

31 Web Frameworks

32 Python Hosting

33 Extending and Embedding $ swig -python example.i $ gcc -c example.c example_wrap.c \ -I/usr/local/include/python2.1 $ ld -shared example.o example_wrap.o -o _example.so >>> import example >>> example.fact(5) 120

34 Self Learning – Where to Start On-line Tutorial –Google ‘ python tutorial ’ Books Local User Groups –pythontw google group OpenFoundry Forums

35 Anytime, Anywhere IPython

36 Python-based CMS Case Study

37 Plone … a CMS Built on Zope Written in Python

38 Blog (CoreBlog)

39 Portal (CIA, USA)

40 Portal (NASA, USA)

41 Network Management (ZenOSS)

42 Issue Tracker (Poi)

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

44 Windows Installer

45

46

47 Plone Controller

48 Filesystem Listing Python Zope Plone Packages/Products Software Home Instance Home

49 One Database, Many Instances HTTP Requests and Responses Instance #1Instance #2 ZEO Client #1ZEO Client #2 port 8080 port 8081 Data.fs

50 Front Page

51 Zope Management Interface (ZMI)

52 Site Setup

53 Guest View

54 Authenticated View

55 Tip for Trying Out - Different Browsers for Different Users/Roles One for Admin, Another for Regular User

56 Usecase #1 Create a New User

57

58 Views Available After Login Personal Bar Content Views

59 Usecase #2 Create New Contents (Page)

60 Default Content Types Page News Item Event Image File Link

61 Title to ID (Part of the URL) ↓

62 Visual Editor

63 Content States

64 Default State and Workflow

65 Roles and Permissions ViewAddEditReview Manager ✔✔✔✔ Reviewer ✔✔✔ Member ✔✔✔ Non-Login ?

66 Core Security Mapping

67 Transaction and Undo

68 Usecase #3 Manage Portlets

69

70

71

72

73 Usecase #4 Enable OpenID Support

74

75 Usecase #5 Change Theme (to NuPlone)

76 Free Themes

77 Better and Super Plone ?

78 Want More ? Join the Community and Develop !

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

80 SQL Database Connection MySQL Database Connection PgSQL Database Connection ODBC Database Connection Z SQL Method Z SQL Method Z SQL Method Z SQL Method Z SQL Method Z SQL Method

81 Database Components Gadfly MySQL MySQLDA P ostgre SQL PsycopgDA MSSQL ODBCDA Zope Z SQL Method Search Interface DTML Script Page Template HTMLWYSWYG Editor Database Adapter Plone Site Development and Management Database Connection

82 Designer Friendly Templates Work with WYSIWYG editors Zope Page Template (ZPT) –Template Attribute Language (TAL) –Macro Expansion Tag Attribute Language (METAL) Page Title Attribute Name XML Namespace Attribute Value namebody TAL statement Element Content

83 Theme Designers ? AJAX / jQuery Support KSS = Kinetic Style Sheets Deliverance Must Read –Plone 3 Theming

84 Repeatable Development buildout.cfg bin/buildout editingrunning with Python Package Index checking into *.egg *.tar.gz downloading product/ package installed as

85 Build Your Own Project cd c:\ C:\plone\python\Scripts\paster create plone3_buildout MyBuildout cd MyBuildout vim buildout.cfg bin\buildout.exe

86 buildout.cfg Sample [buildout] http-address = 8080 eggs = Plone my.package zcml = my.package debug-mode = on

87 Summary A Comprehensive CMS 通用型的內容管理系統 The Web CMS Report Ideaware Report

88 Web CMS 2007 Content Production Services Authoring & Transformation Aggregation Repository Services Metadata/Taxonomy Management Globalization Promotion Path System Reporting Content Delivery Services Personalization Site Search Scaling & Performance Multichannel & Syndication Content Retention User-Generated Content Micro-Applications Site Analytics Vendor Intangibles Maintenance & Support Integration & Tech Partnerships Active User Groups Services & Channel Product QA Strategy & Roadmap Good Value Technology Standards Development Access Control Templating Page Rendering Usability Internationalization

89 Active Community

90 Multilingual Support

91 Open Source Projects ArgoUML SchoolTool

92 Alternative Theming - Deliverance

93 Developer Baby Steps Python Script + External Method

94 Plone Hosting

95 Thank You ! Question? Email to marr.tw@gmail.com


Download ppt "Python A Comprehensive Programming Language 胡崇偉 Open Source Software Foundry."

Similar presentations


Ads by Google