ㄚ凱隨手紀 | 我就是在碎碎念~

CAT | PHP+MySQL

五月/10

10

FirePHP for CakePHP 安裝

FireBug, 是一個 Firefox 上面非常方便的網頁除錯工具….
FirePHP, 是 FireBug 的一個擴充, 可以讓 FireBug 處理 FirePHPCore librar 輸出的錯誤訊息…

有什麼好處?..
當用 FirePHP 後.. PHP 運行時候產生的錯誤訊息就不會直接輸出到畫面上影響畫面…
而可以在 FireBug Console 裡面才看到錯誤訊息或是 Debug 訊息…

在 CakePHP 怎麼裝呢?…
可以參考這篇文章..

http://bakery.cakephp.org/articles/view/debugging-with-firephp

基本上流程如下:
首先下載 FirePHPCore Library http://www.firephp.org/HQ/Install.htm
下載解開後, 把 FirePHP.class.php 拷貝到 APP/vendors/FirePHP

接著把 http://bakery.cakephp.org/articles/view/debugging-with-firephp 裡面的 FirePHP.deubgger.php 下載存在 APP/vendors/FirePHP 裡.

最後調整 APP/config/bootstrap.php ..
增加一行
App::import(‘Vendor’, ‘FirePHPDebugger’, array(‘file’ => ‘FirePHP’ . DS . ‘FireP
HP.debugger.php’));

這樣就好了…

以後 CakePHP 運行時候產生的錯誤訊息就會經由 FirePHP 輸出, 而不會直接輸出在畫面上囉!!!..

另外, 可以在任何一個地方使用 fb(‘Debug Message’); 來輸出除錯訊息到 FirePHP …

七月/09

1

PHP 5.3 Release

PHP Logo

PHP Logo

http://www.php.net/archive/2009.php#id2009-06-30-1

Release Note.

http://php.net/releases/5_3_0.php

要注意一下這些…

http://tw.php.net/migration53

還有..

http://tw.php.net/manual/en/migration53.incompatible.php

http://tw.php.net/manual/en/migration53.deprecated.php

另外這些已經被移掉或是用其他模組取代了..

http://tw.php.net/manual/en/migration53.removed-extensions.php

No tags

十一月/08

27

PDV – phpDocumentor for Vim

今天在 Twitter 上看到小海說在一堆 PHP 中加入 phpDoc 非常的痛苦

後來 johnpupu 就提供了 PDV 這個好用的 Vim 的 plugin …

安裝方式很簡單….

先到 http://www.vim.org/scripts/script.php?script_id=1355 下載最新的 php-doc.vim

下載後放在像是 ~/.vim/php-doc.vim

然後修改 .vimrc 增加下面的設定

source ~/.vim/php-doc.vim 
inoremap <C-P> <ESC>:call PhpDocSingle()<CR>i 
nnoremap <C-P> :call PhpDocSingle()<CR> 
vnoremap <C-P> :call PhpDocRange()<CR> 

之後只要在用 Vim 編輯 php 的時候,於編輯模式按下 ctrl+p 就可以自動根據 function or class 產生 phpdoc 格式的註解囉!!!

20081208 補充, 

感謝 Johnpupu 的提供…我找了一下參考這篇裝起來了..

http://c9s.blogspot.com/2007/06/vim-snippet.html

在 vim 下的程式碼自動完成!

No tags

十一月/08

27

MySQL 5.1 GA 囉…

恭喜大家… MySQL 5.1 Release 了….

What’s New in MySQL 5.1
http://dev.mysql.com/doc/refman/5.1/en/mysql-nutshell.html

Download
http://dev.mysql.com/downloads/mysql/5.1.html

No tags

十月/07

7

一份介紹 CakePHP 1.2 的 PDF

內容很多,幾乎把 CakePHP 1.2 上很多重要的新東西都講到的,看完了很心動很想馬上來試試看阿!
http://www.cakephp.org/files/OCPHP.pdf

No tags

網站製作學習誌 看到的消息…

國外知名的書籤網站 http://del.icio.us/ 已經在十月初期重新建構了網站程式,採用的是 Symfony 這套 PHP Framework ..

相關文章請看..
http://blog.phpdeveloper.co.nz/2007/10/03/delicious-switches-to-symfony/
http://www.symfony-project.com/blog/2007/10/02/delicious-preview-built-with-symfony

