RSS feed [root] /weblog /java




login:

password:

title search:




 


Wed Jun 23 23:53:07 AEST 2021

java



(google search) (amazon search)
second
download zip of files only

Wed Aug 24 02:55:53 AEST 2011 From /weblog/java/libraries

Code Inspection


Comparison of difference static code analysis - http://weblogs.java.net[..]rar/archive/2006/11/talking_about_s.html

and http://www.javacodegeeks.com[..]-tools-source-code-optimization-and.html

(google search) (amazon search)


Tue Aug 16 01:40:53 AEST 2011 From /weblog/java/performance

usage


Offline parsing heap dump, good for analysis huge heap dump at server with GTK - http://www.eclipse.org[..]index.php?t=rview&goto=703990#msg_703990

Nice explanation of GC - http://redstack.wordpress.com[..]sualising-garbage-collection-in-the-jvm/

Get call back for memory allocation, should be very useful - http://blogs.lessthandot.com[..]s/applying-kanban-to-it-processes-part-2

Detailed discussion of analysis memory consumption in Java - http://kohlerm.blogspot.com[..]mory-consumption-of-netbeans-versus.html

it probably one of the nicest feature of java 5 - dump VM for you to analyst http://blogs.sun.com[..]apdumponoutofmemoryerror_option_in_5_0u7

This article present a simple, and possible not accurate method to track object creation and finalization. May be not that useful in general but sometime is convenience - http://www.devx.com/tips/Tip/30833?trk=DXRSS_JAVA

checking memory consumption at object level - http://www.jroller.org[..]im?entry=again_about_determining_size_of

Sun contain a nice library for we to investigate heap stat - http://elliotth.blogspot.com[..]om/2005/01/java-equivalent-of-heap1.html

Use java.util.Observable to Monitor Object State changes - http://www.devx.com/tips/Tip/22592?trk=DXRSS_JAVA

(google search) (amazon search)


Mon Jun 27 02:27:08 AEST 2011 From /weblog/java/concurrency

hint


A nice list of hints about concurrency in java - http://www.weiqigao.com[..]c_burke_java_concurrency_by_example.html

Testing about java parallel processing - http://embarcaderos.net[..]ng-and-multi-core-utilization-with-java/

Some concurrency basic information - http://blog.andrewhubbs.com/?p=107

Tutorial of concurrency package - http://tutorials.jenkov.com/java-util-concurrent/index.html

Using Latch with Executor - http://binkley.blogspot.com[..]06/new-shimmer-for-java-concurrency.html

(google search) (amazon search)


Sun May 15 04:01:11 AEST 2011 From /weblog/java/fundamental

classloader


Add custom classloaders to compilation classpath: "javac -J-Djava.system.class.loader=my.custom.ClassLoaderImpl theSource.java"

http://forums.java.net[..]read.jspa?messageID=87728&tstart=0#87728

Possible NULL from static fields... which is documented behaviours - http://qaix.com[..]2-puzzling-class-field-hellip-read.shtml

Comparing Class.getResourceAsStream() and bundle.getEntry(), point out some issues of using Class.getResourceAsStream() - http://www.eclipsezone.com/eclipse/forums/t101557.rhtml

Basic of classloader - http://www.journaldev.com[..]rstanding-and-extending-java-classloader http://java.sun.com[..]chnicalArticles/Networking/classloaders/

(google search) (amazon search)


Thu May 05 10:35:19 AEST 2011 From /weblog/java/features

java7


A summary - http://tech.puredanger.com/java7 http://www.developer.com[..]d-to-Make-Developers-More-Productive.htm

concurrency improvement - http://www.infoq.com/news/2007/07/concurrency-java-se-7

Finally it is confirmed - http://www.petefreitag.com/item/778.cfm

You can do this in Java7, look pretty nice
try{
try-code
}
catch (SQLException | IOException) {
catch-code
}

http://extreme-java.blogspot.com[..]7-multi-catch-blocks-for-exceptions.html

(google search) (amazon search)


Sun Apr 24 03:44:47 AEST 2011 From /weblog/java/fundamental

serialization


Here is a mailing list message that tell why we need to serialize logger, sometime there are more need to have for sometime, but we need to do it very careful: http://mail-archives.apache.org[..]06691254D6185151@sheex267.he.conet.de%3E

A link that discuss various aspect of binary or xml (i.e. plain text) serialization, worth to keep as reference
http://www-03.ibm.com[..]f?entry=java_serialization_binary_or_xml

Basic question about serialization - http://www.opensubscriber.com[..]ed-java@discuss.develop.com/1641413.html , a long article explaining that http://www.eaze.org/patrick/java/objectserialization.jsp

Why we have to put serialziation id in serializable class... - https://issues.apache.org/jira/browse/DBUTILS-36

Show cast of test if all object in session can be serialized - http://www.theserverside.com/news/thread.tss?thread_id=38398

Interview questions - http://javarevisited.blogspot.com[..]top-10-java-serialization-interview.html

