Tuesday, September 14, 2010

How to Resize All Window Columns with a Single Keystroke

When you’re dealing with an application that displays data in a set of columns, it’s often frustrating to have to resize each column separately—but today we’ve got a great trick for you that resizes all the columns with a single keystroke.

The secret keystroke to use is Ctrl and the Numpad’s + key, and it only works if you have a separate number pad on your PC.

Monday, August 23, 2010

Working with 'vi' editor

People who use Linux/Unix as their OS should have used the vi editor. This editor is more powerful editor I've seen ever. I'm here with listing some basic & important 'vi' commands which needed to do file manipulation/editing.

Save & Exit:

:x --> quit vi, writing out modified file to file named in original invocation
:x --> quit vi, writing out modified file to file named in original invocation
:wq --> quit vi, writing out modified file to file named in original invocation
:q --> quit (or exit) vi
:q! --> quit vi even though latest changes have not been saved for this vi call

Screen manipulation:

^f -->move forward one screen
^b -->move backward one screen
^d -->move down (forward) one half screen
^u -->move up (back) one half screen

Working with Multiple files:

To open multiple files:

$vi main.pl maintenance.pl

To hop between them:

:n --> Next file
:prev --> Previous file
:args --> To see which are the files open.

Tuesday, August 17, 2010

Ctrl+V for Pasting in the Windows Command Prompt

1. Install AutoHotkey

2. Save the following code as PasteCommandPrompt.ahk

#IfWinActive ahk_class ConsoleWindowClass
^V::
SendInput {Raw}%clipboard%
return
#IfWinActive



3. Double click PasteCommandPrompt.ahk file. Now you all set. You can apply Ctrl + V in command window.

Tuesday, June 8, 2010

Eclipse IDE tips

Often I hate with Eclipse editor is, switching between editor. I mean if you have multiple java files opened with eclipse one way to switch between 'next files' using default shortcut 'CTRL + F6'. To do that ideally you have to use your both hand to handle it. I mean F6 key is all the way up on the top where as CTRL key is all the way down to the keyboard.



You can change this default behaviour and make it 'CTRL + Tab' like other windows application. To do that make a 'Binding' for the command Next Editor under Window > Preferences > General > Keys.



After changing this, you can pretty much switch between files easily with your left hand.



I'd ask every programmer to think all these kind of small small things to make their life better.

Friday, May 14, 2010

Screen capture - Java

This might be very helpful for GUI developer in java. At times its hard to figureout the some error happens in the user end. I mean, End user usually just complain that while clicking so and so button or tab or something it failed. In those cases if you have users screen, you can guess something. To do that, you can make the following code as an API and store screen shot in your log location and you can verify them later.

License key generator for Java applications (free)

Just a quick note that if you happen to be looking for a license key generator (or "license key manager") for a Java desktop (Swing) application, I've been taking a look at the TrueLicense library on java.net, and although it is several years old now, it seems to work well, and the author certainly put a lot of time and thought into it.

As a word of caution, I did find the author's tutorial difficult to read, so I highly recommend looking at an introductory doc written by Martin Paulo. (Just search for his name on the TrueLicense homepage and you'll find a link to that doc.) After reading that doc, the author's tutorial made more sense to me.

I don't know how many people need a Java license key generator, but if you're in the market for one, and "free" (or donation-ware) is your right price, I recommend taking a look at the TrueLicense license key generator for Java applications.

Java Store update

In a related note, the "Java Store" is still in beta. If you haven't heard of it before, the Java Store "is an application storefront that provides an easy and secure way to discover Java applications for your desktop." I don't know what they're doing for software licensing and license management, but I thought I'd mention this "store" again here today. I appreciate what they're doing, I just wish this was available a long, long time ago.

Friday, May 7, 2010

Personalize your windows command prompt

Some times you may want to customize your windows command prompt to display font color differently. I mean instead of white color font with black back groud color, you may want to display them in red color font or something else. Typically people go to window properties and choose the color. Instead you can achieve through DOS command. This is not just for a fun always, it might be useful to have unique color for the batch file/app you write to do some tasks.

Here is the help information:


C:\workspace\perl>color /h
Sets the default console foreground and background colors.

COLOR [attr]

attr Specifies color attribute of console output

Color attributes are specified by TWO hex digits -- the first
corresponds to the background; the second the foreground. Each digit
can be any of the following values:

0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White

If no argument is given, this command restores the color to what it was
when CMD.EXE started. This value either comes from the current console
window, the /T command line switch or from the DefaultColor registry
value.

The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the
same.

Example: "COLOR fc" produces light red on bright white


For example:


C:\workspace\perl>color 7

Tuesday, May 4, 2010

Linux - Basic & useful commands

How to find CPU & Memory detail of linux
cat /proc/cpuinfo (CPU)
cat /proc/meminfo (Memory)


How to find if any service is listening on particular port or not ?
netstat -an grep {port no}
For example if you know that tomcat is running on 8080 port so to check if tomcat service is listening or not then use
netstat -an grep 8080

How to sort files based on Size of file ? ( useful to find large files in log directory to delete in case disk is full )
ls -l sort -nrk 5 more

How to delete files older than N number of days ? (Useful in delete log, trace, tmp file )
find . -name ‘*.*’ -mtime +[N in days] -exec rm {} \; ( This command will delete files older then N days in that directory, always good to use it when you are in applcsf/ tmp,out,log directory)


How to create symbolic link to a file ?
ln -s pointing_to symbolic_name

e.g. If you want to create symbolic link from a -> b
ln -s b a
(Condition:you should have file b in that directory & there should not be any file with name a)

How to find the Unix/Linux version of a particular host ?
uname -a

How to set/unset line numbers in vi editor?
To set line number
:set number

To unset line number
:set nonumber

Total number of files in particular directory

find /usr/local/perl-5.10.1 -ls wc -l


How to set an alias for complex/different commands?

alias l=“ls –alF”
alias cls=clear




/Proc file system - Various Kernel Statistics
/proc file system provides detailed information about various hardware devices and other Linux kernel information.

cat /proc/cpuinfo
cat /proc/meminfo
cat /proc/zoneinfo
cat /proc/mounts


Search the particular key word content in a file

grep -iR <phrase>
< phrase > -> word you want to search if you want to search a sentence enclose within '' (single quotes)

To make your search more faster if you know what type of files to be searche use the following


find -iname "*.xml" | xargs grep -iR <phrase>

Disk Usage listing with depth one level depth:
du -h --max-depth=1 .

First posting

Dear friends,

I've been thinking to write some technical related stuff for long time and I couldn't do that. Some how I started today and lets see how it progress further. Feel free to post your comments & suggestions on this.