Monday, October 1, 2018

Snapshot of Java 11 Features

New features from the developer’s perspective:


I think the most important feature from above is, HTTP Client API. As you must aware there are a number of existing HTTP client API’s and implementations exist, e.g. Jetty and the Apache Http Client – In fact, I was using Apache Http Client since there was no standardized API from the Java. 

Other important thing here is - Removal of Java EE and CORBA modules. Many projects still using JAXB API's and now they need to package them as third-party jars.

Memory and Performance tuning:
   (Experimental)

However, none of them impact the hotspot GC. Those are introduced to address various use cases especially for testing and performance tuning and need to enable them through specific flags.

Deprecated Features:


Lot of people uses the Nashron JS engine to run the JS code from the Java – this might be a huge impact for those people.

Thursday, September 27, 2018

When to amend/squash commits and how to maintain a clean PR

I always like to improve the development process with the git and a strong believer in the clean code.
Something which I always insist during my PR review is - maintain the clean git history by avoiding the unnecessary indivual commits. 

Broadly, we can follow these 2 rules:

  1. amend/squash commits if they don't add semantic value to the PR
  2. Always rebase the PR before you push to the server

Below article exactly reflects my thought on this.



Other nice articles on this:

https://www.atlassian.com/git/tutorials/rewriting-history
https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

Friday, September 21, 2018

Setting a specific Java version to maven if you've multiple Java versions installed in the system

This is for the macOS:

By default, maven runs with the default JAVA_HOME configured in the system. If you want to set a different Java version temporarily for your maven - we need to change the JAVA_HOME in the mvn file. 

mvn shell file

#!/bin/bash
JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home)}" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"


Changed mvn shell file this to:

#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

However, if you wish to set a particular java version to the project permanently - that needs to be configured in the pom.xml file

Refer here:                   


For example, to set for Java 1.8
<properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
 </properties>


Java 7:

<properties>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
 </properties>


 But where can I find this mvn file in macOS?
$ which mvn
/usr/local/bin/mvn

$ cat mvn
#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

As you can see - mvn file is located in /usr/local/Cellar/maven/3.5.2/libexec/bin/



Monday, September 17, 2018

Git tag operations

First, let me check my branch and the origin

item-ax40113:es6features kkolipaka$ git branch
* master

item-ax40113:es6features kkolipaka$ git remote -v
origin https://github.com/kolipakakondal/es6features.git (fetch)
origin https://github.com/kolipakakondal/es6features.git (push)


Let me view my existing git tags on this branch

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730


Create a new git called "1.0.3"

$ git tag 1.0.3

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3


Create a new git tag with the message

$ git tag 1.0.4 -m "1.0.4 GA release"
$ git show 1.0.4
tag 1.0.4
Tagger: Kondal Kolipaka <kondal.kolipaka@gmail.com>
Date:   Mon Sep 17 15:56:31 2018 +0800

1.0.4 GA release

commit 24302d15e49d24ee208ca7eb725f34dbf37cd0ef
Author: Kondal Kolipaka <kondal.kolipaka@gmail.com>
Date:   Mon Jul 30 18:20:46 2018 +0800

    adding comment for test


Push git tag to the remote server repository

$ git push origin 1.0.4
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.43 KiB | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/kolipakakondal/es6features.git
 * [new tag]         1.0.4 -> 1.0.4



Let me rename git tag from "1.0.4" to "1.0.4.GA"

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4

$ git tag 1.0.4.GA 1.0.4
$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4
1.0.4.GA


Let me push the newly git to the remote repo

Before that, let me delete my git tag first from the local repo
$ git tag -d 1.0.4
Deleted tag '1.0.4' (was c3a04e7)
item-ax40113:es6features kkolipaka$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4.GA


Let me also delete my old git tag "1.0.4" from the remote repo

$ git push origin :1.0.4
To https://github.com/kolipakakondal/es6features.git
 - [deleted]         1.0.4


Now, let me push my renamed git tag "1.0.4.GA" to the remote server

item-ax40113:es6features kkolipaka$ git push origin 1.0.4.GA
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.43 KiB | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/kolipakakondal/es6features.git

 * [new tag]         1.0.4.GA -> 1.0.4.GA



Here is my current release commits for 1.0.4 GA, git tag "1.0.4.GA" is created on the latest commit which is "24302"

