Monday, December 01, 2008

SQL - Find Possible Duplicate Records in Multiple Columns

 

Below is the code used to find possible duplicate records across multiple columns. Below I am trying to find duplicate rows in col1, col2 combined eg.

Consider the following ERD :- 

ERD

Table data:-

table data

Here row 2 and 3 are duplicate and the following SQL detects and finds such rows:-

SELECT a.* FROM test a INNER JOIN 
( 
    SELECT col1, col2 FROM test GROUP BY col1, col2 HAVING Count(*) >1 
) b 
ON (a.col1 = b.col1 
AND a.col2 = b.col2) 

Wednesday, November 12, 2008

Could not load driver OracleDriver. Could not get JDBC Connection nested exception is SQLException: No suitable driver

I was working on Spring web services with Axis and I received this strange error related to my c3p0 connections:


java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver [[oracle.jdbc.driver.OracleDriver]]

Could not get JDBC Connection nested exception is SQLException: No suitable driver


It seems this is because my bean was containing some white spaces since I had copied the settings from other project. Here is the correct configuration for c3p0 with Oracle 9i


 <bean id="dataSourceC3PO" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>oracle.jdbc.OracleDriver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:oracle:thin:@SERVER:1521:07</value>
</property>
<property name="user">
<value>USERNAME</value>
</property>
<property name="password">
<value>PASSWORD</value>
</property>
<property name="initialPoolSize">
<value>3</value>
</property>
<property name="acquireIncrement">
<value>3</value>
</property>
<property name="minPoolSize">
<value>1</value>
</property>
<property name="maxPoolSize">
<value>15</value>
</property>
<property name="maxStatementsPerConnection">
<value>100</value>
</property>
<property name="automaticTestTable">
<value>oracle_server</value>
</property>
<property name="numHelperThreads">
<value>20</value>
</property>
<property name="preferredTestQuery">
<value>select * from oracle_server</value>
</property>
</bean>



Do not forget to include Oracle driver ojdbc14.jar and c3po jar c3p0-0.9.1.2.jar in the class path.


Also, for those who need DBCP settings here they are:-


 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@SERVER:1521:07" />
<property name="username" value="USERNAME" />
<property name="password" value="PASSWORD" />
<property name="initialSize" value="2" />
<property name="maxActive" value="5" />
<property name="maxIdle" value="2" />
</bean>

Tuesday, November 11, 2008

Answers to Sun Certified Developer for Java Web Services Free Proficiency Assessment

1. Given:


10. <?xml version="1.0" encoding="utf-8" ?>

11. <employee firstName="John" lastName="Doe">

12. <id>12345</id>

13. <office number="100"/>

14. </employee>

Which is true?

firstName is an XML attribute.



2. Which is a requirement of a well-formed XML document?



complies with XML syntax rules



3. How does a Web service specify the parameter types it accepts?

The parameters are defined in an XML Schema.



4. Which restrictions are applied to attachments by the WS-I Basic Profile 1.1?

The Basic Profile allows attachments with any MIME type.



5. Which two are part of a SOAP document? (Choose two)

Envelope

Namespace



6. Which is true of SOAP in Web services?



Server side errors are transmitted to clients using SOAP.





7. Which is a valid WSDL element according to the WS-I Basic Profile 1.1?


<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>


<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/https"/>


<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>


<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/rmi"/>



8. Given:



11. public class PurchaseOrder {

12. public int poNumber;

13. public double amt;

14. public String customerName;

15. public java.util.Calendar orderDate;

16. }



The PurchaseOrder class is used as a parameter to a Web service. How is the PurchaseOrder class described in the service's WSDL document?



The class is a complex type and should be described in WSDL using an XML schema.



9. How does a client get the WSDL for a Web service from a UDDI registry?

The client retrieves the WSDL URI from the UDDI TModel.



10. The Java programming language does NOT support out or in-out parameters. The SOAP specification supports out and in-out. Which is true of out and in-out parameters?

JAX-RPC supports out or in-out parameters.



11. Which is required to build a stand-alone Java client to a Web service using JAX-RPC Dynamic Interface Invocation?

the qualified name of the Web service operation



12. A Web service takes requests from clients to render a series of JPEG images of a 3-dimensional object. The rendering may take hours or days. After the images are rendered, clients will connect again and retrieve them. Which invocation mode is appropriate for this service?

The service should use non-blocking RPC.





14. Which mapping is provided by JAXB?

an object mapping to an XML element



15. Which two are valid use cases for JAXB? (Choose two.)

Create an XML Document based on an XML Schema.

Load an XML Document into a document tree without validation.



