<?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>w00kie's ramblings &#187; code</title>
	<atom:link href="http://w00kie.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://w00kie.com</link>
	<description>making compressors in Japan</description>
	<lastBuildDate>Tue, 20 Jul 2010 00:34:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
	<atom:link rel="hub" href="http://superfeedr.com/hubbub" />
			<item>
		<title>Custom Django filters in Google App Engine</title>
		<link>http://w00kie.com/2008/06/19/custom-django-filters-in-google-app-engine/</link>
		<comments>http://w00kie.com/2008/06/19/custom-django-filters-in-google-app-engine/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 02:36:00 +0000</pubDate>
		<dc:creator>w00kie</dc:creator>
				<category><![CDATA[Work stuff]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://w00kie.com/?p=272</guid>
		<description><![CDATA[You want to create your own custom Django filters in App Engine without running a whole Django stack? Here's how in a few lines of code. First create a specific python file to hold your custom filters at the root of your application. In my case I use customfilters.py like this: import re from google.appengine.ext [...]]]></description>
			<content:encoded><![CDATA[<p>You want to create your own custom Django filters in App Engine without running a whole Django stack? Here's how in a few lines of code.</p>
<p>First create a specific python file to hold your custom filters at the root of your application. In my case I use customfilters.py like this:</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>
<span style="color: #ff7700;font-weight:bold;">from</span> google.<span style="color: black;">appengine</span>.<span style="color: black;">ext</span> <span style="color: #ff7700;font-weight:bold;">import</span> webapp
&nbsp;
register = webapp.<span style="color: black;">template</span>.<span style="color: black;">create_template_register</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> escapeimg<span style="color: black;">&#40;</span>body<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'&amp;lt;img (.*)/&amp;gt;'</span>, <span style="color: #483d8b;">'[IMG]'</span>, body<span style="color: black;">&#41;</span>
&nbsp;
register.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>escapeimg<span style="color: black;">&#41;</span></pre>
<p>Then in your main application source file, call the following line outside of the main() definition, for example just after your modules loading:</p>
<pre class="python"><span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Load custom Django template filters&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
webapp.<span style="color: black;">template</span>.<span style="color: black;">register_template_library</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'customfilters'</span><span style="color: black;">&#41;</span></pre>
<p>You should then be able to use the new filters you registered in customfilters.py straight away in any of your Django templates without any % load foobar % call</p>
]]></content:encoded>
			<wfw:commentRss>http://w00kie.com/2008/06/19/custom-django-filters-in-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Crossdomain proxy on Google App Engine</title>
		<link>http://w00kie.com/2008/06/18/crossdomain-proxy-on-google-app-engine/</link>
		<comments>http://w00kie.com/2008/06/18/crossdomain-proxy-on-google-app-engine/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 05:05:55 +0000</pubDate>
		<dc:creator>w00kie</dc:creator>
				<category><![CDATA[Work stuff]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[app engine]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://w00kie.com/?p=271</guid>
		<description><![CDATA[Here's a crossdomain proxy to pipe Javascript Ajax calls from you Google App Engine application to the Flickr API, since most browser will not let you call another domain directly. import cgi import urllib from google.appengine.ext import webapp from google.appengine.api import urlfetch &#160; class FlickrController&#40;webapp.RequestHandler&#41;: &#34;&#34;&#34;Proxy for Ajax calls to flickr&#34;&#34;&#34; def get&#40;self&#41;: flickrapiendpoint = [...]]]></description>
			<content:encoded><![CDATA[<p>Here's a crossdomain proxy to pipe Javascript Ajax calls from you Google App Engine application to the Flickr API, since most browser will not let you call another domain directly.</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">cgi</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">urllib</span>
<span style="color: #ff7700;font-weight:bold;">from</span> google.<span style="color: black;">appengine</span>.<span style="color: black;">ext</span> <span style="color: #ff7700;font-weight:bold;">import</span> webapp
<span style="color: #ff7700;font-weight:bold;">from</span> google.<span style="color: black;">appengine</span>.<span style="color: black;">api</span> <span style="color: #ff7700;font-weight:bold;">import</span> urlfetch
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> FlickrController<span style="color: black;">&#40;</span>webapp.<span style="color: black;">RequestHandler</span><span style="color: black;">&#41;</span>:
	<span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;Proxy for Ajax calls to flickr&quot;</span><span style="color: #483d8b;">&quot;&quot;</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> get<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		flickrapiendpoint = <span style="color: #483d8b;">'http://api.flickr.com/services/rest/'</span>
		flickrapikey = <span style="color: #483d8b;">'you_flicker_api_key'</span>
&nbsp;
		params = <span style="color: #008000;">self</span>.<span style="color: black;">request</span>.<span style="color: black;">GET</span>
		params.<span style="color: black;">add</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'api_key'</span>, flickrapikey<span style="color: black;">&#41;</span>
		params.<span style="color: black;">add</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'format'</span>, <span style="color: #483d8b;">'json'</span><span style="color: black;">&#41;</span>
		apiquery = <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlencode</span><span style="color: black;">&#40;</span>params<span style="color: black;">&#41;</span>
&nbsp;
		result = urlfetch.<span style="color: black;">fetch</span><span style="color: black;">&#40;</span>url=flickrapiendpoint + <span style="color: #483d8b;">'?'</span> + apiquery, method=urlfetch.<span style="color: black;">GET</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: black;">response</span>.<span style="color: black;">out</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>result.<span style="color: black;">content</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	application = webapp.<span style="color: black;">WSGIApplication</span><span style="color: black;">&#40;</span>
		<span style="color: black;">&#91;</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/flickr/'</span>, FlickrController<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>,
		debug=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>
	wsgiref.<span style="color: black;">handlers</span>.<span style="color: black;">CGIHandler</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">run</span><span style="color: black;">&#40;</span>application<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
	main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre>
<p>I didn't see examples of such a script anywhere else so I thought I'd post it here for all to see.</p>
]]></content:encoded>
			<wfw:commentRss>http://w00kie.com/2008/06/18/crossdomain-proxy-on-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MQL baffles me</title>
		<link>http://w00kie.com/2008/01/10/mql-baffles-me/</link>
		<comments>http://w00kie.com/2008/01/10/mql-baffles-me/#comments</comments>
		<pubDate>Thu, 10 Jan 2008 13:26:10 +0000</pubDate>
		<dc:creator>w00kie</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[Work stuff]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[ematrix]]></category>
		<category><![CDATA[mql]]></category>

		<guid isPermaLink="false">http://www.w00kie.com/2008/01/10/mql-baffles-me/</guid>
		<description><![CDATA[My job consists of writing functional specifications and generally managing the architecture of a big R&#38;D information system based on a wonderful jack-of-all-trade application called eMatrix from Dassault. I often delve deep into the application with the MQL console (for Matrix Query Language) to dig out some insight into the data we manage. And, more [...]]]></description>
			<content:encoded><![CDATA[<p>My job consists of writing functional specifications and generally managing the architecture of a big R&amp;D information system based on a wonderful jack-of-all-trade application called eMatrix from Dassault.</p>
<p>I often delve deep into the application with the MQL console (for Matrix Query Language) to dig out some insight into the data we manage.</p>
<p>And, more often than not, I find things that makes me cringe:</p>
<blockquote><p><code><strong>MQL&lt;45&gt;</strong> print bus ECO ZCO3171 - select history.promote;<br />
business object  ECO ZCO3171 -<br />
history.promote = time: 10/22/2007 9:56  state: Design Work<br />
history.promote = time: 10/22/2007 17:23  state: Review<br />
history.promote = time: 10/22/2007 18:28  state: Release<br />
history.promote = time: 10/24/2007 21:33  state: Implemented<br />
<strong> MQL&lt;46&gt;</strong> print bus ECO ZCO3171 - select history.promote[1];<br />
business object  ECO ZCO3171 -<br />
history.promote[1] = time: 10/22/2007 17:23  state: Review<br />
<strong> MQL&lt;47&gt;</strong> print bus ECO ZCO3171 - select history.promote[0];<br />
business object  ECO ZCO3171 -<br />
history.promote[0] = time: 10/22/2007 9:56  state: Design Work<br />
history.promote[0] = time: 10/22/2007 17:23  state: Review<br />
history.promote[0] = time: 10/22/2007 18:28  state: Release<br />
history.promote[0] = time: 10/24/2007 21:33  state: Implemented</code></p></blockquote>
<p>If someone has any insight on how a query language can be <strong>this</strong> flawed, I'm all ears.</p>
<p>PS: If you don't understand anything about this post, I'm deeply sorry for boring you with my tech rants...</p>
]]></content:encoded>
			<wfw:commentRss>http://w00kie.com/2008/01/10/mql-baffles-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
