<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>phaq &#187; Operating Systems</title>
	<atom:link href="http://phaq.phunsites.net/category/faq/operating-systems/feed/" rel="self" type="application/rss+xml" />
	<link>http://phaq.phunsites.net</link>
	<description>my daily IT madness</description>
	<lastBuildDate>Mon, 30 Jan 2012 10:07:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>Install Icinga with MySQL and IDOUtils on FreeBSD</title>
		<link>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/</link>
		<comments>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:24:23 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=920</guid>
		<description><![CDATA[It&#8217;s not hard to install Icinga on FreeBSD, at least if you&#8217;re satisfied with default options. Should you however require Icinga with IDOUtils and MySQL support, then you need to take additional steps. Note: This howto requires a patch to your FreeBSD ports tree. The patch has been submitted to the FreeBSD port maintainers. I [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not hard to install <a href="http://www.icinga.org" target="_blank">Icinga</a> on FreeBSD, at least if you&#8217;re satisfied with default options.<br />
Should you however require Icinga with IDOUtils and MySQL support, then you need to take additional steps.</p>
<p><span id="more-920"></span></p>
<p><b>Note: This howto requires a <a href="http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt">patch</a> to your FreeBSD ports tree. The patch has been submitted to the FreeBSD port maintainers. I hope that it will eventually end up in the ports tree.</b></p>
<p>My initial readings about this was on the official Icinga docs covering <a href="http://docs.icinga.org/latest/en/quickstart-idoutils-freebsd.html" target="_blank">installing Icinga on FreeBSD with IDOUtils</a>.<br />
However, as it turned out, the docs our a bit outdated, and yet do not reflect a way of doing the install using ports.</p>
<p>So here&#8217;s just a short primer on what I did do install Icinga from ports, imposing as little additional work four you, my fellow reader, as well <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Now let&#8217;s turn to Icinga, which has a port on it&#8217;s own, which you&#8217;ll find it at <strong>/usr/ports/net-mgtm/icinga</strong>. First change to that directory.</p>
<pre>cd /usr/ports/net-mgtm/icinga</pre>
<p>Now download the <a href="http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt">patch file</a> I made into your ports directory.<br />
The patch will inject a new rc-script for ido2db and enable your port to build IDOutils.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# fetch http://phaq.phunsites.net/files/2012/01/patch_icinga_1.5.1_idoutils_fbs_port.txt</pre>
<p>Then apply the patch like this:</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# patch -p0 &lt; patch_icinga_1.5.1_idoutils_fbs_port.txt
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- Makefile.org	2012-01-28 16:36:46.000000000 +0000
|+++ Makefile	2012-01-28 17:51:38.000000000 +0000
--------------------------
Patching file Makefile using Plan A...
Hunk #1 succeeded at 27.
Hunk #2 succeeded at 109.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- /dev/null	2012-01-28 18:00:51.000000000 +0000
|+++ files/ido2db.in	2012-01-28 18:00:30.000000000 +0000
--------------------------
(Creating file files/ido2db.in...)
Patching file files/ido2db.in using Plan A...
Hunk #1 succeeded at 1.
Hmm...  The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- files/pkg-message.in.org	2012-01-28 17:48:37.000000000 +0000
|+++ files/pkg-message.in	2012-01-28 17:49:38.000000000 +0000
--------------------------
Patching file files/pkg-message.in using Plan A...
Hunk #1 succeeded at 4.
done</pre>
<p>Now you&#8217;re ready to configure the port:</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# make config</pre>
<p>Note the now <strong>IDOUtils</strong> option that now has appeared. Check it to enable IDOUtils.</p>
<p><a href="http://phaq.phunsites.net/files/2012/01/idoutils_config_screen.png" rel="lightbox[920]"><img class="aligncenter size-medium wp-image-929" src="http://phaq.phunsites.net/files/2012/01/idoutils_config_screen-300x180.png" alt="" width="300" height="180" /></a></p>
<p>Then compile and install as usual. The port will install also all required dependies, two of them being mysql55-client and libdbi-drivers, both to be found at /usr/ports/databases.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# make install clean</pre>
<p>Afterwards, you should end up with a few additional files, which would not be installed with the stock FreeBSD port.</p>
<pre>[root@localhost /usr/ports/net-mgmt/icinga]# ls -l /usr/local/bin/ido*
-rwxrwxr--  1 root  wheel  238326 Jan 28 16:53 /usr/local/bin/ido2db
-rwxrwxr--  1 root  wheel   80419 Jan 28 16:53 /usr/local/bin/idomod.o

[root@mgmp-bs01 /usr/ports/net-mgmt/icinga]# ls -l /usr/local/etc/rc.d/ido2db
-r-xr-xr-x  1 root  wheel  738 Jan 28 18:00 /usr/local/etc/rc.d/ido2db</pre>
<p>Now you can enable Icinage and IDO2DB in /etc/rc.conf by adding these lines:</p>
<pre>icinga_enable="YES"
ido2db_enable="YES"</pre>
<p>Of course, you still need to perform the usual Icinga configuration steps, which are not covered in this post.<br />
Please check with the <a href="http://docs.icinga.org/latest/en" target="_blank">official docs</a> for this procedure.</p>
<p>If your configuration is proper, you should notice this in your logs indicating that IDOMOD (IDOUtils) is really working.</p>
<pre>[1327773651] Icinga 1.5.1 starting... (PID=95448)
[1327773651] Local time is Sat Jan 28 18:00:51 UTC 2012
[1327773651] LOG VERSION: 2.0
[1327773651] idomod: IDOMOD 1.5.1 (09-09-2011) Copyright (c) 2005-2008 Ethan Galstad (nagios@nagios.org), Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org))
[1327773651] idomod: Successfully connected to data sink.  26 queued items to flush.
[1327773651] idomod: Successfully flushed 26 queued items to data sink.
[1327773651] Event broker module '/usr/local/bin/idomod.o' initialized successfully.
[1327773651] Finished daemonizing... (New PID=95450)</pre>
<p>That&#8217;s it, you conquered the beast!</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2012/01/28/install-icinga-with-mysql-and-idoutils-on-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TimeMachine mobile backup eats up disk space if backup drive unavailable</title>
		<link>http://phaq.phunsites.net/2012/01/14/timemachine-mobile-backup-eats-up-disk-space-if-backup-drive-unavailable/</link>
		<comments>http://phaq.phunsites.net/2012/01/14/timemachine-mobile-backup-eats-up-disk-space-if-backup-drive-unavailable/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 10:34:06 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=893</guid>
		<description><![CDATA[Apple introduced a new feature called &#8220;mobile backups&#8221; with OS X Lion. The idea behind that: Use a temporary part of the local hard drive to store backups until the backup drive is connected again. True, this is a good feature for most. But if you can spare some backups, because you &#8211; let&#8217;s say [...]]]></description>
			<content:encoded><![CDATA[<p>Apple introduced a new feature called &#8220;mobile backups&#8221; with OS X Lion.<br />
The idea behind that: Use a temporary part of the local hard drive to store backups until the backup drive is connected again.</p>
<p>True, this is a good feature for most. But if you can spare some backups, because you &#8211; let&#8217;s say &#8211; store your files to a dropbox folder, which is synchronized to a cloud service, then you may not need the mobile backup feature of OS X.<br />
In fact, you may notice running out of disk space, that you could use otherwise.<br />
<span id="more-893"></span><br />
So to see the difference, let&#8217;s check out the available free disk space in Termin us the &#8216;df&#8217; (disk free) utility:</p>
<pre>
gianpaolo-del-mattos-macbook-pro:~ Gianpaolo$ df -h
Filesystem                          Size   Used  Avail Capacity  Mounted on
/dev/disk0s2                        79Gi   69Gi  9.1Gi    89%    /
devfs                              129Ki  129Ki    0Bi   100%    /dev
map -hosts                           0Bi    0Bi    0Bi   100%    /net
map auto_home                        0Bi    0Bi    0Bi   100%    /home
localhost:/SkA_FxsNwtVofJZZOc308I   79Gi   79Gi    0Bi   100%    /Volumes/MobileBackups
</pre>
<p>Gosh, I&#8217;m almost out of space, having only 9 Gigs left :-/</p>
<p>So let&#8217;s get rid of the mobile backups using this command:</p>
<p><code><br />
sudo tmutil disablelocal<br />
</code></p>
<p>Now check back at the disk space:</p>
<pre>
gianpaolo-del-mattos-macbook-pro:~ Gianpaolo$ df -h
Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2    79Gi   60Gi   18Gi    77%    /
devfs          129Ki  129Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
</pre>
<p>You notice, that the &#8216;/Volumes/MobileBackups&#8217; mount point is gone?<br />
I&#8217;m having 18 Gigs free now as well.</p>
<p>So, depending on how long you didn&#8217;t have your backup drive connected, the amount used may well increase to a multiple of that.</p>
<p>It may not be best choice for most people to have mobile backups disabled. But if you DO know what you&#8217;re doing, then go for it <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2012/01/14/timemachine-mobile-backup-eats-up-disk-space-if-backup-drive-unavailable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VpnInit AppleScript: Override and Restore Default VPN-Routes on OS X</title>
		<link>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/</link>
		<comments>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 17:37:04 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Utilities]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=876</guid>
		<description><![CDATA[Years ago I wrote a small script to restore local default route after connecting the RAS VPN on Windows. Now, I made up a similar script to do the same on OS X. The basic idea, now and then, was that I would not want to send all traffic through the VPN. Thus the script [...]]]></description>
			<content:encoded><![CDATA[<p>Years ago I wrote a small script <a href="/2007/06/06/ras_initvbs-override-and-restore-routes-with-windows-ras/">to restore local default route after connecting the RAS VPN on Windows</a>.</p>
<p>Now, I made up a similar script to do the same on OS X.<br />
<span id="more-876"></span><br />
The basic idea, now and then, was that I would not want to send all traffic through the VPN.<br />
Thus the script will assist in restoring your local default route after the VPN connection is established.<br />
Furthermore, it&#8217;ll add some specific routes directed to the VPN.</p>
<p>This way, all your usual traffic (internet, surfing, skype, whatever) is sent through your default gateway, while more specific routes (your business stuff) is sent through the VPN.</p>
<p>Below&#8217;s the code for the initial release. It may lack some details yet, like auto-detecting the tunnel device name, but it does the job already.</p>
<p>Just copy the code into Apple Script Editor and save it to a convenient location. Make sure you save it as &#8220;Application&#8221; and not as &#8220;Script&#8221; (which is the default). You you don&#8217;t, double-clicking the script will open the Script Editor instead of executing the script. Surely, not what you want.</p>
<p>Pay attention to the variables on the top, which need to be edited before you save the Script: _vpn_name, _default_gw, _networks, and _sudo_password (optional).<br />
I hope directions are clear enough from the comments sections.</p>
<pre>
# VpnInit
# ---
# an AppleScript utility to connect your vpn,
# restore local default route and add selected
# routes directed to the VPN only
# thus you'll end up sending only selected
# traffic through the VPN, while the rest
# goes through your local default gateway
# as usual
# ---
# released "as is" under the terms of GPL v2.
# Copyright © 2011 Gianpaolo Del Matto
# 
# r0.1 initial release 2011/12/29
#
# ToDo:
# - hardcoding the "sudo" password is a bad idea, maybe
#	need a better way to get away with it
# - vpn tunnel (utun0) is still hardcoded,
#	should be auto-detected
#

# the name of your vpn connection
#
set _vpn_name to "My VPN"

# your local default gateway
#
set _default_gw to "192.168.1.1"

# your remote networks to pass via VPN, separate multiple with comma
# like so: {"1.2.3.4/30", "5.6.7.8/30"}
#
set _networks to {"192.168.2.1/24"}

# your super-user (root) password
# actually needed to bypass the prompts
# leave empty to get prompted
#
set _sudo_password to ""

# ##################################################################
# DO NOT CHANGE ANYTHING BELOW
# ##################################################################

# kindly borrowed from
# http://www.macosxautomation.com/applescript/uiscripting/index.html
# make sure that support for assistive devices is enabled
#
tell application "System Events"
	if UI elements enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script requires access for assistive devices be enabled." &amp; return &amp; return &amp; "To continue, click the OK button and enter an administrative password in the forthcoming security dialog." with icon 1
		end tell
		set UI elements enabled to true
		if UI elements enabled is false then
			display dialog "This script cannot run while access for assistive devices is disabled." &amp; return &amp; "Exiting now." buttons {"OK"} with icon 2
			return "user cancelled"
		end if
	end if
end tell

# now dive into the VPN setup part
#
tell application "System Events"
	set _if_tunnel to "utun0" #	do not change, will be auto-detected, just giving a reasonable default
	tell current location of network preferences
		if exists service _vpn_name then
			# try to connect the VPN service if it's disconnected
			#
			if current configuration of service _vpn_name is not connected then
				connect service _vpn_name
			end if

			# give it some time to settle
			#
			set _retval to false
			repeat until (_retval) is true
				set counter to 0
				repeat while counter is less than 16
					# exit if we get connected
					#
					if current configuration of service _vpn_name is connected then
						set _retval to true
						exit repeat
					end if

					# opt for exit if still not connected after 15 seconds
					#
					if counter is equal to 15 then
						display dialog "VPN '" &amp; _vpn_name &amp; "' is still not connected after 15 seconds. Do you want to keep waiting?" with title "VPN still not connected" buttons {"Yes", "No"}
						if button returned of result is "No" then
							# bail out if user decided not to wait any longer
							#
							set _retval to true
							return
						else
							# otherwise reset the counter so we can trigger again
							#
							set counter to 0
						end if
					end if

					set counter to counter + 1
					delay 1
				end repeat
			end repeat

			# now go to post processing and to the following:
			# - delete default route via vpn
			# - restore original default route
			# - add specific routes to vpn
			#
			if current configuration of service _vpn_name is connected then
				# restore local default route
				#
				do shell script "route delete default" password _sudo_password with administrator privileges
				do shell script "route add default " &amp; _default_gw password _sudo_password with administrator privileges

				# inject custom routes via VPN
				#
				repeat with _network in _networks
					do shell script "route add -interface " &amp; _network &amp; " utun0" password _sudo_password with administrator privileges
				end repeat
			end if
		else
			# bail out if the VPN service does not exist
			#
			display dialog "Given VPN '" &amp; _vpn_name &amp; "' does not exist. Please check the name"
		end if
	end tell
end tell
</pre>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/29/vpninit-applescript-override-and-restore-default-vpn-routes-on-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating MakeMKV with AppleScript</title>
		<link>http://phaq.phunsites.net/2011/12/15/automating-makemkv-with-applescript/</link>
		<comments>http://phaq.phunsites.net/2011/12/15/automating-makemkv-with-applescript/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 21:56:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=858</guid>
		<description><![CDATA[It&#8217;s only days since I wrote about a custom script action upon inserting a DVD in OS X, allowing me have either run the DVD Player or MakeMKV to rip the DVDs. Now I was digging around if I could do some automation on the GUI part, which indeed turned out to work &#8230; at [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s only days since I wrote about <a href="/make-os-x-run-custom-actions-upon-dvd-insert">a custom script action upon inserting a DVD</a> in OS X, allowing me have either run the DVD Player or MakeMKV to rip the DVDs.</p>
<p>Now I was digging around if I could do some automation on the GUI part, which indeed turned out to work &#8230; at least to a certain degree.<br />
<span id="more-858"></span><br />
Let&#8217;s face it: Ripping DVDs with MakeMKV is simple and easy, however its scripting abilities s*** <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>There is actually some limited CLI support available. If you dive into the application package, you&#8217;ll find the <b>/Applications/MakeMKV.app/Contents/MacOS/makemkvcon</b> program, which can be scripted somehow.</p>
<p>In the first place, I was perfectly able to rip off a complete DVD using the CLI command. But that was not what I had in mind, because I wanted to select only the main movies, and there only a limited set of audio streams and subtitles.<br />
As I seemed to be unable to figure out, how that would be possible (some rare comments on the <a href="http://www.makemkv.com/forum2/" target="_blank">MakeMKV forums</a> mentioned, that it would NOT be possible), I ended up using the GUI.</p>
<p>Well, after I wrote the auto-selector script, I started thinking on how to make this a bit more practical.<br />
I know Apple released support for GUI (graphical user interface) scripting already years ago, but I had never really looked into until today <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>After some reading over there at <a href="http://www.macosxautomation.com/applescript/uiscripting/index.html" target="_blank">macosxautomation.com</a> I started on extending my script.<br />
Please consider that you need to enable support for assistive devices, as mentioned on macosxautomation.com &#8212; otherwise the script will simply fail.</p>
<p>With help of <a href="http://pfiddlesoft.com/uibrowser" target="_blank">UI Browser</a>, a utility to explore GUI elements of any application, I was able to identify the relevant items.</p>
<p>So with the latest additions, the script does the following:</p>
<ul>
<li>Runs whenever a DVD is inserted</li>
<li>Automatically run DVD Player if no action is taken &#8211; or -</li>
<li>run MakeMKV if requested to do so</li>
<li>Wait for the DVD TOC (table of contents) to be read initially</li>
<li>As soon as the TOC is read, open the DVD in MakeMKV</li>
<li>Wait until the tracks selected were ripped and try to eject the DVD afterwards</li>
</ul>
<p>And here&#8217;s the code:</p>
<pre>
# dvd-action
# ---
# an AppleScript utility to select DVD Player or MakeMKV
# upon inserting a DVD
# ---
# released "as is" under the terms of GPL v2.
# Copyright © 2011 Gianpaolo Del Matto <www.phunsites.net>
# 
# r0.1 initial release 2011/12/09
# - simple selector with default action after timeout
#
# r0.2 2011/12/15
# - added limited GUI scripting functionality for MakeMKV
#
# r0.3 2011/12/16
# - added support to check for assistive device access
#	(code borrowed from http://www.macosxautomation.com)
# - added simple progress indicator while waiting for drive
#	do become available for access
#

# initialization
#
# true : show progress dialogs, false: hide progress dialogs
set verbose to true

# kindly borrowed from
# http://www.macosxautomation.com/applescript/uiscripting/index.html
# make sure that support for assistive devices is enabled
#
tell application "System Events"
	if UI elements enabled is false then
		tell application "System Preferences"
			activate
			set current pane to pane id "com.apple.preference.universalaccess"
			display dialog "This script requires access for assistive devices be enabled." &#038; return &#038; return &#038; "To continue, click the OK button and enter an administrative password in the forthcoming security dialog." with icon 1
		end tell
		set UI elements enabled to true
		if UI elements enabled is false then
			display dialog "This script cannot run while access for assistive devices is disabled." &#038; return &#038; "Exiting now." buttons {"OK"} with icon 2
			return "user cancelled"
		end if
	end if
end tell

# check if DVD Player or MakeMKV are already running
# if not, present a little menu, that allows to select
# which application should be run
#
if not appIsRunning("DVD Player") and not appIsRunning("MakeMKV") then

	with timeout of 3600 seconds
		display dialog "Please choose your desired action:" with title "Action for DVD" buttons {"Cancel", "play DVD", "rip DVD"} cancel button "Cancel" giving up after (5)
	end timeout
	if button returned of result is "rip DVD" then
		if verbose then display dialog "Starting MakeMKV" buttons {"OK"} giving up after 2
		tell application "MakeMKV" to activate
		repeat
			if application "MakeMKV" is running then exit repeat
			delay 5
		end repeat

	else if button returned of result is "Cancel" then
		return
	else
		if verbose then display dialog "Starting DVD Player" buttons {"OK"} giving up after 2
		tell application "DVD Player" to activate
		return
	end if

end if

# check again if MakeMKV is running
# this time, attempt to automate these steps:
# - automatically open the DVD as soon as the drive is ready for access
#
if appIsRunning("MakeMKV") then
	# now tell MakeMKV what to do
	tell application "System Events"
		tell process "MakeMKV"
			# in some rare cases, the menu bar items will stay "greyed out"
			# even if a DVD was inserted
			# the culprit: "AXEnabled" property of the menu will be TRUE even then,
			# although the menu items are not clickable
			# There seems to be no way to check, if they're actually active or inactive
			# However, as a workaround, sending CMD+O to fire up the "File - Open" dialog
			# seems to work, and yet: just opening and closing it will enable the menu bar
			#
			set _retval to false
			repeat until (_retval) is true
				try
					tell application "MakeMKV" to activate
					keystroke "o" using {command down}
					delay 1

					if (exists window 1) and (exists window 2) and (value of attribute "AXRoleDescription" of window 1) = "dialog" then
						click button "Cancel" of window 1
						set _retval to true
					end if
				end try
				delay 1
			end repeat

			# note on the dvd drive selection and menu handling:
			#
			# because we don't know the name of the DVD device,
			# we simply address it by the id of 'menu item 1'
			# so we're just selecting the first device found there.
			# we might have more than one DVD drive, but this is out of scope for now
			#
			# this script was initially triggered by inserting a new disc
			# thus we need to wait until the disc is initially read
			# while this is in progress, our 'Open disc' menu item will be disabled
			#
			set _retval to false
			repeat until (_retval) is true
				try
					repeat while (value of attribute "AXEnabled" of menu "Open disc" of menu item "Open disc" of menu "File" of menu bar item "File" of menu bar 1) is false
						get value of attribute "AXEnabled" of menu "Open disc" of menu item "Open disc" of menu "File" of menu bar item "File" of menu bar 1
						set counter to 5
						repeat while counter is greater than 0
							if verbose then display dialog "Waiting for dvd drive to become ready for use ..." with title "Please wait …" buttons {"" &#038; counter &#038; ""} giving up after 1
							set counter to counter - 1
						end repeat
					end repeat
					set _retval to true
				on error
					display dialog "error"
				end try
				delay 1
			end repeat

			# seems that the dvd drive is now ready for use, now try to load the disc
			#
			if verbose then display dialog "Trying to load DVD in MakeMKV now …" giving up after 1

			# now load the drive
			#
			tell application "MakeMKV" to activate
			click menu item 1 of menu 1 of menu item "Open disc" of menu 1 of menu bar item "File" of menu bar 1

			# now stay and wait until another window appears
			# this should be "completed" dialog at the end
			#
			repeat until ((exists window 1) and (exists window 2))
				delay 15
			end repeat

			# check the type of window 1, which should be a dialog
			# if so, let's close it and try to eject the disk
			#
			if (exists window 1) and (exists window 2) and ((value of attribute "AXRoleDescription" of window 1) = "dialog" or (value of attribute "AXRoleDescription" of window 1) = "standard window") then
				click button 1 of window 1

				click menu item "Eject disc" of menu 1 of menu bar item "File" of menu bar 1
			end if

		end tell
	end tell
end if

# func:appIsRunning
#	appName	: string : name of application (e.g. "DVD Player")
#
# helper to check if application is running or not
#
on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning
</pre>
<p>This, as far as it goes, saves at least the additional button click to load the DVD in MakeMKV.<br />
However, there is one drawback after all &#8230;</p>
<p>While examining the MakeMKV GUI, I figured that the main panel was not recognized by UI Browser. It was just reported as <b>unknown (UI element #4)</b>. Unfortunately there was no obvious way to get access to the elements within that panel.<br />
This &#8211; as of today &#8211; effectively limits the use of GUI scripting, as it is not possible to interact with the elements within that panel.<br />
Otherwise, I&#8217;d be happy to sit down and write the part, which does auto-selection of the track elements according to some given criteria.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/15/automating-makemkv-with-applescript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Make OS X run custom actions upon DVD insert</title>
		<link>http://phaq.phunsites.net/2011/12/11/make-os-x-run-custom-actions-upon-dvd-insert/</link>
		<comments>http://phaq.phunsites.net/2011/12/11/make-os-x-run-custom-actions-upon-dvd-insert/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 10:44:39 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=837</guid>
		<description><![CDATA[I&#8217;m currently ripping my complete DVD collection off to MKV (Matroska) format, so I can stream them across my home network. So I sought a way to have my OS X give me the choice to either start DVD Player or MakeMKV upon inserting a DVD. First I wrote a little AppleScript which gives me [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently ripping my complete DVD collection off to MKV (Matroska) format, so I can stream them across my home network.</p>
<p>So I sought a way to have my OS X give me the choice to either start DVD Player or <a href="http://www.makemkv.com/" target="_blank">MakeMKV</a> upon inserting a DVD.<br />
<span id="more-837"></span><br />
First I wrote a little AppleScript which gives me the choice. If I&#8217;m not taking any action, it will play the DVD automatically after 5 seconds, so it&#8217;s very similar to the default behaviour of OS X.</p>
<p>So just run Apple Script-Editor and store this code to a convenient location you like (usually it&#8217;s ~/Library/Scripts).</p>
<pre>
if not appIsRunning("DVD Player") and not appIsRunning("MakeMKV") then
	with timeout of 3600 seconds
		display dialog "Bitte wählen Sie gewünschte Aktion:" with title "Aktion für DVD" buttons {"Cancel", "DVD abspielen", "DVD rippen"} cancel button "Cancel" giving up after (5)
	end timeout
	if button returned of result is "DVD rippen" then
		display dialog "Starte MakeMKV" buttons {"OK"} giving up after 2
		tell application "MakeMKV" to activate
	else if button returned of result is "Cancel" then
		quit
	else
		display dialog "Starte DVD-Player" buttons {"OK"} giving up after 2
		tell application "DVD Player" to activate
	end if
end if

on appIsRunning(appName)
	tell application "System Events" to (name of processes) contains appName
end appIsRunning
</pre>
<p>Then go to system properties and select CDs &amp; DVDs properties. Beneath &#8220;When you a insert a Video-DVD&#8221; choose &#8220;Run Script&#8221; and locate the script file you created before.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/dvdaction1.jpg" rel="lightbox[837]"><img src="http://phaq.phunsites.net/files/2011/12/dvdaction1-300x119.jpg" alt="" width="300" height="119" class="aligncenter size-medium wp-image-838" /></a></p>
<p>From now on, you&#8217;ll be presented with a selection prompt. Doing nothing will automatically start the DVD Player, or the DVD Ripper, if you choose to do so.<br />
Quiet cool, isn&#8217;t it? <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a href="http://phaq.phunsites.net/files/2011/12/dvdaction2.png" rel="lightbox[837]"><img src="http://phaq.phunsites.net/files/2011/12/dvdaction2-300x96.png" alt="" width="300" height="96" class="aligncenter size-medium wp-image-839" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/11/make-os-x-run-custom-actions-upon-dvd-insert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting old TimeMachine Backups</title>
		<link>http://phaq.phunsites.net/2011/12/10/deleting-old-timemachine-backups/</link>
		<comments>http://phaq.phunsites.net/2011/12/10/deleting-old-timemachine-backups/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 10:50:13 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=833</guid>
		<description><![CDATA[Are you using an external hard drive for TimeMachine backup? Are you using it to store other data as well? Didn&#8217;t you divide your hard drive it into a data and TimeMachine partition? (Hell No &#8230;!) Now you&#8217;re running out of free disk space and need more room? (Hell Yes &#8230;!) Solution #1: Buy another [...]]]></description>
			<content:encoded><![CDATA[<p>Are you using an external hard drive for TimeMachine backup?<br />
Are you using it to store other data as well?<br />
Didn&#8217;t you divide your hard drive it into a data and TimeMachine partition? (Hell No &#8230;!)<br />
Now you&#8217;re running out of free disk space and need more room? (Hell Yes &#8230;!)</p>
<p>Solution #1: Buy another (bigger) hard drive.</p>
<p>Solution #2: Remove some old TimeMachine backups to recover some space.<br />
<span id="more-833"></span><br />
To do the later, open up a Console and type in this command:</p>
<p><code><br />
bash-3.2# tmutil  listbackups<br />
</code></p>
<p>You&#8217;ll get a list of backups available on your hard drive, which looks something like this:</p>
<pre>
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2009-12-05-145734
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2009-12-18-204014
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2010-01-01-020640
[...]
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2011-12-10-064156
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2011-12-10-074201
/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2011-12-10-110239
</pre>
<p>Now if you feel, that you won&#8217;t need any old backups anymore (like I do for the pre-2011 backups, you can remove them easily like this:</p>
<p><code><br />
bash-3.2# tmutil  delete "/Volumes/My Passport/Backups.backupdb/Gianpaolo Del Mattos MacBook Pro/2009-12-05-145734"<br />
</code></p>
<p>Note: Don&#8217;t forget to enquote the string to cope with white spaces, otherwise you&#8217;ll get an error message.</p>
<p>Now if you want to be a bit more efficient, you can delete multiple backups at once.<br />
Let&#8217;s say, we want to delete all 2009 and 2010 backups, this command will do:</p>
<p><code><br />
tmutil listbackups | grep -E -e '20(09|10)-[[:digit:]]{2}-[[:digit:]]{2}-' | while read backup; \<br />
   do echo "Working on backup '$backup' ..."; tmutil delete "$backup"; done<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/10/deleting-old-timemachine-backups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shutting Speakers on OS X when Screen Saver runs</title>
		<link>http://phaq.phunsites.net/2011/12/02/shutting-speakers-on-os-x-when-screen-saver-runs/</link>
		<comments>http://phaq.phunsites.net/2011/12/02/shutting-speakers-on-os-x-when-screen-saver-runs/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 14:32:32 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=780</guid>
		<description><![CDATA[Why for God&#8217;s sake would anyone even think about shutting speakers while the screen saver runs? Don&#8217;t these thingies provide an internal mute switch to stay quiet? Well, yes, most of the time, they do. Though in my case, I run that nice and decent System47 LCARS-style screen saver. And while it provides indeed a [...]]]></description>
			<content:encoded><![CDATA[<p>Why for God&#8217;s sake would anyone even think about shutting speakers while the screen saver runs?<br />
Don&#8217;t these thingies provide an internal mute switch to stay quiet?</p>
<p>Well, yes, most of the time, they do. Though in my case, I run that nice and decent <a href="http://www.mewho.com/system47/" target="_blank">System47</a> LCARS-style screen saver. And while it provides indeed a mute switch, it yet refuses to honor that flag and will always revert to non-muted operations. This drives me crazy, at least during the night time.</p>
<p>So here&#8217;s my solution to shut it quiet &#8212; really handy when I&#8217;m not along and forgot to turn volume down &#8230;<br />
<span id="more-780"></span><br />
The key to it lies with a small Automator script, which I hacked up and which you can <a href='http://phaq.phunsites.net/files/2011/12/Shut-Speakers-on-Screen-Saver.zip'>download here</a>.</p>
<p>It basically consists of an endless loop, which will sleep some time, wake up, check if the screen saver is running and mute the speakers if that&#8217;s the case.<br />
It will also unmute the speakers if the screen saver is not running, e.g. when you return to the work place.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/preview.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/preview-300x114.png" alt="" width="300" height="114" class="aligncenter size-medium wp-image-783" /></a></p>
<p>So first download the file and extract it to your desktop.<br />
Then double click the file to import it to Automator.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step1.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step1-300x125.png" alt="" width="300" height="125" class="aligncenter size-medium wp-image-785" /></a></p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step2.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step2-300x90.png" alt="" width="300" height="90" class="aligncenter size-medium wp-image-786" /></a></p>
<p>You&#8217;ll end up with the script being added to your &#8220;Services&#8221; menu.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step3.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step3-300x125.png" alt="" width="300" height="125" class="aligncenter size-medium wp-image-787" /></a></p>
<p>Now open up your control panel and go the the <strong>Users &amp; Groups</strong> preferences. Select your account and navigate to <strong>Startup Items</strong>.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step4.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step4-300x226.png" alt="" width="300" height="226" class="aligncenter size-medium wp-image-788" /></a></p>
<p>Click the + icon to add a new startup item. Use Finder to navigate to the Library folder below your home directory and then locate the <strong>Shutting Speakers on Screen Saver</strong> automator script beneth the Services folder.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step5.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step5-300x156.png" alt="" width="300" height="156" class="aligncenter size-medium wp-image-789" /></a></p>
<p>Note for OS X Lion Users: You may not see the Library folder in the first place due to restrictive defaults on Lion. If that&#8217;s the case, open a Terminal and type this command in there:</p>
<p><code><br />
chflags nohidden ~/Library<br />
</code></p>
<p>This will enable the Library folder to be seen within Finder.</p>
<p>Now select the <strong>Shutting Speakers on Screen Saver</strong>. It will be added to your startup item preferences.</p>
<p><a href="http://phaq.phunsites.net/files/2011/12/step6.png" rel="lightbox[780]"><img src="http://phaq.phunsites.net/files/2011/12/step6-300x226.png" alt="" width="300" height="226" class="aligncenter size-medium wp-image-790" /></a></p>
<p>The script will now run everytime after logon, so you won&#8217;t need to care about having the system muted or not.<br />
If you want to run it now without logoff/logon, just go to Finder menu and click on <strong>Shutting Speakers on Screen Saver</strong> on the Services submenu.</p>
<p>Enjoy the silence <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/12/02/shutting-speakers-on-os-x-when-screen-saver-runs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert RAW partition to VDI image with VirtualBox on OS X</title>
		<link>http://phaq.phunsites.net/2011/09/26/convert-raw-partition-to-vdi-image-with-virtualbox-on-os-x/</link>
		<comments>http://phaq.phunsites.net/2011/09/26/convert-raw-partition-to-vdi-image-with-virtualbox-on-os-x/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 08:59:54 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=739</guid>
		<description><![CDATA[Some time ago, I set up a multi-boot environment on my Mac, where I could use my BootCamp-Partition for both booting Windows natively on the Mac as well as virtualized from within VirtualBox. Now, I wanted to create a clone of the RAW partition to do some testing. As usual, there&#8217;s more than one way [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I <a href="http://phaq.phunsites.net/2011/03/05/sharing-windows-7-between-boot-camp-and-virtualbox/">set up a multi-boot environment on my Mac</a>, where I could use my BootCamp-Partition for both booting Windows natively on the Mac as well as virtualized from within VirtualBox.</p>
<p>Now, I wanted to create a clone of the RAW partition to do some testing.<br />
<span id="more-739"></span><br />
As usual, there&#8217;s more than one way to accomplish this. I&#8217;m going with the CLI way, as it&#8217;s feast and easier in my opinion.</p>
<p>Before you start with this anyway, I shall recommed you first to take a backup and second, make sure you don&#8217;t have lot&#8217;s of temp files WITHIN the BOOTCAMP partition. Also it&#8217;s a good idea, to defragment it first. This will save you some additional space and the converted VDI disk will be slightly smaller at the end.</p>
<p>So, first we need to identify, which device number our BOOTCAMP partition resides in.<br />
Do this simply from a Terminal by running the command &#8216;diskutil info disk0&#8242; (If you have a standard setup, your setup should reside on &#8216;disk0&#8242;. If you do some remote/iSCSI booting or use an USB drive to boot from, then your disk-id may be different. This is beyond this topic.)</p>
<p><a href="http://phaq.phunsites.net/files/2011/09/rawconvert1.png" rel="lightbox[739]"><img src="http://phaq.phunsites.net/files/2011/09/rawconvert1-300x57.png" alt="" width="300" height="57" class="aligncenter size-medium wp-image-741" /></a></p>
<p>You can easily identify your BOOTCAMP partition, as it reads &#8220;Microsoft Basic Data&#8221; in it&#8217;s TYPE description. Now look our for the last row which says &#8220;IDENTIFIER&#8221;.<br />
Note the name it says there (&#8216;disk0s4&#8242; in my example).</p>
<p>Now you may take the slow and easy way or the fast and complicated way. The later being the more geek-like approach <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h4>The slow and easy way</h4>
<p>Now change to a temporary directory, where you have enough room to store the disk image. Enough room in our case means, twice as much as your BOOTCAMP partition is in size. In my example, it&#8217;s roughly around 35G, so you should have some 70G free at least. You can always check your remaining free disk space on the commad line with the &#8216;df&#8217; command:</p>
<p><code><br />
new-host-2:Image Gianpaolo$ df -h<br />
Filesystem                          Size   Used  Avail Capacity  Mounted on<br />
/dev/disk0s2                      179Gi   62Gi   111Gi    79%    /<br />
devfs                              128Ki  128Ki    0Bi   100%    /dev<br />
map -hosts                           0Bi    0Bi    0Bi   100%    /net<br />
map auto_home                        0Bi    0Bi    0Bi   100%    /home<br />
</code></p>
<p>Then I created a new directly called &#8216;Image&#8217; below my home directory to hold the image.</p>
<p><a href="http://phaq.phunsites.net/files/2011/09/rawconvert2.png" rel="lightbox[739]"><img src="http://phaq.phunsites.net/files/2011/09/rawconvert2-300x22.png" alt="" width="300" height="22" class="aligncenter size-medium wp-image-742" /></a><br />
To actually dump the RAW partition, you need to have super-user privileges. So it&#8217;s easiest to run &#8216;sudo bash&#8217; to get a super-user shell like this:</p>
<p><code><br />
sudo bash<br />
</code></p>
<p>Then run this command to dump the RAW partition into a file. Remember to use the correct IDENTIFIER as noted above (&#8216;disk0s4&#8242; in my case).</p>
<p><code><br />
dd if=/dev/disk0s4 of=Win7RAW.dd<br />
</code></p>
<p><a href="http://phaq.phunsites.net/files/2011/09/rawconvert3.png" rel="lightbox[739]"><img src="http://phaq.phunsites.net/files/2011/09/rawconvert3-300x30.png" alt="" width="300" height="30" class="aligncenter size-medium wp-image-743" /></a></p>
<p>This will take ample of time. Unfortunally, &#8216;dd&#8217; does not print it&#8217;s progress to the console. So if you want to know the progress, you can always open a second Terminal an run these command from there:</p>
<p><code><br />
sudo bash<br />
while [ : ] ; do killall -SIGINFO dd &amp;&amp; sleep 5 || exit ; done<br />
</code></p>
<p>This will send a &#8216;SIGINFO&#8217; signal to &#8216;dd&#8217; every five seconds and cause it to print it&#8217;s progress to the Terminal as shown below. The loop will terminate on it&#8217;s own once &#8216;dd&#8217; is finished.</p>
<pre>8925687808 bytes transferred in 373.295433 secs (23910520 bytes/sec)
17634581+0 records in
17634580+0 records out</pre>
<p>When you&#8217;re done with capturing the image, it&#8217;s time to convert it to a virtual disk usage for VirtualBox.<br />
Do so by the &#8216;VBoxManage&#8217; command like this:</p>
<p><code><br />
VBoxManage  convertfromraw Win7RAW.dd Win7.vdi --format VDI<br />
</code></p>
<p>This will convert the RAW image into a &#8216;VDI&#8217; disk. Additionally, if the RAW partition space was not completely filled up, your VDI disk should end up considerably smaller than the original RAW image.</p>
<p>As soon as this conversion is finished, you can delete the RAW image.</p>
<p><code><br />
rm Win7RAW.dd<br />
</code></p>
<p>As you see, this method is straigth forward, but takes double the space and almost double the time to create the VDI image.<br />
Look into the next method to gain some speed, but also a bit more complexity <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h4>The fast and complicated way</h4>
<p>So you end up here. Maybe because you want to spare some time, or simply don&#8217;t have enough free disk space to hold two images.</p>
<p>So, let&#8217;s start again on the Terminal by gathering information. Remember the IDENTIFIER of the BOOTCAMP partition? It was &#8216;disk0s4&#8242; for me &#8230;</p>
<p>Now let&#8217;s get some detail about this partition, as we need to know it&#8217;s exact size in bytes.<br />
The &#8216;diskutil&#8217; command can provide us with this information, but only if it&#8217;s run in so called &#8216;plist-mode&#8217;. By invoking &#8216;diskutil&#8217; like this, you&#8217;ll end up with an XML-formated output with lots of detail information.</p>
<p><code><br />
bash-3.2# diskutil info -plist /dev/disk0s4<br />
&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br />
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;<br />
&lt;plist version="1.0"&gt;<br />
&lt;dict&gt;<br />
&lt;key&gt;Bootable&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;BusProtocol&lt;/key&gt;<br />
&lt;string&gt;SATA&lt;/string&gt;<br />
&lt;key&gt;CanBeMadeBootable&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;CanBeMadeBootableRequiresDestroy&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;Content&lt;/key&gt;<br />
&lt;string&gt;Microsoft Basic Data&lt;/string&gt;<br />
&lt;key&gt;DeviceBlockSize&lt;/key&gt;<br />
&lt;integer&gt;512&lt;/integer&gt;<br />
&lt;key&gt;DeviceIdentifier&lt;/key&gt;<br />
&lt;string&gt;disk0s4&lt;/string&gt;<br />
&lt;key&gt;DeviceNode&lt;/key&gt;<br />
&lt;string&gt;/dev/disk0s4&lt;/string&gt;<br />
&lt;key&gt;DeviceTreePath&lt;/key&gt;<br />
&lt;string&gt;IODeviceTree:/PCI0@0/SATA@1F,2/PRT0@0/PMP@0&lt;/string&gt;<br />
&lt;key&gt;Ejectable&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;FilesystemName&lt;/key&gt;<br />
&lt;string&gt;NTFS&lt;/string&gt;<br />
&lt;key&gt;FilesystemType&lt;/key&gt;<br />
&lt;string&gt;ntfs&lt;/string&gt;<br />
&lt;key&gt;FilesystemUserVisibleName&lt;/key&gt;<br />
&lt;string&gt;Windows NT File System (NTFS)&lt;/string&gt;<br />
&lt;key&gt;FreeSpace&lt;/key&gt;<br />
&lt;integer&gt;0&lt;/integer&gt;<br />
&lt;key&gt;GlobalPermissionsEnabled&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;IOKitSize&lt;/key&gt;<br />
&lt;integer&gt;34688991232&lt;/integer&gt;<br />
&lt;key&gt;Internal&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;MediaName&lt;/key&gt;<br />
&lt;string&gt;BOOTCAMP&lt;/string&gt;<br />
&lt;key&gt;MediaType&lt;/key&gt;<br />
&lt;string&gt;Generic&lt;/string&gt;<br />
&lt;key&gt;MountPoint&lt;/key&gt;<br />
&lt;string&gt;&lt;/string&gt;<br />
&lt;key&gt;ParentWholeDisk&lt;/key&gt;<br />
&lt;string&gt;disk0&lt;/string&gt;<br />
&lt;key&gt;RAIDMaster&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;RAIDSlice&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;SMARTStatus&lt;/key&gt;<br />
&lt;string&gt;Verified&lt;/string&gt;<br />
&lt;key&gt;SolidState&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;SupportsGlobalPermissionsDisable&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;SystemImage&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;TotalSize&lt;/key&gt;<br />
&lt;integer&gt;34688991232&lt;/integer&gt;<br />
&lt;key&gt;VolumeName&lt;/key&gt;<br />
&lt;string&gt;BOOTCAMP&lt;/string&gt;<br />
&lt;key&gt;VolumeUUID&lt;/key&gt;<br />
&lt;string&gt;7028E14A-6363-480D-8AAD-57609FBA87CB&lt;/string&gt;<br />
&lt;key&gt;WholeDisk&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;key&gt;Writable&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;WritableMedia&lt;/key&gt;<br />
&lt;true/&gt;<br />
&lt;key&gt;WritableVolume&lt;/key&gt;<br />
&lt;false/&gt;<br />
&lt;/dict&gt;<br />
&lt;/plist&gt;<br />
<code></p>
<p>Look out for the keyword 'TotalSize' and the take the integer value it provides ('34688991232' in this example).</p>
<p>Now dump your RAW partition directly into a VDI image like this:</p>
<p><code><br />
dd if=/dev/disk0s4 | VBoxManage convertfromraw stdin Win7.vdi 34688991232 --format VDI<br />
</code></p>
<p><a href="http://phaq.phunsites.net/files/2011/09/rawconvert4.png" rel="lightbox[739]"><img src="http://phaq.phunsites.net/files/2011/09/rawconvert4-300x17.png" alt="" width="300" height="17" class="aligncenter size-medium wp-image-744" /></a></p>
<p>Further readings on this topic are located at <a href="https://forums.virtualbox.org/viewtopic.php?t=1966" target="_blank">VirtualBox Forums</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/09/26/convert-raw-partition-to-vdi-image-with-virtualbox-on-os-x/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>36 Hours of OS X &#8220;Lion&#8221;: A Review</title>
		<link>http://phaq.phunsites.net/2011/07/23/36-hours-of-os-xlion-a-review/</link>
		<comments>http://phaq.phunsites.net/2011/07/23/36-hours-of-os-xlion-a-review/#comments</comments>
		<pubDate>Sat, 23 Jul 2011 00:18:17 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=699</guid>
		<description><![CDATA[So OS X &#8220;Lion&#8221; is out now for over 36 hours. It&#8217;s time for a review of the minor troubles and glitches I had with it so far. Table of Contents Preparation: Make a Backup! Preparation: Check the File System! Preparation: Application Compatibility Preparation: Download OS X Lion and burn a DVD from it immediately [...]]]></description>
			<content:encoded><![CDATA[<p>So OS X &#8220;Lion&#8221; is out now for over 36 hours. It&#8217;s time for a review of the minor troubles and glitches I had with it so far.<br />
<span id="more-699"></span></p>
<h3>Table of Contents</h3>
<p><a href="#1">Preparation: Make a Backup!</a><br />
<a href="#2">Preparation: Check the File System!</a><br />
<a href="#3">Preparation: Application Compatibility</a><br />
<a href="#4">Preparation: Download OS X Lion and burn a DVD from it immediately</a><br />
<a href="#5">After the Upgrade: Some things are quiet different</a><br />
<a href="#6">UI: natural scrolling</a><br />
<a href="#7">UI: Launchpad</a><br />
<a href="#8">UI: Make Dashboard and Mission Control behave<a><br />
<a href="#9">Finder: Where&#8217;s my Library and Status bar? Get rid of that annoying &#8220;All My Files&#8221; item</h3>
<p><a href="#10">Apps: Rosetta is gone</a><br />
<a href="#11">Kernel Extension: Serial-to-USB driver</a><br />
<a href="#12">Cisco VPN client</a><br />
<a href="#13">Upgrade the NAS Software for AFP compatibility</a></p>
<p><a name="1"><br />
<h3>Preparation: Make a Backup!</h3>
<p></a></p>
<p>Just a warning note to everyone intending to upgrade to Lion: Even if you NEVER take backups &#8212; at least for this time, take a backup using Time Machine.<br />
So far I can not stress this enough: Make a backup! Really!</p>
<p>I know, there&#8217;s lot&#8217;s of people not taking backups. Believe me: Upgrading the Operating System is a major action than can be cumbersome and very well impose issues on your Mac during that process.</p>
<p>In my case for example, the upgrade completely screwed my hard drive. While in the first place everything seemed to work fine during the upgrade and the first reboot, my Mac got stuck during the second reboot. After seeing the &#8216;spinning wheel&#8217; for minutes I decided to reboot into verbose mode. Verbose mode is enabled if you press CMD+V during system startup. This will cause Mac OS X to display the kernel boot messages on-screen instead of the Apple logo.</p>
<p>So I ended up in verbose mode giving me the message &#8220;Still waiting for root device&#8221; repeatedly.</p>
<p><a href="http://phaq.phunsites.net/files/2011/07/IMG_1918.jpg" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/IMG_1918-300x224.jpg" alt="" width="300" height="224" class="alignnone size-medium wp-image-701" /></a></p>
<p>So I rebootet the system with a bootable Snow Leopard as well as a bootable Lion DVD and headed straight to Disk Utility. Unfortunately, both systems refused to check and repair the partition on the hard drive, leaving me with some obscure unrecoverable logical errors within the file system.</p>
<p>I don&#8217;t know the reason for this behaviour at all. But in the end, I can only conclude: Be on the safe side and take a backup BEFORE attempting to upgrade.<br />
It did it (I do regurlarly anyway) and was very happy about this, as Time Machine saved me a lot of time and hassles.</p>
<p>A collegue of mine at the office encountered the very same issue on his MBP as me, so I doubt it&#8217;s a pure coincidence. It can well be bug within the OS X Lion installer or just the shortcomings of having an unclean file system on the Mac itself.</p>
<p><a name="2"><br />
<h3>Preparation: Check the File System!</h3>
<p></a></p>
<p>This leads to another preparation step: check the file system before upgrading. After my experience it would definitely not hurt booting the system from the Snow Leopard DVD and check (and repair) the file system from Disk Utility.</p>
<p>But again: Take the backup FIRST <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a name="3"><br />
<h3>Preparation: Application Compatibility</h3>
<p></a></p>
<p><a href="http://www.roaringapps.com/" target="_blank">RoaringApps</a> has an extensive list of applications listed with their current compatibility status on OS X Lion. You&#8217;re better off checking in there and download current versions of your applications. If you use applications that require kernel extensions or drivers (I had a serial-to-USB dongle with a kernel driver, VirtualBox and Wireshark installed), then I&#8217;d recommend to upgrade to the current version before installing Lion.<br />
That should prevent issues with broken kernel extensions in the first place.</p>
<p>Again: I&#8217;d do this only after taking the backup first &#8230;</p>
<p><a name="4"><br />
<h3>Preparation: Download OS X Lion and burn a DVD from it immediately</h3>
<p></a></p>
<p>Oh well. Apple distributes Lion exclusively through App Store. You cannot buy any physical media from it. That may be a good thing for the environment. But in terms of recovery (especially if somethings goes wrong, as it did with me), you should have the DVD at hand.</p>
<p>Save yourself some time and burn a DVD before you start the upgrade. You&#8217;ll find a tutorial over there at <a href="http://osxdaily.com/2011/06/08/create-burn-bootable-mac-os-x-lion-install-disc/" target="_blank">OSXDaily</a>.<br />
Another way would be to store Lion to a bootable USB stick, see again on <a href="http://osxdaily.com/2011/07/08/make-a-bootable-mac-os-x-10-7-lion-installer-from-a-usb-flash-drive/" target="_blank">OSXDaily</a>.</p>
<p>Two reasons, why you should make a DVD or bootable USB stick before the upgrade:</p>
<ol>
<li>After you downloaded OS X Lion, you&#8217;ll end a with a file called &#8220;Install OS X Lion&#8221; in your application folder.<br />
If you just run the installation from there, that file WILL GET DELETED after installing Lion. So you cannot burn the DVD afterwards unless you download the complete package once again!</li>
<li>If something goes wrong during the install, it&#8217;s a good thing to have a bootable DVD/stick at hand for recovery.</li>
</ol>
<p>At this point, you&#8217;re now fully preopared and ready to upgrade to OS X Lion without fear. Go and hit the button and welcome OS X Lion in 30 minutes (or less)&#8230;</p>
<p><a name="5"><br />
<h3>After the Upgrade: Some things are quiet different</h3>
<p></a></p>
<p>I admit that I only read about OS X Lion, I never had a beta version at hands. So when Lion finally came up, I found myself in a shiny new world.<br />
But, as with every new OS, some things are quiet different and may be distorting and need some further review to fix. Here&#8217;s the things I came along.</p>
<p><a name="6"><br />
<h3>UI: natural scrolling</h3>
<p></a></p>
<p>OS X implements new gestures for controlling the UI. Some of them are quiet useful, while others aren&#8217;t. That surely is more a matter of personal preference.</p>
<p>The only things I disabled was the so called &#8220;natural scrolling&#8221;. While the &#8220;content follows gesture&#8221;-approach works well on the iPhone and iPad, it seems very uncomfortable to me on the Mac. Maybe I&#8217;m just old school <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><a href="http://phaq.phunsites.net/files/2011/07/natural_scrolling_gesture.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/natural_scrolling_gesture-300x238.png" alt="" width="300" height="238" class="alignnone size-medium wp-image-707" /></a></p>
<p><a name="7"><br />
<h3>UI: Launchpad</h3>
<p></a></p>
<p>In short: What do I need this for on the Mac?</p>
<p>To be honest: For launching an App, I just enter it&#8217;s name in Spotlight and go for it &#8211; it&#8217;s a thousand times faster than fiddling through 3 pages of Apps in launchpad.<br />
And for the most important Apps, they have their place in the Dock anyway.</p>
<p>So I turned both the gesture and active corner off for Launchpad.</p>
<p><a href="http://phaq.phunsites.net/files/2011/07/launchpad_gesture1.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/launchpad_gesture1-300x237.png" alt="" width="300" height="237" class="alignnone size-medium wp-image-706" /></a><a href="http://phaq.phunsites.net/files/2011/07/launchpad_mission_control.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/launchpad_mission_control-300x221.png" alt="" width="300" height="221" class="alignnone size-medium wp-image-704" /></a></p>
<p><a name="8"><br />
<h3>UI: Make Dashboard and Mission Control behave</h3>
<p></a></p>
<p>Mission Control takes over from Exposé and Spaces. Two things I changed there:</p>
<ol>
<li>I changed Dashboard to NOT display as a separate space. I use the Dashboard mostly for quick-access to calculator, calendar and converter widgets. I don&#8217;t see why I should swithc spaces if I can have the widgets shown on top of my current space.</li>
<li>I also changed the auto-arrange feature of Mission Control work spaces</li>
</ol>
<p><a name="9"><br />
<h3>Finder: Where&#8217;s my Library and Status bar? Get rid of that annoying &#8220;All My Files&#8221; item</h3>
<p></a></p>
<p>Oh well, that annoying &#8220;All My Files&#8221; item on the left-hand view in Finder reminds me so much of Windows <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
Sorry guys, I keep order with my folders and files, and that feature is more annoying than helpful to me. Luckily enough this can be easily removed from the sidebar.</p>
<p><a href="http://phaq.phunsites.net/files/2011/07/remove_all_my_files.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/remove_all_my_files-300x179.png" alt="" width="300" height="179" class="alignnone size-medium wp-image-708" /></a></p>
<p>From Finder&#8217;s properties you may as well set your own starting location for Finder. By default it&#8217;s set to &#8216;All my Files&#8217; which I changed to my personal home directory.</p>
<p>Another thing quiet as annoying as in Windows is the status bar being hidden by default. Maybe that&#8217;s something the average user doesn&#8217;t need. I do!<br />
Again, the status bar can still be enabled through the menu.</p>
<p><a href="http://phaq.phunsites.net/files/2011/07/show_status_bar.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/show_status_bar-286x300.png" alt="" width="286" height="300" class="alignnone size-medium wp-image-709" /></a></p>
<p>Yet another thing that I don&#8217;t like: Lion hides some folders away from the User&#8217;s view. I didn&#8217;t like this with Windows either!<br />
If you miss the &#8220;Library&#8221; or other folders when you open your home folder in Finder, then you must enable their display through Terminal.<br />
Open a Terminal and run this command from there:</p>
<p><code><br />
chflags nohidden ~/Library<br />
</code></p>
<p>(To make the Tilde (~) character, just press ALT+n).</p>
<p><a href="http://phaq.phunsites.net/files/2011/07/finder_hidden.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/finder_hidden-300x218.png" alt="" width="300" height="218" class="alignnone size-medium wp-image-710" /></a><br />
<a href="http://phaq.phunsites.net/files/2011/07/unhide_library_cmd.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/unhide_library_cmd-300x104.png" alt="" width="300" height="104" class="alignnone size-medium wp-image-712" /></a><br />
<a href="http://phaq.phunsites.net/files/2011/07/finder_nohidden.png" rel="lightbox[699]"><img src="http://phaq.phunsites.net/files/2011/07/finder_nohidden-300x217.png" alt="" width="300" height="217" class="alignnone size-medium wp-image-711" /></a></p>
<p><a name="10"><br />
<h3>Apps: Rosetta is gone</h3>
<p></a></p>
<p>Well, if you downloaded and upgraded all Apps, you won&#8217;t miss Rosetta, the PowerPC emulator included with previous versions of OS X.</p>
<p>I just missed one application, the <a href="http://homepage.mac.com/dalverson/zterm/" target="_blank">ZTerm terminal emulator</a>, which had just received a Lion-upgrade as well.</p>
<p><a name="11"><br />
<h3>Kernel Extension: Serial-to-USB driver</h3>
<p></a></p>
<p>I use a Serial-to-USB dongle for remote management of Cisco devices.<br />
As it turned out, <a href="http://phaq.phunsites.net/2010/12/13/getting-aten-uc-232a-usb-to-serial-dongle-to-work-on-os-x-snow-leopard/" target="_blank">my own article about the Aten USB driver for Snow Leopard</a> holds true for OS X Lion as well <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
<p><a name="12"><br />
<h3>Cisco VPN client</h3>
<p></a></p>
<p>Oh well, the Cisco VPN client for OS X does not work any longer on Lion &#8211; at least not when running the OS in 64-bit mode, which is now default. If you start Lion in 32-bit mode, then the Cisco VPN client still works.</p>
<p>How to start Lion in 32-bit mode? Press and hold keys 3+2 during startup to load the 32-bit kernel. Another option is to set the the kernel mode through a unix command in Terminal.</p>
<p><a href="http://phaq.phunsites.net/2011/03/06/choppy-virtualbox-performance-on-macbook-pro-with-core-i7/">I wrote about this already in the context of VirtualBox before</a>, but the same procedure applies to this as well.</p>
<p><a name="13"><br />
<h3>Upgrade the NAS Software for AFP compatibility</h3>
<p></a></p>
<p>I have a QNAP TS-459 Pro II Turbo NAS. Most NAS devices, including this one, require an uprade if you use AFP (Apple Filing Protocol) to access it from OS X because of lack of the AFP DHX2 authentication feature.</p>
<p>Current firmware 3.5.0, released mid of August 2011, fixes this issue and TimeMachine backup to the NAS works again flawlessly.</p>
<p>That&#8217;s if for my experiences on OS X Lion so far. After all, it&#8217;s not too bad at all <img src='http://phaq.phunsites.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/07/23/36-hours-of-os-xlion-a-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Serve files quickly using built-in python Web-Server in OS X</title>
		<link>http://phaq.phunsites.net/2011/07/13/serve-files-quickly-using-built-in-python-web-server-in-os-x/</link>
		<comments>http://phaq.phunsites.net/2011/07/13/serve-files-quickly-using-built-in-python-web-server-in-os-x/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 18:31:46 +0000</pubDate>
		<dc:creator>gdelmatto</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://phaq.phunsites.net/?p=673</guid>
		<description><![CDATA[Mac OS X (since 10.5) sports a python environment in it&#8217;s default install, which includes a very simple HTTP server. This may come in handy if you want to serve some files quickly over HTTP, without the need to fireup the full-blown Apache available through &#8216;Web Sharing Service&#8217;. Don&#8217;t believe me? Read on to see [...]]]></description>
			<content:encoded><![CDATA[<p>Mac OS X (since 10.5) sports a python environment in it&#8217;s default install, which includes a very simple HTTP server.<br />
This may come in handy if you want to serve some files quickly over HTTP, without the need to fireup the full-blown Apache available through &#8216;Web Sharing Service&#8217;.<br />
Don&#8217;t believe me? Read on to see how you&#8217;ll be up in running in just a few seconds.<br />
<span id="more-673"></span><br />
To launch the simple HTTP server, start a Terminal first, then change to the directory containing the files you want to serve, e.g. your Downloads folder:</p>
<p><code><br />
$ cd ~/Downloads<br />
</code></p>
<p>Now fire up the web server like this:</p>
<p><code><br />
$ python -m SimpleHTTPServer<br />
Serving HTTP on 0.0.0.0 port 8000 ...<br />
</code></p>
<p>This will bind to port 8000 by default. To use another port, just give the TCP port as an additional argument on the command line:</p>
<p><code><br />
$ python -m SimpleHTTPServer 8100<br />
Serving HTTP on 0.0.0.0 port 8100 ...<br />
</code></p>
<p>To access the server, open the link as http://Your-Macs-IP-Address:8000 (or http://Your-Macs-IP-Address:8100 for the second example).<br />
This will provide you with a simple file list to browse and access your files.</p>
<p>You won&#8217;t be able to bind to the HTTP default port 80 with regurlar user accounts however. This will only yield a &#8220;socket: [Errno 13] permission denied&#8221; error message.</p>
<p>To bind to port 80, you need to run the command through &#8216;sudo&#8217; like this:</p>
<p><code><br />
$ sudo python -m SimpleHTTPServer 80<br />
Password:<br />
Serving HTTP on 0.0.0.0 port 80 ...<br />
</code></p>
<p>The server will stay in foreground of the Terminal and keep running until you hit CTRL-C.</p>
<p>If you want to know why I needed this, then read on my efforts on <a href="/2011/07/13/tricking-squeezebox-server-into-downloading-firmware-files-from-local-server/">upgrading Squeezebox Radio firmare</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://phaq.phunsites.net/2011/07/13/serve-files-quickly-using-built-in-python-web-server-in-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