(google search) (amazon search)


Sun Apr 10 11:54:33 AEST 2011 From /weblog/java/performance

dynamic compilation


Introduce the idea of using dynamic compilation to replace reflection using Janino - http://today.java.net/lpt/a/351 , but actually reflection isn't that slow - http://buzdin.blogspot.com[..]1/01/is-java-reflection-really-slow.html

How to use eclipse compiler as API - http://dev.eclipse.org[..]atch%20compile/batchCompile.html?rev=1.2

Support of annotation - http://jroller.com/page/eu?entry=compiler_for_jsr_308

Some cases that block method inlining - http://www.azulsystems.com[..]f/2011-04-04-fixing-the-inlining-problem

(google search) (amazon search)


Sat Mar 26 04:44:46 AEDT 2011 From /weblog/java/eclipse

hadoop


https://grid.sara.nl[..]Hadoop/MapReduce_Development_Environment

(google search) (amazon search)


Wed Feb 16 04:16:05 AEDT 2011 From /weblog/java/concurrency

AnonymousInnerClass


Here is an tricky concurrency concern in Java when using Anonymous Inner Class with ExecutorService, if you use collection from outside class, that collection actually a global variable in the Inner Class, and need to take care the issues happened in concurrency access.

For this class:

public static void main(String[] args) throws InterruptedException {
ExecutorService es = Executors.newFixedThreadPool(80);
final List list = new ArrayList();
for (int i = 0; i < 100000; i++)
es.execute(new Runnable() {
@Override
public void run() {
list.add(new String());
}
});
es.shutdown();
while (true) {
boolean terminated = es.awaitTermination(5, TimeUnit.SECONDS);
if (terminated) {
break;
}
}
for (String string : list) {
if (string == null)
System.out.println("Have null");
}
}

actually same as

private static final class RunnableImpl implements Runnable {
private final List mList;
private RunnableImpl(List list) {
mList = list;
}

@Override
public void run() {
mList.add(new String());
}
}
public static void main(String[] args) throws InterruptedException {
ExecutorService es = Executors.newFixedThreadPool(80);
final List list = new ArrayList();
for (int i = 0; i < 100000; i++)
es.execute(new RunnableImpl(list));
/** @formatter:on */
es.shutdown();
while (true) {
boolean terminated = es.awaitTermination(5, TimeUnit.SECONDS);
if (terminated) {
break;
}
}
for (String string : list) {
if (string == null)
System.out.println("Have null");
}
}


(google search) (amazon search)


Tue Feb 08 04:38:39 AEDT 2011 From /weblog/java

misc


Sample to write custom indexer for lucent: http://www.onjava.com/lpt/a/6428

Overview of Antlr, Martin Fowler think it is better than SableCC - http://martinfowler.com/bliki/HelloAntlr.html

JMS performance test - http://www.c2b2.co.uk[..]t/ipoint?SelectedPage=69&110ArticleID=17

Six JDK Classes You Think You Know

1) java.lang.Double.MIN_VALUE, it is not negative number
2) java.lang.Thread.setDefaultUncaughtExceptionHandler and java.lang.Runtime.addShutdownHook can have racing
3) java.util.Properties.load
4) java.lang.String.getBytes
5) Use update row, java.sql.ResultSet.updateRow

http://jnb.ociweb.com/jnb/jnbDec2010.html

(google search) (amazon search)


Fri Jan 28 01:41:09 AEDT 2011 From /weblog/java/discussion

factorial


A lot of difference implementation of factorial - http://chaosinmotion.com/blog/?p=622

(google search) (amazon search)


Wed Dec 15 03:30:18 AEDT 2010 From /weblog/java/concurrency

antipattern


Why we need volatile in MT access - http://blogs.sun.com[..]age/sundararajan?entry=is_this_mt_safe_i

Sync. and set array - http://www.nabble.com[..]attern%2C-way-to-common-td16061045.html: No such file or directory

Java Concurrency Gotchas - ttp://www.slideshare.net[..]xmiller/java-concurrency-gotchas-3666977

(google search) (amazon search)


Fri Jun 04 04:21:24 AEST 2010 From /weblog/java/concurrency

profiler


But look like very useful: http://jroller.com/page/davinci?entry=simple_thread_profiling

Profile the contention of lock - http://www.infoq.com/articles/jucprofiler

(google search) (amazon search)


Thu Dec 31 20:29:28 AEDT 2009 From /weblog/java/eclipse

shortcut


Ctrl + Shift + O : Organize imports

Ctrl + Shift + T : Open Type

Ctrl + Shift + F4 : Close all Opened Editors

Ctrl + O : Open declarations

Ctrl + E : Open Editor

Ctrl + / : Line Comment

Alt + Shift + R : Rename

Alt + Shift + L : extract to Local Variable

Alt + Shift + M : extract to Method

F3 : Open Declaration

CTRL-3: Quick Access

CHTL-H: Search & Replace

ALT-SHIFT-X: Run As ......

