Saturday, June 20, 2015

A Stock Management Software - I call it stockIT

Well this one is more of a blog which will be a memory than a web hit . Today 20-06-2015 , ohh well lets go few days back , so starting last Tuesday , i started trading on my DMAT account , invested slowly , slowly till i became all crazy about it and started investing more , and guess what 3K in 4 days , that's what i could make , with an initial investment of 40K . 

Well , well , well , which bank in this small world gives such an interests , practically none . Anyways , that;s not the point . Now i ended up buying more and more shares of different companies and i felt that i need a SHARES management system for myself local on my desktop , i don't want to login to my trading account and keep seeing my investment , reports and profits. 

So what i decide to write my own stock buying and selling management system , started early morning and i have the back end ready by now . Yet i  need to write the UX . Well who knows if this ends up great , i might end up sharing it publicly on github or somewhere.

Next is , should i write the UX as a desktop application or a web application , that decision is still to be taken . 

Ohh let me share , the backend is Java and database used is OrientDB a nosql graph database , ah i might have talked about it a lot in my previous blogs .

So as of today , as i sleep , the software i wrote in morning , add the stock i bought to the database , adds the stocks i sold to the database , keeping a relation between the bought stock and the sold stock of the same company , and well yeah it generates a report in the form of a db table / vertex here , that tells me each companies' share i bought and sold , total investment , total sales , profit or loss . 

More to be implemented . I don't know if you read this entire blog or not , but if you did i really appreciate it , keep reading .

-@nmol

Thursday, June 18, 2015

How to deal with FindBugs in your project

FindBugs is a google project which many of the companies use in their product development lifecycle to findBugs in a java project . Well this can be used as a command line tool or as a plugin to a build automation framework , lets take Gradle for example .

Well findBugs hunts your code very effectively to find stupid coding mistakes which one would not take care of much while coding .

Lets take a look at what does find bug hunt for . Well this is it : BugCodes.

I am not here to talk about findBugs , neither i am here to talk about gradle .

What i am gonna share is how i got messed up with findBugs BugCode : RV .
 
A situation  where i  had to ignore the return value of  function and also call that function for something to work in background . Well i really got fed up with findBugs to catch my error everytime and keep failing the build.

Well how to supress this warning and go ahead with the build.

-> If you are not a gradle expert do not try this , in build.gradle , in
findbugsMain  {
}

you need to give excludeFilter and a file which specifies the format of the classes and the methods and Bug Code to ignore. Well this was a nightmare and i could not achieve it. Check if you can here   .

-> Well if you are a java expert which you i hope you are , all you need to do is add  this dependecy in your project build file and use the Annotation

@SupressFBWarnings(value = "bug-code") -- well value is an array so you can send in a string array .

OR

if you are not using a build automation framework like ant , maven or gradle , all you need to do is download the annotations.jar from  - here and include it in your project library.

Well there you go and you have succeeded in suppressing findBugs warnings and your build has not failed at this point .

Happy Coding

-@nmol

Saturday, June 13, 2015

Java Virtual Machine Analysis and Debugging

Hello Folks whoever is reading this i am sharing my experience of Performance Testing i was involved in , in one of my projects in my company.

-->  Load Testing the API's written for a business model on top of a nosql graph database OrientDB . We used an open source XA transaction manager JCA adapter deployed on the Oracle weblogic server 12.1.3 . The API's were deployed as a restful web-service on the same application server as the adapter .

Client Tools used -
-> SoapUI
-> Jmeter

SoapUI and Jmeter are the best two tools i felt to fire http requests to the rest webservice , one can select the number of concurrent users / threads hitting the web service , in Jmeter and can loop such requests multiple times or forever . However SOAPUI provides the flexibility to send n number of concurrent clients and also fix the time for which the client will fire requests , also providing the lag between every next request .

Learn Jmeter @ JMeter Tutorial

However i often saw the JVM getting on slower and slower as the requests came , hence needed to get the Thread Dump periodically and analyze the thread dump , used few tools for this .

-> Jstack : This tool was used to get the thread dump , this tool can be found inside bin directory of jdk installation directory.

-> Samurai : This tool takes the thread dump and gives a gui representation of running , blocked and deadlocked threads. This tool will be helpful to analyze the threads that are going into blocked state slowing down the CPU and the JVM.

Further we found in the performance tab under Monitoring section under managed servers section of Oracle Weblogic server , that free heap percentage is growing lesser and lesser as the application serves the client requests .

-> Jmap : This tool was used to get a heap dump as and when we needed , whenever the free heap percentage went down and down. These tests were carried out on a 2GB heap so @ 5% free heap the HeapDump size came out to be 3.7G + .

Now how to analyse this heap dump , so there are a lot of tools to do that .

-> VisualVM : This is the best and free tool to anaylze the heap dump and will tell you the number of instances of each of the Objects with existing references and will also tell where the references are coming from.

-> Jprofiler : Jprofiler is not free but allows a 10 day free trial , again a great tool to analyze heap dump , provides the same details as above. However loads the entire heap initially , little slower than VisualVM.

-> MAT : Memory analyzer tool is an eclipse project , another alternative for heap dump analysis , however personally i didn't like this tool , much slower than the above two , but still worth a try.

-> Jhat : Jhat is again a tool provided in the bin directory of the jdk installation directory , its the oracle's provided tool to analyze heap dump . This will load the heap data as html and can be accessed on localhost port 7000 . A  very simple tool to use and provides the same data as Visual JM and Jprofiler.

This was all about thread dump and analysis and heap dump and analysis .

Finally we found the objects that were not garbage collected and accordingly modified the JCA adapter code to use the OrientGraphFactory and calling the getTx() method instead of manually creating OrientGraph objects which were never getting garbage collected.

Thursday, June 11, 2015

My First Blog

Dear Blogspot ,

Its 12:40 am at midnight on Thursday June 11 , 2015 when i get to write my first blog , well this is hardly a blog but an introduction to blogger.com . Hmmm how did i think of writing , well first of all i like traveling and i have traveled a lot so i thought why not write about my travel , the roads i have taken , the journey , the treks , the forests,  the company of friends and sometimes even strangers who become good friends, the memories created etc .

Also i wish to write technical blogs , things i learnt ,  technologies i have used and worked on , so i started actually using the blogger i created back in 2009.

Now this is my first blog so , not putting down a lot of stuff here . By the way i never introduced myself , I am Anmol Deep , born and brought up in small town Sarwal in the beautiful city of Jammu (J & K) . I am a Software Engineer by profession and have been working for 3 years in Bangalore . It will be seven years this September in Bangalore .

Following is the link to my fB profile , wish to meet new interesting people and learn
from a lot of people.


Facebook

and following is my linkedIn profile if you wish to hire me someday in your company , ahh i would love to join the best industry in market.

 LinkedIn

I think its time to sleep with the pc clock @ 12:50 AM asking me to crash as tomorrow is going to be a long day .

I hope you get to read many interesting blogs about my travel , my road trips , my journey , my life .

-@nmol