16. Given the SOAP Envelope and Java code fragment in the Exhibit, what is the output?



EXHIBIT:

11. <SOAP-ENV:Envelope

12. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

13. <SOAP-ENV:Body>

14. <getAccountHolderName xmlns="http://account.sun.com/">

15. <acctNum>3</acctNum>

16. </getAccountHolderName>

17. </SOAP-ENV:Body>

18. </SOAP-ENV:Envelope>


11. SOAPMessage message = ...

12. SOAPBody body = message.getSOAPPart().getEnvelope().getBody();

13. Iterator i = body.getChildElements();

14. SOAPElement element = (SOAPElement) i.next();

15. System.out.println( element.getElementName().getLocalName() );


getAccountHolderName



17. Which two describe the use of JAXR in compliance with the WS-I Basic Profile 1.1? (Choose two.)

The provider must support UDDI registries.

The provider must support the level 0 profile.



18. Which three can be used by JAXR clients to query a registry? (Choose three.)

findServices

findOrganizations

findServiceBindings





19 Which method is NOT supported by the javax.transaction interface?

setStatus



20.Which is NOT included in the J2EE specification?

firewall-friendly EJB protocols



21. Which three are true of the JAXP? (Choose three.)

JAXP includes SAX.

JAXP includes DOM

JAXP includes XSLT



22. Which two correctly describe the Security Assertion Markup Language (SAML)? (Choose two.)

An assertion is a package of information that supplies zero or more statements made by a SAML authority.

SAML assertions are usually made about a subject.



23. The requirements for a particular Web service dictate that the security mechanism must support strong authentication of the client. The service will be implemented using HTTP, but may migrate to another form of transport. Which security mechanism will support these requirements?

XML Digital Signature



24. A J2EE compliant Web service is implemented with an EJB endpoint that uses declarative security. What two actions must a client do to access the Web service? (Choose two.)

The client must connect to the Web service as a security Principal mapped to a role defined in the endpoint's ejb-jar.xml file.

The client must connect to the Web service in a security Group defined in the endpoint's ejb-jar.xml file.



25 Which two are used to deploy EJB technology-based endpoints? (Choose two.)

EAR files

EJB-JAR files



26 Which messaging mode should a document-oriented Web service use according to the WS-I Basic profile?

Document/Literal



27 Which is NOT a characteristic of a Web services-based service oriented architecture?

Services are conversational.



28 Which is an example of the Business Delegate pattern?

A client calls a method that looks up a Web service in a UDDI registry and invokes it to calculate sales tax.



29 Given: An existing set of services consisting of Enterprise JavaBeans that is exposed to clients by creating a stateless session bean (facade) as an EJB endpoint. Which two are true? (Choose two.)

The existing Enterprise JavaBeans are the processing layer.

The endpoint is the service interaction layer.



30 Which two correctly define how the endpoint container implementation handles a document received in javax.xml.transform.Source format? (Choose two.)

The container automatically handles the document as an attachment.

The container implementation handles the document-passing.

Saturday, October 25, 2008

Another reason to chuck Cingular and ATT

Cingular and ATT sux. The family plan is of $70 and they have $17 in taxes and fees! I still miss my T-mobile : Awesome coverage, no billing issues!

Thursday, October 16, 2008

40 Ways To Save Power And Money

Conservation Tips
Easy Ways You Can Save Energy(and Money)

-In the Kitchen
-While Cooking
-Doing the Laundry
-Heating and Cooling

Tuesday, September 23, 2008

All you wanted to know about Google Chrome

Google's new Chrome Web browser is being hailed as a game-changer. It is fast, has a clean interface and some snazzy features that other browsers do not have.

Thursday, September 18, 2008

Top 10 tips for home users to secure WiFi networks

Before five bomb blasts ripped through Delhi on Saturday, an Islamic outfit known as the Indian Mujahideen sent an e-mail to various news organisations threatening a terror attack. On July 26, the same outfit shot out a similar e-mail minutes before the Ahmedabad blasts.

According to cyber crime cell, terrorists hacked into the wireless or WIFI Internet accounts of innocent citizens to send the e-mails.

This has become a big cause of concern in the IT community, as well as for the home user, since most have wireless networks.

Monday, September 15, 2008

JavaServer Pages (JSP) and JSTL - el-ignored / Tomcat 5.5.4

Sometimes Tomcat 5.5 does not evaluate EL expressions in JSPs rather you get the EL expression as the output. This can be because you have web.xml as version 2.3 compliant in which case you can change it to the newer 2.4 syntax. It can also be solved by including a snippet of code in all your JSPs. More : http://forums.sun.com/thread.jspa?threadID=613520&messageID=3394683

