<?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>Standard Deviations &#187; Programming</title>
	<atom:link href="http://parand.com/say/index.php/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://parand.com/say</link>
	<description>Parand Tony Darugar: A Cruel and Petty Dictator</description>
	<lastBuildDate>Sun, 25 Jul 2010 02:36:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Understanding OAuth: An Overview</title>
		<link>http://parand.com/say/index.php/2010/05/17/understanding-oauth-an-overview/</link>
		<comments>http://parand.com/say/index.php/2010/05/17/understanding-oauth-an-overview/#comments</comments>
		<pubDate>Tue, 18 May 2010 04:43:53 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[oauth]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=1040</guid>
		<description><![CDATA[The scenario: user Alice wants to allow SimpleService to access Twitter on her behalf.
Before OAuth this would be done by having Alice give SimpleService her login credentials for Twitter. She would type in her Twitter username and password into SimpleService, and SimpleService would use those credentials to access Twitter on her behalf. This was bad [...]]]></description>
			<content:encoded><![CDATA[<p>The scenario: user Alice wants to allow SimpleService to access Twitter on her behalf.</p>
<p>Before OAuth this would be done by having Alice give SimpleService her login credentials for Twitter. She would type in her Twitter username and password into SimpleService, and SimpleService would use those credentials to access Twitter on her behalf. This was bad because SimpleService now knew Alice&#8217;s credentials, and could do malicious things or carelessly leak her credentials to malicious people.</p>
<p>With OAuth Alice doesn&#8217;t have to give SimpleService her Twitter credentials. Instead she goes through a process wherein she tells Twitter that SimpleService is allowed to act on her behalf.</p>
<p>The flow is:</p>
<p>First, before Alice is involved, Twitter and SimpleService exchange secret information: SimpleService requests Twitter to provide it with a consumer token and a secret. The consumer token will be used to identify SimpleService to Twitter, and the secret will be used to secure the communications to prevent others from pretending to be SimpleService.</p>
<p>This is setup once, allowing SimpleService and Twitter to communicate in general.</p>
<p>Once setup, for each user that wants to allow SimpleService to access Twitter on their behalf, the following happens:</p>
<ul>
<li>The user Alice goes to the SimpleService website and requests SimpleService to access her Twitter account.</li>
<li>SimpleService calls Twitter with a <code>request_token</code> call. This tells Twitter SimpleService is about to have a conversation with it regarding authorization.</li>
<li>Twitter responds with a <code>request_token</code>.</li>
<li>SimpleService, having received the token from Twitter, redirects the user&#8217;s browser to a Twitter <code>authorize</code> page, passing the along the <code>request_token</code> as part of the url.</li>
<li>Twitter grabs the token (along with various signatures and timestamps to verify the request is not forged).</li>
<li>Twitter displays a page to the user asking her if she wants to give SimpleService access to her Twitter account.</li>
<li>If the user says no the game is over, and the token is not authorized.</li>
<li>If the user says yes, Twitter redirects the user back to SimpleService, passing along an authorization token, letting SimpleService know the user authorized access.</li>
<li>SimpleService now exchanges the authorization token for an access token: it calls Twitter with the authorization token, and requests Twitter to give it an access token.</li>
<li>Twitter examines the token SimpleService sent it, verifies that it&#8217;s not forged and that the user Alice had earlier authorized that token for access. It now believes that Alice wants to grant SimpleService access to her Twitter account. Twitter responds to SimpleService with an Access token.</li>
<li>SimpleService grabs the access token and stores it, associating it with the user Alice.</li>
</ul>
<p>Now the initial authorization dance is done: SimpleService has an access token that allows it to access Twitter on behalf of Alice.</p>
<p>To actually access Twitter on behalf of Alice, SimpleService includes the access token with each call it makes to Twitter on behalf of Alice. Twitter checks the token, verifies that is valid, and allows SimpleService to access Alice&#8217;s resources.</p>
<p>To be an OAuth service provider (that is, play the part of Twitter), you need to:</p>
<ul>
<li>Have a way to exchange consumer tokens and secret keys with third parties (eg. SimpleService) that want to access your APIs.</li>
<li>Provide a request_token service that provides tokens that start the conversation for each authorization.</li>
<li>Provide an authorization page that tells the user that a third party (eg. SimpleService) is requesting access to her resources, and allows her to accept or reject the request.</li>
<li>Make a callback to the service (eg. SimpleService), informing it that the request has been authorized.</li>
<li>Provide an access_token service that accepts a request token that&#8217;s been authorized and provides an access token to the third party (eg. SimpleService).</li>
<li>Store the access token for the user that authorized it.</li>
<li>Accept access tokens as an authentication mechanism for API calls, verifying the token&#8217;s validity and authenticating the user associated with that token.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2010/05/17/understanding-oauth-an-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Request for Android, Tim Bray, and Google</title>
		<link>http://parand.com/say/index.php/2010/03/19/a-request-for-android-tim-bray-and-google/</link>
		<comments>http://parand.com/say/index.php/2010/03/19/a-request-for-android-tim-bray-and-google/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 06:20:01 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=1023</guid>
		<description><![CDATA[Mr. Bray has joined the empire of no evil, the Android group no less, and has been writing useful things about Android and Nexus One. He also has deep roots in the world of scripting, has been an advocate, and has been fearless in his experiments with languages new fangled and old.
So I&#8217;d like to [...]]]></description>
			<content:encoded><![CDATA[<p>Mr. Bray has <a href="http://www.tbray.org/ongoing/When/201x/2010/03/15/Joining-Google" target="_blank">joined the empire of no evil</a>, the Android group no less, and has been writing <a href="http://www.tbray.org/ongoing/When/201x/2010/03/17/Nexus-One" target="_blank">useful things about Android and Nexus One</a>. He also has deep roots in the world of scripting, has been <a href="http://www.tbray.org/ongoing/When/200x/2006/09/07/JRuby-guys" target="_blank">an advocate</a>, and has been fearless in his <a href="http://www.tbray.org/ongoing/When/200x/2008/05/01/Wide-Finder-2" target="_blank">experiments with languages new fangled and old</a>.</p>
<p>So I&#8217;d like to make a request of Tim, one that I think would make a tremendous impact. Tim: please help bring scripting to Android development.</p>
<p>I know that a lot of people like Java and find the current development environment just dandy. Which is great. But many other reasonable people would prefer to keep their hands clean of Java and feel a greater degree of productivity using higher level languages.</p>
<p>Imagine a scenario where you could write a Python, Ruby, or Javascript script, get it onto the phone using a simple interface (eg. just upload it to a url), and have a native app. Imagine how many more people would be developing apps, and how much more quickly.</p>
<p>I&#8217;m looking for something like this: supported and documented as a standard part of the Android SDK, all reasonable APIs needed to develop native apps exposed as Javascript (and/or Python or Ruby, but Javascript is likely the widest reaching bet). And a reasonable packaging process that is only slight more complex than tar.</p>
<p>There is absolutely no reason this can&#8217;t be achieved. In fact projects like <a href="http://www.appcelerator.com/" target="_blank">Appcelerator</a> and <a href="http://phonegap.com/" target="_blank">PhoneGap</a> have already made tremendous strides in this direction. All it takes is a believer to take the initiative and make it happen.</p>
<p>I feel Tim is that believer. And so I humbly submit, Mr. Bray, that the most important impact you could have on Android is to embed a love and support of scripting languages into the SDK. Pretty please.</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2010/03/19/a-request-for-android-tim-bray-and-google/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To Use curl To Upload a File While Limiting Bandwidth</title>
		<link>http://parand.com/say/index.php/2010/03/07/how-to-use-curl-to-upload-a-file-while-limiting-bandwidth/</link>
		<comments>http://parand.com/say/index.php/2010/03/07/how-to-use-curl-to-upload-a-file-while-limiting-bandwidth/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 06:04:53 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=1018</guid>
		<description><![CDATA[For future reference:
I needed to simulate a slow connection for testing an HTTP file upload, time the results, and see how reliable it was. Turns out it&#8217;s all doable with curl using the right set of incantations. Here they are:

curl -F file=@/tmp/sample-large-image.jpg -F some_parameter=1027504 \
    -u myusername:mypassword -w "\nTIME: %{time_total}\n" \
  [...]]]></description>
			<content:encoded><![CDATA[<p>For future reference:</p>
<p>I needed to simulate a slow connection for testing an HTTP file upload, time the results, and see how reliable it was. Turns out it&#8217;s all doable with curl using the right set of incantations. Here they are:</p>
<pre><code>
curl -F file=@/tmp/sample-large-image.jpg -F some_parameter=1027504 \</code></pre>
<pre><code>    -u myusername:mypassword -w "\nTIME: %{time_total}\n" \</code></pre>
<pre><code>    --limit-rate 10k http://somewebsite.com/api/upload/
</code></pre>
<p>What this is saying is:</p>
<ul>
<li>Upload the file /tmp/sample-large-image.jpg . Note the &#8220;@&#8221; symbol &#8211; that&#8217;s what tells curl this his a file upload.</li>
<li>Set the parameter some_parameter to 1027504</li>
<li>Use HTTP basic auth to login, with user &#8220;myusername&#8221; and password &#8220;mypassword&#8221;</li>
<li>Include the word &#8220;TIME&#8221; followed by how long the upload took in the output</li>
<li>Limit the upload bandwidth to 10k bytes per second</li>
</ul>
<p>curl continues to amaze with its flexibility.</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2010/03/07/how-to-use-curl-to-upload-a-file-while-limiting-bandwidth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django-mptt: Tree Storage in Django: A Brief Overview</title>
		<link>http://parand.com/say/index.php/2010/01/24/django-mptt-tree-storage-in-django-a-brief-overview/</link>
		<comments>http://parand.com/say/index.php/2010/01/24/django-mptt-tree-storage-in-django-a-brief-overview/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 00:01:16 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[mptt]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=976</guid>
		<description><![CDATA[django-mptt is a library for storing tree oriented data using the Django ORM. It allows you to place your model instances into a tree structure and efficiently query for ancestors and children.
Here&#8217;s a brief tutorial on how to use it:
After installing, you&#8217;ll need to modify your model to include a &#8220;parent&#8221; field, and register it [...]]]></description>
			<content:encoded><![CDATA[<p><a target="blank" href="http://code.google.com/p/django-mptt/">django-mptt</a> is a library for storing tree oriented data using the Django ORM. It allows you to place your model instances into a tree structure and efficiently query for ancestors and children.</p>
<p>Here&#8217;s a brief tutorial on how to use it:</p>
<p>After installing, you&#8217;ll need to modify your model to include a &#8220;parent&#8221; field, and register it with mptt:</p>
<pre><code lang="python">class Person(models.Model):
    contact   = models.ForeignKey( Contact, db_index=True )
    role      = models.CharField(max_length=20, blank=True)
    parent    = models.ForeignKey('self', null=True, blank=True, related_name='children')

    def __unicode__(self):
        return "Person: &lt;%s&gt;" % (self.contact.email, )

mptt.register(Person)
</code></pre>
<p>mptt dynamically adds fields to your model, so you&#8217;ll need to syncdb after you&#8217;ve added the parent attribute and the mptt.register call to your model.</p>
<p>The basics are fairly easy to use:</p>
<p>To move a node to the root of the tree, use move_to with a targe of None:</p>
<pre><code lang="python">person1.move_to(None)
person1.save()
</code></pre>
<p>To make a node the child of another, set its parent:</p>
<pre><code lang="python">person2.parent = person1
person2.save()
</code></pre>
<p>To find the children of a node, use the children field:</p>
<pre><code lang="python">&gt;&gt;&gt;person1.children.all()
[&lt;Person: Person: &lt;test2@testing.com&gt;&gt;, &lt;Person: Person: &lt;test3@testing.com&gt;&gt;]
</code></pre>
<p>
Here&#8217;s a little snippet of code to setup a 15 node tree where each node has two child nodes:<br />
<br /><font color="red">[UPDATE] The code in this snippet is not correct &#8211; you have to save each node as you update it, then look it up again. You can&#8217;t modify a node, save it, then use the reference you already have for it. I&#8217;ll update the code when I get a chance</font>
</p>
<pre><code lang="python">contacts = []
people = []
for n in range(15):
    c = mod.Contact(email="test" + str(n) + "@testing.com")
    c.save()
    contacts.append(c)
    p = mod.Person(contact=c)
    p.save()
    people.append(p)

people[0].move_to(None)  # Root
people[0].save()
for n in range(1,15):
    people[n].parent = people[(n-1)/2]
    people[n].save()
</code></pre>
<p>Now let&#8217;s take a look around:</p>
<pre><code lang="python">&gt;&gt;&gt;people[7].parent
&lt;Person: Person: &lt;test3@testing.com&gt;&gt;

&gt;&gt;&gt;people[3].children.all()
[&lt;Person: Person: &lt;test7@testing.com&gt;&gt;, &lt;Person: Person: &lt;test8@testing.com&gt;&gt;]
</code></pre>
<p>Now let&#8217;s move things around a bit; we&#8217;ll take person3, which is 2 levels down from the root, and make it a direct child of the root:</p>
<pre><code lang="python">&gt;&gt;&gt;people[3].parent = people[0]
&gt;&gt;&gt;people[3].save()

&gt;&gt;&gt;people[0].children.all()
[&lt;Person: Person: &lt;test1@testing.com&gt;&gt; &lt;Person: Person: &lt;test2@testing.com&gt;&gt;, &lt;Person: Person: &lt;test3@testing.com&gt;&gt;]
</code></pre>
<p>And we can look at the ancestors of a given node:</p>
<pre><code lang="python">people[14].get_ancestors()</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2010/01/24/django-mptt-tree-storage-in-django-a-brief-overview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move Files Older Than X Days To Another Directory</title>
		<link>http://parand.com/say/index.php/2010/01/08/move-files-older-than-x-days-to-another-directory/</link>
		<comments>http://parand.com/say/index.php/2010/01/08/move-files-older-than-x-days-to-another-directory/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 22:34:32 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=965</guid>
		<description><![CDATA[Here&#8217;s a little script for finding files modified more than 7 days ago and moving them to another directory:

find . -type f -mtime +7 -print > /tmp/old_files.txt
cat /tmp/old_files.txt &#124; while read line; do mv "$line" ../old_files ; done

]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little script for finding files modified more than 7 days ago and moving them to another directory:</p>
<pre><code lang="bash">
find . -type f -mtime +7 -print > /tmp/old_files.txt
cat /tmp/old_files.txt | while read line; do mv "$line" ../old_files ; done
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2010/01/08/move-files-older-than-x-days-to-another-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Eclipse + PyDev : I Recommend It</title>
		<link>http://parand.com/say/index.php/2009/10/11/eclipse-pydev-i-recommend-it/</link>
		<comments>http://parand.com/say/index.php/2009/10/11/eclipse-pydev-i-recommend-it/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 18:46:42 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[pydev]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=882</guid>
		<description><![CDATA[I used to be a vi guy who finally made the move to graphical editors. I looked for the simplest, lightest possible solutions, using ConTEXT for quite a while.
Some years ago I was forced into using Eclipse for reasons I can&#8217;t quite recall; probably Java development. I didn&#8217;t like it &#8211; the forced Project concept, [...]]]></description>
			<content:encoded><![CDATA[<p>I used to be a vi guy who finally made the move to graphical editors. I looked for the simplest, lightest possible solutions, using <a href="http://www.contexteditor.org/" target="_blank">ConTEXT</a> for quite a while.</p>
<p>Some years ago I was forced into using Eclipse for reasons I can&#8217;t quite recall; probably Java development. I didn&#8217;t like it &#8211; the forced Project concept, the bloat, the general slowness.</p>
<p>Eventually I got comfortable with it, got <a href="http://pydev.org/" target="_blank">PyDev</a> installed, and made it my primary development environment. These days most of my development lives in Eclipse.</p>
<p><img class="alignleft" title="PyDev Logo" src="http://pydev.org/images/pydev_banner2.gif" alt="" width="272" height="112" /></p>
<p>With the 1.5 release PyDev included quite a few previously pay-only features in the free / open source version. Since then I&#8217;ve found I&#8217;ve become even more productive in the environment, and now actually enjoy it.</p>
<p>In particular, the code analysis is very useful. I love the fact that it points out unused imports and variables as well as syntax errors. Going through old code I was surprised at how many spurious imports I had, as well as a few actual errors in code that had been in production for several years in rarely exercised branches.</p>
<p>If you&#8217;re doing python development I recommend you take a look at Eclipse+PyDev. I was surprised at the level of increased productivity it brought me.</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2009/10/11/eclipse-pydev-i-recommend-it/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tim Bray on Design Patterns, Threads, and COM</title>
		<link>http://parand.com/say/index.php/2009/09/26/tim-bray-on-design-patterns-threads-and-com/</link>
		<comments>http://parand.com/say/index.php/2009/09/26/tim-bray-on-design-patterns-threads-and-com/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 06:55:25 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=861</guid>
		<description><![CDATA[From Tim Bray:
My experience suggests that there are few surer ways to doom a big software project than via the Design Patterns religion. Also, that multi-threading is part of the problem, not part of the solution; that essentially no application programmer understands threads well enough to avoid deadlocks and races and horrible non-repeatable bugs. And that [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://www.tbray.org/ongoing/When/200x/2009/09/25/On-Duct-Tape" target="_blank">Tim Bray</a>:</p>
<blockquote><p>My experience suggests that there are few surer ways to doom a big software project than via the Design Patterns religion. Also, that multi-threading is part of the problem, not part of the solution; that essentially <em>no</em> application programmer understands threads well enough to avoid deadlocks and races and horrible non-repeatable bugs. And that COM was one of the most colossal piles of crap my profession ever foisted on itself.</p></blockquote>
<p>You may have read my own two cents on <a href="http://parand.com/say/index.php/2005/07/18/i-hate-patterns/" target="_blank">design patterns</a> (hate them) and <a href="http://parand.com/say/index.php/2008/06/03/the-hamburger-theory-of-threads-and-processes/" target="_blank">threads</a> (not a huge fan).</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2009/09/26/tim-bray-on-design-patterns-threads-and-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding and Fixing Slow MySQL Queries</title>
		<link>http://parand.com/say/index.php/2009/09/01/finding-and-fixing-slow-mysql-queries/</link>
		<comments>http://parand.com/say/index.php/2009/09/01/finding-and-fixing-slow-mysql-queries/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 00:08:52 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=819</guid>
		<description><![CDATA[Notes to self, for future reference.
Edit /etc/mysql/my.cnf . Uncomment the following lines:
log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

This enables logging of slow queries and queries not making use of indexes.
Now tail -f the mysql-slow.log file. You&#8217;ll see the slow and non-index-using queries.
Grab a query that you&#8217;d like to examine. Open a mysql shell and run [...]]]></description>
			<content:encoded><![CDATA[<p>Notes to self, for future reference.</p>
<p>Edit /etc/mysql/my.cnf . Uncomment the following lines:</p>
<pre><code>log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes
</code></pre>
<p>This enables logging of slow queries and queries not making use of indexes.</p>
<p>Now tail -f the mysql-slow.log file. You&#8217;ll see the slow and non-index-using queries.</p>
<p>Grab a query that you&#8217;d like to examine. Open a mysql shell and run &#8220;explain&#8221; on it:</p>
<pre><code>explain your_query_here;</code></pre>
<p>You&#8217;ll see output that looks like:</p>
<pre><code>+----+-------------+---------------------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table               | type | possible_keys | key  | key_len | ref  | rows | Extra       |
+----+-------------+---------------------+------+---------------+------+---------+------+------+-------------+
|  1 | SIMPLE      | some_table          | ALL  | NULL          | NULL | NULL    | NULL |  166 | Using where |
+----+-------------+---------------------+------+---------------+------+---------+------+------+-------------+</code></pre>
<p>Look at the <em>rows</em> and <em>key</em> fields in particular. rows shows how many rows were examined for query &#8211; you don&#8217;t want to see a high number. If you&#8217;re not using an index you may be doing a full-table-scan, examining every single row to find the value you&#8217;re looking for.</p>
<p><em>key</em> shows which index, if any, was used. If you see NULL then no index was used.</p>
<p>To make the query go faster you may need an index. Look at the query and see what your&#8217;e selecting based on, and then create the corresponding index. For example, if we&#8217;re doing the selection based on the &#8220;myfield&#8221; field, you could create the index:</p>
<pre><code lang="sql">CREATE INDEX myapp_mytable_myfield_idx on myapp_mytable(myfield);
</code></pre>
<p>Once you create the index you should see that query no longer appearing in the slow query log. </p>
<p>Rinse and repeat for other queries.</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2009/09/01/finding-and-fixing-slow-mysql-queries/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XML The Evil Adult</title>
		<link>http://parand.com/say/index.php/2009/06/21/xml-the-evil-adult/</link>
		<comments>http://parand.com/say/index.php/2009/06/21/xml-the-evil-adult/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 06:51:16 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=810</guid>
		<description><![CDATA[Entertaining if long winded rant from Erik Naggum:
When the markup overhead exceeds 200%, when attributes values and element
contents compete for the information, when the distance between 99%
of the &#8220;tags&#8221; is /zero/, when the character set is Unicode, and when
validation takes more time than processing, not to mention the sorry
fact that information longevity is more /threatened/ [...]]]></description>
			<content:encoded><![CDATA[<p>Entertaining if long winded <a href="http://harmful.cat-v.org/software/xml/s-exp_vs_XML" target="_blank">rant from Erik Naggum</a>:</p>
<blockquote><p>When the markup overhead exceeds 200%, when attributes values and element<br />
contents compete for the information, when the distance between 99%<br />
of the &#8220;tags&#8221; is /zero/, when the character set is Unicode, and when<br />
validation takes more time than processing, not to mention the sorry<br />
fact that information longevity is more /threatened/ by XML than by<br />
any other data representation in the history of computing, then SGML<br />
has gone from good kid, via bad teenager, to malfunctioning, evil<br />
adult as XML.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2009/06/21/xml-the-evil-adult/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Easiest Way To Create UML Sequence Diagrams</title>
		<link>http://parand.com/say/index.php/2009/05/22/easiest-way-to-create-uml-sequence-diagrams/</link>
		<comments>http://parand.com/say/index.php/2009/05/22/easiest-way-to-create-uml-sequence-diagrams/#comments</comments>
		<pubDate>Fri, 22 May 2009 23:33:19 +0000</pubDate>
		<dc:creator>Parand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[uml]]></category>

		<guid isPermaLink="false">http://parand.com/say/?p=803</guid>
		<description><![CDATA[In need of creating various UML Sequence Diagrams and in no mood to deal with Visio or its other graphical editor ilk, I did some research and ended up at a really nice solution.
What I wanted was to be able to specify my sequence using a simple text description and have a tool turn that [...]]]></description>
			<content:encoded><![CDATA[<p>In need of creating various UML Sequence Diagrams and in no mood to deal with Visio or its other graphical editor ilk, I did some research and ended up at a really nice solution.</p>
<p>What I wanted was to be able to specify my sequence using a simple text description and have a tool turn that into a sequence diagram. What I found was a tool called <a href="http://www.zanthan.com/itymbi/archives/cat_sequence.html" target="_blank">Sequence by Alex Moffat</a> that does exactly that. The syntax takes a minute to get used to, but once you see what&#8217;s going on it&#8217;s very easy to use. The generated images are reasonably attractive and easily exportable to png, gif, etc.</p>
<p>
Here&#8217;s a sample of the syntax:</p>
<pre><code>
objectOne.methodOne {
  objectTwo.methodTwo -&gt; value {
    objectThree.methodThree -&gt; anotherValue;
    objectFour.methodFour-&gt;finalValue;
  }
}
</code></pre>
</p>
<p>
And here&#8217;s the resulting diagram:</p>
<p><img src='/say/misc/sequence.gif' alt='UML Sequence Diagram' class='aligncenter' /></p>
<p>
Once you download the jar and run it hit the &#8220;Help&#8221; option and look at the examples. They&#8217;re self explanatory and fairly complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://parand.com/say/index.php/2009/05/22/easiest-way-to-create-uml-sequence-diagrams/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
