Archive

Archive for the ‘Latest’ Category

El Capitan open and quit an app every 6 hours

March 18th, 2016 No comments

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 !

See:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

 

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):

~/Library/LaunchAgents/com.exit.evocam.1.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.exit.evocam.1</string>
    <key>Program</key>
    <string>/usr/bin/osascript</string>
    <key>ProgramArguments</key>
    <array>
        <string>osascript</string>
        <string>-e</string>
        <string>tell application "Evocam" to quit</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>12</integer>
        <key>Minute</key>
        <integer>00</integer>
    </dict>
</dict>
</plist>

To Launch EvoCam:

Saved this to :
~/Library/LaunchAgents/com.launch.evocam.1.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.launch.evocam.1</string>
    <key>Program</key>
    <string>/usr/bin/osascript</string>
    <key>ProgramArguments</key>
    <array>
        <string>osascript</string>
        <string>-e</string>
        <string>tell application "Evocam" to open</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>12</integer>
        <key>Minute</key>
        <integer>01</integer>
    </dict>
</dict>
</plist>

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.

Categories: Latest, Mac and OSX Tags:

Show hidden files on Mavericks (10.9)

January 30th, 2014 No comments

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
Categories: Latest, Mac and OSX Tags: ,

Bootcamp missing from Startup Disk control panel

January 30th, 2014 No comments

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”.

Categories: Latest, Mac and OSX Tags:

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

January 31st, 2011 No comments

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

OR

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

Categories: Latest, web development Tags: , ,