RSS feed [root] /weblog /java




login:

password:

title search:




 


Thu Apr 06 06:33:22 GMT 2023

java



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

Mon Jun 10 12:13:52 GMT 2019 From /weblog/java/string

substring


Substring no longer just change offset - http://www.javaadvent.com[..]hanges-to-stringsubstring-in-java-7.html

https://cl4es.github.io/2019/05/14/String-Concat-Redux.html

(google search) (amazon search)


Wed Apr 10 09:06:39 GMT 2019 From /weblog/java/performance

io


Improvement from io -> nio, then -> MappedByteBuffer - http://dobbscodetalk.com[..]blog&show=File-IO-in-Java.html&Itemid=29

How to improve performance by tuning the IO - http://pzemtsov.github.io[..]enefits-of-stream-buffering-in-Java.html

(google search) (amazon search)


Sat Mar 09 15:33:41 GMT 2019 From /weblog/java/concurrency

framework


https://dzone.com[..]ye-view-on-java-concurrency-frameworks-1

(google search) (amazon search)


Sat Mar 09 15:32:04 GMT 2019 From /weblog/java/performance

static


https://pangin.pro/posts/computation-in-static-initializer

(google search) (amazon search)


Fri Jul 13 15:54:42 GMT 2018 From /weblog/java/fundamental

number


double aDouble = 12345678912345678912345.0;
BigDecimal dd = new BigDecimal(aDouble);
System.out.println(dd); // print: 12345678912345679593472

String aString = "12345678912345678912345.0";
BigDecimal bd = new BigDecimal(aString);
System.out.println(bd); // print: 12345678912345678912345.0

Java Hangs When Converting 2.2250738585072012e-308 - http://www.exploringbinary.com[..]when-converting-2-2250738585072012e-308/ http://bugs.openjdk.java.net/show_bug.cgi?id=100119

Compare performance between double and float - http://www.heatonresearch.com[..]-between-java%E2%80%99s-float-and-double

How to work correctly with double - http://vanillajava.blogspot.com.au[..]au/2014/07/compounding-double-error.html

Maybe handy api, Math.toIntExact(Long) - http://marxsoftware.blogspot.com[..]t-conversion-of-long-to-int-in-java.html
Check the border cases - http://vanillajava.blogspot.com.au[..]consistent-operation-widen-rules-in.html http://vanillajava.blogspot.com.au[..]ava-conversion-puzzler-not-suitable.html

(google search) (amazon search)


Mon Feb 26 15:45:40 GMT 2018 From /weblog/java/fundamental

process


Execute and manage an external process from within Java - http://developer4life.blogspot.com.au[..]cuting-command-line-executable-from.html

http://fahdshariff.blogspot.hk[..]/java-9-enhancements-to-process-api.html

(google search) (amazon search)


Fri Dec 29 09:51:28 GMT 2017 From /weblog/java/tools

messaging


Compare between pulsar and Kafka - http://furkankamaci.com[..]ar-distributed-pub-sub-messaging-system/

(google search) (amazon search)


Tue Oct 31 02:18:25 GMT 2017 From /weblog/java/fundamental

java.lang.ref


Overview of weak, soft and Phantom References
Second, PhantomReferences avoid a fundamental problem with finalization: finalize() methods can "resurrect" objects by creating new strong references to them. So what, you say? Well, the problem is that an object which overrides finalize() must now be determined to be garbage in at least two separate garbage collection cycles in order to be collected. When the first cycle determines that it is garbage, it becomes eligible for finalization. Because of the (slim, but unfortunately real) possibility that the object was "resurrected" during finalization, the garbage collector has to run again before the object can actually be removed. And because finalization might not have happened in a timely fashion, an arbitrary number of garbage collection cycles might have happened while the object was waiting for finalization. This can mean serious delays in actually cleaning up garbage objects, and is why you can get OutOfMemoryErrors even when most of the heap is garbage.

