<?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>The Rambling Chronicles: Notes</title>
	<atom:link href="http://notes.theramblingchronicles.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.theramblingchronicles.co.uk</link>
	<description>Making sense is optional</description>
	<lastBuildDate>Thu, 26 Aug 2010 10:09:56 +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>Easy thumbnail resizing with Automator</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/08/26/easy-thumbnail-resizing-with-automator/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/08/26/easy-thumbnail-resizing-with-automator/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 10:07:01 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[resize]]></category>
		<category><![CDATA[thumbnail]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/?p=350</guid>
		<description><![CDATA[Simply use a &#8220;run shell script&#8221; action, set pass input to &#8220;as argument&#8221; and use sips $@ --resampleWidth 60, setting the width you want. Found this handy tip here: http://lethain.com/entry/2008/sep/22/using-automator-to-scale-images-horizontally/]]></description>
			<content:encoded><![CDATA[<p>Simply use a &#8220;run shell script&#8221; action, set pass input to &#8220;as argument&#8221; and use <code>sips $@ --resampleWidth 60</code>, setting the width you want.</p>

<p>Found this handy tip here: <a href="http://lethain.com/entry/2008/sep/22/using-automator-to-scale-images-horizontally/">http://lethain.com/entry/2008/sep/22/using-automator-to-scale-images-horizontally/</a></p>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/08/26/easy-thumbnail-resizing-with-automator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A PHP version of Sinatra</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/08/17/a-php-version-of-sinatra/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/08/17/a-php-version-of-sinatra/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 13:43:45 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[Fitzgerald]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sinatra]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/?p=348</guid>
		<description><![CDATA[I&#8217;ve been looking for something like this for a while: Fitzgerald. Handles routing, rendering and all the other basics, small size and very easy to use.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for something like this for a while: <a href="http://autonomousmachine.com/2008/11/21/fitzgerald-a-sinatra-clone-in-php">Fitzgerald</a>.</p>

<p>Handles routing, rendering and all the other basics, small size and very easy to use.</p>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/08/17/a-php-version-of-sinatra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Syntax highlighting for Coda</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/07/28/django-syntax-highlighting-for-coda/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/07/28/django-syntax-highlighting-for-coda/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 14:00:33 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[django templates]]></category>
		<category><![CDATA[syntax highlighting]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/?p=346</guid>
		<description><![CDATA[Just makes things a little clearer than without: Get it here]]></description>
			<content:encoded><![CDATA[<p>Just makes things a little clearer than without: <a href="http://joebergantine.com/werkstatt/django-template">Get it here</a></p>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/07/28/django-syntax-highlighting-for-coda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Macports</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/07/28/django-macports/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/07/28/django-macports/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 11:51:51 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/?p=344</guid>
		<description><![CDATA[Irritatingly, the django-admin.py is not set in the path, you need to symlink it somehwere that is seen (I put it in /opt/local/bin)]]></description>
			<content:encoded><![CDATA[<p>Irritatingly, the django-admin.py is not set in the path, you need to symlink it somehwere that is seen (I put it in <code>/opt/local/bin</code>)</p>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/07/28/django-macports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash without and IDE</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/05/11/flash-without-and-ide/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/05/11/flash-without-and-ide/#comments</comments>
		<pubDate>Tue, 11 May 2010 13:08:11 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[mxmlc]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/2010/05/11/flash-without-and-ide/</guid>
		<description><![CDATA[Not as tricky as it sounds, as long as you have the right stuff. First, the compiler: (Use Flex SDK mxmlc ) Which you can then use to compile: mxmlc -compiler.debug -default-size 550 1204 -o=&#34;&#60;swf location&#62;&#34; &#60;your_actionscript&#62;.as You&#8217;ll also need a debugger: Such as De MonsterDebugger which allows you to debug your swf. Notes: Flash [...]]]></description>
			<content:encoded><![CDATA[<p>Not as tricky as it sounds, as long as you have the right stuff.</p>

<p>First, the compiler: (Use Flex <span class="caps">SDK </span>mxmlc )</p>

<p>Which you can then use to compile:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mxmlc -compiler.debug <span style="color: #660033;">-default-size</span> <span style="color: #000000;">550</span> <span style="color: #000000;">1204</span> <span style="color: #660033;">-o</span>=<span style="color: #ff0000;">&quot;&lt;swf location&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span>your_actionscript<span style="color: #000000; font-weight: bold;">&gt;</span>.as</pre></div></div>




<p>You&#8217;ll also need a debugger:<br />
<a href="http://demonsterdebugger.com/">Such as De MonsterDebugger</a> which allows you to debug your swf.</p>

<p><strong>Notes:</strong></p>


<ul>
<li>Flash security policy means that debugging as a local file is a pain, set up a &#8220;site&#8221; that you can work from (a local server is best)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/05/11/flash-without-and-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interesting Bash colour reference</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/05/04/interesting-bash-colour-reference/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/05/04/interesting-bash-colour-reference/#comments</comments>
		<pubDate>Tue, 04 May 2010 12:05:13 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[bash colour]]></category>
		<category><![CDATA[PS1]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/2010/05/04/interesting-bash-colour-reference/</guid>
		<description><![CDATA[The PS1 variable in .bash_profile contains the formatting for the login bit of a terminal prompt. My PS1 variable: PS1=&#34;\[3[1;32m\]\u\[3[1;30m\]@\[3[0;34m\]\h\[3[1;30m\] \[3[0;30m\]\W \[3[1;30m\]\$\[3[0m\] &#34; (green username@blue server: black location) PS1 variables: \a an ASCII bell character &#40;07&#41; \d the date in &#34;Weekday Month Date&#34; format &#40;e.g., &#34;Tue May 26&#34;&#41; \e an ASCII escape character &#40;033&#41; \h [...]]]></description>
			<content:encoded><![CDATA[<p>The <span class="caps">PS1 </span>variable in <code>.bash_profile</code> contains the formatting for the login bit of a terminal prompt.</p>

<p>My <span class="caps">PS1 </span>variable: <code>PS1=&quot;\[3[1;32m\]\u\[3[1;30m\]@\[3[0;34m\]\h\[3[1;30m\] \[3[0;30m\]\W \[3[1;30m\]\$\[3[0m\] &quot;</code> (green username@blue server: black location)</p>

<p><span class="caps">PS1 </span>variables:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> \a     an ASCII bell character <span style="color: #7a0874; font-weight: bold;">&#40;</span>07<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \d     the <span style="color: #c20cb9; font-weight: bold;">date</span>  <span style="color: #000000; font-weight: bold;">in</span>  <span style="color: #ff0000;">&quot;Weekday  Month  Date&quot;</span>  format
        <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g., <span style="color: #ff0000;">&quot;Tue May 26&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \e     an ASCII escape character <span style="color: #7a0874; font-weight: bold;">&#40;</span>033<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \h     the <span style="color: #c20cb9; font-weight: bold;">hostname</span> up to the first <span style="color: #000000; font-weight: bold;">`</span>.<span style="color: #ff0000;">'
 \H     the hostname
 \j     the  number of jobs currently managed by the shell
 \l     the basename of the shell'</span>s terminal device name
 \n     newline
 \r     carriage <span style="color: #7a0874; font-weight: bold;">return</span>
 \s     the  name  of  the shell, the <span style="color: #c20cb9; font-weight: bold;">basename</span> of $<span style="color: #000000;">0</span>
        <span style="color: #7a0874; font-weight: bold;">&#40;</span>the portion following the final slash<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \t     the current <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">24</span>-hour HH:MM:SS format
 \T     the current <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">12</span>-hour HH:MM:SS format
 \<span style="color: #000000; font-weight: bold;">@</span>     the current <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000;">12</span>-hour am<span style="color: #000000; font-weight: bold;">/</span>pm format
 \u     the username of the current user
 \v     the version of <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g., <span style="color: #000000;">2.00</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \V     the release of <span style="color: #c20cb9; font-weight: bold;">bash</span>,  version  +  patchlevel
        <span style="color: #7a0874; font-weight: bold;">&#40;</span>e.g., 2.00.0<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 \<span style="color: #c20cb9; font-weight: bold;">w</span>     the current working directory
 \W     the  <span style="color: #c20cb9; font-weight: bold;">basename</span>  of the current working direcory
 \<span style="color: #000000; font-weight: bold;">!</span>     the <span style="color: #7a0874; font-weight: bold;">history</span> number of this <span style="color: #7a0874; font-weight: bold;">command</span>
 \<span style="color: #666666; font-style: italic;">#     the command number of this command</span>
 \$     <span style="color: #000000; font-weight: bold;">if</span> the effective UID is <span style="color: #000000;">0</span>, a <span style="color: #666666; font-style: italic;">#, otherwise a $</span>
 \nnn   the character corresponding to the octal number nnn
 \\     a backslash
 \<span style="color: #7a0874; font-weight: bold;">&#91;</span>     begin a sequence of non-printing characters,
        <span style="color: #c20cb9; font-weight: bold;">which</span> could be used to embed a terminal control
        sequence into the prompt
 \<span style="color: #7a0874; font-weight: bold;">&#93;</span>     end a sequence of non-printing characters</pre></div></div>




<p><span class="caps">PS1</span> Colours:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Black       <span style="color: #000000;">0</span>;<span style="color: #000000;">30</span>     Dark Gray     <span style="color: #000000;">1</span>;<span style="color: #000000;">30</span>
Blue        <span style="color: #000000;">0</span>;<span style="color: #000000;">34</span>     Light Blue    <span style="color: #000000;">1</span>;<span style="color: #000000;">34</span>
Green       <span style="color: #000000;">0</span>;<span style="color: #000000;">32</span>     Light Green   <span style="color: #000000;">1</span>;<span style="color: #000000;">32</span>
Cyan        <span style="color: #000000;">0</span>;<span style="color: #000000;">36</span>     Light Cyan    <span style="color: #000000;">1</span>;<span style="color: #000000;">36</span>
Red         <span style="color: #000000;">0</span>;<span style="color: #000000;">31</span>     Light Red     <span style="color: #000000;">1</span>;<span style="color: #000000;">31</span>
Purple      <span style="color: #000000;">0</span>;<span style="color: #000000;">35</span>     Light Purple  <span style="color: #000000;">1</span>;<span style="color: #000000;">35</span>
Brown       <span style="color: #000000;">0</span>;<span style="color: #000000;">33</span>     Yellow        <span style="color: #000000;">1</span>;<span style="color: #000000;">33</span>
Light Gray  <span style="color: #000000;">0</span>;<span style="color: #000000;">37</span>     White         <span style="color: #000000;">1</span>;<span style="color: #000000;">37</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/05/04/interesting-bash-colour-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL string replace</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/03/23/mysql-string-replace/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/03/23/mysql-string-replace/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 12:04:23 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/2010/03/23/mysql-string-replace/</guid>
		<description><![CDATA[Keep forgetting this. Replace a string in all rows: UPDATE &#60;table&#62; SET &#60;column&#62; = REPLACE&#40;&#60;column&#62;, '&#60;string to find&#62;', '&#60;string to replace&#62;'&#41;;]]></description>
			<content:encoded><![CDATA[<p>Keep forgetting this. Replace a string in all rows:</p>


<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #66cc66;">&lt;</span>table<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #66cc66;">&lt;</span>column<span style="color: #66cc66;">&gt;</span> <span style="color: #66cc66;">=</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&lt;</span>column<span style="color: #66cc66;">&gt;,</span> <span style="color: #ff0000;">'&lt;string to find&gt;'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'&lt;string to replace&gt;'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/03/23/mysql-string-replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lucene Indexing</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/03/15/lucene-indexing/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/03/15/lucene-indexing/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 12:20:50 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[Indexing]]></category>
		<category><![CDATA[Lucene]]></category>
		<category><![CDATA[Luke]]></category>
		<category><![CDATA[LuSql]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Zend Search Lucene]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/?p=331</guid>
		<description><![CDATA[Using Zend Search Lucene to index is almost impossible when the amount needing to be index exceeds even a small amount. Some Tools: LuSql allows you to index a database based on a mysql query 1 Luke For looking into the indexes you&#8217;ve created and checking they contain all the data you want. Things to [...]]]></description>
			<content:encoded><![CDATA[<p>Using Zend Search Lucene to index is almost impossible when the amount needing to be index exceeds even a small amount.</p>

<h3>Some Tools:</h3>


<ul>
<li><a href="http://lab.cisti-icist.nrc-cnrc.gc.ca/cistilabswiki/index.php/LuSql">LuSql</a> allows you to index a database based on a mysql query <sup class='footnote'><a href='#fn-331-1' id='fnref-331-1'>1</a></sup></li>
<li><a href="http://code.google.com/p/luke/">Luke</a> For looking into the indexes you&#8217;ve created and checking they contain all the data you want.</li>
</ul>




<h3>Things to remember</h3>


<ul>
<li>If you need to specify what an index field will store you have to do it for each one, in order they are returned in the <span class="caps">SQL.</span> E.g.</li>
</ul>




<pre>
name, age, dob, location, 
310 210 200 200
</pre>



<ul>
<li>It doesn&#8217;t seem to like column aliases for some reason &#8211; try not to use them if possible<div class='footnotes'><div class='footnotedivider'></div><ol><li id='fn-331-1'>Seems to have problems with column aliases though in my scripts <span class='footnotereverse'><a href='#fnref-331-1'>&#8617;</a></span></li></ol></div></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/03/15/lucene-indexing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python DB API</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/03/09/python-db-api/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/03/09/python-db-api/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 14:46:53 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[DB API]]></category>
		<category><![CDATA[MySQL Connector/Python]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[reference]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/2010/03/09/python-db-api/</guid>
		<description><![CDATA[Useful things to remember: Can get python built (no compile, no need for mysql_config file shenanigans) from launchpad Need to create a DB cnfig object: config = &#123;'host': 'localhost', 'database': 'database_name', 'user': 'root', 'password': '', 'charset': 'utf8' ,'use_unicode': True, 'get_warnings': True &#125; Then connect: db = mysql.connector.connect&#40;**config&#41; Then you can get the &#8220;cursor&#8221; object which [...]]]></description>
			<content:encoded><![CDATA[<p>Useful things to remember:</p>

<p>Can get python built (no compile, no need for mysql_config file shenanigans) from <a href="https://launchpad.net/myconnpy">launchpad</a></p>

<p>Need to create a DB cnfig object:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">config = <span style="color: black;">&#123;</span><span style="color: #483d8b;">'host'</span>: <span style="color: #483d8b;">'localhost'</span>, <span style="color: #483d8b;">'database'</span>: <span style="color: #483d8b;">'database_name'</span>, <span style="color: #483d8b;">'user'</span>: <span style="color: #483d8b;">'root'</span>, <span style="color: #483d8b;">'password'</span>: <span style="color: #483d8b;">''</span>, <span style="color: #483d8b;">'charset'</span>: <span style="color: #483d8b;">'utf8'</span> ,<span style="color: #483d8b;">'use_unicode'</span>: <span style="color: #008000;">True</span>, <span style="color: #483d8b;">'get_warnings'</span>: <span style="color: #008000;">True</span> <span style="color: black;">&#125;</span></pre></div></div>



<p>Then connect:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">db = mysql.<span style="color: black;">connector</span>.<span style="color: black;">connect</span><span style="color: black;">&#40;</span><span style="color: #66cc66;">**</span>config<span style="color: black;">&#41;</span></pre></div></div>



<p>Then you can get the &#8220;cursor&#8221; object which allows you to do things:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">cursor = db.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>



<p>Then perform whatever you want with <span class="caps">SQL</span>:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">cursor.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SELECT * FROM table'</span><span style="color: black;">&#41;</span></pre></div></div>



<p>Get the results for your query and iterate through them:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> cursor.<span style="color: black;">fetchall</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">print</span> row</pre></div></div>



<p>Get the ID of an insert you have just performed:</p>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">cursor.<span style="color: black;">lastrowid</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/03/09/python-db-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change of address</title>
		<link>http://notes.theramblingchronicles.co.uk/2010/03/01/change-of-address/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2010/03/01/change-of-address/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:51:39 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[moved]]></category>
		<category><![CDATA[new address]]></category>

		<guid isPermaLink="false">http://notes.theramblingchronicles.co.uk/2010/03/01/change-of-address/</guid>
		<description><![CDATA[The blog is now at http://notes.theramblingchronicles.co.uk. It was always going to be moved to make way for the original purpose on the domain. On the absolute remote chance that this messed up something for someone, somewhere, I&#8217;m sorry.]]></description>
			<content:encoded><![CDATA[<p>The blog is now at http://notes.theramblingchronicles.co.uk. It was always going to be moved to make way for the original purpose on the domain. On the absolute remote chance that this messed up something for someone, somewhere, I&#8217;m sorry.</p>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2010/03/01/change-of-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
