{"id":496,"date":"2012-04-19T15:14:52","date_gmt":"2012-04-19T20:14:52","guid":{"rendered":"http:\/\/www.brunerd.com\/blog\/?p=496"},"modified":"2012-04-19T16:46:49","modified_gmt":"2012-04-19T21:46:49","slug":"apples-new-epoch-time-for-webcomponentslastused","status":"publish","type":"post","link":"https:\/\/www.brunerd.com\/blog\/2012\/04\/19\/apples-new-epoch-time-for-webcomponentslastused\/","title":{"rendered":"Apple&#8217;s New Epoch Time for WebComponentsLastUsed"},"content":{"rendered":"<p>The latest Java update for Lion 2012-003 ( which after 3 revisions is still called JavaForOSX-1.0 in Software Update &#8211; oh, Apple! But I digress&#8230;) will turn off Java if it hasn&#8217;t been used in 30 days (or so I hear). It accomplishes this by writing a value to the WebComponentsLastUsed\u00a0in ~\/Library\/Preferences\/ByHost\/com.apple.java.JavaPreferences.<em>UUID.plist.<\/em><\/p>\n<p><a href=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/WebComponentsLastUsed.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-497\" title=\"WebComponentsLastUsed\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/WebComponentsLastUsed.png\" alt=\"\" width=\"280\" height=\"257\" \/><\/a><\/p>\n<p><em><\/em>It used to be enough to have WebComponentsEnabled set to True, but now\u00a0WebComponentsLastUsed is required or the unclickable &#8220;Plugin-Disabled&#8221; button will be shown in Safari&#8217;s lower right corner (it totally looks clickable yeah?)<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Java-Plugin-Inactive.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-498 aligncenter\" title=\"Java Plugin Inactive\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/Java-Plugin-Inactive.png\" alt=\"\" width=\"131\" height=\"38\" \/><\/a><\/p>\n<p style=\"text-align: left;\">If you work at a company that requires Java web components to be on for things like timesheets, making sure Java stays\u00a0<strong>on<\/strong>\u00a0helps to avoid getting help desk calls.<\/p>\n<p style=\"text-align: left;\">So I needed to figure out how this value was computed, it was too small to be the <a href=\"http:\/\/www.epochconverter.com\">Unix epoch<\/a> (seconds since January 1, 1970), so I did some sleuthing, some comparitive analysis (just to sound fancy), and figured out it is <strong>the number of seconds since January 1, 2001<\/strong>. To get this value you just need to get the Unix epoch and subtract the <a href=\"http:\/\/www.epochconverter.com\/epoch\/timestamp-list.php\">number of seconds since Jan 1, 2001<\/a>.<\/p>\n<p style=\"text-align: left;\">Here&#8217;s the way to get this value in a BASH Terminal:<\/p>\n<pre style=\"text-align: left;\">echo $(( $(date \"+%s\") - 978307200 ))<\/pre>\n<p style=\"text-align: left;\">Toggling the check box in \/Applications\/Utilities\/Java Preferences will reset the WebComponentsLastUsed value and you will find it very close to the value from Terminal.<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/JavaPrefs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-504\" title=\"JavaPrefs\" src=\"http:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/JavaPrefs.png\" alt=\"\" width=\"422\" height=\"115\" srcset=\"https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/JavaPrefs.png 422w, https:\/\/www.brunerd.com\/blog\/wp-content\/uploads\/JavaPrefs-300x81.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">Wasn&#8217;t that fun? The Der Flounder blog has a <a href=\"http:\/\/derflounder.wordpress.com\/2012\/04\/13\/automatically-activate-the-java-web-plug-ins-setting-on-login\/\">script<\/a>\u00a0using this method to turn on Java. He was a good sport to incorporate my code, too. He enlightened me with his UUID scripting code, so share and share alike, I say.<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/www.joabj.com\/blog\/?p=814\">Bonus link<\/a> for Apple&#8217;s other epoch time, for iTunes&#8217; XML Play Date field: January 1, 1904 &#8211; that&#8217;s the first year of the last century with a leap year, <a href=\"http:\/\/help.filemaker.com\/app\/answers\/detail\/a_id\/4051\/~\/why-january-1,-1904-is-macintosh-day-number-1\">so says Filemaker<\/a>! ;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest Java update for Lion 2012-003 ( which after 3 revisions is still called JavaForOSX-1.0 in Software Update &#8211; oh, Apple! But I digress&#8230;) will turn off Java if it hasn&#8217;t been used in 30 days (or so I hear). It accomplishes this by writing a value to the WebComponentsLastUsed\u00a0in ~\/Library\/Preferences\/ByHost\/com.apple.java.JavaPreferences.UUID.plist. It used to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,12,8],"tags":[17,18],"class_list":["post-496","post","type-post","status-publish","format-standard","hentry","category-apple","category-os-x","category-scripting","category-security","tag-java","tag-webcomponentslastused"],"_links":{"self":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/comments?post=496"}],"version-history":[{"count":11,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":506,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/posts\/496\/revisions\/506"}],"wp:attachment":[{"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/media?parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/categories?post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brunerd.com\/blog\/wp-json\/wp\/v2\/tags?post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}