Sunday, January 29, 2006

SQL notes

TSQL reference On MSDN

I am reading some code snippts in Transactional SQL and found this interesting.

1>uniqueidentifier type and NEWID() function.

The NEWID() function in stored procedure will return a unique identifier type, which is essentially a old COM concept GUID.

2>Sql command to display all the tables.

3> Data types

Data Types Description
bigint Integer data from -2^63 through 2^63-1
int Integer data from -2^31 through 2^31 - 1
smallint Integer data from -2^15 through 2^15 - 1
tinyint Integer data from 0 through 255
bit Integer data with either a 1 or 0 value
decimal Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1
numeric Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1
money Monetary data values from -2^63 through 2^63 - 1
smallmoney Monetary data values from -214,748.3648 through +214,748.3647
float Floating precision number data from -1.79E + 308 through 1.79E + 308
real Floating precision number data from -3.40E + 38 through 3.40E + 38
datetime Date and time data from January 1, 1753, through December 31, 9999,
with an accuracy of 3.33 milliseconds
smalldatetime Date and time data from January 1, 1900, through June 6, 2079,
with an accuracy of one minute
char Fixed-length character data with a maximum length of 8,000 characters
varchar Variable-length data with a maximum of 8,000 characters
text Variable-length data with a maximum length of 2^31 - 1 characters
nchar Fixed-length Unicode data with a maximum length of 4,000 characters
nvarchar Variable-length Unicode data with a maximum length of 4,000 characters
ntext Variable-length Unicode data with a maximum length of 2^30 - 1 characters
binary Fixed-length binary data with a maximum length of 8,000 bytes
varbinary Variable-length binary data with a maximum length of 8,000 bytes
image Variable-length binary data with a maximum length of 2^31 - 1 bytes
cursor A reference to a cursor
sql_variant A data type that stores values of various data types,
except text, ntext, timestamp, and sql_variant
table A special data type used to store a result set for later processing
timestamp A database-wide unique number that gets updated every time
a row gets updated
uniqueidentifier A globally unique identifier.

4> Alter Table and Create Table.
Alter Table apply to a table which has already has some data and you want to keep the data.


I think I probably spent about 3 hours trying to fix this issue. When I go to the microsoft update website, it always returns the "0x8DDD0004" error. I tried a lot of differetn solutions until I found the following one.

Be honest, I don't know what is going on underneath, but it turns out the only fixing solution for me.

Windows update doesn't work on my computer until I found the following solution.

corrupted keys.

Import registry key.
1. Click Start, Click Run, type in "notepad C:\fix.reg" (without quotation
marks) and press Enter. Choose Yes when you are prompted.
2. Copy the following commands and then paste them into the opened Notepad

Windows Registry Editor Version 5.00




3. After you paste the above commands, please close the Notepad window.
Choose Yes when you are prompted to save the file.
4. Click Start and Click Run, type in "C:\fix.reg" (without quotation marks)
and press Enter to run the commands we have pasted.
5. A dialog box will pop-up saying "Are you sure you want to add the
information in C:\fix.reg to the registry?". Click Yes on this dialog box
6. Reboot the machine.
7. After the machine reboots use Windows Update and see if the problem has
gone away.

Saturday, January 28, 2006

#2120 : How do I page through a recordset?

A common issue in displaying large recordset in a database.

#2120 : How do I page through a recordset?

SELECT @local_variable=NULL

ransact-SQL Reference
SELECT @local_variable

Specifies that the given local variable (created using DECLARE @local_variable) should be set to the specified expression.

It is recommended that SET @local_variable be used for variable assignment rather than SELECT @local_variable. For more information, see SET @local_variable.

SELECT { @local_variable = expression } [ ,...n ]


Is a declared variable for which a value is to be assigned.


Is any valid Microsoft® SQL Server™ expression, including a scalar subquery.

SELECT @local_variable is usually used to return a single value into the variable. It can return multiple values if, for example, expression is the name of a column. If the SELECT statement returns more than one value, the variable is assigned the last value returned.

If the SELECT statement returns no rows, the variable retains its present value. If expression is a scalar subquery that returns no value, the variable is set to NULL.

In the first example, a variable @var1 is assigned Generic Name as its value. The query against the Customers table returns no rows because the value specified for CustomerID does not exist in the table. The variable retains the Generic Name value.

USE Northwind
DECLARE @var1 nvarchar(30)
SELECT @var1 = 'Generic Name'

SELECT @var1 = CompanyName
FROM Customers
WHERE CustomerID = 'ALFKA'

