<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>computers</title>
  <link rel="alternate" type="text/html" href="http://www.nekomancer.net/taxonomy/term/4"/>
  <link rel="self" type="application/atom+xml" href="http://www.nekomancer.net/taxonomy/term/4/atom/feed"/>
  <id>http://www.nekomancer.net/taxonomy/term/4/atom/feed</id>
  <updated>2008-03-28T19:31:30-05:00</updated>
  <entry>
    <title>RIP ISO</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/2008/04/02/rip-iso" />
    <id>http://www.nekomancer.net/blog/2008/04/02/rip-iso</id>
    <published>2008-04-02T06:27:45-05:00</published>
    <updated>2008-05-14T13:53:17-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>Today <a href="http://www.iso.org">ISO</a> approved the Open Office XML format as an ISO standard.</p>

<p>It&#8217;s always sad when i have to cut out an entry from my &#8216;respected authorities&#8217; list, and this time i have to do it with ISO. Now that i think about it, i never really followed whether ISO is a respectable authority or not,  but somehow, by default assumed it is. Maybe it never was.</p>

<p>There are several reasons why i don&#8217;t like Open Office XML, i will describe here some of them. please note, that i was unable to download the final version, that was accepted by ISO. all i could get was the one accepted by ECMA, and i assume they are similar. if not, please correct me in the comments.</p>

<ul>
<li>the spec contains attributes like autoSpaceLikeWord95 (section 2.15.3.6), which basically means that you have to do some formatting the same way as Word 95 does it.it is not specified how it should be done. so if someone wants to implement it, he should try it in Word 95?</li>
</ul>
    ]]></summary>
    <content type="html"><![CDATA[<p>Today <a href="http://www.iso.org">ISO</a> approved the Open Office XML format as an ISO standard.</p>

<p>It&#8217;s always sad when i have to cut out an entry from my &#8216;respected authorities&#8217; list, and this time i have to do it with ISO. Now that i think about it, i never really followed whether ISO is a respectable authority or not,  but somehow, by default assumed it is. Maybe it never was.</p>

<p>There are several reasons why i don&#8217;t like Open Office XML, i will describe here some of them. please note, that i was unable to download the final version, that was accepted by ISO. all i could get was the one accepted by ECMA, and i assume they are similar. if not, please correct me in the comments.</p>

<ul>
<li><p>the spec contains attributes like autoSpaceLikeWord95 (section 2.15.3.6), which basically means that you have to do some formatting the same way as Word 95 does it.it is not specified how it should be done. so if someone wants to implement it, he should try it in Word 95? in other words, only the company which has the source code for Word 95 can implement this feature correctly. OOXML proponents will probably point out, that the spec says that this attribute is deprecated and should not be used in new document. this is true. but, on the other hand, why is it in the spec at all? and even if it is deprecated, here is what will happen: Microsoft&#8217;s implementation will be able to read/write this correctly, and other implementations will not. and the customer will only see that in Microsoft&#8217;s program it works, but in an other program it does not work. that simple.</p></li>
<li><p>the spec is very inconsistent. uses different tags/namespaces/attributes for the same thing in different document-types. for example, see how to make the text bold and aligned to right in the various document-types (<a href="http://www.robweir.com/blog/2008/03/disharmony-of-ooxml.html">source</a>):</p></li>
</ul>

<table class="datagrid">
  <tbody>
      <tr><th>Format</th><th>Text Color</th><th>Text Alignment</th></tr>
      <tr><td>OOXML Text</td><td>&lt;w:color w:val=&#8221;FF0000&#8221;/&gt;</td><td>&lt;w:jc w:val=&#8221;right&#8221;/&gt;</td></tr>
      <tr><td>OOXML Sheet</td><td>&lt;color rgb=&#8221;FFFF0000&#8221;/&gt;</td><td>&lt;alignment horizontal=&#8221;right&#8221;/&gt;</td></tr>
      <tr><td>OOXML Presentation</td><td>&lt;a:srgbClr val=&#8221;FF0000&#8221;/&gt;</td><td>&lt;a:pPr algn=&#8221;r&#8221;/&gt;</td></tr>
      <tr>
        <td>ODF Text</td><td>&lt;style:text-properties fo:color=&#8221;#FF0000&#8221;/&gt;</td>
        <td>&lt;style:paragraph-properties fo:text-align=&#8221;end&#8221; /&gt;</td>
      </tr>
      <tr>
        <td>ODF Sheet</td><td>&lt;style:text-properties fo:color=&#8221;#FF0000&#8221;/&gt;</td>
        <td>&lt;style:paragraph-properties fo:text-align=&#8221;end&#8221;/&gt;</td>
      </tr>
      <tr>
        <td>ODF Presentation</td>
        <td>&lt;style:text-properties fo:color=&#8221;#FF0000&#8221;/&gt;</td>
        <td>&lt;style:paragraph-properties fo:text-align=&#8221;end&#8221;/&gt;</td>
      </tr>
    </tbody>
  </table>

<p>to clarify: i&#8217;m not sad because of the file-format. while the format is not perfect, imho it&#8217;s still much more open, than their binary-formats. the problem is ISO, not Microsoft. the fact that ISO accepted such a mess as a standard.</p>

<p>to read more, try <a href="http://www.noooxml.org/">http://www.noooxml.org/</a> or just google for <a href="http://www.google.sk/search?&amp;q=OOXML">OOXML</a> or for <a href="http://www.google.sk/search?&amp;q=autoSpaceLikeWord95">autoSpaceLikeWord95</a>.</p>
    ]]></content>
  </entry>
  <entry>
    <title>MySQL homepage vs. PostgreSQL homepage</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/2008/03/30/mysql-vs-postgresql-homepage" />
    <id>http://www.nekomancer.net/blog/2008/03/30/mysql-vs-postgresql-homepage</id>
    <published>2008-03-30T16:37:14-05:00</published>
    <updated>2008-03-30T16:53:40-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>I always used PostgreSQL, never MySQL. The reason was simply that at work first i had to work with PostgreSQL, and later i simply saw no reason to switch to MySQL. For me they both seem to offer pretty much the same functionality/performance these days.</p>

