<?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>Untamed Wilds &#187; computers</title>
	<atom:link href="http://thomaswebb.net/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://thomaswebb.net</link>
	<description>Human ecology, human action and human nature</description>
	<lastBuildDate>Tue, 06 Mar 2012 18:38:45 +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>Response to Steve Jobs&#8217; Open Letter to</title>
		<link>http://thomaswebb.net/2010/04/29/response-to-steve-jobs-open-letter-to/</link>
		<comments>http://thomaswebb.net/2010/04/29/response-to-steve-jobs-open-letter-to/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 16:10:28 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod touch]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=812</guid>
		<description><![CDATA[http://www.engadget.com/2010/04/29/steve-jobs-publishes-some-thoughts-on-flash-many-many-thou/ I mostly agree with most of the technical issues he raises and I think the lesson here is that it does, in fact, pay to use open standards. However, there are some things he says that I take issue &#8230; <a href="http://thomaswebb.net/2010/04/29/response-to-steve-jobs-open-letter-to/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>http://www.engadget.com/2010/04/29/steve-jobs-publishes-some-thoughts-on-flash-many-many-thou/</p>
<p>I mostly agree with most of the <em>technical</em> issues he raises and I think the lesson here is that it does, in fact, pay to use open standards. However, there are some things he says that I take issue with as a developer:</p>
<p>Replacing flash with H.264 is not an option right now for several reasons. Firstly, flash isn&#8217;t simply a way to view video. At present there is no way to have interactive elements in a web page that work on desktop and iP* other than javascript, which has its interoperability problems (though the jQuery and prototype folks <em>usually</em> do a good job at sorting that out for you). Second is the notion that H.264 already is the default format for HTML5. No, it is not. That has not been decided yet. Hopefully H.264 doesn&#8217;t win since it, too is <strong>proprietary</strong>, the very thing Jobs takes issue with for Flash! I even notice that at Apple stores, the employees are basically told to tell this tale to customers who are web developers that they should just replace everything with HTML5 and H.264. I hope that Google does open-source VP8 and that it becomes the format that wins, or VP8 and Ogg and that Apple doesn&#8217;t kick and scream in protest when they win the HTML5 video format wars. We don&#8217;t want .gif part 2!</p>
<p>Jobs also has a disdain for 3rd party development tools. Here I see the motivation as business, not technical. We developers have only so much time-money and Jobs knows that making it difficult to support multiple platforms with the same source tree more or less will make a lot of developers chose to develop only for Apple&#8217;s products. Jobs knows this very well and I believe it was behind the decision not only to not allow Flash but also to not allow Java. Jobs even boldly chided Java as something no one uses anymore. No one? Well, except for their mobile devices&#8217; biggest upcoming competitor, the Android platform. That&#8217;s all.</p>
<p>When developing C++ desktop applications, I don&#8217;t want to waste my investment. I use Qt. It doesn&#8217;t block me from using the latest innovations in Windows, Mac OS X or Linux&#8217; desktops (KDE and Gnome), but it gets me most of the way easily. 90% of the time for 90% of the people making business apps (not games), OS specific GUI code shouldn&#8217;t be necessary. I believe the same is true for mobile devices. Without writing with the iphone in mind, I believe you can have your tool translate your menus, form items, etc. into the appropriate code for different platforms. Apple won&#8217;t allow this. My understanding is they won&#8217;t even allow this if such a tool (including the tool Adobe made earlier to translate Flash into Obj-C) even if you hand-edit the code after generation or make your own regexp to modify after generation (so at least minor edits won&#8217;t require a rewrite to remove wasteful routines, etc.) This is a shame. It&#8217;s bad for developers and consumers, but good for Apple. It also directly affects me as I was planning on making an XUL to iphone gui converter.</p>
<p>So again, I absolutely agree with Jobs&#8217; assessment of Flash&#8217;s shortcomings. If he is serious about them, though, I trust that he will allow Flash once they are addressed? If Adobe fails to correct these issues and it may be impossible without breaking backwards compatibility, their prize platform may go the way of the Dodo, with or without Apple&#8217;s sabotage. At the very least, I believe something that creates obj-c from an AS3/Flex project should technically address the issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2010/04/29/response-to-steve-jobs-open-letter-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Newscientist: Horizontal and vertical: The evolution of evolution</title>
		<link>http://thomaswebb.net/2010/01/26/newscientist-horizontal-and-vertical-the-evolution-of-evolution/</link>
		<comments>http://thomaswebb.net/2010/01/26/newscientist-horizontal-and-vertical-the-evolution-of-evolution/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:06:39 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[evolutionary programming]]></category>
		<category><![CDATA[nature]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[plasmids]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=750</guid>
		<description><![CDATA[http://www.newscientist.com/article/mg20527441.500-horizontal-and-vertical-the-evolution-of-evolution.html?full=true&#38;print=true Lately, I&#8217;m increasingly thinking, especially after reading this article, that evolutionary computing would benefit greatly from using a more bacterial type of evolution, where genes are shared between often unrelated organisms, rather than brute inheritance. Another way of looking &#8230; <a href="http://thomaswebb.net/2010/01/26/newscientist-horizontal-and-vertical-the-evolution-of-evolution/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.newscientist.com/article/mg20527441.500-horizontal-and-vertical-the-evolution-of-evolution.html?full=true&amp;print=true">http://www.newscientist.com/article/mg20527441.500-horizontal-and-vertical-the-evolution-of-evolution.html?full=true&amp;print=true</a></p>
<p>Lately, I&#8217;m increasingly thinking, especially after reading this article, that evolutionary computing would benefit greatly from using a more bacterial type of evolution, where genes are shared between often unrelated organisms, rather than brute inheritance. Another way of looking at it, is it might be good to deal with the complexities of subroutine sharing (which functional programming would make easier) than the complexities of sexual reproduction which make my eyes glaze over to read the solutions offered for. Maybe I&#8217;m just not clever enough (my <a href="http://thomaswebb.net/2009/04/17/i-created-life">earlier post on genetic programming</a> had a little ruby script and it only uses asexual reproduction).</p>
<p>I am skeptical of the article&#8217;s claim that the shared genetic code of all organisms must mean that genes were shared between organisms like bacterium do today. Firstly, bacterium don&#8217;t all share some common genes due to the passing of genes between species as it is. Secondly, clade evolution &#8211; where clades that are just better at evolving edge out others over time could be sufficient explanation. Surely DNA-based life had immense advantages over life with less fault-tolerant code. Just the same, the article makes a good point that biologists are, being human macro-centric &#8211; they focus on multi-cellular organisms even though most of the biomass, even more of the variety, along with the vast, vast majority of the history of life on this planet, is prokaryotic.</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2010/01/26/newscientist-horizontal-and-vertical-the-evolution-of-evolution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exercise 3-6: Sorting Lists &amp; 3-7 Using Library Modules</title>
		<link>http://thomaswebb.net/2009/11/04/exercise-3-6-sorting-lists/</link>
		<comments>http://thomaswebb.net/2009/11/04/exercise-3-6-sorting-lists/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 03:19:54 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[exercises]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=653</guid>
		<description><![CDATA[It looks like there&#8217;s one other guy on the internet who&#8217;s posting his answers for the exercises in this book. So, I&#8217;ll be linking to his so you (and I) can compare our answers. He knows what he&#8217;s doing. In &#8230; <a href="http://thomaswebb.net/2009/11/04/exercise-3-6-sorting-lists/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It looks like there&#8217;s one other guy on the internet who&#8217;s posting his answers for the exercises in this book. So, I&#8217;ll be linking to his so you (and I) can compare our answers. He knows what he&#8217;s doing. In his posts, he talks about, e.g., what he&#8217;d do in Haskell. I&#8217;m not a functional programming guy (lisp gives me the heebie-geebies, my earlier post on evolutionary programming where I used it notwithstanding). So, below are my answers (click to see more if you&#8217;re looking at the blog and not this post by itself) and <a href="http://d.hatena.ne.jp/vostok92/20090817/1250509904" target="_blank">here</a> is the Japanese guy&#8217;s answers.</p>
<p><span id="more-653"></span>[erlang]<br />
-module(sort).<br />
-export([quicksort/1,mergesort/1]).</p>
<p>less([Head|Tail], Pivot) when Head &gt;= Pivot -&gt;<br />
	less(Tail, Pivot);<br />
less([Head|Tail], Pivot) when Head &lt; Pivot -&gt;<br />
	[Head|less(Tail, Pivot)];<br />
less([],_) -&gt;<br />
	[].</p>
<p>more([Head|Tail], Pivot) when Head &gt;= Pivot -&gt;<br />
        [Head|more(Tail, Pivot)];<br />
more([Head|Tail], Pivot) when Head &lt; Pivot -&gt;<br />
        more(Tail, Pivot);<br />
more([],_) -&gt;<br />
        [].</p>
<p>quicksort([Head|Tail]) -&gt;<br />
	quicksort(less(Tail,Head)) ++ [Head] ++ quicksort(more(Tail,Head));<br />
quicksort([]) -&gt;<br />
	[].</p>
<p>% For reference, here&#8217;s the quicksort from wikipedia&#8217;s page on erlang&#8230; much better-looking than my crap (but in my defense, I didn&#8217;t know how to do this kind of list construction&#8230; cool!)<br />
% quicksort([]) -&gt; [];<br />
% quicksort([Pivot|Rest]) -&gt;<br />
% quicksort([Front || Front &lt;- Rest, Front &lt; Pivot])<br />
% ++ [Pivot] ++<br />
% quicksort([Back || Back &lt;- Rest, Back &gt;= Pivot]).</p>
<p>merge([Head1|Tail1],[Head2|Tail2]) when Head2 &gt; Head1 -&gt;<br />
	[Head1] ++ merge(Tail1,[Head2|Tail2]);<br />
merge([Head1|Tail1],[Head2|Tail2]) when Head2 =&lt; Head1 -&gt;<br />
	[Head2] ++ merge([Head1|Tail1],Tail2);<br />
merge([],[]) -&gt;<br />
	[];<br />
merge(End,[]) -&gt;<br />
	End;<br />
merge([],End) -&gt;<br />
	End.</p>
<p>mergesort([]) -&gt;<br />
	[];<br />
mergesort([Left]) -&gt;<br />
	[Left];<br />
mergesort(List) -&gt;<br />
	{Left, Right} = lists:split(length(List) div 2, List),<br />
	merge(mergesort(Left), mergesort(Right)).</p>
<p>[/erlang]</p>
<p>[erlang]<br />
-module(db_lists).<br />
-export([new/0, destroy/1, write/3, delete/2, read/2, match/2]).</p>
<p>new() -&gt;<br />
	[].</p>
<p>destroy(Db) -&gt;<br />
	ok.</p>
<p>write(Key, Element, Db) -&gt;<br />
	Db ++ [{Key, Element}].</p>
<p>delete(Key, List) -&gt;<br />
	lists:keydelete(Key, 1, List).</p>
<p>read(Key, List) -&gt;<br />
	case (lists:keyfind(Key, 1, List)) of<br />
		{MatchKey, Element} -&gt;<br />
			{ok, Element};<br />
		_ -&gt;<br />
			{error, instance}<br />
	end.</p>
<p>match(Element, [{DbHeadKey, DbHeadElement}|DbTail]) -&gt;<br />
	case DbHeadElement of<br />
		Element -&gt; [DbHeadKey] ++ match(Element, DbTail);<br />
		_ -&gt; match(Element, DbTail)<br />
	end;<br />
match(Element, []) -&gt;<br />
	[].</p>
<p>[/erlang]</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/11/04/exercise-3-6-sorting-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exercise 3-5: Manipulating Lists</title>
		<link>http://thomaswebb.net/2009/11/03/exercise-3-5-manipulating-lists/</link>
		<comments>http://thomaswebb.net/2009/11/03/exercise-3-5-manipulating-lists/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 18:19:52 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[exercise]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=647</guid>
		<description><![CDATA[Next installment in my &#8220;Thomas does your homework&#8221; series&#8230; [erlang] -module(list). -export([filter/2, reverse/1, concatenate/1, flatten/1]). filter([Head&#124;Tail],Num) when Head =&#60; Num -&#62; [Head&#124;filter(Tail,Num)]; filter([Head&#124;Tail],Num) when Head &#62; Num -&#62; filter(Tail,Num); filter([],_) -&#62; []. reverse([Head&#124;Tail]) -&#62; reverse(Tail) ++ [Head]; reverse([]) -&#62; []. &#8230; <a href="http://thomaswebb.net/2009/11/03/exercise-3-5-manipulating-lists/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Next installment in my &#8220;Thomas does your homework&#8221; series&#8230;</p>
<p><span id="more-647"></span></p>
<p>[erlang]<br />
-module(list).<br />
-export([filter/2, reverse/1, concatenate/1, flatten/1]).</p>
<p>filter([Head|Tail],Num) when Head =&lt; Num -&gt;<br />
	[Head|filter(Tail,Num)];<br />
filter([Head|Tail],Num) when Head &gt; Num -&gt;<br />
	filter(Tail,Num);<br />
filter([],_) -&gt;<br />
	[].</p>
<p>reverse([Head|Tail]) -&gt;<br />
	reverse(Tail) ++ [Head];<br />
reverse([]) -&gt;<br />
	[].</p>
<p>concatenate([Head|Tail]) -&gt;<br />
	Head ++ concatenate(Tail);<br />
concatenate([]) -&gt;<br />
	[].</p>
<p>% Probably possible to make this a LOT more efficient, ne<br />
flatten([Head|Tail]) -&gt;<br />
	flatten(Head) ++ flatten(Tail);<br />
flatten([]) -&gt;<br />
	[];<br />
flatten(NotArry) -&gt;<br />
	[NotArry].<br />
[/erlang]</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/11/03/exercise-3-5-manipulating-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exercise 3-4 Database Handling Using Lists</title>
		<link>http://thomaswebb.net/2009/10/12/exercise-3-4-database-handling-using-lists/</link>
		<comments>http://thomaswebb.net/2009/10/12/exercise-3-4-database-handling-using-lists/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 06:07:25 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[exercise]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=606</guid>
		<description><![CDATA[Here&#8217;s my clumsy attempt at the database handling exercise. Man, I must be a nerd, but I actually like these exercises.. I&#8217;m also enjoying my biology class. Is there something wrong with me? [code lang="erl"]-module(db). -export([new/0, destroy/1, write/3, delete/2, read/2, &#8230; <a href="http://thomaswebb.net/2009/10/12/exercise-3-4-database-handling-using-lists/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my clumsy attempt at the database handling exercise. Man, I must be a nerd, but I actually like these exercises.. I&#8217;m also enjoying my biology class. Is there something wrong with me?<br />
<span id="more-606"></span></p>
<p>[code lang="erl"]-module(db).<br />
-export([new/0, destroy/1, write/3, delete/2, read/2, match/2]).</p>
<p>new() -&gt;<br />
	[].</p>
<p>destroy(Db) -&gt;<br />
	ok.</p>
<p>write(Key, Element, Db) -&gt;<br />
	Db ++ [{Key, Element}].</p>
<p>delete(Key, [{DbHeadKey, DbHeadElement}|DbTail]) -&gt;<br />
	case DbHeadKey of<br />
		Key -&gt; delete(Key, DbTail);<br />
		_ -&gt; [{DbHeadKey, DbHeadElement}] ++ delete(Key, DbTail)<br />
	end;<br />
delete(Key, []) -&gt;<br />
	[].</p>
<p>read(Key, [{DbHeadKey, DbHeadElement}|DbTail]) -&gt;<br />
	case DbHeadKey of<br />
		Key -&gt; {ok, DbHeadElement};<br />
		_ -&gt; read(Key, DbTail)<br />
	end;<br />
read(Key, []) -&gt;<br />
	{error, instance}.</p>
<p>match(Element, [{DbHeadKey, DbHeadElement}|DbTail]) -&gt;<br />
	case DbHeadElement of<br />
		Element -&gt; [DbHeadKey] ++ match(Element, DbTail);<br />
		_ -&gt; match(Element, DbTail)<br />
	end;<br />
match(Element, []) -&gt;<br />
	[].</p>
<p>[/code]</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/10/12/exercise-3-4-database-handling-using-lists/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Erlang Exercises &#8211; Chapter 3</title>
		<link>http://thomaswebb.net/2009/10/10/erlang-exercises-chapter-3/</link>
		<comments>http://thomaswebb.net/2009/10/10/erlang-exercises-chapter-3/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 17:34:02 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[evaluating expressions]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[practice code]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=594</guid>
		<description><![CDATA[I learn by doing much more than by reading or listening, so as I go through O&#8217;Reilly&#8217;s Erlang Programming, I take the exercises at the end seriously. Generally, when I learn a new programming language, while I read, I&#8217;ll make &#8230; <a href="http://thomaswebb.net/2009/10/10/erlang-exercises-chapter-3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I learn by doing much more than by reading or listening, so as I go through O&#8217;Reilly&#8217;s <em>Erlang Programming</em>, I take the exercises at the end seriously. Generally, when I learn a new programming language, while I read, I&#8217;ll make a program of my own choosing, perhaps something that will be useful to me or that I could sell. However, with Erlang, I don&#8217;t even know where to begin using it yet. I want to get really, really good at it before I even attempt to make anything with it (I think remembering the mistakes I made with my first Ruby on Rails project caused this shift in attitude.. and let&#8217;s not forget the triumphs of reading <em>Mastering Regular Expressions</em> in its entirety).</p>
<p>I will be posting my attempts at the exercises, in case others might find it useful or seasoned Erlang programmers might tell me what I may be doing wrong. I&#8217;ll be spacing out my answers to chapter 3 over the week to keep things interesting. Here are the first three exercises from Chapter 3:<br />
<span id="more-594"></span><br />
[erlang]-module(chapter3).<br />
-export([sum/1, sum/2, even/1, create/1, reverse_create/1]).<br />
-import(erlang).</p>
<p>sum(Num) when Num &gt; 1 -&gt;<br />
	Num + sum(Num &#8211; 1);<br />
sum(Num) when Num == 1 -&gt;<br />
	1.</p>
<p>sum(N,M) when N &lt; M -&gt;<br />
	M + sum(N,M-1);<br />
sum(N,M) when N == M -&gt;<br />
	N;<br />
sum(N,M) when N &gt; M -&gt;<br />
	erlang:throw({&#8216;EXIT&#8217;,{bad_argument}}).</p>
<p>reverse_create(N) when N &gt; 1 -&gt;<br />
	[N|reverse_create(N-1)];<br />
reverse_create(N) when N == 1 -&gt;<br />
	[1].</p>
<p>create(N) when N &gt; 1 -&gt;<br />
	create(N-1) ++ [N];<br />
create(N) when N == 1 -&gt;<br />
	[1].</p>
<p>even(N) when (N &gt; 0) and (N rem 2 == 0) -&gt;<br />
	io:format(&quot;Number:~p~n&quot;,[N]), even(N-1);<br />
even(N) when (N &gt; 0) and (N rem 2 == 1) -&gt;<br />
	even(N-1);<br />
even(N) when N == 0 -&gt;<br />
	done.<br />
[/erlang]</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/10/10/erlang-exercises-chapter-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update (on Earlier Post on Evolutionary Programming)</title>
		<link>http://thomaswebb.net/2009/08/05/update-on-earlier-post-on-evolutionary-programming/</link>
		<comments>http://thomaswebb.net/2009/08/05/update-on-earlier-post-on-evolutionary-programming/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 04:50:18 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[genetic programming]]></category>
		<category><![CDATA[grammatical evolution]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=545</guid>
		<description><![CDATA[Apparently, without realizing it, I implemented a technique known as grammatical evolution, and the thing I&#8217;ve been aiming to do is called a genetic programming problem solver. More on this later, but here is the earlier post.]]></description>
			<content:encoded><![CDATA[<p>Apparently, without realizing it, I implemented a technique known as grammatical evolution, and the thing I&#8217;ve been aiming to do is called a <em>genetic programming problem solver</em>. More on this later, but here is the earlier <a href="http://thomaswebb.net/2009/04/17/i-created-life/">post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/08/05/update-on-earlier-post-on-evolutionary-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ah, now Mac OS X is finally behaving&#8230;</title>
		<link>http://thomaswebb.net/2009/06/29/ah-now-mac-os-x-is-finally-behaving/</link>
		<comments>http://thomaswebb.net/2009/06/29/ah-now-mac-os-x-is-finally-behaving/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 07:22:24 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[computers]]></category>
		<category><![CDATA[keyboard]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[programmer]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=454</guid>
		<description><![CDATA[I mentioned in a post earlier about my frustrations w/ the mac keyboard. I finally got around to being frustrated enough to google and (pretty simply) solve the issues I had. Basically, as a programmer the craaaazy way home and &#8230; <a href="http://thomaswebb.net/2009/06/29/ah-now-mac-os-x-is-finally-behaving/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I mentioned in a post <a href="http://thomaswebb.net/2007/09/16/mac-os-x-vs-my-keyboard/">earlier</a> about my frustrations w/ the mac keyboard. I finally got around to being frustrated enough to google and (pretty simply) solve the issues I had. Basically, as a programmer the craaaazy way home and end work on mac is unacceptable. The Windows &amp; UNIX way is better (home and end of <em>the line</em>, not the document). Here are the relevant, helpful posts:</p>
<p><a href="http://blog.dubh.org/2007/11/configuring-mac-os-x-terminal.html">http://blog.dubh.org/2007/11/configuring-mac-os-x-terminal.html</a><br />
<a href="http://blog.dubh.org/2007/11/configuring-mac-os-x-terminal.html">http://www.starryhope.com/tech/apple/2006/keyfixer/</a></p>
<p>Old posts, but very, very helpful. There really should just be a system-wide option, something like &#8220;home and end keys operate on line, not document&#8221;. Indeed, the primary reason I&#8217;m making such a banal post is I hope Apple&#8217;s marketing research finds this and maybe does something about making the growing UNIX nerd &amp; programmer user base a lot happier..</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/06/29/ah-now-mac-os-x-is-finally-behaving/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Created Life!</title>
		<link>http://thomaswebb.net/2009/04/17/i-created-life/</link>
		<comments>http://thomaswebb.net/2009/04/17/i-created-life/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 19:49:19 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[evolutionary programming]]></category>
		<category><![CDATA[nature]]></category>
		<category><![CDATA[avida]]></category>
		<category><![CDATA[genetics]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=356</guid>
		<description><![CDATA[Here is a ruby script I quickly whipped up to teach myself genetic programming/evolutionary programming, and also to demonstrate basic principles of biology (please see below to see how it works.. if you&#8217;re on my front page, click to read &#8230; <a href="http://thomaswebb.net/2009/04/17/i-created-life/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a ruby script I quickly whipped up to teach myself genetic programming/evolutionary programming, and also to demonstrate basic principles of biology (please see below to see how it works.. if you&#8217;re on my front page, click to read more first). I think I&#8217;m going to write something more sophisticated in <span><span>erlang</span></span> (I don&#8217;t know <span><span>erlang</span></span>, but I&#8217;m intrigued) after I get further down the road in <span><span>gp</span></span>, but here&#8217;s what I quickly whipped up. Since writing it, I have started reading <a href="http://www.gp-field-guide.org.uk/" target="_blank">A Field Guide to Genetic Programming</a> and already notice some things I should have done a little different. But in some respects, having a simple string of characters change their role in different modes is elegant and I think I prefer that way of doing things, despite shortfalls in statistical bias. Here are some observations I have at this point:</p>
<p>I know the people researching <span><span>gp</span></span> are really smart, so there&#8217;s probably something I&#8217;m missing, but I don&#8217;t see how genetic programming is supposed to quickly find solutions. Evolution is as slow as molasses. You need to dig through millions of years of dirt to see actual changes. I can only see <span><span>gp</span></span> quickly finding solutions if the process is being run <em>continually</em>, with multiple challenges or &#8220;resources&#8221;. I was glad to see, after having this thought, mention of multi-objective (5.1.3) and <span><span>coevolution</span></span> (5.4) in the book. It makes me think I&#8217;m on the right track. I also remember a while back reading in <a href="http://carlzimmer.com/articles/2005.php?subaction=showfull&amp;id=1177184710&amp;ucat=8" target="_blank">the article Discover had</a> about <a href="http://avida.devosoft.org/" target="_blank"><span><span>Avida</span></span></a> that when there was only one resource, one species would quickly capitalize on that and then the evolution would stagnate, but having multiple resources would create diversity and even better solutions at attacking that one resource. The ability of organisms to <span><span>repurpose</span></span> adaptations is important in evolution and without it, most complexity would not have been possible.</p>
<p>This leads me to another point. It seems <span><span>gp</span></span> works best when it works the most like evolution in the real world works. The rate of mutation is low and, despite my initial intuitions that a high mutation rate would lead to a good solution more quickly, I found that it was actually harmful to do so. Even though, in this script, there is a bias towards shorter programs (the longer the chromosomes, the more calories it takes to create just one offspring), when I had a higher mutation rate, like, say, 1 out of 5 copies, the length of the genes would get really, really long as a defense against mutations. This could happen because if the last parenthesis of the mini-lisp program is closed prematurely, the rest of the genes are ignored. Junk <span><span>dna</span></span>. In my program, at least, junk <span><span>dna</span></span> was a defense against mutation since I would get really short programs that have long tails of junk after them, but decreasing the mutation rate shrunk those tails down to almost insignificant. Weird. Please try downloading this and edit it to see for yourself.</p>
<p>While mutations should be rare, it helps to have variety. I did just substitutions at first and it worked, but it took a while. I also added stutters, insertions and deletions. Once I added stutters, it helped a lot! Even before adding stutters, I found that, when the &#8220;challenge&#8221; was 6 * x, I would get x + x + x + x + x and something like 7 * x competing with each<span> other</span> for a long time (5x or 7x often becomes the leading candidate after a few generations and it takes forever for any 6x to show up). Adding the stutters seemed to get multiplication through addition happening faster, though.</p>
<p>Download <a href="/code/yeasties.rb"><span><span>yeasties</span></span></a> or copy/paste from below (requires <a href="http://www.ruby-lang.org/" target="_blank">ruby</a> and <a href="http://clisp.cons.org/" target="_blank"><span><span>clisp</span></span></a>):</p>
<p><span id="more-356"></span></p>
<p>How it works: <em>(feel free to ignore italicized parenthetical comments if they confuse or distract you.. they can be safely ignored and are there for anyone wanting to play around with the program)</em></p>
<p>This is a basic, single-objective instance of digital evolution. Organisms only reproduce asexually. As you can see in the code, the &#8220;<span><span>dna</span></span>&#8221; is just a sequence of lower-case letters <em>(feel free to modify that array for aesthetic purposes, but keep in mind that there should be at least 30 elements or so in the array for this to work right)</em>. Each organism has its own sequence of <span><span>dna</span></span>. For the first generation, it is generated randomly, for any generation after that, it is a copy, occasionally mutated, of its parent&#8217;s. This <span><span>dna</span></span> is used to generate the &#8220;protein&#8221; or mini-program that will be run. The mini-program is in in lisp, rather than ruby <em>(it should be quite easy to change that to be generated ruby code and just use <tt><span><span>eval</span></span>()</tt> on it, though lisp code is easier to generate and we have the advantage of being able to easily add &#8216;time&#8217; to the command, and factoring in how computationally intensive it is into the equation. I started to set that up, but found that in this program, it&#8217;s almost always a split second and the differences have nothing to do with the code in question&#8230; just something to consider for larger programs in the future)</em>.</p>
<p>When reproducing, the mini-programs must expend calories to do so, in proportion to the length of the chromosomes. Simpler life is cheaper to create, but a) more susceptible to mutation (assuming longer chromosomes also mean more junk dna) and b) less likely to be the solution in cases where the challenge is complex. The amount of calories that is given to an &#8220;organism&#8221; to reproduce is proportional to its fitness. See next paragraph for how fitness is evaluated. This dna is then used to generate the &#8220;body&#8221; or &#8220;proteins&#8221; of the organism, which is simply a small program in lisp (basically two lines, the first simply being the line to feed the program a value). The generation of the program works like this: there are different modes, such as &#8220;operator is okay&#8221; or &#8220;variable or constant only&#8221;. Each gene is evaluated in sequence, starting with the operator mode. Depending on what is selected, the mode will change, so &#8216;a&#8217; might be 1 in terminal mode or + in operator mode. This ensures that only legal programs are being made. If you understand lisp, this&#8217;ll make sense (I don&#8217;t really understand lisp, but I can fake it): once the last parenthesis is closed, the generation ends and the rest is essentially junk dna. Junk dna can protect against mutation (since a mutation is statistically less likely to affect working code) but it also means offspring are more expensive to produce without any additional working code..</p>
<p>Each mini-program runs with a parameter being fed to it and is evaluated based on what it spits back out. If it evolves to not have x in it, then it will be ignoring that parameter to its peril <em>(unless we set the challenge to something that also doesn&#8217;t have x in it, like a constant number, in which case x is unnecessary noise though, at a 0 to 1 range, minor noise at that)</em>. For each generation, the x is set to the percentage of the minute (seconds divided by 60) or to that number times something else. This makes the program good for doing regression within a range since you can just multiply this number by the range and add the minimum point. For example, to do a sine function, do the sin of pi times this number (there&#8217;s no way in hell this script is going to generate the formula for sin, though I&#8217;d love to be proven wrong.. maybe only a few more lisp operators need be added&#8230;) The program doesn&#8217;t self-terminate unless all the life goes extinct (which happens sometimes with code bloat.. if the genome sizes get too big, usually through stutter, life forms quickly cease to be able to afford but one child.. this is why I&#8217;m considering creating a hard limit on the length of stutter). The program&#8217;s fitness is determined by how distant its result is algebraically from the correct answer (I&#8217;m just using the absolute value of the difference). You can specify how close it must be to be within the baseline. If it&#8217;s not that close, then its fitness is negative and it will die without reproducing. The fitness provides the calories it needs to create the following generation.</p>
<p>After the next generation is created, the organisms are sorted by fitness and the least fit are killed until there&#8217;s only WorldSize left, WorldSize being what we decide the population to be at the top. Rinse, lather, repeat. You can start this program and step away if you want to have your computer do something useless for a while. Or, better yet, you can probably program it to do something useful, though this isn&#8217;t using the best practices at this point and should be looked at as the simplest you can make gp and it still work. Perhaps this represents life in a primitive pre-dna state and gp will only be useful once its as sophisticated and awesome as dna. We don&#8217;t have to start at cosmic ooze and wait. We know how the story ends, so we can fast forward&#8230;</p>
<p>Overall, the program is mostly self-explanatory, but feel free to leave any comments or ask any questions about it. It&#8217;s a good learning experience and it&#8217;s certainly giving me some ideas&#8230;</p>
<p>&lt;/p&gt; &lt;p&gt;Your browser does not support iframes, so just download the code directly &lt;a href=&#8221;/code/yeasties.rb&#8221; mce_href=&#8221;/code/yeasties.rb&#8221;&gt;&lt;span&gt;&lt;span&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/04/17/i-created-life/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bandwidth Detection AS3</title>
		<link>http://thomaswebb.net/2009/01/15/bandwidth-detection-as3/</link>
		<comments>http://thomaswebb.net/2009/01/15/bandwidth-detection-as3/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 16:13:56 +0000</pubDate>
		<dc:creator>Thomas J. Webb</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[actionscript 3.0]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[bandwidth detection]]></category>

		<guid isPermaLink="false">http://thomaswebb.net/?p=325</guid>
		<description><![CDATA[ex animo » Blog Archive » Automatic Bandwidth Detection for SMIL + FLVPlayback + Progressive Downloads I was frustrated trying to get my flash player to do bandwidth detection, then stumbled on this site.. Apparently, there&#8217;s a bug in FLVplayback? &#8230; <a href="http://thomaswebb.net/2009/01/15/bandwidth-detection-as3/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://exanimo.com/actionscript/automatic-bandwidth-detection-for-smil/">ex animo » Blog Archive » Automatic Bandwidth Detection for SMIL + FLVPlayback + Progressive Downloads</a></p>
<p>I was frustrated trying to get my flash player to do bandwidth detection, then stumbled on this site.. Apparently, there&#8217;s a bug in FLVplayback? Psh.</p>
]]></content:encoded>
			<wfw:commentRss>http://thomaswebb.net/2009/01/15/bandwidth-detection-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

