tag:blogger.com,1999:blog-9673689464996249912012-09-15T09:39:52.779-07:00Java RiotLisaknoreply@blogger.comBlogger22125tag:blogger.com,1999:blog-967368946499624991.post-45233969401565539582012-09-15T09:39:00.003-07:002012-09-15T09:39:52.788-07:002012-09-15T09:39:52.788-07:00Hazelcast OverviewThis is just an evaluation summary. A shortened version of Hazelcast documentation. I pointed out the most important facts about it.Hazelcast allows for distributing application data across cluster nodes. It is a peer-to-peer solution to avoid single point of failure.
Data in the cluster is almost evenly distributed (partitioned) across all nodes. So each node carries ~ (1/n * total-data) + Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-90095481971733654352012-09-15T01:51:00.002-07:002012-09-15T01:51:42.886-07:002012-09-15T01:51:42.886-07:00Guava Live View of collections explainedThe collection returned when using filter or transform methods is so called Live View of the underlying collection. Its iterator doesn't support removing elements, only adding. The most useful thing about Live Views is that they let you work with elements that satisfy the Predicate condition only. It is handy especially when the elements are Objects and their state changes so that the object may Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-83557462600035490752011-11-19T13:13:00.001-08:002011-11-20T02:51:06.954-08:002011-11-20T02:51:06.954-08:0010 things a programmer should know about Liferay Kaleo Workflow EngineLiferay developers decided to create their own workflow engine called Kaleo 2 years ago. It's a flexible lightweight workflow engine similar to other open-source engines out there. It is a plugin built on Liferay's ServiceBuilder and it needs to be deployed before you can use it (it is not a part of portal).
The principle consists in defining workflow for resources as an xml definition Lisaknoreply@blogger.com3tag:blogger.com,1999:blog-967368946499624991.post-62521391912022050952011-11-09T18:40:00.000-08:002011-11-19T15:50:13.790-08:002011-11-19T15:50:13.790-08:00Liferay Workflow Kaleo Engine tuningIt's been a pleasure to work with Liferay Workflow Kaleo Engine. I'm not going to introduce it here, you can read about it in the documentation reference. I just wanted to mention one thing that I needed to improve.
When I was designing complex workflow definitions that were containing a lot of groovy scripts I just didn't want to write them directly in workflow xml definition. Instead, I Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-64033879331618995952011-11-08T19:36:00.000-08:002011-11-08T20:03:35.431-08:002011-11-08T20:03:35.431-08:00How to use Liferay third-party libraries as Maven dependencies ?Almost all day worth of work but finally I finished DependencyInstallerMojo. Simply put, you provide it with destination of Liferay's lib/versions.xml and inclusion regexp patterns that determine which libraries are to be installed into either local maven repository or a custom location and it installs them as Maven artifacts and generates a pom definition that contains corresponding dependenciesLisaknoreply@blogger.com1tag:blogger.com,1999:blog-967368946499624991.post-86981583155007877582011-11-07T08:57:00.000-08:002011-11-10T08:43:09.608-08:002011-11-10T08:43:09.608-08:00Does Maven honor principles it is based on in its own architecture ? I like Maven a lot, makes Java programming more fun and spares a lot of time. I also understand principles of preserving backward compatibility, but it is supposed to be comprehension tool, but inside it still uses Plexus or Javadoc tags that are quite hard to comprehend and imho should be deprecated in version 2 and disappear in version 3. But I don't see almost any sings of that.
People knowLisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-44829241477159540392011-11-06T04:51:00.000-08:002011-11-06T04:51:01.421-08:002011-11-06T04:51:01.421-08:00Liferay database load balancing and shardingIf you are considering optimizations at the database level, you should be aware of 2 things :
Sharding
Technique that scales your database along portal instances : Database Sharding. Not that I have used it already, I haven't found a use case for this yet, so I'm setting up liferay-maven-plugin to call ServiceBuilder with these properties, so that it doesn't generate file Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-71179014470375618442011-11-06T04:36:00.001-08:002011-11-16T02:07:38.162-08:002011-11-16T02:07:38.162-08:00Liferay cachingLiferay is caching on a few places. Good one to start at is taking a look at PortalContextLoaderListener where all the key classes that take care of pooling, caching or buffering get revealed.
Entity caching and Finder caching :
These are just java collections that are mapping an instance of an Object representing an Entity to a primary key. Unless you access database by other means than via Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-33938065715729606802011-11-06T04:29:00.000-08:002011-11-06T04:57:01.948-08:002011-11-06T04:57:01.948-08:00Liferay servlet filtering The first thing that I have noticed when I started using Liferay was quite a significant amount of filters. Some of them relates to performance, caching, bandwidth, garbage collection of thread locals, security or providing you with various ways of authentication. But you should really know them and turn those that you don't need off. You can do that in portal-ext.properties.
# Audit Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-42383103627570722712011-11-06T03:07:00.000-08:002011-11-10T15:14:58.984-08:002011-11-10T15:14:58.984-08:00Booting up Ant project when testing with Maven and surefire plugin
Have you ever had a huge non-maven project that you needed to boot up in order to use it when testing your maven project ? The first time I had to deal with that, I wrote an Ant script that has installed all those hundreds of jars as dummy dependencies with no metadata to maven repository. It was called every time the software finished building.
The second time I needed to do something Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-37634689754873404772011-10-26T14:53:00.000-07:002011-11-05T14:25:42.017-07:002011-11-05T14:25:42.017-07:00Find yourself some rules to stick to ! I realized that keeping a few rules could be more important than any other skill of a developer. Some of them are :
making a precise image of what you want
If you are writing an algorithm, unless you are 90% sure that this is the right solution, at least in your best, you shouldn't be writing it at all and think harder. Programming is much like the real life and a lot of principles are Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-29970872426029848032011-10-24T16:42:00.000-07:002011-10-25T14:50:22.360-07:002011-10-25T14:50:22.360-07:00What is even worse than getting stuck? Every programmer knows how it feels to get stuck. There are various means of getting stuck, sure. You might deal with something trivial that you don't have experience with for an hour instead of ten minutes. You could get annoyed by a task that you don't like or have a little motivation to finish, voila, you find yourself procrastinating a few hours because you don't want to get certain Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-20252101727221570872011-10-24T08:13:00.000-07:002011-10-25T16:50:50.083-07:002011-10-25T16:50:50.083-07:00Died learning Scala I spent an entire weekend trying to break through Scala. The amplitude of interest was increasing at first but suddenly rapidly decreased until I lost patience for good. I barely finished 10 projectEuler's problems except for reading up documentation. The more experience I had the more unhappy I was about the complexity of the language and mainly the abstraction layer. Considering the fact Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-11223531908554969562011-10-20T04:16:00.000-07:002011-10-20T08:11:06.343-07:002011-10-20T08:11:06.343-07:00Liferay Modeshape HookLiferay has a really incredible ability to support various implementations and technology vendors. I mean, search through portal-properties for something you'd need to use and you most probably find that Liferay supports it.
As far as ECM is concerned, Liferay Portal disposes of Document Library that has Repository implementations underneath. The default repository, LiferayRepository, is a Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-51783408230441315862011-10-17T16:39:00.000-07:002011-10-17T16:39:08.414-07:002011-10-17T16:39:08.414-07:00Google Translator Toolkit Client Half a year ago I implemented this Java Client that covers most of what Google Translator Toolkit API has to offer. One implementation that depends on the old gdata-java-client is already available by Google. This one is using the new java client library (com.google.api-client 1.5-beta) after I switched from 1.3 or 1.4 version.
Translator Toolkit API is restricted but you may ask for theLisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-79129952465026966842011-10-17T16:35:00.000-07:002011-10-17T16:37:46.203-07:002011-10-17T16:37:46.203-07:00Need documents of various media types and language ? I wrote this java document provider library for Google Translator Toolkit Client. It is quite handy when developing an application that works with documents, that either vary in media type or language. TDD is the best approach for writing these kinds of apps and this library allows you to set up your test suits with documents very easily.
It downloads text data and makes combination of Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-16320732442108764052011-10-11T17:58:00.000-07:002011-10-12T04:06:34.380-07:002011-10-12T04:06:34.380-07:00Is Java concurrency for human beings ? Do you also have the bad feeling or uncertainty whenever you use volatile field modifier? The fact that compiler or processor can reorder statements or keep values in registers and that Java Memory Model and compiler is designed to allow aggressive optimizations is bad for our intuition about sufficiency of code synchronization.
For instance, if you are iterating something on a boolean field Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-4129284777351310532011-10-09T13:32:00.000-07:002011-10-09T13:32:26.386-07:002011-10-09T13:32:26.386-07:00Google API Shell ClientIf you are on Linux and want to try or test Google APIs, you might want to use this simple shell script I wrote to share with other developers when dealing with bugs.
Google API Shell Client
I have tested it on just a few APIs. Using cURL directly is quite annoying, mainly due to a very long auth token that spreads across a few lines and that must be present in each request.Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-88666949985517812662011-10-09T02:45:00.000-07:002011-10-09T02:46:31.273-07:002011-10-09T02:46:31.273-07:00Not Invented Here Syndrome, why reinvent the wheel?
From my point of view Not Invented Here Syndrome is both a great anti-pattern and a way to be very productive in short term.
When developing application without using third party software (libraries, platforms or APIs) there is nothing to stop you from delivering the SW. Except for your own inability to design and implement it. I'm not talking about the fact that developers don't have Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-17634666326632130302011-10-07T05:05:00.000-07:002011-11-06T03:35:49.013-08:002011-11-06T03:35:49.013-08:00Java 8 backwards compatibilityI really hope that Oracle JVM engineers will decide to ignore backwards compatibility for Java 8 release. It is a great burden for the language in past releases and for developers too. The language is and was overly complicated and honoring backward compatibility is totally counterproductive.
For instance, consider Generics that were introduced in Java 5. It came with Type Erasure due to Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-83315392136497771752011-06-01T11:55:00.000-07:002011-10-07T11:08:58.731-07:002011-10-07T11:08:58.731-07:00Liferay - Train of thoughtsIt is ca 2 years ago when I was playing with sample portlets wondering what is the difference between Ext and Hook. I wanted to make a summary of the most important facts that it is good to be aware of.
Newcomers usually expect that they will be able to deliver an Intranet solution or at least a nice website with a few handy plugins very shortly. But suddenly they realize that even though Lisaknoreply@blogger.com0tag:blogger.com,1999:blog-967368946499624991.post-8097047821413293032011-05-30T13:16:00.000-07:002011-11-09T06:47:45.446-08:002011-11-09T06:47:45.446-08:00Broadleaf Commerce Vs. Apache Ofbiz
At first, around 2-3 years ago, I gave up on using Apache Ofbiz, because it seemed that I wouldn't be able to be "productive" with it for weeks, because of its complexity. But I noticed of Broadleaf Commerce a few months ago and I find it very interesting. The technology stack suits me a lot ( spring, spring-mvc frontend, GWT backend, hibernate on jpa spec, maven, etc.), if it utilized git and Lisaknoreply@blogger.com4