Eclipse – Stop auto jumping to the file in project explorer (disable link with editor)
February 25, 2013 § Leave a Comment
When you switch among opened files in eclipse, project explorer moves to the currently active file (in left pane). This can be annoying several times. To disable this just make sure icon with double arrows in Project Explorer (top right of Project explorer – see image below) is not pressed (this is called link with editor feature in eclipse):
iFrames, Javascript events and IE problems
September 11, 2012 § Leave a Comment
Several hours wasted while debugging this. We have a, HTML page and within this page is a hyperlink to open another page in iFrame. While iFrame page is loaded we display WAIT message overlay on parent page so as to make that inaccessible. So wait message overlay is behind iFrame and above the parent.
iFrame page was loading without any problem in FF, Chrome and IE. Problem happened with event handlers associated with textboxes on iFrame page. We have textboxes on iFrame page and “onchange” event handler is tied to each textbox. In FF and Chrome event handlers were working perfectly. But IE was showing very strange behavior. Onchange event was not fired when value was changed in textbox and focus was removed from it. It was being fired second time when I was bringing focus back into same textbox. That means IE was confusing onclick with onchange. I tested onblur and it was same problem. Onblur was being fired “onfocus”.
After spending so much time I finally figured out that problem was because Wait message overlay had “modal=true” set. Although Wait message was being shown behind the iFrame window by browser still this property was interfering with proper event handling by IE. When I changed Modal to false it started to behave as expected.
Connection Pool with Tomcat6 and Mysql
May 21, 2012 § 2 Comments
Inside $tomcat_home/conf/context.xml add this inside <Context>
<Resource name=”jdbc/datasourcename” auth=”Container” type=”javax.sql.DataSource” maxActive=”100″ maxIdle=”30″ maxWait=”1000″ username=”dbuser” password=”dbpwd” driverClassName=”com.mysql.jdbc.Driver” url=”jdbc:mysql://localhost:3306/exodus”/>
Now restart tomcat
Inside you web.xml add this before </web-app>
<resource-ref>
<description>My DB Connection</description>
<res-ref-name>jdbc/datasourcename</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Java code to connect:
Context initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup(“java:comp/env/jdbc/datasourcename”);
Connection connection = ds.getConnection();
MuleStudio – No option to Create New Mule Project
April 24, 2012 § Leave a Comment
I installed MuleStudio community edition on Ubuntu 11.04. MuleStudio was starting but showed no option to create new Mule Project. Since I have multiple versions of JDK installed, so before starting mule studio I was explicitly exporting JAVA_HOME to point to JDK 1.6 in same terminal window from which muleStudio was being started. But it was not making any difference.
After long struggle I finally figured out that Mule was ignoring JAVA_HOME exported on command line. Instead it always went into .bashrc to pick JAVA_HOME defined there (which was pointing to JDK 1.5 in my case). Once I changed JAVA_HOME in .bashrc, everything stated working as expected.
—
Update on next day…..
I tested again by NOT SETTING JAVA_HOME correctly, but set PATH properly (to point to jdk 1.6 bin). MuleStudio works fine in this case. That means MuleStudio does not look at JAVA_HOME value (at least for starting-up correctly).
But I guess it should go through JAVA_HOME to find JDK executables (like $JAVA_HOME/bin/java instead of direct java or may be there’s a configurable file with Mule to define JAVA_HOME and PATH only for Mule, need to look more)
Windows 7 – Control Startup Programs
March 27, 2012 § Leave a Comment
run msconfig and click on startup tab
Send email using gmail in Perl
March 22, 2012 § 2 Comments
Here’s sample code to send email via gmail smtp server, which uses TLS (transport layer security):
#!/usr/bin/perl -w
use Net::SMTP::TLS;
my $mailer = new Net::SMTP::TLS(
'smtp.gmail.com',
Hello => 'smtp.gmail.com',
Port => 587,
User => 'gmail userid',
Password=> 'gmail password');
$mailer->mail('from\@domain.com');
$mailer->to('targetuser\@userdomain.com');
$mailer->data;
$mailer->datasend("Subject:Email Subject");
$mailer->datasend("From:From Name<from\@domain.com>\n");
$mailer->datasend("To:targetuser\@userdomain.com");
$mailer->datasend("This is the email body");
$mailer->dataend;
$mailer->quit;