SELECT @var1 AS 'Company Name'

This is the result:

Company Name
Generic Name

In this example, a subquery is used to assign a value to @var1. Because the value requested for CustomerID does not exist, the subquery returns no value and the variable is set to NULL.

USE Northwind
DECLARE @var1 nvarchar(30)
SELECT @var1 = 'Generic Name'

SELECT @var1 =
(SELECT CompanyName
FROM Customers
WHERE CustomerID = 'ALFKA')

SELECT @var1 AS 'Company Name'

This is the result:

Company Name

One SELECT statement can initialize multiple local variables.

Note A SELECT statement that contains a variable assignment cannot also be used to perform normal result set retrieval operations.

See Also

DECLARE @local_variable



Friday, January 27, 2006

Found an interesting question.

given the following code:

p is not NUL terminated char array
int foo(char *p, char c, int length)
for(int i = 0 ; i <= length ; i++)
if(p[i] == c) return i;
return -1;

1. what does above code do?
2. how many comparison for each iteration?
3. can you modify the function to have less comparison for each iteration?
(hint: p is not pointer to a const char)

Thursday, January 26, 2006

Binding Data to a datagrid.

Binding Data to a datagrid.

1 Declare a datagrid object.
2 Declare a data grid table style.
a. Set the mapping name to the collection name.
b. Add the DataGridTextBoxColumn to the GridColumnStyles of the datagrid.
3 Add the data grid table style to the table styles of the datagrid.
4. Very important, in order to let the datagrid notified the data change and do the proper update of the interface. The collection object which binds to the interface must support the following:

4-a. bool SupportsChangeNotification {get;} must return true.
4-b.event ListChangedEventHandler ListChanged must be implemented.

public event ListChangedEventHandler ListChanged
m_oOnListChanged += value;
m_oOnListChanged -= value;
4-c. Expose the OnListChanged method
protected virtual void OnListChanged(ListChangedEventArgs ev)
if (m_oOnListChanged != null)
m_oOnListChanged(this, ev);

protected override void OnInsertComplete(int index, object value)
//raise the event on ListChanged
//raise event
OnListChanged( new ListChangedEventArgs(ListChangedType.ItemAdded, index ) );
//base.OnInsertComplete (index, value);

protected override void OnSetComplete(int index, object oldValue, object newValue)
OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));

protected override void OnRemoveComplete(int index, object value)

OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));

The datagrid which binds to the collection class will register the ListChanged event and will be notified if an item is added.

If those properties, methods, events are not properly registered, the datagrid will behave stupid and never responds to any event.

Tuesday, January 24, 2006

ASP.Net Web Application Administration

Membership management in Asp.Net 2.

ASP.Net Web Application Administration

I was following the membership tutorials on the Asp.Net website, and it mentioned to use "ASPNETDB" database, however, I couldn't find that database on my machine. But on the Asp.Net administration page, I found the aspnet_regsql feature. It was so cool that it could install and uninstall ASP.Net features on a SQL Server. Essentially, it will add all the necessary tables, views, and stored procedures to database, so the website could take full advantage of all the membership service Asp.Net could provide.

Sunday, January 22, 2006


I found it from here

