<?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>NinjaCipher &#187; development</title>
	<atom:link href="http://www.ninjacipher.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ninjacipher.com</link>
	<description>kungpow programming</description>
	<lastBuildDate>Thu, 25 Mar 2010 14:39:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='www.ninjacipher.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Using Mako with Tornado Web Server</title>
		<link>http://www.ninjacipher.com/2010/01/01/using-mako-with-tornado-web-server/</link>
		<comments>http://www.ninjacipher.com/2010/01/01/using-mako-with-tornado-web-server/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 19:42:54 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[real time]]></category>
		<category><![CDATA[tornado]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=191</guid>
		<description><![CDATA[So at work we have been focusing on real time web services a lot lately. Due to this I&#8217;ve been getting a chance to play with some awesome new technologies that really lend themselves to the real time web. One of these new technologies is the Tornado Web Server.
&#8220;Tornado is an open source version of [...]]]></description>
			<content:encoded><![CDATA[<p>So <a href="http://wiredset.com" target="wiredset">at work</a> we have been focusing on real time web services a lot lately. Due to this I&#8217;ve been getting a chance to play with some awesome new technologies that really lend themselves to the real time web. One of these new technologies is the <a href="http://www.tornadoweb.org/" target="tornado">Tornado Web Server</a>.</p>
<blockquote><p>&#8220;Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed&#8221;</p></blockquote>
<p>We&#8217;re using <a href="http://www.makotemplates.org/" target="mako">Mako</a> to handle our templates (vs the template module that comes with Tornado). It&#8217;s super fast and feature rich and has good documentation. Bellow is a base class I wrote that illustrates how to render Mako templates from a Tornado RequestHandler class. It takes care of setting your template directory, template cache directory and your output encoding (utf-8). </p>
<p><strong>Note: This example assumes that you have your template settings defined as tornado options but they could be very easily just hard coded in. </strong></p>
<pre name="code" class="python">from tornado.web import RequestHandler
from mako.template import Template
from mako.lookup import TemplateLookup
from tornado.options import options

class BaseRequest(RequestHandler):
    def __init__(self, application, request, transforms=None):
        RequestHandler.__init__(self, application, request, transforms)
        self.lookup = TemplateLookup(directories=[options.template_dir], module_directory=options.mako_modules_dir, output_encoding='utf-8', encoding_errors='replace')

    def render_template(self,template_name, **kwargs):
        new_template = self.lookup.get_template(template_name)
        self.write(new_template.render(**kwargs))</pre>
<p>Basically you would just derive your handlers from BaseRequest vs from RequestHandler and you will then be able to render your Mako templates via the render_template method.</p>
<p>Here is an example:</p>
<pre name="code" class="python">class ExampleHandler(BaseRequest):
    def get(self):
        self.render_template('example.html')</pre>
<p>Shoot me a comment and let me know if you have any questions. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2010/01/01/using-mako-with-tornado-web-server/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Selling clients on Django</title>
		<link>http://www.ninjacipher.com/2009/05/06/selling-clients-on-django/</link>
		<comments>http://www.ninjacipher.com/2009/05/06/selling-clients-on-django/#comments</comments>
		<pubDate>Thu, 07 May 2009 01:39:23 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=143</guid>
		<description><![CDATA[So right up front let me just say that I love Django. This should come as no surprise to anyone who has been to my site. I think its a great framework and I really enjoy working with it. That being said all too often my clients look like a deer in headlights when I [...]]]></description>
			<content:encoded><![CDATA[<p>So right up front let me just say that I love Django. This should come as no surprise to anyone who has been to my site. I think its a great framework and I really enjoy working with it. That being said all too often my clients look like a deer in headlights when I suggest using it for their projects. Unfortunately that usually means that they want to use&#8230; PHP ::dies::</p>
<p>Now not that there aren&#8217;t some decent PHP frameworks out there but lets be honest if I had my druthers the clear winner would ALWAYS be Python/Django. Once in awhile I will get someone who is a little bit more open minded and they will suggest Rails. Which again is fine&#8230; I would rather write Ruby then PHP any day but it still is a far cry from Django IMHO. </p>
<p>So my question is this&#8230; how do you sell a client on the idea of using Django?! I would love to hear your thoughts about it. To preface my client base is normally entertainment industry based (Record labels, TV networks and Movie Studios). They tend to have overly bloated IT departments that take 7 months to handle an app we can crank out in a matter of weeks. The usual roadblocks I hear are &#8220;we don&#8217;t support python&#8221; or &#8220;we have no python resources to maintain the app after your done&#8221;. Basically I think my clients tend to think that I&#8217;m suggesting they build in Django not out of trying to use the best tool for the job but more as a job security language (jsl).   </p>
<p>Anyway as you can prob tell this is a constant source of frustration and any advice would be very much appreciated. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2009/05/06/selling-clients-on-django/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Top 5 Django IDEs</title>
		<link>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/</link>
		<comments>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/#comments</comments>
		<pubDate>Sat, 02 May 2009 03:22:24 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[random thoughts]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ide]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=108</guid>
		<description><![CDATA[I&#8217;ve seen a lot of people out there looking for a good IDE for doing Django work. Personally I&#8217;m a pydev guy. I have been using Eclipse for so long for everything else it&#8217;s very natural to keep on that path. However there are definitely other alternatives out there. Here is a list of other [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a lot of people out there looking for a good IDE for doing Django work. Personally I&#8217;m a pydev guy. I have been using Eclipse for so long for everything else it&#8217;s very natural to keep on that path. However there are definitely other alternatives out there. Here is a list of other IDEs and editors that have Django support.</p>
<ol>
<li><a href="http://pydev.blogspot.com/2006/09/configuring-pydev-to-work-with-django.html" target="_blank">Eclipse with PyDev</a> (part of <a href="http://www.aptana.com/python" target="_blank">Aptana</a> now)</li>
<li><a href="http://macromates.com/blog/archives/2006/08/21/getting-more-bundles/" target="_blank">TextMate with Django Bundle</a> (technically not an IDE but allot of people love it)</li>
<li><a href="http://code.google.com/p/netbeans-django/" target="_blank">Netbeans with Django Plugin</a></li>
<li><a href="http://www.wingware.com/doc/howtos/django" target="_blank">Wing</a></li>
<li><a href="http://code.google.com/p/django-komodo-kit/" target="_blank">Komodo with Django Komodo Kit</a></li>
</ol>
<p>So I&#8217;m sure some of you people out there will say man up&#8230; use VIM or Emacs&#8230; be a real programmer! To that I say have at it. If that&#8217;s your preference then do what works best for you. By all means, leave me a comment and tell my how wrong I am and/or glow about how good your IDE/editor is. Long story short Django is an awesome framework and whatever you choose to work in I hope you enjoy it as much as I have.</p>
<div id="stb-container" class="stb-container"><div id='caption' class='stb-alert-caption_box' >Reality Check!</div><div id='body' class='stb-alert-body_box' >Of course there are other options out there. And top 5 doesn&#8217;t mean these are the best. But from my research these are the editors most people seem to be using.<br />
</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>I can has REST?</title>
		<link>http://www.ninjacipher.com/2009/04/14/i-can-has-rest/</link>
		<comments>http://www.ninjacipher.com/2009/04/14/i-can-has-rest/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 12:53:59 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=97</guid>
		<description><![CDATA[Recently I&#8217;ve been working on a python wrapper for the twitter.com REST API called BirdyPy. It got me thinking about when I first started working with web APIs and how over complicated it seemed to me then. So I figured that I would share some of the stuff I&#8217;ve learned in my work leveraging XML [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-103" title="i-can-has-walkthru" src="http://www.ninjacipher.com/wp-content/uploads/2009/04/i-can-has-walkthru.jpg" alt="i-can-has-walkthru" width="200" height="214" />Recently I&#8217;ve been working on a python wrapper for the <a href="http://twitter.com" target="twitter">twitter.com</a> REST API called BirdyPy. It got me thinking about when I first started working with web APIs and how over complicated it seemed to me then. So I figured that I would share some of the stuff I&#8217;ve learned in my work leveraging XML APIs and hopefully help some other people struggling with the concept frame it in a simple way.</p>
<p>On the most basic level a <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="wikipedia">REST</a> API consists of different urls that you can call to get and post content to a web service. This can be pictures (like <a href="http://www.flickr.com/" target="flickr">Flickr</a>) or micro blog posts (like <a href="http://twitter.com" target="twitter">twitter</a>) or even videos (like <a href="http://youtube.com" target="youtube">youtube</a>). When you make a request to a REST API the API responds with a chunk of XML. This XML usually represents one or more data record (they call them resources). For instance if I want to get a list of my recent twitter updates I can make a call to the following url (http://twitter.com/statuses/user_timeline.xml) and I get back an chunk of XML that represents my last 20 status updates. Taking this a step further I can also post a new status update by making a request to http://twitter.com/statuses/update.xml.</p>
<p>One of the key factors to take into account when working with REST APIs are the request methods used when interacting with the API. If your a little fuzzy on what request method means just think of it in terms of a web form (ie method=&#8217;post&#8217;). GET requests work off of query strings (like so http://mylink.com?id=1) where as POST requests bundle all of the data into the request itself. There is allot you can talk about as far as different request types. You can read more about it here if your still unclear on it.</p>
<p>Most REST APIs are setup so that when you want to <em>get</em> back records from the system you use a GET request. If you want to <em>post</em> records to the system or update an existing record you use a POST request. If your noticing a trend good for you. The convention is to work off of the verb in the sentence&#8230; so to get something you use GET and to post something you use POST. Pretty simple right.</p>
<p>Some APIs are set up so that when you want to delete a record you have to send a request as a DELETE method. And some APIs also use the PUT method for doing things like updates or posting files. Allot of services don&#8217;t take it to this level as it tends to just confuse people. For now just worry about GET and POST until you get everything straight in your head.</p>
<p>Another point to notice is that most REST APIs not only return a chunk of XML representing the data record but they also return a response status code (200 ok, 404 not found, 500 server error etc).  Response status codes are a pretty hefty topic but really simple one you get it. Basically they are a numeric code that represents the status of the response (did it work or not and why). You can read more about them <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">here</a>.</p>
<p>So hopefully that wasn&#8217;t too painful. If anything that should  give you at least an introductory understanding of what to expect when you start to play with a REST API. Stay tuned for the next installment of this series when I show language specific (ruby, python) examples of using REST. Feel free to post some questions and I&#8217;ll do my best to answer them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2009/04/14/i-can-has-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oh BirdyPy</title>
		<link>http://www.ninjacipher.com/2009/04/12/oh-birdypy/</link>
		<comments>http://www.ninjacipher.com/2009/04/12/oh-birdypy/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 01:47:27 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=80</guid>
		<description><![CDATA[Just started a new open source python wrapper for the twitter rest and search apis. I&#8217;m trying to stay as 1 to 1 as I can with the names and function arguments so its pretty much an exact match to the twitter api docs. Also adding a django test app that includes models for serializing [...]]]></description>
			<content:encoded><![CDATA[<p>Just started a new open source python wrapper for the twitter rest and search apis. I&#8217;m trying to stay as 1 to 1 as I can with the names and function arguments so its pretty much an exact match to the twitter api docs. Also adding a django test app that includes models for serializing all of the return object types to the db. You can check it out <a href="http://code.google.com/p/birdypy/">here</a>. If you have some time and want to help shoot me an email and I will add you to the project. The codes is still a very unfinished work in progress. Definitely not ready for prime time at this point, but hell sharing is caring and who knows&#8230; someone out there may want to help. LOL </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2009/04/12/oh-birdypy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>post_from_link javascript tip</title>
		<link>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/</link>
		<comments>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 23:50:03 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=55</guid>
		<description><![CDATA[I wrote this the other day. Thought someone might find it useful. Will let you do a POST request from a link. Good for delete buttons, since we all know your not supposed to let users delete things from a get request&#8230; right?!   
Basically it takes your url &#038; params and dynamically builds [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this the other day. Thought someone might find it useful. Will let you do a POST request from a link. Good for delete buttons, since we all know your not supposed to let users delete things from a get request&#8230; right?! <img src='http://www.ninjacipher.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>Basically it takes your url &#038; params and dynamically builds the DOM for the form and then submits it. </p>
<p>Requires that you include <a href="http://www.prototypejs.org" target="prototype">prototype.js</a>.</p>
<p>Here is an example link. You just pass the url you wish to submit to and an associative array of the params.</p>
<pre name="code" class="html"><a href="#" onClick="post_from_link('/the/url/to/post/to',{'param1':'val1','param2':'val2'});" >post the request</a></pre>
<p>Here is the js function. Include this in the head of your page.</p>
<pre name="code" class="javascript">
/*
* Dynamically creates a form based on args and submits it to the given url
* @param {Object} url
* @param {Object} params
*/
function post_from_link(url,params){
   var form = new Element('form', { action: url, method: 'POST' });
   for(param in params){
       var hidden = new Element('input', {type:'hidden', name:param, value:params[param]});
       form.insert(hidden);
   }
   document.body.appendChild(form);
   form.submit();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
