星期二, 12月 18, 2007

Osspedia.com - Your Open Source Software Encyclopedia

Osspedia.com is a very useful site for finding open source software. In fact, it is a wiki based web site. You can also add more open source project information into the web site.

 

http://www.osspedia.com

 

星期三, 9月 19, 2007

Java秘史:隱藏在SWT/Swing背後的故事

本文來自straight_talking_java@yahoogroups.com討論組: http://tech.groups.yahoo.com/group/straight_talking_java/messages/24236?xm=1&m=e&l=1

  要想弄清楚為什麼Java GUI API被弄得如此混亂,要從幾年前隻存在AWT的時候說起。SUN當時已經建立了一套基本的可移植控件類,這些類映射到不同作業系統上的原生窗口元件(native widget),顯然下一步應該繼續增強這套模型,除了初始的CUA 92元件(文字、按鈕等等),再繼續加上表格、樹、記事本、滑塊等等……當時的AWT還滿是漏洞,遠不能稱為可靠,還需要SUNcoder們去修補。SUNdeveloper們如GrahamOtto總是習慣於公開把他們的bug歸咎為作業系統的差異,比如"WindowsOS/2的焦點次序不同"或者"在……之間Ctrl-X的行為不一樣",以及其他蒼白的託辭,好讓批評的火力從SUN太早釋出代碼這個問題的真相上移開。然後Amy Fowler來到了SUN。不是我大男子主義,Amy是個聰明的美女,大多數獃頭呆腦隻懂技術的開發人員都要被她捏在手裏。 Amy來自一家Smalltalk公司,叫做Objectshare,在那裏她負責搞UI類庫。

 

  跟Java相比Smalltalk的歷史有些悲慘,曾幾何時有3家龐大的Smalltalk公司--IBMParc-PlaceDigitalk。在90年代初期3家公司的市場份額大致相等,生活是美好的。Parc-Place採用倣窗口部件(emulated widgets)的設計(即Swing的設計),IBMDigitalk則採用原生窗口部件(native widgets)。後來IBM壓倒了另外兩家,因此他們打算合併成一家,假設叫做Parc-Place Digitalk。隨後當他們試圖將他們的產品融合到一個叫做Jigsaw的計劃中時爆發了一場大戰,計劃由於政治原因失敗了(開發人員實際上已經能讓它運轉起來),就因為原生和倣造兩派的死戰。

 

  Amy贏得了精神上的勝利,不過在IBM我們贏得了他們所有的生意,因為這兩家公司在一整年裏除了吵架什麼都沒做。當塵埃落定之後PPDParc-Place Digitalk當時已改名為Objectshare,跟Windscale改名為Sellafield的原因相同--讓人們淡忘之前發生的災難)的股票價格從60美元掉到了低於1美元1股。他們因為偽報收入被NASDAQ摘牌,從此消失。此時SUN正走上與PPD類似的技術方向,於是PDD的技術人員都把他們的簡歷投到了SUNAmy被僱傭了,她承諾透過輕量級方案解決所有窗口元件的問題,因此說服SUN管理層讓她當了GUI開發部門的頭頭。她是拿著"這裡原來的人都搞砸了,我是來解決的"的鑰匙進來的。隨後Amy僱傭了所有她過去在Parc-Place的舊朋友,讓他們來開發Swing

 

  顯然Swing應該做的是僅僅成為一個繪制框架,給那些希望創建地圖軟體或者繪圖軟體的人們使用,無論如何,應該圍繞AWT類庫來建造它,按鈕之類的東西仍然交給AWT來管。SUN的人比如PhilipMark已經讓AWT能夠處理表格、樹和記事本(notebook,?),所以Swing的方向應該說很明顯了。但那些毀了PDD的人不幹,他們非要把一切都弄成輕量級的。由於SUN管理層的無知,再加上Amy無情的政治手段,造成了我們今天所見的混亂局面。Amy還使SUN相信Swing是作為Mozilla項目的一部分與Netscape聯合開發的,事實上這只是她的宣傳伎倆。

 

  在IBM,我們從第一天起就憎惡Swing。龐大、滿是錯誤,而且難看至極。原先我們的工具如VisualAge for Java都是用Smalltalk(用的是原生窗口元件)寫的,所以當我們將這些工具向Java代碼庫遷移時,我們需要一套窗口元件。IBM這邊的開發人員都是原來搞Smalltalk的那一批人,我們對管理層要求用Swing來構建WebSphere Studio工具都非常不情願。Swing是個可怕的充滿缺陷的怪獸。

 

  在WebSphere Studio最初的預視中,當與Microsoft Visual Studio作對比演示的時候,我們所有的用戶都討厭它,就因為它的外觀,而不管它的功能有多強。大多數消費者都不會買一輛讓人覺得難看的車,哪怕這車有一台出色的引擎。因此我們開始了一個項目,是把我們的Smalltalk原生窗口元件移植到Java上去。這個項目是加拿大的Object Technology International小組做的。這個項目穫得了成功,被運用在在我們發佈的VisualAge Micro Edition產品中,VisualAge Micro Edition後來成為J2ME開發方面一個非常成功的IDE。但是OTI的人發現,Swing在讀取Windows事件方面有極嚴重的缺陷,我們甚至無法進行SWTS開始是Simple的縮寫,不過後來變成了Standard的縮寫)和Swing間的互操作。他們在讀事件佇列的時候用了一種可能留下記憶體漏洞的方式,所以我們不得不採用我們自己的查詢Windows事件佇列的循環,以糾正這個錯誤。

 

  我們試了一次又一次讓SUN修復這個錯誤,但Amy就是聽不進去,所以我們才決定SWTAWT/Swing不能共存。我們甚至在SWT中定義了自己的PointRectangle類--整個工具包對AWTSwing都沒有任何依賴。我們把這個工具包放到了Eclipse中,這是一個工具平台,它的總體設計目標就是要戰勝MicrsoftVisual StudioEclipse是開源的,所以任何人都可以在上面構建自己的東西,我們已經有像TogetherSoftRational這樣的公司移植到了上面。我們的競爭者是Microsoft,所以我們所有努力和注意力都是從正面針對Microsoft

 

  不管怎麼說SUN對此非常不滿。他們的NetbeansEclipse做的是相同的事,因此他們向IBM高層抱怨。他們認為SWT是要將你綁到Windows上,這純粹是胡說,因為SWT能透過GTKMac/Linux上運行,以及一大堆嵌入式平台。他們拒絕讓Eclipse穫得Java認證,因為裏面有原生代碼,所以Eclipse產品必須很小心地使用單詞"Java"這個SUN的商標。Eclipse甚至不能把自己稱為一個Java IDESUN已經威脅過要采取法律行動來制止IBM在任何時候把Eclipse稱作一個Java IDE。結果之一就是IBMEclipse上創建的GUI設計工具,允許你構建Swing/AWT GUI,卻不讓你往裏面拖放SWT窗口控件。

 

  將SWTEclipse中分離出來是完全可能的,只需要把DLL摳出來放到路徑中,並使用窗口元件工具包來給你的銀行或者保險或者其他什麼應用程式開發GUI。再次說明,我們無法更進一步,因為SUN把我們的雙手綁上了。雖然作為Eclipse開放源碼協議的一部分,CPL允許我們提供這樣的解決方案,但SUN已經很清楚地表明他們不希望我們這樣做。 對於用戶社區來說,無論IBMSUN的最終動機是什麼,我發現有一點總是很有趣:喜愛Swing的人總會說"一旦你花上幾年時間去掌握它,你就能正確地使用它",這基本上是他們在試圖證明和維護他們辛苦得來的用途有限的專門技術;而SWT的擁護者們說的是"哇,這真快,這跟原生的一樣,還可以用XP皮膚……它還又輕又小"。有一句話是我喜歡的,我們的一個用戶說,Swing就像Java決定不透過作業系統來實現原生的IO,而是透過磁頭馬達API自己來讀磁碟的扇區。Swing基本上就是這樣的,它拿著個底層的"paint(Graphics)"方法,自己來繪制所有的窗口元件。

 

