doxygen => fu** javadoc

I am just looking at some tool for documenting a little C++ project I am doing. (A C++ wrapper for curl will be up shortly). And I had a look at doxgen. And it is brilliant. There is a little GUI tool called doxywizard that will generate the config file that you then can feed into doxygen. It is possible to create HTML, Latex, man, rtf and XML with little in line graphics and so on(Call graphs, Class diagrams, ...). I am loving it. Having used javadoc previously this is so much nicer and more configurable. And it can format the source code nicely so clicking on the function name can take you to the actual code, what I consider brilliant for open source projects. So have a look at it especially if you are using JavaDoc.

new Window manager

While camping edd and myself thought about window managers. Why can everyone cope with the Windows Xp windowing System but in the Nix world everyone has a huge problem with Gnome, Kde and so on. Maybe it was because you had to use the Windows one and in Nix you had the choice, so because you could choose you complained all the time but in Windows you just accepted the fact that you are stuck with this shit thing and get one with your work. So our idea was to use a non main stream windowing system for a month and see how we got on with it. The only condition was that it had to boot up in less than a second. Edd chose evilwm and I went for Enlightenment
Now, after two days I have set it up so I can work with it. Sourceforge being down has stopped me from adding a few final things but I am hoping that they are minor. But for now I am really liking it. It is about 10 times faster then xfce4 (what I was using before) and has lots of nice little features. I don't understand why Enlightenment is not bigger in the desktop market. In my eyes it is more advanced than xfce4. But I am only using it for 2 days now lets see.
Enlightenment pros:
  • Nice window move affect with transparency
  • Fast, Fast, Fast boot in under a second
  • Nice virtual desktop system.
  • Nice preview when minimised
  • Lost of little E-* applets you can start
  • Fairly easy to configure
Enlightenment cons:
  • gtk apps looked horrible at start had to modify a little bit
  • No nice icon panel (in e16) it is in e17 and looks really nice
  • Mouse clicks on desktop open all sorts of menus

UML 2.0 in a Nutshell


I bought this book on amazon because I have to do some revision on my UML. Over time I have sort of made up my own notation and as I have to write an exam now, I have to brush up the odd one or two things. At fist glance this book is a little thin (216 Pages) for a UML book but this is not because there is nothing good in it, this is because the author managed to get all the information needed in a few sentences that are very easy to understand. Reading one chapter not only explains the UML to you in a clear and easy way it also explains the underlying OO principles. A brilliant book if you just want to use UML and not get the 600 page official manual.

Open Solaris

After spending the day looking at opensolaris here some thoughts.
Ok so I got the DVD set opensolaris b57 today and as I have been using solaris at my uni and on my Ray 1, I thought I might give it a shot. So I fired up vmware and Installed the x64 developer edition. What I instantly didn't like was that it was doing stuff (I think) but was giving me no feedback. At boot for example it was just chundering away and at some stage something happened, same with dtlogin, and the rayserver hardly ever reboots. As I have been using Linux as my main Desktop for ages now, I am used to have some sort of idea what is taking so long. Then it couldn't install with 500Mb of memory, what I understand if you use Java as an installer but especially for old machines it is not too good, maybe a little text based installer like Red Hat used to do (or may still). If you don't have the configuration for a X window based install give me some easy dialogs. Further DHCP overwrites the /etc/hosts file so when I changed my hostname or nodename it stopped letting me log on to dtlogin. One more little thing is the ^H, what isn't really a problem because you can use bash but in xorgconfig I hat to stty. A note to the VMWare Guys, the vmware installer for Xorg doesn't work, the resolution is set wrong. But if you use xconfig and use vmware(30) as a driver it works fine. Otherwise it is really making improvements and I am liking the changes. I just talked to a friend and he told me that in the non developer version loads has been done. I am sorry if I critsised stuff that has been fixed.

Rsync blessing or pain in the a**

