Saturday, 13 December 2008

SVN for Eclipse Installation on Ubuntu

There are two SVN alternatives for Eclipse Subversive and Subclipse. In Windows, both of them seem work out of the box. But in Ubuntu, they require lot more steps to make it works.


Subclipse


For ubuntu and all other linux OS, a library called libsvn is required to install prior installation of Subclipse:


sudo apt-get install libsvn-java

In Eclipse, using Software Updates to obtain Subclipse, make sure include JavaHL adapter and SVNKit adapter. After installation, Eclipse may says that "JavaHL (JNI) Not Available". This is caused by JVM fails to find the libsvn library location (in /usr/lib/jni) which support JavaHL interface. Now, open eclipse.ini in eclipse installation folder and add follow line just after "-vmargs"

-Djava.library.path=/usr/lib/jni

Re-open eclipse the problem should be solved!


Update 16/12/2008 - I could not find a way to save SSH password.. which mean even time accessing the repository you are asked for password.. very annoying..


Subversive


So far, I still could not make Subversive works (the JavaHL part). Subversive contains two components that are required:



  • Subversive SVN Team Provider Plugin (Incubation)

  • Subversive SVN Connectors JavaHL and/or SVNKit


They can be grabbed from two different update URL check here. For some reasons, it may need to select/enable the correct update URL in Software Updates -> Manage Sites. Fail to do so may results to have old version of SVN Team Provider Plugin installed.


It seems that Subversive requires libsvn library as well, and JVM also fail to find libsvn location, but even apply above method, JavaHL still could not be loaded due to either "Could not find library" or "library has been loaded by another class loader"


Update 20/12/2008 - Forget about JavaHL!!! Use SVNKit which is purely bases on Java!!!

Thursday, 27 November 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

Tuesday, 25 November 2008

Thinkpad Middle Mouse Scrolling in Ubuntu 8.10

Originally from "aliencam dot net blog.", just keep a record here :)


I found a couple blogs that said they got middlemouse scrolling working on a thinkpad, but none of their methods worked on my x61Tablet with 64-bit Ubuntu 8.10 installed. This version of ubuntu uses evdev instead of the xorg.conf file that previous versions used, so it makes configuring the middle mouse button a little bit more difficult.


The first thing you should do (just for your own records) is this command:



xinput -list-props "TPPS/2 IBM TrackPoint"


that will return the properties of your trackpoint. (change “TPPS/2 IBM TrackPoint” to “DualPoint Stick” if you have an X200 or X61s.) I did not do this before changing settings, so I don’t know what the original looks like (if you do, please post it in the comments so I can have a record of it! I posted the final results of that command at the end.)



Now, what you will need to do is create a file, /etc/hal/fdi/policy/mouse-wheel.fdi with the following command:



sudo nano /etc/hal/fdi/policy/mouse-wheel.fdi


then paste in the contents with ctrl-shift-v:




true
2
4 5
6 7
true
200


save and quit by hitting ctrl-x, then “y”.



Now, the above configuration DOES NOT work for me, but it seems that it does for everybody else who has a blog (I can’t help but wonder if anyone actually tried it… so many comments just say it doesn’t work…) what happens is that the xinput list-props command shows the buttons as being mapped correctly, but nothing happens in xev or in real use. I cannot find any errors in any log files to indicate why.



So, what I do to get it working is in the above file, change “YAxisMapping” and “XAxisMapping” to be misspelled by adding an extra “s” as such: “YAxsisMapping” “XAxsisMapping” (you don’t have to do this, you can just delete those two lines and the next step will cause it to work. I just mess up the spelling so I can change it back later easily)



Now, create another file. This will be a shell script that is run at startup to map the horizontal scrolling correctly (If you don’t care about horizontal scrolling and only use vertical, just stop after you messed up or deleted the XAxisMapping and YAxisMapping lines).Use the following command:



nano /home/$USERNAME/.horizscrollscript


Then paste with ctrl-shift-v, or type in the following contents:



#!/bin/bash
#
#
# The following line sets the X-axis mapping to buttons 6 and 7 so that
# horizontal scrolling works.
xinput -set-int-prop "TPPS/2 IBM TrackPoint" "Wheel Emulation X Axis" 8 6 7


then save and close with ctrl-X, then “Y”. make the file executible with:



chmod +x /home/$USERNAME/.horizscrollscript

Now open the gnome sessions manager (System > Prefferences > Sessions, or alt-f2 and “gnome-session-properties”) and click “add”

for the “Name” field, name it something so you know what it does (I named it Horizontal Scroll Script).

In the “Command” field, enter the path to the file (/home/$USERNAME/.horizscrollscript)

The comment field is optional. Save and restart, and everything should be working!

Please leave a comment if this does or does not work for you, I’m curious to know if I messed something up and that is why the first art of the tutorial doesn’t work.

To test everything, you should try this command:

xinput -list-props "TPPS/2 IBM TrackPoint"

and it should return:

Device 'TPPS/2 IBM TrackPoint':
Device Enabled: 1
Middle Button Emulation: 1
Middle Button Timeout: 50
Wheel Emulation Inertia: 10
Wheel Emulation: 1
Wheel Emulation X Axis: 6, 7
Wheel Emulation Y Axis: 4, 5
Wheel Emulation Timeout: 200
Wheel Emulation Button: 2
Drag Lock Buttons: 0

those bolded lines are what we were trying to get! now to test how your computer sees you use those buttons, ust the command:

xev

then you can hit keys on the keyboard and watch what it returns, or put the mouse pointer in the box that pops up and watch that as well. You should be able to see that scrolling down is 5, up is 4, left is 6 and right is 7. (close xev with ctrl-z or by pressing the “x” on the box.)

Saturday, 22 November 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...

Thursday, 20 November 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 :).