<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>[Be el o ge]</title>
	<atom:link href="http://blog.project-sierra.de/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.project-sierra.de</link>
	<description>I &#9829; The Web</description>
	<lastBuildDate>Sun, 29 Aug 2010 17:59:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Thinking about buying an iMac</title>
		<link>http://blog.project-sierra.de/archives/1678</link>
		<comments>http://blog.project-sierra.de/archives/1678#comments</comments>
		<pubDate>Sun, 29 Aug 2010 17:59:25 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[in eigener Sache]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1678</guid>
		<description><![CDATA[I like to believe that I&#8217;m 95% decided to buy an iMac. The remaining final question is: which one?
Out of the relatively big choice one currently has (new version released a couple of weeks ago, old version still available) I narrowed it down to these:

Old version of iMac 27&#8243;: i3 3.06GHz, 4GB RAM, 1TB hard [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>I like to believe that I&#8217;m 95% decided to buy an iMac. The remaining final question is: which one?</p>
<p>Out of the relatively big choice one currently has (new version released a couple of weeks ago, old version still available) I narrowed it down to these:</p>
<ul>
<li>Old version of iMac 27&#8243;: i3 3.06GHz, 4GB RAM, 1TB hard disk, ATI 4670 256MB: <strong>1439.00 EUR</strong></li>
<li>Old version of iMac 21.5&#8243;: i3 3.06GHz, 4GB RAM, 1TB hard disk, ATI 4670 256MB: <strong>1295.00 EUR</strong></li>
<li>New version of iMac 21.5&#8243;: i3 3.2GHz, 4GB RAM, 1TB hard dis, ATI 5670 512MB: <strong>1429.00 EUR</strong></li>
</ul>
<p>After all the difference between the old and recently released new version of the iMac is not really significant. At least if you&#8217;re not going for one of the high end versions with i5 / i7 quad core processors and high end ATI graphics. Since I&#8217;m not playing on the Mac, I&#8217;m not doing any video editing, etc, I probably can narrow the choice further down by eliminating #3 in the list: new version of 21.5&#8243; iMac.</p>
<p>So old version with 27&#8243; or 21.5&#8243;. Is the ATI 4670 powerful enough for the huge screen with its enormous resolution? I guess tomorrow I&#8217;ll decide : &#8211; )</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1678&amp;linkname=Thinking%20about%20buying%20an%20iMac" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1678/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Inside the Tornado &#8211; Geoffrey A. Moore</title>
		<link>http://blog.project-sierra.de/archives/1639</link>
		<comments>http://blog.project-sierra.de/archives/1639#comments</comments>
		<pubDate>Tue, 17 Aug 2010 21:46:35 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Marketing]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1639</guid>
		<description><![CDATA[Inside the Tornado is subtitled with &#8220;Strategies for Developing, Leveraging, and Surviving Hypergrowth Markets&#8220;.
Though I&#8217;m not working in Marketing, or maybe just because of that, I really enjoyed reading &#8220;Inside the Tornado&#8221;. There is a lot of valuable information in this book; unfortunately much more then I can keep in mind longterm. Therefore here some [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Inside the Tornado is subtitled with &#8220;<em>Strategies for Developing, Leveraging, and Surviving Hypergrowth Markets</em>&#8220;.</p>
<p>Though I&#8217;m not working in Marketing, or maybe just because of that, I really enjoyed reading &#8220;Inside the Tornado&#8221;. There is a lot of valuable information in this book; unfortunately much more then I can keep in mind longterm. Therefore here some key concepts I thought are worth remembering even if you are, like me, not working in the Marketing or Sales department of your company.</p>
<p>The foundation of the whole book is the <strong>Technology Adoption Life Cycle.</strong></p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/technology_adoption_lifecycle.jpg" alt="Technology Adoption Lifecycle" title="Technology Adoption Lifecycle" width="683" height="368" class="alignnone size-full wp-image-1642" /></p>
<p>This is pretty much the life cycle every tech product goes through during its lifetime. Each phase has it&#8217;s own dynamics and groups which are important to address and communicate with. Each phase needs its own strategies. As main customers of each phase, Moore defines below groups:</p>
<ul>
<li>Innovators = Technology enthusiasts.</li>
<li>Early Adopters = Visionaries.</li>
<li>Early Majority = Pragmatists.</li>
<li>Late Majority = Conservatives.</li>
<li>Laggards = Skeptics.</li>
</ul>
<p><strong>The Chasm</strong></p>
<p>The chasm is the phase of the technology adoption life cycle which needs to be crossed by the product in order to enter the mainstream market. Refining above diagram, we are getting this:</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/thechasm.jpg" alt="The Chasm" title="The Chasm" width="687" height="353" class="alignnone size-full wp-image-1645" /></p>
<p>Add this point I&#8217;d like to quote from the book two paragraphs which, in my opinion, contain the central message ragarding &#8220;crossing the chasm&#8221;:</p>
<blockquote><p>The fundamental strategy for making a successful &#8220;crossing&#8221; is based on a single observation: the main difference between the visionaries of the early market and the pragmatists in the mainstream is that the former are willing to bet &#8220;on the come&#8221; whereas the latter want to see solutions &#8220;in producion&#8221; before they buy. That is, when a visionary sees that you have 80 percent of the solution to her problem, she says, &#8220;Great, let&#8217;s get started right away on building the other 20 percent together.&#8221; A pragmatist, on the other hand, says, &#8220;Wait a minuate &#8211; aren&#8217;t you supposed to be the one improving <strong>my</strong> productivity? I&#8217;ll buy this thing when it&#8217;s done not before.&#8221; Specifically, what pragmatists want, more than anything else, is a 100 percent solution to their problem &#8211; what we came to call the whole product.<br />
[...]<br />
the key to a winning strategy is to identify a single beachhead of pragmatist customers in a mainstream market segment and to accelerate the formation of 100 percent of their whole product. The goal is to win a nice foothold in the mainstream as quickly as possible &#8211; that is what is meant by crossing the chasm.</p></blockquote>
<p>In order to come to the main topic of the book we need one more refinement of the life cycle and introduce the Bowling Alley and, finally, the tornado.</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/tornado.jpg" alt="Bowling Alley and Tornado" title="Bowling Alley and Tornado" width="671" height="420" class="alignnone size-full wp-image-1650" /></p>
<p>And more quotes directly from the book:</p>
<ul>
<li><strong>The Bowling Alley</strong>: <em>A period of niche-based adoption in advance of the general marketplace, driven by compelling customer needs and the willingness of vendors to craft niche-specific whole products.</em></li>
<li><strong>The Tornado</strong>: <em>A period of mass-market adoption, when the general marketplace switches over to the new infrastructure paradigm.</em></li>
</ul>
<p><strong>Bowling Alley Market Development</strong></p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/bowlingalleymarketdevelopment.jpg" alt="Bowling Alley Market Development" title="Bowling Alley Market Development" width="400" height="275" class="alignnone size-full wp-image-1674" /></p>
<p>So what this diagram wants to say is that from the one niche market you already dominate you have to spread out to other niche markets, ideally such markets which are close to the initial market. Thus you can use knowledge and and possible connections you gained by building and selling a whole product for the first market segment you entered. A lot more interesting stuff about market development during the Bowling Alley phase you will find on page 39 of &#8220;Inside the Tornado&#8221;.</p>
<p>Moore advices, that the Tornado is the market phase in which you need to become the &#8220;gorilla&#8221;. What that means in terms of market share and profit show these diagrams:</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/marketshare.jpg" alt="Marketshare by Profits and Revenue" title="Marketshare by Profits and Revenue" width="650" height="313" class="alignnone size-full wp-image-1656" /></p>
<p>This is the time when it&#8217;s more important than anything else to just ship your product. The profits of the gorilla are so high, even compared to its market share by revenue, because the gorilla in the market is the one who sets the price bar. All competitors must discount below that price in order to successfully compete! There are quite a few advantages of being the gorilla and the tornado is the only phase of the market to gain these.</p>
<p><strong>Main Street</strong></p>
<p>Unlike during crossing the chasm and in the Bowling Alley where you try to create whole products for each market niche, on Main Street, you extent your product in order to serve niche markets which could use your product if only you added very little functionality to it.</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/nichemarketextensions.jpg" alt="Niche Market Extensions" title="Niche Market Extensions" width="351" height="318" class="alignnone size-full wp-image-1661" /></p>
<p><strong>So&#8230;.</strong></p>
<p>This is just a very rough summary of approximately the first half of the book. There are plenty of details which are interesting and I totally recommend reading &#8220;Inside the Tornado&#8221;! I believe that having at least some background in marketing (like e.g. the stuff I talk about above) helps to understand certain dynamics which are observable in every tech company. And understanding something is the first step to make you even better in your job ;-)</p>
<p>Buy <em>Inside the Tornado</em> at Amazon:<br />
<a href="http://www.amazon.de/gp/product/0060745819?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=0060745819"><br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/08/insidethetornado.jpg" alt="" title="Inside the Tornado" width="101" height="160" class="alignnone size-full wp-image-1671" /></a></p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1639&amp;linkname=Inside%20the%20Tornado%20%26%238211%3B%20Geoffrey%20A.%20Moore" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1639/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improving Javascript Minification by Using Closure</title>
		<link>http://blog.project-sierra.de/archives/1622</link>
		<comments>http://blog.project-sierra.de/archives/1622#comments</comments>
		<pubDate>Sat, 14 Aug 2010 12:41:53 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1622</guid>
		<description><![CDATA[Like jQuery, I&#8217;m using the Google Closure Compiler to minify the code of my Image Color Picker plugin.
When I looked over the minified code, I noticed that quite a few function names don&#8217;t get minified.
Let&#8217;s take a closer look at the v0.1 version of ImageColorPicker.js (github):

$.widget&#40;&#34;ui.ImageColorPicker&#34;, &#123;
 options: &#123;&#125;,
  _create: function&#40;&#41; &#123;
  &#125;,
&#160;
 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Like <a href="http://github.com/jquery/jquery">jQuery</a>, I&#8217;m using the <a href="http://code.google.com/closure/compiler/">Google Closure Compiler</a> to minify the code of my <a href="http://blog.project-sierra.de/image-color-picker">Image Color Picker</a> plugin.</p>
<p>When I looked over the minified code, I noticed that quite a few function names don&#8217;t get minified.<br />
Let&#8217;s take a closer look at the v0.1 version of ImageColorPicker.js (<a href="http://github.com/Skarabaeus/ImageColorPicker/blob/7685e908bdddc498688ee98c04a0a00f934bb577/src/ImageColorPicker.js">github</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.ImageColorPicker&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
 options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  _create<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
  destroy<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
  selectedColor<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
  _d2h<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
  _h2d<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
  _createImageColorPicker<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>option, _create, destroy, selectedColor and all the other function names don&#8217;t get minified. Everything within these function gets minified pretty well. The reason for this is that the Closure Compiler regards all these functions and objects as public. Since they are public the compiler does not know whether another, external library uses one or more of the functions. In order not to break external libraries or, more generally, code that depends on our code, the Closure compiler does not touch the names.</p>
<p>In case you have quite a few &#8220;private&#8221; functions and / or use them heavily, it can become pretty space wasting to not minify them. So how to fix this?</p>
<p>The solution is: Use a Javascript Closure. By using closures you can make functions <a href="http://www.crockford.com/javascript/private.html">truly private</a>, compared to marking them private by using the underscore convention. This is ImageColorPicker.js after the refactoring (<a href="http://github.com/Skarabaeus/ImageColorPicker/blob/50ce0a4e4a19d395f56607171002b7044b2fc858/dist/jquery.ImageColorPicker.js">github</a>):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> uiImageColorPicker <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> _d2h <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>d<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> _h2d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>h<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> _createImageColorPicker <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>widget<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
		options<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
		_create<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
		destroy<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
		selectedColor<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$.<span style="color: #660066;">widget</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ui.ImageColorPicker&quot;</span><span style="color: #339933;">,</span> uiImageColorPicker<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In line 1 a function is assigned to uiImageColorPicker. But not really. Take a closer look at line 27. It&#8217;s directly executed. Therefore the value which is assigned to uiImageColorPicker is not a function, but the object which is returned by the function. This object is supposed to contain all public functions of your plugin and option, _create and destroy, since these are expected by the jQuery UI Widget implementation.<br />
All private functions go to the function body, outside of the object. After the outer function ran, they won&#8217;t be accessible any more, but if you use them in functions of the returned object they are bound through a closure and thus can be used by the object&#8217;s functions even after the outer function finished execution.</p>
<p>When doing such thing, there are two things I can think of which require a little extra attention:</p>
<ul>
<li>Don&#8217;t store object specific data in the function body. That&#8217;s like storing data in an object prototype. All objects would either read the same data, or worse, overwrite data. Therefore, keep object related data in the object.</li>
<li><em>this</em> refers to the object when used within the object and to the function when used outside of the object in the function body. If you need to use the object&#8217;s this reference in your private function, pass it in as a parameter. I&#8217;m doing this for example in the create function. Check out <a href="http://github.com/Skarabaeus/ImageColorPicker/blob/50ce0a4e4a19d395f56607171002b7044b2fc858/dist/jquery.ImageColorPicker.js">github</a> for the code.</li>
</ul>
<p>A bonus: In case you ever forget to remove a private function which you don&#8217;t use anymore it will be removed entirely by the Closure Compiler in the minified version of your plugin ;-)</p>
<p><strong>Measuring the result</strong></p>
<p>After refactoring the code, I ran the Closure Compiler again. Before the minified version of the plugin had 3729 bytes. After the refactoring it had 3475 bytes. That&#8217;s about 8% smaller. Hm, not quite a lot you&#8217;d say. But:</p>
<ul>
<li>ImageColorPicker is a very small plugin anyway. If your plugin has a lot more private functions and / or uses them more frequently the savings will increase.</li>
<li>If you have thousands of hits per day, each percent you save in download size will save yourself or your company cash money.</li>
</ul>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1622&amp;linkname=Improving%20Javascript%20Minification%20by%20Using%20Closure" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1622/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Color Picker v0.1</title>
		<link>http://blog.project-sierra.de/archives/1617</link>
		<comments>http://blog.project-sierra.de/archives/1617#comments</comments>
		<pubDate>Sun, 08 Aug 2010 16:39:06 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1617</guid>
		<description><![CDATA[Today I&#8217;m releasing my first jQuery plugin :-)
Read more about it here: Image Color Picker or check out the demo.
You can find the code on Github.
]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Today I&#8217;m releasing my first jQuery plugin :-)</p>
<p>Read more about it here: <a href="http://blog.project-sierra.de/image-color-picker">Image Color Picker</a> or check out the <a href="http://www.project-sierra.de/ImageColorPicker/example/">demo</a>.</p>
<p>You can find the code on <a href="http://github.com/Skarabaeus/ImageColorPicker">Github</a>.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1617&amp;linkname=Image%20Color%20Picker%20v0.1" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1617/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML Canvas, getImageData and Browser Security</title>
		<link>http://blog.project-sierra.de/archives/1577</link>
		<comments>http://blog.project-sierra.de/archives/1577#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:36:36 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1577</guid>
		<description><![CDATA[Today I played a bit with Canvas and getImageData. What I tried to figure out was how to get the color of a certain pixel. The solution is easy to find via Google. The code looks  somewhat like this:

var ctx = document.getElementById&#40;'canvas'&#41;.getContext&#40;'2d'&#41;;  
var img = new Image&#40;&#41;;  
img.onload = function&#40;&#41;&#123;  
 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Today I played a bit with Canvas and getImageData. What I tried to figure out was how to get the color of a certain pixel. The solution is easy to find via Google. The code looks  somewhat like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> ctx <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'canvas'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2d'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #003366; font-weight: bold;">var</span> img <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
img.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
  ctx.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span>img<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  <span style="color: #003366; font-weight: bold;">var</span> objImageData <span style="color: #339933;">=</span> ctx.<span style="color: #660066;">getImageData</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">width</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span>  
  <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Pixel at (0,0): rgba(&quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>  
img.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'test.jpg'</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you run this locally in Firefox. It will show the image, but it won&#8217;t show the popup. Instead, you&#8217;ll see this exception in the Firebug console:</p>

<div class="wp_syntax"><div class="code"><pre class="javasciprt" style="font-family:monospace;">Security error&quot; code: &quot;1000
var objImageData = ctx.getImageData(0, 0, img.width, img.height)</pre></div></div>

<p>Here is why:</p>
<ul>
<li>If the image is hosted on a different domain than the script, you can&#8217;t access image data without causing above security exception.</li>
<li>If you run this locally, you anyway will get this exception because, locally there&#8217;s no domain, so Firefox thinks for sure: different Domains >> Panic!</li>
<li>If you upload above code to some web server, image and HTML page with the Javascript code on the same domain, the code will work perfectly.</li>
<li>If you want to get the image data of an image which is not on the same domain, but e.g. on Amazon S3, you will end up with above security exception.</li>
</ul>
<p>One way to handle the exception is to catch it, enable the appropriate browser permission and retry.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span> 
    <span style="color: #003366; font-weight: bold;">var</span> objImageData <span style="color: #339933;">=</span> ctx.<span style="color: #660066;">getImageData</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">width</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span>  
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
    netscape.<span style="color: #660066;">security</span>.<span style="color: #660066;">PrivilegeManager</span>.<span style="color: #660066;">enablePrivilege</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;UniversalBrowserRead&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> objImageData <span style="color: #339933;">=</span> ctx.<span style="color: #660066;">getImageData</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">width</span><span style="color: #339933;">,</span> img.<span style="color: #660066;">height</span><span style="color: #009900;">&#41;</span> 
  <span style="color: #009900;">&#125;</span> 						 
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">throw</span> <span style="color: #003366; font-weight: bold;">new</span> Error<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;unable to access image data: &quot;</span> <span style="color: #339933;">+</span> e<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Pixel an (0,0): rgba(&quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>objImageData.<span style="color: #660066;">data</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, that works, at least in Firefox, but it is ugly, because the user will get a security warning and he has to decide whether to grant the script the requested additional permission.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/07/firefoxsecurity.jpg" alt="" title="firefoxsecurity" width="400" height="145" class="alignnone size-full wp-image-1579" /></p>
<p>The only &#8220;nice&#8221; way of getting the code to work, without browser specific try / catch statements and without security warnings is to host the images on the same domain as the script. Luckily Amazon S3 supports that through <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?VirtualHosting.html">Virtual Hosting of Buckets</a>.</p>
<p>If anyone knows about additional solutions for this, I&#8217;m happy to hear about it.</p>
<p>Most information I got from this <a href="http://aaronmt.com/?p=673">article</a> on Aaron&#8217;s blog.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1577&amp;linkname=HTML%20Canvas%2C%20getImageData%20and%20Browser%20Security" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1577/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eine Billion Dollar &#8211; Andreas Eschbach</title>
		<link>http://blog.project-sierra.de/archives/1563</link>
		<comments>http://blog.project-sierra.de/archives/1563#comments</comments>
		<pubDate>Sun, 25 Jul 2010 15:23:50 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1563</guid>
		<description><![CDATA[ Guter, trotz der 800+ Seiten, kurzweiliger Roman mit einigen interessanten Punkten:
Der Abschnitt auf Seite 305 ff. hat mich dazu angeregt &#8220;Die Grenzen des Wachstums&#8221; auf meine Amazon Wunschliste zu setzen. Im Roman geht es an dieser Stelle um die Analyse und Voraussage der Entwicklung hochgradig vernetzter Systeme; in diesem konkreten Fall: der Welt in [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p><a href="http://www.amazon.de/gp/product/3404150406?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=3404150406"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/07/einebilliondollar.jpg" alt="Eine Billion Dollar" title="Eine Billion Dollar" width="108" height="160" class="aligncenter size-full wp-image-1564" align="left" style="padding:20px;"/></a> Guter, trotz der 800+ Seiten, kurzweiliger Roman mit einigen interessanten Punkten:</p>
<p>Der Abschnitt auf Seite 305 ff. hat mich dazu angeregt &#8220;<strong>Die Grenzen des Wachstums</strong>&#8221; auf meine <a href="http://www.amazon.de/gp/redirect.html?ie=UTF8&#038;location=http%3A%2F%2Fwww.amazon.de%2Fgp%2Fregistry%2Fwishlist%2F3QZVGTXSH4OGB%3Fie%3DUTF8%26ref_%3Dcm%5Fwl%5Frlist%5Fgo&#038;site-redirect=de&#038;tag=beeloge-21&#038;linkCode=ur2&#038;camp=1638&#038;creative=19454">Amazon Wunschliste</a> zu setzen. Im Roman geht es an dieser Stelle um die Analyse und Voraussage der Entwicklung hochgradig vernetzter Systeme; in diesem konkreten Fall: der Welt in der wir leben. In denke &#8220;Die Grenzen des Wachstums&#8221; kann interessante Denkansätze zu folgender Frage geben: Welche Faktoren beeinflussen die Entwicklung der Menschheit und wie hängen diese Faktoren zusammen?</p>
<p><a href="http://www.amazon.de/gp/product/3777613843?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=3777613843"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/07/grenzendeswachstums.jpg" alt="Grenzen des Wachstums" title="Grenzen des Wachstums" width="107" height="160" class="alignright size-full wp-image-1569" align="right" style="padding:20px;"/></a> Auf den Seiten 452 ff. wird beschrieben wie der <strong>Golfstrom</strong> funktioniert, warum er auf Grund des Klimawandels versiegen könnte und welche Auswirkungen das wiederum auf unser Klima haben könnte. Mittlerweile ist die Rolle des Golfstroms für das Klima in Europa kein großes Geheimnis mehr. Nichtsdestotrotz sind die Zusammenhänge interessant. Mehr zu dieser Thematik erfährt man <a href="http://oceancurrents.rsmas.miami.edu/atlantic/gulf-stream.html">hier</a>, <a href="http://www.agenda21-treffpunkt.de/lexikon/Golfstrom.htm">hier</a>, <a href="http://www.corona-magazine.de/archiv/corona124.html#wissenschaft">hier</a> und <a href="http://wiki.bildungsserver.de/klimawandel/index.php/Golfstrom">hier</a>. </p>
<p>Oft hört man Sätze wie &#8220;Du musste Dein Geld für dich arbeiten lassen&#8221;. Aber: <strong>Geld arbeitet nicht</strong>. Menschen arbeiten. Jeden Euro um den ein Konto wächst, hat irgendjemand erarbeitet. Jemand, der Schulden hat und deshalb von dem Geld, dass er verdient, abgeben muss an den, bei dem er dieser Schulden hat. Also: Reiche lassen nicht ihr Geld für sich arbeiten, sie lassen andere für sich arbeiten, wenn auch nicht direkt.</p>
<p>Reichtum hängt in erster Linie mit den Einnahmen zusammen nicht zu sehr mit der Ausgabenseite. Schaut man sich die Einnahmeseite an, so kann man folgende <strong>Hierarchie des erreichbaren Einkommens</strong> erkennen:</p>
<ul>
<li>Arbeit (dass was die meisten &#8220;ehrliche Arbeit&#8221; nennen)</li>
<li>Spezialisierte Arbeit</li>
<li>Handel</li>
<li>Unternehmen</li>
<li>Geld (mit dem man weiteres Geld verdient; siehe oben &#8220;Geld arbeitet nicht&#8221;)</li>
</ul>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1563&amp;linkname=Eine%20Billion%20Dollar%20%26%238211%3B%20Andreas%20Eschbach" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1563/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Delay execution of any function</title>
		<link>http://blog.project-sierra.de/archives/1559</link>
		<comments>http://blog.project-sierra.de/archives/1559#comments</comments>
		<pubDate>Sun, 18 Jul 2010 14:23:45 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1559</guid>
		<description><![CDATA[If you ever wanted to use jQuery&#8217;s delay function to delay the execution of any other function than e.g. jQuery&#8217;s effect functions you probably tried something like this:

$&#40;document&#41;.ready&#40;function&#40;&#41;&#123;
  $&#40;&#34;#myElement&#34;&#41;.delay&#40;2000&#41;.trigger&#40;&#34;click&#34;&#41;;
&#125;&#41;;

My intension was to trigger the &#8220;click&#8221; event on #myElement two seconds after the DOM was loaded. During testing however it turned out that the event [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>If you ever wanted to use jQuery&#8217;s <a href="http://api.jquery.com/delay/">delay</a> function to delay the execution of any other function than e.g. <a href="http://api.jquery.com/category/effects/">jQuery&#8217;s effect functions</a> you probably tried something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myElement&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>My intension was to trigger the &#8220;click&#8221; event on #myElement two seconds after the DOM was loaded. During testing however it turned out that the event was triggered right away without any delay. </p>
<p>Taking a closer look at the delay function showed me that only functions that are queued in jQuery&#8217;s default &#8220;fx&#8221; queue are delayed by a delay-call like the one above. If you want to delay e.g. the trigger function you either need to queue it in the fx-queue or in a separate queue. Here is how that works:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myElement&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">queue</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dequeue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you don&#8217;t want to use the default fx-queue, this is how to queue the function in your own queue:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myElement&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delay</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2000</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;myQueue&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">queue</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myQueue&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
  $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">trigger</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;click&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dequeue</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myQueue&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1559&amp;linkname=jQuery%3A%20Delay%20execution%20of%20any%20function" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1559/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting border width with jQuery</title>
		<link>http://blog.project-sierra.de/archives/1548</link>
		<comments>http://blog.project-sierra.de/archives/1548#comments</comments>
		<pubDate>Mon, 28 Jun 2010 20:44:11 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1548</guid>
		<description><![CDATA[Say the HTML is this

&#60;div id=&#34;mydiv&#34; style=&#34;border:10px solid #ff0000;&#34;&#62;Hello World&#60;/div&#62;

then you get the width of the border with this:

var borderWidth =&#40;$&#40;&#34;#mydiv&#34;&#41;.outerWidth&#40;&#41; - $&#40;&#34;#mydiv&#34;&#41;.width&#40;&#41;&#41; / 2;

]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Say the HTML is this</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div id=&quot;mydiv&quot; style=&quot;border:10px solid #ff0000;&quot;&gt;Hello World&lt;/div&gt;</pre></div></div>

<p>then you get the width of the border with this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> borderWidth <span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mydiv&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">outerWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#mydiv&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span></pre></div></div>

<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1548&amp;linkname=Getting%20border%20width%20with%20jQuery" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1548/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serialize / Deserialize nested objects in ActiveRecord</title>
		<link>http://blog.project-sierra.de/archives/1539</link>
		<comments>http://blog.project-sierra.de/archives/1539#comments</comments>
		<pubDate>Sat, 26 Jun 2010 18:17:19 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1539</guid>
		<description><![CDATA[Using ActiveRecord&#8217;s serialize method you can save Ruby objects in a single field of your model. The serialization is done through YAML.
Today I tried to save a nested object structure with this method. These are the classes:

class PhotoStyle
  attr_accessor :image
&#160;
  def initialize
    @image = StyleElement.new
  end
end
&#160;
class StyleElement
  attr_accessor [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Using ActiveRecord&#8217;s <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001799">serialize</a> method you can save Ruby objects in a single field of your model. The serialization is done through YAML.</p>
<p>Today I tried to save a nested object structure with this method. These are the classes:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> PhotoStyle
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:image</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize
    <span style="color:#0066ff; font-weight:bold;">@image</span> = StyleElement.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> StyleElement
  attr_accessor <span style="color:#ff3333; font-weight:bold;">:selector</span>, <span style="color:#ff3333; font-weight:bold;">:style</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize
    <span style="color:#0066ff; font-weight:bold;">@selector</span> = <span style="color:#996600;">'*'</span>
    <span style="color:#0066ff; font-weight:bold;">@style</span> = <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The model which saves a PhotoStyle object:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Photo <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  serialize <span style="color:#ff3333; font-weight:bold;">:style</span>, PhotoStyle
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>This first approach didn&#8217;t quite work out. Saving the model worked fine, but when I loaded it only PhotoStyle got deserialized to the original type. The nested StyleElement didn&#8217;t:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">p</span> = Photo.<span style="color:#9900CC;">last</span>
<span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">style</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;PhotoStyle:0xb70a906c @image=#&lt;YAML::Object:0xb72079a4 @ivars={&quot;selector&quot;=&gt;&quot;#theimage&quot;, &quot;style&quot;=&gt;{&quot;border&quot;=&gt;&quot;0&quot;, &quot;box-shadow&quot;=&gt;&quot;1px 3px 15px #555&quot;}}, @class=&quot;StyleElement&quot;&gt;}, @class=&quot;PhotoStyle&quot;&gt;&gt;</span></pre></div></div>

<p>Note the YAML object assigned to the @image instance variable.</p>
<p>I&#8217;m not sure if that&#8217;s a bug in Rails3 or if that is by design. You can however &#8220;fix&#8221; it by running this code snippet when your application starts up:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">YAML::Syck::Resolver</span>.<span style="color:#9900CC;">class_eval</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> transfer_with_autoload<span style="color:#006600; font-weight:bold;">&#40;</span>type, val<span style="color:#006600; font-weight:bold;">&#41;</span>
    match = type.<span style="color:#9900CC;">match</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>object:<span style="color:#006600; font-weight:bold;">&#40;</span>\w<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span>?:::\w<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    match <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> match<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">constantize</span>
    transfer_without_autoload<span style="color:#006600; font-weight:bold;">&#40;</span>type, val<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  alias_method_chain <span style="color:#ff3333; font-weight:bold;">:transfer</span>, <span style="color:#ff3333; font-weight:bold;">:autoload</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Save it e.g. in yaml_autoloader.rb in the config/initializers folder of your app.</p>
<p>Now all types will autoload:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#&lt;PhotoStyle:0xb73dcb08 @image=#&lt;StyleElement:0xb73dd058 @selector=&quot;#theimage&quot;, @style={&quot;border&quot;=&gt;&quot;0&quot;, &quot;box-shadow&quot;=&gt;&quot;1px 3px 15px #555&quot;}&gt;&gt;</span></pre></div></div>

<p>I found above code snippet <a href="http://blog.sbf5.com/?p=39">here</a>. Thanks!</p>
<p>Read more about ActiveRecord&#8217;s serialize method here: <a href="http://blog.project-sierra.de/archives/1379">Simple user preferences for your Rails app</a>.</p>
<p><strong>Update:</strong><br />
Still not sure if that&#8217;s a bug, but I submitted a <a href="https://rails.lighthouseapp.com/projects/8994/tickets/5002-nested-objects-dont-deserialized-completely-rails-3-beta-4">lighthouse ticket</a>.</p>
<p><strong>Update 2:</strong><br />
Apparently this is not a bug in Rails, but a problem in my code :-) Please see Aaron&#8217;s comment in <a href="https://rails.lighthouseapp.com/projects/8994/tickets/5002-nested-objects-dont-deserialized-completely-rails-3-beta-4">above ticket</a>. </p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1539&amp;linkname=Serialize%20%2F%20Deserialize%20nested%20objects%20in%20ActiveRecord" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1539/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Heroku, Rails 3, RVM and Ubuntu</title>
		<link>http://blog.project-sierra.de/archives/1534</link>
		<comments>http://blog.project-sierra.de/archives/1534#comments</comments>
		<pubDate>Tue, 15 Jun 2010 20:50:24 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1534</guid>
		<description><![CDATA[Today I tried to use Heroku on Ubuntu / RVM for a Rails 3 test app. I ran into a similar problem like I had yesterday with OpenSSL.
After installing the Heroku gem:

gem install heroku

and running the command for create a new app

heroku create

I got this error

/home/siebel/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- readline (LoadError)
	from [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Today I tried to use <a href="http://heroku.com/">Heroku</a> on Ubuntu / RVM for a Rails 3 test app. I ran into a similar problem like I had yesterday with <a href="http://blog.project-sierra.de/archives/1527">OpenSSL</a>.</p>
<p>After installing the Heroku gem:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> heroku</pre></div></div>

<p>and running the command for create a new app</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">heroku create</pre></div></div>

<p>I got this error</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>rubies<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>site_ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>rubygems<span style="color: #000000; font-weight: bold;">/</span>custom_require.rb:<span style="color: #000000;">31</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>gem_original_require<span style="color: #ff0000;">': no such file to load -- readline (LoadError)
	from /home/siebel/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>heroku-1.9.10<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>heroku<span style="color: #000000; font-weight: bold;">/</span>commands<span style="color: #000000; font-weight: bold;">/</span>app.rb:<span style="color: #000000;">1</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>rubies<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>site_ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>rubygems<span style="color: #000000; font-weight: bold;">/</span>custom_require.rb:<span style="color: #000000;">31</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>gem_original_require<span style="color: #ff0000;">'
	from /home/siebel/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>heroku-1.9.10<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>heroku<span style="color: #000000; font-weight: bold;">/</span>command.rb:<span style="color: #000000;">5</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>heroku-1.9.10<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>heroku<span style="color: #000000; font-weight: bold;">/</span>command.rb:<span style="color: #000000;">5</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>each<span style="color: #ff0000;">'
	from /home/siebel/.rvm/gems/ruby-1.8.7-p249/gems/heroku-1.9.10/lib/heroku/command.rb:5
	from /home/siebel/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>rubies<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>site_ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>rubygems<span style="color: #000000; font-weight: bold;">/</span>custom_require.rb:<span style="color: #000000;">31</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>require<span style="color: #ff0000;">'
	from /home/siebel/.rvm/gems/ruby-1.8.7-p249/gems/heroku-1.9.10/bin/heroku:7
	from /home/siebel/.rvm/gems/ruby-1.8.7-p249/bin/heroku:19:in `load'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>siebel<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>heroku:<span style="color: #000000;">19</span></pre></div></div>

<p>Now, the first line looks darn familiar and so does the solution:</p>
<p>First install libreadline-dev:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libreadline-dev</pre></div></div>

<p>Then cd into</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249<span style="color: #000000; font-weight: bold;">/</span>ext<span style="color: #000000; font-weight: bold;">/</span>readline</pre></div></div>

<p>and build the extension:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby extconf.rb
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>That&#8217;s it&#8230; heroku should run after that without problems.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1534&amp;linkname=Heroku%2C%20Rails%203%2C%20RVM%20and%20Ubuntu" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1534/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL, Rails 3 and Ubuntu</title>
		<link>http://blog.project-sierra.de/archives/1527</link>
		<comments>http://blog.project-sierra.de/archives/1527#comments</comments>
		<pubDate>Mon, 14 Jun 2010 21:03:41 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1527</guid>
		<description><![CDATA[I&#8217;m using RVM on my Ubuntu box. This way I can nicely install several Ruby and Rails versions next to each other. With Rails 3 however I had a little bit of trouble. When starting the server using

rails server

 the server started fine, but as soon as I clicked &#8220;About your application’s environment&#8221;, I got [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>I&#8217;m using <a href="http://rvm.beginrescueend.com/">RVM</a> on my Ubuntu box. This way I can nicely install several Ruby and Rails versions next to each other. With Rails 3 however I had a little bit of trouble. When starting the server using</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rails server</pre></div></div>

<p> the server started fine, but as soon as I clicked &#8220;About your application’s environment&#8221;, I got this error on the console:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LoadError: no such <span style="color: #c20cb9; font-weight: bold;">file</span> to load <span style="color: #660033;">--</span> openssl</pre></div></div>

<p>If you&#8217;re getting this too the first thing to check is whether these packages are installed:</p>
<ul>
<li>openssl</li>
<li>libssl-dev</li>
<li>libssl0.9.8</li>
</ul>
<p>If they are and it anyway doesn&#8217;t work you want to go to the source code of your Ruby installation. In my case the source is in this path:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.7-p249</pre></div></div>

<p>Now you cd to ext/openssl and run the following commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby extconf.rb
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>After restarting WEBrick, everything was good:</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/06/rails3.jpg" alt="" title="rails3" width="515" height="223" class="aligncenter size-full wp-image-1528" /></p>
<p>For a more complete description on how to install Rails 3 on Ubuntu using RVM, checkout this blog post by Rohit Arondekar: <a href="http://rohitarondekar.com/articles/installing-rails3-beta3-on-ubuntu-using-rvm">Installing Rails 3.0 Beta 3 on Ubuntu using RVM</a></p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1527&amp;linkname=OpenSSL%2C%20Rails%203%20and%20Ubuntu" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1527/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery: Checking if image is loaded</title>
		<link>http://blog.project-sierra.de/archives/1490</link>
		<comments>http://blog.project-sierra.de/archives/1490#comments</comments>
		<pubDate>Wed, 09 Jun 2010 19:12:12 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1490</guid>
		<description><![CDATA[Triggering some function when an image is loaded is as easy as this with jQuery:
The HTML:

&#60;img src=&#34;image.jpg&#34; alt=&#34;&#34; id=&#34;theimage&#34;/&#62;

Javascript:

$&#40;document&#41;.ready&#40;function&#40;&#41; &#123;
  $&#40;&#34;#theimage&#34;&#41;.load&#40;function&#40;&#41; &#123;
    alert&#40;&#34;loaded&#34;&#41;;
  &#125;&#41;;
&#125;&#41;;

If you load your test page a second or third time, you&#8217;ll notice that the alert doesn&#8217;t pop up. That&#8217;s because the browser cached the image and [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Triggering some function when an image is loaded is as easy as this with jQuery:</p>
<p>The HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;img src=&quot;image.jpg&quot; alt=&quot;&quot; id=&quot;theimage&quot;/&gt;</pre></div></div>

<p>Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#theimage&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loaded&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you load your test page a second or third time, you&#8217;ll notice that the alert doesn&#8217;t pop up. That&#8217;s because the browser cached the image and in that case the load event won&#8217;t fire. To work around this you could use the complete property of the image:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> $image <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#theimage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$image<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">complete</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loaded&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    $image.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loaded&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>So in case the image is already loaded the alert pops up right away. Otherwise we bind a function to the load event.</p>
<p>See the code in action on <a href="http://365days.project-sierra.de/index.html">365 Days</a> or checkout this <a href="http://gist.github.com/432010">gist</a>.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1490&amp;linkname=jQuery%3A%20Checking%20if%20image%20is%20loaded" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1490/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML: Hiding border of focused elements</title>
		<link>http://blog.project-sierra.de/archives/1484</link>
		<comments>http://blog.project-sierra.de/archives/1484#comments</comments>
		<pubDate>Sat, 05 Jun 2010 15:27:25 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1484</guid>
		<description><![CDATA[When you focus a link or some other focusable HTML element, you&#8217;ll get some more or less ugly outline which might not quite be what you want. In Firefox it&#8217;s for example a dotted border:

To remove this outline e.g. for all links, simply add this CSS:

a &#123;
  border: 0;
  outline: 0;
&#125;

This won&#8217;t work [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>When you focus a link or some other focusable HTML element, you&#8217;ll get some more or less ugly outline which might not quite be what you want. In Firefox it&#8217;s for example a dotted border:</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/06/focusedlink.jpg" alt="" title="focusedlink" width="300" height="76" class="aligncenter size-full wp-image-1485" /></p>
<p>To remove this outline e.g. for all links, simply add this CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">outline</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>This won&#8217;t work for any element in Internet Explorer. You might have to add some none standard attribute:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;#&quot; hidefocus=&quot;true&quot;&gt;some link&lt;/a&gt;</pre></div></div>

<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1484&amp;linkname=HTML%3A%20Hiding%20border%20of%20focused%20elements" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1484/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 show off</title>
		<link>http://blog.project-sierra.de/archives/1479</link>
		<comments>http://blog.project-sierra.de/archives/1479#comments</comments>
		<pubDate>Fri, 04 Jun 2010 21:28:01 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1479</guid>
		<description><![CDATA[This week Apple show&#8217;s off Safari&#8217;s HTML5 capabilities &#8230; check it out, it&#8217;s impressive: Apple HTML5

There is also a page for Google Chrome demonstrating some pretty neat HTML5: Chrome Experiments

]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>This week Apple show&#8217;s off Safari&#8217;s HTML5 capabilities &#8230; check it out, it&#8217;s impressive: <a href="http://www.apple.com/html5/">Apple HTML5</a><br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/06/applehtml5.jpg" alt="" title="applehtml5" width="400" height="183" class="aligncenter size-full wp-image-1480" /></p>
<p>There is also a page for Google Chrome demonstrating some pretty neat HTML5: <a href="http://www.chromeexperiments.com/">Chrome Experiments</a><br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/06/chormeexperiments.jpg" alt="" title="chormeexperiments" width="400" height="183" class="aligncenter size-full wp-image-1481" /></p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1479&amp;linkname=HTML5%20show%20off" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1479/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile_Fu, Internet Explorer and respond_to</title>
		<link>http://blog.project-sierra.de/archives/1477</link>
		<comments>http://blog.project-sierra.de/archives/1477#comments</comments>
		<pubDate>Tue, 01 Jun 2010 19:48:53 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[RubyOnRails]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1477</guid>
		<description><![CDATA[Today I noticed that List Kung Fu displays the mobile version of the list page when I browse there with regular desktop Internet Explorer. Surfing to the same page with Firefox or Opera on the same machine worked fine and just returned the regular HTML page.
So what&#8217;s up?
Simple&#8230; Internet Explorer sends a really funny accepts [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Today I noticed that List Kung Fu displays the mobile version of the list page when I browse there with regular desktop Internet Explorer. Surfing to the same page with Firefox or Opera on the same machine worked fine and just returned the regular HTML page.</p>
<p>So what&#8217;s up?</p>
<p>Simple&#8230; Internet Explorer sends a really funny accepts header, none of the formats actually is text/html. Thus HTML is covered with an implicit */*. That&#8217;s not awesome (in good IE manner), but not really a problem. A problem it just becomes with something like this in your controller action:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">      respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span>
        <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">mobile</span>
        <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span>
      <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Since Internet Explorer doesn&#8217;t send an explicit accept for text/html, Rails would just default to the first format, in above case format.mobile and then correctly return the mobile version of the view. The fix is easy. Just move format.html to the first position:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">      respond_to <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>format<span style="color:#006600; font-weight:bold;">|</span>
        <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">html</span>
        <span style="color:#CC0066; font-weight:bold;">format</span>.<span style="color:#9900CC;">mobile</span>
      <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now */* would default to format.html.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1477&amp;linkname=Mobile_Fu%2C%20Internet%20Explorer%20and%20respond_to" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1477/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling jQuery Simpletip temporarily</title>
		<link>http://blog.project-sierra.de/archives/1470</link>
		<comments>http://blog.project-sierra.de/archives/1470#comments</comments>
		<pubDate>Mon, 31 May 2010 21:12:35 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1470</guid>
		<description><![CDATA[Simpletip is a pretty nice jQuery plugin for displaying tool-tips. Minified and packed it&#8217;s only 3.4kb.

It comes with a small API, which is quite sufficient for most of the stuff you want to do with a tool-tip. One thing however I am missing: The ability to temporarily disable the tool-tip.You could do simply this:

function createTooltip&#40;ele&#41; [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p><a href="http://craigsworks.com/projects/simpletip">Simpletip</a> is a pretty nice jQuery plugin for displaying tool-tips. Minified and packed it&#8217;s only 3.4kb.</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/simpletip.jpg" alt="" title="simpletip" width="281" height="128" class="aligncenter size-full wp-image-1471" /></p>
<p>It comes with a small API, which is quite sufficient for most of the stuff you want to do with a tool-tip. One thing however I am missing: The ability to temporarily disable the tool-tip.You could do simply this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> createTooltip<span style="color: #009900;">&#40;</span>ele<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  ele.<span style="color: #660066;">simpletip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    content<span style="color: #339933;">:</span> <span style="color: #3366CC;">'My Simpletip'</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create the tool-tip</span>
createTooltip<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// disable the tool-tip:</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">unbind</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;mouseover&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// do some other stuff</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// enable tool-tip again:</span>
createTooltip<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This works perfectly fine, but it&#8217;s not very generic, since the content is hard coded in the createTooltip function. An alternative approach could look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> createTooltip<span style="color: #009900;">&#40;</span>ele<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  ele.<span style="color: #660066;">simpletip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    content<span style="color: #339933;">:</span> <span style="color: #3366CC;">'My Simpletip'</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> disableTooltip<span style="color: #009900;">&#40;</span>ele<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> tooltip <span style="color: #339933;">=</span> ele.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">simpletip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  ele.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tooltip-content&quot;</span><span style="color: #339933;">,</span> tooltip.<span style="color: #660066;">getTooltip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  tooltip.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  tooltip.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> enableTooltip<span style="color: #009900;">&#40;</span>ele<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> tooltip <span style="color: #339933;">=</span> ele.<span style="color: #660066;">eq</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">simpletip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> content <span style="color: #339933;">=</span> ele.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;tooltip-content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  tooltip.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span>content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// create the tool-tip</span>
createTooltip<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// disable the tool-tip:</span>
disableTooltip<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// do some other stuff</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// enable tool-tip again:</span>
enableTooltip<span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#myelement&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In this version the mouseover event is still bound to #myelement, but we update the content of the  tool-tip to an empty string. This has the desired effect of nothing being displayed when hovering over the element. The original content of the tool-tip is stored in the data store of the HTML element. When enabling the tool-tip again, we take the HTML from there and update the tool-tip content with it. That&#8217;s it.</p>
<p>If you have any events bound to elements within the tool-tip, you have to make sure you re-bind them in the enableTooltip function. Better would be however to use the jQuery <a href="http://api.jquery.com/live/">live</a> function in the createTooltip function. This way you don&#8217;t have to worry about re-binding events. jQuery will take care of it.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1470&amp;linkname=Disabling%20jQuery%20Simpletip%20temporarily" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1470/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Der Hauptmann von Köpenick &#8211; Carl Zuckmayer</title>
		<link>http://blog.project-sierra.de/archives/1466</link>
		<comments>http://blog.project-sierra.de/archives/1466#comments</comments>
		<pubDate>Sun, 30 May 2010 16:39:16 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Books]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1466</guid>
		<description><![CDATA[ There are few authors of whom you can read just everything. In my humble opinion Carl Zuckmayer is one of them. I&#8217;ve always thought I&#8217;m not the kind of guy reading theater players. Actually I&#8217;m really not. Zuckmayer&#8217;s plays are an exception. They are natural, true and entertaining.
]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p><a href="http://www.amazon.de/gp/product/3596270022?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=3596270022"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/hauptmannvonkoepenick.jpg" alt="" title="Der Hauptmann von Köpenick" width="106" height="160" class="aligncenter size-full wp-image-1467" align="left" style="padding:10px;" /></a> There are few authors of whom you can read just everything. In my humble opinion Carl Zuckmayer is one of them. I&#8217;ve always thought I&#8217;m not the kind of guy reading theater players. Actually I&#8217;m really not. Zuckmayer&#8217;s plays are an exception. They are natural, true and entertaining.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1466&amp;linkname=Der%20Hauptmann%20von%20K%C3%B6penick%20%26%238211%3B%20Carl%20Zuckmayer" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1466/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art Of The Start &#8211; Guy Kawasaki</title>
		<link>http://blog.project-sierra.de/archives/1457</link>
		<comments>http://blog.project-sierra.de/archives/1457#comments</comments>
		<pubDate>Tue, 25 May 2010 19:19:00 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Business]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1457</guid>
		<description><![CDATA[ While reading The Art Of The Start I was quite surprised how many parallels there are to Rework. Kawasaki&#8217;s guide gives a concise overview about many things that are helpful to know when starting either a business on your own or a new product internally within an existing company. It also contains a couple [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p><a href="http://www.amazon.de/gp/product/1591840562?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=1591840562"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/theartofthestart.png" alt="" title="theartofthestart" width="104" height="160" class="aligncenter size-full wp-image-1458" align="left" style="padding:10px;" /></a> While reading <em>The Art Of The Start</em> I was quite surprised how many parallels there are to <em><a href="http://blog.project-sierra.de/archives/1362">Rework</a></em>. Kawasaki&#8217;s guide gives a concise overview about many things that are helpful to know when starting either a business on your own or a new product internally within an existing company. It also contains a couple of good references to further readings.<br />
<br/><br/><br/><br/><br />
Topics are:</p>
<ul>
<li>What&#8217;s your business about: Positioning, Pitching, Business Plans.</li>
<li>Money: Bootstrapping, Recruiting, Raising capital.</li>
<li>Create a profile: partnering, branding, rainmaking.</li>
</ul>
<p>Some people call it the &#8220;startup bible&#8221;. That&#8217;s exaggerated. It&#8217;s a useful guide, a starting point. You might also want to read <em><a href="http://blog.project-sierra.de/archives/1213">The Principles Of Successful Freelancing</a></em>, since you&#8217;ll find more information about the nitty-gritty details of creating a business there.</p>
<p>P.S.: I&#8217;m not saying <em>Rework</em> is necessarily a startup guide. Fried and Hansson focus more on work quality and life / work balance. At least that&#8217;s how I read the book.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1457&amp;linkname=The%20Art%20Of%20The%20Start%20%26%238211%3B%20Guy%20Kawasaki" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1457/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Things Done &#8211; David Allen</title>
		<link>http://blog.project-sierra.de/archives/1408</link>
		<comments>http://blog.project-sierra.de/archives/1408#comments</comments>
		<pubDate>Sun, 23 May 2010 19:46:36 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Business]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1408</guid>
		<description><![CDATA[If you want to learn about increasing your productivity most people will recommend you David Allen&#8217;s book &#8220;Getting things done&#8221;.

When reading through the book you might get the impression that Allen evangelizes his productivity principles like a religion. I wouldn&#8217;t go so far and call it a religion, but certainly implementing those principles will have [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>If you want to learn about increasing your productivity most people will recommend you David Allen&#8217;s book <em>&#8220;Getting things done&#8221;</em>.</p>
<p><a href="http://www.amazon.de/gp/product/0142000280?ie=UTF8&amp;tag=beeloge-21&amp;linkCode=as2&amp;camp=1638&amp;creative=19454&amp;creativeASIN=0142000280"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd_cover.jpg" alt="" title="gtd_cover" width="100" height="160" class="size-full wp-image-1448" align="left" style="padding:10px;" /></a></p>
<p>When reading through the book you might get the impression that Allen evangelizes his productivity principles like a religion. I wouldn&#8217;t go so far and call it a religion, but certainly implementing those principles will have a notable effect on your life. It is a methodology to get organized and productive.</p>
<p><em>Getting things done</em> consists out of three parts:</p>
<ol>
<li>Master your workflow / Natural Project Planning</li>
<li>The core principles in detail</li>
<li>Key principles for a successful application of the process</li>
</ol>
<p>If the first part Allen introduces the &#8220;<a href="http://zenhabits.net/mind-like-water/">Mind like water</a>&#8221; concept. The modern world bombards everyone with thousands of inputs. Allen calls it simply &#8220;stuff&#8221;. This stuff needs to be canalized into a trusted system as fast as possible in order to keep a clear mind and to be able to concentrate on what really matters.</p>
<p>The <strong>complete system</strong> looks like this:<br />
<a href="http://blog.project-sierra.de/wp-content/uploads/2010/05/gettingsthingsdone_complete.png" rel="lightbox"><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gettingsthingsdone_complete_small.png" alt="" title="Getting Things Done System" width="400" height="566" class="alignleft size-full wp-image-1413" /></a></p>
<p>Let&#8217;s look at it a little more detailed. At the beginning stands the <strong>collection</strong> process.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd-collection.png" alt="" title="gtd-collection" width="244" height="219" class="alignleft size-full wp-image-1418" /><br />
Goal of this first step is to collect all the various inputs in a single inbox. This makes the next step of &#8220;Processing&#8221; a lot easier and effective. Collecting all your loose &#8220;stuff&#8221; is the very first step towards a mind like water.</p>
<p>Next comes the step of <strong>processing and organizing</strong>.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd-processing1.png" alt="" title="gtd-processing1" width="500" height="252" class="alignleft size-full wp-image-1421" /><br />
You need to regularly empty your inbox. If you don&#8217;t, it will soon serve as garbage dump rather than inbox. The first question you have to ask for each item is &#8220;<strong>What is it?</strong>&#8220;. This might sound dumb, but in the collection process you only collect everything without making a decision about it. Therefore when processing your inbox you first need to find out what you&#8217;re dealing with. Without knowing this you cannot figure out a good answer to the next question: &#8220;<strong>Is it actionable?</strong>&#8221;</p>
<p><strong>If it&#8217;s not actionable, there are three possibilities: </strong></p>
<ul>
<li>It&#8217;s not needed so trash it.</li>
<li>No action is needed right now, but someday you might want to do something about it.</li>
<li>No action is needed, but you want to keep it as reference material.</li>
</ul>
<p><strong>If it is actionable</strong>, you should do things which take less than two minutes right away. If you do that, it means one less item to think about, one less item on your lists to review.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd-processing2.png" alt="" title="gtd-processing2" width="400" height="304" class="alignleft size-full wp-image-1432" /></p>
<p><strong>For all other items:</strong></p>
<ul>
<li>If you&#8217;re not the right person for the task, delegate it. Wait for results, if necessary follow up with the person to whom you delegated the task.</li>
<li>Since you can&#8217;t get the task done within two minutes: Defer it. In case it needs to be done on a specific date / time, put it on your calendar. If it&#8217;s not bound to a time, put it on a list that keeps track of the &#8220;next action&#8221; you need to undertake.</li>
</ul>
<p>Some things consist out of more than one action, you usually call them projects.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd-processing3.png" alt="" title="gtd-processing3" width="302" height="201" class="alignleft size-full wp-image-1435" /><br />
Projects need to be managed vertically and horizontally. They serve as constant source of &#8220;next action&#8221; tasks.</p>
<p>Managing horizontally means, controlling all the different kinds of topics / projects you&#8217;re involved in.<br />
<img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/gtd_projects_vh_whitebackground.png" alt="" title="gtd_projects_vh_whitebackground" width="400" height="252" class="alignleft size-full wp-image-1442" /><br />
Managing vertically means to think about the distinct tasks of a specific project.</p>
<p>At the end of the processing / organizing step you have at least 8 categories:</p>
<ul>
<li>Trash.</li>
<li>Someday / maybe list.</li>
<li>Reference.</li>
<li>A list with projects and for each project a list actionable items (project plans).</li>
<li>A waiting-for list, holding all things you delegated and are waiting for results.</li>
<li>A calendar, containing all tasks which need to be done at a specific time.</li>
<li>A list of &#8220;next-actions&#8221;, containing atomic actions you need to work on.</li>
</ul>
<p>Now, after putting all the energy in collecting, processing and organizing you have to regularly <strong>review</strong> these lists, update them and then most important: getting the specific action items done.<br />
The review step is at least as important as the &#8220;do&#8221; step. It guarantees that your lists stay up to date and you won&#8217;t forget about something. If your lists are not up to date, you can&#8217;t trust them. They might contain stuff you have already done or which is outdated. If you don&#8217;t trust the system, you won&#8217;t use it and you won&#8217;t get the benefit of the &#8220;Getting things done&#8221;-methodology, you won&#8217;t feel the relieve of a mind like water ;-)</p>
<p>There&#8217;s a whole lot more useful stuff in this book. One of which is &#8220;Natural Project Planning&#8221;. I will write about this in a future post.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1408&amp;linkname=Getting%20Things%20Done%20%26%238211%3B%20David%20Allen" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1408/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capturing keyboard events for div&#8217;s and other non-input elements</title>
		<link>http://blog.project-sierra.de/archives/1398</link>
		<comments>http://blog.project-sierra.de/archives/1398#comments</comments>
		<pubDate>Sun, 23 May 2010 09:22:26 +0000</pubDate>
		<dc:creator>skarabaeus</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.project-sierra.de/?p=1398</guid>
		<description><![CDATA[Last week a friend of mine was claiming that you can&#8217;t easily capture keyboard events on non-input HTML elements such as div or span. The fact is: it is easy.
See this demo:

You can use the arrow down / up keys to move the selection down or up. Find a working demo here.
The  HTML:

&#60;ul id=&#34;list&#34;&#62;
	&#60;li [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p><p>Last week a friend of mine was claiming that you can&#8217;t easily capture keyboard events on non-input HTML elements such as div or span. The fact is: it is easy.</p>
<p>See this demo:</p>
<p><img src="http://blog.project-sierra.de/wp-content/uploads/2010/05/keyevents_demo.jpg" alt="" title="demo" width="560" height="197" class="alignleft size-full wp-image-1400" /></p>
<p>You can use the arrow down / up keys to move the selection down or up. Find a working <a href="http://blog.project-sierra.de/code/keyevents_demo/index.html" target="_blank">demo here</a>.</p>
<p><strong>The  HTML:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;ul id=&quot;list&quot;&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;0&quot;&gt;test 1&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;1&quot;&gt;test 2&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;2&quot;&gt;test 3&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;3&quot;&gt;test 4&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;4&quot;&gt;test 5&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;5&quot;&gt;test 6&lt;/li&gt;
	&lt;li class=&quot;list-item&quot; tabindex=&quot;6&quot;&gt;test 7&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>Really the only trick here is to add a tabindex attribute to each list element. This way it can receive the focus and starts to capture keyboard events.</p>
<p><strong>The JavaScript:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.list-item&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">bind</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
	keydown<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> key <span style="color: #339933;">=</span> e.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">var</span> target <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">currentTarget</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">38</span><span style="color: #339933;">:</span> <span style="color: #006600; font-style: italic;">// arrow up</span>
				target.<span style="color: #660066;">prev</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">case</span> <span style="color: #CC0000;">40</span><span style="color: #339933;">:</span> <span style="color: #006600; font-style: italic;">// arrow down</span>
				target.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	focusin<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">currentTarget</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
&nbsp;
	focusout<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">currentTarget</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;selected&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">first</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The keydown event figures out which key was pressed. If it was the arrow up key it selects the previous element and sets the focus on it. For the arrow down key the following element gets the focus. The focusin and focusout events add or remove a css class in order to make the selection more visible.</p>
<p>You can find the complete code of the example here: <a href="http://gist.github.com/410789" target="_blank">http://gist.github.com/410789</a> or by clicking view source in the <a href="http://blog.project-sierra.de/code/keyevents_demo/index.html" target="_blank">demo</a>.</p>
<!-- google_ad_section_end --><p><a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Delicious" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Twitter" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Facebook" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/linkedin?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="LinkedIn" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/linkedin.png" width="16" height="16" alt="LinkedIn"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Reddit" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Slashdot" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/technorati_favorites?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Technorati Favorites" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/technorati.png" width="16" height="16" alt="Technorati Favorites"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Fblog.project-sierra.de%2Farchives%2F1398&amp;linkname=Capturing%20keyboard%20events%20for%20div%26%238217%3Bs%20and%20other%20non-input%20elements" title="Digg" rel="nofollow" target="_blank"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://blog.project-sierra.de/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://blog.project-sierra.de/archives/1398/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
