Update to drupal commerce dev with composer

For the lazy:

composer require --update-with-dependencies drupal/commerce:2.x-dev drupal/commerce_price:2.x-dev drupal/commerce_product:2.x-dev drupal/commerce_order:2.x-dev drupal/commerce_payment:2.x-dev drupal/commerce_payment_example:2.x-dev drupal/commerce_checkout:2.x-dev drupal/commerce_tax:2.x-dev drupal/commerce_cart:2.x-dev drupal/commerce_log:2.x-dev drupal/commerce_store:2.x-dev drupal/commerce_promotion:2.x-dev

Show related content based on shared reference entity

create a block view that filters for content-type-1.
add a relationship for "Entity Reference: Referenced Entity" for the entityreference field on content-type-1.
add a second relationship for "Entity Reference: Referencing entity" (note the difference from the 1st relationship) and select the 1st relationship in the drop down for this one (it won't appear if you haven't already created at least 1 relationship).
this is the 'money' step: Add a contextual filter for "Content: Nid", select the 2nd relationship then "provide default value" and "Content ID from URL".

Update Commerce Kickstart

Updating your files
If you are upgrading your site from a previous release of Commerce Kickstart (since 2.x RC1 forward), we support an upgrade path.

IMPORTANT - Drush 8.x-6.x supports an upgrade for Kickstart 2, but it is not the common "drush up" command. Use the following code snippets (and make sure to backup everything):

$ drush dl commerce_kickstart $ drush updatedb -y
Or you can follow the step by step instructions below.

Force SSL for Drupal 8


RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


RewriteRule ^ - [E=protossl]
RewriteCond %{HTTPS} on
RewriteRule ^ - [E=protossl:s]

How to Securely Wipe the Free Space on Your Mac

Securely Wipe the Free Space on Your Mac Using the Command Line
Before wiping the free space on your Mac using the command line, back up your data.

Once you’ve backed up your data, open the Terminal app from the Applications > Utilities folder.

Then, type the following command at the prompt and press Enter.

diskutil secureErase freespace 4 /Volumes/Macintosh\ HD
Make sure you include “freespace” in the command. This indicates you are only erasing the free space on the drive and not the entire drive.

Use only parent terms in view

If you want to display the top-level terms of a given vocabulary, create a "term" view ("View type: Term") with these basic settings: a field for "Taxonomy:Term", an argument for "Taxonomy: Vocabulary ID"

Then to filter:
1) add a relationship to "Taxonomy: Parent term"
2) add a filter on "Taxonomy: Term ID", using relationship "Parent", with operator set to "Is empty (NULL)"

This will list only top-level terms for the given vocabulary.

Notice: Undefined variable: pages_prefix in template_preprocess_quicktabs_view_quicktabs() (line 83 of modules/contrib/quicktabs/quicktabs.theme.inc).

