Yii CGridView default Order

If you want to set a default sort order for a CGridView, often used in admin views you can do so in the controller as part of the search() function:

$dataProvider = new CActiveDataProvider(get_class($this), array(
	'criteria'=>$criteria,
	'sort' => array('defaultOrder' => 'name')
));

[carousel keywords=”yii” tag=”fetchit-21″]

Do We Even Need Cookies?

A new law came into force on May 26th 2011 in the UK and Europe that affect websites and how they deal with the user flow of saving cookies to a visitors browser.

Previously websites could use cookies as much as they liked and we only limited by the browsers of the people visiting their websites, but as of late May the Privacy and Electronic Communications (EC Directive) Amendment Regulations 2011 require that certain information must be given to that site’s visitors and the user must give his or her consent to the placing of the cookies.

In english, that means that a site must ask all users permission before saving a cookie to their browser.

Continue reading

New Twitter Last Read Tweet Bar Bookmarklet

Update: Twitter has now added this to the site and the bookmarklet below is no longer of any use.

Got the new Twitter?
Annoyed that when you click the bar that says ‘x new tweets’ you can’t find the last one you had already read?
Harry Bailey to the rescue.

Update: Now works in Chrome, Safari, Firefox. Anyone checked Internet Explorer?

Drag the following link to your bookmark bar, go to the Twitter page that’s annoying you, click the bookmarklet:

(function(){ $('head').append(''); setInterval(function() { var last_read = $('div.stream-item.last-read'); if(!last_read.length) { $('div.stream-item:first').addClass('last-read'); } else if(last_read.prev().length) { $('div.stream-item.marker').removeClass('marker').removeAttr('style'); last_read.removeClass('last-read').addClass('marker'); $('div.stream-item:first').addClass('last-read'); } }, 2000); }();

[carousel keywords=”twitter development” tag=”fetchit-21″]

Hide topics row in Postbox message view

I love Postbox. I talk about it a lot. However Postbox is trying to be more than a mail client and as part of that is attempting to sneak into the world of GTD with the inclusion of todos and topics.

Now call me old fashioned but I use Things for my GTD stuff and so don’t use todos or topics in Postbox.

“Not a problem really is it?” I hear you yell. Well no until you look at the amount of space the topic row of Message View takes up. Believe me on a small screen this matters:

Continue reading