Posts

Showing posts from April, 2013

To increase the size of heap memory for a Netbeans project

To increase the size of heap memory for a Netbeans project, do the following: 1. Change -Xms,  -Xmx, -XX:PermSize,to the desired memory size e.g :   -J-Xms512m -J-Xmx2G -J-XX:PermSize=2G -Xms defines the minimum size and Xmx the maximum.  These options are saved in the netbeans.conf file To find the file on a mac, go to Application/Netbeans/Netbeans7.3 right click and choose show Package Content and then go to: Contents/Resources/Netbeans/etc/netbeans.conf 2. Also add the same options in the Project Properties file of the Nebeans Project as well as in Netbeans Platform Config file. ( located in Important files folder of the project)   run.args.extra=-J-d64 -J-Xms512m -J-Xmx2G This file can found in the Important Files folder of the Netbeans project. This increases the memory for the Netbeans project also and not only for the Netbeans platform.

To Define Mode for Non-Sigleton Windows/TopComponent

To Define Mode for Non-Sigleton Windows/TopComponent, add the desired mode in the Topcomponent's open() function. @Override     public void open() {         Mode mode = WindowManager.getDefault().findMode("rightSlidingSide");         if (mode != null) {             mode.dockInto(this);             super.open();         }     }

To Make Window groups for Non Sigleton Windows

To Make Window groups for Non Sigleton Windows, choose one window as the main window,,i.e., that is the second window can be opened and closed only when first one is present. For example, in my case I have two singleton windows ( as have been described in a different post How to make Singleton windows) or two TopComponents, AlignmentFilterOption and AlignmentView. Here, I have choosen AlignmentFilterOption a my main window. Now in the AlignmentFilterOption TopComponent, (main window) make following changes: 1. make a private TopComponent object and define it as AlignmentView in the constructor private TopComponent tc; tc = new AlignmentView(this.ado.getAlignment()); 2.  In componentOpened() function, add AlignmentView object, so that whenever AlignmentFilterOption window is opened, AlignmentView widnow also opens. @Override     public void componentOpened() {                 if (tc != null) {             tc.open();        }     } 3. In componentClosed() function add tc.c

Printing of large double values in JAVA with or without scientific notation

Option 1:  Double d= 0.0007 ; System.out.println(d ); System.out.println(double d) Prints a long and then terminate the line. This method behaves as though it invokes print(long) and then println() . print(double d)  Prints a double-precision floating-point number. The string produced by String.valueOf(double) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method. So System.out.println(double d) changes double value to String. So 0.0007 becomes 7.0E-4. Option 2: Double d= 0.000000007; System.out.println(BigDecimal.valueOf(d) ); If you use System.out.println( BigDecimal.valueOf(d)), Translates a double into a BigDecimal , using the double 's canonical string representation provided by the Double.toString(double) method.  So 0.0007 is printed as 0.00070 but if the double number value is large like,  d= 0.000000007 then its becomes 7.0E-9 agai

Adding/Updating Java projects from existing sources to Netbeans Project

Task :  To update Java projects from existing sources to Netbeans Project Solution : Once you have an updated Java Project, you need to change it also in the Netbeans projects which have dependency on it. So First remove the java project from the sources of Java Project in the Netbeans Platform. Then download the updated version of the java project (e.g, from CVS) and then again add it to the sources of java project of Netbeans. Now, remove/delete the old jar for the java project, to remove the dependency on the old jar. Build and clean the java project as well as the whole netbeans project and again in the nebeans module, add the dependency on the new java project jar. Steps in detail: => Make all the changes in your Java Project and Save it. => right click on the Java Project and go to Properties. => Go to Sources, check the source in which you just made the changes and Remove it.    Click OK => Now go to the folder where it stored and delete it => Delet

on a lazy weekend!!

Image
On one of these lazy weekend, when every other person is busy in their own mundane life, me sitting alone and thinking what to do, suddenly i go back into introspection, and think of things i need to improve.... think of what i was and what i am... and how to be a better person to prove...