Posts

Multi Threading , Producer consumer problem in Java

Multi threading is topic which is always fascinating for java developer. I feel its more about practical the theory. So here i wanted to present sample examples which clear understanding for several multi threading concept.

In Theory basically thread which is light weight process.Thread shares mostly same memory space.
I said mostly because there is some space called thread local which is not common to threads & separate for each thread. We create thread whenever we wanted to use multicore of processor although that doesn't mean single core cant use it. In single core context switching works among different running thread.

for example suppose there is website which is showing latest price as well as offer as well as doing order booking all these things can be assigned to different thread to provide parallel processing.



There are 2 ways for creating a thread.

Extend a thread & Implement a Runnable class. Extending a class is little avoided since it closed possibility for e…

Mavan Step By Step & Java Portable set up

**********Portable Java Set up**********
Just paste below content in some bat file.Open any command prompt & call this JavaSetup.bat & then you will good to go for calling java -version.
rem Set the JAVA_HOME environment variable and insert it into the system path.
rem This will make the javac and java commands reachable from the command line.
set JAVA_HOME="E:\Java"
set PATH=%JAVA_HOME%\bin;%PATH%

                                                     *************Maven Setup****************

Download maven binary & set JAVA & MAVEN_HOME
set JAVA_HOME="E:\Java"
set PATH=%JAVA_HOME%\bin;%PATH%
Set MAVEN_HOME="E:\apache-maven-3.3.9"
Set PATH=%MAVEN_HOME%\bin;%PATH%
After setting above in batch file (if temporary required) or in system/user variables check mvn -v for verification & it should display java & maven details.
Then Run mvn: generate command like 
mvn archetype:generate -Dgroup…

Portable Java 8/ JDK8 setup without admin rights

Some time we got machine to work where we don't have access rights to install anything or if you do not want to install. You can get latest jdk running by this trick. Just follow step step & do comment if you like it.

Step by Step details to get running java from .exe setup without any admin rights. Get portable 7 zip from portableapps.comdownload java 8 from oracle  http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlopen 7 zip & extract jdk-8u102-windows-x64.exeyou will see below folders                .data                .pdata                .rdata                .reloc                .rsrc                .text                CERTIFICATE

          5.Go inside E:\jdk-8u102-windows-x64\.rsrc\1033\JAVA_CAB10you will find 111 file.

         6.extract it it some folder where you can find tools.zip again extract that to some folder say Java & copy it to very first folder of setup along with .data,.rsrc etc.
         7.Go to folder where you have co…

Project Estimation Technique

There are several estimation technique which differs based on project to project.
Some of the technique are:
1.    Expert Suggestion 2.    Historical Data 3.    Function Points 4.    Story Points
5.    Lines of Code 6.    COCOMO 7.    Use Case Points 8.    Wideband delphi 9.    Test case point  10.  Parkinson Law 


Expert Suggestion This is mos widely used technique.In this estimation technique, you have to rely on his expert experience.Based on his domain and technical capabilities he estimates things for multiple iterations until reached on some consensus.
Historical Data Based on data available for similar project which has been delivered earlier.You have to compare if somewhat similar project has been completed earlier, approximately same amount of estimate will be for this project as well.
Function Points In this Estimate technique we take multiple factors for deciding estimation.
Input Output Internal Queries External Queries

based on no of input, output, enquiries, reading/writing…

Things to check while Code Review in Java

Code review is important part of any application. Some time we avoid doing it due to time constraints or lack of resource availability but if we do it in practice it pays off very well in terms of quality & maintainability of code.
    We have to look for couple of things while code review & i will try to explain most of them here.
Functionality This is most important part in code review that code is functional as required. Requirement is completely addressed by code or not.
Logging & readability Code should be readable. It should be formatted properly like indentations & space should be proper and as matches as per set convention.proper comment should in place to understand code as well as for debugging perspective.
Naming & other java as well client as Standards you should follow naming standards as prescribed in java.Apart from industry standards we should take care of client coding standards if there are any.
Performance Performance checking is difficult to measur…

JDK 4, 5, 6, 7, 8, 9 version features

Different Java version features (jdk 1.4 to 1.9)



Java 4 Assertion , NIO
Java 5  For-each loop, Varargs, Static Import, Autoboxing and Unboxing, Enum, Covariant Return Type, Annotation, Generics
Java 6 New collection interfaces includes Deque,NavigableSet,NavigableMap, JAXP, jdbc enhancement (driver auto loading, support for row id sql type, annotation based sql query)  
Java 7 Type inference, String in switch, try with resource, fork join framework, underscore in numeric literals, multiple exception in single catch block, java nio package, more precise re throw of exception
Java 8 
Lambda expressions,Functional interfaces,Functional Programming,Method references,Default methods,Stream API,Optional
Java 9 (March- 2017 launch) Java Module System, JShell

Start with Internet of things - IOT for java

What exactly Internet of things (IOT) is & its awesome uses
Its been now a talk of town for a while. now a days all around we are listing term IOT which feels like a science fiction movie. Hold on now its no more science fiction as we already in era where we are have so many things which were earlier science fiction but now available to common people like reaching to different planets or could be finger print & eye scanner.
     So Internet of things a.k.a IOT is basically a network of things or object which could be a car or a house or an AC or a fridge or an oven or heater or house door or could be any gadget which has embedded chip or circuit or sensors. These IOT connected device can exchange data from each other or you can say talk to each other communicate to each other.Application of these of network could be very useful & fascinating at same time.
     As per Gartner will be nearly 20.8 billion devices on the internet of things by 2020. one research says more than …