With PhantomReference, this situation is impossible -- when a PhantomReference is enqueued, there is absolutely no way to get a pointer to the now-dead object (which is good, because it isn't in memory any longer). Because PhantomReference cannot be used to resurrect an object, the object can be instantly cleaned up during the first garbage collection cycle in which it is found to be phantomly reachable. You can then dispose whatever resources you need to at your convenience.

Arguably, the finalize() method should never have been provided in the first place. PhantomReferences are definitely safer and more efficient to use, and eliminating finalize() would have made parts of the VM considerably simpler. But, they're also more work to implement, so I confess to still using finalize() most of the time. The good news is that at least you have a choice.

http://weblogs.java.net[..]las/archive/2006/05/understanding_w.html

The other valuable reference about object life cycle - http://java.sun.com[..]ormance/1st_edition/html/JPAppGC.fm.html

Incorrect use of reference can cause GC issue - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4405807

fews more related blog - http://www.egimaben.com[..]garbage-collector-and-reference-objects/ https://medium.com[..]in-java-and-why-they-matter-c04bfc9dc792

(google search) (amazon search)


Thu Sep 28 08:21:47 GMT 2017 From /weblog/java/concurrency

Contended


preventing false sharing with the @Contended annotation - https://dzone.com[..]false-sharing-is-and-how-jvm-prevents-it

(google search) (amazon search)


Thu Aug 31 02:38:43 GMT 2017 From /weblog/java/tools

jhsdb


The jhsdb tool is described on its Oracle JDK 9 Documentation Early Access page, "You use the jhsdb tool to attach to a Java process or to launch a postmortem debugger to analyze the content of a core-dump from a crashed Java Virtual Machine (JVM)." The tool comes with several "modes" and several of these modes correspond in name and function with individual command-line tools available in previous JDK distributions. The jhsdb tool not only provides a single tool that encompasses functionality of multiple other tools, but it also provides a single, consistent approach to applying these different functions. For example, the jhsdb command-line syntax for getting help for each of the "modes" is identical.

http://marxsoftware.blogspot.hk/2017/06/jhsdb-jdk9.html
https://docs.oracle.com[..]UID-0345CAEB-71CE-4D71-97FE-AA53A4AB028E

(google search) (amazon search)


Fri Jun 02 09:55:34 GMT 2017 From /weblog/java/libraries

parsing


Introducing LALR parser in java - http://martinfowler.com/bliki/HelloCup.html

https://tomassetti.me/parsing-in-java/

(google search) (amazon search)


Thu May 18 02:28:15 GMT 2017 From /weblog/java/features

jdbc


5 things you didn't know about ... Java Database Connectivity - https://www.ibm.com/developerworks/library/j-5things10/index.html

(google search) (amazon search)


Sat Mar 25 16:09:52 GMT 2017 From /weblog/java/string

regex


Introduction to a library which support faster regular expression processing: http://weblogs.java.net[..]ite/archive/2006/03/a_faster_java_r.html http://www.javaadvent.com[..]-expression-library-benchmarks-2015.html

Regex helper - https://github.com/VerbalExpressions/JavaVerbalExpressions

java-regular-expressions-cheat-sheet - https://zeroturnaround.com[..]abs/java-regular-expressions-cheat-sheet

(google search) (amazon search)


Fri Mar 10 09:49:16 GMT 2017 From /weblog/java/concurrency

Map


putall can cause ConcurrentModifcationException - http://cr.openjdk.java.net[..]ses/sun/management/Agent.java.sdiff.html

Note on writing CopyOnWrite wrapper - http://flyingspaniel.blogspot.com[..]ot.com/2010/12/copyonwrite-wrappers.html

Sometime this is a bit difficult for Chinese to be a good programmer, recently some colleague and me discuss about the behaviour of this class and look like we have difficult understanding

A: ConcurrentHashMap support for locking as this is thread-safe
B: ConcurrentHashMap is thread safe for read but not for write because there is no lock, we still need to have external lock to keep it thread safe. By the way, I get ConcurrentModificationException from this before.
C: ConcurrentHashMap don't support for locking but they still thread safe for all operations, which is how "This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details." mentioned.

Too good that we can actually take a look at the source code to see what going on nowadays rather than just guessing - http://www.google.com[..]HashMap&sourceid=opera&ie=utf-8&oe=utf-8 By the way, this constructor is useful for a lot of concurrency access but actually not many developer notice about this - http://java.sun.com[..]rrentHashMap.html#ConcurrentHashMap(int, float, int)

Lazy initialization of map values - http://artisans-serverintellect-com.si-eioswww6.com[..]ect-com.si-eioswww6.com/default.asp?W122

HashMap.get() can cause infinite loop - http://lightbody.net[..]5/07/hashmapget_can_cause_an_infini.html

Discussing the effect of initCapacity() of HashMap in Java - http://saloon.javaranch.com[..]ltimatebb.cgi?ubb=get_topic&f=1&t=021171

OpenJDK and HashMap …. Safely Teaching an Old Dog New (Off-Heap!) Tricks - http://www.infoq.com/articles/Open-JDK-and-HashMap-Off-Heap

We can run search in ConcurrenctHashMap - https://dzone.com/articles/concurrenthashmap-in-java8

(google search) (amazon search)


Wed Feb 15 09:35:52 GMT 2017 From /weblog/java/libraries

mapper


Discussion of difference Java base object to object mapper - http://halyph.blogspot.com.au[..]013/10/java-object-to-object-mapper.html

Some information about JOOQ - https://www.infoq.com/news/2017/02/data-geekery-releases-jooq-3-9

(google search) (amazon search)


Tue Jan 03 01:45:40 GMT 2017 From /weblog/java/concurrency

synchronisers


Similar to Barrier - http://tech.puredanger.com/2008/07/08/java7-phasers/

An example, show how to coordinate producer and consumer with Phaser - http://javaforu.blogspot.com[..]08/java-7s-jucphaser-short-tutorial.html

When to use CountDownLatch, Semaphore, CyclicBarrier, Exchanger and Phaser - https://codurance.com/2016/08/24/the-java-synchronisers/

(google search) (amazon search)


Sat Dec 03 01:41:11 GMT 2016 From /weblog/java/libraries

code generation


DSL of code generation - http://namanmehta.blogspot.com.au[..]e-codemodel-to-generate-java-source.html

jannocessor/ - http://maciejwalkowiak.pl[..]8/java-code-generation-with-jannocessor/

Living in the Matrix with Bytecode Manipulation - https://www.infoq.com[..]cles/Living-Matrix-Bytecode-Manipulation http://www.infoq.com[..]cles/Living-Matrix-Bytecode-Manipulation

(google search) (amazon search)


Tue Nov 29 03:43:01 GMT 2016 From /weblog/java/features

javadoc


We can link java source in javadoc page: http://blogs.sun.com[..]amere/Weblog/cool_javadoc_trick#comments

http://marxsoftware.blogspot.hk[..]/inheriting-javadoc-method-comments.html

(google search) (amazon search)


Mon Oct 10 16:24:40 GMT 2016 From /weblog/java/libraries

log


Good thing about LogBack - http://www.infoq.com/news/2007/08/logback

http://blog.takipi.com[..]your-java-logging-with-7-logback-tweaks/

Configuring how exception stack traces appear in log entries using Log4J2 - https://medium.com[..]ies-using-log4j2-e3a3dc5e48bc#.vfx1l1jlr

(google search) (amazon search)


Thu Oct 06 15:58:24 GMT 2016 From /weblog/java/concurrency

Lock


ReentrantReadWriteLock - http://www-128.ibm.com[..]loperworks/library/j-jtp10264/index.html

why it suppose to be faster than VM level lock - http://osdir.com[..]sr.166-concurrency/2005-02/msg00031.html and a test about it - http://mechanical-sympathy.blogspot.gr[..]r/2011/11/java-lock-implementations.html

Samples of how to use it, and how to write test cases about it - http://www.javaspecialists.eu/archive/Issue152.html

Some useful VM parameter to tune the locks: -XX:+EliminateLocks , -XX:+DoEscapeAnalysis , -XX:+UseBiasedLocking - http://work.tinou.com[..]locking-escape-analysis-for-dummies.html

Discuss about 3 difference lock for Java, bias, thin and fat - http://www.javacodegeeks.com/2011/05/how-jvm-handle-locks.html

Why using the read lock will make lock detector fail - http://javaeesupportpatterns.blogspot.com.au[..]concurrency-hidden-thread-deadlocks.html

Basic of synchronization and locking - http://www.takipiblog.com[..]about-synchronization-in-java-and-scala/

Better semaphore with striped api - http://codingjunkie.net/striped-concurrency/

Comparing and discuss difference locking approach - http://www.javaspecialists.eu/archive/Issue215.html

Compare performance behavior of RWLock, StampedLock and Optimistic lock - http://www.takipiblog.com[..]ocks-vs-readwritelocks-and-synchronized/

Comparing sync and lock - http://www.rationaljava.com[..]ase-study-in-analysing-latency-lock.html

http://vmlens.com/articles/reentrant-lock-cheat-sheet/

(google search) (amazon search)


Tue Jul 05 08:29:21 GMT 2016 From /weblog/java/concurrency

race


http://vmlens.com[..]-or-how-to-find-an-irreproducable-bug-2/
http://vmlens.com[..]-java-race-conditions-with-tests-part-2/

(google search) (amazon search)


Thu Dec 24 03:18:13 GMT 2015 From /weblog/java/swing

performance


https://pavelfatin.com/low-latency-painting-in-awt-and-swing/

(google search) (amazon search)


Fri Dec 18 08:06:33 GMT 2015 From /weblog/java/libraries

office


I think this will be a cool API that enable developer to use openoffice at their code. However there is not much tutorial / guide. Here are 2 I known

http://technology.amis.nl/blog/?p=1243
http://technology.amis.nl/blog/?p=1244

Other than that, Lotus release an eclipse base Office suit recently, we suppose able to program using this, if there is no obfuscation - http://symphony.lotus.com/software/lotus/symphony/home.jspa

Generate Graph directly - http://www.programming-free.com[..]2/create-charts-in-excel-using-java.html

Alternative to POI, jXLS - http://fahdshariff.blogspot.com.au[..]ing-excel-file-into-javabeans-using.html

Using POI to update MS Word document - http://www.infoq.com/articles/convert-microsoft-word-to-html

(google search) (amazon search)


Mon Dec 14 06:18:15 GMT 2015 From /weblog/java/libraries

media


A complaint about media support, turn out attract a lot of library pointers: http://hedges.net[..]/29/video-support-on-java-found-lacking/

Music - https://www.reddit.com[..]/3wjuuc/java_music_software_development/

(google search) (amazon search)


Mon Dec 07 03:34:53 GMT 2015 From /weblog/java/libraries

pdf


Convert HTML to PDF -
Using Apache FOP: http://www.javaworld.com/javaworld/jw-04-2006/jw-0410-html_p.html
Or using native library: http://www.allcolor.org/YaHPConverter/

Generate barcode - http://examples.javacodegeeks.com/core-java/itext-barcode-example

(google search) (amazon search)