<?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>w.holeso.me</title>
	<atom:link href="http://w.holeso.me/feed/" rel="self" type="application/rss+xml" />
	<link>http://w.holeso.me</link>
	<description>A blog about Python, Django, and other things</description>
	<lastBuildDate>Wed, 23 Mar 2011 09:57:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Django: A Simple Keyword Search</title>
		<link>http://w.holeso.me/2009/09/django-a-simple-keyword-search/</link>
		<comments>http://w.holeso.me/2009/09/django-a-simple-keyword-search/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 03:44:49 +0000</pubDate>
		<dc:creator>proc</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Django search]]></category>
		<category><![CDATA[Django tips]]></category>

		<guid isPermaLink="false">http://w.holeso.me/?p=57</guid>
		<description><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0717    3194116  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.0717    3194116  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.0718    3194272  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.0718    3195328  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0718    3195356  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.0726    3202500  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.0806    3208188  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0806    3208216  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0717    3194116  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.0717    3194116  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.0718    3194272  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.0718    3195328  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0718    3195356  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.0726    3202500  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.0806    3208188  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0806    3208216  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.0807    3208436  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.0808    3208736  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.0808    3209228  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0717    3194116  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.0717    3194116  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.0718    3194272  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.0718    3195328  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0718    3195356  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.0726    3202500  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.0806    3208188  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0806    3208216  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0717    3194116  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.0717    3194116  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.0718    3194272  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.0718    3195328  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0718    3195356  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.0726    3202500  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.0806    3208188  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0806    3208216  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.0816    3208916  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.0816    3209216  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.0816    3209568  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

Disclaimer: This post was actually started about 9 months ago and never finished, so I&#8217;m not sure if the code will even run on the latest version of Django. I&#8217;m actually doing Ruby on Rails work nowadays at my job, and using Django solely for my personal projects. With that said, I hope some people [...]]]></description>
			<content:encoded><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0850    3195104  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.0850    3195104  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.0851    3198716  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.0938    3204288  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0938    3204316  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0850    3195104  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.0850    3195104  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.0851    3198716  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.0938    3204288  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0938    3204316  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.0940    3204492  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.0941    3204792  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.0941    3205160  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0850    3195104  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.0850    3195104  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.0851    3198716  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.0938    3204288  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0938    3204316  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.0850    3195104  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.0850    3195104  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.0851    3198716  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.0938    3204288  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.0938    3204316  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.0948    3204720  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.0948    3205020  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.0949    3205372  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

<h2>Disclaimer:</h2>
<p>This post was actually started about 9 months ago and never finished, so I&#8217;m not sure if the code will even run on the latest version of Django.  I&#8217;m actually doing Ruby on Rails work nowadays at my job, and using Django solely for my personal projects.  With that said, I hope some people out there will find some of these techniques somewhat useful.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<h2>Search</h2>
<p>One feature that is commonly used on a lot of Django applications is the ability to search through content by keywords.  There are many different ways to do this, but I&#8217;d like to present a way that&#8217;s super easy to implement and uses only the Django model API.</p>
<p>Before I start, I&#8217;d like to first give a little disclaimer: this is absolutely NOT the most efficient way to perform a search through data.  If you&#8217;re looking for a more advanced solution, check out <a href="http://code.google.com/p/djangosearch/">djangosearch </a> on google code.</p>
<p>Ok, let&#8217;s say you&#8217;re making a blogging application, and you need a way to search blog entries for certain keywords.  You may have a model named BlogEntry that looks like this:</p>
<pre class="brush:py">
class BlogEntry(models.Model):
    blog = models.ForeignKey(Blog)
    subject = models.CharField(max_length=100)
    body = models.TextField()</pre>
