<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>To iterate is human, to recurse divine.</description><title>Code as Art</title><generator>Tumblr (3.0; @codeasart)</generator><link>http://codeasart.tumblr.com/</link><item><title>All about 64-bit programming in one place</title><description>&lt;a href="http://software.intel.com/en-us/blogs/2011/07/07/all-about-64-bit-programming-in-one-place/"&gt;All about 64-bit programming in one place&lt;/a&gt;</description><link>http://codeasart.tumblr.com/post/7393924027</link><guid>http://codeasart.tumblr.com/post/7393924027</guid><pubDate>Fri, 08 Jul 2011 17:40:08 -0400</pubDate><category>programming</category></item><item><title>Noir: A (micro-)web framework for Clojure</title><description>&lt;a href="http://webnoir.org/"&gt;Noir: A (micro-)web framework for Clojure&lt;/a&gt;: &lt;p&gt;This is pretty neat. I’ve been meaning to find an excuse to use Clojure for a real project, and I’ll definitely keep this in mind. The fact that it apparently &lt;a target="_blank" href="http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo"&gt;runs on Heroku&lt;/a&gt; is icing on the cake.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/7259130707</link><guid>http://codeasart.tumblr.com/post/7259130707</guid><pubDate>Tue, 05 Jul 2011 05:35:46 -0400</pubDate><category>programming</category><category>clojure</category><category>web development</category></item><item><title>A regular expression matcher in 30 lines of C</title><description>&lt;a href="http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html"&gt;A regular expression matcher in 30 lines of C&lt;/a&gt;: &lt;blockquote&gt;
&lt;p&gt;Beautiful code is likely to be simple — clear and easy to understand. Beautiful code is likely to be compact — just enough code to do the job and no more — but not cryptic, to the point where it cannot be understood.  Beautiful code may well be general, solving a broad class of problems in a uniform way.  One might even describe it as elegant, showing good taste and refinement&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is fascinating. I love clever, well-written code.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/7192135801</link><guid>http://codeasart.tumblr.com/post/7192135801</guid><pubDate>Sun, 03 Jul 2011 11:00:13 -0400</pubDate><category>programming</category></item><item><title>"XML is like violence. If it doesn’t solve your problem, you’re not using enough of it."</title><description>“XML is like violence. If it doesn’t solve your problem, you’re not using enough of it.”</description><link>http://codeasart.tumblr.com/post/7019666776</link><guid>http://codeasart.tumblr.com/post/7019666776</guid><pubDate>Tue, 28 Jun 2011 15:55:41 -0400</pubDate><category>xml</category><category>programming</category><category>computers</category></item><item><title>Google Plus</title><description>&lt;a href="https://plus.google.com"&gt;Google Plus&lt;/a&gt;: &lt;p&gt;Google’s new project, Google Plus, is currently in beta. They have a pretty impressive demo online.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/7019547287</link><guid>http://codeasart.tumblr.com/post/7019547287</guid><pubDate>Tue, 28 Jun 2011 15:52:06 -0400</pubDate><category>google</category><category>computers</category></item><item><title>Revisiting 'Zork': What We Lost in the Transition to Visual Games</title><description>&lt;a href="http://www.theatlantic.com/technology/archive/2011/06/revisiting-zork-what-we-lost-in-the-transition-to-visual-games/241074/"&gt;Revisiting 'Zork': What We Lost in the Transition to Visual Games&lt;/a&gt;: &lt;p&gt;There’s something about a text adventure game that can’t be adequately captured by even the most modern and expensive 3D game. Like reading a good novel, a text adventure game inspires you to to create whole universes in your imagination. No 3D rendering engine can even come close.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/7019304536</link><guid>http://codeasart.tumblr.com/post/7019304536</guid><pubDate>Tue, 28 Jun 2011 15:44:00 -0400</pubDate><category>art</category><category>games</category><category>computers</category></item><item><title>Testing Benford's Law</title><description>&lt;a href="http://testingbenfordslaw.com/"&gt;Testing Benford's Law&lt;/a&gt;: &lt;p&gt;Benford’s Law says that in lists of numbers from many real life sources, the leading digit is distributed in a non-uniform way.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Chances are, the leading digit will be a &lt;em&gt;1&lt;/em&gt; more often than         a &lt;em&gt;2&lt;/em&gt;. And &lt;em&gt;2&lt;/em&gt;s would probably occur more often than         &lt;em&gt;3&lt;/em&gt;s, and so on.&lt;/p&gt;
&lt;p&gt;This odd phenonenom is Benford’s Law. If a set of values were truly         random, each leading digit would appear about &lt;em&gt;11%&lt;/em&gt; of the time, but Benford’s Law predicts a logarithmic distribution.         It occurs so regularly that it is even used in fraudulent accounting         detection.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://codeasart.tumblr.com/post/6993520666</link><guid>http://codeasart.tumblr.com/post/6993520666</guid><pubDate>Mon, 27 Jun 2011 20:33:31 -0400</pubDate><category>math</category><category>statistics</category></item><item><title>"An interesting description - Java is to JavaScript as a car is to a carpet."</title><description>“An interesting description - Java is to JavaScript as a car is to a carpet.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Unknown (via &lt;a href="http://vinayard.tumblr.com/"&gt;vinayard&lt;/a&gt;)&lt;/em&gt;</description><link>http://codeasart.tumblr.com/post/6984495916</link><guid>http://codeasart.tumblr.com/post/6984495916</guid><pubDate>Mon, 27 Jun 2011 16:18:56 -0400</pubDate><category>programming</category></item><item><title>The mystery file system</title><description>&lt;a href="http://www.devttys0.com/2011/06/mystery-file-system/"&gt;The mystery file system&lt;/a&gt;: &lt;p&gt;A fascinating account of a skilled hacker reverse-engineering an undocumented filesystem.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/6969982679</link><guid>http://codeasart.tumblr.com/post/6969982679</guid><pubDate>Mon, 27 Jun 2011 05:50:00 -0400</pubDate><category>programming</category><category>hacking</category></item><item><title>Three virtues of a programmer: Laziness, Impatience, and Hubris</title><description>&lt;a href="http://en.wikipedia.org/wiki/Larry_Wall#Virtues_of_a_programmer"&gt;Three virtues of a programmer: Laziness, Impatience, and Hubris&lt;/a&gt;: &lt;p&gt;These are the three virtues of a programmer, as described by Larry Wall, creator of the Perl programming language. They were included in his book &lt;em&gt;Programming Perl&lt;/em&gt;.&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Laziness&lt;/strong&gt; - The quality that makes you go to great effort to reduce overall  energy expenditure. It makes you write labor-saving programs that other  people will find useful, and document what you wrote so you don’t have  to answer so many questions about it. Hence, the first great virtue of a  programmer. Also hence, this book. See also impatience and hubris.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span class="mw-redirect"&gt;Impatience&lt;/span&gt;&lt;/strong&gt; - The anger you feel when the computer is being lazy. This makes you  write programs that don’t just react to your needs, but actually  anticipate them. Or at least pretend to. Hence, the second great virtue  of a programmer. See also laziness and hubris.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Hubris&lt;/strong&gt; - Excessive pride, the sort of thing Zeus zaps you for. Also the  quality that makes you write (and maintain) programs that other people  won’t want to say bad things about. Hence, the third great virtue of a  programmer. See also laziness and impatience.&lt;/li&gt;
&lt;/ol&gt;</description><link>http://codeasart.tumblr.com/post/6969607317</link><guid>http://codeasart.tumblr.com/post/6969607317</guid><pubDate>Mon, 27 Jun 2011 05:21:00 -0400</pubDate><category>programming</category><category>computers</category></item><item><title>The Social Network is inspiring students to study computer science</title><description>&lt;p&gt;&lt;a href="http://leonsbuddydave.tumblr.com/post/6969207391"&gt;leonsbuddydave&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’m now looking forward to a freshman year CS class full of disillusioned wannabe hackers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&amp;#8217;m in favor of anything that motivates people to study computer science, but there&amp;#8217;ll probably be more than a few frustrated and disappointed students. Programming is hard, especially for students who&amp;#8217;ve never seen it before and have little background in math or logic.&lt;/p&gt;
&lt;p&gt;Hell, there already are. The intro to programming class at my university was filled with would-be game developers, most of which either dropped after a few weeks or ended up failing. They simply weren&amp;#8217;t willing to put in the work required.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/6969457123</link><guid>http://codeasart.tumblr.com/post/6969457123</guid><pubDate>Mon, 27 Jun 2011 05:09:48 -0400</pubDate></item><item><title>"It should be noted that no ethically-trained software engineer would ever consent to write a..."</title><description>“It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Nathaniel_Borenstein"&gt;Nathaniel Borenstein&lt;/a&gt; (via &lt;a href="http://dianeisadork.tumblr.com/"&gt;dianeisadork&lt;/a&gt;)&lt;/em&gt;</description><link>http://codeasart.tumblr.com/post/6968533958</link><guid>http://codeasart.tumblr.com/post/6968533958</guid><pubDate>Mon, 27 Jun 2011 04:04:06 -0400</pubDate><category>programming</category></item><item><title>"On two occasions I have been asked, ‘If you put into the machine wrong figures, will the right..."</title><description>“On two occasions I have been asked, ‘If you put into the machine wrong figures, will the right answers come out?’  I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Charles Babbage, quoted from his autobiography, &lt;a title="Google Books copy of Passages from the Life of a Philosopher" target="_blank" href="http://books.google.com/books/about/Passages_from_the_life_of_a_philosopher.html?id=Fa1JAAAAMAAJ"&gt;&lt;em&gt;Passages from the Life of a Philosopher&lt;/em&gt;&lt;/a&gt;&lt;/em&gt;</description><link>http://codeasart.tumblr.com/post/6967955391</link><guid>http://codeasart.tumblr.com/post/6967955391</guid><pubDate>Mon, 27 Jun 2011 03:28:00 -0400</pubDate><category>computers</category><category>science</category><category>logic</category></item><item><title>An x86 emulator in pure Javascript</title><description>&lt;a href="http://bellard.org/jslinux/"&gt;An x86 emulator in pure Javascript&lt;/a&gt;: &lt;p&gt;This is a PC emulator (think VirtualBox or VMWare) written by &lt;a title="Fabrice Bellard" target="_blank" href="http://bellard.org/"&gt;Fabrice Bellard&lt;/a&gt;, who is also the author of the well-known &lt;a title="QEMU Wiki" target="_blank" href="http://wiki.qemu.org/Main_Page"&gt;QEMU&lt;/a&gt; emulation software. It runs entirely inside the browser using Javascript and &lt;a target="_blank" href="http://www.khronos.org/registry/typedarray/specs/latest/"&gt;typed arrays&lt;/a&gt;, a new W3C standard API for interacting with binary data.&lt;/p&gt;
&lt;p&gt;The demo launches the Linux kernel and a simple shell, and it comes with a working C compiler.&lt;/p&gt;
&lt;p&gt;&lt;a title="PC Emulator techincal notes" target="_blank" href="http://bellard.org/jslinux/tech.html"&gt;The technical notes&lt;/a&gt; and the &lt;a title="PC Emulator FAQ" target="_blank" href="http://bellard.org/jslinux/faq.html"&gt;FAQ&lt;/a&gt; are worth reading as well.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/6967786350</link><guid>http://codeasart.tumblr.com/post/6967786350</guid><pubDate>Mon, 27 Jun 2011 03:18:00 -0400</pubDate><category>javascript</category><category>web development</category><category>programming</category></item><item><title>"The best way to predict the future is to implement it."</title><description>“The best way to predict the future is to implement it.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;a title="Loud Thinking, DHH's blog" target="_blank" href="http://www.loudthinking.com/"&gt;David Heinemeier Hansson&lt;/a&gt;, creator of &lt;a title="Ruby on Rails" target="_blank" href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt;&lt;/em&gt;</description><link>http://codeasart.tumblr.com/post/6967518223</link><guid>http://codeasart.tumblr.com/post/6967518223</guid><pubDate>Mon, 27 Jun 2011 03:03:33 -0400</pubDate></item><item><title>"Physics is the universe’s operating system."</title><description>“Physics is the universe’s operating system.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Jack Garman&lt;/em&gt;</description><link>http://codeasart.tumblr.com/post/6967270024</link><guid>http://codeasart.tumblr.com/post/6967270024</guid><pubDate>Mon, 27 Jun 2011 02:50:40 -0400</pubDate><category>science</category><category>physics</category></item><item><title>Finding an inverse square root using black magic</title><description>&lt;a href="http://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code"&gt;Finding an inverse square root using black magic&lt;/a&gt;: &lt;p&gt;In computer programming, a “&lt;a title="Magic Numbers in programming" target="_blank" href="http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Unnamed_numerical_constants"&gt;magic number&lt;/a&gt;” usually refers to a constant (an unchanging number or value) that is used without explanation in code. Generally it is considered bad practice to use magic numbers, as any special number should be documented or given a helpful variable name (misunderstandings of this teaching lead some programmers to do silly things like define &lt;em&gt;int TWENTY_SIX = 26&lt;/em&gt;, which isn’t very informative).&lt;/p&gt;
&lt;p&gt;John Carmack’s code for the video game &lt;em&gt;Quake III&lt;/em&gt; (released as open source) is unique in that it has one of the few cases where the “magic” in magic number appears to apply quite literally. The function has been nicknamed the &lt;strong&gt;black magic inverse square root&lt;/strong&gt; function.&lt;/p&gt;
&lt;pre class="sh_c"&gt;float Q_rsqrt( float number )
{
        long i;
        float x2, y;
        const float threehalfs = 1.5F;
 
        x2 = number * 0.5F;
        y  = number;
        i  = * ( long * ) &amp;y;                       // evil floating point bit level hacking [sic]
        i  = 0x5f3759df - ( i &gt;&gt; 1 );               // what the f*ck? [sic]
        y  = * ( float * ) &amp;i;
        y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
//    y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
 
        return y;
}
&lt;/pre&gt;
&lt;p&gt;Essentially, Carmack’s function finds the inverse square root of a given number by using &lt;a title="Newton's method" target="_blank" href="http://en.wikipedia.org/wiki/Newton%27s_method"&gt;Newton’s method&lt;/a&gt;, which is meant to be done in several iterations. The magic comes in with the constant 0x5f3759df: the input is divided by two and subtracted from that initial constant, then the result is run through an iteration of Newton’s method. With this magic constant, the function can return an adequate approximation after only a single iteration, and the function can compute up to four times faster than the native machine instruction for floating point square roots!&lt;/p&gt;
&lt;p&gt;After firing off a few emails, &lt;a title="Origin of Quake III's Inverse Square Root Function" target="_blank" href="http://www.beyond3d.com/content/articles/8/"&gt;someone discovered&lt;/a&gt; that John Carmack was not the original author. The code was apparently passed around by 3d gurus from places like id and 3dfx, with Gary Tarolli being perhaps as close as we’ll get to finding the original author (though he claims he can’t take full credit for it).&lt;/p&gt;
&lt;p&gt;It’s not the sort of code you run into every day (and judging by how confusing it is at first glance, I’m a little glad), but it’s quite an amazing hack, and not just because of the magic constant used in the initial approximation. There’s some impressive stuff going on as the code alternatively treats the same bits as an integer and as a floating point. Like the Mythbusters say, please don’t try this at home.&lt;/p&gt;</description><link>http://codeasart.tumblr.com/post/6966705237</link><guid>http://codeasart.tumblr.com/post/6966705237</guid><pubDate>Mon, 27 Jun 2011 02:22:00 -0400</pubDate><category>3d</category><category>math</category><category>hack</category><category>cool</category><category>programming</category></item></channel></rss>