另一Amy Fowlerinterview:

http://java.sys-con.com/read/44701_p.htm

 

 

星期二, 9月 18, 2007

Opensource WPF application

Why need WPF

A good presentation about why Microsoft design WPF

http://channel9.msdn.com/showpost.aspx?postid=185468           

 

星期五, 9月 07, 2007

Anders Hejlsberg的人生信念:

Anders Hejlsberg人生信:

如果你对该问题不具有发言权,也没办法推进其解决进程,那么最好保持沉默和中立,而不应该摆出一个非此即彼的架势。

 

我十分認同.

 

 

星期四, 8月 23, 2007

Rounding Dilemma in Two-Dimension Situation

Please consider following example:

Before Rounding:

 

 

 

 

Jan

Feb

Cum

Item 1

12.534145

8.126270

20.660415

Item 2

14.004458

7.119500

21.123958

Total

26.538603

15.245770

41.784373

 

 

 

 

Rounded Version

 

 

 

 

Jan

Feb

Cum

Item 1

12.53

8.13

20.66

Plan 2

14.00

7.12

21.12

Total

26.54

15.25

41.78

 

There is no problem in calculation in "Before Rounding" version.

 

However, user may report that some problem on Rounded version. Because 26.54+15.25 <> 41.78

But, if we patch the data become 41.79, then it become another problem since 20.66+21.12<> 41.79