Thursday, August 21, 2008

Carbonrally – Simple, fun, and competitive ways to have a meaningful impact on climate change

Reduce global warming by taking quick & easy challenges.
Compete with others in your area and around the world.

Edison PC Power Management Software | Edison

Edison PC Power Management Software | Edison

Wednesday, August 13, 2008

NetBeans IDE 6.5 Beta Now Available for Download!

NetBeans.org is proud to announce the availability of NetBeans IDE 6.5 Beta!
NetBeans IDE 6.5 Beta introduces several new features, including a robust IDE
for PHP, JavaScript debugging for Firefox and IE, and support for Groovy and
Grails. This release also includes a number of enhancements for Java, Ruby and
Rails, and C/C++ development. Java feature highlights include: built-in
support for Hibernate, Eclipse project import, and compile on save.

Highlights include:
  • PHP
    • Code Completion
    • Quick Fixes and Semantic Checks
    • FTP Support
    • Debugging with Xdebug
    • Support for popular Web Services
  • Ajax/JavaScript
    • Debugging support for Firefox and IE
    • HTTP client monitoring
    • Bundled popular JavaScript libraries
  • Java
    • Groovy/Grails support
    • Compile/Deploy on Save
    • Eclipse project import and synchronization
    • Built-in Hibernate support
    • JSF CRUD Generator now Ajax-enabled
  • Database
    • Editor Improvements
  • C/C++
    • Improved code completion and error highlighting
    • Remote Development
  • Ruby
    • Support for Ruby Tests
    • Improved support for Rake build tool
  • GlassFish v3 "Prelude"
    • Small footprint, fast startup and deployment
    • Support for scripting, including jRuby
The final NetBeans IDE 6.5 release is planned for October 2008. As always, we
welcome and encourage feedback about your experience using the NetBeans IDE.
Visit our mailing lists or post a blog entry!

NetBeans IDE 6.5 - Development Simplified

Tuesday, July 22, 2008

NetBeans Wiki: SOAPNetBeans6


Wednesday, June 25, 2008

Creating EJB3 Using Netbeans And Glassfish

Netbeans 6.x brought nice features and let the web development much easier. You can create many things in a ".VS-style", in other words, drag-and-drop components on the User Interface. A good example of this it is the Visual Java Server Faces features from NetBeans 6 and the Web Service module.

Netbeans also brought Glassfish Application Server as its official server. Glassfish is the the RI (Reference Implementation) from JEE 5, therefore it is the better choice when you want to work with EJB 3.

Advanced Web Service Interoperability In Easy Steps | NetBeans Zone

This article is intended for programmers who are interested in adding additional qualities to their services, clients, or SOA solutions, as well as for beginners in Java web service development. You will learn how to use NetBeans IDE 6.1 to develop Java web service clients and services that can interoperate with Microsoft .NET 3.0 clients and services, how to use encryption and signatures to protect confidentiality and integrity of message transmission without need for SSL, and how to use Reliability features to ensure that none of your application messages are lost or delivered twice.

Wednesday, June 18, 2008

Top Firefox config tweaks

The Firefox homepage calls the web browser "fully customizable to your online life," and that's not just marketing claptrap. Beyond the extensive options available in its menus and dialogs, there's a lengthy set of advanced Firefox preferences that can customize the browser to your specific needs. Sure, your brother-in-law's not likely to edit Firefox's default configuration, but you? You're a power surfer and you want your web browser your way.

Firefox 3: Power User's Guide to Firefox 3

You already know about Firefox 3's marquee new features, but now it's time to dig deep and unearth the shortcuts, tweaks, and even Easter eggs that Mozilla marketing doesn't mention. In honor of today's official release of Firefox 3—at 10AM Pacific Time—let's dive in past Firefox 3's most talked-about feature-set into its lesser-known power uses, tricks, and customizations.

Saturday, June 14, 2008

Send Your Name to the Moon

Sign up to send your name to the moon. Names will be collected and placed onboard the LRO spacecraft for its historic mission bringing NASA back to the moon. You will also receive a certificate showcasing your support of the mission.

Tuesday, June 10, 2008

Sun Academic Initiative Program

Sun Academic Initiative Program

Take the online course of Sun technologies for FREE! based on 2 websites:
http://learningconnection.sun.com
http://sunsite.scut.edu.cn

Nearly 60% discount for the Sun Certificate !!!
SCJP: Sun Certified Java Programmer
SCSA: Sun Certified System Administration for the Solaris Operating System
Sun Certified Developer for Sun Application Server