<p>Now let&#8217;s say you needed a way to search the &#8216;body&#8217; and &#8216;subject&#8217; fields of all BlogEntries for the keywords &#8216;Django&#8217; and &#8216;Python.&#8217;  Given a set of BlogEntries, this function will search their subject and body fields for the specified keywords. Here&#8217;s how you would build the function:</p>
<pre class="brush:py">
def search_keywords(blogentries, keywords):
    '''
    Searches a given QuerySet and returns a
    QuerySet that contains any word in the list of keywords
    '''
    if isinstance(keywords, str):
        keywords = [keywords]

    if not isinstance(keywords, list):
        return None

    list_body_qs = [Q(body__icontains=x) for x in keywords]
    list_subj_qs = [Q(subject__icontains=x) for x in keywords]
    final_q = reduce(operator.or_, list_body_qs + list_subj_qs)
    r_qs = blogentries.filter(final_q)
    return r_qs
</pre>
<p>The beginning of the function is pretty straightforward.  The interesting part is the latter half of the function, which uses Django&#8217;s database API and Python&#8217;s reduce function to dynamically create a Django query with all of the keywords in it.</p>
<p>First, build a couple lists of Q objects, one for each keyword and field.</p>
<pre class="brush:py">...
list_body_qs = [Q(body__icontains=x) for x in keywords]
list_subj_qs = [Q(subject__icontains=x) for x in keywords]
---</pre>
<p>Using Python&#8217;s reduce function, we glue all these Q objects together with <strong>operator.or_</strong>.</p>
<pre class="brush:py">...
final_q = reduce(operator.or_, list_body_qs + list_subj_qs)
r_qs = blogentries.filter(final_q)
return r_qs
---</pre>
<p>Essentially, you create a query similar to this:<br />
Q(body__icontains=&#8221;dog&#8221;) | Q(body__icontains=&#8221;cat&#8221;) | Q(body__icontains=&#8221;parrot&#8221;) &#8230;</p>
<p>If you wanted to perform an all-inclusive search (i.e. AND&#8217;ing the search terms together instead of OR&#8217;ing them), you&#8217;d use <strong>operator.and_</strong> instead of <strong>operator.or_</strong></p>
<h2>Finish</h2>
<p>And that&#8217;s it.  Just a few lines of code and you&#8217;ve got your own search function.  Leave a comment with your thoughts <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Unless you&#8217;re a spam bot)</p>
]]></content:encoded>
			<wfw:commentRss>http://w.holeso.me/2009/09/django-a-simple-keyword-search/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Simple Django Truncate Filter</title>
		<link>http://w.holeso.me/2008/08/a-simple-django-truncate-filter/</link>
		<comments>http://w.holeso.me/2008/08/a-simple-django-truncate-filter/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 17:30:06 +0000</pubDate>
		<dc:creator>proc</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Truncate]]></category>

		<guid isPermaLink="false">http://w.holeso.me/?p=38</guid>
		<description><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1047    3218980  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1047    3218980  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1047    3219136  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1048    3220072  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1048    3220100  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1056    3225672  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1142    3229896  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1142    3229924  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1047    3218980  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1047    3218980  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1047    3219136  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1048    3220072  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1048    3220100  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1056    3225672  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1142    3229896  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1142    3229924  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1145    3230100  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1146    3230400  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1147    3230752  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1047    3218980  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1047    3218980  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1047    3219136  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1048    3220072  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1048    3220100  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1056    3225672  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1142    3229896  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1142    3229924  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1047    3218980  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1047    3218980  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1047    3219136  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1048    3220072  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1048    3220100  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1056    3225672  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1142    3229896  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1142    3229924  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1157    3230328  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1157    3230628  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1158    3230980  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

The Problem: The built-in Django filter, truncate_words, truncates a string after a certain number of words.  This is great, but many times I find I have very tight space restrictions in certain areas of a page, and a string that is too long would push its way into another element and subsequently into my head [...]]]></description>
			<content:encoded><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1188    3219056  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1188    3219056  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1189    3221916  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1270    3227272  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1270    3227300  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1188    3219056  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1188    3219056  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1189    3221916  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1270    3227272  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1270    3227300  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1271    3227476  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1272    3227776  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1272    3228128  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1188    3219056  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1188    3219056  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1189    3221916  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1270    3227272  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1270    3227300  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1188    3219056  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1188    3219056  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1189    3221916  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1270    3227272  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1270    3227300  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1279    3227704  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1279    3228004  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1280    3228356  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

