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 Jul 23 11:57:03 AEST 2014 From /weblog/java/string

comparison


Better sorting should do 2 things:
1) case insensitive
2) aware of numbers in the file names. So File2 comes after File1 (obviously) but before File10

http://jroller.com[..]ingcomparator_sorting_strings_for_people

source: http://jroller.com/resources/t/tfenne/HumaneStringComparator.java

Switch comparison - http://java-performance.info/string-switch-performance/

(google search) (amazon search)


Wed Jul 16 00:16:21 AEST 2014 From /weblog/java/annotation

A discussion of various use case of annotation


Some good, some bad and some ugly - http://jroller.com[..]tPark?entry=annotations_the_good_the_bad

http://www.yegor256.com[..]/01/aop-aspectj-java-method-logging.html

(google search) (amazon search)


Wed Jun 25 16:26:02 AEST 2014 From /weblog/java/libraries

aspect


Allow a Java method to work for a maximum of five seconds and want an exception to be thrown if the timeframe is exceeded. Here is how you can do it with jcabi-aspects and AspectJ - http://www.yegor256.com[..]4/06/20/limit-method-execution-time.html

(google search) (amazon search)


Mon Jun 16 19:21:07 AEST 2014 From /weblog/java/network

mail


Some advance usage of javamail and apache james smtp server... but I guess not much ppl will use this server, right? - http://cephas.net[..]ment_variable_envelope_return_paths.html

Code sample of using auth required SMTP server - http://timarcher.com/?q=node/53

Properties to prevent infinite timeout for all socket operations, in Java mail - http://andreas.haufler.info[..]vamail-can-be-evil-and-force-you-to.html

(google search) (amazon search)


Tue Apr 22 15:08:26 AEST 2014 From /weblog/java/fundamental

type


Nice instanceof replacement - http://nurkiewicz.blogspot.com.au[..]anceof-operator-and-visitor-pattern.html https://github.com/nurkiewicz/typeof

http://interviewquestionjava.blogspot.hk[..]01/java-data-types-conversion-chart.html

How to use reflection to get the size of Primitive - http://marxsoftware.blogspot.com.au[..]rogrammatic-access-java-types-sizes.html

(google search) (amazon search)


Wed Apr 02 15:01:15 AEDT 2014 From /weblog/java/tools

memory


How to use Eclipse Memory Analyzer - http://eclipsesource.com[..]s-for-using-the-eclipse-memory-analyzer/

Tool to check java memory layout, how the object placed in JVM - http://openjdk.java.net/projects/code-tools/jol/

(google search) (amazon search)


Wed Mar 26 14:10:08 AEDT 2014 From /weblog/java/concurrency

Reference


How weak and soft reference work http://www.javaspecialists.co.za/archive/Issue098.html http://javarevisited.blogspot.com.au[..]rence-phantom-strong-reference-java.html

Issue about weakhashmap - http://blogs.azulsystems.com/cliff/2007/08/why-weakhashmap.html

When soft reference clean? - http://jeremymanson.blogspot.com[..]/07/how-hotspot-decides-to-clear_07.html

(google search) (amazon search)


Mon Mar 17 13:27:52 AEDT 2014 From /weblog/java/features

agent


http://www.takipioncode.com[..]1/07/double-agent-java-vs-native-agents/

List the pros of using native agent - http://apmblog.compuware.com[..]-for-application-performance-management/

(google search) (amazon search)


Mon Jan 06 19:30:32 AEDT 2014 From /weblog/java/features

generics


As Java still need to support Collection.get(Object) , it is easy to get NPE if you use wrong type accidentally
http://jroller.com/page/sstirling?entry=map_get_object_and_java
I met this problem when using wicket, one cool feature of ListMultipleChoice is that if the list I press into the constructor is not List, it will persist the type information.
However, if you use this API carelessly and think the List return from the HTML form is always List . Then you will get strangle null pointer exception when you operate with the list instead of ClassCastException, as java will surpress the ClassCastException from ArrayList.get(i) sliencely and just return null to caller.

A related one but not really related to generics - http://www.pankaj-k.net/archives/2006/11/how_hard_is_tes.html , look like the behaviours difference of primittive and wrapper class at NULL is very easy to get hard to check bug

Another one, JDK generic try to cast to wrong class internally: http://jroller.com/page/dhall?entry=exploring_the_limits_of_java

Some cool feature, apply generic in comparable - http://tech.puredanger.com/2006/11/22/comparator-jdk5/

Wildcast in generic -http://javarevisited.blogspot.com[..]-is-bounded-and-unbounded-wildcards.html

http://javarevisited.blogspot.com.au[..]trized-class-method-Generic-example.html

http://mydailyjava.blogspot.com.au[..]6/advanced-java-generics-retreiving.html

(google search) (amazon search)


Mon Dec 23 21:09:08 AEDT 2013 From /weblog/java/concurrency

pool


Demo how java 1.5 built-in thread pool work: http://blogs.sun.com[..]ry=swingworker_throttling_and_monitoring

Sample of thread pool - http://www.javaworld.com/javaworld/jw-01-2005/jw-0124-pool_p.html

Discussion about how to estimate threadpool size - http://www.infoq.com/articles/Java-Thread-Pool-Performance-Tuning

(google search) (amazon search)


Wed Dec 18 18:53:04 AEDT 2013 From /weblog/java/hacks

cglib


http://www.jroller.com[..]/20050506#java_dynamic_proxies_and_cglib

http://mydailyjava.blogspot.com.au[..]com.au/2013/11/cglib-missing-manual.html

(google search) (amazon search)


