Main image
27th January
2011
written by simplelight

Facebook isn’t often cited as a cloud computing company since the ‘Social’ moniker has proven to be stickier. It does, however, meet the common definition of ‘Cloud’ i.e. the management of the hardware is highly abstracted from its users, the infrastructure is highly elastic, a variety of services (billing, authentication etc.) are bundled, and the underlying hardware is geographically dispersed.

What is fascinating is that Facebook, more than other cloud companies, gives us a glimpse into a future where computing and storage are virtually free and ubiquitous. With $2 billion in revenue for 2010 and about 500M users, Facebook has revenue of roughly $4 per user. With some back of the envelope math, it seems likely that the variable cost for each additional user is about $1 per year. Think of the services that Facebook is providing its users for $1. Unlimited photo storage and sharing. A contact database. Email. Instant messaging. A gaming platform.

The economics in the consumer cloud are compelling. They will become more so over time and as large enterprises realize that there is no strategic value in common IT, there will be a similar shift for businesses.

7th December
2010
written by simplelight

Is there any way to specify the RAILS_ENV when using Passenger? I tried setting it in my environment.rb, but it doesn’t seem to take anything other than “production” … setting the RAILS_ENV constant instead of the ENV[‘RAILS_ENV’] eventually did the trick.

For a way to set Rails_env differently depending on the capistrano stage being deployed to, see this post

24th October
2010
written by simplelight

Everything you need to know about HTML5 and video codec support. And a chunk of html code that embeds a video into a website using the HTML5 <video> element, falling back to Flash automatically, without the use of JavaScript or browser-sniffing. It therefore works in RSS readers (no JavaScript), on the iPhone / iPad (don’t support Flash) and on many browser platforms.

27th August
2010
written by simplelight

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 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.

Hyperinflation 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 people are trying to get out of the currency. It’s not that they want more money—they want less of the currency: So they will pay anything for a good which is not the currency.

25th August
2010
written by simplelight

When you’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
11th August
2010
written by simplelight

collect {|item|block} and map{|item|block} do the same thing – 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{|item|block} will return actual collection items being iterated over if, for each item, the block condition evaluates to true. 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 TrueClass or FalseClass.  Typically, [true, false, ..., true] is not what you’re looking for in your resulting array.

Slightly modifying the core RDoc example:

a = ["a", "b", "c", "d"]      #=> ["a", "b", "c", "d"]
a.map {|item|"a" == item}     #=> [true, false, false, false]
a.select {|item|"a" == item}  #=> ["a"]

2nd June
2010
written by simplelight

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 at high noon.

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.

25th May
2010
written by simplelight

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, 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.

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.

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.

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.

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.

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.

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.

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.

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’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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

3rd May
2010
written by simplelight

If you’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’ for class `ActiveRecord::ConnectionAdapters::MysqlAdapter’

Check to see whether you’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

Previous
Next