Saturday, December 26, 2009

Website monitoring services

Uptime Party, Pingdom, Watch Mouse, Site Uptime and Zoho’s Site 24×7

http://www.labnol.org/internet/tools/best-website-monitoring-services-for-site-uptime/4742/

http://www.labnol.org/internet/website-down-alerts/12096/

in reference to:

"Uptime Party, Pingdom, Watch Mouse, Site Uptime and Zoho’s Site 24×7"
- The Best Website Monitoring Services for Tracking Your Site’s Uptime (view on Google Sidewiki)

5 Useful Websites To Send Large Files Over the Internet

1. YouSendIt
2. FileDropper
3. WeTransfer
4. TransferBigFiles
5. FileBanker

in reference to: 5 Useful Websites To Send Large Files Over the Internet | Techtites (view on Google Sidewiki)

Wednesday, December 23, 2009

How to configure Oracle OCI Driver and connect to Oracle Database using OCI ( Type II ) Driver.

Oracle OCI driver is also called the 'thick' driver, because of its thick native code it uses to communicate with the database. OCI expands to Oracle Call Interface, its written in C language and all the Java calls use JNI to direct the calls to the C layer. The C layer does the talking with the database and returns the results to the Java layer. Even thoug C is the fastest way to communicate with database, the overhead incurred during in the JNI layer makes it a bit slower than the 100% Java thin driver. But in some cases the OCI driver beats the thin driver, i am yet to a performance analysis on that.

In a nutshell, the Oracle OCI (thick) driver uses Oracle Call Interface (written in C and is native code ) to communicate with the database. Hence, all Java calls have to be mapped to the C calls in OCI. Due to this mapping, the driver classes must be in sync with the OCI files - this results in connection problems which are listed and solved below.

Here are the steps that have to be done to Connect to Oracle database using Oracle OCI driver.

ORACLE_HOME : This refers to the folder where Oracle Client or Database has been installed.
Example D:\oracle9i , /home/oracle/orahome. This folder will have sub-folders such as bin, sqlj, network, rdbms, jdbc, jlib, lib, ...etc.

Windows

1. Set ORACLE_HOME environment variable
2. Add ORACLE_HOME\lib to System PATH
3 Set CLASSPATH environment variable to use Oracle JDBC driver from ORACLE_HOME\jdbc\lib

*nix ( Linux / Unix )

1. Set ORACLE_HOME environment variable
2. Add ORACLE_HOME/lib to LD_LIBRARY_PATH env variable
3 Set CLASSPATH environment variable to use Oracle JDBC driver from ORACLE_HOME/jdbc/lib.

While connecting to Oracle Database using OCI driver, here are some of the error messages that you might encounter. If the error message matchs, then the answer to the checklist question must be 'yes', else perform the nesseccary operation to answer 'yes'.

Example :

Is the jdbc driver from ORACLE_HOME/jdbc/lib ?

- If you are using a classes12.jar taken from an other location other than this, then your answer will be no. Hence you will have to use the jdbc driver from ORACLE_HOME/jdbc/lib.

Error Messages and Solutions For Windows Platform

Error Message : Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9.dll in java.library.path
Checklist :
1. Is ORACLE_HOME environment variable set
2. Is ORACLE_HOME\bin added to System path
3. Is ORACLE_HOME\lib added to System path

Error Message : Exception No Such Method : make_c_state error
Checklist :
1. Is ORACLE_HOME\lib added to System path
2. Is the JDBC driver used to connect to database is taken from ORACLE_HOME\jdbc\lib

Error Message : Exception in thread "main" java.lang.NoSuchFieldError: envCharSetId
Checklist :
1. Is ORACLE_HOME\lib added to System path
2. Is the JDBC driver used to connect to database is taken from ORACLE_HOME\jdbc\lib

Error Messages and Solutions For *nix (Linux / Unix) Platform

Error Message : Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
Checklist :
1. Is ORACLE_HOME environment variable set
2. Is ORACLE_HOME/lib added to LD_LIBRARY_PATH

Error Message : Exception in thread "main" java.lang.NoSuchFieldError: envCharSetId
Checklist :
1. Is ORACLE_HOME environment variable set
2. Is the JDBC driver used to connect to database is taken from ORACLE_HOME/jdbc/lib

Error Message : make_c_state error
Checklist :
1. Is ORACLE_HOME/bin added to System path
2. Is the JDBC driver used to connect to database is taken from ORACLE_HOME/jdbc/lib

