2010-04-15 3:09 pm class, flash, helper and Kohana
So I wrote my own:
<?php
/*
* Flash message helper class
*/
class Helper_Flashmessage {
/*
* @author Anthony Wlodarski <aw@sfp8.com>
* @return null
*/
public static function setFlashMessage($type=\'generic\', $message = null)
{
if($message != null)
{
Session::instance()->set("messages", array_merge(Session::instance()->get(\'messages\'), array($type=>array(time()=>$message))));
}
}
/*
* @author Anthony Wlodarski <aw@sfp8.com>
* @return array of messages in the system
*/
public static function getFlashMessages()
{
return Session::instance()->get(\'messages\');
}
/*
* @author Anthony Wlodarski <aw@sfp8.com>
* @return null
*/
public static function resetMessages()
{
Session::instance()->set("messages", array(\'errors\'=>array(), \'general\'=>array()));
}
}
?>
So I had to do some UI/UA editing today on a user registration system. I decided to break the form up into a multi part step as to not overwhelm the user with just one page and a lot of input fields. The problem with this was how do I implement buttons at the bottom of each tab as having to click the next tab my be intuitive to all users. I broke out the jQuery documentation and came up with the following code as an example:
<script type="text/javascript">
var $currentTab = 0;
$(function () {
$tabs = $("#tabs").tabs({
select: function(event, ui) { $currentTab = ui.index; }
});
/* Bind button click events */
$('button[name=nextStep]').click(function(){
$currentTab = $currentTab + 1;
$tabs.tabs('select', $currentTab);
return false;
});
$('button[name=prevStep]').click(function(){
$currentTab = $currentTab - 1;
$tabs.tabs('select', $currentTab);
return false;
});
});
</script>
All tabs indexed by jQuery start at zero (as like any array in computers science). What this will do is bind a click event to the two buttons in the tab to select the previous or next tab if applicable. All you have to do is add the appropriate mark-up in your html as so:
<button id="prevStep" name="prevStep" >Previous Step</button>
<button id="nextStep" name="nextStep" >Next Step</button>
The 'select' even handler in the tabs configuration makes sure that if the user clicks a tab instead of a button we still update the $currentTab index.
Being a novice myself at generating SSH key pairs I found this link: http://principialabs.com/beginning-ssh-on-ubuntu/#comment-220. It gently explains the public/private key types and has a quick five minute run through of what you need. A definite good read.
Today I just picked up a second book from David Gemmell, just got done reading Stormrider and was amazed with his writing style.

I cannot wait to start reading it!
Since I found Twitter as useful as the hair on the back of my hand, I decided to delete my account. I was hoping Twitter had a better data policy when it comes to account deletion but I guess not. Apparently they hold onto your information for as long as they choose to:

Here is the problem - If a user asks to delete their information, just delete it. There is no reason to hold onto it. If I requested to have my information deleted then you better make sure that you have no identifiable traces of it. There should be no reason that my personally identifiable information should be kept on your server(s).
I consider the technical team over at twitter to be smart individuals but I guess they got the database query wrong when they were trying to figure out how to delete user accounts, here is a freebie twitter, I will not charge you my consultant fee:
DELETE FROM users WHERE users.username = 'foobar';
OR
DELETE FROM users WHERE users.id = 123456789;
Not hard things to do, hell you can even throw in a REFERENCE from a foreign key and have it delete all the tweets, images and everything else associated with the user. Walk the plank!