Saturday, September 17, 2011

How to clear the DNS cache for Windows, Mac and Linux

Command for clearing the DNS cache for Windows, Mac and Linux.

The commands need to be run at the command prompt with administrator privileges.

Windows

ipconfig /flushdns

Mac OSX 10.4 (Tiger)

lookupd -flushcache

Mac OSX 10.5/10.6 (Leopard/Snow Leopard)

dscacheutil -flushcache

Linux (Most Distributions)

sudo /etc/init.d/nscd restart
or
sudo /etc/init.d/networking restart

Thursday, June 30, 2011

How to disable automatic Facebook calendar entries addition on BlackBerry

[caption id="" align="alignnone" caption="BlackBerry Facebook Options"][/caption]

Once you install Facebook application on your BlackBerry, Facebook will invade the BlackBerry calendar. Birthdays and events will be added automatically.

How to disable this annoying feature?

These are the steps needed to disable it:

  1. Open Facebook app. Under Options, uncheck the sync. calendar and contacts options. Close Facebook app.

  2. Open Options, Device, Advanced System Settings, Service books. Delete all Facebook related entries.

  3. Open Options, Device, Advanced System Settings, Default Services. Select the default for calendar, contact list and messaging.


Please note that you might need to redo all these steps, if you update Facebook app.

By default, Facebook app will automatically update itself. So, don't forget to disable this feature in the Facebook app options.

Hope that helps!

BlackBerry typing shortcuts



These are eight BlackBerry typing shortcuts that may help you type faster.

  1. Insert a period
    Press the Space key twice. However, in the email field, this action will insert an at sign (@) or a period (.)

  2. Type a number
    Press and hold the Alt key and press the number key. In a number field just press a number key, without pressing the Alt key.

  3. Turn on Num Lock
    Press the Alt key and left Shift key. To turn off, press the left or right Shift key.

  4. Turn on Caps Lock
    Press the Alt key and left Shift key. To turn off, press the left or right Shift key.

  5. Highlight text character(s)/line(s)
    Press the Left Shift key or Right Shift key and, on the trackpad.
    Slide your finger up or down on the trackpad to highlight line(s).
    Slide your finger left or right on the trackpad to highlight characters.

  6. Cut highlighted text
    Press the Left Shift key or Right Shift key and the Backspace/Delete key.

  7. Copy highlighted text
    Press the Alt key and click the trackpad.

  8. Paste text
    Press the Left Shift key or Right Shift key and click the trackpad.


Happy typing!

Saturday, January 15, 2011

How to run Java class file on Ubuntu

Let say you compile the following Java codes
public class hello {
    public static void main(String[] args) {
    System.out.println("rizauddin.com");
    }
}
using the following command:
javac hello.java
You will get a class file `hello.class`.

However, when you try to run the Java class file using
java hello

like you usually did on Windows, it won't run.
Exception in thread "main" java.lang.NoClassDefFoundError: hello Caused by: java.lang.ClassNotFoundException: hello at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: hello. Program will exit.
Actually, to run Java class file on Ubuntu, you need to always specify the classpath, using the `-cp` options.

As an example,
java -cp . hello

The `.` means the current working directory. In other words, you are telling Java to look for `hello class` in the same directory that you invoke the `java` command.

You can also add the current directory to the CLASSPATH, like this:
export CLASSPATH=.:$CLASSPATH
If you don't like to do that each time you want to run a Java class file, you can set the CLASSPATH permanently in /etc/environment or in ~/.profile.