<?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>felipeNascimento.org(true); &#187; Learned Stuff / Tips</title>
	<atom:link href="http://felipenascimento.org/en/category/learned-stuff/feed/" rel="self" type="application/rss+xml" />
	<link>http://felipenascimento.org</link>
	<description>Making the web a better place to live</description>
	<lastBuildDate>Tue, 31 Aug 2010 14:31:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHPSCConf</title>
		<link>http://felipenascimento.org/en/phpscconf/</link>
		<comments>http://felipenascimento.org/en/phpscconf/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 14:20:40 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[theWebMind]]></category>
		<category><![CDATA[Mind2.0]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=293</guid>
		<description><![CDATA[O evento, ocorrido em Joinvile (http://phpsc.com.br/), nos dias 27 e 28 deste mês foi ótimo. Os organizadores mostram cada ano mais maturidade, as palestras conseguiram ser tanto focadas na parte mais técnica quanto focadas no mercado, metodologias, etc. A platéia também parecia bem interessada, apesar de terem ficado bastante distribuídos entre demais cursos que aconteciam [...]]]></description>
			<content:encoded><![CDATA[<p>O evento, ocorrido em Joinvile (<a href='http://phpsc.com.br/' target='_blank'>http://phpsc.com.br/</a>), nos dias 27 e 28 deste mês foi ótimo. Os organizadores mostram cada ano mais maturidade, as palestras conseguiram ser tanto focadas na parte mais técnica quanto focadas no mercado, metodologias, etc. A platéia também parecia bem interessada, apesar de terem ficado bastante distribuídos entre demais cursos que aconteciam durante o evento.<br />
É a comunidade PHP mostrando o poder que tem no Brasil e na reagião Sul.</p>
<p>A palestra sobre o theWebMind foi bem divertida e positiva, vários demonstraram interesse e acredito que conseguiremos atingir mais pessoal capacitado e interessado em colaborar, o que é sempre muito importante para o projeto.</p>
<p>Parabéns aos envolvidos e palestrantes. Obrigado a todos e até o ano que vem!</p>
<p>Slides da palestra: <a href="http://tinyurl.com/259zbre">http://tinyurl.com/259zbre</a></p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/phpscconf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bug on IE when creating elements with name (submitName)</title>
		<link>http://felipenascimento.org/en/bug-on-ie-when-creating-elements-with-name-submitname/</link>
		<comments>http://felipenascimento.org/en/bug-on-ie-when-creating-elements-with-name-submitname/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 04:40:48 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Learned Stuff / Tips]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=291</guid>
		<description><![CDATA[Hi, yesterday I had to fight against this problem, which is not very touched out there.
In the beginning, people from jQuery thought it was a jQuery bug, but searching a bit more I could find out the root of this problem.
What is it?
When running your javascript in Internet Explorer 6, or 7 or 8 in [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, yesterday I had to fight against this problem, which is not very touched out there.<br />
In the beginning, people from <em>jQuery</em> thought it was a jQuery bug, but searching a bit more I could find out the root of this problem.</p>
<p><b>What is it?</b><br />
When running your javascript in Internet Explorer 6, or 7 or 8 in compatible mode, if you create dynamically an iframe, for example, and set it a <strong>name</strong> attribute, Internet Explorer will reaplace it by an <strong>submitName</strong> attribute. This attribute cannot be found with .getAttribute(&#8217;submitName&#8217;), but that is the problem, neither can be with .getAttribute(&#8217;name&#8217;)!</p>
<p><b>How to see it happening? Try this:</b></p>
<pre class="brush: jscript;">
var ifr= document.createElement('iframe');
ifr.setAttribute('name', 'iFrameOne');
document.body.appendChild(ifr);
alert(ifr.getAttribute('name'));
// you can also see it through the &quot;developer tool&quot; in the IE tools menu
</pre>
<p>The main problem is that &#8230; when you have something like a link or a form targeting this iframe, you loose it! The same happens with inputs with name, which are dynamically created.</p>
<p><b>How to fix it without ask your users to migrate to a real browser? I did this and it worked:</b></p>
<pre class="brush: jscript;">
var ifrDiv= document.createElement('div');
ifrDiv.innerHTML= &quot;&lt;iframe name='iFrameOne' &gt;&lt;/iframe&gt;&quot;;
document.body.appendChild(ifrDiv);
</pre>
<p><b>Now, why does it happen?!</b><br />
I had the chance to search for this and found in the Microsoft&#8217;s webpage something about this old, known bug in <em>Internet Explorer</em>, with names on dynamic elements. Due to &#8220;fix&#8221; this, instead of fixing, then &#8220;provided&#8221; this workarounded attribute. When you try to deal with the name attribute, it applies like an alias, redirecting it to the Microsoft&#8217;s Internet Explorer imaginary <strong>submitName</strong> attribute. But with this, you cant access a form that has a name, like this:</p>
<pre class="brush: jscript;">
document.forms['dynamicFormName'];
</pre>
<p>because the DOM hasn&#8217;t rendered that form with the name you asked for.</p>
<p>I hope it can help you, if you get stuck with this some day.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/bug-on-ie-when-creating-elements-with-name-submitname/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three ways to reload or move the page</title>
		<link>http://felipenascimento.org/en/three-ways-to-reload-or-move-the-page/</link>
		<comments>http://felipenascimento.org/en/three-ways-to-reload-or-move-the-page/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 02:46:34 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Learned Stuff / Tips]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=286</guid>
		<description><![CDATA[Hi there.
Well, this is a question I see a lot of people doing! Then, I decided to post about it.
We have got, in Javascript, when dealing with the DOM API, the history element, with which we can move forward or backward trough the navigation historic, plus specify with the method go page or step we [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there.<br />
Well, this is a question I see a lot of people doing! Then, I decided to post about it.<br />
We have got, in Javascript, when dealing with the DOM API, the history element, with which we can move forward or backward trough the navigation historic, plus specify with the method <em>go</em> page or step we want to go, by informing the < 0 value to past, or > 0 to the possible forward pages. So, we can do this, too:</p>
<pre class="brush: jscript;">

history.go(0);
</pre>
<p>This will simply reload the page. Of course you can use it with iframes, using the parent, top, self or name to work with their relation.<br />
Other alternative is using the reload method provided by the <em>location</em>, just like this:</p>
<pre class="brush: jscript;">

self.location.reload();
</pre>
<p>Now, a different alternative, and also a way to move from one page to another, is using the href property, also from location.</p>
<pre class="brush: jscript;">

self.location.href= self.location.href;
</pre>
<p>This code will reload the same page, but could be any other address to be loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/three-ways-to-reload-or-move-the-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add an animated bird to announce your tweets</title>
		<link>http://felipenascimento.org/en/add-an-animated-bird-to-announce-your-tweets/</link>
		<comments>http://felipenascimento.org/en/add-an-animated-bird-to-announce-your-tweets/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 05:35:52 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[My Projects]]></category>
		<category><![CDATA[Tweety]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=280</guid>
		<description><![CDATA[Add an animated bird to announce your tweets, in your webpage or blog.
With Tweety (maybe a temporary name), you can specify your twitter account and then get back a small script to put this animation into your website. Only have to copy and paste it wherever you want. It will random one of your 4 [...]]]></description>
			<content:encoded><![CDATA[<p>Add an animated bird to announce your tweets, in your webpage or blog.<br />
With Tweety (maybe a temporary name), you can specify your twitter account and then get back a small script to put this animation into your website. Only have to copy and paste it wherever you want. It will random one of your 4 last posts on twitter and show it for 1 minute, randomising it again, then.<br />
In my home page there is an example of it working. Though, you can see here, it working again:</p>
<p>If you have ideas to have it better, or found any bug, or if you can draw a better bird, talk to me <img src='http://felipenascimento.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/add-an-animated-bird-to-announce-your-tweets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Firefox 4 Beta 1</title>
		<link>http://felipenascimento.org/en/testing-firefox-4-beta-1/</link>
		<comments>http://felipenascimento.org/en/testing-firefox-4-beta-1/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 00:38:21 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[Learned Stuff / Tips]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[acid3]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=273</guid>
		<description><![CDATA[Well, Firefox 4b1 has just been lauched and we had the chance to test it and use it for quite a while.
The first thing I did was to test it running some crazy heacy scripts, like http://bit.ly/DvVL and http://bit.ly/ppahL. I gotta say, it was impressive. Those scripts simply couldn&#8217;t run at Firefox in the previous [...]]]></description>
			<content:encoded><![CDATA[<p>Well, Firefox 4b1 has just been lauched and we had the chance to test it and use it for quite a while.<br />
The first thing I did was to test it running some crazy heacy scripts, like <a href="http://bit.ly/DvVL">http://bit.ly/DvVL</a> and <a href="http://bit.ly/ppahL">http://bit.ly/ppahL</a>. I gotta say, it was impressive. Those scripts simply couldn&#8217;t run at Firefox in the previous version, now, they run just as chrome does. It made me happy about this release.<br />
Then, testing it with <a href="http://acid3.acidtests.org/">acid3</a>, it reached the 97 points. I think it could be better, specially because either chrome, safari and opera reached 100. Though, those 3 missing points are related to the SVG Fonts, which were deliberately not implemented, using WOFF instead, as you can see in the <a href="http://weblogs.mozillazine.org/roc/archives/2010/06/not_implementin.html">Mozilla&#8217;s developers blog</a>.<br />
At <a href='http://html5test.com/'>html5test.com</a>, firefox 4 had 189 points. Chrome was the only better, with 197. IE had 27, as I thought.<br />
When testing selectors and CSS3 <a href='http://www.findmebyip.com/#target-selector'>here</a>, I notice there are only a few properties/methods that only chrome offers more than Firefox.<br />
The problem I have to point by now is that no one single add-on worked on this version. Even mine didn&#8217;t work ok and I&#8217;ll have to change some details at them.</p>
<p>About the layout, I&#8217;m personaly happy they didn&#8217;t take off the status bar, as many people had asked for(if I wanted a browser without a status bar, I&#8217;d rather use Chrome). Still, if you use windows vista or Seven, you may have some new advances, like the special button at the top of the window, removing the usual menubar, adding it to the title bar.</p>
<p>I do think there are many things to get better or to be increased in Firefox 4 before its release candidate. It promises a lot and I&#8217;m really glad to see the browsers walking toward the same point. The future developers will be happier and faster <img src='http://felipenascimento.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/testing-firefox-4-beta-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting with Canvas in javascript</title>
		<link>http://felipenascimento.org/en/starting-with-canvas-in-javascript/</link>
		<comments>http://felipenascimento.org/en/starting-with-canvas-in-javascript/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 00:20:10 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Learned Stuff / Tips]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=266</guid>
		<description><![CDATA[Well, canvas is not that young feature, even though, people are still afraid of using it. Most of our browsers can understand it, and the others (I mean, the Internet Explorer, the onlly one which can&#8217;t) will &#8220;learn&#8221; it soon.
Now, I want to put here some tips about how to start working with canvas easily, [...]]]></description>
			<content:encoded><![CDATA[<p>Well, canvas is not that young feature, even though, people are still afraid of using it. Most of our browsers can understand it, and the others (I mean, the Internet Explorer, the onlly one which can&#8217;t) will &#8220;learn&#8221; it soon.<br />
Now, I want to put here some tips about how to start working with canvas easily, and also, how to import images and draw then into it.</p>
<p>First thing, you need a canvas element, and you need to treat it for <s>those</s> that which can&#8217;t render the canvas element properly.</p>
<pre class="brush: xml;">
    &lt;body&gt;
        &lt;canvas id=&quot;theCanvasElement&quot;&gt;
            whatever you write in here, will be shown ONLY
            when your canvas cannot be rendered.
            Of course, it accepts HTML tags
        &lt;/canvas&gt;
    &lt;/body&gt;
</pre>
<p>Ok, now, using event handlers we will treat it in our  javascript</p>
<pre class="brush: xml;">
    &lt;/body&gt;
    &lt;script&gt;
          // yes, addEventListener does not work on IE
          document.addEventListener('load', canvasHandler, false);
    &lt;script&gt;
&lt;/html&gt;
</pre>
<p>Good. When our page is loaded, it will call our method <em>canvasHandler</em>. Let&#8217;s see how we will open the canvas to use with javascript:</p>
<pre class="brush: jscript;">
// let's create some global variables.
// You can use it better with namespaces
var canvas= null;
var ctx= null;
canvasHandler= function(){
    // first of all, we simply get the canvas element itself
    canvas= document.getElementById('theCanvasElement');
    // now, we need to have the CONTEXT to work with
    ctx= canvas.getContext('2d');
}
</pre>
<p>Great, we have now in our variable <em>canvas</em>, the HTML canvas element itself. While the variable ctx has got its context. The context is what we will use to draw. It has the mothods and properties to allow us to interact with the canvas in 2D.<br />
No, unfortunately it does not offer any other context besides 2D.<br />
Our canvas still has no properties. It has no with and height, we can set it then.<br />
From now on, all the javascript code must be set inside the canvasHandler function&#8217;s body, under those  lines shown  before.</p>
<pre class="brush: jscript;">
    canvas.width= 480;
    canvas.height= 340;
</pre>
<p>You probably know how to load an image  from js, right?</p>
<pre class="brush: jscript;">
    var img= new Image();
    img.src= 'url.png';
</pre>
<p>Ok, you can use it to insert images inside your canvas. Just like this.</p>
<pre class="brush: jscript;">
    // instantiate an image
    var img= new Image();
    // we need to use the image when it has finished to load
    img.addEventListener('load', function(){
        // after downloading the image, we can draw it into the canvas
        ctx.drawImage(this);
        // where this= the image just downloaded
    });
    // then, we say the image's url, to it start loading
    img.src= 'url.png';
</pre>
<p>Ok, now you can see an image inside your canvas. The drawImage method supports some different structures refered by its parameters:</p>
<pre class="brush: jscript;">
    // draws the image in the position left=30, top=30
    ctx.drawImage(this, 30, 30);
    // draws the image in the 0/0 position, changing its size
    ctx.drawImage(this, 0, 0, 45, 75);
    // more complex, draws the image croping it
    ctx.drawImage(this, 0, 0, 150, 150, 0, 0, 480, 340);
</pre>
<p>When cropping, you specify the image (this), the position to start showing it (0, 0), then the size you want to crop it (150, 150). After that, you will tell the canvas the size and position the image really is(0, 0, 480, 340).</p>
<p>Soon, I&#8217;ll post about how to really draw  into your canvas through javascript, adding lines, points and texts.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/starting-with-canvas-in-javascript/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHPDevBar reaches 6 thousand downloads</title>
		<link>http://felipenascimento.org/en/phpdevbar-reaches-6-thousand-downloads/</link>
		<comments>http://felipenascimento.org/en/phpdevbar-reaches-6-thousand-downloads/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 04:29:45 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP DevBar]]></category>
		<category><![CDATA[php developer toolbar]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=239</guid>
		<description><![CDATA[I&#8217;m quite proud to talk about these new marks and goals.
We&#8217;ve also had many feedback, which has helped a lot.
A little secret. I&#8217;m working hard to provide a new version with some new features and with a real better engine for the Function Search.
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m quite proud to talk about these new marks and goals.<br />
We&#8217;ve also had many feedback, which has helped a lot.</p>
<p>A little secret. I&#8217;m working hard to provide a new version with some new features and with a real better engine for the Function Search.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/phpdevbar-reaches-6-thousand-downloads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPDevBar 2.0.1 released</title>
		<link>http://felipenascimento.org/en/phpdevbar-2-0-1-released/</link>
		<comments>http://felipenascimento.org/en/phpdevbar-2-0-1-released/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 23:56:59 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP DevBar]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[php developer toolbar]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=232</guid>
		<description><![CDATA[This last week we released the latest version of PHPDevBar.
Better, Mozilla has approved it and now it opened to be downloaded at mozilla&#8217;s website.
We hope we will have many comments and feedback about it. Ideas are also very welcome.
]]></description>
			<content:encoded><![CDATA[<p>This last week we released the latest version of PHPDevBar.<br />
Better, Mozilla has approved it and now it opened to be downloaded at <a href="https://addons.mozilla.org/en-US/firefox/addon/12686" target='_quot'>mozilla&#8217;s website</a>.</p>
<p>We hope we will have many comments and feedback about it. Ideas are also very welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/phpdevbar-2-0-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>print_r (the same as in PHP) in Javascript, the print_j</title>
		<link>http://felipenascimento.org/en/print_r-the-same-as-in-php-in-javascript-the-print_j/</link>
		<comments>http://felipenascimento.org/en/print_r-the-same-as-in-php-in-javascript-the-print_j/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 23:48:25 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[print_j]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[My Projects]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=223</guid>
		<description><![CDATA[Hey folks.
I prepared this small function to use, once it&#8217;s many times needed and we don&#8217;t have it natively in JavaScript. I have many times searched for it through google and couldn&#8217;t find a reall interesting lib to it.
Then, I prepared this one.
You can see the example of the output in my projects directory. And [...]]]></description>
			<content:encoded><![CDATA[<p>Hey folks.<br />
I prepared this small function to use, once it&#8217;s many times needed and we don&#8217;t have it natively in JavaScript. I have many times searched for it through google and couldn&#8217;t find a reall interesting lib to it.<br />
Then, I prepared this one.<br />
You can see the example of the output in my <a href="http://felipenascimento.org/projetos/print_j" target='_quot'>projects directory</a>. And you can download the <a href="http://felipenascimento.org/projetos/print_j/print_j.zip">print_j</a> js.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/print_r-the-same-as-in-php-in-javascript-the-print_j/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Criando uma aplicação funcional com theWebMind</title>
		<link>http://felipenascimento.org/en/portugues-brasil-criando-uma-aplicacao-funcional-com-thewebmind/</link>
		<comments>http://felipenascimento.org/en/portugues-brasil-criando-uma-aplicacao-funcional-com-thewebmind/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 03:03:30 +0000</pubDate>
		<dc:creator>Felipe Nascimento</dc:creator>
				<category><![CDATA[Generic]]></category>
		<category><![CDATA[Learned Stuff / Tips]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[theWebMind]]></category>

		<guid isPermaLink="false">http://felipenascimento.org/?p=197</guid>
		<description><![CDATA[Quero apresentar neste post, e em alguns mais que virão, como podemos criar uma aplicação completa a partir de não mais que 6 linhas utilizando o theWebMind.
Um de seus principais desafios é mostrar como podemos explorar muito mais de algumas de nossas capacidades, que são verdadeiros diferenciais contra as máquinas, ao mesmo tempo, sabendo extrair [...]]]></description>
			<content:encoded><![CDATA[<p>Quero apresentar neste post, e em alguns mais que virão, como podemos criar uma aplicação completa a partir de não mais que 6 linhas utilizando o theWebMind.<br />
Um de seus principais desafios é mostrar como podemos explorar muito mais de algumas de nossas capacidades, que são verdadeiros diferenciais contra as máquinas, ao mesmo tempo, sabendo extrair o que há de melhor nas máquinas, e que não temos sequer chance de concorrer. Sim, estou falando de criatividade, inovação, imaginação, versus habilidade matemática, lógica e performance ao se aplicar regras.<br />
TheWebMind está em sua versão <a href="http://code.google.com/p/webmind/source/browse/#svn/tags/pre-alpha-2.0.0">Pre-Alpha 2.0.0</a> e com certeza ainda ha muitas melhorias por vir, além de possíveis bugs a serem corrigidos.</p>
<p>Com o <a href="http://thewebmind.org/download">último release</a>, uma das principais novidades é o módulo nativo <a href="http://docs.thewebmind.org/index.php?title=Modules#Native_ZendModels">Zend Models</a>, que gera uma estrutura <a href="http://pt.wikipedia.org/wiki/MVC">MVC</a> utilizando o <a href="http://framework.zend.com/">Zend Framework</a>.</p>
<p>Caso ainda não conheça o Mind, como assim o chamamos, visite seu <a href="http://thewebmind.org">site oficial</a> e veja a <a href="http://docs.thewebmind.org">documentação</a>.</p>
<p>Após ter baixado o último release do Mind e tê-lo movido para um diretório em seu ambiente de desenvolvimento PHP, por exemplo, http://localhost/thewebmind/, basta acessar tal endereço para vê-lo funcionando. Ao ser acessado pela primeira vez, o Mind tratará de criar um usuário padrão, que recomendamos que se altere a senha, e prepara o ambiente todo, mesmo que você nem perceba. A partir daí, ja estarás apto a sair usando o Mind.<br />
Caso tenha tido algum problema nesta parte, visite a nossa <a href="http://docs.thewebmind.org/index.php?title=FAQ">FAQ</a> e a página com detalhes sobre a <a href="http://docs.thewebmind.org/index.php?title=Instalation">instalação</a>.</p>
<p>Sobre o sistema a ser desenvolvido:<br />
Pensei no que preparar, de forma a mostrar de tudo um pouco, e por isto decidi fazer um sistema de posts, onde usuários pudessem criar posts, e outros usuários pudessem comentar os mesmos, além de dar uma nota de 1 a 5.</p>
<h1>1º Passo, criando um projeto no Mind</h1>
<p>Já logado na IDE do Mind, acesse o menu <i>File</i>, e então <i>New Project</i>. Um formulário será exibido solicitando algumas informações.<br />
Note que não é necessário ter uma base de dados já funcionando para ir desenvolvendo o projeto, porém, ao se solicitar que o Mind gere os arquivos ou a base de dados, sim, neste momento será necessário a existência de um banco de dados já configurado. Aconselho a já cadastrar os dados para um banco de dados desde o início. Podemos ainda cadastrar duas bases de dados diferentes, uma para testes e outra pra produção.</p>
<h1>2º Passo, escrevendo em WML</h1>
<p>A sintaxe da linguagem WML é baseada no conceito NLP (Natural Language Processing), que consiste basicamente em ser semelhante a linguagem humana natural(Português, Inglês, Espanhol, etc), e ainda obedece ao conceito de <a href="http://docs.thewebmind.org/index.php?title=Lignuagem_de_Programa%C3%A7%C3%A3o_Discreta">programação discreta</a>.<br />
Caso precise de alguma ajuda nesta sintaxe, visite a <a href="http://docs.thewebmind.org/index.php?title=Web-Mind-Language">documentação do Mind sobre WML</a>.</p>
<p>O código que preparei para este protótipo foi o que segue:</p>
<pre class="brush: plain;">
Sabemos que todo login tem nome:caractere(60).
Também, o login tem idade:inteiro(). E login pode ter muitos post.
Sendo que cada post tem título:string(40, obrigatório).
E todo post tem descrição:texto().
Post pode ter muitos comentário.
Comentário tem mensagem:varchar(140).
Enquanto que todo o comentário
tem pontuação:inteiro(-1, {1=Ruim|2=Regular|3=Bom|4=Muito Bom|5=Ótimo}).
</pre>
<p>Para compreender o que foi escrito: apenas com estas 7 linhas de código conseguimos representar um problema relativamente complexo.<br />
A instrução mais complexa é a ultima, onde especificamos que os comentarios terão uma pontuação, e que a mesma somente aceitará 5 opções de valores numericos. Apontamos -1 como tamanho do inteiro, para que o mesmo tenha um tamanho padrão, e então especificamos os valores válidos para este atributo e suas respectivas lábels. Para maiores detalhes, veja em na sessão de <a href="http://docs.thewebmind.org/index.php?title=Web-Mind-Language#Attributes">atributos na documentação do mind</a>.</p>
<h1>3º Rodando o projeto</h1>
<p>Para rodar o projeto, o que atualizará o output do mesmo, será necessário ter o projeto já salvo com o código atual, e entao clicar no ícone <img src="http://jaydson.org/wp-content/uploads/2010/02/bt_play_over.gif" alt="Run project" /> na barra de ferramentas sobre o editor do Mind, ou pelo menu <i>Tools>Run/Simulate</i>.<br />
Neste momento, as saídas serão atualizadas tanto no painel de output, na parte inferior da tela, quanto na árvore contendo a estrutura do projeto, na lateral esquerda da IDE.<br />
Confira algumas das saídas para este projeto:<br />
<img src="http://felipenascimento.org/wp-content/uploads/2010/02/ddl.png" alt="Código DDL - criação da estrutura na base de dados" /><br/><br />
<img src="http://felipenascimento.org/wp-content/uploads/2010/02/er.png" alt="Diagrama ER para o projeto gerado" /><br/><br />
<img src="http://felipenascimento.org/wp-content/uploads/2010/02/tree.png" alt="Árvore, representando a estrutura do projeto trabalhado" /></p>
<h1>4º Gerando o projeto</h1>
<p>Para gerar um projeto, use o menu <i>Tools>Generate Project</i> ou o ícone <img src="http://jaydson.org/wp-content/uploads/2010/02/compiler_over.gif" alt="Generate Project" /> sobre o editor do theWebMind.<br />
Um wizard irá abrir com alguns passos a serem seguidos:</p>
<ol>
<li>
Escolha o que planejas gerar. Nesta tela, selecione a opção que melhor se adapta. Escolheremos a segunda, para criar os arquivos, MAIS a base de dados no banco de dados que cadastramos como desenvolvimento.
</li>
<li>
Na segunda tela, selecionaremos um módulo para ficar como responsável pelo código a ser gerado. Neste caso, selecionaremos o módulo ZendModels.<br />
<b> &#8211; Note que há requisitos para usar este módulo, como htaccess ativo e a biblioteca <i>library</i> na raíz de seu servidor</b>
</li>
<li>
A terceira tela lhe oferecerá opções sobre o módulo selecionado ou detalhes do passo-a-passo. Neste caso, o ZendModels não tem nenhuma especificação extra, porém será perguntado se desejamos pular(skip) ou substituir (replace) as tabelas que já existirem no banco de dados. Como a base ainda está limpa, esta opção é indiferente neste momento.
</li>
</ol>
<p>Ao clicar em avançar, theWebMind irá automáticamente iniciar a gerar os arquivos e a interagir com a base de dados para criar as tabelas necessárias.<br />
Ao término desta tarefa, lhe será oferecido um link, <b>here</b> que lhe levará aos arquivos gerados. Os mesmos também estão acessíveis em <i>View>Temp Project Files</i>.</p>
<h1>6º Testando a aplicação gerada</h1>
<p>Simplesmente fazendo isto, já temos um sistema pronto e funcionando de forma simples. Somente o que precisaremos fazer será editar as views para ter uma interface melhor adaptada à real necessidade.<br />
Na modal onde vemos os códigos gerados, logo no topo da árvore que representa a estrutura de arquivos vemos um link com o nome do projto. Clicando nele seremos levados para onde a aplicação gerada esta rodando. Outra forma de chegarmos a estes arquivos paramovermos para outro servidor é atraves do endereço: <i>&lt;theWebMind root>/restrict/users/&lt;user name>/temp/&lt;project name>/root/</i></p>
<p>Publiquei o sistema gerado, sem nenhuma alteração, <a href="http://source.jaydson.org/posts/root/">aqui</a>, onde você poderá ver e testar como ficou o resultado.</p>
<h1>Enfrentando possíveis problemas</h1>
<p>Caso tenha tido algum problema ao gerar o mesmo sistema, verifique se o htaccess está aivo na configuração do seu server. Confirme também que a biblioteca do Zend Framework está no diretório raíz do seu servidor HTTP. O que enfrentamos também, foi que algumas configurações no apache limitam o htaccess, então teste removendo as linhas:<br />
<strong><br />
php_flag magic_quotes_gpc off<br />
php_flag register_globals off<br />
</strong></p>
<p>Enfim, tentei expressar neste post como podemos com apenas algumas poucas linhas, desenvolver uma aplicação já funcional com toda a estrutura e classes seguindo o padrão ZF.<br />
Você encontra outro exemplo de aplicação gerada a partir do Mind no <a href="http://jaydson.org/criando-um-sistema-de-tarefas-com-o-thewebmind/?lang=en">blog do Jaydson</a>.<br />
Espero ter um feedback sobre suas experiências a respeito do <strong>theWebMind</strong>.</p>
<p>Abraços a todos.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipenascimento.org/en/portugues-brasil-criando-uma-aplicacao-funcional-com-thewebmind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
