2008年6月11日 星期三

Install PIL (Python Image Library) at Bluehost.com

I tried to install PIL1.1.6 at Bluehost and encoutered the following error messages:



bash#python setup.py install --prefix=$HOME
......
......
_imagingtk.c:20:16: tk.h: No such file or directory
_imagingtk.c:23: error: syntax error before '*' token
_imagingtk.c:31: error: syntax error before "Tcl_Interp"
_imagingtk.c:31: warning: no semicolon at end of struct or union
_imagingtk.c:32: warning: data definition has no type or storage class
_imagingtk.c: In function `_tkinit':
_imagingtk.c:37: error: `Tcl_Interp' undeclared (first use in this function)
_imagingtk.c:37: error: (Each undeclared identifier is reported only once
_imagingtk.c:37: error: for each function it appears in.)
_imagingtk.c:37: error: `interp' undeclared (first use in this function)
_imagingtk.c:45: error: syntax error before ')' token
_imagingtk.c:50: error: `app' undeclared (first use in this function)
_imagingtk.c:50: error: syntax error before ')' token
_imagingtk.c: At top level:
_imagingtk.c:55: warning: parameter names (without types) in function declaration
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: error: conflicting types for 'TkImaging_Init'
_imagingtk.c:23: error: previous declaration of 'TkImaging_Init' was here
_imagingtk.c:55: warning: data definition has no type or storage class
_imagingtk.c:57: error: syntax error before '&' token
error: command 'gcc' failed with exit status 1
The problem can be corrected by not importing tkinter. Modify the program block of the file "setup.py"

try:
import _tkinter
except ImportError:
_tkinter = None

to the following

_tkinter = None

With this, PIL would not be compiled with tkinter support.

2008年3月30日 星期日

TPMath - A Scientific Library Written in Pascal

http://www.unilim.fr/pages_perso/jean.debord/tpmath/tpmath.htm

IT is a library of scientific programs written in Pascal. Available in several versions according to the compiler, it is proposed as an alternative to the famous Numerical Recipes, for which the Pascal version is no longer developed, or to the Borland Numerical Methods Toolbox which is no longer available.

2008年3月11日 星期二

A Collection of Delphi Code Libraries - Fundamentals

http://fundementals.sourceforge.net/index.html

The collection consists of:
  • Utility functions:
    String operations, Dynamic array operations, System functions and Date & Time operations.

  • Unicode functions:
    Unicode codecs and Unicode character and string functions.

  • Streams:
    Common stream implementations that includes parsing support and binary packing.

  • Datastructures:
    Commonly used data structures, including efficient array and dictionary implementations.

  • Sockets:
    UDP and TCP server and client classes. Support for asynchronous or threaded modes.

  • Mathematics:
    Units included for vectors, matrices, rational numbers and complex numbers.

2008年3月6日 星期四

A Cross-platform Packer For Executables(跨平台的執行檔壓縮工具)

在 Lazarus 網站的 FAQ 中提到,可使用 UPX 這個工具,加上移除 GNU debugger 的 symbols(使用 strip)使得 freepascal 編譯出的 windows 執行檔變小。

經測試壓縮效率比 PECompact 差一些,不過差別在於:
  • UPX 為 GPL。
  • UPX 跨平台。
  • UPX 支援許多不同平台的執行檔格式。(win32, linux, linux kernel, mac, even Playstation 1 !)
以下轉貼自原始網站 http://upx.sourceforge.net/

UPX is a versatile executable packer with the following features:

  • excellent compression ratio: typically compresses better than WinZip/zip/gzip, use UPX to decrease the size of your distribution !

  • very fast decompression: ~10 MB/sec on an ancient Pentium 133, ~200 MB/sec on an Athlon XP 2000+.

  • no memory overhead for your compressed executables because of in-place decompression.

  • safe: you can list, test and unpack your executables. Also, a checksum of both the compressed and uncompressed file is maintained internally.

  • universal: UPX can pack a number of executable formats.

  • portable: UPX is written in portable endian-neutral C++

  • extendable: because of the class layout it's very easy to add new executable formats or new compression algorithms

  • free: UPX is distributed with full source code under the GNU General Public License, and may be used freely even with commercial programs.

You probably understand now why we call UPX the "Ultimate Packer for eXecutables".

UPX is based on experience with our previous packers DJP and lzop and uses the NRV compression library.

Pascal Tutorial

http://www.taoyue.com/tutorials/pascal/
Pascal 的入門教學。

2008年2月14日 星期四

隨身碟病毒 - kavo kava tavo tava etc.

最近家中電腦感染了隨身碟病毒,起先沒有發現(Norton 2005)。notebook 中安裝的是 Avira Antivir Personal Edition 才偵測出隨身碟已受到感染。參考了幾篇文章之後動手清除。其中比較有價值的文章分別是:

  1. 行政院資安論壇中的一個討論串。其中有一篇說明 kavo virus 的詳細清除步驟。甚至提到病毒會自我更新病毒碼!
  2. 台灣論壇中的一篇文章。包括其他的隨身碟病毒的各種名稱:tava/kava/avpa/amva/mmva/mnsa。但解法不如 1. 的完整。
  3. 您不可不知的KAVO病毒與解法。內有提到使用 HiJackThis 工具,來掃瞄並修復系統。此項工具可從趨勢網站下載。
系統是 XP Home,步驟與資安論壇中的文章類似但略有不同,紀錄如下:

  1. 關閉系統還原。
  2. 關閉網路。不一定要進入安全模式。
  3. 修復登錄檔,把顯示隱藏檔案的功能打開。執行 regedit 把 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL 值改成 1。
  4. 移除 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2
  5. 執行 cmd.exe 用工作管理員把 explorer.exe 這個 process 殺掉,之後在 cmd 視窗下再執行 explorer。因為其中有 kavox.dll 會被 explorer 調用。
  6. 在 cmd 視窗下執行 explorer 以開啟 explorer,如:explorer c:。將資料夾選項中的隱藏檔案功能取消,如此可看到病毒寫入的隱藏檔案,將之清除。如:
    1. 根目錄下面的 autorun.inf, ntdelect.com (NOT ntdetect.com!), 數字/亂碼.bat/com。這些檔案不一定都存在。
    2. C:\windows\system32\kavo.exe
    3. C:\windows\system32\kavo1.dll
    4. C:\windows\help 下也要檢查。(?)
  7. 使用 cmd 視窗進入使用者的家目錄下的 Local Settings 之後執行 "rd /s /q Temp" 清除暫存目錄下的檔案。
  8. 每個磁碟根目錄都用 cmd 視窗下執行 explorer 磁碟機代號清除病毒檔案。
  9. 最後用 HiJackThis scan 之後勾選 kava/tava/等等 將之修復。
  10. 重新開機。