<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Fun with ones and zeros - macosx</title>
<subtitle>Barry&#039;s notes on computer software and hardware</subtitle>
<link href="/blog/tags/macosx"></link>
<updated>2026-05-08T21:52:40-07:00</updated>
<id>urn:uuid:fc7d7b3d-654a-d9f6-a823-66a9e082449d</id>
<entry>
<title>WTF!, when did those files get deleted ?!</title>
<link href="/blog/entries/wtf-when-did-those-files-get-deleted"></link>
<id>urn:uuid:70462cab-8c0c-78cc-a5e6-cd10f6e7e2c4</id>
<updated>2011-10-25T19:08:00-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;body&gt;&lt;p&gt;A guy I work with recently showed me a bad situation he had with iPhoto, some family videos had gone missing from his harddisk.  The thumbnails were in iPhoto, but when he clicked on them, they wouldn&#039;t play because the files were gone.  He had Time Machine backups, but they were gone even in the oldest copies.  Apparently the files had been deleted quite a while ago.&lt;/p&gt;
&lt;p&gt;This got me thinking about a huge problem with backups - you can be very diligent about keeping them, but if you have no idea that something&#039;s missing they don&#039;t do you much good.  &lt;/p&gt;
&lt;p&gt;What you need is something that would alert you of unexpected deletions.  Thinking about my friend&#039;s experience, I whipped together a small shell script that would be run periodically to take an inventory of the iPhoto originals, and if something was removed compared to the last run, it would place a file on my desktop that hopefully I&#039;d notice, listing a diff of the changes.&lt;/p&gt;
&lt;p&gt;I saved this on my disk as &lt;code&gt;/Users/barryp/bin/inventory_iphoto.sh&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;ch&quot;&gt;#!/bin/bash&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Check if anything has been deleted from the iPhoto Originals&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# folder, and if so, place a file on the Desktop listing what&#039;s&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# gone missing&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;CHECK_FILE&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;~/Library/Logs/com.diskcompare.inventory_iphoto.txt

find ~/Pictures/iPhoto&lt;span class=&quot;se&quot;&gt;\ &lt;/span&gt;Library/Originals -type f &lt;span class=&quot;p&quot;&gt;|&lt;/span&gt; sort &amp;gt;&lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.new
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -e &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    diff -u &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.new &amp;gt;&lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.diff
    grep &lt;span class=&quot;s1&quot;&gt;&#039;^-/&#039;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.diff &amp;gt;&lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.gone
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; -s &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.gone &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
        mv &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.diff &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/Desktop/DELETED iPhoto files-`date &quot;&lt;/span&gt;+%Y-%m-%d %H%M%S&lt;span class=&quot;s2&quot;&gt;&quot;`.txt&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
        rm &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.diff
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
    rm &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.gone
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
mv &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;.new &lt;span class=&quot;nv&quot;&gt;$CHECK_FILE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and made it executable with &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;chmod +x /Users/barryp/bin/inventory_iphoto.sh&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Other than the directory name to check, there&#039;s nothing iPhoto or even Mac specific about this, it could be easily adapted for other uses.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;You can run the script manually too anytime you want, and you can test this out by running once, editing &lt;code&gt;~/Library/Logs/com.diskcompare.inventory_iphoto.txt&lt;/code&gt; to add a line (starting with a /), and then running the script again to make sure a diff file pops up on your desktop showing how the line you manually added is gone in the updated inventory.&lt;/p&gt;
&lt;p&gt;Next, I setup the Mac to run this once a day or so, by creating a &lt;code&gt;launchd&lt;/code&gt; job saved as &lt;code&gt;/Users/barryp/Library/LaunchAgents/com.diskcompare.inventory_iphoto.plist&lt;/code&gt; &lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/span&gt;
&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;plist&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;version=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;Label&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.diskcompare.inventory_iphoto&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;ProgramArguments&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;
        &lt;span class=&quot;nt&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;/Users/barryp/bin/inventory_photo.sh&lt;span class=&quot;nt&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;StartInterval&lt;span class=&quot;nt&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;integer&amp;gt;&lt;/span&gt;86400&lt;span class=&quot;nt&quot;&gt;&amp;lt;/integer&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;
