If you install the latest version of Google Chrome (mine is 5.0.375.125), flash player debug version do not work in it; though the same debug player is working fine in Firefox3. Reason is that Chrome now comes pre-installed with the Flash player which get used by default, despite whatever other version you might have installed. It always use its original version. To change this, follow below steps:
- Open Google Chrome
- Type about:plugins in the url, - It will show the list of all the plugins
- Click on the "Disable" link of "Shockwave Flash" plugin
It will not disable flash, but just the built in version. Now the chrome will use the system-wide flash player version (probably the debug version).
Wednesday, August 4, 2010
Flash Player debug version on New Google Chrome
Posted by
Vishnu Agrawal
at
10:38 AM
0
comments
Labels: flash version
Wednesday, February 24, 2010
Unix: Get a file's name, extension and directory name
file="/usr/local/bin/test.sh"
# get extension; everything after last '.'
ext=${file##*.}
# will return 'sh'
# everything after last '/'
basename=${file##*/}
# will return 'test.sh', similar to 'basename'
# everything before last '/'
basename=${file%/*}
# will return '/usr/local/bin', similar to 'dirname'
# back one directory
basename=${file%/*/*}
# will return '/usr/local'
Posted by
Vishnu Agrawal
at
8:13 AM
0
comments
Labels: linux
Saturday, January 16, 2010
Share files between local and remote computer using Remote Desktop Connection
One of the most common tasks you'll need to do when using an Remote Desktop Connection is transfer a file from your local machine to the remote machine that you're logged into. During a Remote Desktop session, you can gain easy access to your local disk drives on the remote computer so that you can transfer files between these two systems in the same way that you copy files from a network share.
1. Click Start ->All Programs->Accessories->Remote Desktop Connection.
2. Click Options, and then click the Local Resources tab.
3. Click Disk Drives and then click Connect.
4. When you get logged into the remote box, open My Computer and you'll see that all the local drives will show up as mapped disk drives.
5. Now you can transfer your file as you do in local system.
Posted by
Vishnu Agrawal
at
11:06 AM
0
comments
Labels: system
Thursday, January 14, 2010
Remove a file whose name begins with "-"
Due to a bug in our product the log file was being created with the name "-server.log" (instead of "host-server.log"). Once the issue was fixed, i was trying to remove the file. Tried single quote/double quote/escape, but nothing worked. Finally after googling, found solution for it. Since the file name begins with the "-", all the unix commands treats the file name itself as a parameter to the command. To make it work put -- or ./ before the file name.
example:
rm -- -server.log
rm ./-server.log
Posted by
Vishnu Agrawal
at
11:09 PM
0
comments
Labels: solaris
Thursday, January 7, 2010
Paragliding in Manali
Last Christmas I went on vacation in Manali (Himachal) with my friends. One of the adventure we planned for the trip was Paragliding and we all were excited about it. By googling, we found out that Paragliding could be done in Solang Valley of Manali.
After reaching Manali, we enquired about the paragliding packages in Solang Valley. Most of the tour agents offered us 3 packages Short, Fly, Mediaum Fly and High fly. While roaming into Manali market, we noticed a tour agency which was offering paragliding in comaprtive cheaper rates. We talked to sales guy of that agency and he told us that they do offer pragliding in Naggar Village (which is 20 kms away from Manali). After having talk with him, we found it to be excited (though we were not sure, how would it be as we hven't heard of it before but we thought of giving it a try). Finally we gave him advance payment. He asked us to reach a particular destination (Heritage Hotel) which was 16 km from the Manali, from where their guys were supposed to pick us.
After half an hour we reached the Heritage hotel where one guy was waiting for us. We parked our car there and we sit in the Jeep which that guy was driving. REAL ADVENTURE starts from here.
Next 4 km was a mountain road with blind curves and had a road space only for a single Car/jeep. That guy started the Jeep and he was driving on that ride like he is running a ferrari on that road . We asked him that Jeep has Brake, you can apply them, he answered that if he would apply break then how would the jeep drive -:). Moreover, after half of our drive, we knew that the jeep do not have power steering. The experince in this 4 km drive was hilarious and full of adventure :). Finally we reached a point from where we have to trek to a top of mountain from where our glides were suppose to take off. Ohhh My GOD, that was again a surprise for us... we had to treck for around 2 kms. to reach at peak of the hill. No problem as we all like the trekking .. we started treking and reached on top in around 25 mins.
We were around 2500ft above from the ground and the view was fantastic from there. We had a rest there for some time as we were tired of the trekking. After some time the guys were ready with the glide and I was the first one to start. The pilot prepared me for the drive (helmet and glide dress which was tied with the glides), then Finally it was time to take off. We (me and my pilot) have to run for few distance and then jump from the hill.
"I ran slowly against the wind and suddenly, i felt an elevating force. In an instant, my feet were no longer touching the ground and i went into gentle decent.... The act of flying gives one sensations that are extraordinary and absolutely indescribable"
I was roaming in air around 2500 ft above from the ground. The surrounding hills and ground looks amazing from the top. After around 10-12 mins we landed in fields and this whole experience was amazing.
After a day, we went to Solang Valley for sight seeing. We saw the guys doing paragliding there. We didn't like it as the take off height was so short and the duration was only for couple of minutes. For us it was like swimming in a pond while we already swim in the sea :-)
Guys, if you want to do real paragliding, then you should go for this one.

Posted by
Vishnu Agrawal
at
9:06 PM
1 comments
Labels: Paragliding, travel
Saturday, October 24, 2009
Using variable with sed inside a shell script
For using sed inside a shell script, The variable should be in "double quotes" and the command in 'single quotes'. Following is the example
#!/bin/bash
usage () {
echo "$0 -s < name> -r <replace name> -f <file name>"
exit
}
while getopts s:r:f: option
do
case "$option" in
s) search="$OPTARG";;
r) replace="$OPTARG";;
f) filename="$OPTARG";;
\?) usage
esac
done
sed -i 's/'"$search"'/'"$replace"'/g' "$filename"
Posted by
Vishnu Agrawal
at
10:39 PM
0
comments
Labels: sed, shell scripting
Saturday, October 3, 2009
https redirection handling in httpunit
In httpunit when you are requesting a http page and if the page internally redirects to a https page, httpunit throws following error and response is not received:
sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: timestamp check failed
To resolve this error, add following code in your httpunit program.
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.*;
try{
SSLContext context = SSLContext.getInstance("SSLv3");
TrustManager[] trustManagerArray = { new NullX509TrustManager() };
context.init(null, trustManagerArray, null);
HttpsURLConnection.setDefaultSSLSocketFactory(context.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new NullHostnameVerifier());
}catch(Exception e) {
e.printStackTrace();
}
class NullX509TrustManager implements X509TrustManager {
/* Implements all methods, keeping them empty or returning null */
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
}
class NullHostnameVerifier implements HostnameVerifier {
public boolean verify(String hostname, SSLSession session) {
return true;
}
}
Posted by
Vishnu Agrawal
at
4:23 PM
0
comments
Getting thread dump for java application
When an java application server freezes or becomes non-responsive, it is recommended to generate a thread dump for the application. A thread dump is a user-friendly snapshot of the threads and monitors in a Java Virtual Machine (JVM). A thread dump can range from fifty lines to thousands of lines of diagnostics depending on how complex your application is.
On UNIX platforms you can send a signal to a program by using the kill command. This is the quit signal, which is handled by the JVM. On Solaris you can use the command kill -QUIT process_id, where process_id is the process id of your Java program.
run the command kill -QUIT
On Windows platform, enter the key sequence <CTRL> <break>
Thread States :: The key used for the thread states in Thread dump is:
R ==> Running or runnable thread
S ==> Suspended thread
CW ==>Thread waiting on a condition variable
MW ==> Thread waiting on a monitor lock
MS ==> Thread suspended waiting on a monitor lock
Posted by
Vishnu Agrawal
at
3:57 PM
0
comments
Labels: java
Monday, July 20, 2009
Run sql query from command line
We all know to run sql scripts (.sql files) from command prompt but sometimes we need to run a sql query from command prompt. It is sometimes necessary when we have to fetch a query result from a script (shell/perl) and process it. By following way, we can run a sql query from command prompt.
echo "select * from dual;" | sqlplus -S user/pwd\@sid
Posted by
Vishnu Agrawal
at
8:16 PM
0
comments
Labels: perl script, sql
Send Email from perl script
Sometimes we do not have enough privileges to install perl modules on the host system and we have to work with ideal installation of perl. In that case, simpler way to send emails using perl is to use sendmail command. Following function can be used to send emails in perl.
sub sendEmail
{
($from, $to, $subject, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);
}
above function can be used as below:
sendEmail("vishnu\@test.com", "vishnu\@mytest.com", "Test sendEmail.", "Testing sendEemail function.");
Posted by
Vishnu Agrawal
at
8:02 PM
0
comments
Labels: perl script