Java


27
Aug 09

When is 4 – 1 = 4?

When c like languages say so

$a = 5;
$b = 1;
 
$result = $a---$b;
echo $a; #=>4
echo $b; #=>1
echo $result; #=>4
public class FunMaths{
	public static void main(String[] args) {
		int result;
		int a = 5, b = 1;
		result = a---b;
		System.out.println(a);
		System.out.println(b);
		System.out.println(result);
	}
}

7
Apr 09

Why I use NetBeans

I am sure you know by now that IBM was set to aquire Sun Microsystems this week. This would have been bad seeing as most of their products directly compete/overlap with eachother. Fortunately they backed off at the last minute (or at least they did not offer enough money for them). While this might be a barganing tactic I surely hope that this is not the case. If they had bought them, it seems to me that it would have meant the death of many of the great Sun products.

NetBeans is one that would have been dead really quickly, sure it would have survived as a fork of the code (since Open Source projects never really die) but it would have been making much slower progress than it does now. This is because of Eclipse which is a good product in its own right… but as someone put it:

NetBeans is the Mac of the IDE world… it just works

If you want to use php in eclipse you have to work at setting it up, if you want to develop in php, download the php package, ruby? There is one  for that too. Since they are all professionally developed as part of the package there is no need to work to get it going no need to route aroud the net trying to find which plugins you need, which ones are still supported (which ones are supported well), which ones do not conflict with eachother… You want to use SVN? Which one do you use? Subclipse? Subversive? Does it work with your version of eclipse? Your repository? Will it corrupt it? Does it work with the latest version of subversion? Can it use the command line version if it doesn’t? (On a side note, subclipse probably works fine since it is supported by tigris).

So, if you have a choice at work, try it, if not, try it at home. It even has an eclipse project importer. You have nothing to lose, it is free after all.


11
Aug 08

Why implement PHP in Java?

First of all, why not? Everything else can run on the jvm (yes… even c#), so why not php? Well… I certainly don’t see why not… Java is a fairly robust language with a pile of different libraries and (as you saw if you clicked on any of those links) languages that can run on it. It is ideal!

Don’t like php’s random function? Why not use Java’s? Not your cup of tea? Use ruby’s instead, or python’s, or  write one in COBOL if you are really brave.

It also means that you can implement the functionality in Java, the database transactions in Ruby, then write all of the presentation in PHP, no clearer MVC separation than that eh? Admitedly it might get a bit confusing and I may be over exaggerating about the possibility of these implementation’s cross communication abilities… but it would be great if you could (I might test it later…).

http://www.caucho.com/resin-3.0/quercus/index.xtp

Go check it out!


27
Nov 06

Jerk Markers

Ok… so markers are assholes. They go through the assignments with the minimal effort that they can put into it. It is evident that they do this.

I got my Operating Systems assignment back and this was made very clear to me. There were comments on it such as “Needs more comments”, and then later “It should only be 2″. The combination of these two amused me because on the line where it said that “It should only be 2″ there was a comment explaining why it wasn’t 2… Nice.

On that question I lost 1 point for not putting comments in the code even though on every line it was quite obvoius what was going on, to make sure that it wasn’t just me who understood the code, I gave it to my friend (an arts major) and she could tell me exactly what was going on at any line that I pointed to. I am a firm believer in the fact that if the code is written properly there do not need to be a whole bunch of comments. If you name a function stringToInt… what else could be going on really? I managed to argue my mark up 1 point for that part as the marker realised that he was being an ass (I guess…).

The other problem I had was on the last question of the assignment. There was supposed to be a proof of some sort. The marker asked the professor how to mark this part, and the teacher gave him some guidelines to go by. This gave the marker free reign to just throw marks on the page without actually thinking about it. He then protested that he ‘couldn’t understand the proof’ when I said that my proof was right. It was pretty evident that the proof was lost on him and that he didn’t understand it, nor had he made any effort to do so. Way to go the extra mile there buddy.