Sunday, 24 January 2010

Ubuntu Linux: Install Sun's Java JDK

If you're using Debian (this works with Ubuntu as well, and may work with other Debian derivatives) and want to install Sun's Java Development Kit, and ensure it is set properly.
First, let's start by opening a terminal. Remember to use su or sudo for admin tasks.
sudo apt-get install sun-java6-jdk -y
You'll be asked to accept the accept the license terms before installing the JDK.
After all is done, type the following to test your JDK:
java -version
javac -version
Many Linux distributions come with other versions of the JRE (runtime environment). If this is the case, use the following terminal commands to choose which want to use as default:
update-alternatives --config java
update-alternatives --config javac
The first line lets you choose a JRE and the second, a compiler (provided more than one alternative is installed).

Notes: You need the nonfree/multiverse repository(-ies) enabled. OR, if you're using Ubuntu 10.04 onwards, the "partner" repository (Sun's/Oracle's Java packages have been moved to partner). Via command line, you may easily do this by pasting the following line in your terminal:

sudo add-apt-repository “deb http://archive.canonical.com/ maverick partner”
sudo apt-get update
 If you're using Ubuntu 10.10, the word in bold should be maverick; for 10.4, use lucid.

Wednesday, 6 January 2010

Java programming fun

This is an interesting problem solved using Java, but without using any fancy extra methods.

public class TestIsSubString {

/*
* Write a isSubString method that searches for a specific string within
* another string; the method must return true if the former exists in the
* latter string. Otherwise, the method return false.
*/

public static boolean isSubString(String part, String whole) {
// The hard way, with nested loops instead of whole.indexOf(part)!= -1
// Note to self: local variables MUST be init'd
int hits = 0; // flag type of variable
boolean isFound = false;
for (int i = 0; i <= whole.length()-part.length(); i++) {
hits = 0;
//isFound = false;
for (int j = 0; j < part.length(); j++) {
if( part.charAt(j) == whole.charAt(i + j) ) {
hits ++;
}
}
System.out.println("Hits = " + hits + " | len = " + part.length());
if( hits == part.length() ) {
isFound = true;
}
}
return isFound;
}

public static void main(String[] args) {
String text = "The cat in the hat.";

System.out.println("isSubString(\"cat\", \"The cat in the hat.\") "
+ isSubString("cat", text));

System.out.println("isSubString(\"bat\", \"The cat in the hat.\") "
+ isSubString("bat", text));

System.out.println("isSubString(\"The\", \"The cat in the hat.\") "
+ isSubString("The", text));

System.out.println("isSubString(\"hat.\", \"The cat in the hat.\") "
+ isSubString("hat.", text));

}
}

Saturday, 5 December 2009

Mousey Terminal

I found an insteresting software package playing with Fedora 12. It may be available for other distriburions as well.

It's called GPM.

According to Wikipedia (short and sweet description), GPM means "general purpose mouse" and it "provides mouse support in Linux virtual consoles. It is included in most Linux distributions."
If you want to know more, this is GPM's official page.

Saturday, 28 November 2009

Sitex 2009

SITEX 2009 is here again, and here's some information that can be very useful! Tomorrow (Sun 29/Nov) is the last day, so apologies for not posting this before. Fortunately, I don't need anything from it, so it slipped my mind. Plus I'm really into avoiding crowds.

Anyway, here it goes:

Other information you may get (via Google, for example) I found not as relevant and essential.
So if you're going to Sitex, check the offers and perhaps decide before you go.

And remember that some shops have Sitex offers during or even after the event (and some despite not taking part in Sitex).

Anyway, Selamat Hari Raya Haji, and happy IT, everybody.

Sunday, 8 November 2009

Day 1 with Snow Leopard

Let me start by saying that I'm a fan of clean installs, so don't expect to find any information about upgrading issues here.

So, what you'll find here is a summary of how I've set up Snow Leopard from scratch.

Make Leopard boot in 64 bit mode
For selected Macs models only*, you can enable this. By default, all Macs except Xserves (server machines) boot in 32 bit mode.