Tue Dec 10 14:58:22 AEDT 2013 From /weblog/java/features

i18n


Java: Moving conditions into Message files - http://www.mscharhag.com[..]the-java-classes-resourcebundle-and.html

(google search) (amazon search)


Thu Dec 05 16:16:04 AEDT 2013 From /weblog/java/hacks

preprocessor


Funny, using gcc preprocessor with java - https://gist.github.com/anonymous/7797380

(google search) (amazon search)


Wed Dec 04 22:27:37 AEDT 2013 From /weblog/java/network

Jetty


Guide of how to start and config jetty dynamic at code - http://www.onjava.com/lpt/a/6623 , even change the config after the server started.

Websocket coding sample - http://aredko.blogspot.hk[..]java-websockets-jsr-356-on-jetty-91.html

(google search) (amazon search)


Mon Dec 02 14:47:12 AEDT 2013 From /weblog/java/string

unicode


A common issue of Windows environment and the workaround - http://jroller.com/page/ff?entry=java_utf_8_bug_grief

Strange String issues in JVM languages, don't trust all string operations all the time! https://sites.google.com[..]/posts/strangestringissuesinjvmlanguages http://mortoray.com/2013/11/27/the-string-type-is-broken/

(google search) (amazon search)


Thu Nov 28 12:25:38 AEDT 2013 From /weblog/java/network

protocol


Sockets Direct Protocol – Write Once, Run Everywhere …. and Run (Some Places) Blazingly - http://www.infoq.com/articles/Java-7-Sockets-Direct-Protocol

(google search) (amazon search)


Fri Nov 22 20:04:49 AEDT 2013 From /weblog/java/string

alignment


Discussion of how to do string alignment - http://manycupsofcoffee.blogspot.com.au[..]va-implementation-of-optimal-string.html

(google search) (amazon search)


Tue Nov 12 15:04:47 AEDT 2013 From /weblog/java/libraries

graphics


https://www.openshift.com[..]pencv-face-detection-for-java-developers

(google search) (amazon search)


Sun Nov 10 21:51:44 AEDT 2013 From /weblog/java/eclipse

plugins


Good decompiler - http://mchr3k.github.com/jdeclipse-realign/

fatjar - http://kurucz-grafika.de/fatjar

Builder generator - https://code.google.com/a/eclipselabs.org/p/bob-the-builder/

And my old stuff - https://carfield.tadalist.com/lists/18316

(google search) (amazon search)


Thu Nov 07 19:02:21 AEDT 2013 From /weblog/java/concurrency

threadlocal


There is a little bit performance cost for threadlocal variable - http://software.intel.com[..]ost-of-accessing-thread-local-variables/

Look like a useful but less known API - http://crazybob.org/2006/07/hard-core-java-threadlocal.html

Forward up discussion - http://www.theserverside.com[..]d_id=41473&asrc=EM_NNL_406677&uid=703565 pointing out some problems of using this technique, include similar effect of GLOBLE , possible memory leak

Another discussion in higher level - http://blog.objectmentor.com[..]04/thread-local-a-convenient-abomination , Key is "An object is an abstraction of function. A thread is an abstraction of schedule" , you can read further conclusion at http://www.infoq.com/news/2007/09/confusing_uow_with_threads

Protential issue of using threadlocal, one is memory leak and the other is it is that local - http://blog.maxant.co.uk/pebble/2008/09/23/1222200780000.html http://www.javacodegeeks.com[..]hreading-stories-threadlocal-in-web.html
http://plumbr.eu[..]shoot-yourself-in-foot-with-threadlocals

The beauty of the design of threadlocal, how it prevent locking and memory leaking - http://plumbr.eu/blog/how-is-threadlocal-implemented

(google search) (amazon search)


Wed Oct 23 03:11:36 AEDT 2013 From /weblog/java/fundamental

instanceof


Nice instanceof replacement - http://nurkiewicz.blogspot.com.au[..]anceof-operator-and-visitor-pattern.html https://github.com/nurkiewicz/typeof

(google search) (amazon search)


Wed Oct 23 02:20:06 AEDT 2013 From /weblog/java/libraries

config


http://binkley.blogspot.com.au[..]/10/better-java-properties-handling.html http://owner.aeonbits.org/

(google search) (amazon search)


Wed Oct 23 01:46:35 AEDT 2013 From /weblog/java/features

autoboxing


Type can be changed - http://blog.jooq.org/2013/10/08/java-auto-unboxing-gotcha-beware/

(google search) (amazon search)


Tue Oct 22 20:25:00 AEDT 2013 From /weblog/java/concurrency

Double-Checked Locking


Very detailed explanation: http://www.cs.umd.edu[..]va/memoryModel/DoubleCheckedLocking.html

Some more information, also demo in fact not much difference for most cast: http://blogs.sun.com[..]page/cwebster?entry=double_check_locking

Even more discussion - http://www-128.ibm.com/developerworks/java/library/j-dcl.html

In Chinese - http://www.infoq.com[..]hecked-locking-with-delay-initialization

(google search) (amazon search)


Mon Sep 23 20:11:40 AEST 2013 From /weblog/java/concurrency

testing


Series of blog showing how to use JMock API to help testing MT code - http://www.google.com[..]shhtresohqc&ie=UTF-8&q=JMock+and+Threads

A test for deadlock - http://cr.openjdk.java.net[..]notationTypeDeadlockTest.java.sdiff.html http://cr.openjdk.java.net[..]t/java/util/logging/Bug8010939.java.html

Some technique, use of SynchronousExecutorService and Events - http://alexecollins.com[..]ntent/5-tips-unit-testing-threaded-code/

(google search) (amazon search)