It is a perception dilemma because we did not recognized that all version are rounded values rather than actual values.  

 

May be you may suggest to do rounding before all calculations, however, please aware that cumulative error will become very large, as we have more than 5,000 of item in calculation . 

Let me compare the "error"

Method

Error due to Rounding

Error due to Human Perception

Rounding only on display (Current method)

0.00 (as no rounding in calculation)

0.005

Rounding before calculation

=0.005* 5,000 = 25.00

0.00

 

Conclusion:

The "Rounding Issues" is because of a wrong perception from human rather than system error.

 

 

 

星期二, 8月 14, 2007

Activestocks

activeQuant is a Free Software derivatives trade application written in Java. activeQuant is issued under the GNU General Public License. A growing community supports this project through forums, mailing lists and by comitting code

 

http://www.activestocks.de/?q=node/210

 

 

星期五, 7月 27, 2007

feynman diagram

feynman diagram

 

6 converation  (cannot not be create only can transfer)

1. Energy

2. linear momentum

3. angler momentum

4. electric

5. mass

6.   ?

 

Irrational number in Physic

 

 

 

 

星期三, 7月 11, 2007

Registry for reassign 2 soft keys for Windows Mobile

Found the registry to reassign the 2 soft keys for Windows Mobile 2005

 

Left Key
[HKCU\Software\Microsoft\Today\Key\112]
@="Left"
Open="\Windows\MyApp.exe"

Right Key
[HKCU\Software\Microsoft\Today\Key\113]
@="Right"
Open="\Windows\MyApp.exe"

星期一, 6月 18, 2007

稻香 (0573.HK)

 

 

 

星期五, 6月 08, 2007

JBuiilder Desginer also move to .NET

Another desginer of Delphi VCL and WPF

Chuck Jazdzewski is designer of Delphi VCL and WPF

 

His good blog

http://www.removingalldoubt.com/PermaLink.aspx/a32977e2-cb7d-42ea-9d25-5e539423affd

 

 

 

Chief architect of C#

Anders Hejlsberg work on Turbo Pascal, Delphi, C# and the Microsoft .NET Framework…

 

 

星期五, 6月 01, 2007

