Embracing the Messiness in Search of Epic Solutions

Home

Welcome to my encyclopedia of shitty code!

  • 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…

  • UnboundID: The entry contains attribute ‘XXXX’ which is not defined in the schema

    PROBLEM Let’s assume we have the following LDIF file containing custom attribute(s), such as managedBy:- When running the code on UnboundID’s In-Memory Directory Server, the following exception is thrown:- SOLUTION The problem is caused by the fact that the default schema does not match Microsoft’s Active Directory schema. Hence, attribute(s), such as managedBy, would cause… 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…

  • Spring: Component Scan Selected Classes

    PROBLEM Let’s assume we have a package with the following classes where each class is either annotated with Spring’s @Service, @Component, @Controller or @Repository. When writing unit test, we want Spring to component scan class A and class B. SOLUTION Before we begin, we configure Log4j to log Spring in debug level. Step 1 If… Read More…

  • JAXB2: Adding toString() to Generated Java Classes

    PROBLEM By default, the generated Java class prints the memory address when toString() is invoked. However, sometimes it is helpful to have a more meaningful toString() for debugging purposes. SOLUTION To fix this, configure maven-jaxb2-plugin to generate toString() based on the fields in the class:- Read More…

  • Git + Linux: (gnome-ssh-askpass:24871): Gtk-WARNING **: cannot open display:

    PROBLEM When running git clone on Linux, the following error appears:- SOLUTION To fix this, run the following command to disable gnome-ssh-askpass:- Now, git clone will work just fine:- To prevent this from happening again, add unset SSH_ASKPASS command to .bashrc file. Read More…

  • Spring Security SAML: Replacing SHA-1 with SHA-256 on Signature and Digest Algorithms

    PROBLEM By default, Spring Security SAML’s SAMLBootstrap uses SHA1withRSA for signature algorithm and SHA-1 for digest algorithm. For example, the above configuration will generate the following SAML request payload when using HTTP-POST binding:- Unfortunately, SHA-1 is now deemed insecure due to “Freestart Collision” attack. Further, most modern browsers have ceased to trust SHA-1 code signing… Read More…

About Author

This author has 20+ years of experience in software engineering and cloud engineering. In an industry where knowledge becomes obsolete in the next three months, he learns anything that crosses his path indiscriminately. He floats from one technology to another like a moth and stings the problem sets like a mosquito. This author codes Java while drinking Espresso and writes Spock specifications while listening to Groovy beats. He masters Google Cloud Platform just like how he masters the art of predicting the movement of dark clouds over his backyard, where 60% of the time, he is right every time.

This author suffers from the Dunning-Kruger effect, where he overestimates his competence and underestimates his ignorance. Technology buzzwords never faze him, for he does not know enough to be afraid of in the first place. GCP, GCS, GCR, GKE, GWT… everything sounds the same to him. He never fears acronyms, synonyms, or antonyms, for he has ChatGPT in his back pocket. This author is a jack of all trades but a master of none. He writes like he knows all the answers, yet he googles for better solutions from elsewhere. He fakes it until he makes it; if he doesn’t, that’s okay because he has the attention span of a squirrel. The blog posts are his buried walnuts, in case he needs them one day.

In conclusion, this author is full of something. He apologizes in advance if you are trying to solve your company’s real problems with his shitty solutions. There, he has successfully written paragraphs of nonsense because every professional blogging website needs a section about the author, with a too-cool-to-smile portrait staring sideways into the abyss.