Design Patterns: Elements of Reusable Object-Oriented Software
The Mythical Man-Month: Anniversary Edition
TCP/IP Illustrated, Volume 1: The Protocols
Writing Secure Code, Second Edition
Advanced Programming in the UNIX Environment, 2nd Edition
Code Complete, 2nd Edition
The C Programming Language, 2nd Edition
Art of Computer Programming Volumes 1-3 Boxed Set
Effective C++
Effective C++: 55 Specific Ways to Improve Your Programs and Designs, 3rd Edition
The Guru's Guide to Transact-SQL
Programming Perl, 3rd Edition
Programming Pearls, 2nd Edition
Pragmatic Programmer: From Journeyman to Master
Extreme Programming Explained: Embrace Change, 2nd Edition
Don't Make Me Think
Don't Make Me Think: A Common Sense Approach to Web Usability, 2nd Edition
Developing Microsoft ASP.NET Server Controls and Components
Security Engineering: A Guide to Building Dependable Distributed Systems
Routing TCP/IP, Volume 1
The Design of Everyday Things
Joel on Software
Internet Routing Architectures, 2nd Edition
Secrets & Lies: Digital Security in a Networked World
The Practice of Programming
Designing with Web Standards
Peopleware: Productive Projects and Teams, 2nd Edition
The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography
Programming Windows, 5th Edition
Mac OS X: The Missing Manual, Panther Edition
The Elements of Style, 4th Edition
In Search of Stupidity: Over 20 Years of High-Tech Marketing Disasters
Godel, Escher, Bach: An Eternal Golden Braid
Service-Oriented Architecture: A Field Guide to Integrating XML and Web Services
Head First Java, 2nd Edition
Introduction to Algorithms, 2nd Edition
A First Look at SQL Server 2005 for Developers
Core Java 2, Volume 1: Fundamentals, 7th Edition
UML Distilled: A Brief Guide to the Standard Object Modeling Language, 3rd Edition
Expert Oracle, Signature Edition (One-on-One)
Hacking Exposed: Network Security Secrets & Solutions, 5th Edition
Microsoft SharePoint: Building Office 2003 Solutions
Effective Java Programming Language Guide
Joe Celko's SQL for Smarties : Advanced SQL Programming, 3rd Edition
Patterns of Enterprise Application Architecture
Group Policy, Profiles, and IntelliMirror for Windows 2003, Windows XP, and Windows 2000
Applied Cryptography: Protocols, Algorithms, and Source Code in C, 2nd Edition
Refactoring: Improving the Design of Existing Code (The Addison-Wesley Object Technology Series)
The C# Programming Language
Pragmatic ADO.NET: Data Access for the Internet World
Computer Networks, 4th Edition


美国著名图书频道Book Pool集结最权威的62位作者评选出了最近10年计算机专业图书中的50强[原文]


* Francesco Balena(Microsoft.NET框架程序设计,Visual Basic.NET语言描述作者)
* Bert Bates(Head First Design Patterns作者)
* Joshua Bloch(Effective Java作者)
* Kalen Delaney(Microsoft SQL Server 2000技术内幕作者)
* Stephen C. Dewhurst(C++ Gotchas作者)
* Bill Evjen(Visual Basic.NET宝典作者)
* Dino Esposito(构建Web解决方案—应用ASP.NET和ADO.NET、Microsoft .NET XML程序设计作者)
* Andy Hunt(Pragmatic Programmer系列图书作者)
* Gary McGraw(Exploiting Software: How to Break Code作者)
* Steve McConnell(Code Complete作者)
* Christian Nagel(Enterprise Services with the .NET Framework作者)
* Arnold Robbins(Linux程序设计作者)
* Tim O'Reilly(O'Reilly媒体集团创始人)
* Chris Sells(Windows Forms程序设计、.NET本质论作者)
* Stephen Walther(设计模式--可复用面向对象软件的基础作者)
* John Vlissides(ASP.NET揭秘作者)



按照现代计算机技术的发展,人月神话应该称得骨灰级图书了,计算机图书能够流行30年,Frederick Brooks确实让人刮目相看。这种现象往往出现在软件工程类和算法类的图书上,这些理论和技术往往经久不衰。比如:
# 设计模式:可复用面向对象软件的基础 -- 1994年出版(多位大师创作)
# 人件 -- 1987年出版(Tom DeMarco、Timothy Lister)

Martin Fowler和Kent Beck是软件工程领域最有名的技术作家,剩下的4本上榜图书全部是他们所写:
# 企业应用架构模式(Martin Fowler)
# 重构--改善既有代码的设计(Martin Fowler)
# 解析极限编程(Kent Beck)
# UML精粹:标准对象建模语言简明教程(Martin Fowler)

Robert C. Martin的敏捷软件开发:原则、模式与实践或者是其他?


C语言的设计者Brian W.Kernighan的C程序设计语言确实经典,超过C++之父Bjarne Stroustrup的C++程序设计语言进入名单榜中。

此外,Scott Meyers的Effective C++众望所归,作者的More Effective C++、Effective STL也同样精彩。

Stan Lippman的C++ Primer不在榜单,有点可惜。


不知道什么原因,Java类图书的排名比较靠后,Head First Java是一本不错的教材,不过国内好像还未引进,Java 2核心技术 卷I: 基础知识已经出第7版了,可见受欢迎的程度。Sun的Joshua Bloch在Effective Java采用Scott Meyers的风格,使本书成为真正的Effective Java Book。

不过Java编程思想、J2EE核心模式、Contributing to Eclipse、 Expert One-on-One J2EE Development without EJB落榜有点意外。


Charles Petzold的Windows程序设计是尽人皆知的Win32 API编程经典,也称为“Petzold Book”。由 Anders Hejlsberg来写C#编程语言详解 ,谁说不是经典?不过ADO.NET实用指南上榜有点出乎我的意料,为什么不是 Jeffrey Richter的Microsoft .NET框架程序设计?


