#include <windows.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
MessageBox(NULL, "Hello World!", "Note", MB_OK);
return 0;
}
使用 MinGW + Notepad++ 來寫 C++
1. 下載 Notepad++
2. 下載 Notepad++ plugin – NppExec
3. 下載 MinGW-5.1.6.exe,安裝起來
4. 使用 Notepad++ 新增檔案
// hello.cpp
#include // cout
#include “conio.h” // getch
#include // TCHAR
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << “Hello World!\n”;
getch();
return 0;
}
5. 使用 NppExec套件, 輸入
C:\MinGW\bin\g++.exe “$(FULL_CURRENT_PATH)” -o $(NAME_PART)
6. 執行後, 即會 Complier 成 exe 檔案 !!
2. 下載 Notepad++ plugin – NppExec
3. 下載 MinGW-5.1.6.exe,安裝起來
4. 使用 Notepad++ 新增檔案
// hello.cpp
#include
#include “conio.h” // getch
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << “Hello World!\n”;
getch();
return 0;
}
5. 使用 NppExec套件, 輸入
C:\MinGW\bin\g++.exe “$(FULL_CURRENT_PATH)” -o $(NAME_PART)
6. 執行後, 即會 Complier 成 exe 檔案 !!
刪除 Facebook 的帳號
要如何刪除 Facebook 的帳號呢??
1. 用要刪除的帳號登入 !
2. 進入以下網址 : https://ssl.facebook.com/help/contact.php?show_form=delete_account
3. 輸入密碼及驗證碼後, 就會刪除了, 如果14天內再登入, 就不會刪除了!
1. 用要刪除的帳號登入 !
2. 進入以下網址 : https://ssl.facebook.com/help/contact.php?show_form=delete_account
3. 輸入密碼及驗證碼後, 就會刪除了, 如果14天內再登入, 就不會刪除了!
MySQL Error Log
設定可以觀看 mysql 的 error log 檔案
mkdir /var/log/mysqlThe best choice is to define the error log, in both the [mysqld_safe] and [mysqld] section of your servers my.cnf
chown mysql:mysql /var/log/mysql
chmod 750 /var/log/mysql
[mysqld_safe]
log-error=/var/log/mysql/error.log
[mysqld]
log-error=/var/log/mysql/error.log
轉貼自:http://ronaldbradford.com/blog/monitoring-mysql-the-error-log-2009-09-16/
Notepad++ Function List
目前撰寫PHP程式,都用 Notepad++ 來撰寫, 其中, 最常使用的 Plugin 為 function list,
這個 plugin 都是到 http://sourceforge.net/projects/npp-plugins/files/ 這個網站去下載,
要下載最新版本, 因為目前都是使用 UTF-8 的格式撰寫程式, 所以都是下載 unicode
版本的!
這個 plugin 都是到 http://sourceforge.net/projects/npp-plugins/files/ 這個網站去下載,
要下載最新版本, 因為目前都是使用 UTF-8 的格式撰寫程式, 所以都是下載 unicode
版本的!
FreeBSD下, 修改 Samba 的密碼
修改 Samba 的密碼指令為: smbpasswd
如何讓欄位不自動提示?
<input name=”txtUserName” type=”textbox” AUTOCOMPLETE = “off” >
Vim 詳細列出所有加入的套件
Vim 詳細列出所有加入的套件:
:scriptnames
:scriptnames
重新啟動Apache設定,又不想停止網頁的執行
apachectl graceful
apache 設定 reload 後也可保持現有連線了
參考網頁:http://blog.2be.com.tw/2009/02/apache_4216.html
apache 設定 reload 後也可保持現有連線了
參考網頁:http://blog.2be.com.tw/2009/02/apache_4216.html
Comments
測式留言通知方式為如何???
Python 連結 MySQL 顯示 UTF-8 中文
最近在研究 python 串聯 mysql 的方式, 之前一直抓 MySQL-python-1.2.3c1.tar.gz
回來安裝, 都安裝不起來,結果同事告知要去抓取 windows 下 可以執行的檔案, 所以去抓了
MySQL-python-1.2.2.win32-py2.5.exe 回來安裝後, python 就可以與 mysql 連結了.
可以連結後,想說要顯示mysql 內的utf-8字元,找了很久,找不到,後來找到要在connect中加入utf-8的參數設定,
如下:
db = MySQLdb.connect(user=’username’, db=’mydbname’, passwd=’userpassword’, host=’127.0.0.1’, charset=’utf8’)
之後可以顯示utf-8的字元了, 但是卻顯示 (u’\u4efb\u7ea2’) 這樣的字,結果查詢後是因為顯示rows的資料才這樣,將 print row 改成 print row[0] 就可以了.
之後可以顯示後,又發現沒辦法顯示utf-8的中文簡體字,所以又找了一下,要將 print row[0] 改成
print row[0].encode(‘utf8’) 才可以. 所以,這是要讓它顯示 utf-8 中文的過程
PS: 使用 python 2.5.4, mysql 5.1
測試程式如下:
#encoding=utf8
#-*- coding: utf-8 -*-
import MySQLdb
db = MySQLdb.connect(user=’xxx’, db=’MyDb’, passwd=’pwd’, host=’127.0.0.1’, charset=’utf8’)
cursor = db.cursor()
#cursor.execute(‘set names utf8;’)
#cursor.execute(‘set character set utf8;’)
#cursor.execute(‘set character_set_connection=utf8;’)
cursor.execute(‘SELECT u_name as name FROM user ORDER BY user_id’)
#names = [unicode(row[0]) for row in cursor.fetchall()]
#print names
results = cursor.fetchall()
for row in results:
x = row[0]
#print “%s” % unicode(x)
print x.encode(‘utf8’)
db.close()
回來安裝, 都安裝不起來,結果同事告知要去抓取 windows 下 可以執行的檔案, 所以去抓了
MySQL-python-1.2.2.win32-py2.5.exe 回來安裝後, python 就可以與 mysql 連結了.
可以連結後,想說要顯示mysql 內的utf-8字元,找了很久,找不到,後來找到要在connect中加入utf-8的參數設定,
如下:
db = MySQLdb.connect(user=’username’, db=’mydbname’, passwd=’userpassword’, host=’127.0.0.1’, charset=’utf8’)
之後可以顯示utf-8的字元了, 但是卻顯示 (u’\u4efb\u7ea2’) 這樣的字,結果查詢後是因為顯示rows的資料才這樣,將 print row 改成 print row[0] 就可以了.
之後可以顯示後,又發現沒辦法顯示utf-8的中文簡體字,所以又找了一下,要將 print row[0] 改成
print row[0].encode(‘utf8’) 才可以. 所以,這是要讓它顯示 utf-8 中文的過程
PS: 使用 python 2.5.4, mysql 5.1
測試程式如下:
#encoding=utf8
#-*- coding: utf-8 -*-
import MySQLdb
db = MySQLdb.connect(user=’xxx’, db=’MyDb’, passwd=’pwd’, host=’127.0.0.1’, charset=’utf8’)
cursor = db.cursor()
#cursor.execute(‘set names utf8;’)
#cursor.execute(‘set character set utf8;’)
#cursor.execute(‘set character_set_connection=utf8;’)
cursor.execute(‘SELECT u_name as name FROM user ORDER BY user_id’)
#names = [unicode(row[0]) for row in cursor.fetchall()]
#print names
results = cursor.fetchall()
for row in results:
x = row[0]
#print “%s” % unicode(x)
print x.encode(‘utf8’)
db.close()