About/Contact

Steve Trefethen

Steve Trefethen is CTO at Wanderful Media.
Contact me

View my LinkedIn profile



Calendar

<<  May 2013  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

Disclaimer

The posts on this weblog are provided AS IS with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.



Leveraging the Facebook API on Google AppEngine with jQuery Mobile

November 20 2011 1:20PM

In the past I’ve built starter kits for Facebook development in ASP.NET and building CruiseControl plugins. My latest interest has been experimenting with Google AppEngine as my day job is all python appserver stuff so it’s a pretty logical fit. I’m slowly putting together all of the pieces I’d like to have in website starter kit including support for jQuery Mobile and Facebook Graph API.

I have a simple proof-of-concept app working here. Btw, as this is a work-in-progress it YMMV and the app may or may not be in a working state so apologies in advance.

Technologies used:

Google AppEngine

Cheetah Templates

Facebook Graph API

jQuery Mobile

FacebookDel.icio.usDigg It!

Casualty of a Google Panda Update?

November 12 2011 11:00AM

I'm beginning to wonder if my blog has become a casualty of a Google Panda update. Looking at Analytics my traffic is down 40% over the last month yet I've only posted a handful of times. That's a pretty dramatic drop when nothing else on the site has materially changed. As I search on Google for post that I've written which have driven traffic to this blog they're nowhere to be found.

Then again, perhaps I'm just getting punished for my Leaving Andriod post. Tongue out (but seriously, that post was on Oct 20th)

Update Jan 16, 2012: Down traffic continues to the point where my traffic is 1/3 of what it was a year ago.

FacebookDel.icio.usDigg It!

Tags:

Pretty printing a Python dictionary to HTML

October 31 2011 11:08PM

Here’s a routine I wrote to pretty print a Python dict into an HTML table and though I’d share.

    def prettyTable(dictionary, cssClass=''):
        ''' pretty prints a dictionary into an HTML table(s) '''
        if isinstance(dictionary, str):
            return '<td>' + dictionary + '</td>'
        s = ['<table ']
        if cssClass != '':
            s.append('class="%s"' % (cssClass))
        s.append('>\n')
        for key, value in dictionary.iteritems():
            s.append('<tr>\n  <td valign="top"><strong>%s</strong></td>\n' % str(key))
            if isinstance(value, dict):
                if key == 'picture' or key == 'icon':
                    s.append('  <td valign="top"><img src="%s"></td>\n' % Page.prettyTable(value, cssClass))
                else:
                    s.append('  <td valign="top">%s</td>\n' % Page.prettyTable(value, cssClass))
            elif isinstance(value, list):
                s.append("<td><table>")
                for i in value:
                    s.append('<tr><td valign="top">%s</td></tr>\n' % Page.prettyTable(i, cssClass))
                s.append('</table>')
            else:
                if key == 'picture' or key == 'icon':
                    s.append('  <td valign="top"><img src="%s"></td>\n' % value)
                else:
                    s.append('  <td valign="top">%s</td>\n' % value)
            s.append('</tr>\n')
s.append('</table>') return '\n'.join(s)
FacebookDel.icio.usDigg It!

CNN's sad attempt to use Mike Arrington

October 29 2011 9:24AM

While browsing tech news this morning I stumbled into Mike Arrington's post about an interview he did with CNN. While I'm not always a fan of Arrington, though in this case, I completely accept his explaination of what happened in his interview with Solidad O'Brien. I've never read CNN for Tech news and rarely look at it otherwise though this incident will further cement that relationship (or lack thereof).

Btw, my prior and current CEO where Egyption and Persian respectively, both Entreprenuers.

FacebookDel.icio.usDigg It!

Tags:

Leaving Android for an iPhone 4S

October 20 2011 12:59AM

I'm eligible for a device upgrade and as much as I'd like to stick with Android I can imagine myself feeling like James Kendrick in his piece After the iPhone 4s Android Just Feels Wrong. The Android experience for the last 18 mos. on my original Droid has been terrible to the point of laughable. This next round will be Apple iPhone 4S. Adios Android.

