<?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/"
	>

<channel>
	<title>dmtdev</title>
	<atom:link href="http://www.dmtdev.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dmtdev.com/blog</link>
	<description>Unusual information, opinions, and musings on obscure intellectual topics.</description>
	<pubDate>Wed, 23 Dec 2009 19:06:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fully iterative Ackermann function computation</title>
		<link>http://www.dmtdev.com/blog/computer-science/fully-iterative-ackermann-function-computation</link>
		<comments>http://www.dmtdev.com/blog/computer-science/fully-iterative-ackermann-function-computation#comments</comments>
		<pubDate>Sat, 15 Aug 2009 23:18:44 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[computer science]]></category>

		<category><![CDATA[ackermann]]></category>

		<category><![CDATA[function]]></category>

		<category><![CDATA[iterative]]></category>

		<category><![CDATA[iteratively]]></category>

		<category><![CDATA[non-recursive]]></category>

		<category><![CDATA[non-recursively]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=643</guid>
		<description><![CDATA[I recently heard someone insist that the Ackermann function can only be computed recursively.
Wrong! Here is a fully iterative implementation of Ackermann‐computation, written in Python:

def ackermann(m, n):
	stack = [m]
	while stack:
		m = stack.pop()
		if m == 0:
			n += 1
		elif n == 0:
			stack.append(m - 1)
			n = 1
		else:
			stack.append(m - 1)
			stack.append(m)
			n -= 1
	return n

The insistence that the Ackermann function can [...]]]></description>
			<content:encoded><![CDATA[<p>I recently heard someone insist that the Ackermann function can only be computed recursively.</p>
<img class="size-full wp-image-644" title="The Ackermann function, defined recursively" src="http://www.dmtdev.com/blog/wp-content/ackermann.gif" alt="The Ackermann function, defined recursively" width="100%" height="100%" />
<p>Wrong! Here is a fully iterative implementation of Ackermann‐computation, written in Python:</p>
<pre class="syntax-highlight:python">
def ackermann(m, n):
	stack = [m]
	while stack:
		m = stack.pop()
		if m == 0:
			n += 1
		elif n == 0:
			stack.append(m - 1)
			n = 1
		else:
			stack.append(m - 1)
			stack.append(m)
			n -= 1
	return n
</pre>
<p>The insistence that the Ackermann function can only be computed recursively is rampant and is often caused by a poor understanding of recursion and why it is not required for Turing‐completeness. Using Python 2.6 on my Intel Core 2 Duo, the above iterative implementation performed better than the typical recursive implementation—a fact that should not surprise anyone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/computer-science/fully-iterative-ackermann-function-computation/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linguistic and Typographical Conventions</title>
		<link>http://www.dmtdev.com/blog/ramblings/linguistic-and-typographical-conventions</link>
		<comments>http://www.dmtdev.com/blog/ramblings/linguistic-and-typographical-conventions#comments</comments>
		<pubDate>Tue, 11 Aug 2009 06:31:47 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[ramblings]]></category>

		<category><![CDATA[semantics and linguistics]]></category>

		<category><![CDATA[conventions]]></category>

		<category><![CDATA[grammatical]]></category>

		<category><![CDATA[grammer]]></category>

		<category><![CDATA[guide]]></category>

		<category><![CDATA[style]]></category>

		<category><![CDATA[typographical]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=596</guid>
		<description><![CDATA[My own grammatical and typographical conventions have fascinated me for some time. When writing, from the most trivial and the most significant, I am dogmatically and painfully conscious of every sentence, every word, every thought, and every comma I determine (joking, joking!) choose to use. Sometimes, when I deliberately revise my conventions, I rewrite pieces [...]]]></description>
			<content:encoded><![CDATA[<p style="text-indent:2em">My own grammatical and typographical conventions have fascinated me for some time. When writing, from the most trivial and the most significant, I am dogmatically and painfully conscious of every sentence, every word, every thought, and every comma I <del>determine (joking, joking!)</del> choose to use. Sometimes, when I deliberately revise my conventions, I rewrite pieces of ancient, obsolete text of mine, regardless of the shame and self‐pity I feel for doing so.</p>
<p style="text-indent:2em">Although this post’s presence indicates otherwise, I wrote this for myself: reviewing my conventions will hopefully discourage (and hopefully hinder) me from changing my conventions so often. Its presence here is of secondary concern, but hopefully it will provoke discussion among readers—at least the non‐verbal, internal kind.</p>
<p>When writing, I do…</p>
<h3>Capitalization</h3>
<ul>
<li>
			Capitalize honorifics.
		</li>
<li>
			Capitalize possessives and pronouns of veneration.
		</li>
<li>
			Capitalize doctrines, philosophies, and Platonic ideals.
		</li>
<li>
			Capitalize names of genera.
		</li>
<li>
			Capitalize names of regions that are proper nouns.
		</li>
<li>
			Not capitalize directions.
		</li>
<li>
			Not capitalize names of species.
		</li>
<li>
			Not capitalize names of regions that are not proper nouns.
		</li>
</ul>
<h3>Acronyms and abbreviations</h3>
<ul>
<li>
			Not use periods or spaces to delimit letters in acronyms or initialisms.
		</li>
<li>
			In non-web mediums, include the acronym form in parenthesis when introducing an acronym or initialism.
		</li>
<li>
			In web-based text, use <em>&lt;acronym&gt;</em> tags to introduce acronyms and initialisms at every occurrence.
		</li>
<li>
			Not use apostrophes in non-possessive plural acronyms.
		</li>
<li>
			Generally avoid abbreviations. When using an abbreviation, I always append a fullstop.
		</li>
</ul>
<h3>Quotations</h3>
<ul>
<ul>
			Use block quotations for quotations that exceed three lines.
		</li>
<li>
			Indent block quotations with one tabstop.
		</li>
<li>
			Not surround block quotations with quotation marks.
		</li>
<li>
			Introduce block quotations with colons, not horizontal bars (U+2015).
		</li>
<li>
			Use square brackets for editorial marks.
		</li>
<li>
			Use ‘[sic]’ to indicate mistakes that are reproduced verbatim.
		</li>
<li>
			Replace confusing text with editorial enclosed in square brackets.
		</li>
<li>
			Replace unintelligible speech with ellipses enclosed in square brackets.
		</li>
<li>
			Alter the typography where necessary to assist readability and consistency.
		</li>
<li>
			Alternate between double quotation marks and single quotation marks for nested quotations.
		</li>
<li>
			Enclose punctuation within quotation marks <em>only</em> if it is part of the quotation (“the British way”).
		</li>
</ul>
<h3>Parenthesis</h3>
<ul>
<li>
			Avoid nested parenthesis.
		</li>
<li>
			For nested parenthesis, use spaces between consecutive opening parenthesis and consecutive closing parenthesis.
		</li>
<li>
			Enclose punctuation within parenthesis <em>only</em> if it is part of the parenthesized idea.
		</li>
</ul>
<h3>Commas</h3>
<ul>
<li>
			Use commas wherever grammatically required.
		</li>
<li>
			Not use commas wherever stylistically appealing.
		</li>
<li>
			Not splice with commas.
		</li>
<li>
			Use serial commas except where their use would cause ambiguity. For example, I would use ‘He showed his friends, John, and Mary’ but ‘He showed his friend, John and Mary’.
		</li>
</ul>
<h3>Semicolons</h3>
<ul>
<li>
			Use semicolons to separate full sentences that continue a single thought.
		</li>
<li>
			Use semicolons as a lower-precedence delimiter for lists.
		</li>
<li>
			Avoid using multiple semicolons in a single sentence.
		</li>
</ul>
<h3>Colons</h3>
<ul>
<li>
			Use colons to introduce lists.
		</li>
<li>
			Use colons to <em>explain, prove, or refine</em> the preceding thought.
		</li>
<li>
			Avoid using multiple semicolons in a single sentence.
		</li>
</ul>
<h3>Hyphens</h3>
<ul>
<li>
			Use hyphens to join prefixes and suffixes with a word.
		</li>
<li>
			In digital mediums, always use U+2010 instead of the deprecated, ambiguous U+002D.
		</li>
<li>
			Use hyphens to distinguish between homographs.
		</li>
<li>
			Use hyphens to form compound modifiers, except where the first operand is an -ly adverb.
		</li>
<li>
			Use hanging hyphens on both prefixes and suffixes.
		</li>
<li>
			In handwritten text, use hyphens to indicate that words are continued on following lines.
		</li>
</ul>
<h3>En dash</h3>
<ul>
<li>
			Use non‐spaced en dashes to indicate (closed) ranges.
		</li>
<li>
			Use non‐spaced en dashes to indicate relationships between two things.
		</li>
<li>
			Use en dashes with single appended spaces as a replacement for hyphens when one operand includes a space. For example, I would use “pro– San Diego doctrine”. Does anyone have a better alternative?
		</li>
<li>
			Avoid using en dashes in compound modifiers when a comma would suffice.
		</li>
</ul>
<h3>Em dashes</h3>
<ul>
<li>
			Use non‐spaced em dashes to enclose parenthetical but equally important information.
		</li>
<li>
			Use non‐spaced em dashes to provide stylistic and tone-providing sharp breaks in flow.
		</li>
</ul>
<h3>Slashes</h3>
<ul>
<li>
			Prefer other punctuation over slashes.
		</li>
<p>			In informal writing, use ‘and/or’ where applicable to remove ambiguity.
		</li>
</ul>
<h3>Punctuation</h3>
<ul>
<li>
			In informal writing, use exclamation marks, question marks, and interrobangs.
		</li>
<li>
			In informal writing, Use parenthesized exclamation marks and question marks in the middle of sentences.
		</li>
</ul>
<h3>Figures</h3>
<ul>
<li>
			Present numbers as words only when they can be pronounced in fewer than four syllables <em>and</em> written in less than one word.
		</li>
<li>
			Not provide information to distinguish between the long and short systems.
		</li>
<li>
			Prefer using ‘USD’ or other unambiguous symbols of currency units over the generic ‘$’ and ‘¤’ except when previous text makes the meaning of ‘$’ or ‘¤’ obvious.
		</li>
<li>
			Always prefer <acronym title="Standard International">SI</acronym> and other prescribed standards over other systems.
		</li>
<li>
			Use scientific notation (using superscript forms) for large numbers and <a href="http://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation">Kunth’s up-arrow notation</a> for extremely large, known numbers when precision is required</a>.
		</li>
<li>
			Abbreviate units in scientific and informal writing.
		</li>
<li>
			Generally use <acronym title="Standard International">SI</acronym> prefixes but may present figure forms in scientific notation as alternatives to extremely high and uncommon prefixes.
		</li>
<li>
			Use <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO 8601</a> for dates.
		</li>
<li>
			In digital mediums, use digit dashes (U+2102) instead of hyphens in text that contains numbers.
		</li>
</ul>
<h3>Formatting</h3>
<ul>
<li>
			In digital mediums, italicize programming keywords, computer commands, hash sums, foreign text, and other non-English text. When referring to the text as text, I do not use single quotes (I normally would).
		</li>
<li>
			In digital mediums, use italicized text for emphasis.
		</li>
<li>
			In informal text in digital mediums, use bold text for serious emphasis.
		</li>
<li>
			In digital mediums, not underline text.
		</li>
<li>
			In hand-written text, underline titles of creative works.
		</li>
</ul>
<h3>Other grammar</h3>
<ul>
<li>
			Start sentences with ‘But’ and ‘And’ when doing so enhances readability.
		</li>
<li>
			Not confuse ‘which’ and ‘that’.
		</li>
<li>
			Always use commas for non-essential clauses and never use commas for essential clauses.</p>
<li>
			Use who and whom correctly.
		</li>
<li>
			Use data as plural and datum as singular, radius and singular and radii as plural, cactus as singular and cacti as plural, and so on.
		</li>
<li>
			Choose <strong>not to split</strong> infinitives except in some circumstances.
		</li>
<li>
			End sentences with prepositions where doing so is clearer.
		</li>
<li>
			Not use ‘they’ as a replacement for ‘he or she’.
		</li>
<li>
			Prefer comparative and superlative adverbs and adjectives over ‘more’ and ‘most’.
		</li>
<li>
			When using comparative adverbs and adjectives, include both operands of the comparison.
		</li>
</ul>
<h3>Spelling</h3>
<ul>
<li>
			Use -ize over -ise, -yze over -yse, -er over -re, and -xion over -ction (“the American way” ¹).
		</li>
<li>
			Now use -or over -our.
		</li>
<li>
			Prefer standard -ed endings for irregular verbs (“the American way”).
		</li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li>
			Enclose words and other characters in single quotes to refer to the word itself or characters themselves.
		</li>
<li>
			In digital mediums, always use correct Unicode character identities if possible, including for en dashes (U+2013), em dashes (U+2014), figure dashes (U+2012), swung dashes (U+2053), soldi (U+2044 ²), ellipsis (U+2026), single quotation marks (U+2018 and U+2019), double quotation marks (U+201C and U+201D), prime marks (U+2032, U+2033, U+2034, and U+2057), and minus signs (U+2212).
		</li>
<li>
			When referring to the plurality of a single character (as text), italicize the character and append ‘-s’. For example, I would write “multiple <em>a</em>-s”.
		</li>
<li>
			Use contractions only in <em>some</em> informal text.
		</li>
<li>
			Use <acronym title="International Phonetic Alphabet">IPA</acronym> where helpful.
		</li>
<li>
			Not invent words and other dittononsensibilities.
		</li>
<li>
			Not use second-person in cases where third-person is more clear.
		</li>
<li>
			Use <a href="http://en.wikipedia.org/wiki/Harvard_style_(referencing)">Harvard‐style citation</a>.
		</li>
<li>
			Use footnotes as supplemental notes for non‐normative information.
		</li>
</ul>
<p>¹ With regard to ‐ize and ‐ise and ‐yze and ‐yse and with note to common ignorance, the “American way” predates the “British way”, and the “British way” only <em>became</em> the “British way” during the last century. French influence and disdain for American conventions are two potential explanations for the switch.<br />
² Unicode incorrectly assigned the solidus to be “FRACTION SLASH U+2044” and the slash to be “SOLIDUS U+002F”.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/ramblings/linguistic-and-typographical-conventions/feed</wfw:commentRss>
		</item>
		<item>
		<title>User‐agent detection using regular expressions and relational databases</title>
		<link>http://www.dmtdev.com/blog/computer-science/web-design/user-agent-detection-using-regular-expressions-and-relational-databases</link>
		<comments>http://www.dmtdev.com/blog/computer-science/web-design/user-agent-detection-using-regular-expressions-and-relational-databases#comments</comments>
		<pubDate>Tue, 09 Jun 2009 22:46:39 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[web design]]></category>

		<category><![CDATA[agent]]></category>

		<category><![CDATA[architecture]]></category>

		<category><![CDATA[browser]]></category>

		<category><![CDATA[detection]]></category>

		<category><![CDATA[download]]></category>

		<category><![CDATA[expressions]]></category>

		<category><![CDATA[http]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[mac]]></category>

		<category><![CDATA[operating system]]></category>

		<category><![CDATA[os]]></category>

		<category><![CDATA[regex]]></category>

		<category><![CDATA[regular]]></category>

		<category><![CDATA[string]]></category>

		<category><![CDATA[user]]></category>

		<category><![CDATA[user-agent]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=544</guid>
		<description><![CDATA[Detecting clients is trivial yet extremely difficult to do well. Developing a mechanism that properly and reliably detects operating systems and architectures in order to provide specifically‐targeted downloads requires patience. Because I remain infatuated with dynamic solutions, the solution I used is atypical.
I have a database table (inappropriately called archs) with six columns:


id [unsigned int [...]]]></description>
			<content:encoded><![CDATA[<p>Detecting clients is trivial yet extremely difficult to do well. Developing a mechanism that properly and reliably detects operating systems and architectures in order to provide specifically‐targeted downloads requires patience. Because I remain infatuated with dynamic solutions, the solution I used is atypical.</p>
<p>I have a database table (inappropriately called <em>archs</em>) with six columns:</p>
<ol>
<li>
<strong>id [unsigned int (10)] {primary key, auto_increment}</strong><br />
An integer identification.
</li>
<li>
<strong>name [varchar (80)] {unique}</strong><br />
A short, unique name, which is displayed to the user.
</li>
<li>
<strong>regex_match [varchar (250)]</strong><br />
A Perl‐compatible regular expression that matches any <acronym title="Hyper‐Text Transfer Protocol">HTTP</acronym> 1.1 <em>User-agent</em> header string that user agents running on this row’s operating system could reasonably supply. Needs not uniquely match, not even within the same <em>group</em>; overlap of matches between rows that share a <em>group</em> is permissible.
</li>
<li>
<strong>{default=null} stamp [timestamp] {default=current_timestamp}</strong><br />
The time at which the row was inserted.
</li>
<li>
<strong>precedence [unsigned tinyint (3)]</strong><br />
Indicates the order in which the regular expression should be processed. For example, a row for Unix‐like might have a precedence of 1 and rows for GNU‐Linux and FreeBSD might have a precedence of 2. The <acronym title="PHP: Hyper‐Text Preprocessor">PHP</acronym> code processes expressions with lower precedence first (the motiviations for this are strong and are explained in the code’s documentation).
</li>
<li>
<strong>group [unsigned smallint (5)] {default=null}</strong><br />
A <em>group</em> of related rows under which this row falls. Corresponds to the <em>id</em> of another (parent) row, which has a precedence of this row’s − 1, resulting in a many‐to‐one multiplicity. For example, the GNU‐Linux and FreeBSD rows might share the <em>group</em> equal to the Unix‐like row’s <em>id</em>, and they would have a <em>precedence</em> of one higher than the Unix‐like row’s <em>precedence</em>.<br />
After the <acronym title="PHP: Hyper‐Text Preprocessor">PHP</acronym> code matches the User‐agent string against rows of a given precedence, it attempts to match it against rows of a precedence one higher.
</li>
</ol>
<p>Here are the rows I have:</p>
<table style="border: 1px solid black; padding-left: .1em; padding-right: .1em; margin-left: -130px;">
<tr>
<th style="border-bottom: 1px dashed black;">Id</th>
<th style="border-bottom: 1px dashed black;">Name</th>
<th style="border-bottom: 1px dashed black;">Regular expression</th>
<th style="border-bottom: 1px dashed black;">P</th>
<th style="border-bottom: 1px dashed black;">G</th>
</tr>
<tr>
<td>1</td>
<td>platform‐independent</td>
<td>
<pre style="color:#302000;">.*</pre>
</td>
<td>1</td>
<td>NULL</td>
</tr>
<tr>
<td>2</td>
<td>Windows</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows).*</pre>
</td>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>3</td>
<td>Unix‐like</td>
<td>
<pre style="color:#302000;">.*\(.*([uU]nix|[sS]olaris|[fF]ree|[oO]pen|[nN]et)[bB][sS][dD]|[sS]un[oO][sS]|[lL]inux|cygwin).*</pre>
</td>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>4</td>
<td>Mac OS</td>
<td>
<pre style="color:#302000;">.*\(.*([mM]acintosh|[pP]ower[pP][cC]|[aA]pple|(ppc|PPC) [mM]ac).*</pre>
</td>
<td>2</td>
<td>1</td>
</tr>
<tr>
<td>5</td>
<td>GNU–Linux</td>
<td>
<pre style="color:#302000;">.*\(.*([lL]inux|cygwin).*</pre>
</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>6</td>
<td>Unix</td>
<td>
<pre style="color:#302000;">.*\(.*([uU]nix).*</pre>
</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>7</td>
<td>BSD</td>
<td>
<pre style="color:#302000;">.*\(.*(([fF]ree|[oO]pen|[nN]et)[bB][sS][dD]|[sS]un[oO][sS]).*</pre>
</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>8</td>
<td>Solaris</td>
<td>
<pre style="color:#302000;">.*\(.*([sS]olaris).*</pre>
</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>9</td>
<td>OS/2</td>
<td>
<pre style="color:#302000;">.*\(.*(OS/2).*</pre>
</td>
<td>3</td>
<td>3</td>
</tr>
<tr>
<td>10</td>
<td>Windows Vista</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows [nN][tT] 6.0|[wW]indows [vV]ista).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>11</td>
<td>Windows NT 5.2</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows [nN][tT] 5.2|[wW]indows [sS]erver 2003|[wW]indows [xX][pP] x64 [eE]dition).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>12</td>
<td>Windows XP</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows [nN][tT] 5.1|[wW]indows [xX][pP]).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>13</td>
<td>Windows 2000, SP1</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows [nN][tT] 5.01|[wW]indows 2000).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>14</td>
<td>Windows 2000</td>
<td>
<pre style="color:#302000;">.*\(.*([wW]indows [nN][tT] 5.01|[wW]indows 2000).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>15</td>
<td>Windows ME</td>
<td>
<pre style="color:#302000;">.*\(.*[wW]in( 9x 4.90|dows 98).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>16</td>
<td>Windows 95</td>
<td>
<pre style="color:#302000;">.*\(.*[wW]indows 95).*</pre>
</td>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>17</td>
<td>Mac OS PPC</td>
<td>
<pre style="color:#302000;">.*\(.*([pP]ower[pP][cC]|(ppc|PPC) [mM]ac)).*</pre>
</td>
<td>3</td>
<td>5</td>
</tr>
</table>
<p>I tested these expressions using <a href="http://regexxer.sourceforge.net/">Regexxer</a> 0.9 and this <a href="http://www.pgts.com.au/download/data/browser_list.txt">list of user‐agent strings</a>.<br />
This <a href="http://www.dmtdev.com/current/dmtdev/browser-detection.sql">table is available</a> in .<acronym title="Structured Query Language">sql</acronym> format. I will provide the <acronym title="PHP: Hyper‐Text Preprocessor">PHP</acronym> source code soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/computer-science/web-design/user-agent-detection-using-regular-expressions-and-relational-databases/feed</wfw:commentRss>
		</item>
		<item>
		<title>Good Programming Language Features</title>
		<link>http://www.dmtdev.com/blog/computer-science/language-design/good-programming-language-features</link>
		<comments>http://www.dmtdev.com/blog/computer-science/language-design/good-programming-language-features#comments</comments>
		<pubDate>Fri, 03 Apr 2009 23:27:35 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[language design]]></category>

		<category><![CDATA[comparison]]></category>

		<category><![CDATA[feature]]></category>

		<category><![CDATA[features]]></category>

		<category><![CDATA[language]]></category>

		<category><![CDATA[list]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=525</guid>
		<description><![CDATA[This post presents a list of programming language features I have had good experiences with. It is neither absolute nor complete, but it accurately—albeit not conclusively—outlines my preferences in programming languages. Each preference is my opinion, and I remain open to discussion. I deliberately kept these items specific rather than abstract (for example, “concision” is [...]]]></description>
			<content:encoded><![CDATA[<p>This post presents a list of programming language features I have had good experiences with. It is neither absolute nor complete, but it accurately—albeit not conclusively—outlines my preferences in programming languages. Each preference is <em>my opinion</em>, and I remain open to discussion. I deliberately kept these items specific rather than abstract (for example, “concision” is not included). With that said, I prefer languages that are open source, fiscally inexpensive, standardized, high-performance, and concise in syntax.</p>
<p>I present this list partially in response to something I dislike: programming language advocacy and “us-versus-them” philosophy. Let’s be clear: it <em>is possible</em> for a language to have zero strengths, but it is hardly likely. Different languages are more suited for different purposes, some languages have overall weaknesses or overall strengths as a result of failed or successful experiments, and some languages are no longer widely used—some for good reasons. In every case, a combination of arrogance and conviction does not benefit. “Your” language may be superior—or inferior—to some other, but I encourage everyone to maintain a broader and more logical approach: examine languages’ strengths and weaknesses without arrogance or religious zeal. Thank you.</p>
<p>Here is the list, sorted by relative importance (most important first) <em>constrained by implementations of the notion with which I am familiar</em> (for example, <em>constructors</em> is ranked lowly, but implementations could exist so extreme that they would be more important. Some of these points only apply to certain types of languages. Languages whose implementations exemplify each point are placed in parenthesis.</p>
<ul>
<li>
<strong>Strong, static typing (Java):</strong><br />
Types must be declared. Five does not equal true.</p>
<pre class="syntax-highlight:java">
if (5 == true) {} // Error
</pre>
</li>
<li>
<strong>Object orientation and namespaces (Java):</strong><br />
Everything is or is contained within a class. No global namespace exists.<br />
Imports are controlled explicitly with a directive. Package definitions are hierarchical and are coupled to class locations. Members <em>must</em> be defined in their corresponding class.
</li>
<li>
<strong>Implicit accessors (C#):</strong><br />
Getters and setters are called implicitly.</p>
<pre class="syntax-highlight:c#">
public int halfLife {
	get {
		return halfLife;
	}
	set {
		halfLife = value;
	}
}
void foo() {
	int bar = halfLife; // Calls the getter
	halfLife = 5; // Calls the setter
}
</pre>
</li>
<li>
<strong>Encapsulation (C#):</strong><br />
Encapsulation is handled explicitly. Access can differ between accessors and mutators.</p>
<pre class="syntax-highlight:c#">
private int halfLife {
	public get {
		return halfLife;
	}
	private set {
		halfLife = value;
	}
}
</pre>
</li>
<li>
<strong>Garbage collection (Java):</strong><br />
Allocation and dellocation of resources is handled automatically. Java-style destructors are permitted. Garbage collection can be invoked explicitly.</p>
<pre class="syntax-highlight:java">
class Foo {
	void openConnection() {}
	void closeConnection() {}
	void doEverything() {}
	void run() {
		Runtime.getRuntime().gc(); // Runs the garbage collector
	}
	protected void finalize() {
		closeConnection();
	}
}
</pre>
</li>
<li>
<strong>Information hiding (C#):</strong><br />
Encapsulation is supported at language-level with access-modification keywords.<br />
The access modification can be <em>private</em>, <em>public</em>, <em>protected</em>, <em>internal</em>, and <em>protected internal</em>; allowing full control in specifying access of subclasses, internal classes, and external classes. </p>
<pre class="syntax-highlight:c#">
public class Fruit {
	static fruitOnTree = 100;
	protected static Fruit pick() {
		fruitOnTree--;
		return new Fruit();
	}
	protected internal static Fruit purchase() {
		return new Fruit();
	}
}
public class Apple : Fruit {
	public Apple() {
        	Fruit.pick();         // Cannot
		Fruit.purchase(); // Can
	}
}
</pre>
</li>
<li>
<strong>Pointcut–Join-Point–Advice Model (AspectJ):</strong></p>
<pre class="syntax-highlight:java">
aspect ColorControl {
	pointcut CCClientCflow(ColorControllingClient client):
		cflow(call(* * (..)) &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; target(client));
	pointcut make(): call(FigureElement Figure.make*(..));
	after (ColorControllingClient c) returning (FigureElement fe):
		make() &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; CCClientCflow(c) {
		fe.setColor(c.colorFor(fe));
	}
}
</pre>
<p>This example was shamelessly “borrowed”.<br />
<cite><a href=http://eclipse.org/aspectj/doc/released/progguide/starting-production.html">AspectJ Programming Guide</a></cite>
</li>
<li>
<strong>Multiple return (Python):</strong><br />
Methods can return multiple values using tuples.</p>
<pre class="syntax-highlight:python">
def foo():
	return 3, &quot;hello&quot;
my_int, my_str = foo()
</pre>
</li>
<li>
<strong>First-class functions (Python):</strong><br />
Functions are first-class objects and can be interchanged easily.</p>
<pre class="syntax-highlight:python">
def major_slice(items):
	return items[0] ** 2
def minor_slice(items):
	return math.sqrt(items[0])
def print_slices(items):
	for f in [major_slice, minor_slice]:
		print(f(t))
</pre>
</li>
<li>
<strong>Pointers (Java):</strong><br />
Direct object access through pointers is not allowed. Actual objects are never handled; only references are used.</p>
<pre class="syntax-highlight:java">
Car mycar = new Car(); // Creates a reference
Car mycaragain = mycar; // Creates another reference
Car hiscar = mycar.clone(); // Creates a new object
</pre>
</li>
<li>
<strong>Exception handling (Python, Java):</strong><br />
Exceptions are handled with <em>try</em>, <em>except</em> or <em>catch</em>, <em>else</em>, and <em>finally</em> blocks, which act on subclasses of some Exception superclass. A single <em>except</em> or <em>catch</em> statement can catch multiple types. Exceptions are thrown with <em>raise</em> or <em>throw</em> and can be chained. Java-style checked exceptions do not exist.</p>
<pre class="syntax-highlight:python">
try:
	foo()
except SizeError, WidthError:
	print(&#039;failure: size or width&#039;)
except FormatError
	print(&#039;failure: format&#039;)
else:
	print(&#039;success&#039;)
finally:
	print(&#039;finished&#039;)
</pre>
<pre class="syntax-highlight:java">
try {
	read();
} catch (IOException ioe) {
	throw new BadStuffHappenedException(ioe); // Chained exception
}
</pre>
</li>
<li>
<strong>Generics (C#):</strong><br />
Java- and C#-style generics. The information is retained at compile-time to enhance reflection.</p>
<pre class="syntax-highlight:c#">
Thing&lt;String&gt; foo = Thing&lt;String&gt;();
foo.GetType(); // Returns information about the generics
</pre>
</li>
<li>
<strong>Unicode support (Java):</strong><br />
All strings use UTF-16.</p>
<pre class="syntax-highlight:java">
String status = &quot;?!&quot;;
</pre>
</li>
<li>
<strong>Constants (D):</strong><br />
Declaring an object as immutable forbids changes to any of its fields.</p>
<pre class="syntax-highlight:c">
immutable Car car = Car();
car.brand = &quot;Ford&quot; // Error
</pre>
<p>Declaring an object as immutable forbids changes to any of its fields <em>only through that reference</em>.</p>
<pre class="syntax-highlight:c">
Car car1 = new Car();
car.brand = &quot;Ford&quot; // Fine
const Car car2 = car1
car.brand = &quot;Ford&quot; // Error
</pre>
</li>
<li>
<strong>Closures (Scheme):</strong><br />
Closures are fully supported.</p>
<pre class="syntax-highlight:ruby">
(define (derivative f dx)
  (lambda (x) (/ (- (f (+ x dx)) (f x)) dx)))
</pre>
<p>Shamelessly “borrowed” from Wikipedia.
</li>
<li>
<strong>Interfaces (Java):</strong><br />
Interfaces are distinct concepts from inheritance used to bind class implementations to specific external handling.</p>
<pre class="syntax-highlight:java">
interface Writer {
	public void write();
}
class Thing implements Writer { // Error
	doWhatever();
}
</pre>
</li>
<li>
<strong>Inheritance (C++, Java):</strong><br />
Multiple inheritance is supported (as in C++). All methods are virtual by default (as in Java). Inheritance can be forbidden by using <em>final</em> (as in Java).</p>
<pre class="syntax-highlight:c++">
class Fruit {}
class Juice {}
class AppleJuice : Fruit, Juice {}
</pre>
<pre class="syntax-highlight:java">
class Fruit {
	void doCoolThing() {}
}
class Apple extends Fruit {
	void doCoolThing {}
}
final class ThingHandler {
	Apple apple = new Apple();
	apple.doCoolThing(); // Always calls Apple.doCoolThing() and never Fruit.doCoolThing()
}
final class ThingHandler2 {} // Error
</pre>
</li>
<li>
<strong>Contracts (D):</strong><br />
Contracts are handled explicitly with the keywords <em>assert</em>, <em>in</em>, <em>out</em>, and <em>body</em>.</p>
<pre class="syntax-highlight:c">
long squareRoot(int n)
in {
	assert (n &gt; -1)
}
out (result) {
	assert((result * result) &lt;= n &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; (result + 1) * (result + 1) &gt;= n);
}
body {
	return std.math.sqrt(n);
}
</pre>
</li>
<li>
<strong>Enums (Java):</strong><br />
Values can be assigned to enumerations. Enum definitions can contain methods and constructors.</p>
<pre class="syntax-highlight:java">
enum Direction {
	NORTH(0, -1),
	NORTH_WEST(-1, -1),
	WEST(-1, 0),
	SOUTH_WEST(-1, 1),
	SOUTH(0, 1),
	SOUTH_EAST(1, 1),
	EAST(1, 0),
	NORTH_EAST(-1, 1);

	public int x;
	public int y;
	boolean isDiagonal() {
		if (x == 0 ^ y == 0) {
			return true;
		}
		return false;
	}
}
</pre>
</li>
<li>
<strong>Overloading (C):</strong><br />
Method signatures consist of a name and an argument list.</p>
<pre class="syntax-highlight:c">
String foo(int a, double b) {} // Fine
String foo(bool a) {} // Fine
int foo(int a, double b) {} // Error
</pre>
</li>
<li>
<strong>Streams (Java):</strong><br />
Streams are handled abstractly and can be wrapped into other streams.</p>
<pre class="syntax-highlight:java">
URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
GZIPInputStream gzis = new GZIPInputStream(stream); // Wrapped stream
</pre>
</li>
<li>
<strong>True multidimensional arrays (C#):</strong><br />
Continuity of memory allocation for multidimensional arrays is ensured. Jagged arrays are easy to use.</p>
<pre class="syntax-highlight:c#">
int[,] foo = new int[10,4]; // These indexes are stored are stored continuously in one block.
foo[2][3] = 5;
int[][] myJaggedArray = new int[][]  {
	new int[] {1, 2},
	new int[] {1, 2, 3},
	new int[] {6}
};
</pre>
</li>
<li>
<strong>Abstract classes (Java):</strong><br />
Abstract classes are <em>purely abstract</em> and cannot contain implementations.</p>
<pre class="syntax-highlight:java">
abstract class Foo {
	public doThing() {
		doOtherThing(); // Error
	}
}
</pre>
</li>
<li>
<strong>Constant methods (C++):</strong><br />
Methods can be defined that cannot change their object’s fields.</p>
<pre class="syntax-highlight:c++">
const getFoo() {
	x = 5; // Error
}
</pre>
</li>
<li>
<strong>Operator overloading (C++):</strong><br />
Operator overloading is permitted. Overloading of the assignment operator and parenthesis is not allowed. Right-associative operator chaining is permitted and is implemented for library classes.</p>
<pre class="syntax-highlight:c++">
class Foo {
	Foo Foo::operator += (const Foo&amp;amp; rhs) {}
	Foo Foo::operator ! (const Foo&amp;amp; rhs) const {}
	Foo Foo::operator - (const Bar&amp;amp; rhs) const {} // Error
}
void bar() {
	int a, b, c, d;
	a = b = c = d = 0;
}
</pre>
</li>
<li>
<strong>Constructors (none):</strong><br />
Constructors may implicitly set fields with something like:</p>
<pre class="syntax-highlight:java">
class Foo {
	int x;
	string s;
	Foo(int# x, string# s) {} // This sets Foo.x and Foo.s
}
</pre>
<p>I have never seen this implemented, though a Java 7 <acronym title="Java Specification Request">JSR</acronym> suggested something similar (using the <em>this</em> keyword).
</li>
<li>
<strong>Documentation generation (C#):</strong><br />
Metadata for documentation is contained within the source code, is generated easily, and is specified with <acronym title="eXtensible Markup Language">XML</acronym>.
</li>
<pre class="syntax-highlight:c#">
/// &lt;summary&gt;
/// This class perfoms complex foo.
/// &lt;/summary&gt;
/// &lt;exception cref=&quot;IOException&quot;&gt;
/// Oh dear!
/// &lt;/exception&gt;
</pre>
</li>
<li>
<strong>List comprehensions (Python):</strong><br />
List comprehensions are simple.</p>
<pre class="syntax-highlight:python">
def get_slices(self):
	return [Math.tan(slice ** 2) for slice in pie]
</pre>
</li>
<li>
<strong>Annotations (Java):</strong><br />
A simple annotation syntax can attach metadata to code. Custom annotation types can be defined.</p>
<pre class="syntax-highlight:java">
@Deprecated
class Bar {}
@RequestForEnhancement
class Foo {
	@NotNull
	static Bar bar;
}
</pre>
</li>
<li>
<strong>Loops (PHP, None):</strong><br />
Iteration over multiple data is simple.</p>
<pre class="syntax-highlight:php">
foreach ($array as $index =&gt; $value) {}
</pre>
<p>A simple <em>repeat</em> keyword allows straightforward repetition:</p>
<pre class="syntax-highlight:c">
repeat (5):
	do_foo()
</pre>
</li>
<li>
<strong>Static If (D):</strong><br />
There are static if-s, which are evaluated at compile-time.</p>
<pre class="syntax-highlight:c">
static if(n == 1) {
	// Do something
}
</pre>
</li>
<li>
<strong>Switch statements (C#):</strong><br />
Switch statements break automatically; they will “fall through” only if explicitly requested. Strings are permitted in switch statements.</p>
<pre class="syntax-highlight:c#">
switch (message) {
	case &quot;Hello&quot;:
		sayHello();
		message = &quot;Goodbye&quot;
	case &quot;Goodbye&quot;
		sayGoodbye(); // Will not execute
}
</pre>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/computer-science/language-design/good-programming-language-features/feed</wfw:commentRss>
		</item>
		<item>
		<title>Fourmilab and Java+Hotbits+TLS</title>
		<link>http://www.dmtdev.com/blog/other-science/fourmilab-and-java-hotbits-tls</link>
		<comments>http://www.dmtdev.com/blog/other-science/fourmilab-and-java-hotbits-tls#comments</comments>
		<pubDate>Fri, 20 Mar 2009 01:25:02 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[other science]]></category>

		<category><![CDATA[security and cryptography]]></category>

		<category><![CDATA[fourmilab]]></category>

		<category><![CDATA[hotbits]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[randomHotBits]]></category>

		<category><![CDATA[randomx]]></category>

		<category><![CDATA[secure]]></category>

		<category><![CDATA[ssl]]></category>

		<category><![CDATA[tls]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=510</guid>
		<description><![CDATA[In paranoid cryptographic applications, I use John Walker’s HotBits, a free service which generates genuine random data based on radioactive decay. It generates ½ bits per sample, using radiation generated from Cæsium-137 beta decay:

The service stores the generated data in a buffer; when it serves a request, it pops the data and transmits it.
I trust [...]]]></description>
			<content:encoded><![CDATA[<p>In paranoid cryptographic applications, I use <a href="http://www.fourmilab.ch/hotbits/">John Walker’s HotBits</a>, a free service which generates genuine random data based on radioactive decay. It generates ½ bits per sample, using radiation generated from Cæsium-137 beta decay:</p>
<p><img class="alignnone size-full wp-image-511" title="cs137decay" src="http://www.dmtdev.com/blog/wp-content/cs137decay.png" alt="Cæsium‐137 decay reaction" width="480" height="28" /></p>
<p>The service stores the generated data in a buffer; when it serves a request, it pops the data and transmits it.<br />
I trust HotBits over other solutions such as <a title="random.org—atmospheric noise generation" href="http://www.random.org">random.org</a> because their <a title="a statistical analysis of HotBits" href="http://www.fourmilab.ch/hotbits/statistical_testing/stattest.html">entropy seems more reliable</a> and because they provide a <a title="HotBits’s secure transfer page" href="https://www.fourmilab.ch/hotbits/secure_generate.html"><acronym title="Transport Layer Security">TLS</acronym>‐secured request page</a>. I am also naturally less suspicious of providers of <a title="Fourmilab’s Solar System Live" href="http://www.fourmilab.ch/solar/solar.html">cool free services</a> and open source software, providers of <a title="a collection of short science fiction stories by John Walker" href="http://www.fourmilab.ch/nav/topics/sf.html">science fiction stories</a>, and anything whose <a title="the Fourmilab Frequently Asked Questions page" href="http://www.fourmilab.ch/nav/topics/faq.html">name means “ant lab”</a> in French.<br />
I built upon Fourmilab’s <a title="the randomX Java package’s homepage" href="http://www.fourmilab.ch/hotbits/source/randomX/randomX.html">randomX</a> Java encryption package in my class <a title="Douglas Myers–Turnbull’s SecureRandomHotBits class" href="http://www.dmtdev.com/current/other/SecureRandomHotBits.java"><strong>SecureRandomHotBits</strong></a>, which accesses the TLS‐secured HotBits for enhanced security. My code does not extend randomX’s randomHotBits but easily can; add <em>extends randomHotBits</em> to the class declaration to extend randomX functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/other-science/fourmilab-and-java-hotbits-tls/feed</wfw:commentRss>
		</item>
		<item>
		<title>Gone too far</title>
		<link>http://www.dmtdev.com/blog/ramblings/sarcasm/gone-too-far</link>
		<comments>http://www.dmtdev.com/blog/ramblings/sarcasm/gone-too-far#comments</comments>
		<pubDate>Thu, 19 Mar 2009 17:57:43 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[sarcasm]]></category>

		<category><![CDATA[8]]></category>

		<category><![CDATA[citizen]]></category>

		<category><![CDATA[definition]]></category>

		<category><![CDATA[floodgates]]></category>

		<category><![CDATA[gay]]></category>

		<category><![CDATA[god]]></category>

		<category><![CDATA[hell]]></category>

		<category><![CDATA[land-owning]]></category>

		<category><![CDATA[male]]></category>

		<category><![CDATA[marriage]]></category>

		<category><![CDATA[prop]]></category>

		<category><![CDATA[sheep]]></category>

		<category><![CDATA[sinful]]></category>

		<category><![CDATA[white]]></category>

		<category><![CDATA[william murray]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=507</guid>
		<description><![CDATA[Posted under sarcasm.
Lately I have been pondering this ridiculous notion called “gay rights”—apparently sinful atheistic Muslims want to practice the disease of homosexuality under US law. The Lord is omnipresent and will see through these Communist homosexuals and weigh their intentions, but He asked me to vote for Proposition Eight anyways because He recognizes our [...]]]></description>
			<content:encoded><![CDATA[<p>Posted under <a href="http://www.dmtdev.com/blog/category/ramblings/sarcasm">sarcasm</a>.</p>
<p>Lately I have been pondering this ridiculous notion called “gay rights”—apparently sinful atheistic Muslims want to practice the disease of homosexuality under US law. The Lord is omnipresent and will see through these Communist homosexuals and weigh their intentions, but He asked me to vote for Proposition Eight anyways because He recognizes our need to constrain their sin. Homosexuals that would have sinfully “married” without mortal law will be condemned to Hell anyways, but Proposition Eight is nonetheless needed.<br />
Despite what <a title="William J Murray’s homepage" href="http://www.wjmurray.com/">William J Murray</a> (God bless him, and may his atheistic mother burn for eternity) <a title="a Youtube video—debate on school prayer" href="http://www.youtube.com/watch?v=-hM8MiD95Nk">thinks</a>, societies cannot have absolutes. Homosexual marriage is illegal because lines must be drawn; sooner or later some sinful heathen farmer might marry his sheep! If you open the floodgates, who knows what sinners will attempt? Recognizing this point—and with the Lord’s help, I propose new legislation:<br />
The United States’ Framers recognized the definition of citizen only to include white, land‐owning males. Clearly, we have shifted from the Lord’s path: first those without property, then non‐whites, then women, and then His youngest children. Soon some farmer will want his sheep to vote! Lines must be drawn; hence, God and I propose that “citizen” be reverted to its proper definition.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/ramblings/sarcasm/gone-too-far/feed</wfw:commentRss>
		</item>
		<item>
		<title>Compiz with fglrx on Mobility Radeon 3400</title>
		<link>http://www.dmtdev.com/blog/computer-science/linux/compiz-with-fglx-on-mobility-radeon-3400</link>
		<comments>http://www.dmtdev.com/blog/computer-science/linux/compiz-with-fglx-on-mobility-radeon-3400#comments</comments>
		<pubDate>Sun, 08 Mar 2009 05:01:54 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[3400]]></category>

		<category><![CDATA[amd]]></category>

		<category><![CDATA[ati]]></category>

		<category><![CDATA[beryl]]></category>

		<category><![CDATA[compiz]]></category>

		<category><![CDATA[fedora]]></category>

		<category><![CDATA[fglrx]]></category>

		<category><![CDATA[fusion]]></category>

		<category><![CDATA[hd]]></category>

		<category><![CDATA[mobility]]></category>

		<category><![CDATA[radeon]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=418</guid>
		<description><![CDATA[On 2009‒02‒16, I wrote:

While still in the mood for pointless Linux software, I tried Compiz Fusion again—again, with no success. I plan to wait until the RadeonHD driver is finished. I have not tried AMD’s proprietary fglrx driver thanks to horror stories of system crashes and hardware damage.

I tried fglrx anyways. I followed fedoraforum.org’s tutorial [...]]]></description>
			<content:encoded><![CDATA[<p>On 2009‒02‒16, <a href="http://www.dmtdev.com/blog/computer-science/linux/fedora-plymouth-graphics-and-compiz-fusion" title="post on Fedora Plymouth graphics and Compiz Fusion">I wrote</a>:</p>
<blockquote><p>
While still in the mood for pointless Linux software, I tried <a href="http://www.compiz-fusion.org/">Compiz Fusion</a> again—again, with no success. I plan to wait until the <a href="http://www.x.org/wiki/radeonhd">RadeonHD</a> driver is finished. I have not tried <acronym title="Advanced Micro Devices">AMD</acronym>’s proprietary <a href="http://en.wikipedia.org/wiki/Fglrx">fglrx</a> driver thanks to horror stories of system crashes and hardware damage.
</p></blockquote>
<p>I tried fglrx anyways. I followed <a href="http://www.fedorafaq.org/#radeon" title="fedoraforum.org’s FAQ for installing fglrx">fedoraforum.org’s tutorial</a> for my Dell Studio 15, Radeon Mobility, and Fedora 12, and I now have Compiz Fusion working. I encountered three issues:</p>
<ul>
<li>
Using the <a href="http://wiki.compiz-fusion.org/Plugins/Animation" title="a description of the Compiz Fusion plugin, Animation">Animation plugin</a>, effects are not displayed for the shade, focus, and minimize actions.
</li>
<li>
Occasionally when I switch back to Firefox, Firefox’s scroll bar will not function unless I maximize, resize, or move Firefox. This occurs even with all plugins disabled.
</li>
<li>
When opened, gnome-compiz-manager returns the error: &#8220;Type mismatch: Expected list, got string&#8221;. I cannot change the shortcut keys in any menu. (I use <a href="http://wiki.compiz-fusion.org/CCSM" title="compiz.org’s description of the CompizConfig Settings Manager">CCSM</a>).
</li>
</ul>
<p>I will post any solutions here; otherwise I will file a bug report against <a href="http://bugs.freedesktop.org/" title="the Free Desktop bug database">freedesktop.org’s bug database</a>.<br />
Otherwise, Compiz is functioning beautifully on my Mobility Radeon HD 3400. I added compiz-fusion-icon to my Gnome startup scripts, which serves to load it automatically.<br />
I’m off to spin my desktop. I might post screenshots later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/computer-science/linux/compiz-with-fglx-on-mobility-radeon-3400/feed</wfw:commentRss>
		</item>
		<item>
		<title>Fedora Plymouth Graphics and Compiz Fusion</title>
		<link>http://www.dmtdev.com/blog/computer-science/linux/fedora-plymouth-graphics-and-compiz-fusion</link>
		<comments>http://www.dmtdev.com/blog/computer-science/linux/fedora-plymouth-graphics-and-compiz-fusion#comments</comments>
		<pubDate>Mon, 16 Feb 2009 23:42:38 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[10]]></category>

		<category><![CDATA[3400]]></category>

		<category><![CDATA[animation]]></category>

		<category><![CDATA[boot]]></category>

		<category><![CDATA[cambridge]]></category>

		<category><![CDATA[compiz]]></category>

		<category><![CDATA[fedora]]></category>

		<category><![CDATA[fusion]]></category>

		<category><![CDATA[graphical]]></category>

		<category><![CDATA[hd]]></category>

		<category><![CDATA[mobility]]></category>

		<category><![CDATA[plymouth]]></category>

		<category><![CDATA[radeon]]></category>

		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=381</guid>
		<description><![CDATA[Here are two changes I made to my Fedora install recently—one successful, one not.
&#160;
graphical Fedora Plymouth animation (success)
I will neglect my blog’s philosophy by covering a topic that has already been covered: Axel’s guide describes this process. Derek Hildereth also covered this process, citing Axel’s guide. ⟵I tried this one.
&#160;
My Dell Studio 15 has an [...]]]></description>
			<content:encoded><![CDATA[<p>Here are two changes I made to my Fedora install recently—one successful, one not.</p>
<p style="margin:-.6em">&nbsp;</p>
<h4>graphical Fedora Plymouth animation (success)</h4>
<p>I will neglect <a href="http://www.dmtdev.com/blog/about">my blog’s philosophy</a> by covering a topic that has already been covered: <a href="http://www.my-guides.net/en/content/view/125/26/1/12/#plymouth"><em>Axel</em>’s guide</a> describes this process. <a href="http://www.derekhildreth.com/blog/how-to-enable-graphical-boot-with-plymouth-fedora-tip/">Derek Hildereth</a> also covered this process, citing Axel’s guide. ⟵I tried this one.</p>
<p style="margin: -1em;">&nbsp;</p>
<p><a href="http://www.dmtdev.com/current/other/laptop.html" title="a detailed description of my Dell Studio 15 laptop’s hardware">My Dell Studio 15</a> has an <acronym title="ATI Technology, Inc.">ATI</acronym> Mobility Radeon HD 3400 graphics card, for which I am using <a href="http://x.org">x.org</a>’s default open source driver. I had been using <a title="Fedora 10 features: Plymouth" href="http://fedoraproject.org/wiki/Releases/FeatureBetterStartup">Plymouth</a>’s text animation, assuming that the graphical modes would not work with my card. I followed <a href="http://www.my-guides.net/en/content/view/125/26/1/12/#plymouth"><em>Axel</em>’s guide</a> and now have an esthetic boot sequence. Briefly:</p>
<p>Add a <acronym title="Video Graphics Array">VGA</acronym> framebuffer resolution value to <em>grub.conf</em>. For example, I added the bold text in mine:</p>
<blockquote><p>
title Fedora (2.6.27.12-170.2.5.fc10.i686)<br />
        root (hd0,1)<br />
        kernel /vmlinuz-2.6.27.12-170.2.5.fc10.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet <strong>vga=<em>0&#215;323</em></strong><br />
        initrd /initrd-2.6.27.12-170.2.5.fc10.i686.img
</p></blockquote>
<p><em>vga</em> should be specific to your display. Use the following table, which I obtained from <a href="http://128.194.106.6/~baum/linux/LDP/HOWTO/mini/Vesafb-5.html" title="Steven K. Baum’s page with a VESA mode lookup table and brief description">Steven K. Baum’s reference</a>.</p>
<blockquote>
<pre>
Colours   640x480 800x600 1024x768 1280x1024 1600x1200
--------+---------------------------------------------
256     |  0301    0303     0305     0307      031C
32,768  |  0310    0313     0316     0319      031D
65,536  |  0311    0314     0317     031A      031E
16.8M   |  0312    0315     0318     031B      031F
</pre>
</blockquote>
<p>You can configure Plymouth’s animation with the following two commands (as root):</p>
<blockquote><p>
plymouth-set-default-plugin <em>pluginname {solar, fade-in, pulser, spinfinity}</em><br />
/usr/libexec/plymouth/plymouth-update-initrd
</p></blockquote>
<p style="margin:-.2em">&nbsp;</p>
<h4>Compiz Fusion on Mobility Radeon HD 3400 <acronym title="Free and Open Source Software">FOSS</acronym> drivers (failure)</h4>
<p>While still in the mood for pointless Linux software, I tried <a href="http://www.compiz-fusion.org/">Compiz Fusion</a> again—again, with no success. I plan to wait until the <a href="http://www.x.org/wiki/radeonhd">RadeonHD</a> driver is finished. I have not tried <acronym title="Advanced Micro Devices">AMD</acronym>’s proprietary <a href="http://en.wikipedia.org/wiki/Fglrx">fglrx</a> driver thanks to horror stories of system crashes and hardware damage. It seems that Mobility Radeon HD 3400 graphics cards do not enjoy stable drivers that enable hardware acceleration—yet.</p>
<p style="font-style: italic; color: #006600;">Update: fglrx works perfectly on my Radeon HD 3400, and <a href="http://www.dmtdev.com/blog/computer-science/linux/compiz-with-fglrx-on-mobility-radeon-3400" title="my blog post on fglrx and mobility radeon">I have Compiz working</a>.</p>
<p>If this worked or did not work for you, comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/computer-science/linux/fedora-plymouth-graphics-and-compiz-fusion/feed</wfw:commentRss>
		</item>
		<item>
		<title>ABC’s Story on Abbie Schubert, Dell, and Ubuntu</title>
		<link>http://www.dmtdev.com/blog/ramblings/abcs-story-on-abbie-schubert-dell-and-ubuntu</link>
		<comments>http://www.dmtdev.com/blog/ramblings/abcs-story-on-abbie-schubert-dell-and-ubuntu#comments</comments>
		<pubDate>Thu, 12 Feb 2009 00:03:05 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<category><![CDATA[ramblings]]></category>

		<category><![CDATA[abbie]]></category>

		<category><![CDATA[abc]]></category>

		<category><![CDATA[area]]></category>

		<category><![CDATA[college]]></category>

		<category><![CDATA[dell]]></category>

		<category><![CDATA[fall]]></category>

		<category><![CDATA[internet]]></category>

		<category><![CDATA[madison]]></category>

		<category><![CDATA[matc]]></category>

		<category><![CDATA[microsoft]]></category>

		<category><![CDATA[open]]></category>

		<category><![CDATA[openoffice]]></category>

		<category><![CDATA[pc]]></category>

		<category><![CDATA[schubert]]></category>

		<category><![CDATA[semester]]></category>

		<category><![CDATA[source]]></category>

		<category><![CDATA[spring]]></category>

		<category><![CDATA[technical]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[verizon]]></category>

		<category><![CDATA[website]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[wkowtv]]></category>

		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=385</guid>
		<description><![CDATA[On 2009‒01‒13, ABC’s WKOWTV posted a news story and article, where Abbie Schubert, a student enrolled in online courses at Madison Area Technical College bought a Dell computer with Ubuntu and blamed Dell, Ubuntu, and GNU–Linux for having to abandon her semesters. ABC writes:
She didn&#8217;t realize until the next morning her laptop defaulted to the [...]]]></description>
			<content:encoded><![CDATA[<p>On 2009‒01‒13, <acronym title="American Broadcasting Company">ABC</acronym>’s <a href="http://www.wkowtv.com">WKOWTV</a> posted a <a href="http://www.youtube.com/watch?v=2dQiXHf0CEE">news story</a> and <a href="http://www.wkowtv.com/Global/story.asp?S=9667184">article</a>, where Abbie Schubert, a student enrolled in online courses at <a href="http://matcmadison.edu/matc/">Madison Area Technical College</a> bought a <a href="http://www.dell.com">Dell</a> computer with <a href="http://www.ubuntu.com/">Ubuntu</a> and blamed Dell, Ubuntu, and GNU–Linux for having to abandon her semesters. ABC writes:</p>
<blockquote><p>She didn&#8217;t realize until the next morning her laptop defaulted to the Ubuntu operating system.<br />
…<br />
Her Verizon High-Speed Internet CD won&#8217;t load, so she can&#8217;t access the internet.  She also can&#8217;t install Microsoft Word, which she says is a requirement for MATC&#8217;s online classes.<br />
As a result, with no internet and no Microsoft Word, Schubert dropped out of MATC&#8217;s fall and spring semesters.</p></blockquote>
<p>While first reading this article, I felt sympathetic for the student. I don’t anymore.</p>
<p>&nbsp;</p>
<p>Ordering a <acronym title="Personal Computer">PC</acronym> with Ubuntu requires either awareness or negligence:</p>
<ol>
<li>On Dell’s front page, hover your cursor over the drop‐downs for <q>Desktops</q> or <q>Laptops &amp; Mini</q> and select the option for <q>Open‐Source PCs</q>, despite the flashy image–links’ prominence. This brings you to <a href="http://www.dell.com/ubuntu">Dell’s Ubuntu page</a>.</li>
<li>Ignore the warnings like <q>Not sure Open Source is for You?</q> and <q>The main thing to note is that when you choose open source you don’t get a Windows® operating system. If you’re here by mistake and you are looking for a Dell PC with Windows, please use the following link.</q></li>
<li>Ignore the description, with its own warnings like <q><em>may not be compatible with the same software applications and hardware as Windows operating systems</em></q>.</li>
<li>Go through the typical web‐based configuration process, explicitly clicking <q>Ubuntu</q>, not noticing the selection options for <q>Operating System</q>, which again says <q>Ubuntu</q>. Ignore the <q>Review</q> screen which again says <q>Ubuntu</q> and click <q>continue anyways</q>. Add the item to your cart and again ignore the <q>Ubuntu</q>.</li>
<li>While confirming your purchase email, ignore the information.</li>
</ol>
<p>Is that really insufficient notice? Then, Abbie Schubert’s particular case also requires the following:</p>
<ul>
<li>Not using alternatives, such as <em>library computers</em> (which her campus had).</li>
<li>Not requesting help from her peers or the Linux community.</li>
<li>Attempting to use wireless drivers in a CD explicitly for Windows.</li>
</ul>
<p>Users accustomed to Windows find switching difficult, so I am sympathetic towards her confusion after the purchase. But I do object to her—or, more likely, only ABC’s—eagerness to blame Dell and Ubuntu.</p>
<p>&nbsp;</p>
<p>The article itself rings of bias. For example:</p>
<blockquote><p>[Ubuntu is] extremely popular with certain circles of computer users because it&#8217;s free.</p></blockquote>
<p>Or perhaps because it is better? Even Dell makes buying computers with GNU–Linux difficult and more expensive; many if not most GNU–Linux users buy a PC with Windows and then install GNU–Linux.</p>
<p>&nbsp;</p>
<p>Here is another:</p>
<blockquote><p>But it is not Windows, and what works on Windows doesn’t always work on Ubuntu.</p></blockquote>
<p>…and vice versa, perhaps?</p>
<p>&nbsp;</p>
<p>At 1:35 of the Youtube movie, notice the ABC reporter: <q>[…] Ubuntu might look a lot like Windows, but it sure doesn’t act like it</q> accompanied by a carefully‐chosen screenshot of an error in Firefox.</p>
<p>&nbsp;</p>
<p>ABC’s implicit and explicit accusations that Dell forced her to use Ubuntu likely border on slander.</p>
<blockquote><p>She called Dell the very next day and says the representative told her there was still time to change back to Windows.<br />
But she says Dell discouraged her.<br />
&#8220;The person I was talking to said Ubuntu was great, college students loved it, it was compatible with everything I needed,&#8221; said Schubert.</p></blockquote>
<p>The question arises: what conversation preceded that quote? I highly doubt the representative said that randomly.</p>
<p>&nbsp;</p>
<p>ABC also writes:</p>
<blockquote><p>She also says Dell claimed it was now too late to get Windows and any changes she made herself would void her warranty.</p></blockquote>
<p>…perhaps because that is their policy?<br />
“Claimed” overtly suggests misinformation or fabrication. Dell certainly does not have a reputation for sincerity and integrity, but ABC has a reputation for providing information that is deliberately misleading.</p>
<p>&nbsp;</p>
<p>Whether Abbie Schubert deliberately created Microsoft’s new‐found marketing weapon or ABC warped her story for mass‐appeal (I find the latter more probable), her issues are a direct result of her choice in purchase.<br />
I wish her luck in her next semester.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/ramblings/abcs-story-on-abbie-schubert-dell-and-ubuntu/feed</wfw:commentRss>
		</item>
		<item>
		<title>Vincenty Ellipsoidal Geodesy and PHP Nightmares</title>
		<link>http://www.dmtdev.com/blog/math/vincenty-ellipsoidal-geodesy-and-php-nightmares</link>
		<comments>http://www.dmtdev.com/blog/math/vincenty-ellipsoidal-geodesy-and-php-nightmares#comments</comments>
		<pubDate>Thu, 22 Jan 2009 01:28:11 +0000</pubDate>
		<dc:creator>dmyersturnbull</dc:creator>
		
		<category><![CDATA[language design]]></category>

		<category><![CDATA[math]]></category>

		<category><![CDATA[calculation]]></category>

		<category><![CDATA[calculator]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[distance]]></category>

		<category><![CDATA[ellipsoid]]></category>

		<category><![CDATA[ellipsoidal]]></category>

		<category><![CDATA[formula]]></category>

		<category><![CDATA[geodesics]]></category>

		<category><![CDATA[geodesy]]></category>

		<category><![CDATA[latitude]]></category>

		<category><![CDATA[longitude]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[thaddeus]]></category>

		<category><![CDATA[vincenty]]></category>

		<category><![CDATA[wgs84]]></category>

		<guid isPermaLink="false">http://www.dmtdev.com/blog/?p=357</guid>
		<description><![CDATA[I address two matters here.
&#160;
Earth‐distance calculator based on Thaddus Vincenty’s formula and WGS‒84
Two weeks ago, I considered running from UCR to Cal Poly Pomona to visit friends there. Questioning the run’s feasibility (and my athleticism), I wanted to know the distance (it is 49km). Quickly searching, I found several distance calculation websites, all of which [...]]]></description>
			<content:encoded><![CDATA[<p>I address two matters here.</p>
<p style="margin:-.6em">&nbsp;</p>
<h4>Earth‐distance calculator based on Thaddus Vincenty’s formula and WGS‒84</h4>
<p>Two weeks ago, I considered running from <acronym title="University of California, Riverside">UCR</acronym> to <abbr title="California State Polytechnic University, Pomona">Cal Poly Pomona</abbr> to visit friends there. Questioning the run’s feasibility (and my athleticism), I wanted to know the distance (it is 49<acronym title="kilometers">km</acronym>). Quickly searching, I found several distance calculation websites, all of which used spherical models—inadequate for those afflicted by <acronym title="Obsessive–Compulsive Disorder">OCD</acronym>. So, I wrote a <a href="http://www.dmtdev.com/distance/" title="Douglas’s distance calculation page"><strong>web‐based program</strong></a> to calculate the distance between any two points (longitude and latitude) accurately using <a href="http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf" title="Thaddeus Vincenty’s geodesy paper (1975)">Thaddeus Vincenty’s formula</a> for calculating ellipsoidal geodesics and an accurate coordinate frame for the Earth, <a title="the National Geospatial Intelligence Agency’s page on WGS84" href="http://earth-info.nga.mil/GandG/publications/tr8350.2/tr8350_2.html"><acronym title="World Geodetic System">WGS</acronym>84</a>. My web page’s <a href="http://www.dmtdev.com/current/other/calculate_distance.php" title="PHP code for calculating ellipsoidal geodesics"><acronym title="PHP: Hypertext Preprocessor">PHP</acronym> code</a> (licensed under the <a href="http://www.gnu.org/licenses/gpl-3.0-standalone.html" title="the GNU General Public License version 3 (standalone HTML)"><acronym title="Gnu’s Not Unix">GNU</acronym> <acronym title="General Public License">GPL</acronym> version 3</a>) is—necessarily discounting altitude—accurate to within ½<acronym title="milliliter">mm</acronym>. After writing about a third of the code, I discovered other websites (particularly, see <a href="http://www.movable-type.co.uk/scripts/latlong-vincenty.html" title="Movable Type Scripts’ webpage for geodesics with Vincenty’s formula">Movable Type Scripts’ page</a> and realized that <a href="http://maps.google.com">Google Maps</a> had a (in my defense, new) selection for “walking”. However… my calculator is notably user‐friendly and has flexible input requirements, so I do not regret the time I spent.<br />
Here are the WGS84 values:</p>
<blockquote><p>
Major semiaxis:<br />
a = 6378137<br />
Minor semiaxis:<br />
b = 6356752.314245<br />
Flattening (a − b) / a<br />
ƒ = 1/298.257223563<br />
Negligible value (iterates until):<br />
Δλ &lt; 10⁻¹²
</p></blockquote>
<p style="margin:-.6em">&nbsp;</p>
<h4>PHP is terrible—again</h4>
<p>I refuse to use PHP ever again.</p>
<p style="font-style: italic; color: #006600;">Update: That was a lie. I capitulated yet again—and regretted it yet again.</p>
<p>If an employer requires me to use it, I will likely quit. I repeatedly give PHP chances and am repeatedly disappointed. After writing the calculator, I spent nearly three hours searching for a bug that resulted in significant numerical error. Well—here it is:</p>
<p>I had this line:</p>
<pre class="syntax-highlight:php">
$uSqr = $cosSqrAlpha * (sqr(ELLIPSOID_A) - sqr(ELLIPSOID_B)) / sqr(ELLIPSOID_B);
</pre>
<p>And then this line:</p>
<pre class="syntax-highlight:php">
$B = &lt;em&gt;$uSqrd&lt;/em&gt; / 1024 * (256 + $uSqr * (-128 + $uSqr * (74 - 47 * $uSqr)));
</pre>
<p>Almost any other language would have returned an error since $uSqrd is undefined. But not PHP. In its wisdom, PHP decided that since $uSqrd is undefined, it equals zero. Admittedly, PHP reports the use of undefined variables at higher “error reporting” levels, so it is arguably my fault for not setting error_reporting. But really…<br />
I loathe weak dynamic typing.</p>
<p>Again, my <a href="http://www.dmtdev.com/distance/" title="Douglas’s distance calculator">distance calculation webpage</a> is available to those interested. If you have feedback, comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dmtdev.com/blog/math/vincenty-ellipsoidal-geodesy-and-php-nightmares/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.532 seconds -->