Error Message : Error connecting to database : java.sql.SQLException: internal error: oracle.jdbc.oci8.OCIEnv@291aff
Checklist :
1. Is ORACLE_HOME environment variable set

I am just putting down the stack trace down here so that search engines will index them too.

Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

-- Set classpath to Oracle JDBC drivers

---------------------
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path

Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:300)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:370)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:505)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:342)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at JDBCOCITest.dbconnect(JDBCOCITest.java:40)
at JDBCOCITest.main(JDBCOCITest.java:30)

-- LD_LIBRARY_PATH has not been set, set LD_LIBRARY_PATH to ORACLE_HOME/lib
---------------------

Error connecting to database : java.sql.SQLException: internal error: oracle.jdbc.oci8.OCIEnv@291aff
Refer to http://myjdbc.tripod.com/basic/jdbcoci.html for the appropriate solution to this error
Exception in thread "main" java.sql.SQLException: internal error: oracle.jdbc.oci8.OCIEnv@291aff
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:188)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:230)
at oracle.jdbc.oci8.OCIEnv.getEnvHandle(OCIEnv.java:79)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:390)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:370)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:505)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:342)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at JDBCOCITest.dbconnect(JDBCOCITest.java:40)
at JDBCOCITest.main(JDBCOCITest.java:30)

-- ORACLE_HOME not set

---------------------

Connecting with URL=jdbc:oracle:oci8:@ias904 as scott/tiger
Exception in thread "main" java.lang.NoSuchFieldError: envCharSetId
at oracle.jdbc.oci8.OCIEnv.get_env_handle(Native Method)
at oracle.jdbc.oci8.OCIEnv.getEnvHandle(OCIEnv.java:70)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:390)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:361)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va:485)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:337)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at JDBCOCITest.dbconnect(JDBCOCITest.java:40)
at JDBCOCITest.main(JDBCOCITest.java:30)

-- wrong version of classes12.jar is being used, use classes12.jar from ORACLE_HOME/jdbc/lib

---------------------


Connecting with URL=jdbc:oracle:oci8:@ias904 as scott/tiger
Error connecting to database : java.sql.SQLException: ORA-12154: TNS:could not resolve service name

Refer to http://myjdbc.tripod.com/basic/jdbcoci.html for the appropriate solution to this error
Exception in thread "main" java.sql.SQLException: ORA-12154: TNS:could not resolve service name

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:477)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:346)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at JDBCOCITest.dbconnect(JDBCOCITest.java:40)
at JDBCOCITest.main(JDBCOCITest.java:30)

-- The tnsname specified in jdbc url is incorrect, check if the names match in ORACLE_HOME/network/admin/tnsnames.ora

OCI Issues: Closed connection error when connection isn't being closed

java.sql.SQLException: Closed Connection
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439)
at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:653)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:338)
at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:490)
at oracle.jdbc.driver.T2CConnection.(T2CConnection.java:133)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)

in reference to:

"java.sql.SQLException: Closed Connection at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439) at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:653) at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:338) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490) at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133) at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185)"
- OTN Discussion Forums : Closed connection error when connection ... (view on Google Sidewiki)

Saturday, December 19, 2009

One button to merge all duplicate contacts

Managing a big address book can be a challenge, so it's no surprise that the top request for Google contacts is a fast, easy way to merge duplicate contacts. You've been able to merge contacts one-by-one for a while, but now we've added a single button that merges all your duplicate contacts at once. To clean up your contact list in one fell swoop, just click the "Find duplicates" button in the contact manager, review the merge suggestions (and uncheck any suggestions you don't want merged), and hit the "Merge" button.

in reference to:

"Managing a big address book can be a challenge, so it's no surprise that the top request for Google contacts is a fast, easy way to merge duplicate contacts. You've been able to merge contacts one-by-one for a while, but now we've added a single button that merges all your duplicate contacts at once. To clean up your contact list in one fell swoop, just click the "Find duplicates" button in the contact manager, review the merge suggestions (and uncheck any suggestions you don't want merged), and hit the "Merge" button."
- Official Gmail Blog: One button to merge all duplicate contacts (view on Google Sidewiki)

Amit's Gmail Account and Google Apps Got Hacked

My Gmail and Google Apps accounts were hacked recently but Google restored access in the next three hours. Here are lessons learned and tips that might prevent your Google Accounts from getting hacked.

