Archive for December, 2010

Adding Keyboard Shortcut to Microsoft Office

December 20, 2010

Being a fan of Keyboard shortcuts, I always wanted all those frequent operations I do on my machine to be available as Keyboard Shortcuts. Today I was searching for the Toggle Full Screen keyboard shortcut in Microsoft Word. But to my surprise it was not available. Did some googling and found out that we can add custom shortcuts for Word. To add custom shortcut :

  1. Choose Customize from the Tools menu. Word displays the Customize dialog box.
  2. Click the Keyboardbutton. Word displays the Customize Keyboard dialog box.
  3. In the list of Categories, choose View.
  4. In the list of Commands, choose ToggleFull.
  5. Place the insertion point in the Press New Shortcut Key box.
  6. Press the shortcut key you want to use, such as Alt+L.
  7. Click Assign.
  8. Close the dialog boxes.

The interesting thing is that, when you input one new shorcut, Word will show whether this shortcut is already assigned to any other shortcuts. I preferred Alt+L since I wanted the similar shortcut available in Adobe Reader for toggling full screens for Pdf (Ctl+L), but this was already assigned in word.

πŸ™‚

Unix Tail command in DOS Batch

December 20, 2010

I was struggling the last days for converting my applications from UNIX servers to Windows servers. The main difficulty I faced was the conversion of the shell scripts to DOS Batch scripts. Since I was not that expert in UNIX Shell commands, it was a challenge for me. I will keep on posting the different conversions I did. This is the first one.

The tail command in UNIX will take the last specified number of lines from the input given. The below line of command will take last 20 lines from del_temp.log and put into value.log.

tail -20 del_temp.log >> value.log

This single line tail command can be converted to its equivalent DOS Batch by the below block of code.

SETlocal EnableExtensions
SET tailCount=20
SET fileName=del_temp.log
SET output=value.log
FOR /F “usebackq tokens=3,3 delims= ” %%l IN (`find /c /v “” %fileName%`) DO (call SET find_lc=%%l)
SET /a linenumber = %find_lc% – %tailCount%
IF %linenumber% LSS 1 (
more +0 %fileName% >> %output%
) ELSE (
more +%linenumber% %fileName% >> %output%
)
endLocal

Enjoy and Happy Coding Guys πŸ™‚

Splitting string using period or dot or any basic symbol in Java

December 14, 2010

Have you tried splitting a string in Java using the period or dot (.) with the inbuilt method split. On trying str.split(“.”) will give you an array of zero elements. This is because unlike Javascript, java wants a regular expression as the parameter for split method. You can solve this simply by giving regular expression instead of simple ‘.’ like this :

String fieldId = “1.3.0.1.i”;
String[] s = fieldId.split(“\\.”);
System.out.println(“Length of splitted array :: ” + s.length);

The output will show you Length of splitted array :: 5

The same expression applies to comma (,) as well as pipe symbol alsoΒ  (|).

Just scribbled down the issue I just faced, hope this will come to help for someone like me also.

Happy Coding Guys… πŸ™‚

Linking an external folder to Eclipse / Flex Builder Project

December 6, 2010

At times, there may be a need to link some external folder to the source code of our project in Eclipse or Flex Builder project. One common need is to link the output of our java project in Eclipse to the WEB-INF folder of our web server.Β  Do the following steps for this.

1. Right click on the project -> new -> Folder.

2. In the dialog box shown, click on the Advanced button, if the advanced section is not expanded. This will expand the advanced section in the dialog box.

3.Now check the checkbox with label : “Link to folder in the file system”. This will enable the text box for entering the path and the Browse and Variables button.

4.Now either enter the path to the folder to which you need to link in the text box or select the folder using the “Browse” button.

5. Click Finish.

BINGO!! This will show the new folder in the folder list under the project. The folder will be having a special icon, denoting that this is a external linked folder. This folder can then be used as source folder or output folder using the Configure Build Path options.

Happy Coding Guyz… Cheers. πŸ™‚


%d bloggers like this: