<?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>Braindead1.de</title>
	<atom:link href="http://braindead1.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://braindead1.de</link>
	<description>My personal web home</description>
	<lastBuildDate>Tue, 02 Feb 2010 07:18:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sending an email to more than one address using the Email Component</title>
		<link>http://braindead1.de/2010/02/02/sending-an-email-to-more-than-one-address-using-the-email-component/</link>
		<comments>http://braindead1.de/2010/02/02/sending-an-email-to-more-than-one-address-using-the-email-component/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 06:53:45 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=134</guid>
		<description><![CDATA[It took me some time to figure out how to send an email to more than one email address using the CakePHP Email Component. I&#8217;ll share my findings, maybe this will save somebodys time.
According to the cookbook the &#8220;to&#8221; variable only accepts a string, which is different to the &#8220;cc&#8221; and &#8220;bcc&#8221; variable. Both accept [...]]]></description>
			<content:encoded><![CDATA[<p>It took me some time to figure out how to send an email to more than one email address using the <a title="Email Component" href="http://book.cakephp.org/view/176/Email">CakePHP Email Component</a>. I&#8217;ll share my findings, maybe this will save somebodys time.</p>
<p>According to the cookbook the &#8220;to&#8221; variable only accepts a string, which is different to the &#8220;cc&#8221; and &#8220;bcc&#8221; variable. Both accept an array. To send an email to more than one address you have to sepearate the email addresses using a comma, which is pretty annoying as it is not documented.</p>
<p>I&#8217;ll open a ticket in <a title="CakePHP Issue Tracker" href="http://cakephp.lighthouseapp.com">Lighthouse</a> to make the &#8220;to&#8221; variable also accept an array.</p>
<p><strong>Update:</strong> I opened a new Lighhouse <a title="Lighhouse ticket" href="http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/tickets/293-email-component-should-accept-an-array">ticket</a> and also made a <a href="http://book.cakephp.org/view/270/Class-Attributes-and-Variables">contribution</a> to the cookbook to document this behavior.</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2010/02/02/sending-an-email-to-more-than-one-address-using-the-email-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set the layout from a view</title>
		<link>http://braindead1.de/2009/12/01/how-to-set-the-layout-from-a-view/</link>
		<comments>http://braindead1.de/2009/12/01/how-to-set-the-layout-from-a-view/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 07:02:52 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=126</guid>
		<description><![CDATA[A few minutes ago I came across a blog post by Jeremy Burns where he describes how to render different layouts depending on the controller. Although his solution is correct, there is an even better solution that follows the MVC concept.
You can set the layout inside your view. All you have to do is adding [...]]]></description>
			<content:encoded><![CDATA[<p>A few minutes ago I came across a blog post by <a title="CakePHP: Setting $layout for a page" href="http://www.jeremy-burns.co.uk/2009/10/cakephp-setting-layout-for-a-page/" target="_self">Jeremy Burns</a> where he describes how to render different layouts depending on the controller. Although his solution is correct, there is an even better solution that follows the MVC concept.</p>
<p>You can set the layout inside your view. All you have to do is adding the following code:</p>
<pre>&lt;?php
    $this-&gt;layout = 'your_layout';
?&gt;</pre>
<p>It&#8217;s easy, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/12/01/how-to-set-the-layout-from-a-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File upload validation</title>
		<link>http://braindead1.de/2009/07/14/file-upload-validation/</link>
		<comments>http://braindead1.de/2009/07/14/file-upload-validation/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 09:45:28 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=101</guid>
		<description><![CDATA[Data validation is one of the easiest things in CakePHP as long as you can use the build-in validation rules. But at the moment there is no build-in rule to validate uploaded files. Today I will show you how to implement a custom validation rule and validate uploads.]]></description>
			<content:encoded><![CDATA[<p>Data validation is one of the easiest things in CakePHP as long as you can use the build-in validation rules. But at the moment there is no build-in rule to validate uploaded files. Today I will show you how to implement a custom validation rule and validate uploads.</p>
<h3>Step 1: The custom validation function</h3>
<p>To make the validation function available to all your models, you have to put it into your AppModel.</p>
<p>The function is designed to accept jpg, gif and png file extensions, but you can easily add other extensions in your model. Also the user is not forced to upload a file.</p>
<p>Filename: app/app_model.php</p>
<pre>&lt;?php
class AppModel extends Model {
    function validFile($check, $settings) {
        $_default = array(
            'allowEmpty' =&gt; true,
            'extensions' =&gt; array(
                0 =&gt; 'jpg',
                1 =&gt; 'jpeg',
                2 =&gt; 'gif',
                4 =&gt; 'png'
            )
        );

        $_settings = array_merge(
            $_default,
            ife(
                is_array($settings),
                $settings,
                array()
            )
        );

        // Remove first level of Array
        $_check = array_shift($check);

        if($_settings['allowEmpty'] == false &amp;&amp; $_check['size'] == 0) {
            return true;
        }

        // No file uploaded.
        if($_settings['allowEmpty'] &amp;&amp; $_check['size'] == 0) {
            return false;
        }

        // Check for Basic PHP file errors.
        if($_check['error'] !== 0) {
            return false;
        }

        // Use PHPs own file validation method.
        if(is_uploaded_file($_check['tmp_name']) == false) {
            return false;
        }

        // Use CakePHPs build-in rule to validate the extension
        return Validation::extension(
            $_check,
            $_settings['extensions']
        );
    }
}
?&gt;</pre>
<h3>Step 2: Create the validation rule in your model</h3>
<p>Now we are ready to use the rule in our model. As an example we will validate the user picture in our User model. We will only accept jpg files and force the user to upload an image.</p>
<p>Filename: app/models/user.php</p>
<pre>&lt;?php
class User extends AppModel {
    var $name = 'User';

    var $validate = array(
        'user_picture' =&gt; array(
            'rule' =&gt; array(
                'validFile',
                array(
                    'allowEmpty' =&gt; false,
                    'extensions' =&gt; array(
                        0 =&gt; 'jpg',
                        1 =&gt; 'jpeg'
                    )
                )
            ),
            'error' =&gt; 'You have to upload a jpg file.'
        )
    );
}
?&gt;</pre>
<h3>Step 3:</h3>
<p>After implementing the validation rule we are ready to build the code to move the uploaded file to the corresponding folder. But I will leave this up to you. ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/07/14/file-upload-validation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing a MySQL database from latin1 to utf8</title>
		<link>http://braindead1.de/2009/06/17/changing-a-mysql-database-from-latin1-to-utf8/</link>
		<comments>http://braindead1.de/2009/06/17/changing-a-mysql-database-from-latin1-to-utf8/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 05:45:43 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=85</guid>
		<description><![CDATA[Yesterday I found a solution on the german site administrator.de to quickly change a whole MySQL database from latin1 (latin1_general_ci) to utf8 (utf8_general_ci).
ALTER DATABASE `database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table1` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table2` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table3` CONVERT TO CHARACTER SET [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I found a solution on the german site administrator.de to quickly <a title="Change a MySQL database from latin1 to utf8" href="http://www.administrator.de/index.php?content=53604">change a whole MySQL database from latin1 (latin1_general_ci) to utf8 (utf8_general_ci)</a>.</p>
<pre><code>ALTER DATABASE `database` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table1` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table2` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `table3` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;</code></pre>
<p>After running the above SQL script, the whole database including all (text) fields are converted to utf8.</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/06/17/changing-a-mysql-database-from-latin1-to-utf8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a TinyMCE image browser the CakePHP way</title>
		<link>http://braindead1.de/2009/05/30/adding-a-tinymce-image-browser-the-cakephp-way/</link>
		<comments>http://braindead1.de/2009/05/30/adding-a-tinymce-image-browser-the-cakephp-way/#comments</comments>
		<pubDate>Sat, 30 May 2009 19:32:00 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=76</guid>
		<description><![CDATA[My first article at the Bakery is online now and available for everybody: Adding a TinyMCE imagebrowser the CakePHP way. I first needed to make my article a little bit more compliant to the CakePHP conventions, but then the article was approved.
As promised I made a small demo available for download. Just post a comment [...]]]></description>
			<content:encoded><![CDATA[<p>My first article at the <a title="The Bakery, Everything CakePHP" href="http://bakery.cakephp.org">Bakery</a> is online now and available for everybody: <a title="Adding a TinyMCE image browser the CakePHP way" href="http://bakery.cakephp.org/articles/view/adding-a-tinymce-image-browser-the-cakephp-way">Adding a TinyMCE imagebrowser the CakePHP way</a>. I first needed to make my article a little bit more compliant to the CakePHP conventions, but then the article was approved.</p>
<p>As promised I made a small demo available for <a title="TinyMCE image browser demo" href="http://braindead1.de/wp-content/uploads/2009/05/tinymce_image_browser.zip">download</a>. Just post a comment in case you need some help with the demo.</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/05/30/adding-a-tinymce-image-browser-the-cakephp-way/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>First article at the Bakery published</title>
		<link>http://braindead1.de/2009/05/27/first-article-at-the-bakery-published/</link>
		<comments>http://braindead1.de/2009/05/27/first-article-at-the-bakery-published/#comments</comments>
		<pubDate>Wed, 27 May 2009 05:14:44 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://braindead1.de/?p=71</guid>
		<description><![CDATA[Yesterday I published my first CakePHP tutorial at the Bakery. The article is called Adding a TinyMCE image browser the CakePHP way and is about, well &#8230; adding an image browser to your TinyMCE installation. :-)
Before my article is available to the CakePHP community, someone from the CakePHP team has to review the article and [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I published my first CakePHP tutorial at the<a title="The Bakery, Everything CakePHP" href="http://bakery.cakephp.org"> Bakery</a>. The article is called <em>Adding a TinyMCE image browser the CakePHP</em> way and is about, well &#8230; adding an image browser to your <a title="TinyMCE - Javascript WYSIWYG Editor" href="http://tinymce.moxiecode.com/">TinyMCE</a> installation. :-)</p>
<p>Before my article is available to the CakePHP community, someone from the CakePHP team has to review the article and then approve it. I don&#8217;t know how long it takes, but as I&#8217;m a little bit excited, I hope that the approval is done in the next few days.</p>
<p>Shortly after the approval is done, I&#8217;ll build a tiny demo and make it available for download on my blog.</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/05/27/first-article-at-the-bakery-published/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello again!</title>
		<link>http://braindead1.de/2009/05/25/hello-again/</link>
		<comments>http://braindead1.de/2009/05/25/hello-again/#comments</comments>
		<pubDate>Mon, 25 May 2009 19:46:38 +0000</pubDate>
		<dc:creator>Braindead</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=36</guid>
		<description><![CDATA[After not posting anything to my blog for nearly one year, I decided to make a cut, redesign braindead1.de and start blogging again.
Mainly my new posts will be about my experiences with CakePHP. I hope that some of my posts will be of such a value to anybody as other postings of the CakePHP community [...]]]></description>
			<content:encoded><![CDATA[<p>After not posting anything to my blog for nearly one year, I decided to make a cut, redesign <em>braindead1.de</em> and start blogging again.</p>
<p>Mainly my new posts will be about my experiences with <a href="http://cakephp.org">CakePHP</a>. I hope that some of my posts will be of such a value to anybody as other postings of the CakePHP community are to me. That&#8217;s the reason, why I start to blog in English. So please be patient with me, if my English is sometimes a little bit broken. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://braindead1.de/2009/05/25/hello-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

