Saturday, September 27, 2008

修復Windows XP和2003在每次開機後都被提示要啟動的錯誤

家庭版、專業版和Windows Server 2003中,全部的標準版,企業版,Web 版,使用者可能遇到一個奇怪的錯誤, 每當使用者開啟電腦的時候,Windows系統將要求使用者啟用 或者 Windows Server 2003, 以前即使系統已經成功啟用。更糟糕的是, 如果為了再次啟用Windows而使用者回答『是』的話,系統就會顯示說Windows或者Server 已經被啟用,然後登出使用者的訊息。

這 個問題發生原因,因為有個程式或者它的相關檔案(例如reset5.exe、reset5.dll、reset5.dat、reset5.dt *、reset5.bat、resetserver、resetpath、srvany.exe)去干擾 Windows啟用在這台電腦。 (備註︰Reset5是終端機服務重置工具) .

以下的內容是微軟 KB312295 的說明,可依照指示進行修復的工作: .

步驟 1:以安全模式開啟電腦

1. 開啟電腦。
2. 電腦執行了開機自我檢查 (POST) 後,重複按 F8,打開『Windows 進階選項』功能表。
3. 在『Windows 進階選項』功能表上,用箭頭鍵選擇『安全模式』,然後按 Enter。
4. 用箭頭鍵選擇要啟動的 Windows 作業系統,然後按 Enter。
5. 在電腦以安全模式執行時,用具備Administrator權限的帳號登入。然後,在指示 Windows 正以安全模式執行的訊息方塊中按『是』。

步驟 2:啟動註冊表編輯器

依次按『開始』和『執行』,輸入 regedit,然後按『確定』。

步驟 3:刪除 RESETS 註冊表子項

1. 在註冊表編輯器中,展開『我的電腦』,然後展開『HKEY_LOCAL_MACHINE』。
2. 展開『SOFTWARE』,然後展開『』。
3. 展開『Windows NT』,然後展開『CurrentVersion』。
4. 展開『Winlogon』,然後展開『Notify』。
5. 在『Notify』下,右鍵按『RESETS』,然後按『刪除』。
6. 按『是』,確認刪除 RESETS 子項。

注意:不要退出註冊表編輯器。在『步驟 4:修改註冊表以停用 Windows』中必須使用註冊表編輯器。

步驟 4:修改註冊表以停用 Windows

1. 在註冊表編輯器中,展開『我的電腦』,然後展開『HKEY_LOCAL_MACHINE』。
2. 展開『SOFTWARE』,然後展開『』。
3. 展開『Windows NT』,然後展開『CurrentVersion』。
4. 在『CurrentVersion』下,按『WPAEvents』。
5. 在註冊表編輯器的右邊(主題區域)中,右鍵按『OOBETimer』,然後按『修改』。
6. 按並將指標置於『數值資料』框中。然後,修改『數值資料』框中顯示的任何字元。
7. 按『確定』。

注意:此步驟將停用 Windows

8. 退出註冊表編輯器。

步驟 5:重命名受損的 Windows 啟動檔案

1. 依次按『開始』和『執行』,輸入 cmd,然後按『確定』。
2. 在命令提示處,輸入以下命令並按 Enter:
ren %windir%\system32\WPA.dbl wpa.old
此命令將 WPA.dbl 檔重命名為 WPA.old。

步驟 6:確定 CD DVD 光碟機路徑

1. 插入 Windows CD。
2. 按『開始』,然後按『我的電腦』。
3. 請注意出現在『有可移動存儲的設備』下的 CD 光碟機路徑或 DVD 光碟機路徑。在下一步中必須使用此光碟機路徑。

步驟 7:取代受損的 Windows 啟動檔案

1. 依次按『開始』和『執行』,輸入 cmd,然後按『確定』。
2. 在命令提示處,輸入以下命令並按 Enter:
expand drive:\i386\wpa.db_ %windir%\system32\wpa.dbl
在此命令中,需用包含 Windows CD 的光碟機的光碟機路徑取代 drive

例如,如果 Windows CD 位於光碟機 D 中,那麼該命令將如下所示:
expand d:\i386\wpa.db_ %windir%\system32\wpa.dbl
此命令從 Windows CD 中提取 Wpa.dbl 檔的副本。然後,將其置於 Windows 安裝的 System32 資料夾中。

3. 檢查命令提示處出現的輸出結果。如果命令成功執行,則會顯示類似於以下內容的資訊:
(R) File Expansion Utility Version 5.1.2600.0 Copyright (C) Corp 1990-1999. All rights reserved. Expanding d:\i386\wpa.db_ to c:\windows\system32\wpa.dbl. d:\i386\wpa.db_: 2222 bytes expanded to 2126 bytes, -5% increase.
4. 輸入 exit,然後按 Enter 退出命令提示。

