<?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>David&#039;s Ramblings &#187; regular</title>
	<atom:link href="http://david.davidandpenelope.com/category/regular/feed/" rel="self" type="application/rss+xml" />
	<link>http://david.davidandpenelope.com</link>
	<description>Thoughts on programming languages, interesting blurbs that I read, things I learn in school, and details about stuff I&#039;m working on.</description>
	<lastBuildDate>Mon, 30 May 2011 16:55:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>XBRL</title>
		<link>http://david.davidandpenelope.com/2010/07/09/xbrl/</link>
		<comments>http://david.davidandpenelope.com/2010/07/09/xbrl/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 16:49:21 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://david.davidandpenelope.com/?p=632117669</guid>
		<description><![CDATA[The XBRL spec will put you to sleep. In any case, I&#8217;m making an XBRL parser in ruby. Yeah, we already have xbrlware community edition, but it&#8217;s artificially limited and I didn&#8217;t want that, so I&#8217;m building my own. Also, xbrlware represents the entire taxonomy as a Ruby class. I am going to make mine a little [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.xbrl.org/Specification/XBRL-RECOMMENDATION-2003-12-31+Corrected-Errata-2008-07-02.htm">XBRL</a> spec will put you to sleep. In any case, I&#8217;m making an XBRL parser in ruby. Yeah, we already have xbrlware community edition, but it&#8217;s artificially limited and I didn&#8217;t want that, so I&#8217;m building my own. Also, xbrlware represents the entire taxonomy as a Ruby class. I am going to make mine a little more generic than that.</p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2010/07/09/xbrl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://david.davidandpenelope.com/2010/04/17/527634784/</link>
		<comments>http://david.davidandpenelope.com/2010/04/17/527634784/#comments</comments>
		<pubDate>Sat, 17 Apr 2010 07:03:28 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/527634784</guid>
		<description><![CDATA[You might&#8217;ve heard about the CAP Theorem. It says that when building a distributed system, you&#8217;d like to guarantee 3 properties &#8211; Consistency, Availability, and Partition Tolerance &#8211; but that you have to pick two, because you can&#8217;t have all three at the same time. Today I&#8217;ve invented DRC Theorem™. Dog Rain (and therefore mud, [...]]]></description>
			<content:encoded><![CDATA[<p>You might&#8217;ve heard about the <a href="http://en.wikipedia.org/wiki/CAP_theorem">CAP Theorem</a>. It says that when building a distributed system, you&#8217;d like to guarantee 3 properties &#8211; Consistency, Availability, and Partition Tolerance &#8211; but that you have to pick two, because you can&#8217;t have all three at the same time.</p>
<p>Today I&#8217;ve invented DRC Theorem™.</p>
<ol>
<li>Dog</li>
<li>Rain (and therefore mud, at least in Lubbock)</li>
<li>Clean Carpet</li>
</ol>
<p>Pick two. You can&#8217;t have all three at the same time.</p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2010/04/17/527634784/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://david.davidandpenelope.com/2009/11/14/243302050/</link>
		<comments>http://david.davidandpenelope.com/2009/11/14/243302050/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:02:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/243302050</guid>
		<description><![CDATA[It&#8217;s important to note that the prototype is &#8220;live&#8221;. Objects are passed by reference in JavaScript, and therefore the prototype is not copied with every new object instance. What does this mean in practice? It means that you can modify the prototype at any time and all objects (even those created before the modification) will [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s important to note that the prototype is &#8220;live&#8221;. Objects are passed by reference in JavaScript, and therefore <b>the prototype is not copied with every new object instance</b>. What does this mean in practice? It means that you can modify the prototype at any time and all objects (even those created before the modification) will inherit the changes.</p>
<p>&#8212; <a href="http://www.packtpub.com/article/using-prototype-property-in-javascript">Using Prototype Property in JavaScript</a></p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/11/14/243302050/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>To Over-Engineer is Human</title>
		<link>http://david.davidandpenelope.com/2009/11/07/235769772/</link>
		<comments>http://david.davidandpenelope.com/2009/11/07/235769772/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 07:41:40 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/235769772</guid>
		<description><![CDATA[The title is a play off of a book named To Engineer is Human and it seems especially true among software developers. As an example of over-engineering, imagine a civil engineer, who needing to build a bridge, builds a bridge-building machine, and then being unsatisfied that the bridge-building machine can only build one type of bridge, [...]]]></description>
			<content:encoded><![CDATA[<p>The title is a play off of a book named <a href="http://www.amazon.com/Engineer-Human-Failure-Successful-Design/dp/0679734163">To Engineer is Human</a> and it seems especially true among software developers.</p>
<p>As an example of over-engineering, imagine a civil engineer, who needing to build a bridge, builds a bridge-building machine, and then being unsatisfied that the bridge-building machine can only build one type of bridge, then sets out to build a bridge-building machine generator (i.e. a machine that produces bridge-building machines).</p>
<p>I did that recently; not the bridge builder, but the software equivalent.</p>
<p>I&#8217;ve been working on a user interface prototype for my stock screening application. Since it&#8217;s a web-app, the UI (i.e. user interface) code is all in JavaScript. JavaScript doesn&#8217;t have a traditional class system like other object-oriented languages, so I set out to build one.</p>
<p>I built one that was built upon another JavaScript library called <a href="http://www.extjs.com">ExtJS</a>. The system worked, but I wasn&#8217;t satisfied because my class system wasn&#8217;t as simple to use as the class system that John Resig <a href="http://ejohn.org/blog/simple-javascript-inheritance/">recently released</a>. So, I&#8217;ve been thinking and experimenting with different ways of building class systems, because I don&#8217;t want just any old class system, I want the easiest, fastest, smallest, best JavaScript class system.</p>
<p>What I came up with is hideously complex and it took me hours to code and debug.</p>
<p>Fast-forward to yesterday. Google released a <a href="http://googlecode.blogspot.com/2009/11/introducing-closure-tools.html">javascript library</a> that looks very nice, is simple to use, is very well documented, and is proven (on properties such as gmail.com, Google Calendar, and other google apps). So I  think I&#8217;m going to scrap the complex class system and instead go back to something more JavaScript-esque, and simple to use, and use it along with Google&#8217;s javascript library.</p>
<p>Hopefully I can keep from over-engineering this thing again. I&#8217;m going for simplicity and minimalism this time.</p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/11/07/235769772/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhD</title>
		<link>http://david.davidandpenelope.com/2009/06/02/116973121/</link>
		<comments>http://david.davidandpenelope.com/2009/06/02/116973121/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 21:05:22 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/116973121</guid>
		<description><![CDATA[Today I talked with my advisor again about the PhD program. I think this is the strongest I&#8217;ve felt about pursuing the PhD. It turns out that my master&#8217;s thesis is going to be a comparison of stock trading strategy simulator implementations&#8212;one written in C++, and one written in SequenceL.]]></description>
			<content:encoded><![CDATA[<p>Today I talked with my advisor again about the PhD program. I think this is the strongest I&#8217;ve felt about pursuing the PhD.</p>
<p>It turns out that my master&#8217;s thesis is going to be a comparison of stock trading strategy simulator implementations&#8212;one written in C++, and one written in SequenceL.</p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/06/02/116973121/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Euler Totient in Clojure</title>
		<link>http://david.davidandpenelope.com/2009/01/29/74086100/</link>
		<comments>http://david.davidandpenelope.com/2009/01/29/74086100/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 17:41:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/74086100</guid>
		<description><![CDATA[Here&#8217;s my attempt: (defn gcd [a b] (if (= b 0) a (recur b (rem a b)))) (defn totient [n] (if (&#60;= n 1) 1 (loop [i (- n 1) a 0] (if (&#62; i 0) (recur (- i 1) (+ a (if (= (gcd n i) 1) 1 0))) a))))]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my attempt:</p>
<pre>(defn gcd [a b]
  (if (= b 0)
    a
    (recur b (rem a b))))

(defn totient [n]
  (if (&lt;= n 1)
    1
    (loop [i (- n 1) a 0]
      (if (&gt; i 0)
        (recur (- i 1) (+ a (if (= (gcd n i) 1) 1 0)))
        a))))
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/01/29/74086100/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jeremy is right!</title>
		<link>http://david.davidandpenelope.com/2009/01/27/73586466/</link>
		<comments>http://david.davidandpenelope.com/2009/01/27/73586466/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 21:31:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/73586466</guid>
		<description><![CDATA[Study Finds High-Fructose Corn Syrup Contains Mercury &#8211; washingtonpost.com Jeremy is right! High-fructose corn syrup really is causing political unrest in America, world instability, the global financial crisis, turmoil in the middle east, conflict among Jupiter&#8217;s moons, and near-certain destruction of earth (and Jupiter). &#8230; Sorry, I got a bit carried away. That washintonpost.com article [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.washingtonpost.com/wp-dyn/content/article/2009/01/26/AR2009012601831.html">Study Finds High-Fructose Corn Syrup Contains Mercury &#8211; washingtonpost.com</a></p>
<p>Jeremy is right! High-fructose corn syrup really <i>is</i> causing political unrest in America, world instability, the global financial crisis, turmoil in the middle east, conflict among Jupiter&#8217;s moons, and near-certain destruction of earth (and Jupiter).</p>
<p>&#8230; Sorry, I got a bit carried away.</p>
<p>That washintonpost.com article is a republication of <a href="http://www.healthday.com/Article.asp?AID=623456">this</a> article at healthday.com.</p>
<p>The article cites this study:<br /><a href="http://www.ehjournal.net/content/8/1/2">Mercury from chlor-alkali plants: measured concentrations in food product sugar</a></p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/01/27/73586466/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 55</title>
		<link>http://david.davidandpenelope.com/2009/01/17/71179176/</link>
		<comments>http://david.davidandpenelope.com/2009/01/17/71179176/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 20:22:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/71179176</guid>
		<description><![CDATA[Problem 55, in short, says &#8220;How many Lychrel numbers are there below ten-thousand?&#8221; I didn&#8217;t know what a Lychrel number was until I read the explanation. Here it is: If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + [...]]]></description>
			<content:encoded><![CDATA[<p>Problem 55, in short, says &#8220;How many Lychrel numbers are there below ten-thousand?&#8221;</p>
<p>I didn&#8217;t know what a Lychrel number was until I read the explanation. Here it is:</p>
<blockquote>
<p>If we take 47, reverse and add, 47 + 74 = 121, which is palindromic.</p>
<p>Not all numbers produce palindromes so quickly. For example,</p>
<p style="margin-left: 50px">349 + 943 = 1292,<br /> 1292 + 2921 = 4213<br /> 4213 + 3124 = 7337</p>
<p>That is, 349 took three iterations to arrive at a palindrome.</p>
<p>Although no one has proved it yet, it is thought that some numbers, like 196, never produce a palindrome. A number that never forms a palindrome through the reverse and add process is called a Lychrel number. Due to the theoretical nature of these numbers, and for the purpose of this problem, we shall assume that a number is Lychrel until proven otherwise. In addition you are given that for every number below ten-thousand, it will either (i) become a palindrome in less than fifty iterations, or, (ii) no one, with all the computing power that exists, has managed so far to map it to a palindrome. In fact, 10677 is the first number to be shown to require over fifty iterations before producing a palindrome: 4668731596684224866951378664 (53 iterations, 28-digits).</p>
<p>Surprisingly, there are palindromic numbers that are themselves Lychrel numbers; the first example is 4994.</p>
<p>How many Lychrel numbers are there below ten-thousand?</p>
</blockquote>
<p>At first I made the mistake of thinking that a number was Lychrel if it <i>does</i> produce a palindromic number within 50 iterations. Then I realized my mistake: a number is Lychrel if it <i>doesn&#8217;t </i>produce a palindromic number within 50 iterations.</p>
<p>Here is what I came up with in Clojure to determine the number of Lychrel numbers less than 10,000:</p>
<pre>(import '(java.math BigInteger))

(defn reverse-str [s]
  (apply str (reverse s)))

(defn reverse-int [n]
  (BigInteger. (reverse-str (str n))))

(defn add-reverse [n]
  (+ n (reverse-int n)))

(defn lychrel? [n iterations]
  (if (&lt; iterations 1)
    true
    (let [i (add-reverse n)
          s (str i)]
      (if (= (reverse-str s) s)
        false
        (recur i (- iterations 1))))))

(println (count (filter #(lychrel? % 49) (range 10000))))</pre>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/01/17/71179176/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 97</title>
		<link>http://david.davidandpenelope.com/2009/01/17/71070454/</link>
		<comments>http://david.davidandpenelope.com/2009/01/17/71070454/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 05:39:00 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/71070454</guid>
		<description><![CDATA[I just implemented a solution to problem 97 in clojure! Problem 97 is to &#8220;Find the last ten digits of the non-Mersenne prime: 28433 × 27830457 + 1.&#8221; My solution in clojure ran in 82165.759 milliseconds, which Google says is 1.36 minutes. Here&#8217;s my implementation: (require &#8216;math)(time (rem (+ (* 28433 (expt 2&#160;7830457)) 1) 10000000000)) [...]]]></description>
			<content:encoded><![CDATA[<p>I just implemented a solution to <a href="http://projecteuler.net/index.php?section=problems&amp;id=97">problem 97</a> in clojure!</p>
<p>Problem 97 is to &#8220;Find the last ten digits of the non-Mersenne prime:<br /> 28433 × 2<sup>7830457</sup> + 1.&#8221;</p>
<p>My solution in clojure ran in 82165.759 milliseconds, which Google <a href="http://www.google.com/search?q=82165.759+milliseconds+to+minutes&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a">says</a> is 1.36 minutes.</p>
<p>Here&#8217;s my implementation:</p>
<p>(require &#8216;math)<br />(time (rem (+ (* 28433 (expt 2&#160;7830457)) 1) 10000000000))</p>
<p>My solution uses an external clojure library that implements the function expt (i.e. exponentiation). That library is posted for download <a href="http://groups.google.com/group/clojure/browse_thread/thread/416aafd8e1858c77">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/01/17/71070454/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Euler : Problem 7 &#8211; Part 2</title>
		<link>http://david.davidandpenelope.com/2009/01/17/71057290/</link>
		<comments>http://david.davidandpenelope.com/2009/01/17/71057290/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 04:13:34 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[regular]]></category>

		<guid isPermaLink="false">http://davidkellis.tumblr.com/post/71057290</guid>
		<description><![CDATA[I&#8217;m learning a new language called clojure and wanted to re-implement my solution to problem 7 in it. Here it is: (defn list-primes ([n] (list-primes n [2] 3)) ([n primes i] (if (&#62;= (count primes) n) primes (if (not-any? #(= (rem i %) 0) primes) (recur n (conj primes i) (+ i 2)) (recur n [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m learning a new language called <a href="http://www.clojure.org/">clojure</a> and wanted to re-implement my solution to problem 7 in it. Here it is:</p>
<pre>(defn list-primes
  ([n] (list-primes n [2] 3))
  ([n primes i]
    (if (&gt;= (count primes) n)
      primes
      (if (not-any? #(= (rem i %) 0) primes)
        (recur n (conj primes i) (+ i 2))
        (recur n primes (+ i 2))))))
(println (nth (list-primes 10001) 10000))
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://david.davidandpenelope.com/2009/01/17/71057290/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

