Recently in tools Category

Announcing the Developer Extension for OpenSocial

| | Comments (0) | TrackBacks (0)

I really enjoy using Firebug to debug my web applications. Nothing like being able to inspect items on the page, log debug information to the console, and execute arbitrary Javascript on the page to test out a quick fix.

When working with OpenSocial gadgets, I usually find myself using Firebug to inspect an IFrame to get the URL of the gadget spec that is being loaded. While Firebug gives me access to this data, it's a little hard to get to, and I need to decode the URL before I can paste it into a browser. So to help with this, I created a Firebug extension which scans the current page to see if any OpenSocial gadgets have been loaded. If the extension finds any gadgets, it attempts to discover the XML spec URLs for all the gadgets on the page and lists these as links which will go directly to the gadget XML spec. (Note that this feature works for Shindig based websites, but will not work on MySpace).

Additionally, I wanted to be able to execute JavaScript code inside of the gadget IFrame (and not the container page, which Firebug lets you do normally). This kind of functionality really help debug gadgets, because you can test out JavaScript without needing to save and upload an XML file again (or even reload the page!). So I added a box below each XML spec URL which will let you execute any JavaScript you want, in the context of the gadget's IFrame.

You can find the extension on addons.mozilla.org here. Please leave a review on that site if you wind up using it!

I'm happy to announce that we've just finished work on a preliminary "Getting Started" guide for the OpenSocial PHP client library.

This guide should help answer a lot of the questions people first have when starting to develop OpenSocial applications with PHP. We've covered such topics as getting and installing the library, how to batch requests and deal with errors, and how to make simple OpenSocial requests for People, Activities, and App Data. Also included is our current roadmap so you can see what we're working on.

While every effort has been made to create a comprehensive developer's guide, we certainly understand that there still may be areas of the client library which are not fully documented or where the examples are unclear. If you see any place where the documentation can be improved, please take a minute to file a feature request in our issue tracker, and we'll be able to make the documentation better for everyone.

Happy Coding!
~Arne (on behalf of the PHP client library team)

Introducing DAfOS: Quick OpenSocial testing

| | Comments (0) | TrackBacks (0)
When teaching myself the OpenSocial API, I found the standard "edit XML file" -> "upload to server" -> "reload gadget" process to be too slow for my liking, especially when working with code that was almost completely client-side JavaScript. 

A strength (or weakness, depending on who you ask) of JavaScript is that you can compile and execute JavaScript source code at runtime using the eval function.  It made sense to create a simple gadget to help developers prototype simple OpenSocial calls, so I released CodeRunner, an OpenSocial application that let developers execute JavaScript snippets inside of a live OpenSocial container.  These snippets could also be saved to AppData, which was convenient as long as you didn't run out of quota space (currently 10k on orkut and 1k on MySpace).

CodeRunner wound up working quite well, but I wanted more space for storage, and I wanted to offer some capabilities that only a server-side solution would be able to satisfy.  Because Google released their App Engine product around this time, I decided to turn CodeRunner into an App Engine application, called the Developer Application for OpenSocial, or DAfOS for short.

You can get links to use DAfOS on different containers by visiting dafos.appspot.com.  Eventually that site will be filled out with more documentation. 
 
Here's a shot of DAfOS in action (it looks a lot like CodeRunner at the moment):

DAfOS.png

DAfOS_execute.pngSamples are entered into the yellow input box.  You can run a sample by clicking the "Execute" button in the top right hand corner of the gadget.  The JavaScript entered in the box will execute as if it were part of the gadget itself.  That means that you can execute social data queries, post Activity Stream entries, send messages, and anything else that the OpenSocial API allows.

DAfOS also defines a method called output.  Everything you pass to this method will be printed out in an output box at the bottom of the application.  If you have Firebug installed (you really should!), then you'll see this output in Firebug's console, as well.

Picture 7.png

Since DAfOS runs on App Engine, the samples are no longer stored in AppData.  When you save a sample, it is actually hosted at dafos.appspot.com, and accessible by clicking on the name of the sample after you save it.  This URL can be sent out to help supply code for reporting issues or helping other developers with problems.

DAfOS_controls.png

Because I use DAfOS to write most of my samples, you'll be able to copy and paste most of the code snippets from this blog directly into DAfOS and watch them run.

You can still use CodeRunner by installing this gadget XML spec to a container, but there will not be any future development on it, meaning it will likely stop functioning once containers switch to OpenSocial 0.8

About this Archive

This page is a archive of recent entries in the tools category.

samples is the previous category.

Find recent content on the main index or look in the archives to find all content.