'Programming'에 해당되는 글 16

  1. 2008.03.04 PHP Redirect TutorialThe PHP Redirect command
  2. 2008.02.15 Dive Into Python -- python from novice to pro
  3. 2008.02.15 Python的应用
  4. 2008.01.11 regular expression
  5. 2008.01.03 connect to DB in python
  6. 2007.12.04 python
Programming/others | Posted by 알 수 없는 사용자 2008. 3. 4. 16:30

PHP Redirect TutorialThe PHP Redirect command

The PHP Redirect command

<?php
header("location: [some-url]");
?>
Replace [some-url] with the URL where you want the redirection to take place.

For example,

header("location: ./version2/index.html"); =>redirect to "index.html" page in
subfolder called "version2"
header("location: http://www.yahoo.com"); =>redirect to a website called yahoo.com
If PHP is not available, it's also possible to use other redirects:

HTTP Redirects
<meta http-equiv="Refresh" content="[time];
URL=[some-url]">

Replace [time] with seconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.

For example,

<meta http-equiv="Refresh" content="5;
URL=http://www.yahoo.com">

The above HTTP based redirect needs to be in the region of the HTML code.

JavaScript Redirects

<script language=javascript>
setTimeout("location.href='[some-url]'",[time]);
</script>

Replace [time] with milliseconds. This will pause the browser for the specified number of seconds. Replace [some-url] with the target URL you want to redirect.

For example,
setTimeout("location.href='http://www.yahoo.com'", 5000);
The above JavaScript based redirect can be either in the or region of the HTML code.
Usually a PHP redirect is much more reliable than other form of redirects like HTTP redirect or JavaScript based redirects. For example a JavaScript redirect may not work if a user's browser settings has JavaScript turned off.

The reason why PHP redirects will work no matter what settings users have on their browser is because PHP is server side script. It will not depend on browser settings that may affect JavaScript which is parsed on the client-side/user-side.
Programming/Python | Posted by 알 수 없는 사용자 2008. 2. 15. 23:16

Dive Into Python -- python from novice to pro

[Dive Into Python]

Dive Into Python is a Python book for experienced programmers. You can buy a printed copy, read it online, or download it in a variety of formats. It is also available in multiple languages.

The complete text is available online. You can read the revision history to see what's new. Updated 20 May 2004

Programming/Python | Posted by 알 수 없는 사용자 2008. 2. 15. 22:40

Python的应用



Zope-应用服务器

Plone-内容管理系统

Django-鼓励快速开发的web framework

Twisted - Python Network Application Framework Python的网络应用程序框架

TurboGears - 另一个Web应用快速开发框架

Bit Torrent - 著名的BT下载工具

2006年的Google编程大赛已经将Python作为参赛语言之一
Programming/Python | Posted by 알 수 없는 사용자 2008. 1. 11. 16:47

regular expression

Simple Patterns

  • metacharacters :
    • .  ^  $  *  +  ?  {  [  ]  \  |  (  )
  • [abc] = [a-c] : will match any of the characters "a", "b" or "c"
  • metacharacters are not active inside classes.
    • [abc$] : will match any of the characters of "a", "b", "c" or "$"
    • "$" is usually a metacharacter, but inside a character class it's stripped of its special nature.
  • not within the range-- complementing
    • [^5] : will match any character except "5"
  • .
    • match anything except a newline character
  • "\" is used to escape all the metacharactes so you can still match them in patterns
    • \[ or \\ : match "[" or "\"
  • \d = [0-9]
    • match any decimal digit
  • \D = [^0-9]
    • match any non-digit character
  • \s = [\t\n\r\f\v]
    • match nay whitespace character
  • \S = [^\t\n\r\f\v]
    • match any non-whitespace character
  • \w = [a-zA-Z0-9_]
    • match any alphanumeric character
  • \W = [^a-zA-Z0-9_]
    • match any non-alphanumeric character


Programming/Python | Posted by 알 수 없는 사용자 2008. 1. 3. 23:28

connect to DB in python

import MySQLdb

# Create a connection object and create a cursor
Con = MySQLdb.Connect ( host = "kle.postech.ac.kr", user="joe", passwd = "secrete", db = "onto_web" )
Cursor = Con.cursor ()

#Make SQL string and execute it
sql = "show tables"
Cursor.execute ( sql )

#Fetch all results from the cursor into a sequence and close the connection
Results = Cursor.fetchall ()
Con.close ()
Programming/Python | Posted by 알 수 없는 사용자 2007. 12. 4. 09:10

python




From www.python.or.kr
( These are PDF files. )

1. 개요
2. 파이썬 기초
3. while문
4. list, for문
5. tuples
6. functions
7. dictionary
8. files
9. exceptions
10. classes
11. module
12. string
13. regular expression
14. Tkinter GUI
15. 수치연산 모듈
16. Internet Programming