I use rsync to backup all of my stuff to a separate hard drive once a week. Not just because Edd breaks a drive about every two days. This is quite nice because I have a image of that drive and if the one breaks I just slide in the backup one and finished. Further once it's copied all the files (first run) it only copies the changed ones every succeeding run. So how does it do this? Rsync takes creation time modified time size and I don't know what (if you don't tell it to use md5 -n) to compare the files. This is a nice way of doing it IF there wasn't this little thing of daylight saving time. So now the clocks have moved I have to copy every single file over because the file on the backup is one hour older than the original one. Of course this happens only once a Year and it is not that big a deal. But it could easily be changed so that rsync uses utc and not the computer time.

Jad the Java decompiler

I have been looking at how the Java class file is built and astonished how easy it is one great tool for decompiling java is jad. With knowing the JVM instructions you can really see what the java is trying to do. I found out loads of stuff about the internals of the JVM. A little example.

public class TextClass extends Object{

public TextClass(){
super();
}


public static void main(String[] args)
{
System.out.println("HEllO WORLD");
}
}
is identicall to

public class TextClass
{
public static void main(String[] args)
{
System.out.println("HEllO WORLD");
}
}

Java just adds all that stuff. Here is the decompiled class file

import java.io.PrintStream;

public class TextClass
{

public TextClass()
{
// 0 0:aload_0
// 1 1:invokespecial #8 Method void Object()
// 2 4:return
}
public static void main(String args[])
{
// 0 0:getstatic #16 Field PrintStream System.out
// 1 3:ldc1 #22 String "HEllO WORLD"
// 2 5:invokevirtual #24 Method void PrintStream.println(String)
// 3 8:return
}
}


You can find out loads of interresting stuff through this. Have a try :)

Coding Styles

One thing that is really important when coding is to eliminate errors from the start. Lots of errors happen because of a typo one being if(a=1) in a C sort of language. This is a assignment not a comparison (==) so how can I avoid this error?
By putting the 1 before the == like
if(1==a)
if you forget one = (if(1=a)) this will moan at you at compile time.
In short
Never use (a==1) always use (1==a)

a=1 will compile and always return true
1=a will not compile

Thx to J. Spolsky

Java and Url in the Code

Hey, a nother funny fact about java
How thinks the code below will compile?

public static void main(String[] args)
{
http://www.ribalba.de/
System.out.println("Hello World");
}
It does. This is due to the : and the //
In Java you can have a label so the goto can work. This is defined through the : everything after this is seen as a comment because of the //
=> So you can post urls in your code where you want and javac will just ignore them

Java quicker than C++

Ok everyone thinks java is a slow bastar**. But how do you explain this:

didi@alpha ~/speedTest $ time java SpeedTest
Finisched with 2000000000 loops
real 0m16.606s
user 0m16.233s
sys 0m0.264s

didi@alpha ~/speedTest $ time ./speed
Finisched with 2000000000 loops
real 2m7.950s
user 2m6.292s
sys 0m0.180s


Here are the programms:

The c++ one
 1: 
2: #include iostream
3:
4: class MathObject {
5: public:
6: MathObject(){}
7: };
8:
9: int main()
10: {
11: for(int i=0; i < 2000000000 ;++i){
12: MathObject *mathObject = new MathObject();
13: delete mathObject;
14: }
15:
16: std::cout << "Finisched with 2000000000 loops" << std::endl;
17: return 0;
18: }


The Jave one
 1: public class MathObject
2: {
3: public MathObject(){}
4: }
5:
6: public class SpeedTest
7: {
8: public static void main(String[] args)
9: {
10: for(int i=0; i < 2000000000 ;++i){
11: MathObject mathObject = new MathObject();
12: mathObject = null;
13: }
14: System.out.println("Finisched with 2000000000 loops");
15: }
16: }


I assume, this is because the java jvm can only change a pointer for the new Obj but c++ has to scan through the heep to find a new memory address and becomes so much slower through doing so. So java is faster at some stuff.

Download the files under : http://www.ribalba.de/speedTest.zip

Hello

Hi

After I realised that I don't have the time to make a real daily blog I decided to post funny stuff about computing here. Thx to Edd who has a similar blog http://vext01.blogspot.com/
So have fun reading and feel free to email me.