Posts

Showing posts from 2013

Create New File Type resolver and associate the data type in Netbeans

1. make a new xml Document ( eg, PdbResolver) 2.choose DTD Constrained Documenton the second page of the new Xml Document wizard 3. On third page, in the DTD Public Id, choose, -//NetBeans//DTD MIME Resolver 1.0//EN,  from the drop down menu 4. save it 5. make a new java file , call it as DataObject ( eg: PdbDataObject), write ur code... 6. save it, and add  @MIMEResolver.Registration(displayName = "PdbResolver", resource = "/alifea/gui/PdbResolver.xml") for registering the mime tyoe to the data object file 7. In the layer file add                 <folder name="x-pdb">  <folder name="Factories">                     <file name="PdbDataLoader.instance">                         <attr name="dataObjectClass" stringvalue="alifea.gui.filesystem.PdbDataObject"/>                         <attr name="instanceCreate" methodvalue="org.openide.loaders.DataLoaderPool.f

Understanding Bayesian Belief Networks, and their Inference

Amazing lecture series from IIT Kharagpur for understanding Bayesian Networks, Bayesian Belief Networks, and their Inference. http://www.youtube.com/watch?v=P1b9Y4aacOE&list=PLAED5C0CF1D9BA622

Create a Floating/Undocked Non-sigleton Window in Netbeans

first of all some really useful links on this topic: http://netbeans.dzone.com/news/secrets-netbeans-window-system https://blogs.oracle.com/geertjan/entry/case_study_customizing_the_netbeans http://forums.netbeans.org/ptopic15413.html To create a TopComponent which is undocked by default, one need to define an undock (or floating ) mode. To do so, create a new XML file and call it "newModeUnDock.xml" Wriet following in the file: <?xml version="1.0" encoding="UTF-8"?> <mode version="2.3">     <name unique="newModeUnDock" />     <kind type="editor" />     <state type="separated" />     <constraints>         <path orientation="vertical" number="0" weight="0.5"/>         <path orientation="horizontal" number="1" weight="0.5"/>     </constraints>     <bounds x="312" y=&qu

to make custom configuration file for distributed netbeans java project

followed the blog at : https://blogs.oracle.com/geertjan/entry/support_for_custom_configuration_files steps: 1. clean and build the project 2. package the project as Mac Os X Application. 3. copy the  project/build/launcher/etc/app.config file to a new file at project/nbproject/ and rename it as my.config. 4. Now, change/add the wanted arguments in a new my.config file. for example, add J-d64 -J-Xms512m -J-Xmx2G to the default_options in the new my.config file. and save it. 5. Add app.conf=nbproject/my.conf to the project.properties file. 6. clean and build the project and package as Mac Os X Application, again. 7. check the project/build/launcher/etc/app.config file. It will have the default options overridden .

add/ remove fast action by double clicking the project node

in layer.xml file <folder name="Analysis">                 <folder name="Actions">                       <folder name="PreferredAction"> add following : <file name="alifea-gui-actions-AddAnalysisAction.shadow">                         <attr name="originalFile" stringvalue="Actions/AddAnalysis/alifea-gui-actions-AddAnalysisAction.instance"/>                     </file> if you want to open the action by double clicking the project node and delete if you do not wnat that

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...