<?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>true false maybe &#187; Uncategorized</title>
	<atom:link href="http://truefalsemaybe.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://truefalsemaybe.com</link>
	<description>tom longson's blog on software, design, and user experience</description>
	<lastBuildDate>Mon, 21 Jun 2010 21:57:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JavaScript Book Recommendations</title>
		<link>http://truefalsemaybe.com/2010/06/javascript-book-recommendations/</link>
		<comments>http://truefalsemaybe.com/2010/06/javascript-book-recommendations/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 22:00:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=150</guid>
		<description><![CDATA[I've been expanding my library recently, and I wanted to share a list of some advanced JavaScript books I've picked up:

JavaScript: The Good Parts by Papa Crock
High Performance Web Sites by Steve Souders
Even Faster Web Sites by Steve Souders
High Performance JavaScript by Nicholas C. Zakas
Professional JavaScript for Web Developers by Nicholas C. Zakas
Pro Javascript Techniques [...]]]></description>
			<content:encoded><![CDATA[<p>I've been expanding my library recently, and I wanted to share a list of some advanced JavaScript books I've picked up:</p>
<ul>
<li><a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1276033931&amp;sr=1-1">JavaScript: The Good Parts</a> by Papa Crock</li>
<li><a href="http://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309">High Performance Web Sites</a> by Steve Souders</li>
<li><a href="http://www.amazon.com/Even-Faster-Web-Sites-Performance/dp/0596522304/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1276033969&amp;sr=1-1">Even Faster Web Sites</a> by Steve Souders</li>
<li><a href="http://www.amazon.com/Performance-JavaScript-Faster-Application-Interfaces/dp/059680279X/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1276034070&amp;sr=1-1">High Performance JavaScript</a> by Nicholas C. Zakas</li>
<li><a href="http://www.amazon.com/Professional-JavaScript-Developers-Wrox-Programmer/dp/047022780X/">Professional JavaScript for Web Developers</a> by Nicholas C. Zakas</li>
<li><a href="http://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1276034136&amp;sr=1-1-spell">Pro Javascript Techniques</a> by John Resig</li>
<li><a href="http://www.manning.com/resig/">Secrets of the JavaScript Ninja</a> by John Resig</li>
</ul>
<p>If you're totally new, these probably aren't the best books to dive into, but I still recommend picking up JavaScript: The Good Parts. It's amazing reading, really gave me a much better understanding of the language, and incredibly dense.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2010/06/javascript-book-recommendations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DataTable in yer DataTable</title>
		<link>http://truefalsemaybe.com/2010/03/datatable-in-yer-datatable/</link>
		<comments>http://truefalsemaybe.com/2010/03/datatable-in-yer-datatable/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 00:24:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[yui]]></category>
		<category><![CDATA[yuiblog]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/2010/03/datatable-in-yer-datatable/</guid>
		<description><![CDATA[
This is in response to Daniel Barreiro's post on putting DataTables in DataTables:
http://www.yuiblog.com/blog/2010/03/17/using-nested-datatables-for-row-expansion/
Credit: my coworker Jason R. Smith.
]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-117" title="yodawg" src="http://truefalsemaybe.com/wp-content/uploads/2010/03/yodawg.jpg" alt="yodawg" width="595" height="576" /></p>
<p>This is in response to Daniel Barreiro's post on putting DataTables in DataTables:</p>
<p><a href="http://www.yuiblog.com/blog/2010/03/17/using-nested-datatables-for-row-expansion/">http://www.yuiblog.com/blog/2010/03/17/using-nested-datatables-for-row-expansion/</a></p>
<p>Credit: my coworker Jason R. Smith.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2010/03/datatable-in-yer-datatable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is JSONPX?</title>
		<link>http://truefalsemaybe.com/2009/10/what-is-jsonpx/</link>
		<comments>http://truefalsemaybe.com/2009/10/what-is-jsonpx/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 19:19:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript jsonp jsonpx templating xml]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=112</guid>
		<description><![CDATA[I saw a message on twitter about something called JSONPX, and did some research to try to find out what it was. According to Wait till I come this is a new way to provide XML with a callback. Essentially this is a format to provide markup Yahoo's API with a callback and metadata describing [...]]]></description>
			<content:encoded><![CDATA[<p>I saw a message on twitter about something called JSONPX, and did some research to try to find out what it was. According to <a href="http://www.wait-till-i.com/2009/07/09/another-interesting-yql-feature-xml-with-callback-json-p-x/">Wait till I come</a> this is a new way to provide XML with a callback. Essentially this is a format to provide markup Yahoo's API with a callback and metadata describing the query.</p>
<p>Pretty slick, if you ask me. Normally I'd take the JSONP results and have a JavaScript templating engine like <a href="http://ejohn.org/blog/javascript-micro-templating/">John Resig's Micro-Templating</a>. If you use Yahoo's <a href="http://developer.yahoo.com/yql/guide/sorting.html">sanitize</a> function, you can even make the HTML safe to insert via innerHTML, even though <a href="http://erik.eae.net/archives/2005/04/08/18.13.31/">innerHTML is evil</a>.</p>
<p>As it gets easier to do HTML layout without markup hacks, I see this approach becoming more common. Get the markup you want, with the metadata you need.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2009/10/what-is-jsonpx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Be Cool</title>
		<link>http://truefalsemaybe.com/2009/05/be-cool/</link>
		<comments>http://truefalsemaybe.com/2009/05/be-cool/#comments</comments>
		<pubDate>Mon, 04 May 2009 05:42:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/2009/05/be-cool/</guid>
		<description><![CDATA[Andrew says to his kids "What's the rule?"

]]></description>
			<content:encoded><![CDATA[<p>Andrew says to his kids "What's the rule?"</p>
<p><img class="alignnone size-full wp-image-108" title="becool" src="http://truefalsemaybe.com/wp-content/uploads/2009/05/becool.jpg" alt="becool" width="600" height="450" /></p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2009/05/be-cool/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tagging with SQLAlchemy</title>
		<link>http://truefalsemaybe.com/2009/04/100/</link>
		<comments>http://truefalsemaybe.com/2009/04/100/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 20:47:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=100</guid>
		<description><![CDATA[I wanted to use tags with SQLAlchemy, so I looked up previous examples and found Wayne's post on how he did it. I adapted his code into a single file example so you can see better how it works. For any given page, there can be any number of tags .appended to it. For any [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to use tags with SQLAlchemy, so I looked up previous examples and found Wayne's post on how he did it. I adapted his code into a single file example so you can see better how it works. For any given page, there can be any number of tags .appended to it. For any given tag, you can .append it to any number of pages.</p>
<p>For example:</p>
<pre class="python">page = Page<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Example Page&quot;</span><span style="color: black;">&#41;</span>
page.<span style="color: black;">append</span><span style="color: black;">&#40;</span>Tag<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;examples&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> sqlalchemy <span style="color: #ff7700;font-weight:bold;">import</span> *
<span style="color: #ff7700;font-weight:bold;">from</span> sqlalchemy.<span style="color: black;">orm</span> <span style="color: #ff7700;font-weight:bold;">import</span> *
engine = create_engine<span style="color: black;">&#40;</span><span style="color: #483d8b;">'sqlite://'</span><span style="color: black;">&#41;</span>
metadata = MetaData<span style="color: black;">&#40;</span>engine<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#engine.echo =True </span>
&nbsp;
page_table = Table<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;page&quot;</span>, metadata,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;id&quot;</span>, Integer, Sequence<span style="color: black;">&#40;</span><span style="color: #483d8b;">'page_seq_id'</span>, optional=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>, primary_key=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;name&quot;</span>, Unicode<span style="color: black;">&#40;</span><span style="color: #ff4500;">100</span><span style="color: black;">&#41;</span>, nullable=<span style="color: #008000;">False</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span>
&nbsp;
tag_table = Table<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tag&quot;</span>, metadata,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;id&quot;</span>, Integer, Sequence<span style="color: black;">&#40;</span><span style="color: #483d8b;">'taq_seq_id'</span>, optional=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>, primary_key=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;name&quot;</span>, Unicode<span style="color: black;">&#40;</span><span style="color: #ff4500;">50</span><span style="color: black;">&#41;</span>, nullable=<span style="color: #008000;">False</span>, unique=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span>
&nbsp;
pagetag_table = Table<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;pagetag&quot;</span>, metadata,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;id&quot;</span>, Integer, Sequence<span style="color: black;">&#40;</span><span style="color: #483d8b;">'pagetag_seq_id'</span>, optional=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>, primary_key=<span style="color: #008000;">True</span><span style="color: black;">&#41;</span>,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;pageid&quot;</span>, Integer, ForeignKey<span style="color: black;">&#40;</span><span style="color: #483d8b;">'page.id'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
    Column<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;tagid&quot;</span>, Integer, ForeignKey<span style="color: black;">&#40;</span><span style="color: #483d8b;">'tag.id'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>,
<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Tag<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, name<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">name</span> = name
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__repr__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Tag(<span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span>)&quot;</span> % <span style="color: #008000;">self</span>.<span style="color: black;">name</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> Page<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, name<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">name</span> = name
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__repr__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Page(<span style="color: #000099; font-weight: bold;">\&quot;</span>%s<span style="color: #000099; font-weight: bold;">\&quot;</span>)&quot;</span> % <span style="color: #008000;">self</span>.<span style="color: black;">name</span>
&nbsp;
mapper<span style="color: black;">&#40;</span>Tag, tag_table<span style="color: black;">&#41;</span>
mapper<span style="color: black;">&#40;</span>Page, page_table, properties = <span style="color: black;">&#123;</span>
    <span style="color: #483d8b;">'tags'</span>:relation<span style="color: black;">&#40;</span>Tag, secondary=pagetag_table, cascade=<span style="color: #483d8b;">&quot;all&quot;</span><span style="color: black;">&#41;</span>,
    <span style="color: #808080; font-style: italic;">#    'tags':relation(Tag, secondary=pagetag_table, cascade=&quot;all,delete-orphans&quot;),</span>
<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
&nbsp;
metadata.<span style="color: black;">create_all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
sess = create_session<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
page = Page<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Tags with SQLAlchemy Example&quot;</span><span style="color: black;">&#41;</span>
page2 = Page<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Hot New Video Game Consists Solely Of Shooting People Point-Blank In The Face&quot;</span><span style="color: black;">&#41;</span>
page3 = Page<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;Congressman's War Hero Son Would Have Wanted Highway Bill Passed&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
tag = Tag<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;examples&quot;</span><span style="color: black;">&#41;</span>
tag2 = Tag<span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;onion&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
page.<span style="color: black;">tags</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>tag<span style="color: black;">&#41;</span>
page2.<span style="color: black;">tags</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>tag2<span style="color: black;">&#41;</span>
page3.<span style="color: black;">tags</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>tag2<span style="color: black;">&#41;</span>
&nbsp;
sess.<span style="color: black;">add</span><span style="color: black;">&#40;</span>page<span style="color: black;">&#41;</span>
sess.<span style="color: black;">add</span><span style="color: black;">&#40;</span>page2<span style="color: black;">&#41;</span>
sess.<span style="color: black;">add</span><span style="color: black;">&#40;</span>page3<span style="color: black;">&#41;</span>
sess.<span style="color: black;">flush</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
tag_q = sess.<span style="color: black;">query</span><span style="color: black;">&#40;</span>Tag<span style="color: black;">&#41;</span>
tags = tag_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Number of tags:&quot;</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>tags<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># filter pages by tag(s)</span>
page_q = sess.<span style="color: black;">query</span><span style="color: black;">&#40;</span>Page<span style="color: black;">&#41;</span>
pages = page_q.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'tags'</span><span style="color: black;">&#41;</span>.<span style="color: black;">filter_by</span><span style="color: black;">&#40;</span>name=u<span style="color: #483d8b;">&quot;tag&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;First Page&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">first</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">first</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">tags</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Second Page&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">tags</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Third Page&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> page_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>.<span style="color: black;">tags</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># delete-orphans does the work for us here...</span>
<span style="color: #808080; font-style: italic;">#sess.delete(pages[0]</span>
<span style="color: #808080; font-style: italic;">#sess.flush()</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;All tags&quot;</span>
tags = tag_q.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> tags, <span style="color: #483d8b;">&quot;Count:&quot;</span>, <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>tags<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Tag cloud anyone?&quot;</span>
<span style="color: #808080; font-style: italic;"># see the source code linked below for a properly weighted tag cloud.</span>
tag_q = sess.<span style="color: black;">query</span><span style="color: black;">&#40;</span>func.<span style="color: black;">count</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;*&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">label</span><span style="color: black;">&#40;</span>u<span style="color: #483d8b;">&quot;tagcount&quot;</span><span style="color: black;">&#41;</span>, Tag<span style="color: black;">&#41;</span>
tag_r = tag_q.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>Tag.<span style="color: #008000;">id</span>==pagetag_table.<span style="color: black;">c</span>.<span style="color: black;">tagid</span><span style="color: black;">&#41;</span>.<span style="color: black;">group_by</span><span style="color: black;">&#40;</span>Tag.<span style="color: #008000;">id</span><span style="color: black;">&#41;</span>.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;">#print tag_q</span>
<span style="color: #ff7700;font-weight:bold;">print</span> tag_r
&nbsp;
<span style="color: #808080; font-style: italic;"># what about pages with related tags?</span>
page_q = sess.<span style="color: black;">query</span><span style="color: black;">&#40;</span>Page<span style="color: black;">&#41;</span>
&nbsp;
taglist = <span style="color: black;">&#91;</span>u<span style="color: #483d8b;">&quot;tag1&quot;</span>, u<span style="color: #483d8b;">&quot;tag2&quot;</span><span style="color: black;">&#93;</span>
tagcount = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>taglist<span style="color: black;">&#41;</span>
page_q.<span style="color: black;">join</span><span style="color: black;">&#40;</span>Page.<span style="color: black;">tags</span><span style="color: black;">&#41;</span>.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>Tag.<span style="color: black;">name</span>.<span style="color: black;">in_</span><span style="color: black;">&#40;</span>taglist<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.\
group_by<span style="color: black;">&#40;</span>Page.<span style="color: #008000;">id</span><span style="color: black;">&#41;</span>.<span style="color: black;">having</span><span style="color: black;">&#40;</span>func.<span style="color: black;">count</span><span style="color: black;">&#40;</span>Page.<span style="color: #008000;">id</span><span style="color: black;">&#41;</span> == tagcount<span style="color: black;">&#41;</span>.<span style="color: black;">all</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre>
<p>I know tag clouds are passe, but I still think from an information architecture perspective, tags still better than categories.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2009/04/100/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Giving up Reddit for Lent</title>
		<link>http://truefalsemaybe.com/2009/02/giving-up-reddit-for-lent/</link>
		<comments>http://truefalsemaybe.com/2009/02/giving-up-reddit-for-lent/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:05:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=95</guid>
		<description><![CDATA[I'm not religious but I like the idea of Lent because it fits into the idea of changing our habits, which is hard to do and potentially has dramatic long standing effects on how we live.
I for one love reading Reddit and sometimes Digg, but I find it to be somewhat a sinkhole. Sure it's [...]]]></description>
			<content:encoded><![CDATA[<p>I'm not religious but I like the idea of Lent because it fits into the idea of changing our habits, which is hard to do and potentially has dramatic long standing effects on how we live.</p>
<p>I for one love reading <a href="http://reddit.com">Reddit</a> and sometimes <a href="http://digg.com">Digg</a>, but I find it to be somewhat a sinkhole. Sure it's funny to read about how someone destroyed their finger with magnets or see a cute picture of a coyote on the BART, but from a learning perspective, I'd be better off spending my time on <a href="http://news.ycombinator.com/">hacker news</a>.</p>
<p>So to that end, I'm modifying my host file to give up reddit for lent. Who knows, maybe instead of removing the entry after lent, I'll add more instead.</p>
<p>Here's how you can do it too:<br />
<a href="http://www.allthingsmarked.com/2006/08/28/howto-block-websites-using-the-hosts-file/">Windows</a> | <a href="http://osxdaily.com/2007/03/19/block-access-to-specified-sites-by-modifying-etchosts/">OSX</a> | <a href="http://tugalinux.wordpress.com/2009/01/15/blocking-websites-using-the-hosts-file/">Linux</a></p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2009/02/giving-up-reddit-for-lent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Profiling SQL in Pylons with Dozer</title>
		<link>http://truefalsemaybe.com/2008/11/profiling-sql-in-pylons-with-dozer/</link>
		<comments>http://truefalsemaybe.com/2008/11/profiling-sql-in-pylons-with-dozer/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 18:32:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Pylons]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=68</guid>
		<description><![CDATA[
So you want to find out why your Pylons app is running slowly? Well most likely it has to do with your SQL queries, and the best way to see what's going on and how long each request is taking is to install Dozer (by benbangert of Pylons), and load it up with a TimerProxy [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://truefalsemaybe.com/wp-content/uploads/2008/11/picture-141.png"><img src="http://truefalsemaybe.com/wp-content/uploads/2008/11/picture-141.png" alt="" title="Pylons with Dozer" width="500" height="309" class="alignnone size-full wp-image-78" /></a></p>
<p>So you want to find out why your Pylons app is running slowly? Well most likely it has to do with your SQL queries, and the best way to see what's going on and how long each request is taking is to install Dozer (by benbangert of Pylons), and load it up with a TimerProxy (by zzzeek of SQLAlchemy).</p>
<p>Sound like fun? Well, here's how to do it.</p>
<p>Install Dozer:</p>
<pre>sudo easy_install -U http://www.bitbucket.org/bbangert/dozer/get/b748d3e1cc87.gz</pre>
<p>Add this to your middleware:</p>
<pre>
# Add this to your middleware.py, right before return app
    if asbool(config['debug']):
        from dozer import Logview
        app = Logview(app, config)
</pre>
<p>Add this to your development.ini</p>
<pre>
# Add to development.ini
logview.sqlalchemy = #faa
logview.pylons.templating = #bfb
</pre>
<p>(you can customize the colors here)</p>
<p>Next, modify your configuration ini as well as you like to configure what shows up in the log. Note that I have root set to INFO which will squelch a lot of messages. Change this to DEBUG to see more of what's going on in each request.</p>
<pre>
# Logging configuration
[loggers]
keys = root, YOURPROJ

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_YOURPROJ]
level = DEBUG
handlers =
qualname = YOURPROJ.lib

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
</pre>
<p>Add this file to /lib/</p>
<p>querytimer.py</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> sqlalchemy.<span style="color: black;">interfaces</span> <span style="color: #ff7700;font-weight:bold;">import</span> ConnectionProxy
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
log = <span style="color: #dc143c;">logging</span>.<span style="color: black;">getLogger</span><span style="color: black;">&#40;</span>__name__<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> TimerProxy<span style="color: black;">&#40;</span>ConnectionProxy<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> cursor_execute<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, execute, cursor, statement, parameters, context, executemany<span style="color: black;">&#41;</span>:
        now = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #ff7700;font-weight:bold;">return</span> execute<span style="color: black;">&#40;</span>cursor, statement, parameters, context<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">finally</span>:
            total = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - now
            log.<span style="color: black;">debug</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Query: %s&quot;</span> % statement<span style="color: black;">&#41;</span>
            log.<span style="color: black;">debug</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Total Time: %f&quot;</span> % total<span style="color: black;">&#41;</span>
&nbsp;</pre>
<p>Okay, one last thing, modify your SQLAlchemy engine in environment.py to this:</p>
<pre class="python">engine = engine_from_config<span style="color: black;">&#40;</span>config, <span style="color: #483d8b;">'sqlalchemy.'</span>, proxy=TimerProxy<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre>
<p>and add an import at the top:</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> YOURPROJ.<span style="color: black;">lib</span>.<span style="color: black;">querytimer</span> <span style="color: #ff7700;font-weight:bold;">import</span> TimerProxy</pre>
<p>So that's it! Restart paster, and load up a request in your web browser. There will now be a bar at the top that you can click on and see all the requests.</p>
<p>If you want to run TimerProxy on it's own (that is without Pylons and Dozer, see zzzeek's post on "<a href="http://techspot.zzzeek.org/?p=31">Timing All Queries</a>".</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2008/11/profiling-sql-in-pylons-with-dozer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Graphing Stories</title>
		<link>http://truefalsemaybe.com/2008/10/graphing-stories/</link>
		<comments>http://truefalsemaybe.com/2008/10/graphing-stories/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 00:57:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=49</guid>
		<description><![CDATA[At the most basic level, a graph can communicate key information, like a company's P&#38;L, the median price of a house, or daily average rainfall for a county over a year, but when used effectively, a graph can tell a story.
Much like the rings on a tree can tell you the story of their lives, [...]]]></description>
			<content:encoded><![CDATA[<p>At the most basic level, a graph can communicate key information, like a company's P&amp;L, the median price of a house, or daily average rainfall for a county over a year, but when used effectively, a graph can tell a story.</p>
<p>Much like the rings on a tree can tell you the story of their lives, <a href="http://www.nytimes.com/interactive/2008/10/11/business/20081011_BEAR_MARKETS.html?hp">this graph from the NYTimes</a>, tells the all too true story that we're living right now, every one of us -- the economy. How it varies from the LA Times dead tree edition though is dramatic because it interactively allows you to explore how this bear market relates to the bear markets of our parents, grandparents, and great grandparents.</p>
<p><a href="http://www.nytimes.com/interactive/2008/10/11/business/20081011_BEAR_MARKETS.html?hp"><img class="alignnone size-full wp-image-50" title="NYTimes Bear Market Graph" src="http://truefalsemaybe.com/wp-content/uploads/2008/10/picture-1.png" alt="" width="500" height="389" border="0" style="border: 0px;"/></a></p>
<p>The NYTimes effectively use a timeline that slides to specific bear markets, making it incredibly easy to see the differences between today and the history that led up to this crisis. Having closely watched the markets, this paints an entirely new picture, however grim it may be.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2008/10/graphing-stories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>American Nightmare</title>
		<link>http://truefalsemaybe.com/2008/07/american-nightmare/</link>
		<comments>http://truefalsemaybe.com/2008/07/american-nightmare/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 17:18:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=15</guid>
		<description><![CDATA[I'm putting together a costume for Burning Man. It's all around the theme of the American Dream, gone horribly horribly wrong. The truth of the world today is just as sinister, just not so visually repulsive.
Here are the main pieces of the costume. I have yet to get them, so I haven't been able to [...]]]></description>
			<content:encoded><![CDATA[<p>I'm putting together a costume for Burning Man. It's all around the theme of the American Dream, gone horribly horribly wrong. The truth of the world today is just as sinister, just not so visually repulsive.</p>
<p>Here are the main pieces of the costume. I have yet to get them, so I haven't been able to assemble it yet. They will be modified somewhat to look more "official", possibly incorporating a government looking seal.</p>
<p><img class="alignnone size-medium wp-image-16" title="EyeClops" src="http://truefalsemaybe.com/wp-content/uploads/2008/07/41dm8hfgltl_aa280_.jpg" alt="" width="280" height="280" /><br />
EyeClops Nightvision Mask ($80)</p>
<p><img class="alignnone size-medium wp-image-17" title="3M Respirator " src="http://truefalsemaybe.com/wp-content/uploads/2008/07/p0014104.jpg" alt="" width="200" height="200" /><img class="alignnone size-medium wp-image-18" title="Coveralls" src="http://truefalsemaybe.com/wp-content/uploads/2008/07/p0038294.jpg" alt="" width="200" height="200" /><br />
<img class="alignnone size-medium wp-image-19" title="Chemical Apron" src="http://truefalsemaybe.com/wp-content/uploads/2008/07/p0004319.jpg" alt="" width="200" height="200" /><img class="alignnone size-medium wp-image-20" title="28\&quot; Chemical Gloves" src="http://truefalsemaybe.com/wp-content/uploads/2008/07/p0018067.jpg" alt="" width="200" height="200" /><br />
Respirator, Coveralls, Chemical Apron, and 28" Chemical Gloves, all totaling approximately $65.</p>
<p>These parts combined with a pair of black boots will create a look that will cover up the entire body, leaving no sense of humanity beyond the humanoid shape, much like HalfLife 2's Combine Soldiers. Combined with some audio on loop possibly similar to 1984 - War is Peace, Freedom is Slavery, Ignorance is Strength, or possibly more aptly, incorrectly telling people they do not have the right to take photographs and to report suspicious behavior immediately.</p>
<p>Maybe this isn't the Burning Man many know and love. It's dark. It's dystopian. It is performance art designed to provoke thought, not laughter or smiles. Is it my dream? No, but I am tired of the security theater and crumbling of civil liberties that is the reality of today's world.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2008/07/american-nightmare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenViewProject</title>
		<link>http://truefalsemaybe.com/2008/07/openviewproject/</link>
		<comments>http://truefalsemaybe.com/2008/07/openviewproject/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 19:37:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://truefalsemaybe.com/?p=14</guid>
		<description><![CDATA[The OpenView Project is a open source, creative commons project for building and taking interactive panoramas much like Google Street View, but of more interesting places than streets, such as farmers markets, concerts, art festivals, and hiking trails, just to name a few. I'm blogging my work on it at OpenView Project (openviewproject.org). I'm very [...]]]></description>
			<content:encoded><![CDATA[<p>The OpenView Project is a open source, creative commons project for building and taking interactive panoramas much like Google Street View, but of more interesting places than streets, such as farmers markets, concerts, art festivals, and hiking trails, just to name a few. I'm blogging my work on it at <a href="http://openviewproject.org">OpenView Project</a> (openviewproject.org). I'm very thrilled to be working with photography again, and excited about the prospect of giving people a new pespective of the world around them.</p>
]]></content:encoded>
			<wfw:commentRss>http://truefalsemaybe.com/2008/07/openviewproject/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
