I am mikek's Blog

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

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:

/scripts/rebuildhttpdconf
service httpd restart

http://blog.servint.net/2012/03/30/the-tech-bench-changing-a-document-root-in-cpanel/

Filed under: code snippets, development

Raspberry Leaf

A really useful idea – a template for Raspberry Pi GPIO so you can see the PIN numbers when attaching your wires.

Visit Dr Monks site for the print out.

Thanks to Liz from Raspberry Pi blog for the link.

20130218-214436.jpg

Filed under: development, raspberry pi

Scoopy – view HTML source on Mobile Safari for iPhone ad iPad

Snoopy is a bookmarklet that go can install on mobile browsers where you can’t view source. Once installed, you can get access to both source and generated source as well as information about the document.

check out scoopy

image

Filed under: development, ,

hook_form_alter

A few links relating to hook form alter
In Drupal 7. Used to modify form output .
snippets

api

Filed under: code snippets, development

Dealing with images in concrete 5

Been working with a new client today who uses the CMS concrete5.

It’s been an eventful day working out what is standard concrete and what had been modified by the client. There’s been a lot of custom work on this system, with some good improvements but this also makes for head scratching over things that might be earlier in other CMSs.

We found the onboard editor in concrete5 responsible for rescaling images no longer works as the Picnik image editing service from google has been shut down. Fortunately it looks like Picmonkey fills the space:

http://www.concrete5.org/marketplace/addons/picmonkey-image-editor/

To get images into the view, we’d use concrete5s image helper:

http://c5cookbook.com/recipes/generate_thumbnail_images

We were looking at ways to affect the jpeg quality of the thumbnail too. Seems someone has done this for us:

https://github.com/concrete5/concrete5/pull/675

Filed under: development

How to change the default crontab editor

env EDITOR=nano crontab -e

Thanks to http://www.linuxquestions.org/questions/red-hat-31/how-to-change-the-default-crontab-editor-395750/ for the tip

Filed under: code snippets, development

Dealing with wildcards in croogo

i’ve been looking into wildcards for visibility paths primarity so I can add a block into my news/view page without specifying all my news articles.

inside blocks function within croogo component, there is a query which checks the url:

'Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%',

obviously, adding news/* wont match so no block in this instance.

The solution I settled on was to modify the conditions and add another check:

I replaced:

'conditions' => array(
'Block.status' => 1,
'Block.region_id' => $regionId,
'AND' => array(
array(
'OR' => array(
'Block.visibility_roles' => '',
'Block.visibility_roles LIKE' => '%"' . $this->roleId . '"%',
),
),
array(
'OR' => array(
'Block.visibility_paths' => '',
'Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%',
//'Block.visibility_paths LIKE' => '%"' . 'controller:' . $this->params['controller'] . '"%',
//'Block.visibility_paths LIKE' => '%"' . 'controller:' . $this->params['controller'] . '/' . 'action:' . $this->params['action'] . '"%',
),
),
),
),

With:

'conditions' => array(
'Block.status' => 1,
'Block.region_id' => $regionId,
'AND' => array(
array(
'OR' => array(
'Block.visibility_roles' => '',
'Block.visibility_roles LIKE' => '%"' . $this->roleId . '"%',
),
),
array(
'OR' => array(
array('Block.visibility_paths LIKE' => '%"' . $this->controller->params['url']['url'] . '"%'),
array(
'Block.visibility_paths LIKE' => '%"' .
'controller:' . $this->controller->params['controller'] . '/' .
'action:' . $this->controller->params['action'] . '/'.
'type:' . $this->controller->params['named']['type'] .
'"%',
),
),
),
),
),

This then allows the addition of the following in visibility paths


controller:nodes/action:view/type:news

to get our result.

Filed under: code snippets, development, ,

Cleaning up repositories

I’ve given a lot of files that once were in a mercurial repository but now need adding into another one.

Like with svn, mercurial file trees have hidden folders containing details about the commit history. If these get added into a new repo, things stop working properly.

The trick is to recursively delete these folders then all is good.


// find and remove .hg files in the filesystem
find . -name ".hg" -exec rm -rf {} \;


// works with svn files as well
find . -name ".svn" -exec rm -rf {} \;

Filed under: code snippets, development, , ,

Enabling CSS for themes in Croogo

Croogo is a free and open source content management system, built on top of CakePHP framework.

A little tweak to your .htaccess file in Croogo will get your css serving correctly from within your themes directory.

Look in your webroot/.htaccess


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

And amend to:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Options -MultiViews

Filed under: code snippets, development,

Rsync’ing backups

Syntax
$ rsync options source destination

To syncronise directories between servers you can do the follow:

rsync -avz LOCALDIRECTORY / REMOTEUSER@REMOTEHOST:REMOTEFILEPATH

See more

Filed under: development

what's hot

Flickr Photos

Tree graffiti

Tree graffiti

Tree graffiti

More Photos

Sponsor Mike run the Bath Half marathon

mikek on twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Follow

Get every new post delivered to your Inbox.