Recent Notes

Displaying keyword search results 91 - 100
Created by Dr. Xi on January 29, 2010 22:07:44    Last update: January 29, 2010 22:07:44
This class demonstrates how to read a binary file in Java. This is the Java version of cat , probably one of the first programs you ever use on a *NIX platform. import java.io.*; public class JavaCat { ...
Created by Dr. Xi on January 29, 2010 21:08:43    Last update: January 29, 2010 21:08:43
This class reads a text file line by line and echos the contents to standard out. import java.io.*; public class ReadTextFile...
Created by Dr. Xi on January 08, 2010 03:53:37    Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage: <taskdef name="mergeProperty" classname="ant.task.... Implementation: package ant.task.addon; import java.io.Buff...
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 James on October 11, 2009 21:15:53    Last update: October 11, 2009 21:19:39
Many techniques for making rounded corners do not work well when the element being rounded is displayed on a background with a different color (or multiple colors). Example 1: Nifty Cube with JavaScript <html> <head> <base href="http://www.html.i... Example 2: modx Simple Rounded Corner Box <html> <head> <title>Round Corner</title> ... Example 3: CSS3 (does not work in IE) <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ... Example 4: This is one that actually works ! The nifty corner technique can be tweaked to be background friendly, although the JavaScript version didn't work for some reason. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" ...
Created by Bambi on August 07, 2009 03:47:56    Last update: August 07, 2009 03:59:15
Code: package hello.world; // package declaration, must ... Compile/Run: C:\tmp>javac hello\world\HelloWorld.java C:\tmp... Since the class is not public (package access), the name of the Java file could be anything! If a package access class has a public static void main(String[]) method, it may still be run from the command line using the class name. C:\tmp>copy hello\world\HelloWorld.java hello\worl...
Created by Dr. Xi on March 16, 2009 22:10:29    Last update: March 16, 2009 22:12:35
Generate the keys $ ssh-keygen -t rsa Generating public/private r... Copy id_rsa.pub to the remote server. scp .ssh/id_rsa.pub jmann@sleepy:/home/jmann/.ssh/ Logon to the remote host, append id_rsa.pub to authorized_keys . Make sure authorized_keys is writable only by owner. $ cd ~/.ssh $ cat id_rsa.pub >>authorized_keys ... For putty, you need to convert the private key to putty format using puttygen : and tell it to use the private key:
Created by Dr. Xi on February 09, 2009 23:14:15    Last update: February 09, 2009 23:14:15
This example demonstrates the general steps in creating a custom Java class loader. Normally a class loader would consult its parent class loader when asked to load a class. If it's not loaded by the parent class loader, then the class loader would try to load the class on its own. This class loader tries to load the requested class on its own first, and delegates to the parent only when a java.lang.SecurityException is thrown (which happens when it tries to load core Java classes such as java.lang.String ). The classes are loaded from CLASSPATH through the getResourceAsStream call. It's important to note that when a class is loaded with a certain class loader, all classes referenced from that class are also loaded through the...
Created by Dr. Xi on January 29, 2009 17:11:34    Last update: January 29, 2009 17:11:34
import java.awt.Color; import java.awt.Font; ...
Created by Dr. Xi on October 18, 2008 03:16:24    Last update: October 18, 2008 03:17:21
Normally the browser opens a page if it knows how to. For example, text files are usually displayed in the browser window. You can set the Content-Type and Content-Disposition headers in the HTTP response to force the browser to popup the download dialog. Python example: def download_log(req, app = None, file = None): ... Java example: public void service(HttpServletRequest req, Ht...
Previous  2 3 4 5 6 7 8 9 10 11 Next