<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NorthIs..⇡ &#187; api</title>
	<atom:link href="http://northisup.com/blog/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://northisup.com</link>
	<description>The enemy&#039;s gate is down.</description>
	<lastBuildDate>Tue, 10 Aug 2010 15:14:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Google visualization from python</title>
		<link>http://northisup.com/blog/google-visualization-from-python/</link>
		<comments>http://northisup.com/blog/google-visualization-from-python/#comments</comments>
		<pubDate>Tue, 05 May 2009 23:00:07 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://northisup.com/?p=544</guid>
		<description><![CDATA[So I was hacking away at a turbogears project and thought &#8216;how cool would it be to visualize this?&#8217; That thought lead to a short example of how to get the graphing visualization from google finance into your app. I used cherrypy to do the web serving for the example. Code after the break (sorry [...]]]></description>
			<content:encoded><![CDATA[<p>So I was hacking away at a turbogears project and thought &#8216;how cool would it be to visualize this?&#8217; That thought lead to a short example of how to get the graphing visualization from google finance into your app. I used cherrypy to do the web serving for the example. Code after the break (sorry if wordpress formats it poorly).</p>
<p><span id="more-544"></span></p>
<pre>#!/usr/bin/env python
# encoding: utf-8
"""
chart_example.py

Dynamic example of chart visualization

Created by Adam Hitchcock on 2009-05-05.
Copyright (c) 2009 __NorthIsUp__. All rights reserved.
"""

import sys
import os
import string
import subprocess
import cherrypy

body = """

"""

class DataTable():
	def __init__(self):
		"""columns [{'name':'aname', 'type':'JStype'}]"""

		self.columns = []
		self.values = []
		pass

	def render(self):
		s = """

		<script src="http://www.google.com/jsapi" type="text/javascript"><!--mce:0--></script>
		<script type="text/javascript"><!--mce:1--></script>

"""
		return s + body

	def add_column(self, name, jstype):
		self.columns.append({'name':name, 'jstype':jstype})

	def add_value(self, row, column, value):
		"""docstring for add_value"""
		self.values.append({'row':row, 'column':column, 'value':value})

class chart_example(object):

	def index(self):
		d = DataTable()
		columns = [
		{'jstype':'date',	'name':'Date'},
		{'jstype':'number', 'name':'Sold Pencils'},
		{'jstype':'string', 'name':'title1'},
		{'jstype':'string', 'name':'text1'},
		{'jstype':'number', 'name':'Sold Pens'},
		{'jstype':'string', 'name':'title2'},
		{'jstype':'string', 'name':'text2'},
		]

		values = [
		[{'column':0, 'value':"new Date(2008, 1 ,1)"},
		{'column':1, 'value':"30000"},
		{'column':4, 'value':"40645"},],

		[{'column':0, 'value':"new Date(2008, 1 ,2)"},
		{'column':1, 'value':"14045"},
		{'column':4, 'value':"20374"},],

		[{'column':0, 'value':"new Date(2008, 1 ,3)"},
		{'column':1, 'value':"55022"},
		{'column':4, 'value':"50766"},],

		[{'column':0, 'value':"new Date(2008, 1 ,4)"},
		{'column':1, 'value':"75284"},
		{'column':4, 'value':"14334"},
		{'column':5, 'value':"'Out of Stock'"},
		{'column':6, 'value':"'Ran out of stock on pens at 4pm'"},],

		[{'column':0, 'value':"new Date(2008, 1 ,5)"},
		{'column':1, 'value':"41476"},
		{'column':2, 'value':"'Bought Pens'"},
		{'column':3, 'value':"'Bought 200k pens'"},
		{'column':4, 'value':"66467"},],

		[{'column':0, 'value':"new Date(2008, 1 ,6)"},
		{'column':1, 'value':"33322"},
		{'column':4, 'value':"39463"},
		{'column':2, 'value':"'Bought Pens2'"},
		{'column':3, 'value':"'Bought 200k pens2'"},
		{'column':4, 'value':"66467"},],

		[{'column':0, 'value':"new Date(2008, 1 ,7)"},
		{'column':1, 'value':"33322"},
		{'column':4, 'value':"39463"}]
		,]

		for c in columns:
			d.add_column(c['name'], c['jstype'])

		for vals, i in zip(values, range(len(values))):
			for v in vals:
				d.add_value(i, v['column'], v['value'])
		return d.render()
	index.exposed = True

class sub_wrapper(object):
	def renext(self, next):
		print next

	def doit(self, popenargs):
		result = subprocess.Popen(popenargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
		return result

cherrypy.config.update({'server.socket_host': '127.0.0.1', 'server.socket_port': 8080, })
cherrypy.quickstart(chart_example())</pre>
]]></content:encoded>
			<wfw:commentRss>http://northisup.com/blog/google-visualization-from-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