<p>But what i&#8217;d like to talk about here, is their home pages: <a href="http://www.mysql.com/">MySQL</a> and <a href="http://www.postgresql.org/">PostgreSQL</a>.</p>

<p>Most of time i work with open-source/free software, and i got used to the way their home pages are created/behave. and let me tell you this: if i would have to choose today between MySQL and PostgreSQL purely based on their home pages, i would never ever choose MySQL. Their  web page is just similar to the  usual full-of-bullshit commercial-product web pages, which i learned to hate. The only missing thing is the photo of some happy-guy-in-a-suit holding a copy of MySQL.</p>

<p>Or, let&#8217;s try a simple test: How fast can you find the download-link for the latest version of MySQL?</p>

<ul>
<li>with Postgresql, it&#8217;s right there on the home page, on the right side of the page.</li>
<li>with MySQL, the first download-like-thing you find is some 30-day-trial&#8230; (WHAT? A TRIAL? ISN&#8217;T THIS GPL???) . below i can either DISCOVER it, or TEST DRIVE it or LEARN it or read the WHAT&#8217;S NEW section&#8230; but no DOWNLOAD. well, but if you check more, you can find the small &#8216;download&#8217; link in the TEST DRIVE section. now you get to a new page, where they try very much to persuade me to buy a commercial version. but, if i prefer to do everything by myself, and accept that there will be no binary builds after every update/bugfix, i can download the free version</li>
</ul>

<p>i understand the reason for the piece-of-shit web page. MySQL is dual-licensed, there is a commercial version, and there is a company behind it that is trying to sell it. but the problem is that because of this, the &#8220;free&#8221; version is basically shown as a worse version. and that&#8217;s not the best way to look good to programmers using free/open-source software.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I always used PostgreSQL, never MySQL. The reason was simply that at work first i had to work with PostgreSQL, and later i simply saw no reason to switch to MySQL. For me they both seem to offer pretty much the same functionality/performance these days.</p>

<p>But what i&#8217;d like to talk about here, is their home pages: <a href="http://www.mysql.com/">MySQL</a> and <a href="http://www.postgresql.org/">PostgreSQL</a>.</p>

<p>Most of time i work with open-source/free software, and i got used to the way their home pages are created/behave. and let me tell you this: if i would have to choose today between MySQL and PostgreSQL purely based on their home pages, i would never ever choose MySQL. Their  web page is just similar to the  usual full-of-bullshit commercial-product web pages, which i learned to hate. The only missing thing is the photo of some happy-guy-in-a-suit holding a copy of MySQL.</p>

<p>Or, let&#8217;s try a simple test: How fast can you find the download-link for the latest version of MySQL?</p>

<ul>
<li>with Postgresql, it&#8217;s right there on the home page, on the right side of the page.</li>
<li>with MySQL, the first download-like-thing you find is some 30-day-trial&#8230; (WHAT? A TRIAL? ISN&#8217;T THIS GPL???) . below i can either DISCOVER it, or TEST DRIVE it or LEARN it or read the WHAT&#8217;S NEW section&#8230; but no DOWNLOAD. well, but if you check more, you can find the small &#8216;download&#8217; link in the TEST DRIVE section. now you get to a new page, where they try very much to persuade me to buy a commercial version. but, if i prefer to do everything by myself, and accept that there will be no binary builds after every update/bugfix, i can download the free version</li>
</ul>

