Category: Programming Language
-
Karma: Getting Started
Overview This tutorial walks through the steps need to configure Karma to work with a Maven web project. It will also be used as a base for my future Karma related posts. Install Node.js First, download Node.js from http://nodejs.org/download/ and install it. Once installed, we should be able to invoke npm command from the command Read More…
-
Guava: Reducing Cyclomatic Complexity with Objects.firstNonNull(…)
PROBLEM Ever written code like this? While it works, it has several minor problems:- SOLUTION Guava provides a much cleaner solution to address these problems:- Read More…
-
Guava: FluentIterable vs Collections2
PROBLEM Guava’s Collections2 is great when dealing with collections, but it quickly becomes rather clumsy and messy when we try to combine multiple actions together. For example, say we have userIds, which is a collection of user IDs. For each user ID, we want to retrieve the Employee object and add it into an immutable Read More…
-
Combining and Minifying JavaScript Files with Google Closure Compiler
GOAL The goal is to combine and minify several JS files into one JS file in the right order. PROBLEM Let’s assume we have the following directory structure with three JS files. Directory Structure appdev.js appdev.blackcow.js appdev.whitesheep.js SOLUTION To pull this off, we will leverage Google Closure Compiler. There are multiple ways to use this Read More…
-
IntelliJ: Overriding Log4J Configuration Globally for JUnit
PROBLEM Most of the time, we may have several Log4J configurations depending on the environments, for example:- Since log4j.xml and log4j2.xml are the default configuration files for Log4J and Log4J2, these configurations will always be used unless we override the configuration file path. In another word, if we don’t override the configuration file path and Read More…
-
Java + Groovy: Creating Immutable List
Java: Mutable List Java: Immutable List Java: Immutable List using Guava Groovy: Immutable List Read More…