$ git log --pretty=oneline
24302d15e49d24ee208ca7eb725f34dbf37cd0ef adding comment for test
f9446b4a8dc7112eb64f60981a3700ae49cf483b some more changes
58694540ee96369dd34898288ac1bfb1f0ac203e some more changes
b1743684346a42cc3b0820b2e1241bfc3f794a1a changes
ba039a51a49ae67cbb3fb9c3c2f8d49335588eca Update .mergify.yml
c458c898ec1efcd2d1c03b762b8d2437dc5ce644 Enable mergify.io
3632a41f38bc7ee7ad409666397301f80815ff58 ES6 sample app for Appcelerator titanium

Fix#1 added

$ git add es6features/LICENSE.txt
$ git commit -m "Fix1 on 1.0.4 GA release"
[master be67c9f] Fix1 on 1.0.4 GA release
 1 file changed, 2 insertions(+), 1 deletion(-)

Fix#2 added

$ git add es6features/LICENSE.txt
$ git commit -m "Fix2 on 1.0.4 GA release"
[master a609582] Fix2 on 1.0.4 GA release
 1 file changed, 2 insertions(+), 1 deletion(-)


2 new commits added after 1.0.4 GA release

item-ax40113:es6features kkolipaka$ git log --pretty=oneline
a60958216f0e64c2d9374978e0064585e6bca7b2 Fix2 on 1.0.4 GA release
be67c9f4d7780686eb7469ab681bc7f0ee3ca4ca Fix1 on 1.0.4 GA release
24302d15e49d24ee208ca7eb725f34dbf37cd0ef adding comment for test
f9446b4a8dc7112eb64f60981a3700ae49cf483b some more changes
58694540ee96369dd34898288ac1bfb1f0ac203e some more changes
b1743684346a42cc3b0820b2e1241bfc3f794a1a changes
ba039a51a49ae67cbb3fb9c3c2f8d49335588eca Update .mergify.yml
c458c898ec1efcd2d1c03b762b8d2437dc5ce644 Enable mergify.io
3632a41f38bc7ee7ad409666397301f80815ff58 ES6 sample app for Appcelerator titanium



Now we want to make a release 1.0.5 with only Fix#1 - In this case, we need to create a tag with the Fix1 commit hash id.

$ git tag -a 1.0.5.GA be67c9f4d7780686eb7469ab681bc7f0ee3ca4ca -m "1.0.5 GA release with the Fix#1" 

$ git tag
1.0.1
1.0.2
1.0.2.201807
1.0.2.20180730
1.0.3
1.0.4.GA
1.0.5.GA


Tuesday, April 24, 2018

Singapore ThoughtWorks Tech Radar

Less than a week ago, I was invited to attend ThoughtWorks Tech Radar, Singapore and debate and discuss on the latest technologies along with the other senior technologists.

It was an interesting session and enjoyed sharing my perspective on the latest technologies!

You can view Singapore radar from here  Your very own Tech Radar.







Thursday, April 19, 2018

Redis meetup, Singpaore


Few days back, I got a chance to attend Redis Meetup in Singapore, and it was an interesting session!

I thought, I could share some of my learnings from the session!

Major features:
  1. It’s a in-memory data structure - so you can expect more RAM if you want to store more data!
  2. It’s blazing fast!
  3. Easy and versatile
  4. No SQL
  5. Stores the data in key-value way
  6. Can be used as Cache buffer, Message broker, Pub/sub and in streams
  7. It’s a single threaded.
  8. Can be deployed in the “cluster” mode, scalable up to 1000 nodes!!
  9. It has self healing feature - if the master goes down, automatically slave node will become the master and align with the other nodes

It’s used in the WhatsApp, Twitter, Uber, Grab, Airbnb, Netflix and many more! - This is very interesting to me since I use most of these apps in my day-to-day life!

The only problem I heard is - It’s very difficult manage Redis Cluster and it doesn’t guarantee consistency!!


Quick start:

Installing in macOS:
  1. Download the latest stable version Redis 4.0.9 is the latest stable version.
  2. Extract the tar file
  3. Run "sudo make Install" from the root directory


Quick test:

item-ax30641:redis-4.0.9 kkolipaka$ redis-cli ping
PONG
item-ax30641:redis-4.0.9 kkolipaka$ redis-cli
127.0.0.1:6379> set mykey helloworld
OK
127.0.0.1:6379> get mykey

"helloworld"





Resources:

https://redis.io/