好用的console的指令
CTRL+A = 游標移到最“前”方
CTRL+E = 游標移到最“後”方
CTRL+U = 刪除游標“前”的所有資料
CTRL+K = 刪除游標“後”的所有資料
CTRL+L = 類似“clear”指令
ubuntu無法更新-Unable to connect to mirror.nttu.edu.tw
ubuntu無法更新
問題:
Unable to connect to mirror.nttu.edu.tw
解法:
1.sudo vi /etc/apt/sources.list
2.把 mirror.nttu.edu.tw 全取代成 "可更新ubuntu的主機位置"
例如:
:1,$s/mirror.nttu.edu.tw/ubuntu.cs.nctu.edu.tw/g
3.sudo apt-get update //更新最新的套件資訊
4.sudo apt-get upgrade //更新套件程式(這一步找時間再做就可以了)
php5+memcache+codeigniter的安裝與設定
又出現難找的資料,只好自己把它給記下來,免得又忘了。
話說ci(codeigniter) version 2.0以上,內建了memcache的driver,
但是在英文大小有分的系統上,及64bits的系統上,都會有各自的問題發生。
(也許ci升到最新版就沒有這問題了)
主機資訊:
system os:2.6.38-8-server Ubuntu
ci version:2.0.2
php version:5.3.5
問題1:
“Unable to load the requested driver: CI_Cache_memcached”
mac上如何裝node.js呢?
首先要安裝:
Install Xcode.
Install git.
然後執行底下的指令:
git clone git://github.com/ry/node.git
cd node
./configure
make
sudo make install
好啦~完裝成功~簡單吧~
ubuntu上安裝exim4
不想主機變成別人的轉信站,所以找了個純送信的軟體來裝,看起來exim4好像還蠻多人裝的!
安裝步驟:
Step1:安裝 exim4 (MTU:純送信元件)
apt-get install exim4-daemon-light mailutils
Step2:設定組態檔
dpkg-reconfigure exim4-config
設定請參考網路上的文章
反正一路安enter,就ok了(除了要輸入smtp server的地方)
======================================================
設定步驟如下:(僅供參考)
使用 smarthost 來傳送郵件;並藉由 SMTP 或是 fetchmail 來接收郵件
mail sent by smarthost; received via SMTP or fetchmail
系統郵件名稱 (mail name):
輸入你的網域名稱(例如:code.onnie.biz)
在有 SMTP 連線傳入時,要進行監聽的 IP 位址 (listen on for incoming SMTP connections):
127.0.0.1(只寄這台主機的email)
要進行接收的其它郵件位址 (Other destinations for which mail is accepted):
保留空白
要替哪些主機進行郵件轉寄 (Machines to relay mail for):
保留空白
外寄郵件時所使用的 smarthost 的 IP 位址或主機名稱 (Machine handling outgoing mail for this host):
你的smtp server ip
是否在外送郵件中隱藏本機的郵件名稱 (hide local mail name in outgoing mail):
否 (No)
是否保持最小的 DNS 查詢量 (don’t keep number of DNS-queries minimal):
否 (No)
本機郵件的傳送方式:
存放在 /var/mail 裡的 mbox 格式
是否將設定檔分散成較小的檔案 (split configuration into small files):
否 (No)
root 及 postmaster 的郵件代收者:
輸入ubuntu系統中指定的使用者帳號(多位使用者的話,以空白字元來分隔)
完成!
Step3:測試
echo "Hello ! " | mail -s "Testing Mail" xyz@aaa.bbb.ccc
Step4:查看log
tail -n 20 /var/log/exim4/mainlog
完成~~
安裝步驟:
Step1:安裝 exim4 (MTU:純送信元件)
apt-get install exim4-daemon-light mailutils
Step2:設定組態檔
dpkg-reconfigure exim4-config
設定請參考網路上的文章
反正一路安enter,就ok了(除了要輸入smtp server的地方)
======================================================
設定步驟如下:(僅供參考)
使用 smarthost 來傳送郵件;並藉由 SMTP 或是 fetchmail 來接收郵件
mail sent by smarthost; received via SMTP or fetchmail
系統郵件名稱 (mail name):
輸入你的網域名稱(例如:code.onnie.biz)
在有 SMTP 連線傳入時,要進行監聽的 IP 位址 (listen on for incoming SMTP connections):
127.0.0.1(只寄這台主機的email)
要進行接收的其它郵件位址 (Other destinations for which mail is accepted):
保留空白
要替哪些主機進行郵件轉寄 (Machines to relay mail for):
保留空白
外寄郵件時所使用的 smarthost 的 IP 位址或主機名稱 (Machine handling outgoing mail for this host):
你的smtp server ip
是否在外送郵件中隱藏本機的郵件名稱 (hide local mail name in outgoing mail):
否 (No)
是否保持最小的 DNS 查詢量 (don’t keep number of DNS-queries minimal):
否 (No)
本機郵件的傳送方式:
存放在 /var/mail 裡的 mbox 格式
是否將設定檔分散成較小的檔案 (split configuration into small files):
否 (No)
root 及 postmaster 的郵件代收者:
輸入ubuntu系統中指定的使用者帳號(多位使用者的話,以空白字元來分隔)
完成!
===================================================
Step3:測試
echo "Hello ! " | mail -s "Testing Mail" xyz@aaa.bbb.ccc
Step4:查看log
tail -n 20 /var/log/exim4/mainlog
完成~~
wordpress的安裝與設定(ubuntu的環境)
第一次安裝wordpress,沒想到還蠻簡單的!(我用的環境是Ubuntu)
- 下載程式後,解壓縮到http server的根目錄下:例/var/www/wordpress/
- 到/var/www/wordpress/下:
copy wp-config-sample.php wp-config.php - 設定Database:
define('DB_NAME', 'wordpress');
define('DB_USER', 'db-login-name');
define('DB_PASSWORD', 'db-login-passwd');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8_unicode_ci');
- 用Browser開啟http://localhost/wordpress/,一直下一步,就安裝完畢了!
因為安裝plugins或themes會用到ftp權限,而我只想用ssh/scp的方式:
所以要多些步驟如下:
如何備出svn server的資料
#===== 安裝svn server+apache2的方式 =======
#安裝apche2和svn:
apt-get install subversion libapache2-svn apache2 subversion-tools
#建立svn repository:
svnadmin create /srv/xxx
#變更owner:
chown -R www-data.www-data /srv/xxx
svn relocate
最近搬家,碰到svn server ip變更的情況,第一次設定svn relocate,感覺很容易,但應該很容易忘了,先來紀錄一下
svn switch --relocate old_url new_url --username xxx --password xxx
記得要在svn工作目錄裡執行才有效囉!
如何打開mac os 中的 .htaccess的功能
環境:mac os 10.6
mac中的apache預設是關閉.htaccess的功能,那要如何打開呢?
研究了半天,到快睡著了,才找到。
apache的主設定檔
/private/etc/apache2/http.conf
user home相關的設定
/private/etc/apache2/users
所以若要打開user home中.htaccess的功能,就要到/private/etc/apache2/users去找user的設定囉~~
mac中的apache預設是關閉.htaccess的功能,那要如何打開呢?
研究了半天,到快睡著了,才找到。
apache的主設定檔
/private/etc/apache2/http.conf
user home相關的設定
/private/etc/apache2/users
所以若要打開user home中.htaccess的功能,就要到/private/etc/apache2/users去找user的設定囉~~
如何讓aptana 3能自動完成codeigniter的code
請參考這篇,
http://r15ch13.de/2011/03/autocomplete-in-aptana-3-for-codeigniter-2/
重點如下:
底下二個檔案要加入底下的變數,好讓aptana可以抓到code而自動完成
/system/core/controller.php
/system/core/model.php
ps.放在class底下第一行,function的外頭
http://r15ch13.de/2011/03/autocomplete-in-aptana-3-for-codeigniter-2/
重點如下:
底下二個檔案要加入底下的變數,好讓aptana可以抓到code而自動完成
/system/core/controller.php
/system/core/model.php
ps.放在class底下第一行,function的外頭
蘋果電腦如何顯示或隱藏檔案
1 啟用顯示隱藏檔
在終端機下輸入指令"defaults write com.apple.finder AppleShowAllFiles -bool true",然後強制重新啟動Finder(左上角小蘋果圖示-->強制結束-->選擇"Finder")
2 關閉顯示隱藏檔
在終端機下輸入指令"defaults write com.apple.finder AppleShowAllFiles -bool false",然後強制重新啟動Finder即可(左上角小蘋果圖示-->強制結束-->選擇"Finder")
在終端機下輸入指令"defaults write com.apple.finder AppleShowAllFiles -bool true",然後強制重新啟動Finder(左上角小蘋果圖示-->強制結束-->選擇"Finder")
2 關閉顯示隱藏檔
在終端機下輸入指令"defaults write com.apple.finder AppleShowAllFiles -bool false",然後強制重新啟動Finder即可(左上角小蘋果圖示-->強制結束-->選擇"Finder")
2011/07/09 Drupal年會
2011/07/09 Drupal年會
要建立一個能隨著你發展也能一起成長的CMS
傳統手機網頁的建置方式
針對不同的顯示裝置,要轉成有彈性的設計
建立有彈性的網頁的原則
簡單利用meta,就可讓網頁有彈性的顯示
CSS三種方式,讓網頁可以有彈性的設計
有彈性的網頁,要有設置"中斷點",使網頁可以因為不同的中斷點,來決定如何顯示內容。窄時,顯示一個欄位的版型;寬時,可顯示多欄位的版型
IE6~8是個麻煩,可以用IE的條件是註解,或javascript來解決
友達超過4萬個內部user,導入Drupal的案例
投票系統
部門的入口網站
公司內部的資訊服務系統
員工部落格,outlook寄信到部落格直接轉成文章,減少內部信件的轉寄
2011/07/10
一整天的活動,直接改造一個公益團體的網站,包括版型,功能,和內容的調整
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
友達超過4萬個內部user,導入Drupal的案例
![]() |
![]() |
![]() |
![]() |
2011/07/10
一整天的活動,直接改造一個公益團體的網站,包括版型,功能,和內容的調整
![]() |
使用mssql 讀取excel
可以直接下sql語法讀取excel
SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\excelfile.xls;Extended Properties=Excel 8.0')...[sheetname$]
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\excelfile.xls', [sheetname$])
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\excelfile.xls', 'SELECT * FROM [sheetname$]')
若出現底下錯誤訊息:
SQL Server 已封鎖元件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 之存取,因為此元件已經由此伺服器的安全性組態關閉。系統管理員可以使用 sp_configure 來啟用 'Ad Hoc Distributed Queries' 的使用。如需有關啟用 'Ad Hoc Distributed Queries' 的詳細資訊,請參閱《SQL Server 線上叢書》中的<介面區組態>(Surface Area Configuration)。
解決辦法:
使用前: (開啟Ad Hoc Distributed Queries)
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
使用後: (關閉Ad Hoc Distributed Queries)
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
SELECT * FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\excelfile.xls;Extended Properties=Excel 8.0')...[sheetname$]
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\excelfile.xls', [sheetname$])
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\excelfile.xls', 'SELECT * FROM [sheetname$]')
若出現底下錯誤訊息:
SQL Server 已封鎖元件 'Ad Hoc Distributed Queries' 的 STATEMENT 'OpenRowset/OpenDatasource' 之存取,因為此元件已經由此伺服器的安全性組態關閉。系統管理員可以使用 sp_configure 來啟用 'Ad Hoc Distributed Queries' 的使用。如需有關啟用 'Ad Hoc Distributed Queries' 的詳細資訊,請參閱《SQL Server 線上叢書》中的<介面區組態>(Surface Area Configuration)。
解決辦法:
使用前: (開啟Ad Hoc Distributed Queries)
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
使用後: (關閉Ad Hoc Distributed Queries)
exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure
VirtualBox黑蘋果之螢幕大小設定
方法二的成功了...
while booting at the EFI boot loader screen, type;
“Graphics Mode”=”1280x800x32” and press Enter.
參考:
http://www.sysprobs.com/increase-mac-os-virtual-machine-screen-resolution-virtualbox-vmware-player
while booting at the EFI boot loader screen, type;
“Graphics Mode”=”1280x800x32” and press Enter.
參考:
http://www.sysprobs.com/increase-mac-os-virtual-machine-screen-resolution-virtualbox-vmware-player
Virtualbox - 縮放虛擬硬碟空間
縮放虛擬硬碟空間
擴大是比較單純的,可直接使用指令設定,但擴大後必需到guest系統中將磁碟的partition擴大才能使用擴大大空間
VBoxManage modifyhd winxppurl --resize 50000 <== 將winxppurl空間擴大到50GB
VBoxManage modifyhd d:\vbx\winxppurl.vdi --resize 50000 <== 將winxppurl空間擴大到50GB
縮小空間,只能針對guest系統中剩下的空間做壓縮
VBoxManage modifyhd winxppurl --compact 壓縮winxppurl空間
VBoxManage modifyhd d:\vbx\winxppurl.vdi --compact
擴大是比較單純的,可直接使用指令設定,但擴大後必需到guest系統中將磁碟的partition擴大才能使用擴大大空間
VBoxManage modifyhd winxppurl --resize 50000 <== 將winxppurl空間擴大到50GB
VBoxManage modifyhd d:\vbx\winxppurl.vdi --resize 50000 <== 將winxppurl空間擴大到50GB
縮小空間,只能針對guest系統中剩下的空間做壓縮
VBoxManage modifyhd winxppurl --compact 壓縮winxppurl空間
VBoxManage modifyhd d:\vbx\winxppurl.vdi --compact
sun virtualbox 之uuid
標題很不清楚吧~~
主要是想把在sun virtualbox做好的虛擬映像檔再做個備份出來。
若直接從檔案總管或用匯出的方式做出的備份檔,當你再匯入時,都會出現UUID重覆的問題,後來發現,可以用指令的方式,即可做出另外一個UUID的映像檔來囉!
指令如下,剩下的就自個推敲啦~~~
"c:\Program Files\innotek VirtualBox\VBoxManage.exe" clonevdi org.vdi new.vdi
主要是想把在sun virtualbox做好的虛擬映像檔再做個備份出來。
若直接從檔案總管或用匯出的方式做出的備份檔,當你再匯入時,都會出現UUID重覆的問題,後來發現,可以用指令的方式,即可做出另外一個UUID的映像檔來囉!
指令如下,剩下的就自個推敲啦~~~
"c:\Program Files\innotek VirtualBox\VBoxManage.exe" clonevdi org.vdi new.vdi
Windows2003 on Virtual PC
今天正式開始Virtual PC, 來灌個windows 2003好了!
灌好之後遇到幾個問題,
第1個:如何和實體主機共享資料夾呢?雖然選單中,Edit --> Setting中有個share folder的設定項目,可是一直是反白的,無法操作,後來查到要先安裝"Install Or Update Virtual Machine Additions",在選單位置為,Action --> Install Or Update Virtual Machine Additions,然後就可以設定囉!
第2個:如何在VPC播放音樂呢?
發現音效卡是sound blaster 16,可是找不到driver,怎辦?
發現一篇文章,http://kb.vmware.com/selfservice/viewContent.do?externalId=1115&sliceId=1
安裝步驟如下:
灌好之後遇到幾個問題,
第1個:如何和實體主機共享資料夾呢?雖然選單中,Edit --> Setting中有個share folder的設定項目,可是一直是反白的,無法操作,後來查到要先安裝"Install Or Update Virtual Machine Additions",在選單位置為,Action --> Install Or Update Virtual Machine Additions,然後就可以設定囉!
第2個:如何在VPC播放音樂呢?
發現音效卡是sound blaster 16,可是找不到driver,怎辦?
發現一篇文章,http://kb.vmware.com/selfservice/viewContent.do?externalId=1115&sliceId=1
安裝步驟如下:
- Insert a Windows 2000 CD-ROM, then open a Command Prompt window and navigate to the i386 directory.
- Run the following two commands to extract the needed files:
expand driver.cab -f:ctlsb16.sys c:\windows\temp
expand wdma_ctl.in_ c:\windows\temp\wdma_ctl.inf - Choose Control Panel>Add New Hardware, then click Next.
- When prompted, answer Yes, I've already connected the hardware.
- Select Add a new hardware device from the list, then click Next.
- Select Install the hardware that I manually select, then click Next.
- Select Sound, video and game controllers, then click Next.
- Click Have Disk and browse to C:\Windows\temp.
- Click wdma_ctl.inf and follow the prompts, choosing to install the unsigned driver.
- Choose Start>Settings>Control Panel, then open Sounds & Audio. Select Enable Windows audio.
原來非同步作業時,不能呼叫.....
近來一直在學如何在asp.net網頁,執行非同步呼叫的動作。
這二天,一直再修改某個頁面程式,因為要非同步的寄出email,可是不知怎的,email一直寄不出去,看來看去,程式應該沒有寫錯,也沒有error產生,到底是怎麼一回事呢?
努力的k code,發現前人加了一句
response.end()
嗯,這應該是停止所有的回應,我想可能非同步的動作也會停止吧!
果真,改寫後,email就寄出去啦!
心想,這書上沒有教,也查不到相同的情況的例子,若沒有猜到是那個原因的話,那.....我要搞多久啊?????
這二天,一直再修改某個頁面程式,因為要非同步的寄出email,可是不知怎的,email一直寄不出去,看來看去,程式應該沒有寫錯,也沒有error產生,到底是怎麼一回事呢?
努力的k code,發現前人加了一句
response.end()
嗯,這應該是停止所有的回應,我想可能非同步的動作也會停止吧!
果真,改寫後,email就寄出去啦!
心想,這書上沒有教,也查不到相同的情況的例子,若沒有猜到是那個原因的話,那.....我要搞多久啊?????
ASP.NET非同步網頁
在asp.net web page非同步的寫法有二種,我常用的這一種,覺得比較彈性。
有幾個重點步驟,如下:
所以執行順序為:myReg -> onBegin -> ATDObj -> myAction
底下的範本Code:
public class DATA
{
public string a;
有幾個重點步驟,如下:
- 建立一個真的要執行任務的function - ex. myAction
- 建立一個AsyncTaskDelegate物件 - ex. ATDObj
- 建立3個非同步必要的function - onBegin,onEnd,onTimeout
- 在web page註冊非同步的任務 - ex. myReg
所以執行順序為:myReg -> onBegin -> ATDObj -> myAction
底下的範本Code:
public class DATA
{
public string a;
public string b;
}
}
private void myAction(DATA inDATA)
{
//do something
}
}
private delegate void AsyncTaskDelegate(DATA inDATA);
public IAsyncResult onBegin(object sender, EventArgs e, AsyncCallback cb, object state)
{
AsyncTaskDelegate _dlgt = new AsyncTaskDelegate(myAction);
return _dlgt.BeginInvoke((DATA)state, cb, state);
}
public void onEnd(IAsyncResult ar)
{}
public void onTimeout(IAsyncResult ar)
{}
private void Asnyc_NotifyGuest(string inGuestID)
{
DATA tmpData = new DATA();
tmpData .a= "xxxx";
tmpData .b= "yyyy";
this.Page.RegisterAsyncTask(new PageAsyncTask(this.onBegin,
this.onEnd,
this.onTimeout,
tmpData ,
true
));
}
訂閱:
文章 (Atom)












