Skip to main content

Posts

Showing posts from 2016

Ubuntu Setup

I just moved to Ubuntu from Windows for numerous reasons and as I'm setting up my Ubuntu I have listed few points for future me. Here it goes.. Update Java Ubuntu 14.04 comes default with Java 7, I need Java 8 for new projects and Java 6 for some legacy projects. http://ubuntuhandbook.org/index.php/2014/09/install-oracle-java-ubuntu-1410/ https://ubuntuforums.org/showthread.php?t=2218888 Clean existing JDK sudo apt-get purge openjdk* sudo apt-get purge icedtea-* openjdk-* sudo dpkg --list | grep -i jdk java -version javac -version which javaws Update sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer java -version sudo apt-get install oracle-java6-installer java -version sudo apt-get install oracle-java8-set-default java -version Update GIT sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git git --version Eclipse - Install Neon http://ubuntuhandbook.org/in

Serlizing JSON polymorphically when type field is in parent JSON using Jackson

Today, I came across a json parsing situation where the sub-type field is outside the type json. Genrally we seen a situation like this @JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class") class Animal{} class Dog extends Animal{ } class Cat extends Animal{ } and it de-serialize to json like this: {      "@class" : "x.y.z.Cat", ... } In my project I need to parse json like this { "status": "OK", "messageName": "x.y.z.Success", "messagePayload": { "foo": "cd3a5697", "bar": 224 } } { "status": "ERROR", "messageName": "x.y.z.Error", "messagePayload": { "errorCode": "APPLICATION_ERROR", "errorInstanceId": "b292b864", "errorDetailedMessage": "Invalid UUID string (Length mismatch)" } }

My first C program: now and then

I was searching for some documents in gmail and found a mail that I sent to company X for their hiring process. It was a c program for searching word in file. I do not know how much time I have taken for it but it was basic search utility function. The point of this blog is not discuss that program but to discuss how time makes you better programmer. Here are the few things I would like to share myself - It takes some learning to write clean code.  Reed books like clean code. You need mentor to learn from his experience. Get a github account and see how experts are writing code. This is not the complete list, there are many things you will acquire over a period of time which make you better programmer. PS: If you are wondering how that program used to look like, then see this  repo.