Tuesday, September 29, 2009

How a Gadget can break igoogle?

I was trying to create a gadget where you can provide your html page link in User Preferences of gadget and you can see your HTML page in gadget container like igoogle. I wrote the following code to do that

<Module>
<ModulePrefs
title="Add Prefered URL"
description="Add your Website URL to expose that as Gadget"
author_email="rsandhu1@gmail.com"
scrolling="true">
<Require feature="opensocial-0.8" />
<Require feature="dynamic-height" />
</ModulePrefs>
<UserPref name="WebURL" display_name="HTML Page URL" datatype="string" required="true"/>
<Content type="url" href="__UP_WebURL__"/>
</Module>

Then i thought i should give some default URL also to UserPref so i added following attribute. When i deployed this Gadget on igoogle its redirecting my igoogle to given URL.
default_value="http://www.collab-ogce.org/ogce/index.php/Main_Page"

I dont have any idea how to fix this problem. Please try this at your own risk and you may be where i am right now. I may find a solution soon but its always fun to see working things broken and find a solution for those problems.

Monday, July 20, 2009

Open Social Frameworks

Check out this SlideShare Presentation:

Tuesday, July 14, 2009

Sakai and OpenSocial

OpenSocial specification is evolving and Gadgets, Widgets and Ajax are becoming popular in web applications. Sakai also developed REST API's to communicate with application layer.

Read following 2 links to get some idea
http://mfeldstein.com/sakai-and-opensocial-a-different-approach-to-distributed-learning-applications/


http://nicolaasmatthijs.wordpress.com/2008/01/10/sdata-10-january-2008/

Friday, July 10, 2009

Setup Sakai 3

After checkout the project you will run into Jave heap size issue while running maven

http://communitygrids-raman.blogspot.com/2009/07/maven2-install-error.html

export JAVA_OPTS="-server -Xmx1024m -XX:MaxNewSize=256m -XX:MaxPermSize=256m -Dsakai.demo=true"

export CATALINA_OPTS="-server -Xmx1024m -XX:MaxNewSize=256m -XX:MaxPermSize=256m -Dsakai.demo=true"

This link have all other details
http://confluence.sakaiproject.org/display/DOC/3akai

This code base is broken so Sakai have moved to new code base.. i just wrote above steps as Sakai team want every one to experience the pain and then find right code base and i feel they are not sure about their GIT choice :)

Please forgive me for above instruction but right location to setup Sakai 3 is

http://confluence.sakaiproject.org/display/KERNDOC/Kernel+-+K2+-+Documentation

Maven2 Install Error: java.lang.OutOfMemoryError: Java heap space

If you ever run the maven command “maven install” and you run into the following error:

[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.OutOfMemoryError: Java heap space

$ export MAVEN_OPTS=-Xmx1024m
or the better option is
$export MAVEN_OPTS='-Xms512m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=128m'
then
$ mvn clean install

Sunday, July 5, 2009

Avoid a Proliferation of Singletons

Read on page 29 of following scribd. We all do these common coding mistakes and then are not happy with them.

J2EE Desing and Development

Thursday, June 11, 2009

PHP WebService Client

I need to call WebService from a PHP page and was trying to find easy program.

There is a nusoap PHP library you can download to make your life very easy.

Then you need to write following set of code


/** Make sure you move lib folder to your current directory or change following path**/



require_once('lib/nusoap.php');

/** false is to make request sync. If you make parameter true it will submit Async request. **/

$client = new soapclient("<wsdl http="" url="">",false);



/** To concat string with current time **/

$timeStamp = time();

$imgCons = 'output';

$imageName = $imgCons.$timeStamp;



/** Parameter of webserive request **/

$parameters = array

   ('matlabLocation'=>'/opt/MATLAB/MATLAB_Compiler_Runtime/v710/',

    'dataName'=>'helheim',

    'filterName'=>'wiener',

    'filterParam'=>'[20,20]',

    'outputDir'=>'~/apache-tomcat-5.5.27/webapps/webdav/',

    'imageSize'=>'[800,640]',

    'imageName'=>$imageName

   );

/** Calling the webservice method **/



  $result = $client->call('Run_InputParams',$parameters,'namespace');



/** If webservice fault will come then it will come into this loop  **/

   if ($client->fault){

       echo '</wsdl></code><h2>Fault</h2><pre>';

       print_r($result);

       echo '</pre>';

   }

/** This will print the output parameter value on consol**/

   print_r($result);

  

/** To display request and response messages**/  

   echo '<h2>Request</h2>';

   echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) .

'</pre>';

   echo '<h2>Response</h2>';

   echo '<pre>' . htmlspecialchars($client->response,ENT_QUOTES) .

'</pre>';



You can call this php program using shell command like
$ php webservice.php

There are more client examples available in samples folder of nusoap.