Friday, November 28, 2008

Windows XP Installtion Note on K8

Here I just record several steps need to go through after installation is done. AMD K8 system ONLY!!

Hardware Driver Setup

  • Disable System Restore
  • Format D: and E: Drives (Or Document and ProgramFiles Drives)
  • Install Register Manager to E: Drive
  • Change all %ProgramFiles% entries into C:\Program Files
  • Open regedit -> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion. Modify CommonFilesDir, ProgramFilesDir and ProgramFilesPath
  • Install CPU Drivers (AMD K8 Driver, XP Fix and DualCore Optimizer
  • Install nF4 Chipset Driver
  • Install .Net Framework package (ATI Gfx Card ONLY!)
  • Install Gfx Card Driver
  • Install Audio Driver

Set Up User Profile

  • Login as Administrator
  • Copy User Folder from C:\Documents and Settings to D: Drive
  • Open regedit -> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. Change ProfileImagePath to new location from above step
  • Copy back up My Documents to that new location

Partition Size List

  • 10400 --> 10GB
  • 5154 --> 5GB
  • 41002 --> 40GB
  • 20600 --> 20GB
  • 30800 --> 30GB
  • 51300 --> 50GB

Sunday, November 23, 2008

CSS problem on “Microsoft IE”

I have no intention to make it looks any better on IE 5 and 5.5. After I spent lots of time on tuning, it finally looks better (90%) on IE 6 and IE 7. I think this is quite achievement already!!! There are several IE 6 bugs which affect my site:

  • min-height, max-height does not work
  • width MUST be set, or element will extend as long as it can..(even over bound)
  • margin set to auto does not work

But who care?? People will finally find FireFox 3 is sooooo much better!!!

MySQL connection problem with “Spring Transaction Management”

This problem bugs me for a long long time.. it happens when need DB access after a certain period of inactivity. It gives you like:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:238)
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy15.searchMovies(Unknown Source)
com.showman.mediaapp.web.MainViewController.handleRequest(MainViewController.java:36)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
com.mysql.jdbc.Util.getInstance(Util.java:381)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
com.mysql.jdbc.ConnectionImpl.getMutex(ConnectionImpl.java:3018)
com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:4827)
org.apache.commons.dbcp.DelegatingConnection.setAutoCommit(DelegatingConnection.java:331)
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.setAutoCommit(PoolingDataSource.java:317)
org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:221)
org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:377)
org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:263)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
$Proxy15.searchMovies(Unknown Source)
com.showman.mediaapp.web.MainViewController.handleRequest(MainViewController.java:36)
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

After done some research, I found out this problem could be a stale DB connection problem (connection killed by the DB server , but still considered alive by the connection pool). I am using MySQL and DBCP from Apaches Commons, now I set pool maxWait (for connection return to pool) from indefinitely to 3000 milliseconds and see if the problem can be solved...

Friday, November 21, 2008

Shrink SW_Preload Volume in Vista Ultimate on ThinkPad x200

I spent almost two whole days on figuring out how to shrink the SW_Preload volume (where VISTA lives) on my new ThinkPad x200. It took me so long because:

  • ThinkPad's Rescue and Recovery does not allow partition resizing during restoration.
  • I don't need Ubuntu yet. If you have decided install Ubuntu, ur life will become easier by using GParted during installation.
  • I try to avoid using other 3rd party utilities because their operations may break VISTA and force it to process repairation. In ThinkPad's case, Rescue and Recovery does the job which takes forever!!! In other word, the best method is Shrink Volume in VISTA's Disk Management.
  • I want to shrink as much as what free space available. My x200 has 320GB, and SW_Preload takes 280GB <---- FTL!

Method - Step 1:

  • Turn OFF pagefile (virtual memory) and System Restore
  • Remove pagefile.sys and hiberfil.sys
  • Remove all windows shadow copies and restore points

After this, all the large unmovable files should be cleaned. And try to shrink now and Disk Management should let shrink more than before.

Method - Step 2:

  • Require PerfectDisk 2008, read its best practise guide and section: Shrinking Drives under Windows Vista.

This purpose is, there are still lots of unmovable files beside those in step 1 such as boot files, and those currently in used. That where PerfectDisk's boot time defragment comes to play. Its Aggressive Consolidation Degragment also moves MFT in order to get more free space!

Method - Step 3:

  • Require Unlocker to rename or delete folder C:\Windows\System32\LogFiles\WMI\RtBackup

If you are unlucky just like me, VISTA will get error "Access Denied" and operation stops. This is because the folder above has default permission to System ONLY not even Admin can touch it. Therefore I needed Unlocker to remove it forcefully. After reboot, same but new folder is created with proper permission. Shrink again and it should be done!!

In my case, if I want SW_Preload drive occupies EXACTLY 20.XGB, shrink it to 20500 in MB :).