<h2>The Problem:</h2>
<p>The built-in Django filter, <a href="http://www.djangoproject.com/documentation/templates/#truncatewords" target="_blank">truncate_words</a>, truncates a string after a certain number of words.  This is great, but many times I find I have very tight space restrictions in certain areas of a page, and a string that is too long would push its way into another element and subsequently into my head in the form of a headache.</p>
<p>The built-in truncate_words filter is no help here &#8212; it does nothing to limit the width of a string.</p>
<p>I.e., &#8220;One two&#8221; and &#8220;ooooooooooooooooooooooooooonnnnnnnnnnnnnnneeeeeeeeeeeeee twoooooooooooooo&#8221; are both only 2 words, yet they have extremely different widths <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>The Solution:</h2>
<p>We need a filter that truncates not only by words, but by characters too.  It&#8217;s an extremely simple filter, and often times I wonder why it&#8217;s not included in Django.</p>
<p>Let&#8217;s start from the very beginning.  Every filter must live in your app&#8217;s templatetags directory.  So create a file in that directory named &#8220;truncate_filters.py&#8221; or something.  If you need any more information than that, take a look at the Django documentation on how to create a custom filter.</p>
<p>Here is what the filter looks like:<br />
<code></p>
<pre class="brush: python; title: ; notranslate">
from django import template
register = template.Library()

@register.filter(&quot;truncate_chars&quot;)
def truncate_chars(value, max_length):
    if len(value) &lt;= max_length:
        return value

    truncd_val = value[:max_length]
    if value[max_length] != &quot; &quot;:
        rightmost_space = truncd_val.rfind(&quot; &quot;)
        if rightmost_space != -1:
            truncd_val = truncd_val[:rightmost_space]

    return truncd_val + &quot;...&quot;
</pre>
<p></code><br />
*update* code was changed per chris and paul&#8217;s suggestions below, I haven&#8217;t tested but assume they work <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here&#8217;s how it works visually on this string: <em><strong>&#8220;This is a sample string&#8221;</strong></em><br />
This is what happens when the filter is supplied with the argument <strong>20</strong>:</p>
<ol>
<li>Cut down the string to 20 chars if it is greater than 20 chars in length.  The string now becomes: &#8220;This is a sample str&#8221;</li>
<li>Find the right-most space, indicating the start of the last word in the string, and truncate again:  The string is now: &#8220;This is a sample&#8221;</li>
<li>Add &#8220;&#8230;&#8221; and return.  &#8220;This is a sample&#8230;&#8221;</li>
</ol>
<p>You can invoke the filter from within your template like so:</p>
<pre class="brush: xml; title: ; notranslate">
{% load truncate_filters %}
&lt;ol&gt;
{% for some_string in a_list_of_strings %}
    &lt;li&gt;{{some_string|truncate_chars:50}}&lt;/li&gt;
{% endfor %}
&lt;/ol&gt;
</pre>
<p>Hope someone out there finds this helpful <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://w.holeso.me/2008/08/a-simple-django-truncate-filter/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The Day I Switched from Vista x64 to Ubuntu for Compatibility Reasons</title>
		<link>http://w.holeso.me/2008/08/the-day-i-switched-from-vista-x64-to-ubuntu-for-compatibility-reasons/</link>
		<comments>http://w.holeso.me/2008/08/the-day-i-switched-from-vista-x64-to-ubuntu-for-compatibility-reasons/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 05:19:22 +0000</pubDate>
		<dc:creator>proc</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Dell DJ]]></category>
		<category><![CDATA[Hardy Heron]]></category>

		<guid isPermaLink="false">http://w.holeso.me/?p=32</guid>
		<description><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1370    3245596  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1370    3245596  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1371    3245752  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1371    3246688  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1371    3246716  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1378    3252096  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1428    3256180  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1428    3256208  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1370    3245596  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1370    3245596  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1371    3245752  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1371    3246688  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1371    3246716  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1378    3252096  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1428    3256180  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1428    3256208  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1429    3256384  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1429    3256684  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1430    3257052  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1370    3245596  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1370    3245596  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1371    3245752  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1371    3246688  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1371    3246716  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1378    3252096  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1428    3256180  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1428    3256208  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1370    3245596  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1370    3245596  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1371    3245752  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1371    3246688  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1371    3246716  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1378    3252096  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1428    3256180  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1428    3256208  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1437    3256612  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1437    3256912  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1438    3257264  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