*Which models?
Open the Terminal and type the following:
ioreg -l -p IODeviceTree | grep firmware-abi
If you get the following output, you're all set to go. Otherwise, skip this section.
| | "firmware-abi" = <"EFI64">
OK, you're happy. You got the EFI64 message (that means your Extensible Firmware Interface is 64 bit) and (still inside the Terminal, type:
sudo nano /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
Type in your password when asked. A handy text editor will open a configuration file. Carefully, change it so it looks like this:
Kernel
mach_kernel
Kernel Flags
arch=x86_64
So, the idea is to insert the line
arch=x86_64
Right after the "Kernel Flags" section. Press control and X simultaneously, then Y, then return. Now we're done. Restart, then open the Terminal again, and type:
uname -a
If you get something like the following, the magic worked! Congrats!
Darwin xxxxxxx 10.1.2 Darwin Kernel Version 10.1.2: Wed Sep 9 23:09:02 PDT 2009; root:xnu-1486.1.8~1/RELEASE_X86_64 x86_64

2D Dock
Yes, we'll be using the Terminal utility again. Open it, and type
defaults write com.apple.dock no-glass -boolean YES
killall Dock
To set the Dock to a 2D look, or
defaults write com.apple.dock no-glass -boolean NO
killall Dock
To (re)set it to the 3D glassy look. I prefer 2D myself because it's easier to see which apps are open (the little dot).

Install MS Office 2008 without Rosetta
Rosetta provide PowerPC support for Intel Macs, and is not installed by default in Snow Leopard. I find a waste of space and time to install it, so... Guess what! Terminal again. I open it at login, as you may guess.

Obviously, you need to insert the MS Office 2008 DVD into your Mac's optical drive. After that, type inside the Terminal the following:
sudo installer -package /Volumes/Microsoft\ Office\ 2008/Office\ Installer.mpkg/ -target /
Type in your password, and wait. Wait! It takes a while, even on your shiny new Snow Leopard Mac or your recently upgraded system. You will get the familiar prompt back once the installation is done. No nags, no questions asked, just an old fashioned, straightforward install.

Don't run anything yet. First, download and install all available updates first. Just go to http://www.microsoft.com/mac/downloads.mspx to fetch them, then install them.

Adobe Photoshop Elements 6.0
Nothing. You don't have to do anything. It's one of my favourite applications... I would recommend you, however, to run the Adobe Updater before you run any Adobe application. In the case of a default Elements 6.0 installation, you can find it in
Applications > Utilities > Adobe Utilities > Adobe Updater
or similar. Sometimes there's a number after updater showing the version of the utility (i.e. 4, 5)

Best luck and enjoy your Mac!

Monday, 2 November 2009

Unbuntu 9.10 Released!

Great news! Ubuntu 9.10 was released at the end of October, and it's the best Ubuntu yet! Try it for free or get more information at:

So far I've tried it and it's looking and working better than ever!

If you have an MSI Wind U100 or similar netbook, you may want to know that the brightness glitch can easily be fixed (at the time of this post) by disabling the 3D desktop effects. At least that worked for me.

Thursday, 22 October 2009

Windows 7

Let's start the game all over again...

Microsoft just released its Windows 7 Operating System, so obviously I've started digging for information before making the financial commitment of spending my hard earned money yet again on a Microsoft OS.

What I found out:
Vista left me a really bad aftertaste... Paying too much money for software that does not meet essential expectations regarding stability, efficiency, compatibility...

I have tried the Windows 7 Release Candidate, and it is indeed better than Vista, but my position is that Microsoft would almost redeem itself by charging a reasonable price for the upgrade (like Apple, for example), or why not offer it as a service pack?

It's up to you, dear reader, but I just can't part with so much money... again.

I'll be in the Apple Mac OS X camp and eagerly waiting for Ubuntu 9.10, thank you very much.


Optimise Windows 10/11

How to optimise your Windows setup Just in case you need it. If you want a safe and conservative approach, just disable the background apps ...