Embracing the Messiness in Search of Epic Solutions

Category: Programming Language

  • Java: Exploring Preferences API

    BACKGROUND In any written scripts or rich client apps, there is almost a need to persist the user preferences or app configurations. Most of the time, we, the proud developers, handle that situation in very ad-hoc manner. When storing in a file, we use different formats: from old-boring XML, to cool-kid JSON, to even cooler-kid Read More…

  • Spring + Ehcache: XML-less Spring Configuration for Ehcache 2.x vs Ehcache 3.x

    BACKGROUND The documentation on the web regarding Ehcache 3.x configuration using Spring is rather lacking. There is apparently a very distinct difference in Spring Java-based configuration between Ehcache 2.x vs Ehcache 3.x. Spring + Ehcache 2.x Dependency:- Spring configuration:- Spring + Ehcache 3.x Dependency:- Spring configuration:- Read More…

  • Groovy + GPars: Handling Concurrency

    PROBLEM Let’s assume given a list of user IDs (ex: 1, 2, 3, 4, and 5), we need to query 2 data sources to get the names and the addresses before returning a list of Employee objects. The Employee class looks like this:- We are going to explore multiple solutions to implement lookup(..) to run Read More…

  • Groovy: Log Annotation

    PROBLEM My personal goal of 2017 is to write less useless-yet-neccessary code, such as initializing a logger:- SOLUTION Groovy provides several useful annotations that allow us to inject a logger instance into the class. Here’s a rewrite of the above example:- If we insist of using the same variable ( LOGGER ), we can do Read More…

  • LdapTemplate: javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name ‘…’

    BACKGROUND Let’s assume we have the following LDAP configuration… When running any LDAP query, the following exception is thrown:- SOLUTION There are 3 solutions to this problem. Query against Gobal Catalog To prevent the referral issues when dealing with Active Directory, we may query against the Global Catalog by using port 3268. The possible downside Read More…

  • LdapTemplate: AttributesMapper vs ContextMapper

    BACKGROUND When using Spring’s LdapTemplate, there are two ways to transform the queried results: AttributesMapper and ContextMapper. Here’s the comparison between these mapper classes. AttributesMapper If you are migrating your existing LDAP queries to Spring’s LdapTemplate, AttributesMapper seems ideal because you can copy most of the code over because it provides javax.naming.directory.Attributes. However, you have Read More…