{"id":33372,"date":"2017-10-03T03:01:55","date_gmt":"2017-10-02T17:01:55","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=33372"},"modified":"2017-10-04T07:20:41","modified_gmt":"2017-10-03T21:20:41","slug":"mac-os-x-do-not-sleep-mamp-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-do-not-sleep-mamp-tutorial\/","title":{"rendered":"Mac OS X Do Not Sleep MAMP Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"HTTP:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php?zipfile=mamptest.zip\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Mac OS X Do Not Sleep MAMP Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/do_not_sleep_mac_os_x.jpg\" title=\"Mac OS X Do Not Sleep MAMP Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Mac OS X Do Not Sleep MAMP Tutorial<\/p><\/div>\n<p>The Mac OS X command line (accessible via its <i>Terminal<\/i> desktop application) is not exactly Unix nor Linux, but more <a target=_blank title='Berkeley Software Distribution information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Berkeley_Software_Distribution'>BSD<\/a>.  As such, it has developed some interesting command line commands, some of which we&#8217;ve mentioned in the past, and, today, want to start developing a <a target=_blank title='MAMP' href='http:\/\/mamp.info'>MAMP<\/a> (local Apache\/PHP\/MySQL web server) friendly arrangement (via the use of PHP&#8217;s <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'>exec<\/a> method), that we may or may not be able to show you relevant live runs for (see more about this later), but can encourage you to download and use on your Mac OS X and MAMP web browser arrangement &#8230;<\/p>\n<ul>\n<li>&#8220;say&#8221; &#8212; Convert text to audible speech &#8230; command, as featured in <a title='Mac OS X Text to English Speech Primer Tutorial' href='#mosxtespt'>Mac OS X Text to English Speech Primer Tutorial<\/a> as shown below<\/li>\n<li>&#8220;drutil&#8221; &#8212; Interact with CD\/DVD burners &#8230; command, as featured in <a title='Mac Linux DVD Troubleshooting Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-linux-dvd-troubleshooting-primer-tutorial\/'>Mac Linux DVD Troubleshooting Primer Tutorial<\/a><\/li>\n<li>&#8220;caffeinate&#8221; &#8212; Prevent the system from sleeping on behalf of a utility &#8230; command, and of Windows comparable interest you might want to read <a target=_blank title='AutoHotKey StayAwake Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/autohotkey-stayawake-tutorial\/'>AutoHotKey StayAwake Tutorial<\/a><\/li>\n<li>&#8220;opendiff&#8221; &#8212; Use FileMerge to graphically compare or merge file or directories<\/li>\n<li>&#8220;qlmanage&#8221; &#8212; Quick Look Server debug and management tool<\/li>\n<li>&#8220;scp&#8221; &#8212; Secure copy (remote file copy program)<\/li>\n<\/ul>\n<p>This comes towards addressing a long running wish for us, that being the coalescing of public web application functionality on the rjmprogramming.com.au domain with <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> local web server web application functionality into the one web application.   The reason we&#8217;ve decided to try it with the &#8220;Zipfiles&#8221; project is a bit like the reason we wanted to try it, again with the &#8220;Zipfiles&#8221; project, with <a target=_blank title='Zipfiles in PHP Media Gallery Synchronize Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/zipfiles-in-php-media-gallery-synchronize-tutorial\/'>Zipfiles in PHP Media Gallery Synchronize Tutorial<\/a> is that PHP code sources, several perhaps, of use can be gathered in the one place, downloadable, and it is this downloading capability that is required to make the one menu system to be able to load HTML iframe web applications from either public or &#8220;private&#8221; local MAMP in the one sitting.  There are four user &#8220;categories&#8221; of possibilitites here, those being &#8230;<\/p>\n<ul>\n<li>Mac OS X <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> users of the &#8220;Zipfiles&#8221; <i>HTTP:\/\/localhost:8888\/ziptest.php?zipfile=mamptest.zip<\/i> web application (because they&#8217;ve downloaded it to use that way)  who will see at least one new &#8220;MAMP&#8221; button and up to 6 others for those PHP web applications above that they have downloaded off the zipfile with the application, and then used Mac OS X&#8217;s Finder to reposition at MAMP&#8217;s default document root of \/Applications\/MAMP\/htdocs<\/li>\n<li>users of the rjmprogramming.com.au &#8220;Zipfiles&#8221; <a target=_blank href=\"HTTP:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php?zipfile=mamptest.zip\">live run<\/a> web application who also have MAMP installed and running, who will see at least one new &#8220;MAMP&#8221; button and up to 6 others for those PHP web applications above that they have downloaded off the zipfile with the application, and then used Mac OS X&#8217;s Finder to reposition at MAMP&#8217;s default document root of \/Applications\/MAMP\/htdocs<\/li>\n<li>users of the rjmprogramming.com.au &#8220;Zipfiles&#8221; <a target=_blank href=\"HTTP:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php?zipfile=mamptest.zip\">live run<\/a> web application who are accessing a zipfile containing any PHP file and  who are using Mac OS X but do not have MAMP installed (or do not have it running) will see a link to the <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a> website to encourage you to start the ball rolling<\/li>\n<li>users of the rjmprogramming.com.au &#8220;Zipfiles&#8221; <a target=_blank href=\"HTTP:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php?zipfile=mamptest.zip\">live run<\/a> web application who are not using Mac OS X, even if they have MAMP installed and are running the web application using that here, will not see any new buttons<\/li>\n<\/ul>\n<p>Complexity of PHP coding here concerns the differentiation of category 2 users from category 3 users above, and involved, at least for us, <a target=_blank title='jQuery Ajax information' href='http:\/\/api.jquery.com\/jquery.ajax\/'>jQuery Ajax<\/a> techniques, specifically involving the <a target=_blank href='http:\/\/stackoverflow.com\/questions\/19035557\/jsonp-request-error-handling'>great advice from this JSONP request error handling webpage<\/a>, thanks, to introduce a <b>timeout<\/b> so that the error handling is given time to be examined regarding error codes, as per code like (for a global Javascript var<font size=1>iable<\/font> <i>lasterr<\/i>) &#8230;<\/p>\n<p><code><br \/>\n    $.ajax({<br \/>\n     url: 'http:\/\/localhost:8888\/MAMP\/',<br \/>\n     dataType: 'jsonp',<br \/>\n     <b>timeout: 5000<\/b>,<br \/>\n     success: function (parsed_json) {<br \/>\n     },<br \/>\n     error: function (parsedjson, textStatus, errorThrown) {<br \/>\n       <b>lasterr=parsedjson.status;   \/\/ if this is 200 rather than 404 (running) MAMP is possible<\/b><br \/>\n     }<br \/>\n     });<br \/>\n<\/code><\/p>\n<p>And so here is the PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php----GETME\" title='ziptest.php'>ziptest.php<\/a> source code changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/ziptest.php----GETME\" title='ziptest.php'>this way<\/a> to allow for Mac OS X and MAMP afficianados try out those nifty Mac OS X command line gems.<\/p>\n<p>We want to thank <a target=_blank title='Useful link, thanks' href='https:\/\/www.infoworld.com\/article\/2614879\/mac-os-x\/mac-os-x-top-20-os-x-command-line-secrets-for-power-users.html'>this great link<\/a> for ideas in this line of thinking.<\/p>\n<hr>\n<p id='mosxtespt'>Previous relevant <a target=_blank title='Mac OS X Text to English Speech Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-text-to-english-speech-primer-tutorial\/'>Mac OS X Text to English Speech Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html?clickit=submitmb\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Mac OS X Text to English Speech Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/say.jpg\" title=\"Mac OS X Text to English Speech Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Mac OS X Text to English Speech Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve got a few new ideas today &#8230;<\/p>\n<ol>\n<li>Text to English Speech via Mac OS X&#8217;s command line <a target=_blank title='say command information from Apple' href='https:\/\/developer.apple.com\/legacy\/library\/documentation\/Darwin\/Reference\/ManPages\/man1\/say.1.html'><i>say<\/i><\/a> command used by PHP via <a target=_blank title='PHP exec() method information' href='http:\/\/php.net\/manual\/en\/function.exec.php'><i>exec<\/i><\/a> to make <a target=_blank title='say.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/say.php_GETME'>say.php<\/a> (which is useful as a download to a Mac OS X laptop using <a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'>MAMP<\/a>) which, today, does not have a live run because the web server of domain <i>rjmprogramming.com.au<\/i> is a CentOS Linux server &#8230; Linux equivalent of Mac OS X&#8217;s <i>say<\/i>? &#8230; read <a target=_blank title='Useful link' href='https:\/\/github.com\/usc-isi-i2\/festival-text-to-speech-service\/blob\/master\/README.md'>here<\/a><\/li>\n<li>Trying to present this brought up the usual movie production problem with <a target=_blank title='iMovie for Mac information from Apple' href='http:\/\/www.apple.com\/au\/mac\/imovie\/'>iMovie<\/a> overlaying the audio on top of the video (though you may want to try, and you could start reading with <a target=_blank title='Semi useful link' href='http:\/\/video.stackexchange.com\/questions\/2579\/can-you-link-an-audio-track-to-a-video-track-in-imovie'>this link<\/a>) versus <a target=_blank title='QuickTime information from Apple' href='https:\/\/support.apple.com\/downloads\/quicktime'>QuickTime Player<\/a> talent to catch both audio and video tracks (and that we ended up using), but not of the &#8220;screen goings on&#8221;, alas versus <a target=_blank title='MPlayer OSX Extended information' href='http:\/\/mplayerosx.ch\/'>MPlayer OSX Extended<\/a> which can play separately but not two tracks on top and doesn&#8217;t do any reconstituting &#8230; so &#8230;<\/li>\n<li>Improved on our inhouse Video\/Audio synchronizing efforts by allowing <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>audio_video.html<\/a> supervisor (changed in <a target=_blank title='audio_video.html' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html---GETME'>this way<\/a>) be able to be called to press one of its preconceived synchronization buttons <i>onload<\/i> which we do with (the newly added) <a target=_blank title='Macbeth Act 1 Scene 1' href='http:\/\/www.rjmprogramming.com.au\/PHP\/audio_video.html?clickit=submitmb'>Macbeth Act 1 Scene 1<\/a> &#8230; in a small <a target=_blank title='Birthday of Shakespeare' href='http:\/\/www.shakespeare.org.uk\/visit-the-houses\/whats-on.html\/birthday-celebrations.html'>celebration<\/a> of the Bard &#8230; who, am thinking (in that Falstaff way), would have got a huge chuckle out of &#8220;anonymous&#8221; instead of &#8220;anon&#8221; during the Three Witches scene &#8230; we <i>had<\/i> to do something to say Happy Birthday<\/li>\n<\/ol>\n<p>Along the way we tried filming the MacBook Pro with the iPad to a <a target=_blank title='YouTube' href='http:\/\/youtube.com'>YouTube<\/a> &#8230;<\/p>\n<p><iframe loading=\"lazy\" width=\"420\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/9-Hvlz8g1Mg\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p> &#8230; but weren&#8217;t happy with the audio quality, alas (too\/two).<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d21904' onclick='var dv=document.getElementById(\"d21904\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/text-to-speech\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d21904' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d33372' onclick='var dv=document.getElementById(\"d33372\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/mamp\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d33372' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Mac OS X command line (accessible via its Terminal desktop application) is not exactly Unix nor Linux, but more BSD. As such, it has developed some interesting command line commands, some of which we&#8217;ve mentioned in the past, and, &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-do-not-sleep-mamp-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,12,14,29,37],"tags":[69,85,1875,234,1750,354,2352,405,652,663,664,2351,714,725,744,932,1772,997,2350,1197,1252,2027,1319,1497],"class_list":["post-33372","post","type-post","status-publish","format-standard","hentry","category-ajax","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-ajax","tag-apache","tag-bsd","tag-command-line","tag-document-root","tag-dom","tag-drutil","tag-exec","tag-javascript","tag-jquery","tag-json","tag-jsonp","tag-local-web-server","tag-mac-os-x","tag-mamp","tag-php","tag-port","tag-programming","tag-say","tag-stay-resident","tag-terminal","tag-timeout","tag-tutorial","tag-zip"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33372"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=33372"}],"version-history":[{"count":17,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33372\/revisions"}],"predecessor-version":[{"id":33417,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33372\/revisions\/33417"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=33372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=33372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=33372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}