Friday, October 18, 2013

Understanding 32-bit vs. 64-bit systems with Java Heap

Eclipse Mac OS: Hyperlinks are not working in welcome page

Have you ever come across the issue, where hyperlinks is not working in Mac OS Eclipse but it works in Windows OS.

We had faced this issue with the welcome page, where hyper links are not working. The reason was, href links with target=”_blank” is causing the issue.

We couldn't see any other solution other than removing it.


To understand about target attribute in html @ http://www.w3schools.com/tags/att_a_target.asp

Similar thread on the same topic @  https://code.google.com/p/android/issues/detail?id=41109

Thursday, October 17, 2013

SAP Transaction codes

You can find all transaction codes @ http://www.tcodesearch.com/


SE37 - ABAP Function Modules
SE16 - Data Browser(Table search)
SE11 - ABAP Dictionary Maintenance

GIT: Finding a commit based on SHA1 ID

> git show <sha1-id>

Example: > git show e43db49

This will display the complete changes including the with commit message.

Adding a new menu item in Eclipse Help Menu

As shown in the image below, if you want to add 'Tutorials' menu item in the Help Menu in Eclipse.




Adding command extension:

      <command
            defaultHandler="com.kk.help.TutorialsHelpHandler"
            id="com.kk.command.tutorialshelp"
            name="Tutorials">
      </command>


Adding menu extension:

 <menuContribution
            allPopups="false"
            locationURI="menu:help?after=intro">
         <separator
               name="slot1"
               visible="true">
         </separator>
         <command
               commandId="com.kk.command.tutorialshelp"
               label="Tutorials"
               style="push">
         </command>
         <separator
               name="slot2"
               visible="true">
         </separator>
      </menuContribution>


Handler implementation:

public class TutorialsHelpHandler extends AbstractHandler implements IHandler{

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
//implemention here

retun null;

}
}

Launching a URL in external browser from an eclipse plugin

public class HelpHandler extends AbstractHandler implements IHandler{


public static final String HELP_LIBRARY = "http:/kk.com/KKLibrary/";

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

try {
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(HELP_LIBRARY ));
} catch (PartInitException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
}
return null;
}
}

Tuesday, October 15, 2013

toArray Dynamic behaviour

public class ToArrayTest {

public static void main(String[] args) {

ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("1");
arrayList.add("2");
arrayList.add("3");
arrayList.add("4");

//what happens here??, since I have allocated new String[0] for single element, will it return single element or all elements ??
String[] array = arrayList.toArray(new String[0]); 
System.out.println(array.length);

}
}


Output:  4


As per spec, it's going to create a new array, if it does not fit in.
Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array. If the list fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this list.