Outside Links collection sticky icon

Sometimes you find just the right resources that fulfill certain need and nothing much should be added to them, in those cases I will just collect them on this page and add short comment why is this so.

How to combine Git and Drush to have perfect workflow for site maintenance, information and examples are here
http://www.jenlampton.com/blog/keeping-your-drupal-site-date-git-and-drush

Setting upt perfect Git + Drush workflow, read here
http://www.acquia.com/blog/using-git-drush-win-workflow

$_SERVER['HTTPS']='on' on reverse proxies - nginx and SSL

When using nginx and SSL and you have a problem that CSS or JS files are using HTTP in their urls and everything else is in HTTPS. The thing you need to do is use this magic

$_SERVER['HTTPS']='on';

put it in settings.php and also if you have wordpress, do the same, put it in wp-config.php it will do the same and solve the same problem.

Attaching Extra or Pseudo Fields to any Entity in Drupal

This thing is so cool and only recently I found about it. You can create pseudo fields with your entites, most often content types. So you can make some add, edit, delete buttons or any kind of forms on your entites or nodes. And it is pretty quick and straight fwd solution.

Read more about it here
https://www.computerminds.co.uk/drupal-code/add-stuff-node-and-configure...
http://www.vdmi.nl/blog/attach-extra-or-pseudo-fields-any-entity-drupal

Update and insert only specific fields of your entity

TO not need to use hook_entity_presave and save whole entity try this

//Get the id of your field
$field_name = 'name_of_your_field';
$info = field_info_field($field_name);
$fields = array($info['id']);

//Execute the storage function
field_sql_storage_field_storage_write($entity_type', $entity, 'update', $fields);

Using CRUD with RESTful WS module

There is not much docs about this, but watching this video
https://www.youtube.com/watch?v=DJQnDZCbUHk
will help you with testing your drupal site and RESTful WS and Advanced REST Client.

For more info, look this one
https://www.youtube.com/watch?v=a2nHIWlCXSw
has all the drupal service modules in it and good examples how to use them.

One big GOTCHA is that.
X-CSRF-TOKEN is working on my localhost as

Running mysql on mamp localy

If you have more then one mysql installed on your computer and in your path is not proper MYSQL, you should run


/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

to start MAMP mysql, and to check if the one you want to use is right, run show databases;
Kind of a newbee thing, but could help for Frontenders and people not so good with AMP stacks.

Can't find a string to translate in drupal

This is kind of odd solution as it will confuse people.

"The t() function, to save on performance for single-language sites, won't store the string in the database until it is requested from another language. View the page in one of the non-default languages in order to populate the database (t() calls locale() to do this), thus making the string available for translation."

what it means is that you wont find some string if it was never requested
So…

1. When you create new string you need to visit it on other language page

Enable errors and logging with drush or with settings.php

You have error, your site is not accessable and you need to see what is the problem but logging and errors are set to none.
Type this with drush

drush vset error_level x

Where x is 0/1/2, depending on what you want

0: none
1: errors and warnings
2: all

You can also do the same with settings.php, adding to it this

$conf['error_level'] = 2;

Stdin: is not a tty and other GIT problems when git clone

stdin: is not a tty
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = (unset)
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
remote: Counting objects: 7844, done.
error: git upload-pack: git-pack-objects died with error.
remote: fatal: Out of memory, calloc failed
remote: fatal: Out of memory, calloc failed
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.

Finding ib_logfile0, ib_logfile1 and ibdata1 on MAMP

ib_logfile0
ib_logfile1
ibdata1

You will need this files, probably to delete them on MAMP/MAMP PRO when changing your "innodb_log_file_size" in my.cnf
Right location is very hard to find it is /Library/Application Support/appsolute/MAMP PRO/db/mysql