这类只有一本UNIX环境高级编程,漏掉了UNIX 编程艺术是否可惜?


有3本书上榜,Perl之父Larry Wall的Perl语言编程 是经典的教程,网站重构上榜在情理之中,Jeffrey Zeldman一直走在Web标准制定的最前沿。

ASP.NET Page Framework负责人Nikhil Kothari的ASP.NET服务器空间与组件开发讲解ASP.NET模式非常清晰,不过,如果是ASP.NET入门的话,我倒是推荐另外一本--ASP.NET揭秘。



这类图书上榜比较多,TCP/IP如此的重要,TCP/IP详解卷1:协议和 TCP/IP路由技术(第一卷)同时上榜。其他的还有Internet路由结构、计算机网络(第四版)、DNS与BIND


数据库类评选结果不太好评点,Transact-sql权威指南是一本标准的T-SQL教材,进一步实践,还是建议看邹建最新出版的中文版 SQL Server 2000 开发与管理应用实例。

其他上榜的都没有中文版:A First Look at SQL Server 2005 for Developers (FirstLook系列过时太快,基本上没有引进)、Expert Oracle, Signature Edition (One-on-One)(2005年的新书,作者 Thomas Kyte是Oracle的VP)、Joe Celko's SQL for Smarties : Advanced SQL Programming(作者Joe Celko是ANSI SQL标准委员会成员)


网络社会没有比安全更重要的了,这类图书上榜就有5本,分别是: 编写安全的代码、 黑客大曝光、 信息安全工程、 网络信息安全的真相、 应用密码学。 后2本都是国际公认密码和信息安全专家Bruce Schneier的大作。


提到算法,没有人不想到Donald E.Knuth的计算机程序设计艺术,据说Bill Gates曾放言,做对该书所有习题就能到微软来报到上班,可见此书探讨算法的深度。相比Donald的巨著,算法导论更适合做为算法教材。



不好归类的都叫综合类吧,程序员修炼之道书名翻译不太恰当,Pragmatic Programmer代表注重实效的程序员,程序员如何注重实效?全书就围绕这个话题在谈。不过,因为这本书出版时间较早(1999年),我更愿意看Joel说软件,这种Blog的写作风格更加通俗易懂。


Merrill R. Chapman作为老资格的程序员、销售主管,在IT大败局中以事件亲历的方式来剖析Ashton-Tate等公司的失败案例的时候显得特别具有说服力。前车之鉴、后车之师,何必自己花钱买教训呢?

综合类还有很多好书,比如,Gerald M.Weinberg的你的灯亮着吗?、David Kushner的DOOM启世录都值得一读。国内的读者还不应该放过李维的Borland传奇、蔡学镛的爪哇夜未眠

# Microsoft SharePoint: Building Office 2003 Solutions
# Group Policy, Profiles, and IntelliMirror for Windows 2003, Windows XP, and Windows 2000
# Don't Make Me Think
# The Design of Everyday Things
# The Code Book: The Science of Secrecy from Ancient Egypt to Quantum Cryptography
# Mac OS X: The Missing Manual, Panther Edition
# The Elements of Style, 4th Edition
# Godel, Escher, Bach: An Eternal Golden Braid

Why does StartingNodeOffset make my SiteMap dissappear?

Why does StartingNodeOffset make my SiteMap dissappear?

Very useful information on explaining how the sitemap works.

Saturday, January 21, 2006

Exception Handling Process.

Windows can handle user-mode errors in a variety of ways. The following sequence shows the precedence used for error handling:
  1. If a user-mode debugger is currently attached to the faulting process, all errors will cause the target to break into this debugger.
As long as the user-mode debugger is attached, no other error-handling methods will be used — even if the gn (Go With Exception Not Handled) command is used.
  1. If no user-mode debugger is attached and the executing code has its own exception handling routines (for example, try - except), this exception handling routine will attempt to deal with the error.

  2. If no user-mode debugger is attached, and Windows has an open kernel-debugging connection, and the error is a breakpoint interrupt, Windows will attempt to contact the kernel debugger.
