Wednesday, December 10, 2014

Selenium WebDriver Wait

http://assertselenium.com/2013/01/29/webdriver-wait-commands/

Running Groovy Code From Java


public class CodeExecutor {

    /**
     * @param args
     */
    public static void main(String[] args) {
        runWithGroovyShell();

    }
   
    static void runWithGroovyShell()  {
        new GroovyShell().evaluate("println 'Hello World'");
      }

}

http://stackoverflow.com/questions/3989592/calling-a-groovy-function-from-java

Friday, December 5, 2014

Java Swing Design Patterns

Sharing a few good links for Swing Desing Paterns

  • https://www.link-intersystems.com/blog/2013/07/20/the-mvc-pattern-implemented-with-java-swing/
  • http://www.cs.wcupa.edu/rkline/java/mvc-design.html

Friday, February 1, 2013

SOAP URI

 

The SOAPAction field of the HTTP-Header identifies the purpose of the SOAP-HTTP request. The value of this field is a URI without special requirements due to presence or format. A HTTP client which sends a SOAP request has to use this header field.

Examples:

The presence of the SOAPAction field of the HTTP header can be used by firewalls to filter SOAP requests.
The field value of an empty String means the purpose of the request is to be determined from HTTP request URI itself (examples line 3).
No field value at all (examples line 4) means there is no hint for the purpose of the message provided.

Links
http://stackoverflow.com/questions/2262781/soap-action-wsdl

Saturday, January 26, 2013

Enums why cant we override equals

in the java.lang.Enum class equals method is like

 
 public final boolean equals(Object other) {
       return this==other;
 }

 
actually overriding it with something else d
oes not make sense hence its final. As for Enums equals() and == are the same things.

Java Generic < ? > vs < T >

Using "?" is the same as "any", whereas "T" means "a specific type". So, compare these interfaces:

public interface StrictClass {
 public T doFunction(Class class);
}



public interface EasyClass {
 public < ? >  doFunction(Class class);
}



When to use which one

There are also use cases for choosing over (or vice versa) that apply when you don't add type parameter to the class that encloses the method. For example, consider the difference between

public boolean add(List j) {
    boolean t = true;
    for (JLabel b : j) {
        if (b instanceof JLabel) {
            t = t && labels.add(b);
        }
    }
    return t;
}

and

public boolean add(List j) {
    boolean t = true;
    for (JLabel b : j) {
        if (b instanceof JLabel) {
            t = t && labels.add(b);
        }
    }
    return t;
}

The first method will actually not compile UNLESS you add an appropriate type parameter to the enclosing class, whereas the second method WILL compile regardless of whether the enclosing class has a type parameter

Using Type Tokens to Retrieve Generic Parameters

Interesting read

http://www.jquantlib.org/index.php/Using_TypeTokens_to_retrieve_generic_parameters