JSON-JAVA / CATATAN</>↗JSON-Java30 Agt 2018
In this example we are going to use the JSON-Java (org.json) library to read or parse JSON file. First we start by getting the InputStream of the JSON file to be read using getResourceAsStream() method. Next we construct a JSONTokener from the input stream and create an instance of JSONObject to read the JSON entries. […]
KOTLIN / CATATAN</>↗Kotlin13 Mei 2018
To write Kotlin program you will need an IDE (Integrated Development Environment). One of the IDE that you can use is the IntelliJ IDEA CE (Community Edition). It comes with Kotlin Java Runtime Library, so you don’t need to install it separately. To run Kotlin program you will need to install the latest JDK (Java […]
KOTLIN / CATATAN</>↗Kotlin12 Mei 2018
In Kotlin, the HelloWorld.kt program can be written as a simple function like the following snippet. fun main(args: Array<String>) { println("Hello, World!") } From this little code snippet we can learn the following features of the Kotlin programming language: Kotlin program saved in a file with .kt extension. The fun keyword to declare a function […]
OS X / CATATAN</>↗OS X13 Nov 2017
In this post you will learn how to set the default JAVA_HOME in Mac OS X when you have more than one JDK installed in your computer. First you need to run /usr/libexec/java_home -V command to get the list of installed JDK. The command will print out something like the following depending on the available […]
TOOLS / CATATAN</>↗Tools16 Okt 2017
If you want to run a sudo command without being prompted to input the password you can do the following command. echo password | sudo -S rm -rf /opt/jetty/ In the command above we are trying to remove the /opt/jetty directory using the rm -rf command. The -S (stdin) option allow the sudo command to […]
JACKSON / CATATAN</>↗Jackson14 Feb 2017
The following example demonstrates how to pretty print the JSON string produces by Jackson library. To produce well formatted JSON string we create the ObjectMapper instance and enable the SerializationFeature.INDENT_OUTPUT feature. To enable this feature we need to call the enable() method of the ObjectMapper and provide the feature to be enabled. ObjectMapper mapper = […]