8

Feb2010

VMWare Player on a VMWare ESX Guest

Someone gave me a VMWare Player instance Linux. I couldn’t run it on my own machine so I had to run it on my VMWare ESX Server the only solution i had was to run it on an instance on that machine. it wont let me do it unless i had some kind of modifications. so to solve that problem i came up with the following after searching google.

They are:

Under Options: Advanced -> General -> Configuration Parameters (button), I made the following changes:

(change) deploymentPlatform from “windows” to “vmkernel”
(add) monitor_control.vt32 = “TRUE”
(add) monitor_control.restrict_backdoor = “TRUE”

30

Jan2010

Java – do loop

The difference between do-while and while is that do-while evaluates its expression at the bottom of the loop instead of the top. Therefore, the statements within the do block are always executed at least once.


int num = 0;
do {
System.out.println("Line " + (num++));
} while (num < 5);

The loop will continue to increment by one on every loop untill it reaches 5.

30

Jan2010

Java – foreach equivalent

Java 5 introduced what is sometimes called a “for each” statement that accesses each successive element of an array, List, or Set without the bookkeeping associated with iterators or indexing.


String[] names = {"Michael Maus", "Mini Maus"};

for (String s : names) {
System.out.println(s);
}

the output results


Michael Maus
Mini Maus

30

Jan2010

Java – while loop

The while statement is used to repeat a block of statements while some condition is true. The condition must become false somewhere in the loop, otherwise it will never terminate.


int i = 1;
while (i <= 5) {
System.out.println(i + " squared is " + (i * i));
i++;
}

The output result for the above could would be

1 squared is 1
2 squared is 4
3 squared is 9
4 squared is 16
5 squared is 25