Monday, June 02, 2008

Javadoc Analyzer in NetBeans 6.1

NetBeans 5.5 contained a useful tool called the ‘Javadoc Auto Comment’ feature. With the heavy rewrite of the NetBeans internals in version 6.0, the auto comment tool as we knew it was stripped out. This was down with some howling and protests, but at least there was a good reason (and not simply for the heck of it).

Send and receive SOAP messages with SAAJ

In this tip, author and developer Nicholas Chase shows you how to use the SOAP with Attachments API for Java (SAAJ) to simplify the process of creating and sending SOAP messages.

The foundation of Web services lies in the sending and receiving of messages in a standard format so that all systems can understand them. Typically, that format is SOAP. A SOAP message can be generated and sent manually, but the SOAP with Attachments API for Java (SAAJ) -- an offshoot of the Java API for XML Messaging (JAXM) -- automates many of the required steps, such as creating connections or creating and sending the actual messages. This tip chronicles the creation and sending of a synchronous SOAP message.

The process involves five steps:

1. Creating a SOAP connection
2. Creating a SOAP message
3. Populating the message
4. Sending the message
5. Retrieving the reply

SAAJ is available as part of the Java Web Services Developer Pack 1.2 (see Resources). This package also includes a copy of the Tomcat Web server (so you can host your own service) and sample applications.

Thursday, May 29, 2008

Free Open Source Counterparts of Windows Software | MakeUseOf.com

Why would you want to have Open Source software on your computer? Let’s consider a few reasons:
(1) First reason that every one thinks of is that Open Source software is free of cost, well it certainly is about 95% of the time but it can be paid too although the license will be less restrictive. Nevertheless it can save you hundreds of dollars.

(2) Another often overlooked aspect is that you can have full access to the source code of the software. This is a great blessing for someone who needs the ultimate customization.

(3) You can actually help in the development by fixing bugs, releasing your changes to the code (in accordance with the license of course).

(4) They may also offer more features then their commercial counterparts.

With that out of the way, lets get to the fun part and lets save some bucks. I will be giving information on my personal favorites (which would generally mean BETTER) open source replacements. There are however other choices as well, so drop a line or two if our choices differ!

Tuesday, May 27, 2008

Joomla Docman component upgrades

Upgrading from v1.3 RC1 or RC2

Docman Joomla buttons

I'm not seeing download/view/... buttons in the frontend - Joomlatools

Thursday, May 22, 2008

NDTV.com: Raise standard to compete with Indian kids: Obama

Inching closer towards clinching the Democratic presidential nomination, Senator Barack Obama has urged the American parents to raise the standards of their children so that they can compete with those from India and China in particular in the field of math and science.

Wednesday, May 21, 2008

soapUI plugins for Netbeans and Eclipse

soapUI is Free and Open Source and is used for Inspecting Web Services, Invoking Web Services, Developing Web Services, Web Service Simulation and Web Service Mocking and Functional Testing of Web Services Load Testing of Web Services over HTTP.
 
The soapUI NetBeans Plugin provides all soapUI functionality directly from within netbeans and eclipse allowing integrated development and testing environment for Web Services in java.
 
Read more :
 

The Castor Project

Castor is an Open Source data binding framework for Java[tm]. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.

Maven 2: Spring and JTA dependencies


Tuesday, May 06, 2008

6 Excellent Firefox Extensions Made To Save Your Time | MakeUseOf.com

If you are a die-hard Firefox user then I am sure you are always on the look-out for tips and tweaks to get more out of Firefox in less time and hence be more productive.

Keeping that in mind, I decided to list six Firefox extensions, which I use in my daily life and which have been extremely helpful in saving me a great deal of time. I hope you will find them useful too.

Sunday, April 20, 2008

Interesting...

Couple of days back I got to know the meaning of "Interested" "Not bad" and here it goes...

http://ibnlive.com/news/muslim-clerics-have-no-problem-with-flying-kingfisher/63655-3.html

Well, this way I would be fasting 365 days of the year.

Monday, March 17, 2008

Netbeans 6.1 Beta

For anyone who is considering upgrading Netbeans, I wanted to mention a few things I found in my upgrade process.

I originally upgraded to Netbeans 6.0 and found it a little slow. I tried upgrading to 6.0.1, but found it crashed on my desktop whenever I tried to start it.

More recently, I upgraded to 6.1 Beta and found it runs and starts up much faster.

