<?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>Factory-H</title>
	<atom:link href="http://www.factory-h.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.factory-h.com/blog</link>
	<description>brought to you by Darrel Herbst</description>
	<lastBuildDate>Fri, 24 Feb 2012 15:50:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>query-replace-regexp</title>
		<link>http://www.factory-h.com/blog/?p=232</link>
		<comments>http://www.factory-h.com/blog/?p=232#comments</comments>
		<pubDate>Fri, 24 Feb 2012 15:50:55 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=232</guid>
		<description><![CDATA[All these years, I never knew about M-x re-builder It allows emacs to highlight the matches in your regular expression as you type them. Very well done. http://www.emacswiki.org/emacs/ReBuilder]]></description>
			<content:encoded><![CDATA[<p>All these years, I never knew about M-x re-builder</p>
<p>It allows emacs to highlight the matches in your regular expression as you type them.  Very well done.</p>
<p>http://www.emacswiki.org/emacs/ReBuilder</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=232</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django: using multi-db with .raw</title>
		<link>http://www.factory-h.com/blog/?p=228</link>
		<comments>http://www.factory-h.com/blog/?p=228#comments</comments>
		<pubDate>Thu, 23 Feb 2012 20:26:22 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=228</guid>
		<description><![CDATA[Got the error QuerySet does not have raw when trying to do MyModel.objects.using(&#8216;slave&#8217;).raw(&#8216;select &#8230;&#8217;) The problem is you have to set the DB onto the db model like this: MyModel.objects.db_manager(&#8216;slave&#8217;).raw(&#8216;&#8230;&#8217;)]]></description>
			<content:encoded><![CDATA[<p>Got the error QuerySet does not have raw when trying to do</p>
<p>MyModel.objects.using(&#8216;slave&#8217;).raw(&#8216;select &#8230;&#8217;)</p>
<p>The problem is you have to set the DB onto the db model like this:</p>
<p>MyModel.objects.db_manager(&#8216;slave&#8217;).raw(&#8216;&#8230;&#8217;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=228</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project planning with google docs</title>
		<link>http://www.factory-h.com/blog/?p=226</link>
		<comments>http://www.factory-h.com/blog/?p=226#comments</comments>
		<pubDate>Tue, 31 Jan 2012 04:56:21 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=226</guid>
		<description><![CDATA[We use Google docs where I work, and I like to plot out developer task timelines. The easiest thing to do is set up the id, dependency, start, end, %done spreadsheet and use http://lifehacker.com/5070701/add-a-gantt-chart-to-your-google-spreadsheet to throw a gantt chart on the wall with the projector. Easy to do and review on the wall.]]></description>
			<content:encoded><![CDATA[<p>We use Google docs where I work, and I like to plot out developer task timelines.  The easiest thing to do is set up the id, dependency, start, end, %done spreadsheet and use <a href="http://lifehacker.com/5070701/add-a-gantt-chart-to-your-google-spreadsheet" title="ViewPath Gantt Chart">http://lifehacker.com/5070701/add-a-gantt-chart-to-your-google-spreadsheet</a> to throw a gantt chart on the wall with the projector.  Easy to do and review on the wall.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=226</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android and HTML5 and HLS</title>
		<link>http://www.factory-h.com/blog/?p=222</link>
		<comments>http://www.factory-h.com/blog/?p=222#comments</comments>
		<pubDate>Sat, 05 Nov 2011 23:24:05 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[android html5 html5-video]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=222</guid>
		<description><![CDATA[In the long running quest for HTML5 video on Android, now with HLS &#8211; I&#8217;ve yet to find a working example of HLS on Android 3.0+. Argh. If you know of an example, please let me know.]]></description>
			<content:encoded><![CDATA[<p>In the long running quest for HTML5 video on Android, now with HLS &#8211; I&#8217;ve yet to find a working example of HLS on Android 3.0+.  Argh.</p>
<p>If you know of an example, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=222</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NameVirtualHost and ServerName</title>
		<link>http://www.factory-h.com/blog/?p=219</link>
		<comments>http://www.factory-h.com/blog/?p=219#comments</comments>
		<pubDate>Tue, 04 Oct 2011 18:54:49 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache2]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=219</guid>
		<description><![CDATA[More of a note to myself &#8211; was having trouble with mod_wsgi and setting up different NameVirtualHost and ServerNames. Turned out the problem was I was including a .conf file that had multiple ServerName directives. Always check that first.]]></description>
			<content:encoded><![CDATA[<p>More of a note to myself &#8211; was having trouble with mod_wsgi and setting up different NameVirtualHost and ServerNames.  Turned out the problem was I was including a .conf file that had multiple ServerName directives.  Always check that first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=219</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django tip of the day &#8211; use pluralize</title>
		<link>http://www.factory-h.com/blog/?p=216</link>
		<comments>http://www.factory-h.com/blog/?p=216#comments</comments>
		<pubDate>Thu, 23 Jun 2011 12:52:00 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=216</guid>
		<description><![CDATA[There are a bunch of built in template tags and filters to make things easier to read. Be sure to take a look at pluralize when building your pages. It helps you easily use a plural suffix when you are listing counts of items.]]></description>
			<content:encoded><![CDATA[<p>There are a bunch of built in template tags and filters to make things easier to read.  Be sure to take a look at <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#pluralize">pluralize</a> when building your pages.</p>
<p>It helps you easily use a plural suffix when you are listing counts of items.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=216</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django user permissions allows is_superuser</title>
		<link>http://www.factory-h.com/blog/?p=210</link>
		<comments>http://www.factory-h.com/blog/?p=210#comments</comments>
		<pubDate>Wed, 30 Mar 2011 03:30:53 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=210</guid>
		<description><![CDATA[Small issue we found, if you want to give someone the ability to add/edit/delete users but don&#8217;t want them to be able to elevate privileges by setting is_superuser you have to monkey patch the UserAdmin class like this: from django.contrib.auth.models import User from django.contrib.auth.admin import UserAdmin from django.utils.translation import ugettext_lazy as _ class MyUserAdmin(UserAdmin): &#160;&#160;&#160;my_fieldsets [...]]]></description>
			<content:encoded><![CDATA[<p>Small issue we found, if you want to give someone the ability to add/edit/delete users but don&#8217;t want them to be able to elevate privileges by setting is_superuser you have to monkey patch the UserAdmin class like this:<br />
<code><br />
from django.contrib.auth.models import User<br />
from django.contrib.auth.admin import UserAdmin<br />
from django.utils.translation import ugettext_lazy as _</p>
<p>class MyUserAdmin(UserAdmin):<br />
&nbsp;&nbsp;&nbsp;my_fieldsets = (<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(None, {'fields': ('username', 'password')}),<br />
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(_('Permissions'), {'fields':('is_active',)}),<br />
&nbsp;&nbsp;&nbsp; )</p>
<p>   def change_view(self, request, object_id, extra_context=None):<br />
&nbsp;&nbsp;&nbsp;&nbsp;   # for non-superuser<br />
&nbsp;&nbsp;&nbsp;&nbsp;   if not request.user.is_superuser:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   self.fieldsets = self.my_fieldsets<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   response = UserAdmin.change_view(self, request, object_id,<br />
extra_context=None)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   return response<br />
&nbsp;&nbsp;&nbsp;&nbsp;   else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   return UserAdmin.change_view(self, request, object_id,<br />
extra_context=None)</p>
<p>admin.site.unregister(User)<br />
admin.site.register(User, MyUserAdmin)</p>
<p></code></p>
<p>Then they won&#8217;t see the is_superuser checkbox.  You&#8217;ll have to get a bit more fancy if you want to allow permission changes, but this is a good start.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=210</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django AuthenticationForm is not showing errors but is_valid is False</title>
		<link>http://www.factory-h.com/blog/?p=196</link>
		<comments>http://www.factory-h.com/blog/?p=196#comments</comments>
		<pubDate>Thu, 03 Mar 2011 18:45:01 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=196</guid>
		<description><![CDATA[Got bit by this one again, which I assume is going to be pretty common if you&#8217;re trying to use the AuthenticationForm as you would normally use a form. When I use forms, I get into the habit of doing something like this: if request.method == 'POST': f = MyForm(request.POST) if f.is_valid(): do_whatever() The problem [...]]]></description>
			<content:encoded><![CDATA[<p>Got bit by this one again, which I assume is going to be pretty common if you&#8217;re trying to use the AuthenticationForm as you would normally use a form.</p>
<p>When I use forms, I get into the habit of doing something like this:</p>
<pre>
if request.method == 'POST':
    f = MyForm(request.POST)
    if f.is_valid():
        do_whatever()
</pre>
<p>The problem when you use the <code>AuthenticationForm</code> is that <code>__init__</code>&#8216;s has the first parameter named <code>request</code>.  So if you do something like this:</p>
<pre>
if request.method == 'POST':
    f = AuthenticationForm(request.POST)
    if f.is_valid():
          do_whatever()
</pre>
<p>You&#8217;ll see that the form is not valid, but you won&#8217;t get any errors.  The explanation is listed in the comments here: <a href="http://code.djangoproject.com/ticket/9803">http://code.djangoproject.com/ticket/9803</a>, but it&#8217;s painful to learn what went wrong.</p>
<p>The right way to use the AuthenticationForm is do this:</p>
<pre>
if request.method == 'POST':
     f = AuthenticationForm(data=request.POST)
     if f.is_valid():
         do_whatever()
</pre>
<p><em>How would I fix this?</em><br />
Instead of doing this:</p>
<pre>
class AuthenticationForm(forms.Form):
     def __init__(self,request=None, *args, **kwargs):
</pre>
<p>I would make <code>request</code> be an optional named parameter, and check for it.  That&#8217;s what the code is doing later on in the <code>clean</code> method anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=196</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pricing AppEngine</title>
		<link>http://www.factory-h.com/blog/?p=194</link>
		<comments>http://www.factory-h.com/blog/?p=194#comments</comments>
		<pubDate>Sat, 12 Feb 2011 01:30:51 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[AppEngine]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=194</guid>
		<description><![CDATA[Google has a survey asking prospective pricing for new AppEngine features, please take a few minutes and fill it out here: https://groups.google.com/d/topic/google-appengine/eBdE0hyVPhE/discussion]]></description>
			<content:encoded><![CDATA[<p>Google has a survey asking prospective pricing for new AppEngine features, please take a few minutes and fill it out here: <a href="https://groups.google.com/d/topic/google-appengine/eBdE0hyVPhE/discussion">https://groups.google.com/d/topic/google-appengine/eBdE0hyVPhE/discussion</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=194</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Django as an OAuth provider</title>
		<link>http://www.factory-h.com/blog/?p=185</link>
		<comments>http://www.factory-h.com/blog/?p=185#comments</comments>
		<pubDate>Thu, 10 Feb 2011 05:58:15 +0000</pubDate>
		<dc:creator>dar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django oauth]]></category>

		<guid isPermaLink="false">http://www.factory-h.com/blog/?p=185</guid>
		<description><![CDATA[For a while I couldn&#8217;t understand why getting a request token wasn&#8217;t working from our Django server, it kept returning 401 &#8211; it is because mod_wsgi does not pass the Authorization header by default over to Django. To get the Authorization header, add: WSGIPassAuthorization On to your configuration.]]></description>
			<content:encoded><![CDATA[<p>For a while I couldn&#8217;t understand why getting a request token wasn&#8217;t working from our Django server, it kept returning 401 &#8211; it is because mod_wsgi does not pass the Authorization header by default over to Django.  </p>
<p>To get the Authorization header, add:</p>
<p>WSGIPassAuthorization On </p>
<p>to your configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.factory-h.com/blog/?feed=rss2&#038;p=185</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

