Wednesday, June 14, 2006
Wednesday, May 31, 2006
Source of Icons to help spruce up your custom entities
I like the silk ones from this series: http://www.famfamfam.com/lab/icons/
These are interesting. http://ndesign-studio.com/resources/pixel_icons.htm
Some interesting samples: http://www.icongalore.com/sales/purchase-and-download.php
Great Variety of them are also available here: http://www.iconarchive.com/
These are interesting. http://ndesign-studio.com/resources/pixel_icons.htm
Some interesting samples: http://www.icongalore.com/sales/purchase-and-download.php
Great Variety of them are also available here: http://www.iconarchive.com/
Monday, May 08, 2006
Google's services
Google Ad Sense https://www.google.com/adsense/
Google AdWords https://adwords.google.com/select
Google分析 http://google.com/analytics/
Google问答 http://answers.google.com/
GoogleBase http://base.google.com/
Google博客搜索 http://blogsearch.google.com/
Google书签 http://www.google.com/bookmarks/
Google图书搜索 http://books.google.com/
Google日历 http://google.com/calendar/
Google目录 http://catalogs.google.com/
Google代码 http://code.google.com/
Google桌面工具条 http://deskbar.google.com/
Google桌面 http://desktop.google.com/
Google网页目录 http://www.google.com/dirhp
Google地球 http://earth.google.com/
Google股票 http://finance.google.com/
Google网上论坛 http://groups.google.com/
Google图片搜索 http://images.google.com/
Google实验室 http://labs.google.com/
Google本地搜索 http://local.google.com/
Google地图 http://maps.google.com/
Google火星 http://www.google.com/mars/
Google移动 http://mobile.google.com/
Google月球 http://moon.google.com/
Google电影 http://www.google.com/movies
Google音乐 http://www.google.com/musicsearch
Google新闻 http://news.google.com/
Google软件包 http://pack.google.com/
Google网页创作 http://pages.google.com/
Google个性化主页 http://www.google.com/ig
Google个性化搜索 http://labs.google.com/personalized
Google阅读器 http://www.google.com/reader
Google学术搜索 http://scholar.google.com/
Google搜索历史 http://www.google.com/searchhistory
Google短信服务 http://www.google.com/sms/
Google提示 http://www.google.com/webhp?complete=1
GoogleTalk http://talk.google.com/
Google工具条 http://toolbar.google.com/
Google旅行计划者 http://www.google.com/transit
Google翻译工具 http://www.google.com/translate_t
Google视频 http://video.google.com
Google网页加速器 http://webaccelerator.google.com
Google Web API http://www.google.com/apis
Google网页搜索 http://www.google.com
Google AdWords https://adwords.google.com/select
Google分析 http://google.com/analytics/
Google问答 http://answers.google.com/
GoogleBase http://base.google.com/
Google博客搜索 http://blogsearch.google.com/
Google书签 http://www.google.com/bookmarks/
Google图书搜索 http://books.google.com/
Google日历 http://google.com/calendar/
Google目录 http://catalogs.google.com/
Google代码 http://code.google.com/
Google桌面工具条 http://deskbar.google.com/
Google桌面 http://desktop.google.com/
Google网页目录 http://www.google.com/dirhp
Google地球 http://earth.google.com/
Google股票 http://finance.google.com/
Google网上论坛 http://groups.google.com/
Google图片搜索 http://images.google.com/
Google实验室 http://labs.google.com/
Google本地搜索 http://local.google.com/
Google地图 http://maps.google.com/
Google火星 http://www.google.com/mars/
Google移动 http://mobile.google.com/
Google月球 http://moon.google.com/
Google电影 http://www.google.com/movies
Google音乐 http://www.google.com/musicsearch
Google新闻 http://news.google.com/
Google软件包 http://pack.google.com/
Google网页创作 http://pages.google.com/
Google个性化主页 http://www.google.com/ig
Google个性化搜索 http://labs.google.com/personalized
Google阅读器 http://www.google.com/reader
Google学术搜索 http://scholar.google.com/
Google搜索历史 http://www.google.com/searchhistory
Google短信服务 http://www.google.com/sms/
Google提示 http://www.google.com/webhp?complete=1
GoogleTalk http://talk.google.com/
Google工具条 http://toolbar.google.com/
Google旅行计划者 http://www.google.com/transit
Google翻译工具 http://www.google.com/translate_t
Google视频 http://video.google.com
Google网页加速器 http://webaccelerator.google.com
Google Web API http://www.google.com/apis
Google网页搜索 http://www.google.com
Saturday, April 01, 2006
Hong Kong Java User Group
Homepage: https://hkjug.dev.java.net/ News group: news://news.3home.net/3comp.programming.java
Friday, February 24, 2006
Masking Console System.in in 1.5 or b4
/* '\010' <== is the delete ASCII */
import java.io.*;
class EraserThread implements Runnable {
private boolean stop;
/**
*@param The prompt displayed to the user
*/
public EraserThread(String prompt) {
System.out.print(prompt);
}
/**
* Begin masking...display asterisks (*)
*/
public void run () {
stop = true;
while (stop) {
System.out.print("\010*");
try {
Thread.currentThread().sleep(1);
} catch(InterruptedException ie) {
ie.printStackTrace();
}
}
}
/**
* Instruct the thread to stop masking
*/
public void stopMasking() {
this.stop = false;
}
}
Wednesday, February 08, 2006
Sunday, February 05, 2006
Using Native Application to open file
This may be of interest to you. I have been looking around the web and found on a post that it is possible to open the real Acrobat viewer from Java, although it is O/S specific.
- For windows :
-
Runtime.getRuntime().exec(new String[]{ "rundll32", "url.dll,FileProtocolHandler", "filename.pdf" });
- For a mac:
-
Runtime.getRuntime().exec(new String[]{"open", "filename.pdf" });
Wednesday, February 01, 2006
JDK 1.4 Logging
The JDK defines 5 handlers:
* StreamHandler : sends messages to an OutputStream
* ConsoleHandler: sends messages to System.err
* FileHandler: sends messages to a file
* SocketHandler: sends messages to a TCP port
* MemoryHandler: buffers messages in memory
Sun has defined two formatters:
* SimpleFormatter: defines a simple message format containing among other things a timestamp
* XMLFormatter: a message in XML format
A logger with a ConsoleHandler with low priority level:
Logger logger1 = Logger.getLogger("abc.def");
logger1.setLevel(Level.FINEST);
ConsoleHandler c1 = new ConsoleHandler();
c1.setLevel(Level.FINEST);
logger1.addHandler(c1);
A logger with a FileHandler using a home made formatter:
Logger logger2 = Logger.getLogger("abc.def.ghi");
logger2.setLevel(Level.CONFIG);
FileHandler f2 = new FileHandler("%h/mylog.txt", 10000, 2, false);
f2.setFormatter(new MyFormatter());
f2.setLevel(Level.CONFIG);
logger2.addHandler(f2);
Formatters
Every handler must have a formatter defined, and the API has pre-defined a SimpleFormatter and an XMLFormatter which both extend the abstract class Formatter. You may define your own formatter if you like, and it's actually quite simple. You only have to implement the format method. This method receives an instance of the LogRecord class which contains several properties. format returns a string with the data that should be logged. In the next example I've made a formatter that returns the most important properties from the LogRecord:
import java.util.*;
import java.util.logging.*;
public class MyFormatter extends Formatter {
public String format(LogRecord record) {
return
"LogRecord info:\n" +
"Level: " + record.getLevel() + '\n' +
"LoggerName: " + record.getLoggerName() + '\n' +
"Message: " + record.getMessage() + '\n' +
" " + record.getMillis() + '\n' +
"Sequence Number: " + record.getSequenceNumber() + '\n' +
"SourceClassName: " + record.getSourceClassName() + '\n' +
"SourceMethodName: " + record.getSourceMethodName() + '\n' +
"ThreadID: " + record.getThreadID() + '\n';
}
}
* StreamHandler : sends messages to an OutputStream
* ConsoleHandler: sends messages to System.err
* FileHandler: sends messages to a file
* SocketHandler: sends messages to a TCP port
* MemoryHandler: buffers messages in memory
Sun has defined two formatters:
* SimpleFormatter: defines a simple message format containing among other things a timestamp
* XMLFormatter: a message in XML format
A logger with a ConsoleHandler with low priority level:
Logger logger1 = Logger.getLogger("abc.def");
logger1.setLevel(Level.FINEST);
ConsoleHandler c1 = new ConsoleHandler();
c1.setLevel(Level.FINEST);
logger1.addHandler(c1);
A logger with a FileHandler using a home made formatter:
Logger logger2 = Logger.getLogger("abc.def.ghi");
logger2.setLevel(Level.CONFIG);
FileHandler f2 = new FileHandler("%h/mylog.txt", 10000, 2, false);
f2.setFormatter(new MyFormatter());
f2.setLevel(Level.CONFIG);
logger2.addHandler(f2);
Formatters
Every handler must have a formatter defined, and the API has pre-defined a SimpleFormatter and an XMLFormatter which both extend the abstract class Formatter. You may define your own formatter if you like, and it's actually quite simple. You only have to implement the format method. This method receives an instance of the LogRecord class which contains several properties. format returns a string with the data that should be logged. In the next example I've made a formatter that returns the most important properties from the LogRecord:
import java.util.*;
import java.util.logging.*;
public class MyFormatter extends Formatter {
public String format(LogRecord record) {
return
"LogRecord info:\n" +
"Level: " + record.getLevel() + '\n' +
"LoggerName: " + record.getLoggerName() + '\n' +
"Message: " + record.getMessage() + '\n' +
" " + record.getMillis() + '\n' +
"Sequence Number: " + record.getSequenceNumber() + '\n' +
"SourceClassName: " + record.getSourceClassName() + '\n' +
"SourceMethodName: " + record.getSourceMethodName() + '\n' +
"ThreadID: " + record.getThreadID() + '\n';
}
}
Tuesday, January 31, 2006
Get Java Software Logo
For some reason, ur client might have no or old version of Java Virtual Machine installed.
To ensure they have correct JVM installed. Sun now introduced the "Get Java Logo"
After u signed up the http://logos.sun.com/spreadtheword. You will be able to enbed this logo on ur applet pages.
My registion provided me the follow code snippest:
Small Button
88 x 31
<a href="http://java.com/java/download/index.jsp?cid=jdp74840" target="_blank">
<img width="88" height="31" border="0"
style="margin: 8px;" alt="GetJava Download Button" title="GetJava"
src="http://java.com/en/img/everywhere/getjava_sm.gif?cid=jdp74840">
</a>
To ensure they have correct JVM installed. Sun now introduced the "Get Java Logo"
My registion provided me the follow code snippest:
Small Button
88 x 31
<a href="http://java.com/java/download/index.jsp?cid=jdp74840" target="_blank">
<img width="88" height="31" border="0"
style="margin: 8px;" alt="GetJava Download Button" title="GetJava"
src="http://java.com/en/img/everywhere/getjava_sm.gif?cid=jdp74840">
</a>
Medium Button

