Posts

Showing posts from March, 2016

Micro-services for performance

Microservices is a buzz word at the moment. Is it really something original or based on established best practices. There are some disadvantages to the way micro-services have been implemented, but can these be solved? Read more at  https://vanilla-java.github.io/2016/03/22/Micro-services-for-performance.html

Moving to Github and Asciidoc

This blog is moving to  https://vanilla-java.github.io/ Why move to Asciidoc on HubPress on Gighub from Blogger. I am moving my blog to use Asciidoc on Github.com. This is partially to make it easier to embed code and tables, but mostly because I am tired of fighting blogger to not mess with the content when I edit a posting. Please join me on my new source of content, and if you see any mistakes, please fork my blog and issue a Pull Request. EDIT: It has been noted that HubPress.IO doesn't support an RSS feed yet. For this reason I will be posting an abstract and a link on blogger until this feature is added.

Printing arrays by hacking the JVM.

Overview One the most common gotchas in Java, is knowing how to print arrays.   If an answer on how to print an array get more than 1000 upvotes, you have to wonder if there is a simpler way.  Just about every other popular language has that simpler way, so it's not clear to me why Java still does this. Unlike other JDK classes, arrays don't have a particularly sane toString() as it is inherited from Object. It prints the type and address right? Actually, it doesn't print the address, it just looks as cryptic as one. It prints the internal representation of the type, and the hashCode() of the object.  As all arrays are an Object, they have a hashCode() and a type and a synchronized lock, and every thing else an Object has, but no methods specific to an array. This is why the toString() isn't useful for arrays. What does it look like unhacked? If I run the following program. public class ObjectTest {     boolean[] booleans = {true...