Tuesday, April 7, 2009

Recursively rename files

I knew the command for finding files in recursive fashion + I knew command for renaming the files = I now know how to recursively rename the files

find . -type f -name *.txt -exec rename -v 's/.txt/.xml/' {} \;

Similarly, say for example if you need to recursively delete the (.exe) files from your USB stick, you may use following command:
find /path/to/usb/dir -name '*.exe' -print -exec rm -f {} \;

and to remove files below size 200 use command:
find . -type f -size -200 -exec rm {} \;
or somthing like
find . -name '*.exe' -exec rm {} \;

Hope this is helpful to other people too.

Wednesday, April 1, 2009

Automated GUI Testing Tools - Comparison Matrix

After spending much efforts of hunting down the best possible tool for Automated GUI Testing for RCP Application; we came up with the following extract:



Sr. No.ToolsAvailabilityProsCons
AbbotOpen SourceLibrary (Java)1. Programmatically drive UI components
2. Records user actions programatically
3. Tools build up using Abbot - Costello, Windows Tester, Rcp Robot
4. More suitable for AWTUnit / SwingUnit testing
1. No Automatic GUI Recorder
2. More Efforts on spends on writing Java Code
3. Time consuming.
CostelloOpen SourceRecorder (XML)1. Automatic GUI Recorder for AWT & SWING applications
2. Records user actions and facilitate script construction and maintenance
3. Useful for building Unit tests and Function tests
4. Records, Edits, playback XML scripts using Abbot
5. Provides a full-fledged script editor for the generated scripts
1. Currently not supported for SWT / RCP applications.
TPTPOpen SourceRecorder (XML / Java) 1. Allows Eclipse developers to automate regression tests
2. Supports Automatic GUI Recorder
3. Also supports performance and functional testing
1. User actions on native dialogs cannot be recorded because SWT events based on the actions are not reported
2. Keyboard shortcuts are not recorded when object-based recording is enabled
3. SWT does not report mouse / keyboard events when the user clicks a menu item on the menu bar or when the user clicks the native (minimize, maximize, close) buttons that appear in the right hand corner of applications in a windows environment.
SWT BOTOpen SourceLibrary (Java)1. Facility to record and playback scripts
2. Ant support for playback of test suites, reporting, and multi threaded playback
3. Test case execution is easily integrated into a continuous build system
1. Don't have ready-made automatic GUI recorder as well as script editor
2. Not sure about we can build script on top of SWT BOT to make automatic GUI recording
Windows TesterCommercial
Recorder / Library (Java)1. Test cases are based on the JUnit standard
2. Pure Java GUI test cases are easy to read
3. Test cases are customizable
4. You can re-factor GUI test cases easily
5. Provides a rich GUI Test library
6. Test case execution is easily integrated into a continuous build system
7. You can create new GUI test case support for GEF easily record and playback tests for Java GUIs using the Eclipse Graphical Editing Framework (GEF)
1. Not Open Source
RCP RobotOpen SourceLibrary (Java)1. Designed for specially for RCP applications
2. RCP Robot is an API on top of Abbot
3. They are used to write GUI tests in Java using some kind of testing framework
1. No automatic GUI recorder or script editor
2. Manual efforts needed to write the test cases using Java code
3. Difficult to changing the existing code when requirement changes


Friday, March 20, 2009

Open full screen window using Javascript

Here's a very interesting sample code that I found. I have been looking for the solution of this issue since long time...
 <HTML>  
      <HEAD>  
           <SCRIPT LANGUAGE="JavaScript">  
           function openFull(theUrl) {  
                h = screen.height;  
                w = screen.width;  
                window.open(  
                     theUrl,'','left=0,top=0,screenX=0,screenY=0,  
                     height='+(h-100)+',width='+(w-10)+',  
                     directories=no,location=no,menubar=no,  
                     resizable=no,scrollbars=yes,status=no,  
                     titlebar=yes,toolbar=no'  
                );  
           }  
           </SCRIPT>  
      </HEAD>  
 <BODY>  
      <a href="javascript:void(0);" onClick="openFull('full-screen.html');">Open Full Screen Window</a>  
 </HTML>  

Sunday, March 15, 2009

More swap with a swap file ...

There are situations when either you have a pre-installed Linux system or a new one, but forgot to set enough swap space for your needs or you recently have upgraded your hardware (like I have recently added an additional RAM on my machine :) ).

Now, to make the most of the hardware that you've got, you might consider to increase the swap space. What do you do now? Do you need to repartition and reinstall the system? Answer is NO! Linux offers you with fascinating swap utilities to make a real file and use it as swap space. The trick is to make a file and then tell the swapon program to use it.

Here's how to create, for example, a 64 megs swap file on your root partition (of course make sure you have at least 64 megs free):
dd if=/dev/zero of=/swapfile bs=1024 count=65536


This will make a 64 megs (about 67 millions bytes) file on your hard drive. You now need to initialize it:
mkswap /swapfile 65536

sync

And you can then add it to your swap pool:
swapon /swapfile


With that you have 64 megs of swap added. Don't forget to add the swapon command to your startup files so the command will be repeated at each reboot.

Tuesday, March 3, 2009

Adding emmuerated values to the spreadsheet column.

Most of the client interactions makes use of various spreadsheets. One of the common strategy for validating some spreadsheet column is to provide a list of allowed enumerated values to it.

For long time I wasn't aware of this myself. Thus once I came to know about it I felt like sharing how to achieve that.

Following are the steps for adding validation to a spreadsheet column:

1. For Open Office (OpenOffice SpreadSheet):

  1. Select the spreadsheet cells for validating
  2. Click the menu: Data -> Validity. A popup dialog would appear.
  3. Select "List" option from the "Allow" drop-down.
  4. Add the comma-separated or tab-separated or newline-separated enumerated entries in the "Entry" text area.
  5. Click "Ok"
2. For MS Office (MS Excel):
  1. Select the spreadsheet cells for validating
  2. Click the menu: Data -> Validation. A popup dialog would appear.
  3. Select "List" option from the "Allow" drop-down.
  4. Add the comma-separated enumerated entries in the "Source" textbox.
  5. Click "Ok"

Sunday, March 1, 2009

Creating transparent images using GIMP (GNU Image Manipulation Program) ...

INTRODUCTION:
GNU Image Manipulation Program (GIMP) is a very powerful image manipulation software available for Linux operating systems. While working on one of client project which is a Rich UI application, we felt the necessity of inventing customized icons of our own at lot of places. The key challenge was to find a tool for helping our cause. After scanning through a stack of softwares available free / commercial; we found GIMP to be the most interesting of them all.
Two of the prime requirements for creating icons are to have a control over exact icon size and the graphic transparency. Following are the steps for creating transparent images using GIMP:


STEPS:
1. Open GIMP application
2. Click File -> Open
3. Select and load the image from the disk.
4. Zoom into the image for better accuracy while making it transparent.
5. Click Layer -> Transparency -> Add Alpha Channel
6. Make sure to select the Fuzzy selection tool from the main window toolbar for GIMP
7. Selectively click the section that you want to make transparent
8. When you are sure that this section is highlighted properly, then click Edit -> Clear or simply hit 'delete' from keyboard.
9. Repeat steps 7 and 8 until all the sections are made transparent.
10. Finally save the image File -> Save.


Hope these steps will be very helpful to everyone, especially if the application demands heavy use of images and icons.

Monday, February 16, 2009