{"id":22942,"date":"2016-06-22T03:01:35","date_gmt":"2016-06-21T17:01:35","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=22942"},"modified":"2016-06-22T19:49:36","modified_gmt":"2016-06-22T09:49:36","slug":"mac-os-x-mamp-timekeeping-web-application-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-mamp-timekeeping-web-application-primer-tutorial\/","title":{"rendered":"Mac OS X MAMP Timekeeping Web Application Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/quarter_hour_timer.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Mac OS X MAMP Timekeeping Web Application Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/quarter_hour_timer.jpg\" title=\"Mac OS X MAMP Timekeeping Web Application Primer Tutorial\"  style=\"float:left;\"   \/><\/a><p class=\"wp-caption-text\">Mac OS X MAMP Timekeeping Web Application Primer Tutorial<\/p><\/div>\n<p>Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms.  So it is today with our timekeeping web application that relies on &#8230;<\/p>\n<ul>\n<li><i>Mac OS X<\/i> operating system +<\/li>\n<li>Existance of [\/usr\/sbin\/]<a target=_blank title='screencapture command information from Apple' href='https:\/\/developer.apple.com\/legacy\/library\/documentation\/Darwin\/Reference\/ManPages\/man1\/screencapture.1.html'><i>screencapture<\/i><\/a> +<\/li>\n<li><a target=_blank title='crontab information from computerhope ... thanks' href='http:\/\/www.computerhope.com\/jargon\/c\/cron.htm'><i>crontab<\/i><\/a> active and editable via <i>crontab -e<\/i> +<\/li>\n<li>One of &#8230;\n<ol>\n<li><a target=_blank title='MAMP for Apache\/PHP\/MySql on Mac OS X local web server' href='http:\/\/www.mamp.info'><i>MAMP<\/i><\/a> installed to, in our case, <i>\/Applications\/MAMP\/htdocs\/<\/i> (as is mentioned in the relevant <i>crontab<\/i> background task that snapshots the user&#8217;s screen every quarter hour) that maps to the MAMP web application URL <i>http:\/\/localhost:8888\/<\/i> &#8230; or &#8230;<\/li>\n<li><i>crontab<\/i> directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the <i>directory<\/i> below, used, could be a place of your choosing (that matches what is in your <i>crontab<\/i> task entry)) &#8230;<br \/>\n<code><br \/>\nfile:\/\/<i>\/Applications\/MAMP\/htdocs\/<\/i>quarter_hour_timer.html?localplace=<br \/>\n<\/code><br \/>\n&#8230; or just, via the web browser&#8217;s File -&gt; Open File menu &#8230;<br \/>\n<code><br \/>\nfile:\/\/<i>\/Applications\/MAMP\/htdocs\/<\/i>quarter_hour_timer.html<br \/>\n<\/code><br \/>\n<img decoding=\"async\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/quarter_hour_timer.gif\"><\/img>\n<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p> &#8230; pretty restrictive, huh? &#8230; but pretty useful for our quarter hour timekeeping purposes today.<\/p>\n<p>We want to have a web application that is running at the user&#8217;s discretion, and when first fired up, looks for outputs from <i>crontab<\/i> tasks above &#8230;<\/p>\n<p><code><br \/>\n0,15,30,45 * * * * \/usr\/sbin\/screencapture -Cd -tjpg <i>\/Applications\/MAMP\/htdocs\/<\/i>screen-`date +\"\\%Y\\%m\\%d-\\%H\\%M\"`.jpg<br \/>\n<\/code><\/p>\n<p> &#8230; for the current day in question and if existant show &#8230;<\/p>\n<ol>\n<li>a date and time stamp +<\/li>\n<li>the snapshot of what you were doing at the quarter hour, that is clickable to make bigger for more in depth viewing +<\/li>\n<li>an HTML textarea element in which you can optionally type in more specifics about that quarter hour<\/li>\n<\/ol>\n<p>So, as much as we like to think of Mac OS X Terminal application&#8217;s <a target=_blank title='Berkeley Software Distribution information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Berkeley_Software_Distribution'>BSD<\/a> (a unix derivative) operating system, as being a lot like Linux, there are some commands and usage that &#8230;<\/p>\n<ul>\n<li>adds Mac OS X specific command line functionality to a Linux or unix base set of functionality, like for today&#8217;s <a target=_blank title='screencapture command information from Apple' href='https:\/\/developer.apple.com\/legacy\/library\/documentation\/Darwin\/Reference\/ManPages\/man1\/screencapture.1.html'><i>screencapture<\/i><\/a> command &#8230; and we&#8217;ve included another such example, below, with the command <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> featuring in <a title='Mac OS X Text to English Speech Primer Tutorial' href='#moxttspt'>Mac OS X Text to English Speech Primer Tutorial<\/a> as shown below<\/li>\n<li>changes switches on Linux or unix commands<\/li>\n<li>won&#8217;t have some Linux or unix commands that other platforms do<\/li>\n<\/ul>\n<p>In the great tradition of <i>behoving<\/i> &#8230; we <i>behove<\/i> &#8230; we <i>behove<\/i> thee <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/quarter_hour_timer.html_GETME\">quarter_hour_timer.html<\/a> if you like, my liege.  On this occasion you&#8217;ll have gleaned that there is no <i>live run<\/i> link, because the RJM Programming web server is not Mac OS X &#8230; so command line <a target=_blank title='screencapture command information from Apple' href='https:\/\/developer.apple.com\/legacy\/library\/documentation\/Darwin\/Reference\/ManPages\/man1\/screencapture.1.html'><i>screencapture<\/i><\/a> has no meaning for a CentOS web server&#8217;s operating system command line.  You&#8217;ll see in the code that rather than use <a target=_blank title='\"Client Pre-emptive Iframe\" at this blog' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/?s=client-pre-emptive-iframe'>&#8220;Client Pre-emptive Iframe&#8221;<\/a> concepts to check for existence of <i>crontab<\/i> screen capture images, we, instead use the <a target=_blank title='Javascript onerror event information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/event_onerror.asp'><i>onerror<\/i><\/a> event for HTML <a target=_blank title='HTML img tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_img.asp'>img<\/a> elements to check for non-existance.<\/p>\n<p><b><i>Stop Press<\/i><\/b><\/p>\n<p>Just noticed that, perhaps, after all, a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/quarter_hour_timer.html\">live run<\/a> from the RJM Programming website can make sense if you have a Mac OS X laptop, for instance, that is running that suggested <i>crontab<\/i> entry as explained in tutorial above.  That type of live run managed to latch on to our local <i>crontab<\/i> screencaptures on my MacBook Pro.<\/p>\n<hr>\n<p id='moxttspt'>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='#d22942' onclick='var dv=document.getElementById(\"d22942\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/time\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d22942' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms. So it is today with our timekeeping web application that relies &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/mac-os-x-mamp-timekeeping-web-application-primer-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":[12,14,29,37],"tags":[135,1875,234,274,576,652,707,714,723,725,744,1922,997,1103,1161,1200,1252,1279,1921,1319,1339],"class_list":["post-22942","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-batch","tag-bsd","tag-command-line","tag-crontab","tag-html","tag-javascript","tag-linux","tag-local-web-server","tag-mac","tag-mac-os-x","tag-mamp","tag-onerror","tag-programming","tag-screen-capture","tag-snapshot","tag-stop-press","tag-terminal","tag-time","tag-timekeeping","tag-tutorial","tag-unix"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22942"}],"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=22942"}],"version-history":[{"count":10,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22942\/revisions"}],"predecessor-version":[{"id":22970,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/22942\/revisions\/22970"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=22942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=22942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=22942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}