El Capitan open and quit an app every 6 hours

after opening “Automator” and spending 2 minutes dragging and dropping actions I though no this need to be done with AppleScript !

Then looking at the fact the AppleScript would need to run constantly I thought this is best for a Cron job!

Looking at apples tech docs Cron is being depricated!

Right so the replacement is to use Launch Daemons and Agents !



So I want to exit and re launch an app called EvoCam every 6 hours, my solution is to create 8 plist files the logic is:

24 / 6 = 4

and I want it to Exit EvoCam on the hour and re open it every 1 minute passed the hour.

so 2 * 4 = 8

To exit EvoCam:

I saved this file to (where ~ is your user directory):

[cc lang=”xml” tab_size=”2″ lines=”40″]


tell application “Evocam” to quit




To Launch EvoCam:

Saved this to :
[cc lang=”xml” tab_size=”2″ lines=”40″]


tell application “Evocam” to open




Then duplicate each file 4 times advancing the Hour by 6 , so it quits the app every 6 hours and opens it at every one minute past.

Maybe someone can explain hot to get the .plist file to Loop every 6 hours?
For now this will do!

Obviously you change “EvoCam to the name of the app or program you want to launch.

Show hidden files on Mavericks (10.9)

Open the terminal app from “Applcations > Utilities”.

To show all files enter:

defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder

To hide hidden files again

defaults write com.apple.finder AppleShowAllFiles 0 && killall Finder

1 = show all files

0 = do not show all files

In OS X Mountain Lion / Mavericks, you can no longer open hidden folders normally (by double-clicking).

You can however, open hidden folders by right-clicking on them, and clicking “Open”.

On previous versions of mac os:

To show all files enter:

defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
To hide hidden files again
defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder

Bootcamp missing from Startup Disk control panel

Today when i checked my Startup Disk control panel my Bootcamp partition had disappeared!

Of course you can choose the disk or partition to boot from start up by holding down the option key unless like me you are using a wireless keyboard!

Which leaves the option to change start up form “System preferences > Startup Disk ” as a very useful panel.

So why you ask did my Bootcamp disk not show up in “System preferences > Startup Disk “?

For me it was as simple as my Tuxera NTFS driver had mounted my Bootcamp volume as it had recognised the bootcamp volume (on a mac a disk or partition is refereed to as a volume in case you are wondering why I suddenly changed my wording).

So the fix if running Tuxera NTFS:

  1. Open “System preferences > Tuxera NTFS”
  2. Click on Volumes under the Tuxera NTFS panel.
  3. Choose your BootCamp volume.
  4. Check the box for “Disable Tuxera NTFS”
  5. Then either reboot your system or open Disk utility which you can find in the utilities folder in Applications and unmount your bootcamp volume and then mount it again.

Now when you check under “System preferences > Startup Disk ” you will see the BootCamp partition again.

You will also lose the ability to write to the bootcamp partition as you have told Tuxera NTFS not to mount the bootcamp volume.

So to reverse this you need to delete the file “/Volumes/BOOTCAMP/.Tuxera-NTFS/disable-driver” that is assuming you have called your bootcamp volume “BOOTCAMP”.

Mysql db commands

Dump ALL MySQL Databases

mysqldump –user=XXXXXXXX –password=XXXXXXX -A > /PATH/TO/DUMPFILE.SQL

Dump Individual or Multiple MySQL Databases

mysqldump –user=XXXXXXXX –password=XXXXXXX –databases DB_NAME1 DB_NAME2 DB_NAME3 > /PATH/TO/DUMPFILE.SQL

Dump only certain tables from a MySQL Database

mysqldump –user=XXXXXXXX –password=XXXXXXXX –databases DB_NAME –tables TABLE_NAME > /PATH/TO/DUMPFILE.SQL

make dumps compatible with the old MySQL version, add the following switch:


Put Myqsl database back

mysql –verbose –user=XXXXXXXX –password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL

PHP 5.1 date(): getdate(): and assorted Time Zone errors

Ok So you have your Apache server WIth PHP installed and you keep getting this error on your sites

