Blog I've always got something to say...
Try Messages Beta for OS X Now
February
Friday
17
Download Messages Beta and get a taste of what’s coming in OS X Mountain Lion. When you install Messages, it replaces iChat. But iChat services will continue to work. And Messages brings iMessage to the Mac — just like on iPad, iPhone, and iPod touch running iOS 5. Here are the features you can expect with Messages:
- Send unlimited iMessages to any Mac, iPad, iPhone, or iPod touch.
- Start an iMessage conversation on your Mac and continue it on your iPad, iPhone, or iPod touch.
- Send photos, videos, attachments, contacts, locations, and more.
- Launch a FaceTime video call and bring the conversation face-to-face.
- Messages supports iMessage, AIM, Yahoo!, Google Talk, and Jabber accounts.
PHP Twitter OAuth Library
September
Thursday
22
Anyone looking for a quick, easy and well documented Twitter OAuth Library, I have to recommend tmhOAuth by Matt Harris.
After creating an App at Twitter and successful authorisation, I was posting tweets within minutes. The library requires CURL and hash_hmac, but your host should be providing this as standard.
Oh, and it's hosted at GitHub too. Enough said!
Firefox 6 with 1Password
August
Wednesday
17
For those of you whose lives depend on the the great application 1Password, you may have noticed that if your primary browser is Firefox, and you upgraded to the latest recent version 6, then the 1Password extension stopped working.
Thankfully, the great folk at Agile have already released an update/replacement extension, and normal service has ben resumed!
Here's the link to the extension.
CodeIgniter Controller Names with Dashes
June
Friday
17
I prefer to use dashes with my CI2 controller names, so the below solves that problem.
Simply create a file called 'MY_Router.php' and place it in the '/application/core/' folder.
class MY_Router extends CI_Router
{
function _set_request($segments = array()) {
parent::_set_request(str_replace('-', '_', $segments));
}
}
CodeIgniter Message Library
April
Wednesday
27
The very useful and simple to use Message Library written by Adam Jackett, allowing you to show different types of messages in an application.
Usage:
$this->load->library('message');Setting a Message:
// an error
$this->message->set('You forgot a required field.', 'error');
// a notice after a redirect
$this->message->set('Your account will expire in 5 days.', 'notice', TRUE);
// a success message after a redirect in a specific group
$this->message->set('Your subscription has been received.', 'success', TRUE, 'newsletter');
Retreiving Messages:
$this->message->display();
Library:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Message:: a library for giving feedback to the user
*
* @author Adam Jackett
* @url http://www.darkhousemedia.com/
* @version 2.1
*/
class CI_Message {
var $CI;
var $messages = array();
var $wrapper = array('', '');
function CI_Message($config){
$this->CI =& get_instance();
$this->CI->load->library('session');
if($this->CI->session->flashdata('_messages')) $this->messages = $this->CI->session->flashdata('_messages');
if(isset($config['wrapper'])) $this->wrapper = $config['wrapper'];
}
function set($message, $type, $flash=FALSE, $group=FALSE){
if(!is_array($message)) $message = array($message);
foreach($message as $msg){
$obj = new stdClass();
$obj->message = $msg;
$obj->type = $type;
$obj->flash = $flash;
$obj->group = $group;
$this->messages[] = $obj;
}
$flash_messages = array();
foreach($this->messages as $msg){
if($msg->flash) $flash_messages[] = $msg;
}
if(count($flash_messages)) $this->CI->session->set_flashdata('_messages', $flash_messages);
}
function get($type=FALSE, $group=FALSE){
$output = array();
if(count($this->messages)){
foreach($this->messages as $msg){
if($type !== FALSE){
$output[] = $msg->message;
} else {
if(!isset($output[$msg->type])) $output[$msg->type] = array();
$output[$msg->type][] = $msg->message;
}
}
}
return $output;
}
function display($group=FALSE, $wrapper=FALSE){
if(count($this->messages)){
$output = $this->get(FALSE, $group);
echo ($wrapper !== FALSE ? $wrapper[0] : $this->wrapper[0])."\r\n";
foreach($output as $type => $messages){
echo '<div class="message-'.$type.'">'."\r\n";
foreach($messages as $msg){
echo '<p>'.$msg.'</p>'."\r\n";
}
echo '</div>'."\r\n";
}
echo ($wrapper !== FALSE ? $wrapper[1] : $this->wrapper[1])."\r\n";
}
}
}