<p>i understand the reason for the piece-of-shit web page. MySQL is dual-licensed, there is a commercial version, and there is a company behind it that is trying to sell it. but the problem is that because of this, the &#8220;free&#8221; version is basically shown as a worse version. and that&#8217;s not the best way to look good to programmers using free/open-source software.</p>
    ]]></content>
  </entry>
  <entry>
    <title>check if your site validates using your google sitemap</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/validate-using-sitemap" />
    <id>http://www.nekomancer.net/blog/archives/validate-using-sitemap</id>
    <published>2006-11-26T15:27:42-06:00</published>
    <updated>2008-03-28T19:34:54-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="django" />
    <category term="42" />
    <category term="computers" />
    <summary type="html"><![CDATA[<p>i was playing with the google sitemap (means i was activating the google sitemap support in <a href="http://www.djangoproject.com">django</a> :)</p>

<p>and then i had an idea&#8230; this sitemap basically describes all the urls of a site. with this, i could simply check all my urls on the w3 validator. automatically. every night, for example.</p>

<p>but this requires to be able to get some kind of machine-readable output from the w3 validator.</p>

<p>as it turns out, there are 2 ways:</p>

<ul>
<li>the normal validating url looks like : http://validator.w3.org/check?uri=[escaped url] .</li>
</ul>
    ]]></summary>
    <content type="html"><![CDATA[<p>i was playing with the google sitemap (means i was activating the google sitemap support in <a href="http://www.djangoproject.com">django</a> :)</p>

<p>and then i had an idea&#8230; this sitemap basically describes all the urls of a site. with this, i could simply check all my urls on the w3 validator. automatically. every night, for example.</p>

<p>but this requires to be able to get some kind of machine-readable output from the w3 validator.</p>

<p>as it turns out, there are 2 ways:</p>

<ul>
<li>the normal validating url looks like : http://validator.w3.org/check?uri=[escaped url] . if you add &#8220;&amp;output=soap12&#8221; to it, then it returns an xml file, which describes the validation results</li>
<li>regardless of the output-method (human-readable html, or machine-readable xml), the validator adds several custom headers to the http response. one of them is &#8220;x-w3c-validator-errors&#8221;, which returns the number of validation errors. if there are no errors, it&#8217;s zero.</li>
</ul>

<p>i decided to use the second approach, mostly because it&#8217;s simpler.</p>

<p>so i wrote a simple python script, that:</p>

<ol>
<li>fetches the sitemap file</li>
<li>submits every url in it to the validator, and extracts the validation-error-count.</li>
</ol>

<p>the script turned out to be very simple:</p>

<div class="geshifilter"><pre class="geshifilter-python"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib2</span> <span style="color: #ff7700;font-weight:bold;">import</span> urlopen
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">httplib</span> <span style="color: #ff7700;font-weight:bold;">import</span> HTTPConnection
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">urllib</span> <span style="color: #ff7700;font-weight:bold;">import</span> quote
<span style="color: #ff7700;font-weight:bold;">from</span> elementtree <span style="color: #ff7700;font-weight:bold;">import</span> ElementTree
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">time</span> <span style="color: #ff7700;font-weight:bold;">import</span> sleep
&nbsp;
SITEMAP_URL = <span style="color: #483d8b;">'http://nekomancer.net/sitemap.xml'</span>
VALIDATOR_URL = <span style="color: #483d8b;">'validator.w3.org'</span>
&nbsp;
LOC_LOCATION = <span style="color: #483d8b;">'{http://www.google.com/schemas/sitemap/0.84}url/{http://www.google.com/schemas/sitemap/0.84}loc'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_urls<span style="color: black;">&#40;</span>sitemap_url<span style="color: black;">&#41;</span>:
    c = urlopen<span style="color: black;">&#40;</span>sitemap_url<span style="color: black;">&#41;</span>
    data = c.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    c.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    tree = ElementTree.<span style="color: black;">fromstring</span><span style="color: black;">&#40;</span>data<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#91;</span>loc.<span style="color: black;">text</span>.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> loc <span style="color: #ff7700;font-weight:bold;">in</span> tree.<span style="color: black;">findall</span><span style="color: black;">&#40;</span>LOC_LOCATION<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_error_count<span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span>:
    c = HTTPConnection<span style="color: black;">&#40;</span>VALIDATOR_URL<span style="color: black;">&#41;</span>
    c.<span style="color: black;">request</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'HEAD'</span>,<span style="color: #483d8b;">'/check?uri=%s'</span> <span style="color: #66cc66;">%</span> quote<span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    r = c.<span style="color: black;">getresponse</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    c.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>r.<span style="color: black;">getheader</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'x-w3c-validator-errors'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
urls = get_urls<span style="color: black;">&#40;</span>SITEMAP_URL<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> url <span style="color: #ff7700;font-weight:bold;">in</span> urls:
    <span style="color: #ff7700;font-weight:bold;">print</span> get_error_count<span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span>,url
    sleep<span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span></pre></div>

<p>to parse the sitemap.xml i chose to use ElementTree, but i could have used also regular expressions, to match the <code>&lt;loc&gt;URL&lt;/loc&gt;</code> parts</p>
    ]]></content>
  </entry>
  <entry>
    <title>reasons to learn c</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/reasons-to-learn-c" />
    <id>http://www.nekomancer.net/blog/archives/reasons-to-learn-c</id>
    <published>2006-11-26T09:37:37-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>i found an <a href="http://www.jubling.com/ten-reasons-why-every-programmer-should-learn-c.html">article</a> using Digg, which gives ten reasons, why every programmer should learn C.</p>

<p>i personally think, that a programmer should learn C. it&#8217;s used in many areas, so it comes handy on such cases. but there&#8217;s no need to learn a lot of it. there&#8217;s no need imho to learn how to write complex programs in it. just learn the basic stuff (hello world, fibonacci, read/write files, basic string-manipulation, etc.).</p>

<p>but the arguments proposed in the article seem wrong/incomplete for me. well, some of them are mostly correct, some are half-correct, and some are plain wrong. generally the problem with it is that the author seems to have come from a C/C++/Java/C# world, so he completely ignores the rest (ruby, python, smalltalk, lisp, haskell, ocaml, erlang etc.)</p>

<p>so let&#8217;s look at the arguments:</p>

<blockquote>
  <p>1) C is lower level then other programming languages (C++, Java). Programming at a lower level allows you
  to further your understanding of computers, as a whole.</p>
</blockquote>

<p>this is correct, but if it is so, why don&#8217;t you learn assembler? it&#8217;s even lower lever than C.</p>

<p>></p>

<blockquote>
  <p>2) Device drivers and operating systems are written exclusively in C. Now, you may never write a device driver
  or an operating system, but what if you are ever required to modify one?</p>
</blockquote>

<p>while it&#8217;s correct that most of the operating systems are written in C, not all of them  (for example, <a href="http://programatica.cs.pdx.edu/House/">House</a> is an operating system written in haskell).</p>

<p>also, for a programmer there are usually a plenty of new technologies he can learn about, so he should always think about if it pays off or not.
and, well, for me, writing op-systems and device drivers does not seem that interesting.</p>

<p>></p>

