Friday, June 12, 2009

iGoogle like interface using Apache Shindig + JQuery

Shindig is a very useful Apache project currently in incubation. It provides a gadget server, social data server and javascript gadgets.* and opensocial.* APIs.

My team at Wipro has been working on Apache Shindig since July 2008 and, we have successfully put together a framework that allows rapid development of Social Enterprise applications. This framework is called WiproWeb2Works and, provides among other things, a fully functional igoogle-like container for gadgets. We have in fact put a reference implementation of WiproWeb2Works framework - Festa on the Web for any one to get a feel of a "portal" application based on Apache Shindig. I'd encourage you to register (free!) and try it out today.

In my honest opinion, Shindig is the best way to jumpstart development of a Web 2.0 content mashup/social application. While this is great news for those of us that want to quickly create slick applications, there are some rough edges though that need to be ironed out to make it production ready.

Shindig provides a sample container right out of the box. This container is as elementary as a "hello world" application that you try in Chapter 1 of any book. It hardly demonstrates the power of Shindig or the potential it holds for building an app that looks & feels like iGoogle.

In the remainder sections, I'd focus on the Container development in particular and, share tips & tricks to help you learn from our mistakes and, build apps that are better and faster than portal apps.

There are plenty of articles out there on building websites that look like igoogle. Here are 2 of my favorites -
(1) A JQuery based iGoogle interface by James Padolsey
(2) A Dojo based iGoogle interface by Matthew Russell

In the first article, James has provided a fully functional browser compatible source code on implementing an interface with drag & drop niceties. In the second article, Matthew shares his experience of implementing a shindig container using dojo.

To be continued...

Thursday, May 21, 2009

Enable security in Tomcat

I finally figured a way to enable Security Manager on Tomcat 6.0 (windows) . The documentation at Apache Tomcat's official website is incorrect and, needs revision.

Please follow these steps to enable security on your Tomcat server:-
1) Right click on the tomcat monitor icon

2) Open the Configure dialog.
3) Click on the Java tab

4) Add 2 system properties - java.security.manager and java.security.policy that points to the policy file. I'm pointing to the default catalina.policy file that ships with tomcat distribution.

5) Add the 2 properties to java options
6) Click OK.
7) Stop Service
8) Start Service
9) Tomcat is now running with security enabled.

Thanks for reading this post. Please leave comments/suggestions to let me know if it worked for you.

Saturday, March 28, 2009

Ant Task for YUICompressor

Here is a macro I wrote to look for javascript files recursively in a source folder, compress every one of them using YUICompressor and copy the compressed javascript files to target folder. The usage of the task cannot get any simpler than this:-


< target name="compress" >
<yuicompress src="uncompressed_folder" target="target_folder"/>
</target>

Here is the macro definition for yuicompress. Just place it before the yuicompress task in buildfile.xml


<property description="YUICompressor" name="YUICompressor" value="./build/yuicompressor/yuicompressor-2.4.2.jar" />


<macrodef name="yuicompress">
<attribute name="src"/>
<attribute name="target"/>
<sequential>
<echo message="Compressing files at @{src}" />
<!-- create target folder if it doesn't exist already -->
<mkdir dir="@{target}"/>
<!-- Create directories recursively first.
Exclude javascript files as they will be put by YUICompressor later on -->

<copy todir="@{target}">
<fileset dir="@{src}">
<exclude name="**/*.js"/>
</fileset>
</copy>

<!-- Compress js files recursively -->
<apply executable="java" parallel="false" verbose="true" dest="@{target}">
<fileset dir="@{src}">
<include name="**/*.js"/>
</fileset>
<arg line="-jar" />
<arg path="${YUICompressor}" />
<arg value="--charset" />
<arg value="ANSI" />
<arg value="-o" />
<targetfile />
<mapper type="glob" from="*.js" to="*.js" />
</apply>
<echo message="Files compressed and copied to @{target}" />
</sequential>
</macrodef>


Reminder: Remember to replace YUICompressor's location marked in red above

Please leave a comment if you found it useful.