I&#8217;ve always been a fan of Linux.  Ever since I was barely 13ish years old I remember splurging up $1.50 to order a Red Hat Linux cd from linuxmall.com.  With all that said, I still never thought I&#8217;d see this day:  the day my recently purchased mp3 player, a Dell DJ 20gb, would not work [...]]]></description>
			<content:encoded><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1461    3245672  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1461    3245672  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1462    3248436  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1514    3252844  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1514    3252872  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1461    3245672  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1461    3245672  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1462    3248436  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1514    3252844  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1514    3252872  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1515    3253048  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1515    3253348  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1516    3253716  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1461    3245672  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1461    3245672  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1462    3248436  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1514    3252844  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1514    3252872  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1461    3245672  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1461    3245672  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1462    3248436  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1514    3252844  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1514    3252872  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1523    3253276  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1523    3253576  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1523    3253928  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

<div id="attachment_35" class="wp-caption aligncenter" style="width: 107px"><a href="http://w.holeso.me/wp-content/uploads/2008/08/delldj.jpeg"><img class="size-full wp-image-35" title="delldj" src="http://w.holeso.me/wp-content/uploads/2008/08/delldj.jpeg" alt="Dell crap-j" width="97" height="150" /></a><p class="wp-caption-text">Dell crap-j</p></div>
<p>I&#8217;ve always been a fan of Linux.  Ever since I was barely 13ish years old I remember splurging up $1.50 to order a Red Hat Linux cd from linuxmall.com.  With all that said, I still never thought I&#8217;d see this day:  the day my recently purchased mp3 player, a Dell DJ 20gb, would not work on Windows but worked perfectly fine on Linux.  Here&#8217;s the story.</p>
<p>I recently came across a great deal on a Dell DJ.  Sure, I already own a few mp3 players, but a 20gb usb powered external hard drive which also happens to play mp3s all for 35 dollars seemed like a pretty good deal.  So I bought it.  When it arrived, I ripped it out of its box and hooked it up to one of my desktops, which runs Vista x64.  Up popped one of those infamous &#8220;Search for drivers&#8221; dialogs.  I gave it a shot.  It failed, of course.</p>
<p>But wait! All I really wanted to do was transfer music and files to it.  Maybe it was designed in such a way that I could just copy mp3s over to it like an external hard drive (after all, the Dell DJ is actually made by Creative which produces the Muvo).  Well, needless to say, that didn&#8217;t pan out.  I could transfer files to it, but there was no &#8220;Music&#8221; folder in sight.  I saw that Dell took the same approach as Apple &#8212; Dell Dj Explorer being the equivalent to Apple Itunes.  Pure crap.</p>
<p>Popping in the included drivers disc didn&#8217;t prove to be any help either.  The drivers would not install.  I turned to the internet for help, but was immediately discouraged after finding that the last time Dell updated the drivers for this device was in 2005.  Wow.</p>
<p>Then the unthinkable happened.  The <a title="Dell DJ entry" href="http://en.wikipedia.org/wiki/Dell_Digital_Jukebox" target="_blank">Dell DJ entry</a> on Wikipedia noted that there were a couple Linux programs that could do the job: gnomad2 and neutrino.  Sure enough, I pulled out my laptop, which runs Ubuntu: Hardy Heron, and plugged in the Dell crap-jay.  After a quick &#8220;sudo apt-get install gnomad2&#8243;, I was happily transferring my small music collection over to the device.  Awesome.</p>
<p>I&#8217;m not sure if my situation was a special case or not.  A popular device (as popular as can be in the IPod saturated mp3 player market) compatible with Linux and not Windows?  Who woulda thunk it? Not me.</p>
]]></content:encoded>
			<wfw:commentRss>http://w.holeso.me/2008/08/the-day-i-switched-from-vista-x64-to-ubuntu-for-compatibility-reasons/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>The Dark Side of Code Commenting</title>
		<link>http://w.holeso.me/2008/08/the-dark-side-of-code-commenting/</link>
		<comments>http://w.holeso.me/2008/08/the-dark-side-of-code-commenting/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 06:02:43 +0000</pubDate>
		<dc:creator>proc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[comments]]></category>

		<guid isPermaLink="false">http://w.holeso.me/?p=24</guid>
		<description><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1597    3287892  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1597    3287892  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1597    3288048  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1598    3288984  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1598    3289012  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1602    3293556  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1659    3297768  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1659    3297796  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1597    3287892  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1597    3287892  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1597    3288048  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1598    3288984  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1598    3289012  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1602    3293556  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1659    3297768  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1659    3297796  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1660    3297972  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1661    3298272  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1661    3298640  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1597    3287892  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1597    3287892  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1597    3288048  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1598    3288984  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1598    3289012  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1602    3293556  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1659    3297768  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1659    3297796  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1597    3287892  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1597    3287892  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1597    3288048  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1598    3288984  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1598    3289012  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1602    3293556  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1659    3297768  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1659    3297796  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1668    3298200  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1669    3298500  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1669    3298852  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

