Tuesday, December 13, 2011

Offtopic: Removed Ads

Just a note. I removed ads, if it bothered anyone before, sorry. I know some (maybe most) used an ad-blocker so it didn't really affect them.

I have plans on migrating this blog to a nicer look soon, something more presentable. Details to come...

On a second note: Sencha Touch Roadshow in NYC was great today. Great insight on some things and great to chat with some of the guys behind the framework.

Monday, November 21, 2011

IBM JAX-WS JAXB Troubles and Work Around

So one of my recent projects involved sending some data to a SOAP service. Something I took to be trivial. It was until the requirement of MTOM bindings, SAML assertions and a huge schema came into play.

IBM WebSphere 6.1 (WAS) doesn't support MTOM so we had to use WAS 8.

Then I hit this wonderful error:

Caused by: java.lang.ClassCastException: oasis.names.tc.ebxml_regrep.xsd.rim._3.ExtrinsicObjectType incompatible with javax.xml.bind.JAXBElement
 at oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType_JAXB_Serialization_Stub.write(oasis.names.tc.ebxml_regrep.xsd.rim._3.RegistryObjectListType_JAXB_Serialization_Stub.java)
 at oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest_JAXB_Serialization_Stub.write(oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest_JAXB_Serialization_Stub.java)
 at ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType_JAXB_Serialization_Stub.write(ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType_JAXB_Serialization_Stub.java)

After a ticket with IBM I finally received the workaround after 3 weeks.


Set the following custom JVM property
com.ibm.xml.xlxp.jaxb.opti.level = 0


For those who do not know how to set custom properties:
http://publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.nd.iseries.doc%2Finfo%2Fiseriesnd%2Fae%2Fxrun_jvm.html

Friday, October 14, 2011

Reading Metadata values in Grails scripts

After reading the useful post by Kevin Gill on adding build numbers to the grails build: Adding Auto Incrementing Build Number to a Grails Application

I began to wonder how to attach the build number to the project war file. Turns out the solution was simpler than I had thought.

grails.project.war.file = "target/${appName}-${appVersion}-${grails.util.Metadata.current.'app.buildNumber'.toInteger()+1}.war"

Monday, October 3, 2011

Refresh Browser v1.1

Just a bit of self promotion...

My iPad app that I built for the guys at Breakpoint IT, Refresh Browser, had its first maintenance release (v1.1)

http://itunes.apple.com/qa/app/refresh-browser/id442132171?mt=8


So check it out and support!

Wednesday, April 20, 2011

Adobe LiveCycle ES2.5 Migration Woes

So recently I had to migrate LiveCycle ES to ES2 / ES2.5

Surprisingly the install and deployment of the application went smooth. When I got Workbench installed and everything up and running it was time to migrate the old forms over to a new application and get everything working. All was well until I hit the Deploy button.

The resource [resourceUri] is exclusive-locked by user [userId].

When this used to happen in LiveCycle ES there was always an unlock option in the context menu, in ES2.5 it's nowhere to be found. Numerous calls to Adobe Support no help. Until today I stumbled upon Locking a resource using the Java API. I'm not sure where this was before but it contained some valuable information. So I quickly wrote up the source for my server running on WebSphere 6.1.

import java.util.*;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient;
import com.adobe.repository.infomodel.bean.*;

public class UnlockFile {
 public static void main(String[] args) {
  try {
   Properties connectionProps = new Properties();
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT,
     "iiop://myhost:2809");
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,
     ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_SERVER_TYPE,
     ServiceClientFactoryProperties.DSC_WEBSPHERE_SERVER_TYPE);
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME,
     "login");
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD,
     "pass");

   ServiceClientFactory myFactory = ServiceClientFactory
     .createInstance(connectionProps);

   ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(
     myFactory);

   String resourceUri = "/MyResourceDir/";

   for (Resource resource : (List) repositoryClient
     .listMembers(resourceUri)) {
    repositoryClient.unlockResource(resource.getPath());

   }
  } catch (Exception e) {
   e.printStackTrace();
  }
 }
}


What I did here to make my life easier instead of going through 50 forms 1 by 1 You can pass in their parent directory as a ResourceURI.