看樣子最近已經有越來越多網站開始重視使用的 PHP Framework 囉!…
目前比較有名一點的,我想大概就是 SymfonyCakePHP Zend Framework 這三套吧!~
對 PHP 有研究的朋友,別忘了試試看唷!

No tags

九月/07

5

Adodb 的 AutoExecute

很久沒有寫關於 adodb 相關的文章了,前一陣子(好久以前)翻閱文件的時候,注意到新增了一個 AutoExecute 的 Method ,看名字就覺得很有趣,所以當然就玩了一下。

一玩不得了,這東西太好用了,所以一直想說要介紹給朋友用,但是一直忘記要寫文章,雖然過了很久,但是還是來補一下好了。

還沒有用 GetInsertSQL 跟 GetUpdateSQL 以前,通常都需要自己撰寫相關的 SQL 去操作資料庫,不免會遇到打錯 SQL 或是程式碼中一堆 SQL 語法的問題。

之後我用 adodb 的時候,通常都會跟官方文件上得範例差不多,都是用 GetInsertSQL 或是 GetUpdateSQL 癌產生 SQL ,然後才用 Execute 去執行該 SQL ,而GetUpdateSQL 之前還要 Select 一下資料庫,取出一份該筆資料得欄位跟資料內容,所以整段程式變成有點累贅,因為一些不必要的重複的 Code 不斷出現。

類似這樣:

$rs = $db->Execute("Select * from mytable where id = '{$id}'");
$updateArray['name'] = 'newName';
$UpdateSQL = $db->GetUpdateSQL($rs,$updateArray);
$db->Execute($sql);

而比較新的版本的 adodb 則新增了 AutoExecute ,則可以大幅度減少這些無謂的程式碼.

AutoExecute($table, $arrFields, $mode, $where=false, $forceUpdate=true,$magicq=false)

參數說明:

  • $table 要處理的表格名稱
  • $arrFields 要更新或新增的欄位內容
  • $mode 模式選擇,內容需為 INSERT 或是 UPDATE 
  • $where 當模式為 UPDATE 的時候,需要輸入更新條件
  • $forceUpdate 一般來說預設 UPDATE 的時後,會先從資料庫取出該筆資料,然後若是欄位內容沒有修改,則不會進行UPDATE,只會更新有更新的欄位,若是姜此參數設定,則會強迫一律更新。
  • $magicq 系統環境是否有把 magice_quotes 打開,預設是沒有,所以會替你將傳入的資料作 qstr

範例:

$record["firstName"] = "Carol";$record["lasTname"] = "Smith"; $conn->AutoExecute($table,$record,'INSERT');# executes "INSERT INTO $table (firstName,lasTname) values ('Carol',Smith')";

$record["firstName"] = "Carol";$record["lasTname"] = "Jones"; $conn->AutoExecute($table,$record,'UPDATE', "lastname like 'Sm%'");# executes "UPDATE $table SET firstName='Carol',lasTname='Jones' WHERE lastname like 'Sm%'";
從上面的範例可以發現,比起之前用 GetUpdateSQL 與 GetInsertSQL 更為簡潔,且更為方便了!
官方文件
http://phplens.com/adodb/reference.functions.getupdatesql.html#autoexecute 

No tags

八月/07

22

超快速的實現 session on memcache

看文件總是會有新發現…
如果你用的 php, php-memcache 版本夠新…
可以很輕易的將 Session 用 memcached 保存了…


 
session.save_path string

Defines a comma separated of server urls to use for session storage, for example "tcp://host1:11211, tcp://host2:11211".

Each url may contain parameters which are applied to that server, they are the same as for the Memcache::addServer() method. For example "tcp://host1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"


代碼:
<?php
$session_save_path = "tcp://$host:$port?persistent=1&weight=2&timeout=2&retry_interval=10,  ,tcp://$host:$port  ";
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', $session_save_path);
?>

http://tw.php.net/memcache

No tags

七月/07

14

PHP4 要掰掰囉!~

 拖了這麼久,PHP5 都已經改到 5.2.3 了,終於官方網站宣佈 PHP4 即將終止更新與維護,我相信這是官方網站的正確選擇。

有要需要更新自己程式的朋友們,別忘了要看看  Migration Guide 喔…


PHP 4 end of life announcement

[13-Jul-2007]

Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

For documentation on migration for PHP 4 to PHP 5, we would like to point you to our migration guide. There is additional information available in the PHP 5.0 to PHP 5.1 and PHP 5.1 to PHP 5.2 migration guides as well.

 

 

