<?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>pukkared</title>
	<atom:link href="http://www.pukkared.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pukkared.com</link>
	<description>Web Design &#38; Development</description>
	<lastBuildDate>Thu, 20 Oct 2011 13:10:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Simulating User Login in a Django View Unit Test</title>
		<link>http://www.pukkared.com/2011/07/simulating-user-login-in-a-django-view-unit-test/</link>
		<comments>http://www.pukkared.com/2011/07/simulating-user-login-in-a-django-view-unit-test/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 01:26:59 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1605</guid>
		<description><![CDATA[&#160; &#160; So attempting to simulate a user login for a unit test has been driving me crazy for about the last hour or so. Django offers a pretty sweet testing client that simulates the http request/response model allowing for fairly robust unit tests to be built around the application views themselves. I was admittedly [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<p>So attempting to simulate a user login for a unit test has been driving me crazy for about the last hour or so.  Django offers a pretty sweet testing client that simulates the http request/response model allowing for fairly robust unit tests to be built around the application views themselves.  I was admittedly skeptical of unit testing views, but given the context I&#8217;ve become a believer.  But on that note, keep in mind that they are still unit tests, they are not a replacement for Integration or User Acceptance tests.</p>
<p>As such I was a very happy camper until I began writing a test for a view that used the request.user.id value of a logged in user.  Of course to test the functional part of the view it checked if a user was logged in (request.user.id != null), and if null would skip processing.  Well, that doesn&#8217;t do me any good.  I needed to convince the view that I am logged in.</p>
<p>So I went through the ropes of using the RequestFactory and the User model to create a fake request with a simulated user.  While this worked, there were still session issues.  I&#8217;ll also note that I found very little on the web about simulating user authentication in unit tests which surprised me since django documentation has never been something I&#8217;ve had trouble finding.</p>
<p>Eventually, I discovered a login() method in the Client model.  It accepts a username and password and performs the login without requiring the request like the login() method in the &#8216;auth&#8217; module.  Keep in mind that the primary database is not used in unit tests, so an empty replica is used.  As such you will need to create the mock user at runtime.</p>
<p>So I&#8217;ll wrap up with a working example of the code.  Enjoy.</p>
<div class="code">
<pre class="brush: python; title: ; notranslate">
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User

class ViewsTestCase(TestCase):
    def setUp(self):
        self.client = Client()

    def test_MyView(self):
        User.objects.create_user('fakename', 'fake@pukkared.com', 'mypassword')

        #use test client to perform login
        user = self.client.login(username='fakename', password='mypassword')

        response = self.client.post('/myViewUrlPath/')
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/07/simulating-user-login-in-a-django-view-unit-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing SQLite database in a Django application</title>
		<link>http://www.pukkared.com/2011/07/accessing-sqlite-database-in-a-django-application/</link>
		<comments>http://www.pukkared.com/2011/07/accessing-sqlite-database-in-a-django-application/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 16:36:00 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1583</guid>
		<description><![CDATA[I&#8217;ve been building some apps in Django lately. The apps are fairly small and Django comes with what is pretty much out of the box support for SQLite. While I love the ORM built in data management in Django, during development I often find myself needing to visually view the contents in my database, and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building some apps in Django lately.  The apps are fairly small and Django comes with what is pretty much out of the box support for SQLite.  While I love the ORM built in data management in Django, during development I often find myself needing to visually view the contents in my database, and if necessary quickly make updates.</p>
<p>So I started looking around and found a pretty cool free app called <a href="http://sourceforge.net/projects/sqlitebrowser/">SQLite Database Browser</a>.  While it&#8217;s got a few bugs, I really admire the simplicity of the application.  When it really comes down to it, I want to be able to view the data cleanly and quickly.  Sometimes I will want to update, delete, or insert data.  And the very few times that I would want to perform DBA tasks, I&#8217;m going to handle that via other means anyways.  I found that viewing data is quick and simple.  Setup is also very simple.  If working locally, just open your db file in your project.</p>
<p>The one bug I found that is pretty annoying concerns creating records.  If the table contains fields that are not nullable it becomes impossible to perform inserts via the GUI interface.  This pretty much means that you can never really create anything.  It appears that in the preferences you can assign a default for non-nullable value that will allow record creation.  Only problem is that this preference doesn&#8217;t seem to work.  I set the preference, close the dialog, reopen the dialog and the preferences are no longer set.  Doesn&#8217;t seem to be saving or something.  Overall, works very well with SQLite databases.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/07/accessing-sqlite-database-in-a-django-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Just Finished Reading: Design Patterns Explained: A New Perspective on Object-Oriented Design</title>
		<link>http://www.pukkared.com/2011/07/just-finished-reading-design-patterns-explained-a-new-perspective-on-object-oriented-design/</link>
		<comments>http://www.pukkared.com/2011/07/just-finished-reading-design-patterns-explained-a-new-perspective-on-object-oriented-design/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 14:44:18 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1590</guid>
		<description><![CDATA[This was really an excellent book. I&#8217;m hesitant to say if it is really better than other books I&#8217;ve read on design patterns simply because I question how much reader experience plays a role in getting a book like this. This is not the first book I&#8217;ve read on Design Patterns and OOP programming. However, [...]]]></description>
			<content:encoded><![CDATA[<p>This was really an excellent book.  I&#8217;m hesitant to say if it is really better than other books I&#8217;ve read on design patterns simply because I question how much reader experience plays a role in getting a book like this.  This is not the first book I&#8217;ve read on Design Patterns and OOP programming.  However, it is the first one that I&#8217;ve really felt that I got.  Now there are two possible reasons why I think I got it.  First is that it is a clear well-written, well-organized book.  Second, is that I actually have some experience to apply to the concepts in the book.</p>
<p>First off, it was indeed a good book.  Theory was balanced well with examples.  Theory was related with clarity, and the examples were relevant to the theory.  I particularly liked the focus not on functionality, but on responsibility.  I feel it gives the program more of a human quality than just a machine.  Beyond the way it changes one&#8217;s perception of the program, it really I think gives more meaning to the program.  The reality is that after spending months working on a program I do become somewhat attached to it.  Handing that program off to someone else to maintain is not always easy.  I&#8217;ve noticed that after reading this book I&#8217;ve looked at my programs as less of a set of functionality that solves a problem, and more as a set of workers, each with there own set of responsibilities, that, at a high level, solves a given problem.  I kind of view it as my classes have a responsibility.  That class is decomposed into the functionality necessary to perform that responsibility.  At this point testing now involves straight unit tests of pieces of functionality, and something more that tests that a responsibility is performed.  This seems above unit testing, but not quite integration testing.  Above all, my development style has not really changed, only my way of thinking about it. </p>
<p>Which brings me to my next observation.  Which is how my experience affected my perception of the book.  I&#8217;ve read a number of OOP books that revolve around the explanation and promotion of design patterns. However, I read all of them during my first year of real day-in day-out development.  They sort of planted the seeds, but I remember going into the books with so much excitement, only to come out on the other end confused and wondering what just happened.</p>
<p>I think I now understand though.  I didn&#8217;t come out of this one dazed and confused, and I&#8217;m not convinced that it is because it was a much better book.  Instead what I found throughout this book was a constant connection with my experience.  As he explained the Adapter Pattern, I would think that I used this all the time, I just didn&#8217;t realize it had a name.  When explaining the Bridge Pattern I&#8217;m thinking of how I could have written better applications if I had understood then what I know now.  A number of years have passed between reading my first Design Patterns books and now.  And those few years have been spent developing software full-time.  As such Design Patterns now make sense to me.  Explanations seemed to clarify or give names to what I already know conceptually, or provide ways to improve designs I have or am already working on.  I feel that for me at least I had to spend time designing software without patterns to really understand how patterns can provide consistency, maintainability, and a common dictionary of ideas for developers to communicate more effectively.  Overall, very much worth the read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/07/just-finished-reading-design-patterns-explained-a-new-perspective-on-object-oriented-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python IDLE performs a SaveAs with every file save</title>
		<link>http://www.pukkared.com/2011/07/python-idle-performs-a-saveas-with-every-file-save/</link>
		<comments>http://www.pukkared.com/2011/07/python-idle-performs-a-saveas-with-every-file-save/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 17:45:32 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Python IDLE]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1587</guid>
		<description><![CDATA[This is really just a note to myself and others who may encounter the Python IDLE performing a saveAs every time command/ctrl S shortcut is performed. This happened to me while working on some Python code. After looking around for what could be the issue I found that if CapsLock is turned on the save [...]]]></description>
			<content:encoded><![CDATA[<p>This is really just a note to myself and others who may encounter the Python IDLE performing a saveAs every time command/ctrl S shortcut is performed.  This happened to me while working on some Python code.  After looking around for what could be the issue I found that if CapsLock is turned on the save shortcut becomes a SaveAs function.  Seems pretty strange to me as I see no real reason for this.  Nonetheless, simple enough to get around, just mildly frustrating in the moment.  Turn off your CapsLock.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/07/python-idle-performs-a-saveas-with-every-file-save/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Just Finished Reading: 97 Things Every Programmer Should Know</title>
		<link>http://www.pukkared.com/2011/06/just-finished-reading-97-things-every-programmer-should-know/</link>
		<comments>http://www.pukkared.com/2011/06/just-finished-reading-97-things-every-programmer-should-know/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 23:04:24 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1548</guid>
		<description><![CDATA[This is a very good book for providing high-level insight into both the technical and the procedural aspects of programming. By procedural I mean in general the software development lifecycle process. There are 97 chapters, each roughly a page in length on a topic every programmer should know. The short concise chapters actually made this [...]]]></description>
			<content:encoded><![CDATA[<p>This is a very good book for providing high-level insight into both the technical and the procedural aspects of programming. By procedural I mean in general the software development lifecycle process.  There are 97 chapters, each roughly a page in length on a topic every programmer should know.  The short concise chapters actually made this a very easy and quick read.</p>
<p>The book did what I would want any book to do.  It taught me a lot of things I didn&#8217;t know, and confirmed a lot of things I thought I knew.  I enjoyed the chapters on tips for programmers interacting with and working with QA departments.  I feel that it is very important for both teams to understand each others approach.  I also felt like there was a lot of common sense in the book.  The advice given in many cases was good practical tips that could be applied independently of organizational structure.  Essentially, most of what I found could be practiced by both the cowboy coding freelancer and the programmer working within the confines of structured processes.</p>
<p>Lastly I&#8217;ll note that I thought it was pretty cool that some topics were covered multiple times from different perspectives.  Not to the point of contradiction, but enough to indicate the context sensitivity of certain topics.  Again, a good read. I certainly feel like I came out of the book a better programmer.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/just-finished-reading-97-things-every-programmer-should-know/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Badboy to build JMeter Test Plans over an SSL</title>
		<link>http://www.pukkared.com/2011/06/using-badboy-to-build-jmeter-test-plans-over-an-ssl/</link>
		<comments>http://www.pukkared.com/2011/06/using-badboy-to-build-jmeter-test-plans-over-an-ssl/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 23:07:04 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Badboy]]></category>
		<category><![CDATA[Integration Testing]]></category>
		<category><![CDATA[JMeter]]></category>
		<category><![CDATA[Load Testing]]></category>
		<category><![CDATA[Performance Testing]]></category>
		<category><![CDATA[Stress Testing]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1554</guid>
		<description><![CDATA[I&#8217;ve just recently began using JMeter to stress/load test a Coldfusion application. After reading some blogs on JMeter I got everything set up locally and created a proxy site to my application. But I quickly realized that the proxy is not supported for applications running under an SSL. The JMeter forum revealed that an easy [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just recently began using JMeter to stress/load test a Coldfusion application.  After reading some blogs on JMeter I got everything set up locally and created a proxy site to my application.  But I quickly realized that the proxy is not supported for applications running under an SSL.</p>
<p>The JMeter forum revealed that an easy way to create test cases under an SSL is to actually create the test with a program called Badboy.  Luckily for me I&#8217;ve been using badboy for automated regression testing for the past year or so.  I had never noticed however, that once a badboy test is created there is an export to JMeter option.  After exporting a test case I then learned that the badboy export has not yet been updated to support JMeter 2.4.  However, it does support JMeter 2.3.4</p>
<p>So the steps for setting up an environment for creating JMeter 2.4 test cases for an application running under an SSL are:</p>
<ol>
<li>Download JMeter 2.4 (<a href="http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi" target="_blank">http://jakarta.apache.org/site/downloads/downloads_jmeter.cgi</a>)</li>
<li>Download JMeter 2.3 (<a href="http://archive.apache.org/dist/jakarta/jmeter/binaries/" target="_blank">http://archive.apache.org/dist/jakarta/jmeter/binaries/</a>)</li>
<li>Download BadBoy (<a href="http://www.badboy.com.au/download/index" target="_blank">http://www.badboy.com.au/download/index</a>)</li>
</ol>
<p>Note that both versions of JMeter are downloaded on the assumption that you will want to execute your JMeter tests in 2.4, but you will need 2.3 to make the test cases compatible with 2.4.  If you are happy just using 2.3 then you will not need to download 2.4.</p>
<p>Once you have the necessary software do the following:</p>
<p><span id="more-1554"></span></p>
<ol>
<li>Create your test with Badboy.</li>
<li>In badboy go to file > Export to JMeter</li>
<li>Now open JMeter 2.3 and open the .jmx file that was exported.</li>
<li>Once the JMeter test is loaded save to the same .jmx file and close JMeter 2.3</li>
<li>Now open JMeter 2.4 and you should be able to open the .jmx file. and perform your load testing as you see fit</li>
</ol>
<p>So this is a workaround for not only creating JMeter test cases for a secured application, but also for using Badboy and the latest version of JMeter.  The only thing that sucks is that the exported Badboy script has to be opened and saved using the compatible JMeter 2.3 or else it will not open in JMeter 2.4.</p>
<p>Hope this helps setting up load tests.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/using-badboy-to-build-jmeter-test-plans-over-an-ssl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loading resizable fonts dynamically based on window size</title>
		<link>http://www.pukkared.com/2011/06/loading-resizable-fonts-dynamically-based-on-window-size/</link>
		<comments>http://www.pukkared.com/2011/06/loading-resizable-fonts-dynamically-based-on-window-size/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 22:58:17 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1564</guid>
		<description><![CDATA[A reader asked concerning a post I wrote a while back on Resizing text with jQuery and window resize: Can the text resize adapt to the window size when the page is loaded and also change when the window gets resized? Essentially, in my previous post I had hard-coded a font size in the CSS [...]]]></description>
			<content:encoded><![CDATA[<p>A reader asked concerning a post I wrote a while back on <a href="http://www.pukkared.com/2010/10/resizing-text-with-jquery-and-window-resize" target="_blank">Resizing text with jQuery and window resize</a>:</p>
<div class="code">
Can the text resize adapt to the window size when the page is loaded and also change when the window gets resized?
</div>
<p>Essentially, in my previous post I had hard-coded a font size in the CSS of 30px.  It would then resize as the window was resized horizontally.  But no matter what size the window was when the page was loaded the text was always set to 30px.  So I&#8217;ve wrote up a simple code sample below in jQuery illustrating how to set the font-size in a div based on the size of the window that the site is loaded in.  The original code was fairly easy to refactor to accomplish this.  Essentially I added the following function</p>
<div class="code">
<pre class="brush: jscript; title: ; notranslate">
getOriginalFontSize = function()
{
	var windowWidth = $(window).width();

	var thisFontSize = windowWidth / 50;

	return thisFontSize;
}
</pre>
</div>
<p>and changed the line</p>
<div class="code">
<pre class="brush: jscript; title: ; notranslate">
var originalFontSize = 30;
</pre>
</div>
<p>to </p>
<div class="code">
<pre class="brush: jscript; title: ; notranslate">
var originalFontSize = getOriginalFontSize();
</pre>
</div>
<p>So the final block of javascript looks like</p>
<p><span id="more-1564"></span></p>
<div class="code">
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function()
{
	//set the originals
	var originalWinHeight = $(window).height();
	var originalWinWidth = $(window).width();

	//set the original font size
	var originalFontSize = getOriginalFontSize();

	//set the ratio of change for each size change
	var ratioOfChange = 50;

	//set the font size using jquery
	$(&quot;#container&quot;).css(&quot;font-size&quot;, originalFontSize);

	$(window).resize(function()
	{
		//get the width and height as the window resizes
		var winHeight = $(window).height();
		var winWidth = $(window).width();

		//get the difference in width
		var widthDiff = winWidth - originalWinWidth;

		//check if the window is larger or smaller than the original
		if(widthDiff &gt; 0)
		{
			//our window is larger than the original so increase font size
			var pixelsToIncrease = Math.round(widthDiff / ratioOfChange);

			//calculate the new font size
			var newFontSize = originalFontSize + pixelsToIncrease;

			//set new font size
			$(&quot;#container&quot;).css(&quot;font-size&quot;, newFontSize);
		}
		else
		{
			//our window is smaller than the original so decrease font size
			var pixelsToDecrease = Math.round(Math.abs(widthDiff) / ratioOfChange);

			//calculate the new font size
			var newFontSize = originalFontSize - pixelsToDecrease;

			//set the new font size
			$(&quot;#container&quot;).css(&quot;font-size&quot;, newFontSize);
		}
	})
});

getOriginalFontSize = function()
{
	var windowWidth = $(window).width();

	var thisFontSize = windowWidth / 50;

	return thisFontSize;
}
</pre>
</div>
<p>The html and css did not change from the previous post.  Just a note that I used a simple algorithm for the getOriginalFontSize() method.  Of course, any algorithm can be programmed in this method for determining what the original font-size is and how it is determined.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/loading-resizable-fonts-dynamically-based-on-window-size/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Just Finished Reading: Head First Python</title>
		<link>http://www.pukkared.com/2011/06/just-finished-reading-head-first-python/</link>
		<comments>http://www.pukkared.com/2011/06/just-finished-reading-head-first-python/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 16:38:23 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1556</guid>
		<description><![CDATA[I&#8217;m usually a huge fan of the Head First series of books. They are, in general, written in a way that is geared towards efficient learning. I almost always take great joy in some of their puzzles and subtle humor. This book, was no exception up to the chapter on mobile development with Python. At [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m usually a huge fan of the Head First series of books.  They are, in general, written in a way that is geared towards efficient learning.  I almost always take great joy in some of their puzzles and subtle humor.  This book, was no exception up to the chapter on mobile development with Python.</p>
<p>At some point in this chapter nothing seemed to work.  I ended up doing a lot of research trying to understand how to do now what the book was instructing me how to do then.  The problem was essentially that the Android API for Python had been updated and changed fairly substantially it seems since the book was written.  While this is natural for APIs and programs in general it can really ruin the teaching / learning experience for someone really new to the topic.</p>
<p>The resulting issue was that each of the following chapters (which I believe was three) were very difficult to follow since they were building on the mobile app development chapter that had fallen to pieces.</p>
<p>In the end I learned a lot about Python outside of the Android API, but there may be better general python references out there to check out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/just-finished-reading-head-first-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Error: &#8216;CSRF verification failed. Request aborted.&#8217;</title>
		<link>http://www.pukkared.com/2011/06/django-error-csrf-verification-failed-request-aborted/</link>
		<comments>http://www.pukkared.com/2011/06/django-error-csrf-verification-failed-request-aborted/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 22:08:55 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Django]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1551</guid>
		<description><![CDATA[I just got this error when trying to execute a Django application locally. A quick search on the web revealed that I needed to include the following two lines: in the &#8216;MIDDLEWARE_CLASSES&#8217; setting in the Settings.py of the application. In my setup &#8216;django.middleware.csrf.CsrfViewMiddleware&#8217; class path was already there, but &#8216;django.middleware.csrf.CsrfResponseMiddleware&#8217; path was not. I added [...]]]></description>
			<content:encoded><![CDATA[<p> I just got this error when trying to execute a Django application locally.  A quick search on the web revealed that I needed to include the following two lines:</p>
<div class="code">
<pre class="brush: python; title: ; notranslate">
'django.middleware.csrf.CsrfViewMiddleware'
'django.middleware.csrf.CsrfResponseMiddleware'
</pre>
</div>
<p>in the &#8216;MIDDLEWARE_CLASSES&#8217; setting in the Settings.py of the application.</p>
<p>In my setup &#8216;django.middleware.csrf.CsrfViewMiddleware&#8217; class path was already there, but &#8216;django.middleware.csrf.CsrfResponseMiddleware&#8217; path was not.  I added the latter and it seemed to have resolved the error.  </p>
<p>I&#8217;m not completely sure what these classes do in detail, but it appears to revolve around security related to the local developing environment and obviously cross-site forgery.  I also noticed in the &#8216;django.middleware.csrf.CsrfResponseMiddleware&#8217; class there are notes that the class was deprecated as of Django 1.4.  Once I saw this I removed the path from my Settings.py file, re-ran the application, and it appears to still work.  I can&#8217;t really explain it, but adding it (at least temporarily) resolved the issue so I thought I would spread the wealth.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/django-error-csrf-verification-failed-request-aborted/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Just Finished Reading: Django &#8211; Visual QuickPro Guide</title>
		<link>http://www.pukkared.com/2011/06/just-finished-reading-django-visual-quickpro-guide/</link>
		<comments>http://www.pukkared.com/2011/06/just-finished-reading-django-visual-quickpro-guide/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 23:00:53 +0000</pubDate>
		<dc:creator>Matthew Cook</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.pukkared.com/?p=1542</guid>
		<description><![CDATA[I am pretty familiar with the MVC structure and have been writing Python for a while now mostly within the context of unit and integration testing. I started to think that maybe it was time to begin looking into web development with Python. In the past I&#8217;ve done a little work with python and CGI, [...]]]></description>
			<content:encoded><![CDATA[<p>I am pretty familiar with the MVC structure and have been writing Python for a while now mostly within the context of unit and integration testing.  I started to think that maybe it was time to begin looking into web development with Python.  In the past I&#8217;ve done a little work with python and CGI, but decided to look into Django as a framework for building Python sites.</p>
<p>I read a number of reviews on this book before picking it up and many of the complaints seemed to revolve around the fact that the book does not consistently build an application throughout the chapters.  While true, I believe it adds to the learning experience in that it drills the basics of creating a Django application into your head.  The book has 10 chapters and each chapter is a new application.  While many of the applications are simply expanded versions of the application built in the previous chapter the author to go through again the process of creating the application.  While probably annoying for the advanced Django programmer, the beginner leaves the book with the ability to set up a Django application in his or her sleep.  Ultimately repetition is the best way to learn, and this book is full of repetition.</p>
<p>The writing style was clean and concise.  No real issues with versioning.  All of the code seemed to work as illustrated.  Overall, I was looking to get a broad idea of what Django was all about, and on a high level what I could get out of it.  If you&#8217;re at all advanced with the Django framework this book will probably bore you out of your mind, but if your a Django newbie I think you&#8217;ll find this book very informative.</p>
<p>If I had one criticism of the book, it would be that on a very basic level the book continued to be very instructive in how to accomplish certain tasks.  I like the idea that I have to create a new application and set up a new database for each chapter.  But I also think that it is good to force the user to begin doing it themselves without instructions.  For example after chapter 6 or so the instructions should have indicated to the user that they should create an application named &#8216;thisApplication&#8217; with a database named &#8216;thisDB&#8217; instead of going through detailed instructions each time.</p>
<p>Overall good book, and well worth the time to read.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pukkared.com/2011/06/just-finished-reading-django-visual-quickpro-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

