2010年6月3日 星期四

Oracle 11g: Error on Start up

If you get Error like:
Failed to auto-start Oracle Net Listener using xxxxx
or
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener

SOLUTION:
Update file "dbstart", change link ORACLE_HOME_LISTENER=$1 to ORACLE_HOME_LISTENER=$ORACLE_HOME

2010年5月28日 星期五

DB2: Select table Primary key and Foreign Key

Primary key

SELECT NAME
FROM
SYSIBM.SYSCOLUMNS
WHERE TBNAME = 'table name'
AND TBCREATOR = 'creator'
AND KEYSEQ > 0
ORDER BY KEYSEQ ASC

Foreign Key

SELECT B.REFTBNAME AS PARENTTABLE,COLNAME
FROM
SYSIBM.SYSFOREIGN KEYS A,
SYSIBM.SYSRELS B
WHERE A.RELNAME = B.RELNAME
AND B.TBNAME = 'table name'
AND B.REFTBCREATOR = 'creator'
AND B.REFTBCREATOR = A.CREATOR

2010年5月12日 星期三

SQL: not match from table 1

SELECT TestTable1.ID, TestTable1.Name, TestTable1.Title
FROM TestTable1 LEFT JOIN TestTable ON TestTable1.[Name] = TestTable.[Name]
WHERE (((TestTable.Name) Is Null));

2010年5月11日 星期二

SharePoint: The trial period for this product has expired.

Method 1:
Go to: http://support.microsoft.com/kb/971620/en-us
(When you install the 2007 Microsoft Office servers Service Pack 2, the product expiration date is activated incorrectly) and follow the document.

Method 2:
Added application pool Account ("dcomcnfg.exe") to the Distributed users
(Add the Application Pool account to the built-in Active Directory group "Distributed COM Users".)
1. Go to Application Pool and see what's the account which can access this Application pool.
2. Go to Active Directory and find the group named "Distributed COM Users". Add the application pool account to that group.

2010年4月18日 星期日

JAVA Memory Leak

FINDING MEMORY LEAKS IN JAVA APPS

Here is a small HOWTO on how to find memory leaks with Java SE.

I’ve written it while trying to find memory leaks in our testing tools: JTHarness and ME Framework, and then wanted to share the HOWTO with the world, but I didn’t have my blog at that time, so I posted this info as a comment to a relevant entry in the excellent Adam Bien’s blog.

Note: Use the latest JDK 6, because it has the latest tools, with lots of bug fixes and improvements. All the later examples assume that JDK6’s bin directory is in the PATH.

STEP 1. START THE APPLICATION.

Start the application as you usually do:

java -jar java_app.jar

Alternatively, you could start java with hprof agent. Java will run slower, but the huge benefit of this approach is that the stack traces for created objects will be available which improves memory leak analysis greatly:

 java   -Dcom.sun.management.jmxremote   -Dcom.sun.management.jmxremote.port=9000   -Dcom.sun.management.jmxremote.authenticate=false   -Dcom.sun.management.jmxremote.ssl=false   -agentlib:hprof=heap=dump,file=/tmp/hprof.bin,    format=b,depth=10   -jar java_app.jar

When the application is up, perform various actions that you think might lead to memory leaks.

For example, if you open some documents in your app, the memory graph could rapidly go up. If closing the docs and invocation of full garbage collection did not bring the memory back to normal level, there is probably a leak somewhere.You might use jconsole from JDK 6 to see the memory consumption graph to have a clue whether memory leak is present or not:

jconsole

It will pop up a dialog with a list of Java applications to connect to. Find the one with java_app.jar and connect. Also, jconsole allows to invoke full GC providing nice button just for that.

STEP 2. FIND THE APPLICATION PID.

Find out the application’s process id via:

jps

It will print something like:

15976 java_app.jar
7586 startup.jar
22476 Jps
12248 Main
5437 Bootstrap

In our case the pid is 15976.