For the record I have the original Droid but I've also used an HTC EVO and my wife has an HTC Eris. We're both switching to the iPhone.

FacebookDel.icio.usDigg It!

American Airlines Threatens to Take Away My 9598 Miles

September 13 2011 8:46PM

 American Airlines AAdvantage miles threat letterDear American Airlines,
  Last September was one of the most difficult of my career. I spent 24 of 30 days on the road flying all over the US on many American flights (Seattle WA, Columbus OH, Lexington SC) and ending with my family on our vacation at Disneyland and while I was left attending a conference in San Diego not that you’d know or care about any of that. Though you were kind enough to inform me today if I don’t find some way to engage with with you you’ll cancel my hard earned miles.

I just wanted to say thanks for adding this little nugget to my day.

FacebookDel.icio.usDigg It!

Setting up debugging for Google AppEngine projects in Eclipse

August 30 2011 9:57PM

When I made the move from Windows to OSX and Python development one of the things I wanted to experiment with has been Google’s AppEngine. I installed the SDK and setup the plugin for Eclipse but ran into a few issues I wanted to make note of since I think other could probably benefit from it as well. I’ll mention I’m on OSX 10.6.8 using Eclipse for Java Version Helios SR 2.

Creating a new AppEngine project in Eclipse

With the plugin installed you get an AppEngine project template listed under PyDev.

Eclipse New Project dialog

Clicking Next displays the standard Eclipse dialog for a new project where you enter the name and optionally a few other project settings. However, it’s the dialog after that where I had my first question where you’re prompted for the Google App Engine Directory which in my case corresponds to:

/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/

Google instructions for development in Eclipse didn’t answer this question and it wasn’t immediately obvious to me. At any rate, once this path is set correctly you’ll immediately see a list of AppEngine modules to be included on the PYTHONPATH:

AppEngine Module selection dialog 

Configuring the Project's Python Interpreter

After I successfully created the AppEngine project I wanted to look at the appengine-boilerplate for HTML5 which is based on HTML5 boilerplate which is well worth checking out. Next, I used the Google AppEngine Console to create a new application called “helloworld954” then copied the boilerplate files into my project and edited the app.yaml file to set the application name:

application: helloworld954

I then ran the project and everything looked ok but when I hit the page from the browser (http://localhost:8080) I got:

ImportError: No module named cgi

Which I subsequently discovered more information about here.

Now, IIRC my MacBook Pro came with Python 2.6 as the default version though v2.5 was installed as well and given AppEngine is, as of this writing, based on v2.5 I figured rather than tweaking dev_appserver.py as mentioned on that prior link I figured I’d first try the proper Python version. I right clicked my project from the package explorer and selected Properties then clicked the PyDev – Interpreter/Grammar option then clicked the “Click here to configure an interpreter not listed” link (blue link below).

PyDev Package properties dialog

Next, on the preferences dialog (which I won’t screenshot here as it’s too big) I clicked New… and added a new interpreter option for “Python v2.5” with a path of:

/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python

Btw, I think I tried the symlink but that wasn’t allowed (again, I think).

At any rate, once I saved those changes voila the boilerplate project started working. Ah, one step I overlooked was setting up a debug configuration for this project:

Eclipse Debug Configuration 

The main module for the application has to be Google’s dev_apperser.py file which is located here on my machine:

/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/dev_appserver.py

Also, under the (x)= Agruments tab I set the Program Arguments to “.” for the current working directory and for "Working Directory" I selected "Other" with a value of "$(workspace_loc:starterkit}" Note, starterkit is the name of my project.

The final result:

Google AppEngine HTML5 boilerplate

Hopefully, this helps someone else, it will certainly help me months from now when I trying to do the same thing again so I won’t have try and recall all these steps.

FacebookDel.icio.usDigg It!