使用下列網站:
http://codeformatter.blogspot.com/2009/06/about-code-formatter.html
只要將 source code 貼上, 就會產生對應的 html, 再貼入 blog 中就可以了.
星期二, 10月 26, 2010
使用 python 呼叫 DLL
使用 BCB 來撰寫 DLL
/* 注意 __stdcall 這個宣告很重要,不然 python 會找不到而出現錯誤訊息 */
使用 python 呼叫 DLL
## 使用 ctypes module
## 使用 windll, 這個是用來呼叫 windows 中的 DLL.
參考:
http://hi.baidu.com/fangss007/blog/item/461d00f3dc317bc50b46e078.html
extern "C" __declspec(dllexport) int __stdcall ReturnAplusB(int a,int b)
{
return a+b+1;
}
/* 注意 __stdcall 這個宣告很重要,不然 python 會找不到而出現錯誤訊息 */
使用 python 呼叫 DLL
from ctypes import *
def main():
dll = windll.LoadLibrary("DllTest.dll")
c = c_short(1)
d = c_short(3)
a = dll.ReturnAplusB(c,d)
print 'the return value : %d'%a
a = dll.ReturnAplusB(4,6)
print 'the return value : %d'%a
a = dll._Print1()
print 'the return value : %d'%a
if __name__ == '__main__':
main()
## 使用 ctypes module
## 使用 windll, 這個是用來呼叫 windows 中的 DLL.
參考:
http://hi.baidu.com/fangss007/blog/item/461d00f3dc317bc50b46e078.html
星期五, 8月 27, 2010
Install Jdownloader in Ubuntu 10.04
Open the terminal and run the following command
Terminalsudo add-apt-repository ppa:jd-team/jdownloader
sudo apt-get update
sudo apt-get install jdownloader
星期三, 7月 28, 2010
星期六, 5月 08, 2010
Mount nrg file
使用 kiso 就可以 mount .nrg 檔
安裝方式, 使用 command line:
apt-get install kiso
之後會在"附屬應用程式" 就可找到 Kiso
安裝方式, 使用 command line:
apt-get install kiso
之後會在"附屬應用程式" 就可找到 Kiso
星期五, 3月 26, 2010
產生 GUID 的方式
使用 BCB compiler
#include "objbase.h"
...
void __fastcall GenerateGUID(void)
{
GUID guid;
CoCreateGuid(&guid); // win32API
AnsiString asGuid = GUIDToString(guid);
}
#include "objbase.h"
...
void __fastcall GenerateGUID(void)
{
GUID guid;
CoCreateGuid(&guid); // win32API
AnsiString asGuid = GUIDToString(guid);
}
星期三, 2月 10, 2010
把 chm 檔解開的方式
直接在 dos 視窗下輸入:
hh.exe -decompile extracted_folder filename.chm
非常簡單 !
ref:
http://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help#Applications
星期二, 11月 24, 2009
關閉自動播放功能--使用 gpedit.msc
windows xp professional:
執行 gpedit.msc 指令,啟動「群組原則」系統工具:
-> 電腦設定->系 統管理範本->系統->關閉自動播放 (啟用這項功能)
ref: http://blog.xuite.net/webe_chen/tech/24233425?ref=rel
執行 gpedit.msc 指令,啟動「群組原則」系統工具:
-> 電腦設定->系 統管理範本->系統->關閉自動播放 (啟用這項功能)
ref: http://blog.xuite.net/webe_chen/tech/24233425?ref=rel
星期三, 10月 28, 2009
Download YouTube
利用下列的 script
javascript:window.location.href%20=%20'http://youtube.com/get_video?video_id='%20+%20swfArgs['video_id']%20+%20"&fmt=18"%20+%20"&l="%20+%20swfArgs['l']%20+%20"&sk="%20+%20swfArgs['sk']%20+%20'&t='%20+%20swfArgs['t'];
其中參數 :
參考:
http://taiwan.cnet.com/blog/0,2000089057,20137871,00.htm
javascript:window.location.href%20=%20'http://youtube.com/get_video?video_id='%20+%20swfArgs['video_id']%20+%20"&fmt=18"%20+%20"&l="%20+%20swfArgs['l']%20+%20"&sk="%20+%20swfArgs['sk']%20+%20'&t='%20+%20swfArgs['t'];
其中參數 :
| fmt 參數 | 下載格式 | 最高解析度 | 音質 | 聲道 |
| 無 | flv | 320*240 | 64Kbps MP3 | 單聲道 |
| 6 | flv | 480*360 | 64Kbps MP3 | 單聲道 |
| 18(HQ) | MP4 | 480*360 | 128Kbps AAC | 立體聲 |
| 22(HD) | MP4 | 1280*720 | 128Kbps AAC | 立體聲 |
參考:
http://taiwan.cnet.com/blog/0,2000089057,20137871,00.htm
星期一, 10月 05, 2009
專利搜尋
US Patent
US Free Patent Search USPTO Depository Library Program
Google Patents Search
World Patent
PATENTSCOPE®Patent Search International Patent Applications
US/European Patent
Patents.com
European Patent
British Patent Status Enquiry
Canada Patent
Canada Patent Search Database
Japanese Patent
Industrial Property Digital Library
星期三, 9月 23, 2009
7zip command line
using 7 zip to compress files listed in backupfilelist.txt
7z a compressed_%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.7z @backupfilelist.txt
或是可以加上時間
setlocal
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set yyyymmdd_hhmm=%date:~0,4%%date:~5,2%%date:~8,2%_%hh%%time:~3,2%
7z a compressed_%yyyymmdd_hhmm%.7z @backupfilelist.txt
7z a compressed_%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%.7z @backupfilelist.txt
或是可以加上時間
setlocal
set hh=%time:~0,2%
if "%time:~0,1%"==" " set hh=0%hh:~1,1%
set yyyymmdd_hhmm=%date:~0,4%%date:~5,2%%date:~8,2%_%hh%%time:~3,2%
7z a compressed_%yyyymmdd_hhmm%.7z @backupfilelist.txt
星期五, 8月 28, 2009
星期四, 8月 27, 2009
在 python 程式中呼叫另一個 python 程式
使用 os.system() 來達成
prog1.py:
# ========= code below ===
print 'this is prog1.py'
# ========= code above ===
prog2.py
# === code below ===
import os
cmd = 'python prog1.py'
os.system(cmd)
# === code above ===
prog1.py:
# ========= code below ===
print 'this is prog1.py'
# ========= code above ===
prog2.py
# === code below ===
import os
cmd = 'python prog1.py'
os.system(cmd)
# === code above ===
星期三, 8月 05, 2009
How to transfer tuple to list
tuple 無法修改, 要修改其中的 element 就要使用 list. 把 tuple 轉為 list:
a = (1,2,3)
al = list(a)
就這麼簡單...
a = (1,2,3)
al = list(a)
就這麼簡單...
星期五, 6月 19, 2009
C++ Builder 中的 SysErrorMessage( )
把 GetLastError() 的 Error Code 轉為可閱讀的訊息.
Example:
dwErrorCode = GetLastError();
ShowMessage(SysErrorMessage(dwErrorCode));
Example:
dwErrorCode = GetLastError();
ShowMessage(SysErrorMessage(dwErrorCode));
星期一, 6月 08, 2009
星期日, 5月 31, 2009
備份 VirtualBox Machine
使用指令:
參考:
How To: Properly Backup a VirtualBox Machine (.VDI)
VBoxManage clonevdi source destination
example:
VBoxManage clonevdi ~/.VirtualBox/HardDisks/WinXP.vdi ~/WindowsXP_Backup.vdi參考:
How To: Properly Backup a VirtualBox Machine (.VDI)
星期四, 4月 23, 2009
python to exe
. 使用 py2exe (官網 : http://www.py2exe.org/)
. 建立下列程式來轉換 (命名為 setup.py)
from distutils.core import setup
import py2exe
setup(console=['hello.py']) #hello.py 就是要轉換的 .py 檔
.下一步在 cmd line 下執行
d:\> python setup.py py2exe
.轉換完成會產生一個 dist 的目錄, 在該目錄中就會有相對應的 exe 檔及 dll.
. 建立下列程式來轉換 (命名為 setup.py)
from distutils.core import setup
import py2exe
setup(console=['hello.py']) #hello.py 就是要轉換的 .py 檔
.下一步在 cmd line 下執行
d:\> python setup.py py2exe
.轉換完成會產生一個 dist 的目錄, 在該目錄中就會有相對應的 exe 檔及 dll.
星期三, 4月 22, 2009
星期一, 1月 12, 2009
RICOH GRD 當機
最近 GRD 只要按 ADJ 鈕就當機, 上網爬文, 原來是 ADJ 按鈕需要清理一下. 先把電池拿出來, 再用接電子用接點清潔劑噴一下,把 ADJ 鈕轉一轉. 裝回電池.真神奇.. 不會當機了.
訂閱:
文章 (Atom)