<blockquote>
  <p>3) What if you ever want to get a job programming microcontrollers? They are programmed in C. Are you going
   to limit your possible list of jobs because you didn&#8217;t want to learn a new language?</p>
</blockquote>

<p>again, the same as #2. it depends on whether you&#8217;d like to program microcontrollers or not.</p>

<p>></p>

<blockquote>
  <p>4) C programs are smaller and faster then any other program created in a different language. Sometimes your program
   needs that speed boost that only C can give it.</p>
</blockquote>

<p>not true.</p>

<ul>
<li>if we follow his analogy (lower-level language means faster programs), then we can also say that Assembler is faster than C</li>
<li>on the other hand, the optimizers for higher-level languages are becoming faster and faster&#8230; like java&#8217;s Just In Time Compiler etc.
check for example <a href="http://shootout.alioth.debian.org/">The Computer Language Shootout</a>. you will see that the C solution is not
always the fastest (sometimes java is faster for example). of course, the C version is always very fast, no question there. but saying
that it&#8217;s always THE FASTEST, is wrong.</li>
</ul>

<p>></p>

<blockquote>
  <p>5) If you have learned C, you can learn any modern programming language. The reason behind this is that
  all modern programming languages are based on C (Java, C++, C#, etc).</p>
</blockquote>

<p>somehow the author of the article does not realise that using phrases with &#8220;all&#8221; is very dangerous. did he really check all the
obscure, niche programming languages and made sure that they are all based on C?</p>

<p>for example, i&#8217;m pretty sure <a href="http://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> is not. but to come back to &#8220;more mainstream&#8221; languages,
most of the functional ones (like <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=ocaml&amp;id=4">OCaml</a>, <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=ghc&amp;id=2">Haskell</a> or <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=sbcl&amp;id=2">Lisp</a> do not look like C programs at all (just btw: all 3 of the linked programs were <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=all_">faster</a>  in the binaryTree test than the C version :)</p>

<p>></p>

<blockquote>
  <p>6) Because C has been around for many years, it has a large community and collective code base.
  This allows you to quickly and efficiently implement new algorithms or functions that have been programmed before.</p>
</blockquote>

<p>ok</p>

<p>></p>

<blockquote>
  <p>7) C is the language of the Open Source community. The Open Source poster child, Linux, was coded in C.
  If you know C, you can participate in and contribute to numerous Open Source communities like Source Forge.</p>
</blockquote>

<p>all what he says here is true.
but, check this <a href="http://www.cs.berkeley.edu/~flab/languages.html">Source Forge statistics</a>:</p>

<p>the most used language on SF is (at least was at the point where it was measued in 2006) Java, followed by C++, followed by C. (and btw. check the &#8220;popularity&#8221; of C in the graph. see the sinking blue line? :)</p>

<p>in other words: while it&#8217;s true, that there are many C projects on SF, there are more java projects there.
so if you base your decision purely on SF-popularity, Java is a better choice.</p>

<blockquote>
  <p>8) C is the only language that teaches you what pointers really are. C# and Java skip the subject completely.
  It is pointers that give C its power.</p>
</blockquote>

<p>true.
but using this argument, i could say, that if you don&#8217;t use C, you don&#8217;t need to have/use/understand it&#8217;s power. so why bother with pointers?</p>

<p>for some strange reason, many people think that pointers are the most important concept in programming.
there are many other hard (imho much harder than pointers) areas in programming, like concurrency or distributed-programming.</p>

<p>></p>

<blockquote>
  <p>9) C is still the most commonly required language for programming jobs.
  It is well worth your time to get C under your belt.</p>
</blockquote>

<p>hmm.. i would like to see the statistics&#8230; i also cannot dig up a statistics currently, but if i remember correctly, visual-basic was also quite popular&#8230;
></p>

<blockquote>
  <p>10) Anything that has a microprocessor in it has support for C. From your microwave to your cell phone,
  C powers technology.</p>
</blockquote>

<p>how is this different from #3?</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>i found an <a href="http://www.jubling.com/ten-reasons-why-every-programmer-should-learn-c.html">article</a> using Digg, which gives ten reasons, why every programmer should learn C.</p>

<p>i personally think, that a programmer should learn C. it&#8217;s used in many areas, so it comes handy on such cases. but there&#8217;s no need to learn a lot of it. there&#8217;s no need imho to learn how to write complex programs in it. just learn the basic stuff (hello world, fibonacci, read/write files, basic string-manipulation, etc.).</p>

<p>but the arguments proposed in the article seem wrong/incomplete for me. well, some of them are mostly correct, some are half-correct, and some are plain wrong. generally the problem with it is that the author seems to have come from a C/C++/Java/C# world, so he completely ignores the rest (ruby, python, smalltalk, lisp, haskell, ocaml, erlang etc.)</p>

<p>so let&#8217;s look at the arguments:</p>

<blockquote>
  <p>1) C is lower level then other programming languages (C++, Java). Programming at a lower level allows you
  to further your understanding of computers, as a whole.</p>
</blockquote>

<p>this is correct, but if it is so, why don&#8217;t you learn assembler? it&#8217;s even lower lever than C.</p>

<p>></p>

<blockquote>
  <p>2) Device drivers and operating systems are written exclusively in C. Now, you may never write a device driver
  or an operating system, but what if you are ever required to modify one?</p>
</blockquote>

<p>while it&#8217;s correct that most of the operating systems are written in C, not all of them  (for example, <a href="http://programatica.cs.pdx.edu/House/">House</a> is an operating system written in haskell).</p>

