<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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" version="2.0">

<channel>
	<title>felipediesel.net</title>
	
	<link>http://felipediesel.net/blog</link>
	<description>Desenvolvimento web e um pouco de tudo mais</description>
	<pubDate>Sun, 21 Sep 2008 18:15:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/FelipeDiesel" type="application/rss+xml" /><item>
		<title>Dica: Listando as rotas no console</title>
		<link>http://felipediesel.net/blog/dica-listando-as-rotas-no-console/</link>
		<comments>http://felipediesel.net/blog/dica-listando-as-rotas-no-console/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 18:15:09 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[Ruby On Rails]]></category>

		<category><![CDATA[desenvolvimento]]></category>

		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=111</guid>
		<description><![CDATA[O Carlos Brando publicou hoje um artigo sobre como testar rotas no console. Achei legal e decidi compartilhar um c&#243;digo que uso freq&#252;entemente, mas que serve para listar todas as rotas nomeadas existentes. Fa&#231;a o seguinte no terminal:
PLAIN TEXT
RUBY:




$ ./script/console


&#62;&#62; app.methods.grep /_path$/ 






Este comando, pega todos os m&#233;todos da aplica&#231;&#227;o e filtra utilizando uma express&#227;o [...]]]></description>
			<content:encoded><![CDATA[<p>O <a href="http://www.nomedojogo.com/">Carlos Brando</a> publicou hoje <a href="http://www.nomedojogo.com/2008/09/21/dica-testando-rotas-no-console/">um artigo sobre como testar rotas no console</a>. Achei legal e decidi compartilhar um c&oacute;digo que uso freq&uuml;entemente, mas que serve para listar todas as rotas nomeadas existentes. Fa&ccedil;a o seguinte no terminal:</p>
<div class="igBar"><span id="lruby-5"><a href="#" onclick="javascript:showPlainTxt('ruby-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-5">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ ./script/console</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&gt;&gt; app.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">grep</span> /_path$/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Este comando, pega todos os m&eacute;todos da aplica&ccedil;&atilde;o e filtra utilizando uma express&atilde;o regular.</p>
<p>Para melhorar a visualiza&ccedil;&atilde;o, voc&ecirc; pode adicionar o "y" na frente, para que ele converta o array de retorno em yaml:</p>
<div class="igBar"><span id="lruby-6"><a href="#" onclick="javascript:showPlainTxt('ruby-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-6">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&gt;&gt; y app.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">grep</span> /_path$/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>E para ficar ainda melhor, adicione o "sort", para ficar em ordem alfab&eacute;tica:</p>
<div class="igBar"><span id="lruby-7"><a href="#" onclick="javascript:showPlainTxt('ruby-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-7">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&gt;&gt; y app.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">sort</span>.<span style="color:#9900CC;">grep</span> /_path$/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>O problema &eacute; que existem muitas rotas, numa aplica&ccedil;&atilde;o bem pequena que tenho aqui chega a 500. Para contornar isso voc&ecirc; pode utilizar o poder das express&otilde;es regulares. O c&oacute;digo abaixo, lista apenas as que come&ccedil;am com 's':</p>
<div class="igBar"><span id="lruby-8"><a href="#" onclick="javascript:showPlainTxt('ruby-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-8">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&gt;&gt; y app.<span style="color:#9900CC;">methods</span>.<span style="color:#9900CC;">sort</span>.<span style="color:#9900CC;">grep</span> /^s.*_path$/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Se voc&ecirc; n&atilde;o conhece Express&otilde;es Regulares, d&ecirc; uma lida na Web, tem muito material. Caso prefira livros, d&ecirc; uma conferida no <a href="http://www.piazinho.com.br/">"livro do piazinho"</a>, do <a href="http://aurelio.net/">Aur&eacute;lio</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/dica-listando-as-rotas-no-console/feed/</wfw:commentRss>
		</item>
		<item>
		<title>E o curso de Rails já acabou…</title>
		<link>http://felipediesel.net/blog/e-o-curso-de-rails-ja-acabou/</link>
		<comments>http://felipediesel.net/blog/e-o-curso-de-rails-ja-acabou/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 03:54:41 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[Ruby On Rails]]></category>

		<category><![CDATA[Curso]]></category>

		<category><![CDATA[e-Genial]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=91</guid>
		<description><![CDATA[Conforme falei no artigo anterior, fiz o curso de Ruby On Rails da e-Genial, que infelizmente se encerrou na quinta, dia 23. Foram 21 aulas, com direito a lista de discuss&#227;o, material de estudo de primeira e um instrutor, o J&#250;lio Monteiro muito bom. De quebra ainda conheci muita gente legal e que com certeza [...]]]></description>
			<content:encoded><![CDATA[<p>Conforme falei <a href="http://felipediesel.net/blog/ruby-on-rails-aqui-vou-eu/">no artigo anterior</a>, fiz o curso de <a href="http://www.egenial.com.br/cursorails/">Ruby On Rails da e-Genial</a>, que infelizmente se encerrou na quinta, dia 23. Foram 21 aulas, com direito a lista de discuss&atilde;o, material de estudo de primeira e um instrutor, o <a href="http://www.monteiro.eti.br/">J&uacute;lio Monteiro</a> muito bom. De quebra ainda conheci muita gente legal e que com certeza manterei contato.</p>
<p>Foi muito interessante a proposta do pessoal da e-Genial de fazer um desafio: montar um software de gest&atilde;o escolar, com cadastro de alunos, instrutores, cursos, turmas, aulas e ainda lista de chamada! Os melhores ganhariam livros.</p>
<p>A maioria do pessoal do curso n&atilde;o fez, ou n&atilde;o conseguiu terminar, mas eu recomendo muito que se lhe for proposto algo assim, deixe um fim de semana de lado e se dedique a isso. N&atilde;o tanto pelo livro, que &eacute; um incentivo legal, mas pelo aprendizado que algo assim proporciona. Eu fiz e aprendi muita coisa nesse sistema, pois as d&uacute;vidas s&oacute; aparecem quando voc&ecirc; mete a m&atilde;o na massa.</p>
<p><a style="float:right" href="http://www.amazon.com/gp/product/0321445619?ie=UTF8&amp;tag=felipedieseln-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321445619"><img title="The Rails Way - Obie Fernandez" src="http://felipediesel.net/blog/wp-content/uploads/2008/07/51qmxwhhvjl_sl160_.jpg" alt="" /></a></p>
<p>E o ganhador? Bom, n&atilde;o que eu queira me gabar nem nada, mas <strong>eu ganhei!</strong> <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> O pr&ecirc;mio foi um livro muito bom, o <a href="http://www.amazon.com/gp/product/0321445619?ie=UTF8&amp;tag=felipedieseln-20&amp;linkCode=as2&amp;camp=1789&amp;creative=9325&amp;creativeASIN=0321445619">Rails Way</a>, do <a href="http://obiefernandez.com/">Obie Fernandez</a>. Estou agora a espera do livro, que est&aacute; vindo pelo correio, j&aacute; que o curso foi online, para mergulhar de cabe&ccedil;a em mais material sobre Rails. Se voc&ecirc; quiser ver meu projeto, &eacute; s&oacute; <a href="https://github.com/felipediesel/gestao_escolar/tree">acessar no github</a> ou fazer o <a href="http://github.com/felipediesel/gestao_escolar/tarball/master">download do tarball</a>.</p>
<p>Gostaria ainda de elogiar o <a href="http://www.treinatom.com.br/">TreinaTom</a>, que eu insisto em chamar de Teletom (vai ver o Carlos Eduardo &eacute; amigo do S&iacute;lvio Santos). O ambiente &eacute; muito legal, com a intera&ccedil;&atilde;o entre professor e aluno acontecendo na hora. Pior coisa de curso online s&atilde;o aqueles em que s&oacute; h&aacute; apostilas e f&oacute;rum e este n&atilde;o foi assim, teve v&iacute;deo, screensharing e muito bate-papo.</p>
<p>O <a href="http://www.monteiro.eti.br/">J&uacute;lio</a> tamb&eacute;m foi sensacional, muito prestativo e paciente com nossas d&uacute;vidas beirando o rid&iacute;culo. Ontem ele disse que nossa turma foi a melhor que ele j&aacute; trabalhou at&eacute; hoje e que &eacute;ramos muito interessados. Mas eu sei que ele diz isso pra todas turmas. <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Bom, se voc&ecirc; chegou at&eacute; aqui, &eacute; por que j&aacute; deve estar interessado no curso. E pra n&atilde;o dizer que foi tudo elogios, faltou falar um pouco mais sobre Testes, que &eacute; algo muito importante e que n&atilde;o consegui entender o fluxo de trabalho, mas tenho certeza que vai estar melhor nos pr&oacute;ximos cursos. Esse problema vou resolver com um <a href="http://peepcode.com/products/test-first-development">screencast do Peepcode</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/e-o-curso-de-rails-ja-acabou/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ruby On Rails, aqui vou eu</title>
		<link>http://felipediesel.net/blog/ruby-on-rails-aqui-vou-eu/</link>
		<comments>http://felipediesel.net/blog/ruby-on-rails-aqui-vou-eu/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 02:02:14 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[Ruby On Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=83</guid>
		<description><![CDATA[Tenho andado com os meu queixo dolorido nos &#250;ltimos dias. H&#225; um m&#234;s estou fazendo o curso de Ruby On Rails da e-Genial e estou embasbacado com o framework. Tenho estudado Rails por conta j&#225; faz um ano, mas nunca saindo do b&#225;sico (com o Django fiz a mesma coisa). Claro que isso parece ser [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float:right; margin-left:8px" src="http://felipediesel.net/blog/wp-content/uploads/2008/07/rails.png" alt="Ruby On Rails" />Tenho andado com os meu queixo dolorido nos &uacute;ltimos dias. H&aacute; um m&ecirc;s estou fazendo o curso de <a href="http://www.rubyonrails.pro.br/">Ruby On Rails</a> da <a href="http://egenial.com.br/">e-Genial</a> e estou embasbacado com o framework. Tenho estudado Rails por conta j&aacute; faz um ano, mas nunca saindo do b&aacute;sico (com o Django fiz a mesma coisa). Claro que isso parece ser chover no molhado, mas o Rails &eacute; realmente impressionante.</p>
<p>Pelo que vi at&eacute; agora o grande diferencial dele &eacute; o Active Record. Eu trabalho o <a href="http://codeigniter.com">CodeIgniter</a> recentemente, mas ele n&atilde;o tem <a href="http://pt.wikipedia.org/wiki/ORM">ORM</a> e isso faz uma falta enorme, j&aacute; que no Rails os Models tem a fun&ccedil;&atilde;o de <em>configurar</em> a tabela do banco de dados e deixando todo o resto pro Active Record, enquanto no CI, &eacute; um reposit&oacute;rio de fun&ccedil;&otilde;es relacionados ao BD; fazendo o desenvolvimento ser muito mais r&aacute;pido no Rails.</p>
<p>Outra qualidade que percebi nesse meu "namoro" com Rails, foi a Comunidade, que &eacute; muito ativa, trazendo novidades e material quase que diariamente. Tanto a <a href="http://rubyonrails.com/">comunidade internacional</a> (d&aacute; pra chamar assim?), quanto a <a href="http://www.rubyonrails.pro.br/">brasileira</a> s&atilde;o legais. Isso contou muito na hora que optei pelo Ruby/Rails (em detrimento do Python/Django).</p>
<p><img style="float:left; margin-right:8px" src="http://felipediesel.net/blog/wp-content/uploads/2008/07/ruby.png" alt="Ruby" />Outra grande vantagem do Rails, &eacute; o Ruby. Isso mesmo, a linguagem utilizada no framework &eacute; muito boa. &Eacute; leg&iacute;vel, padronizada e muito poderosa. Eu trabalho com PHP fazem 4 anos e n&atilde;o quero cuspir no prato que comi (e ainda como), mas PHP &eacute; muito desorganizada.</p>
<p>Me chamou a aten&ccedil;&atilde;o no Ruby o modo literal com que as coisas s&atilde;o programadas (<em>3.times { print "Hi!" }</em>, quer algo mais claro que isso?) e o fato de ser totalmente orientada a objeto. Isso mesmo at&eacute; as opera&ccedil;&otilde;es b&aacute;sicas, com a soma, s&atilde;o objetos! <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Claro que essas opini&otilde;es aqui escritas s&atilde;o percep&ccedil;&otilde;es minhas, e est&atilde;o longe de ser verdades absolutas, j&aacute; que como disse Nelson Rodrigues, "toda unanimidade &eacute; burra". <a href="http://corporacaoweb.com/atacando-no-ruby.html">Mas eu n&atilde;o estou sozinho.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/ruby-on-rails-aqui-vou-eu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ajude a sustentar a Wikipédia e outros projetos, sem colocar a mão no bolso, e concorra a um Eee PC!</title>
		<link>http://felipediesel.net/blog/ajude-a-sustentar-a-wikipedia-e-outros-projetos-sem-colocar-a-mao-no-bolso-e-concorra-a-um-eee-pc/</link>
		<comments>http://felipediesel.net/blog/ajude-a-sustentar-a-wikipedia-e-outros-projetos-sem-colocar-a-mao-no-bolso-e-concorra-a-um-eee-pc/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 17:00:46 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[internet]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=80</guid>
		<description><![CDATA[…e tamb&#233;m a pen drives, card drives, camisetas geeks, livros e mais! O BR-Linux e o Efetividade lan&#231;aram uma campanha para ajudar a Wikimedia Foundation e outros mantenedores de projetos que usamos no dia-a-dia on-line. Se voc&#234; puder doar diretamente, ou contribuir de outra forma, s&#227;o sempre melhores op&#231;&#245;es. Mas se n&#227;o puder, veja as [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float: right;" title="Wikipedia" src="http://felipediesel.net/blog/wp-content/uploads/2008/07/wikipedia-logo.png" alt="Wikipedia" />…e tamb&eacute;m a pen drives, card drives, camisetas geeks, livros e mais! O BR-Linux e o Efetividade lan&ccedil;aram uma campanha para ajudar a Wikimedia Foundation e outros mantenedores de projetos que usamos no dia-a-dia on-line. Se voc&ecirc; puder doar diretamente, ou contribuir de outra forma, s&atilde;o sempre melhores op&ccedil;&otilde;es. Mas se n&atilde;o puder, veja as regras da promo&ccedil;&atilde;o e participe - quanto mais divulga&ccedil;&atilde;o, maior ser&aacute; a doa&ccedil;&atilde;o do BR-Linux e do Efetividade, e voc&ecirc; ainda concorre a diversos brindes!</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/ajude-a-sustentar-a-wikipedia-e-outros-projetos-sem-colocar-a-mao-no-bolso-e-concorra-a-um-eee-pc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SSH mais simples ainda</title>
		<link>http://felipediesel.net/blog/ssh-mais-simples-ainda/</link>
		<comments>http://felipediesel.net/blog/ssh-mais-simples-ainda/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 17:58:43 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[shell]]></category>

		<category><![CDATA[internet]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=79</guid>
		<description><![CDATA[Eu estava brigando a com o rsync para enviar um arquivo para um servidor em que a posta ssh n&#227;o era a 22 (padr&#227;o) e descobri algo muito mais interessante, que com certeza &#233; &#250;til para muita gente.
Voc&#234; pode criar aliases para suas conex&#245;es ssh. O rsync roda utilizando o ssh, ent&#227;o tamb&#233;m funciona. Com [...]]]></description>
			<content:encoded><![CDATA[<p>Eu estava brigando a com o <em>rsync</em> para enviar um arquivo para um servidor em que a posta ssh n&atilde;o era a 22 (padr&atilde;o) e descobri algo muito mais interessante, que com certeza &eacute; &uacute;til para muita gente.</p>
<p>Voc&ecirc; pode criar aliases para suas conex&otilde;es ssh. O rsync roda utilizando o ssh, ent&atilde;o tamb&eacute;m funciona. Com isso, voc&ecirc; pode logar via ssh da seguinte forma: <em>ssh servidor</em>.</p>
<p>Para que isso funcione, altere (ou crie se necess&aacute;rio) o arquivo ~/.ssh/config da seguinte forma:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showPlainTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Host servidor</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; hostname enredeco.<span style="">do</span>.<span style="">host</span>.<span style="">com</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; user nome.<span style="">do</span>.<span style="">usuario</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; port <span style="color:#800000;color:#800000;">22</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A porta s&oacute; especifique se n&atilde;o for o padr&atilde;o.</p>
<p>F&aacute;cil n&atilde;o?</p>
<p>E n&atilde;o esque&ccedil;a de dar uma olhada <a href="http://felipediesel.net/blog/logando-num-servidor-ssh-sem-senha/">no meu artigo sobre como logar sem senha</a>, para facilitar ainda mais sua vida! <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/ssh-mais-simples-ainda/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Utilizando layouts no CodeIgniter</title>
		<link>http://felipediesel.net/blog/utilizando-layouts-no-codeigniter/</link>
		<comments>http://felipediesel.net/blog/utilizando-layouts-no-codeigniter/#comments</comments>
		<pubDate>Wed, 21 May 2008 12:56:38 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[desenvolvimento]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=78</guid>
		<description><![CDATA[Na grande maioria dos sites e sistemas web &#233; apenas modificado o miolo da aplica&#231;&#227;o, enquanto que o cabe&#231;alho, rodap&#233;, menu, etc. permanecem iguais. E utilizando o modelo MVC, normalmente para cada action do controller temos uma view correspondente, sendo que geralmente um controller: Main com uma action: index, ter&#225; a view main/index.php.
No Code Igniter [...]]]></description>
			<content:encoded><![CDATA[<p>Na grande maioria dos sites e sistemas web &eacute; apenas modificado o miolo da aplica&ccedil;&atilde;o, enquanto que o cabe&ccedil;alho, rodap&eacute;, menu, etc. permanecem iguais. E utilizando o modelo MVC, normalmente para cada action do controller temos uma view correspondente, sendo que geralmente um controller: <em>Main</em> com uma action: <em>index</em>, ter&aacute; a view main/index.php.</p>
<p>No Code Igniter ter&iacute;amos que fazer tudo manualmente, j&aacute; que n&atilde;o h&aacute; como definir um layout que ser&aacute; carregado em cada view, nem esse carregamento autom&aacute;tico.</p>
<p>Pelo menos n&atilde;o havia... <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Criei um pequeno hook que faz esse servi&ccedil;o. Crie seu controller como abaixo:</p>
<div class="igBar"><span id="lphp-13"><a href="#" onclick="javascript:showPlainTxt('php-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-13">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Main extends Controller <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#000000; font-weight:bold;">function</span> Main<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; parent::<span style="color:#006600;">Controller</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#000000; font-weight:bold;">function</span> index<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">data</span>-&gt;<span style="color:#006600;">foo</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'main_table'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#000000; font-weight:bold;">function</span> show<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">data</span>-&gt;<span style="color:#006600;">foo</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">db</span>-&gt;<span style="color:#006600;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'another_table'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Voc&ecirc; pode definir manualmente a view e o layout da seguinte forma:</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">view</span> = <span style="color:#FF0000;">'main/index'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">layout</span> = <span style="color:#FF0000;">'popup'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>E ao acessar as duas actions a view <em>main/index.php</em> ser&aacute; chamada com os valores definidos na vari&aacute;vel <em>$this->data</em>. Tamb&eacute;m ser&aacute; carregado o layout <em>application/views/layouts/default.php</em> na fun&ccedil;&atilde;o index e <em>application/views/layouts/popup.php</em> na fun&ccedil;&atilde;o show.</p>
<h4>Download</h4>
<p>Fa&ccedil;a o <a href="http://felipediesel.net/dl/ci_layout.tar.gz">download da hook</a> ou <a href="http://felipediesel.net/dl/ci_layout_app.tar.gz">de uma aplica&ccedil;&atilde;o de exemplo (CI 1.6.2)</a>.</p>
<h4>Instala&ccedil;&atilde;o</h4>
<p>Para utilizar este hook, copie o arquivo Layout.php dentro da pasta <em>application/hooks/</em>,  defina a op&ccedil;&atilde;o <em>$config['hooks']</em> com <em>true</em> no config e adicione o seguinte no arquivo application/config/hook.php:</p>
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showPlainTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$hook</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'post_controller'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF0000;">'class'</span>&nbsp; &nbsp; =&gt; <span style="color:#FF0000;">'Layout'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF0000;">'function'</span> =&gt; <span style="color:#FF0000;">'view'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF0000;">'filename'</span> =&gt; <span style="color:#FF0000;">'Layout.php'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF0000;">'filepath'</span> =&gt; <span style="color:#FF0000;">'hooks'</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#FF0000;">'params'</span>&nbsp; &nbsp;=&gt; <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Espero que goste tanto de utilizar isto quanto eu. Me salva algumas linhas de c&oacute;digo.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/utilizando-layouts-no-codeigniter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cortando e redimensionando imagens com o CodeIgniter</title>
		<link>http://felipediesel.net/blog/cortando-e-redimensionando-imagens-com-o-codeigniter/</link>
		<comments>http://felipediesel.net/blog/cortando-e-redimensionando-imagens-com-o-codeigniter/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 16:42:39 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[desenvolvimento]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/?p=76</guid>
		<description><![CDATA[Eu sei que n&#227;o tenho aparecido muito por aqui, mas o desenvolvimento da nova vers&#227;o do SiGA est&#225; tomando todo tempo imagin&#225;vel e tive que priorizar aquilo, pois o prazo j&#225; est&#225; estourando. Mas n&#227;o &#233; sobre isso que quero escrever.
Recentemente precisei de imagens quadradas num projeto e esse mesmo procedimento se repetiria v&#225;rias vezes, [...]]]></description>
			<content:encoded><![CDATA[<p>Eu sei que n&atilde;o tenho aparecido muito por aqui, mas <a href="http://www.sigasw.com.br/blog/um-novo-siga-para-2008/">o desenvolvimento da nova vers&atilde;o</a> do <a href="http://sigasw.com.br">SiGA</a> est&aacute; tomando todo tempo imagin&aacute;vel e tive que priorizar aquilo, pois o prazo j&aacute; est&aacute; estourando. Mas n&atilde;o &eacute; sobre isso que quero escrever.</p>
<p>Recentemente precisei de imagens quadradas num projeto e esse mesmo procedimento se repetiria v&aacute;rias vezes, ent&atilde;o criei esta extens&atilde;o da Biblioteca Image_lib que j&aacute; vem com o <a href="http://codeigniter.com">CodeIgniter</a>. Na verdade o c&oacute;digo serve n&atilde;o s&oacute; para imagens quadradas, j&aacute; que o tamanho tem que ser definido literalmente.</p>
<p>Cole o c&oacute;digo abaixo na pasta application/library com o nome MY_Image_lib.php:</p>
<div class="igBar"><span id="lphp-17"><a href="#" onclick="javascript:showPlainTxt('php-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-17">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> MY_Image_lib extends CI_Image_lib <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">/**</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * Crop and resize a image</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> * @return bool</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;"> */</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> crop_and_resize<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$width</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$height</span> = <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">height</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$size</span> = <a href="http://www.php.net/getimagesize"><span style="color:#000066;">getimagesize</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">source_folder</span> . <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">source_image</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>&gt; <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">width</span> =&nbsp; <span style="color:#0000FF;">$width</span> / <span style="color:#0000FF;">$height</span> * <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">height</span> = <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">width</span> = <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">height</span> =&nbsp; <span style="color:#0000FF;">$height</span> / <span style="color:#0000FF;">$width</span> * <span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">x_axis</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> - <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">width</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#CC66CC;color:#800000;">2</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">y_axis</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$size</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> - <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">height</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#CC66CC;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">crop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">width</span> = <span style="color:#0000FF;">$width</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">height</span> = <span style="color:#0000FF;">$height</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span> ! <span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">resize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">false</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">return</span> <span style="color:#000000; font-weight:bold;">true</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Pra usar &eacute; muito f&aacute;cil:</p>
<div class="igBar"><span id="lphp-18"><a href="#" onclick="javascript:showPlainTxt('php-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-18">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$config</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">'source_image'</span> =&gt; <span style="color:#FF0000;">'/path/para/a/imagem.jpg'</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">'maintain_ratio'</span> =&gt; <span style="color:#000000; font-weight:bold;">false</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">'width'</span> =&gt; <span style="color:#CC66CC;color:#800000;">48</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">'height'</span> =&gt; <span style="color:#CC66CC;color:#800000;">48</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">load</span>-&gt;<span style="color:#006600;">library</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'image_lib'</span>, <span style="color:#0000FF;">$config</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$this</span>-&gt;<span style="color:#006600;">image_lib</span>-&gt;<span style="color:#006600;">crop_and_resize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>E temos uma imagem como a mostrada abaixo:</p>
<p style="text-align:center"><img class="size-full wp-image-77" title="Imagem de exemplo" src="http://felipediesel.net/blog/wp-content/uploads/2008/04/exemplo_crop_and_resize.jpg" alt="" width="48" height="48" /></p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/cortando-e-redimensionando-imagens-com-o-codeigniter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Escritório de Verdade</title>
		<link>http://felipediesel.net/blog/escritorio-de-verdade/</link>
		<comments>http://felipediesel.net/blog/escritorio-de-verdade/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 15:22:56 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[Negócios]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/escritorio-de-verdade/</guid>
		<description><![CDATA[Tenho acompanhado o blog Office Snapshots e o recomendo sem pestanejar, mas algo que eu achava estranho era que todos os escrit&#243;rios sempre eram arrumados de mais, sem extens&#245;es e cabos de rede pelo ch&#227;o e tudo muito padronizado.
Pelo que vi n&#227;o fui s&#243; eu que estranhei isso, pois foram publicadas fotos do escrit&#243;rio da [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://felipediesel.net/blog/wp-content/uploads/2008/02/grooveshark_logo.jpg" alt="Grooveshark" align="right" />Tenho acompanhado o blog <a href="http://www.officesnapshots.com">Office Snapshots</a> e o recomendo sem pestanejar, mas algo que eu achava estranho era que todos os escrit&oacute;rios sempre eram arrumados de mais, sem extens&otilde;es e cabos de rede pelo ch&atilde;o e tudo muito padronizado.</p>
<p>Pelo que vi n&atilde;o fui s&oacute; eu que estranhei isso, pois <a href="http://www.officesnapshots.com/2008/02/05/grooveshark-offices/">foram publicadas fotos do escrit&oacute;rio</a> da <a href="http://www.grooveshark.com/">Grrovershark</a>.</p>
<p>N&atilde;o que eu ache melhor os escrit&oacute;rios serem bagun&ccedil;ados, mas o custo de se montar um escrit&oacute;rio todo personalizado &eacute; muito alto. Por&eacute;m acho que vale a pena conferir todos, por que sempre podemos pegar uma ou outra id&eacute;ia para melhorar o ambiente onde trabalhamos.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/escritorio-de-verdade/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tema novo</title>
		<link>http://felipediesel.net/blog/tema-novo/</link>
		<comments>http://felipediesel.net/blog/tema-novo/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 04:12:16 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/tema-novo/</guid>
		<description><![CDATA[Finalmente, depois de um ano e pouco e v&#225;rias tentivas de temas fiz um que acabei e gostei. O tema ainda est&#225; bem cru, pois j&#225; s&#227;o 2 horas e comecei ontem as 17h (total de 9 horas). Isso que ainda dei um tempo no meio.  
Deixei o tema mais limpo, com layout l&#237;quido [...]]]></description>
			<content:encoded><![CDATA[<p>Finalmente, depois de um ano e pouco e v&aacute;rias tentivas de temas fiz um que acabei e gostei. O tema ainda est&aacute; bem cru, pois j&aacute; s&atilde;o 2 horas e comecei ontem as 17h (total de 9 horas). Isso que ainda dei um tempo no meio. <img src='http://felipediesel.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Deixei o tema mais limpo, com layout l&iacute;quido e removi todos os restos de AdSense. Deve estar com v&aacute;rios furos, se achar algum, por favor me avise. O que achou?</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/tema-novo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CodeIgniter em PHP5 ou PHP4?</title>
		<link>http://felipediesel.net/blog/codeigniter-em-php5-ou-php4/</link>
		<comments>http://felipediesel.net/blog/codeigniter-em-php5-ou-php4/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 19:36:28 +0000</pubDate>
		<dc:creator>Felipe Diesel</dc:creator>
		
		<category><![CDATA[CodeIgniter]]></category>

		<category><![CDATA[desenvolvimento]]></category>

		<guid isPermaLink="false">http://felipediesel.net/blog/codeigniter-em-php5-ou-php4/</guid>
		<description><![CDATA[Recentemente tem havido bastante discuss&#227;o sobre o por que de o CodeIgniter n&#227;o partir apenas para o PHP5, mas n&#227;o entendo isso, j&#225; que um dos grandes motivos que me levou a ter interesse por esse framework foi por ele suportar o PHP4. Entendo e concordo que o PHP5 &#233; muito superior, poder trabalhar apenas [...]]]></description>
			<content:encoded><![CDATA[<p>Recentemente tem havido bastante <a href="http://boo-box.com/link/aff:jacoteiid/uid:2288/tags:discuss%C3%A3o" rel="external" target="_blank" class="bbli" title="Compare pre&ccedil;os de discuss&atilde;o no J&aacute;Cotei" >discuss&atilde;o<img src="http://boo-box.com/bbli" alt="[bb]" class="bbic" /></a> sobre o por que de o <a href="http://codeigniter.com">CodeIgniter</a> n&atilde;o partir apenas para o PHP5, mas n&atilde;o entendo isso, j&aacute; que um dos grandes motivos que me levou a ter interesse por esse <a href="http://boo-box.com/link/aff:jacoteiid/uid:2288/tags:framework" rel="external" target="_blank" class="bbli" title="Compare pre&ccedil;os de framework no J&aacute;Cotei" >framework<img src="http://boo-box.com/bbli" alt="[bb]" class="bbic" /></a> foi por ele suportar o PHP4. Entendo e concordo que o PHP5 &eacute; muito superior, poder trabalhar apenas com OO &eacute; muito melhor, mas existem dois grandes problemas que travam a ado&ccedil;&atilde;o ao PHP5.</p>
<p>Quem nunca teve que fazer um site pra hospedar num servidor com PHP4 e MySQL 3.23? (E olha que uma das maiores empresas de <a href="http://boo-box.com/link/aff:jacoteiid/uid:2288/tags:hospedagem" rel="external" target="_blank" class="bbli" title="Compare pre&ccedil;os de hospedagem no J&aacute;Cotei" >hospedagem<img src="http://boo-box.com/bbli" alt="[bb]" class="bbic" /></a> do Brasil tem uma configura&ccedil;&atilde;o parecida com essa! Qual &eacute; a sua?) Por mais que os desenvolvedores do <a href="http://boo-box.com/link/aff:jacoteiid/uid:2288/tags:PHP" rel="external" target="_blank" class="bbli" title="Compare pre&ccedil;os de PHP no J&aacute;Cotei" >PHP<img src="http://boo-box.com/bbli" alt="[bb]" class="bbic" /></a> fa&ccedil;am campanha de ado&ccedil;&atilde;o do PHP5, que o PHPmyAdmin prometa que as pr&oacute;ximas vers&otilde;es apenas ser&atilde;o pra PHP5, isso N&Atilde;O vai mudar. As hospedagens ainda s&atilde;o PHP4 e ado&ccedil;&atilde;o ao PHP5 &eacute; lenta (cerca de 1% ao m&ecirc;s).</p>
<p>Outro fator &eacute; que infelizmente a maioria dos desenvolvedores s&atilde;o med&iacute;ocres. N&atilde;o est&atilde;o nem um pouco preocupados com MVC, OO, <a href="http://boo-box.com/link/aff:jacoteiid/uid:2288/tags:padr%C3%B5es+web" rel="external" target="_blank" class="bbli" title="Compare pre&ccedil;os de padr&otilde;es web no J&aacute;Cotei" >padr&otilde;es web<img src="http://boo-box.com/bbli" alt="[bb]" class="bbic" /></a> e tudo mais. E isso acaba influenciando as hospedagens, que tem medo de quebrar os c&oacute;digos de seus clientes. N&atilde;o que eu me considere um grande programador, mas isso &eacute; o que todos tinham que ter como base (ou pelo menos vontade de aprender).</p>
<p>Voltando ao CodeIgniter, o <a href="http://www.derekallard.com/">Derek Allard</a>, um dos desenvolvedores do CodeIgniter, j&aacute; disse que o PHP4 ser&aacute; suportado por <a href="http://www.derekallard.com/blog/post/codeigniter-will-not-be-dropping-support-for-php-4-anytime-soon/">bastante tempo ainda</a>, justamente por isso. N&atilde;o adianta querermos impor algo, quando n&atilde;o temos meios para for&ccedil;ar.</p>
<p>N&atilde;o quero de maneira nenhuma defender os hosts que n&atilde;o fazem upgrades, muito menos a "sobrinhada", mas acho que as vezes esquecemos que vivemos em mundo que n&atilde;o &eacute; perfeito, que por mais que queiramos que as coisas sejam &oacute;timas, elas apenas podem ser t&atilde;o boas quanto poss&iacute;vel.</p>
]]></content:encoded>
			<wfw:commentRss>http://felipediesel.net/blog/codeigniter-em-php5-ou-php4/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
