stopPropagation, preventDefault 和 return false 的区别
http://www.neoease.com/stoppropagation-and-preventdefault-and-return-false/
[javascript]Apply與Call用法說明
http://www.dotblogs.com.tw/lastsecret/archive/2010/11/30/19826.aspx
JavaScript 中的 prototype 物件是什麼?
http://myluckycolor.wordpress.com/2007/04/14/javascript-中的-prototype-物件是什麼?/
javascript setTimeout 和 setInterval 区别
http://www.cnblogs.com/ruxuan/archive/2006/07/04/442490.html
2012年10月4日 星期四
查奇怪的字
http://www.dezeen.com/2012/10/03/pelt-by-benjamin-hubert-for-de-la-espada/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+dezeen+%28Dezeenfeed%29
這網址標題有亂碼 OBJ ( 用firefox開 )
使用
http://idaiwan.pixnet.net/blog/post/32503252-%E3%80%90%E7%B7%9A%E4%B8%8A%E5%B7%A5%E5%85%B7%E3%80%91%E5%90%84%E5%9C%8B%E8%AA%9E%E8%A8%80%E7%9A%84%E6%96%87%E5%AD%97%E6%88%96%E5%85%B6%E4%BB%96%E5%AD%97%E5%85%83%E8%88%87-16
查出其Unicode 編碼是 \ufffc
去 http://www.scarfboy.com/coding/unicode-tool?s=U%2Bfffc 查到該字
Type here 打 U+fffc ( U要大寫 然後打+ )
或是去
http://www.tamasoft.co.jp/en/general-info/unicode.html
可以查到全部unicode
將該段文字存成檔案,使用emeditor 開,點右下角選編碼,可看到16進位碼
http://www.youtube.com/watch?v=j7x3G4JFJ1g
這網址標題有亂碼 OBJ ( 用firefox開 )
使用
http://idaiwan.pixnet.net/blog/post/32503252-%E3%80%90%E7%B7%9A%E4%B8%8A%E5%B7%A5%E5%85%B7%E3%80%91%E5%90%84%E5%9C%8B%E8%AA%9E%E8%A8%80%E7%9A%84%E6%96%87%E5%AD%97%E6%88%96%E5%85%B6%E4%BB%96%E5%AD%97%E5%85%83%E8%88%87-16
查出其Unicode 編碼是 \ufffc
去 http://www.scarfboy.com/coding/unicode-tool?s=U%2Bfffc 查到該字
Type here 打 U+fffc ( U要大寫 然後打+ )
或是去
http://www.tamasoft.co.jp/en/general-info/unicode.html
可以查到全部unicode
將該段文字存成檔案,使用emeditor 開,點右下角選編碼,可看到16進位碼
http://www.youtube.com/watch?v=j7x3G4JFJ1g
2012年10月3日 星期三
使用Git與Github管理軟體開發專案
http://billy3321.blogspot.tw/2009/02/github-howto.html
windows -
1.安裝與設定git
請先抓取putty-installer安裝,或至少抓取plink.exe
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
接下來抓取msysgit的安裝檔 ( 選 Git-1.7.11-preview20120704.exe - 安裝git bash )
http://code.google.com/p/msysgit/downloads/list
安裝時,選擇使用Plink,並從putty安裝資料夾或plink.exe所在資料夾點選plink。 (不知其用途)
2.設定與上傳ssh key
git使用ssh tunnel來傳遞原始碼,這個加密通道可以避免原始碼的封包被攔截而竊取。
因此要先產生與上傳ssh key到github,方便之後與伺服器之間的通訊。
在安裝好的git選單中選取git-bash,並輸入
您的public key就存放在id_rsa.pub裡面,而id_rsa則是private key,請妥善保存以免遺失。
這個key是一對的,private key要存放於家目錄下的.ssh資料夾中。public key則複製後,貼上您github帳號中的SSH Public Keys欄位。注意小心不要複製到空格。
將Public key所有內容複製後貼上您github帳戶底下的 SSH Public Keys 欄位,一次貼上一個(注意,這邊貼上的是public key,另外請注意不要有空格。)
github設定public keys : 點右上角account settings圖示 -> 左邊點SSH Keys -> Add SSH key ( 把上面public key貼上去 )
3.設定github帳號並開啟一個repo
4. 第一次git push 時可能會遇到
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'file:///xxxxxxx.git'
這是Git 找不到你要提交的版本了.
解法:
http://blog.csdn.net/viweei/article/details/6163562
$ git push origin master
5. (optional)安裝 Github 介面軟體
https://help.github.com/articles/set-up-git 點 Download GitHub for Windows (家裏電腦不知為何點了沒反應...)
6. 錯誤訊息:
Cloning into 'amp'...
FATAL ERROR: Disconnected: No supported authentication methods available (serve sent: publickey)
fatal: The remote end hung up unexpectedly
重裝git後照 https://help.github.com/articles/generating-ssh-keys 步驟做一次
更多的git安裝配置與錯誤處理: http://wiki.7color.org/git.html
ps. 讓git-bash的git有高亮
Why does git diff on Windows warn that the “terminal is not fully functional”?
http://stackoverflow.com/questions/7949956/why-does-git-diff-on-windows-warn-that-the-terminal-is-not-fully-functional
Can be fixed by adding the following line to ~/.bashrc:
export TERM=msys
Git - how to tell which commit a tag points to
http://stackoverflow.com/questions/1862423/git-how-to-tell-which-commit-a-tag-points-to
windows -
1.安裝與設定git
請先抓取putty-installer安裝,或至少抓取plink.exe
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
接下來抓取msysgit的安裝檔 ( 選 Git-1.7.11-preview20120704.exe - 安裝git bash )
http://code.google.com/p/msysgit/downloads/list
安裝時,選擇使用Plink,並從putty安裝資料夾或plink.exe所在資料夾點選plink。 (不知其用途)
2.設定與上傳ssh key
git使用ssh tunnel來傳遞原始碼,這個加密通道可以避免原始碼的封包被攔截而竊取。
因此要先產生與上傳ssh key到github,方便之後與伺服器之間的通訊。
在安裝好的git選單中選取git-bash,並輸入
$ ssh-keygen -C “username@email.com” -t rsa
Generating public/private rsa key pair. Enter file in which to save the key (/home/tom/.ssh/id_rsa): <enter> Enter passphrase (empty for no passphrase): <輸入存取此key之密碼,或直接按下enter使用空密碼> Enter same passphrase again: <再一次輸入相同密碼> Your identification has been saved in /home/tom/.ssh/id_rsa. Your public key has been saved in /home/tom/.ssh/id_rsa.pub. The key fingerprint is: 50:43:77:c6:97:af:61:82:dc:ea:9b:6b:67:d4:1b:61 tom@volcano
您的public key就存放在id_rsa.pub裡面,而id_rsa則是private key,請妥善保存以免遺失。
這個key是一對的,private key要存放於家目錄下的.ssh資料夾中。public key則複製後,貼上您github帳號中的SSH Public Keys欄位。注意小心不要複製到空格。
將Public key所有內容複製後貼上您github帳戶底下的 SSH Public Keys 欄位,一次貼上一個(注意,這邊貼上的是public key,另外請注意不要有空格。)
github設定public keys : 點右上角account settings圖示 -> 左邊點SSH Keys -> Add SSH key ( 把上面public key貼上去 )
3.設定github帳號並開啟一個repo
4. 第一次git push 時可能會遇到
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'file:///xxxxxxx.git'
這是Git 找不到你要提交的版本了.
解法:
http://blog.csdn.net/viweei/article/details/6163562
$ git push origin master
5. (optional)安裝 Github 介面軟體
https://help.github.com/articles/set-up-git 點 Download GitHub for Windows (家裏電腦不知為何點了沒反應...)
6. 錯誤訊息:
Cloning into 'amp'...
FATAL ERROR: Disconnected: No supported authentication methods available (serve sent: publickey)
fatal: The remote end hung up unexpectedly
重裝git後照 https://help.github.com/articles/generating-ssh-keys 步驟做一次
更多的git安裝配置與錯誤處理: http://wiki.7color.org/git.html
ps. 讓git-bash的git有高亮
Why does git diff on Windows warn that the “terminal is not fully functional”?
http://stackoverflow.com/questions/7949956/why-does-git-diff-on-windows-warn-that-the-terminal-is-not-fully-functional
Can be fixed by adding the following line to ~/.bashrc:
export TERM=msys
Git - how to tell which commit a tag points to
http://stackoverflow.com/questions/1862423/git-how-to-tell-which-commit-a-tag-points-to
Summary: Since there are about 4 almost equally acceptable yet different answers I will summarise all the different ways to skin a tag.
git rev-list $TAG | head -n 1(thanks mipadi).git rev-listoutputs the commits that lead up to the$TAGsimilar togit logbut only showing the SHA1 of the commit. For non-unix heads like myselfhead -n 1will show the first line of the output, which is the tip of the tag.git show-ref --tags(thanks Charles Bailey) will show all tags (local and fetched from remote) and their SHA1s.git show-ref $TAG(thanks Jakub Narębski) will show the tag and its path along with the SHA1.git rev-parse $TAG(thanks Jakub Narębski) will show the SHA1 of an unannotated tag.git rev-parse --verify $TAG^{commit}(thanks Jakub Narębski) will show a SHA1 of both annotated and unannotated tags. On Windows usegit rev-parse --verify %TAG%^^^^{commit}(four hats).cat .git/refs/tags/*orcat .git/packed-refs(thanks The MYYN) depending on whether or not the tag is local or fetched from remote.
2012年9月26日 星期三
[Apache] 在URL中刪除目錄
http://lmgtfy.com/?q=url+rewrite+remove+folder
http://stackoverflow.com/questions/1314279/mod-rewrite-in-expression-engine-removing-directory-in-url
使用下面規則把目錄去掉
http://stackoverflow.com/questions/1314279/mod-rewrite-in-expression-engine-removing-directory-in-url
使用下面規則把目錄去掉
#RewriteEngine on #可能需要打開
#RewriteBase /
RewriteCond %{THE_REQUEST} ^GET\ /website/
RewriteRule ^website/(.*) /$1 [L,R=301]
RewriteRule !^website/ website%{REQUEST_URI}
2012年9月22日 星期六
[CodeIgniter] No Input File Specified.
用ci出現 No input file specified. 錯誤:
http://tzangms.com/programming/977/
因為 http://www.codeigniter.org.tw/user_guide/installation/troubleshooting.html
伺服器可能不支援 PATH_INFO 變數
因為把 config.php
$config['index_page'] = 'index.php';
改為
$config['index_page'] = 'index.php?';
使用 helper - url 的 redirect 會有問題,所以讓url-rewrite去解
把 rewrite改掉如下
原本的 rewrite
http://tzangms.com/programming/977/
因為 http://www.codeigniter.org.tw/user_guide/installation/troubleshooting.html
伺服器可能不支援 PATH_INFO 變數
因為把 config.php
$config['index_page'] = 'index.php';
改為
$config['index_page'] = 'index.php?';
使用 helper - url 的 redirect 會有問題,所以讓url-rewrite去解
把 rewrite改掉如下
原本的 rewrite
RewriteRule ^(.*)$ index.php/$1 [L]改成
RewriteRule ^(.*)$ index.php?/$1 [L]
2012年9月13日 星期四
我的CI模組
1. http://www.codeigniter.org.tw/ 下載最新CI
2. https://github.com/Vheissu/Ci-Smarty 下載最新ci-smarty ,直接解壓縮到CI application目錄下
3. http://www.codeigniter.org.tw/user_guide/general/urls.html 設定ci url-rewrite (把index.php 拿掉),
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|robots\.txt|$)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
( index.php、images、robots.txt 的全部 HTTP request 都會被當成是 request index.php 檔案。 )
如果目錄是 http://localhost/justin/amp/index.php/smartytest RewriteBase 要設定 /justin/amp/
4. http://rental.zhupiter.com/postshow_178_1_1.html 打開本機 apache - url-rewrite ( 我電腦是 win 7 - appserv )
4-1 先確定自己的 Apache web server 有設定成支援 ReWrite。
動態載入 ReWrite engine 的設定下會在 httpd.conf 中看到這一行『LoadModule rewrite_module modules/mod_rewrite.so』。4-2 在 DocumentRoot 所屬的 Directory 設定內設定 ReWrite 參數。
RewriteEngine On
4-3 因為我設定 virualhost 所以也要到 D:\AppServ\Apache2.2\conf\extra\httpd-vhosts.conf 修改設定
<VirtualHost *:80>
DocumentRoot "D:\AppServ\www"
ServerName localhost
<Directory "D:\AppServ\www">
Options FollowSymLinks Indexes
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
</Directory>
</VirtualHost>
4-4 設定完 apache 後 去 win 7的 "服務" 重新啟動apache.
4-5 如果主機不支援url-rewrite或url-rewrite有問題且無法設定apache , 啟動CI的Query Strings
http://www.codeigniter.org.tw/user_guide/general/urls.html
CodeIgniter 也有提供這個功能,可以到 application/config.php 檔案中開啟底下的設定:
設定encryption_key以啟動session功能
$config['cache_status'] =TRUE;
設為FALSE 讓開發時不使用cache
A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
https://ellislab.com/forums/viewthread/244510/
解法:
將
return $_config[0] =& $config;
改成
$_config[0] =& $config;
return $_config[0];
2. https://github.com/Vheissu/Ci-Smarty 下載最新ci-smarty ,直接解壓縮到CI application目錄下
3. http://www.codeigniter.org.tw/user_guide/general/urls.html 設定ci url-rewrite (把index.php 拿掉),
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|robots\.txt|$)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
( index.php、images、robots.txt 的全部 HTTP request 都會被當成是 request index.php 檔案。 )
如果目錄是 http://localhost/justin/amp/index.php/smartytest RewriteBase 要設定 /justin/amp/
4. http://rental.zhupiter.com/postshow_178_1_1.html 打開本機 apache - url-rewrite ( 我電腦是 win 7 - appserv )
4-1 先確定自己的 Apache web server 有設定成支援 ReWrite。
動態載入 ReWrite engine 的設定下會在 httpd.conf 中看到這一行『LoadModule rewrite_module modules/mod_rewrite.so』。4-2 在 DocumentRoot 所屬的 Directory 設定內設定 ReWrite 參數。
RewriteEngine On
4-3 因為我設定 virualhost 所以也要到 D:\AppServ\Apache2.2\conf\extra\httpd-vhosts.conf 修改設定
<VirtualHost *:80>
DocumentRoot "D:\AppServ\www"
ServerName localhost
<Directory "D:\AppServ\www">
Options FollowSymLinks Indexes
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
</Directory>
</VirtualHost>
4-4 設定完 apache 後 去 win 7的 "服務" 重新啟動apache.
4-5 如果主機不支援url-rewrite或url-rewrite有問題且無法設定apache , 啟動CI的Query Strings
http://www.codeigniter.org.tw/user_guide/general/urls.html
CodeIgniter 也有提供這個功能,可以到 application/config.php 檔案中開啟底下的設定:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
只要把 "enable_query_strings" 設定為 TRUE,這個功能就會啟動。index.php?c=controller&m=method設定encryption_key以啟動session功能
$config['encryption_key'] = 'xxx';
5. 在application\libraries\Smarty.php 中設定左分隔符和右分隔符$this->left_delimiter = '{{';$this->right_delimiter = '}}';
6. 在 application\config\smarty.php 調整smarty cache$config['cache_status'] =
設為FALSE 讓開發時不使用cache
7. application\config\autoload.php 設定$autoload['helper'] = array('url'); 讓前端能直接使用 {{base_url()}} 抓網站網址$autoload['libraries'] = array('parser','database','session');自動載入smarty、db、session 功能
8. 在linux主機上要把cache資料夾改權限ex. $ chmod 777 -R cache
出現錯誤Only variable references should be returned by reference:A PHP Error was encountered
Severity: Notice
Message: Only variable references should be returned by reference
Filename: core/Common.php
Line Number: 257
https://ellislab.com/forums/viewthread/244510/
解法:
將
return $_config[0] =& $config;
改成
$_config[0] =& $config;
return $_config[0];
2012年9月4日 星期二
CodeIgniter URL-rewrite
http://www.codeigniter.org.tw/user_guide/general/urls.html
以下是將除了像是 index.php、captcha(資料夾)、images、admin、swf檔(使用.*為任意檔名)、css檔、js檔 的全部 HTTP request 都會被當成是 request index.php 檔案。 ( ex. pond.php => index.php/pond.php )
以下是將除了像是 index.php、captcha(資料夾)、images、admin、swf檔(使用.*為任意檔名)、css檔、js檔 的全部 HTTP request 都會被當成是 request index.php 檔案。 ( ex. pond.php => index.php/pond.php )
RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|captcha|images|admin|.*\.swf|.*\.css|.*\.js|.*\.xml|.*\.jpg|$) RewriteRule ^(.*)$ index.php/$1 [L,QSA]
訂閱:
文章 (Atom)