&lt;span class=&quot;nt&quot;&gt;&amp;lt;/plist&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;(You&#039;ll have to change the path to the script to suit your setup, unfortunately it doesn&#039;t seem you can use tilde expansion in a launchd job)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;and then activated it in &lt;code&gt;launchd&lt;/code&gt; with this command at the command prompt:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;launchctl load ~/Library/LaunchAgents/com.diskcompare.inventory_iphoto.plist&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Fortunately my friend found a really old harddisk that happened to have his missing videos on it, but he&#039;s even more lucky to have noticed the problem in the first place.  &lt;/p&gt;
&lt;p&gt;With a periodic inventory as described above, hopefully a person would become aware of a problem with in a day or two, in plenty of time get the files out of a backup system.&lt;/p&gt;&lt;/body&gt;</content>
</entry>
<entry>
<title>Flash playback on MacOSX Firefox</title>
<link href="/blog/entries/flash-playback-macosx-firefox"></link>
<id>urn:uuid:99af868e-1799-b61e-91ba-4ed764a27d1c</id>
<updated>2009-09-29T15:57:41-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;For a long time I&#039;ve been annoyed by really jerky playback on Flash videos under Firefox on MacOSX.&lt;br /&gt;
&lt;a href=&quot;http://www.youtube.com/watch?v=BudhFVnN2o0&quot;&gt;This YouTube video&lt;/a&gt; for example, was just awful to watch, stuttering very frequently.
&lt;/p&gt;
&lt;p&gt;Turns out the fix is pretty simple: just go into about:config and increase the &lt;code&gt;browser.sessionstore.interval&lt;/code&gt; setting in Firefox from the default of 10000 (10 seconds) to something larger like 120000 (120 seconds).&lt;br /&gt;
Got it from &lt;a href=&quot;http://www.ubuntumini.com/2009/08/smooth-flash-playback-by-hacking.html&quot;&gt;this page&lt;/a&gt;, even though it&#039;s talking about Ubuntu Firefox, it still applies to MacOSX and seems to have made a world of difference.
&lt;/p&gt;</content>
</entry>
<entry>
<title>Building additional PHP modules on OSX</title>
<link href="/blog/entries/building-additional-php-modules-osx"></link>
<id>urn:uuid:d6dedaf0-9a55-6a46-528e-44e43df37111</id>
<updated>2008-12-08T20:09:00-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;body&gt;&lt;p&gt;Normally I try to avoid dealing with PHP if at all possible, but there is now a PHP port of &lt;a href=&quot;/software/py-amqplib&quot;&gt;py-amqplib&lt;/a&gt;
called &lt;a href=&quot;http://code.google.com/p/php-amqplib/&quot;&gt;php-amqplib&lt;/a&gt;, and I offered to help out with it a bit.  Maybe partially out of guilt for having
written the mess of Python code it was based on :)&lt;/p&gt;
&lt;p&gt;I thought it would be handy to work on it using my MacBook.  OS X 10.5 (Leopard) has PHP 5.2.6 built in standard, but unfortunately it doesn&#039;t have the &lt;code&gt;bcmath&lt;/code&gt; extension included, which php-amqplib makes use of.  Turns out building the module wasn&#039;t that difficult.  &lt;a href=&quot;http://kenior.com/macintosh/adding-gd-library-for-mac-os-x-leopard&quot;&gt;This page&lt;/a&gt; got me going - although building &lt;code&gt;bcmath&lt;/code&gt; was much simpler.  Since I had the Apple Developer Tools for 10.5 installed, it was just a matter of ...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mkdir /SourceCache&lt;/li&gt;
&lt;li&gt;cd /SourceCache&lt;/li&gt;
&lt;li&gt;fetch &lt;a href=&quot;https://www.php.net/get/php-5.2.6.tar.gz/from/this/mirror&quot;&gt;https://www.php.net/get/php-5.2.6.tar.gz/from/this/mirror&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;tar xzvf php-5.2.6.tar.gz&lt;/li&gt;
&lt;li&gt;cd php-5.2.6/ext/bcmath&lt;/li&gt;
&lt;li&gt;phpize&lt;/li&gt;
&lt;li&gt;./configure&lt;/li&gt;
&lt;li&gt;make&lt;/li&gt;
&lt;li&gt;sudo make install&lt;/li&gt;
&lt;li&gt;cd /etc&lt;/li&gt;
&lt;li&gt;cp php.ini.default php.ini&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And then edit /etc/php.ini to make these two changes:&lt;/p&gt;
&lt;div class=&quot;source&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;gd&quot;&gt;--- php.ini.default     2008-07-15 14:19:15.000000000 -0500&lt;/span&gt;
&lt;span class=&quot;gi&quot;&gt;+++ php.ini     2008-12-08 21:44:52.000000000 -0600&lt;/span&gt;
&lt;span class=&quot;gu&quot;&gt;@@ -483,7 +483,7 @@&lt;/span&gt;
 user_dir =

 ; Directory in which the loadable extensions (modules) reside.
