<?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>BitBonsai Labs</title>
	<atom:link href="http://www.bitbonsai.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bitbonsai.com</link>
	<description>Mauricio Wolff&#039;s geekness</description>
	<lastBuildDate>Tue, 29 Jun 2010 12:39:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Testing pastie.org embed</title>
		<link>http://www.bitbonsai.com/testing-pastie-org-embed/</link>
		<comments>http://www.bitbonsai.com/testing-pastie-org-embed/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 12:25:05 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[geek]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=229</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><script src='http://pastie.org/1023253.js'></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/testing-pastie-org-embed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Google Chrome to simulate an iPhone Safari</title>
		<link>http://www.bitbonsai.com/chrome-iphone/</link>
		<comments>http://www.bitbonsai.com/chrome-iphone/#comments</comments>
		<pubDate>Thu, 27 May 2010 14:38:47 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Hmmm. Esqueci de colocar a categoria]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=221</guid>
		<description><![CDATA[If you want to look how a test (or any other site) will behave in an iPhone safari from the comfort of your Desktop, do the following steps: Windows 7 In Windows Explorer, go toC:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\ Create a link to chrome.exe (right click, Create Shortcut) Alter the target property in this shortcut: From: C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe To: C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to look how a test (or any other site) will behave in an iPhone safari from the comfort of your Desktop, do the following steps:</p>
<h4>Windows 7</h4>
<ol>
<li>In Windows Explorer, go to<br />C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\</li>
<li>Create a link to chrome.exe (right click, Create Shortcut)</li>
<li>Alter the target property in this shortcut: </li>
</ol>
<p><strong>From:</strong> <code>C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe</code></p>
<p><strong>To:</strong> <code>C:\Users\YOUR_USERNAME\AppData\Local\Google\Chrome\Application\chrome.exe --user-agent="Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3"</code></p>
<p>I use the <a href="https://chrome.google.com/extensions/detail/bfbameneiokkgbdmiekhjnmfkcnldhhm">Web Developer extension</a>, so I can resize my window to iPhone’s defaults (320x480 or 480x320) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/chrome-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JS Tip: Revealing Module Pattern</title>
		<link>http://www.bitbonsai.com/revealing-module-pattern/</link>
		<comments>http://www.bitbonsai.com/revealing-module-pattern/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 17:59:00 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=217</guid>
		<description><![CDATA[From Christian Heilmann. Nothing too fancy for those who are used to write jQ plugins, but nice to save it for reference... var myApp = function&#40;&#41;&#123; var nome = 'Mauricio Wolff'; var idade = 35; &#160; function insertPessoa&#40;&#41;&#123; // [...] &#125; &#160; function updatePessoa&#40;&#41;&#123; // [...] &#125; &#160; function setPessoa &#40;&#41; &#123; // [ usa [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>From Christian Heilmann. Nothing too fancy for those who are used to write jQ plugins, but nice to save it for reference...</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myApp <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: #003366; font-weight: bold;">var</span> nome <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Mauricio Wolff'</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> idade <span style="color: #339933;">=</span> <span style="color: #CC0000;">35</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> insertPessoa<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// [...]</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> updatePessoa<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// [...]</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> setPessoa <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// [ usa insert ou update ]</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> getPessoa <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// [...]</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span><span style="color: #009900;">&#123;</span>
		set<span style="color: #339933;">:</span> setPessoa<span style="color: #339933;">,</span>
		get<span style="color: #339933;">:</span> getPessoa
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// Example usage:</span>
myApp.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/revealing-module-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How does Google 2010 looks in msie3?</title>
		<link>http://www.bitbonsai.com/google2010-msie3/</link>
		<comments>http://www.bitbonsai.com/google2010-msie3/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 13:01:46 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Rumblings]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=210</guid>
		<description><![CDATA[Just for fun... but believe me, it looks better than Bing.  :)]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 514px"><img title="Google 2010 in msie 3.0" src="http://img.skitch.com/20100422-fkmtibrqaeeit3gxpyr5c3j29p.jpg" alt="Google 2010 in msie 3.0" width="504" height="400" /><p class="wp-caption-text">Google 2010 in msie 3.0</p></div>
<p style="text-align: center;">Just for fun... but believe me, it looks better than Bing.  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/google2010-msie3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>h1n1 &#8211; interessante&#8230;</title>
		<link>http://www.bitbonsai.com/h1n1/</link>
		<comments>http://www.bitbonsai.com/h1n1/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 20:15:59 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Hmmm. Esqueci de colocar a categoria]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=208</guid>
		<description><![CDATA[Não sou muito fã de teorias da conspiração, mas achei todo esse movimento de criar uma vacina a jato e vários governos do mundo comprando milhões de unidades e fazendo campanhas mundiais de vacinação muito estranhas... Aí achei um filme em três partes no youtube, que tem algumas informações no mínimo interessantes... deixo a decisão [...]]]></description>
			<content:encoded><![CDATA[<p>Não sou muito fã de teorias da conspiração, mas achei todo esse movimento de criar uma vacina a jato e vários governos do mundo comprando milhões de unidades e fazendo campanhas mundiais de vacinação muito estranhas...</p>
<p>Aí achei um filme em três partes no youtube, que tem algumas informações no mínimo interessantes... deixo a decisão para o julgamento de cada um:</p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/R_Yu2cl5ihk&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/R_Yu2cl5ihk&#038;fs=1" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/gQG9tf1oAHc&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/gQG9tf1oAHc&#038;fs=1" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><object width="500" height="400"><param name="movie" value="http://www.youtube.com/v/0ozY0_1rUT8&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/0ozY0_1rUT8&#038;fs=1" type="application/x-shockwave-flash" width="500" height="400" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/h1n1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Novo Site Publicado</title>
		<link>http://www.bitbonsai.com/novo-site-publicado/</link>
		<comments>http://www.bitbonsai.com/novo-site-publicado/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 23:12:04 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=192</guid>
		<description><![CDATA[O site terra-flor.com já estava em produção há algum tempo... Ele conta com o admbonsai, que é o gerenciador de conteúdo próprio, com uma série de plugins e produtos (gerenciador de eventos, produtos, locais de revenda, contatos, gerenciador de FAQs, mailer...) Com uma série de recursos de HTML5 e CSS3 e jQuery na veia, é [...]]]></description>
			<content:encoded><![CDATA[<p>O site <a href="http://terra-flor.com" target="_blank">terra-flor.com</a> já estava em produção há algum tempo... Ele conta com o admbonsai, que é o gerenciador de conteúdo próprio, com uma série de plugins e produtos (gerenciador de eventos, produtos, locais de revenda, contatos, gerenciador de FAQs, mailer...)</p>
<p>Com uma série de recursos de HTML5 e CSS3 e jQuery na veia, é um bom case. Vou ter de escrever um case completo para retratar as features de uma forma legal.</p>
<div id="attachment_193" class="wp-caption aligncenter" style="width: 540px"><a href="http://terra-flor.com" target="_blank"><img title="Terra-Flor Aromaterapia (terra-flor.com)" src="../wp-content/uploads/2010/04/terraflor.png" alt="" width="530" height="352" /></a><a href="http://www.bitbonsai.com/wp-content/uploads/2010/04/terraflor.png"><br />
</a><p class="wp-caption-text">Site Terra-Flor Aromaterapia</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/novo-site-publicado/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Make an HTML5 iPhone App</title>
		<link>http://www.bitbonsai.com/html-iphone-app/</link>
		<comments>http://www.bitbonsai.com/html-iphone-app/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 13:12:44 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[webdesign]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=186</guid>
		<description><![CDATA[This is nice. An article on SixRevisions, short version here for my Archive. If you write a couple meta tags, your html5 app will look like any other iPhone App, but will also work on Android, PalmPre, etc... &#60;meta name=&#34;viewport&#34; content=&#34;user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0&#34;/&#62; &#60;meta name=&#34;apple-mobile-web-app-capable&#34; content=&#34;yes&#34; /&#62; &#60;meta name=&#34;apple-mobile-web-app-status-bar-style&#34; content=&#34;black&#34; /&#62; &#60;link rel=&#34;apple-touch-icon&#34; href=&#34;iphone_icon.png&#34;/&#62; [...]]]></description>
			<content:encoded><![CDATA[<h4><a href="http://img.skitch.com/20100329-k4k9rkinb4m8r2xebsqtb6d4s9.jpg"><img class="aligncenter" title="iPhone" src="http://img.skitch.com/20100329-k4k9rkinb4m8r2xebsqtb6d4s9.jpg" alt="" width="402" height="232" /></a>This is nice. An <a href="http://sixrevisions.com/web-development/html5-iphone-app/" target="_blank">article on SixRevisions</a>, short version here for my Archive.</h4>
<p>If you write a couple meta tags, your html5 app will look like any other iPhone App, but will also work on Android, PalmPre, etc...</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;viewport&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-mobile-web-app-capable&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-mobile-web-app-status-bar-style&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;black&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-touch-icon&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;iphone_icon.png&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;apple-touch-startup-image&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;startup.png&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;styles.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen, mobile&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;main&quot;</span> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;utf-8&quot;</span>&gt;</span></pre></div></div>

<ul>
<li>apple-mobile-web-app-capable: This is another tip-off that we want to be an offline app.</li>
<li>apple-mobile-web-app-status-bar-style: This hides the status bar, and nav bar when the app is offline.</li>
<li>apple-touch-icon:This is the pointer to the image that want to be the icon.</li>
<li>apple-touch-startup-image: This is a url pointing to the startup image.</li>
</ul>
<h4>Application Cache</h4>
<p>Application caching allows browsers to determine in advance all the files a web page will need for the web page to work.</p>
<p>One tricky part to this whole thing is that the manifest (the list of files that need to be cached offline) has to be passed with a filetype Header set to text/manifest. That is why you need access to a web server that can set HTTP headers.</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">    CACHE MANIFEST
&nbsp;
    <span style="color: #adadad; font-style: italic;"># Version 3 </span>
&nbsp;
    style.css
    index.html
    init.js
&nbsp;
    <span style="color: #adadad; font-style: italic;"># offline icons</span>
    startup.png
    iphone_icon.png</pre></div></div>

<h4>Offline Data</h4>
<p>Along with the ability to keep files that are needed offline, you can also store user data in an offline database. There are two major APIs for per user and/or per page data. The first is localStorage. localStorage, is an easy to use key-value store with a dead simple API.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    localStorage.<span style="color: #660066;">dataToStore</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">;</span>
    console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>localStorage.<span style="color: #660066;">dataToStore</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 5</span></pre></div></div>

<h4>Its also possible to use a webdatabase (SQLite):</h4>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// Try and get a database object</span>
    <span style="color: #003366; font-weight: bold;">var</span> db<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">openDatabase</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            db <span style="color: #339933;">=</span> openDatabase<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;NoteTest&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;1.0&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;HTML5 Database API example&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200000</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><span style="color: #339933;">!</span>db<span style="color: #009900;">&#41;</span>
                <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Failed to open the database on disk.  This is probably because the version was /
                bad or there is not enough space left in this domain's quota&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: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Couldn't open the database.  Please try with a WebKit nightly with this feature enabled&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;">catch</span><span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Check and see if you need to initalize the DB</span>
    db.<span style="color: #660066;">transaction</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tx<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        tx.<span style="color: #660066;">executeSql</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;SELECT COUNT(*) FROM WebkitStickyNotes&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            loadNotes<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: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tx<span style="color: #339933;">,</span> error<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            tx.<span style="color: #660066;">executeSql</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;CREATE TABLE WebKitStickyNotes (id REAL UNIQUE, note TEXT, timestamp /
            REAL, left TEXT, top TEXT, zindex REAL)&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                loadNotes<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>
        <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>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Insert a test Note.</span>
    <span style="color: #003366; font-weight: bold;">var</span> note <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        id<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;1&quot;</span><span style="color: #339933;">,</span>
        text<span style="color: #339933;">:</span><span style="color: #3366CC;">&quot; This is a test note&quot;</span><span style="color: #339933;">,</span>
        timestamp<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;112123000&quot;</span><span style="color: #339933;">,</span>
        left<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>
        top<span style="color: #339933;">:</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>
        zIndex<span style="color: #339933;">:</span><span style="color: #CC0000;">2</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    db.<span style="color: #660066;">transaction</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>tx<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        tx.<span style="color: #660066;">executeSql</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;INSERT INTO WebKitStickyNotes (id, note, timestamp, left, top, zindex) VALUES /
        (?, ?, ?, ?, ?, ?)&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>note.<span style="color: #660066;">id</span><span style="color: #339933;">,</span> note.<span style="color: #660066;">text</span><span style="color: #339933;">,</span> note.<span style="color: #660066;">timestamp</span><span style="color: #339933;">,</span> note.<span style="color: #660066;">left</span><span style="color: #339933;">,</span> note.<span style="color: #660066;">top</span><span style="color: #339933;">,</span> note.<span style="color: #660066;">zIndex</span><span style="color: #009900;">&#93;</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> 
&nbsp;
    <span style="color: #006600; font-style: italic;">// Get all the notes out of the database.</span>
    db.<span style="color: #660066;">transaction</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tx<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        tx.<span style="color: #660066;">executeSql</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;SELECT id, note, timestamp, left, top, zindex /
        FROM WebKitStickyNotes&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tx<span style="color: #339933;">,</span> result<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> result.<span style="color: #660066;">rows</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>                 <span style="color: #003366; font-weight: bold;">var</span> row <span style="color: #339933;">=</span> result.<span style="color: #660066;">rows</span>.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                 <span style="color: #003366; font-weight: bold;">var</span> note <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Note<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">id</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">text</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'note'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">timestamp</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'timestamp'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">left</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'left'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">top</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'top'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 note.<span style="color: #660066;">zIndex</span> <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'zindex'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>                 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> highestId<span style="color: #009900;">&#41;</span>
                    highestId <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'zindex'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> highestZ<span style="color: #009900;">&#41;</span>
                    highestZ <span style="color: #339933;">=</span> row<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'zindex'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>result.<span style="color: #660066;">rows</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span>
                newNote<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: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>tx<span style="color: #339933;">,</span> error<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;">'Failed to retrieve notes from database - '</span> <span style="color: #339933;">+</span> error.<span style="color: #660066;">message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">return</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>

]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/html-iphone-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sonho de consumo&#8230;</title>
		<link>http://www.bitbonsai.com/sonho-de-consumo/</link>
		<comments>http://www.bitbonsai.com/sonho-de-consumo/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 21:47:24 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[Rumblings]]></category>
		<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=183</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter" title="sonho de consumo" src="http://img.ly/system/uploads/000/152/611/large_image.jpg?1268419742" alt="" width="540" height="405" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/sonho-de-consumo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iniciando em mongoDB</title>
		<link>http://www.bitbonsai.com/mongodb1/</link>
		<comments>http://www.bitbonsai.com/mongodb1/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 14:13:09 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[geek]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=177</guid>
		<description><![CDATA[Recentemente descobri o mongoDB, e como tem driver para PHP via Pecl, resolvi investigar... Uma das primeiras coisas que me chamou atenção era a aparente falta de autenticação, controle de usuários, etc. Eis que hoje descobri como funciona: Mais ou menos como o mySQL tem uma collection (admin) que, tendo-se usuário e senha para ele, [...]]]></description>
			<content:encoded><![CDATA[<p>Recentemente descobri o mongoDB, e como tem driver para PHP via Pecl, resolvi investigar...</p>
<p>Uma das primeiras coisas que me chamou atenção era a aparente falta de autenticação, controle de usuários, etc. Eis que hoje descobri como funciona:</p>
<p>Mais ou menos como o mySQL tem uma collection (admin) que, tendo-se usuário e senha para ele, se tem em todos os dbs do sistema. Para se ter auth, basta rodar o daemon com --auth</p>
<p>Em cada banco tem uma collection chamada  system.users. Ex: num banco chamado <strong>projectx</strong>, tem uma collection <strong>projectx.system.users</strong>. Pra começar a autenticar, é preciso criar um usuário no banco admin (equivalente ao banco mysql):</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">$ .<span style="color: #CC0099;">/</span>mongo
<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">use</span> admin
<span style="color: #CC0099;">&gt;</span> db.addUser<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;theadmin&quot;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;anadminpassword&quot;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>Depois disso vai precisar autenticar para fazer ações administrativas:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #CC0099;">&gt;</span> db.auth<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;theadmin&quot;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;anadminpassword&quot;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>Pra ver todos os usuários do sistema:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #CC0099;">&gt;</span> db.system.users.find<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>Criando usuários para um banco específico:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">$ .<span style="color: #CC0099;">/</span>mongo
<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">use</span> projectx
<span style="color: #CC0099;">&gt;</span> db.addUser<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;joe&quot;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;passwordForJoe&quot;</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>pode-se criar tb usuários somente leitura:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">use</span> projectx
<span style="color: #CC0099;">&gt;</span> db.addUser<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;guest&quot;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;passwordForGuest&quot;</span><span style="color: #000033;">,</span> <span style="color: #9900FF; font-weight: bold;">true</span><span style="color: #FF00FF;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/mongodb1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Designer Wheel (Roda do Webdesigner)</title>
		<link>http://www.bitbonsai.com/webwheel/</link>
		<comments>http://www.bitbonsai.com/webwheel/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 00:17:24 +0000</pubDate>
		<dc:creator>mw</dc:creator>
				<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://www.bitbonsai.com/?p=171</guid>
		<description><![CDATA[Original de Woorkup, tradução e adaptação, moi. The Web Designer Wheel é um modelo de processo simples que descreve em 5 passos como construir um projeto pequeno para web, e como conduzir as relações com o cliente. Esta abordagem permite um melhor trabalho, ensina a definir e cumprir prazos e estabelecer relações lucrativas e duradouras [...]]]></description>
			<content:encoded><![CDATA[<p>Original de <a href="http://woorkup.com/2009/11/03/the-web-designer-wheel/" target="_blank">Woorkup</a>, tradução e adaptação, <em>moi</em>.</p>
<p>The Web Designer Wheel é um modelo de processo simples que descreve em 5 passos como construir um projeto pequeno para web, e como conduzir as relações com o cliente. Esta abordagem permite um melhor trabalho, ensina a definir e cumprir prazos e estabelecer relações lucrativas e duradouras com o cliente. Eis o processo:</p>
<p><a href="http://www.bitbonsai.com/wp-content/uploads/2010/03/web-designer-wheel.png"><img class="alignright size-full wp-image-172" title="Web Designer Wheel" src="http://www.bitbonsai.com/wp-content/uploads/2010/03/web-designer-wheel.png" alt="" width="500" height="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bitbonsai.com/webwheel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