100 x 43
Large Button

170 x 100
100 x 43
<a href="http://java.com/java/download/index.jsp?cid=jdp74840" target="_blank">
<img width="100" height="43" border="0" style="margin: 8px;" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_med.gif?cid=jdp74840">
</a>
<img width="100" height="43" border="0" style="margin: 8px;" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_med.gif?cid=jdp74840">
</a>
Large Button
170 x 100
<a href="http://java.com/java/download/index.jsp?cid=jdp74840" target="_blank" >
<img width="170" height="100" border="0" style="margin: 8px;" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_lg.gif?cid=jdp74840">
</a>
<img width="170" height="100" border="0" style="margin: 8px;" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_lg.gif?cid=jdp74840">
</a>
For Your Users Who Don't Have Java Runtime Environment Yet
Content owners can dramatically improve their users' experience by embedding the GetJava button within their applet. Doing so means that, if users do not have the Java Runtime Environment (JRE) installed, they will see the GetJava button, rather than a grey box. Here's the sample applet code with the HTML snippet placed within the <applet> tags.
<applet code=applet.class width=425 height=400>
You have visited a page that contains an applet written with Java
technology. Please install the Java Runtime Environment before
refreshing this page. <br>
<a href="http://java.com/java/download/index.jsp?cid=jdp74840"><img width="88" height="31" border="0" style="margin: 8px;" alt="GetJava Download Button"
title="GetJava" src="http://java.com/en/img/everywhere/getjava_sm.gif?cid=jdp74840"></a>
<br>
</applet>
Content owners can dramatically improve their users' experience by embedding the GetJava button within their applet. Doing so means that, if users do not have the Java Runtime Environment (JRE) installed, they will see the GetJava button, rather than a grey box. Here's the sample applet code with the HTML snippet placed within the <applet> tags.
<applet code=applet.class width=425 height=400>
You have visited a page that contains an applet written with Java
technology. Please install the Java Runtime Environment before
refreshing this page. <br>
<a href="http://java.com/java/download/index.jsp?cid=jdp74840"><img width="88" height="31" border="0" style="margin: 8px;" alt="GetJava Download Button"
title="GetJava" src="http://java.com/en/img/everywhere/getjava_sm.gif?cid=jdp74840"></a>
<br>
</applet>
Tuesday, January 24, 2006
Mustang's HTTP Server
Alan Bateman has kindly provided me with a link to the HTTP server API documentation. This will soon be hooked up in the Mustang docs.
Several times, I've seen Mustang's inclusion of an HTTP server mentioned. A technical article points to bug 6270015, which asks for support of a lightweight HTTP server API. This bug is marked "closed, fixed". Yet, you won't find anything in the Mustang JavaDoc on it. What's the deal? Well, if we read carefully, Mustang will include an HTTP server API, not JSE 6. If we follow David Herrons recommendation, we should therefore forget about this quickly.
However, that API looks like it had some thinking put into it, is documented and itself distinguishes thoroughly between com.sun.* (sort-of presentable?) and sun.* (don't go there?) packages. Here's how you run a simple server:
HttpServer httpServer = HttpServer.create(new InetSocketAddress(8000), 5);
httpServer.createContext("/", new HttpHandler() {
public void handle(final HttpExchange exchange) throws IOException {
Headers requestHeaders = exchange.getRequestHeaders();
exchange.getResponseHeaders().set("Content-Type", "text/plain;charset=utf-8");
exchange.sendResponseHeaders(200, 0);
OutputStream responseBody = exchange.getResponseBody();
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(responseBody, "UTF-8"));
for (Map.Entry> entry : requestHeaders.entrySet())
printWriter.println(entry.getKey() + ": " + entry.getValue());
printWriter.close();
}
});
// the server will be single-threaded unless you uncomment this line
// httpServer.setExecutor(Executors.newCachedThreadPool());
httpServer.start();
Simple enough. If this thing sur
Several times, I've seen Mustang's inclusion of an HTTP server mentioned. A technical article points to bug 6270015, which asks for support of a lightweight HTTP server API. This bug is marked "closed, fixed". Yet, you won't find anything in the Mustang JavaDoc on it. What's the deal? Well, if we read carefully, Mustang will include an HTTP server API, not JSE 6. If we follow David Herrons recommendation, we should therefore forget about this quickly.
However, that API looks like it had some thinking put into it, is documented and itself distinguishes thoroughly between com.sun.* (sort-of presentable?) and sun.* (don't go there?) packages. Here's how you run a simple server:
HttpServer httpServer = HttpServer.create(new InetSocketAddress(8000), 5);
httpServer.createContext("/", new HttpHandler() {
public void handle(final HttpExchange exchange) throws IOException {
Headers requestHeaders = exchange.getRequestHeaders();
exchange.getResponseHeaders().set("Content-Type", "text/plain;charset=utf-8");
exchange.sendResponseHeaders(200, 0);
OutputStream responseBody = exchange.getResponseBody();
PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(responseBody, "UTF-8"));
for (Map.Entry
printWriter.println(entry.getKey() + ": " + entry.getValue());
printWriter.close();
}
});
// the server will be single-threaded unless you uncomment this line
// httpServer.setExecutor(Executors.newCachedThreadPool());
httpServer.start();
Simple enough. If this thing sur
Friday, January 20, 2006
VMware ser-ial num-ber
详细内容:
4.x
For Windows 6CHHE-F0N4G-88N6Q-4HHLM URWKX-TAXAK-H2N63-4HJJ5 1H8FX-C494F-K04D3-4H5T1 48TM5-M014X-N81F7-4HNTJ 6TH4H-K20DZ-R0HFP-4K4J
For Linux DJX29-QWA2Y-C2062-4K4V5 JUEK5-46K6E-C8N6Q-4HNV0 UU9WM-9YCD7-GA1D2-4HHT0 818Y1-GU8FX-W05D
5.0:
CC06T-E8ZAD-A2H4Z-4PXQ2
4.x
For Windows 6CHHE-F0N4G-88N6Q-4HHLM URWKX-TAXAK-H2N63-4HJJ5 1H8FX-C494F-K04D3-4H5T1 48TM5-M014X-N81F7-4HNTJ 6TH4H-K20DZ-R0HFP-4K4J
For Linux DJX29-QWA2Y-C2062-4K4V5 JUEK5-46K6E-C8N6Q-4HNV0 UU9WM-9YCD7-GA1D2-4HHT0 818Y1-GU8FX-W05D
5.0:
CC06T-E8ZAD-A2H4Z-4PXQ2
Thursday, January 19, 2006
My Applet Shows
Today, I also created a site to store the exercises I prepared for Ka-ho(very professional thru?)
All the source codes and demos can be download on the site ^__^, and the password for the source codes is the first letter of the filename ~_~;;;
http://urwelcome.servehttp.com/
or
http://www.myjavaserver.com/~torotime/
All the source codes and demos can be download on the site ^__^, and the password for the source codes is the first letter of the filename ~_~;;;
http://urwelcome.servehttp.com/
or
http://www.myjavaserver.com/~torotime/
Subscribe to:
Posts (Atom)