Kernel debugging connections must be opened during Windows' boot process. If you are using Windows Server 2003 or a later version of Windows and wish to prevent a user-mode interrupt from breaking into the kernel debugger, you can use the KDbgCtrl utility with the -du parameter. For details on how to configure kernel-debugging connections and how to use KDbgCtrl, see Configuring Software on the Target Computer.
If Windows does attempt to contact a kernel debugger but there is no debugger running at the other end of the connection, Windows will freeze until kernel debugger is activated.
In the kernel debugger, you can use gh (Go With Exception Handled) to disregard the error and continue running the target. You can use gn (Go With Exception Not Handled) to bypass the kernel debugger and go on to step 4.
  1. If the conditions in steps 1, 2, and 3 do not apply, Windows will activate a debugging tool. Any program can be selected in advance as the tool to use in this situation. The chosen program is referred to as the postmortem debugger. This is also known as the just-in-time debugger or the JIT debugger.
If the postmortem debugger is a standard user-mode debugger (such as CDB, WinDbg, or Microsoft Visual Studio®), this debugger will start up and break into your application.
If the postmortem debugger is a tool for writing dump files (such as Dr. Watson), a memory dump file will be created, and then the application will be terminated.
Note If Dr. Watson is activated on Windows XP or a later version of Windows, a message box will appear. This window gives you the option of sending an error report to Microsoft. If you choose Don't Send, a dump file will created and stored on your hard disk. If you choose Send Error Report, a dump file will be created and stored on your hard disk, and will also be transmitted to Microsoft over the internet.
If you have not reconfigured Windows' postmortem settings, Dr. Watson is used as the default postmortem debugger. This setting can be changed programmatically or through the registry; any changes take effect immediately

Testing Applications with Microsoft Windows XP AppVerifier

I found this tool while reading John Robbin's debugging book, except it seemed that it does not support the integration with the VS.Net 2003 anymore as the author has said in his book.

Nevertheless, it is still a very useful tool.

Testing Applications with Microsoft Windows XP AppVerifier

Using Application Verifier to Troubleshoot Programs in Windows XP

Friday, January 20, 2006

How projection works

How projection works.

Projection is the way to project the points on the earth (globe) to the plane.  For different projection systems, like NAD27 and NAD83, they use the same mathematical formula to do the projection, but use the differnt referece system. The NAD 1927 use the Ellipsoid 7008 (Clarke 1866), and the NAD 1983 use the Ellipsoid 7019 (GRS 1980).

The other difference between NAD 1927 and NAD 1983 are the defining constants like the false northing, false easting, etc..

Rules of Thumb to put into StdAfx.h

Rules of Thumb to put into StdAfx.h

  1. All CRT/compiler supplied library included headers.

  2. If you are suing brackets around the name in the include statements, the header files you develop should be in quotes.

  3. Any third-party library header files, like boost.

  4. You own library files.

The inline function in debug/release build.

The inline function in debug and release build.

Page 673 of “Debugging Applications For Microsft.Net and Microsoft Windows”.

In release builds, inline indicates to the complier that it’s supposed to take the code inside the function and pop it directly into where it is being used instead of making a function call. However, in a debug build inline-specified functions don’t get expanded and are treated as normal functions.

Sunday, January 15, 2006

SEH exception and C++ exception.

SEH exception and C++ exception.

SEH doesn’t mix well with C++ programming because C++ exceptions are implemented internally with SEH and the compiler complains when you try to combine them indiscriminately. The reason for the conflict is that when straight SHE unwinds out of a function, it doesn’t call any of the C++ object destructors for objects created on the stack. Because C++ objects can do all sorts of initialization in their constructors, such as allocating memory for internal data structures, skipping the destructors can lead to memory leaks and other problems.

Friday, January 13, 2006

PostgreSQL: The world's most advanced open source database

PostgreSQL: The world's most advanced open source database

I was working on the project to read and write in the WKB format, and was not able to do a good testing. As always , I went to sourceforge to find some information. The WKB4J I found there suggested using the PostgreSQL database. But it seemed to me it's pretty difficult to plug in the postGIS into the engine. I am not a guru of the make file, though I knew it's an essential part to become a good C++ programmer.

It turned out that in the installation package, there was an choice to let you choose whether you want to include the PostGIS part or not, if you choose yes, everything will be ready to go after you finish the installation. It was a beauty.

The PostgreSQL engine also gets strong command support (much like the SSEUtil.exe I played with the SQL server express) and nice GUI.

Open-source projects sometimes are much better than most shity proprietary work.

Tuesday, January 10, 2006

SQL Server Express Utility

SQL Server Express Utility

Version 1.0.2130
SQL Server Express Utility is a tool for interacting with SQL Server. It provides many features including:
- Connect to the main instance or user-instance of SQL Server.

