<?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>dev.enekoalonso.com</title>
	<atom:link href="http://dev.enekoalonso.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dev.enekoalonso.com</link>
	<description>having fun with code</description>
	<lastBuildDate>Wed, 24 Feb 2010 16:34:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Having fun with Mooml &amp; Twitter</title>
		<link>http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/</link>
		<comments>http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 20:43:54 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[mooml]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=472</guid>
		<description><![CDATA[Mooml is a templating engine for Mootools. With it, you can create HTML from Javascript using a very clean syntax. Plus, it is extremely useful when you have to generate repeating elements, since Mooml automatically renders arrays of data multiple times. Let&#8217;s see an example.
Searching Twitter
Nowadays there are a lot of APIs out there that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mootools.net/plugins/p/mooml">Mooml</a> is a templating engine for Mootools. With it, you can create HTML from Javascript using a very clean syntax. Plus, it is extremely useful when you have to generate repeating elements, since Mooml automatically renders arrays of data multiple times. Let&#8217;s see an example.</p>
<h3>Searching Twitter</h3>
<p>Nowadays there are a lot of APIs out there that support JSON or JSONP, which we can use directly from the front end using Javascript. Also, there are other APIs that return tons of JS data, like Google Maps. In this example we are going to be searching Twitter and displaying the search results in a container div, properly rendered as HTML.</p>
<p>The url for searching Twitter is <a href="http://search.twitter.com/search.json?q=mootools&#038;show_user=true">http://search.twitter.com/search.json?q=mootools&#038;show_user=true</a> (searching for Mootools in this case). Check the output:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;results&quot;</span>:<span class="br0">&#91;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;profile_image_url&quot;</span>:<span class="st0">&quot;http://a3.twimg.com/profile_images/547672997/twitterProfilePhoto_normal.jpg&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;created_at&quot;</span>:<span class="st0">&quot;Fri, 19 Feb 2010 17:08:55 +0000&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;from_user&quot;</span>:<span class="st0">&quot;digitalr3bel&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;to_user_id&quot;</span>:<span class="nu0">1212494</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;text&quot;</span>:<span class="st0">&quot;@davidwalshblog Hi David &#8211; im a big fan of your site! Can you recommend a good MooTools tutorial for someone who can already program? thx&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;id&quot;</span>:<span class="nu0">9343656026</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;from_user_id&quot;</span>:<span class="nu0">23704390</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;to_user&quot;</span>:<span class="st0">&quot;davidwalshblog&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;geo&quot;</span>:<span class="kw2">null</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;iso_language_code&quot;</span>:<span class="st0">&quot;en&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="st0">&quot;source&quot;</span>:<span class="st0">&quot;&lt;a href=&quot;</span>http:<span class="co1">//apiwiki.twitter.com/&quot; rel=&quot;nofollow&quot;&gt;API&lt;/a&gt;&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">// More results here&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#93;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;max_id&quot;</span>:<span class="nu0">9343656026</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;since_id&quot;</span>:<span class="nu0">0</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;refresh_url&quot;</span>:<span class="st0">&quot;?since_id=9343656026&amp;q=mootools&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;next_page&quot;</span>:<span class="st0">&quot;?page=2&amp;max_id=9343656026&amp;q=mootools&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;results_per_page&quot;</span>:<span class="nu0">15</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;page&quot;</span>:<span class="nu0">1</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;completed_in&quot;</span>:<span class="nu0">0.0352710000000001</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="st0">&quot;query&quot;</span>:<span class="st0">&quot;mootools&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>We want to render each result inside out container div. On this example, we will just render the user name, user image and message text. Here is our Mooml template:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">Mooml.<span class="me1">register</span><span class="br0">&#40;</span><span class="st0">&#39;twitter-search-result&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>entry<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; div<span class="br0">&#40;</span><span class="br0">&#123;</span>id: <span class="st0">&quot;tweet-&quot;</span> + entry.<span class="me1">id</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; img<span class="br0">&#40;</span><span class="br0">&#123;</span>src: entry.<span class="me1">profile_image_url</span>, alt: entry.<span class="me1">from_user</span><span class="br0">&#125;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; span<span class="br0">&#40;</span>entry.<span class="me1">from_user</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; p<span class="br0">&#40;</span>entry.<span class="me1">text</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Since all results are returned into an array, we can pass it directly to Mooml which will render all of the elements in it:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// Data is the JSON response from Twitter</span></div>
</li>
<li class="li1">
<div class="de1">Mooml.<span class="me1">render</span><span class="br0">&#40;</span><span class="st0">&#39;twitter-search-result&#39;</span>, data.<span class="me1">results</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>So, let&#8217;s do a live test. Type something you want to search for and hit the search button to see Mooml in action :)<br />

<p>Search: <input type="text" id="twitter-mooml-search" value="mootools" /> <input type="button" value="search" id="twitter-mooml-search-btn"/></p>
<div id="mooml-twitter-demo" style="width:400px;border:solid 1px #444;font-size:11px;font-face:Arial,Helvetica;margin:0 auto;"></div>

<script type="text/javascript" src="http://enekoalonso.com/lib/mootools-1.2.4-core-nc.js"></script>
<script type="text/javascript" src="http://enekoalonso.com/lib/mooml.js"></script>
<script type="text/javascript">
Mooml.register('twitter-search-result', function(entry) {
  div({id: "tweet-" + entry.id},
    img({src: entry.profile_image_url, alt: entry.from_user}),
    span(entry.from_user),
    p(entry.text)
  );
});

function searchTwitter() {
  new Element('script', {type:'text/javascript', src:'http://search.twitter.com/search.json?q={text}&show_user=true&callback=renderData'.substitute({text:$('twitter-mooml-search').get('value')})}).inject(document.head);
}
function renderData(data) {
  $('mooml-twitter-demo').empty().adopt(Mooml.render('twitter-search-result', data.results));
}
$('twitter-mooml-search-btn').addEvent('click', searchTwitter);
searchTwitter();
</script>
</p>
<p>How cool is that?</p>
<h3>The code</h3>
<p>Ok, so here is the whole code I have used in this post for this mini-demo:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type=<span class="st0">&quot;text/javascript&quot;</span> src=<span class="st0">&quot;http://enekoalonso.com/lib/mootools-1.2.4-core-nc.js&quot;</span><span class="sy0">&gt;&lt;/</span>script<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type=<span class="st0">&quot;text/javascript&quot;</span> src=<span class="st0">&quot;http://enekoalonso.com/lib/mooml.js&quot;</span><span class="sy0">&gt;&lt;/</span>script<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span>script type=<span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">Mooml.<span class="me1">register</span><span class="br0">&#40;</span><span class="st0">&#39;twitter-search-result&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>entry<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; div<span class="br0">&#40;</span><span class="br0">&#123;</span>id: <span class="st0">&quot;tweet-&quot;</span> + entry.<span class="me1">id</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; img<span class="br0">&#40;</span><span class="br0">&#123;</span>src: entry.<span class="me1">profile_image_url</span>, alt: entry.<span class="me1">from_user</span><span class="br0">&#125;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; span<span class="br0">&#40;</span>entry.<span class="me1">from_user</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; p<span class="br0">&#40;</span>entry.<span class="me1">text</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> searchTwitter<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;script&#39;</span>, <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; type:<span class="st0">&#39;text/javascript&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; src:<span class="st0">&#39;http://search.twitter.com/search.json?q={text}&amp;show_user=true&amp;callback=renderData&#39;</span>.<span class="me1">substitute</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; text:$<span class="br0">&#40;</span><span class="st0">&#39;twitter-mooml-search&#39;</span><span class="br0">&#41;</span>.<span class="me1">get</span><span class="br0">&#40;</span><span class="st0">&#39;value&#39;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">inject</span><span class="br0">&#40;</span>document.<span class="me1">head</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> renderData<span class="br0">&#40;</span>data<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; $<span class="br0">&#40;</span><span class="st0">&#39;mooml-twitter-demo&#39;</span><span class="br0">&#41;</span>.<span class="me1">empty</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">adopt</span><span class="br0">&#40;</span>Mooml.<span class="me1">render</span><span class="br0">&#40;</span><span class="st0">&#39;twitter-search-result&#39;</span>, data.<span class="me1">results</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">$<span class="br0">&#40;</span><span class="st0">&#39;twitter-mooml-search-btn&#39;</span><span class="br0">&#41;</span>.<span class="me1">addEvent</span><span class="br0">&#40;</span><span class="st0">&#39;click&#39;</span>, searchTwitter<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">searchTwitter<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>As you can see, the code is very basic and so is the Mooml template. The coolest thing here is that you don&#8217;t need to iterate over the results to render each element.</p>
<p>Have fun!</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/" title="Mooml.globalize(): Mooml template functions going global">Mooml.globalize(): Mooml template functions going global</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (0)</li><li>February 28, 2009 -- <a href="http://dev.enekoalonso.com/2009/02/28/kyte-rest-api/" title="Kyte&#8217;s REST API">Kyte&#8217;s REST API</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Fiber in San Luis Obispo? That would be awesome!</title>
		<link>http://dev.enekoalonso.com/2010/02/18/google-fiber-in-san-luis-obispo-that-would-be-awesome/</link>
		<comments>http://dev.enekoalonso.com/2010/02/18/google-fiber-in-san-luis-obispo-that-would-be-awesome/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 16:52:44 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[calpoly]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[fiber]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[san luis obispo]]></category>
		<category><![CDATA[slo]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=467</guid>
		<description><![CDATA[It looks like the nomination for San Luis Obispo to get Google Fiber is gaining a lot of support. I have no idea how other cities or communities are doing, but here at SLO seems like a lot of people is getting involved. Having Google Fiber in San Luis Obispo would be awesome.
There is a [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like the nomination for San Luis Obispo to get Google Fiber is gaining a lot of support. I have no idea how other cities or communities are doing, but here at SLO seems like a lot of people is getting involved. Having Google Fiber in San Luis Obispo would be awesome.</p>
<p>There is a group on Facebook (<a href="http://www.facebook.com/group.php?gid=303673457163">Bring Google Fiber to San Luis Obispo</a>) with more than 1300 members right now, mostly from the tech companies and <a href="http://www.calpoly.edu/">CalPoly</a>.</p>
<p><center><a href="http://www.facebook.com/group.php?gid=303673457163"><img alt="" src="http://photos-h.ak.fbcdn.net/hphotos-ak-snc3/hs147.snc3/17464_1253092960766_1032780133_566408_4228578_n.jpg" title="Bring Google Fiber to San Luis Obispo" class="alignnone" width="360" height="288" /></a></center></p>
<p>If you want to nominate San Luis Obispo, please <a href="http://www.google.com/appserve/fiberrfi/public/options">do it here</a>.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/" title="Dojo y yo">Dojo y yo</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>August 8, 2009 -- <a href="http://dev.enekoalonso.com/2009/08/08/drupal-users-cant-access-content-node_access-gone-wild/" title="Drupal: users can&#8217;t access content! (node_access gone wild)">Drupal: users can&#8217;t access content! (node_access gone wild)</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/02/18/google-fiber-in-san-luis-obispo-that-would-be-awesome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My current SVN setup</title>
		<link>http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/</link>
		<comments>http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 18:33:10 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[version]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=462</guid>
		<description><![CDATA[Once upon a time I decided it was time to start keeping track of the changes I was doing in my blogs and websites, specially my landing page at enekoalonso.com. So I started using SVN, which is available in my current hosting: Dreamhost.
Here is my current setup for blogs and websites:
enekoalonso.com
https://enekoalonso.com/prvsvn/enekoalonso.com/trunk (private)
enekoalonso.com/main
https://enekoalonso.com/prvsvn/enekoalonso.com-main/trunk (private)
enekoalonso.com/research
https://enekoalonso.com/svn/research (public)
dev.enekoalonso.com
Checked out [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time I decided it was time to start keeping track of the changes I was doing in my blogs and websites, specially my landing page at <a href="http://enekoalonso.com">enekoalonso.com</a>. So I started using SVN, which is available in my current hosting: Dreamhost.</p>
<p>Here is my current setup for blogs and websites:<br />
<a href="http://enekoalonso.com">enekoalonso.com</a><br />
https://enekoalonso.com/prvsvn/enekoalonso.com/trunk (private)</p>
<p><a href="http://enekoalonso.com/main">enekoalonso.com/main</a><br />
https://enekoalonso.com/prvsvn/enekoalonso.com-main/trunk (private)</p>
<p><a href="http://enekoalonso.com/research">enekoalonso.com/research</a><br />
https://enekoalonso.com/svn/research (public)</p>
<p><a href="http://dev.enekoalonso.com">dev.enekoalonso.com</a><br />
Checked out directly from <a href="http://svn.automattic.com/wordpress/trunk">Wordpress SVN</a> (currently running 3.0alpha)</p>
<p>I have different repositories, public and privates with https access, and I store my blogs, my sites and also other projects I work on, including iPhone applications, etc. Having SVN is a little overhead, but the benefits are great, specially if you use tags to keep track of versions, etc.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 26, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/26/loving-gitgithub/" title="Loving git+github">Loving git+github</a> (0)</li><li>December 20, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/20/wordpress-comment-api-wpnotifier/" title="Wordpress Comment API &#038; WPNotifier">Wordpress Comment API &#038; WPNotifier</a> (0)</li><li>November 29, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/29/setting-up-a-development-environment/" title="Setting up a development environment">Setting up a development environment</a> (0)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got NFS working</title>
		<link>http://dev.enekoalonso.com/2010/02/06/got-nfs-working/</link>
		<comments>http://dev.enekoalonso.com/2010/02/06/got-nfs-working/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 06:19:27 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[exports]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[fedora11]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[nfs4]]></category>
		<category><![CDATA[nfsserver]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=457</guid>
		<description><![CDATA[Well, last night I started reading about how to share the files folder of a Drupal installation on a site with multiple web servers. Seems like NFS is the right way to go (as long as your traffic doesn&#8217;t grow too much). Perfect for Spaniards.es, since I want to move from a 2 dedicated server [...]]]></description>
			<content:encoded><![CDATA[<p>Well, last night I started reading about how to share the files folder of a Drupal installation on a site with multiple web servers. Seems like NFS is the right way to go (as long as your traffic doesn&#8217;t grow too much). Perfect for Spaniards.es, since I want to move from a 2 dedicated server setup to a more flexible one where I can launch new web servers easily, almost on demand.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Install NFS</span></div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> rpcbind nfs-utils nfs-utils-lib system-config-nfs rsync</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># chkconfig nfs on</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig nfs on</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">vi <span class="sy0">/</span>etc<span class="sy0">/</span>idmapd.conf</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># [General]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Domain = spaniards.es</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># [Mapping]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Nobody-User = nfsnobody</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Nobody-Group = nfsnobody</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">service rpcidmapd restart</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&quot;/files/archivos &nbsp;/nfs4exports/archivos none bind 0 0&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>fstab</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">mount</span> <span class="sy0">/</span>nfs4exports<span class="sy0">/</span>archivos</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&quot;/nfs4exports XXX.177.133.25(rw,insecure,no_subtree_check,nohide,fsid=0) XXX.177.136.14(rw,insecure,no_subtree_check,nohide,fsid=0)&quot;</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>exports</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&quot;/nfs4exports/archivos XXX.177.133.25(rw,insecure,no_subtree_check,nohide) XXX.177.136.14(rw,insecure,no_subtree_check,nohide)&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>exports</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">su</span> -c <span class="st0">&quot;/usr/sbin/exportfs -rva&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>sbin<span class="sy0">/</span>service nfs restart</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;portmap:ALL&#39;</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.deny</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;lockd:ALL&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.deny</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;mountd:ALL&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.deny</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;rquotad:ALL&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.deny</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;statd:ALL&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.deny</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;portmap:XXX.177.133.25,XXX.177.136.14&#39;</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.allow</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;lockd:XXX.177.133.25,XXX.177.136.14&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.allow</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;mountd:XXX.177.133.25,XXX.177.136.14&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.allow</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;rquotad:XXX.177.133.25,XXX.177.136.14&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.allow</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;statd:XXX.177.133.25,XXX.177.136.14&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>hosts.allow</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;LOCKD_TCPPORT=48620&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;LOCKD_UDPPORT=48620&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;MOUNTD_PORT=48621&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;STATD_PORT=48622&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;RQUOTAD=no&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">echo</span> <span class="st0">&#39;RQUOTAD_PORT=48623&#39;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sysconfig<span class="sy0">/</span>nfs</div>
</li>
</ol>
</div>
<p>At the end, setting up NFS is not that complicated, but it was my first time, so it took a while. Actually, I had everything working before I noticed, since, logged in as root, I couldn&#8217;t figure out why I wasn&#8217;t able to write to the nfs mounted directory, being this mounted as rw. Well, turns out that you shouldn&#8217;t do this as root, since <a href="http://lists.freebsd.org/pipermail/freebsd-questions/2005-October/101886.html">root access on nfs, once enabled does not require authentication</a>.</p>
<p>I&#8217;m not sure why there is a need to mount a bind directory on the nfs server, but I think it has to do with the NFS4 directory configuration.</p>
<p>I think I got all the information I needed between these two links:<br />
<a href="http://fconfig.wordpress.com/2006/08/17/setting-up-a-fedora-nfs-server/">http://fconfig.wordpress.com/2006/08/17/setting-up-a-fedora-nfs-server/</a><br />
<a href="http://fedorasolved.org/Members/renich/howtos/f7/en/nfsv4-fedora/?searchterm=nfs">http://fedorasolved.org/Members/renich/howtos/f7/en/nfsv4-fedora/?searchterm=nfs</a></p>
<p>Next step: set up the round robin load balancer: haproxy or dns?</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/" title="CloudServers: Creating a new web server with httpd, php &#038; memcached">CloudServers: Creating a new web server with httpd, php &#038; memcached</a> (1)</li><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/" title="CloudServers: Creating a new MySQL db server">CloudServers: Creating a new MySQL db server</a> (0)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li><li>January 29, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/29/un-navarro-en-california-is-back/" title="Un Navarro en California is back!">Un Navarro en California is back!</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/02/06/got-nfs-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mooml.globalize(): Mooml template functions going global</title>
		<link>http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/</link>
		<comments>http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 15:49:35 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[global]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mooml]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[scope]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=448</guid>
		<description><![CDATA[Since version 1.0.9, Mooml includes a new feature: globalize. It maybe handy for some websites to globalize all the Mooml template functions (div, a, p, span&#8230;) to the window object scope, so they can be used anywhere in the code without the need of defining or evaluating a template.
For example, in normal Mootools code we [...]]]></description>
			<content:encoded><![CDATA[<p>Since version 1.0.9, <a href="http://github.com/eneko/mooml">Mooml</a> includes a new feature: <string>globalize</strong>. It maybe handy for some websites to globalize all the Mooml template functions (div, a, p, span&#8230;) to the window object scope, so they can be used anywhere in the code without the need of defining or evaluating a template.</p>
<p>For example, in normal Mootools code we would create a div like this:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">&nbsp;<span class="co1">// options can have attributes, css, events and more</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> mydiv = <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;div&#39;</span>, options<span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>With Mooml.globalize() we can do this:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">Mooml.<span class="me1">globalize</span><span class="br0">&#40;</span><span class="br0">&#41;</span>; <span class="co1">// Only need to call this once</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> mydiv = div<span class="br0">&#40;</span>options<span class="br0">&#41;</span>; <span class="co1">// Same options as Mootools new Element()</span></div>
</li>
</ol>
</div>
<p>Mooml globalized functions can also have nested elements, which makes very easy to create dom elements:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> mydiv = div<span class="br0">&#40;</span>options, </div>
</li>
<li class="li1">
<div class="de1">&nbsp;p<span class="br0">&#40;</span><span class="st0">&#39;First paragraph&#39;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;p<span class="br0">&#40;</span><span class="st0">&#39;Second paragraph&#39;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;div<span class="br0">&#40;</span><span class="st0">&#39;Nested div:&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; span<span class="br0">&#40;</span><span class="st0">&#39;div content&#39;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;Mooml.<span class="me1">render</span><span class="br0">&#40;</span><span class="st0">&#39;nested_template&#39;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="st0">&#39;Some &lt;b&gt;inline&lt;/b&gt; &lt;em&gt;html&lt;/em&gt; too&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Will generate the dom elements for this html:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;&lt;p&gt;First paragraph&lt;/p&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;&lt;p&gt;Second paragraph&lt;/p&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;&lt;div&gt;Nested div:
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;span&gt;div content&lt;/span&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;&lt;/div&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;&lt;!&#8211; nested template here &#8211;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;Some &lt;b&gt;inline&lt;/b&gt; &lt;em&gt;html&lt;/em&gt; too
</div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;</div>
</li>
</ol>
</div>
<p>Elements created by Mooml template functions are not automatically injected in the DOM. They are just created like when you use new Element().</p>
<p>Please be aware that using Mooml.globalize() feature will pollute the window object scope, overriding any methods with the same name and/or possibly conflicting with other Javascript libraries. As a tip, Mooml.tags can be edited before calling Mooml.globalize(), so only functions for those tags we are interested on will be created.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>April 7, 2009 -- <a href="http://dev.enekoalonso.com/2009/04/07/setting-up-timers-and-intervals-inside-js-objects/" title="Setting up timers and intervals inside JS objects">Setting up timers and intervals inside JS objects</a> (2)</li><li>January 17, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/17/mooml-mootools-markup-language-intro/" title="Mooml: Mootools markup language (intro)">Mooml: Mootools markup language (intro)</a> (1)</li><li>September 2, 2009 -- <a href="http://dev.enekoalonso.com/2009/09/02/creating-html-blocks-with-mootools/" title="Creating HTML blocks with Mootools">Creating HTML blocks with Mootools</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CloudServers: Creating a new MySQL db server</title>
		<link>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/</link>
		<comments>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 05:29:46 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[fedora12]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rackspacecoud]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=444</guid>
		<description><![CDATA[On my previous post I posted the commands I used to create a brand new Linux web server for my Drupal site. Now I&#8217;ll post the commands to create the database server. While creating the server instance at RackspaceCloud, I&#8217;ve chosen Fedora 12 for my db server, which comes with MySQL 5.1.42.



# Install MySQL


yum -y [...]]]></description>
			<content:encoded><![CDATA[<p>On my previous post I posted the commands I used to create a brand <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/">new Linux web server for my Drupal site</a>. Now I&#8217;ll post the commands to create the database server. While creating the server instance at RackspaceCloud, I&#8217;ve chosen Fedora 12 for my db server, which comes with MySQL 5.1.42.</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Install MySQL</span></div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> mysql mysql-server rsync</div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig &#8211;levels <span class="nu0">235</span> mysqld on</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Start DB</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>mysqld start</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Grant permissions to db_user (1.2.3.4 is the web server IP address)</span></div>
</li>
<li class="li1">
<div class="de1">mysql -e <span class="st0">&quot;grant all privileges on db_name.* to db_user@&#39;1.2.3.4&#39; identified by &#39;password&#39;;&quot;</span></div>
</li>
<li class="li1">
<div class="de1">mysql -e <span class="st0">&quot;flush privileges;&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#############################################################</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># FIREWALL</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Open DB port 3306</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Allow connections only from web server</span></div>
</li>
<li class="li1">
<div class="de1">iptables -F</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -p tcp &#8211;dport <span class="nu0">22</span> -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -P INPUT DROP</div>
</li>
<li class="li1">
<div class="de1">iptables -P FORWARD DROP</div>
</li>
<li class="li1">
<div class="de1">iptables -P OUTPUT ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -i lo -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -s <span class="nu0">1.2</span><span class="nu0">.3</span><span class="nu0">.4</span> -p tcp &#8211;dport <span class="nu0">3306</span> -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -L -v</div>
</li>
<li class="li1">
<div class="de1">service iptables save</div>
</li>
</ol>
</div>
<p>As easy as that, having a MySQL server up and running is piece of cake :) </p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/" title="CloudServers: Creating a new web server with httpd, php &#038; memcached">CloudServers: Creating a new web server with httpd, php &#038; memcached</a> (1)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li><li>February 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/06/got-nfs-working/" title="Got NFS working">Got NFS working</a> (0)</li><li>January 3, 2009 -- <a href="http://dev.enekoalonso.com/2009/01/03/check-your-server-status-with-email-notification/" title="Check your server status with email notification">Check your server status with email notification</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CloudServers: Creating a new web server with httpd, php &amp; memcached</title>
		<link>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/</link>
		<comments>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 17:16:47 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[fedora12]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rackspacecloud]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=442</guid>
		<description><![CDATA[Creating a new web server is piece of cake at Rackspace Cloud. Here is a demo video of how to set up a new instance with your favorite Linux distribution. I have used Fedora 12 for my new spaniards.es servers, and here is the script I&#8217;ve used to install everything needed so far:



# Install HTTPD


yum [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a new web server is piece of cake at Rackspace Cloud. Here is a demo video of <a href="http://www.rackspacecloud.com/cloud_hosting_demos/cloud_computing_cloud_servers">how to set up a new instance with your favorite Linux distribution</a>. I have used Fedora 12 for my new spaniards.es servers, and here is the script I&#8217;ve used to install everything needed so far:</p>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1"><span class="co0"># Install HTTPD</span></div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> httpd rsync</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Install PHP</span></div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> php php-mbstring php-mysql mysql</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#############################################################</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># FIREWALL</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Open http port 80 (and ssh)</span></div>
</li>
<li class="li1">
<div class="de1">iptables -F</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -p tcp &#8211;dport <span class="nu0">22</span> -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -P INPUT DROP</div>
</li>
<li class="li1">
<div class="de1">iptables -P FORWARD DROP</div>
</li>
<li class="li1">
<div class="de1">iptables -P OUTPUT ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -i lo -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -A INPUT -p tcp &#8211;dport <span class="nu0">80</span> -j ACCEPT</div>
</li>
<li class="li1">
<div class="de1">iptables -L -v</div>
</li>
<li class="li1">
<div class="de1">service iptables save</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Start HTTPD server</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>httpd start</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Install &nbsp;memcached</span></div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> memcached</div>
</li>
<li class="li1">
<div class="de1">memcached -d -u apache</div>
</li>
<li class="li1">
<div class="de1">yum -y <span class="kw2">install</span> php-pecl-memcache</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># Restart HTTPD server</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>httpd restart</div>
</li>
</ol>
</div>
<p>DNS configuration can be done through the admin pages, so there is no need for manual configuration. Copying the data from your old server can be done with rsync and having mysql installed is handy to test db connections from the console.</p>
<p>In less than 10 minutes you can have a new web server up and running :)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/" title="CloudServers: Creating a new MySQL db server">CloudServers: Creating a new MySQL db server</a> (0)</li><li>January 30, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/" title="Got new servers on Rackspace Cloud">Got new servers on Rackspace Cloud</a> (5)</li><li>February 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/06/got-nfs-working/" title="Got NFS working">Got NFS working</a> (0)</li><li>December 5, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/05/enabling-php5-on-mac-os-x-leopard/" title="Enabling PHP5 on Mac OS X Leopard">Enabling PHP5 on Mac OS X Leopard</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Got new servers on Rackspace Cloud</title>
		<link>http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/</link>
		<comments>http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 01:06:09 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[ace-host]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[spaniards]]></category>
		<category><![CDATA[webserver]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=433</guid>
		<description><![CDATA[Last night I got an account at Rackspace Cloud and created three brand new CentOS Linux servers. Now I have to set them up: two web servers and one database server. My goal: Move Spaniards.es website to this new hosting.
Why move?
Currently I am hosting Spaniards.es on two dedicated servers at Ace-Host.net. So far, so good, [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I got an account at <a href="http://www.rackspacecloud.com/cloud_hosting_products/servers">Rackspace Cloud</a> and created three brand new CentOS Linux servers. Now I have to set them up: two web servers and one database server. My goal: Move Spaniards.es website to this new hosting.</p>
<h3>Why move?</h3>
<p>Currently I am hosting <a href="http://spaniards.es/">Spaniards.es</a> on two dedicated servers at <a href="http://ace-host.net/">Ace-Host.net</a>. So far, so good, but the site has started to get slow (more the web server than the db server, which is running great so far). Some days I found the site running at 30 times the processor capacity (according to &#8216;top&#8217;), which is a lot. The biggest problem I have right now is the caching on the web server. I have installed both XCache and Memcached, but can get them to work since that server was my first ever dedicated server an has a CPanel installation that drives me nuts.</p>
<p>Sooner or later I had to move that webserver into a new clean installation, but I have decided that if I have to move, I&#8217;ll do it to a cloud. No more dependencies on a physical hardware, no more worries.</p>
<h3>Why not EC2</h3>
<p>Well, I&#8217;ve ried <a href="http://aws.amazon.com/ec2/">EC2</a> and it is not that I don&#8217;t like it. It is just that it is so much work. After seeing how <a href="http://www.rackspacecloud.com/cloud_hosting_products/servers">CloudServers</a> work on RackSpace, I have no doubt.</p>
<h3>When is Spaniards.es going to be moved?</h3>
<p>There is no date yet. First I have to set up the servers, make sure everything works fine, set up the domains, dns, mail, etc. Hopefully in a couple of weeks, if I can find enough time to do so.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-web-server-with-httpd-php-memcached/" title="CloudServers: Creating a new web server with httpd, php &#038; memcached">CloudServers: Creating a new web server with httpd, php &#038; memcached</a> (1)</li><li>January 31, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/31/cloudservers-creating-a-new-mysql-db-server/" title="CloudServers: Creating a new MySQL db server">CloudServers: Creating a new MySQL db server</a> (0)</li><li>February 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/06/got-nfs-working/" title="Got NFS working">Got NFS working</a> (0)</li><li>February 7, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/" title="My current SVN setup">My current SVN setup</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/30/got-new-servers-on-rackspace-cloud/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Un Navarro en California is back!</title>
		<link>http://dev.enekoalonso.com/2010/01/29/un-navarro-en-california-is-back/</link>
		<comments>http://dev.enekoalonso.com/2010/01/29/un-navarro-en-california-is-back/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 23:53:11 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=429</guid>
		<description><![CDATA[Yeah baby, I&#8217;m back. I have restored the Drupal installation I had for my personal blog, kinda missed it a lot. Hopefully all the old links will still work.
Visit: Un Navarro en California
Related Posts:February 7, 2010 -- My current SVN setup (0)February 6, 2010 -- Got NFS working (0)August 8, 2009 -- Drupal: users can&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah baby, I&#8217;m back. I have restored the Drupal installation I had for my personal blog, kinda missed it a lot. Hopefully all the old links will still work.<br />
Visit: <a href="http://enekoalonso.com/main">Un Navarro en California</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 7, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/" title="My current SVN setup">My current SVN setup</a> (0)</li><li>February 6, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/06/got-nfs-working/" title="Got NFS working">Got NFS working</a> (0)</li><li>August 8, 2009 -- <a href="http://dev.enekoalonso.com/2009/08/08/drupal-users-cant-access-content-node_access-gone-wild/" title="Drupal: users can&#8217;t access content! (node_access gone wild)">Drupal: users can&#8217;t access content! (node_access gone wild)</a> (0)</li><li>February 24, 2009 -- <a href="http://dev.enekoalonso.com/2009/02/24/upgrading-spaniards-to-drupal-6/" title="Upgrading Spaniards.es to Drupal 6">Upgrading Spaniards.es to Drupal 6</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/29/un-navarro-en-california-is-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>4 years of excanvas</title>
		<link>http://dev.enekoalonso.com/2010/01/29/4-years-of-excanvas/</link>
		<comments>http://dev.enekoalonso.com/2010/01/29/4-years-of-excanvas/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 16:01:30 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[excanvas]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=427</guid>
		<description><![CDATA[I wanted to say 5 years but it was actually in December 2005 when Emil A Eklund wrote on his blog about an idea he had to implement the canvas tag functionality in Internet Explorer using VML and behaviors. Today we now that code as excanvas.
Well, it&#8217;s been 4 years and 1 month and still [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to say 5 years but it was actually in December 2005 when <a href="http://me.eae.net/archive/2005/12/29/canvas-in-ie/">Emil A Eklund wrote on his blog</a> about an idea he had to implement the canvas tag functionality in Internet Explorer using VML and behaviors. Today we now that code as <a href="http://code.google.com/p/explorercanvas">excanvas</a>.</p>
<p>Well, it&#8217;s been 4 years and 1 month and still Internet Explorer does not support the canvas tag. Is it possible that Internet Explorer 9 would support canvas? What about SVG?</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/29/4-years-of-excanvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dojo y yo</title>
		<link>http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/</link>
		<comments>http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 05:48:02 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[closure]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[goog]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[require]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=423</guid>
		<description><![CDATA[Back in November 2008 I had a chance to work with Dojo on a project for Cisco WebEx. I didn&#8217;t like it at all. I was used to the simplicity of jQuery and Mootools and I couldn&#8217;t understand how Dojo had been designed so complicated. Well, one year later I just realized that it is [...]]]></description>
			<content:encoded><![CDATA[<p>Back in November 2008 I had a chance to work with <a href="http://dojotoolkit.org/">Dojo</a> on a project for <a href="http://www.webex.com/iphone/">Cisco WebEx</a>. I didn&#8217;t like it at all. I was used to the simplicity of jQuery and Mootools and I couldn&#8217;t understand how Dojo had been designed so complicated. Well, one year later I just realized that it is not that Dojo was that complicated. It is that I wasn&#8217;t ready for it. Now it is time to give it another chance.</p>
<h3>Some cool stuff about Dojo</h3>
<p>Reading Dojo&#8217;s documentation I have finally understood something that I was wondering how it works. It&#8217;s nothing really complicated, but it&#8217;s actually very cool: <a href="http://api.dojotoolkit.org/jsdoc/HEAD/dojo.require">dojo.require</a></p>
<p>Javascript requests to the server are asynchronous (not sure if synchronous request can be done). So we depend on callback functions to continue the flow of your program. That means that when we put <code lang="javascript">dojo.require('somefancyjs');</code> on a line, the execution does not stop and it continues to the next line of code while the browser downloads that file from the server in the background.</p>
<p>Looks like Dojo puts those requests on some kind of array, array that is checked when you use <code>dojo.addOnLoad()</code> which does not execute your callback function until all elements of the array have been downloaded. That is very cool because that means you can do as many dojo.require&#8217;s as you need. The down side is that you need to put your code inside a callback function, which is not very bad when working with objects.</p>
<p>Next, I have to find out how goog.require works ;)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/things-to-do/" title="Things to do">Things to do</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (0)</li><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 18, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/18/google-fiber-in-san-luis-obispo-that-would-be-awesome/" title="Google Fiber in San Luis Obispo? That would be awesome!">Google Fiber in San Luis Obispo? That would be awesome!</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things to do</title>
		<link>http://dev.enekoalonso.com/2010/01/28/things-to-do/</link>
		<comments>http://dev.enekoalonso.com/2010/01/28/things-to-do/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 04:15:44 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[appcelerator]]></category>
		<category><![CDATA[closure]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[yql]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=418</guid>
		<description><![CDATA[To do list:

Try Appcelerator (downloaded.. don&#8217;t like it very much, have to spend more time with it)
Install iPhone SDK 3.2 (downloading installing&#8230;)
Study LinkedIn API
Study Twitter API
Take a look at YQL
Play with Google Closure JS library
Play with Dojo JS library

That&#8217;s it for now. Let&#8217;s see if I can find time to do all those.
Updated

Related Posts:January 28, [...]]]></description>
			<content:encoded><![CDATA[<p>To do list:</p>
<ul>
<li><del datetime="2010-01-31T00:52:29+00:00">Try <a href="http://www.appcelerator.com/">Appcelerator</a></del> (downloaded.. don&#8217;t like it very much, have to spend more time with it)</li>
<li><del datetime="2010-01-31T01:29:38+00:00">Install <a href="http://developer.apple.com/iphone">iPhone SDK 3.2</a> (<del datetime="2010-01-31T00:52:29+00:00">downloading</del> installing&#8230;)</del></li>
<li>Study <a href="http://developer.linkedin.com/community/apis">LinkedIn API</a></li>
<li>Study <a href="http://apiwiki.twitter.com/">Twitter API</a></li>
<li>Take a look at <a href="http://developer.yahoo.com/yql/">YQL</a></li>
<li>Play with <a href="http://code.google.com/closure/library">Google Closure</a> JS library</li>
<li>Play with <a href="http://dojotoolkit.org/">Dojo</a> JS library</li>
</ul>
<p>That&#8217;s it for now. Let&#8217;s see if I can find time to do all those.</p>
<h4>Updated</h4>
<p><a href="http://dev.enekoalonso.com/wp-content/uploads/2010/01/Screen-shot-2010-01-30-at-5.37.52-PM.png"><img src="http://dev.enekoalonso.com/wp-content/uploads/2010/01/Screen-shot-2010-01-30-at-5.37.52-PM-396x300.png" alt="" title="XCode with SDK 3.2 for iPad" width="396" height="300" class="aligncenter size-medium wp-image-439" /></a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/" title="Dojo y yo">Dojo y yo</a> (0)</li><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (0)</li><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 18, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/18/google-fiber-in-san-luis-obispo-that-would-be-awesome/" title="Google Fiber in San Luis Obispo? That would be awesome!">Google Fiber in San Luis Obispo? That would be awesome!</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/28/things-to-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting when CSS gets loaded by the browser with Mootools and Asset.css</title>
		<link>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/</link>
		<comments>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 19:20:22 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[asset]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=416</guid>
		<description><![CDATA[Asset.css claims to have an onload event in Mootools documentation, but sadly, not all browsers support this feature. Even worse, browsers like Chrome seem to support the event, but never fire it.
After some research and testing at work, we have come up with a solution that overrides Asset.css to detect when CSS gets loaded by [...]]]></description>
			<content:encoded><![CDATA[<p>Asset.css claims to have an <strong>onload</strong> event in <a href="http://mootools.net/docs/more/Utilities/Assets#Asset:css">Mootools documentation</a>, but sadly, not all browsers support this feature. Even worse, browsers like Chrome seem to support the event, but never fire it.</p>
<p>After some research and testing at work, we have come up with a solution that overrides Asset.css to detect when CSS gets loaded by the browser using the onload event in those browsers that support it (Internet Explorer and Opera) and doing polling in those that do not (Chrome, Safari and Firefox). Here is the code:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="co1">// Add callback support to Asset.css for all browsers</span></div>
</li>
<li class="li1">
<div class="de1">Asset.<span class="me1">css</span> = <span class="kw2">function</span><span class="br0">&#40;</span>source, <span class="kw3">onLoad</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">var</span> link = <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;link&#39;</span>, <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; rel: <span class="st0">&#39;stylesheet&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; media: <span class="st0">&#39;screen&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; type: <span class="st0">&#39;text/css&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; href: source</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="br0">&#40;</span><span class="st0">&quot;onload&quot;</span> <span class="kw1">in</span> link<span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="sy0">!</span>Browser.<span class="me1">Engines</span>.<span class="me1">webkit</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">onLoad</span><span class="br0">&#41;</span> link.<span class="kw3">onload</span> = <span class="kw3">onLoad</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">try</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; link.<span class="me1">sheet</span>.<span class="me1">cssRules</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">catch</span> <span class="br0">&#40;</span>e<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setTimeout<span class="br0">&#40;</span>arguments.<span class="me1">callee</span>, <span class="nu0">100</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">onLoad</span><span class="br0">&#41;</span> <span class="kw3">onLoad</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; link.<span class="me1">inject</span><span class="br0">&#40;</span>document.<span class="me1">head</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">return</span> link;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Load some CSS and show an alert when done</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> mycss = <span class="kw2">new</span> Asset.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">&#39;http://example.com/style.css&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&#39;CSS loaded!&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// Unload the css</span></div>
</li>
<li class="li1">
<div class="de1">mycss.<span class="me1">destroy</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Enjoy!</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>June 30, 2009 -- <a href="http://dev.enekoalonso.com/2009/06/30/iphone-3-0-geolocation-with-javascript/" title="iPhone 3.0 geolocation with Javascript">iPhone 3.0 geolocation with Javascript</a> (0)</li><li>March 1, 2009 -- <a href="http://dev.enekoalonso.com/2009/03/01/safari-4-rocks/" title="Safari 4 rocks">Safari 4 rocks</a> (1)</li><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/" title="Mooml.globalize(): Mooml template functions going global">Mooml.globalize(): Mooml template functions going global</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loving git+github</title>
		<link>http://dev.enekoalonso.com/2010/01/26/loving-gitgithub/</link>
		<comments>http://dev.enekoalonso.com/2010/01/26/loving-gitgithub/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:49:50 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=414</guid>
		<description><![CDATA[Up until now I always used subversion and, although haven&#8217;t used it much, I liked Google Code repositories a lot. Well, in the last few days I&#8217;ve been working with git and github and I have to say that both of them are very cool.
Related Posts:February 7, 2010 -- My current SVN setup (0)November 29, [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now I always used subversion and, although haven&#8217;t used it much, I liked Google Code repositories a lot. Well, in the last few days I&#8217;ve been working with git and github and I have to say that both of them are very cool.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 7, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/07/my-current-svn-setup/" title="My current SVN setup">My current SVN setup</a> (0)</li><li>November 29, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/29/setting-up-a-development-environment/" title="Setting up a development environment">Setting up a development environment</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/26/loving-gitgithub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging cookies with Firebug 1.5/1.6</title>
		<link>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/</link>
		<comments>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 04:43:09 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[breakpoint]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firecookie]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=412</guid>
		<description><![CDATA[I&#8217;ve been using Firebug 1.5 since it was an alpha and now I&#8217;m using Firebug 1.6 alpha with Firefox 3.6. I&#8217;ve been also using Firecookie for a very long time now, but never realized about this: you can put breakpoints on cookies to detect changes!
Good to know :)
Related Posts:January 19, 2010 -- Firefox 3.6RC2 &#038; [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Firebug 1.5 since it was an alpha and now I&#8217;m using <a href="http://getfirebug.com/releases/firebug/1.6X/">Firebug 1.6</a> alpha with Firefox 3.6. I&#8217;ve been also using <a href="https://addons.mozilla.org/en-US/firefox/addon/6683">Firecookie</a> for a very long time now, but never realized about this: <a href="http://www.softwareishard.com/blog/firebug/new-firebug-15-debugging-cookies/">you can put breakpoints on cookies to detect changes!</a></p>
<p>Good to know :)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/" title="Firefox 3.6RC2 &#038; Firebug 1.6a">Firefox 3.6RC2 &#038; Firebug 1.6a</a> (0)</li><li>November 30, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/" title="Injecting javascript with Firebug">Injecting javascript with Firebug</a> (0)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li><li>December 2, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/02/highlighting-elements-with-firebug-console/" title="Highlighting elements with Firebug console">Highlighting elements with Firebug console</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 3.6RC2 &amp; Firebug 1.6a</title>
		<link>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/</link>
		<comments>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 15:52:50 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=410</guid>
		<description><![CDATA[I love Firefox for web development. I have tried other browsers but nothing compares to the power of Firebug. For everything else I used to use Safari 4, but now I switched to Chrome. It is sooo fast.
Either way, don&#8217;t miss Firefox 3.6RC2 with Firebug 1.6a!
http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/
http://getfirebug.com/releases/firebug/1.6X/
Related Posts:January 20, 2010 -- Debugging cookies with Firebug 1.5/1.6 [...]]]></description>
			<content:encoded><![CDATA[<p>I love Firefox for web development. I have tried other browsers but nothing compares to the power of Firebug. For everything else I used to use Safari 4, but now I switched to Chrome. It is sooo fast.</p>
<p>Either way, don&#8217;t miss Firefox 3.6RC2 with Firebug 1.6a!<br />
<a href="http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/">http://www.mozilla.com/en-US/firefox/3.6rc2/releasenotes/</a><br />
<a href="http://getfirebug.com/releases/firebug/1.6X/">http://getfirebug.com/releases/firebug/1.6X/</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>January 20, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/20/debugging-cookies-with-firebug-1-51-6/" title="Debugging cookies with Firebug 1.5/1.6">Debugging cookies with Firebug 1.5/1.6</a> (0)</li><li>November 30, 2008 -- <a href="http://dev.enekoalonso.com/2008/11/30/injecting-javascript-with-firebug/" title="Injecting javascript with Firebug">Injecting javascript with Firebug</a> (0)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li><li>December 2, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/02/highlighting-elements-with-firebug-console/" title="Highlighting elements with Firebug console">Highlighting elements with Firebug console</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/19/firefox-3-6rc2-firebug-1-6a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally: Singletons, the Mootools way</title>
		<link>http://dev.enekoalonso.com/2010/01/18/finally-singletons-the-mootools-way/</link>
		<comments>http://dev.enekoalonso.com/2010/01/18/finally-singletons-the-mootools-way/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 17:26:38 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[instance]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[singleton]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=404</guid>
		<description><![CDATA[I have been using for a while the &#8220;new new Class&#8221; syntax to create singletons on the projects I am working on. This is for many reasons, but specially because I didn&#8217;t like other solutions like Class.Mutators, Class.Oclude or extending a plain object with $extend().
Now, after discussing a little bit on the Mootools email list [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using for a while the &#8220;new new Class&#8221; syntax to create singletons on the projects I am working on. This is for many reasons, but specially because I didn&#8217;t like other solutions like <a href="http://www.nwhite.net/?p=169">Class.Mutators</a>, <a href="http://www.clientcide.com/best-practices/using-classocclude-to-create-singletons/">Class.Oclude</a> or <a href="http://keetology.com/blog/2009/07/23/up-the-moo-herd-iii-its-classy-not-classic#singleton">extending a plain object with $extend()</a>.</p>
<p>Now, after discussing a little bit on the Mootools email list about what was the best way to create singletons, I have created <a href="http://github.com/eneko/Class.Singleton">Class.Singleton</a> so we can create singletons the Mootools way. Here is how it works:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> MySingleton = <span class="kw2">new</span> <span class="kw2">Class</span>.<span class="me1">Singleton</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; initialize: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// code here</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; method1: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// code here</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; method2: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// code here</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<h3>Using inheritance, mixins, etc</h3>
<p>Class.Singleton works like defining any other Mootools class using Class(), so we can have inheritance, mixins, etc.</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> BaseClass = <span class="kw2">new</span> <span class="kw2">Class</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; initialize: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Initialization code here</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&#39;BaseClass initialized.&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; method1: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// some code</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> MySingleton = <span class="kw2">new</span> <span class="kw2">Class</span>.<span class="me1">Singleton</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">Extends</span>: BaseClass,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; initialize: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; console.<span class="me1">log</span><span class="br0">&#40;</span><span class="st0">&#39;MySingleton singleton initialized.&#39;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; method1: <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">this</span>.<span class="me1">parent</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// more code</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Hope you like it!</p>
<p>Repository url: <a href="http://github.com/eneko/Class.Singleton">http://github.com/eneko/Class.Singleton</a></p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>April 23, 2009 -- <a href="http://dev.enekoalonso.com/2009/04/23/sending-messages-between-javascript-objects/" title="Sending messages between Javascript objects">Sending messages between Javascript objects</a> (2)</li><li>April 7, 2009 -- <a href="http://dev.enekoalonso.com/2009/04/07/setting-up-timers-and-intervals-inside-js-objects/" title="Setting up timers and intervals inside JS objects">Setting up timers and intervals inside JS objects</a> (2)</li><li>July 20, 2009 -- <a href="http://dev.enekoalonso.com/2009/07/20/setters-getters-on-mootools-classes/" title="Setters &#038; Getters on Mootools classes">Setters &#038; Getters on Mootools classes</a> (0)</li><li>December 14, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/14/threads-in-javascript/" title="Threads in Javascript">Threads in Javascript</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/18/finally-singletons-the-mootools-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mooml: Mootools markup language (intro)</title>
		<link>http://dev.enekoalonso.com/2010/01/17/mooml-mootools-markup-language-intro/</link>
		<comments>http://dev.enekoalonso.com/2010/01/17/mooml-mootools-markup-language-intro/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 05:38:56 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[mooml]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[template.dom]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=392</guid>
		<description><![CDATA[It was a month ago when I found about Jaml, an excellent small Javascript library created by Ed Spencer which allows generating HTML code using very nice and clean templates. At work we use Mootools in most of our projects, so I thought it would be nice to improve Jaml by taking advantage of the [...]]]></description>
			<content:encoded><![CDATA[<p>It was a month ago when I found about <a href="http://edspencer.net/2009/11/jaml-beautiful-html-generation-for-javascript.html">Jaml</a>, an excellent small Javascript library created by Ed Spencer which allows generating HTML code using very nice and clean templates. At work we use Mootools in most of our projects, so I thought it would be nice to improve Jaml by taking advantage of the power of Mootools. And this is the result.</p>
<h3>Mooml: Mootools markup language</h3>
<p>What is Mooml? <a href="http://github.com/eneko/mooml">Mooml</a> is a templating system that allows generating HTML snippets very easily, without all the ugly nested &#8220;new Element&#8221; calls or string concatenation. With Mooml you can save templates for later use or evaluate snippets on the fly.</p>
<p>Download: <a href="http://mootools.net/forge/p/mooml">http://mootools.net/forge/p/mooml</a><br/>Source: <a href="http://github.com/eneko/mooml">http://github.com/eneko/mooml</a></p>
<h3>Let&#8217;s see an example</h3>
<p>Required HTML:</p>
<div class="geshi no html">
<ol>
<li class="li1">
<div class="de1">&lt;div class=&quot;node&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;h2&gt;Node Title&lt;/h2&gt;
</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &lt;p&gt;Node body here.&lt;/p&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/div&gt;</div>
</li>
</ol>
</div>
<p>Node title and body are variables, so let&#8217;s save them on a Json format for now.</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> data = <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; title: <span class="st0">&#39;Node Title&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; body: <span class="st0">&#39;Node body here&#39;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Using Mootools &#8220;new Element&#8221; we would have to code something like this:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> el = <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;div&#39;</span>, <span class="br0">&#123;</span><span class="st0">&#39;class&#39;</span>: <span class="st0">&#39;node&#39;</span><span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">adopt</span><span class="br0">&#40;</span><span class="br0">&#91;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;h2&#39;</span>, <span class="br0">&#123;</span>text: data.<span class="me1">title</span><span class="br0">&#125;</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw2">new</span> Element<span class="br0">&#40;</span><span class="st0">&#39;p&#39;</span>, <span class="br0">&#123;</span>text: data.<span class="me1">body</span><span class="br0">&#125;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#93;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>That code is much better than plain Javascript, but still messy. We could use the new Elements.from included in Mootools More 1.2.4, but that would require us writing the html as a string, which rapidly gets messy concatenating variables, etc.</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">var</span> el = Elements.<span class="me1">from</span><span class="br0">&#40;</span><span class="st0">&#39;&lt;div class=&quot;node&quot;&gt;&lt;h2&gt;&#39;</span> + data.<span class="me1">title</span> + <span class="st0">&#39;&lt;/h2&gt;&lt;p&gt;&#39;</span> + data.<span class="me1">body</span> + <span class="st0">&#39;&lt;/p&gt;&lt;/div&gt;&#39;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<h3>With Mooml&#8230;</h3>
<p>With Mooml, we can create a template for that piece of code, and reuse it later as many times as we need:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">Mooml.<span class="me1">register</span><span class="br0">&#40;</span><span class="st0">&#39;node&#39;</span>, <span class="kw2">function</span><span class="br0">&#40;</span>data<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; div<span class="br0">&#40;</span><span class="br0">&#123;</span><span class="st0">&#39;class&#39;</span>: <span class="st0">&#39;node&#39;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; h2<span class="br0">&#40;</span>data.<span class="me1">title</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; p<span class="br0">&#40;</span>data.<span class="me1">body</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">document.<span class="me1">body</span>.<span class="me1">grab</span><span class="br0">&#40;</span>Mooml.<span class="me1">render</span><span class="br0">&#40;</span><span class="st0">&#39;node&#39;</span>, data<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>We can also execute the template directly as a function:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">document.<span class="me1">body</span>.<span class="me1">grab</span><span class="br0">&#40;</span>Mooml.<span class="me1">templates</span>.<span class="me1">node</span><span class="br0">&#40;</span>data<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>Finally, with Mooml we can evaluate templates on the fly, without having to store them for later:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">document.<span class="me1">body</span>.<span class="me1">grab</span><span class="br0">&#40;</span>Mooml.<span class="me1">evaluate</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span>data<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; div<span class="br0">&#40;</span><span class="br0">&#123;</span><span class="st0">&#39;class&#39;</span>: <span class="st0">&#39;node&#39;</span><span class="br0">&#125;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; h2<span class="br0">&#40;</span>data.<span class="me1">title</span><span class="br0">&#41;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; p<span class="br0">&#40;</span>data.<span class="me1">body</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span>, data<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
<p>More examples soon :)</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/" title="Mooml.globalize(): Mooml template functions going global">Mooml.globalize(): Mooml template functions going global</a> (0)</li><li>December 9, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/09/dojo-sucks-mootools-rocks/" title="Dojo sucks, Mootools rocks">Dojo sucks, Mootools rocks</a> (1)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/17/mooml-mootools-markup-language-intro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I never use $$ on my projects (and barely use $)</title>
		<link>http://dev.enekoalonso.com/2010/01/15/i-never-use-on-my-projects-and-barely-use/</link>
		<comments>http://dev.enekoalonso.com/2010/01/15/i-never-use-on-my-projects-and-barely-use/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 04:53:28 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[getElementById]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=400</guid>
		<description><![CDATA[On all the projects I&#8217;ve worked on, I always try to follow the MVC arquitectural pattern, separating the model from the view *and* creating a controller. It may be a simple controller in charge of a tab-set, or an accordion. Or it may be a full size controller in charge of the whole page structure, [...]]]></description>
			<content:encoded><![CDATA[<p>On all the projects I&#8217;ve worked on, I always try to follow the <a href="http://en.wikipedia.org/wiki/Model–view–controller">MVC arquitectural pattern</a>, separating the model from the view <b>*and*</b> creating a controller. It may be a simple controller in charge of a tab-set, or an accordion. Or it may be a full size controller in charge of the whole page structure, on sites that make an extensive use of javascript.</p>
<p>Either way, I always have a controller for a dynamic section of the page and the controller always works with the container of that section. If I need to reference any element inside the container I will use this.container.getElementById() or this.container.getElements(), which will do a search only on the child elements of the container and not on the whole dom tree of the page.</p>
<p>Yes, it is very usual to see nowadays code that alters the links of a page <img src="http://l.wordpress.com/latex.php?latex=%28%27a%27%29%2C%20images%20or%20whatever.%20Every%20time%20we%20use%20%24%20or%20&#038;bg=0D324F&#038;fg=FFFFFF&#038;s=1" title="('a'), images or whatever. Every time we use $ or " style="vertical-align:-20%;" class="tex" alt="('a'), images or whatever. Every time we use $ or " /> we are searching the whole page. And coding like that is just a waste of resources.</p>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>December 18, 2008 -- <a href="http://dev.enekoalonso.com/2008/12/18/gravity-in-the-dom/" title="Gravity in the DOM ">Gravity in the DOM </a> (0)</li><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/" title="Mooml.globalize(): Mooml template functions going global">Mooml.globalize(): Mooml template functions going global</a> (0)</li><li>January 27, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/27/detecting-when-css-gets-loaded-by-the-browser-with-mootools-and-asset-css/" title="Detecting when CSS gets loaded by the browser with Mootools and Asset.css">Detecting when CSS gets loaded by the browser with Mootools and Asset.css</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2010/01/15/i-never-use-on-my-projects-and-barely-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy New Year 2010</title>
		<link>http://dev.enekoalonso.com/2009/12/31/happy-new-year-2010/</link>
		<comments>http://dev.enekoalonso.com/2009/12/31/happy-new-year-2010/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 02:19:52 +0000</pubDate>
		<dc:creator>Eneko Alonso</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[happy]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[new]]></category>
		<category><![CDATA[year]]></category>

		<guid isPermaLink="false">http://dev.enekoalonso.com/?p=386</guid>
		<description><![CDATA[


&#40;function&#40;&#41;&#123;


t=&#91;72,97,112,112,121,32,78,101,119,32,89,101,97,114,32,50,48,49,48&#93;;


alert&#40;String.fromCharCode.apply&#40;null, t&#41;&#41;;


&#125;&#41;&#40;&#41;​



Related Posts:February 19, 2010 -- Having fun with Mooml &#038; Twitter (0)February 1, 2010 -- Mooml.globalize(): Mooml template functions going global (0)January 28, 2010 -- Dojo y yo (0)September 2, 2009 -- Creating HTML blocks with Mootools (3)]]></description>
			<content:encoded><![CDATA[<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">t=<span class="br0">&#91;</span><span class="nu0">72</span>,<span class="nu0">97</span>,<span class="nu0">112</span>,<span class="nu0">112</span>,<span class="nu0">121</span>,<span class="nu0">32</span>,<span class="nu0">78</span>,<span class="nu0">101</span>,<span class="nu0">119</span>,<span class="nu0">32</span>,<span class="nu0">89</span>,<span class="nu0">101</span>,<span class="nu0">97</span>,<span class="nu0">114</span>,<span class="nu0">32</span>,<span class="nu0">50</span>,<span class="nu0">48</span>,<span class="nu0">49</span>,<span class="nu0">48</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">alert</span><span class="br0">&#40;</span>String.<span class="me1">fromCharCode</span>.<span class="me1">apply</span><span class="br0">&#40;</span><span class="kw2">null</span>, t<span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="br0">&#40;</span><span class="br0">&#41;</span>​</div>
</li>
</ol>
</div>
<h3  class="related_post_title">Related Posts:</h3><ul class="related_post"><li>February 19, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/19/having-fun-with-mooml-and-twitter/" title="Having fun with Mooml &#038; Twitter">Having fun with Mooml &#038; Twitter</a> (0)</li><li>February 1, 2010 -- <a href="http://dev.enekoalonso.com/2010/02/01/mooml-globalize-mooml-template-functions-going-global/" title="Mooml.globalize(): Mooml template functions going global">Mooml.globalize(): Mooml template functions going global</a> (0)</li><li>January 28, 2010 -- <a href="http://dev.enekoalonso.com/2010/01/28/dojo-y-yo/" title="Dojo y yo">Dojo y yo</a> (0)</li><li>September 2, 2009 -- <a href="http://dev.enekoalonso.com/2009/09/02/creating-html-blocks-with-mootools/" title="Creating HTML blocks with Mootools">Creating HTML blocks with Mootools</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://dev.enekoalonso.com/2009/12/31/happy-new-year-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