&lt;span class=&quot;gd&quot;&gt;-extension_dir = &quot;./&quot;&lt;/span&gt;
&lt;span class=&quot;gi&quot;&gt;+;extension_dir = &quot;./&quot;&lt;/span&gt;

 ; Whether or not to enable the dl() function.  The dl() function does NOT work
 ; properly in multithreaded servers, such as IIS or Zeus, and is automatically
&lt;span class=&quot;gu&quot;&gt;@@ -595,6 +595,7 @@&lt;/span&gt;
 ; needs to go here.  Specify the location of the extension with the
 ; extension_dir directive above.

&lt;span class=&quot;gi&quot;&gt;+extension=bcmath.so&lt;/span&gt;

 ; Windows Extensions
 ; Note that ODBC support is built in, so no dll is needed for it.
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After that, I was able to run the &lt;code&gt;amqp_test.php&lt;/code&gt; file for the first time, sending a message and receiving it in py-amqplib&#039;s &lt;code&gt;demo/demo_receive.py&lt;/code&gt;&lt;/p&gt;&lt;/body&gt;</content>
</entry>
<entry>
<title>Macbook sleep problem</title>
<link href="/blog/entries/macbook-sleep-problem"></link>
<id>urn:uuid:6ad3e3cf-eb8e-8703-8b96-a6dc0bdd4449</id>
<updated>2008-11-12T19:13:48-08:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;I&#039;ve been using a Macbook for a couple years now, and really love the thing - but it&#039;s had an annoying sleep disorder that I finally found a workaround for.  &lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;I rarely shut it off, usually just closing the lid when I&#039;m not using it, so it goes to sleep.  The problem has been waking up back up - often I&#039;d open the lid and start to enter the password to unlock the system, and the screen would go black and the machine would act sort of half-asleep.  It almost seemed like it was confused as to whether the lid was open or not - maybe it was something with the lid sensor (which some other discussions online hinted at).
&lt;/p&gt;
&lt;p&gt;It turns out there&#039;s a command-line utility to change some power settings, and using it to set the machine &lt;strong&gt;not&lt;/strong&gt; to wake up when the lid opens seems to help.  The command is:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo pmset -a lidwake 0
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The machine still goes to sleep when the lid closes, but now after opening the lid it waits until I hit a key on the keyboard before it rouses itself.   After 3 or 4 days of this, it hasn&#039;t acted up yet, so I think this is a good fix.
&lt;/p&gt;


</content>
</entry>
<entry>
<title>Logitech QuickCam Communicate STX</title>
<link href="/blog/entries/logitech-quickcam-communicate-stx"></link>
<id>urn:uuid:ad805429-6d14-efdd-d602-bb35ff147b48</id>
<updated>2008-04-26T14:21:39-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">
&lt;p&gt;&lt;a href=&quot;/blog/entries/logitech-quickcam-pro-5000-mac-mini/&quot;&gt;Earlier&lt;/a&gt;, I wrote about setting up a Mac Mini user running OSX Tiger 10.4.x with a &lt;a href=&quot;http://www.kqzyfj.com/click-2824236-10440897?url=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProduct.aspx%3FItem%3DN82E16826104045%26nm_mc%3DAFC-C8Junction%26cm_mmc%3DAFC-C8Junction-_-Webcam-_-Logitech%2BInc.-_-26104045&amp;amp;cjsku=N82E16826104045&quot; rel=&quot;nofollow&quot;&gt;Logitech QuickCam Pro 5000&lt;/a&gt;, and how there was trouble using the camera&#039;s microphone.  Fixing it involved mucking around with Mac OSX kernel extensions, and later automatic updates seem to have messed that up.  &lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Rather than keep fighting with OSX, I swapped out that webcam for a Logitech QuickCam Communicate STX. Specifically, the model with part # &lt;a href=&quot;http://www.tkqlhce.com/click-2824236-10440897?url=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProduct.aspx%3FItem%3DN82E16826104021%26nm_mc%3DAFC-C8Junction%26cm_mmc%3DAFC-C8Junction-_-Webcam-_-Logitech%2BInc.-_-26104021&amp;amp;cjsku=N82E16826104021&quot;&gt;961464-0403&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;It&#039;s &lt;strong&gt;not&lt;/strong&gt; supported by default with OSX 10.4.x, but it is supported by &lt;a href=&quot;http://webcam-osx.sourceforge.net/&quot;&gt;macam&lt;/a&gt;, which is ridiculously easy to install.  After doing so it worked fine with Skype, and the auto-exposure feature even worked, where it adjusted itself automatically for the lighting in the room.
&lt;/p&gt;


</content>
</entry>
</feed>