Thursday, 20 August 2009

OutOfMemoryError: PermGen space in Tomcat 6. The Solution:

I'm blogging this as much for my own use as help for other's.

Every time I set up a new Tomcat server I forget these options! Once you find them keep them safe.

set JAVA_OPTS=-Xms256m -Xmx1024m -Xss96k -XX:MaxPermSize=512m -server -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled

It's the CMSClassUnloadingEnabled that prevents the OOM error. The memory options depend on your hardware.

To set these options for the Sand Box Server in eclipse goto window -> preferences. In the left hand view select servers click on the tomcat server and add the above to the startup options. I'd post a screen shot but I'm using MyEclipse which is a bit niche for most developers.

Thursday, 30 July 2009

Cross Domain AJAX Support with JSON-P

I was asked to get an online payment system working recenlty but the site was hosted away from the customer's site. Payment confirmation was on the customer's site and payments were run from WOLRDPAY. So my problem was how do you get the page to not accept payment twice for the same invoice? Answer a payment check service using ajax returning a simple paid/not paid response to the invoice id in the request. But in AJAX you can't do that because you're stepping off your domain.

Eventually I found JSON-P according to the browser implementation of XMLHTTPRequest the URL needs to be relative ie /ajax/CheckInvoice?invId=12345
I wanted http://some3rdpartysite/CheckInvoice?invId=12345

JSON is a way of encoding the XML request into key-value pairs but JSON-P adds a call back function that is created locally the AJAX request then looks at the local call, the local call wraps a function that calls the remote site. The Browser is not then aware of the cross domain aspect of the call and doesn't throw an exception. Job done, customer happy.

I'm not, though. Unfortunately there is some disagreement around whether or not this is a legit process. Many developers think that because JSON-P takes advantage of the fact that <script> tags are not evaluated, this is in fact a security flaw and should be plugged. So will my solution be broken by a future browser release? There is another school of thought that this is, in fact a legitimate process - certainly in this case, that should be handled appropriately and that until browser technology catches up JSON-P is a legit solution.

I agree with the latter. In my case the sites are all legitimate and it is simply a case of integrating two SAAS (Software As A Service) Services and that's becoming ever more important. The fact that they haven't been built to provide these services formally is more to do with the implementation rather than the principle.

Tuesday, 23 June 2009

Microgen Aptitude®

Having worked with Microgen Aptitude® development tool whilst employed by Microgen® I naturally included it on my CV. However, every time I go to an interview for a new contract I get asked “What is Microgen Aptitude?” and have to explain exactly what it is and why it's relevant to my work as a developer.

Microgen® is a Software Consultancy & Supply organisation focussing mainly on, but not limited to, the financial sector.

Aptitude® is described as "The Enterprise Class Business Process Management Suite" essentially a piece of software that allows you to define the data in your business and your organisations rules for processing that data. You can use the rules you create to generate business processes based on those rules and run those processes in an ordered manner. Including all the tools & facilities you've come to expect from an enterprise level development environment.

Data exists within an organisation in a number of forms Databases, files, message feeds etc. Aptitude® caters for all the common formats and has facilities for transforming these sources to Data Objects which can then be used to create rules.

This is interesting but nothing new. I can model my business objects in Java and map those objects to a Database schema using a ORM (Object Relational Mapping) tool like Hibernate Aptitude®, however, does this using a graphical development environment, which allows you to drag and drop entities around the development environment.

fig. 1 An example rule

fig. 2 An example of a business process designed with a source, rule, and target entities.

Graphically representing the elements of a business process gives a visual representation of the rules involved in a business process which, in turn, contributes to a better understanding of the rules and processes required to make business decisions. Not only this but there is no need to learn a complex 3rd generation programming language. Microgen® suggest that this tool can be used by a Business Analyst, however I, personally wouldn't go that far. You still need to have a strong technical understanding of software development to use Aptitude® efficiently. Not least because you'll more than likely be using it in conjunction with a database of some sort and that means an understanding of the Relational Model at least. Then there's understanding XML, messaging, SOA, Transactions processing, file formats.

The next most significant part of the Aptitude® suite is the ability to then use the it's built in Web interface designer. I'm not going into much detail in this article, but at a high level you can design a web page and deploy it to IIS or Tomcat in the more recent incarnations.
Looking a little like a Visual Basic style form designer, the design interface lets you drag and drop web widgets onto a 'page' and connect them to your Business Processes or Reference Objects. Once deployed you have a working web interface that can deliver functionality around your organisation based on a common set of business rules.

Pros: Graphical development environment, wizards to rapidly model existing objects from table/file specification, security model, test/debug environment,
Cons: Single vendor, fixed device interfaces, limited after market consultant base, slow costly development cycle, maturity.