STEP 3. DUMP THE HEAP INTO FILE.

Dump heap into the file:

jmap -dump:format=b,file=/tmp/java_app-heap.bin 15976

We just told jmap to dump the heap into /tmp/java_app-heap.bin file, in binary from (which is optimized to work with large heaps). The third parameter is the pid we found in Step 2.

Alternatively, if you started java with hprof agent, you could just use Ctrl-\ on Solaris/Linux or Ctrl-Break on Windows to dump heap into the file, specified in hprof agent arguments.

STEP 4. VISUALIZE THE HEAP.

Use jhat tool to visualize the heap:

jhat -J-Xmx326m /tmp/java_app-heap.bin

Jhat will parse the heap dump and start a web server at port 7000. Connect to Jhat server by pointing your browser to:

http://localhost:7000

And start investigating. :)

Jhat allows you to see what objects are present in the heap, who has references to those objects, etc.

Here are some tips:

  • Investigate _instances_, not _classes_.
  • Use the following URL to see the instances: http://localhost:7000/showInstanceCounts/
  • Use “Reference Chains from Rootset” (Exclude weak refs!!!) to see who’s holding the instance.

2010年3月24日 星期三

Spring: onBindAndValidate

Well, there is a reason why the standard Validator does not offer access to the current HttpServletRequest: Validators are not web-specific in the first place, so they obviously shouldn't have any Servlet API artifacts in their signature. So I'm afraid standard Validators will remain the way they are, without access to the HttpServletRequest.

So in general, I would still recommend to override "onBindAndValidate" here. Note that you can easily delegate to some custom validator objects from there: For example, define a "RequestAwareValidator" interface yourself, implement it according to your needs, pass an instance into your controller through dependency injection, and call that instance from your "onBindAndValidate" implementation.


Refer to http://book.opensourceproject.org.cn/java/eclipse/eclipsejava/opensource/0672328968/ch07lev1sec8.html#ch07fig08

2010年3月3日 星期三

2010年2月19日 星期五

DB2: Select table sturcture

select TBNAME, NAME, COLTYPE, LENGTH, NULLS FROM SYSIBM.SYSCOLUMNS
WHERE TBCREATOR = 'schemaname' and TBNAME in ('tablename')

2010年2月10日 星期三

SVN: Eclipse Plugin

1. Help->Install New Software
2. Choose to work with Galileo – http://download.eclipse.org/releases/galileo
3. Unfold Collaboration
4. Choose Subversive SVN Team Provider (Incubation)
5. I employ you to restart Eclipse and don’t use any plugin at this point since they will not work and you will get a message which is similar to this: 0×0040010b: Obtain Project Name’ operation finished with error: Selected SVN connector library is not available or cannot be loaded …’. Instead you rather install a connector library.
6. Help->Install New Software
7. Add a site
8. I used: http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/ , but you can probably use any other that has SVNKit or JavaHL connector
9. Unfold Subversive SVN Connectors
10. Select Subversive SVN Connectors, SVNKit (1.3.0), JavaHL (1.6.0) and it’s native libraries.
11. Restart Eclipse
12. Configure SVN Connector by specifying the connector in Window->Preferences->Team->SVN->SVN Connector.

2009年10月16日 星期五

T-Mobile: WAP Setting

Services => WAP => Settings => Edit Profile => SIM1 => Pick any profile => Edit Profile
1:Rename Profile => T-MOBILE WAP
2:Home Page =>http://wap.myvoicestream.com
3:Data account :T-Mobile GPRS
4:Connection type:WAP
5:User Name:(none)
6:Password:(none)

Services => Data Account => GPRS => (chose an unused company name) =>
1:Change Account Name => T-Mobile GPRS
2:APN => wap.voicestream.com
3:User Name: (none)
4:Password:(none)
5:Auth.type: Normal


Primary DNS: 216.155.165.50

Secondary DNS: 216.155.165.51