Sunday, August 21, 2011

Creating a Map like data structure in java script

While I was working in one of my projects (GSoC 2011 - Sakai CLE mobile app) I wanted to have a map like data structure in java. Just for the clarity I will explain my scenario:

I have a list of items that I am being iterated over it and doing some stuff. So what I wanted is to have store some dynamic values on the fly as key:value pairs. I am actually new to Java Script and I am not sure this a good way and I appreciate if anyone can share any other possible ways. Here is what I did:



Output:

key1: val1
key2: val2
.
.
keyn: valn

Correct me if this is wrong or not the efficient way!

Monday, July 4, 2011

Posting code snippets to Blogger

In my last post I wanted to put some Java and JavaScript code snippets in it so I started googling and asking my friends how to do it. But, I could not find an easy way to do that so I started searching more and found the following which is actually a zero work thing to do. Here we go,

  1. Browse to https://gist.github.com/
  2. Add a Gist Description (optional)
  3. Add a filename with an extension (extension will be used to add syntax highlighting)
  4. Add your code snippet which need to be added to your blog post
  5. Click “Create Public Gist” button at the botton
  6. Click on the “embed” link and copy the script generated
This is all from Gist side. Now to Blogger,

     7. Paste the script where you need to add the code snippet
     8. Make sure to select the option “Interpret typed HTML” under Post Options -> Compose Settings

Here is how an example Java code looks like after this 8 Steps above,


Publish your post and enjoy! 

Sunday, July 3, 2011

Sakai CLE mobile application with phoneGap

In my previous post I mentioned how to setup the working environment and useful tools we can use to develop mobile applications using web technologies. Today I am going to present what I learnt during the past few weeks and the status of the CLE mobile application at the moment.
As discussed with my mentor, Steve Swinsberg, the basic requirements of the CLE mobile app. are as follows for the first version also listed here and the UI flows can be found here. (Screens v1.0.1) 

User login
User enters user details to enter the system.

 List of sites
s/he will be directed to a list of sites that they are in (assuming credentials are correct)

 List of tools
User selects a site will navigate them to a tools list of the selected site. Here they can see how many new announcements, assignments and etc are there at a glance.

 Mobile version of each tool
Once they select a particular tool they can view the above details in detail. This will hopefully be a read only tool for the first version of app.

Current status  
List of sites and tools for a selected site done.


















































Both this screens are rendered using JSONP feeds of my local host because JSON feeds did not work due to domain issues. Please find the code here and please add your suggestions.

Try out this in your emulators with phoneGap
If you want to run this in your emulator what you have to do is to create a phoneGap app. following their tutorial and add sites.html to assets/www directory.

To add JSONP support for your local sakai instance you can do the following change to core-providers in entitybroker and deploy *only* it in tomcat.

Checkout entitybroker trunk if you don’t have,

    edit the classes where it says:


    add Formats.JSONP to the end      
    • mvn clean install sakai:deploy (from entitybroker pom level)
    •  re/start Tomcat.
    Yeah that’s it! Now you have JSONP support.

    Here is how to add a customize callback function,


    That's it you should be able to see above screens. :-)

    This is a useful place you can try JS, CSS, HTML http://jsfiddle.net/. Here we don't need to put all code just the snippets work nicely for example http://jsfiddle.net/HQK5w/6/

    Thanks to my mentor, Steve Swinsberg, for the support and directions.

    As always waiting for your comments. 

    Tuesday, May 3, 2011

    MySQL 5.5.X (X=11 for me) installation issue in Ubuntu 10.10

    Recently, while I was trying to install "MySQL community server" from binary distribution I came up with an issue when running the command ,

    terminal> scripts/mysql_install_db --user=mysql

    in INSTALL-BINARY. 


    So the error is about a missing library. To get rid of this install the missing lib which solved the problem for me.

    terminal> apt-get install libaio1 libaio-dev

    This solved the problem I had during the installation. HTH. :-)

    Sunday, May 1, 2011

    Sakai CLE mobile app - GSoC 2011


    My proposal for GSoC 2011 got accepted this time with Sakai project. Idea is to develop a mobile application for Sakai using cross platform javascript library phoneGap which will run on variety of platforms (first instance will run on Android and iOS). My project mentor is Steve Swinsburg. 

    With the progress I hope to post to this blog with the status of the project and things I learnt in the mean time.




    Monday, April 18, 2011

    Using Smart VOIP in Ubuntu

    I was trying to use Smart VOIP to make calls. But as I am on Ubuntu most of the time I was trying to get a solution for it other than logged in from Windows. Here is something I found ultimately.


    Please note that I did this on my Ubuntu 10.10 machine.
    Here we go:
    1) Download and install Linphone from http://www.linphone.org/ or you can simply use Ubuntu Software center.


    2) Open Linphone. You can find this under, Applications --> Internet --> Linphone


    3) Then select, preferences from Linphone menu. Go to "Manage SIP Accounts". Click Add button and enter following details.

    • Your SIP identity: sip:<smart_voip_userName>@.com. eg: yourName@smartvoip.com
    • SIP Proxy address: sip:sip.smartvoip.com
    • Keep other settings as is and click 'OK'
    That's it! We are done! 

    Enjoy your calls to loved or non-loved once! :-)