Ever since the beginning of my journey to become a solid programmer, it was taught to me that commenting code was always a good thing.  You can never have enough comments, they would say.  The golden rule was to have at least an equal comments to code line ratio. All of this made sense to [...]]]></description>
			<content:encoded><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1708    3287968  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1708    3287968  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1709    3290316  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1769    3294528  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1769    3294556  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1708    3287968  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1708    3287968  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1709    3290316  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1769    3294528  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1769    3294556  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1771    3294732  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1771    3295032  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1771    3295384  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1708    3287968  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1708    3287968  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1709    3290316  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1769    3294528  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1769    3294556  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1708    3287968  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1708    3287968  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1709    3290316  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1769    3294528  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1769    3294556  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1778    3294960  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1778    3295260  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1778    3295612  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

<p>Ever since the beginning of my journey to become a solid programmer, it was taught to me that commenting code was always a good thing.  You can never have enough comments, they would say.  The golden rule was to have at least an equal comments to code line ratio.</p>
<p>All of this made sense to me back in college.  Nothing wrong with being too descriptive right?  Wrong! Sure, comments can be a great thing.  There&#8217;s nothing better than reading a comment that helps you understand some complex piece of code.  However, after working in the industry for awhile, I&#8217;ve seen the dark side of comments.</p>
<p>The other day, while working on one of many bugfixes, I came across an obfuscated piece of code.  Instead of diving into it and figuring out where each function/variable/whatever came from, I trusted a couple lines of comments above the code.  Thank god for comments, right!  Wrong again!  Apparently, whoever wrote that code wrote it over someone else&#8217;s code, but hadn&#8217;t updated the comment because he hadn&#8217;t noticed it.  So the comment was downright false.  A lie.  Imagine dealing with that all day.  Ever try to understand thousands of lines of code where some comments are leading you down the wrong path, like satan?</p>
<p>My thinking is, keep the comments to a minimum.  Instead of commenting excessively, try to write your code in such a way that it doesn&#8217;t *need* too many comments to understand.  Good code speaks for itself <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And don&#8217;t be lazy, always update the comments as needed as your code changes.  If you come across a useless one, throw it out&#8230; like a leper!</p>
<p>Because I&#8217;ve been getting some weird feedback on this post (my fault most likely, for being a professional programmer and not a writer), let me reiterate my point here&#8230;comments, when used appropriately, are a good thing! The key word is appropriately.  Don&#8217;t diarrhea all over your code.  It&#8217;s stinky.  And too many people do it.  When a developer sees a piece of code, he tries to understand.  When he reads a comment, he is inclined to believe it right off the bat.  So don&#8217;t mess with his head.  Get it?</p>
<p>Oh and hey, leave some &#8220;comments&#8221; below if you&#8217;ve had bad experiences too <img src='http://w.holeso.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://w.holeso.me/2008/08/the-dark-side-of-code-commenting/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Django: A Profanity Filter</title>
		<link>http://w.holeso.me/2008/08/django-a-profanity-filter/</link>
		<comments>http://w.holeso.me/2008/08/django-a-profanity-filter/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 23:30:32 +0000</pubDate>
		<dc:creator>proc</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Bad words]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Profanity]]></category>
		<category><![CDATA[Profanity Filter]]></category>

		<guid isPermaLink="false">http://w.holeso.me/?p=6</guid>
		<description><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1855    3308228  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1855    3308228  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1855    3308384  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1855    3309320  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1855    3309348  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1860    3313776  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1893    3317004  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1893    3317032  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1855    3308228  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1855    3308228  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1855    3308384  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1855    3309320  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1855    3309348  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1860    3313776  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1893    3317004  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1893    3317032  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1895    3317208  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1895    3317508  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1895    3317860  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1855    3308228  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1855    3308228  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1855    3308384  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1855    3309320  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1855    3309348  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1860    3313776  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1893    3317004  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1893    3317032  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1855    3308228  10. the_excerpt_rss() /var/www/wordpress/wp-includes/feed-rss2.php:46
    0.1855    3308228  11. get_the_excerpt() /var/www/wordpress/wp-includes/feed.php:176
    0.1855    3308384  12. apply_filters() /var/www/wordpress/wp-includes/post-template.php:272
    0.1855    3309320  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1855    3309348  14. wp_trim_excerpt() /var/www/wordpress/wp-includes/plugin.php:0
    0.1860    3313776  15. apply_filters() /var/www/wordpress/wp-includes/formatting.php:1852
    0.1893    3317004  16. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1893    3317032  17. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1902    3317436  18. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1902    3317736  19. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1903    3318088  20. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