in reference to: Gmail and Google Apps Account Hacked But Restored Soon After (view on Google Sidewiki)

What To Do When Your Gmail or Google Account is Hacked

Recover Google Account and Gmail access

in reference to: What To Do When Your Gmail or Google Account is Hacked (view on Google Sidewiki)

Friday, December 18, 2009

Speed up Grails in local environment

Typical error received in Grails:-
Running Grails application..
loading security config ...
2009-07-07 12:10:12,224 [main] ERROR plugins.DefaultGrailsPluginManager - Error configuring dynamic methods for plugin [validation:1.1.1]: java.lang.OutOfMemoryError: Java heap space
org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.OutOfMemoryError: Java heap space
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall(_GrailsBootstrap_groovy:86)
at _GrailsBootstrap_groovy$_run_closure2_closure13.doCall(_GrailsBootstrap_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:274)


Grails can seem very slow in development mode, with pages taking more than a second to load. If this applies to you, then try increasing the maximum heap size by setting the

JAVA_OPTS

environment variable to something like this: '-Xmx512m' - this will set the maximum heap size to 512Mb when running Grails and should result in a noticeable improvement in response times.

As a workaround you can edit startGrails.bat and unconditionally put -Xmx to
JAVA_OPTS (search for related lines).

set JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -XX:MaxPermSize=1024m

in reference to:

"Grails can seem very slow in development mode, with pages taking more than a second to load. If this applies to you, then try increasing the maximum heap size by setting the JAVA_OPTS environment variable to something like this: '-Xmx512m' - this will set the maximum heap size to 512Mb when running Grails and should result in a noticeable improvement in response times."
- Grails - Quick Start (view on Google Sidewiki)

Find Your IP

If you want to connect to a PC via Remote Desktop (RDC), you need to know the IP address provided by your ISP. This page is an easy way to see the IP address provided by your ISP.

If you need to know the IP address of your computer on your home network, click Start > Run type cmd in the Run open box and click OK. When the command prompt window opens, type ipconfig -all to see your computer's IP address on the network, your default gateway (the IP address of your router), and the MAC address of your network card (which comes in handy for MAC address filtering on your router).

in reference to:

"If you want to connect to a PC via Remote Desktop (RDC), you need to know the IP address provided by your ISP. This page is an easy way to see the IP address provided by your ISP. If you need to know the IP address of your computer on your home network, click Start > Run type cmd in the Run open box and click OK. When the command prompt window opens, type ipconfig -all to see your computer's IP address on the network, your default gateway (the IP address of your router), and the MAC address of your network card (which comes in handy for MAC address filtering on your router)."
- What is My IP Address - IP Devil Girl - IP Address Lookup (view on Google Sidewiki)

Google Toolbar 6.1.2009.1007b (Firefox)

I like the SideWiki feature. In fact, this post is from the SideWiki! It is in beta stage version is 6.1.2009

in reference to:

"Google Toolbar 6.1.2009.1007b (Firefox)"
- Google Toolbar 6.1.2009.1007b (Firefox) « netVietnam (view on Google Sidewiki)

Error in Pulse Explorer

Typically downloading the new Pulse installer and running it twice will recover broken Pulse Explorer installations. You can also use --repair on the installer to force a clean install

in reference to:

"Typically downloading the new Pulse installer and running it twice will recover broken Pulse Explorer installations. You can also use --repair on the installer to force a clean install"
- MyEclipse :: Eclipse plugin development tools for Java, JSP, XML, Struts, HTML, CSS and EJB (view on Google Sidewiki)

Java Melody : monitoring of JavaEE applications

I came across this tool http://code.google.com/p/javamelody/ which involves monitoring a Java/J2EE application by adding couple of JAR files and a few lines of code in web.xml. This allows us to monitor various aspects of application performance, session details, logging information etc in Testing and even Production environment. The information can be viewed in day/week/month format and also can be configured to send a weekly email report to the admin/developer about the application performance.