- Create/Attach/Detach/List databases on the server.

- Upgrade database files to match the version of the server.

- Execute SQL statements via the console (similar to SQLCMD) or the console window (UI).

- Retrieve the version of SQL Server running.

- Enable/Disable trace flags (e.g. to trace SQL statements sent to the server by any client app)

- List the instances of SQL Server on the local machine or on remote machines.

- Checkpoint and shrink a database

- Measure the performance of executing specific queries using the timer function (console mode).

- Create and playback lists of SQL commands to be executed by the server.

- Log all input/output.

Even though the tool was built with focus on SQL Server Express (by default, it tries to connect to the SQLEXPRESS instance on the local machine), the tool can also be used to connect to other versions of SQL Server, including SQL Server 2000 and earlier (see the –main option for more information).
Important note
Microsoft Corporation does not provide any technical or customer support services for SQL Server Express Utility
Major changes from the Beta2 version

- All help is now build into SSEUtil.exe. For help on a specific command type SSEUtil help .

- Create new databases (-create command)

- List the child instances running (-childlist command)

- Interactive console window (-consolewnd command)

- History commands in the SQL console (!history show/clear/save)

- Set the connection timeout (-timeout option)

- Set the command timeout (-commandtimeout) command

- Script files can contain variables that will be expanded before sending to the server.

- You can specify the name of the database when attaching (see -attach command)

e.g. SSEUtil -attach c:\northwind.mdf NW

- Most commands can now work with a file path (.mdf) or a database name.

- Detach command syntax changed. You can provide either a path or name of DB to detach

Monday, January 09, 2006

TortoiseCVS: About

TortoiseCVS: About

I was trying to get the latest code from the sourceforge, and it seemed to me this was the mostly recommended CVS client. I had installed, and configured, but everytime, I couldn't get the latest code from the sourceforge. It made me think I configure something wrong.

Finally, it turned out that the source code was at the other cvs hoster website, but I finally get the JTS 1.7 code. It was a very nice software.

Sunday, January 08, 2006

Update database in OLE DB.

I had a project which will parse the address in one field, and write the parsed out data to the different fields. Today, it seems not working fine. I was quite confused for a while, the return value E_UNEXPECTED didn't return much information even with Dr. MSDN.

To write values into the fields in ATL OLEDB, the SetData() function has be to called firstly, and then the Update() function. The SetData() returns DB_S_ERRORSOCCURRED

According to MSDN:

An error occurred while setting data for one or more columns, but data was successfully set for at least one column. To determine the columns for which data was returned, the consumer checks the status values. For a list of status values that can be returned by this method, see "Status Values Used When Setting Data" in "Status" in Chapter 6: Getting and Setting Data.

So I had to check which field returned the bad value, so I called CDynamicAccessor::GetStatus(), and a memo field returned value (8). I ended up deleting this field out of database, it succeeded.

Friday, January 06, 2006

Finally fixed my computer.

I was very frustrated on the old Soyo case because of the loud noise of the battery fan. I went to the local microcenter store to check some possible good deals. Fortunately, I found a Xion case with battery which is 60 dollars. Not bad, and I like one side of the case is transparent, it let me see through the case.

But the process of moving all the parts from one computer to another was not that fun to me. Initially, I thought it should be easy. But the motherboard wouldn't boot after I changed it. I thought it is possible loose memory issue, so I took both memory off, and put them on. It still wouldn't work. I even took the CPU off and put it on again.

I took the computer to the company to ask some help form Dave, who is much more experienced than me on that side. He thought the same issue with me, took one memory off, it booted. Then he took another memory off and put the first memory back on, it worked. It proved both memory were fine. He put both on, and the motherboard booted. Well, I still don't know what I did wrong at home.

Then I took the computer back and put the hard drive and DVD on, the system booted, but the OS wouldn't run. And the BIOS won't recognize any of the drives. I thought the DVD has some issue, so I connected it to the other Dell computer at home. Apparently, it worked. Then I replaced the IDE cable, the OS started. It seemed to me that OS has to boot the IDE devices in the right order. My DVD is on the primary IDE , and two hard drives are on the second IDE. If the OS couldn't find the DVD, it won't go to the next.

It took me three days to get the computer back, after all, I still likes the experiences.

Reverse Method in array.

Reverse Method

I am implementing an revese method of a line in our geometry engine, and I am thinking of how to do the reverse efficiently by avoiding creating extra space.

After I search online, it seems the reverse method already comes with Array class in .Net, and all I need to do is simply calling it.

Easy :-)