Hope this helps. Thanks to the Adobe docs, wish they were much easier to find though. Seems they became better for crawlers recently because I haven't seen these links when I was searching for this a little while ago.

Thursday, April 7, 2011

Sencha Touch Scrolling a Non Touch Blackberry OS 6 Device

This is a follow up to my first post about getting clicking to work on Non-Touch Blackberry OS 6 devices with the Sencha Touch framework.

I have come up with a way to get the components to scroll when you move your mouse to the edges. It is a bit rough around the edges and can use some polish but it's a working example and can be used.

This does not require any hacking of the Sencha Touch library which is both good and bad. The good is that you don't have to mess with the library risking something to get broken the bad is that you have to add this for every panel.

Without further ado here's an example Panel implementing a List:

var scrollList;

app.views.scrollList = Ext.extend(Ext.Panel, {
    listeners: {
        mousemove: {
            element: 'el',
            fn: function (evt, div, el) {
                if (scrollList.scroller.offsetBoundary.top == 0) {
                    scrollList.scroller.updateBoundary();
                }
                var maxOffset = scrollList.scroller.offsetBoundary[1] - 400;
                if (evt.xy[1] > 300 && scrollList.scroller.offset.y >= maxOffset) {
                    var offset = -1 * scrollList.scroller.offset.y + 10;
                    scrollList.scroller.scrollTo({
                        x: 0,
                        y: offset
                    });
                } else if (evt.xy[1] < 60 && scrollList.scroller.offset.y <= 0) {
                    scrollList.scroller.scrollTo({
                        x: 0,
                        y: (-1 * scrollList.scroller.offset.y) - 10
                    });
                }
            }
        }
    },
    dockedItems: [{
        xtype: 'toolbar',
        title: 'Scroll List'
    }],
    items: [{
        xtype: 'list',
        id: 'scrollList',
        height: 275,
        scroll: 'vertical',
        store: app.stores.scrollList,
        itemTpl: '{a}, {b}',
        onItemDisclosure: function (record) {

        }

    }],
    initComponent: function () {
        app.stores.scrollList.load();
        app.views.scrollList.superclass.initComponent.apply(this, arguments);
        scrollList = Ext.getCmp('scrollList');
    }

});
What we do here is we attach a mousemove listener to the underlying panel and call the scrollTo() function on the list's Ext.util.Scroller instance. If anyone has any improvements/suggestions/their own implementation I would love to hear it.
Here's a demo:

Hope this helps those who have hit this problem and hopefully Sencha will implement this the "right" way.

Monday, March 28, 2011

Getting Sencha Touch to work on Non Touch Blackberry 6 Devices

Recently I decided to begin researching the current batch of options for cross-platform mobile development with a primary target device being the Blackberry Bold.
The good news is the phone runs a WebKit browser, the bad news is that the phone still sucks. Nonetheless, without much digging a seemingly wonderful framework was brought to my attention from a company I'm familiar with, Sencha, the company behind the Ext-GWT framework.
Sencha Touch is probably the most powerful HTML5 mobile frameworks out today. However with all its greatness it has one shortcoming: Though they state they have Blackberry 6 support,  they really only support one Blackberry 6 device, the Torch.

So what happens when you try to access an app built using Sencha Touch on a non-touch Blackberry? It renders well but you can't click anything, making the app just eye candy.

Alas, there is a quick and dirty solution to it.

NOTE: There are two versions of Sencha Touch, the open source (GPLv3) and the paid commercial license. This solution involves modifying the Sencha Touch source. I only show it as a demonstration, use it as-is. 

Sencha Touch provides a wrapper for mouse & touch events to support gestures, dragging and touching. This modification involves making Sencha think of the Blackberry as if it were a standalone browser in terms of input. This may not be the best/only/right solution but it's a start. 

I looked at the sencha-touch-debug.js file since its detailed and I could understand what was going on. 

The three changes that need to be made are:
Line 4763:
Touch: ('ontouchstart' in window) && (!Ext.is.Desktop && !Ext.is.Blackberry),

Line 13964:
if (!Ext.desktop && !Ext.Blackberry) {...}

Line 18217:
if (Ext.is.Desktop || Ext.is.Blackberry) {...}

There you have it.

Hopefully future versions of Sencha Touch will implement support for non-touch Blackberry 6 devices through a much better way than my hack.