- my webspace

- my webspace

Latest Comment

Why I must believe in GOD
Testing time is almost passed..there are many colours in lif...
27/06/12 01:43 More...
By Tarun Shekhawat

Allama Iqbal - Selective verse...
Yahoouj
Really good work about this website was done. Keep trying mo...
07/03/10 15:04 More...
By Roderick

Allama Iqbal - Selective verse...
Great Job
You have dont a great job of collecting these... Even I had ...
25/08/09 01:01 More...
By Sikandar

O ye who don't believe !
It's like Lehman Brothers :grin
11/10/08 10:31 More...
By anurag Chaturvedi

I Protest
@Sikku
Thanks Sikku for the feedback. I never intend to blame, a...
29/07/08 11:06 More...
By Aminur Rashid

Login






Lost Password?
Home arrow Java
Java hangs converting 2-2250738585072012e-308 PDF Print E-mail
User Rating: / 0
Written by Aminur Rashid   
Saturday, 12 February 2011
As explained @exploringbinary.com, try following code
 public class DoubleBug {
      private static void hangRunTime()
      {
          System.out.println("Test:");
          double d = Double.parseDouble("2.2250738585072012e-308");
          System.out.println("Value: " + d);
      }
      public static void hangCompiler()
      {
          //double d = 2.2250738585072012e-308;
          //System.out.println("Value: " + d);
      }
      public static void main(String args[])
      {
         hangRunTime();
      }
}
to get your runtime hanged. Oracle has already released a patch for this and quite interestingly the fix for this was just one keyword addition. Get your jre patched. BTW, this is a PHP bug as well. So in the meantime, you can try bringing down your own website, by sending the String (assuming the server does a double conversion)

Be first to comment this article
StumbleUponDigg This!Bookmark on Delicious

Add as favourites (386) | Quote this article on your site | Views: 2332 | E-mail

Last Updated ( Saturday, 12 February 2011 )
 
Quick logger PDF Print E-mail
User Rating: / 2
Written by Aminur Rashid   
Saturday, 14 August 2010
.

Post JDK1.5 you can create a quick logger(if you are not using apache log4j for some reason)as below:

 public Logger {
    public static void log(String msg) {
        System.out.printf("%s : %s",Thread.currentThread().getStackTrace() [2],msg);
    }
}

.

Be first to comment this article
StumbleUponDigg This!Bookmark on Delicious

Add as favourites (458) | Quote this article on your site | Views: 2140 | E-mail

Last Updated ( Saturday, 14 August 2010 )
 
When false is true PDF Print E-mail
User Rating: / 1
Written by Aminur Rashid   
Thursday, 12 August 2010
.

While trying to explain reflection to one my young friend, I finally ended up writing this code:

package aminur.test.mutate;

import java.lang.reflect.Field;

public class MutableString {

	public static void main(String[] argv) {
		mutate();
		System.out.println("TRUE".equals("FALSE"));
	}

	public static void mutate() {
		try {
			String t = "TRUE";
			String f = "FALSE";
			Field val = String.class.getDeclaredField("value");
			Field count = String.class.getDeclaredField("count");
			Field off = String.class.getDeclaredField("offset");
			val.setAccessible(true);
			count.setAccessible(true);
			off.setAccessible(true);
			

			count.set(t, f.length());
			val.set(t, f.toCharArray());
			off.set(f, off.getInt(f));
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}

This won't work in 1.3/.4 but will work in higher/lower version of JDK

The bug #5044412 fix(?) may disallow setting of value of fields.

Be first to comment this article
StumbleUponDigg This!Bookmark on Delicious

Add as favourites (407) | Quote this article on your site | Views: 1979 | E-mail

Last Updated ( Thursday, 12 August 2010 )
 
Jdeveloper extension for JavaFX - II PDF Print E-mail
User Rating: / 0
Written by Aminur Rashid   
Thursday, 25 February 2010


In the last JDeveloper extension for JFX I used the initial release of JavaFX. The support for compiling a javafx file was missing in the extension. Moreover, the extension didn't make use of the JavaFX SDK.

I have finally upgraded the extension, to use the JavaFX SDK. With this, we no longer need to add the ".fx" extension to the list of files to be copied to classpath during compilation.

The extension works on the assumption that an entry in environment PATH is set, which points to <JAVAFX_SDK_HOME>\bin folder.

There is no Drag and Drop support yet. And of course there will be bugs which you can point out or fix.

To use the new extension, please remove the old extension jar from jdev_home\jdev\extension folder and add the new jar oracle.jdeveloper.javafx2.jar to folder. Restart Jdeveloper. [Once more, please do not forget to add <JAVAFX_SDK_HOME>\bin to your system PATH variable].

You can download the JavaFX SDK from javafx website.

Be first to comment this article
StumbleUponDigg This!Bookmark on Delicious

Add as favourites (468) | Quote this article on your site | Views: 2746 | E-mail

Last Updated ( Thursday, 25 February 2010 )
Read more...
 
Jdeveloper extension for JavaFX PDF Print E-mail
User Rating: / 0
Written by Aminur Rashid   
Saturday, 20 February 2010


JavaFX is an expressive rich client platform for creating and delivering rich Internet experiences. More on JavaFX can be found at http://javafx.com/.

JavaFX was the Official Rich Client Technology for the 2010 Winter Games. [http://www.oracle.com/us/corporate/press/049166]. I forsee the technology getting a push from Oracle specially after the Sun-Oracle merger. Infact I have read somewhere that JavaFX will be same to java Swing, what JSF was to Struts.

And it was surprising to find there is no support in JDeveloper currently for JavaFX. (Offcourse now with Sun deal, Netbean with JavaFX support goes to Oracle but still for the lovers of Jdev its missing.)

 

Be first to comment this article
StumbleUponDigg This!Bookmark on Delicious

Add as favourites (497) | Quote this article on your site | Views: 4200 | E-mail

Last Updated ( Saturday, 20 February 2010 )
Read more...
 
<< Start < Prev 1 2 3 Next > End >>

Results 10 - 18 of 20
Aminur Rashid