PHP / Web / Python

来源:互联网 发布:unity3d点击生成物体 编辑:程序博客网 时间:2024/06/06 21:38

==vim==

sudo save in vi:

:w !sudo tee %


==.htaccess==

http://support.hostgator.com/articles/general-help/apache-mod_rewrite-and-examples

# Redirect all pages from olddomain.com
# to newdomain.com
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^olddomain.com$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]

OR=or, L=last rule

==Env==

BitNami for XAMPP: http://bitnami.com/stack/xampp?utm_source=bitnami&utm_medium=installer&utm_campaign=XAMPP%2BInstaller


==Env==

[2010-12-31T20:27:53+08:00] apache+php http://www.php.net/manual/en/install.windows.apache2.php    Options +ExecCgi

[2011-01-04T19:45:39+08:00] In PHP 5.3.0 and above the MySQL-related database extensions use the MySQL Native Driver by default. you may want to set some preferences in php.ini depending on your requirements.
[2011-01-04T19:48:56+08:00] windows php.ini : extension_dir = "ext"

[2011-01-12T17:13:50+08:00] php xdebug: need enable socket
[2011-01-12T17:14:56+08:00] netbeans + php: http://wiki.netbeans.org/HowToConfigureXDebug#How_to_configure_xdebug_with_WAMP

[2011-01-12T22:15:29+08:00] Mediawiki + UCenter 1.5 + Discuz 7.0/7.1/7.2 : http://www.discuz.net/thread-1208570-1-1.html

[2011-01-15T14:44:56+08:00] define('var', 'value');    echo var;
define('v', 'value');  echo v;

[2011-01-15T23:13:48+08:00] dl dt dd

WLMP is an acronym, which stands for the first letters of Windows / LightTPD / MySQL / PHP.

http://en.wlmp-project.net/downloads.php?cat=wlmp

[2011-06-27T05:04:39+08:00] css, html, js IDE: http://www.aptana.com/downloads/start

[2011-01-22T22:55:18+08:00] source control: https://github.com/

[2011-06-27T05:08:01+08:00] Debugging Tool seems better than Fiddler: http://www.zendstudio.net/archives/charlas-web-debugging-proxy/#more-1365

--Eclipse--

Load & Run  faster:

--launcher.XXMaxPermSize
756M

[2011-06-27T15:03:18+08:00] In Eclipse, go to Preferences>General>Workspace and select UTF-8 as the Text File Encoding

==Sample==

[2011-02-14T20:41:41+08:00] CSS Text: http://www.w3.org/TR/CSS21/text.html

[2011-05-11T17:39:37+08:00] http://skyje.com/2010/02/css-sprites/

==Projects==

[2011-01-19T22:59:31+08:00] online editor: CKEditor

[2011-01-09T20:00:48+08:00] http://en.wikipedia.org/wiki/Wikipedia:Spoken_articles

--My PHP Twitter API client--

Function: post/delete a tweet; list recent tweets; support mobile browser
Reference: Twitter API: Up and Running(click "Examples" to download the sample code)


<?php$file_folder = $_SERVER['DOCUMENT_ROOT'].'/t/';$files_php = array("index","index_do");foreach ($files_php as $file_php){$files[] = $file_folder.$file_php.'.php';}foreach($files as $file){$fp = fopen($file, 'r');$fp_out = fread($fp, filesize($file));echo '';echo htmlspecialchars($fp_out);echo '';}?>



==Python==

[2011-01-12T23:04:51+08:00] >>> import os

>>> os.listdir ("c:\\")



''' python


#need learning
Selenium、Robotium、Athrun、Café
LoadRunner、selenium、appscan、jmeter




# debugging
vars(v)


##file


In [98]: type(open("comm.py",'rb'))
Out[98]: _io.BufferedReader


In [97]: type(open("comm.py",'rb').read())
Out[97]: bytes


In [99]: type(open("comm.py",'r').read())
Out[99]: str




## soap
# save file:
html = soup.prettify("utf-8")
with open("output.html", "wb") as file:
    file.write(html)


   
    
mydivs = soup.findAll("div", { "class" : "stylelistrow" })    



## image
from PIL import Image
im = Image.open("lena.ppm")
im.show()
#error
OSError: cannot identify image file 'error.jpg'


## parsing
>>> import ast
>>> ast.literal_eval("{'muffin' : 'lolz', 'foo' : 'kitty'}")
{'muffin': 'lolz', 'foo': 'kitty'}






my_cookies = {'cookiename1': 'cookievalue1', 'cookiename2': 'cookievalue2'}
response = requests.get(
    'http://www.steampowered.com/mystuff',
    cookies=my_cookies)


'''

0 0
原创粉丝点击