I would like to suggest you to "LIKE" this new "TechieHub" page if you really like my idea. Here is a link. Click Here
Arpit Agarwal's Blog
java | swings | performance | netbeans | programming | coding | operating systems | profiling
Saturday, December 17, 2011
I would like to suggest you to "LIKE" this new "TechieHub" page if you really like my idea. Here is a link. Click Here
Wednesday, August 11, 2010
JavaFX - Special data types and data holders!
def mil = 25ms;
def sec = 25s;
def min = 25m;
def hrs = 25h;
Also notice the time literals used in this example. Appending ms, s, m or h to a value creates an object of type Duration. Not only this, you can also apply arithmatic operations on Duration data types. Cool ... isn't it!
The second feature that is extremely useful is a special collection of objects named Sequences. Peek into the example below:
def seq1:String[] = ["A", "B", "C"];
def seq2 = [1 .. 100];
Don't they look like arrays. Yes they do, but look at the second line, this is special feature in a Sequence. Here seq2 automatically gets assigned the values from 1 to 100 i.e the size of sequence becomes 100. You can also use the following:
def seq3 = [0 .. 100 step 10];
This would assign values 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 to seq3. Not only this, you can do Sequence manipulation as well i.e. you can always perform insert, delete and reverse operations on a sequence. But you must understand that although you can perform such operations but still a sequence is immutable and any such operation would result in creation of a new sequence. Look a the eg. below:
var seq1= [1 .. 5];
insert 6 into seq1;
insert 0 before seq1[0];
This would result in a sequence with values 0, 1, 2, 3, 4, 5, 6. Similary you can delete from a sequence as well. Isn't it much more powerful than an Array!
Tuesday, August 10, 2010
JavaFX - New ways to declare a variable!
var canAssign: Integer = 10;To sum up, you can declare a variable using a keyword var and second option is to use a keyword def. In case you use var keyword to declare a variable, you are creating a reassignable variable. In case you opt in for def keyword, you are creating an initialize-only variable.
def cannotAssign: Integer = 10;
canAssign = 20; // will work fine
cannotAssign = 20; // will result in compiler error
However, it must be noted here that although a def variable cannot be reassigned but the object it references can definately mutate i.e. change its contents. Therefore a def variable may be assumed as an immutable type.
Isn't it interesting!
Sunday, August 8, 2010
NetBeans JavaFX Composer - A threat to Adobe FlexBuilder!
Last night, I was playing with this new tool in the block and I must appreciate the efforts of NetBeans team. They are bang on target with this excellent tool. It makes coding in JavaFX a breeze. Most of times you need not code anything, about 90% of the tasks are done by mere drag and drop.
So Adobe and Microsoft get ready to face a stiff competition from Oracle with this new JavaFX composer. I must say... I am impressed! Just remain tuned in for more action.
Friday, August 6, 2010
JavaFX - Rich UI Applications!
If you remember, it was Java which first introduced the concept of RIAs in form of an Applet, but with time it became old and mature. And then Flash and AJAX begin dominating Java Applet. It would not be wrong to say that Java was completely wiped off from the RIA arena. But now with JavaFX it has really made a comeback.
Oracle is not only doing a great job in creating JavaFX but it is also trying to create solid tools that would enable the developers to quickly create a JavaFX application. If you don't believe me, check out the latest version of NetBeans 6.9. NetBeans 6.9 has an excellent JavaFX composer tool to start creating JavaFX applications by mere drag and drop stuff and its really really powerful.
I will be soon coming up with a tutorial on how to startup with JavaFX using NetBeans 6.9 JavaFX composer. Until then... Good Bye!
Thursday, April 29, 2010
Here comes one more Java puzzle for you...
Sunday, February 21, 2010
Performance driven iteration of an ArrayList - Iterator or Traditional for loop?
public static void main(String args[]){ArrayList arrayList = new ArrayList();//populating list with elementsfor(int i=0; i<1000000; i++){arrayList.add(i);}
// using traditional for looplong startTime = System.currentTimeMillis();for(int i=0; i<1000000; i++){arrayList.get(i);}System.out.println("Time taken in traditional for loop:"+(System.currentTimeMillis()-startTime));
// using traditional for loop with iteratorstartTime = System.currentTimeMillis();for(Iterator i = arrayList.iterator(); i.hasNext();){i.next();}System.out.println("Time taken in Iterator loop:"+(System.currentTimeMillis()-startTime));}
Wednesday, February 17, 2010
Is it a Bug or simply a Java Puzzle?
Thursday, January 21, 2010
Profiling Java Applications
OutOfMemoryErrors or render poor performance over time. JVMPI
Profiling tools that utilized JVMPI had to implement the function call interface and register for various events in order to get various VM memory stats. When a registered event occurred, the application's VM captured a memory snapshot by querying the object hierarchy. This was very time consuming and it interfered with the running application. Also, when the profiling tool registered all the exposed events, it slowed down the VM considerably. As a result, many vendors stayed away from developing profiling tools with this interface.
JVMTI
JVMTI is a two-way (query and control) interface. A client of JVMTI can be notified of interesting occurrences through events. Using JVMTI, profilers can query and control the application through many functions. The native in-process interface allows maximal control with minimal intrusion from the tool.
So what are you waiting for, if you are facing any kind of memory related issues in your Java application, NetBeans profiler is there to help you out.
Friday, September 18, 2009
Free alternative to FlexBuilder in 10 easy steps!
1. To download the FlexBean plugin, click here.
2. Once downloaded, please start NetBeans IDE and click Tools >> Plugins
3. Now in “Plugins” dialog box select “Downloaded” Tab and click “Add Plugins…” button.
4. From “Add Plugins…” dialog please browse to the directory where you downloaded the flex bean plugin file and select it. Finally, click “Open” button to add the plugin to plugin list.

5. Now click “Install” button with FlexBean selected and you will be presented with a FlexBean installation wizard.
6. Click Next, accept the agreement, and finally click install to install the plugin in NetBeans.
7. Click finish and then close all the dialogs to return to NetBeans workbench.

8. To configure FlexBean plugin properly, it needs to know the location where the Flex SDK has been extracted. Click Tools >> Flex Platform.
9. From “Flex Platforms” dialog select "Add Platform…” Button and select the folder where you have extracted Flex SDK and click Next.
10. Finally, write a name of the platform in the next dialog and click Finish.
This is all you need to do in order to make the NetBeans IDE ready for Flex editing.
Next, I will be creating our first flex application and get our hands wet with some real water. Stay tuned!