Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Monday, March 12, 2012

Control auto-screen rotation in Windows 7

If you have Intel Graphics (can happen on other graphics too) installed then magically after few key strokes sometimes screen (monitor) rotates upside down or sideways. Like me, if you are used to Eclipse Java IDE and often use "ctrl+alt+down arrow" to duplicate the line(s) above, then, this is a real pain as screen would turn upside down instead of expected Eclipse IDE action.

To turn this behavior off, follow these steps:

1. Locate right side bottom corner of windows task bar

2. Right click on Intel Graphics (Monitor) icon and select to change "Graphics Properties..."



3. On the next window un-check the "Hot Key Functionality" option.



4. You may disable individual options or change key combinations- square box below.

5. Click OK.

That is it.

Tuesday, April 06, 2010

Values of javac @SuppressWarnings

Legal values for the annotation @SuppressWarnings are compiler dependent, except unchecked, which is required by JLS.

I could find a listing for supported values in Eclipse IDE here. However, what is supported in Sun's (now Oracle) JDK is not well published. But, a little help from Sun JDK javac divulges the supported list as shown below:

[bjha@xxx]$ uname -rsp
Linux 2.6.13.5 x86_64

[bjha@xxx]$ javac -version
javac 1.6.0_07

[bjha@xxx]$ javac -X
...
-Xlint:{all,cast,deprecation,divzero,empty,unchecked,fallthrough,path,serial,finally,overrides,-cast,-deprecation,-divzero,-empty,-unchecked,-fallthrough,-path,-serial,-finally,-overrides,none}Enable or disable specific warnings
...
...
These options are non-standard and subject to change without notice.

Friday, February 12, 2010

Remove trailing white-spaces in Eclipse

Often, we need to quickly remove the trailing spaces (at the end) in the line. Eclipse does not come pre-configured with a shortcut for this in (java) editor perspective (I am using Europa release 3.3.2) . However, it is very easy to create one yourself, like following:

1. On menu choose Window -> Preferences ->General ->Keys
2. Filter the shortcuts for "remove"
3. Follow the image below. I have chosen ctrl+alt+backspace as shortcut key.

That is all you need. Now, while editing any source file, just hit the combo ctrl+alt+backspace to remove the (unnecessary) white-spaces from end of lines.

Friday, November 06, 2009

Eclipse, Ant and java.lang.OutOfMemoryError

Launching Ant builds from Eclipse sometimes gives following error

[javac] Compiling 941 source files to C:\xxx
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
...

After a bit of Google and experimentation, this is what works for me. Basically changed the JRE settings to use a bigger chunk of memory (Go to Window ->Preferences ->Installed JREs -> Default JRE -> Edit) for heap and stack like

-Xms256m -Xmx512m -Xss1m -XX:MaxPermSize=128m

Thursday, July 09, 2009

How to compute MD-5 and SHA-1 hash of files from Eclipse

Often I need to calculate MD-5 and/or SHA-1 hash of files in my workspace. I find it annoying to leave Eclipse and run command line tool every time I have to know these hashes.

Here is a trick I devised to get this done quickly without leaving the IDE. This is for Eclipse running on Windows XP but, can be applied for other operating systems too.

1. Download any free command line tool (or roll your own) to compute hashes. I chose Microsoft's free utility called FCIV (File Checksum Integrity Verifier).

2. Extract FCIV tool at a convenient location e.g. c:\fciv\fciv.exe

3. Configure "External Tools" in Eclipse (go to Menu -> Run ->External tools -> Open External tools Dialogue) for FCIV as shown in the diagram below. You can organize the tool in your "favorites" for easy access.




4. Configure a shortcut key to launch FCIV tool.
Go to Menu -> Window -> Prefrences -> General -> Keys and filter for "external". Create a shortcut key combination (e.g. Alt+L) for "Run Last Launched External Tool". Use this dialogue to configure a shortcut for "External tool..." too, e.g. Alt+R.



This is all that is needed to configure the FCIV tool.

5. Now, select a resource in your workspace and press "Alt+R". This will bring up the "External Tools" dialogue.

6. Select the FCIV tool from the dialogue.

7. This will print both MD5 and SHA-1 of the selected file in the console window at the bottom of Eclipse IDE.

8. For computing hashes of next file, just press shortcut "Alt+L".

Tip:
To compute hashes of all the files in a directory, select at directory and use the shortcut "Alt+L".

Hope it helps.