cygwin 與 nxclient

今天碰到有趣的情況,cygwin 起不來,錯誤訊息是這樣的:

You have multiple copies of cygwin1.dll on your system.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version *should*
reside in x:\cygwin\bin, where ‘x’ is the drive on which you have
installed the cygwin distribution.

也就是說,有多份 cygwin1.dll, 要記得留這份喔(c:\cygwin\bin\cygwin1.dll)…
可是…我找遍整台電腦,也就兩個 cygwin1.dll
一份是 nxclient 用的,一份是 cygwin 用的,可是目錄完全不同,怎麼樣也不會搭到一起.
沒辦法,只能召請Google大神上身幫忙.
果然應驗如神,大神告訴我,有人遇到這種情況了…
原來是因為記憶體裡面有 cygwin1.dll 殘留而導致.
我打開”工作管理員”來查看,果然有這麼一個 Process: cygserver.exe
將他結束掉之後,就沒問題了.
可是,是誰把這個 Process launch 起來的呢?
是 nxclient, 他結束掉以後,並沒有將此 Process 也一併結束掉,所以才會有這問題發生.

聊人資系統(1)

我現在的工作跟人資一點關係都沒有,寫這一系列文章主要是想紀錄以前作人資系統時對人資系統的認識以及當時遇到的一些情況.
人資系統,即人事薪資系統.大致可以分成這幾個子系統:

  • 人事
  • 薪資
  • 出勤
  • 考核

整個系統最終的目的,都是為了要能核發薪資(應該說提供薪資資料給會計財務,由會計財務去作帳及匯款).
人事,提供人員的基本資料,職位調動資料,工地異動資料,勞健保的加退保,退休金提撥,人員統計.
出勤,提供人員的請假紀錄,出勤狀況.
考核,讓主管或人員相互評核,以作為核發獎金的參考依據.

聊 Editor

昨天好友問到我用啥編輯器在寫 .Net 程式,有沒有用 UltraEdit??
我答道:”沒有,現在都用免費的編輯器在寫.”
so, 這就是這篇文章的由來…
PSPad Unicode
話才說完,還真巧,沒多久我就在 Nelson’s Blog 上看到這篇文章.
裝起來大致看了一下,還不錯,該有的功能都有了.
notepad++
這個是無意之中找到的,速度很快,也很好用.
用他的頻率,不知道為甚麼就是比下面的 Programmer’s Notepad 少.
Programmer’s Notepad
這是我目前最常用的編輯器之一,功能也很多.
常常用的原因很簡單,因為在檔案上面按下滑鼠右鍵,就會出現 Edit with PN2 ….
=_=”
Crimson
這個則是在某 blog 上看到的,不過沒記下網址.
也很好用,某同事大力推薦.
VIM
這個就不用說了,在 linux 環境下我都是用這個.
他也有 Windows 版本,也可以很方面的在檔案上面按下滑鼠右鍵,選”使用Vim編輯此檔案”…
可以說是上上之選,一直都沒有花很多時間去認真學他,都是停留在堪用的程度.
依照我逛網路的經驗告訴我,網路上很多 Linux 玩家都很厲害.
Linux 還有一個很有名的 Emacs, 但我沒用過,也懶得學,這套聽說也是神的不得了.
jEdit
是在 SourceForge 找到的,還是在 JavaLobby 電子報上逛到的??
已經不可考,不過這也是一套不錯用的編輯器,可以裝很多官方提供的亂七八糟 plugin. (我還蠻喜歡亂裝 plugin 來玩的)
Eclipse
這套最有名啦~目前紅的要命~~
也有提供很多 plugin, EclipsePlugins : hi! Find your plugin for Eclipse here.
還記得第一次裝的時候,如墜五里霧中.
後來找到不少 tutorial, 才知道怎麼裝.
其實用法不如想像中困難,就只是解開壓縮檔而已.
plugin 的話,eclipse 有內建 plugin manager,很方便.
eclipse 的 plugin 一狗票,但要注意的是,蠻多都是要收錢錢的.
AEdiX Suite
這一套是我同事介紹的.
他是這麼說的:”這套也是不用錢的..還不少人用.還支援 foxpro ..!”
不過,我沒辦法下載,所以也無從驗證起.
最後,”需要評比嗎??”
我這樣問我自己.我想應該是不用吧,每套編輯器都有自己的長處.
Developer 自己用熟就好啦~~

weblogs.com 剖析

