Thursday, April 16, 2009

Unix commands help on diagnosing Weblogic problems

While working on diagnosing the Weblogic problems, I found the unix commands help me a lot, here they are:
  • Apache error_log files BackEnd errors: grep -r -h --include=error_log Backend . | awk '{print $2 " " $3}'| sort | uniq -c

  • Oracle connections: while true; do netstat -an|grep 1521; netstat -an|grep 1521|wc -l; echo "+++++++++++++++++++"; sleep 4; done;

Thursday, April 09, 2009

Google App Engine for Java Rocks!!!

I signed up GAE yesterday, and the account was activated today. It is time to play with it:
* Create Application ID
* Download and install Eclipse plugin
* Create new Web application
* Deploy application to GAE

Done!!!
It is just so easy.
More will come on this topic.

Friday, March 13, 2009

How to remote debug JMeter?

Want to remote Debug JMeter? Here I show you how I did it?
  1. Download JMeter binary package and source package, unzip them into the same directory.
  2. Rename the eclipse.classpath file to .classpath and open the project with IDEA.
  3. Open a shell, set JVM_ARGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
  4. Start JMeter in the previous shell.
  5. Setup remote debug in IDEA and start debug.

Setup JMeter JMS Publisher Sampler

Even though there are documentations on how to setup and use JMeter JMS publisher sampler, it seems all of them are either inaccurate or out of date. After pulling my hair for almost two hours, I finally made it work. To avoid headache for anybody who want to set up JMeter JMS publisher sampler, I recorded the procedure as following.

We choose ActiveMQ as our JMS provider.
  1. Copy activemq-core-5.2.0.jar, jms-1.1.jar, and geronimo-j2ee-management_1.0_spec-1.0.jar into JMeter's lib directory.
  2. Create a jndi.properties file and jar it into a jar file, put the jar file into JMeter's lib directory.
  3. Confiture the JMS publisher sampler with the following settings in the JMeter GUI.
  • Check use jndi.properties
  • Connection Factory: ConnectionFactory
  • Topic: MyTopic
  • Number of messages to aggregate: 1
Here is the content of the jndi.properties file:
java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=tcp://hostname:61616
topic.MyTopic=topic

There are a few catches during the setting up process:
* The ActiveMQInitialContextFactory package name must have the apache.
* ConnectionFactory can not contain any trailing space.
* The Topic JNDI name must be prefixed with topic in the jndi file.
* You must put in the Number Of messages to aggregate, otherwise there will be no messages published.

Monday, December 08, 2008

TeamCity checkout rules

In team city Version Control Settings you can include/exclude the path for checkout.
Here are a few examples:
  • I want to checkout only the directories:/project1/testing/watirtests, and /project1/ant, but not anything else under project1:
-:project1
+:project1/testing/watirtests
+:project1/ant

  • I want to checkout everything but derectories:/project1/testing/watirtests, and /project1/ant:
+:project1
-:project1/testing/watirtests
-:project1/ant

Monday, December 01, 2008

Python recursive generator to find all the files in a directory

Just for exercise, I programed the following transverse_directory function in python to find out all the files in a directory tree in python, while trying the google treasure hunt - zip:

def transverse_directory(path):
if os.path.isdir(path):
for item in os.listdir(path):
item_path = os.path.abspath(path) + os.sep + item
for file in tranverse_directory(item_path):
yield file
else:
yield path

Wednesday, November 26, 2008

Recursive lambda implementation factorial function in Python

It is easy to implement factorial function use recursive in Python, but how do you implement it by using recursive lambda in Python? Here is my try:
 
fact = lambda n: (n and n-1) and n*fact(n-1) or 1

Tuesday, November 25, 2008

What are the Secrets of the Furious Five?

Did you get the secrets of the Furious Five?

Patience(耐心), Courage(勇气), Confidence(信心), Control your strength(自制力) , Compassion(同情心)

Thursday, October 23, 2008

W3C XML Schema design

Recently, I am involved in a project to design some XML Schema for our partners. While working on it, I referred to some resources on the internet, most of them are listed in this Google search result page. I list a few that caught my eyes and I felt helpful:

Thursday, October 09, 2008

Oracle BEA Weblogic Server 10 "invalid pad byte" error

First of first, BEA has the worst error message ever, it just does not make any sense, maybe just for me!

