Category Archives: IT

This section includes coding, configuration, etc..

How to delete the photos in “photos” in Gmail (Solved)

When I open a new email, and try insert a picture. On the opened window, there are always an old photo and can’t be deleted there.

It have confused me for more than one hour.

I also can see the photos by clicking “change photo” on my account icon in the google+. The link is: select profile photo/your photos/photos from posts/

At last, I find that I should delete from the google+ account. Here is the details:

https://support.google.com/plus/answer/2622947?hl=en

Manage your photos

You can delete any photos that you’ve added for a place by following these steps:

Sign in to Google+.
Click the Home menu in the top left and select Photos.
Find the album named either “Google Maps Photos” or “Photos from posts.”
Select the photo you want to delete.
The photo will open to a full-screen overlay view. At the top of the screen, click the trash button.

Drupal 7: Get Data from Database and Create a Table with Theme_table

The code is as below:

/**
* display the data.
*/
function display_data($form, &$form_state) {
//Use Database API to retrieve records.
$query = db_select(‘info_manager’, ‘n’)
->fields(‘n’, array(‘id’, ‘first_name’, ‘last_name’, ’email’))
->orderBy(‘id’, ‘DESC’); //Most recent first.
$result = $query->execute();

//Iterate over the resultset and format them.
$header = array(‘ID’, ‘First Name’, ‘Last Name’, ‘Email’);
$rows = array();
foreach ($result as $row){
$rows[] = array($row->id,
$row->fist_name,
$row->last_name,
$row->email,
);
}

if (empty($rows)) { //No content in the last week.
$page_array[‘info_manager_arguments’] = array(
//Title serves as page subtitle
‘#title’ => t(‘All posts from the last week’),
‘#markup’ => t(‘No posts available.’),
);
return $page_array;
}
else {
$page_array[‘info_manager_arguments’] = array(
‘#header’ => $header,
‘#rows’ => $rows,
//Theme function includes theme hook suggestion.
‘#theme’ => ‘table__info_manager’,
);
return $page_array;
}
}

helpful links:

Default theme implementations
https://api.drupal.org/api/drupal/modules!system!theme.api.php/group/themeable/7

Drupal for Beginners: How to Create a Table Using theme_table()
http://zgadzaj.com/drupal-for-beginners-how-to-create-a-table-using-themetable

Drupal 7: .install file not working properly (Fixed)

Below is from drupal.org

The hook will only be called the first time a module is enabled or after it is re-enabled after being uninstalled.

Generally, the “uninstalled” can be ignored. On the module page, there is a tag named “uninstall” on the top-right corner. Click to open, then the modules are listed there. check the space before the module you want to uninstall, then click “uninstall” button to uninstall.

Drupal 7: Create an id with auto increment by hook_schema

Change the int type to serial.

The below is an example:

function info_manager_schema() {
$schema = array();
$schema[‘info_manager’] = array(
// specification for  table info_manager
‘fields’ => array(
‘id’ => array(
‘description’ => t(‘The primary identifier for a record.’),
‘type’ => ‘serial’,
‘unsigned’ => TRUE,
‘not null’ => TRUE,),
‘first_name’ => array(
‘description’ => t(‘The first name of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
‘last_name’ => array(
‘description’ => t(‘The last name of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
’email’ => array(
‘description’ => t(‘The email of the contact.’),
‘type’ => ‘varchar’,
‘length’ => 255,),
),
‘primary key’ => array(‘id’),
);
return $schema;
}