Monday, March 9, 2015

Jasper Report : Working with IN clause in SQL

Today had to work on a jasper report that has a IN clause in SQL.
The issue was , that the parameters were taken from UI in CSV format , so couldnt use the $X approach as described
http://stackoverflow.com/questions/6226447/passing-sql-in-parameter-list-in-jasperreport

The solution was

< parameter name="CNTRY_ID" isForPrompting="true" class="java.lang.String" / >
 < parameter name="CNTRY_ID_PARSED" isForPrompting="true" class="java.lang.String" >
        < defaultValueExpression >< ! [ CDATA [ $P { CNTRY_ID } . replaceAll(",","','") ] ] > < / defaultValueExpression>
 
   
and in the SQL query use it like

 where pt.subacct_id = gs.member_id
   and gs.CNTRY_ID IN ('$P!{CNTRY_ID_PARSED}')
 

Hope that helps

Friday, January 30, 2015

Oracle Reports Unable to Open Reports Builder 11g (Appears Minimized in Taskbar)

This helped me today
http://pitss.com/us/2013/11/25/unable-to-open-reports-builder-11g-appears-minimized-in-taskbar/

And this one
http://stackoverflow.com/questions/18185171/no-pl-sql-translation-for-the-bindtype-given-for-this-bind-variable

Wednesday, January 28, 2015

Handling classpath issues

Came across this issue today
java.lang.NoSuchMethodError    org.apache.commons.codec.binary.Base64.encodebase64

Eventually realized this was because the class Base64 was picked from wrong jar file... the ques was which one , I mean as i got this in web application ... so the hierarchy is not easy to trace.

I tried adding the following line before the exception
logger.debug(Base64.class.getProtectionDomain().getCodeSource().getLocation());

And then eventually modified the classpath settings to modify the issue.

Wednesday, January 21, 2015

Tomcat startup window disappears ?

https://navnith.wordpress.com/2008/12/31/tomcat-startup-window-disappears/

on Command Prompt type: catalina.bat run
this will ensure that the window stays and shows you what the error was which was causing the window to disappear

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