diff --git a/quicktabs.theme.inc b/quicktabs.theme.inc
index d4e86cf..284f05f 100644
--- a/quicktabs.theme.inc
+++ b/quicktabs.theme.inc
@@ -79,6 +79,4 @@ function template_preprocess_quicktabs_view_quicktabs(&$variables) {
$variables['rows_with_page_starts'] = $rows_with_page_starts;
$variables['rows_with_page_endings'] = $rows_with_page_endings;
- $variables['pages_prefix'] = $pages_prefix;

Twig values

URL in link field
{{ node.field_my_link.0.url }}

{{ entity.field_name.value }} to get the true raw value, includes tags and encoding.

Example: {{ node.body.value }}
result: Batman & Robin
{{ content.field_name.0 }} to get the raw value minus tags and encoding.

Example: {{ content.body.0 }}
result: Batman & Robin

Term ID
{{ node.field_category.entity.tid.value }}

Drupal 8 – Formatting a Date Field in Twig

Here are the four easiest ways I’ve found to show dates via Twig inside of a node template.

They all result in the same output.

Use the field’s formatter settings; include wrappers

{{ content.field_blog_date }}
{{ content.field_blog_date }}
This is the only example that includes wrappers. The rest output just the date.

Use the field’s formatter settings

{{ content.field_blog_date.0 }}
{{ content.field_blog_date.0 }}
This will use the format defined in Content type » Manage Displays » Your View Mode.

Patch for fieldset views empty handler error

diff --git a/views_fieldsets.module b/views_fieldsets.module
index af518a6..8cfe495 100644
--- a/views_fieldsets.module
+++ b/views_fieldsets.module
@@ -65,6 +65,8 @@ function views_fieldsets_preprocess_views_view_fields(&$vars) {
function views_fieldsets_views_ui_display_tab_alter(&$build, ViewUI $ui_view, $display_id) {
$view = $ui_view->getExecutable();
+ // Re-init handlers.
+ $view->inited = FALSE;
$ui_view->set('executable', $view);

V mount battery test

Earlier this year I decided to compare some of the V-mount batteries available and see what the differences were. Some of it was rather eye opening, and since then I’ve expanded on the original article and have now created a dedicated page for batteries - listing all their specs, including crucially, their relative capacities versus their size and weight.

redirect https and without www

Enabling HTTP Secure (HTTPS)
Last updated 4 August 2018. Created on 11 November 2009.
Edited by John Morahan, hiten2112, marcoka, Joel MMCC. Log in to edit this page.

HTTPS is a protocol which encrypts HTTP requests and their responses. This ensures that if someone were able to compromise the network between your computer and the server you are requesting from, they would not be able to listen in or tamper with the communications.

Wireless microphones and monitors frequencies Ofcom

Wireless microphones and monitors
11 May 2015
Wireless microphones and in-ear monitors in the UK are generally available at VHF (170 - 210 MHz) and UHF (470 - 790 MHz).

There are three ways in which you can legally use them:

The ranges 173.8 - 175 MHz and 863 - 865 MHz and 2400 - 2483.5 MHz can be used without a Licence subject to the requirements of The Wireless Telegraphy (Exemption) (Amendment) Regulations 2006. These ranges are also used by other low power equipment so can be subject to interference.


There is a long-running battle between Linux users about which command line editor is the best. In one camp vi is the editor that rules the roost but in another, it is all about emacs.

For the rest of us who just need something simple to use to edit files there is nano. Don't get me wrong vi and emacs are very powerful editors but sometimes you just need to open, amend and save a file without remembering the keyboard shortcuts.

Run cron in WHM

No, you cannot set a cron job from WHM. If you have to set a cron server side, you will have to configure it via SSH as user "root". SSH to your server and execute:

crontab -e
This will edit the root's cronjob file at /var/spool/cron/root. Set the cronjob you like and restart the crond service.

service crond restart

htaccess redirects

Useful 301 Redirects for SEO using .htaccess
Written by Creare - Published on May 8, 2014
It is well known that 301 Redirects are vital for recovering link equity from URLs that are no longer existing on our current website but were available on a previous version.

This usually occurs when migrating a website from one domain to another or perhaps even updating a website to use a new system or framework where the previous URL structure cannot be effectively replicated.

Log in with an SSH private key on Linux and Mac

This example demonstrates how to use a private key to log in to a Linux server by using a private key by using a Terminal session on OS X. However, you can follow the same process to use a private key when using any terminal software on Linux.

Note: For information about using SSH private keys on Windows operating systems, see Logging in with an SSH Private Key on Windows.

To complete this process, you need the following software applications:

Overcoming memory issues installing Drupal with Composer

Tue, 27/03/2018 - 16:34 -- James Oakley

Drupal 8 uses Composer for package management. You can still install a Drupal 8 site by downloading a tarball, but we're all encouraged to use Composer to download Drupal core and other dependencies and to keep things up to date.

I'm just starting to get my head around how Drupal 8 works, so that I can reach the point where I can build new sites in 8.x rather than 7.x, and in time migrate existing sites over. Composer is part of the learning curve for this.

Download Composer to Mac OSX

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Increase CLI php memory limit on OSX

published by Albert Skibinski on Sat, 2015-02-21 13:52
When running MAMP or MAMP Pro on a Mac OSX (this is on version 10 Yosemite) you will notice that PHP executed from the command line (CLI) will use different PHP settings than your website. In this case, OSX is using its own built-in apache server and php settings, not the ones defined by your MAMP setup.

You can easily change this though, as long as you know which php.ini to change.

First, check your memory limit, by running the following command on your SSH shell or local terminal:

Mac show hidden files

The long way to show hidden Mac OS X files is as follows:
Open Terminal found in Finder > Applications > Utilities.
In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES.
Press return.
Hold the 'Option/alt' key, then right click on the Finder icon in the dock and click Relaunch.

Drupal 8 update

# Browse to https://github.com/drush-ops/drush/releases and download the drush.phar attached to the latest 8.x release.

# Test your install.
php drush.phar core-status

# Rename to `drush` instead of `php drush.phar`. Destination can be anywhere on $PATH.
chmod +x drush.phar
sudo mv drush.phar /usr/local/bin/drush

# Optional. Enrich the bash startup file with completion and aliases.
drush init


How to Increase Import Size Limit in phpMyAdmin

If you are using WHM/Cpanel then in order to change that "Max: 50MiB" limit in the import section of phpmyadmin, you will have to change two values in WHM (Web Host Manager).

Step 1) Go to Tweak settings, find the "cPanel PHP Max upload size" change it according to your needs. Save changes.

Step 2) Go to Tweak settings, find the "cPanel PHP Max POST size" change it according to your needs. Save changes.

Go back to your phpMyadmin. The value should have changed.

mismatched entity and/or field definitions The node.field_flexslider_example_slidesh field needs to be uninstalled.

Comment #60osman CreditAttribution: osman as a volunteer commented 2 years ago
If you have Devel module installed, you can also use the "Execute PHP Code" page at http;//example.com/devel/php

try {
catch (EntityStorageException $e) {