Conclusion
If you've got the money, Aptitude® is a nice tool. Out of reach to all but the most well off organisations, however, as technologies like this become more popular and competition in the market place increases this may change.

Wednesday, 3 June 2009

B49

Attended a new networking organisation B49 (before Nine!) run by Nick Lofthouse keyfins.co.uk and his business partner. The group is a support and referral organisation and I've already benefited from help with invoicing, office space and contacts.

The group is located at Welwyn Garden City Golf Club and meets on a Tuesday from Seven Am until Nine

I met Matt from 3internet, great chap, even if he is a .NET guy ;)

They have a nice site, and do all sorts of MS based Web Applications including design and content management.

Back to the Blog

Wow it's been ages since I updated the Blog. I've been working hard for Microgen on a new Billing portal for Virgin Media (ntl:Telewest Business). It was an awesome project. In Four months we re-wrote the online billing application that they'd inherited through an acquisition.

Now it's leaner and meaner. User admin functionality, self sign-up, still with full integration with Microgen's eBilling architecture only now the load process is more maintainable and leveraging JSF, Spring, JPA & Hibernate, we managed to produce a lovely RIA. Only draw back is the configuration nightmare that was the project inception. So what next?

There's a phase II that I may or may not be involved in because I've got other projects to work on, although I'd love it if I could be part of it but Microgen is back up to strength in that department so maybe consultancy only.

I've been investigating other alternatives in the RIA market place. Currently I'm messing with Google's App Engine which I love, with GWT. I played with flex but there are issues there with page ranking, and forcing customers to use Flash - not a bad thing in itself but some people registered protests about moving away from vanilla web (silverlight? JavaFX?)

Friday, 18 July 2008

Linked, linked in and general networking.

Back to the blog after a nice family holiday at Bosinver Farm Cottages. A week in the west country 'on the farm' my eldest learnt to eat eggs, feed ducks, chickens and Chalky the Goat!

Getting back to the office, we're ramping up the design work on the new eBilling system. It's looking great. So much simpler than the existing system.

I've been evaluating charting tools for Java web apps. I've got a bit of a problem though. What ever we choose has to be used by the old struts I app. and the new JSF system. Hmmm that says mashup to me. use an ajax plugin. I found a java project that wraps flash - handy. Flash interactive animated charts inside a java web app. really though I should wait for JavaFX or maybe I could do something in Flex with a webservice.

Also I've finally got around to updating my web site to link into this blog. A bit of joined up thinking!

I found LinkedIn too not sure how useful it is - a sort of Facebook for grownups. I thought I'd take a look and then I found most of the people I work with on it and all this time I didn't know. How left out do I feel? Erm not much really.

I signed up for an Oracle BI hands on day in London and then got a call from a nice lady at Oracle saying we've over subscribed and could we bump you to a later date. 'Yes' I said, because it clashed with a family commitment. We'll contact you at a later date with a new date. I've still not heard anything. Hey guys if you can't do it don't advertise it. Now maybe I'm wondering what else Oracle says it can do that it can't really!

Wednesday, 18 June 2008

Ext Javascript tools

I've always avoided using javascript. I truely hate javascript. Having said that I recenlty found myself having to add a tabbed section to a web page and I really could not be bothered to mess about. So I turned to Ext javascript tools library. It really made a nasty job actually quite easy. I was using the TabPanel, a couple of lines of code from the very good api example got me up and running and the resulting table showed good browser compatability.

write the javascript, include the required library files and stylesheets in the html page and off you go....

Here's my create tab javascript code:

/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/

Ext.onReady(function(){
  // basic tabs 1, built from existing content
  var tabs = new Ext.TabPanel({
    renderTo: 'tabs1',
    width:620,
    activeTab: 0,
    frame:true,
    border:true,
    defaults:{autoHeight: true},
    items:[
      {contentEl:'tab1', title: 'Originating Number(s)'},
      {contentEl:'tab2', title: 'Recurring Charges'},
      {contentEl:'tab3', title: 'Cost Centre(s)'}
    ]]
  });


  function handleActivate(tab){
    alert(tab.title + ' was activated.');
  }
});


Then in my HTML page....

<div id="tabs1">
    <div id="tab1" class="x-hide-display">
    <p>
        tab1 text here...
    </p>
    </div>
    <div id="tab2" class="x-hide-display">
    <p>
        tab2 text here...
    </p>
    </div>
    <div id="tab3" class="x-hide-display">
    <p>
        tab3 text here...
    </p>
    </div>
</div>



Job done. comes all styled up and looks great.


You can mess with the options available in the API and take it from there.