zaterdag 4 juli 2009

Google Wave & Sakai: Exchanging data

Over the last weeks I have been able to spend some time on my Google Wave endeavor. In my last blog I wrote about embedding GW in a Sakai environment which was a simple example of how this could be done. However, I wanted to do more. So I took a deep dive into sometimes turbulent waters of coding. Remember I didn't code for quite some time but GW makes me want to code again. I wanted to see if I could exchange data between GW and Sakai. That would make it much cooler.
So I started to code my first Python lines, learned bout JSON, took a close look at the entity broker of Sakai, wandered through Google's App Engine and did some serious reading on the GW API's.
The fact that GW doesn't have a SDK (yet) with which you can develop on your own computer. Every time I had new or adjusted code I had to upload it to App Engine.

This is what I did. I have written a robot of approx 80 lines of (Python) code which runs on App Engine. First it authenticates, second it retrieves site information and third it adds a poll to a Sakai site.

Code authentication:

"""define login url for Sakai"""
host = "http://qa1-nl.sakaiproject.org"
loginurl = "/portal/xlogin"
url = host+loginurl

form_data = urllib.urlencode({'eid':'','pw':''})
f = opener.open(url, form_data)
data = f.read()
f.close()


This is just Python code and it authenticates me on a Sakai server which runs 2.5.3. btw.

Now I wanted to retrieve site information out of Sakai. RESTful & JSON are my big friends here.


"""Get sit info"""
jsonsiteurl="/direct/site.json"
url = host + jsonsiteurl
f = opener.open(url)
data = f.read()
f.close()

result = simplejson.loads(data)
mylist = result.get('site_collection')

for outerlist in mylist:
for innerlist in outerlist:
blip.GetDocument().AppendText(simplejson.dumps(outerlist.get(innerlist)))


It uses the url "/direct/site.json". Since I'm already logged on it shows the sites I'm enrolled in. I load my data into 'result' and treat it as a JSON message. I want to get all the data that has the key 'site_collection' and let go through a 'for' loop. Last line I print the results. This last line is the first GW code that we encounter. For purposes of this short explanation it is important to know that this appends text to content which already exists in the blip.

Now that we have retrieve some data I wanted to post some data from GW into Sakai. I added a new Poll to my site.


pollurl = "/direct/poll/new"
url = host + pollurl

form_data = urllib.urlencode({
"text": "What do you think of Google Wave?",
"owner": "fbc345bd-8ef0-4060-90fd-4fb2fa028961",
"siteId": "5ab7c822-ccd6-4568-ab8b-deeb3b63630c",
"pollText": "What do you think of Google Wave?"})
f = opener.open(url,form_data)
f.close()


I use JSON again by posting to '/direct/poll/new' with the data for the poll.

What I wanted to check with this robot is how difficult it would be to post and get data between Google Wave and Sakai. It is pretty easy with the use of JSON messages. I don't have to know anything how Sakai handles its stuff internally. All I have to do is to call the url which handles the stuff for me.
So I have my first robot which I called 'Saky' (seems to be the naming convention of GW robots) for the moment and I can upload it to my app-engine.

So what's next? From now on I want to focus on Sakai K2. I think Sling is a wonderful technological solution and it makes me wonder how we could integrate this new kernel with Google Wave. To be continued....

I want to thank Alan Berg for helping me with some Python stuff. I want thank Chuck Severance for writing a book about the App Engine. It really helps! And I want to thank Aaron Zeckoski for thinking along why my handling of JSON messages got messed up which turned out to be a local problem on my Mac.

dinsdag 16 juni 2009

Simple embedded Google Wave in Sakai

Over the last couple of days I have been busy fulfilling other obligations like writing reports. Today I had blocked for Google Wave. Rob van Leeuwen, colleague of my, and I will demo Google Wave on Thursday for some colleagues of the university so we had to make some preparations.

One thing I wanted to do is to show to use of a wave within a learning context. So I opted for Sakai cause I know it to some extend. You have three two options to extend Google Wave, namely Extensions, consisting of Gadgets and Robots and you have the option to embed a wave in your own application. Since I wanted to embed a wave in Sakai I ended up exploring the embed options of Google. To my surprise it was pretty easy to get started. I assume this fits the picture of Google wanting to make easier not only for user but also for developers. I don't consider myself as a developers though.