Overview
weblogs.com是一個彙整的服務,在這個網站上,你會看到目前最新的 blog 文章.
原理
weblogs.com是採取一種被動的方式來得知目前有哪些 blog 文章,換言之,也就是 blog hosting system 在發出文章的時候,就會通知(ping)weblogs.com,讓weblogs.com知道說有新文章啦…
運作
weblogs.com 主要利用兩個方式來接收 ping
*XMLRPC
*REST, 也就是以 http get, post 的方式
參數大同小異:
*name: name of site (limited to 1024 character)
*url: url of site or rss feed (limited to 255 character)
回傳值:
*flerror (bool): true 表示有錯誤發生
*message: successful: Thanks for the ping.”, failure: error message.
背地裡,weblogs 收到這些訊息之後到底做了什麼事情呢??
推測:
1. 組合 ping 過來的資訊
2. 排程,定時去 fetch
3. 把已經取得的資訊組合放到 xml, 裡面提供有 name, url, rssurl, when
name: name of the weblog
url: url
rssUrl: 該網站的 rss/atom feed url
when: a number of second, 拿 weblogUpdated.updated 減去此數字,就是 weblogs.com 收到 ping 的時間.

Inversion of Control

本想看看 .Net 實做 Spring專案的.找著找著,又看到了 Castle. 後來發現他們都用了所謂的 Inversion of Control 的概念.
這我就好奇了,甚麼是 Inversion of Control ??
這裡看到一段很好的解說:

“That’s the basic concept of Inversion of Control; you don’t create your objects, you describe how they should be created. You don’t directly connect your components and services together in code, you describe which services are needed by which components, and the container is responsible for hooking it all together. The container creates all the objects, wires them together by setting the necessary properties, and determines when methods are invoked.”

然後提到大致上有三種實做的方式:

type-3 Services dependencies are provided as constructor parameters (and are not exposed as JavaBeans properties). This is the exclusive approach used by PicoContainer, and is also used in HiveMind and Spring.

接著又提到 Inversion of Control Container 應該被稱為 Dependency Injection pattern 會比較恰當…看這篇:Inversion of Control Containers and the Dependency Injection pattern
PicoContainerCastle 很接近,應該都屬於 type-3 – constructor injection, 此外也有很重的 Interface Injection 味道.
上面那篇文章寫的很好,可以算是經典文了.
其他參考性的東西,不再贅述…
*Castle 官網上對 IoC 的說明就直接貼出兩篇經典文的網址.
*c# 對 IoC 的實做,目前有三個實做: StructureMap, Castle, Spring.net
*Open Source Inversion of Control Containers in C#
*Design Better Software with the Inversion of Control Pattern
*Inversion of Control
*PicoContainer – Inversion of Control
*Apache Excalibur – guide-patterns-ioc

[新酷音]ChewingServer無法啟動

公司的電腦老是無法使用新酷音輸入法.
狀況是這樣子的,切換到新酷音輸入法之後,打任何字都會造成短暫的延遲,無法輸入.
大致的猜測,是因為 ChewingServer 無法載入.
利用 svn 下載 source code(包含 library) 之後

svn co https://svn.csie.net/chewing/win32-chewing/
svn co https://svn.csie.net/chewing/libchewing/
svn co https://svn.csie.net/chewing/libchewingpp/

進行 Trace, 花了不到十五分鐘,就找出原因.
答案是因為在載入家目錄下的 hash.dat ( 在 \Document and settings\xxx\application data\chewing\hash.dat)時,發生了異常,導致整個 ChewingServer crash.
這也是為甚麼會有短暫延遲的原因,每輸入一個字,新酷音輸入法就會試著去啟動 ChewingServer,每次啟動,每次都 crash, 因此就會有延遲.
刪除掉 hash.dat, 讓ChewingServer重新產生以後就行了.
這個問題也回報到這裡了…(很遺憾,第一次填寫,搞不清楚甚麼欄位要填啥,不小心把主旨填成自己的名字了,而且回報的內容也不夠好…下次改進)

Architecture

翻閱A UML Pattern Language的時候看到的,覺得很有道理.摘錄如下:

Architecture is what remains when you cannot take away any more things and still understand the system.
Architecture actually cover 3 similar but different ideas: architecture itself, framework, and toplogy.

ArchitectureTriple

FoxPro over TCP/IP

VFP 雖然可以使用 ODBC/OLEDB 存取自己的 Database, 但是, 基本上,那還是 File base 的方式,所以如果你想使用 TCP/IP 方式來存取資料庫,那麼你就得被迫使用其他的 Database,如 Microsoft SQL server, Firebird, Oracle… 之類的.
我的 idea 大致就像這樣子…
FoxProOverTCPIP
裡面的 Custom ODBC Driver 與 Daemon/Service 就是要寫的部份.
本想找找看,要怎麼寫 ODBC driver 的.
結果不小心發現,已經有人寫了類似的東西了.
一個是 ODBC Socket Server,另外一個則是Open Database Transport Protocol),都跟我的 idea 相當類似.
ODBC Socket Server, 主要是 client 提供 connect string 與 query string, 讓 server 去做 query 的動作並傳回 xml.
這裡有一些可以參考的文章:
*ODBC Socket Server, PHPBuilder.com
Open Database Transport Protocol)的話,跟 PHP 比較相近,所以提供的範例都是 PHP.
嗯嗯,看來是不用多此一舉再寫一次了… 🙂