farmdev

Thoughts on Presentations

Presenting a Solid Tutorial at PyCon

Proposals for tutorials at PyCon 2009 are now being accepted through October 31st.

Due to many projects I have going on right now I probably won't be able to propose a tutorial myself but I thought I'd share some thoughts from last year...

read article

How To Get Started Writing Open Social Applications

I started learning about Google's Open Social API and gave a lightning talk on it at the last Chicago Python User Group meeting. It wasn't much more than a brief overview and fodder for "diving in" to the Open Social platform. Here it is again, in more of a tutorial form, so dive in!

What Is It?

It's a set of programming interfaces to let you build "applications" that run inside social networking websites. By applications, think "widgets." The interfaces consist of a JavaScript API to build the screens and interactivity and a REST API (Atom publishing API + XML) for the "container" site to implement.

The official "container" sites so far include Friendster, MySpace, Orkut (Google's own), Hi5, Ning, and several others. Some interesting facts from the video : Orkut has an overwhelming presence in Brazil and India and Hi5 is the largest Spanish-speaking social site. Ning is unique in that it's a "meta" social site. It's a social site that enables you to build your own social sites until your head explodes.

The Role of An Open Social Application

I predict that the dark energy of the universe (that is, energy generated by the free time of cunning web developers like you and I) will bring hundreds of cool social apps into existence. It's the same collaboration concept that makes open source software so successful. And more similarly, what makes Firefox so customizable through Extensions. This kind of thing gets me excited about the Web reminiscent of when RSS became a standard. To be honest, I don't think social networking is that interesting and I am still waiting for the fad to die out, but Open Social might encourage other sites to standardize additional container/application APIs.

Let's See Some Code

To test out an Open Social app you can use the Orkut Sandbox. It needs to conform to the Google Gadget API; here is the simplest app you can build:

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Boring Hello App">
    <Require feature="opensocial-0.5"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
    <script type="text/javascript">
        
    function start_hello() {
        document.getElementById('message').innerHTML = "Hello!";
    }
    _IG_RegisterOnloadHandler(start_hello);

    </script>
    <div id="message"> </div>
]]>
</Content>
</Module>

Since this isn't very exciting and doesn't show off and of the API features, there are plenty more examples in the Open Social docs.

Some Gotchas

The Orkut sandbox has a fierce cache. To use your application uncached, you have to add this on to the end of your app's URL:

http://.../?...&bpc=1

Since the app is just HTML, you can use the script tag to pull in 3rd party JavaScript libraries. But keep in mind you will face some problems due to to JavaScript's Same Origin security policy. Although, the JavaScript libs automatically available will probably let you do most of the remote-call things you need, like fetching JSON. There also might be some workarounds with the Dojo framework's iframe strategy.

Have fun!

read article

Python on TextMate demo (Chicago area)

If you are in or around the Chicago area, I will be demo-ing some techniques for coding Python in TextMate, an editor for Mac OS X. It's part of the Snakes On Apples themed Chipy (Chicago Python Users) meeting. It's at 7pm, Thursday August 9th; click the link for more info and directions.

I'll try to cover the basics but then also some of the more advanced stuff like creating custom Bundles to automate tasks (Commands / Snippets/ Macros). And if all goes well, I'll be able to show off my somewhat-working, revisted version of running an interactive doctest session directly in the docstring of a python file. I started working on this a while back but had set it aside.

read article