Embracing the Messiness in Search of Epic Solutions

Home

Welcome to my encyclopedia of shitty code!

  • Homebrew: “Invalid Multibyte Escape” Error

    PROBLEM When running brew on OS X Maverick, you get this error:- SOLUTION After upgrading to OS X Mavericks, the default version of Ruby is v2.0, causing Homebrew to break because it relies on v1.8. See issue #23655 for more information. To fix this, run the following command:- If you are getting the “Permission Denied”… Read More…

  • Groovy: java.lang.StackOverflowError When Implementing equals()

    PROBLEM While migrating a portion of my Java code to Groovy code, I got bitten by the Groovy operator loading feature that I should have known better… and my pride hurts, but hey, I admit I write shitty code. Consider this simple POGO with custom equals() and hashCode(), both implemented using Google Guava libraries:- What… Read More…

  • Deleting Cached Web Page by URI in CodeIgniter

    PROBLEM CodeIgniter contains a wonderful feature that allows me to cache web pages to speed up the page loading. The problem is there’s no easy mechanism for me to delete specific cached web pages, especially after I have updated the page contents. I have sucky two choices:- I always do the latter even though I… Read More…

  • Rotating Log Files on Apache HTTP Server

    PROBLEM Consider the following log configuration:- At some point of time, both error.log and access.log are going to get insanely large. SOLUTION To fix this, the logs can be piped (by using |) to Apache HTTP Server’s built-in program called rotatelogs to rotate the log files. For example, the following configuration will create a daily… Read More…

  • Suppressing FindBugs Warnings

    PROBLEM FindBugs is one of the many great static code analysis tools that I use everyday. However, the generated report may usually contain a few false positives that forces me to weave through them whenever I rerun my build on Jenkins. For example, I’m using Google Guava to construct my equals(…) and hashCode():- FindBugs will… Read More…

  • How to Unit Test Spring MVC Controller

    SCENARIO Let’s assume we have the following controller that needs to be tested:- SOLUTION 1: “Works but It Won’t Get You the Promotion” This working solution relies on:- While this solution works, but it has a few problems. This test case strictly tests the actual controller API, but it completely disregards the URI and request… Read More…

  • Hibernate: Migrating from XML-Based Configuration to Annotation-Based Configuration

    Overview At some point of time, as your project scope grows, the Hibernate mapping XML files are going to get to a point where it becomes very difficult to maintain. This is where the annotation-based configuration comes in. It took me a few years to convince myself that annotation-based configuration is the way to go.… Read More…

  • java.lang.OutOfMemoryError: PermGen space When Running Maven on IntelliJ

    NOTE This is not a Groovy related problem, but I’m using it to illustrate my problem and solution here. PROBLEM I recently tried mixing some Groovy code into my existing JEE project. I created a simple POGO that looks as sophisticated as this:- Then, I configured one of my controllers to invoke that POGO:- After… Read More…

  • “tree” Command on Mac OS X

    So, I have been drawing the ASCII file structure tree by hand lately… and that is dumb and time consuming. After digging around, I found a great way to do so. First, if you don’t have Homebrew, install it first. Run the following command to install the tree command:- Now, you can run the following… 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.