<p>also, for a programmer there are usually a plenty of new technologies he can learn about, so he should always think about if it pays off or not.
and, well, for me, writing op-systems and device drivers does not seem that interesting.</p>

<p>></p>

<blockquote>
  <p>3) What if you ever want to get a job programming microcontrollers? They are programmed in C. Are you going
   to limit your possible list of jobs because you didn&#8217;t want to learn a new language?</p>
</blockquote>

<p>again, the same as #2. it depends on whether you&#8217;d like to program microcontrollers or not.</p>

<p>></p>

<blockquote>
  <p>4) C programs are smaller and faster then any other program created in a different language. Sometimes your program
   needs that speed boost that only C can give it.</p>
</blockquote>

<p>not true.</p>

<ul>
<li>if we follow his analogy (lower-level language means faster programs), then we can also say that Assembler is faster than C</li>
<li>on the other hand, the optimizers for higher-level languages are becoming faster and faster&#8230; like java&#8217;s Just In Time Compiler etc.
check for example <a href="http://shootout.alioth.debian.org/">The Computer Language Shootout</a>. you will see that the C solution is not
always the fastest (sometimes java is faster for example). of course, the C version is always very fast, no question there. but saying
that it&#8217;s always THE FASTEST, is wrong.</li>
</ul>

<p>></p>

<blockquote>
  <p>5) If you have learned C, you can learn any modern programming language. The reason behind this is that
  all modern programming languages are based on C (Java, C++, C#, etc).</p>
</blockquote>

<p>somehow the author of the article does not realise that using phrases with &#8220;all&#8221; is very dangerous. did he really check all the
obscure, niche programming languages and made sure that they are all based on C?</p>

<p>for example, i&#8217;m pretty sure <a href="http://en.wikipedia.org/wiki/Brainfuck">Brainfuck</a> is not. but to come back to &#8220;more mainstream&#8221; languages,
most of the functional ones (like <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=ocaml&amp;id=4">OCaml</a>, <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=ghc&amp;id=2">Haskell</a> or <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=sbcl&amp;id=2">Lisp</a> do not look like C programs at all (just btw: all 3 of the linked programs were <a href="http://shootout.alioth.debian.org/gp4/benchmark.php?test=binarytrees&amp;lang=all_">faster</a>  in the binaryTree test than the C version :)</p>

<p>></p>

<blockquote>
  <p>6) Because C has been around for many years, it has a large community and collective code base.
  This allows you to quickly and efficiently implement new algorithms or functions that have been programmed before.</p>
</blockquote>

<p>ok</p>

<p>></p>

<blockquote>
  <p>7) C is the language of the Open Source community. The Open Source poster child, Linux, was coded in C.
  If you know C, you can participate in and contribute to numerous Open Source communities like Source Forge.</p>
</blockquote>

<p>all what he says here is true.
but, check this <a href="http://www.cs.berkeley.edu/~flab/languages.html">Source Forge statistics</a>:</p>

<p>the most used language on SF is (at least was at the point where it was measued in 2006) Java, followed by C++, followed by C. (and btw. check the &#8220;popularity&#8221; of C in the graph. see the sinking blue line? :)</p>

<p>in other words: while it&#8217;s true, that there are many C projects on SF, there are more java projects there.
so if you base your decision purely on SF-popularity, Java is a better choice.</p>

<blockquote>
  <p>8) C is the only language that teaches you what pointers really are. C# and Java skip the subject completely.
  It is pointers that give C its power.</p>
</blockquote>

<p>true.
but using this argument, i could say, that if you don&#8217;t use C, you don&#8217;t need to have/use/understand it&#8217;s power. so why bother with pointers?</p>

<p>for some strange reason, many people think that pointers are the most important concept in programming.
there are many other hard (imho much harder than pointers) areas in programming, like concurrency or distributed-programming.</p>

<p>></p>

<blockquote>
  <p>9) C is still the most commonly required language for programming jobs.
  It is well worth your time to get C under your belt.</p>
</blockquote>

<p>hmm.. i would like to see the statistics&#8230; i also cannot dig up a statistics currently, but if i remember correctly, visual-basic was also quite popular&#8230;
></p>

<blockquote>
  <p>10) Anything that has a microprocessor in it has support for C. From your microwave to your cell phone,
  C powers technology.</p>
</blockquote>

<p>how is this different from #3?</p>
    ]]></content>
  </entry>
  <entry>
    <title>java kiss</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/java-kiss" />
    <id>http://www.nekomancer.net/blog/archives/java-kiss</id>
    <published>2006-11-21T15:42:49-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>there&#8217;s a certain intrinsic beauty in simple solutions. it&#8217;s also known as the <a href="http://en.wikipedia.org/wiki/KISS_principle">KISS (Keep It Simple, Stupid)  principle</a>.</p>

<p>let me present you java, the programming language:</p>

<ul>
<li>the subversion repository is at: https://openjdk.dev.java.net/svn/openjdk/trunk , username guest, no password.</li>
<li>the license is GPLv2.</li>
</ul>

<p>enjoy.</p>

<p>ps1: to be fair, there are still some (hopefully temporary) <a href="http://www.sun.com/software/opensource/java/faq.jsp#h">blurry parts</a>. but the rest is simple. i do not develop in java anymore (switched to python), but i can only admire the elegance of how SUN managed to open-source java. no tricky licenses, no obscure ways to get the code. i&#8217;m sure for the visual-C++ developing slaves of the microsoft world this seems alien and discomforting. but for the rest of us, it&#8217;s a piece of elegance.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>there&#8217;s a certain intrinsic beauty in simple solutions. it&#8217;s also known as the <a href="http://en.wikipedia.org/wiki/KISS_principle">KISS (Keep It Simple, Stupid)  principle</a>.</p>

