I am mikek's Blog

The personal blog of Mike Karthauser, who you may know from Brightstorm Limited or the internet.

Disabling user interface code updates

If your site is relying on an external deployment system (perhaps with a staging and production workflow), you can disable all of the functionality that allows site administrators to install code through the administrative user interface by placing the following line in your site’s settings.php file:

$conf['allow_authorize_operations'] = FALSE;
You will still be able to run the Update manager to check the status of available updates, but you will not be able to install those updates or new modules and themes directly via the web interface.



Filed under: development, drupal, ,

Cleat Drupal cache via SQL

A handy little bit of sql to clear the cache tables just before you back up a drupal db to sql.

Steps to follow:

  1. Replace {db_name} by the real project’s database name.
  2. Execute the sentence.
  3. Copy the generated string (TRUNCATE list, one for each table).
  4. Execute the string  copied in the previous step (TRUNCATE list).

FROM information_schema.TABLES
WHERE TABLE_SCHEMA = '{db_name}'

The resulting string must be something like this (will vary depending on the Drupal version and the installed modules):

TRUNCATE TABLE {db_name}.cache_admin_menu;
TRUNCATE TABLE {db_name}.cache_block;
TRUNCATE TABLE {db_name}.cache_bootstrap;
TRUNCATE TABLE {db_name}.cache_field;
TRUNCATE TABLE {db_name}.cache_filter;
TRUNCATE TABLE {db_name}.cache_form;
TRUNCATE TABLE {db_name}.cache_image;
TRUNCATE TABLE {db_name}.cache_menu;
TRUNCATE TABLE {db_name}.cache_metatag;
TRUNCATE TABLE {db_name}.cache_page;
TRUNCATE TABLE {db_name}.cache_path;
TRUNCATE TABLE {db_name}.cache_token;
TRUNCATE TABLE {db_name}.cache_update;
TRUNCATE TABLE {db_name}.cache_variable;
TRUNCATE TABLE {db_name}.cache_views;
TRUNCATE TABLE {db_name}.cache_views_data;


Filed under: development, ,

Max Allowed Packets

The max_allowed_packet variable can be set globally by running a query.

To change the setting for everyone until the server restarts:

SET GLOBAL max_allowed_packet=1073741824;

Filed under: development,

Restarting virtual box from commandline on OSX

$ sudo /Library/StartupItems/VirtualBox/VirtualBox restart

Filed under: code snippets

Big 3d printing on kickstarter

Gigabot 3D printing brings large format printing ever closer to affordable. At $2500 this printer is a whopper. Designed to be used in developing countries, this printer will soon be available to the public.



Filed under: Uncategorized

Deploying Magento

This is a guide to help you update your URL after you move your site from one environment to another. For example if you have your website on your localhost and now you want to publish it. You will need to change your URL to reflect this.

Find Rows to update
select * from core_config_data where path = 'web/unsecure/base_url';

Next you will need this one:
select * from core_config_data where path = ‘web/secure/base_url’;

You may need this:
select * from core_config_data where path = ‘admin/url/custom’;

* remember you might have to put in your table prefix if you are using one

If you have multiple store BE CAREFUL and note the config_id numbers for each row, that is how we will ensure that we can the results we want!

Each query will return something like this

‘261’, ‘default’, ‘0’, ‘web/unsecure/base_url’, ‘http://your.dev-domain.com/’

You need to note the first column which is your config_id, each id is unique and we can use that to update just the row we want to update. This will ensure you don’t update a wrong row or more rows than you wanted.

read the guide

Filed under: code snippets,

Changing the path to site root in cpanel

For changing the main/primary domain, you will need to have root SSH access and be able to locate and edit the following file (replacing your user & domain info):

cd /var/cpanel/userdata/USERNAME/DOMAIN.COM

1. Once you have opened the file, look for the following line:

documentroot: /home/USERNAME/public_html

2. Modify the location according to your needs. Save it and exit.

3. Rebuild the Apache conf and restart Apache:

service httpd restart


Filed under: code snippets, development

Passive Infra Red sensors and the Raspberry Pi

It’s taken a while to arrive, but finally I have received my infra red sensor that I ordered from china via EBay.

It’s a simple circuit: just power and 1 GPIO port. I followed the circuit I covered in a previous post, and produced the following.


The sensor has two things you can adjust: sensitivity and time – the amount of time the circuit stays on – between 2 and 200 seconds.

Filed under: raspberry pi

Fun with ultrasonics on Raspberry Pi

SRF05 ultra sonic range configured following Matt Hawkins example circuit and python script I hooked up the following:


This circuit allows for the setting of events specific to certain distances. I configured a message to change depending on how far the dog was away:


The future scope is to trigger another GPIO pin depending on location which could activate a warning sound

Filed under: raspberry pi

Making blank worlds in Minecraft Pi edition

Winkleink has a python script that creates blank levels in Minecraft Pi edition so you can run your own builds on the flat ground you’ve created.


Filed under: minecraft, raspberry pi

what's hot

Flickr Photos

Sponsor Mike run the Bath Half marathon

mikek on twitter