I installed a separate tomcat (under c:\tomcat6) and during the install found that Netbeans recommends install tomcat using the zip file and not as a windows service. The windows service install does not create the startup and shutdown scripts used by netbeans to manage tomcat. The best way to install tomcat is to simply unzip the contents into a folder. To add the new server to Netbeans means clicking Add Server and pointing it to the folder. Pretty Simple...you can do the same install for JBoss if your interested.

Here's the recommended settings for the VM options under the Tomcat->properties->platform configuration screen: -server -Xms256m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512mYou may want to install tomcat into a folder that does not contain spaces, since linux does not support spaces. I'm using c:\tomcat6, any folder may work, but I have seen problems related to spaces in the path so I avoid putting tomcat under c:\Program Files which is windows default program install path.

So far, it seems to run better and starts much faster than prior versions. Also, any of the Netbeans 6 versions have much better support for CSS and Javascript editing. Then newer versions will highlight Javascript variable name spelling problems, which can save a lot of headaches when working with Javascript

Feature Highlights

* JavaScript Support

o Semantic Highlighting

o Code Completion and Type Analysis

o Quick Fixes and Semantic Checks

o Refactoring


* Performance Enhancements

o Up to 40% faster startup

o Smarter parsing so that code completion is faster

o Less memory consumption


* Spring Framework Support

o Bundled Spring Framework 2.5 library

o Wizards for XML configuration files and Spring Web MVC controllers

o Code completion of bean names and Java classes and properties

o Spring Web MVC framework support in web project


* New MySQL Support in Database Explorer

o Register MySQL servers

o View, create, and delete databases

o Easy launch of the administration tool for MySQL


* Java Beans Support

o BeanInfo Editor
o Generate Bean Property

o Bean Patterns in Navigator

* JSF CRUD Generator

o Quickly create a database application

o Supports one-to-one, one-to-many, and many-to-many entity relationships


* Ruby/JRuby Support

o Editor enhancements, including new hints and fixes

o Support for JRuby fast debugging

o Platform Manager

o Server and database integration improvements in Rails projects


* Javadoc Code Completion

o Supports standard tags: @param, etc.

o Code completion for parameters, exceptions, etc.


* Sharing Projects (AKA Sharable Libraries)

o More easily share projects with other members of your team through version control systems

o Specify libraries using relative library path for default Java, Web, and all Java EE project types

o Declare project dependencies with relative library paths

o Enable unattended builds for your projects


* New Update Center Modules

o ClearCase Support

o AXIS Support

o SOAP UI Support

Tuesday, February 12, 2008

Monday, February 04, 2008

9 Underrated Sandwiches - OMGLists.com - When we list, the world listens- The Ultimate Pop Culture List Site!

9 Underrated Sandwiches - OMGLists.com - When we list, the world listens- The Ultimate Pop Culture List Site!

Sometimes the best suck!

Google sucks :-) Yes ^2


Thank you for your email. Please be aware that at this time, phone support
isn't available for Google Checkout.
It appears that there was a minor technical error and, as a result, your
order was cancelled and your account was temporarily suspended. However,
upon further review, we can confirm that your account is now active and
performing as normal.
If you would like to re-process your transaction, you may do so by placing
another order in your original account. I can also confirm that you are
still eligible for the $10 bonus on your next purchase with this account.
Please keep in mind that our current promotion is limited to one per
person, as stated on: http://www.buy.com/corp/promos/google_offer.asp
Although you can create a separate account if you share a credit card,
this promotion is meant to be used once per person. If you would like to
make future purchases, we recommend that you use your originally created
account.
We apologize for any inconvenience this may have caused. If you experience
any difficulties, please feel free to contact us again.
Sincerely,
Gloria
The Google Checkout Team

Saturday, February 02, 2008

Thursday, January 31, 2008

Tuesday, January 22, 2008

ClipX

One of the things about Windows that aggravates me is that the clipboard can only hold one item at a time and once I reboot that item is lost. I found a neat little tool that is a clipboard manager called Clipx. You can have multiple items in the clipboard, manage them and have them survive a system reboot. If your interested here is the url: http://www.bluemars.org/clipx/

Tuesday, January 08, 2008

Bill Gates: Bill Gates Explains the Difference Between Microsoft and Apple

We asked the difference between Apple's approach and Microsoft's approach when it comes to product releases. Apple steers clear of products that might be iffy in their first iteration—portable music rentals; DVR—whereas Microsoft rolls out stuff that may not be quite ready. Bill's response is illuminating, direct and humble.

Monday, January 07, 2008

Shame Shame..Bucknor

I remember the same guy in 92 world cup with hilarious decisions . At a point he was called the NOT OUT umpire. I have serious doubts about his involvement in match-fixing. Shame shame..