<p>let me present you java, the programming language:</p>

<ul>
<li>the subversion repository is at: https://openjdk.dev.java.net/svn/openjdk/trunk , username guest, no password.</li>
<li>the license is GPLv2.</li>
</ul>

<p>enjoy.</p>

<p>ps1: to be fair, there are still some (hopefully temporary) <a href="http://www.sun.com/software/opensource/java/faq.jsp#h">blurry parts</a>. but the rest is simple. i do not develop in java anymore (switched to python), but i can only admire the elegance of how SUN managed to open-source java. no tricky licenses, no obscure ways to get the code. i&#8217;m sure for the visual-C++ developing slaves of the microsoft world this seems alien and discomforting. but for the rest of us, it&#8217;s a piece of elegance.</p>
    ]]></content>
  </entry>
  <entry>
    <title>back from dreamhost</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/back-from-dreamhost" />
    <id>http://www.nekomancer.net/blog/archives/back-from-dreamhost</id>
    <published>2006-11-17T15:48:38-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>in an <a href="/blog/archives/switching-to-dreamhost">older post</a> i wrote that i switched to dreamhost for my website.</p>

<p>and ..hmmm&#8230;, now i&#8217;m back :)</p>

<p>why? it&#8217;s hard to say&#8230; first thing is&#8230; you have to understand, is that this whole domain-moving is more like playing/experimenting&#8230; because currently i am not using any extra features&#8230;so all the argumens pro/contra the hosting-change are in the &#8220;what if&#8221; category.</p>

<p>so, i&#8217;m back to my old hosting for now. it does not mean i close my dreamhost account.. it&#8217;s still valid for some months&#8230; so ..who knows :)</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>in an <a href="/blog/archives/switching-to-dreamhost">older post</a> i wrote that i switched to dreamhost for my website.</p>

<p>and ..hmmm&#8230;, now i&#8217;m back :)</p>

<p>why? it&#8217;s hard to say&#8230; first thing is&#8230; you have to understand, is that this whole domain-moving is more like playing/experimenting&#8230; because currently i am not using any extra features&#8230;so all the argumens pro/contra the hosting-change are in the &#8220;what if&#8221; category.</p>

<p>so, i&#8217;m back to my old hosting for now. it does not mean i close my dreamhost account.. it&#8217;s still valid for some months&#8230; so ..who knows :)</p>
    ]]></content>
  </entry>
  <entry>
    <title>semantic porn?</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/semantic-porn" />
    <id>http://www.nekomancer.net/blog/archives/semantic-porn</id>
    <published>2006-11-14T17:12:19-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>the <a href="http://en.wikipedia.org/wiki/Semantic_web">semantic web</a> always interested me. i&#8217;ve read the tutorials on RDF and N3, i even bought a book about it.</p>

<p>but somehow i cannot see how it could help me currently. don&#8217;t get me wrong, i understand it&#8217;s benefits (making the web machine-readable). but i don&#8217;t see any PRACTICAL applications of this technology currently. nevertheless, i&#8217;m always willing to try out new toys in this field.</p>

<p>today i&#8217;ve read a <a href="http://fgiasson.com/blog/index.php/2006/11/14/how_to_participate_to_the_web_3_0_using">blog post about using semantic-web-stuff on your blog</a>. so i immediately decided to try it out.</p>

<p>there was a wordpress plugin recommended, which i installed.</p>

<p>the plugin simply generates some machine-readable about your blog posts in <a href="http://sioc-project.org/">SIOC</a> format.</p>

<p>additionally, after you have set it up, and so you have SIOC data available about your blog, you can notify about your blog posts the <a href="http://pingthesemanticweb.com/">Ping the Semantic Web</a> service, which seems to be a semantic-data indexing/searching system. (this notification can happen automatically by wordpress, if you decide so).</p>

<p>on the <a href="http://pingthesemanticweb.com/">Ping the Semantic Web</a> site, they list the recently updated RDF documents.</p>

<p>and what did i find there? <a href="http://galleries.penthouse.com/labels.rdf">http://galleries.penthouse.com/labels.rdf</a> :)</p>

<p>yes, a link to an RDF document at Penthouse&#8217;s website. i must admit, i was surprised. what do they have to do with RDF? so i went to http://galleries.penthouse.com, which redirected me to http://www.penthouse.com. by checking the source code of the page, i found that they indeed link to an rdf document</p>

<pre></pre>

<p>.</p>

<p>ICRA seems to be a content-rating organization. they have a <a href="http://www.icra.org/label/generator/">web-based questionnaire</a>, which supposedly (info from wikipedia) generates an RDF file, which then describes the rating of the site&#8217;s content, which you can link from your website. the rating seems to be focused on the parental-control aspect.</p>

<p>it was certainly surprising/refreshing to see that one of the early-adopters of the semantic-web technology is a porn site :)</p>

