<?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>iamdave</title>
	<atom:link href="http://i.amdave.com/feed" rel="self" type="application/rss+xml" />
	<link>http://i.amdave.com</link>
	<description>Mostly Code, Some Other Stuff Too</description>
	<lastBuildDate>Mon, 08 Mar 2010 22:11:07 +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>The Mate Framework &#8211; ZendAMF &#8211; Adobe Flex</title>
		<link>http://i.amdave.com/archives/61</link>
		<comments>http://i.amdave.com/archives/61#comments</comments>
		<pubDate>Tue, 02 Mar 2010 21:59:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mate]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[AMF]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[ZendAmf]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=61</guid>
		<description><![CDATA[I have been working on a few eLearning flex apps for the last few months, and after some tests and experiments I settled on the Mate Framework for Flex &#8211; http://mate.asfusion.com/.  After a short learning curve, I have found Mate to be excellent and especially easy to implement on any project in a very short [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a few eLearning flex apps for the last few months, and after some tests and experiments I settled on the <a title="Mate" href="http://mate.asfusion.com/" target="_blank">Mate Framework for Flex &#8211; http://mate.asfusion.com/</a>.  After a short learning curve, I have found Mate to be excellent and especially easy to implement on any project in a very short amount of time.  So I will begin a series of Posts on Mate, mostly because good example are not easy to come by with the framework (which may be its only negative).</p>
<p>I have been using exclusively with<a title="Zend AMF" href="http://framework.zend.com/download/amf" target="_blank"> Zend AMF</a> for class mapping and speedy server communication, So I will also be including some examples, although this won&#8217;t be my main focus.</p>
<p>Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/61/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex 3 Modules -&gt; What are they for?</title>
		<link>http://i.amdave.com/archives/59</link>
		<comments>http://i.amdave.com/archives/59#comments</comments>
		<pubDate>Fri, 18 Dec 2009 19:43:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=59</guid>
		<description><![CDATA[In a recent project, I attempted to implement a flex interface to an e-learning application.  The basics of the application are as follows:

Video game style e-learning application for a medical school.
Administrative game scenario builder and cms

I thought I would use Flex Modules:


Main Application &#8211; handles authentication and main navigation

Admin Module

 Users Admin Module
 Foo Admin [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent project, I attempted to implement a flex interface to an e-learning application.  The basics of the application are as follows:</p>
<ol>
<li>Video game style e-learning application for a medical school.</li>
<li>Administrative game scenario builder and cms</li>
</ol>
<p>I thought I would use Flex Modules:</p>
<ol>
<blockquote>
<li>Main Application &#8211; handles authentication and main navigation
<ol>
<li>Admin Module
<ol>
<li> Users Admin Module</li>
<li> Foo Admin Module</li>
<li>Bar Admin Module</li>
</ol>
</li>
<li>Game Module</li>
</ol>
</li>
</blockquote>
</ol>
<p>This seemed logical today.  I could load the modules and unload them as needed.  This way I could have one application and all the resources available, but never loading all the overhead unless I needed it.  That way, if I just looked on to do the Game, I would only use those resources and not have all the memory being used by the admin features.<br />
I was wrong.  Modules do not work that way.  You can not load a module that registers any events, or many other common memory allocating tasks, and unload them to release the memory.  Flex holds onto many instances which cause a number of problems, many of which are outlined here:  <a href="http://blogs.adobe.com/aharui/2009/08/what_we_know_about_unloading_m.html" target="_blank">Alexs Flex Closet</a>.</p>
<p>Furthermore, If you try to use a class in a loaded module that hasn&#8217;t been registered by the main application, you must go to the main application and register it, otherwise you get an error on things like Lists, ComboBoxes.  This is not a lot of additional work but, to me, doesn&#8217;t seem like the way a module should work.</p>
<p>If I can&#8217;t load and unload modules without incurring memory leaks or errors, what good are modules.</p>
<p>Adobe, please fix this.  It is far more important than all the time/money you are spending making Data Intensive Web Apps accessible for Designers.  Just make it work for developers first, PLEASE, or we will find another technology to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/59/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: Routes Basics</title>
		<link>http://i.amdave.com/archives/43</link>
		<comments>http://i.amdave.com/archives/43#comments</comments>
		<pubDate>Tue, 10 Nov 2009 16:24:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=43</guid>
		<description><![CDATA[**NOTE** I have recently found a much cooler way of doing this &#8211; please read this also: http://v3.kohanaphp.com/guide/tutorials.urls .
I have found the routing in Kohana to be one of the most helpful and easiest features with wich to work.  In this tutorial I will show you how to use Routes to organize your Public site [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff9900;">**NOTE** I have recently found a much cooler way of doing this &#8211; please read this also: <a title="kohana guide" href="http://v3.kohanaphp.com/guide/tutorials.urls" target="_blank">http://v3.kohanaphp.com/guide/tutorials.urls</a> .</span></p>
<p>I have found the routing in Kohana to be one of the most helpful and easiest features with wich to work.  In this tutorial I will show you how to use Routes to organize your Public site with your Back-End or Admin section of your site.</p>
<p><strong>Step 1 :  Controllers</strong></p>
<p>To help us organize our Admin and Public Controllers we create two folders:</p>
<ol>
<li>application/classes/controller/admin</li>
<li>application/classes/controller/public</li>
</ol>
<p>Using this folder structure will determine your class names, for example an Admin Users Controller like this:</p>
<div style="background-color: #eeeeee;"><code><br />
class Controller_Admin_Users extends Controller_Template<br />
{<br />
/// class code<br />
}</code></div>
<p>To access this controller you would need a url like:   <em>www.mysite.com/admin_users/login</em></p>
<p>but who wants that ugly thing.  It would be much nicer to have :  <em>www.mysite.com/admin/users</em></p>
<p>and we can easily achieve that with Routes.</p>
<p><strong>Step 2</strong></p>
<p>Open the file application/boostrap.php and look for the Route section, which should have something like this:</p>
<div style="background-color: #eeeeee;"><code><br />
Route::set('default', '(&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;)))')<br />
-&gt;defaults(array(<br />
'controller' =&gt; 'welcome',<br />
'action'     =&gt; 'index',<br />
));</code></div>
<p>This is the default route, so we are going to leave it alone for now and place all of our other Routes above it.</p>
<p><strong>Step 3</strong></p>
<p>We need to create and initial route for the <strong>admin home or welcome page</strong>. For this example, I&#8217;ll use a <strong>Home Controller</strong> located at  <em>application/classes/controller/admin/home.php</em>.  That is where I want people to go when they type  <em>www.mysite.com/admin</em>.  I do this by adding this route:</p>
<div style="background-color: #eeeeee;"><code>Route::set('admin', 'admin')<br />
-&gt;defaults(array(<br />
'controller' =&gt; 'admin_home',<br />
'action'     =&gt; 'index',<br />
));</code></div>
<p><strong>Step 4</strong></p>
<p>When someone simply trys to access the root of the site (<em>www.mysite.com</em>), I want them to go to the public home controller located at <em>application/classes/controller/public/home.php</em>.  So I just modify the Route that was there when I first intalled Kohana to this:</p>
<div style="background-color: #eeeeee;"><code>Route::set('default', '(&lt;controller&gt;(/&lt;action&gt;(/&lt;id&gt;)))')<br />
-&gt;defaults(array(<br />
'controller' =&gt; 'public_home',<br />
'action'     =&gt; 'index',<br />
));</code></div>
<p><strong>Step 5</strong></p>
<p>Now I want to add a route for that Admin Users controller located at application/classes/controller/admin/users.php, but I want that controller to have other Actions than just the index action, and I want to pass a variable in the url, so I simple do this:</p>
<div style="background-color: #eeeeee;"><code>Route::set('admin/users', 'admin/users(/&lt;action&gt;(/&lt;id&gt;))')<br />
-&gt;defaults(array(<br />
'controller' =&gt; 'admin_users',<br />
'action'     =&gt; 'index',<br />
));</code></div>
<p>And in that you have a model to build the rest of your controllers on..</p>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/43/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: Custom 404 Page</title>
		<link>http://i.amdave.com/archives/32</link>
		<comments>http://i.amdave.com/archives/32#comments</comments>
		<pubDate>Wed, 28 Oct 2009 17:02:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=32</guid>
		<description><![CDATA[A best practice for a web app/site in &#8220;production&#8221; is have an error page that looks like its part of your website &#8211; kind of a friendly error page.  With Kohana v3 this is fairly easy to do, and only requires one new file, and a modification to one other file.
Note: This solution was [...]]]></description>
			<content:encoded><![CDATA[<p>A best practice for a web app/site in &#8220;production&#8221; is have an error page that looks like its part of your website &#8211; kind of a friendly error page.  With Kohana v3 this is fairly easy to do, and only requires one new file, and a modification to one other file.</p>
<p><em>Note: This solution was found in the <a href="http://forum.kohanaphp.com/comments.php?DiscussionID=3754" target="_blank">Kohana Forums.</a></em><br />
<strong></strong></p>
<p><strong>Step 1 : application/boostrap.php</strong></p>
<p>Define &#8216;IN_PRODUCTION&#8217; in the Environment Setup Section</p>
<div style="background-color:#eeeeee; padding:10px;"><code><br />
define('IN_PRODUCTION', true);<br />
</code></div>
<p>Catch the Exception coming from any invalid Request</p>
<p>After you define all your Routes, Kohana executes the request, sends the headers and renders the view.  If you haven&#8217;t already made changes, it looks like this:</p>
<div style="background-color:#eeeeee; padding:10px;"><code><br />
echo Request::instance()<br />
-&gt;execute()<br />
-&gt;send_headers()<br />
-&gt;response;<br />
</code></div>
<p>Here is the replacement you should make, with comments to explain:</p>
<div style="background-color:#eeeeee; padding:10px;"><code>// Instantiate your Request object<br />
$request = Request::instance();<br />
// The give it a try, to see if its a valid request<br />
try<br />
{<br />
$request-&gt;execute();<br />
}<br />
catch (Exception $e)  // if its not valid, it gets caught here<br />
{<br />
if (! IN_PRODUCTION)  // if this is Development, its displays the error<br />
{<br />
throw $e;<br />
}<br />
// if its IN_PRODUCTION, it does the following:<br />
// Logs the error<br />
Kohana::$log-&gt;add(Kohana::ERROR, Kohana::exception_text($e));<br />
// Marks the status as 404<br />
$request-&gt;status = 404;<br />
// Renders the View for your CUSTOM 404 of your choice<br />
$request-&gt;response = View::factory('public/templates/main') //your view may be different<br />
-&gt;set('title', '404')<br />
-&gt;set('content', View::factory('errors/404'));  //again, your view may be different<br />
}<br />
// then continues on with the request process to display your custom 404 page<br />
$request-&gt;send_headers()-&gt;response;<br />
echo $request-&gt;response;</code></div>
<p><strong>Step 2 : Create A Custom Error View</strong></p>
<p>Create a new folder in your views folder called &#8220;Kohana&#8221;</p>
<p>Create a file in that folder called &#8220;error.php&#8221;</p>
<p>Whatever you put in your application/views/Kohana/error.php file will take precedents over Kohana&#8217;s views/Kohana/error.php file, so this is where I styled my error page to look like the rest of my public application.  I copied much of the error reporting code directly from Kohana&#8217;s error file and used a conditional to display it in development or display a friendlier message in production.  See the code skeleton:</p>
<div style="background-color:#eeeeee; padding:10px;"><code><br />
if (IN_PRODUCTION) ///defined in boostrap.php<br />
/* Render your friendly error message */<br />
else<br />
/* Render Kohana's error which you copied from views/Kohana/error.php */<br />
</code></div>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/32/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: URL Redirect</title>
		<link>http://i.amdave.com/archives/30</link>
		<comments>http://i.amdave.com/archives/30#comments</comments>
		<pubDate>Tue, 20 Oct 2009 22:11:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=30</guid>
		<description><![CDATA[To perform a simple redirect in v3, all you have to do is:

Request::instance()->redirect('/foo/bar/1');

]]></description>
			<content:encoded><![CDATA[<p>To perform a simple redirect in v3, all you have to do is:</p>
<div style="background-color:#eeeeee; padding:10px;">
<code>Request::instance()->redirect('/foo/bar/1');</code>
</div>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/30/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: Godaddy &amp; Megahosters</title>
		<link>http://i.amdave.com/archives/26</link>
		<comments>http://i.amdave.com/archives/26#comments</comments>
		<pubDate>Wed, 14 Oct 2009 04:00:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Godaddy]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=26</guid>
		<description><![CDATA[I have the opportunity (or problem, depending on my mood) to work with a diverse group of clients and many of the small business owners have hosting accounts with Godaddy, and one with Megahosters.  Unlike most developers, I actually don&#8217;t mind godaddy so much, but, thats another post.
The point of this post is that [...]]]></description>
			<content:encoded><![CDATA[<p>I have the opportunity (or problem, depending on my mood) to work with a diverse group of clients and many of the small business owners have hosting accounts with Godaddy, and one with Megahosters.  Unlike most developers, I actually don&#8217;t mind godaddy so much, but, thats another post.<br />
The point of this post is that I had to figure out how to get Kohana v3 working on Godaddy and Megahosters, so I thought I would pass the solution along</p>
<ol>
<li>Note:  I am installing Kohana at the root of the domain in booth cases</li>
<li>/.htaccess files
<ul>
<li>Godaddy
<div style="background-color:#eeeeee"><code><br />
# Turn on URL rewriting<br />
RewriteEngine On<br />
# Installation directory<br />
RewriteBase /<br />
# Protect application and system files from being viewed<br />
RewriteRule ^(application|modules|system) - [F,L]<br />
# Allow any files or directories that exist to be displayed directly<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
# Rewrite all other URLs to index.php/URL<br />
RewriteRule ^(.+)$ index.php?kohana_uri=$1 [L]</code></div>
</li>
<li>Megahosters
<div style="background-color:#eeeeee"><code><br />
AddHandler application/x-httpd-php5 .php<br />
# Turn on URL rewriting<br />
RewriteEngine On<br />
# Installation directory<br />
RewriteBase /<br />
# Protect application and system files from being viewed<br />
RewriteRule ^(application|modules|system)/ - [F,L]<br />
# Allow any files or directories that exist to be displayed directly<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
# Rewrite all other URLs to index.php/URL<br />
RewriteRule ^(.+)$ index.php?kohana_uri=$1 [L]</code></div>
</li>
</ul>
</li>
<li>/application/boostrap.php
<div>At the bottom of the bootstrap file, after the routing, is the execution statement.  By default it looks like this:</p>
<div style="background-color:#eeeeee;"><code><br />
echo Request::instance()<br />
-&gt;execute()<br />
-&gt;send_headers()<br />
-&gt;response;<br />
</code></div>
<p>Basically, you can pass an array when you instantiate the Request, but if you don&#8217;t (defualt), Kohana will use some <em>If / Else</em> statements to see which node of the $_SERVER array contains the request information.  This works fine on most servers, but on shared servers like Godaddy/Megahosters, the first $_SERVER node (PATH_INFO) checked sends bad information, so to fix it, you just need to pass the Request the correct node.  For both Godaddy and Megahosters, its the same:  REQUEST_URI.  So here is how it should look:</p>
<div style="background-color:#eeeeee;"><code><br />
echo Request::instance($_SERVER['REQUEST_URI'])<br />
-&gt;execute()<br />
-&gt;send_headers()<br />
-&gt;response;<br />
</code></div>
</div>
</li>
</ol>
<p>HOPE THIS HELPS!</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 582px; width: 1px; height: 1px;">AddHandler application/x-httpd-php5 .php</p>
<p># Turn on URL rewriting<br />
RewriteEngine On</p>
<p># Installation directory<br />
RewriteBase /</p>
<p># Protect application and system files from being viewed<br />
RewriteRule ^(application|modules|system)/ &#8211; [F,L]</p>
<p># Allow any files or directories that exist to be displayed directly<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d</p>
<p># Rewrite all other URLs to index.php/URL<br />
RewriteRule ^(.+)$ index.php?kohana_uri=$1 [L]</p></div>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/26/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: Auth Module</title>
		<link>http://i.amdave.com/archives/19</link>
		<comments>http://i.amdave.com/archives/19#comments</comments>
		<pubDate>Tue, 13 Oct 2009 02:42:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=19</guid>
		<description><![CDATA[I was just about to throw my monitor across the room when I finally got the Auth Module working:

IMPORTANT &#8211; do not use the complete v3 download from the main Kohana site (It simply doesn&#8217;t work that way), instead git the project, the core, and all the modules individually from github: http://github.com/kohana.
Note that the ORM [...]]]></description>
			<content:encoded><![CDATA[<p>I was just about to throw my monitor across the room when I finally got the Auth Module working:</p>
<ol>
<li>IMPORTANT &#8211; do not use the complete v3 download from the main Kohana site (It simply doesn&#8217;t work that way), instead git the project, the core, and all the modules individually from github: <a title="Kohana Github" href="http://github.com/kohana" target="_blank">http://github.com/kohana</a>.</li>
<li>Note that the ORM and Auth Modules have been forked and have their own repositories, but the links are the main Kohana git page</li>
<li>Create the necessary database tables (MySql):<br />
<code style="background-color:#cccccc">CREATE TABLE IF NOT EXISTS `roles` (<br />
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,<br />
`name` varchar(32) NOT NULL,<br />
`description` varchar(255) NOT NULL,<br />
PRIMARY KEY  (`id`),<br />
UNIQUE KEY `uniq_name` (`name`)<br />
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;<br />
INSERT INTO `roles` (`id`, `name`, `description`) VALUES(1, 'login', 'Login privileges, granted after account confirmation');<br />
INSERT INTO `roles` (`id`, `name`, `description`) VALUES(2, 'admin', 'Administrative user, has access to everything.');CREATE TABLE IF NOT EXISTS `roles_users` (<br />
`user_id` int(10) UNSIGNED NOT NULL,<br />
`role_id` int(10) UNSIGNED NOT NULL,<br />
PRIMARY KEY  (`user_id`,`role_id`),<br />
KEY `fk_role_id` (`role_id`)<br />
) ENGINE=InnoDB DEFAULT CHARSET=utf8;<br />
CREATE TABLE IF NOT EXISTS `users` (<br />
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,<br />
`email` varchar(127) NOT NULL,<br />
`username` varchar(32) NOT NULL DEFAULT '',<br />
`password` varchar(255) NOT NULL,<br />
`logins` int(10) UNSIGNED NOT NULL DEFAULT '0',<br />
`last_login` int(10) UNSIGNED,<br />
PRIMARY KEY  (`id`),<br />
UNIQUE KEY `uniq_username` (`username`),<br />
UNIQUE KEY `uniq_email` (`email`)<br />
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;<br />
CREATE TABLE IF NOT EXISTS `user_tokens` (<br />
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,<br />
`user_id` int(11) UNSIGNED NOT NULL,<br />
`user_agent` varchar(40) NOT NULL,<br />
`token` varchar(32) NOT NULL,<br />
`created` int(10) UNSIGNED NOT NULL,<br />
`expires` int(10) UNSIGNED NOT NULL,<br />
PRIMARY KEY  (`id`),<br />
UNIQUE KEY `uniq_token` (`token`),<br />
KEY `fk_user_id` (`user_id`)<br />
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;<br />
ALTER TABLE `roles_users`<br />
ADD CONSTRAINT `roles_users_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,<br />
ADD CONSTRAINT `roles_users_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;<br />
ALTER TABLE `user_tokens`<br />
ADD CONSTRAINT `user_tokens_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;<br />
</code></li>
<li>The only database change I made is to change the User.password field to varchar 255 to allow for large hashed passwords.</li>
<li>Ensure that your database is configured correctly &#8211; per my previous post on Kohana&#8217;s Database Session.</li>
<li>Then follow the tutorial on the Wiki for the Auth fork git repository: <a title="Kohana Auth Github" href="http://wiki.github.com/biakaveron/kohana-auth" target="_blank">http://wiki.github.com/biakaveron/kohana-auth</a>.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/19/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana v3 :: Session Database Driver</title>
		<link>http://i.amdave.com/archives/15</link>
		<comments>http://i.amdave.com/archives/15#comments</comments>
		<pubDate>Mon, 12 Oct 2009 02:08:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://i.amdave.com/?p=15</guid>
		<description><![CDATA[I was having a little trouble getting the session to work while using the database driver (instead of the Native or Cookie drivers), but I eventually found the error.  I was using the sessions table  MySql create statement from Kohana 2.3 documentation, which is slightly different from the required table for 3.0.  [...]]]></description>
			<content:encoded><![CDATA[<p>I was having a little trouble getting the session to work while using the database driver (instead of the Native or Cookie drivers), but I eventually found the error.  I was using the sessions table  MySql create statement from Kohana 2.3 documentation, which is slightly different from the required table for 3.0.  So here is a brief tutorial in using the Session with the database driver.</p>
<ol>
<li>create the sessions database table (mysql example):<br />
<code style="background-color:#cccccc">CREATE TABLE `sessions` (<br />
`session_id` varchar(127) NOT NULL,<br />
`last_active` int(10) unsigned NOT NULL,<br />
`contents` text NOT NULL,<br />
PRIMARY KEY  (`session_id`)<br />
) ENGINE=MyISAM DEFAULT CHARSET=latin1;</code></li>
<li>In the bootstrap.php file, uncomment the line for the database module</li>
<li>Copy the <em>/modules/database/config/database.php</em> file to <em>/application/config/database.php</em> and fill in the appropriate database connection variables</li>
<li>to test, create a controller action and run it:<br />
<code style="background-color:#cccccc"> public function action_set()<br />
{<br />
$session = Session::instance('database');<br />
$session-&gt;set('foo', 'hello from the session db');<br />
}<br />
</code></li>
<li>then retrieve the session data in another controller action and run it:<br />
<code style="background-color:#cccccc"> public function action_get()<br />
{<br />
$session = Session::instance('database');<br />
$data = $session-&gt;get('foo');<br />
echo Kohana::debug($data);<br />
}<br />
</code></li>
<li>You should be greated with our session string:   &#8216;hello from the session db&#8217;</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana v3</title>
		<link>http://i.amdave.com/archives/1</link>
		<comments>http://i.amdave.com/archives/1#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:58:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http:/?p=1</guid>
		<description><![CDATA[For the past year I have been building all of my web applications with Kohana in their 2.x branch.  With the release of version 3 (http://v3.kohanaphp.com), I will be delving into the new code for a new CMS based website for a big client of mine.  So, I thought that I would use this opportunity [...]]]></description>
			<content:encoded><![CDATA[<p>For the past year I have been building all of my web applications with Kohana in their 2.x branch.  With the release of version 3 (<a title="Kohana v3" href="http://v3.kohanaphp.com" target="_blank">http://v3.kohanaphp.com</a>), I will be delving into the new code for a new CMS based website for a big client of mine.  So, I thought that I would use this opportunity to blog about my learnings/progress with Kohana v3 and its new features, especially because there aren&#8217;t any tutorials yet on the subject.  So stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://i.amdave.com/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
