Posts

Showing posts from June, 2011

Start webscarab in not lite mode

java -DWebScarab.lite=false -jar webscarab.jar

Ajax in JSF has problem when there is view parameter.

I just don't use view parameter when I am using Ajax in that page.

Java EE

You can start without Java EE or other similar framework like .NET, Spring, Guice, or even systems such as CICS, but you will have to implement the concurrency, transactions, locking, sessions on your own. It’s likely that the end result will be more complex, than a full-blown Java EE solution. If you understand the concepts of distributed computing and know the challenges, Java EE becomes suddenly a breeze. Instead of coding, you can mostly rely on the provided defaults or confgure the desired behavior declaratively. In addition you will gain with Java EE vendor independence. Your business logic will be clearly separated from infrastructure, which can be provided by (as of summer 2009) thirteen certifed application servers and even the Spring framework itself.
-- from <<Real World Java EE Patterns Rethinking Best Practices>> by Adam Bien

Add new disk to Centos

fdisk -l

list the disk


fdisk /dev/sdb

suppose /dev/sdb is what you want to add.
Command (m for help): p
Command (m for help): n
Command (m for help): w


mkfs -t ext3 /dev/sdb1

Format the new partition, suppose you want to format
sdb1 to ext3


mkdir /disk2
Add the following line into fstab.

/dev/sdb1 /disk2 ext3 defaults 0 1
for adding to LVM, refers to this link

Another convenient way to get your external ip information

Sometimes you are inside an internal network and would like to confirm your external ip address. You can go to http://tech.i88.ca/ip/ Or just

wget http://tech.i88.ca/ip/

or

curl http://tech.i88.ca/ip/

Sample code to call python script from java

public static void main(String[] args) throws IOException {

try {
Runtime r = Runtime.getRuntime();
Process p = r.exec("python3.2 urlopen.py");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
p.waitFor();

while (br.ready()) {
System.out.println(br.readLine());
}

} catch (Exception e) {
String cause = e.getMessage();
if (cause.equals("python: not found")) {
System.out.println("No python interpreter found.");
}
}
}