<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Apple Town Prince</title>
	
	<link>http://www.appletownprince.com</link>
	<description>"What of the dreams that never die?"</description>
	<lastBuildDate>Sat, 28 Aug 2010 00:50:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AppleTownPrince" /><feedburner:info uri="appletownprince" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How Hyperinflation Could Happen</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/bpmdQqCcHlM/</link>
		<comments>http://www.appletownprince.com/2010/08/27/how-hyperinflation-could-happen/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 00:50:26 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Economics]]></category>
		<category><![CDATA[hyperinflation]]></category>
		<category><![CDATA[inflation]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=458</guid>
		<description><![CDATA[I was reading an interesting article on the possibility of hyperinflation in the US. It had an interesting take on the discontinuity between inflation and hyperinflation:
Inflation is when the economy overheats: It’s when an economy’s consumables  (labor and commodities) are so in-demand because of economic growth,  coupled with an expansionist credit environment, that [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading an interesting article on <a title="How Hyperinflation Will Happen" href="http://gonzalolira.blogspot.com/2010/08/how-hyperinflation-will-happen.html">the possibility of hyperinflation in the US</a>. It had an interesting take on the discontinuity between inflation and hyperinflation:</p>
<blockquote><p><strong><em>Inflation</em> is when the economy overheats: It’s when an economy’s consumables  (labor and commodities) are so in-demand because of economic growth,  coupled with an expansionist credit environment, that the consumables  rise in price. This forces all goods and services to rise in price as  well, so that producers can keep up with costs. It is essentially a  demand-driven phenomena.<br />
</strong></p>
<p><em>Hyperinflation</em> is  the loss of faith in the currency. Prices rise in a hyperinflationary  environment just like in an inflationary environment, but they rise not  because people want more money for their labor or for commodities, but  because <em>people are trying to get out of the currency</em>. It’s not that they want <em>more</em> money—they want <em>less</em> of the currency: So they will pay <em>anything</em> for a good which is <strong><em>not</em> the currency.<br />
</strong></p></blockquote>

<p><a href="http://feedads.g.doubleclick.net/~a/DVI_YjscT5-a6kNbDNaE1nwcW54/0/da"><img src="http://feedads.g.doubleclick.net/~a/DVI_YjscT5-a6kNbDNaE1nwcW54/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/DVI_YjscT5-a6kNbDNaE1nwcW54/1/da"><img src="http://feedads.g.doubleclick.net/~a/DVI_YjscT5-a6kNbDNaE1nwcW54/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/bpmdQqCcHlM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/08/27/how-hyperinflation-could-happen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/08/27/how-hyperinflation-could-happen/</feedburner:origLink></item>
		<item>
		<title>Verbose logging in the Rails console</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/VkzQ0GhGtr8/</link>
		<comments>http://www.appletownprince.com/2010/08/25/verbose-logging-in-the-rails-console/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 00:55:29 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=456</guid>
		<description><![CDATA[When you&#8217;re debugging/analyzing MySQL queries in the Rails console, it helps to turn on ActiveRecord logging:

#Enable ActiveRecord logging
def loud_logger(enable = true)
  logger = (enable == true ? Logger.new(STDOUT) : nil)
  ActiveRecord::Base.logger = logger
  ActiveRecord::Base.clear_active_connections!
end

]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re debugging/analyzing MySQL queries in the Rails console, it helps to turn on ActiveRecord logging:</p>
<blockquote>
<pre>#Enable ActiveRecord logging
def loud_logger(enable = true)
  logger = (enable == true ? Logger.new(STDOUT) : nil)
  ActiveRecord::Base.logger = logger
  ActiveRecord::Base.clear_active_connections!
end</pre>
</blockquote>

<p><a href="http://feedads.g.doubleclick.net/~a/x4SmoM3LNJUsIMPqRuDwlSYGizo/0/da"><img src="http://feedads.g.doubleclick.net/~a/x4SmoM3LNJUsIMPqRuDwlSYGizo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/x4SmoM3LNJUsIMPqRuDwlSYGizo/1/da"><img src="http://feedads.g.doubleclick.net/~a/x4SmoM3LNJUsIMPqRuDwlSYGizo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/VkzQ0GhGtr8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/08/25/verbose-logging-in-the-rails-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/08/25/verbose-logging-in-the-rails-console/</feedburner:origLink></item>
		<item>
		<title>Ruby Case Statements Demystified</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/SyX6DRp6wII/</link>
		<comments>http://www.appletownprince.com/2010/08/11/ruby-case-statements-demystified/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 23:47:40 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[case statements]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=450</guid>
		<description><![CDATA[An excellent post on the various syntaxes for Ruby &#8216;case&#8217; statements
]]></description>
			<content:encoded><![CDATA[<p>An excellent <a title="Ruby Case Statements" href="http://ilikestuffblog.com/2008/04/15/how-to-write-case-switch-statements-in-ruby/">post on the various syntaxes for Ruby &#8216;case&#8217; statements</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/dEnPZaawUCzO92hZzTOiIL4LYxE/0/da"><img src="http://feedads.g.doubleclick.net/~a/dEnPZaawUCzO92hZzTOiIL4LYxE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dEnPZaawUCzO92hZzTOiIL4LYxE/1/da"><img src="http://feedads.g.doubleclick.net/~a/dEnPZaawUCzO92hZzTOiIL4LYxE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/SyX6DRp6wII" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/08/11/ruby-case-statements-demystified/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/08/11/ruby-case-statements-demystified/</feedburner:origLink></item>
		<item>
		<title>Ruby Arrays: Difference between map, collect, and select</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/vqP_DEywdDA/</link>
		<comments>http://www.appletownprince.com/2010/08/11/ruby-arrays-difference-between-map-collect-and-select/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 21:29:21 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Computers & Internet]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[collect]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[select]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=448</guid>
		<description><![CDATA[collect {&#124;item&#124;block} and map{&#124;item&#124;block} do the same thing &#8211; return an array of things returned by the block.  This is different from returning specific items in the collection being iterated over.
Which leads to select.
select{&#124;item&#124;block} will return actual collection items being iterated over if, for each item, the block condition evaluates to true.  Not the [...]]]></description>
			<content:encoded><![CDATA[<p><code>collect {|item|block}</code> and <code>map{|item|block}</code> do the same thing &#8211; return an array of things <em>returned by the block</em>.  This is different from returning specific items in the collection being iterated over.</p>
<p>Which leads to <code>select</code>.</p>
<p><code>select{|item|block}</code> will return <em>actual collection items</em> being iterated over if, for each item, <em>the block condition evaluates to </em><code>true</code>.  Not the same as returning what the block, itself, may return.  In the case of select, the block would always return an instance of class <code>TrueClass</code> or <code>FalseClass</code>.  Typically, <code>[true, false, ..., true]</code> is not what you&#8217;re looking for in your resulting array.</p>
<p>Slightly modifying the core RDoc example:</p>
<p><code> a = ["a", "b", "c", "d"]      #=&gt; ["a", "b", "c", "d"]<br />
a.map {|item|"a" == item}     #=&gt; [true, false, false, false]<br />
a.select {|item|"a" == item}  #=&gt; ["a"]</code></p>

<p><a href="http://feedads.g.doubleclick.net/~a/RZlaXfnzaR8ToyhgI7dbeP6-1Eo/0/da"><img src="http://feedads.g.doubleclick.net/~a/RZlaXfnzaR8ToyhgI7dbeP6-1Eo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RZlaXfnzaR8ToyhgI7dbeP6-1Eo/1/da"><img src="http://feedads.g.doubleclick.net/~a/RZlaXfnzaR8ToyhgI7dbeP6-1Eo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/vqP_DEywdDA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/08/11/ruby-arrays-difference-between-map-collect-and-select/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/08/11/ruby-arrays-difference-between-map-collect-and-select/</feedburner:origLink></item>
		<item>
		<title>Using High Speed Sync Flash</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/dNX3SLiuO04/</link>
		<comments>http://www.appletownprince.com/2010/06/02/using-high-speed-sync-flash/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 22:27:13 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[flash photography]]></category>
		<category><![CDATA[high speed sync]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=446</guid>
		<description><![CDATA[Post on when to use high speed sync:
The High Speed Sync feature allows you to work with Speedlites way  past your camera’s normal sync speed (1/160 – 1/250 depending on  camera). By shooting at very fast shutter speeds you can dramatically  reduce ambient light and shoot what look like night time shots [...]]]></description>
			<content:encoded><![CDATA[<p>Post on <a href="http://cameradojo.com/2010/05/31/mastering-your-flash-101-high-speed-sync/">when to use high speed sync</a>:</p>
<blockquote><p>The High Speed Sync feature allows you to work with Speedlites way  past your camera’s normal sync speed (1/160 – 1/250 depending on  camera). By shooting at very fast shutter speeds you can dramatically  reduce ambient light and shoot what look like night time shots at high  noon.</p>
<p>If 1/250th is fast enough to freeze most action, why would we need to shoot  faster than that or why would we need to use flash outdoors in the  daylight? To begin with, if we are shooting people against a bright blue  sky and we try to expose the scene for our subject, the blue in the sky  will get completely washed out and turn white. On the other hand, if  you crank the shutter speed fast enough to get the sky to stay nice and  blue, the subject will be underexposed. The best way to solve this is to  expose for the sky and then use flash to light the subject. While this  sounds simple the problem is really bright conditions is that you may  need a shutter speed significantly faster than your sync speed,  sometimes well over 1/1000th of a second.</p></blockquote>

<p><a href="http://feedads.g.doubleclick.net/~a/rzOsGhjyF0zT2owB0mS2SA8RjpA/0/da"><img src="http://feedads.g.doubleclick.net/~a/rzOsGhjyF0zT2owB0mS2SA8RjpA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/rzOsGhjyF0zT2owB0mS2SA8RjpA/1/da"><img src="http://feedads.g.doubleclick.net/~a/rzOsGhjyF0zT2owB0mS2SA8RjpA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/dNX3SLiuO04" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/06/02/using-high-speed-sync-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/06/02/using-high-speed-sync-flash/</feedburner:origLink></item>
		<item>
		<title>Samuel Johnson on Blogging</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/eM_d-aPjxWA/</link>
		<comments>http://www.appletownprince.com/2010/05/25/samuel-johnson-on-blogging/#comments</comments>
		<pubDate>Tue, 25 May 2010 21:30:42 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Philosophy]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[information explosion]]></category>
		<category><![CDATA[Samuel Johnson]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=442</guid>
		<description><![CDATA[Even in 1753 people thought there was too much ink being spent on too many worthless thoughts:
Title:     Adventurer  115
Author: Samuel  Johnson
Adventurer No. 115. Tuesday, December 11, 1753.
Scribimus  indocti doctique.
HOR. Lib. ii. Ep. i. 17.
All dare to  write, who can or cannot read.
They who have attentively  considered the history of mankind, [...]]]></description>
			<content:encoded><![CDATA[<p>Even in 1753 people thought there was too much ink being spent on too many worthless thoughts:</p>
<blockquote><p>Title:     Adventurer  115<br />
Author: Samuel  Johnson<br />
Adventurer No. 115. Tuesday, December 11, 1753.</p>
<p><em>Scribimus  indocti doctique.</em><br />
HOR. Lib. ii. Ep. i. 17.</p>
<p>All dare to  write, who can or cannot read.<br />
They who have attentively  considered the history of mankind, know that every age has its peculiar  character. At one time, no desire is felt but for military honours;  every summer affords battles and sieges, and the world is filled with  ravage, bloodshed, and devastation: this sanguinary fury at length  subsides, and nations are divided into factions, by controversies about  points that will never be decided. Men then grow weary of debate and  altercation, and apply themselves to the arts of profit; trading  companies are formed, manufactures improved, and navigation extended;  and nothing is any longer thought on, but the increase and preservation  of property, the artifices of getting money, and the pleasures of  spending it.</p>
<p>The present age, if we consider chiefly the state of  our own country, may be styled, with great propriety, _The Age of  Authors_[1]; for, perhaps, there never was a time in which men of all  degrees of ability, of every kind of education, of every profession and  employment, were posting with ardour so general to the press. The  province of writing was formerly left to those, who by study, or  appearance of study, were supposed to have gained knowledge unattainable  by the busy part of mankind; but in these enlightened days, every man  is qualified to instruct every other man: and he that beats the anvil,  or guides the plough, not content with supplying corporal necessities,  amuses himself in the hours of leisure with providing intellectual  pleasures for his countrymen.</p>
<p>It may be observed, that of this,  as of other evils, complaints have been made by every generation: but  though it may, perhaps, be true, that at all times more have been  willing than have been able to write, yet there is no reason for  believing, that the dogmatical legions of the present race were ever  equalled in number by any former period: for so widely is spread the  itch of literary praise, that almost every man is an author, either in  act or in purpose: has either bestowed his favours on the publick, or  withholds them, that they may be more seasonably offered, or made more  worthy of acceptance.</p>
<p>In former times, the pen, like the sword,  was considered as consigned by nature to the hands of men; the ladies  contented themselves with private virtues and domestick excellence; and a  female writer, like a female warrior, was considered as a kind of  eccentrick being, that deviated, however illustriously, from her due  sphere of motion, and was, therefore, rather to be gazed at with wonder,  than countenanced by imitation. But as in the times past are said to  have been a nation of Amazons, who drew the bow and wielded the  battle-axe, formed encampments and wasted nations, the revolution of  years has now produced a generation of Amazons of the pen, who with the  spirit of their predecessors have set masculine tyranny at defiance,  asserted their claim to the regions of science, and seem resolved to  contest the usurpations of virility.</p>
<p>Some indeed there are, of  both sexes, who are authors only in desire, but have not yet attained  the power of executing their intentions; whose performances have not  arrived at bulk sufficient to form a volume, or who have not the  confidence, however impatient of nameless obscurity, to solicit openly  the assistance of the printer. Among these are the innumerable  correspondents of publick papers, who are always offering assistance  which no man will receive, and suggesting hints that are never taken;  and who complain loudly of the perverseness and arrogance of authors,  lament their insensibility of their own interest, and fill the  coffee-houses with dark stories of performances by eminent hands, which  have been offered and rejected.</p>
<p>To what cause this universal  eagerness of writing can be properly ascribed, I have not yet been able  to discover. It is said, that every art is propagated in proportion to  the rewards conferred upon it; a position from which a stranger would  naturally infer, that literature was now blessed with patronage far  transcending the candour or munificence of the Augustan age, that the  road to greatness was open to none but authors, and that by writing  alone riches and honour were to be obtained.</p>
<p>But since it is  true, that writers, like other competitors, are very little disposed to  favour one another, it is not to be expected, that at a time when every  man writes, any man will patronize; and, accordingly, there is not one  that I can recollect at present, who professes the least regard for the  votaries of science, invites the addresses of learned men, or seems to  hope for reputation from any pen but his own.</p>
<p>The cause,  therefore, of this epidemical conspiracy for the destruction of paper,  must remain a secret: nor can I discover, whether we owe it to the  influences of the constellations, or the intemperature of seasons:  whether the long continuance of the wind at any single point, or  intoxicating vapours exhaled from the earth, have turned our nobles and  our peasants, our soldiers and traders, our men and women, all into  wits, philosophers, and writers.</p>
<p>It is, indeed, of more  importance to search out the cure than the cause of this intellectual  malady; and he would deserve well of this country, who, instead of  amusing himself with conjectural speculations, should find means of  persuading the peer to inspect his steward&#8217;s accounts, or repair the  rural mansion of his ancestors; who could replace the tradesman behind  his counter, and send back the farmer to the mattock and the flail.</p>
<p>General  irregularities are known in time to remedy themselves. By the  constitution of ancient Egypt, the priesthood was continually  increasing, till at length there was no people beside themselves; the  establishment was then dissolved, and the number of priests was reduced  and limited. Thus among us, writers will, perhaps, be multiplied, till  no readers will be found, and then the ambition of writing must  necessarily cease.</p>
<p>But as it will be long before the cure is thus  gradually effected, and the evil should be stopped, if it be possible,  before it rises to so great a height, I could wish that both sexes would  fix their thoughts upon some salutary considerations, which might  repress their ardour for that reputation, which not one of many  thousands is fated to obtain.</p>
<p>Let it be deeply impressed, and  frequently recollected, that he who has not obtained the proper  qualifications of an author, can have no excuse for the arrogance of  writing, but the power of imparting to mankind something necessary to be  known. A man uneducated or unlettered may sometimes start a useful  thought, or make a lucky discovery, or obtain by chance some secret of  nature, or some intelligence of facts, of which the most enlightened  mind may be ignorant, and which it is better to reveal, though by a rude  and unskilful communication, than to lose for ever by suppressing it.</p>
<p>But  few will be justified by this plea; for of the innumerable books and  pamphlets that have overflowed the nation, scarce one has made any  addition to real knowledge, or contained more than a transposition of  common sentiments, and a repetition of common phrases.</p>
<p>It will be  naturally inquired, when the man who feels an inclination to write, may  venture to suppose himself properly qualified; and, since every man is  inclined to think well of his own intellect, by what test he may try his  abilities, without hazarding the contempt or resentment of the publick.</p>
<p>The first qualification of a writer is a perfect knowledge of  the subject which he undertakes to treat; since we cannot teach what we  do not know, nor can properly undertake to instruct others while we are  ourselves in want of instruction. The next requisite is, that he be  master of the language in which he delivers his sentiments: if he treats  of science and demonstration, that he has attained a style clear, pure,  nervous, and expressive; if his topicks be probable and persuasory,  that he be able to recommend them by the superaddition of elegance and  imagery, to display the colours of varied diction, and pour forth the  musick of modulated periods.</p>
<p>If it be again inquired, upon what  principles any man shall conclude that he wants those powers, it may be  readily answered, that no end is attained but by the proper means; he  only can rationally presume that he understands a subject, who has read  and compared the writers that have hitherto discussed it, familiarized  their arguments to himself by long meditation, consulted the foundations  of different systems, and separated truth from errour by a rigorous  examination.</p>
<p>In like manner, he only has a right to suppose that  he can express his thoughts, whatever they are, with perspicuity or  elegance, who has carefully perused the best authors, accurately noted  their diversities of style, diligently selected the best modes of  diction, and familiarized them by long habits of attentive practice.</p>
<p>No  man is a rhetorician or philosopher by chance. He who knows that he  undertakes to write on questions which he has never studied, may without  hesitation determine, that he is about to waste his own time and that  of his reader, and expose himself to the derision of those whom he  aspires to instruct: he that without forming his style by the study of  the best models hastens to obtrude his compositions on the publick, may  be certain, that whatever hope or flattery may suggest, he shall shock  the learned ear with barbarisms, and contribute, wherever his work shall  be received, to the depravation of taste and the corruption of  language.</p></blockquote>

<p><a href="http://feedads.g.doubleclick.net/~a/512qz3nukCzx3XSv2m_aTD1bZi4/0/da"><img src="http://feedads.g.doubleclick.net/~a/512qz3nukCzx3XSv2m_aTD1bZi4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/512qz3nukCzx3XSv2m_aTD1bZi4/1/da"><img src="http://feedads.g.doubleclick.net/~a/512qz3nukCzx3XSv2m_aTD1bZi4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/eM_d-aPjxWA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/05/25/samuel-johnson-on-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/05/25/samuel-johnson-on-blogging/</feedburner:origLink></item>
		<item>
		<title>Error During Cucumber Rake Task</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/uGixZ1imjcg/</link>
		<comments>http://www.appletownprince.com/2010/05/03/error-during-cucumber-rake-task/#comments</comments>
		<pubDate>Mon, 03 May 2010 23:58:54 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[cucumber]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[query analyzer]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=440</guid>
		<description><![CDATA[If you&#8217;re trying to run the rake task required for installing Cucumber in Rails and keep getting the following error message:
rake aborted!
undefined method `select&#8217; for class `ActiveRecord::ConnectionAdapters::MysqlAdapter&#8217;
Check to see whether you&#8217;re using the query_analyzer plugin. I had to uninstall it to get the rake task to complete using:
script/plugin remove query_analyzer
That solved the problem
]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying to run the rake task required for installing Cucumber in Rails and keep getting the following error message:</p>
<blockquote><p>rake aborted!<br />
undefined method `select&#8217; for class `ActiveRecord::ConnectionAdapters::MysqlAdapter&#8217;</p></blockquote>
<p>Check to see whether you&#8217;re using the query_analyzer plugin. I had to uninstall it to get the rake task to complete using:</p>
<blockquote><p>script/plugin remove query_analyzer</p></blockquote>
<p>That solved the problem</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Q0f_GetfH07YZndhJr4yrqh4DDg/0/da"><img src="http://feedads.g.doubleclick.net/~a/Q0f_GetfH07YZndhJr4yrqh4DDg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Q0f_GetfH07YZndhJr4yrqh4DDg/1/da"><img src="http://feedads.g.doubleclick.net/~a/Q0f_GetfH07YZndhJr4yrqh4DDg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/uGixZ1imjcg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/05/03/error-during-cucumber-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/05/03/error-during-cucumber-rake-task/</feedburner:origLink></item>
		<item>
		<title>Avoiding Duplicate MySQL Records when Using Rails</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/gt4uIUB2AzA/</link>
		<comments>http://www.appletownprince.com/2010/04/04/avoiding-duplicate-mysql-records-when-using-rails/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 06:16:29 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=438</guid>
		<description><![CDATA[Assuming you want to make sure that no two models have the same COMBINATION of values for a and b:
so having two models with:
a = 1, b = 2
a = 1, b = 3
would not be a conflict.
If that&#8217;s the case then the standard validation
class Widget &#60; ActiveRecord::Base
validates_uniqueness_of :a, :b
end
wouldn&#8217;t work since it tries to [...]]]></description>
			<content:encoded><![CDATA[<p>Assuming you want to make sure that no two models have the same COMBINATION of values for a and b:</p>
<p>so having two models with:</p>
<p>a = 1, b = 2<br />
a = 1, b = 3</p>
<p>would not be a conflict.</p>
<p>If that&#8217;s the case then the standard validation</p>
<p>class Widget &lt; ActiveRecord::Base<br />
validates_uniqueness_of :a, :b<br />
end</p>
<p>wouldn&#8217;t work since it tries to prevent saving two models with the same value of a, OR with the same value of b.</p>
<p>And even if that&#8217;s not what you&#8217;re trying to do, and you&#8217;re ok with the example being a conflict, validates_uniqueness_of doesn&#8217;t guarantee uniqueness if two users try to save conflicting records simultaneously.  The validation works by first trying to find a record with the value, and if it doesn&#8217;t find it inserting the &#8216;new&#8217; record, and this can fail due to a concurrency hole.</p>
<p>To fill this hole requires leaning on the database server, and the way to do that in SQL is by having a unique index on the table which covers the column or columns you want to be unique. This assume you are using a database which supports it, e.g. MySql.</p>
<p>To create an index you can create a migration which includes a statement like</p>
<p>add_index  :widgets, [:a, :b], :unique =&gt; true)</p>
<p>Assuming that the table name for the model is &#8216;widgets&#8217;</p>
<p>Now if you do this, you also need to be aware that if you try to save a record with a uniqueness conflict the save will raise an ActiveRecord::StatementInvalid exception, which you&#8217;ll need to rescue and do something like telling the user of the conflict so that he can rectify it.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/hY3f_B8ZKKKwMo9ZziB-2NpCV9o/0/da"><img src="http://feedads.g.doubleclick.net/~a/hY3f_B8ZKKKwMo9ZziB-2NpCV9o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hY3f_B8ZKKKwMo9ZziB-2NpCV9o/1/da"><img src="http://feedads.g.doubleclick.net/~a/hY3f_B8ZKKKwMo9ZziB-2NpCV9o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/gt4uIUB2AzA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/04/04/avoiding-duplicate-mysql-records-when-using-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/04/04/avoiding-duplicate-mysql-records-when-using-rails/</feedburner:origLink></item>
		<item>
		<title>jQuery Traversing Functions</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/7qeK965iruY/</link>
		<comments>http://www.appletownprince.com/2010/04/04/jquery-traversing-functions/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:11:36 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[traversing]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/?p=436</guid>
		<description><![CDATA[This is a great post on using the various jQuery Traversing functions to select DOM elements.
]]></description>
			<content:encoded><![CDATA[<p>This is a great post on using the various<a title="jQuery Traversing Functions" href="http://net.tutsplus.com/tutorials/javascript-ajax/10-super-helpful-traversing-functions-in-jquery/"> jQuery Traversing functions</a> to select DOM elements.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/QTMr2W8E2PMc5xz2j4Y_l6Y_IWM/0/da"><img src="http://feedads.g.doubleclick.net/~a/QTMr2W8E2PMc5xz2j4Y_l6Y_IWM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QTMr2W8E2PMc5xz2j4Y_l6Y_IWM/1/da"><img src="http://feedads.g.doubleclick.net/~a/QTMr2W8E2PMc5xz2j4Y_l6Y_IWM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/7qeK965iruY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2010/04/04/jquery-traversing-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2010/04/04/jquery-traversing-functions/</feedburner:origLink></item>
		<item>
		<title>Showing Database Access in your Ruby on Rails IRB Console</title>
		<link>http://feedproxy.google.com/~r/AppleTownPrince/~3/kziudInRjnA/</link>
		<comments>http://www.appletownprince.com/2009/12/02/showing-database-access-in-your-ruby-on-rails-irb-console/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 22:56:44 +0000</pubDate>
		<dc:creator>simplelight</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.appletownprince.com/2009/12/02/showing-database-access-in-your-ruby-on-rails-irb-console/</guid>
		<description><![CDATA[>> ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)
]]></description>
			<content:encoded><![CDATA[<p>>> ActiveRecord::Base.connection.instance_variable_set :@logger, Logger.new(STDOUT)</p>

<p><a href="http://feedads.g.doubleclick.net/~a/zRO_-RClYuyxn3DuXWlT6Z0wEP4/0/da"><img src="http://feedads.g.doubleclick.net/~a/zRO_-RClYuyxn3DuXWlT6Z0wEP4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/zRO_-RClYuyxn3DuXWlT6Z0wEP4/1/da"><img src="http://feedads.g.doubleclick.net/~a/zRO_-RClYuyxn3DuXWlT6Z0wEP4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/AppleTownPrince/~4/kziudInRjnA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.appletownprince.com/2009/12/02/showing-database-access-in-your-ruby-on-rails-irb-console/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.appletownprince.com/2009/12/02/showing-database-access-in-your-ruby-on-rails-irb-console/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.309 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-08-27 17:50:28 -->
