Recent Notes

Displaying keyword search results 61 - 70
Created by alfa on April 11, 2011 20:55:35    Last update: April 11, 2011 20:55:35
There are two methods to create a temporary file in Java: File.createTempFile(String prefix, String suffix) : Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. The default temporary-file directory is specified by the system property java.io.tmpdir . File.createTempFile(String prefix, String suffix, File directory) Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. If no exception is thrown, then: The file denoted by the returned abstract pathname did not exist before this method was invoked, and Neither this method nor any of its variants will return the same abstract pathname again in the current invocation of the virtual machine. Call File.deleteOnExit() to arrange for the...
Created by alfa on April 04, 2011 20:07:28    Last update: April 04, 2011 20:07:28
The java.io.File class can be used to do various file tests: File file = new File("myTestFile.txt"); ...
Created by Dr. Xi on January 14, 2010 00:28:27    Last update: March 30, 2011 15:37:44
A task that a Java developer does so frequently is to find out where a certain class can be found - to resolve compilation errors, classpath issues, or version conflicts of the same class introduced by multiple class loaders. A long while back I wrote a simple Perl script to perform the task. Later I was informed that there are Swing based Jar Browser and Jars Browser . Then, there are a couple of shell one-liners: # one liner 1 find -name "*.jar" -print0 | xarg... But all of them share the same problem: if a class is in a jar nested in another jar, it cannot be found. Such is the case for a class inside a jar under the WEB-INF/lib directory of a...
Created by magnum on March 25, 2011 13:29:53    Last update: March 25, 2011 13:30:45
Create an ISO image for files from a directory: mkisofs -o cdrom.iso /home/jack/files-for-cdrom/ Create an ISO image from CD/DVD drive: dd if=/dev/cdrom of=~/cdrom.iso bs=2048 conv=sync
Created by nogeek on March 21, 2011 15:31:26    Last update: March 21, 2011 15:32:35
Inventory list for configuring a JDBC data source in JBoss: Put *-ds.xml configuration file in server/yourServer/deploy , e.g., hsqldb-ds.xml Other needed files in server/yourServer/deploy : jboss-local-jdbc.rar , jboss-xa-jdbc.rar , jca-jboss-beans.xml , transaction-jboss-beans.xml Copy jboss-jca.deployer directory to server/yourServer/deployers Copy standardjbosscmp-jdbc.xml to server/yourServer/conf Make sure the following lines appear in server/yourServer/conf/jboss-service.xml <mbean code="org.jboss.ejb.plugins.cmp.jdbc.metada...
Created by magnum on March 09, 2011 15:49:58    Last update: March 09, 2011 15:49:58
GNU cpio copies files into or out of a cpio or tar archive. There are 3 modes: -o : copy-out mode, copies files into an archive -i : copy-in mode, copies files out of an archive -p : copy-pass mode, combines the copy-out and copy-in steps without actually using an archive Examples: # create a cpio archive with all files in the ...
Created by magnum on March 02, 2011 14:00:24    Last update: March 02, 2011 14:00:24
The installation script for JDK 1.5 failed since I already had JDK1.6: Do you agree to the above license terms? [yes or n... Fortunately jdk-1_5_0_22-linux-amd64.rpm was left in the current directory. Used the --force flag to install JDK1.5: rpm -i --force jdk-1_5_0_22-linux-amd64.rpm Now both 1.5 and 1.6 are available: ls -l /usr/java total 12 lrwxrwxrwx. 1 root ...
Created by Dr. Xi on February 17, 2011 12:59:47    Last update: February 17, 2011 12:59:47
Operator Meaning -e file1 file1 exists -b file1 file1 is a block special file -c file1 file1 is a character special file -d file1 file1 is a directory -f file1 file1 is a regular -g file1 Set Group ID (sgid) bit is set for file1 -h file1 file1 is a symbolic link -k file1 Sticky bit is set for file1 -L file1 file1 is a symbolic link -p file1 file1 is a named pipe (FIFO) -r file1 file1 is readable by the current process -s file1 file1 has a size greater than zero. -t FileDescriptor FileDescriptor is open and associated with a terminal. -u file1 Set User ID (suid) bit is set for file1 -w file1 Write flag (w) is on for file1 -x file1...
Created by woolf on February 10, 2011 13:25:20    Last update: February 10, 2011 13:25:20
If Command Extensions are enabled (which is enabled by default), then there are several dynamic environment variables that can be expanded but which don't show up in the list of variables displayed by SET . These variable values are computed dynamically each time the value of the variable is expanded (but see example below). If the user explicitly defines a variable with one of these names, then that definition will override the dynamic one described below: %CD% - expands to the current directory string. %DATE% - expands to current date using same format as DATE command. %TIME% - expands to current time using same format as TIME command. %RANDOM% - expands to a random decimal number between 0 and 32767. %ERRORLEVEL% - expands to the...
Created by Dr. Xi on February 03, 2011 13:47:22    Last update: February 03, 2011 13:47:22
Read a directory and sort files by modified date (oldest to newest): $dirname = "."; opendir(DIR, $dirname) or die $... Same, but with glob (note that the output is a bit different): $dirname = "."; @files = sort { -M $b <=> -M $... Switch the places of $a and $b to order from newest to oldest.
Previous  2 3 4 5 6 7 8 9 10 11 Next