preload
Jun 26

讓你的網頁適合在 iPhone 與 iPad 上瀏覽

Tagged with:
Nov 11

進 settings.py 編輯

時區調整
TIME_ZONE = 'Asia/Taipei'

語系調整
LANGUAGE_CODE = 'zh-tw'

Tagged with:
Nov 11

安裝

tar zxvf Django-*.tar.gz
cd Django-*.
sudo python setup.py install

開一個新專案

~/djcode$ django-admin.py startproject mysite
~/djcode$ ls -a mysite/
./           ../          __init__.py  manage.py    settings.py  urls.py
    __init__.py: 偽裝目錄成package
    manage.py: 一個cli的工具,讓妳可以用多種方式和Django專案互動
    settings.py: Django專案的設定/組態
    urls.py: 此Django專案的URL宣告

執行開發用Server

~/djcode/mysite$ python manage.py runserver
Validating models...
0 errors found
 
Django version 1.1.1, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[10/Nov/2009 19:55:59] "GET / HTTP/1.1" 200 2053
It worked!

It worked!

改Port或IP

python manage.py runserver 8080
python manage.py runserver 0.0.0.0:8080
Tagged with:
Nov 02

PHP 檔案處理

讀檔:

1.fopen

範例:

<?php
$handle = fopen("open_file.txt", "r");
if( $handle === FALSE)
{    
    echo "Open File Fail" . "<br>";
} 
else
{    
    echo "Open File Success" . "<br>";
    while (!feof($handle))
    {
        $current_line = fgets($handle);
        echo $current_line . "<br>";
    }
}
 
?>

2.file_get_contents

範例:

<?php
 
$handle = file_get_contents('open_file.txt');
echo $handle;
 
?>

=========================================================

寫檔:

1.fwrite

<?php
$handle = fopen('open_file.txt', 'w');
fwrite($handle, "test1");
fclose($fp);
?>

ps:fwrite 是沒有加換行字元,如果要換行必須加上 \n 處理

2.file_put_contents

<?php
    $handle = 'open_file.txt';
    $current_line = "line1\n";
    file_put_contents($handle, $current_line);
?>

source: PHP:檔案處理 @ 拉不拉多的夢幻世界 :: 痞客邦 PIXNET ::

Tagged with:
Jun 30
cp config.sample.inc.php config.inc.php
vi config.inc.php

分別找到這兩列

$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';

改成

$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['host'] = '127.0.0.1';

PS. 我是用來搭配 Mac OS X 10.5 Leopard 內建的 Apache2

Tagged with: