Author Archives: cyberaka

About cyberaka

My name is Abhinav Anand and I am an ex entrepreneur. I am currently working as a Solution Architect. My roles are managing the team and project design/architecture development. I started working in the year 2001 as a freelancer and developed softwares for local business houses. During this stint I developed accounting, payroll, inventory, institute management softwares for multiple firms. The crowning achievement during this period was Cash Master and Visual Accounts which were highly used by their respective customers. I did this for almost 3 full years and I learnt from experience that it is difficult for a single person to design big product although you have more control but you are limited to your talent only. You need preferably a small talented team if you want to do anything big. From 2004 I started working in process automation and visualization (HMI) related software. This was a rewarding experience and I developed core competence at many interesting concepts and technology. I got a great deal of experience in team based development and got a very knowledge rewarding technical sales support experience. It is unfortunate that the company I work for and the company for whom they designed the product have both closed their business within 4 years of my leaving. I did this for around 3 years and I learnt from this experience that you cannot focus on a single customer and grow. As a consulting firm you have to hedge your risk on multiple customers and accounts. Whereas as a product firm you need to have a very solid financial backing to break into a market and keep yourself afloat. The most important lesson I personally learnt was to keep clear of products which take better portion of a decade to become successful. From 2007 onwards my focus narrowed down to mobile and web integrated projects. I worked on multiple projects in J2ME (Symbian, Blackberry) and Android. I saw Android’s first release and I loved the power it gave to developers in comparison to iPhone ecosystem. I think the coming of Android changed the game and gave way to the opening up of the iOS development environment to average joe developer. I knew the coming decade was going to be a mesh of mobile and web based solution. The future is all about combining consumer electronics and software for a compelling product. From 2010 onwards I finally got fully involved with my own venture and my focus was developing Android and iOS apps. My goal was to be identified as a dependable mobile based product maker with a solid portfolio of mobile based software. Till date my company has developed Blackberry, iOS and Android apps in variety of small to medium domains. From 2014 onwards I got back into a Job and shutdown my venture. I did this as I had become bored and wanted to work in a bigger team and project. I worked for a while in a Big Data analytics company. Finally I moved to a new company which wanted me to hire a team and write a Retail ERP software from scratch. It has been a very challenging experience and I had to relearn a number of things to get things done. I am still not fully done with this ERP but the end is in sight. It has been a very rewarding experience to work with AngularJS, Spring Boot, Docker, Mockito etc. which were totally new to me. But the technology choices have paid back handsomely.

Uninstalling and reinstalling brew

I use brew utility for all my terminal based installation needs. However recently I had to deal with a corrupted brew install. To fix this I followed this link. The uninstallation and reinstallation worked fine and I now have a working brew instance.

The commands as mentioned in the above link are:

$ cd `brew –prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew
$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

 

Export JSON from RoboMongo

I use RoboMongo extensively for all my Mongo development work / debugging. I however sorely needed a way to export JSON from it. A Stack Over Flow link came up in a Google search and I was able to export JSON for my use. Basically you need to execute this command which uses “printjsononeline” function provided by Mongo to give you one line JSON for each row in the collection:

db.getCollection('collection_name').find({}).forEach(function(x){printjsononeline(x)});

Installing pip on MacOS

I recently started exploring python and immediately ran into the following issue:
$ pip install requests
-bash: pip: command not found

A quick google search yielded this result. So basically on MacOS you have Python preinstalled along with easy_install command. So the following command installs pip:

$ sudo easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 9.0.1
....
....
Processing dependencies for pip
Finished processing dependencies for pip

A quick and handy solution indeed!

Adding docker support in Spring Boot application

Adding docker containerization support in a working Spring Boot application is surprisingly easy.

Step 1: Add the docker maven plugin to your pom file.

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.3.4</version>
            <configuration>
                <repository>${project.artifactId}</repository>
            </configuration>
        </plugin>
    </plugins>
</build>

Step 2: Build the application as well as the docker image

mvn clean package install dockerfile:build

Step 3: I have a local docker registry setup in my Lan so I prefer to push this image to my network registry manually (this can be automated as well however).

docker tag my-app:latest my_network_registry_host:5000/my-app

Step 4: Now we can bootup this docker image anywhere in the network.

docker run \
--detach \
--link <any database link> \
-e <Environment variable 1> \
-e <Environment variable 2> \
-p 8080:8080 \
--name my-app \
my_network_registry_host:5000/simply-hr
 Step 5: Checkout the application URL @ http://localhost:8080. Tail the log if you want to
docker logs --follow simply-hr

Setting up Redmine docker instance

In order to setup a fully functional Redmine server via Docker I use the following consolidated command:

docker run \
--detach \
--name redmine \
--link mysql:mysql \
--publish 3000:3000 \
--env="REDMINE_DB_MYSQL: redmine" \
--env="REDMINE_DB_PASSWORD: redmine" \
--volume /Volumes/DATA/Abhinav/Docker/redmine/files:/usr/src/redmine/files \
redmine

This connects my mysql docker instance with sonar and it is able to create tables and start using MySQL properly for storing all it’s data.

Java Code To Extract Email From Text

I found a good piece of code which can be used to extract multiple email from a String. A modified version of the code is listed below:

public static String readContactEmailFromString(String resumeText) {
    final String RE_MAIL = "([\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Za-z]{2,4})";
    Pattern p = Pattern.compile(RE_MAIL);
    Matcher m = p.matcher(resumeText);

    StringBuilder sb = new StringBuilder();
    while(m.find()) {
        if (sb.toString().contains(m.group(1))) continue;
        if (sb.toString().isEmpty()) {
            sb.append(m.group(1));
        } else {
            sb.append("; " + m.group(1));
        }
    }
    return sb.toString();
}

Fetching colleague’s fork on Github

I am currently using Github and all project members have forked the main repository into private repository. Now the problem is that I need to review my colleagues code committed in his branch inside his forked repository. So to do this I found out a good article that showed me exactly how to do that. I used the following approach.

git remote add my-colleague https://github.xyz.com/my-colleague/project.git

git fetch my-colleague

git checkout -b my-colleague-branch --track my-colleague/branch

After I do this I can see all the work done by my colleague and I can switch back to my branch anytime.

Spring Certification

We can now do Spring certification without going for Pivotal training. It was long due and here it is finally!

Can you take Spring certification without Pivotal Training Course?

Read more: http://javarevisited.blogspot.com/2017/05/can-you-take-spring-certification-without-training-course.html#ixzz4hVUNb9fW

5 Spring Framework Books for Java developers (Includes Spring Security and Spring Boot) – Best of lot

Read more: http://www.java67.com/2016/12/5-spring-framework-books-for-java-programmers.html#ixzz4hVU7visy