搜狐的:http://mirrors.sohu.com
网易的:http://mirrors.163.com
上海交通大学FTP:http://202.38.97.230
如果你是教育网的用户,上海交通大学FTP访问速度非常的快。
-
« Home
Pages
-
RSS Feeds
搜狐的:http://mirrors.sohu.com
网易的:http://mirrors.163.com
上海交通大学FTP:http://202.38.97.230
如果你是教育网的用户,上海交通大学FTP访问速度非常的快。
In JavaScript, undefined means a variable has been declared but has not yet been assigned a value, such as:
var TestVar;
alert(TestVar); //shows undefined
alert(typeof TestVar); //shows undefined
null is an assignment value. It can be assigned to a variable as a representation of no value:
var TestVar = null;
alert(TestVar); //shows null
alert(typeof TestVar); //shows object
From the preceding examples, it [...]
函数是JavaScript中很重要的一个语言元素,提供了一个function关键字和内置对象Function,下面是其可能的用法和它们之间的关系。
使用方法一:
var foo01 = function(){
var temp = 100;
this.temp = 200;
return temp + this.temp;
}
alert(typeof(foo01));
alert(foo01());
运行结果:
function
300
最普通的function使用方式,定一个JavaScript函数。两种写法表现出来的运行效果完全相同,唯一的却别是后一种写法有较高的初始化优先级。在大扩号内的变量作用域中,this指代foo01的所有者,即window对象。
使用方法二:
var foo02 = new function() {
var temp = 100;
this.temp = 200;
[...]
1.jQuery.fn.extend 是对jQuery方法进行扩展
demo: jquery 本身并不提供 jQuery.color() 这个方法,如果我们需要对jQuery本身提供的方法进行扩展,则我们就需要是用jQuery.fn.extend
jQuery.fn.extend({
color:function(val){
if(val==undefined){
return $(this).css(”color”);
}else{
[...]
Time模块:
--------------------------
time() #以浮点形式返回自Linux新世纪以来经过的秒数。在linux中,00:00:00 UTC,
January 1, 1970是新**49**的开始。
>>>time.time()
>>>1150269086.6630149
>>>time.ctime(1150269086.6630149)
>>>’Wed Jun 14 15:11:26 2006′
time.ctime([sec])#把秒数转换成日期格式,如果不带参数,则显示当前的时间。
>>> import time
>>> time.ctime()
>>> ‘Wed Jun 14 15:02:50 2006′
>>> time.ctime(1138068452427683)
‘Sat Dec 14 04:51:44 1901′
>>> time.ctime(os.path.getmtime(’E:\\untitleds.bmp’))
‘Fri Sep 19 16:35:37 2008′
>>> time.gmtime(os.path.getmtime(’E:\\untitleds.bmp’))
time.struct_time(tm_year=2008, tm_mon=9, tm_mday=19, tm_hour=8, tm_min=35, tm_sec=37, tm_wday=4, tm_yday=263, tm_isdst=0)
#将一个文件的修改时间转换为日期格式(秒 转 日期)
>>> time.strftime(’%Y-%m-%d %X’,time.localtime(os.path.getmtime(’E:\\untitleds.bmp’)))
>>> ‘2008-09-19 16:35:37′
#定时3秒。
>>> time.sleep(3)
TIME模块参考:
---------------------------------
#取一个文件的修改时间
>>> os.path.getmtime(’E:\\untitleds.bmp’)
1221813337.7626641
变量
timezone 通用协调时间和本地标准时间的差值,以秒为单位。
altzone 通用协调时间和本地夏令时的差值
daylight 标志,本地时间是否反映夏令时。
tzname (标准时区名,夏令时时区名)函数
time() 以浮点数返回纪元至今以来的秒数。
clock() 以浮点数返回CPU开始这个process的时间,(或者至上次调用这个函数的时间)
sleep() 延迟一段以浮点数表示的秒数。
gmtime() 把以秒表示的时间转换为通用协调时序列
localtime() 把秒时转换为本地时序列
asctime() 将时间序列转换成文本描述
ctime() 将秒时转换成文本描述
mktime() [...]
简介:
urllib2是python的一个获取url(Uniform Resource Locators,统一资源定址器)的模块。它用urlopen函数的形式提供了一个非常简洁的接口。这使得用各种各样的协议获取url成为可能。它同时 也提供了一个稍微复杂的接口来处理常见的状况-如基本的认证,cookies,代理,等等。这些都是由叫做opener和handler的对象来处理的。
以下是获取url最简单的方式:
import urllib2
response = urllib2.urlopen(’http://python.org/’)
html = response.read()
许多urlib2的使用都是如此简单(注意我们本来也可以用一个以”ftp:””file:”等开头的url取代”HTTP”开头的url).然而,这篇教程的目的是解释关于HTTP更复杂的情形。HTTP建基于请求和回应(requests &responses )-客户端制造请求服务器返回回应。urlib2用代 表了你正在请求的HTTP request的Request对象反映了这些。用它最简单的形式,你建立了一个Request对象来明确指明你想要获取的url。调用urlopen函 数对请求的url返回一个respons对象。这个respons是一个像file的对象,这意味着你能用.read()函数操作这个respon对象:
import urllib2
req = urllib2.Request(’http://www.tinoweb.cn’)
response = urllib2.urlopen(req)
the_page = response.read()
注意urlib2利用了同样的Request接口来处理所有的url协议。例如,你可以像这样请求一个ftpRequest:
req = urllib2.Request(’ftp://example.com/’)
对于HTTP,Request对象允许你做两件额外的事:第一,你可以向服务器发送数据。第二,你可以向服务器发送额外的信息(metadata),这些信息可以是关于数据本身的,或者是关于这个请求本身的–这些信息被当作HTTP头发送。让我们依次看一下这些。
数据:
有时你想向一个URL发送数据(通常这些数据是代表一些CGI脚本或者其他的web应用)。对于HTTP,这通常叫做一个Post。当你发送一个你 在网上填的form(表单)时,这通常是你的浏览器所做的。并不是所有的Post请求都来自HTML表单,这些数据需要被以标准的方式encode,然后 作为一个数据参数传送给Request对象。Encoding是在urlib中完成的,而不是在urlib2中完成的。
import urllib
import urllib2
url = ‘http://www.someserver.com/cgi-bin/register.cgi’
values = {’name’ : ‘Michael Foord’,
‘location’ : ‘Northampton’,
‘language’ : ‘Python’ }
data = urllib.urlencode(values)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
如果你不传送数据参数,urlib2使用了一个GET请求。一个GET请求和POST请求的不同之处在于POST请求通常具有边界效应:它们以某种 方式改变系统的状态。(例如,通过网页设置一条指令运送一英担罐装牛肉到你家。)虽然HTTP标准清楚的说明Post经常产生边界效应,而get从不产生 边界效应,但没有什么能阻止一个get请求产生边界效应,或一个Post请求没有任何边界效应。数据也能被url自己加密(Encoding)然后通过一 个get请求发送出去。
这通过以下实现:
import urllib2
import urllib
data = [...]
With this book, you can build exciting, scalable web applications quickly and confidently, using Google App Engine — even if you have little or no experience in programming or web development. App Engine is one of the most exciting web technologies to appear in the last year, providing a simple, easy-to-use application framework with [...]
Learn to leverage PHP5’s OOP features to write manageable applications with ease
General OOP concepts explained
Implement Design Patterns in your applications and solve common OOP Problems
Take full advantage of native built-in objects
Test your code by writing unit tests with PHPUnit
In Detail
Some basic objected-oriented features were added to PHP3; with PHP5 full support for object-oriented programming [...]
Here’s no doubt about it — Facebook is cool. Along with users who want to interact with friends, businesses are using Facebook as a marketing and networking tool. And if you’re a Web developer, you probably know there’s a demand for Facebook applications. If you have some basic knowledge of Web client technology, such [...]
Another sunny day,
Has come and gone away,
In Paris and Rome,
I want to go home,
Mmmmmm
Maybe surrounded by,
A million people I,
Still feel all alone,
I just want to go home,
Oh I miss you, You know,
And i’ve been keeping all the letters,
That I wrote to you,
Each one a line or to,
I’m fine baby how are you,
Well I would [...]