Search This Blog

Tuesday 21 June 2016

How to start eclipse with different version of Java?

After Installing required JRE if you require to upgrade Eclipse version then kindly follow following step to upgrade eclipse java version:

You can add the -vm option to eclipse.ini:
-vm
c:/<path>/java/<javaName>/bin/javaw.exe
path : directory where Java is installed
javaName:Name of JDK/JRE installed.
 After updating eclipse.ini file, eclipse.ini file may look like this :
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m

Thursday 18 February 2016

Split String at Space ,Except if it is not in double qoutes


Split String at Space ,Except if it is not in double qoutes


 public class Main {
    public static void main(String[] args) {
        String str= "abc \"peter micheal\" Jean \"Patrick David\" Richards";
        String[] tempArr = str.split("[ ]+(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
       for(String string : tempArr) {
         System.out.println(string);
      }
  }
}

You can use online java compiler such as THIS to verify usability.
This will help you to avoid chances of using wrong solution and save your time.

Output: 

abc
"peter micheal"
Jean
"Patrick David"
Richards

Monday 8 February 2016

Set Focus on any table row in javascript

                     Set Focus on any table row in javascript


To set focus on any specific row we will require row id ,HTML : 


<div id="one"><table border='1' id='tableDiv1'><tr><td>row1</td><td>Test1</td></tr><tr><td>row1</td><td>Test1Test1</td></tr><tr><td>row1row1</td><td>Test1Test1</td></tr><tr><td>Selected Row</td>Selected Td<td></td></tr><tr><td>row1</td><td>Test1Test1trgTest1</td></tr><tr><td>row1row1</td><td>Test1Test1Test1Test1</td></tr><tr><td>row1row1</td><td>Test1Tertgrgrst1Test1Test1</td></tr><tr><td>fdetgregtt</td><td>Test1Test1Test1Test1</td></tr><tr><td>rtgrgr</td><td></td>Test1tyhegergr</tr><tr><td>grgrgr</td><td></td>TestTAble</tr><tr><td>gregerg</td><td>Test1Test1Test1Test1</td></tr>
</table></div>

If  you want to select 4th row then put index number 4 in table row row[] array
$(document).ready(function(){
var row = document.getElementById("tableDiv1").rows;
row[4].scrollIntoView(false);
});

Or from any other method  

function selectRow(){
       var row = document.getElementById("tableDiv1").rows;
            row[4].scrollIntoView(false);
}