<p>(maybe these porn sites must include some kind of rating/parental-control stuff, i don&#8217;t know. i checked www.playboy.com, and they did not link to any rdf documents&#8230;. )</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>the <a href="http://en.wikipedia.org/wiki/Semantic_web">semantic web</a> always interested me. i&#8217;ve read the tutorials on RDF and N3, i even bought a book about it.</p>

<p>but somehow i cannot see how it could help me currently. don&#8217;t get me wrong, i understand it&#8217;s benefits (making the web machine-readable). but i don&#8217;t see any PRACTICAL applications of this technology currently. nevertheless, i&#8217;m always willing to try out new toys in this field.</p>

<p>today i&#8217;ve read a <a href="http://fgiasson.com/blog/index.php/2006/11/14/how_to_participate_to_the_web_3_0_using">blog post about using semantic-web-stuff on your blog</a>. so i immediately decided to try it out.</p>

<p>there was a wordpress plugin recommended, which i installed.</p>

<p>the plugin simply generates some machine-readable about your blog posts in <a href="http://sioc-project.org/">SIOC</a> format.</p>

<p>additionally, after you have set it up, and so you have SIOC data available about your blog, you can notify about your blog posts the <a href="http://pingthesemanticweb.com/">Ping the Semantic Web</a> service, which seems to be a semantic-data indexing/searching system. (this notification can happen automatically by wordpress, if you decide so).</p>

<p>on the <a href="http://pingthesemanticweb.com/">Ping the Semantic Web</a> site, they list the recently updated RDF documents.</p>

<p>and what did i find there? <a href="http://galleries.penthouse.com/labels.rdf">http://galleries.penthouse.com/labels.rdf</a> :)</p>

<p>yes, a link to an RDF document at Penthouse&#8217;s website. i must admit, i was surprised. what do they have to do with RDF? so i went to http://galleries.penthouse.com, which redirected me to http://www.penthouse.com. by checking the source code of the page, i found that they indeed link to an rdf document</p>

<pre></pre>

<p>.</p>

<p>ICRA seems to be a content-rating organization. they have a <a href="http://www.icra.org/label/generator/">web-based questionnaire</a>, which supposedly (info from wikipedia) generates an RDF file, which then describes the rating of the site&#8217;s content, which you can link from your website. the rating seems to be focused on the parental-control aspect.</p>

<p>it was certainly surprising/refreshing to see that one of the early-adopters of the semantic-web technology is a porn site :)</p>

<p>(maybe these porn sites must include some kind of rating/parental-control stuff, i don&#8217;t know. i checked www.playboy.com, and they did not link to any rdf documents&#8230;. )</p>
    ]]></content>
  </entry>
  <entry>
    <title>switching to dreamhost</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/switching-to-dreamhost" />
    <id>http://www.nekomancer.net/blog/archives/switching-to-dreamhost</id>
    <published>2006-11-12T07:53:50-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>i&#8217;m currently in the middle of switching to <a href="http://www.dreamhost.com">dreamhost</a>.</p>

<p>currently i&#8217;m waiting for the DNS servers to update their data, but basically: if you see this post, then you are seeing my blog already on dreamhost.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>i&#8217;m currently in the middle of switching to <a href="http://www.dreamhost.com">dreamhost</a>.</p>