date(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead


getdate(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead

It turns out your shiny new server set up has changed if your using PHP 5.1 or greater you now need to tell php what time zone to use.

Rather than editing all your sites / scripts just update your .htaccess with

php_value date.timezone Europe/London

You can also set the default time zone in your php.ini file if you have access / the script should revert to UTC or GMt as it used to be but you will get the E_warning as above.

replacing Europe/London with the appropriate time zone for your server see full list: http://www.php.net/manual/en/timezones.php

How to order posts by number of Facebook Likes

I was recently asked to produce a facebook “like” page where by the website owner could add entries and visitors could like those entries via facebook. The entries could then be displayed in order of most likes. see http://purplepanda.eu/like/

Afetr a brief discussion the cient told me they have used wordpress before and where comfortable using it, so hey lets build the site for wordpress.

First off we need somewhere to store our number of facebook likes against the post so add the following to functions.php

[cc lang=”php” tab_size=”3″ lines=”40″]
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, ‘_my_key’, ‘0’, true);
add_action(‘publish_page’, ‘add_custom_field_automatically’);
add_action(‘publish_post’, ‘add_custom_field_automatically’);

This will automatically add a custom field called _my_key to any new posts with a default value of “0” the reason for the _ before my_key is to hide the custom field from the post editor.

Next you’ll need to add the facebook like button to your code no use adding the button from facebook.com you have to write your own add this code where you want the button to appear inside the Post loop:
[cc lang=”html” tab_size=”3″ lines=”40″]


Next we need to check how many likes we have against each post and update the custom field we created at the beginning “_my_key”.
This code is for Satndard Permalinks e.g p?=123.
For nice permalinks use the code underneath!
You can add this to your header.php file:
[cc lang=”php” tab_size=”3″ lines=”40″]
global $wp_query;
$Magic_no = $wp_query->post->ID;

$data = file_get_contents(‘http://graph.facebook.com/?id=’.bloginfo(‘url’).’?p=’. $Magic_no);

$json = $data;

$obj = json_decode($json);
$like_no = $obj->{‘shares’};
$meta_values = get_post_meta($Magic_no, ‘_my_key’, true);
//$meta_values = 1;
//if ($like_no == ‘2’) {
//echo $meta_values;
if ($like_no == $meta_values) {

} else if (empty($meta_values)) {
add_post_meta($Magic_no, ‘_my_key’, $like_no, true);
update_post_meta($Magic_no, ‘_my_key’, $like_no, false);

} else {
update_post_meta($Magic_no, ‘_my_key’, $like_no, false);


Code for nice permalinks:

[cc lang=”php” tab_size=”3″ lines=”40″]
global $wp_query;
$Magic_no = get_permalink();
$Magic_no_postid = $wp_query->post->ID;
//echo get_permalink();
$data = file_get_contents(‘http://graph.facebook.com/?id=’. $Magic_no);

$json = $data;

$obj = json_decode($json);
$like_no = $obj->{‘shares’};
$meta_values = get_post_meta($Magic_no_postid, ‘_my_key’, true);
//$meta_values = 1;
//if ($like_no == ‘2’) {
// echo “Number of Likes”.$meta_values;
if ($like_no == $meta_values) {

} else if (empty($meta_values)) {
add_post_meta($Magic_no_postid , ‘_my_key’, $like_no, true);
update_post_meta($Magic_no_postid , ‘_my_key’, $like_no, false);

} else {
update_post_meta($Magic_no_postid, ‘_my_key’, $like_no, false);


Now to display the posts Create a new page template and add this betwee the get_header and get_posts:
[cc lang=”php” tab_size=”3″ lines=”40″]
$featuredPosts1 = new WP_Query();
while ($featuredPosts1->have_posts()) : $featuredPosts1->the_post(); ?>


Seo >Start Here<

Introduction to SEO

When SEO started, SEO wasn’t called SEO. It was best described by those who practiced it as a form of hacking.

The early search engines weren’t the best , so it was relatively easy to figure out their sorting algorithms. There was a time when Infoseek’s algorithm was almost entirely based on keyword density and keyword position.

I’m sure many  SEOs remember those days with a sense of nostalgia. It was more of a pure technical pursuit back then.

As search engines got more sophisticated, and more money flowed online, the nature of the game changed. SEO moved beyond technical hacking to an exercise in making connections.

In Googles early days, you could build a couple of high PR (Page Rank) Links and that was enough to get you ranking top ten. (Click here is you want to read the current status on PR) Add a few more if you really wanted to go hard.  It’s clear to see we haven’t completely left the era of High PR but it’s clear to see their has been a shift away from this method.

Today a holistic approach is required to capitalize on SEO.

Get your head round current SEO

If you’re starting out in SEO now, Don’t try and cover it all at once it’s going to take a while.

It helps to understand the big picture first. The reason people engage in SEO is about making money, Driving visitors to your site, Building your online presence, and increasing your search ranking.

They want people to connect with them, rather than their competitors.

They want people to find their web site.

They want people to do this so they can convert these people to buyers, of their goods, their services, or their ideas. If a site were only to rank, on keyword terms no-one searched for, or that weren’t directly applicable to the objectives of the business, then the SEO work is largely useless.

So SEO isn’t solely about rankings.

The rankings must translate to something tangible. In most cases, this means gaining qualified visitor traffic.

A low bounce Rate

To get this traffic, a site must do more than rank, a site must appeal to visitors. To appeal to visitors, the SEO must first understand them.

Once the SEO provider understands what is available to the visitor and what the aim is of the Employer of the SEO provider, relevant traffic can be driven to he relevant sections of a site.

If for instance we are providing SEO for a company that sells Crockery there’s no point providing quality seo for plates and the visitor arriving at the home page and then having to find that information within the site. We want to send the visitor straight to the most relevant part of the site relating to Plates.

Please share your thoughts and ask some questions in the comments as I’m looking to keep this post updated and added to.

iOS 4.1 and 4.2

iOS 4.1 is available for download from apple so get your iPhones, iPods, and iPads updated.

iOS 4.2 is available as of November 2010 I’ll be writing about that soon also.

As well as the usual bug fixes iOS 4.1 also has some brand new features!

A new Camera App

A new button that turns on HDR mode.

Take great photos that capture a wider range of light intensity using the new high dynamic range (HDR) setting on iPhone 4, which automatically combines multiple exposures into a single HDR image.

The restriction on uploading High Def video directly from the iPhone has been removed.

Upload HD video to YouTube and MobileMe from your iPhone 4.

The addition of game center.

iOS 4 introduces the Game Center app. An out-of-the-box social gaming network for iPhone 4 and iPod touch.1 Invite friends to join. Then totally crush them. Take a look at how your score ranks among your friends and other players of each game. Compare game achievements with your friends. Get matched up and put together a select group of friends to play. Or choose to automatically go up against people you don’t know in a multiplayer game. Read More here >>

Face Time.

FaceTime is just another way iOS 4 seamlessly integrates hardware and software to make every iPhone feature as easy to use as it is groundbreaking. Now when you wish your friends could be there, they actually can be. With just a few taps, you can see your friends and family while you talk to them — iPhone 4 to iPhone 4 or new iPod touch over Wi-Fi.

Watch a cut down Keynote here:

If you have a spare two hours watch it in full:


It’s here Or maybe not Html5

So Html5 isn’t due for release untill 2022 but sites like facebook are already using it?

Html5 is till being developed by the web Hypertext Application technology working group, and developemnt is still currently at “Working Draft – Last Call” the second of five total recommendation levels.

The basics are safari, Chrome, Firefox and no Internet Explorer (version 9) are using Html 5 on an increasing level and these technologies are being adopted by an increasing number of sites so we could argue Html 5 is here already albeit in Beta.

What can I do with Html5 that I couldn’t do before with Html 4 and some plugins?

Thats just it you don’t need the plugins,

But if the plugins are available why not just use them?

As plug ins are not set by an independent body as an industry standard they will not necessarily be available on all platforms, and in the case of Flash and Divx they can be very hardware intensive regularly causing crashes on lower spec machines.

So what is available with Html5 and where can I see some examples?

The biggest changes are media markup tags such as <audio>, <video>, and <canvas>.

We can see the audio tag in use here: Note you’ll want to get a html5 browser such as safari or chrome, opened to enjoy these examples.



The video tag has been adopted by Youtube, BBC iPlayer, and vimeo.


The canvas tag is at work, with gmail, and scribd.

So you lke wat you hear?

Here’s some of the best examples on the web currently of html5.



This site is using it all <canvas>, <audio>, and <video>


I like what I see how do I learn how?



Here are the latest tutorials from Html 5 Rocks .com

RSS Content

Am I really doing that well? Exclude Internal Traffic

Are you actually getting 100 hits per day already or is that you reading and reviewing your own webiste?

Your most likely to be the most frequent visitor to your website and or people from your own intranet (that pretty much means anybody on your wifi, or Ethernet network).

This is especially true if you are running a blog site / cms site or an e commerce site that means you have to visit your site regularly to update the content.

Here is how to ad a custom filter in Google Analytics to remove the home grown traffic.

Start by going to Filters in your Google Analytics and click Add Filters. Up pops the normal filter form.

Following the example below, placing your own IP address into the field, add it to what ever profile you want. Now all internal traffic is gone.

If you don’t know your i.p address click here.

Of Course you could filter out by City, or State or even Country (if you lived in Luxembourg) However some genuine traffic will come from as close to home as next door, If you are using Mobile broadband or dial up or maybe don’t have a fixed i.p you can filter by i.p starting with and use the first two to three numbers in my example I would filter by all i.p’s starting “92”