The reason for it: There are often times when you would like to display content on your page that was actually submitted by another user, such as displaying a list of recent posts on your homepage or something.  The problem is that you don&#8217;t want to post any offensive material on such a prominent page.  [...]]]></description>
			<content:encoded><![CDATA[
Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 115

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1924    3308304  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1924    3308304  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1925    3310592  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1987    3314628  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1987    3314656  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1924    3308304  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1924    3308304  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1925    3310592  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1987    3314628  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1987    3314656  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1989    3314832  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:115
    0.1989    3315132  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1989    3315500  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466


Notice: Undefined variable: idmode in /var/www/wordpress/wp-content/themes/simpledark/functions.php on line 116

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1924    3308304  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1924    3308304  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1925    3310592  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1987    3314628  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1987    3314656  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0


Notice: the_author was called with an argument that is <strong>deprecated</strong> since version 1.5! Use <code>get_the_author()</code> instead if you do not want the value echoed. in /var/www/wordpress/wp-includes/functions.php on line 3466

Call Stack:
    0.0001     319072   1. {main}() /var/www/wordpress/index.php:0
    0.0002     319528   2. require('/var/www/wordpress/wp-blog-header.php') /var/www/wordpress/index.php:17
    0.0620    3152412   3. require_once('/var/www/wordpress/wp-includes/template-loader.php') /var/www/wordpress/wp-blog-header.php:16
    0.0633    3152724   4. do_feed() /var/www/wordpress/wp-includes/template-loader.php:14
    0.0633    3152884   5. do_action() /var/www/wordpress/wp-includes/functions.php:1784
    0.0633    3153948   6. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:405
    0.0633    3153976   7. do_feed_rss2() /var/www/wordpress/wp-includes/plugin.php:0
    0.0634    3154092   8. load_template() /var/www/wordpress/wp-includes/functions.php:1816
    0.0635    3164308   9. require_once('/var/www/wordpress/wp-includes/feed-rss2.php') /var/www/wordpress/wp-includes/theme.php:1114
    0.1924    3308304  10. the_content_feed() /var/www/wordpress/wp-includes/feed-rss2.php:48
    0.1924    3308304  11. get_the_content_feed() /var/www/wordpress/wp-includes/feed.php:164
    0.1925    3310592  12. apply_filters() /var/www/wordpress/wp-includes/feed.php:147
    0.1987    3314628  13. call_user_func_array() /var/www/wordpress/wp-includes/plugin.php:170
    0.1987    3314656  14. simpledark_feed_additional_info() /var/www/wordpress/wp-includes/plugin.php:0
    0.1996    3315060  15. the_author() /var/www/wordpress/wp-content/themes/simpledark/functions.php:116
    0.1996    3315360  16. _deprecated_argument() /var/www/wordpress/wp-includes/author-template.php:55
    0.1996    3315712  17. trigger_error() /var/www/wordpress/wp-includes/functions.php:3466

<h2>The reason for it:</h2>
<p>There are often times when you would like to display content on your page that was actually submitted by another user, such as displaying a list of recent posts on your homepage or something.  The problem is that you don&#8217;t want to post any offensive material on such a prominent page.  Without real live human moderation, the best we can do is strip out things we know are offensive (to most people anyway), such as bad words.  Here&#8217;s a profanity filter for Django I wrote using code mostly sheisted from django.core.validators.</p>
<h2>And here she is:</h2>
<p>Here&#8217;s what the filter looks like: (If you don&#8217;t know how to make a filter in Django, read the <a title="documentation" href="http://www.djangoproject.com/documentation/" target="_blank">documentation</a>)</p>
<pre class="brush: python; title: ; notranslate">
@register.filter(&quot;replace_bad_words&quot;)
def replace_bad_words(value):
    &quot;&quot;&quot; Replaces profanities in strings with safe words
    For instance, &quot;shit&quot; becomes &quot;s--t&quot;
    &quot;&quot;&quot;
    words_seen = [w for w in settings.PROFANITIES_LIST if w in value]
    if words_seen:
        for word in words_seen:
            value = value.replace(word, &quot;%s%s%s&quot; % (word[0], '-'*(len(word)-2), word[-1]))
    return value
</pre>
<h2>Some other things:</h2>
<p>Just throw that on a django template variable and it will replace words like &#8220;shit&#8221; with &#8220;s&#8211;t.&#8221; It won&#8217;t change words like &#8220;ass&#8221; and &#8220;dick&#8221; since they are technically not bad words&#8230; but if you think they are, you can do something like this:</p>
<pre class="brush: python; title: ; notranslate">
...
extra_bad_words = ['ass', 'dick']

bad_words = settings.PROFANITIES_LIST.extend(extra_bad_words)

words_seen = [w for w in bad_words if w in value]
...
</pre>
<p>Pretty useful huh?</p>
<p>Oh, one more thing to add &#8212; this filter depends on the profanities list that is included in Django.  To get this, make sure you import settings:</p>
<pre class="brush: python; title: ; notranslate">

from django.conf import settings
</pre>
<h2>That&#8217;s it.</h2>
<p>I know there are a lot of details missing.  I apologize.  If you make a comment here, I&#8217;ll be happy to help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://w.holeso.me/2008/08/django-a-profanity-filter/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

