Thursday, 20 September 2012

Useful web tools

https://webcheck.me/
www.browserstack.com

Friday, 27 April 2012

Wrapped vs Bare in Doc/Lit web services


Best explanation that I have seen to date.  Includes a description of the constraints that need to be applied to wsdl to make it work

http://atmanes.blogspot.co.uk/2005/03/wrapped-documentliteral-convention.html


Saturday, 21 April 2012

PermGen In Grails

Found this useful tidbit on Grails Facebook page - how to fix Grails permgen issues


  • Hi ,default ram size occupied by jvm is 64MB you can increase it manually by the code given by santosh CATALINA_OPTS="-Xms256m -Xmx1024m -XX:MaxPermSize=256m". configure the above code in tomcat config file.
    Friday at 09:40 ·  ·  1
  • Prabhat Roy ‎2)Some time memory leak causes this problem, than abome wont work use profiler and chekout the code , dont include unnecessary jars and check the code module by module remove unneccessary object creation , if required call garbage collection explicitly to kill the useless objects. its bit difficult to debug.
    Friday at 09:44 ·  ·  1
  • Prabhat Roy ‎3)(a)Put JDBC driver in common/lib (as tomcat documentation says) and not in WEB-INF/lib
    (b)Don't put commons-logging into WEB-INF/lib since tomcat already bootstraps it
    Friday at 09:46 · 
  • Prabhat Roy new class objects get placed into the PermGen and thus occupy an ever increasing amount of space. Regardless of how large you make the PermGen space, it will inevitably top out after enough deployments. What you need to do is take measures to flush the PermGen so that you can stabilize its size. There are two JVM flags which handle this cleaning:

    -XX:+CMSPermGenSweepingEnabled
    This setting includes the PermGen in a garbage collection run. By default, the PermGen space is never included in garbage collection (and thus grows without bounds).

    -XX:+CMSClassUnloadingEnabled
    This setting tells the PermGen garbage collection sweep to take action on class objects. By default, class objects get an exemption, even when the PermGen space is being visited during a garabage collection.
    Friday at 09:47 · 
  • Prabhat Roy finally , in rare condition if nothing works than restart the server :)

Wednesday, 18 April 2012

JAXBElement and generateElementProperty

This had me perplexed for a while.

http://docs.oracle.com/cd/E19879-01/820-1072/ahiid/index.html

So, if you have for example a  name attribute which is a String and has minOccurs="0" nillable="true" for its schema element then there are 2 representations for "no value":

<person>
<name xsi:nil="true"/>
<age>21</age>
</person>

and:

<person>
<age>21</age>
</person>

Note that an empty String element is not the same:


<person>
<name/>
<age>21</age>
</person>

This can be interpreted as an empty String, "", rather than nil.


With this definition its not possible to marshal that in a way that does't lose information if you go direct to String, because you have to pick a representation when you unmarshal.

That is if you perform the marshalling activities xml -> String -> xml you have to pick which representation of nil to use in the final XML, and you have no information to allow you to determine which representation you came from.  So its possible they may end up different.

That's not good.  So JAXB doesn't do that by default.  Instead it wraps elements like this in JAXBElement rather than String so its xml -> JAXBElement -> xml, and the representation is preserved.

Said another way, you can avoid using JAXBElement if you pick the representation of nil you want for XML, by having minOccurs="0", nillable="false" for example.

Or, you can tell JAXB how to do it when you do wsdl2java by providing a binding file that contains generateElementProperty="false".

Interesting Grails Pugin - Melody

System reporting within your app.

http://grails.org/plugin/grails-melody
http://code.google.com/p/javamelody/

Thursday, 15 March 2012

Typefaces and response designs

http://beta.typecastapp.com/
http://responsive.is/

Nice way to make a sequential number look random

From here: http://stackoverflow.com/questions/611915/obscure-encrypt-an-order-number-as-another-number-symmetrical-random-appea/612085#612085

Useful if you want to use a sequential number as the unique reference for something, but want to obfuscate it so that its non-obvious that its a sequence

Pick a 8 or 9 digit number at random, say 839712541. Then, take your order number's binary representation (for this example, I'm not using 2's complement), pad it out to the same number of bits (30), reverse it, and xor the flipped order number and the magic number. For example:

1 = 000000000000000000000000000001

Flip = 100000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 010010000011001111111100011101 = 302841629

2 = 000000000000000000000000000010

Flip = 010000000000000000000000000000
839712541 = 110010000011001111111100011101
XOR = 100010000011001111111100011101 = 571277085

Tuesday, 24 January 2012

Command Prompt From Here In Windows

Shift + RClick on the folder

simples!

TripleDES block encryption and padding

What the various parts of a cipher string such as "DESede/ECB/PKCS5Padding" means:

http://www.informit.com/articles/article.aspx?p=26343&seqNum=4

Saturday, 14 January 2012

Useful Free Tools

www.BitBucket.com - free dvcs with git
www.cloudbees.com - free jenkins - cheap clous based test servers
http://www.rallydev.com - free agile planning
youtrack - free for public - cheap ($10 / month) private bug tracking

github does it all for $7 month for 1 user

Friday, 6 January 2012

Programmatic configuration of logging Handler for Axis 1.x client

This took ages to work out.

Mostly the web examples involve writing  a WSDD to configure a Handler subclass, but I wanted to create a handler which logged outgoing and incoming SOAP messages via Axis 1.4 and I wanted to programmatically control whether the handler was added to the axis client so that when logging was turned off, there were no unnecessary calls being made.

The code I used was to create a subclass of Axis BasicHandler to do what I wanted (by looking at the example LogHandler class provided by axis: http://kickjava.com/src/org/apache/axis/handlers/LogHandler.java.htm)

Then register it (when the configuration was turned on) using the below.  Note "css" is a service locator object that is created when you use WSDL2Java on the WSDL for the service being connected to.  This is done before you call getPort on the locator to get the service stub.


            SimpleProvider clientConfig = new SimpleProvider();
            AxisClientLogHandler logHandler = new AxisClientLogHandler();
            SimpleChain reqHandler = new SimpleChain();
            SimpleChain respHandler = new SimpleChain();
            reqHandler.addHandler(logHandler);
            respHandler.addHandler(logHandler);
            Handler pivot = new HTTPSender();
            Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler);
            clientConfig.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME, transport);

            css.setEngineConfiguration(clientConfig);
            css.setEngine(new AxisClient(clientConfig));