jump to navigation

Java graphics to blow your mind August 25, 2006

Posted by pauloh81 in Uncategorized.
1 comment so far

Looking arround in my Java installation I found this folder (where JAVA_PATH= where you install the JDK)

JAVA_PATH/demo/jfc

It is full of nice examples. Some of them really show the power of the graphics system in Java.

I hope I’ll have some time to add some of those features into my code.

Operator overloading in Java using Jython August 24, 2006

Posted by pauloh81 in Uncategorized.
add a comment

Yesterday, I discovered that it is possible to add operator overloading to Java through Jython.
I created a small Point.java class:

import java.lang.String;
public class Point {
private double x, y;

public Point(double x, double y){
this.x = x; this.y = y;
}

public Point(Point other){
this.x = other.x; this.y = other.y;
}

public Point __add__(Point b) {
return new Point(this.x + b.x, this.y + b.y);
}

public String toString(){
String str = “(” + this.x + “,” + this.y + “)”
return str;
}

public String __repr__(){
String str = “Point: (” + this.x + “,” + this.y + “)”
return str;
}
}

I compiled this class with: javac Point.java . In the same folder I created a testPoint.py file with:

import Point

a = Point(1.0,1.0)
b = Point(2.0,2.5)
print “a = “, a
print “b = “, b
c = a + b
print “a + b = “, c

Running: jython testPoint.py, produces

a = (1.0,1.0)
b = (2.0,2.5)
a + b = (3.0,3.5)

Moving back to Windows August 24, 2006

Posted by pauloh81 in Uncategorized.
add a comment

I’ve used Linux as my main OS for the last 4 years. During that time I installed many different distributions: Debian, Ubuntu, Fedora, Suse, Mepis, Mandrake/Mandriva, ……. . I was looking for the “perfect” distribution, but I couldn’t find it. There was always something that didn’t work: multimedia, package manager, etc….

Finally, there were two things that made me switch back to Windows. First, I had to configure a VPN connection to my university. After spending several hours fiddling with configuration files I gave up and I downloaded the pptp client. That worked OK, but the problem was that this useful package is not supported by any distribution, so you have to trust some obscure repository to download it. Then, the question was: Is it reasonable to setup something like VPN using a package that I don’t trust? My answer was not.

More or less at the same time I purchased a digital TV card. Before buying it I checked it was supported in Linux, so it works fine. The problem is that there are few programs in Linux that you can use to watch DVB-T. I found two that are easy to setup: Kaffeine and Xine. I liked Kaffeine, it is a great idea, but it is very unstable. It randomly crashes. Xine is also good but for some reason that I couldn’t figure out, lirc (the remote control server I used with xine) is very unstable and stops working after some time. So, I had my TV card recognized by the kernel, but I couldn’t use it as I wanted.

That’s why I decided to move to Windows XP. After a couple of weeks, I can say that the experience has been positive. Everything is easier to setup. Most things just works. I’m also surprised at the amount of open source and free (as in beer) software available for Windows. I even found that there are many free development tools available for Windows. Just to name some: MinGw/Msys (C/C++), Visual Studio Express (C/C++/C#), Eclipse/Netbeans, Python, Jython, etc……; you get the idea: I can get most things I used in Linux without having to spent hours to get things working. Moreover, I’m surprised at how stable is Windows XP SP2. I had bad memories of often blue screens in Windows 95/98, but it seem that those are gone now.

My other main concern was security. I installed a free antivirus, activated the windows firewall, and I installed few free antispyware software that I run periodically. I also used Gmail to check my email and Opera/Firefox as browsers. I’ve installed a lot of software I download from Internet and I spend several hours a day surfing the Web. I haven’t found any virus/trojan/spyware software in my machine. My conclusion is: your are safe if you don’t use Internet Explorer or/and Outlook and have a rational behavior, i.e. do not click the first pop-up that ask you do so.

The real motivation of science August 24, 2006

Posted by pauloh81 in Uncategorized.
add a comment

Some days ago this news about a Russian mathematician got my attention in Slashdot. He solved one of the most difficult problems in mathematics, first established by H. Poincare.
I read the article thinking that the main subject was the demonstration. I was surprised to discover that the main point of the article was to discuss why the “Russian genius” could not want to receive US$ 1 million as prize and maybe he would not accept the Fields Medal (equivalent to the Nobel prize in mathematics). What is wrong about that? Why people cannot understand someone can get pleasure and satisfaction without thinking on money or being famous?

I am sure he got more excitement and satisfaction by solving the problem than by being millionaire. Of course, that is very difficult to accept in this materialist and competitive world.
That article made me think about the real motivation of researchers and scientists around the world. Are we trying to solve problems and to create new technology to make a better world?, or we just want making money and publishing “important” papers to be famous?