<?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>Peter Krantz &#187; python</title>
	<atom:link href="http://www.peterkrantz.com/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterkrantz.com</link>
	<description>A blog about technology, visualization, music and unmanned vehicle experiments</description>
	<lastBuildDate>Mon, 12 Jul 2010 14:47:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Rails vs Grails vs Django models</title>
		<link>http://www.peterkrantz.com/2009/rails-grails-django-models/</link>
		<comments>http://www.peterkrantz.com/2009/rails-grails-django-models/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 16:58:47 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[domain modeling]]></category>
		<category><![CDATA[grails]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=281</guid>
		<description><![CDATA[Coming back to Rails after being away from some time in Django land I discovered a huge difference in how Rails and Django treats your models...]]></description>
			<content:encoded><![CDATA[<p>Coming back to Rails after being away from some time in Django land I discovered a huge difference in how Rails, Grails and Django treats your models. In Django and Grails you can look at a model class and see all the properties it has:</p>
<pre class="brush: python;">
class Organization(models.Model):
    name = models.CharField(max_length=255)
    url = models.URLField(verify_exists=False)
    orgtype = models.ForeignKey(OrgType)
</pre>
<p>The same model class in Rails typically looks like this:</p>
<pre class="brush: ruby;">
class Organization &lt; ActiveRecord::Base
    belongs_to :OrgType
end
</pre>
<p>&#8230;and in Grails it is more specific like Django:</p>
<pre class="brush: groovy;">
class Organization {
  String name
  String url
  static belongsTo = OrgType
  OrgType orgtype
}
</pre>
<p>It took me a while to remember that in Rails, parts of the model design is actually stored in the database schema instead of in the Ruby code. Peculiar don&#8217;t you think, given that everything else in a Rails app is nicely declared in Ruby code? There are of course benefits to both approaches, but I have started adding comments in the Rails model classes to be able to remember what properties they have without peeking in the Db. Typically I have a number of half-baked projects on my laptop and from time to time I forget what they do and these comments help me remember.</p>
<p>Check out more examples here:</p>
<ul>
<li><a href="http://docs.djangoproject.com/en/dev/topics/db/models/#topics-db-models">Django models</a></li>
<li><a href="http://www.tutorialspoint.com/ruby-on-rails/rails-models.htm">Rails models</a></li>
<li><a href="https://www.ibm.com/developerworks/java/library/j-grails02128/">Grails models</a></li>
</ul>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2009%2Frails-grails-django-models%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2009/rails-grails-django-models/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Integrating Yahoo Search in a Django site in 5 easy steps</title>
		<link>http://www.peterkrantz.com/2008/yahoo-search-in-django/</link>
		<comments>http://www.peterkrantz.com/2008/yahoo-search-in-django/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 12:38:17 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[boss]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[yahoo]]></category>
		<category><![CDATA[yahoo boss]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=247</guid>
		<description><![CDATA[I have been experimenting with various search options for the eutveckling.se site for a while. Google Custom Search is nice and very fast, but the number of ads appearing in the search result page makes it difficult for users to separate result items from ads. (Update: I am sticking with Google Custom Search until I [...]]]></description>
			<content:encoded><![CDATA[<p>I have been experimenting with various search options for the <a href="http://www.eutveckling.se/">eutveckling.se</a> site for a while. Google Custom Search is nice and very fast, but the number of ads appearing in the search result page makes it difficult for users to separate result items from ads. (Update: I am sticking with Google Custom Search until I figure out how to get Yahoo search to present proper excerpts).</p>
<p>I am a fast reader which comes with the tradeoff of missing important information sometimes. Skimming through the terms for using the API I was a bit disappointed at first. That was because I was only reading the first column in the table that lists the <strong>previous </strong>terms of use. Oh well. The second column that lists the current restrictions (or rather lack of restrictions) makes it clear that Yahoo search is very easy to get started with. It is almost so that you start wondering where Yahoo will make money from providing a service like that.</p>
<p>Anyway, here are the five simple steps to get Yahoo search integrated in your Django site:</p>
<h2>1. Get an API Key</h2>
<p>&#8230;or &#8220;application ID&#8221; as Yahoo calls it. Visit <a href="http://developer.yahoo.com/wsregapp/">this page to sign up for an API key</a>.</p>
<h2>2. Install the pYsearch library</h2>
<p>Download <a href="http://pysearch.sourceforge.net/">pYsearch</a> from Sourceforge to your computer (here is the <a href="http://garr.dl.sourceforge.net/sourceforge/pysearch/pYsearch-3.1.tar.gz">direct link to the package</a>), and:</p>
<p><kbd>tar xvf pYsearch-3.1.tar.gz</kbd></p>
<p><kbd>cd pYsearch</kbd></p>
<p><kbd>sudo python setup.py build</kbd></p>
<p><kbd>sudo python setup.py install</kbd></p>
<p>This should install pYsearch somewhere on your Python path.</p>
<h2>3. Set up URL-pattern and view method</h2>
<p>In your urls.py add a URL-pattern to pick up search requests. We&#8217;ll use queries like /search/?q=myquery:</p>
<pre>url(r'^search/$', 'myapp.views.search', name='site_search'),</pre>
<p>Set up the view method in your application&#8217;s views.py (make sure the search query is encoded to utf-8 to enable characters outside ISO-8859-1 in the query parameter):</p>
<pre>from yahoo.search.web import WebSearch

def search(request):
	query = request.GET.get("q", "").encode("utf-8")

	if len(query) &gt; 0:

		#Call yahoo!
		api_key = "[your api key]"
		srch = WebSearch(api_key)
		srch.site = "www.example.com" #restrict to your own site
		srch.query = query
		srch.results = 50
		result = srch.parse_results() #puts all result items into a dict

	return render_to_response('search/search.html', locals())</pre>
<h2>4. And now the search form and result template</h2>
<p>Add the search field and form somewhere on your site:</p>
<pre>&lt;form action="/search/" method="GET"&gt;
	&lt;div&gt;
	&lt;label for="q""&gt;Find:&lt;/label&gt;
	&lt;input type="text" name="q" accesskey="4" size="30" id="q" value="{{query}}"&gt;
	&lt;input type="submit" value="Search"&gt;
	&lt;/div&gt;
&lt;/form&gt;</pre>
<p>The base.html sets up the basic web page. This template lives in myapp/templates/search/search.html</p>
<pre>{% extends 'base.html' %}
{% block content %}
	{% if result.results %}
        &lt;ul class="searchresult"&gt;
	{% for item in result %}
	&lt;li&gt;
           &lt;h2&gt;&lt;a href="{{item.Url}}"&gt;{{item.Title}}&lt;/a&gt;&lt;/h2&gt;
           &lt;p&gt;{{item.Summary|cut:" ..."}}...&lt;/p&gt;
        &lt;/li&gt;
        {% endfor %}
        &lt;/ul&gt;
{% else %}
Suggestion:
&lt;ul&gt;
	&lt;li&gt;Check your spelling.&lt;/li&gt;
	&lt;li&gt;Try similar words.&lt;/li&gt;
&lt;/ul&gt;
{% endif %}
{% endblock %}</pre>
<h2>5. There is no step 5!</h2>
<p>That&#8217;s it! Your site should now have a nice search engine. Some issues you may encounter:</p>
<ol>
<li>Yahoo does not seem to have indexed all of <a href="http://www.eutveckling.se">eutveckling.se</a> yet. This means that the result set will be limited. No PDF documents seem to have been included (<a href="http://www.eutveckling.se/sok/?q=V%C3%A4gledningen+24-timmarswebben">searching for &#8220;Vägledningen 24-timmarswebben&#8221;</a> does not return <a href="http://www.eutveckling.se/sok/?q=V%C3%A4gledningen+24-timmarswebben">the PDF document</a> even though it has many links on the site). It would be nice to be able to see how much of the site that the search engine knows about.</li>
<li>The summary text for each page seems to be the same (including hidden skiplink text). This may be my fault as I haven&#8217;t provided meta description elements yet. I have added som CSS classnames (robots-nocontent) to navigation elements to help the search engine decide on what should be included and what should be skipped. I had expected that the summary would contain a phrase close to the query term instead of text from the top of the page.</li>
</ol>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fyahoo-search-in-django%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/yahoo-search-in-django/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Improving Django performance with better caching</title>
		<link>http://www.peterkrantz.com/2008/improving-django-cache-performance/</link>
		<comments>http://www.peterkrantz.com/2008/improving-django-cache-performance/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 18:58:54 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=231</guid>
		<description><![CDATA[The Django cache middleware is great, but has one drawback. If you are caching views (which can give a nice performance boost) Django will only use the path segment of the URL to create a cache key. If you are an avid reader of RFC 3986 you may remember that a URI consists of multiple [...]]]></description>
			<content:encoded><![CDATA[<p>The Django cache middleware is great, but has one drawback. If you are caching views (which can give a nice performance boost) Django will only use the path segment of the URL to create a cache key. If you are an avid reader of <a href="http://labs.apache.org/webarch/uri/rfc/rfc3986.html#components">RFC 3986</a> you may remember that a URI consists of multiple components; path and query being of special interest here. The problem is documented in <a href="http://code.djangoproject.com/ticket/4992">ticket 4992</a>.</p>
<p>Given the following URL:</p>
<pre class="brush: plain;">aHR0cDovL2V4YW1wbGUuY29tL2l0ZW1zLz9vcmRlcl9ieT1uYW1l</pre>
<p>&#8230;Django will ignore the query part when determining a cache key so the key for the above request will be:</p>
<pre class="brush: plain;">L2l0ZW1zLw==</pre>
<p>Any type of query parameter will make Django ignore the cached page. Django will not create a new cache item for the order_by request. This will be detrimental for the performance of your site. I had expected Django to create three different cache items for these URLs instead of one cache item and two ignored requests:</p>
<ul>
<li>
<pre class="brush: plain;">aHR0cDovL2V4YW1wbGUuY29tL2l0ZW1zLw==</pre>
</li>
<li>
<pre class="brush: plain;">aHR0cDovL2V4YW1wbGUuY29tL2l0ZW1zLz9vcmRlcl9ieT1uYW1l</pre>
</li>
<li>
<pre class="brush: plain;">aHR0cDovL2V4YW1wbGUuY29tL2l0ZW1zLz9vcmRlcl9ieT1kYXRl</pre>
</li>
</ul>
<h2>The solution</h2>
<p>Fortunately Django&#8217;s source is very readable and easy to adapt to your own needs. A few minor changes to middleware/cache.py and utils/cache.py and you are ready to go. For details see the <a href="http://code.djangoproject.com/attachment/ticket/4992/cache_by_request_full_path.diff">patch I attached to ticket 4992</a>.</p>
<p>I recently deployed a Django site to get an <a href="http://www.comparevps.com/">overview of VPS hosting plans</a> and the ability to cache items based on the filtering parameters gives much better performance.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fimproving-django-cache-performance%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/improving-django-cache-performance/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Stuff I learned over the weekend</title>
		<link>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/</link>
		<comments>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/#comments</comments>
		<pubDate>Mon, 27 Oct 2008 21:57:59 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Markup]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=229</guid>
		<description><![CDATA[1. Finding stuff in lists of dicts in Python If you have a list of dicts in Python like this: aXRlbXMgPSBbeyJpZCI6MSwgIm5hbWUiOiAiUmFzbXVzIn0sIHsiaWQiOiAyLCAibmFtZSI6ICJSaWNrIn1d &#8230;and want to check if there are any dict items with an id of a specific value (e.g. 2) I first came up with this: MiBpbiBtYXAobGFtYmRhIHg6IHhbJ2lkJ10sIGl0ZW1zKQ== The downside is that it will loop all [...]]]></description>
			<content:encoded><![CDATA[<h2>1. Finding stuff in lists of dicts in Python</h2>
<p>If you have a list of dicts in Python like this:</p>
<pre class="brush: plain;">aXRlbXMgPSBbeyJpZCI6MSwgIm5hbWUiOiAiUmFzbXVzIn0sIHsiaWQiOiAyLCAibmFtZSI6ICJSaWNrIn1d</pre>
<p>&#8230;and want to check if there are any dict items with an id of a specific value (e.g. 2) I first came up with this:</p>
<pre class="brush: plain;">MiBpbiBtYXAobGFtYmRhIHg6IHhbJ2lkJ10sIGl0ZW1zKQ==</pre>
<p>The downside is that it will loop all items which may be inefficient for larger lists. Niklas eventually pointed me at <a href="http://www.python.org/doc/2.5.2/lib/built-in-funcs.html">Python&#8217;s any() function</a> which I managed to miss while googling for other ways. Thus, a nicer version is:</p>
<pre class="brush: plain;">YW55KGl0ZW1bJ2lkJ10gPT0gMiBmb3IgaXRlbSBpbiBpdGVtcyk=</pre>
<p>Handy for checking stuff in Django object collections.</p>
<h2>2. YUI Grids looks difficult but is easy</h2>
<p>I decided to scrap the YAML based layout of a site I made a while ago when I discovered the licensing agreement (requires backlinks for the free version). I turned to <a href="http://developer.yahoo.com/yui/grids/">YUI Grids</a> which I had a look at a long time ago, but didn&#8217;t use because it looked too complex. Maybe it is just the layout of the YUI grids website (massive amounts of text), but it felt complicated at a first glance.</p>
<p>Coming back to YUI Grids this time I skipped the documentation and went straight for the <a href="http://developer.yahoo.com/yui/examples/grids/index.html">examples</a>. It is simple as soon as you understand grids (yui-g) and units (yui-u). I managed to get the basic layout going in an hour. <a href="http://www.wait-till-i.com/2008/10/04/webmaster-jam-session-hack-quickly-fixing-a-web-site-with-yui-grids/">Thank you YUI team!</a></p>
<h2>3. Django&#8217;s template language is heavily opinionated</h2>
<p>They really, really don&#8217;t want you to write anything but pure template code in there. Which is good, I guess. I only tried doing some basic addition. Sorry.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fstuff-i-learned-over-the-weekend%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/stuff-i-learned-over-the-weekend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s your history&#124;awk&#8230;</title>
		<link>http://www.peterkrantz.com/2008/whats-your-historyawk/</link>
		<comments>http://www.peterkrantz.com/2008/whats-your-historyawk/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 20:41:12 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/?p=144</guid>
		<description><![CDATA[Via Bill de hÓra. Run this from the command line: history&#124;awk '{a[$2]++} END{for(i in a){printf "%5d\t%s ",a[i],i}}'&#124;sort -rn&#124;head I get: 108 ls 78 cd 53 sudo 29 python 13 cap 9 django-admin.py 9 ruby 8 vim 6 easy_install 3 bzr 1 ex 1 python2.5 1 ln 1 mksir 1 cat 1 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc In short: I [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://www.dehora.net/journal/2008/04/10/that-looks-about-right/">Bill de hÓra</a>. Run this from the command line:</p>
<p><kbd>history|awk '{a[$2]++} END{for(i in a){printf "%5d\t%s ",a[i],i}}'|sort -rn|head</kbd></p>
<p>I get:</p>
<p>108	ls<br />
78	cd<br />
53	sudo<br />
29	python<br />
13	cap<br />
9	django-admin.py<br />
9	ruby<br />
8	vim<br />
6	easy_install<br />
3 bzr<br />
1	ex<br />
1	python2.5<br />
1	ln<br />
1	mksir<br />
1	cat<br />
1 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc</p>
<p>In short:</p>
<ul>
<li>I have trouble with my default python installation.</li>
<li>I am trying Django for small project.</li>
<li>I was hit by the Leopard keyboard repeat freeze bug.</li>
<li>I am poor at spelling simple commands.</li>
</ul>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fwhats-your-historyawk%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/whats-your-historyawk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Come celebrate Niklas Lindström&#8217;s birthday</title>
		<link>http://www.peterkrantz.com/2008/yak-shaving/</link>
		<comments>http://www.peterkrantz.com/2008/yak-shaving/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 15:34:42 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[RDF]]></category>
		<category><![CDATA[Semantic Web]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2008/yak-shaving/</guid>
		<description><![CDATA[You may ask yourself &#8220;who is that?&#8221; or &#8220;wtf?!&#8221; but the fact is that in the near future he will have a much greater impact on your life than you may think. Here is why you should head over to his blog and post a random comment about Yak shaving and, if possible, create a [...]]]></description>
			<content:encoded><![CDATA[<p>You may ask yourself &#8220;who is that?&#8221; or &#8220;wtf?!&#8221; but the fact is that in the near future he will have a much greater impact on your life than you may think. Here is why you should head over to his blog and post a random comment about <a href="http://dustfeed.blogspot.com/">Yak shaving</a> and, if possible, create a link containing the words <a href="http://dustfeed.blogspot.com/">&#8220;Yak shaving&#8221;</a> pointing to his blog. With a little bit of effort and luck Google will pick it up and Niklas will be the number one result for people from inner Mongolia.</p>
<p>Although unknown to most people on the giant global graph, Niklas Lindström is the inventor and sole developer of <a href="http://oort.to/">Oort</a>. And:</p>
<ol>
<li>Oort is a Python toolkit to work with RDF data.</li>
<li><a href="http://oubiwann.blogspot.com/2007/03/python-will-rule-world.html">Python will rule the world</a> and RDF will be the primary way of connecting people in the Giant Global Graph.</li>
<li>The Giant Global Graph will be the natural entry point for the first self-aware computer (let&#8217;s call it &#8220;The Machine&#8221;) to gain control of humanity.</li>
<li>You want to be treated nicely by The Machine.</li>
</ol>
<p>Therefore you should become friends with Niklas by celebrating his birthday so that he may prevent the scenario we all became aware of in the documentary &#8220;The Terminator&#8221; a couple of years ago:</p>
<p><img src='http://www.peterkrantz.com/wp-content/uploads/2008/02/terminator.jpg' alt='The Giant Global Graph' /></p>
<p>He may be our only hope.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fyak-shaving%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/yak-shaving/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Software architects as management deadwood</title>
		<link>http://www.peterkrantz.com/2008/software-architects/</link>
		<comments>http://www.peterkrantz.com/2008/software-architects/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 19:31:55 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2008/software-architects/</guid>
		<description><![CDATA[Two interesting quotes from Dietrich Kappe: So no, we don&#8217;t hire architects. We hire developers. In a small team, there is no room for management deadwood. I agree completely. My view is that the title &#8220;Software architect&#8221; is a misnomer for what most architects in the software industry do, or at least what they should [...]]]></description>
			<content:encoded><![CDATA[<p>Two interesting quotes from <a href="http://blogs.pathf.com/agileajax/2008/02/but-where-are-a.html">Dietrich Kappe</a>:</p>
<blockquote><p>So no, we don&#8217;t hire architects. We hire developers. In a small team, there is no room for management deadwood.</p></blockquote>
<p>I agree completely. My view is that the title &#8220;Software architect&#8221; is a misnomer for what most architects in the software industry do, or at least what they should be doing. </p>
<p>It is part of the weird trend that career advancement means getting away from actual programming for some reason. Maybe that is part of a bigger problem when the only way to get a higher pay is to become a manager of some sort? A couple of years ago, most programmers I knew aimed for a project management position. Programming was a dirty job that you had to put up with during the first years in consulting.</p>
<p>When my title was &#8220;business analyst&#8221; I tried to do as much programming I could and I haven&#8217;t regretted that for a moment. In fact, I believe that more people from the business side should get involved in programming to get a better understanding of the fundamental principles. For example, it would be great if business people could write their own acceptance tests and with the booming trend of DSL:s you will probably get involved anyway. </p>
<blockquote><p>If you&#8217;ve made the transition from a hierarchical environment to an agile, self-organizing team, you know what I&#8217;m saying. You won&#8217;t ever want to go back.</p></blockquote>
<p>Absolutely. It is the same thing as discovering things like Ruby/Python/Rails: it makes you wonder what the hell you were doing earlier. In many ways I feel sorry for young software developers that go straight into Rails or similar frameworks today. They are not as appreciative as the rest of us:-)</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2008%2Fsoftware-architects%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2008/software-architects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hackety Hack &#8211; The Foundation for a Revolution</title>
		<link>http://www.peterkrantz.com/2007/hackety-hack-revolution/</link>
		<comments>http://www.peterkrantz.com/2007/hackety-hack-revolution/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 11:11:26 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/hackety-hack-revolution/</guid>
		<description><![CDATA[<img src="http://www.peterkrantz.com/wp-content/uploads/2007/07/hackety-hack.jpg" alt="Hackety Hack t-shirt" class="right"><a href="http://whytheluckystiff.net/">Why the lucky stiff</a> is a well known name among most Ruby developers. Many have read his Ruby programming tutorials and seen his spectacular performances (or whatever they are) at RailsConf and elsewhere. Personally, I owe him a lot for Hpricot, the liberal HTML parser (at <a href="http://www.verva.se/web/t/Page____492.aspx">my government agency</a> we use it to run the <a href="http://www.verva.se/web/t/Page____2135.aspx">quarterly test of all public websites in Sweden</a>). Here are some thoughts on why I think Hackety Hack may be important than I first thought.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.peterkrantz.com/wp-content/uploads/2007/07/hackety-hack.jpg" alt="Hackety Hack t-shirt" class="right"><a href="http://whytheluckystiff.net/">Why the lucky stiff</a> is a well known name among most Ruby developers. Many have read his Ruby programming tutorials and seen his spectacular performances (or whatever they are) at RailsConf and elsewhere. Personally, I owe him a lot for Hpricot, the liberal HTML parser (at <a href="http://www.verva.se/web/t/Page____492.aspx">my government agency</a> we use it to run the <a href="http://www.verva.se/web/t/Page____2135.aspx">quarterly test of all public websites in Sweden</a>). Hpricot is also the default parser for the <a href="http://www.peterkrantz.com/raakt/wiki/">Ruby Accessibility Analysis Kit</a>.</p>
<h2>The Hackety Hack</h2>
<p>Hi latest endeavour seemed uninteresting at first. Hackety Hack, a toolbox to <a href="http://hacketyhack.net/">teach programming to kids</a>. But after a while it dawned on me. If Ruby on Rails is beginning to make inroads into the Enterprise by challenging web development paradigms, Hackety Hack will in time question many of the programming paradigms taught at universities today. </p>
<p>My first programming class at university was in <a href="http://en.wikipedia.org/wiki/ML_programming_language">ML, a functional programming language</a>. I remember that we played with lists a lot. And recursion. Then we made a parser for our own symbolic programming language. I guess that pretty much killed my entrepreneurial spirit for a couple of years.</p>
<p>Kids who learn how to set up a blog in five lines of code, send messages over the internet and play with mp3 files will not accept that. The first kids out of Hackety Hack camp will soon be arriving at universities all over the place. And they will question the curly braces, the semicolons and <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Arcane ways to make Old programming languages Pleasant</a>.</p>
<p>If I was a university professor I would make sure to have a look at some other programming languages apart from Java and C# (do they teach C# at universities?) before these kids come and ruin my programming classes.</p>
<p>I predict that Sweden will be the last bastion of uninterested software developers. To make some sort of vague statement I have made a Hackety Hack t-shirt for my 2 year old son. I hope he will be at the front lines of the Hackety Hack revolution.</p>
<p><strong>Update:</strong> A bunch of people asked me where the highres print came from. The <a href="http://hacketyhack.net/art/">original logo is of course from Why the lucky stiff</a>. Here is the <a href='http://www.peterkrantz.com/wp-content/uploads/2007/07/hackety-hack-print.pdf'>Hackety Hack logo PDF</a> that I created in Inkscape.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Fhackety-hack-revolution%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/hackety-hack-revolution/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>First impressions of Mercurial (as an alternative to subversion)</title>
		<link>http://www.peterkrantz.com/2007/to-mercurial-from-cvs/</link>
		<comments>http://www.peterkrantz.com/2007/to-mercurial-from-cvs/#comments</comments>
		<pubDate>Fri, 04 May 2007 15:33:40 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[SCM]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2007/to-mercurial-from-cvs/</guid>
		<description><![CDATA[So, I was in the mall the other day where I bumped into Marcus Ahnve. He mentioned that he had been using Mercurial instead of Subversion for his latest project. Just before I met Marcus I had been coding on a rails project housed in subversion. I was sitting in a cafe without internet access [...]]]></description>
			<content:encoded><![CDATA[<p>So, I was in the mall the other day where I bumped into <a href="http://marcus.ahnve.com/">Marcus Ahnve</a>. He mentioned that he had been using <a href="http://en.wikipedia.org/wiki/Mercurial_%28software%29">Mercurial</a> instead of Subversion for his latest project.</p>
<p>Just before I met Marcus I had been coding on a rails project housed in subversion. I was sitting in a cafe without internet access which means that it wasn&#8217;t possible to commit changes to subversion. As my son was asleep time was scarce and I wanted to get as much done as possible. So what do you do? Well I continued coding on a different part of the application and in the end I had a fairly large changeset waiting to be committed.</p>
<p>This makes for bad coding practices. A large changeset is more likely to create problems for your colleagues when the do an update from the repository. I really wanted to be able to create several changesets offline and put them back in when my connection was restored.</p>
<h2>Trying Mercurial as an alternative to Subversion</h2>
<p>This is where <a href="http://en.wikipedia.org/wiki/Mercurial_%28software%29">Mercurial</a> comes in. With Mercurial it is easy to create changesets when you are offline. These can be pushed to a central repository (of you have one).</p>
<p>Installing Mercurial in a shared hosting account should be easy if you have access to ssh, Python and Apache. Following the <a href="http://www.dehora.net/journal/2007/04/mercurial_part_ii.html">step by step instructions by Bill de hÓra</a> it was easy to get Mercurial running on TextDrive.</p>
<p>My initial impression is that mercurial looks very promising:</p>
<ul>
<li><a href="http://www.selenic.com/mercurial/wiki/index.cgi/QuickStart">Mercurial commands</a> are very similar to those of subversion and it was easy to set up a new repository.</li>
<li>The web interface looks very nice compared to that of subversion.</li>
<li>Capistrano can be used with mercurial.</li>
<li>It feels marginally snappier than subversion.</li>
<li>Mercurial doesn&#8217;t litter your folder tree with myriads of folders (just one in the root folder).</li>
</ul>
<p>The next step is to migrate my subversion repository history using <a href="http://progetti.arstecnica.it/tailor/">Tailor</a>. If that goes well I may well become a mercurial switcher.</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2007%2Fto-mercurial-from-cvs%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2007/to-mercurial-from-cvs/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Google Code Search Reveals Anger, Frustration and Hate</title>
		<link>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/</link>
		<comments>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/#comments</comments>
		<pubDate>Wed, 11 Oct 2006 08:09:30 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/</guid>
		<description><![CDATA[Google&#8217;s Code search is a great way to spend an evening. Indexing a hefty amount of source code reveals anger, frustration and hate. Some favourites: I hate Java Java sucks Python sucks I hate Microsoft I hate DTDs (that is REXML by the way&#8230;) Interestingly, searching for &#8220;Ruby sucks&#8221; does not return any matching documents&#8230;]]></description>
			<content:encoded><![CDATA[<p>Google&#8217;s Code search is a great way to spend an evening. Indexing a hefty amount of source code reveals anger, frustration and hate. Some favourites:</p>
<ul>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+java">I hate Java</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22Java+sucks">Java sucks</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22python+sucks%22&#038;btnG=Search">Python sucks</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+microsoft">I hate Microsoft<br />
</a></li>
<li><a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22I+hate+DTD">I hate DTDs</a> (that is REXML by the way&#8230;)</li>
</ul>
<p>Interestingly, searching for &#8220;<a href="http://google.com/codesearch?hl=en&#038;lr=&#038;q=%22ruby+sucks%22&#038;btnG=Search">Ruby sucks</a>&#8221; does not return any matching documents&#8230;</p>
<div id="facebook_like"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.peterkrantz.com%2F2006%2Fgoogle-code-search-reveals-anger-and-frustration%2F&amp;layout=standard&amp;show-faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" title="I like this" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:auto;"></iframe></div>]]></content:encoded>
			<wfw:commentRss>http://www.peterkrantz.com/2006/google-code-search-reveals-anger-and-frustration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