No tags

二月/07

2

admin route 強迫使用 https 連線

目前大部分的電子商務網站,大部分後台都是直接就在線上的某個路徑下,或是某個 subdomain 下 ….

而客戶對於安全的需求,有時後會要求全部後台使用 SSL 進行連線。

所以就誕生了下面我用的這段 Code ..
In bootstrap.php

代碼:
if(substr($_GET["url"],0,6) == CAKE_ADMIN.'/' and empty($_SERVER['HTTPS']) ){
   header('Location: https://'.$_SERVER["HTTP_HOST"].'/'.CAKE_ADMIN.'/');
}

No tags

Older posts >>

Ativan recommended dosage
Generic cheap viagra
Propecia cost
Phentermine free consultation
Cialis free trial pack
Buy viagra overnight
Viagra danger
Valium addiction signs
Viagra in bali
Best prices on viagra
Female viagra pill
Cheap cialis pills
How viagra works
Adipex for sale
Ativan normal doses
Cialis tadalafil
Effexor and tramadol
Natural viagra uk
El cialis generico
Doxycycline hyclate
Soma overnight delivery
Drug stores that sell xanax
Levitra dose
Cheapest price viagra
Guaranteed cheapest viagra
Adipex online no prescription
Order levitra without prescription
Viagra injectable
Cialis headaches
Buy tramadol cod
Generic viagra from canada
Doxycycline 100 mg
Cialis murah klang
Canadian pharmacy phentermine
Phentermine side effects dangers
Buy xanax online
Xanax 5mg
Herbal cialis
Tramadol pet medicine
What does viagra do
Neonatal celexa withdrawal
Generic viagra 100mg soft pills
Cialis india pharmacy
What is phentermine
Viagra cialis
Viagra woman
Buy cialis with mastercard
Online pharmacy propecia
Levitra paypal
Purchase viagra
Purchase valium without a prescription
Cialis canada illegal buy
Discount cialis levitra viagra
Viagra sales on line
Killer chimp on xanax
Levitra canadian
Cheapest prescription viagra
Purchase propecia online
Uk online pharmacies for viagra etc
Viagra prices
Levitra prices
Georgia accutane injuries
Cheapest uk viagra
Soft cialis
Can men take clomid
Sales online viagra sale
Online pharmacy phentermine
Accutane attorneys san diego
Ordering levitra without a prescription
Cheap viagra generic
Xanax bars for sale
Cialis soft tab
Canada cialis online
Cialis ireland
Next day viagra
Get levitra
Cheap propecia online prescription
Generic pharmacy viagra
Experience taking valium
Buy viagra online uk
Buying viagra in the uk
Prescription phentermine
Does propecia cause genetic disorders
Prescription levitra
Uk propecia sales
Tramadol saturday delivery cod
Tramadol drug
Is tramadol a narcotic
Adipex 37.5 mg prices
Free viagra without a perscription
Buy soma online
Generic review viagra
Cheap propecia order online
Discount levitra pharmacy purchase
Pfizer viagra 50 mg
Phentermine pregnancy
Cialis brand
Uk viagra on line
Viagra lowest prices
Uk viagra
Cheap price viagra
High blood pressure phentermine
Viagra sales in uk
50mg cialis
Order cialis online without prescription
Phentermine shipped to arkansas
How to get off xanax
Results of accutane treatment
Levitra doses
Germany levitra
Viagra effects on women
Levitra overnight
Xanax standard dose
Phentermine 37.5mg
Viagra info
Compare prices of phentermine
Buy generic propecia online
Lowest prices on tramadol
Phentermine 15mg
Ativan withdrawal
Cialis applied directly
Adipex no prescription
Prednisone and thyroid
Xanax detox
Gernic viagra
Tadalafil and viagra are they the same
Propecia online
Generic viagra overnight delivery
Cheapest levitra
Prednisone 10 mg
Cialis injury attorney ohio
Cialis generics
Does generic viagra work
Valium and geriatric dogs
Order cheap cialis online
Viagra england
Soma 350mg
Cialis malaysia
Order propecia propecia
Cialis no perscription non generic
Side effects of doxycycline
Xanax 10mg
Didrex adipex online
Viagra female use
Cialis pills for sale
Drug levitra
Viagra from usa
Cialis canadian drugs
Buy cheap viagra in uk
Free online prescriptions

Theme Design by devolux.nh2.me