Issue time04:59:33 pm, by Trefex309 views
Categories: Welcome

Hey,

Something all of you experienced is that some CHM Help Files don't seem to work correctly sometimes. You do see the Table of Contents of the help file, but the content window just tells you "Page cannot be displayed".

If you use Network storage, like at work, at school or even at home with the new network storage devices then I know what to tell you, simply don't use it to store your CHM ebooks.

It seems that when a CHM file is opened from a network location then it cannot be read. If you copy it to your local hard drive and try to open it, you will see that it works fine.

While this tip is short and simple it might save you a lot of headache. It can also save you 10 years of your life if you don't have the frustration to figure out why all damn CHM files don't seem to work on your machine :)

Hope this helps you out,

Cheers,

Issue time10:43:30 pm, by Trefex219 views
Categories: Welcome

Hi,

So you have been driving yourself crazy looking over the Internet on how to do those bloody conversions from a

double

to a

byte[]

array using << or <<< and god knows what else in Java?

Well you have come to the right place.

This function takes a double as argument and converts it to an 8-Byte array in Big Endian format. Alternatively, you can use the Little Endian format by uncommenting the 2nd line. For more information on Endianess you can check http://en.wikipedia.org/wiki/Endianness

public static byte[] doubleToByteArray(double valToConv) {
  ByteBuffer bb = ByteBuffer.allocate(8);
  //bb.order(ByteOrder.LITTLE_ENDIAN);
  bb.putDouble(valToConv);
  bb.flip();
  byte[] bbb= new byte[8];
  bb.get(bbb, 0, 8);
  return bbb;
}

This method takes an 8-Byte Array in Big Endian and transforms it back to a Double.

public static double byteArrayToDouble(byte[] arrayToConv) {
  ByteBuffer bb = ByteBuffer.allocate(byteArrayToConv.length);
  //bb.order(ByteOrder.LITTLE_ENDIAN);
  bb.put(byteArrayToConv);
  bb.flip();
  return bb.getDouble();
}

As a final note, if you look at the Java API you will find many more methods in the ByteBuffer Class to handle conversions to Byte Arrays, like from Int, Long, etc...

Enjoy,

Issue time03:59:38 pm, by Trefex479 views
Categories: Welcome

Have you wondered: Why does Java hate us so much? Why do they not allow us to do a switch statement on a String?

Well maybe this little "workaround" can help you in your tasks.

In 1.5, Java introduced a new type called Enum. With this type you can "simulate" a switch as if it were on Strings.

public enum MyEnum {
 SUNNY,
 RAINY,
}

Once you have this, you can simply do a switch.

switch(MyEnum.valueOf(myString)) {
 case SUNNY: // The Weather is good
   break;
 case RAINY: // The Weather sucks
   break;
 default: // No Weather Info
   break;
}
 

So here you go.

Cheers,

Issue time07:53:05 pm, by Trefex85 views
Categories: News

If you are a web developer, you usually want to create nice looking menus. Until know, you did this using JavaScript. The Scripts are usually heavy, use up alot of ressources and are not easily portable. Also, if you disable JS on your machine, the website doesn't work anymore.

While looking how to create drop-down menus, I came across this awesome FREE CSS Menu Builder. In a couple of minutes you can create your fully featured multi-level pure CSS Menu, where you can define anything from the Offsets, the Colors and many other things.

It is definitely worth a look !!

http://www.cssplay.co.uk/menus/menu_builder_flyout.html

Enjoy !!

Issue time10:39:14 am, by Trefex39 views
Categories: News

What happens when you insall JVM 1.5 and 1.6? or 1.4 and 1.5?

Java sets a JAVA_HOME environmental variable in your system, but what if you don't want the "active" JVM to always be the latest installed? Well, you will find the solution here !

First of all, let me explain to you what seems to happen in the latest version of the Java Installer. It seems that, Java is also installing itself into the %WINDOWS%\System32 folder and thus overwrites the ugly Microsoft Java that usually causes unexpected behaviour in other programs. This is a good thing you say, but now, when you try to change the path content of the JAVA_HOME variable to put the "active" JVM to another version, why does it not change as it should? (See Figure Above)

The reason is simple. This what part of your PATH environmental variable could look like. %SystemRoot%\system32;%SystemRoot%;%JAVA_HOME%;

The problem with this is that Windows searches through all the pathes for a java.exe until it finds one. And it stops at the first it finds. You already see the problem? Regardless of what you put in JAVA_HOME, Windows will ALWAYS stop looking for a java.exe file right after %SystemRoot%\system32.

If however, you put %JAVA_HOME% before %SystemRoot%\system32 the problem is fixed!! So now, your PATH should contain amongst others these elements in THIS order.

%JAVA_HOME%;%SystemRoot%\system32;%SystemRoot%;

From now on, you can just switch the active JVM's by simply changing the JAVA_HOME env variable !!

Leave your comments and thoughts please.

Cheers,

July 2009
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Search

The requested Blog doesn't exist any more!

XML Feeds

Put your credits or banners here.

You can change or delete this text in /_sidebar_credits.inc.php
Powered by b2evolution