步驟 8:刪除與程式相關的檔案

1. 按『開始』,然後按『搜尋』。
2. 在『您要搜尋什麼』下,按『所有檔案和資料夾』。
3. 在『全部或部分檔案名稱』框中,輸入以下內容,然後按『搜尋』:
reset5.exe; reset5.dll; reset5.dat; reset5.dt*; srvany.exe
此操作將對以下所有檔案進行搜尋:
Reset5.exe
Reset5.dll
Reset5.dat
Reset5.dt*
Srvany.exe

請注意:如果您使用其他搜尋工具,如 Windows Desktop Search,則可以使用此工具來搜尋其中的各個檔案。

4. 在『搜尋結果』對話方塊的結果視窗中,右鍵按每個檔案,然後按『刪除』。
5. 按『是』,確認刪除檔。
6. 在完成對這些檔的刪除後,退出『搜尋結果』對話方塊。
7. 重新啟動電腦,並讓 Windows 以正常模式重新啟動。

步驟 9:重新啟動 Windows

1. 按『開始』,依次指向『所有程式』、『附屬應用程式』和『系統工具』,然後按『啟動 Windows』。
2. 如果『Windows 產品啟動精靈』提示啟動 Windows,則按精靈中的說明啟動 Windows
3. 重新啟動電腦,然後重複『步驟 9:重新啟動 Windows』的步驟 1,再次啟動『Windows 產品啟動精靈』。執行此步驟,以確認精靈不會再提示啟動 Windows
4. 如果『Windows 產品啟動精靈』顯示『Windows 已啟動』訊息,則按『確定』退出精靈。

Monday, September 22, 2008

Apache + Subversion + Trac 安裝配置設定三合一 (Ubuntu)

安裝 install apache
=======================

$ sudo apt-get install apache2

安裝 install subversion
=======================

$ sudo apt-get install subversion

$ sudo apt-get install libapache2-svn

設定 Confiigure subversion
--------------------------

Enter menu system/management/user_and_group

change to group tab, add atwo new group named "www-data"(apache) and "subversion"
then add user [your account] and "www-data" to "subversion"'s group members.

or use command instead::

$ sudo adduser www-data subversion
$ sudo adduser [your account] subversion

Then we could create svn repository::

$ sudo svnadmin create /home/svn (or $ sudo svnadmin /usr/local/svn)

Then Change the folder owner

$ sudo chown -R www-data:www-data /home/svn
$ sudo chmod -R g+ws /home/svn

Setup apache host site
$ sudo gedit /etc/apache2/mods-enabled/dav_svn.conf

uncomment following lines:
[Location /svn]
DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
[/Location]

or add following just above the /location:

[LimitExcept GET PROPFIND OPTIONS REPORT]
Require valid-user
[/LimitExcept]
為 subversion 存取加上密碼:

sudo htpasswd -c /etc/subversion/passwd user_name


重開 apache:

sudo /etc/init.d/apache2 restart

驗證能取得 svn 檔案:

$ svn co http://hostname/svn/myproject myproject --username user_name


安裝 Install Trac
================

$ sudo apt-get install trac

$ sudo mkdir /home/trac
$ sudo chown www-data:www-data /home/trac

To add a virtual host to host trac:

$ sudo gedit /etc/apache2/sites-available/trac


[VirtualHost *]
ServerAdmin webmaster@localhost
ServerName trac.example.com
DocumentRoot /usr/share/trac/cgi-bin/
[Directory /usr/share/trac/cgi-bin/]
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
[/Directory]
Alias /trac "/usr/share/trac/htdocs"

[Location /]
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/trac
#PythonOption TracEnv /home/trac/singletrac
PythonOption TracUriRoot /
[/Location]

DirectoryIndex trac.cgi
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined

[/VirtualHost]

Uncomment the AddHandler line in /etc/apache2/apache2.conf so that the Trac CGI program will be executed:

# To use CGI scripts outside /cgi-bin/:
#
AddHandler cgi-script .cgi

Disable the default virtualhost, enable the Trac virtualhost, and restart Apache2:

sudo a2dissite default
sudo a2ensite trac
sudo /etc/init.d/apache2 reload


Make New Trac Project expose to web
===================================

sudo trac-admin /home/trac/YourProjectNameHere initenv

Then the interactive interface was prompt:
[specify the repository to /home/svn/YourProjectNameHere]

sudo chown -R www-data /home/trac/YourProjectNameHere


Refer to
http://trac.edgewall.org/wiki/TracOnUbuntu
http://trac.edgewall.org/wiki/TracModPython
http://www.blendedtechnologies.com/setting-up-subversion-on-ubuntu/11
http://philipatswarchy.wordpress.com/2006/11/27/apachesslsubversionpam/

Saturday, September 20, 2008

