Tuesday, 20 January 2015

It makes me feel like a dog chasing its tail

There is a certain trend when it comes to new technologies. A lot of hype for nothing, they are trying to gain traction by promising the holy grail. For instance, I am not against Docker or Rocket or any other container alternative, however, I feel that for initial development phase it is an unnecessary overhead.

Having said that, I have come to a certain epiphany when it comes to technology, frameworks, libraries and the like. If you are trying to innovate, create something new and exciting it is better to use new technology ( or not ready for production ) and not so mature, because there is a belief that maturity stops innovation.

Furthermore, consider that your development will take 1-2-3 years to get to the market, that technology will be mature by then and now I ask myself, how will I support product innovation with technologies that are mature and have stopped innovating.

It makes me feel like a dog chasing its tail.

The only thing I can come up with is to take the most simplistic and minimalistic approach to fulfil your purpose. Use technologies that have got big backing behind them which means longevity, support, they will live up to their expectations and then some. When those technologies reach the prime of their time, your product too will be at that same level. What's after that?

Your product is fully developed, its served its purpose and now the decline begins, so you start thinking how can you keep innovating? By incorporating new ideas using underdeveloped technologies.


Wednesday, 29 February 2012

PartialResultException

I named the post "PartialResultException" because it was the exception which haunted me the most and made me doubt the benefits of Grails as a framework. For instance, code more configure less.

Recently, I was tasked to write a Grails app which authenticates against an MS Active Directory (LDAP enabled), performs lookups, persists some objects and lastly syncs with Google Apps.

As a newbie on Groovy & Grails I started my journey by going through the online documentation and various tutorials. This video tutorial shows how to build a twitter client in 90 minutes and is highly recommended to any Grails beginner.




It is very useful to start by using the command line so that you can get an idea of the ins and outs of the framework. Since I am used to coding in Eclipse, I ended up installing the SpringSource Tool Suite version of Eclipse.

Authentication was fairly trivial as there are plenty of tutorials and information out there. I used the following two plugins, Spring Security Core Plugin which is accompanied by this tutorial, and Grails Spring-Security-Ldap 

All is good so far, however, the nightmare begins now. Performing queries against an MS Active Directory can prove to be tricky and even reach the level beyond annoyance. More specifically if data are spread around a forest rather than lie in one location where LDAP has to process referrals. 

Thanks to this plugin it is easy to perform LDAP queries and represent data in an object oriented fashion

For example, even if you set the flag to automatically follow referrals to true and you try to perform a query for an (objectclass=group) on the baseDn without providing an OrganizationUnit, basically look through the entire tree structure and get an exception of the like, 

ERROR errors.GrailsExceptionResolver - PartialResultException occurred when processing request: [GET] /myapp/mypackage/myaction
Unprocessed Continuation Reference(s). Stacktrace follows:
javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name xxxx.xxxx.xxxxx

the culprit is Active Directory, apparently it cannot handle referrals automatically and throws a PartialResultException, there is a note in the documentation of LdapTemplate.

To resolve this error, you have to ignore the exception. In your Config.groovy where you set up Grails LDAP plugin add this flag.

ldap {
  directories {
    group {
      url = "ldap://myserver:389"
      base = "dc=xxx,dc=xxxx,dc=xx,dc=xx"
      userDn = "cn=xxxxxxxxxxxxxxxx, cn=xxxx, dc=xxxxxx,dc=xxxxxxx,dc=xx,dc=xx"
      password = "xxxxxxx"
        ignorePartialResultExcepton = true
      searchControls {
        countLimit = 40
        timeLimit = 600
        searchScore = "subtree"
        derefLinkFlag = true
      }
    }
  }
}

I hope this post can be helpful and guide other travellers to the right path.

Total Pageviews