Recent Notes
Displaying keyword search results 71 - 80
Created by nogeek on March 21, 2010 20:13:48
Last update: March 21, 2010 20:23:41
Download JBoss from http://www.jboss.org/jbossas/downloads/
Set environment variables JAVA_HOME and JBOSS_HOME
Open a command prompt and enter %JBOSS_HOME%\bin\run.bat ( $JBOSS_HOME/bin/run.sh on *nix).
Drop your WAR or EAR file into %JBOSS_HOME%\server\default\deploy
Created by Dr. Xi on February 14, 2010 23:00:53
Last update: February 16, 2010 03:20:24
Tomcat auto-deploys WAR files or exploded web applications copied to the appBase directory by default. The default Host configuration in server.xml looks like this:
<!-- Define the default virtual host ... So the appBase directory is named webapps by default, which is where the manager and examples applications are. You can deploy a new application by dropping your WAR file, or copying your application in exploded WAR structure to the same directory. Your application is automatically re-deployed when a new WAR file is copied to webapps , or, in exploded structure, WEB-INF/web.xml is updated. The reason that Tomcat knows to reload a web application when web.xml is updated is because of the WatchedResource declaration in $CATALINA_BASE/conf/context.xml : <Context> <!-- Default set of monitored... It...
Created by Dr. Xi on February 15, 2010 06:09:56
Last update: February 16, 2010 03:08:34
The context root of a web application determines the root path of URLs that will be handled by that application. For example, if the context root is example , then URLs starting with /example (i.e., /example/* ) will be handled by that application. By default, Tomcat uses the WAR file name (without the .war extension) or, if deployed in exploded directory form, the name of the top level directory as the context root . For example, the pre-installed examples application is deployed under the examples directory under webapps , and its context root is examples . You may want to use a different context root than Tomcat's default. For example, if you build your application with Maven, the resulting WAR file might be named my-fabulous-app-1.0-SNAPSHOT.war...
Created by Dr. Xi on January 07, 2010 23:40:28
Last update: February 09, 2010 03:24:35
This is a utility to generate SQL insert statements for Oracle for one table, or a set of tables. It doesn't cover all possibilities but should be good enough for most cases.
import java.io.*;
import java.sql.*;
import ...
To generate insert statements for multiple tables, simply put the table names in a file, one per line, and use the -f switch.
Created by voodoo on February 08, 2010 04:36:31
Last update: February 08, 2010 05:10:57
If you have X server on the client side, you can run remote desktop with XDMCP . But XDMCP is not secure, and it's somewhat tricky to tunnel XDMCP through ssh. So if you are concerned about security, VNC is a much better choice. Plus vncviewer is a lot easier to set up than X server. There are two options to set up VNC server: VNC vino-server Many Linux distros come with remote desktop server installed. On Fedora Core, you can simply set the configuration from the Desktop menu (Desktop -> Preferences -> Remote Desktop), and use vncviewer from the client machine to access the desktop remotely. Install RealVNC or TightVNC and configure it yourself You need to change ~/.vnc/xstartup in order to see the...
Created by Dr. Xi on September 29, 2008 23:21:38
Last update: January 16, 2010 23:36:05
Create a startup script for inetd
Copy /etc/init.d/skeleton to /etc/init.d/inetd . Change the top section of the script to read:
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="In...
Now inetd can be stopped/started/restarted like this:
sudo /etc/init.d/inetd stop
sudo /etc/init....
Add links to rc*.d
$ sudo update-rc.d inetd defaults
Adding sy...
If you no longer need to start inetd at boot up:
$ sudo update-rc.d -f inetd remove
update-r...
This would remove the links from the start up sequence but leave /etc/init.d/inetd in place.
Contents of /etc/init.d/skeleton :
#! /bin/sh
### BEGIN INIT INFO
# Provide...
Created by woolf on May 05, 2009 04:05:08
Last update: January 15, 2010 02:50:49
Remove the sound track. The default output format is avi, even though the input file is mpeg.
mencoder -ovc copy -nosound PandaKing.mpg -o PK-no...
Add a sound track:
mencoder -ovc copy -audiofile PandaKing.ac3 -oac c...
Replace the sound track and encode to mpeg:
mencoder -ovc copy -audiofile PandaKing.zh.ac3 -oa...
Looks like mencoder does not support multiple audio tracks . Check avimux from transcode project, or avidemux2.
Created by Fang on August 22, 2009 21:48:12
Last update: January 10, 2010 00:29:08
The POM (Project Object Model, pom.xml ) is at the heart of all Maven builds. It tells Maven how to build your project, just like build.xml for Ant. This is a POM for a simple Hello World project:
<project xmlns="http://maven.apache.org/POM/4.0.0"...
Not much can be inferred from the POM file alone, because lots of information is implied . For example, packaging defaults to jar , which means that if nothing is specified, Maven compiles all java files under src/main/java and creates a jar .
All Maven POMs inherit from a base Super POM. To see the effective POM for your project, type mvn help:effective-pom :
C:\maven\hello-world>mvn help:effective-pom
Below is the Super POM for Maven 2.0.x.
<project>
<modelVersion>4.0.0</modelVersion>
...
Created by Dr. Xi on November 19, 2008 00:22:27
Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...
Created by Dr. Xi on December 05, 2009 20:12:16
Last update: December 05, 2009 20:46:45
It's quite easy for Perl to open a pipe and read from it:
$file = "nospace.txt";
open(IN, "cat $file |") ...
But the code breaks when the file name contains a space:
# This does not work!
$file = "yes space.txt";
...
On Windows, these don't work either:
# This does not work!
$file = "yes space.txt";
...
You need to use a technique called Safe Pipe Opens :
$file = "yes space.txt";
$prog = "cat";
...