用VMWare開雙視窗玩3D遊戲

這個設定只適用在 VMWare Workstation 版本

1.切換到存放XP虛擬電腦檔案的資料夾,然後找到「Windows XP Professional.vmx」個檔案,這時用記事本或其他純文字編輯程式來開啟它。

2.開啟後捲動頁面到最下方,輸入「mks.enable3d = TRUE」、「svga.vramSize = 67108864」、「vmmouse.present = FALSE」三行,輸入完畢就可以存檔關閉。

3.回到VMWare,按下功能表上的【Edit】→【Preferences】叫出設定對話盒,再點選〔Input〕分頁標籤,取消勾選「Ungrab when cursor leaves window」,然後按下〔OK〕關閉對話盒。

4.接下來啟動虛擬XP,啟動完畢後按下鍵盤上「Ctrl」+「Alt」鍵回到VMWare主畫面,然後按下功能表上的【VM】→【Install VMware Tools】再按下〔Install〕安裝VMWare工具組,安裝完畢後讓虛擬XP重新開機。

5.最後用虛擬XP連線到「 http://tinyurl.com/5xosf 」下載DirectX回來安裝,然後按下「開始」→「執行」並輸入「DXDiag」,切換到〔顯示〕標籤分頁,看見「Direct3D加速」部份顯示「已 啟用」,就表示虛擬3D顯示卡已經設定成功了。

Sunday, September 14, 2008

在 linux (ubuntu) 裝 oracle xe

First modify /etc/apt/sources.list file:
$ sudo vi /etc/apt/sources.list
Append following line:
deb http://oss.oracle.com/debian unstable main non-free
Save and close the file. Next import GPG key:
$ wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
Update package database:
$ sudo apt-get update
Finally install Oracle:
$ sudo apt-get install oracle-xe

You must configure Oracle TCP/IP port and other parameters. Simply type the following command:
$ sudo /etc/init.d/oracle-xe configure

To access the Database Home Page go to http://127.0.0.1:8080/apex. Open a web browser and type url (you need to use username 「system」 and password setup earlier)

Wednesday, August 27, 2008

如何寫 Beautiful code

剛剛讀了一篇文章,發現跟我的想法不謀而合,因此抓下來供自己或參觀我的 blog 參考
所謂 beautiful code 並不是要證明寫的 code 很厲害確難懂,而是清楚易懂又有效率
不易懂的 code 讓自己或別人無法輕易理解及重複使用

Class.forName for Methos.invoke 等是我最不建議使用,因為用了 System level 的呼叫方式
這些方式通常屬於較底層的寫法,用在平常開發 Web Application 則顯得格格不入

Beautiful Coding - The way to life.

I often have to fix other people’s code. You can tell coders who have been coding for years simply by the feel of their code.

One of the problems with java is the simple fact that you can end up with a spaghetti-junction of objects all calling, calling back, implementing, sub classing, overriding, running ejb’s etc etc and it can be a bit of a nightmare to find your way through.

The key here (although you can reverse engineer into a UML Model with Netbeans) is really in the way that the code is written.

Things I do to make code more readable

- Initials of variables

All my strings for instance start with s - sName, sUsername
integers I , iCount, iGold
doubles d

and so on for different types of variables or objects.

Components on forms I use a 3 letter start up.

txtTEXTBOX
lblLABEL
stcSTATICTEXT
cmbCOMBOBOX

