jQuery Masonry – Append items does not work?

We could append items on the Masonry container using the appended method.

var $boxes = $('<div class="box"/><div class="box"/><div class="box"/>');
$('#container').append( $boxes ).masonry( 'appended', $boxes );

 

Please note that in the above example, we have to wrap the new boxes with the jQuery object. This is because the .masonry() call expects an jQuery object in the 2nd parameter.

Done =)

Reference:

Drupal 7 – Update node programmatically

If you want to update the node programmatically, the following example update the node title and the value of the custom field called field_example.

// Load the node with nid = 1
$nid = 1;
$a_node = node_load($nid);
$a_node->title = 'new title';
$a_node->field_example['und'][0]['value'] = 'new value';

// Save the node
node_save($a_node);

// If you want to populate the node author and creation date, call node_submit() before saving
/*
if($a_node = node_submit($a_node)) {
  // Save the node
  node_save($a_node);
}
*/

 

Done =)

Reference: fooninja.net – Updating nodes programmatically in Drupal 7

Drupal 7 – Set a date fieldCondition in EntityFieldQuery

We can select nodes by conditions using EntityFieldQuery.
Drupal 7 – Get specific nodes using EntityFieldQuery

After I have installed the Date module, I could create a content type with a date field called field_expiry_date. When i setup this field, there are 3 date options in the field type.

  • Date
  • Date (ISO format)
  • Date (Unix timestamp)

Continue reading Drupal 7 – Set a date fieldCondition in EntityFieldQuery

陶傑 – 不罵曾蔭權

曾蔭權多次外訪豪遊,住很貴的套房,全城唾罵,連大陸新華社也不留情,詳盡報道,加入圍剿。

這時候,你該不該加一張嘴也罵曾一份?我認為絕不應該。有很多理由。

第一,有沒有聽過一句名言:「當華爾街的擦鞋童也在談股票的時候,就要放掉你手上的股票了。」同理,當中國官方也加入圍剿一個人的時候,不管是誰,如果你有一點政治觸覺(或者尚有點人性),即使你本來很討厭這個人,但此時也要停一停,想一想:此一跡象,是一個臨界點,不要加入眾聲的喧嘩,反而,要沉默了。

其次,至目前為止,只是住了幾天總統套房,租了豪宅,沒有貪污千億,英國人是他的師傅,但他沒有把至少八十億託一個英國人轉移海外。身為一名中國官員,有人早就指出過了:他的清廉品格,已經十分高尚。
Continue reading 陶傑 – 不罵曾蔭權

Dream BIG and go for it =)