<?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>Dae’s blog &#187; Releases</title>
	<atom:link href="http://dae.cyberic.eu/blog/categories/technical/releases/feed/" rel="self" type="application/rss+xml" />
	<link>http://dae.cyberic.eu</link>
	<description></description>
	<lastBuildDate>Thu, 26 Aug 2010 07:44:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>AppleScript to mount/unmount a drive</title>
		<link>http://dae.cyberic.eu/blog/applescript-to-mount-unmount-a-drive/</link>
		<comments>http://dae.cyberic.eu/blog/applescript-to-mount-unmount-a-drive/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 17:50:52 +0000</pubDate>
		<dc:creator>Dae</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[mac pro]]></category>

		<guid isPermaLink="false">http://dae.cyberic.eu/?p=512</guid>
		<description><![CDATA[On my Mac Pro I have two internal hard drives I rarely use. Some times they &#8220;sleep&#8221; and while doing so, every file opening dialog, search in Spotlight or search in Dictionary might wake them up and that takes some &#8230; <a href="http://dae.cyberic.eu/blog/applescript-to-mount-unmount-a-drive/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>On my Mac Pro I have two internal hard drives I rarely use. Some times they &#8220;sleep&#8221; and while doing so, every file opening dialog, search in Spotlight or search in Dictionary might wake them up and that takes some time. I could, of course, disable sleeping in power settings, but then the drives would be unreasonably wasting power all the time, so I decided to write an <strong>AppleScript to mount or unmount a drive</strong> depending on it&#8217;s state.<br />
<span id="more-512"></span><br />
<strong>I&#8217;d like to emphasize: this script is meant to unmount an entire drive rather than just a volume. </strong><strong>It takes a volume as an identifier of the needed drive. </strong>This is mostly useful for Mac Pros.</p>
<p>I will make a proper release of the script some time, now you can have a half-baked source code. The script requires Growl to be installed in the system. Tested only on Mac OS X 10.6 &#8220;Snow Leopard&#8221;. Please use at your own risk!</p>
<p>Change <code>myVolumeLabel</code> variable to the label of any volume on the drive you want to (un)mount.</p>
<pre><code>set myVolumeLabel to "Storage HD"

tell application "GrowlHelperApp"
	set the allNotificationsList to {"Disk mounted", "Disk unmounted"}

	register as application "Disk Mounter" all notifications allNotificationsList default notifications allNotificationsList icon of application "Disk Utility.app"
end tell

tell application "Finder"
	set diskDev to do shell script "diskutil list | grep \"" &amp; myVolumeLabel &amp; "\" | grep -o 'disk[1-9]*' "
	if not (disk myVolumeLabel exists) then
		do shell script "diskutil mountDisk " &amp; diskDev
		tell application "GrowlHelperApp" to notify with name "Disk mounted" title "Volume mounted" description "Disk “" &amp; diskDev &amp; "” with volume “" &amp; myVolumeLabel &amp; "” has been successfully mounted." application name "Disk Mounter" icon of application "Disk Utility.app"
	else
		do shell script "diskutil unmountDisk " &amp; diskDev
		tell application "GrowlHelperApp" to notify with name "Disk unmounted" title "Disk unmounted" description "Disk “" &amp; diskDev &amp; "” with volume “" &amp; myVolumeLabel &amp; "” has been successfully unmounted." application name "Disk Mounter" icon of application "Disk Utility.app"
	end if
end tell</code></pre>
<p><strong>Last updated:</strong> 30.05.10</p>
<p><span style="color: #ff0000;"><strong>Update:</strong></span> please note that unmounting an internal HDD screws up some links, for instance, if you had shared folders — they will not be shared after re-mounting the drive. Use the script only with the drives that you never/link use at all in Mac OS — in my case, this applies to the Bootcamp drive.</p>
]]></content:encoded>
			<wfw:commentRss>http://dae.cyberic.eu/blog/applescript-to-mount-unmount-a-drive/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Restrict page access to authorized MODx managers only</title>
		<link>http://dae.cyberic.eu/blog/restrict-page-access-to-authorized-modx-managers-only/</link>
		<comments>http://dae.cyberic.eu/blog/restrict-page-access-to-authorized-modx-managers-only/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 17:50:57 +0000</pubDate>
		<dc:creator>Dae</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[modx]]></category>

		<guid isPermaLink="false">http://dae.cyberic.eu/?p=27</guid>
		<description><![CDATA[A while ago I needed to create a private zone with documentation, accessible only by the MODx managers. In order to restrict access I wrote a simple snippet, which you can now use as well. Snippet name: ManagersOnly Description: Restrict &#8230; <a href="http://dae.cyberic.eu/blog/restrict-page-access-to-authorized-modx-managers-only/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A while ago I needed to create a private zone with documentation, accessible only by the MODx managers. In order to restrict access I wrote a simple snippet, which you can now use as well.<br />
<span id="more-27"></span><br />
<strong>Snippet name:</strong> ManagersOnly<br />
<strong>Description:</strong> Restrict access to managers only.</p>
<pre><code>if (!isset($_SESSION['mgrValidated']))
{
	header('Location: '.$modx->makeUrl($modx->config['unauthorized_page']));
	exit;
}
else
{
	$modx->setPlaceholder('manager_name', $_SESSION['mgrShortname']);
}</code></pre>
<p><strong>Usage:</strong> add <code>[[ManagersOnly]]</code> in the beginning of the page or in a template. In case the visitor is authorized as a manager, the snippet will also return the placeholder <code>[+manager_name+]</code> (MODx manager&#8217;s “short name”), so you can greet them. Please note that the placeholder will not work correctly with cached pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://dae.cyberic.eu/blog/restrict-page-access-to-authorized-modx-managers-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
