Hi All
To Fix this error please move to your home directory and remove the file keyring that should fix the issue.For Example
#cd /home/ram/.gnome2/
# mv keyring keyring_old
Then try accessing the application that should work without any issue .
Open Source Guide Blog Started with thought of sharing Ideas in existing Technology
Thursday, November 5, 2009
Monday, November 2, 2009
Sunday, November 1, 2009
Named Service failed
Error
[root@phpmyadmin ram]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [FAILED]
In the back end i got to know that i was facing the below mentioned error.
Apr 22 15:08:37 phpmyadmin named[10379]: loading configuration: file not found
Apr 22 15:08:37 phpmyadmin named[10379]: exiting (due to fatal error)
Apr 22 15:09:22 phpmyadmin named[10438]: starting BIND 9.3.4-P1 -u named -t /var/named/chroot
Apr 22 15:09:22 phpmyadmin named[10438]: found 2 CPUs, using 2 worker threads
Apr 22 15:09:22 phpmyadmin named[10438]: loading configuration from '/etc/named.conf'
Apr 22 15:09:22 phpmyadmin named[10438]: listening on IPv4 interface lo, 127.0.0.1#53
Apr 22 15:09:22 phpmyadmin named[10438]: listening on IPv4 interface eth0, 192.168.1.16#53
Apr 22 15:09:22 phpmyadmin named[10438]: /etc/named.conf:100: configuring key 'ddns_key': bad base64 encoding
Apr 22 15:09:22 phpmyadmin named[10438]: loading configuration: bad base64 encoding
Apr 22 15:09:22 phpmyadmin named[10438]: exiting (due to fatal error)
Solution:
To overcome above error
follow the below mentioned steps:-
# vim /var/named/chroot/etc/named.conf
then look for line 103
100 key ddns_key
101 {
102 algorithm hmac-md5;
103 secret "use /usr/sbin/dns-keygen to generate TSIG keys";
104 };
105 view "external"
106 {
then issue below command in the terminal to get a key
# /usr/sbin/dns-keygen
MYuDOCEckswLfQdVgMjwybFZcB69Jwjv9KMJw7AumSD54dJhdHre2dQYYYmz
Then replace above line(103) as mentioned in the below sample example:
100 key ddns_key
101 {
102 algorithm hmac-md5;
103 secret "MYuDOCEckswLfQdVgMjwybFZcB69Jwjv9KMJw7AumSD54dJhdHre2dQYYYmz";
104 };
105 view "external"
106 {
Then give a below mentioned command
[root@phpmyadmin ram]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@phpmyadmin ram]#
That's it and Enjoys Guys
[root@phpmyadmin ram]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [FAILED]
In the back end i got to know that i was facing the below mentioned error.
Apr 22 15:08:37 phpmyadmin named[10379]: loading configuration: file not found
Apr 22 15:08:37 phpmyadmin named[10379]: exiting (due to fatal error)
Apr 22 15:09:22 phpmyadmin named[10438]: starting BIND 9.3.4-P1 -u named -t /var/named/chroot
Apr 22 15:09:22 phpmyadmin named[10438]: found 2 CPUs, using 2 worker threads
Apr 22 15:09:22 phpmyadmin named[10438]: loading configuration from '/etc/named.conf'
Apr 22 15:09:22 phpmyadmin named[10438]: listening on IPv4 interface lo, 127.0.0.1#53
Apr 22 15:09:22 phpmyadmin named[10438]: listening on IPv4 interface eth0, 192.168.1.16#53
Apr 22 15:09:22 phpmyadmin named[10438]: /etc/named.conf:100: configuring key 'ddns_key': bad base64 encoding
Apr 22 15:09:22 phpmyadmin named[10438]: loading configuration: bad base64 encoding
Apr 22 15:09:22 phpmyadmin named[10438]: exiting (due to fatal error)
Solution:
To overcome above error
follow the below mentioned steps:-
# vim /var/named/chroot/etc/named.conf
then look for line 103
100 key ddns_key
101 {
102 algorithm hmac-md5;
103 secret "use /usr/sbin/dns-keygen to generate TSIG keys";
104 };
105 view "external"
106 {
then issue below command in the terminal to get a key
# /usr/sbin/dns-keygen
MYuDOCEckswLfQdVgMjwybFZcB69Jwjv9KMJw7AumSD54dJhdHre2dQYYYmz
Then replace above line(103) as mentioned in the below sample example:
100 key ddns_key
101 {
102 algorithm hmac-md5;
103 secret "MYuDOCEckswLfQdVgMjwybFZcB69Jwjv9KMJw7AumSD54dJhdHre2dQYYYmz";
104 };
105 view "external"
106 {
Then give a below mentioned command
[root@phpmyadmin ram]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@phpmyadmin ram]#
That's it and Enjoys Guys
MANUAL TO RESTRICT A USER TO A SPECIFIC DATABASE
MANUAL TO RESTRICT A USER TO A SPECIFIC DATABASE
*************************************************************
1) First login to phpmyadmin
2) After login click on privileges
3) Then select add new user example: user : user1 Host : local host
passwd: ########
4) Then select go
5) exit
6) Please login with user1
7) you will see only default database
8) Then log off
9) Once again login to root account
10) Then click privileges
11) check the box user1 and click edit privileges
12) After that select add privileges on the following data base
13) Then from the drop down menu select the specific database
14) On selecting the data base pop the new window
15) Then check all , and give the password and select Go
16) Now exit the button .
Please see the below screen short
*************************************************************
1) First login to phpmyadmin
2) After login click on privileges
3) Then select add new user example: user : user1 Host : local host
passwd: ########
4) Then select go
5) exit
6) Please login with user1
7) you will see only default database
8) Then log off
9) Once again login to root account
10) Then click privileges
11) check the box user1 and click edit privileges
12) After that select add privileges on the following data base
13) Then from the drop down menu select the specific database
14) On selecting the data base pop the new window
15) Then check all , and give the password and select Go
16) Now exit the button .
Please see the below screen short
Perl Module Deployment error Tk::Tree::JSON
Problem:
Perl Module Deployment error Tk::Tree::JSON:-
Can't locate JSON.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/site_perl/5.10.0/Tk/Tree
/JSON.pm line 16.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.10.0/Tk/Tree/JSON.pm line 20.
Compilation failed in require at example.pl line 22.
BEGIN failed--compilation aborted at example.pl line 22.
Solution:-
While Compiling this specific perl module we will be getting similar error .Just a fix for this problem look for JSON.pm file located in “lib/Tk/Tree” and copy it to “
cp JSON.pm /home/Tk-Tree-JSON-0.01/blib/lib/”
Then compile it I.e, make test. You will get below message
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ....... Subroutine Tk::Widget::ScrolledJSON redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 24.
Subroutine Populate redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 29.
Subroutine valuemaxlength redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 50.
Subroutine _value_max_length redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 60.
Subroutine load_json_file redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 72.
Subroutine load_json_string redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 88.
Subroutine get_value redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 100.
Subroutine _json_parser redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 108.
Subroutine _load_json redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 123.
Subroutine _format_text redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 154.
Subroutine Tk::Widget::JSON redefined at /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/Tk/Widget.pm line 256.
t/00-load.t ....... 1/1 # Testing Tk::Tree::JSON 0.01, Perl 5.010000, /usr/bin/perl
t/00-load.t ....... ok
t/pod-coverage.t .. 1/2 Subroutine Tk::Widget::ScrolledJSON redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 24.
Subroutine Populate redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 29.
Subroutine valuemaxlength redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 50.
Subroutine _value_max_length redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 60.
Subroutine load_json_file redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 72.
Subroutine load_json_string redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 88.
Subroutine get_value redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 100.
Subroutine _json_parser redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 108.
Subroutine _load_json redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 123.
Subroutine _format_text redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 154.
Subroutine Tk::Widget::JSON redefined at /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/Tk/Widget.pm line 256.
t/pod-coverage.t .. ok
t/pod.t ........... ok
All tests successful.
Files=3, Tests=5, 1 wallclock secs ( 0.08 usr 0.00 sys + 0.56 cusr 0.08 csys = 0.72 CPU)
Result: PASS
Then Do Make install
Installing /usr/lib/perl5/site_perl/5.10.0/JSON.pm
Appending installation info to /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/perllocal.pod
That's it done and enjoy
Perl Module Deployment error Tk::Tree::JSON:-
Can't locate JSON.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/site_perl/5.10.0/Tk/Tree
/JSON.pm line 16.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.10.0/Tk/Tree/JSON.pm line 20.
Compilation failed in require at example.pl line 22.
BEGIN failed--compilation aborted at example.pl line 22.
Solution:-
While Compiling this specific perl module we will be getting similar error .Just a fix for this problem look for JSON.pm file located in “lib/Tk/Tree” and copy it to “
cp JSON.pm /home/Tk-Tree-JSON-0.01/blib/lib/”
Then compile it I.e, make test. You will get below message
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-load.t ....... Subroutine Tk::Widget::ScrolledJSON redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 24.
Subroutine Populate redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 29.
Subroutine valuemaxlength redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 50.
Subroutine _value_max_length redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 60.
Subroutine load_json_file redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 72.
Subroutine load_json_string redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 88.
Subroutine get_value redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 100.
Subroutine _json_parser redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 108.
Subroutine _load_json redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 123.
Subroutine _format_text redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 154.
Subroutine Tk::Widget::JSON redefined at /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/Tk/Widget.pm line 256.
t/00-load.t ....... 1/1 # Testing Tk::Tree::JSON 0.01, Perl 5.010000, /usr/bin/perl
t/00-load.t ....... ok
t/pod-coverage.t .. 1/2 Subroutine Tk::Widget::ScrolledJSON redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 24.
Subroutine Populate redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 29.
Subroutine valuemaxlength redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 50.
Subroutine _value_max_length redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 60.
Subroutine load_json_file redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 72.
Subroutine load_json_string redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 88.
Subroutine get_value redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 100.
Subroutine _json_parser redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 108.
Subroutine _load_json redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 123.
Subroutine _format_text redefined at /home/Tk-Tree-JSON-0.01/blib/lib/Tk/Tree/JSON.pm line 154.
Subroutine Tk::Widget::JSON redefined at /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi/Tk/Widget.pm line 256.
t/pod-coverage.t .. ok
t/pod.t ........... ok
All tests successful.
Files=3, Tests=5, 1 wallclock secs ( 0.08 usr 0.00 sys + 0.56 cusr 0.08 csys = 0.72 CPU)
Result: PASS
Then Do Make install
Installing /usr/lib/perl5/site_perl/5.10.0/JSON.pm
Appending installation info to /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi/perllocal.pod
That's it done and enjoy
checking for kde-config... not found
Error message that i received when i was trying to install Umbrello error is as follow
checking host system type... i386-apple-darwin8.11.1
checking target system type... i386-apple-darwin8.11.1
checking for a BSD-compatible install... /usr/bin/install
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for kde-config... not found
configure: error: The important program kde-config was not found!
Please check whether you installed KDE correctly.
Solution : check whether all kde packages are installed properlly . if everything is done
and still you get this error message .
Then please go to the directory /usr/bin and check for kde-config if it their then you can
install any of your application and if in case if some higher version is their like kde4-config
then do "cp kde4-config kde-config " then try this it should work .
Thanks.
In hope solution you liked it.
checking host system type... i386-apple-darwin8.11.1
checking target system type... i386-apple-darwin8.11.1
checking for a BSD-compatible install... /usr/bin/install
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for kde-config... not found
configure: error: The important program kde-config was not found!
Please check whether you installed KDE correctly.
Solution : check whether all kde packages are installed properlly . if everything is done
and still you get this error message .
Then please go to the directory /usr/bin and check for kde-config if it their then you can
install any of your application and if in case if some higher version is their like kde4-config
then do "cp kde4-config kde-config " then try this it should work .
Thanks.
In hope solution you liked it.
Max Sound volume is too Low Ubuntu
well The solution is just deploy alsamixer and alsamixergui
Command:-
i had same problem and I have installed below packages to fix the issue
Code:
$ sudo apt-get install alsamixer
And than
Code:
$ sudo apt-get install alsamixergui
and increase the sound to maximum from alsamixer gui in
Applications-->Sound & Videos ->Alsamixergui
The Just Look for PCM,MASTER and Front . The increase the volume in all of them then you will see increase in volume.
And Enjoy. Please post your query any on Linux
Command:-
i had same problem and I have installed below packages to fix the issue
Code:
$ sudo apt-get install alsamixer
And than
Code:
$ sudo apt-get install alsamixergui
and increase the sound to maximum from alsamixer gui in
Applications-->Sound & Videos ->Alsamixergui
The Just Look for PCM,MASTER and Front . The increase the volume in all of them then you will see increase in volume.
And Enjoy. Please post your query any on Linux
Sound Problem in fedora
Just install all the rpm related to alsamixer and then executing the below
pulseaudio -D and check what is the output if everything is fine you won't get any error.
This is one way to check whether sound daemon is running.
Thats all i can Say. Hope this Should solve your sound problem in Fedora
And it is tested in Dell Inspirion 1525
pulseaudio -D and check what is the output if everything is fine you won't get any error.
This is one way to check whether sound daemon is running.
Thats all i can Say. Hope this Should solve your sound problem in Fedora
And it is tested in Dell Inspirion 1525
The configuration file now needs a secret passphrase (blowfish_secret). Open new phpMyAdmin window
Please look for file config.inc.php file located in phpmyadmin directory.
and Look for line:-$cfg['blowfish_secret']='';
replace it with some word like $cfg['blowfish_secret']='abc';
That’s it it you are done with it and enjoy
The configuration file now needs a secret passphrase (blowfish_secret). Open new phpMyAdmin window
Please look for file config.inc.php file located in phpmyadmin directory.
and Look for line:-$cfg['blowfish_secret']='';
replace it with some word like $cfg['blowfish_secret']='abc';
That’s it it you are done with it and enjoy
and Look for line:-$cfg['blowfish_secret']='';
replace it with some word like $cfg['blowfish_secret']='abc';
That’s it it you are done with it and enjoy
PHP Deployment in Fedora Core 7,8,9
yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel
phpmyadmin: cannot load mcrypt extension
Just Install php-mcrypt and libmcrypt.
and for php5 install php5-mcrypt and libcrypt
and for php5 install php5-mcrypt and libcrypt
ifconfig!! Command not found!!
Check to see that /sbin is in your $PATH variable as root. If not, add with
PATH=$PATH:/sbin/
That should fix it.
PATH=$PATH:/sbin/
That should fix it.
How-To create a MySQL database and set privileges to a user
On default settings, mysql root user do not need a password to authenticate from localhost. In this case, user can login as root on your mysql server using:
$ mysql -u root
If a password is required, use the extra switch -p:
$ mysql -u root -p
Enter password:
Now that you are logged in, we will create a database:
mysql> create database ramdb;
Query OK, 1 row affected (0.00 sec)
We allow user ramuser to connect to the server from localhost using the password rampasswd:
mysql> grant usage on *.* to ramuser@localhost identified by 'passwd';
Query OK, 0 rows affected (0.00 sec)
And finally we grant all privileges on the ramdb database to this user:
mysql> grant all privileges on ramdb.* to ramuser@localhost ;
Query OK, 0 rows affected (0.00 sec)
And that's it. You can now check that you can connect to the MySQL server using this command:
$ mysql -u ramuser -p'passwd' ramdb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
$ mysql -u root
If a password is required, use the extra switch -p:
$ mysql -u root -p
Enter password:
Now that you are logged in, we will create a database:
mysql> create database ramdb;
Query OK, 1 row affected (0.00 sec)
We allow user ramuser to connect to the server from localhost using the password rampasswd:
mysql> grant usage on *.* to ramuser@localhost identified by 'passwd';
Query OK, 0 rows affected (0.00 sec)
And finally we grant all privileges on the ramdb database to this user:
mysql> grant all privileges on ramdb.* to ramuser@localhost ;
Query OK, 0 rows affected (0.00 sec)
And that's it. You can now check that you can connect to the MySQL server using this command:
$ mysql -u ramuser -p'passwd' ramdb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
Changing MySQL user password using mysql sql command
MySQL stores username and passwords in user table inside MySQL database. You can directly update password using the following method to update or change password for user ram: 1) Login to mysql server, type following command at shell prompt:
$ mysql -u root -p
2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;
3) Change password for user ram:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='ram';
4) Reload privileges:
mysql> flush privileges;
mysql> quit
$ mysql -u root -p
2) Use mysql database (type command at mysql> prompt):
mysql> use mysql;
3) Change password for user ram:
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='ram';
4) Reload privileges:
mysql> flush privileges;
mysql> quit
Change MySQL password for other user
To change a user password you need to type (let us assume you would like to change password for ram):
$ mysqladmin -u ram -p oldpassword newpass
$ mysqladmin -u ram -p oldpassword newpass
Saturday, October 31, 2009
mysqladmin command to change root password
Hi All
If you people wanted to change mysql root password . Please use below mentioned
Procedure.First login into the terminal then issue below mentioned command to change password.
Hope this will help someone who wanted to change mysql root password and this root password is different from linux PC root Login Password
$ mysqladmin -u root password xyznewpassword
However, if you want to change (or update) a root password, then you need to use following command
$ mysqladmin -u root -p oldpassword newpass
Enter password:
If you people wanted to change mysql root password . Please use below mentioned
Procedure.First login into the terminal then issue below mentioned command to change password.
Hope this will help someone who wanted to change mysql root password and this root password is different from linux PC root Login Password
$ mysqladmin -u root password xyznewpassword
However, if you want to change (or update) a root password, then you need to use following command
$ mysqladmin -u root -p oldpassword newpass
Enter password:
Reliance USB Data Card (Huawei) on Ubuntu HowTo
This is a quick way to setup huawei usb data card with reliance connection on ubuntu 8.04 hardy Ram kumar
1. Connect the reliance usb modem and check if its been recognized by the kernel.
$ cat /proc/bus/usb/devices
you’ll see something like this.
T: Bus=02 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=12d1 ProdID=1001 Rev= 0.00
S: Manufacturer=Huawei Technologies
S: Product=Huawei Mobile
S: SerialNumber=HUAWEI EC3X1
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=0b(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
2. Modprobe the driver
$ modprobe usbserial vendor=0×12d1 product=0×1001
verify dmesg
$ dmesg
[ 2315.412106] usbcore: registered new interface driver usbserial
[ 2315.412508] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[ 2315.461938] usbcore: registered new interface driver usbserial_generic
[ 2315.461945] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[ 2315.480382] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[ 2315.480414] pl2303 2-6:1.0: pl2303 converter detected
[ 2315.480608] usb 2-6: pl2303 converter now attached to ttyUSB0
[ 2315.480620] pl2303 2-6:1.1: pl2303 converter detected
[ 2315.480691] usb 2-6: pl2303 converter now attached to ttyUSB1
3. Edit /etc/wvdial.conf add the entries provided in the sample file.
or replace the original one with it if there is nothing setup.
It will create a connection called “cdma”
Add the following lines to /etc/wvdial.conf
#/etc/wvdial.conf
[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer cdma]
Username =
Password =
Phone = #777
Stupid Mode = 1
Inherits = Modem0
The following things automate recognizing and adding your card everytime you plug it in.
5. Edit/add this file /etc/hotplug/usb/datacard.usermap with following contents
# /etc/hotplug/usb/datacard.usermap
# Huawei EC321 CDMA data card
datacard 0×0003 0×12d1 0×1001
6. Edit/Add /etc/hotplug/usb/datacard . make it executable (chmod +x) . Add the following lines to
it.
#!/bin/bash
#This script goes to ” /etc/hotplug/usb/datacard “
# used to run modprobe when the usb cable is connected
SED=/bin/sed
if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
VENDOR=”`echo “$PRODUCT” | $SED “s/^\(.*\)\/.*\/.*$/\1/”`”;
PRODUCT_ID=”`echo “$PRODUCT” | $SED “s/^.*\/\(.*\)\/.*$/\1/”`”;
modprobe usbserial “vendor=0x$VENDOR” “product=0x$PRODUCT_ID”
fi
1. Connect the reliance usb modem and check if its been recognized by the kernel.
$ cat /proc/bus/usb/devices
you’ll see something like this.
T: Bus=02 Lev=01 Prnt=01 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=12d1 ProdID=1001 Rev= 0.00
S: Manufacturer=Huawei Technologies
S: Product=Huawei Mobile
S: SerialNumber=HUAWEI EC3X1
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=0b(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=pl2303
E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
2. Modprobe the driver
$ modprobe usbserial vendor=0×12d1 product=0×1001
verify dmesg
$ dmesg
[ 2315.412106] usbcore: registered new interface driver usbserial
[ 2315.412508] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[ 2315.461938] usbcore: registered new interface driver usbserial_generic
[ 2315.461945] drivers/usb/serial/usb-serial.c: USB Serial Driver core
[ 2315.480382] drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
[ 2315.480414] pl2303 2-6:1.0: pl2303 converter detected
[ 2315.480608] usb 2-6: pl2303 converter now attached to ttyUSB0
[ 2315.480620] pl2303 2-6:1.1: pl2303 converter detected
[ 2315.480691] usb 2-6: pl2303 converter now attached to ttyUSB1
3. Edit /etc/wvdial.conf add the entries provided in the sample file.
or replace the original one with it if there is nothing setup.
It will create a connection called “cdma”
Add the following lines to /etc/wvdial.conf
#/etc/wvdial.conf
[Modem0]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)
[Dialer cdma]
Username =
Password =
Phone = #777
Stupid Mode = 1
Inherits = Modem0
The following things automate recognizing and adding your card everytime you plug it in.
5. Edit/add this file /etc/hotplug/usb/datacard.usermap with following contents
# /etc/hotplug/usb/datacard.usermap
# Huawei EC321 CDMA data card
datacard 0×0003 0×12d1 0×1001
6. Edit/Add /etc/hotplug/usb/datacard . make it executable (chmod +x) . Add the following lines to
it.
#!/bin/bash
#This script goes to ” /etc/hotplug/usb/datacard “
# used to run modprobe when the usb cable is connected
SED=/bin/sed
if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
VENDOR=”`echo “$PRODUCT” | $SED “s/^\(.*\)\/.*\/.*$/\1/”`”;
PRODUCT_ID=”`echo “$PRODUCT” | $SED “s/^.*\/\(.*\)\/.*$/\1/”`”;
modprobe usbserial “vendor=0x$VENDOR” “product=0x$PRODUCT_ID”
fi
Startx Error Unable to See Graphical Display in Linux
Solution
Please Enter into runlevel 3 then issue the Below command that should fix the issue
#system --reconfig --set-resolution=1024x768 --set-depth=16 --set-driver=nv
Please Enter into runlevel 3 then issue the Below command that should fix the issue
#system --reconfig --set-resolution=1024x768 --set-depth=16 --set-driver=nv
Can't connect to local MySQL server through socket '/var/lib /mysql/mysql.sock' (2)
Problem:
phpAdmin
#2002 - The server is not responding (or the local MySQL server's socket is not correctly
configured)
Open phpMyAdmin in New window
Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning:
Unknown: Failed to write session data (files). Please verify that the current setting of
session.save_path is correct () in Unknown on line 0
http://localhost/projects/myadmin/
mysql login
user: root
password: ""
Solution: Just create enough space in the partition and start mysql service this will fix issuse
phpAdmin
#2002 - The server is not responding (or the local MySQL server's socket is not correctly
configured)
Open phpMyAdmin in New window
Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning:
Unknown: Failed to write session data (files). Please verify that the current setting of
session.save_path is correct () in Unknown on line 0
http://localhost/projects/myadmin/
mysql login
user: root
password: ""
Solution: Just create enough space in the partition and start mysql service this will fix issuse
How to Access USB Drive In Linux
Hi All
First Step is to Insert PenDrive into Any Linux PC.Then
Open the Terminal and type Below Commands
#fdisk -l
ram@ram-laptop:~$ sudo fdisk -l
[sudo] password for ram:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5099 40957686 7 HPFS/NTFS
/dev/sda2 5100 19457 115330635 f W95 Ext'd (LBA)
/dev/sda5 5100 9561 35840983+ 7 HPFS/NTFS
/dev/sda6 9562 19048 76204296 83 Linux
/dev/sda7 19049 19457 3285261 82 Linux swap / Solaris
Disk /dev/sdb: 4022 MB, 4022337536 bytes
255 heads, 63 sectors/track, 489 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0105a552
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 490 3928032+ b W95 FAT32
Partition 1 has different physical/logical endings:
phys=(488, 254, 63) logical=(489, 5, 28)
Here in the above List Look for Last Device that Got Detected By Linux PC.It would be FAT32
Then Next Step is to Mount the Device /dev/sdb1(Note it could vary in each user case) to any Folder in your PC As mentioned in the Below Mentioned Example.
#mount /dev/sdb1 /mnt
#cd /mnt
#ls
Here in my case i am mounting my Device to /mnt Directory .
First Step is to Insert PenDrive into Any Linux PC.Then
Open the Terminal and type Below Commands
#fdisk -l
ram@ram-laptop:~$ sudo fdisk -l
[sudo] password for ram:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080
Device Boot Start End Blocks Id System
/dev/sda1 * 1 5099 40957686 7 HPFS/NTFS
/dev/sda2 5100 19457 115330635 f W95 Ext'd (LBA)
/dev/sda5 5100 9561 35840983+ 7 HPFS/NTFS
/dev/sda6 9562 19048 76204296 83 Linux
/dev/sda7 19049 19457 3285261 82 Linux swap / Solaris
Disk /dev/sdb: 4022 MB, 4022337536 bytes
255 heads, 63 sectors/track, 489 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0105a552
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 490 3928032+ b W95 FAT32
Partition 1 has different physical/logical endings:
phys=(488, 254, 63) logical=(489, 5, 28)
Here in the above List Look for Last Device that Got Detected By Linux PC.It would be FAT32
Then Next Step is to Mount the Device /dev/sdb1(Note it could vary in each user case) to any Folder in your PC As mentioned in the Below Mentioned Example.
#mount /dev/sdb1 /mnt
#cd /mnt
#ls
Here in my case i am mounting my Device to /mnt Directory .
How to Use VI Editor
Below is the Usefull tips to Operate VI Editor.
1) Press "i" to insert some data .
2) Press Escape twice and and type ":wq" and hit Enter to save and Exit.
3) To Undo the Work Press "u"
1) Press "i" to insert some data .
2) Press Escape twice and and type ":wq" and hit Enter to save and Exit.
3) To Undo the Work Press "u"
Sunday, October 25, 2009
Selenium Get Attribute of Fields
Selenium Get Attribute of Fields
Below is an Example to get Attribute of Text Box using Selenium :
package Selenium;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.SeleniumServer;
public class Main_Test extends SeleneseTestCase {
public void setUp() throws Exception {
/*
* Startting Selenium Server from Test Case itself
* */
SeleniumServer s = new SeleniumServer();
s.start();
/*
* Opening Google web page in Firefox
* */
setUp("http://www.google.co.in//", "*firefox");
}
public void testNew() {
selenium.open("http://www.google.co.in//");
/*
* Getting Property of Text Field like maxlength and size of Text Field
*
* */
String collectTextProperty = selenium.getEval("var property = new Array(); " +
"property[0] = window.document.getElementsByName('q')[0].maxLength;" +
"property[1] = window.document.getElementsByName('q')[0].size; property.toString();");
/* Replace getElementsByName('q') in this 'q' by element id of Textbox*/
String[] Textproperties = collectTextProperty.split(",");
for (int i = 0; i < Textproperties.lenght();i++){
/*
*Textproperties[0] give maxlength of Text Box.
*Textproperties[1] give size of Text Box.
**/
}
selenium.type("q", "selenium");
selenium.stop();
}
}
Below is an Example to get Attribute of Text Box using Selenium :
package Selenium;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.SeleniumServer;
public class Main_Test extends SeleneseTestCase {
public void setUp() throws Exception {
/*
* Startting Selenium Server from Test Case itself
* */
SeleniumServer s = new SeleniumServer();
s.start();
/*
* Opening Google web page in Firefox
* */
setUp("http://www.google.co.in//", "*firefox");
}
public void testNew() {
selenium.open("http://www.google.co.in//");
/*
* Getting Property of Text Field like maxlength and size of Text Field
*
* */
String collectTextProperty = selenium.getEval("var property = new Array(); " +
"property[0] = window.document.getElementsByName('q')[0].maxLength;" +
"property[1] = window.document.getElementsByName('q')[0].size; property.toString();");
/* Replace getElementsByName('q') in this 'q' by element id of Textbox*/
String[] Textproperties = collectTextProperty.split(",");
for (int i = 0; i < Textproperties.lenght();i++){
/*
*Textproperties[0] give maxlength of Text Box.
*Textproperties[1] give size of Text Box.
**/
}
selenium.type("q", "selenium");
selenium.stop();
}
}
Selenium UI Testing
Selenium UI Testing
Below are methods that can be used to test position of element in web page
UI Testing can be done using these method
1. getElementHeight(java.lang.String locator)
2. getElementPositionLeft(java.lang.String locator)
3. getElementPositionTop(java.lang.String locator)
4. getElementWidth(java.lang.String locator)
Below are methods that can be used to test position of element in web page
UI Testing can be done using these method
1. getElementHeight(java.lang.String locator)
2. getElementPositionLeft(java.lang.String locator)
3. getElementPositionTop(java.lang.String locator)
4. getElementWidth(java.lang.String locator)
Selenium PDF Testing
I came across queries related to Testing PDF in web page . As after clicking on PDF link , PDF file on on same page , But we can not either verify Text or any content on that page.
So I thought of copying that data into text File and comparing data in that Text File with actuall Text File.
As we know that after pressing CTRL+A ,CTRL+C text are stored in clipboard. So we can move that data in Text File .
Example given below is performed on selenium forum site itself.
Below is Java code for that
TextClipBoard Class where actuall data from PDF is moved to text file .
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import java.awt.event.KeyEvent;
import java.io.*;
public class TextClipBoard extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://seleniumhq.org/", "*chrome");
}
public void testNew() throws Exception {
/*
* Opening Selenium Site
*/
selenium.open("/");
/*
* Clicking on link Forums
*/
selenium.click("link=forums");
/*
* Waiting for Elements presence because , while Testing page is getting timeout after
* default timeout period , So I searched for Communities keyword in that page
*/
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("css=h4:contains(\"Communities\")")) break; }
catch (Exception e) {}
Thread.sleep(1000);
}
/*
* Clicking on recently posted link in forum site
*/
selenium.click("link=Clover report for Selenium tests");
/*
* Waiting for Default Timeout period
*/
selenium.waitForPageToLoad("30000");
/*
* Clicking on View as pdf link
*/
selenium.click("link=View as PDF");
/*
* Maximizing window and moving focus to that page
*/
selenium.windowMaximize();
selenium.windowFocus();
pause(10000);
selenium.keyDownNative(String.valueOf(KeyEvent.VK_CONTROL)); //Stands for CONTROL
pause(1000);
selenium.keyPressNative("65"); // Stands for A "ascii code for A"
pause(4000);
selenium.keyDownNative(String.valueOf(KeyEvent.VK_CONTROL));//Stands for CONTROL
pause(1000);
selenium.keyPressNative("67"); // Stands for C "ascii code for C"
/*
* Below code is call to Text Transfer class so as to retrieve data from Clip Board
* As we know that after copying data using ctrl+A and ctrl+C data remain in clip board
* We can move that data into Text File
*/
TextTransfer textTransfer = new TextTransfer();
//display what is currently on the clipboard
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
pause(4000);
selenium.stop(); // Kill the Browser
/*
* Writing data into Text File so as to compare these data with actual data.
* */
Writer output = null;
String text = textTransfer.getClipboardContents();
File file = new File("D:\\write.txt");
output = new BufferedWriter(new FileWriter(file));
output.write(text);
output.close();
try{
FileInputStream fstream = new FileInputStream("D:\\write.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println ("Reading from File line by line : " +strLine);
}
//Close the input stream
in.close();
}
catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
TextTransfer class to retrieve data from Clipboard
package Selenium;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.Toolkit;
import java.io.*;
public final class TextTransfer implements ClipboardOwner {
public static void main (String... aArguments ){
TextTransfer textTransfer = new TextTransfer();
//display what is currently on the clipboard
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
//change the contents and then re-display
textTransfer.setClipboardContents("blah, blah, blah");
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
}
/**
* Empty implementation of the ClipboardOwner interface.
*/
public void lostOwnership( Clipboard aClipboard, Transferable aContents) {
//do nothing
}
/**
* Place a String on the clipboard, and make this class the
* owner of the Clipboard's contents.
*/
public void setClipboardContents( String aString ){
StringSelection stringSelection = new StringSelection( aString );
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents( stringSelection, this );
}
/**
* Get the String residing on the clipboard.
*
* @return any text found on the Clipboard; if none found, return an
* empty String.
*/
public String getClipboardContents() {
String result = "";
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//odd: the Object param of getContents is not currently used
Transferable contents = clipboard.getContents(null);
boolean hasTransferableText =
(contents != null) &&
contents.isDataFlavorSupported(DataFlavor.stringFlavor)
;
if ( hasTransferableText ) {
try {
result = (String)contents.getTransferData(DataFlavor.stringFlavor);
}
catch (UnsupportedFlavorException ex){
//highly unlikely since we are using a standard DataFlavor
System.out.println(ex);
ex.printStackTrace();
}
catch (IOException ex) {
System.out.println(ex);
ex.printStackTrace();
}
}
return result;
}
}
So I thought of copying that data into text File and comparing data in that Text File with actuall Text File.
As we know that after pressing CTRL+A ,CTRL+C text are stored in clipboard. So we can move that data in Text File .
Example given below is performed on selenium forum site itself.
Below is Java code for that
TextClipBoard Class where actuall data from PDF is moved to text file .
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
import java.awt.event.KeyEvent;
import java.io.*;
public class TextClipBoard extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://seleniumhq.org/", "*chrome");
}
public void testNew() throws Exception {
/*
* Opening Selenium Site
*/
selenium.open("/");
/*
* Clicking on link Forums
*/
selenium.click("link=forums");
/*
* Waiting for Elements presence because , while Testing page is getting timeout after
* default timeout period , So I searched for Communities keyword in that page
*/
for (int second = 0;; second++) {
if (second >= 60) fail("timeout");
try { if (selenium.isElementPresent("css=h4:contains(\"Communities\")")) break; }
catch (Exception e) {}
Thread.sleep(1000);
}
/*
* Clicking on recently posted link in forum site
*/
selenium.click("link=Clover report for Selenium tests");
/*
* Waiting for Default Timeout period
*/
selenium.waitForPageToLoad("30000");
/*
* Clicking on View as pdf link
*/
selenium.click("link=View as PDF");
/*
* Maximizing window and moving focus to that page
*/
selenium.windowMaximize();
selenium.windowFocus();
pause(10000);
selenium.keyDownNative(String.valueOf(KeyEvent.VK_CONTROL)); //Stands for CONTROL
pause(1000);
selenium.keyPressNative("65"); // Stands for A "ascii code for A"
pause(4000);
selenium.keyDownNative(String.valueOf(KeyEvent.VK_CONTROL));//Stands for CONTROL
pause(1000);
selenium.keyPressNative("67"); // Stands for C "ascii code for C"
/*
* Below code is call to Text Transfer class so as to retrieve data from Clip Board
* As we know that after copying data using ctrl+A and ctrl+C data remain in clip board
* We can move that data into Text File
*/
TextTransfer textTransfer = new TextTransfer();
//display what is currently on the clipboard
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
pause(4000);
selenium.stop(); // Kill the Browser
/*
* Writing data into Text File so as to compare these data with actual data.
* */
Writer output = null;
String text = textTransfer.getClipboardContents();
File file = new File("D:\\write.txt");
output = new BufferedWriter(new FileWriter(file));
output.write(text);
output.close();
try{
FileInputStream fstream = new FileInputStream("D:\\write.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println ("Reading from File line by line : " +strLine);
}
//Close the input stream
in.close();
}
catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
}
TextTransfer class to retrieve data from Clipboard
package Selenium;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.Toolkit;
import java.io.*;
public final class TextTransfer implements ClipboardOwner {
public static void main (String... aArguments ){
TextTransfer textTransfer = new TextTransfer();
//display what is currently on the clipboard
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
//change the contents and then re-display
textTransfer.setClipboardContents("blah, blah, blah");
System.out.println("Clipboard contains:" + textTransfer.getClipboardContents() );
}
/**
* Empty implementation of the ClipboardOwner interface.
*/
public void lostOwnership( Clipboard aClipboard, Transferable aContents) {
//do nothing
}
/**
* Place a String on the clipboard, and make this class the
* owner of the Clipboard's contents.
*/
public void setClipboardContents( String aString ){
StringSelection stringSelection = new StringSelection( aString );
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents( stringSelection, this );
}
/**
* Get the String residing on the clipboard.
*
* @return any text found on the Clipboard; if none found, return an
* empty String.
*/
public String getClipboardContents() {
String result = "";
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//odd: the Object param of getContents is not currently used
Transferable contents = clipboard.getContents(null);
boolean hasTransferableText =
(contents != null) &&
contents.isDataFlavorSupported(DataFlavor.stringFlavor)
;
if ( hasTransferableText ) {
try {
result = (String)contents.getTransferData(DataFlavor.stringFlavor);
}
catch (UnsupportedFlavorException ex){
//highly unlikely since we are using a standard DataFlavor
System.out.println(ex);
ex.printStackTrace();
}
catch (IOException ex) {
System.out.println(ex);
ex.printStackTrace();
}
}
return result;
}
}
Selenium SSL Site Testing / Secure [HTTPS] Site Testing
Selenium SSL Site Testing / Secure [HTTPS] Site Testing
Selenium Secure Site [HTTPS] Testing
Below are steps that need to be followed to Test HTTPS – Secure Site :
Selenium uses its own Certificate for all https-connections, the Certificate is Cybervilian Certificate. We have to import the certificate into your Internet Explorer.
Please follow below steps to import Cybervilian Certificate.
1.Open Internet Explorer.
2.Navigate to Tool->Option.
3.Click on content Tab.
1.Now click on certificates button.
5.Click on Import button.
6.Click on Next > button.
7.Click on browse button.
8.Import cybervilliansCA .
9.Click on Next > button.
10.Again Click on Next > button.
11.Click on Finish button.
Image will be displayed as below on succesfull import of certificate.
12.Now open secure site:
Example: https://herald.cybage.com/exchange
13.Security Alert will be shown as below:
14. Click on View Certificate button.
15.Click on Install Certificate button .
16.Click on Next > button.
17.Click on Next > button.
18.Click on Finish button.
On Succesfull import of certificate
19.Click on yes button, After successful import of certificate .
20.Now you can run your Test Case.
First time while running HTTPS Test Case you may find alert box will be shown , click on OK and remember my decision .
Below example is used by be to Test my official Email Site, though password has been changed by me for confidential reason:
Below code is used to connect HTTPS site in Internet Explorer .
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class CertificateTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("https://herald.cybage.com/exchange", "*iexplore");
}
public void testSecureSite() throws Exception {
selenium.open("/exchweb/bin/auth/owalogon.asp?url=https://herald.cybage.com/exchange&reason=0");
selenium.type("username", "XXXXXX");
selenium.type("password", "XXXXXX");
selenium.click("SubmitCreds");
}
}
To run Test Case in Firefox . Please follow below steps:
1.Close all instance of Firefox .
2.Start Firefox from command prompt using command: firefox –ProfileManager
1.Create a new profile. You'll be prompted to choose a directory for the profile.
2.Select the profile and run Firefox using it.
3.Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
4.Accept the self-signed certificate when prompted. This creates an exception for it in the profile.
5.Close the browser.
6.Go to the Firefox profile directory.
7.Delete everything in the directory except for the cert_override.txt and cert8.db files.
8.Start Selenium Server using below command:
When you run your Selenium server pass a
-firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile (with certificate exceptions) as a basis for minting its new profile.
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class CertificateTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("https://herald.cybage.com/exchange", "*firefox");
}
public void testSecureSite() throws Exception {
selenium.open("/exchweb/bin/auth/owalogon.asp?url=https://herald.cybage.com/exchange&reason=0");
selenium.type("username", "XXXXX");
selenium.type("password", "XXXXX");
selenium.click("SubmitCreds");
}
Selenium Secure Site [HTTPS] Testing
Below are steps that need to be followed to Test HTTPS – Secure Site :
Selenium uses its own Certificate for all https-connections, the Certificate is Cybervilian Certificate. We have to import the certificate into your Internet Explorer.
Please follow below steps to import Cybervilian Certificate.
1.Open Internet Explorer.
2.Navigate to Tool->Option.
3.Click on content Tab.
1.Now click on certificates button.
5.Click on Import button.
6.Click on Next > button.
7.Click on browse button.
8.Import cybervilliansCA .
9.Click on Next > button.
10.Again Click on Next > button.
11.Click on Finish button.
Image will be displayed as below on succesfull import of certificate.
12.Now open secure site:
Example: https://herald.cybage.com/exchange
13.Security Alert will be shown as below:
14. Click on View Certificate button.
15.Click on Install Certificate button .
16.Click on Next > button.
17.Click on Next > button.
18.Click on Finish button.
On Succesfull import of certificate
19.Click on yes button, After successful import of certificate .
20.Now you can run your Test Case.
First time while running HTTPS Test Case you may find alert box will be shown , click on OK and remember my decision .
Below example is used by be to Test my official Email Site, though password has been changed by me for confidential reason:
Below code is used to connect HTTPS site in Internet Explorer .
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class CertificateTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("https://herald.cybage.com/exchange", "*iexplore");
}
public void testSecureSite() throws Exception {
selenium.open("/exchweb/bin/auth/owalogon.asp?url=https://herald.cybage.com/exchange&reason=0");
selenium.type("username", "XXXXXX");
selenium.type("password", "XXXXXX");
selenium.click("SubmitCreds");
}
}
To run Test Case in Firefox . Please follow below steps:
1.Close all instance of Firefox .
2.Start Firefox from command prompt using command: firefox –ProfileManager
1.Create a new profile. You'll be prompted to choose a directory for the profile.
2.Select the profile and run Firefox using it.
3.Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
4.Accept the self-signed certificate when prompted. This creates an exception for it in the profile.
5.Close the browser.
6.Go to the Firefox profile directory.
7.Delete everything in the directory except for the cert_override.txt and cert8.db files.
8.Start Selenium Server using below command:
When you run your Selenium server pass a
-firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile (with certificate exceptions) as a basis for minting its new profile.
package Selenium;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class CertificateTest extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("https://herald.cybage.com/exchange", "*firefox");
}
public void testSecureSite() throws Exception {
selenium.open("/exchweb/bin/auth/owalogon.asp?url=https://herald.cybage.com/exchange&reason=0");
selenium.type("username", "XXXXX");
selenium.type("password", "XXXXX");
selenium.click("SubmitCreds");
}
Subscribe to:
Posts (Atom)