When switch to a new weblogic domain, we like to copy the configuration files to the new domain in order to reserve some configurations works, such as JMS, JDBC settings.

However, you may get weblogic.management.ManagementRuntimeException: com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.

Does this give you any hint that your password-encrypt is incorrect?

You may need to re-encrypt your password in the new domain by using the BEA supplied weblogic.security.Encrypt tool to archive this goal.
java -cp ./weblogic/server/lib/weblogic.jar -Dweblogic.RootDirectory={your domain} weblogic.security.Encrypt {your plain text password}

Monday, August 11, 2008

Seam getting start with JBoss Tools Plugin for Eclipse

Prerequisites:
Install Eclipse and JBoss Tools as Plugin for Eclipse.
Install JBoss AS
Follow the steps to create a HelloWorld Seam web project.








Tuesday, July 08, 2008

Saturday, March 08, 2008

Better Web App

Watch the following video, get a feeling on what is better to be used to develop web application.
better-web-app.mov (video/quicktime Object)

Thursday, February 28, 2008

Oracle Lite dmagent managing olite.key

While dmagent running, it may hold a copy of the olite.key in the memory. So if you change the olite.key in the file system level, it may not be picked up during next action.
Also, the dmagent has the ability to download the new olite.key as it needs, but you may see the username/password challenge window, if you are sure the username/password is correct, just simply click OK, let it try with the new olite.key downloaded by the dmagent. Surprise, it succeeded!

Monday, January 14, 2008

Creating platform specific apps for .Net development

Creating platform specific apps

Most of the language compilers (like C#) now offer a /platform switch. By using this switch, developers can create binaries targeted for a specific platform type or binaries that are platform agnostic. There are four types of binaries that are emitted

· anycpu – platform agnostic

· x86 – 32-bit platform specific

· x64 – x64 platform specific

· itanium – IA platform specific

Please refer to Moving from 32-bit to 64-bit application development on .NET Framework.

How to view the corflags(ILONLY, 32BitRequired etc.) of a PE image?
corflags.exe Core32.dll

Thursday, August 16, 2007

bash shortcuts

Here is a list of bash shortcuts, credit to this blog.
alt-f -- move forward one word
alt-b -- move backwards one word
ctrl-a -- takes you to the begining of the command you are currently typing.
ctrl-b -- move backwards one character
ctrl-c -- kills the current command or process.
ctrl-d -- kills the shell.
ctrl-e -- takes you to the end of the command you are currently typing in.
ctrl-f -- move forward one character
ctrl-h -- deletes one letter at a time from the command you are typing in.
ctrl-l -- clear screen
ctrl-r -- does a search in the previously given commands so that you don't have to repeat long command.
ctrl-u -- clears the typing before the hotkey.
ctrl-z -- puts the currently running process in background
esc-b -- takes you back by one word while typing a command.
esc-p -- like ctrl-r lets you search through the previously given commands.
esc-. -- gives the last command you typed.

Another good reference.
Here "2T" means Press TAB twice

$ 2T - All available commands(common)
$ (string)2T - All available commands starting with (string)
$ /2T - Entire directory structure including Hidden one
$ 2T - Only Sub Dirs inside including Hidden one
$ *2T - Only Sub Dirs inside without Hidden one
$ ~2T - All Present Users on system from "/etc/passwd"
$ $2T - All Sys variables
$ @2T - Entries from "/etc/hosts"
$ =2T - Output like ls or dir

Wednesday, July 18, 2007

Regex back references

When use Intellij to search/replace by using Regex, you need to notice that the back reference is $n rather than \n.
Refer to Intellij Help on search/repalce.
Refer to here.

Replace File Explorer with XPlorer 2

Need a tabbed file explorer?
Try Xplorer 2 out.
Please refer to here.
Aslo: need tabbed console? here you are.

Tuesday, June 19, 2007

This attribute does not support request time values when using JSTL

When I tried to upgrade our jstl library from 1.0 to 1.1, I got the following error:
This attribute does not support request time values
The solution is

  • include JSTL 1.1 by changing the taglib-URIs in include.jsp from
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" >
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt">
    to
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core">
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt">

Does JSTL forEach apply to array?

The answer is yes. Please see here.

Full Guide for using Bitnami Prometheus Operator Helm Chart with Additional Scrape Configuration

"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of...