Sunday, June 05, 2011

search filter

find . -name "*jar" -print -exec jar -tvf {} \; | grep pattern ...

Thursday, April 21, 2011

Search for a class file in a set of jars

Lot of times we get the following errors:
Exception in thread "main" java.lang.NoClassDefFoundError: server

And we just don't know which jar file is missing from the classpath. And we need to know the correct jar file name(s) to fix the problem. So, here I create a shell script that would allow you to search through all the jar files by specifying a specific keyword. You may modify this script to search in all files (*) or whatever your criteria may be. This script works recursively for all sub-folders as well. So, you can keep this script on the root level of search and simply execute it.

=====================================
searchjars.sh
=====================================


#!/bin/sh

if [ $# -ne 1 ];
then
echo "Usage: ./searchjars.sh "
exit
fi

LOOK_FOR="$1"

for i in `find . -name "*jar"`
do
#echo "Looking in $i ..."
jar tvf $i | grep $LOOK_FOR > /dev/null
if [ $? == 0 ]
then
echo "==> Found \"$LOOK_FOR\" in $i"
fi
done


After saving this file, don't forget to give the execute permissions to this script.

[jboss@lin01 xlclient]$chmod +x searchjars.sh

Now you are ready to execute as follows:

If you don't specify any value, the script shows you the usage command:
[jboss@lin01 xlclient]$ ./searchjars.sh
Usage: ./searchjars.sh

When you specify the value to be searched, you will see the files that have that value in it.
[jboss@lin01 xlclient]$ ./searchjars.sh server
==> Found "server" in ./java/lib/rt.jar
==> Found "server" in ./ext/jdbcpool-0.99.jar
==> Found "server" in ./ext/nexaweb-nfc-api.jar
==> Found "server" in ./ext/jai_core.jar
==> Found "server" in ./ext/javagroups-all.jar
==> Found "server" in ./ext/jbossall-client.jar
==> Found "server" in ./ext/jboss-client.jar
==> Found "server" in ./ext/nexaweb-common.jar
==> Found "server" in ./ext/soap.jar
==> Found "server" in ./lib/xlVO.jar
==> Found "server" in ./lib/XellerateClient.jar
[jboss@lin01 xlclient]$

If you need to see what files are being looked at, uncomment (remove the #) the following line in the script:
#echo "Looking in $i ..."

Reference: http://rajnishbhatia19.blogspot.com/2008/10/searching-jar-files-in-unix-linux.html

Friday, April 01, 2011

KDE environment for Linux

Install Nomachine client, node and server on Linux machine and restart then
http://www.nomachine.com/download-package.php?Prod_Id=2519
Restart machine after this.

Install windows client on your laptop or desktop
http://www.nomachine.com/download-client-windows.php

Friday, March 18, 2011

linux rpm commands

For help, rpm --help or tar --help from the command line.

Install a package
rpm –ivh packagename

upgrade a package
rpm –Uvh packagename

create a tar file
tar –cvf myfiles.tar mydir/
(add z if you are dealing with or creating .tgz (.tar.gz) files)

standard install from source
tar –xvzf Apackage.tar.gz
cd Apackage
./configure
make
make install

Friday, February 25, 2011

Converting html character to actual character

Source : http://webglimpse.net/docs/howto_uml.html

#!/usr/local/bin/perl


# converts html files into ascii by just stripping anything between
# < and >
# written 4/21/96 by Michael Smith for WebGlimpse
#
# Added code to replace html codes for special chars with the
# characters themselves. 12/19/98 --GB
#
# Also add space in place of space-producing HTML tags
# 12/22/98 --GB

$carry=0;

while(){
$line = $_;

if($carry==1){
# remove all until the first >
next if($line!~s/[^>]*>//);
# if we didn't do next, it succeeded -- reset carry
$carry=0;
}

while($line=~s/(<[^\s>][^>]*>)/&addspace($1)/ge){};
if($line=~s/<[^\s>].*$//){
$carry=1;
}

$line = &fixspecial($line);
print $line;
}


sub addspace () {

$_ = shift;

# Check for tags that should NOT return a space
/(<\/?b>)|(<\/?i>)|(<\/?em>)|(<\/?font)|(<\/?strong)|(<\/?big)/i && return '';
/(<\/?sup)|(<\/?sub)|(<\/?u>)|(<\/?strike)|(<\/?style)/i && return '';

# Otherwise, put in a space
return ' ';

}


sub fixspecial () {

$_ = shift;

s/\ / /g;
s/\ / /g;
s/\¡/¡/g;
s/\¡/¡/g;
s/\¢/¢/g;
s/\¢/¢/g;
s/\£/£/g;
s/\£/£/g;
s/\¤/¤/g;
s/\¤/¤/g;
s/\¥/¥/g;
s/\¥/¥/g;
s/\¦/¦/g;
s/\¦/¦/g;
s/\§/§/g;
s/\§/§/g;
s/\¨/¨/g;
s/\¨/¨/g;
s/\©/©/g;
s/\©/©/g;
s/\ª/ª/g;
s/\ª/ª/g;
s/\«/«/g;
s/\«/«/g;
s/\¬/¬/g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it won't affect the other substitutions
s/\&/\&/g;
s/\&/\&/g;

return $_;
}

Monday, December 20, 2010

Windows: Determine processor type 32 bit or 64 bit

http://support.microsoft.com/kb/827218
http://windows.microsoft.com/en-US/windows-vista/32-bit-and-64-bit-Windows-frequently-asked-questions

Wednesday, March 17, 2010

Adding users to Remote Desktop Users Group

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

To add users to the Remote Desktop Users group

1. Open Computer Management.

2. In the console tree, click the Local Users and Groups node.

3. In the details pane, double-click the Groups folder.

4. Double-click Remote Desktop Users, and then click Add....

5. On the Select Users dialog box, click Locations... to specify the search location.

6. Click Object Types... to specify the types of objects you want to search for.

7. Type the name you want to add in the Enter the object names to select (examples): box.

8. Click Check Names.

9. When the name is located, click OK.

Notes

* By default, the Remote Desktop Users group is not populated. You must decide which users and groups should have permission to log on remotely, and then manually add them to the group.

* To open Computer Management, click Start, click Control Panel, double-click Administrative Tools, and then double-click Computer Management.

Source:
MSDN

Sunday, March 14, 2010

Restoring ipod touch to its factory settings

Hold down the power and home keys down for about 10 seconds each while plugged into itunes. When the screen goes black, release the power button but keep holding the home key until itunes says. We have detected an itouch in recovery mode.

From there you can restore as normal via iTunes.

Source:
Yahoo Answers

Monday, December 14, 2009

Enable remote root login and sshd on Solaris-10 after fresh Solaris-10 installation

Enable sshd on solaris-10

1. Change the file /etc/ssh/sshd_config from PermitRootLogin no to PermitRootLogin yes

2. restart the services
#svcadm restart svc:/network/ssh:default


Enable remote root login on Solaris-10

1. Open file /etc/default/login

2. Comment out line CONSOLE=/dev/console as #CONSOLE=/dev/console

Thursday, November 19, 2009

sys-unconfig on solaris

To change solaris config info like NIS server,
login as root and do sys-unconfig. Provide configuration info as needed.

Friday, October 23, 2009

Java 1.5 Certification resources (310-055)

Online Resources :
-----------------
SCJP Tiger Study Guide (Link)

Javabeat.net Notes (Link)

Examulator.com (Link)

An SCJP 5.0 Certification primer(Link)

How to test a product?

1. Requirements based testing - Test it based on Product Requirements doc
2. Parallel testing - Test it against competitor and peer products
3. Scenario testing - Assume different scenarios for different kinds of end users.
4. Usability testing - Based on usage of the product
5. Function testing - Based on functionality
6. Fault Injection - Inject problems
7. Stress testing - Stress it out
8. Performance testing - metrics
9. Regulations - specs

A blog article on all possible test scenarios for a stapler is available in the following location:
http://www.testingreflections.com/node/view/928

Monday, September 07, 2009

Installing thunderbird on Jaunty Ubuntu Linux

Do:
sudo apt-get install thunderbird

Go to: Applications --> Internet --> Thunderbird

To login as root in Ubuntu Jaunty, do:
sudo bash
enter your user password when it prompts for password. You become root then.

Install vpn client on Ubuntu linux - jaunty

mkdir vpnclient

Change to that directory:

cd vpnclient

* Download cisco-decrypt file which will be used to decrypt the group password from your pcf file:

wget http://www.debuntu.org/files/cisco-decrypt.c

sudo apt-get install libgcrypt11-dev

gcc -Wall -o cisco-decrypt cisco-decrypt.c $(libgcrypt-config --libs --cflags)

chmod +x cisco-decrypt

sudo cp cisco-decrypt /usr/bin

* Download pcf2vpnc to convert pcf files in vpnc configuration format

wget http://svn.unix-ag.uni-kl.de/vpnc/trunk/pcf2vpnc

chmod +x pcf2vpnc

sudo cp pcf2vpnc /usr/bin

* Go to windows vpn profiles directory and convert .pcf files to .conf files

pcf2vpnc cisco.pcf > cisco.conf

Note:replace above cisco.pcf with your own .pcf file.

sudo cp cisco.conf /etc/vpnc/

* install vpnc and connect to vpn

sudo apt-get install vpnc resolvconf

sudo vpnc cisco

Enter username for :
Enter password for :
VPNC started in background (pid: 6092)…

* To disconnect simply do

sudo vpnc-disconnect

Source:
=======
http://www.ubuntugeek.com/how-to-setup-cisco-vpn-using-vpnc-ubuntu-jaunty-9-04.html

Wednesday, August 26, 2009

How to find out if solaris machine is 32 or 64 bits?

# /usr/bin/isainfo -kv
64-bit amd64 kernel modules

# uname -a
SunOS jack 5.10 Generic_137138-09 i86pc i386 i86pc

# cat /etc/release
Solaris 10 10/08 s10x_u6wos_07b X86
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 27 October 2008

Configure FTP for root logins

1. Remove 'root' line from /etc/ftpusers.

2. Edit file /etc/ftpaccess and comment out 'deny-uid' and 'deny-gid' lines. If the file doesn't exist, there is no need to create it.

NOTE: If you are using Solaris 9 or Solaris 10, the ftp* files are located in /etc/ftpd

Configure Telnet for root logins

Edit file /etc/default/login and comment out the following line as follows:
# If CONSOLE is set, root can only login on that device.
# Comment this line out to allow remote login by root.
#
# CONSOLE=/dev/console

Enable ssh root login in Solaris 10

1. Change the file /etc/ssh/sshd_config with PermitRootLogin yes to replace PermitRootLogin no

2. restart the services
#svcadm restart svc:/network/ssh:default

Thursday, August 06, 2009

Booting solaris from CD

Open terminal
Enter command: halt in command line. White screen will appear.
Enter command: boot cdroom