Mike Karthauser

I work predominantly in PHP using CakePHP MVC Framework on Mac OS X and FreeBSD.

I have worked in the web Industry since 1998 and have contracted for many companies across Bristol and Southern England through as the company Brightstorm Limited.

Posts

December 14, 06:36 AM

I tend to keep my public_html folder at the same level as app folder when working in cakePHP.

Croogo is set up to serve the webroot folder from inside the app folder by default, so if you move your public_html directory then you’ll also need to ensure your file uploads still work.

look in app/views/helpers/image.php

and change the $fullpath and $url to match your directory path.

mine is

$fullpath = ROOT.DS.WEBROOT_DIR.DS.$uploadsDir.DS;
$url = ROOT.DS.WEBROOT_DIR.DS.$path;


December 08, 11:32 AM

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.


November 10, 07:01 AM

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 {} \;


October 31, 10:30 AM

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


September 21, 07:29 AM

A neat bit of javascript which allows you to view html source on an iPad or iPhone.


javascript:(function(){
var w = window.open('about:blank'),
s = w.document;
s.write('Source of ' + location.href + '');
s.close();

var pre = s.body.appendChild(s.createElement("pre"));
pre.style.overflow = 'auto';
pre.style.whiteSpace = 'pre-wrap';
pre.appendChild(s.createTextNode(document.documentElement.innerHTML));
})();

Just copy and save as a bookmarklet on mobile safari.

All credit for this goes to Rob Flaherty at Ravel Rumba.

For more details and a link to the bookmarklet – visit http://www.ravelrumba.com/blog/ipad-view-source-bookmarklet/


August 15, 09:49 AM

Syntax
$ rsync options source destination

To syncronise directories between servers you can do the follow:

rsync -avz LOCALDIRECTORY / REMOTEUSER@REMOTEHOST:REMOTEFILEPATH

See more


February 10, 07:16 AM

Something pretty useful in the CakePHP right now is VirtualFields.

A virtual field is a way to combine several fields to make a new ‘virtual’ one that exists when you read from the model. So with ‘firstname’ and ‘surname’ you can make a ‘full_name’ field which will allow you to use this within a find(‘list’) – a notoriously tricky task otherwise.

To do this on the User Model for example, just add the following to your app/models/user.php.

var $virtualFields = array(
'full_name' => 'CONCAT(User.firstname, " ", User.surname)'
);

Simple and powerful.

Available in CakePHP 1.3.*


January 30, 03:47 PM

Wilkinsons is a shop selling low priced general hardware, pharmacy and sundries.

On a trip recently we discoved that Wilkinsons have updated their own brand product labelling. The update has produced a charming and playful set of labels which we were so delighted with that we went round the store hunting for the new labelling, some of which included below.

complete food for adult working and sporting dogs

tomato feed

ant & crawling insect killer

squeeze sponge mop

rose & flower bug killer

To see more, check out my flickr set.


September 16, 07:18 AM

“Trying to fix an organization’s content problems by installing a content management system (CMS) is like trying to save a marriage by booking a holiday.”

A very insightful article about writing content management systems – http://www.alistapart.com/articles/strategic-content-management/


August 20, 12:09 PM

By default, results returned by the Google Base data API are sorted according to relevancy. You can change the order by using the orderby parameter. Possible values for this parameter can be found here:

http://code.google.com/apis/base/snippets-feed.html#Parameters

I’m particularly interested in returning the lowest price first which can be achieved by adding the following:
&orderby=price(float%20GBP)

to your base query.

to change sort order,

&sortorder=descending|descending

For more information about format and implementation
http://code.google.com/apis/base/samples/javascript/javascript-sample-autosmasher.html


Photos

Favorites

Posts

Yamaha Y125 concept

Dick Knight’s 1928 SS100 Brough Superior

Urwerk UR-110

Zero Engineering Type 9 Motorcycle

via uncrate

Parker Brothers Choppers All-electric Tron Lightcycle

via gizmag

Custom JRL Cycle’s Radial Chopper

Edsel Ford’s 1934 Model 40 Speedster

Automobile Association roadside telephone box at Devils Bridge

Brown Impressions Lowrider Car Club

low rider rat rod

A beautiful low rider trike from sixfourcustoms

simonholliday:

Motorbike Dance

“At Magny-Cours, during a round of the promosport Championship: two riders crash and their bikes lock wheel bars and continue to pirouette on the ground.”

[YouTube, via Neatorama]

simonholliday:

Sports Photographer Combines Entire Events into Single Images

“German photographer Peter Langenhahn has specialized in capturing a particular aspect of sports events in a single photo collage. Langenhahn takes as many as three thousand pictures and then puts them together on his computer to create a single image. One of his compositions documented all the fouls in a football match.”

[YouTube, via PetaPixel]

apartness:

jane by gesebel on Flickr.

Jane is a famous British comic begun during WWII to improve troop morale. Jane is a plucky English lady who always seems to lose her clothes. This strange predeliction was enough to keep the boys happy and helped them defeat the Gerries. With constant changes of illustration style, the comic persisted into the 1960s. Of course the pill and the sexual revolution made the strange innocent little cartoon completely irrelevant, and that was the end of Jane.

Circle Circle Dot Dot - Jamie Kennedy and Stu Stone. In lego.

A combination of everything i like rolled into one vehicle.

simonholliday:

He’ll Look So Great His Grandma Won’t Recognize Him!

[World Of Wonder, via Neatorama]

this weeks development work has been brought to you by angry cat. credit to google search where i found him.

officialbeastieboys:

Good people, unfortunately due to circumstances beyond our control, the “clean” version of our new album, The Hot Sauce Committee pt 2 has leaked. So as a hostile and retaliatory measure with great hubris we are making the full explicit aka filthy dirty nasty version available for streaming on our site. We hope this brings much happiness, hugs, and harmony. Enjoy Kikoos for life!

Thank you,

The Management

Audio

abcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyz