Posts

Powerful PERL Script for Large codes

Count lines of code in a C,C++,Java,perl,shell,html,VHDL,Verilog or Python file     #!/usr/bin/perl -0777 my @lines = (); my $numofifs = 1; my $commentstarted = 0; my $notacfile = 0; if($ARGV[0] !~ /\.[cCh]$/) {   $notacfile = 1; } while(<>) {      s/\/\*(.*?)\*\//cOmMeNt/gms;      s/<!--(.*?)-->/cOmMeNt/gms;      @tmp = split(/\n/);      for(@tmp) {      if (/cOmMeNt/) {                 unless(/cOmMeNt/ ) { $_ = $_ . "\n";                         push(@lines, $_); next;                  }                  else {                     if((/[\S]+[\s]*cOmMeNt/) || (/cOmMeNt[\s]*[\S]+/)) {         ...

Mostly occured Performance Issue in JAVA

Top 10 causes of performance issues in Java Cause #1 : The JVM spends  more time performing garbage collection  due to improper Garbage Collection (GC) configuration. E.g. Young generation being too small. Heap size is too small (use -Xmx). The application footprint is larger than the allocated heap size. Wrong use of libraries. For example, XML based report generation using DOM parser as opposed to StAX for large reports generated concurrently by multiple users.  Incorrectly creating and discarding objects without astutely reusing them with a flyweight design pattern or proper caching strategy. Other OS activities like swap space or networking activity during GC can make GC pauses last longer.  Any explicit  System.gc( )  from your application or third party modules. Run your JVM with GC options such as  -verbose:gc (print the GC logs)  -Xloggc: (comprehensive GC logging)  -XX:+PrintGCDetails (for more detailed output)...

Java Collection Tutorial

Java Collection Framework          The java collections are one of the core framework of java. The collections are most widely used by the programmers. This collections used to write more efficient and reusable codes , And also most of experienced interview questions are from the java collections only. What is Java Collections ? Benefits of Java Collections Java Collections Interfaces Collection Interface Iterator Interface Set Interface List Interface Queue Interface Dequeue Interface Map Interface ListIterator Interface SortedSet Interface SortedMap Interface Traversing Collections Java Collection Classes HashSet Class TreeSet Class ArrayList Class LinkedList Class HashMap Class TreeMap Class PriorityQueue Class Collections class Synchronized Wrappers Unmodifiable wrappers Thread Safe Collection Collections API Algorithms Sorting Shuffling Searching Composition Min and Max values Java 8 Collections API Features ...