<p>currently i&#8217;m waiting for the DNS servers to update their data, but basically: if you see this post, then you are seeing my blog already on dreamhost.</p>
    ]]></content>
  </entry>
  <entry>
    <title>blog updates</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/blog-updates" />
    <id>http://www.nekomancer.net/blog/archives/blog-updates</id>
    <published>2006-11-03T18:31:03-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="computers" />
    <summary type="html"><![CDATA[<p>i changed some things on my blog, i hope it works better now:</p>

<ul>
<li>i upgraded my spam-filter ( <a href="http://www.homelandstupidity.us/software/bad-behavior/">Bad Behavior</a> ) to it&#8217;s newest version.

<ul>
<li>the reason was that suddenly i was unable to log-in to my blog-admin. i got an error 412 (Precondition failed). phew, i had no idea what that error means (i still don&#8217;t have :-), but after some googling i found out that it&#8217;s Bad Behavior&#8217;s fault. after an upgrade, it works fine.</li>
<li>btw. if someone cares to comment&#8230; which wordpress smap-filter-plugins are usable? Akismet?</li>
</ul></li>
<li>disabled the page-caching in wordpress (wp-cache). the caching itself worked fine, but it removed a lot of response-headers (Content-type, for example).

<ul>
<li>this is how a respone looks like without wp-cache:</li>
</ul></li>
</ul>

<pre>
    HTTP/1.1 200 OK
    Date: Sat, 04 Nov 2006 00:21:35 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.4-pl6-gentoo with Hardening-Patch
    X-Pingback: http://www.nekomancer.net/blog/xmlrpc.php
    ETag: "ebbfe181885d8db233d59464b69d0389"
    Set-Cookie: bb2_screener_=1162599696+217.67.16.60; path=/blog/
    Last-Modified: Wed, 01 Nov 2006 23:50:08 GMT
    Content-Type: application/atom+xml; charset=UTF-8
    </pre>

<ul>
<li>and this is a response using wp-cache:</li>
</ul>

<pre>
    HTTP/1.1 200 OK
    Date: Sat, 04 Nov 2006 00:22:15 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.4-pl6-gentoo with Hardening-Patch
    Content-Type: text/html
    </pre>

<ul>
<li>the comments can now be previewed using a nice ajax-using plugin ( <a href="http://blog.chweng.idv.tw/wordpress/ajaxified-comment-preview/">Ajaxified Comment Preview</a> )</li>
</ul>
    ]]></summary>
    <content type="html"><![CDATA[<p>i changed some things on my blog, i hope it works better now:</p>

<ul>
<li>i upgraded my spam-filter ( <a href="http://www.homelandstupidity.us/software/bad-behavior/">Bad Behavior</a> ) to it&#8217;s newest version.

<ul>
<li>the reason was that suddenly i was unable to log-in to my blog-admin. i got an error 412 (Precondition failed). phew, i had no idea what that error means (i still don&#8217;t have :-), but after some googling i found out that it&#8217;s Bad Behavior&#8217;s fault. after an upgrade, it works fine.</li>
<li>btw. if someone cares to comment&#8230; which wordpress smap-filter-plugins are usable? Akismet?</li>
</ul></li>
<li>disabled the page-caching in wordpress (wp-cache). the caching itself worked fine, but it removed a lot of response-headers (Content-type, for example).

<ul>
<li>this is how a respone looks like without wp-cache:</li>
</ul></li>
</ul>

<pre>
    HTTP/1.1 200 OK
    Date: Sat, 04 Nov 2006 00:21:35 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.4-pl6-gentoo with Hardening-Patch
    X-Pingback: http://www.nekomancer.net/blog/xmlrpc.php
    ETag: "ebbfe181885d8db233d59464b69d0389"
    Set-Cookie: bb2_screener_=1162599696+217.67.16.60; path=/blog/
    Last-Modified: Wed, 01 Nov 2006 23:50:08 GMT
    Content-Type: application/atom+xml; charset=UTF-8
    </pre>

<ul>
<li>and this is a response using wp-cache:</li>
</ul>

<pre>
    HTTP/1.1 200 OK
    Date: Sat, 04 Nov 2006 00:22:15 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.4-pl6-gentoo with Hardening-Patch
    Content-Type: text/html
    </pre>

<ul>
<li>the comments can now be previewed using a nice ajax-using plugin ( <a href="http://blog.chweng.idv.tw/wordpress/ajaxified-comment-preview/">Ajaxified Comment Preview</a> )</li>
</ul>
    ]]></content>
  </entry>
  <entry>
    <title>feeds and time</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/feeds-and-time" />
    <id>http://www.nekomancer.net/blog/archives/feeds-and-time</id>
    <published>2006-11-01T17:50:08-06:00</published>
    <updated>2008-03-28T19:31:30-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="django" />
    <category term="computers" />
    <summary type="html"><![CDATA[<p>i use a lot of rss/atom feeds. by use i mean that i am reading many news-sites, blogs, etc. using their feeds.</p>

<p>for some reason those feeds always contain the last <em>n</em> entries, where <em>n</em> is a fixed number.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>i use a lot of rss/atom feeds. by use i mean that i am reading many news-sites, blogs, etc. using their feeds.</p>

<p>for some reason those feeds always contain the last <em>n</em> entries, where <em>n</em> is a fixed number. so a feed contains let&#8217;s say the last 10 entries.</p>

<p>this is fine as long as the page (which is represented in the feed) does not get updated too often.</p>

<p>otherwise the following scenario might happen:</p>

<ul>
<li>let&#8217;s say the feed contains the last 10 entries</li>
<li>and you fetch the feed once a day using your feed-reader program</li>
<li>now, for some reason, one day there will be 11 new entries</li>
<li>when you fetch the feed next day, only the last 10 entries will be in the feed</li>
<li>so you missed one article on that website</li>
</ul>

<p>the problem is, that these feeds do not provide any guarantees about their &#8220;completeness&#8221;.</p>

<p>(this is not an &#8220;in theory only&#8221; problem. once i had this exact problem.a website&#8217;s feed only contained the last x (50, iirc) entries, and much more arrived daily. so i kept missing them, and if i wanted to be sure that i saw all of them, i had to manually go through the entries on the site. kind of defeats the purpose of the feed. nowadays i&#8217;m using <a href="http://www.bloglines.com">bloglines</a>, which is fetching the feeds a lot more often than i did, so i do not have the problem with that site anymore)</p>

<p>what i would like to see, is feeds that contain all the entries for a specified timeframe.for example for the last 48 hours. they can contain of course more entries, but they would have to guarantee, that they contain at least all the entries for the last 48 hours. which would mean, that if you fetch the feed daily, you will not miss any entries.</p>

<p>for example, let&#8217;s do it in <a href="http://www.djangoproject.com">django</a>:</p>

<p>django contains a complete feed-framework, with documentation, so first go and <a href="http://www.djangoproject.com/documentation/syndication/">read the documentation</a></p>

<p>as you see, the whole issue of &#8220;showing the last n entries&#8221; is being handled in the <a href="http://www.djangoproject.com/documentation/syndication/#feed-classes">items() method</a>:</p>

<p>(the example from the documentation)</p>

<div class="geshifilter"><pre class="geshifilter-python"><span style="color: #ff7700;font-weight:bold;">def</span> items<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> NewsItem.<span style="color: black;">objects</span>.<span style="color: black;">order_by</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-pub_date'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:<span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span></pre></div>

<p>we want to return at least 10 entries, and we want to make sure that we return all the entries for the last 48 hours.</p>

<p>so we could use something like this:</p>

<div class="geshifilter"><pre class="geshifilter-python"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">datetime</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>, timedelta
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> items<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
    entries = NewsItem.<span style="color: black;">objects</span>.<span style="color: black;">order_by</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-pub_date'</span><span style="color: black;">&#41;</span>
    two_days_ago = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - timedelta<span style="color: black;">&#40;</span>days=<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
    last_entries = entries.<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>pub_date__gte = two_days_ago<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> last_entries.<span style="color: black;">count</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span>= <span style="color: #ff4500;">10</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> last_entries
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> entries<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">10</span><span style="color: black;">&#93;</span></pre></div>

<p>and we&#8217;re done.</p>

<p>now if only i could find out how to do it in wordpress (this blog is running on it)</p>

<p>P.S: the code i showed here was not tested extensively, so it might contain bugs. but the basic idea should work.</p>
    ]]></content>
  </entry>
</feed>
