<?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>cObaia.net &#187; php</title>
	<atom:link href="http://cobaia.net/categorias/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://cobaia.net</link>
	<description>PHP, Javascript and some code around it!</description>
	<lastBuildDate>Sun, 29 Jan 2012 03:56:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Forget the evil C of MVC inside the CakePHP</title>
		<link>http://cobaia.net/2012/01/forget-the-evil-c-of-mvc-inside-the-cakephp/</link>
		<comments>http://cobaia.net/2012/01/forget-the-evil-c-of-mvc-inside-the-cakephp/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 03:56:40 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=823</guid>
		<description><![CDATA[CakePHP is great, I love this framework, it&#8217;s really fast to develop and it&#8217;s possible to maintain a great code inside this framework, I like the rules that CakePHP impose, I like that CakePHP is an obstructive framework, it makes easy to training the team, and put new members inside the team, and to everyone keep one [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP is great, I love this framework, it&#8217;s really fast to develop and it&#8217;s possible to maintain a great code inside this framework, I like the rules that CakePHP impose, I like that CakePHP is an obstructive framework, it makes easy to training the team, and put new members inside the team, and to everyone keep one standard.</p>
<p>BUT, one problem that comes not just with CakePHP but with several frameworks, is the usage of the Model. it&#8217;s not really a problem, but I think that is the way that people learned MVC with the framework, and the way that we see the Controller.</p>
<p>Frameworks, such as CakePHP, Rails and so on, impose that Model is database access (not really, but they come with this access).</p>
<p>Is that wrong? NOT really wrong&#8230;</p>
<p>As the fact that normally your application will need to save data into one database, or filesystem, etc&#8230; So provide one database access inside our model probably will help us.</p>
<h3>What is the problem?</h3>
<p>The problem comes when you see your model as JUST one database access layer, see the model as the thing that will store our data. So we start write the system logic inside the Controller, and this Controller starts to grow, because it already has several roles in our application, it handle the request, it handle the input, it call the model, it call the view&#8230; and it also get an additional role that is have the system logic. So our controller get FAT, hard to maintain, hard to change, hard to test, hard to change. It start to has the action methods, some other private/protected methods to implement logic, and it get ugly, strange, BIG.</p>
<h3>What about our model?</h3>
<p>The model keep thin, with no methods, no logic, just with the relationships of our database, with the validation&#8230; does it seems strange for you?</p>
<p><strong>So what hell we are not using our model?</strong></p>
<p>YES, we should use our model to make the logic of the system, is that the M of our application, is what Model must be, and is what the Model is expecting.</p>
<h3>How we can start use our model as the logic part of our applications?</h3>
<ol>
<li>STOPING to see the Model as your database access;</li>
<li>Writing methods inside our models;</li>
<li>Creating models without usage of database;</li>
<li>Making the models talks each other;</li>
<li>Importing libraries, objects inside or model;</li>
<li>Creating one API inside or models, to make easy the calls for the controllers;</li>
<li>Make your controllers as  much thin as possible.</li>
</ol>
<h3>What will be your gains?</h3>
<ol>
<li>You will probably have more freedom to make your logic;</li>
<li>Your code will be more simple to maintain;</li>
<li>It&#8217;s simple to write test for Models;</li>
<li>You will have a better OO structure of your logic;</li>
<li>You will start think different about Behaviors, Components in CakePHP;</li>
<li>Your controller will be thin, and make just what he should do, nothing else;</li>
<li>You will stop rewrite code, the model can be called in any controller that you want;</li>
<li>With a good structure of logic, it will be so much easy to upgrade your code to new versions of  the framework, or why not, migrate to another framework, as the fact that your logic system will not depends more of the features that CakePHP has.</li>
</ol>
<p>To summarize, CakePHP is great, it has great tools to make our development fast, but what we can not do is misunderstand the MVC, and starts to be addict with bad practices.  Frameworks like Zend make it more simple to understand, because it not provides directly in the model one database access, BUT anyway in CakePHP we can make the thing correct too, and get everything good of the framework.</p>
<p>So the idea behind the post is not forget the Controller, but pay much more attention in your Model.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2012/01/forget-the-evil-c-of-mvc-inside-the-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attach: CakePHP 2 Upload Plugin / Behavior</title>
		<link>http://cobaia.net/2012/01/attach-cakephp-2-upload-plugin-behavior/</link>
		<comments>http://cobaia.net/2012/01/attach-cakephp-2-upload-plugin-behavior/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 16:39:58 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=819</guid>
		<description><![CDATA[Hi I&#8217;m here to promote a new plugin to upload in CakePHP, the Attach plugin, that is based on MeioUpload, but it&#8217;s a bit different, he makes use of new Model API of CakePHP 2, where we have support to define own validations and use the Behavior as the method of validate, and also some [...]]]></description>
			<content:encoded><![CDATA[<p>Hi</p>
<p>I&#8217;m here to promote a new plugin to upload in CakePHP, the <a href="https://github.com/krolow/Attach">Attach plugin</a>, that is based on <a href="https://github.com/jrbasso/MeioUpload">MeioUpload</a>, but it&#8217;s a bit different, he makes use of new Model API of CakePHP 2, where we have support to define own validations and use the Behavior as the method of validate, and also some new things.</p>
<p>A big difference is the use of <a href="https://github.com/avalanche123/Imagine">Imagine Lib</a>, to make the thumbnails, that gives a lot of features to manipulate images.</p>
<p>The plugin also implements polymorphic models, so we have one model/table that handles/store all the files, and your custom models have association with this Attachment model.</p>
<p>It&#8217;s really simple to use I hope you guys enjoy the plugin any improvement or feedback are welcome, and you are able to fork it.</p>
<p>Currently the plugin is in his first version, and improvements will be done in the API of the plugin also in the code.</p>
<p>Git: <a href="https://github.com/krolow/Attach">https://github.com/krolow/Attach</a></p>
<p>* In the github we have the description of how it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2012/01/attach-cakephp-2-upload-plugin-behavior/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Conrad Caine is looking for a Trainee Backend Developer</title>
		<link>http://cobaia.net/2011/12/conrad-caine-is-looking-for-a-trainee-backend-developer/</link>
		<comments>http://cobaia.net/2011/12/conrad-caine-is-looking-for-a-trainee-backend-developer/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 10:26:36 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=816</guid>
		<description><![CDATA[Your task Support in the maintenance of existing projects Study the development practices of our Backend Team Get working knowledge in different Content Management Systems and PHP Frameworks Support Lead Developer in getting things done Support small projects in cooperation with project managers Learn how to be a pragmatic developer Learn and code a lot [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Your task</strong></p>
<ul>
<li>Support in the maintenance of existing projects</li>
<li>Study the development practices of our Backend Team</li>
<li>Get working knowledge in different Content Management Systems and PHP Frameworks</li>
<li>Support Lead Developer in getting things done</li>
<li>Support small projects in cooperation with project managers</li>
<li>Learn how to be a pragmatic developer</li>
<li>Learn and code a lot of cool stuff (Node.js, MongoDB, CouchDB, Ruby, C++, Arduino)</li>
</ul>
<div><strong>Required soft skill and experience</strong></div>
<ul>
<li>First experience with Code Editors</li>
<li>Experience with Versioning Systems (CVS, SVN, GIT)</li>
<li>Demonstration of self-reliance and responsibility in your work, taking a goal-oriented approach to projects</li>
<li>Attention to detail and high-quality standards</li>
<li>Pro-active behavior</li>
<li>Good communication skills</li>
<li>Responsibility</li>
<li>Ability to be self-taught</li>
<li>Fast-learning</li>
<li>Ability to work under pressure</li>
<li>Ability to accept and learn from criticism</li>
<li>Willingness to work alternate shifts</li>
<li>Will for experimentation and innovation</li>
<li>Ability to identify, prevent and resolve imminent problems</li>
<li>Willingness to understand technologies beyond your working knowledge</li>
<li>Ability to work in a team with a positive attitude</li>
<li>Excitement about current tasks and motivation to take on future challenges</li>
<li>First English skills</li>
</ul>
<p>CONRAD CAINE is looking for smart programmers who are willing to join our pragmatic Backend team. If you are looking for a great company to grow professionally and personally, our team is your place. Here you will find a very open and friendly working environment and many challenges to overcome. Became a part of our great team now.</p>
<p>Please send an online application in Portuguese or English to <a href="mailto:jobs.pelotas@conrad-caine.com">jobs.pelotas@conrad-caine.com</a></p>
<p>More open jobs available at <a href="http://www.conrad-caine.com/jobs.html">Conrad Caine website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2011/12/conrad-caine-is-looking-for-a-trainee-backend-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vaga para Programador Backend Conrad Caine</title>
		<link>http://cobaia.net/2011/09/vaga-para-programador-backend-conrad-caine/</link>
		<comments>http://cobaia.net/2011/09/vaga-para-programador-backend-conrad-caine/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 23:44:35 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=765</guid>
		<description><![CDATA[A CONRAD CAINE, agência digital com escritórios em Munich, Pelotas e Buenos Aires procura programador backend para integrar a equipe de Pelotas-RS. Responsabilidades - Desenvoler sistemas e sites para web; - Manutenção em sistemas e sites existentes; - Desenvolver utilizando as melhores técnicas de programação; - Estruturar códigos e banco de dados; - Escrever código [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://conrad-caine.com">CONRAD CAINE</a>, agência digital com escritórios em Munich, Pelotas e Buenos Aires procura programador backend para integrar a equipe de Pelotas-RS.</p>
<p><strong>Responsabilidades</strong></p>
<p>- Desenvoler sistemas e sites para web;<br />
- Manutenção em sistemas e sites existentes;<br />
- Desenvolver utilizando as melhores técnicas de programação;<br />
- Estruturar códigos e banco de dados;<br />
- Escrever código limpo e bem organizado;<br />
- Capacidade de lidar com desafios e novas tecnologias diaramente.</p>
<p><strong>Qualificações</strong><br />
- Dominío de uma ou mais linguages de programação;<br />
- Dominío de programação orientada a objetos;<br />
- Facilidade na adptação com novas tecnologias;<br />
- Responsável com o projeto/produto a ser desenvolvida;<br />
- Dominío de banco de dados;<br />
- Pró-ativo e autodidata;<br />
- Rápido na solução de bugs;<br />
- Habilidade para entregar estimativas corretas;<br />
- Inglês intermediário/avançado;<br />
- Experiência com desenvolvimento WEB;<br />
- Experiência com CakePHP;<br />
- Experiência com .NET.</p>
<p>Currículos devem ser enviados para <a href="mailto:vkrolow@conrad-caine.com?subject=Programador Backend">vkrolow@conrad-caine.com</a>, com o título &#8220;Programador Backend&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2011/09/vaga-para-programador-backend-conrad-caine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom var_dump in xdebug with PHP it&#8217;s not working</title>
		<link>http://cobaia.net/2011/03/custom-var_dump-in-xdebug-with-php-itsnot-working/</link>
		<comments>http://cobaia.net/2011/03/custom-var_dump-in-xdebug-with-php-itsnot-working/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 19:35:03 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=747</guid>
		<description><![CDATA[If the custom var_dump of xdebug, it&#8217;s not working in your PHP config, check the php.ini file and search for the html_errors, turn it off, and it&#8217;s done. This happened at the ubuntu 10.10 with the php 5.3 version. To install the xdebug: sudo apt-get install php5-dev php5-xdebug]]></description>
			<content:encoded><![CDATA[<p>If the custom var_dump of xdebug, it&#8217;s not working in your PHP config, check the php.ini file and search for the <code>html_errors</code>, turn it off, and it&#8217;s done.</p>
<p>This happened at the ubuntu 10.10 with the php 5.3 version. To install the xdebug: </p>
<p><code><br />
sudo apt-get install php5-dev php5-xdebug<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2011/03/custom-var_dump-in-xdebug-with-php-itsnot-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pimcore: PHP CMS that you must know!</title>
		<link>http://cobaia.net/2011/03/pimcore-php-cms-that-you-must-know/</link>
		<comments>http://cobaia.net/2011/03/pimcore-php-cms-that-you-must-know/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 14:01:45 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pimcore]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=737</guid>
		<description><![CDATA[Pimcore is not just another CMS, forget about Drupal, WordPress (kind of CMS), Typo3, Joomla or some others CMS. Think about a robust solution for your websites and a simple way to create types of contents, regions to be editable, to administrate files and at last but not at least with a great framework at [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.pimcore.org/">Pimcore</a> is not just another CMS, forget about Drupal, WordPress (kind of CMS), Typo3, Joomla or some others CMS. Think about a robust solution for your websites and a simple way to create types of contents, regions to be editable, to administrate files and at last but not at least with a great framework at backside the <a href="http://framework.zend.com/">Zend Framework</a>.  I&#8217;m just delighted with the power of this CMS, a complex, powerful and great solution with a great interface and code, that becomes so simple to do the things.  You have to put a simple way to your client update his site, pimcore provide this:</p>
<p><iframe src="http://player.vimeo.com/video/10850668" width="400" height="225" frameborder="0"></iframe>
<p><a href="http://vimeo.com/10850668">Working with Documents</a> from <a href="http://vimeo.com/pimcore">pimcore</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>But your client also wanna administrate some PDF files, yep no problem for pimcore:</p>
<p><iframe src="http://player.vimeo.com/video/18374836" width="400" height="225" frameborder="0"></iframe>
<p><a href="http://vimeo.com/18374836">pimcore web2print</a> from <a href="http://vimeo.com/pimcore">pimcore</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>You have to create some dynamic contents, for example a news system, ok no problem for you Pimcore will provide for you a friendly interface where you haven&#8217;t to code to create  one admin interface to create the news system for your client: </p>
<p><img src="http://www.pimcore.org/website/var/tmp/thumb_48__lightbox.png" alt="" width="307" height="130" /><br />
<br />
<a href="http://www.pimcore.org/products-and-solutions/web-content-management/objects">see more</a> We need one good file administration, yep they know, and they have a good one:  </p>
<p><img src="http://www.pimcore.org/website/var/tmp/thumb_65__lightbox.png" alt="" width="482" height="228" /><br />
<br />
In the end you ask but this works well, they answer this for you too with a <a href="http://www.pimcore.org/showcase">showcase</a>.  I&#8217;m so impress with this CMS, it&#8217;s not normal i like something as much I liked this CMS, I&#8217;d like to congrats the team of <a href="http://www.pimcore.org/">pimcore</a>, for this so great tool.<br />
<br />
You can check some videos in their user at vimeo: <a href="http://vimeo.com/pimcore">http://vimeo.com/pimcore</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2011/03/pimcore-php-cms-that-you-must-know/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP list the data from the last 30 days using MySQL or PHP</title>
		<link>http://cobaia.net/2010/10/cakephp-list-the-data-from-the-last-30-days-using-mysql-or-php/</link>
		<comments>http://cobaia.net/2010/10/cakephp-list-the-data-from-the-last-30-days-using-mysql-or-php/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 16:38:05 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=701</guid>
		<description><![CDATA[Some friend mine asked me a long time ago how he could made a select to show a list of posts from the last 30 days using MySQL, and yesterday I also needed something like this and so I guess maybe other people want do the same and there is a simple way using natives [...]]]></description>
			<content:encoded><![CDATA[<p>Some friend mine asked me a long time ago how he could made a select to show a list of posts from the last 30 days using MySQL, and yesterday I also needed something like this and so I guess maybe other people want do the same and there is a simple way using natives functions from MySQL, that also work properly with <a href="http://cakephp.org">CakePHP</a>.</p>
<p>Let&#8217;s go to the code:</p>
<p>So if you wanna retrieve a data from the last 30 days, or the last 15 days you can use the follow code:</p>

<div class="wp_codebox"><table><tr id="p7015"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p701code5"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> posts <span style="color: #993333; font-weight: bold;">WHERE</span> date <span style="color: #66cc66;">&gt;=</span> DATE_SUB<span style="color: #66cc66;">&#40;</span>CURDATE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> INTERVAL <span style="color: #cc66cc;">30</span> DAY<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> date <span style="color: #993333; font-weight: bold;">DESC</span>;</pre></td></tr></table></div>

<p>OR</p>

<div class="wp_codebox"><table><tr id="p7016"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p701code6"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">FROM</span> posts <span style="color: #993333; font-weight: bold;">WHERE</span> date <span style="color: #66cc66;">&gt;=</span> DATE_SUB<span style="color: #66cc66;">&#40;</span>CURDATE<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> INTERVAL <span style="color: #cc66cc;">15</span> DAY<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> date <span style="color: #993333; font-weight: bold;">DESC</span>;</pre></td></tr></table></div>

<p>So there is a function <a href="http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-sub">DATE_SUB</a> that makes the work for us, in resume DATE_SUB subtract a time value (interval) from a date, so we set the current date and subtract the interval that we want.</p>
<p><strong>To use the code in the CakePHP it&#8217;s simple:</strong></p>

<div class="wp_codebox"><table><tr id="p7017"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p701code7"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post.date &gt;= DATE_SUB(CURDATE(), INTERVAL 15 DAY)'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>For others databases or also in the MySQL you can do the same with PHP code, so you just need subtract the time using PHP and pass it as a condition, for that we have the function <a href="http://php.net/manual/en/function.strtotime.php">strtotime</a>.</p>

<div class="wp_codebox"><table><tr id="p7018"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p701code8"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$date</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/strtotime"><span style="color: #990000;">strtotime</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-30 day&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'conditions'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post.date &gt;='</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$date</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2010/10/cakephp-list-the-data-from-the-last-30-days-using-mysql-or-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cobaia Cake: A different Aggregator for CakePHP</title>
		<link>http://cobaia.net/2010/10/cobaia-cake-a-different-aggregator-for-cakephp/</link>
		<comments>http://cobaia.net/2010/10/cobaia-cake-a-different-aggregator-for-cakephp/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 00:42:25 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[pessoal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=695</guid>
		<description><![CDATA[I&#8217;d like to show the new aggregator for CakePHP, the idea arose from the fact that keeps up to date with news of some topic nowadays is hard, there are a lot of information in many places, and to try it, we need access a lot of websites to try get all the informations, but that have a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to show the new aggregator for <a href="http://cake.cobaia.net">CakePHP</a>, the idea arose from the fact that keeps up to date with news of some topic nowadays is hard, there are a lot of information in many places, and to try it, we need access a lot of websites to try get all the informations, but that have a big cost, because time is cost.</p>
<p>Thinking about it I like the idea of crawlers that looking for specifics kind of subjects, and give for me all information that I want in just one place, and so there is one new website/crawler that I put it to public, is the <a href="http://cake.cobaia.net">Cake Cobaia</a>, there will show informations of some sites that I guess are pertinent that talk about CakePHP, using social websites like informations about CakePHP in Twitter, also videos that talk about CakePHP and photos about CakePHP.</p>
<p>The aggregator show a limited number of information in the first page and it&#8217;s possible filter by types, Twitter, Web, Youtube, Flickr&#8230; I want in the future also create a filter by time etc&#8230;</p>
<p>I&#8217;m open for any suggestions about the project and I&#8217;d like receive some feedback, and I hope you enjoy it.</p>
<p><a href="http://cake.cobaia.net">http://cake.cobaia.net</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2010/10/cobaia-cake-a-different-aggregator-for-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Top funny source code comments</title>
		<link>http://cobaia.net/2010/09/top-funny-source-code-comments/</link>
		<comments>http://cobaia.net/2010/09/top-funny-source-code-comments/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 17:49:44 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programação]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=684</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 9 10 11 12 13 14 /* * OK; before you read the following code know what I am trying to do. * I needed to get the list of child catagories from the root node so that * the root node didn't appear in the selection [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p68431"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p684code31"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
 * OK; before you read the following code know what I am trying to do.
 * I needed to get the list of child catagories from the root node so that
 * the root node didn't appear in the selection box. But for some stupid
 * fucking reason the stupid fucking DBA wont let me access the items using
 * indices and I instead have to use their stupid fucking Iterator
 * implementation. So there.
 */</span>
<span style="color: #000088;">$firstList</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRootNode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getChildren</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$firstList</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$node</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$nodes</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$node</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getChildren</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>                <span style="color: #666666; font-style: italic;">// wtf?</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68432"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code32"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// if i ever see this again i'm going to start bringing guns to work</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68433"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code33"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//hack for ie browser (assuming that ie is a browser)</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68434"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p684code34"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68435"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p684code35"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// </span>
<span style="color: #006600; font-style: italic;">// Dear maintainer:</span>
<span style="color: #006600; font-style: italic;">// </span>
<span style="color: #006600; font-style: italic;">// Once you are done trying to 'optimize' this routine,</span>
<span style="color: #006600; font-style: italic;">// and have realized what a terrible mistake that was,</span>
<span style="color: #006600; font-style: italic;">// please increment the following counter as a warning</span>
<span style="color: #006600; font-style: italic;">// to the next guy:</span>
<span style="color: #006600; font-style: italic;">// </span>
<span style="color: #006600; font-style: italic;">// total_hours_wasted_here = 16</span>
<span style="color: #006600; font-style: italic;">//</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68436"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code36"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// TODO: Fix this. Fix what?</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68437"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p684code37"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// no comments for you</span>
<span style="color: #006600; font-style: italic;">// it was hard to write</span>
<span style="color: #006600; font-style: italic;">// so it should be hard to read</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68438"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code38"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// I will give you two of my seventy-two virgins if you can fix this.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68439"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code39"><pre class="javascript" style="font-family:monospace;">options.<span style="color: #660066;">BatchSize</span> <span style="color: #339933;">=</span> <span style="color: #CC0000;">300</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Madness? THIS IS SPARTA!</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68440"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p684code40"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// I am not responsible of this code.</span>
<span style="color: #006600; font-style: italic;">// They made me write it, against my will.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68441"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p684code41"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Dear future me. Please forgive me.</span>
<span style="color: #006600; font-style: italic;">//I can't even begin to express how sorry I am.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68442"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code42"><pre class="java" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">double</span> penetration<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// ouch</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68443"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code43"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># To understand recursion, see the bottom of this file.</span></pre></td></tr></table></div>

<p>At the bottom file:</p>

<div class="wp_codebox"><table><tr id="p68444"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code44"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># To understand recursion, see the top of this file.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68445"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code45"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//I am not sure why this works but it fixes the problem.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68446"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p684code46"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//somedev1 - 6/7/02 Adding temporary tracking of Logic screen</span>
<span style="color: #006600; font-style: italic;">//somedev2 - 5/22/07 Temporary my ass</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68447"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p684code47"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/*
 * You may think you know what the following code does.
 * But you dont. Trust me
 * Fiddle with me, and youll spend many a sleppless
 * night cursing the moment you thought you be clever 
 * enough to &quot;optimize&quot; the code below.
 * Now close this file and go play with something else.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68448"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code48"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// drunk, fix later</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68449"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p684code49"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Magic. Do not touch.</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68450"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p684code50"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// I dedicate all this code, all my work, to my wife, Darlene, who will</span>
<span style="color: #006600; font-style: italic;">// have to support me and our three children and the dog once it gets</span>
<span style="color: #006600; font-style: italic;">// released into the public</span></pre></td></tr></table></div>

<p></p>

<div class="wp_codebox"><table><tr id="p68451"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p684code51"><pre class="java" style="font-family:monospace;"><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a> up <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Exception</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Something is really wrong.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">throw</span> up<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//ha ha</span></pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p68452"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p684code52"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//When I wrote this, only God and I understood that I was doing</span>
<span style="color: #006600; font-style: italic;">//Now, God only knows</span></pre></td></tr></table></div>

<p>Some more <a href="http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2010/09/top-funny-source-code-comments/feed/</wfw:commentRss>
		<slash:comments>126</slash:comments>
		</item>
		<item>
		<title>Test-Driven Development with CakePHP 1.3 TDD</title>
		<link>http://cobaia.net/2010/09/test-driven-development-with-cakephp-1-3-tdd/</link>
		<comments>http://cobaia.net/2010/09/test-driven-development-with-cakephp-1-3-tdd/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 20:25:12 +0000</pubDate>
		<dc:creator>Vinícius Krolow</dc:creator>
				<category><![CDATA[cakephp]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://cobaia.net/?p=676</guid>
		<description><![CDATA[Today I found a good article about TDD, Test Driven Development using CakePHP 1.3. Nowadays with the constantly changes of scope in one web project the TDD is something that all programmer must know and practice, and some frameworks like the CakePHP give the support for that. In a recently article for the php architect [...]]]></description>
			<content:encoded><![CDATA[<p>Today I found a good article about TDD, Test Driven Development using <a href="http://cakephp.org">CakePHP</a> 1.3. Nowadays with the constantly changes of scope in one web project the TDD is something that all programmer must know and practice, and some frameworks like the CakePHP give the support for that.</p>
<p>In a recently article for the php architect magazine, <a href="http://www.phparch.com/author/canderson/">Carl Anderson</a> describe a great article how to use the TDD inside the CakePHP 1.3.</p>
<p>You can <a href="http://www.phparch.com/files/2010/08/PHPA-AUG-10-cakephp.pdf">download</a> that tutorial by free <a href="http://www.phparch.com/files/2010/08/PHPA-AUG-10-cakephp.pdf">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cobaia.net/2010/09/test-driven-development-with-cakephp-1-3-tdd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

