<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
<title>Fun with ones and zeros - macosx</title>
<description><![CDATA[Barry's notes on computer software and hardware]]></description>
<link>/blog/tags/macosx</link>
<lastBuildDate>Fri, 08 May 2026 21:51:01 -0700</lastBuildDate>
<item>
<title>WTF!, when did those files get deleted ?!</title>
<link>/blog/entries/wtf-when-did-those-files-get-deleted</link>
<pubDate>Tue, 25 Oct 2011 19:08:00 -0700</pubDate>
<author>bp@barryp.org (Barry Pederson)</author>
<description><![CDATA[<body><p>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'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.</p>
<p>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's missing they don't do you much good.  </p>
<p>What you need is something that would alert you of unexpected deletions.  Thinking about my friend'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'd notice, listing a diff of the changes.</p>
<p>I saved this on my disk as <code>/Users/barryp/bin/inventory_iphoto.sh</code></p>
<div class="source"><pre><span></span><span class="ch">#!/bin/bash</span>
<span class="c1">#</span>
<span class="c1"># Check if anything has been deleted from the iPhoto Originals</span>
<span class="c1"># folder, and if so, place a file on the Desktop listing what's</span>
<span class="c1"># gone missing</span>
<span class="c1">#</span>

<span class="nv">CHECK_FILE</span><span class="o">=</span>~/Library/Logs/com.diskcompare.inventory_iphoto.txt

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

 ; Directory in which the loadable extensions (modules) reside.
<span class="gd">-extension_dir = "./"</span>
<span class="gi">+;extension_dir = "./"</span>

 ; 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
<span class="gu">@@ -595,6 +595,7 @@</span>
 ; needs to go here.  Specify the location of the extension with the
 ; extension_dir directive above.

<span class="gi">+extension=bcmath.so</span>

 ; Windows Extensions
 ; Note that ODBC support is built in, so no dll is needed for it.
</pre></div>
<p>After that, I was able to run the <code>amqp_test.php</code> file for the first time, sending a message and receiving it in py-amqplib's <code>demo/demo_receive.py</code></p></body>]]></description>
</item>
<item>
<title>Macbook sleep problem</title>
<link>/blog/entries/macbook-sleep-problem</link>
<pubDate>Wed, 12 Nov 2008 19:13:48 -0800</pubDate>
<author>bp@barryp.org (Barry Pederson)</author>
<description><![CDATA[
<p>I've been using a Macbook for a couple years now, and really love the thing - but it's had an annoying sleep disorder that I finally found a workaround for.  <br />
</p>
<p>I rarely shut it off, usually just closing the lid when I'm not using it, so it goes to sleep.  The problem has been waking up back up - often I'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).
</p>
<p>It turns out there's a command-line utility to change some power settings, and using it to set the machine <strong>not</strong> to wake up when the lid opens seems to help.  The command is:
</p>
<pre><code>sudo pmset -a lidwake 0
</code></pre><p>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't acted up yet, so I think this is a good fix.
</p>


]]></description>
</item>
<item>
<title>Logitech QuickCam Communicate STX</title>
<link>/blog/entries/logitech-quickcam-communicate-stx</link>
<pubDate>Sat, 26 Apr 2008 14:21:39 -0700</pubDate>
<author>bp@barryp.org (Barry Pederson)</author>
<description><![CDATA[
<p><a href="/blog/entries/logitech-quickcam-pro-5000-mac-mini/">Earlier</a>, I wrote about setting up a Mac Mini user running OSX Tiger 10.4.x with a <a href="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;cjsku=N82E16826104045" rel="nofollow">Logitech QuickCam Pro 5000</a>, and how there was trouble using the camera's microphone.  Fixing it involved mucking around with Mac OSX kernel extensions, and later automatic updates seem to have messed that up.  <br />
</p>
<p>Rather than keep fighting with OSX, I swapped out that webcam for a Logitech QuickCam Communicate STX. Specifically, the model with part # <a href="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;cjsku=N82E16826104021">961464-0403</a>.
</p>
<p>It's <strong>not</strong> supported by default with OSX 10.4.x, but it is supported by <a href="http://webcam-osx.sourceforge.net/">macam</a>, 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.
</p>


]]></description>
</item>
</channel>
</rss>