This is what I did.
  1. created a file GoogleWaveSimpleEmbed.html and copied the sample code from http://code.google.com/apis/wave/embed/guide.html into the file
  2. In my Wave client I looked up the WaveID I wanted to use Debug->Get Current Wave ID and copied the ID
  3. Replaced 'WaveID' in the source code of my own html file
    wavePanel.loadWave('wavesandbox.com!w+waveID');

    Now I'm set to upload the file into Sakai

  4. I uploaded the file in the Sakai course using Resources
  5. Copied the link location of the uploaded file
  6. I added a new page to the Sakai course and added the tool 'Web Content' (sakai.iframe)
  7. I renamed the page and title and copied the link location into the URL field
I was ready to go http://twitpic.com/7jk9x. I can edit the Wave from within Sakai and a Wave client and the wave is will be updated in real-time and shown to all member s of the wave. What I have done is the equivalent of a 'Hello World!' example. It is plain simple from a technology point of view. But the fun is that I think that this could be used in a Teaching & Learning setting.
I can create subject/theme based 'pages' which are references to perticular Google Waves.

What I have shown works when you want to have a (very) loosely coupled integration between Sakai and Google Wave.
So what needs to be done from this point. Couple of things
  1. Sort out the group permissions
    Like Chuck Severance mentioned in his blog 'Google Wave - 24 hours in' ttp://www.dr-chuck.com/csev-blog/2009_06.html we need to improve the group stucture within Google Wave.
    Google Wave can handle groups but it needs a better permission structure in order to handle pedagogical use cases. The good news is that after an exchange of e-mail/waves with two Wave developers it seems that we can expect some improvements here.
    Education was also the driving force behind the handling of groups in Google Apps
  2. As a teacher I don't want to edit HTML code in order to add/change a WaveID. I think a simple 'Add functionality/widget', just like you add documents and such will do.
  3. SSO should be in place, of course. I wonder what the best solution would be in this case. I'm definitely not an expert.
I'm happy to see how easy it is to add from, a technology point of view, simple solution and enrich your learning environment.

If I have more time on my hands I will try to code some stuff. Ofcourse, within the limited coding capabilities.


zaterdag 30 mei 2009

Google Wave for Education: Simple Use Case

Over the last 48 hours I have been wondering how we could use Google Wave for educational purposes. I have worked with Blackboard, Sakai en Moodle over the last couple of years but Wave forces me to think differently. I would like to start with a simple use case. I have done statistical analysis, mainly clustering, on Blackboard usage data from the Vrije Universiteit (Amsterdam) and Universiteit van Amsterdam some years ago. Analyzing both data sets learned me that up tot 80% of the usage is more or less basic. With basic I mean that a course within Blackboard is used as place to store some content objects, like presentation slides of a lecture, and to make some announcements. Nothing really fancy. That's ok as long as it supports learning objectives. I would like to apply this use case to Google Wave. I have to say that mu knowledge on Google Wave is still limited and this blog represent my initial ideas. My advise is to read the announcement of Google Wave first before you continue. And preferably you have watched the video which is included in the video.

Let's say I have a small Marketing course in which I want to touch two topics, Product Mix and Branding. I give two lectures on Product Mix and Branding.

First I would like to explore how this would look in a Blackboard or Sakai environment.
I would use "My Documents" (Blackboard) or Resources (Sakai) and make two sub folders (Product Mix and Branding). The slides of the lectures would end up in the sub folders and would add some additional links or such in the sub folders. When I uploaded the slides of particular lecture I will make an announcement that the slides are in place. Furthermore, I would use Announcements for general, you guessed it, announcements. And maybe I'll activate a discussion board. It is pretty hard to have a good solid discussion board since it requires guidance and some incentives for students in order to function. At least students are able to drop some questions.

How would I do this in Google Wave? This is where the fun starts.
In Google Wave* I would start, you guessed it, a wave. Not just one but multiple waves. I tend to see a wave within a learning context as an 'hosted learning conversation'.
My Branding lecture would be a wave. An announcement, document, and discussion are blended into one single wave. This enables me to focus on the subject. I don't have to worry which tools I should enable and apply for this course.
What about your Product Mix lecture? Well, that's gonna be a seperate wave, just like my Branding wave. And what do you do with general announcements? Seperate wave. This can become quite messy so we have to organize ourselves. I would do two things to get some order. First I would start tagging all the Marketing waves. In this example that would mean that my "Branding", "Product Mix", and "General Announcement" wave all are tagged as "Marketing".
The second thing I would do is to create a "Master Marketing wave. Google Wave enables you to link to other waves which creates a Wiki-ish structure. So I from my Master wave I can link to other waves like my Branding wave. So I and up with a wave structure that supports my marketing course and enables me to have an 'hosted learning conversation' with my students.

I will touch more Wave subjects, like collaborative editing, robots, gadgets and extensions, in other blogs and put them in an educational context.

*I refer to the reference implementation of Google of the Wave protocol.