Surfing The Innovation Wave – Talk by Sharad Sharma

December 7, 2012

Heard a very interesting talk by Mr Sharad Sharma titled “Surfing The Innovation Waves” that puts in context the nature of innovation happening in the marketplace and the contextual forces behind the changes. He talks about adopting the
“hobbyist temperament” and gave several examples of people in the edges of industries disrupting the establishment. The key behavioral traits he mentioned are as follows:

  • Stepping outside one’s comfort zone
  • Having an internal compass – “i got to excel.” Don’t rely on external cues and rely on self-mastery instead.
  • Get comfortable to stand out and be an underdog.
  • Persisting in face of adversity. Even if you are right, it doesn’t matter till you are able to go past the criticisms that will keep coming

He then expanded on a New Age Code of Conduct  – keeping in line with the idea of the hobbyists and people who are innovating at the margins. He talked about volunteers, poeple are doing it for others like themselves and participating in creating and growing “Creation Nets”. The Creation Nets are going to be the wave of the future where many people sharing a common cause will come together and contribute to innovation via rapid and effective collaboration. Community activity is key because the world is much too complex and you have to collaborate with others for innovation to happen both within and outside the organizational boundaries.

This new code of conduct has particular behaviours that he recommends:

  • Setting others up for success. Form of servant leadership – make it your job to help others around you get to their goals. Evolving shared aspirations is very important
  • Make sure you give more than what you take – effect of the commons. Amplification of co-operation is key and if you don’t invest in public good, collaboration isn’t sustainable. Academic institutions take an active role to play in public good creation.
  • Say what you mean, do what you say. Allow for trust bonds to be formed – cannot allow duplicity. Without trust, no creation nets are possible and effective collaboration isn’t an option.
  • Make mistakes. Make them fast and recover quickly
  • Don’t wait for instructions – just make it happen. Pick the challenge that catches your fancy and start working to happen. Pull based model and not a push based model. I will do this with the best of my ability. Focus on excellence.

The talk is definitely worth the time in full – do see it online here: http://www.iimb.ernet.in/node/3164

Advertisements

Creating RSS feeds using Freemarker

September 8, 2010

As a follow up to the earlier post on using freemarker, here is an example of creating RSS 2.0 feeds using a freemarker template. This FTL will work assuming there is an input javabean that has a collection accessible via getItems() and returns a list of Item objects. Each Item would have a title, description, link, and last modified date properties as shown below:

<rss version="2.0">
<channel>
<#list items as myitem>
<item>
 <title>${myitem.title?html}</title>
 <description>${myitem.description?html}</description>
 <link>${myitem.link}</link>
 <pubDate>${myitem.lastmodifiedDate?datetime}</pubDate>
 </item>
</#list>
</channel>
</rss>

Transforming Object to XML using Freemarker

August 22, 2010

I wrote earlier about using open source software for fulfilling functionality prior to building a custom implementation. Many projects have the need to transform object to text or XML – e.g. return XML response for REST-based services or return JSON string to support a web application etc.

Freemarker is a templating engine that can be leveraged to perform object to text transformations – with freemarker it is easy to generate RSS feeds or delimited text or plain old XML very easily. Below are some code fragments that illustrate freemarker usage:

Below is a code fragment for setting up the template configuration:

try {
	// Initialize configuration;
	cfg = new Configuration();
	cfg.setDirectoryForTemplateLoading(new File(templatesLocation));
	cfg.setTemplateUpdateDelay(0);
	cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
	//Use beans wrapper (recommmended for most applications)
	cfg.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
	cfg.setDefaultEncoding("ISO-8859-1");
	//charset of the output
	cfg.setOutputEncoding("UTF-8");
	//default locale
	cfg.setLocale(Locale.US);

} catch (Exception e) {
	//handle the exception
}

The templatesLocation variable is the path to a folder with freemarker templates (referred to as FTL templates). These are similar to templates used with frameworks such as Velocity. For example, below is a template fragment:

<Name>${myBean.firstName?xml} ${myBean.lastName?xml}</Name>

“myBean” is the java object that has first name and last name properties supported by JavaBeans style getXYZ() methods. The ?xml built-in function is used to encode any special XML characters.

Below is the code fragment when trying to invoke a template with a java object – the template file name is hard-coded for below example – it can be fetched from an input parameter or injected directly into this object as necessary:

// loading the template file
String templateFileName = "test-template.ftl";
Template template = cfg.getTemplate(templateFileName);
Writer out = new StringWriter();
template.process(dataObject, out);
String strResponse = out.toString();

The above code fragment essentially takes a java object (dataObject) as input and creates a string as output. Using the template above, the output for example could be:

<Name>John Smith</Name>

Freemarker also supports loops and conditions and offers a rich library of built-in functions as well.


%d bloggers like this: