2008年9月24日 星期三

Free cPanel Web Hosting with PHP5/Mysql - no advertising!

They can offer you a free web hosting package packed with advanced features for hosting & building professional dynamic websites. They provide secure free web space with all the web hosting tools you could possibly ever need.

Free Web Hosting with Website Builder

Their package includes:
- 350 MB of Disk Space, 100 GB Bandwidth
- Host your own domain (http://www.yourdomain.com)
- cPanel Powered Hosting (you will love it)
- Over 500 website templates ready to download
- Easy to use website builder
- Free POP3 Email Box with Webmail access
- FTP and Web based File Manager
- PHP, MySQL, Perl, CGI, Ruby.
- And many more..

Click here to Register now: http://www.000webhost.com/

Read more...

Java語言中的 interface 和 abstract class 的比較

如果你有在開發 Java 程式語言的話,應該常常會遇到什麼狀況應該使用 abstract class ,什麼狀況應該使用 interface , 還是兩者都一起用呢? Interface 和 abstract class 表面上好像提供幾乎相同的能力,那如何決定使用哪個呢?
什麼時機使用 Interfaces
An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package.
什麼時機使用Abstract classes
An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation.
The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.
什麼時機使用兩者一起使用
You can offer the best of both worlds, an interface and an abstract class. Implementors can ignore your abstract class if they choose. The only drawback of doing that is calling methods via their interface name is slightly slower than calling them via their abstract class name.
比較表



Interfaces vs Abstract Classes
feature
interface
abstract class
multiple inheritanceA class may implement several interfaces.A class may extend only one abstract class.
default implementationAn interface cannot provide any code at all, much less default code.An abstract class can provide complete code, default code, and/or just stubs that have to be overridden.
constantsStatic final constants only, can use them without qualification in classes that implement the interface. On the other paw, these unqualified names pollute the namespace. You can use them and it is not obvious where they are coming from since the qualification is optional.Both instance and static constants are possible. Both static and instance intialiser code are also possible to compute the constants.
third party convenienceAn interface implementation may be added to any existing third party class.A third party class must be rewritten to extend only from the abstract class.
is-a vs -able or can-doInterfaces are often used to describe the peripheral abilities of a class, not its central identity, e.g. an Automobile class might implement the Recyclable interface, which could apply to many otherwise totally unrelated objects.An abstract class defines the core identity of its descendants. If you defined a Dog abstract class then Dalmatian descendants are Dogs, they are not merely dogable. Implemented interfaces enumerate the general things a class can do, not the things a class is. In a Java context, users should typically implement the Runnable interface rather than extending Thread, because they’re not really interested in providing some new Thread functionality, they normally just want some code to have the capability of running independently. They want to create something that can be run in a thread, not a new kind of thread.The similar is-a vs has-a debate comes up when you decide to inherit or delegate.
plug-inYou can write a new replacement module for an interface that contains not one stick of code in common with the existing implementations. When you implement the interface, you start from scratch without any default implementation. You have to obtain your tools from other classes; nothing comes with the interface other than a few constants. This gives you freedom to implement a radically different internal design.You must use the abstract class as-is for the code base, with all its attendant baggage, good or bad. The abstract class author has imposed structure on you. Depending on the cleverness of the author of the abstract class, this may be good or bad.
homogeneityIf all the various implementations share is the method signatures, then an interface works best.If the various implementations are all of a kind and share a common status and behaviour, usually an abstract class works best. Another issue that’s important is what I call "heterogeneous vs. homogeneous." If implementors/subclasses are homogeneous, tend towards an abstract base class. If they are heterogeneous, use an interface. (Now all I have to do is come up with a good definition of hetero/homo-geneous in this context.) If the various objects are all of-a-kind, and share a common state and behavior, then tend towards a common base class. If all they share is a set of method signatures, then tend towards an interface.
maintenanceIf your client code talks only in terms of an interface, you can easily change the concrete implementation behind it, using a factory method.Just like an interface, if your client code talks only in terms of an abstract class, you can easily change the concrete implementation behind it, using a factory method.
speedSlow, requires extra indirection to find the corresponding method in the actual class. Modern JVMs are discovering ways to reduce this speed penalty.Fast
tersenessThe constant declarations in an interface are all presumed public static final, so you may leave that part out. You can’t call any methods to compute the initial values of your constants. You need not declare individual methods of an interface abstract. They are all presumed so.You can put shared code into an abstract class, where you cannot into an interface. If interfaces want to share code, you will have to write other bubblegum to arrange that. You may use methods to compute the initial values of your constants and variables, both instance and static. You must declare all the individual methods of an abstract class abstract.
adding functionalityIf you add a new method to an interface, you must track down all implementations of that interface in the universe and provide them with a concrete implementation of that method.If you add a new method to an abstract class, you have the option of providing a default implementation of it. Then all existing code will continue to work without change.

Reference:
interface vs abstract class : Java Glossary

Read more...

2008年9月21日 星期日

會自動產生 autorun.inf 的 kavo 病毒

昨天朋友送來一部中毒的筆電,請我幫他解毒,看他似乎非常地灰心,所以還附上還原光碟給我,說最後手段就是重灌。可是常用電腦工作的人都知道,重灌作業系統是一件很可怕的事情,因為花費在恢復到以前工作環境的時間會比重灌作業系統的時間多上很多,而且還有可能會把資料給弄丟了,所以,基本上還是朝著把病毒清乾淨的目標前進。
我把電腦開機後發現桌面上怎麼有一堆殺 kavo 病毒的清毒工具,直覺上就猜想到這部電腦應該中了 kavo 相關的病毒,而且應該有人試著去解毒。因為之前我有解過這個病毒經驗,知道這個不好解,所以他們應該都試不成功吧!當然要檢查是否中了 kavo 病毒,在網路上有一篇的文章,寫得蠻詳細,可參考一下。
接著在 c:\windows\system32\ 目錄底下,用 dir /hs 的指令去查詢是否有 kavo 病毒的相關檔案,哇!如下面所列的真的好多!
kavo.exe
kxvo.exe
kevo1.dll
j3ewro.exe
jwedsfdo1.dll
解毒過程中,基本上都是使用進入作業系統的安全模式下,將這些檔案一一刪除,就完成解毒了,但是,不知道這部筆電是怎麼了,就是進不了安全模式,等了老半天螢幕還是黑的,硬碟沒有任何動靜,最後,想到一招,就是用 windows XP 的光碟片開機,用 R 修復功能進入控制台,就是像以前 DOS 一樣黑底白字的命令提示字元。然後進入 c:\windows\system32\ 目錄底下,先將這些病毒檔案的屬性改掉,然後就可一一刪除檔案,最後再重新開機就大功告成了!
Reference:
五個步驟,檢查你是否中了kavo病毒

Read more...

2008年9月19日 星期五

九和汽車委託代檢公司

我開的車子已經滿五年,所以要開始去驗車了,第一次是去南港區的良友代檢廠驗車,雖然服務態度也算不錯,可是針對沒驗過車的我還要自己開車,對準那對準這的,對這些檢驗過程真的很生疏,因此,第二次就想說找另外一家代檢廠,看會不會只要去繳完規費後就可以直接領車走人。因此,這一次就試著在台北市代驗地點網頁去找另外一家,發現九和汽車這一家似乎不錯,所以馬上就打電話確認是否有額滿,九和回覆下午五點前都OK,當然就馬上拿起鑰匙去驗車了。到了現場,服務人員就請我下車先去繳規費,然後給他收據後,他就請我在旁邊的椅子坐一下,就立刻幫我驗車,車子往前移動不到20公尺就都完成了,真的很不錯!
Reference:
台北市代驗地點網址
九和汽車

Read more...

2008年9月5日 星期五

可用遠端桌面登入Vista Home Premium

相信大家都知道微軟提供的遠端桌面連線功能是非常好用,只是會突然忘記有些OS版本是不提供遠端桌面的Server端功能,只提供Client端功能,這時大家都會覺得比爾蓋茲怎麼這麼小氣哩!不過沒關係,這時上網google一下,看有沒有網友提供解法,果真,大家都遇到相同的問題,當然也有提供完整的解法,真的太感謝這些高手了。

Steps to Add Remote Desktop to Vista Home Premium:

1. Download termsrv.zip here
2. Extract Termsrv.zip to a temp directory
3. Start “Command Prompt” in Administrator mode (Run As Administrator)
4. Run the corresponding batch file for your Vista edition
5. Allow TCP Port 3389 on Windows Firewall or any other firewall product.
6. Done

Reference: Enable Remote Desktop Connection on Vista Home Premium

Read more...

  © Blogger template Spain by Ourblogtemplates.com 2008

Back to TOP