Adobe's Extensible Metadata Platform (XMP)

Adobe's Extensible Metadata Platform (XMP) is a labeling technology that allows you to embed data about a file, known as metadata, into the file itself. With XMP, desktop applications and back-end publishing systems gain a common method for capturing, sharing, and leveraging this valuable metadata — opening the door for more efficient job processing, workflow automation, and rights management, among many other possibilities. With XMP, Adobe has taken the "heavy lifting" out of metadata integration, offering content creators an easy way to embed meaningful information about their projects and providing industry partners with standards-based building blocks to develop optimized workflow solutions.

 

 

 

Google Gear

Google Gear - is an open source browser extension that enables web applications to provide offline functionality using following JavaScript APIs:

Store and serve application resources locally

Store data locally in a fully-searchable relational database

Run asynchronous Javascript to improve application responsiveness

 

http://gears.google.com

 

 

星期四, 5月 31, 2007

Tools for translate ASP to PHP

Just found a useful tool that translate ASP to PHP call ASP2PHP

http://asp2php.naken.cc/

 

 

 

Some VMPlayer tools

The best online VMX generator:  EasyVMX

http://www.easyvmx.com/

 

Some useful VM ware tools

http://petruska.stardock.net/Software/VMware.html

 

 

星期三, 5月 30, 2007

Create vmdk and vmx file for VMWare Player

It's easy to create a vmdk and vmx file for use with VMWare Player. The VMWare Player is free but does not let you create virtual machines.

Steps:

1.      Create VMDK with qemu-img.exe

2.      Create VMX with VMXBuilder

1. Create the VMDK

Create a VMDK file with qemu-img.exe. This exe is part of QEMU, downloadable from http://free.oszoo.org/ftp/qemu/win32/release/QemuInstall-0.7.2.exe.

Command line:

  • qemu-img create -f vmdk Windows2003Server.vmdk 10G

This creates a vmdk that can grow up to 10G. It will actually create a file of about 1,2MB.

2. Create the VMX

Create a .vmx file. To easily do that, use http://sanbarrow.com/vmxbuilder.html. You will find a batch file there that will create a vmx for you.

The batch file just asks questions. You can:

  • set the virtual hardware type
  • set the OS
  • define SCSI and IDE disks: of course, refer here to the disk you made with qemu-img.exe
  • define an ISO file to attach
  • define network cards
  • set advanced properties like virtual SMP, clustering support, etc....
  • ....

Once you have the VMX, open it with VMWare player and you are done. You can now start installing an OS to the empty disk. It is easiest to just use an ISO file of the OS installation cd and configure the iso in VMXBuilder. When you start the VM, you will boot from the ISO!

 

Build VMX file online

VMPlayer is a freeware, however, it did not provide function to create a virtual machine file (VMX).

 

This is a online tool which help to generate the vmx file.

http://dcgrendel.thewaffleiron.net/vmbuilder/

星期四, 5月 17, 2007

Opensource MDA, UMLtools

Some open source/free MDA, UML Tools:

http://staruml.sourceforge.net/en/  

http://www.andromda.org/

 

Lotus Improv

Today when I do some research related to my work, I suddenly remember a very old products from Lotus called Improv (around 1992).

This tools impress me very much when I still a high school student. But it seems this product did not success and no further version.

 

I found some related tools in web

 

Quantrix – written in java, but not as user friendly as Improv:

http://www.quantrix.com/

A Trial Serial #:  AGU73-CMMVA-U5PRA-FZPWY-6GVC8-X3X

 

 

Good javascript web site

This is web site show some good javascript examples:
http://webfx.eae.net/

The company also has a AJAX framework call bindows, but is seems not as good as ZK framework...
http://www.bindows.net/
http://www.europa.idv.tw/f_opendoc/index.php?viewDoc=233

REST framework

Just like servlet, someone make a java framework for REST. Which call Restlet.

http://www.restlet.org

http://www.frevvo.com/