<?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>Toes to the Edge</title>
	<atom:link href="http://powertwenty.com/blog/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://powertwenty.com/blog</link>
	<description>Mostly Rowing and Python</description>
	<lastBuildDate>Sun, 24 Mar 2013 03:59:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>RESTful API Design</title>
		<link>http://powertwenty.com/blog/index.php/programming/restful_api_design</link>
		<comments>http://powertwenty.com/blog/index.php/programming/restful_api_design#comments</comments>
		<pubDate>Sun, 24 Mar 2013 03:59:04 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=281</guid>
		<description><![CDATA[I just stumbled on Geert Jansen&#8217;s book &#8216;Thoughts on RESTful API Design.&#8217; Here he has documented things he learned while designing the Red Hat Enterprise Virtualization API. The nice thing is that the source to the book is on github &#8230; <a href="http://powertwenty.com/blog/index.php/programming/restful_api_design">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I just stumbled on Geert Jansen&#8217;s book &#8216;Thoughts on RESTful API Design.&#8217;   Here he has documented things he learned while designing the Red Hat Enterprise Virtualization API.   </p>
<p>The nice thing is that the source to the book is on github and you can read it <a href="https://restful-api-design.readthedocs.org/en/latest/" title="RESTful API Design on readthedocs.org""> on ReadTheDocs.org.</a></p>
<p>It outlines some good design decisions when creating an API and is well worth taking a look.  It&#8217;s not too long of a read.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/programming/restful_api_design/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repeating Sections in a Django Template</title>
		<link>http://powertwenty.com/blog/index.php/python/repeating_sections_in_a_django_template</link>
		<comments>http://powertwenty.com/blog/index.php/python/repeating_sections_in_a_django_template#comments</comments>
		<pubDate>Sun, 13 Jan 2013 03:04:45 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=261</guid>
		<description><![CDATA[I have a need to have multiple sections of name/value pairs with a header on some pages. Something like: &#60;div class=&#34;row&#34;&#62; &#160;&#160;&#160;&#160;&#60;div class=&#34;span6&#34;&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;div class=&#34;row&#34;&#62;&#60;div class=&#34;span3&#34;&#62;&#60;h2&#62;History:&#60;/h2&#62;&#60;/div&#62;&#60;/div&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;div class=&#34;row&#34;&#62;&#60;div class=&#34;span2&#34;&#62;Date added to fleet:&#60;/div&#62;&#60;div class=&#34;span2&#34;&#62;{{plane.dateAddedToFleet}}&#60;/div&#62;&#60;/div&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;div class=&#34;row&#34;&#62;&#60;div class=&#34;span2&#34;&#62;Total Flight Time:&#60;/div&#62;&#60;div class=&#34;span2&#34;&#62;{{plane.totalFlightTime&#124;asTime}}&#60;/div&#62;&#60;/div&#62; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#60;div &#8230; <a href="http://powertwenty.com/blog/index.php/python/repeating_sections_in_a_django_template">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I have a need to have multiple sections of name/value pairs with a header on some pages.  Something like:</p>
<p><pre><code>&lt;div class=&quot;row&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;span6&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span3&quot;&gt;&lt;h2&gt;History:&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span2&quot;&gt;Date added to fleet:&lt;/div&gt;&lt;div class=&quot;span2&quot;&gt;{{plane.dateAddedToFleet}}&lt;/div&gt;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span2&quot;&gt;Total Flight Time:&lt;/div&gt;&lt;div class=&quot;span2&quot;&gt;{{plane.totalFlightTime|asTime}}&lt;/div&gt;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span2&quot;&gt;Total Number of Flights:&lt;/div&gt;&lt;div class=&quot;span2&quot;&gt;{{plane.totalNumberOfFlights}}&lt;/div&gt;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&lt;/div&gt;</code></pre></p>
<p>So that&#8217;s wrong.  I first tried creating a custom tag to render the entire section that would be used like this within the django template:</p>
<p><pre><code>
{% specgroup &quot;History&quot; &quot;Date added to fleet&quot; plane.dateAddedToFleet &quot;Total Flight Time:&quot; plane.totalFlightTime|asTime &quot;Total Number of Flights&quot; plane.totalNumberOfFlights %}
</code></pre></p>
<p>The custom tag code for the above is:<br />
<pre><code>
# tags for groups of fields (such as on plane detail page)
@register.simple_tag
def specgroup(*args):
&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot;group header label1 value1 label2 value2 ....&quot;&quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;header= args[0]
&nbsp;&nbsp;&nbsp;&nbsp;logging.getLogger().error(header)
&nbsp;&nbsp;&nbsp;&nbsp;html = &quot;&quot;&quot;
&lt;div class=&quot;row&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;span6&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span3&quot;&gt;&lt;h2&gt;%s:&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;
&quot;&quot;&quot;%header
&nbsp;&nbsp;&nbsp;&nbsp;# parse remainder of args as&nbsp;&nbsp;label1 value1 label2 value2 etc....
&nbsp;&nbsp;&nbsp;&nbsp;data = args[1:]
&nbsp;&nbsp;&nbsp;&nbsp;diter = iter(data)
&nbsp;&nbsp;&nbsp;&nbsp;for d in diter:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data = {}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data[&quot;label&quot;] = d
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data[&quot;value&quot;] = diter.next()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html += &quot;&quot;&quot;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span2&quot;&gt;%(label)s:&lt;/div&gt;&lt;div class=&quot;span2&quot;&gt;%(value)s&lt;/div&gt;&lt;/div&gt;&quot;&quot;&quot;%data
&nbsp;&nbsp;&nbsp;&nbsp;html += &quot;&quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&lt;/div&gt;&quot;&quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;return html 
</code></pre></p>
<p>You cannot split the arguments across multiple lines to clean up the mess that is the call to the custom tag.  So back to the drawing board. </p>
<p>I compromised with this:<br />
<pre><code>
{% specheader &quot;History&quot; %}
{% specdata &quot;Date added to fleet&quot; plane.dateAddedToFleet %}
{% specdata &quot;Total Flight Time&quot; plane.totalFlightTime|asTime %}
{% specdata &quot;Total Number of Flights&quot; plane.totalNumberOfFlights %}
{% specend %} 
</code></pre><br />
It&#8217;s my favorite compromise between brevity and maintainability.  </p>
<p>The custom tags to implement this are:<br />
<pre><code>
@register.simple_tag
def specheader(header):
&nbsp;&nbsp;&nbsp;&nbsp;return &quot;&quot;&quot;
&lt;div class=&quot;row&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;span6&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span3&quot;&gt;&lt;h2&gt;%s:&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;&quot;&quot;&quot;%header

@register.simple_tag
def specdata(label,value):
&nbsp;&nbsp;&nbsp;&nbsp;return &#039;&lt;div class=&quot;row&quot;&gt;&lt;div class=&quot;span2&quot;&gt;%s:&lt;/div&gt;&lt;div class=&quot;span2&quot;&gt;%s&lt;/div&gt;&lt;/div&gt;&#039;%(label, value)

@register.simple_tag
def specend():
&nbsp;&nbsp;&nbsp;&nbsp;return &quot;&lt;/div&gt;&lt;/div&gt;&quot;
</code></pre></p>
<p>Which is also cleaner than the all-in-one tag.</p>
<p>It&#8217;s not for me, but <a href="https://gist.github.com/skyl" title="Skylar Savland on github" target="_blank">Skylar Savland on github</a> created a <a href="https://gist.github.com/1715202" title="Django Template macros with args and kwargs gist" target="_blank">Django Template macros with args and kwargs gist</a> that is another solution to this problem.</p>
<p>I&#8217;d love to hear ideas that solve this problem in a better way.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/python/repeating_sections_in_a_django_template/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Rate limiting with django-ratelimit</title>
		<link>http://powertwenty.com/blog/index.php/python/rate_limiting_with_django-ratelimit</link>
		<comments>http://powertwenty.com/blog/index.php/python/rate_limiting_with_django-ratelimit#comments</comments>
		<pubDate>Sat, 29 Dec 2012 06:12:16 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=254</guid>
		<description><![CDATA[I was playing around with James Socol&#8217;s django-ratelimit tonight. It provides a decorator to rate-limit view functions. Very nice! I wanted to use it for login blocking, and some minor changes helped this out. My forked version of django-ratelimit is &#8230; <a href="http://powertwenty.com/blog/index.php/python/rate_limiting_with_django-ratelimit">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I was playing around with James Socol&#8217;s <a href="https://github.com/jsocol/django-ratelimit" title="django-ratelimit">django-ratelimit</a> tonight.  It provides a decorator to rate-limit view functions.  Very nice!   I wanted to use it for login blocking, and some minor changes helped this out.  My <a href="https://github.com/kdahlhaus/django-ratelimit" title="forked version of django-ratelimit">forked version of django-ratelimit</a> is a available on <a href="https://github.com/kdahlhaus/django-ratelimit" title="Github.">GitHub</a>  It adds a message when a call is blocked and the ability to clear the count for given user.</p>
<p>Adding it to <a href="http://www.django-userena.org/" title="django-userena">django-userena</a> sign-in was as simple as:</p>
<p>in userena/views.py:<br />
<pre><code>
from ratelimit.decorators import ratelimit, clear
@ratelimit(field=&#039;identification&#039;,rate=&quot;5/m&quot;, method=&quot;POST&quot;, block=True, error_message=&quot;You have too many invalid login attempts.&nbsp;&nbsp;Please try again later&quot;)
@secure_required
def signin(request, auth_form=AuthenticationForm,.....
.
.
.
&nbsp;&nbsp;&nbsp;&nbsp; #after successful login
&nbsp;&nbsp;&nbsp;&nbsp; clear(request, field=&#039;identification&#039;) ### clear rate limiting 
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/python/rate_limiting_with_django-ratelimit/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Tag to Render Avatar in Django Userena</title>
		<link>http://powertwenty.com/blog/index.php/python/custom_tag_to_render_avatar_in_django_userena</link>
		<comments>http://powertwenty.com/blog/index.php/python/custom_tag_to_render_avatar_in_django_userena#comments</comments>
		<pubDate>Thu, 29 Nov 2012 01:28:01 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=247</guid>
		<description><![CDATA[Here is a simple custom tag to render a users avatar (&#8216;mugshot&#8217;) when using Django Userena. It optionally takes width and or height in pixels. Place the following code in /templatetags/my_app_tags.py: your_app/ &#160;&#160;&#160;&#160;models.py &#160;&#160;&#160;&#160;templatetags/ &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;__init__.py &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;my_app_tags.py from django import template &#8230; <a href="http://powertwenty.com/blog/index.php/python/custom_tag_to_render_avatar_in_django_userena">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Here is a simple custom tag to render a users avatar (&#8216;mugshot&#8217;) when using <a href="http://www.django-userena.org/">Django Userena</a>.  It optionally takes width and or height in pixels.</p>
<p>Place the following code in <app>/templatetags/my_app_tags.py:<br />
<pre><pre>
your_app/
&nbsp;&nbsp;&nbsp;&nbsp;models.py
&nbsp;&nbsp;&nbsp;&nbsp;templatetags/
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__init__.py
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my_app_tags.py
</pre></pre></p>
<p><pre><code>
from django import template
register = template.Library()

from django import template
register = template.Library()

@register.simple_tag(takes_context=True)
def avatar(context, height=None, width=None):
&nbsp;&nbsp;&nbsp;&nbsp;&quot;&quot;&quot; returns html for avatar, optional height/width supplied &quot;&quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;user = context[&#039;user&#039;]
&nbsp;&nbsp;&nbsp;&nbsp;widthAttr = &#039;width=&quot;%s&quot;&#039;%width if width is not None else &quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;heightAttr = &#039;height=&quot;%s&quot;&#039;%height if height is not None else &quot;&quot;
&nbsp;&nbsp;&nbsp;&nbsp;return &quot;&quot;&quot;&lt;img %s %s class=&quot;avatar&quot; src=&quot;%s&quot;&quot; alt=&quot;avatar image&quot;&nbsp;&nbsp;/&gt;&quot;&quot;&quot;%(heightAttr, widthAttr, user.get_profile().get_mugshot_url())
</code></pre></p>
<p>The following template shows how this could be used<br />
<pre><code>
{% load myapp_tags %}

{% avatar %}
{% avatar height=5 %}
{% avatar width=150 %}
{% avatar width=100 height=100 %} 
 </code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/python/custom_tag_to_render_avatar_in_django_userena/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mothballed Software</title>
		<link>http://powertwenty.com/blog/index.php/rowing/mothballed_software</link>
		<comments>http://powertwenty.com/blog/index.php/rowing/mothballed_software#comments</comments>
		<pubDate>Sat, 27 Oct 2012 21:30:51 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[rowing]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=242</guid>
		<description><![CDATA[We all probably have mothballed software &#8211; projects that didn&#8217;t go very far. This was one of mine, a rowing game!]]></description>
				<content:encoded><![CDATA[<p>We all probably have mothballed software &#8211; projects that didn&#8217;t go very far.   This was one of mine, a rowing game!</p>
<p><a href="http://powertwenty.com/blog/index.php/rowing/mothballed_software/attachment/20081013_onwater" rel="attachment wp-att-243"><img src="http://powertwenty.com/blog/wp-content/uploads/2012/10/20081013_onwater.png"  alt="" title="20081013_onwater" width="800" height="600" class="aligncenter size-full wp-image-243" / rel="lightbox"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/rowing/mothballed_software/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Image Field Overwrite with ImageKit</title>
		<link>http://powertwenty.com/blog/index.php/python/django_image_field_overwrite_with_imagekit</link>
		<comments>http://powertwenty.com/blog/index.php/python/django_image_field_overwrite_with_imagekit#comments</comments>
		<pubDate>Sat, 29 Sep 2012 03:32:03 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=235</guid>
		<description><![CDATA[I&#8217;m using django-imagekit on a new site. I was having a problem that when a user uploaded a new image for the object, the system would not overwrite the existing image file, but instead would create a new file with &#8230; <a href="http://powertwenty.com/blog/index.php/python/django_image_field_overwrite_with_imagekit">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m using <a href="https://github.com/jdriscoll/django-imagekit" title="django-imagekit">django-imagekit</a> on a new site.  I was having a problem that when a user uploaded a new image for the object, the system would not overwrite the existing image file, but instead would create a new file with a sequence number on the end.  This was not the behavior I was looking for.   <a href="http://stackoverflow.com/questions/9522759/imagefield-overwrite-image-file" title="Lockjaw's answer" target="_blank">Lockjaw&#8217;s answer on StackExchange</a> handled the not-overwriting the existing file problem.  ImageKit was still caching the previous image for any specfields.  The solution is to call &#8216;<specfield>.clear()&#8217; after saving the new image to purge the ImageKit cache for that specfield/image.</p>
<p>So, the total solution is:</p>
<p><pre><code>
#Lockjaw&#039;s code on StackExchange
class OverwriteStorage(FileSystemStorage):&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;def get_available_name(self, name):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if self.exists(name):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;os.remove(os.path.join(settings.MEDIA_ROOT, name))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return name

def issue_plane_image_path(plane, filename):
&nbsp;&nbsp;&nbsp;&nbsp;&quot;return the canonical file name for an image on this plane instance&quot;
&nbsp;&nbsp;&nbsp;&nbsp;extension = os.path.splitext(filename)[1]
&nbsp;&nbsp;&nbsp;&nbsp;return os.path.join(&#039;photos/planes&#039;, plane.slug+extension) 

class Plane(models.Model):
&nbsp;&nbsp;&nbsp;&nbsp;image = models.ImageField(upload_to=issue_plane_image_path, storage=OverwriteFileStorage(), null=True, blank=True)
&nbsp;&nbsp;&nbsp;&nbsp;gallery = ImageSpecField(...)
&nbsp;&nbsp;&nbsp;&nbsp;thumbnail = ImageSpecField(...) 

&nbsp;&nbsp;&nbsp;&nbsp;def clearImageCache(self):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;invalidate all ImageKit spec caches&quot;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.gallery.clear()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.thumbnail.clear()
</code></pre></p>
<p>and in the edit view:</p>
<p><pre><code>
.
.
if form.is_valid():
&nbsp;&nbsp; form.save()
&nbsp;&nbsp; plane.clearImageCache()
</code></pre></p>
<p>And now each instance has very few images (usually only one, but if a person uploads different filetypes such as a PNG then a JPG, they will both exist.  I am OK with that.)</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/python/django_image_field_overwrite_with_imagekit/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TiddlyWiki with Firefox 15</title>
		<link>http://powertwenty.com/blog/index.php/uncategorized/tiddlywiki_with_firefox_15</link>
		<comments>http://powertwenty.com/blog/index.php/uncategorized/tiddlywiki_with_firefox_15#comments</comments>
		<pubDate>Thu, 13 Sep 2012 04:33:28 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[TiddlyWiki]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=231</guid>
		<description><![CDATA[TiddlyWiki saves (and exports) stopped working with the Firefox upgrade to 15. After trying a few changes to prefs.js, I found the post Will Firefox 16 support TiddlyWiki on the Mozilla site. It had a link to a Firefox extension &#8230; <a href="http://powertwenty.com/blog/index.php/uncategorized/tiddlywiki_with_firefox_15">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>TiddlyWiki saves (and exports) stopped working with the Firefox upgrade to 15.  After trying a few changes to prefs.js, I found the post <a href="http://support.mozilla.org/en-US/questions/936538" title="Will Firefox 16 support TiddlyWiki?">Will Firefox 16 support TiddlyWiki</a> on the Mozilla site.   It had a link to a Firefox extension called <a href="https://github.com/Jermolene/TiddlyWiki5" title="Tiddly Wiki 5">Tiddly Wiki 5</a>, which fixed the problems I had with saving and the export plugin.</p>
<p>https://github.com/Jermolene/TiddlyWiki5</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/uncategorized/tiddlywiki_with_firefox_15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Sort in Google Apps Spreadsheet</title>
		<link>http://powertwenty.com/blog/index.php/uncategorized/custom_sort_in_google_apps_spreadsheet</link>
		<comments>http://powertwenty.com/blog/index.php/uncategorized/custom_sort_in_google_apps_spreadsheet#comments</comments>
		<pubDate>Fri, 31 Aug 2012 15:38:33 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://powertwenty.com/blog/?p=228</guid>
		<description><![CDATA[I use a Google Docs spreadsheet to track my personal projects. Only, I&#8217;m not aware of a way to save sort options in a Google Docs spreadsheet. The solution is to create a script. The following script will add a &#8230; <a href="http://powertwenty.com/blog/index.php/uncategorized/custom_sort_in_google_apps_spreadsheet">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I use a Google Docs spreadsheet to track my personal projects.  Only, I&#8217;m not aware of a way to save sort options in a Google Docs spreadsheet.  The solution is to create a script.  The following script will add a menu option that remembers sort parameters and makes use of a header row on the data.  Detailed instructions on adding the script are here:  http://productforums.google.com/forum/#!topic/docs/Kl9WEj6Kha0  and I just added skipping of the header row.</p>
<p>/**<br />
 * sort spreadsheet assuming first row is a header row<br />
 */<br />
function customSort() {<br />
  var sheet = SpreadsheetApp.getActiveSheet();<br />
  var allData = sheet.getDataRange();<br />
  var range = sheet.getRange(2,1, allData.getNumRows()-1, allData.getNumColumns());<br />
  range.sort( [1,2,4]);  // see https://developers.google.com/apps-script/class_range#sort<br />
};</p>
<p>/**<br />
 * Adds a custom menu to the active spreadsheet, containing a single menu item<br />
 * for invoking the readRows() function specified above.<br />
 * The onOpen() function, when defined, is automatically invoked whenever the<br />
 * spreadsheet is opened.<br />
 * For more information on using the Spreadsheet API, see<br />
 * https://developers.google.com/apps-script/service_spreadsheet<br />
 */<br />
function onOpen() {<br />
  var sheet = SpreadsheetApp.getActiveSpreadsheet();<br />
  var entries = [{<br />
    name : "Custom Sort",<br />
    functionName : "customSort"<br />
  }];<br />
  sheet.addMenu(&#8220;Custom Scripts&#8221;, entries);<br />
};</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/uncategorized/custom_sort_in_google_apps_spreadsheet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleJson Error with django under google app engine</title>
		<link>http://powertwenty.com/blog/index.php/python/simplejson_error_with_django_under_google_app_engine</link>
		<comments>http://powertwenty.com/blog/index.php/python/simplejson_error_with_django_under_google_app_engine#comments</comments>
		<pubDate>Fri, 28 Jan 2011 00:33:08 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://kpd.webfactional.com/blog/?p=217</guid>
		<description><![CDATA[Since moving over to 64 bit windows 7, I&#8217;ve had this error when starting up: &#34;... py_zipimport.py:108] zipimporter(&#039;C:\\python25\\lib\\site- packages\\simplejson-2.0.9-py2.5-win.egg&#039;, &#039;simplejson\\&#039;) ... dev_appserver_main.py ... SetGlobals() ... ... File &#34;C:\Program Files\Google\google_appengine\google\appengine\dist\py_zipimport.py&#34;, line 268, in _getitem__ info = _zipfile_cache[self._archive].getinfo(filename) File &#34;C:\Python25\lib\zipfile.py&#34;, line 462, &#8230; <a href="http://powertwenty.com/blog/index.php/python/simplejson_error_with_django_under_google_app_engine">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Since moving over to 64 bit windows 7, I&#8217;ve had this error when starting up:</p>
<p><pre><pre>
&quot;... py_zipimport.py:108] zipimporter(&#039;C:\\python25\\lib\\site-
packages\\simplejson-2.0.9-py2.5-win.egg&#039;, &#039;simplejson\\&#039;) ...
dev_appserver_main.py ... SetGlobals() ...
...
File &quot;C:\Program 
Files\Google\google_appengine\google\appengine\dist\py_zipimport.py&quot;, line 
268, in _getitem__
info = _zipfile_cache[self._archive].getinfo(filename)
File &quot;C:\Python25\lib\zipfile.py&quot;, line 462, in getinfo
return self.NameToInfo[name]
KeyError: &#039;simplejson\\_speedups.pyd&#039;

</pre></pre></p>
<p>The <a href="http://code.google.com/p/googleappengine/issues/detail?id=2086#c5">solution is from peplafi on the google app engine defect list</a>:</p>
<p>It looks that it gives the error when you have installed simplejson in your python<br />
dist and dev_appserver is mixing its own simplejson (which is located in<br />
django\utils) and the python&#8217;s sipmlejson. The solution is to go to </p>
<p><pre><pre>
The solution is to go to 

&quot;c:\Program Files\Google\google_appengine\google\appengine\ext\key_range\__init__.py&quot; 
, line 26

and change:

&nbsp;&nbsp; import simplejson

 to:

&nbsp;&nbsp; from django.utils import simplejson

</pre></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/python/simplejson_error_with_django_under_google_app_engine/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rynsc on Windows 7 Under Cygwin</title>
		<link>http://powertwenty.com/blog/index.php/programming/rynsc_on_windows_7_under_cygwin</link>
		<comments>http://powertwenty.com/blog/index.php/programming/rynsc_on_windows_7_under_cygwin#comments</comments>
		<pubDate>Tue, 02 Nov 2010 20:48:22 +0000</pubDate>
		<dc:creator>kpd</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://kpd.webfactional.com/blog/?p=211</guid>
		<description><![CDATA[Getting rid of permission denied errors in rsync under Windows 7 <a href="http://powertwenty.com/blog/index.php/programming/rynsc_on_windows_7_under_cygwin">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I *finally* have rysnc working under Windows 7 without issuing <i>permission-denied</i> messages.  Here&#8217;s the story:</p>
<p>The goal is to run a bash script that backs up a set of directories to a an external hard-drive.  This script will run as me from a bash shell. </p>
<p>The destination hard drive is mounted as E: in this example. The bash script contains a series of rysnc commands similar to:</p>
<p><code>rsync -rltgovR --delete-after /cygdrive/h/music /cygdrive/e </code></p>
<p>This will mirror h:\music on E:\h\music  with recursion.</p>
<p>The catch was getting permissions correct on the external drive.  This took two commands run from a cmd.exe shell (bash shell should work if you escape the parameters correctly, but don&#8217;t bother for two commands).</p>
<p>E: is rsync destination for mirrors, &#8216;Kevin&#8217; is the windows user name the script will be running under.</p>
<p><pre><code>
E:
cd \
takeown /f * /r /d y
icacls * /grant Kevin:(F) /T</code></pre></p>
<p>This did it for me.  Hope this helps.</p>
<p>Some other posts mention adding<br />
<code>none /cygdrive cygdrive binary,posix=0,user,noacl 0 0 </code><br />
to /etc/fstab.   I tried this both ways and it did not seem to matter.  For now it is commented out.</p>
]]></content:encoded>
			<wfw:commentRss>http://powertwenty.com/blog/index.php/programming/rynsc_on_windows_7_under_cygwin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