This does not perform any profiling or stores into database, so is considered lightweight i.e. should not degrade a lot performance-wise. ( http://groups.google.com/group/javamelody/browse_thread/thread/dfdb7101217ffcbc )

I decided to use it in my application which is a Struts based application in Test environment. I gave it a try by installing the required jars and modifying the web.xml Then I deployed the application and logged in to the application. I was not able to login due to some error. So I decided to check if the Java Melody page shows up. To access this I simply had to use http://server:9090/appname/monitoring and I was able to see the page. Then I scrolled down the different graphs to see a section Statistics System Error Log which shows me the SQL executed!!

So this gave me the error I would have otherwise searched in my log file. After fixing the error (database synonym grant issue), I played with the application and turned back to monitoring page. It gave me pretty good http and sql statistics. I also liked the way it can drill down to all SQL queries


You can check out the monitoring page at http://server:9090/appname/monitoring . You can click various graphs and also hit the Details to get more detailed information.

It can be used it to monitor application with respect to their performance, logging data etc. in real-time.

in reference to:

"monitoring of JavaEE applications"
- javamelody - Project Hosting on Google Code (view on Google Sidewiki)

Use title attribute in HTML for Tooltips

title attribute described here can be used for tooltip. The text would show up on the tooltip

in reference to: H65: Using the title attribute to identify form controls when the label element cannot be used | Techniques for WCAG 2.0 (view on Google Sidewiki)

Tuesday, December 15, 2009

Subversion issues with Netbeans 6.8 upgrade

Upgraded to Netbeans 6.8

This client is too old to work with working copy 'C:\Projects\ProjectName'; please get a newer Subversion client
We strongly recommend to either install a newer Subversion client or downgrade your working copy.
Any local changes might corrupt your working copy and some file operations as copying, renaming and deleting will not work correctly.

Installed http://www.collab.net/downloads/netbeans/ to fix the issue

Saturday, December 05, 2009

Hide your Email Address with the help of Facebook

Another excellent post by Amit where he shows us how to use face book to generate image of the email address in different sizes and hide it!

Hide your Email Address with the help of Facebook

Simple Desktops

What Box Self Referential
Blue Pixels Simple Acorn
Expletive Wallpaper Victrola Gradients

Do you ever feel like the only good desktop wallpapers you can find are the either the basic 15 or 20 Apple provides or solid colors? Do you often find yourself spending time looking for something that isn't a beautiful photograph but also isn't a gradient and drop shadowed mess with a little lens flare and some annoying copyright information in the corner?

Do you want less, but not boring? Then you want Simple Desktops.

Simple Desktops: a collection of bling, drop shadow, and gradient free desktops to help keep you stay focused but also provide just enough eye candy to not be bored. It's here because finding these around the web is just too hard.

Attribution for the creation of these is given to the creator on the site, but it doesn't extend onto your personal desktop. Use of these desktop wallpapers is for personal use only and shouldn't be sold or reposted without the expressed written consent of the desktop wallpaper's creator.

Friday, December 04, 2009

MyEclipse does not build class files for web project

I had an interesting situation with MyEclipse not building new class files out of changed java code. It was trying to run an old copy of my application. There are a number of things you can do to fix this. Check which one works for you…

Solution:

Try and restart using -clean and see if that helps. On Mac, you will have to select the Eclipse executable and do "Show Contents" then edit the eclipse.ini file in there and add it at the top line.
Also, remove the deployment, clean your project and re-create the deployment. If it's still not working, clean the <workspace>/.metadata/.log file and retry it and see if an exception is getting reported.

Pop open your project properties for the troubled web project, and go to MyEclipse > Web and make sure the two text fields have valid Web Root and Context Root directories set.
Then go to the Java Build Path properties node and click the "Source" tab. Now double-check that your source directory or directories are setup correctly and that your output dir is set to the correct WEB-INF/classes output dir (you can use Browse to re-select it if it's blank).
Now go to Project menu, and select Clean. Make sure the project rebuilds completely without errors.
If you have errors, double-check them, they might be invalid library or project references, which will stop project building dead in it's tracks.

Project layout supported in MyEclipse: (Hopefully will be more flexible in the future)

/<project root>
   +/src <-- Java source code for web project (servlets, actions, forms, beans, etc.)
   +/docs <-- license files, readme's, etc
     +/api <-- Target for your Javadoc source generation
   +/lib <-- extra libs that the web app doesn't need while running
   +/webroot <-- this is the base of the webroot, this will be the root when deployed to Tomcat, etc.
     +index.jsp <-- example jsp file in root
     +/images <-- images for the website
     +/WEB-INF
       +/classes <-- build output directory
       +/lib <-- libs required for your webapp to run (i.e. struts.jar, etc.)
       +/conf <-- your custom conf files that you need for your app
       +/tld <-- taglibs