Also in the code using the java doc function, within Netbeans if you type /** enter it will auto document the next function and you just “fill in the blanks”, javaDoc is fantastic and well worth looking into. If you have “java doced” your code, not only does Netbeans pick up the documentation when you are typing or using your own functions but also you can generate a website that documents your classes!!! How Call

ALT-SHIFT-F - auto format your code, very useful.

Comment long bracketed loops. I always put // from next to a bracketed loop that is too long to see in one screen. e.g.

for (int iCount=0;iCount<10;++icount)> 

Also comment all calls to EJB’s to say what they do -

// Get this job’s History
JobManagerBean.getHistory(sJobNumber);

Beautiful Code!

Lisp programmers write beautiuful code, why? Because you have to, it becomes unreadable otherwise. In a way I wish all programmers would learn Lisp - because it makes you think in a different way and see software development from an almost etherial height. When I get some further research time I want to work on a lisp implementation for netbeans.

Remember that you will not be around forever, don’t punish the next poor programmer who has to work on your code. I like my code to be really easy to read and understand.

Code Rewriting

You know that sometimes I will rewrite a whole subroutine if I’m not happy with it. Programmers are artists, the difference is that the result of our art is a system for people to use or some form of output. Well written, neat, fast, efficient code means happy users and that is the caling of a programmer, to make the lives of the users easier.

If your software makes it harder. It needs rewriting, or maybe replacing with a pen and paper.

Be passionate about your coding and your users will be passionate about your software.



出處 : Beautiful Coding - The way to life.

Thursday, August 21, 2008

每個 team 都該裝個 Wiki

自從裡裝了個 JSPWiki 之後,開始把一些日常的資源往上面丟,做些小整理。試用一陣子之後,發現用 Wiki 整理文件真的超快,語法簡單,資料的相互連結打幾個字就搞定。也不用怕寫的不好,有問題直接改就行了。完全無痛 !! 總算是讓我這個 "死也不寫文件" 的人寫文件寫的心甘情願~~

喔... 我們不是拿來寫軟體規格書,還是啥 SA/SD 文件。主要是收集如何安裝、如何 deploy、或是一些開發的設定、像是 eclipse、資料庫... 等等資料。這些東西並不是每天在做,偶而才做一次而已 (例如新人報到,或是重灌電腦),因此很容易忘記,常常翻箱倒櫃亂找,找的滿頭大汗還不見得找得回來... 用 wiki 來整理這些資料再適合不過了,真恨自己以前不懂的用這個工具~~

一些我們 wiki 的截圖:

首頁設計成提供快速的常用連結

home

Eclipse 的相關設定

eclipse

常用的 API 連結

api

Project 的資料

project

收集一些對開發有益的文件

Wednesday, August 20, 2008

有關軟體開發流程

最近發現 Netbeans 的內部人員發表了在 Netbeans IDE 開發時的流程,這也是我一直想要推動及執行的。
唯有如此做,在台灣的軟體開發才能漸漸的上軌道。

I have worked on a lot of large software projects in the 17+ years I have been in the industry, and I don't say it lightly that I think NetBeans has one of the best development processes I've ever seen.


I've been on (and seen) projects that were so overburdened with processes and documents that it was like walking through a lake of molasses.

I've also been on (and seen) projects where there was so little process that life was exciting, interesting, crazy, but basically one chaotic scramble after another.

NetBeans follow a beautiful middle path - not too much process, but not too little. I'm sure I'm missing a lot of important points and aspects that make this all fall together, but these are the ones that stand out to me:

Planning
The planning phase is fast and lightweight. Each release is given a release boss, and the release boss works to define a theme for the release. The release boss also decides on the dates for milestones and the final release. Then each team is asked to decide what features they feel best meet the theme, and for what milestones those features will be delivered.

Normally the feature list is written up quickly on a Wiki page. Each feature is given an issue number in Issuezilla and is assigned a person who owns it and a milestone date.

The release boss uses reporting features in Issuezilla to track all of the features committed for a given milestone, and you have the plan. Pretty simple. We all know what to do, and when we have to do it by, and we get to work.

Specification and Design

You are expected to specify the user experience and interface for your features. But it's in a very lightweight manner, on a Wiki page. Here is an example UI Spec that I wrote. Pretty simple, but it gets the point across.

Certain defining features get a lot of attention and are reviewed carefully by our User Experience team, but for most smaller features you just need to write up a quick spec, have it reviewed by your team, and you are done.
A milestone on the A140 in Horsham St.
Milestones
I love milestones. I think every large team should have milestones. Basically these are a mini-release, where everyone has to get features in by a certain date, there is a stabilization period with extended QA and bugs are fixed, and then it gets published on the NetBeans site. Milestones normally happen about once every 4-6 weeks.

The main reason why I like these as a developer is because it keeps me focused. A six month development cycle tends to make you be lazy early on in the cycle. With milestones coming at you once a month, you get very focused, and you are working hard all the way through the release, instead of working insanely at the end. This also means that it is much more likely that we deliver on time, or if we're late, we know sooner rather than later. And what I have seen is that NetBeans has consistently delivered what we say we deliver, when we say we're going to deliver it. There is a lot behind this, but milestones are a key part of this.

Simple, Strong Quality Criteria
Every release has quality criteria. These are soft and hard goals in terms of the number of P1, P2 and P3 bugs. There is a total overall goal, and each team is also assigned specific goals. For some reason a lot of projects I have been on have not been that strict about this, and it has affected the quality of their product

Nightly Builds Available to the Community
What this means is everybody is using our stuff all the time, all the way through the release process, and we hear from them. I think this is great. More and more projects are doing this, and I really can't recommend it highly enough. And if you don't know about Hudson, you really should check it out.

The Team
This is a lot harder to reproduce, but as usual is a key part of it.

The theme running through this all of this and a thousand more details and steps, is a dedication to quality and predictability, without overburdening the teams with process and busywork. It's a difficult balance, and it's executed quite well here.

So I think that is probably the underpinning of why NetBeans development process rock: the team. From developers to management to QE to release engineering, I have never seen such a smart, dedicated, hardworking group of folks. I am really honored to work with them.

Source : NetBeans development process rocks!