ALT-SHIFT-D: Debug As ......

ALT-SHIFT-Q: Open View ......

CTRL-TAB / SHIFT-CTRL-TAB: cycle open editors

Alt+Shift+Up - select whole string , if press multiple time, can select whole method. If select more than want, Alt+Shift+Down to reverse - http://eclipseone.wordpress.com[..]hods-in-eclipse-with-a-single-keystroke/



http://sureshkrishna.wordpress.com[..].com/2007/09/15/top-10-eclipse-shotcuts/

HoverToViewSource , but not working for me... - http://www.vasanth.in/2007/11/09/EclipseTipHoverToViewSource.aspx

(google search) (amazon search)


Thu Dec 03 18:41:18 AEDT 2009 From /weblog/java/features

instrument


Use java.lang.instrument.Instrumentation; for profiling - http://java.dzone.com/articles/java-profiling-under-covers

(google search) (amazon search)


Thu Dec 03 18:23:22 AEDT 2009 From /weblog/java/fundamental

enum


An article show how java treat enum internally - http://www.javaspecialists.eu/archive/Issue141.html

Look like it is "replace switch with polymorphism - http://javaforyou.wordpress.com[..]working-with-java-enumerated-types-enums

(google search) (amazon search)


Mon Jul 27 03:08:14 AEST 2009 From /weblog/java/hacks

exception


How to get line number of specific stacktrace
private static void log(String prefix,
String message) {

StackTraceElement ste =
new Exception().getStackTrace()[2];

System.out.println("[" + prefix + "] " +
ste.getClassName() + "." +
ste.getMethodName() + "(" +
ste.getLineNumber() + "): " +
message);
}

http://jroller.com[..]0602#abusing_java_for_debugging_purposes

Annotation of using stacktrace - http://www.theserverside.com[..]m/news/thread.tss?thread_id=55238#312195

(google search) (amazon search)


Fri Dec 26 04:15:04 AEDT 2008 From /weblog/java/servlet

security


A collections of tools - http://www.theserverside.com[..]onsSecure&asrc=EM_NLN_5417965&uid=703565


(google search) (amazon search)


Tue Sep 09 02:42:44 AEST 2008 From /weblog/java/concurrency

Functional


Series about using functional library to ease the development of concurrency application

http://apocalisp.wordpress.com[..]allel-strategies-and-the-callable-monad/
http://apocalisp.wordpress.com[..]008/06/30/parallel-list-transformations/
http://apocalisp.wordpress.com[..]7/28/threadless-concurrency-with-actors/
http://apocalisp.wordpress.com/2008/09/02/a-better-future/

(google search) (amazon search)


Tue Mar 18 04:25:28 AEDT 2008 From /weblog/java/hacks

kill


if you do a “kill -3? of the java process id, it dumps a stack trace of every thread, including what locks it’s holding, to stdout. - http://blog.xcski.com[..]ie-says-kill-3-pid-is-my-new-best-friend

At windows, it is ctrl-break

(google search) (amazon search)


Tue Mar 18 04:25:28 AEDT 2008 From /weblog/java/features

security


Using JCE with OpenSSL - http://kasparov.skife.org[..]ive/src/java/jce-openssl-redux.writeback

---------- Forwarded message ----------
From: "cab"
To:
Date: 10 Mar 2005 23:33:16 +0800
Subject: Re: CRC-32

java.util.zip.CRC32 crc32 = new java.util.zip.CRC32();
crc32.update(byteArray);
long crcValue = crc32.getValue();

"Day Chan" 撰寫於郵件新聞:4230a15b$3@newsgroup.com.hk...
> Does anyone know how to calculate CRC-32 in Java?
> Thanks~

(google search) (amazon search)


Mon Jan 07 18:05:06 AEDT 2008 From /weblog/java/swing

table


Comparing SWT tableviewer and Swing jtable - http://andymaleh.blogspot.com[..]1/jface-tableviewer-vs-swing-jtable.html

(google search) (amazon search)


Mon Jan 07 18:03:59 AEDT 2008 From /weblog/java/fundamental

clone


Some problems of cloning, include using copy constructor / clone() method - http://www.agiledeveloper.com/articles/cloning072002.htm

(google search) (amazon search)



Thu Dec 20 14:34:00 AEDT 2007 From /weblog/java/eclipse

rcp


Tutorial - http://www.ibm.com[..]ce/library/os-eclipse-snippet/index.html , shorter one - http://nricheton.homeip.net/?p=149

Lotus higher level framework base on RCP - http://www.ibm.com/developerworks/lotus/library/expeditor-intro/

Using M$ Office via OLE - http://www.vogella.de[..]EclipseMicrosoftIntegration/article.html

Default open views dialogs - _showViewMenu = ContributionItemFactory.VIEWS_SHORTLIST.create(window);

Glimmer, DSL for building SWT interface for jruby - http://andymaleh.blogspot.com/2007/11/sneak-peak-at-glimmer.html

(google search) (amazon search)