<?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>Everything In Between &#187; Mac OS X</title>
	<atom:link href="http://maymay.net/blog/category/techcomputing/applemacintosh/mac-os-x/feed/" rel="self" type="application/rss+xml" />
	<link>http://maymay.net/blog</link>
	<description>The brutally honest, first-person account of Meitar Moscovitz&#039;s life.</description>
	<lastBuildDate>Tue, 22 May 2012 03:33:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to spoof your MAC address on Mac OS X (for reals)</title>
		<link>http://maymay.net/blog/2011/03/29/how-to-spoof-your-mac-address-on-mac-os-x-for-reals/</link>
		<comments>http://maymay.net/blog/2011/03/29/how-to-spoof-your-mac-address-on-mac-os-x-for-reals/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 05:50:43 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=1324</guid>
		<description><![CDATA[One of the oddities of Apple&#8217;s Mac OS X platform is that some things that should be easy are obtusely difficult, and remarkably so. Changing the hostname of a Mac OS X Server is one good example. Another is changing the &#8220;Ethernet ID&#8221; (aka. MAC address, aka. link-level address) of a network interface card. This [...]]]></description>
			<content:encoded><![CDATA[<p>One of the oddities of Apple&#8217;s Mac <acronym title="Operating System">OS</acronym> X platform is that some things that should be easy are obtusely difficult, and remarkably so. <a href="http://maymay.net/blog/2007/09/19/changing-the-hostname-on-mac-os-x-server/">Changing the hostname of a Mac <acronym title="Operating System">OS</acronym> X Server</a> is one good example. Another is changing the <a href="https://secure.wikimedia.org/wikipedia/en/wiki/MAC_address">&#8220;Ethernet ID&#8221; (<acronym title="Also Known As">aka</acronym>. <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address, <acronym title="Also Known As">aka</acronym>. link-level address)</a> of a network interface card.</p>
<p>This should be really simple, as the correct command line is plain as day (where the string of colon-separated 00&#8242;s is your preferred <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address):</p>
<pre><code class="shell">sudo ifconfig en1 lladdr <var>00:00:00:00:00:00</var></code></pre>
<p>There are <a href="http://hints.macworld.com/article.php?story=20080119114003330">numerous</a> <a href="http://snowleopardtips.net/tutorials/spoofing-your-mac-address-in-snow-leopard.html">blog</a> <a href="http://osxdaily.com/2008/01/17/how-to-spoof-your-mac-address-in-mac-os-x/">posts</a> all over the &#8216;net that tell you this time and again, but each one seems to have comments from <a href="http://osxdaily.com/2008/01/17/how-to-spoof-your-mac-address-in-mac-os-x/#comment-42854">users complaining that it doesn&#8217;t work</a> on their system. I ran into a similar problem not long ago when my MacBook Pro didn&#8217;t do what I expected. Just like others, whenever I tried to run the above command, nothing seemed to happen:</p>
<pre><code class="shell">ifconfig | grep ether # Determine current <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> addresses
sudo ifconfig en1 lladdr <var>00:00:00:00:00:00</var> # Try changing <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address for en1 (usually Airport)
ifconfig | grep ether # Confirm change; but uh-oh! Output is the same as before! Why?</code></pre>
<p>Here&#8217;s how I fixed this problem.</p>
<p>The thing to know is that there seem to be a number of conditions that will prevent Mac <acronym title="Operating System">OS</acronym> X from successfully changing a <acronym title="Network Interface Card">NIC</acronym>&#8216;s <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address. Some are obvious and some are not. As far as I can tell, these conditions are:</p>
<ul>
<li>having the interface &#8220;down&#8221; (i.e., if you&#8217;ve recently run <code>ifconfig en0 down</code> or an equivalent),</li>
<li>being associated with (i.e., connected to) a Wi-Fi network with your Airport card,</li>
<li>having the System Preferences application running,</li>
<li>forgetting to &#8220;unstick&#8221; the current system configuration set.</li>
</ul>
<p>It&#8217;s the last one that bit me. Mac <acronym title="Operating System">OS</acronym> X has a feature called &#8220;system configuration sets&#8221; or &#8220;<a href="http://support.apple.com/kb/HT2712">locations</a>,&#8221; as it&#8217;s termed in much of the <acronym title="Graphical User Interface">GUI</acronym>. These can be accessed via the Network pane in System Preferences, or via the <code>scselect</code> command from Terminal; it&#8217;s that <code>scselect</code> command which offers the key to changing a Mac&#8217;s <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address.</p>
<p>On my MacBook Pro (which, for the record and if it matters, is running Mac <acronym title="Operating System">OS</acronym> X 10.6.7), I need to do <em>all</em> of the following before running <code>ifconfig</code>, as shown above:</p>
<ul>
<li>If I&#8217;m changing my Airport card&#8217;s <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address, I need to disassociate from any network. (This can most easily be done by invoking <code>airport -z</code> from Terminal. If you don&#8217;t have this command, see <a href="http://maymay.net/blog/2010/12/05/one-minute-mac-tip-sniffing-wi-fi-traffic-and-capturing-packets-with-the-built-in-airport-utility/">my tips on where to find <code>airport</code></a>.)</li>
<li>Quit System Preferences if it&#8217;s open.</li>
<li>Tell the operating system to &#8220;delay changing the system&#8217;s &#8216;location&#8217; until the next system boot&#8221; by running: <code>scselect -n</code>.</li>
</ul>
<p>According to <a href="http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/scselect.8.html">the <code>man</code> page for <code>scselect</code></a>:</p>
<blockquote cite="http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/scselect.8.html"><p>scselect provides access to the system configuration sets, commonly referred to as &#8220;locations&#8221;.  When invoked with no arguments, scselect displays the names and associated identifiers for each defined &#8220;location&#8221; and indicates which is currently active.  scselect also allows the user to select or change the active &#8220;location&#8221; by specifying its name or identifier.  Changing the &#8220;location&#8221; causes an immediate system re-configuration, unless the -n option is supplied.</p>
<p>[…]</p>
<p>-n  Delay changing the system&#8217;s &#8220;location&#8221; until the next system boot (or the next time that the system configuration preferences are changed).</p></blockquote>
<p>Once I perform the above rigmarole, I can then change my <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address without issue. But I have to be ludicrously careful. As soon as I open the Network System Preferences pane or otherwise do something to change the system configuration preferences, I have to run through that rigmarole <em>again</em> before changing my <acronym title="Media Access Control (networking) or Message Authentication Code (cryptography)">MAC</acronym> address will work as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2011/03/29/how-to-spoof-your-mac-address-on-mac-os-x-for-reals/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Sniffing Wi-Fi traffic and capturing packets with the built-in airport utility</title>
		<link>http://maymay.net/blog/2010/12/05/one-minute-mac-tip-sniffing-wi-fi-traffic-and-capturing-packets-with-the-built-in-airport-utility/</link>
		<comments>http://maymay.net/blog/2010/12/05/one-minute-mac-tip-sniffing-wi-fi-traffic-and-capturing-packets-with-the-built-in-airport-utility/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 10:58:27 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Wi-Fi]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=1318</guid>
		<description><![CDATA[Many Mac OS X users lament the lack of sophisticated network analysis tools, often prevalent and seemingly prolific on Linux systems. What many don&#8217;t know is that Mac OS X comes with a built-in command-line tool to do all sorts of nifty things with Wi-Fi networks, from packet capture (traffic sniffing) to scanning nearby networks&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>Many Mac <acronym title="Operating System">OS</acronym> X users lament the lack of sophisticated network analysis tools, often prevalent and seemingly prolific on Linux systems. What many don&#8217;t know is that Mac <acronym title="Operating System">OS</acronym> X comes with a built-in command-line tool to do all sorts of nifty things with Wi-Fi networks, from packet capture (traffic sniffing) to scanning nearby networks&#8217; signal to noise ratios.</p>
<p>Mac <acronym title="Operating System">OS</acronym> X ships with a command-line tool called <code>airport</code> that can do all sorts of nifty things with Wi-Fi networks. Unfortunately, it&#8217;s so squirreled away that most people don&#8217;t seem to know about it. The utility is part of the <code>Apple80211</code> Private Framework used to power your Mac&#8217;s Airport menubar icon.</p>
<p>Invoking the utility without arguments prints a useful (if incomplete) usage message. At a Terminal command prompt, type:</p>
<pre>/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport</pre>
<p>The tool let&#8217;s you do a number of interesting things, so it&#8217;s worth playing around with. While you&#8217;re playing, you may as well create a symlink (a shortcut) to the utility so you don&#8217;t have to type that long path name all the time:</p>
<pre>sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport</pre>
<p>Among the easiest things you can do is print a list of the Wi-Fi networks within range of your computer, but unlike the Airport menubar item, this report shows you a bunch of extra, precise data, such as which encryption protocol (if any) is being used on the network:</p>
<pre>&#36; airport en1 scan
                            SSID BSSID             RSSI CHANNEL HT <acronym title="Columbia College">CC</acronym> SECURITY (auth/unicast/group)
                       moscohome 00:22:6b:8b:86:51 -61  10      N  -- WPA2(PSK/AES/AES)
                     PUBLIC-455H 00:15:6d:60:95:d1 -82  1       N  -- NONE
                    Alex Network 00:1e:e5:24:c4:4f -86  1       Y  TW <acronym title="Wi-Fi Protected Access; the successor to the weaker WEP">WPA</acronym>(PSK/TKIP,AES/TKIP) WPA2(PSK/TKIP,AES/TKIP)
                   linksysELNIDO 00:21:29:a3:fd:99 -90  6       N  -- <acronym title="Wi-Fi Protected Access; the successor to the weaker WEP">WPA</acronym>(PSK/AES,TKIP/TKIP) WPA2(PSK/AES,TKIP/TKIP)
                        2WIRE024 00:18:3f:02:2f:49 -88  6       N  US <acronym title="Wired Equivalency Protocol; a weak Wi-Fi encryption standard">WEP</acronym>
                        2WIRE940 00:12:88:d9:85:41 -93  6       N  US <acronym title="Wired Equivalency Protocol; a weak Wi-Fi encryption standard">WEP</acronym>
</pre>
<p>If I wanted to see which of my neighbors still haven&#8217;t upgraded from <acronym title="Wired Equivalency Protocol; a weak Wi-Fi encryption standard">WEP</acronym>, I could just filter using <code>grep</code>:</p>
<pre>airport en1 scan | grep <acronym title="Wired Equivalency Protocol; a weak Wi-Fi encryption standard">WEP</acronym></pre>
<p>More awesome, perhaps, is the tool&#8217;s ability to actually perform traffic sniffing and capture packets. Tell <code>airport</code> to <code>sniff</code>, and optionally provide a channel (which you now know thanks to your ability to <code>scan</code>). You need to be an administrator (i.e., you need <code>sudo</code> privileges) to do this:</p>
<pre>sudo airport en1 sniff 6</pre>
<p>This creates a file called <code>airportSniffXXXXXX.cap</code> in the <code>/tmp</code> directory, where <code>XXXXXX</code> is a string for uniqueness. You can then feed this file into your favorite network analyzer such as <a href="http://wireshark.org/">Wireshark</a> to examine the traffic offline.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2010/12/05/one-minute-mac-tip-sniffing-wi-fi-traffic-and-capturing-packets-with-the-built-in-airport-utility/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HowTo: Use Rules to Automatically Manage Email in Apple Mail</title>
		<link>http://maymay.net/blog/2009/07/27/howto-use-rules-to-automatically-manage-email-in-apple-mail/</link>
		<comments>http://maymay.net/blog/2009/07/27/howto-use-rules-to-automatically-manage-email-in-apple-mail/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 21:07:47 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Information & Communication]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[LinkedIn]]></category>
		<category><![CDATA[Mail.app]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=935</guid>
		<description><![CDATA[After recently moving to San Francisco, I joined the San Francisco Freecyclers&#8217; Network. Freecycle is a really cool set of local groups who prefer to give away items to people who want them instead of throwing them away into the trash. The group uses email to connect people who offer items and those who want [...]]]></description>
			<content:encoded><![CDATA[<p>After recently moving to San Francisco, I joined the <a href="http://www.freecycle.org/group/US/California/San%20Francisco">San Francisco Freecyclers&#8217; Network</a>. Freecycle is a really cool set of local groups who prefer to give away items to people who want them instead of throwing them away into the trash. The group uses email to connect people who offer items and those who want them. In order to stay sane, a simple, <a href="http://www.freecycle.org/faq/faq/faq_guidelines" title="Read more about Freecycle guidelines.">conventional format for writing an email&#8217;s subject line</a> lets you quickly figure out what&#8217;s on offer and where.</p>
<p>Thanks to this simple text convention in subject lines, I could trivially automate the process of sorting through the approximately 100 emails a day that the email list generates in order to single out only the emails that interest me. Here&#8217;s how I did it.</p>
<h2>Define Your Goals</h2>
<p>Before setting out on any task, it behooves you to take a moment and think about what it is you&#8217;re trying to accomplish. For me, with the San Francisco Freecycling Network (SFFN) email list, I wanted to achieve the following goals:</p>
<ul>
<li>Keep my inbox clear of email from the SFFN list unless a message was particularly interesting.</li>
<li>Browse the SFFN messages when I wanted to look at them without having to go to the web site.</li>
<li>Highlight particularly interesting messages in my inbox visually and play a special sound to alert me that such email has been found in case Mail was running in the background (since free stuff gets taken fast!).</li>
</ul>
<p>I defined &#8220;particularly interesting&#8221; messages as ones that offered items of need for my recent move. With this in mind, I set out to create email rules that accomplished each goal in turn.</p>
<h2>Step 1: Create a mailbox to store the appropriate messages</h2>
<p>I began by creating a new mailbox to store all the SFFN messages I was getting. This alternate mailbox would be the mailbox I would shunt all SFFN email to so as to keep my inbox clear of it. I called the mailbox simply &#8220;SFFN&#8221;.</p>
<p><strong>Do this:</strong></p>
<ol>
<li>From the <em>Mailbox</em> menu, select <em>New Mailbox…</em>. The New Mailbox sheet appears.</li>
<li>Select any location (&#8220;On My Mac&#8221; is fine, as is the account that receives the mailing list messages), and give it a name.</li>
<li>Click OK.</li>
</ol>
<h2>Step 2: Create an email rule to move all appropriate messages to the new mailbox</h2>
<p>With the new mailbox created, I now needed to get all the appropriate messages in there and out of my inbox.</p>
<p>Apple Mail&#8217;s email rules work by looking at each incoming message and matching it against a set of conditions that you provide. If the message being evaluated matches the conditions you specify, such as &#8220;from the San Francisco Freecycler&#8217;s Network mailing list&#8221;, then an associated action is automatically performed. Every email you get is evaluated against every rule you have unless a rule moves the message to another mailbox or until you trigger the &#8220;stop evaluating rules&#8221; action.</p>
<p>Since moving an email message to a new mailbox ends the process of evaluating rules and moving messages to the SFFN mailbox I just created is the goal of the rule I&#8217;m creating, I decided to name the rule &#8220;END &#8211; SFFN&#8221;.</p>
<p><strong>Do this:</strong></p>
<ol>
<li>From the Mail menu, select <em>Preferences…</em>. The Mail Preferences window opens.</li>
<li>Click the <em>Rules</em> button. The Rules pane appears.</li>
<li>Click the <em>Add Rule</em> button. The Add Rule sheet appears:
<ol>
<li>Enter a meaningful description (I chose &#8220;END &#8211; SFFN&#8221;) in the <em>Description:</em> field.</li>
<li>Provide the conditions you want to match. Since all SFFN emails must be addressed to the mailing list, I simply provided the email address of the mailing list (<kbd>sffn@yahoogroups.com</kbd>) as the condition for the <em>To</em> header.</li>
<li>Provide the actions you want Mail to perform. I simply wanted to move the matched messages to the SFFN mailbox.</li>
</ol>
<li>Click OK.</li>
</ol>
<p>For me, the above configuration looked like this:</p>
<p><a href="http://maymay.net/blog/wp-content/uploads/2009/07/end-sffn-mail-rule.gif"><img src="http://maymay.net/blog/wp-content/uploads/2009/07/end-sffn-mail-rule.gif" alt="end-sffn-mail-rule" title="end-sffn-mail-rule" class="alignnone wp-image-936" /></a></p>
<h2>Step 3: Create an email rule to highlight a message of particular interest</h2>
<p>At this point, any and all email I receive from the San Francisco Freecyclers&#8217; Network is being moved to the SFFN mailbox I created for it. This is nice because it keeps my inbox clear, but it&#8217;s still not very helpful since I still have to go trudging through the SFFN mailbox in order to find anything that might be interesting to me. The whole point of this exercise is to reduce the amount of time I spend actively looking for interesting things and let my computer do that work for me. So the next step is to tell Mail what I&#8217;m looking for so it can show the interesting messages to me.</p>
<p>Now, as it happens I&#8217;m in need of a wireless router. Since &#8220;router&#8221; is an appropriately unique word, I&#8217;m going to tell Mail to look for that word in a subject line. However, since I only want Mail to tell me when a router is available and not when other people like me are looking for routers, I&#8217;ll also tell Mail to look for the keyword &#8220;OFFER&#8221; in the subject line. (And this is why the <a href="http://www.freecycle.org/faq/faq/faq_guidelines">Freecycle guidelines</a> tell users to format their subject lines in a conventional way.)</p>
<p>Finally, since I don&#8217;t want to have to go digging for the interesting email message and since my inbox is already going to be kept clear by the previous rule, I&#8217;ll simply have Mail highlight the message in a bright green color and leave the message in my inbox <em>without</em> moving it to the SFFN mailbox I created earlier.</p>
<p><strong>Do this:</strong></p>
<ol>
<li>From the Rules pane in Mail&#8217;s preferences, click <em>Add Rule</em>.</li>
<li>Enter a meaningful description in the <em>Description:</em> field. (Since I&#8217;m looking for a router, I called it &#8220;SFFN &#8211; Search for OFFERed &#8216;router&#8217;&#8221;.)</li>
<li>Provide the conditions you wish to match. For me, this meant email sent to the Freecycler&#8217;s mailing list with the two words &#8220;OFFER&#8221; and &#8220;router&#8221; in the subject line.</li>
<li>Specify the actions you wish Mail to perform. I wanted Mail simply to color the message green and to leave the email go to the inbox (where it was originally destined for), so I chose &#8220;Stop evaluating rules&#8221;. (I also decided I&#8217;d want Mail to play a special sound to alert me that it had found something interesting. This is optional, of course.)</li>
<li>Click OK.</li>
</ol>
<p>When I was done creating my rule, the above configuration looked like this:</p>
<p><a href="http://maymay.net/blog/wp-content/uploads/2009/07/highlight-router-sffn-mail-rule.gif"><img src="http://maymay.net/blog/wp-content/uploads/2009/07/highlight-router-sffn-mail-rule.gif" alt="Screenshot of Mail.app rule to highlight incoming Freecycling emails offering a router." title="highlight-router-sffn-mail-rule" width="556" height="330" class="alignnone size-full wp-image-945" /></a></p>
<p>I can now repeat this step as many times as desired to tell Mail to highlight other messages that may be of particular interest for some other reason. For instance, say instead of looking for a wireless router, I wanted to look for a toaster. I would simply need to click on &#8220;Duplicate Rule&#8221; and replace all instances of &#8220;router&#8221; with &#8220;toaster&#8221;.</p>
<h2>Step 4: Place email rules in appropriate order</h2>
<p>Since Mail will repeatedly check incoming email against all the active rules, we need to be sure to place the rules in the correct order. You can think of each email rule as part of large Rube Goldberg machine, each message getting funneled through some piece of the logic at each successive rule. That&#8217;s why I began the name of the first rule I created with &#8220;END,&#8221; so that I&#8217;d know it should be placed <em>after</em> the rest of the SFFN-related email rules.</p>
<p>I decided that I wanted Mail to look for anything related to cameras and, of course, to toasters. This gave me a total of 4 rules (three to search for items of interest, and one to keep my inbox clear). Since the three highlighting rules all perform the same action, it doesn&#8217;t really matter which order they go in, but it is important that all of them appear before the rule to move messages to the SFFN mailbox.</p>
<p>To order rules, simply click-and-drag them into the order you wish Mail to evaluate them in. When I was done, my Rules pane looked like this:</p>
<p><a href="http://maymay.net/blog/wp-content/uploads/2009/07/mailapp-rules-pane.gif"><img src="http://maymay.net/blog/wp-content/uploads/2009/07/mailapp-rules-pane.gif" alt="Screenshot of the Mail.app Rules pane with sorted rules." title="mailapp-rules-pane" width="550" height="309" class="alignnone size-full wp-image-946" /></a></p>
<h2>Conclusion</h2>
<p>Mail rules are an extremely powerful feature that most email clients have, but that too few people use. They can save you enormous amounts of time and increase your productivity by automating simple yet time-consuming tasks.</p>
<p>The conventional, standardized subject lines that the Freecycle mailing list uses simplifies the logic required to have your computer automatically process your messages for you. This is a useful observation because it can be applied to other areas of your life where using simple conventions can help to organize otherwise overwhelming information tasks into manageable batches. Although this particular example uses stock, simple commands, you can get as fancy as you like by having an action trigger an <a href="/blog/category/applescript/">AppleScript</a>.</p>
<p>Now, hopefully, finding some additional housewares and a wireless router for my new San Francisco apartment will be as easy as checking (but not manually sorting!) my own email!</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2009/07/27/howto-use-rules-to-automatically-manage-email-in-apple-mail/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Create an encrypted disk image to store confidential files</title>
		<link>http://maymay.net/blog/2008/10/13/one-minute-mac-tip-create-an-encrypted-disk-image-to-store-confidential-files/</link>
		<comments>http://maymay.net/blog/2008/10/13/one-minute-mac-tip-create-an-encrypted-disk-image-to-store-confidential-files/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 06:33:17 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=548</guid>
		<description><![CDATA[Nary a day goes by when I don&#8217;t use my computer for some extremely personal stuff. I would consider it a Very Bad Thing if some of this information (my bank account details or private SSH keys, for instance) fell out of my control. Everyone has sensitive files that they keep on their computer and, [...]]]></description>
			<content:encoded><![CDATA[<p>Nary a day goes by when I don&#8217;t use my computer for some <em>extremely</em> personal stuff. I would consider it a <a href="http://www.catb.org/jargon/html/B/Bad-Thing.html">Very Bad Thing</a> if some of this information (my bank account details or private <acronym title="Secure SHell">SSH</acronym> keys, for instance) fell out of my control.</p>
<p>Everyone has sensitive files that they keep on their computer and, fortunately for Mac <acronym title="Operating System">OS</acronym> X Users, Apple has made it ridiculously easy to create a cryptographically secure containers for such files. You can think of a container like this, which is just a standard Mac <acronym title="Operating System">OS</acronym> X disk image (<code>.dmg</code>) file, like a vault that you open, put stuff you want to keep safe inside, and then close again.</p>
<p>Here&#8217;s how you go about making and using one.</p>
<h3>Create the container, an encrypted disk image</h3>
<ol>
<li>First, open up your copy of Disk Utility.app, which is located in your computer&#8217;s <code>/Applications/Utilities</code> folder. (As an aside, this program is a bit like a swiss army knife for handling disk operations in Mac <acronym title="Operating System">OS</acronym> X. You should definitely <a href="http://en.wikipedia.org/wiki/Disk_Utility">find out what else it can do</a>).</li>
<li>Next, select the <em>File &rarr; New &rarr; Blank Disk Image&hellip;</em> option. This will cause the New Blank Image window to appear.</li>
<li>Fill in the typical details such as the disk image file&#8217;s name and where you want to save it to. In addition, you&#8217;ll be presented with a number of options such as Volume Name, Volume Size, and Image Format. The defaults are usually adequate except for Volume Name, which you should customize so that when you mount the disk image the disk label is meaningful for you, and the Image Format, which I recommend you switch to &#8220;<a href="http://en.wikipedia.org/wiki/Sparse_disk_image">sparse disk image</a>.&#8221;
<p>Sparse disk images can start small and grow automatically as you write more files into them. If what you want to keep secure in this manner are very large files, say gigantic high resolution PhotoShop documents, then you might <a href="http://macosx.com/article/live-filevaultsparse-bundle-backups-in-leopard.html">consider the sparse <em>bundle</em> disk image format</a> instead.</p>
<p>Also, obviously, set the Encryption to a value other than &#8220;None.&#8221;</p>
<p>Here&#8217;s an example screenshot from my Mac:<div id="attachment_691" class="wp-caption aligncenter" style="width: 510px"><a href="http://maymay.net/blog/wp-content/uploads/2008/10/new-blank-image-screenshot.png"><img src="http://maymay.net/blog/wp-content/uploads/2008/10/new-blank-image-screenshot.png" alt="Screenshot of the New Blank Image window showing meaningful values entered, Encryption field set to 128-bit, and Image Format field set to sparse disk image." title="new-blank-image-screenshot" width="500" height="470" class="size-full wp-image-691" /></a><p class="wp-caption-text">Screenshot of the New Blank Image window showing meaningful values entered, Encryption field set to 128-bit, and Image Format field set to sparse disk image.</p></div></li>
<li>Press the &#8220;Create&#8221; button and you&#8217;ll be presented with a standard password selection dialogue. This is the password you&#8217;ll use to mount the disk image and is analogous to the idea of setting the combination on your vault&#8217;s lock. <a href="http://support.apple.com/kb/HT1506" title="Learn how to choose good passwords in Mac OS X.">It&#8217;s critical that the password you choose is a good one</a>. Ideally, your password is a totally random string that may include any printable character. Since that&#8217;s hard to remember, you can <a href="http://maymay.net/blog/2008/05/06/one-minute-mac-tip-use-mac-os-xs-keychain-to-store-recover-and-sync-all-your-passwords-from-one-place/">have the Mac <acronym title="Operating System">OS</acronym> X keychain manage your passwords for you</a>.</li>
</ol>
<h3>Encrypt some files by writing them to the disk image</h3>
<p>Now that you have an encrypted disk image, a secure container for your sensitive data, you can make use of it just as you might any other disk image on Mac <acronym title="Operating System">OS</acronym> X. For instance, say I have a top secret file called &#8220;My Killer Business Plan.pages&#8221; and I don&#8217;t want anyone to get at it. All I need to do is copy the file into my encrypted disk image, as the following screenshot shows:</p>
<a href="http://maymay.net/blog/wp-content/uploads/2008/10/encrypting-files-via-copy-to-image.jpg"><img src="http://maymay.net/blog/wp-content/uploads/2008/10/encrypting-files-via-copy-to-image-300x138.jpg" alt="Copying &quot;My Killer Business Plan.pages&quot; to the encrypted disk image encrypts the file, too." title="encrypting-files-via-copy-to-image" width="300" height="138" class="size-medium wp-image-693" /></a>
<p>It should go without saying that you want to delete the original, unencrypted copy of the file you&#8217;re copying into the encrypted disk image, but I&#8217;ll say that anyway. Don&#8217;t leave unprotected copies of your files lying around. Also, be certain to unmount (eject) the disk image when you&#8217;re done using it because the only thing the password protects is opening the disk image, not the files contained within it.</p>
<h3>External references</h3>
<p>Here are some additional places where this technique is discussed. Check out these additional articles about this topic elsewhere for more information and other perspectives:</p>
<ul>
<li><a href="http://support.apple.com/kb/HT1578">Mac <acronym title="Operating System">OS</acronym> X: How to create a password-protected (encrypted) disk image</a></li>
<li><a href="http://docs.info.apple.com/article.html?artnum=107332">Mac <acronym title="Operating System">OS</acronym> X: About Encrypted Disk Images</a></li>
<li><a href="http://www.macosxhints.com/article.php?story=20030212055706937">MacOSXHints.com: Create an encrypted disk image that grows as required</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/10/13/one-minute-mac-tip-create-an-encrypted-disk-image-to-store-confidential-files/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extract list of all Apple WikiServer wiki titles into CSV format</title>
		<link>http://maymay.net/blog/2008/09/22/extract-list-of-all-apple-wikiserver-wiki-titles-into-csv-format/</link>
		<comments>http://maymay.net/blog/2008/09/22/extract-list-of-all-apple-wikiserver-wiki-titles-into-csv-format/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 05:35:55 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Bash/Shell Scripting]]></category>
		<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=652</guid>
		<description><![CDATA[An interesting request came in today from a coworker. She wanted to create a spreadsheet that contained all of our intranet&#8217;s wiki pages (which uses the Apple WikiServer), presumably because Apple doesn&#8217;t provide an easy way to &#8220;list all pages&#8221; in the wiki itself. Along with the page title, she also wanted to extract its [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting request came in today from a coworker. She wanted to create a spreadsheet that contained all of our intranet&#8217;s wiki pages (which uses the Apple WikiServer), presumably because Apple doesn&#8217;t provide an easy way to &#8220;list all pages&#8221; in the wiki itself. Along with the page title, she also wanted to extract its internal ID, its <acronym title="Uniform Resource Locator">URL</acronym>, and the time the page was created as well as the time it was last modified.</p>
<p>I spent about an hour looking into this this afternoon and it turns out that much of this information is readily available on the filesystem in the Apple WikiServer&#8217;s data store. I whipped up the following shell script to extract this information in CSV format, exactly as requested.</p>
<p>I&#8217;m posting this script here in case someone else wants similar &#8220;export a list of WikiServer pages to a comma-separated values (CSV) file&#8221; functionality but isn&#8217;t sure how to go about getting it. To use this, just edit the line that reads <code>http://my-server.example.com/groups/wiki/</code> so that it refers to the wiki base <acronym title="Uniform Resource Identifier">URI</acronym> of your own server.</p>
<p><ins datetime="2008-09-23T07:15:49+00:00"><strong>Update:</strong> The latest version of this script is now available at <a href="//github.com/meitar/wikipages2csv/">its Github-hosted repository</a>. <strong>You should probably use that instead of the script below.</strong></ins></p>
<pre class="shell">
#!/bin/<var>sh</var> -
#
# Script to extract data from an Apple WikiServer's data store by querying the
# filesystem itself. Creates a 'wikipages.csv' file that's readable by any
# spreadsheeting application, such as Numbers.app or Microsoft Excel.app.
#
# USAGE:   To use this script, change to the WikiServer's pages directory, then
#          just run this script. A file named wikipages.csv will be created in
#          your current directory. For instance:
#
#              cd /Library/Collaboration/Groups/mygroup/wiki  # dir to work in
#              wikipages2csv.sh                               # run the script
#              cp wikipages.csv ~/Desktop                     # save output
#
# WARNING: Since the WikiServer's files are only accessible as root, this script
#          must be run as root to function. Additionally, this is not extremely
#          well tested, so use at your own risk.
#
# Author:  Meitar Moscovitz
# Date:    Mon Sep 22 15:03:54 EST 2008

##### CONFIGURE HERE ########

# The prefix to append to generated links. NO SPACES!
WS_URI_PREFIX=http://my-server.example.com/groups/wiki/

##### END CONFIGURATION #####
# DO NOT EDIT PAST THIS LINE
#############################

WS_CSV_OUTFILE=wikipages.csv
WS_PAGE_IDS_FILE=`mktemp ws-ids.tmp.XXXXXX`

function extractPlistValueByKey () {
    head -n \
      $(expr 1 + `grep -n "&lt;key&gt;$1&lt;/key&gt;" page.plist | cut -d ':' -f 1`) page.plist | \
        tail -n 1 | cut -d '&gt;' -f 2 | cut -d '&lt;' -f 1
}

function linkifyWikiServerTitle () {
    echo $1 | sed -e 's/ /_/g' -e 's/&amp;amp;/_/g' -e 's/&amp;gt;/_/g' -e 's/&amp;lt;/_/g' -e 's/\?//g'
}

function formatISO8601date () {
    echo $1 | sed -e 's/T/ /' -e 's/Z$//'
}

function csvQuote () {
    echo $1 | grep -q ',' &gt;/dev/null
    if [ $? -eq 0 ]; then
        echo '"'$1'"'
    else
        echo $1
    fi
}

ls -d [^w]*.page | \
  sed -e 's/^\([a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]\)\.page$/\1/' &gt; $WS_PAGE_IDS_FILE

echo "Title,ID,Date Created,Last Modified,<acronym title="Uniform Resource Identifier">URI</acronym>" &gt; $WS_CSV_OUTFILE
while read id; do
    cd $id.page
    title=$(extractPlistValueByKey title)
    created_date="$(formatISO8601date $(extractPlistValueByKey createdDate))"
    modified_date="$(formatISO8601date $(extractPlistValueByKey modifiedDate))"
    link=$WS_URI_PREFIX"$id"/`linkifyWikiServerTitle "$title"`.html
    cd ..
    echo `csvQuote "$title"`,$id,$created_date,$modified_date,`csvQuote "$link"` &gt;&gt; $WS_CSV_OUTFILE
done &lt; $WS_PAGE_IDS_FILE
rm $WS_PAGE_IDS_FILE
</pre>
<p>For those new to the Wiki Server, this <a href="/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/">introduction to the Apple WikiServer for web developers</a> may be of interest.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/09/22/extract-list-of-all-apple-wikiserver-wiki-titles-into-csv-format/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Remove .DS_Store files from ZIP Archives</title>
		<link>http://maymay.net/blog/2008/08/04/one-minute-mac-tip-remove-ds_store-files-from-zip-archives/</link>
		<comments>http://maymay.net/blog/2008/08/04/one-minute-mac-tip-remove-ds_store-files-from-zip-archives/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 06:07:51 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Bash/Shell Scripting]]></category>
		<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=544</guid>
		<description><![CDATA[The Mac OS X Finder has some nifty features, one of which is an exceptionally useful contextual menu item to create ZIP archives of folders. Unfortunately, the Finder also has some really, really annoying habits, one of which is to create a file named .DS_Store in each folder a user opens (when not in Column [...]]]></description>
			<content:encoded><![CDATA[<p>The Mac <acronym title="Operating System">OS</acronym> X Finder has some nifty features, one of which is an exceptionally useful contextual menu item to create ZIP archives of folders. Unfortunately, the Finder also has some really, really annoying habits, one of which is to create a file named <code>.DS_Store</code> in each folder a user opens (when not in Column view). What this means is that if you create a ZIP archive on your Mac and then send it to someone who unzips it without the Finder (such as a Windows user using the Windows Explorer), the recipient will see a lot of litter in the form of useless and meaningless <code>.DS_Store</code> files.</p>
<p>If you&#8217;re not afraid of the Terminal, this can be avoided. Put the following lines in your <code>~/.profile</code> (or similar):</p>
<pre class="shell">
alias rmds='find . -name ".DS_Store" -type f -print0 | xargs -0 rm'
</pre>
<p>What this does is creates a new command that you can use (<code>rmds</code>) which recursively finds and deletes any regular file named &#8220;.DS_Store&#8221; starting from the current directory. Thus, running this command in the folder you are about to create an archive out of will clean it first, and will prevent unnecessary confusion on the part of your archive file recipient.</p>
<p>Alternatively, another way to do this is to use the command-line <code>zip</code> program and an (admittedly more complicated) pipeline to remove the <code>.DS_Store</code> files <em>after</em> they have been added to the archive. To do that, use this series of commands:</p>
<pre class="shell">
zip -d <var>ZIPfile.zip</var> `unzip -l <var>ZIPfile.zip</var> | grep .DS_Store | awk '{print $4}'`
</pre>
<p>where, naturally, <var>ZIPfile.zip</var> is the ZIP archive you want to remove the <code>.DS_Store</code> files from. Creating an alias out of that command (and making it work for paths that contain spaces) is left as an exercise for the reader. ;)</p>
<p>As an aside, the <code>alias</code>, <code>find</code> and <code>xargs</code> commands are incredibly useful in their own right and can be used to do a lot of pretty amazing things. As always, <code>man <var>command</var></code> will give you the nitty gritty.</p>
<p>Also as an aside, you can stop the Finder from creating <code>.DS_Store</code> files entirely when browsing network volumes (like Windows shares) with another command, <a href="//support.apple.com/kb/HT1629">documented in Apple&#8217;s Knowledge Base</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/08/04/one-minute-mac-tip-remove-ds_store-files-from-zip-archives/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Securely erase files from the command line</title>
		<link>http://maymay.net/blog/2008/07/31/one-minute-mac-tip-securely-erase-files-from-the-command-line/</link>
		<comments>http://maymay.net/blog/2008/07/31/one-minute-mac-tip-securely-erase-files-from-the-command-line/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 09:24:42 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Apple/Macintosh]]></category>
		<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=537</guid>
		<description><![CDATA[Security provisions are one of those &#8220;things&#8221; that Mac users have been snooty about—for good reason—for decades. However, I&#8217;d dare say that, even though the UNIX architecture of the underpinnings of Mac OS X is much more secure than most other popular operating systems (cough, Windows, cough), much of the security benefits that Mac users [...]]]></description>
			<content:encoded><![CDATA[<p>Security provisions are one of those &#8220;things&#8221; that Mac users have been snooty about—for good reason—for decades. However, I&#8217;d dare say that, even though the UNIX architecture of the underpinnings of Mac <acronym title="Operating System">OS</acronym> X is much more secure than most other popular operating systems (cough, Windows, cough), much of the security benefits that Mac users have enjoyed are really security-by-obscurity, which is not very secure at all. With the added popularity of Mac <acronym title="Operating System">OS</acronym> X, lots of responsibility suddenly shifts from the vendor (Apple, Inc.) to the individual users (this means you) to keep your data secure.</p>
<p>Apple has been on point, however, providing good security utilities built right into the operating system and easily available to end users. Of most common use is probably &#8220;Secure Empty Trash&#8221; which securely deletes files that you put into the trash. The counterpart to this function available in the Finder is, too few Mac users know, the <code>srm</code> or <dfn>secure remove</dfn> command-line utility.</p>
<p><code>srm</code> can be thought of as simply a version of <code>rm</code> that overwrites file data before unlinking it from the file system. It comes with a few more options than <code>rm</code> comes with all geared towards tweaking just how it overwrites files. My favorite is <code>-m</code>, which the manual page says:</p>
<blockquote><p>overwrite the file with 7 US DoD compliant passes (0xF6, 0&#215;00, 0xFF, random, 0&#215;00, 0xFF, random)</p></blockquote>
<p>I had the perfect occasion to use <code>srm</code> today: I was transporting my <acronym title="Secure SHell">SSH</acronym> private key from one laptop to another via a temporary drive. I wanted to securely remove all traces of the private key file from the temporary drive after installing it in the new computer. (See <a href="http://sial.org/howto/openssh/publickey-auth/">this <acronym title="Secure SHell">SSH</acronym> public key tutorial</a> if you don&#8217;t know why this might be important.)</p>
<p>After copying the private key file over, removing it securely looks like this:</p>
<pre>
srm -m private_key_file
</pre>
<p>It&#8217;s that easy.</p>
<p>To be confident that your file is truly overwritten with garbage, you can use the <code>-n</code> option. This is one way to retain a file, but completely corrupt it. Observe:</p>
<pre>
Meitar:~ meitar$ cat testfile
Hello world.
Meitar:~ meitar$ srm -mn testfile
Meitar:~ meitar$ cat testfile
?
 ?)c?I
      P?Meitar:~ meitar$
</pre>
<p>That garbage you see after the second invocation of <code>cat</code> shows that the file really was trashed, that is, overwritten with garbage data. Now, a simple <code>rm testfile</code> can do the rest of the work.</p>
<p>As always, <code>man srm</code> will give you all the other juicy details.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/07/31/one-minute-mac-tip-securely-erase-files-from-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Server Tip: Enable user avatars for Apple WikiServer without enabling User Weblogs</title>
		<link>http://maymay.net/blog/2008/07/25/mac-os-x-server-tip-enable-user-avatars-for-apple-wikiserver-without-enabling-user-weblogs/</link>
		<comments>http://maymay.net/blog/2008/07/25/mac-os-x-server-tip-enable-user-avatars-for-apple-wikiserver-without-enabling-user-weblogs/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 14:58:41 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Apple/Macintosh]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=525</guid>
		<description><![CDATA[Today I had the opportunity to toy around with more of Apple&#8217;s WikiServer (aka &#8220;Teams Server) intranet-building suite of applications. I already gave the wiki feature a pretty thorough treatment, so this time I set my sights on a simple user-specific (as opposed to group-specific) feature. In my office of approximately twenty-some-odd employees, we&#8217;ve just [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had the opportunity to toy around with more of Apple&#8217;s WikiServer (<acronym title="Also Known As">aka</acronym> &#8220;Teams Server) intranet-building suite of applications. I already gave the <a href="/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/">wiki feature a pretty thorough treatment</a>, so this time I set my sights on a simple user-specific (as opposed to group-specific) feature.</p>
<p>In my office of approximately twenty-some-odd employees, we&#8217;ve just begun using the groups&#8217; blog feature to replace all-staff emails for interesting items that are not business related. This has actually been a huge boon for several reasons, not least of which is the productivity boost we can enjoy thanks to moving from a push system (relatively annoying, if occasionally interesting emails) to a pull system (web browsing, <acronym title="Really Simple Syndication">RSS</acronym> feeds, all generated from the Apple WikiServer group blog). Out of the box, only one feature was missing from the group blog: user profile pictures (&#8220;avatars&#8221;).</p>
<p>If you only turn on the group wikis and blogs features in Apple&#8217;s WikiServer, you&#8217;ll find that whenever someone posts a comment to a wiki page or a blog post, a generic profile picture will appear next to their comment. If you give that person&#8217;s user account a profile picture in Workgroup Manager, you&#8217;ll see that generic profile icon turn into a broken question mark. It turns out that this is because the user profile pictures are served by a completely different web service than the group&#8217;s wiki and blog is served so if that server isn&#8217;t running none of these images will be served up to the browser.</p>
<p>Fixing that is simple enough: simply turn on the appropriate server—the User Weblog server—by opening Server Admin, navigating to the Web Service settings, and enabling the &#8220;Blogs&#8221; service for users under your web site, then clicking save. For the default web site (<code>*</code>), all that checkbox technically does is remove the comment in the <code>/etc/apache2/sites/0000_any_80_.conf</code> file that reads:</p>
<pre>
#        Include /etc/apache2/httpd_users.conf
</pre>
<p>The <code>/etc/apache2/httpd_users.conf</code> file enables the use of your web site&#8217;s <code>/users</code> <acronym title="Uniform Resource Locator">URL</acronym> paths. In practice, this means that you&#8217;ve now allowed anyone with a user account in your Open Directory database to create a new hosted, personal weblog on your server. This may be what you want, but it wasn&#8217;t what I wanted—all I wanted was user profile pictures on the <em>groups</em> features.</p>
<p>As it happens, everything behind the <code>/users</code> <acronym title="Uniform Resource Locator">URL</acronym> is actually a completely different web server (really an instance of <a href="//twistedmatrix.com/">Twisted Python</a>) that&#8217;s accessed via a <code>ProxyPass</code> directive. This turns out to be really handy, because it means we can intercept requests for these URLs and redirect them before they ever get to the Twisted &#8220;User Weblog&#8221; server.</p>
<p>By examining the source of the wiki page on which a user&#8217;s profile picture icon appears, we can see that the <acronym title="Uniform Resource Locator">URL</acronym> path to the user&#8217;s image is retrieved by accessing a <acronym title="Uniform Resource Locator">URL</acronym> that looks like <code>/users/<var>username</var>/icon.jpg</code> (where <var>username</var> is the user&#8217;s full Unix username). So, with the following lines of Apache RewriteRule magic, we can enable <em>only</em> the serving of these user profile avatars but <em>not</em> let users create their own personal blogs:</p>
<pre>
#### We are ONLY using the /etc/apache2/httpd_users.conf file to
#### enable per-user avatar icons sourced from our OpenDirectory
#### user database. So to avoid the messy instance where people
#### create their own blogs we will redirect anything except the
#### image icons themselves to a 403 Forbidden error page.
&lt;IfModule mod_rewrite.c&gt;
        RewriteEngine On
        RewriteCond %{REQUEST_URI} ^/users
        RewriteRule !^/users/[A-Za-z]+/icon.jpg [F,L]
&lt;/IfModule&gt;
</pre>
<p>The magic happens in the lines that begin with <code>RewriteCond</code> and <code>RewriteRule</code>. The <code>RewriteCond</code> rule examines the incoming <acronym title="Uniform Resource Identifier">URI</acronym> and only continues processing if it begins with &#8220;/users&#8221;. That&#8217;s important because the next line, the <code>RewriteRule</code> returns a 403 Forbidden error for any and all requests that do not match  a <acronym title="Uniform Resource Identifier">URI</acronym> that starts out like <code>/users/<var>username</var>/icon.jpg</code>. In other words, without the <code>RewriteCond</code> directive, the entire web site would only be able to serve user profile pictures, and without the <code>RewriteRule</code>, all the URLs of the User Weblog server would be available (such as those to create new personal weblogs).</p>
<p>With both in place, however, I can get exactly what I want out of the Weblog Server. No more and no less.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/07/25/mac-os-x-server-tip-enable-user-avatars-for-apple-wikiserver-without-enabling-user-weblogs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>One minute Mac tip: Schedule off-hours downloads by enabling `at`, `batch` UNIX job scheduling commands</title>
		<link>http://maymay.net/blog/2008/07/14/one-minute-mac-tip-schedule-off-hours-downloads-by-enabling-at-batch-unix-job-scheduling-commands/</link>
		<comments>http://maymay.net/blog/2008/07/14/one-minute-mac-tip-schedule-off-hours-downloads-by-enabling-at-batch-unix-job-scheduling-commands/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 08:48:56 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Unix/Linux]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=508</guid>
		<description><![CDATA[In a lot of places in the world, many people still have to pay for bandwidth costs. I&#8217;m one of those people who just can&#8217;t afford to download lots of stuff during peak hours when my bandwidth might quickly get shaped or, worse, I&#8217;ll get charged. Nevertheless, there are often plenty of legit reasons to [...]]]></description>
			<content:encoded><![CDATA[<p>In a lot of places in the world, many people still have to pay for bandwidth costs. I&#8217;m one of those people who just can&#8217;t afford to download lots of stuff during peak hours when my bandwidth might quickly get shaped or, worse, I&#8217;ll get charged. Nevertheless, there are often plenty of legit reasons to initiate huge downloads.</p>
<p>In these cases, it makes sense to be smart about <em>when</em> I initiate these downloads. Being something of a UNIX-head myself, I wanted to use the age-old <code>at</code> command to download a Linux ISO during off-peak hours, which my <acronym title="Internet Service Provider">ISP</acronym> says starts at 2 AM. Much to my chagrin, I found that <code>at</code> doesn&#8217;t work by default on Mac <acronym title="Operating System">OS</acronym> X and, worse, the Leopard man page leads to a dead end (though it didn&#8217;t back in Tiger…).</p>
<p>Turns out that the system daemon that is responsible for checking up on <code>at</code> jobs has been wrapped with a <code>launchd</code> job. This makes enabling <code>at</code> on your system really easy:</p>
<pre>sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist</pre>
<p>Once you&#8217;ve done this, you can now use <code>at</code> as you normally have done. For instance, I could now schedule my downloads to happen during the off-peak hours:</p>
<pre><samp>Perseus:Fedora maymay$ </samp>at 2:15am tomorrow # now press <kbd>return</kbd>
curl -LO http://download.fedoraproject.org/pub/fedora/linux/releases/9/Fedora/x86_64/iso/Fedora-9-x86_64-<acronym title="Digital Video Disc">DVD</acronym>.iso
# now press <kbd>CTRL-D</kbd>.
<samp>job 1 at Tue Jul 15 02:15:00 2008
Perseus:Fedora maymay$ </samp>atq
<samp>1	Tue Jul 15 02:15:00 2008</samp>
</pre>
<p>This is also incredibly handy for scheduling just about any resource-intensive task that you don&#8217;t have to do <em>right now</em>. To take it one step further, you can even let the computer itself choose when to run these resource-heavy tasks by using the <code>batch</code> command, which will execute commands much like <code>at</code> but will check the system load average instead of the system clock to determine if it should start the job.</p>
<p>Note that with the <code>com.apple.atrun</code> job loaded <code>/usr/libexec/atrun</code> is started every 30 seconds (unless you change the <code>StartInterval</code> key in the <code>plist</code> file). Since the <code>atrun</code> command checks a file on disk (that it places in the <code>/usr/lib/cron/jobs</code> directory) to see if there is any work to do, this will probably prevent your disks from ever sleeping, which could be a major concern for battery life on portables. Also, obviously, your computer needs to be turned on and awake for the job to actually launch.</p>
<p>For more information, check out the result of typing <code>man at</code> and <code>man launchctl</code> at a Terminal prompt. There&#8217;s also a really good <a href="http://video.google.com/videoplay?docid=1781045834610400422">Google Tech Talk about Launchd</a> that will teach you a lot more about job scheduling on Mac <acronym title="Operating System">OS</acronym> X.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/07/14/one-minute-mac-tip-schedule-off-hours-downloads-by-enabling-at-batch-unix-job-scheduling-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>One minute Mac tip: Auto-complete, spellcheck, and search for definitions in Cocoa text fields</title>
		<link>http://maymay.net/blog/2008/06/28/one-minute-mac-tip-auto-complete-spellcheck-and-search-for-definitions-in-cocoa-text-fields/</link>
		<comments>http://maymay.net/blog/2008/06/28/one-minute-mac-tip-auto-complete-spellcheck-and-search-for-definitions-in-cocoa-text-fields/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 10:19:49 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Crosspost]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Writing and blogging]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=487</guid>
		<description><![CDATA[Without doubt, the most common use of computers today is to create written content of some kind. Blogs are an obvious example, but written content can take a number of forms. Writing manuscripts for publication is another example. No matter what kind of writing you&#8217;re doing, using good tools to make your writing technically better [...]]]></description>
			<content:encoded><![CDATA[<p>Without doubt, the most common use of computers today is to create written content of some kind. Blogs are an obvious example, but written content can take a number of forms. Writing manuscripts for publication is another example.</p>
<p>No matter what kind of writing you&#8217;re doing, using good tools to make your writing technically better is an incredibly handy thing. Letting the computers do the technical stuff&mdash;the stuff they&#8217;re good at&mdash;let&#8217;s you focus on the creative stuff: writing great content. Which is why, if you use a Mac, you&#8217;ll be happy to hear that any application&#8217;s text field let&#8217;s you do a number of really cool things (as long as it&#8217;s a <a href="//developer.apple.com/cocoa/">Cocoa</a> application, of course).</p>
<h2>1. Auto-complete unfinished words</h2>
<p>Try this out:</p>
<ol>
<li>Open TextEdit, from your <code>/Applications</code> directory. A new blank document will open.</li>
<li>Type <kbd>Hel</kbd> and then press the <kbd>ESC</kbd> key. A drop-down menu will suddenly appear with an alphabetically sorted auto-complete list of suggestions, sourced from your computer&#8217;s current language dictionary. It looks like this: <a href='http://maymay.net/blog/wp-content/uploads/2008/06/cocoa-text-auto-complete.png'><img src="http://maymay.net/blog/wp-content/uploads/2008/06/cocoa-text-auto-complete.png" alt="Mac OS X\&#039;s native Cocoa framework allows for many applications to get \&quot;auto-complete\&quot; functionality for free." title="cocoa-text-auto-complete" width="255" height="383" class="alignnone size-full wp-image-488" /></a></li>
</ol>
<p>This feature works with both <a href="//www.apple.com/iwork/pages/">Pages</a> and, for those of you still using it for some reason (I know you&#8217;re out there), TextEdit, too. Also, if you&#8217;re a developer <em>and</em> a writer as well (like I am), you&#8217;ll be happy to hear that this feature also works with <a href="http://developer.apple.com/tools/xcode/index.html">Xcode</a>&#8216;s Code Sense feature, and suggests completions for variable, function, class, and method names in your code.</p>
<h2>2. Spellcheck as you type</h2>
<p>A Cocoa text input field also has a number of other tricks up its sleeve. For instance, in many applications you can elect to turn on the &#8220;Check spelling as you type&#8221; feature, which will cause words you misspell (words not in the computer&#8217;s dictionary) to appear with a dotted red underline. If you right-click on these words, the contextual menu that appears will offer spelling corrections.</p>
<p>However, sometimes we use words like those in slang or colloquial language that isn&#8217;t in a proper dictionary. These words will still appear to be &#8220;misspelled&#8221; when you type, so in these cases, we can tell Mac <acronym title="Operating System">OS</acronym> X to &#8220;Learn Spelling&#8221; (also from the contextual menu). When you select this option, you append that spelling to your personal dictionary. (This is really just a plain-text file located at <code>~/Library/Spelling/<var>lang</var></code> file, where <var>lang</var> is the language code you&#8217;re typing in. For Enlgish, this file is <code>~/Library/Spelling/en</code>.)</p>
<h2>3. Look up word definitions and search for text in Google or Spotlight</h2>
<p>Last, but certainly not least, another neat thing you can do with text on your Mac is look them up with Dictionary.app. Simply highlight some selectable text on screen, right-click and select &#8220;Look up in Dictionary&#8221;. This will cause Dictionary.app to open and display the definition of the selected word.</p>
<p><a href='http://maymay.net/blog/wp-content/uploads/2008/06/cocoa-text-contextual-menu.png'><img src="http://maymay.net/blog/wp-content/uploads/2008/06/cocoa-text-contextual-menu.png" alt="" title="cocoa-text-contextual-menu" width="264" height="287" class="alignnone size-full wp-image-489" /></a></p>
<p>Since <a href="//www.apple.com/pro/tips/wiki.html">Dictionary.app can also look up articles in Wikipedia</a>, this is also a very quick way to go to a Wikipedia article without ever having to open up a Web browser.</p>
<p>Also, from the very same menu, you <em>can</em> open a Web browser. Simply select &#8220;Search in Google&#8221; to cause your default Web browser to launch a Google search for the highlighted text.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/06/28/one-minute-mac-tip-auto-complete-spellcheck-and-search-for-definitions-in-cocoa-text-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One minute Mac tip: Create the illusion that Bonjour works over a VPN</title>
		<link>http://maymay.net/blog/2008/06/26/one-minute-mac-tip-create-the-illusion-that-bonjour-works-over-a-vpn/</link>
		<comments>http://maymay.net/blog/2008/06/26/one-minute-mac-tip-create-the-illusion-that-bonjour-works-over-a-vpn/#comments</comments>
		<pubDate>Thu, 26 Jun 2008 10:25:46 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=483</guid>
		<description><![CDATA[If you&#8217;re a Mac user who often uses VPN connections, you&#8217;ll notice one very disappointing thing about connecting to your corporate or personal network over such tunneled connections: typically, Bonjour-style addresses (such as &#8220;computer-name.local&#8221;) don&#8217;t work. This is because multicast DNS (or mDNS) doesn&#8217;t work over a tunnel. Though there are ways to get it [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a Mac user who often uses VPN connections, you&#8217;ll notice one very disappointing thing about connecting to your corporate or personal network over such tunneled connections: typically, Bonjour-style addresses (such as &#8220;computer-name.local&#8221;) don&#8217;t work. This is because multicast <acronym title="Domain Name System or Domain Name Server">DNS</acronym> (or mDNS) doesn&#8217;t work over a tunnel. Though there are ways to get it functional, they are pretty complicated and require that you have a lot of esoteric networking knowledge.</p>
<p>However, if the services you typically access via Bonjour use static <acronym title="Internet Protocol">IP</acronym> addresses, then there is one age-old networking technique you can use to simulate Bonjour-style naming conventions without actually using Bonjour. This, of course, is the <code>/etc/hosts</code> file.</p>
<p>The <code>/etc/hosts</code> is a simple, static, text-based mapping of computer names to <acronym title="Internet Protocol">IP</acronym> addresses. It does exactly what Bonjour does except it doesn&#8217;t keep itself up to date when things change. Of course, if you&#8217;re using static IPs for the services you want access to, you can pretty safely assume that things aren&#8217;t going to be changing frequently anyway. Long-time sysadmins will laugh at this, but I say let them laugh. This is remarkably useful and very easy to implement.</p>
<p>Let&#8217;s assume I&#8217;m running a personal web server on my home network, and I can access my home network via a VPN. On my home network, my web server&#8217;s <acronym title="Internet Protocol">IP</acronym> address is, say, <code>192.168.2.100</code>, and I usually access it as <code>http://server.local/</code>. All I need to do is open a Terminal prompt and run the following commands as an administrative user:</p>
<pre>
sudo echo "192.168.2.100	server.local" >> /etc/hosts
</pre>
<p>That&#8217;s it. What this does is hard-wire the name <code>server.local</code> so that it always resolves to the <acronym title="Internet Protocol">IP</acronym> address <code>192.168.2.100</code>. Now, anytime anything on my computer tries to access <code>server.local</code>, it&#8217;ll always access <code>192.168.2.100</code> directly instead of ever needing to make an mDNS query on the network. The net effect is that we can trick our computer into thinking that Bonjour is working, even when it&#8217;s not—such as over a VPN connection.</p>
<p>Note that in default cases, hard-wiring an <acronym title="Internet Protocol">IP</acronym> address like this <em>completely prevents your computer from ever asking other computers (such as <acronym title="Domain Name System or Domain Name Server">DNS</acronym> servers) what the current <acronym title="Internet Protocol">IP</acronym> address for this name is</em>. That means if the <acronym title="Internet Protocol">IP</acronym> address of the remote server changes, you won&#8217;t be notified, and things will just not work. So be mindful that you&#8217;ve made this change, and revert it as a first step in troubleshooting procedures.</p>
<p>By the way, Windows users can do the very same thing simply by editing their <code>etc/hosts</code>. They can find this file at <code>C:\WINDOWS\system32\drivers\etc\hosts</code> and can edit it with Notepad. They will also need to <a href="//www.apple.com/support/downloads/bonjourforwindows.html">install Bonjour for Windows</a> to get Bonjour working in the first place, of course.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/06/26/one-minute-mac-tip-create-the-illusion-that-bonjour-works-over-a-vpn/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Use the command line to edit the content of your clipboard</title>
		<link>http://maymay.net/blog/2008/05/09/one-minute-mac-tip-use-the-command-line-to-edit-the-content-of-your-clipboard/</link>
		<comments>http://maymay.net/blog/2008/05/09/one-minute-mac-tip-use-the-command-line-to-edit-the-content-of-your-clipboard/#comments</comments>
		<pubDate>Fri, 09 May 2008 05:08:21 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=433</guid>
		<description><![CDATA[Using the pbpaste and pbcopy commands, you can manipulate the contents of the Mac OS X clipboard (or more formally known as the pasteboard) right from the command line. As a brief example, just select the text of this first paragraph, copy it to your clipboard (with -c), and then type pbpaste in a Terminal [...]]]></description>
			<content:encoded><![CDATA[<p>Using the <code>pbpaste</code> and <code>pbcopy</code> commands, you can manipulate the contents of the Mac <acronym title="Operating System">OS</acronym> X clipboard (or more formally known as the <em>pasteboard</em>) right from the command line. As a brief example, just select the text of this first paragraph, copy it to your clipboard (with <kbd>-c</kbd>), and then type <code>pbpaste</code> in a Terminal prompt. You should see output similar to the following:</p>
<pre><samp>Perseus:~ meitar$ </samp><kbd>pbpaste</kbd>
<samp>Using the pbpaste and pbcopy commands, you can manipulate the contents of the Mac <acronym title="Operating System">OS</acronym> X clipboard (or more formally known as the pasteboard) right from the command line. As a brief example, just select the text of this first paragraph, copy it to your clipboard (with ?-c), and then type pbpaste in a Terminal prompt. You should see output similar to the following:Perseus:~ meitar$ </samp></pre>
<p>Pretty straightforward, right? The only thing to be aware of is that the  symbol showed up in the output as a ? symbol. This is because the Terminal doesn&#8217;t support Unicode, but that&#8217;s a topic for another time.</p>
<p>Anyway, what&#8217;s happening here is nothing more magical than simply reading the clipboard and pasting it into a command&#8217;s standard output stream. As a result, you can construct pipelines that read  from or add content to the clipboard. Here&#8217;s an example in reverse, which takes a command&#8217;s standard output and replaces the contents of the clipboard with it:</p>
<pre><kbd>echo "Hello world! I came from the command line, but now I'm in the clipboard." | pbcopy</kbd></pre>
<p>This command produces no output, but if we examine the contents of the clipboard (by selecting <strong>Edit &rarr; Show Clipboard</strong> from the Finder&#8217;s menu bar) we can see that the text we echoed has indeed been copied there.</p>
<p><a href='/blog/wp-content/uploads/2008/05/finder-clipboard-contents.png'><img src="http://maymay.net/blog/wp-content/uploads/2008/05/finder-clipboard-contents.png" alt="The clipboard now contains the text we echoed from the command line." title="finder-clipboard-contents" width="386" height="186" class="aligncenter size-full wp-image-434" /></a></p>
<p>Another way we can verify that this worked as expected is to simply <code>pbpaste</code> again:</p>
<pre><samp>Perseus:~ meitar$ </samp><kbd>pbpaste</kbd>
<samp>Hello world! I came from the command line, but now I'm in the clipboard.
Perseus:~ meitar$ </samp></pre>
<p>Anyway, this is cool, but it isn&#8217;t very useful yet. For that, we need to add some more stages to our pipeline. Let&#8217;s take the simple case of trying to count how many words the selected text contains. We&#8217;ll use the clipboard contents shown above to do this:</p>
<pre><samp>Perseus:~ meitar$ </samp><kbd>pbpaste | wc -w</kbd>
<samp>      14</samp></pre>
<p>Using the word count (<code>wc</code>) utility, we can count words (<code>-w</code>) very easily. Indeed, our previous example does have exactly 14 words in it. We can also count characters (<code>-c</code>) or lines (<code>-l</code>) of text in the clipboard this way. This is like adding Microsoft Word&#8217;s &#8220;Word Count&#8221; feature to every single piece of text you can copy!</p>
<p>As another example take, for instance, the simple case of copying and pasting a snippet of email from Mail. Instead of pasting it back into a text file verbatim, let&#8217;s prepend &#8216;&gt; &#8216; to the beginning of each line. This way, when we paste our email&#8217;s snippet, we&#8217;ll know where the snippet begins and where it ends. This is a simple three-stage pipeline that uses <code>pbpaste</code> to take our clipboard and put it into the pipeline and then reads back the result from the pipeline back to the clipboard using <code>pbcopy</code>. In the middle, we use sed to insert the desired text at the start of each line:</p>
<pre><kbd>pbpaste | sed -e 's/^/&gt; /' | pbcopy</kbd></pre>
<p>Now, when you paste your clipboard, you&#8217;ll have a greater-than symbol at the start of each line. Naturally, check out the manual pages for all of these commands for more detailed information. For instance, type <code>man pbpaste</code> for more information about the <code>pbpaste</code> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/05/09/one-minute-mac-tip-use-the-command-line-to-edit-the-content-of-your-clipboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Minute Mac Tip: Use Mac OS X&#8217;s Keychain to Store, Recover, and Sync All Your Passwords From One Place</title>
		<link>http://maymay.net/blog/2008/05/06/one-minute-mac-tip-use-mac-os-xs-keychain-to-store-recover-and-sync-all-your-passwords-from-one-place/</link>
		<comments>http://maymay.net/blog/2008/05/06/one-minute-mac-tip-use-mac-os-xs-keychain-to-store-recover-and-sync-all-your-passwords-from-one-place/#comments</comments>
		<pubDate>Tue, 06 May 2008 09:08:34 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Security & Privacy]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=429</guid>
		<description><![CDATA[Since Mac OS X 10.2 Jaguar, Mac users have been accustomed to the ease of use of Apple&#8217;s very cool Keychain Services technology. The Mac OS X Keychain basically a secure database of all your passwords, sorted into files called (unsurprisingly enough) &#8220;keychains.&#8221; Each user account on a Mac OS X system has a login.keychain, [...]]]></description>
			<content:encoded><![CDATA[<p>Since Mac <acronym title="Operating System">OS</acronym> X 10.2 Jaguar, Mac users have been accustomed to the ease of use of Apple&#8217;s very cool Keychain Services technology. The Mac <acronym title="Operating System">OS</acronym> X Keychain basically a secure database of all your passwords, sorted into files called (unsurprisingly enough) &#8220;keychains.&#8221; Each user account on a Mac <acronym title="Operating System">OS</acronym> X system has a <code>login.keychain</code>, and the system itself also has a <code>system.keychain</code>.</p>
<p>Whenever you tell an application to &#8220;Remember this password in my keychain,&#8221; what you&#8217;re doing is writing a new encrypted entry into your user account&#8217;s <code>~/Library/Keychains/login.keychain</code> file. Then, the next time the application needs to access a restricted resource, it just asks Mac <acronym title="Operating System">OS</acronym> X to get the password for it. Of course, all of this happens automatically, so except for that single checkbox most users probably don&#8217;t know that the keychain even exists.</p>
<p>What&#8217;s even more awesome than all of this automagic password storing action, though, is the fact that Apple has also provided an easy-to-use application to manipulate the keychain yourself. What good does this do us? Plenty! Observe.</p>
<p>Say you&#8217;ve just signed up with a new <acronym title="Internet Service Provider">ISP</acronym>. They send you a username and a password to log on to their ADSL network with. Of course, they send this password to you on paper—how insecure! Instead, after changing the password to something else first (something <em>other</em> than <kbd>mypassword</kbd>, which is the example password I&#8217;ll use here), we can use Mac <acronym title="Operating System">OS</acronym> X Keychain to securely store the password and retrieve it later.</p>
<ol>
<li>First, launch the Keychain Access application located in the <code>/Applications/Utilities</code> folder of your startup drive.</li>
<li>Next, click the &#8220;Create a new Keychain item&#8221; button (the +) button near the lower left-hand corner of the window. The Add Keychain Item sheet appears.</li>
<li>Enter a meaningful name, such as &#8220;ADSL <acronym title="Internet Service Provider">ISP</acronym> Account&#8221; in my example, in the Keychain Item Name field.</li>
<li>Enter the username or account name associated with this password in the Account Name field.</li>
<li>Enter the password into the Password field.</li>
<li>Click the Add button.</li>
</ol>
<p>That&#8217;s all there is to it. To later retrieve your password if, say, you ever forget it:</p>
<ol>
<li>Launch the Keychain Access application.</li>
<li>Locate and double-click the keychain item that stores the account and password information you want to retrieve.</li>
<li>Tick the &#8220;Show password&#8221; checkbox. You&#8217;ll be presented with a dialogue box that asks for your keychain&#8217;s master password. Unless you&#8217;ve already set it to something else, this is the same password you use to log in to your Mac <acronym title="Operating System">OS</acronym> X user account.<a href='/blog/wp-content/uploads/2008/05/mac-os-x-105-leopard-keychain-access-password-dialogue-box.png'><img src="/blog/wp-content/uploads/2008/05/mac-os-x-105-leopard-keychain-access-password-dialogue-box.png" alt="Screenshot of Mac OS X 10.5 Leopard\&#039;s Keychain Access application requesting password access to the user\&#039;s login.keychain file." title="mac-os-x-105-leopard-keychain-access-password-dialogue-box" width="500" height="321" class="alignnone size-full wp-image-430" /></a></li>
<li>Enter your keychain password and click &#8220;Allow.&#8221; If you click &#8220;Always Allow&#8221; instead, Keychain Access will not prompt you for your login keychain&#8217;s password the next time you ask to see this particular password. I <em>never</em> press that button.</li>
<li>Your password&#8217;s plaintext is now visible.<a href='/blog/wp-content/uploads/2008/05/keychain-access-showing-plaintext-password.png'><img src="/blog/wp-content/uploads/2008/05/keychain-access-showing-plaintext-password.png" alt="" title="keychain-access-showing-plaintext-password" width="211" height="23" class="alignnone size-medium wp-image-431" /></a></li>
</ol>
<p>This effectively obviates the need for third-party applications such as <a href="//fpx.de/fp/Software/Gorilla/">Password Gorilla</a>, <a href="//www.selznick.com/products/passwordwallet/index.htm">PasswordWallet</a> or <a href="//www.keepassx.org/">KeePassX</a> which are great programs, but all suffer from a lack of a good user interface. Furthermore, there&#8217;s no reason why we can&#8217;t store short arbitrary strings of sensitive information in the keychain temporarily. Sure, it might clutter up your keychain, but you can always search the entries using the standard Mac <acronym title="Operating System">OS</acronym> X filter search bar at the top right of the window.</p>
<p><ins datetime="2008-05-24T13:38:46+00:00">In fact, Apple&#8217;s been kind enough to offer an interface to do just that in an even more effective way, called Secure Notes. These are simply plain text strings of arbitrary length that can be stored securely inside your keychain, and that use the same interface to access (requiring your password to view). The only real difference is that instead of a single line, you&#8217;re given a fully scrollable text area in which to type your secure note.</ins></p>
<p>Moreover, because keychains can be synced to multiple Macs with .Mac Sync (or a third-party synchronization solution), you can always have access to all your passwords regardless of which physical Mac you&#8217;re using. Best of all, since you never have to remember another password ever again, you can quit using the same password for multiple accounts, and you can always use <a href="//grc.com/passwords" title="Get a really secure password from Gibson Research Corporation's popular Perfect Passwords page.">really hard-to-crack passwords</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/05/06/one-minute-mac-tip-use-mac-os-xs-keychain-to-store-recover-and-sync-all-your-passwords-from-one-place/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How To: Move all pages in an Apple WikiServer Group to a new Group</title>
		<link>http://maymay.net/blog/2008/05/01/how-to-move-all-pages-in-an-apple-wikiserver-group-to-a-new-group/</link>
		<comments>http://maymay.net/blog/2008/05/01/how-to-move-all-pages-in-an-apple-wikiserver-group-to-a-new-group/#comments</comments>
		<pubDate>Thu, 01 May 2008 09:18:16 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Unix/Linux]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=427</guid>
		<description><![CDATA[As I&#8217;ve been blogging about, I&#8217;ve been playing a lot with Apple&#8217;s new WikiServer (or &#8220;Teams Server&#8221;) at work. We&#8217;re still evaluating what we&#8217;d like to use it for, but as part of the experiments, I&#8217;ve been finding myself having to do some pretty crazy things with the WikiServer. This one is pretty bizarre, and [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ve been blogging about, I&#8217;ve been <a href="/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/">playing a lot</a> with Apple&#8217;s new WikiServer (or &#8220;Teams Server&#8221;) at work. We&#8217;re still evaluating what we&#8217;d like to use it for, but as part of the experiments, I&#8217;ve been finding myself having to do some pretty crazy things with the WikiServer. This one is pretty bizarre, and is probably not only very dangerous for the content of your group&#8217;s wiki and blog, but also almost certainly not a best-practice.</p>
<p>With that caveat out of the way, here&#8217;s how I managed to move all the pages in an Apple WikiServer group wiki and blog from one group to another.</p>
<h2>Dear God, please have a backup!</h2>
<p>Okay, step 1 is mundane, but seriously, please of please have a backup of your data before you do any of these things. To make a back up of your entire WikiServer&#8217;s data store, simply:</p>
<pre><kbd>sudo tar -cvzf <var>backup-file-name</var>.tgz /Library/Collaboration</kbd></pre>
<p>If anything goes wrong, you can restore from your backup just as simply:</p>
<pre><kbd>sudo tar -C /Library/Collaboration -xvzf <var>backup-file-name</var>.tgz</kbd></pre>
<p>Okay, with that out of the way, next make sure absolutely nobody is using any of the Group services for the group you are going to perform the move from, or to. People can work on other group&#8217;s wikis, it&#8217;s just the ones you&#8217;ll be touching you want people to avoid. You can enforce this with some Apache redirects, which is left as an exercise to the reader.</p>
<h2>Step 1: Rename or create a new Group in Workgroup Manager</h2>
<p>First, you need to either rename or create a new group in Workgroup Manager. If you make a new group, be sure to enable all the services that the old group used.</p>
<p>If you&#8217;re simply renaming a group, then you might not even have to go through this trouble. You merely need to change the group&#8217;s &#8220;Name&#8221; (as opposed to its &#8220;Short Name&#8221;) and then stop and start the Web Service from Server Admin to see the group&#8217;s name change. However, if you also want to change the group&#8217;s &#8220;Short Name&#8221; (i.e., the group&#8217;s POSIX group account symbolic name), then you will need to perform these steps.</p>
<p>Once you have the new group ready to go in Workgroup Manager and you have stopped and started your Web Service in Server Admin, continue to the next step.</p>
<h2>Step 2: rsync all your files from the old group to the new group</h2>
<p>This is simple. Just run:</p>
<pre><kbd>sudo rsync -avzE --progress /Library/Collaboration/Groups/<var>old-group</var>/ /Library/Collaboration/Groups/<var>new-group</var>/</kbd></pre>
<p>Note that the trailing slashes on the directory names in this command are quite important, as they tell <code>rsync</code> to take the <em>contents</em> of the first directory and place those items as the contents of the second directory. Without the trailing slashes, <code>rsync</code> will make extraneous directories for you, which Apple WikiServer won&#8217;t understand. See <code>man rsync</code> for more information.</p>
<h2>Step 3: Update the <code>plist</code>s for all your WikiServer pages in the new group</h2>
<p>Now, WikiServer has all the content of your old group but all of the internal references are wrong, since they still point to the old group. What you need to do is rewrite all those references so that they point to the new group address. The group references are stored in property list files. See my older blog entries for <a href="/blog/2008/04/08/a-web-developer’s-introduction-to-the-apple-wikiserver-part-2/">details about the filesystem structure of Apple&#8217;s WikiServer</a> data storage layout.</p>
<p>To do this is a relatively simple procedure. As root, do the following, and do it <em>carefully</em> because as root you can easily mess up (and there is no undo button on the command line!):</p>
<pre><kbd>sudo su -</kbd>
<kbd>cd /Library/Collaboration/Groups/<var>new-group</var></kbd>
<kbd>grep -ri "<var>old-group</var>" * | grep '^[^B]' | cut -d ':' -f 1 | grep 'plist$' | sort | uniq &gt; /tmp/<var>list_of_plist_files_to_edit</var></kbd>
<kbd>for i in `cat /tmp/<var>list_of_plist_files_to_edit</var>`; do sed -e 's/&lt;string&gt;groups\/<var>old-group</var>/&lt;string&gt;groups\/<var>new-group</var>/' $i &gt; $i.new; mv "$i.new" "$i"; chown teamsserver:teamsserver "$i"; chmod o-rwx "$i" done;</kbd></pre>
<p>In English, this means:</p>
<ol>
<li>Become root.</li>
<li>Change to the <code>/Library/Collaboration/Groups/<var>new-group</var></code> directory</li>
<li>Find all <code>plist</code> files that have the the string <var>old-group</var> in them, sort them, and write this list of files to the <code>/tmp/<var>list_of_plist_files_to_edit</var></code> file.</li>
<li>For each of the files listed in the <code>/tmp/<var>list_of_plist_files_to_edit</var></code>, find the text string <code>&lt;string&gt;groups/<var>old-group</var></code> and replace that text with <code>&lt;string&gt;groups/<var>new-group</var></code>, and save this change as the name of the file with <code>.new</code> appended. Finally, replace the original file with the file we modified, and give them the appropriate permissions.</li>
</ol>
<h2>Step 4: Create an Apache redirect to make sure no <acronym title="HyperText Markup Language">HTML</acronym> links are broken</h2>
<p>Okay, at this point your new group is up and running and it should be working. However, if you had any links at all in any of your group&#8217;s pages, they are now all broken because they still point to the old group. Rather than going through the <acronym title="HyperText Markup Language">HTML</acronym> itself and cleaning this up right now (because that&#8217;s very error-prone indeed, even with automated tools), it&#8217;s much easier to just tell Apache to redirect all requests for the old group to the new group.</p>
<p>To do this, edit the Apache configuration file of whatever Virtual Host you have been serving the WikiServer from. Most of the time, this will be at <code>/etc/httpd/sites/0000_any_80_.conf</code>.</p>
<p>The end of that file probably looks something like this::</p>
<pre>#       Include /etc/httpd/httpd_users.conf
#       Include /etc/httpd/httpd_directory.conf
        Include /etc/httpd/httpd_groups.conf
        Include /etc/httpd/httpd_teams_required.conf
        LogLevel warn
        ServerAlias *
&lt;/VirtualHost&gt;</pre>
<p>Right above these <code>Include</code> directives, simply add the following:</p>
<pre><kbd>        &lt;Location /groups&gt;
            &lt;IfModule mod_alias.c&gt;
                Redirect 301 /groups/<var>old-group</var> http://<var>your.server.address</var>/groups/<var>new-group</var>
            &lt;/IfModule&gt;
        &lt;/Location&gt;</kbd>
#       Include /etc/httpd/httpd_users.conf
#       Include /etc/httpd/httpd_directory.conf
        Include /etc/httpd/httpd_groups.conf
        Include /etc/httpd/httpd_teams_required.conf
        LogLevel warn
        ServerAlias *
&lt;/VirtualHost&gt;
</pre>
<p>There you have it. New Teams Server group, old group&#8217;s data.</p>
<h2>Caveats</h2>
<p>Note that this does <em>not</em> update any of the SQLite databases used to store things like revision history and so forth. These things are, for the most part, not really necessary to update but it would be ideal if the old <code>plist</code> revisions could be changed in there, too. That&#8217;s not so much more extra work, really, but I&#8217;ve found it typically unnecessary except in fringe cases, so I leave that as an exercise to the reader.</p>
<p>If you do this to your WikiServer and do not update the SQLite databases as well, just be mindful of that fact so that you&#8217;re not surprised if something goes wonky down the line.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/05/01/how-to-move-all-pages-in-an-apple-wikiserver-group-to-a-new-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to import CVS code repositories into Git using `git cvsimport`</title>
		<link>http://maymay.net/blog/2008/04/15/how-to-import-cvs-code-repositories-into-git-using-git-cvsimport/</link>
		<comments>http://maymay.net/blog/2008/04/15/how-to-import-cvs-code-repositories-into-git-using-git-cvsimport/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 09:06:24 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=425</guid>
		<description><![CDATA[This should be straightforward, but it&#8217;s not. To import (not track, but just import) code from a remote CVS repository to a local git repository, you need to do the following: Be certain you have the git-core package installed on your system and that this package includes the git-cvsimport command. You can run git help [...]]]></description>
			<content:encoded><![CDATA[<p>This should be straightforward, but it&#8217;s not. To import (not <em>track</em>, but just import) code from a remote <acronym title="Concurrent Versions System">CVS</acronym> repository to a local git repository, you need to do the following:</p>
<ol>
<li>Be certain you have the git-core package installed on your system and that this package includes the <code>git-cvsimport</code> command. You can run <code>git help -a | grep cvsimport</code> to verify this.</li>
<li>Be certain you have the <code>cvsps</code> command-line tool installed. This does <em>not</em> come with the git suite of tools, so you&#8217;ll need to get it separately. If you&#8217;re a lazy Mac <acronym title="Operating System">OS</acronym> X user, like me, you can use MacPorts: <code>sudo port install cvsps</code>. Otherwise, get it from <a href="//www.cobite.com/cvsps/">the source</a>.</li>
<li>Prepare your <acronym title="Concurrent Versions System">CVS</acronym> login information for the remote server <em>before</em> you run <code>git cvsimport</code>. You need to do this so that the git tool will be able to log you in to the <acronym title="Concurrent Versions System">CVS</acronym> server automatically. The command for this looks like:
<pre>CVSROOT=:<var>cvs-login-method</var>:<var>cvs-user-name</var>@<var>cvs.server.name</var>:<var>/path/to/CVS/root</var> cvs login</pre>
<p> For example, if you&#8217;re pulling code from the anonymous <acronym title="Concurrent Versions System">CVS</acronym> server that runs on Drupal.org, you might use this: <code>CVSROOT=:pserver:anonymous@cvs.drupal.org:/cvs/drupal-contrib cvs login</code>. This command will prompt you for the password for the user you specified at the server you specified (for anonymous access, the password is almost always <code>anonymous</code>) and will hash this in the <code>~/.cvspass</code> file for future use by <acronym title="Concurrent Versions System">CVS</acronym></li>
<li>Finally, run the <code>git cvsimport</code> tool, and specify the proper options. Using the Drupal example above, your command might look like this:
<pre>git cvsimport -v -d :pserver:anonymous@cvs.drupal.org:/cvs/drupal-contrib contributions/modules/<var>module-name</var></pre>
<p> This would login to <code>cvs.drupal.org</code> using the <acronym title="Concurrent Versions System">CVS</acronym>&#8216;s <code>pserver</code> login method, provide the username <code>anonymous</code> and the password you specified in the previous step that is hashed in <code>~/.cvspass</code>, set the <acronym title="Concurrent Versions System">CVS</acronym> document root to <code>/cvs/drupal-contrib</code>, and pull the code located at <code>contributions/modules/<var>module-name</var></code> into the current working directory as a git repository.</li>
</ol>
<p>This works pretty nicely, and creates a git repository just as though you&#8217;d created it with <code>git init</code> in the current working directory.</p>
<p>If you get an error that looks like this:</p>
<pre>AuthReply: cvs [pserver aborted]: descramble: unknown scrambling method</pre>
<p>then you&#8217;ve most likely specified the <acronym title="Concurrent Versions System">CVS</acronym> document root incorrectly. Most notably, <code>git cvsimport</code> does not understand a <acronym title="Concurrent Versions System">CVS</acronym> document root wherein the password is specified in the document root <acronym title="Uniform Resource Locator">URL</acronym> itself. So, for example, <code>git cvsimport -d :pserver:<var>password</var>:<var>username</var>@<var>cvs.server.name</var>:<var>/path/to/CVS/root</var> <var>code/to/checkout</var></code> will not work. Omitting the password and the separating colon from the <acronym title="Uniform Resource Locator">URL</acronym> should fix it.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/04/15/how-to-import-cvs-code-repositories-into-git-using-git-cvsimport/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>A web developer’s introduction to the Apple WikiServer (part 2)</title>
		<link>http://maymay.net/blog/2008/04/08/a-web-developer%e2%80%99s-introduction-to-the-apple-wikiserver-part-2/</link>
		<comments>http://maymay.net/blog/2008/04/08/a-web-developer%e2%80%99s-introduction-to-the-apple-wikiserver-part-2/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 09:12:18 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Apple/Macintosh]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=423</guid>
		<description><![CDATA[Last time, we checked out the Apple WikiServer from the user&#8217;s side of things. We learned about the code it generates, how it handles page name changes, and what the key filesystem locations the Apple WikiServer looks at are. This time, let&#8217;s delve a little deeper into the WikiServer&#8217;s internals by (safely) messing around with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://maymay.net/blog/2008/04/07/a-web-developers-introduction-to-the-apple-wikiserver-part-1/">Last time</a>, we checked out the Apple WikiServer from the user&#8217;s side of things. We learned about the code it generates, how it handles page name changes, and what the key filesystem locations the Apple WikiServer looks at are. This time, let&#8217;s delve a little deeper into the WikiServer&#8217;s internals by (safely) messing around with a running instance and seeing how we can effect changes that aren&#8217;t available in the <acronym title="Graphical User Interface">GUI</acronym>.</p>
<h2>I’m going in!</h2>
<p>Apple&#8217;s WikiServer keeps each group&#8217;s data segregated. There&#8217;s currently no way in the <acronym title="Graphical User Interface">GUI</acronym> to search across multiple wikis from a single wiki, or move one wiki page in one wiki to another wiki. Luckily, because the Apple WikiServer is a rather lightweight application, it&#8217;s not that hard to move things around. Doing so doesn&#8217;t seem to cause any problems with the application, either—a testament to its apparent simplicity.</p>
<p>Most simply, say you have created a number of different wikis for different groups, and in so doing you&#8217;ve created segregated spaces for different parts of your organization. Now say you&#8217;ve got a wiki page in one wiki that you&#8217;d rather place in a different one, or that you&#8217;d like to copy. Sure, you can edit the first wiki&#8217;s page, copy the <acronym title="what you see is what you get">WYSIWYG</acronym> editor&#8217;s text, and paste it into a new page on the second wiki. But where&#8217;s the fun in that?</p>
<p>Instead, let&#8217;s move some files around to get a sense for how the Apple WikiServer stores its data.</p>
<p>First, recall that the Apple WikiServer stores its content inside the <code>/Library/Collaboration</code> directory on the computer hosting the wiki web site. Inside of this directory you&#8217;ll find four items:</p>
<pre>$ <kbd>cd /Library/Collaboration/</kbd>
$ <kbd>ls -la</kbd>
<samp>total 8
drwxrwxr-x   6 _teamsserver  _teamsserver   204 Mar  2 13:50 .
drwxrwxr-t@ 60 root          admin         2040 Mar  3 19:16 ..
drwxr-xr-x   2 _teamsserver  _teamsserver    68 Mar  2 13:50 ArchivedGroups
drwxr-xr-x   6 _teamsserver  _teamsserver   204 Apr  4 18:48 Groups
drwxr-xr-x   2 _teamsserver  _teamsserver    68 Mar  2 13:50 Users
-rw-r--r--   1 _teamsserver  _teamsserver   249 Mar  2 13:50 dataVersion.plist</samp></pre>
<p>First, note that all of these files are owned solely by the <code>_teamserver</code> user, and only that user can access these files in any way. This keeps people like you and me from accidentally tampering with the Apple WikiServer data store. However, for the purposes of this exercise, we&#8217;re going to tamper anyway. To do so, you&#8217;ll need root permissions, which comes with a big caveat: <strong>be careful whenever you are root—one typo could erase your hard drive (and there is no undo)!</strong></p>
<p>Become root by saying:</p>
<pre>sudo su -</pre>
<p>and supplying your password. Once you are root, you can explore further into the depths of the Apple WikiServer.</p>
<h2>Inside the Apple WikiServer data store for wiki pages</h2>
<p>The Apple WikiServer, which runs under the username <code>_teamserver</code>, is really just a bunch of organized flat files, supplemented with a number of SQLite databases (also flat files, really), and glued together with a bunch of <a href="http://python.org/">Python</a> scripts running under the <a href="http://twistedmatrix.com/trac/">Twisted networking framework</a>. We&#8217;re not going to cover Python or Twisted in this post, so for further information check out their respective homepages. There&#8217;s also <a href="http://www.onlamp.com/pub/a/python/2004/01/15/twisted_intro.html">a great introduction to Twisted at ONLAMP.com</a>.</p>
<p>To make the wiki go, the WikiServer runs these scripts to read and write data to these flat files. Let&#8217;s dig into this data store. Since the wikis are each associated with an existing group, all of the wiki files are inside the <code>Groups</code> subdirectory. In this directory, you&#8217;ll find one directory for each group that has a wiki. Each group directory, in turn, contains 6 other directories, 2 regular files, and 1 SQLite database:</p>
<pre># <kbd>pwd</kbd>
<samp>/Library/Collaboration/Groups/chiefs</samp>
# <kbd>ls -p</kbd>
<samp>discussion/	index.db	metadata.plist	resources/	wiki/
extrainfo	mailinglist/	public/		weblog/</samp></pre>
<p>The two regular files are <code>metadata.plist</code> and <code>extrainfo</code>. The <code>metadata.plist</code> file maintains the preferences of the individual wiki web site that you set from the &#8220;Group Settings&#8221; page on the wiki web site itself. That is, these settings are all editable via the web directly at <code>http://<var>your-server.local</var>/groups/<var>your-group-name</var>/settings/</code>. That page is also accessible to an admin user from the wiki home page under the &#8220;Admin functions&#8221; header in the sidebar of the web page (the key names in the plist file are pretty self-explanatory and map easily to the <acronym title="Graphical User Interface">GUI</acronym> options).</p>
<p>At the moment, the <code>extrainfo</code> file is a bit of mystery. It stores single lines of plain ASCII text in the form:</p>
<pre>groups/<var>your-group-name</var>/<var>web-service</var>/<var>page-id</var></pre>
<p>where <var>your-group-name</var> is the name of the associated group for the file, <var>web-service</var> is one of <code>wiki</code>, <code>weblog</code>, and I assume can also be <code>mailinglist</code> or <code>discussion</code>, although I&#8217;ve only seen the first two on my server in practice.</p>
<p>What we&#8217;re most interested in for the purposes of wiki pages is, unsurprisingly, the <code>wiki</code> directory. This directory stores as many subdirectories as there are pages on your wiki. Every time you create a new page, a new directory is added here. If you delete that page, however, this directory is <em>not</em> deleted outright.</p>
<p>Each directory is named with the unique page identifier that the Apple WikiServer automatically generates followed by a <code>.page</code> extension. The exception is the <code>welcome.page</code> directory, special in that it contains the content of the wiki&#8217;s main (front) page. The <a href="http://images.apple.com/server/macosx/docs/Web_Technologies_Admin_v10.5.pdf">Mac <acronym title="Operating System">OS</acronym> X Server Web Technologies Administration for Version 10.5 Leopard manual</a> explains the contents of this directory as follows:</p>
<blockquote>
<ul>
<li>/Library/Collaboration/Groups/groupname/wiki/pagename.page/ contains the component files of a wiki page.</li>
<li>/Library/Collaboration/Groups/groupname/wiki/pagename.page/page.html contains the main text of the wiki (html content).</li>
<li>/Library/Collaboration/Groups/groupname/wiki/pagename.page/page.plist contains the metadata for the wiki page.</li>
<li>/Library/Collaboration/Groups/groupname/wiki/pagename.page/revisions.db contains the version history database for that wiki page.</li>
<li>/Library/Collaboration/Groups/groupname/pagename.page/images/ contains the images for that wiki page.</li>
<li>/Library/Collaboration/Groups/groupname/pagename.page/attachments/ contains all attachments for that wiki page.</li>
</ul>
</blockquote>
<p>Here are some additional details:</p>
<ul>
<li>The &#8220;page.html&#8221; file contains all of the (X)<acronym title="HyperText Markup Language">HTML</acronym> that appears inside the <acronym title="what you see is what you get">WYSIWYG</acronym> editor field when you click the &#8220;Switch to <acronym title="HyperText Markup Language">HTML</acronym> View&#8221; button (the arrow brackets). Nothing more, and nothing less.</li>
<li>The &#8220;page.plist&#8221; file maintains the metadata that associates a single wiki page to its group as far as the Apple WikiServer is concerned. If you take a closer look at it, you&#8217;ll find property list keys such as <code>commentUID</code> and <code>uid</code> whose values are both strings—URLs, in fact—that the Apple WikiServer uses to, for example, call the appropriate wiki theme to render around the page content. This file also stores self-explanatory data such as <code>author</code>, <code>createdDate</code>, page <code>kind</code>, a last <code>modifiedDate</code> and <code>lastModifiedAuthor</code> and, of course, the page <code>title</code>. The most interesting key in this file is the <code>versioned</code> key, which is a boolean that can turn versioning on or off. By default, wiki pages have this key set to true and (for example) weblog pages have this set to false. However, you can manually turn off versioning for a specific wiki page by changing this key yourself. It won&#8217;t delete past revisions, it will just stop new revisions from being saved. This is especially cool, because it means you can version-control weblog pages simply by editing the page&#8217;s associated plist file.</li>
<li>The <code>revisions.db</code> is the SQLite database in which all revisions are stored. The database contains a single table, <code>revisions</code>, that looks like this:
<pre>CREATE TABLE revisions(revision INTEGER PRIMARY KEY AUTOINCREMENT, editType, comment, lastModifiedBy, content, time DEFAULT CURRENT_TIMESTAMP);</pre>
<p>The interesting bit is the <code>content</code> field, which itself is just a string—but a string <em>stored as an Apple property list, in full</em>. Some keys in the property list inside the SQLite database are the same as those inside the <code>page.plist</code> file for the page, but with some differences. For instance, there is no <code>versioned</code> key in the plist in the database (for obvious reasons), and there is a <code>tags</code> key (which is missing from the filesystem equivalent). Most importantly, there is a <code>content</code> key, which stores the content of the <code>page.html</code> file.</li>
<li>The <code>revisions.db</code> file is created automatically only if the <code>versioned</code> key in the page&#8217;s <code>page.plist</code> file is set to true.</li>
</ul>
<h3>Finally: move a wiki page from one wiki to another</h3>
<p>Now that we understand some of the internals of the Apple WikiServer data store, let&#8217;s mess with it just a little by moving that one test wiki page from one wiki into another. Since almost everything is flat files, it&#8217;s remarkably easy to do:</p>
<pre># <kbd>mv /Library/Collaboration/Groups/<var>your-group-name</var>/wiki/<var>page-id</var>.page /Library/Collaboration/Groups/<var>new-group-name</var>/</kbd></pre>
<p><strong>Be certain that there isn&#8217;t already an existing page in the <var>new-group-name</var> wiki with the same <var>page-id</var> as the one you&#8217;re moving. So far, Apple WikiServer <em>appears</em> to generate unique page IDs across the entire system (as opposed to just per-group), but I haven&#8217;t verified this yet.</strong></p>
<p>With the wiki page files physically moved into the new wiki, you can now access the page at the new wiki <acronym title="Uniform Resource Locator">URL</acronym>. Trying to access it in the old <acronym title="Uniform Resource Locator">URL</acronym> will result in an <acronym title="HyperText Transfer Protocol">HTTP</acronym> 404 &#8220;Not Found&#8221; error. However, the page at the new wiki <acronym title="Uniform Resource Locator">URL</acronym> has the same theme as the other, old wiki. To correct this, you need to edit the <code>page.plist</code> file in two places: the <code>uid</code> string value and the <code>commentUID</code> string value relative URLs need their <var>your-group-name</var> changed to the <var>new-group-name</var>, whatever it is.</p>
<p>After you save this this change, simply reload the wiki page in your browser. Voila. Page moved.</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/04/08/a-web-developer%e2%80%99s-introduction-to-the-apple-wikiserver-part-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>One minute Mac tip: Restore Bonjour&#8217;s &#8220;.local&#8221; addresses</title>
		<link>http://maymay.net/blog/2008/04/05/one-minute-mac-tip-restore-bonjours-local-addresses/</link>
		<comments>http://maymay.net/blog/2008/04/05/one-minute-mac-tip-restore-bonjours-local-addresses/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 10:17:04 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tech/Computing]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=421</guid>
		<description><![CDATA[Lately, there have been a string of networking problems with Mac OS X 10.5 Leopard reported by sites such as MacFixIt. One of most common symptoms is the loss of Bonjour&#8217;s &#8220;.local&#8221; addresses. So, for instance, if you have a machine named &#8220;Perseus&#8221; then you could address that machine by the hostname &#8220;Perseus.local&#8221; instead of [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, there have been a string of networking problems with Mac <acronym title="Operating System">OS</acronym> X 10.5 Leopard reported by sites such as <a href="http://macfixit.com/">MacFixIt</a>. One of most common symptoms is the loss of Bonjour&#8217;s &#8220;.local&#8221; addresses. So, for instance, if you have a machine named &#8220;Perseus&#8221; then you could address that machine by the hostname &#8220;Perseus.local&#8221; instead of its <acronym title="Internet Protocol">IP</acronym> address.</p>
<p>However, if you find that the .local host name no longer works but the <acronym title="Internet Protocol">IP</acronym> address still does, the problem may be in a corrupt or outdated local <acronym title="Domain Name System or Domain Name Server">DNS</acronym> cache. Luckily, the solution is incredibly simple. Just run:</p>
<pre>dscacheutil -flushcache</pre>
<p>at a Terminal prompt, and try again. If you&#8217;re still running Mac <acronym title="Operating System">OS</acronym> X 10.4 Tiger and you experience this problem, the solution is just as simple. Instead of the above line, simply run:</p>
<pre>lookupd -flushcache</pre>
<p>at a Terminal prompt.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/04/05/one-minute-mac-tip-restore-bonjours-local-addresses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A web developer&#8217;s introduction to the Apple WikiServer (part 1)</title>
		<link>http://maymay.net/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/</link>
		<comments>http://maymay.net/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 10:10:29 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Apple/Macintosh]]></category>
		<category><![CDATA[Business & E-Commerce]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/?p=422</guid>
		<description><![CDATA[I absolutely love wikis, so when Apple introduced Mac OS X Server 10.5 &#8220;Leopard,&#8221; one of the new features I was really excited about was &#8220;WikiServer&#8221; (what the Apple marketing department calls &#8220;Teams&#8221;). I&#8217;m calling this specifically the Apple WikiServer in order to avoid confusion with the pre-existing wiki plus web server package called WikiServer. Apple [...]]]></description>
			<content:encoded><![CDATA[<p>I absolutely love wikis, so when Apple introduced Mac <acronym title="Operating System">OS</acronym> X Server 10.5 &#8220;Leopard,&#8221; one of the new features I was really excited about was &#8220;WikiServer&#8221; (what the Apple marketing department calls &#8220;Teams&#8221;). I&#8217;m calling this specifically the <em>Apple</em> WikiServer in order to avoid confusion with the <a href="http://wikiserver.org/">pre-existing wiki plus web server package called WikiServer</a>.</p>
<h2>Apple WikiServer: Mac <acronym title="Operating System">OS</acronym> X Server&#8217;s built-in Intranet builder</h2>
<p>At work, I&#8217;m finally getting the opportunity to try the Apple WikiServer out. Its strongest asset, by far, is the integration it has with Apple&#8217;s Mac <acronym title="Operating System">OS</acronym> X permission scheme. Apple WikiServer makes heavy use of the <acronym title="Operating System">OS</acronym>&#8216;s built-in user accounts to define users and groups, and the permissions those users and groups have to edit, view, and comment on pages in the wiki you create with it. And, because Leopard Server has full support for Access Control Lists, those permissions schemes can be as complex as you like.</p>
<p>This is very important because many large (and small) organizations have sensitive material that they&#8217;d like to keep private, or restricted to certain groups. Historically, wikis are a free-for-all. Anyone and everyone who has access to any part of the wiki can change any other part of the wiki. Recent wiki implementations such as later version of MediaWiki and some other wiki software have implemented permissions systems to allow administrative users to control access rights, but these are often complicated or require code-level configurations.</p>
<p>With Apple&#8217;s WikiServer, all of these permissions can be managed via the Workgroup Manager application, and because you can take advantage of the built-in ACL support, you can model your organizations permissions scheme directly in the Server <acronym title="Operating System">OS</acronym> permissions structure, giving you a much easier way to control information access. Take note, however, that like almost all other things that have to do with your Apache configurations, your Server&#8217;s Web Service will likely need to be stopped and started again for any changes you make to a wiki&#8217;s permissions take effect.</p>
<p>The Workgroup Manager application is also where you go to create new wikis for groups. To enable a wiki, you need to already have created a group and assigned users to that group. For instance, I created a Developer Wiki where all of the in-house developers can share tech tips, so I created a group called &#8220;Developers&#8221; and assigned individual developers, as well as the company executives (by way of the &#8220;Executives&#8221; group) to that group. The group-within-a-group technique is key, because if the company executives change, the members of the Developers group does not need to change, too.  In all of Apple&#8217;s publications, Apple refers to the wikis hosted by WikiServer as an &#8220;intranet website.&#8221;</p>
<p>It&#8217;s clear that Apple intended this product for use within small companies, and not necessarily out on the open Internet. What follows are just a few notes I&#8217;ve compiled about how the Apple WikiServer works.</p>
<h2>Front-end Code Generation from the Apple WikiServer <acronym title="what you see is what you get">WYSIWYG</acronym> Editor</h2>
<p>The Apple wikis are very nice to use. Their functionality is relatively straightforward to find and activate. However, the <acronym title="HyperText Markup Language">HTML</acronym> code that the Apple wikis generate can be a little confusing.  By default, new page text is entered into a semantically meaningless &lt;div&gt; element. This can be changed by highlighting text and then selecting &#8220;Paragraph&#8221; from the formatting toolbar. Subsequent paragraphs that are typed seem to then use &lt;p&gt; elements. However, some paragraphs revert back to &lt;div&gt;s when I used it, and I&#8217;m still not sure why or when this occurred.</p>
<p>On the plus side, so far, all the browsers I&#8217;ve used with the Apple WikiServer function the same way. This include Firefox 2, Safari 3.1, and Internet Explorer 6 and 7.</p>
<p>Typing actual code and having it marked up as such can&#8217;t be done in the <acronym title="Graphical User Interface">GUI</acronym> formatting toolbar to select a &lt;code&gt; element. The &#8220;Monospace&#8221; item in the text formatting toolbar creates &lt;pre&gt; elements and &lt;pre&gt; elements only. However, Apple does provide a &#8220;Switch to <acronym title="HyperText Markup Language">HTML</acronym> view&#8221; button (the arrow brackets button) and one can enter standard <acronym title="HyperText Markup Language">HTML</acronym>, including &lt;code&gt;…&lt;/code&gt; elements in that view, and then switch back. This behaves perfectly on all browsers except Internet Explorer, in which your text area field shows no line breaks whatsoever.</p>
<p>Apple&#8217;s <acronym title="what you see is what you get">WYSIWYG</acronym> editor handles escaping special characters when those special characters have <acronym title="HyperText Markup Language">HTML</acronym> entity reference equivalents, such as double quotes (&#8220;), arrow brackets (&lt; and &gt;), and ampersands (&amp;). It does not seem to handle Unicode characters, such as the ellipses in the prior paragraph. However, such Unicode characters need not be escaped as long as the document&#8217;s character set is UTF-8 (or UTF-16), which the Apple WikiServer specifies and supports out of the box.</p>
<p>Pressing the <em>Return</em> key twice causes the Apple wiki to generate an empty &lt;div&gt; or &lt;p&gt; element with an explicit break (&lt;br /&gt;) inside of it. One can deduce that this is a design choice in order to help transition users who are used to plain &lt;textarea /&gt; inputs to Apple&#8217;s <acronym title="what you see is what you get">WYSIWYG</acronym> editor. It&#8217;s also the only way to space paragraphs properly if the user hasn&#8217;t selected the &#8220;Paragraph&#8221; option in the text formatting toolbar. Otherwise, simply hitting the <em>Return</em> key once is enough to space paragraphs apart properly (i.e., the functionality is equivalent to the way Microsoft Word or Pages handles paragraph breaks).</p>
<p>Interestingly, the &#8220;Enter <acronym title="Uniform Resource Locator">URL</acronym>…&#8221; functionality form the toolbar is smarter than one might first assume. For instance, it recognizes email address and prepends a mailto: scheme to the link if it finds one. This is contrary to what the Apple-provided manual states, which tells you to enter the &#8220;mailto:&#8221; portion as part of the <acronym title="Uniform Resource Locator">URL</acronym>. In fact, you should omit this, else your final mailto link will actually read &#8220;mailto:mailto:your.email@address.com&#8221;.</p>
<p>This means linking to &#8220;mailto: links&#8221; is as simple as typing an email address. Similarly, the <acronym title="what you see is what you get">WYSIWYG</acronym> doesn&#8217;t complain if your fully-qualified <acronym title="Uniform Resource Locator">URL</acronym> doesn&#8217;t include a scheme, so you can enter <kbd>//apple.com/</kbd> and the subsequent link is generated as <code>&lt;a href="//apple.com/"&gt;Link text&lt;/a&gt;</code>. This is one step above and beyond even WordPress&#8217;s new <acronym title="what you see is what you get">WYSIWYG</acronym> editor, which forcefully prepends an http: scheme to URLs without one.</p>
<p>For the most part, copy-and-paste works as expected, except in cases where the <acronym title="what you see is what you get">WYSIWYG</acronym> editor does not understand the current formatting, such as a specific font and (and this is a biggie) for links. At first, the editor will <em>appear</em> to show that the formatting (including links) is saved, but when you actually save the page, only the formatting that the <acronym title="what you see is what you get">WYSIWYG</acronym> editor understands is actually saved. Worse, all your links are turned into underlined—but unlinked—text. In short, this means that if you are copying and pasting page content that contains links, you need to do so in the <acronym title="HyperText Markup Language">HTML</acronym> view of the page editor.</p>
<p>Inexplicably, the editor generates &lt;i&gt; and &lt;b&gt; tags for italics and bold, instead of the preferred &lt;em&gt; and &lt;strong&gt; elements. I&#8217;m not sure I understand why this is the case. There does exist a an &#8220;emphasis&#8221; option in the toolbar, as does an &#8220;important&#8221; option, but these generate strange spans instead. The &#8220;Important&#8221; item wraps the selected text inside a &lt;span class=&#8221;Apple-style-span custom_forecolor_important&#8221;&gt;…&lt;/span&gt; and the &#8220;Emphasis&#8221; item wraps the selected text inside a &lt;span class=&#8221;Apple-style-span custom_forecolor_emphasis&#8221;&gt;…&lt;/span&gt; element.</p>
<p>There&#8217;s also one other item, &#8220;Highlight,&#8221; which wraps the selected text inside of a &lt;span class=&#8221;Apple-style-span custom_backcolor_highlight&#8221;&gt;…&lt;/span&gt; element.</p>
<p>The only explanation that makes sense to me, after much speculation, is that perhaps Apple does not want to encode semantic information such as what &lt;em&gt; and &lt;strong&gt; would imply from users who use a <acronym title="what you see is what you get">WYSIWYG</acronym> editor. This shows either a blatant distrust of users or incredible foresight. I&#8217;m not sure which.</p>
<h2>Page names and URLs</h2>
<p>Currently, the search functionality built into Apple&#8217;s WikiServer only searches on the text of a page&#8217;s title.</p>
<p>Apple&#8217;s WikiServer generates unique page names for each new wiki page. These names consist of two parts, but only one seems to make any difference. For example, if you create a new Wiki page called &#8220;Hello&#8221;, you might get an address in your web browser&#8217;s location bar that looks like this:</p>
<pre>http://your-server.local/groups/your-group-name/wiki/1d06a/Hello.html</pre>
<p>Most of this is standard <acronym title="Uniform Resource Locator">URL</acronym> stuff (the protocol, the server address), and most of the rest is self-explanatory (the group name, the wiki section). The important bits in this <acronym title="Uniform Resource Locator">URL</acronym> are the last two:</p>
<ul>
<li>1d06a</li>
<li>Hello.html</li>
</ul>
<p>Obviously, &#8220;Hello.html&#8221; came from the fact that you named your new page &#8220;Hello&#8221;. WikiServer appended &#8220;.html&#8221; on its own. The other bit, the short string of random characters, is a unique identifier used across all of this group&#8217;s web services (the wiki, blog, calendar, and mail list, if these other services are enabled) to uniquely identify this page.  What&#8217;s interesting about this is that only the unique string of characters seems to matter in regards to accessing the page. That is, if you next ask for:</p>
<pre>http://your-server.local/groups/your-group-name/wiki/1d06a/Some-Random-Page.html</pre>
<p>you&#8217;ll still get the same &#8220;Hello.html&#8221; page from before, even though you&#8217;re seemingly asking for &#8220;Some-Random-Page.html&#8221;. In fact, it doesn&#8217;t seem to matter what you replace &#8220;Some-Random-Page&#8221; with. So long as there is some text in that part of the <acronym title="Uniform Resource Locator">URL</acronym>, that the <acronym title="Uniform Resource Locator">URL</acronym> ends with &#8220;.html&#8221; and that the unique identifier remains untouched, you&#8217;ll always end up retrieving the &#8220;Hello.html&#8221; page.</p>
<p>This means that if you change this page&#8217;s name later to, for instance, &#8220;Hello world&#8221;, old links that point to &#8220;…/1d06a/Hello.html&#8221; will continue to work, even while new links will start to point at &#8220;…/1d06a/Hello_world.html&#8221;.  From a usability perspective, this is simple and effective; it ensures that users have a reminder of what the page is about by looking at the last part of the <acronym title="Uniform Resource Locator">URL</acronym>. However, once page names change, it becomes a bit non-optimal, because the same page can be referred to by multiple names—a &#8220;no-no&#8221; in the <acronym title="Search Engine Optimization">SEO</acronym> world and a practice discouraged by most semantic-web types.</p>
<p>I would imagine that Apple made this design decision because the company envisioned their WikiServer to be used, again, primarily in intranet and SOHO environments, and as a result are not too concerned with search engine optimization.  As an aside, this unique string is also how Apple&#8217;s WikiServer identifies the stored content on the filesystem. Read on for more details.</p>
<h2>Hacking the Apple WikiServer</h2>
<p>There isn&#8217;t a lot of information out on the Web right now about how to work with the WikiServer, especially for developers. Therefore, some digging is needed. After a bit of research, I discovered the following key directories that the WikiServer uses. They are as follows:</p>
<ul>
<li><code>/usr/share/collaboration</code> - This has a few developer tool support files as well as the majority of the client-side code for the Wiki (javascripts, etc).</li>
<li><code>/usr/share/wikid</code> - This directory holds the Python sources and compiled bytecode for all the &#8220;Teams&#8221; components (including wiki, blog, calendar, etc.). It seems to run on Twisted and a number of other familiar-sounding components.</li>
<li><code>/Library/Application Support/Apple/WikiServer</code> - This is where most the data is stored, inside of plist files and a few others. The Themes subdirectory here is where Apple recommends that look-and-feel changes be made.</li>
<li><code>/Library/Collaboration</code> &#8211; This is the default data storage location for all the &#8220;Teams&#8221; components. The actual content of the wikis and blogs will be kept somewhere in this directory, which means that <strong>this is the directory you want to backup to backup the content of your wikis</strong>. This location is the only user-configurable one of the bunch. To change it, change the &#8220;Data Store&#8221; value in Server Admin. (A more detailed listing of this directory hierarchy is available on page 62 of the <a href="http://images.apple.com/server/macosx/docs/Web_Technologies_Admin_v10.5.pdf">Mac <acronym title="Operating System">OS</acronym> X Server Web Technologies Administration For Version 10.5 Leopard</a> manual.)</li>
</ul>
<p>If you take a peek at the /Library/Collaboration directory, and follow that into the Groups/your-group-name/wiki directory, you&#8217;ll find a list of all the pages in your wiki stored as .page bundles, identified with the unique character string WikiServer generated when it first created the page.</p>
<p>It should be noted that anything in the /usr/share directory will likely be overridden whenever Apple releases an update that modifies the WikiServer. As a result, any and all changes you make to WikiServer&#8217;s templates or themes should be done by creating new files in the /Library/Application Support/Apple/WikiServer/Themes directory.</p>
<p>It&#8217;s interesting to note that the WikiServer seems to use <a href="http://python.org/">Python</a> for its back-end processing. This may open up some interesting integration possibilities for Python programmers in the future.</p>
<h2>More help eslewhere</h2>
<p>Even though Apple WikiServer is relatively new, there&#8217;s a load of helpful information about it on the web. Most of the good stuff is on Apple&#8217;s own Discussions boards, but more and more info is beginning to show up on blog posts. A Google search should give you what you need. For the really lazy, however, here are a few helpful items:</p>
<ul>
<li><a href="http://docs.info.apple.com/article.html?path=ServerAdmin/10.5/en/c4ws25.html">Server Admin 10.5 Help: Customizing Wiki Themes and Layouts</a></li>
<li><a href="http://discussions.apple.com/thread.jspa?messageID=6804477">Apple Discussions: How to customize Apple WikiServer templates and themes</a></li>
<li><a href="http://images.apple.com/server/macosx/docs/Web_Technologies_Admin_v10.5.pdf">Mac <acronym title="Operating System">OS</acronym> X Server Web Technologies Administration For Version 10.5 Leopard</a></li>
</ul>
<p>This was just a brief introduction to WikiServer from some notes I&#8217;ve been collecting in my experimentations, but I hope it&#8217;s helpful to someone somewhere. Cheers. Or, continue to <a href="http://maymay.net/blog/2008/04/08/a-web-developer’s-introduction-to-the-apple-wikiserver-part-2/">Part 2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/04/05/a-web-developers-introduction-to-the-apple-wikiserver-part-1/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Sharing your Windows XP Virtual Machine&#8217;s Internet connection with your Mac OS X host operating system using VMware Fusion</title>
		<link>http://maymay.net/blog/2008/03/31/sharing-your-windows-xp-virtual-machines-internet-connection-with-your-mac-os-x-host-operating-system-using-vmware-fusion/</link>
		<comments>http://maymay.net/blog/2008/03/31/sharing-your-windows-xp-virtual-machines-internet-connection-with-your-mac-os-x-host-operating-system-using-vmware-fusion/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 09:06:42 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tech/Computing]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/2008/03/31/sharing-your-windows-xp-virtual-machines-internet-connection-with-your-mac-os-x-host-operating-system-using-vmware-fusion/</guid>
		<description><![CDATA[In some situations, like the odd one I now find myself in, the only way to get Internet connectivity is to use a solution that requires a fair bit of maneuvering. In my situation, I have temporarily obtained a Vodafone 3G mobile card. Unfortunately, the Vodafone Mobile Connect software for Mac OS X as of [...]]]></description>
			<content:encoded><![CDATA[<p>In some situations, like the odd one I now find myself in, the only way to get Internet connectivity is to use a solution that requires a fair bit of maneuvering. In my situation, I have temporarily obtained a Vodafone <acronym title="3 Gigabyte(s)">3G</acronym> mobile card. Unfortunately, the <a href="//www.business.vodafone.com/site/bus/public/enuk/support/10_productsupport/laptop_connectivity/40_software/software/10_latest/p_mac.jsp" title="Download Vodafone's latest software for Mac OS X.">Vodafone Mobile Connect software for Mac <acronym title="Operating System">OS</acronym> X</a> as of this writing is obscenely poor. Of course, Vodafone&#8217;s software for Windows works without a hitch.</p>
<p>The only way I could get my Vodafone <acronym title="3 Gigabyte(s)">3G</acronym> card to work was to fire up a Windows XP guest inside of my MacBook Pro, using <a href="//vmware.com/download/fusion/" title="Download VMware Fusion for Mac OS X.">VMware Fusion</a>. Connecting to the Internet with the <acronym title="3 Gigabyte(s)">3G</acronym> card using the Windows guest was smooth sailing, but that only provided the Internet connection to the Windows virtual machine. I wanted my Mac to be directly connected.</p>
<p>The solution is obvious, but a few gotchas really bit me hard. To get the Windows guest to share its Internet connection from the <acronym title="3 Gigabyte(s)">3G</acronym> card to my Mac, I would need to bridge VMware&#8217;s virtual ethernet adapter from the Windows guest to the Mac <acronym title="Operating System">OS</acronym> X host. Once bridged, both the Windows guest and the Mac <acronym title="Operating System">OS</acronym> X host would logically be on the same ethernet network segment. At this point, I can <a href="http://support.microsoft.com/kb/306126" title="Read Microsoft's Knowledge Base document explaining how to enable Internet Connection Sharing in Windows XP.">enable Windows XP&#8217;s built-in Internet Connection Sharing</a> (stupidly dubbed &#8220;ICS&#8221; because <em>everything</em> needs a <a href="//en.wikipedia.org/wiki/Three_letter_acronym">TLA</a>) on the <acronym title="3 Gigabyte(s)">3G</acronym> connection so that Windows NATs it through to the bridged virtual ethernet card. Finally, I can connect to Vodafone&#8217;s <acronym title="3 Gigabyte(s)">3G</acronym> network, and all should be well.</p>
<p>Here&#8217;s the gotchas.</p>
<p>First, in order for <strong>VMware</strong> to actually initiate the network bridge when it starts up, it <strong>must detect that a <em>physical link</em> is active on your Mac</strong>. In other words, Mac <acronym title="Operating System">OS</acronym> X&#8217;s Network System Preferences pane must show you a yellow dot next to at least one physical networking device (probably either your &#8220;Built-in Ethernet&#8221; or your &#8220;AirPort&#8221; ports). VMware Fusion will give you <em>no errors or warnings</em> that a bridge is unavailable until you try to connect your virtual machine&#8217;s network while set to bridge, in which case VMware Fusion will complain with an error that reads: &#8220;The device on /dev/vmnet0 is not running.&#8221;</p>
<p>Obviously, if you have no other devices to connect to, you need to fake one. The easiest way to do this is to set up a Computer-to-Computer network using AirPort. Just go to your AirPort menu bar item and select &#8220;Create Network…&#8221; and create the network (preferably encrypted). If you check System Preferences now, you should see a that AirPort has a yellow dot next to it and reads as having a &#8220;Self-Assigned <acronym title="Internet Protocol">IP</acronym> Address.&#8221; Now that you have a physical link on your AirPort card, you should be able to start the VMware Fusion virtual machine with bridged networking mode without incident.</p>
<p>However, if you do encounter the above error anyway, you need to restart the VMware network bridge. You can do this either by shutting down VMware completely (turn off your guest operating systems, and quit the VMware Fusion application), or you can run the following commands as an administrator in Terminal, which will stop any bridge currently running (or do nothing if no bridge is running) and then restart it, providing the output as shown:</p>
<pre><kbd>sudo killall vmnet-bridge
sudo "/Library/Application Support/VMware Fusion/vmnet-bridge" -D vmnet0 ''</kbd>
<samp>Entering event loop...
Examining network configuration...
Turning on bridge with host network interface en1...</samp></pre>
<p>Obviously, you may be asked for your password as you perform this procedure. Note that the trailing two apostrophes are <em>single quotes</em> with no space. This is (almost) how the VMware Fusion <code>boot.sh</code> script starts and stops the network bridge. Specifically, you&#8217;re telling the <strong>vmnet-bridge</strong> application to run in <strong>D</strong>ebug mode and to bridge <strong>vmnet0</strong> to whatever is the current primary networking interface. In the example output shown above, this is <strong>en1</strong>, or my AirPort card connected to the computer-to-computer network I created in the previous step.</p>
<p>Hopefully you won&#8217;t have to mess with the vmnet-bridge application, as this should happen on its own when you start up VMware Fusion if you have any physical link on a network device. Nevertheless, I&#8217;ve found this is sometimes unreliable, so just in case it doesn&#8217;t now you know how to bring up the bridge on your own. (Tip: once it&#8217;s up, you can CTRL-Z to pause it, re-start it with <code>fg %1</code> and then quit Terminal if you like. The bridge will still be up.)</p>
<p>Now that the AirPort card has a physical link, and the VMware network bridge is running, the next step is to configure your virtual machine to use bridged networking. Just go to <em>Virtual Machine &rarr; Network &rarr; Bridged</em> as normal. Make sure <em>Connected</em> is also selected. Now start up your Windows guest.</p>
<p>Once Windows boots, go to the Network Connections window by selecting <em>Start &rarr; Connections &rarr; Show all connections</em>. At this point, your &#8220;Local Area Connection&#8221; in Windows probably has a warning sign on it and reads as having &#8220;Little or no connectivity.&#8221; It probably has a self-assigned <acronym title="Internet Protocol">IP</acronym> address just like your AirPort card. That&#8217;s fine—as long as it&#8217;s not &#8220;unplugged,&#8221; we&#8217;re in good shape.</p>
<p>Next, select whatever <em>other</em> connection you want to share the Internet from (in my case, the <acronym title="3 Gigabyte(s)">3G</acronym> modem, but it could also just be any other connection in the window), right-click it and select <em>Properties</em>. Go to the <em>Advanced</em> tab and make sure &#8220;Allow other network users to connect through this computer&#8217;s Internet connection&#8221; is checked. The other boxes won&#8217;t matter.</p>
<p>What this does is turns on Windows&#8217; own NAT service that configures the one connection (the one your sharing) as the WAN side of (yet another) virtual networking device and the Local Area Connection (the one we&#8217;ve bridged to our AirPort or Built-in Ethernet card on our Mac) as the LAN side. Hit OK as many times as is necessary to close the network connection properties windows and wait a few moments. Sometimes this can take up to 30 seconds or so, but eventually you&#8217;ll see Windows announce that &#8220;Local Area Connection is now connected.&#8221; If you inspect it, you&#8217;ll see that the <acronym title="Internet Protocol">IP</acronym> address configuration has been automatically assigned as a &#8220;Manual Configuration&#8221; with the address of 192.168.0.1, a subnet mask of 255.255.255.0, and no default gateway.</p>
<p>As a last step, <em>now</em> we can actually connect to the Internet using whatever service we have. In my case, this is when I hit the &#8220;connect&#8221; button on my Vodafone Mobile Connect software. Once the connection is established and the Windows XP virtual machine can see Internet, it takes up to another minute or two (or three) for the Mac&#8217;s connection to get an <acronym title="Internet Protocol">IP</acronym> address from the Windows guest, but it invariably works.</p>
<p>If the Windows side of things is giving you any trouble, the most reliable solution I&#8217;ve found is to simply disable, then re-enable whatever connection isn&#8217;t behaving as desired. If after all of this your Mac still doesn&#8217;t get an <acronym title="Internet Protocol">IP</acronym> address from the Windows XP guest, disconnect and then re-connect the virtual machine&#8217;s ethernet card (by toggling the &#8220;Connected&#8221; menu item in the <em>Virtual Machine &rarr; Network</em> menu). Also, of course, be doubly sure that your AirPort is set to &#8220;Use <acronym title="Dynamic Host Configuration Protocol">DHCP</acronym>.&#8221;</p>
<p>Phew! So simple…and yet so much harder than it had to be. I found the following two <acronym title="Portable Document Format">PDF</acronym> documents very helpful in understanding all of this. You might too:</p>
<ol>
<li><a href="http://communities.vmware.com/thread/97712">VMware Fusion Network Settings</a> — a super-brief, but excellent introduction to VMware&#8217;s network setting internals. It&#8217;s also a <acronym title="Portable Document Format">PDF</acronym> download attached to the linked forum thread.</li>
<li><a href="//communities.vmware.com/thread/120047">Share Windows XP Guest Internet Connection with <acronym title="Operating System">OS</acronym> X Host HOWTO</a> — This basically describes the same thing this post does, but it does so using absolute step-by-step instructions. It&#8217;s also a <acronym title="Portable Document Format">PDF</acronym> download attached to the linked forum thread.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/03/31/sharing-your-windows-xp-virtual-machines-internet-connection-with-your-mac-os-x-host-operating-system-using-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>HowTo: Use git for personal development when everyone else is using Subversion (part 2)</title>
		<link>http://maymay.net/blog/2008/03/28/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-2/</link>
		<comments>http://maymay.net/blog/2008/03/28/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-2/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 08:20:36 +0000</pubDate>
		<dc:creator>Meitar</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://maymay.net/blog/2008/03/28/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-2/</guid>
		<description><![CDATA[When we left off, you had just finished transforming a remote Subversion repository into a git repository and optimizing it to save you some space. Now that you have a git repository, what do you do? First things first. Once you have an idea of what work you want to do, you should give yourself [...]]]></description>
			<content:encoded><![CDATA[<p>When we left off, you had just finished transforming a remote Subversion repository into a git repository and optimizing it to save you some space. Now that you have a git repository, what do you do?</p>
<p>First things first. Once you have an idea of what work you want to do, you should give yourself a space to do this work without disturbing anybody else&#8217;s work. Do this by making a new, personal branch. Unlike Subversion and some other centralized version control systems, git makes it possible to do make all kinds of changes to your repository, including making branches, and even save those changes without having to republish everything back to the central repository server at each step. In other words, if you thought Subversion branches were &#8220;cheap,&#8221; you&#8217;ll love git&#8217;s branches.</p>
<p>Also unlike Subversion, which stores its branches in completely separate pathnames, git keeps all branches in the same filesystem tree separated only with metadata (in <code>.git/refs/remotes</code> for remote branches and in <code>.git/refs/heads</code> for local branches, to be a bit more precise), so you don&#8217;t have to create lots of different directories for all your branches (unless you want to). With no branches defined, you&#8217;re working in the &#8220;master branch,&#8221; or &#8220;the trunk&#8221; by default.</p>
<pre><kbd>git branch</kbd>
<samp>* master</samp></pre>
<p>By saying <code>git branch</code> you ask git to print a list of all (local) branches. The one with the asterisk marks the current branch, the one you&#8217;re using at the moment you run the command. Since there are no branches, you&#8217;re currently in the &#8220;master&#8221; branch. But we don&#8217;t want to make changes here, we want to make changes in our own private branch, so we&#8217;ll make a new one.</p>
<pre>git checkout -b <var>new_branch_name</var></pre>
<p>This will create a new branch with the name <var>new_branch_name</var> and immediately switch to it. Notice that you&#8217;ve made absolutely no changes to the filesystem itself; only the git metadata has been altered. Saying <code>git branch</code> again will show you the change:</p>
<pre><kbd>git branch</kbd>
<samp>  master
* new_branch_name</samp></pre>
<p>Also note that since we haven&#8217;t comitted any changes, we don&#8217;t need a commit message (or &#8220;log message&#8221;) for creating this branch. We&#8217;ll add one later, when we need it. Now go ahead and write some code in your new branch. At any time, you can create a new branch in the same way you added the first. Each new branch is created at the <code>HEAD</code> (&#8220;latest&#8221;) revision of whatever branch you&#8217;re currently working in.</p>
<pre><kbd>git checkout -b <var>another_branch</var></kbd>
<samp>Switched to a new branch "<var>another_branch</var>"</samp>
<kbd>git branch</kbd>
<samp>  master
  new_branch_name
* another_branch</samp></pre>
<p>To switch back to any other branch, simply <code>git checkout</code> that branch again:</p>
<pre><kbd>git checkout master</kbd>
<samp>Switched to branch "master"</samp></pre>
<p>If you want to delete a branch you don&#8217;t like, that&#8217;s easy too:</p>
<pre><kbd>git branch -d <var>another_branch</var></kbd>
<samp>Deleted branch <var>another_branch</var></samp>.</pre>
<p>Keep in mind that throughout all of these branch creation and deletion actions, the only thing that&#8217;s being altered is the git metadata. That&#8217;s why it&#8217;s so cheap to create new branches. If you ever have a new idea you&#8217;re working on, it&#8217;s recommended that you create a branch for it, even if that branch is so short-lived it never gets published.</p>
<p>So you have a new local branch, and you&#8217;ve been working as you normally do for a few minutes, creating files, editting them, and so on. Running <code>git status</code> now will ask git to show you the changes you&#8217;ve made to your filesystem. If you&#8217;ve created any files in new directories that git doesn&#8217;t know about, it will simply report that directory. If you&#8217;ve made new files in directories git does know about, it will list all those files explicitly.</p>
<pre><kbd>git status</kbd>
<samp># On branch cartoon_contests
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	sites/default/modules/cartoon_contests/
#	sites/default/modules/factiva/.factiva.module.swp
#	sites/default/modules/testfile
#	sites/default/settings.php
nothing added to commit but untracked files present (use "git add" to track)
</samp></pre>
<p>In the above sample output, I&#8217;m working on a new Drupal module for a web site. I&#8217;ve created a new directory, <code>sites/default/modules/cartoon_contests/</code> (note the trailing slash), and I have several untracked files. One is my <a href="//vim.org/">vim</a> swap file for a different module, <code>.factiva.module.swp</code>, one&#8217;s an unimportant <code>testfile</code>, and the last is the Drupal configuration file, <code>settings.php</code>.</p>
<p>The only thing I want to commit is the new <code>cartoon_contests</code> directory, and all the files within it. Like Subversion, I have to tell git that I want to <dfn>track</dfn> this directory, which is done simply by saying <code>git add cartoon_contests</code>. Unlike Subversion, future invocations of <code>git status</code> let me see everything that git is going to go in the next commit.</p>
<pre><kbd>git status</kbd>
<samp># On branch cartoon_contests
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   sites/default/modules/cartoon_contests/cartoon_contests.info
#	new file:   sites/default/modules/cartoon_contests/cartoon_contests.module
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	sites/default/modules/factiva/.factiva.module.swp
#	sites/default/modules/testfile
#	sites/default/settings.php</samp></pre>
<p>The &#8220;Changes to be committed&#8221; section of the output is called the <dfn>staging area</dfn>, or the <dfn>index</dfn>. In this way, I can prepare all the changes I want to commit before I do so, making sure they&#8217;re perfect before I actually commit them to the git repository. At any time before I commit, I can make additional modifications, such as <code>git add</code>ing more files or directories, <code>git reset</code>ing to unstage all (or some) of my changes, etc. <code>git help reset</code> also has a number of handy explanations with examples for different things you might need to do at this point.</p>
<p>If you were using <code>svn:ignore</code>, equivalent functionality exists in git. Simply append file glob patterns, one per line, to the <code>$GIT_DIR/info/exclude</code> file in your git repository. Like so:</p>
<pre><kbd>echo -e "*.swp\nsites/default/settings.php" >> .git/info/exclude ; git status</kbd>
<samp># On branch cartoon_contests
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	new file:   sites/default/modules/cartoon_contests/cartoon_contests.info
#	new file:   sites/default/modules/cartoon_contests/cartoon_contests.module
#
</samp></pre>
<p>If you&#8217;ve got many of these, you can use <code>git svn show-ignore >> .git/info/exclude</code> to search through your old Subversion repository and look for any and all ignores, automatically adding them to git&#8217;s exclude list. (Checkout <a href="//tsunanet.blogspot.com/2007/07/learning-git-svn-in-5min.html">Tsuna&#8217;s blog entry on learning git</a> for more tips like this.)</p>
<p>Finally, after you&#8217;ve done some of your work and you&#8217;ve finished <dfn>staging</dfn> your changes, you&#8217;re ready to commit them to the repository. On the other hand, if you hate what you&#8217;ve done and want to undo it all, you can say <code>git reset --hard HEAD</code> to throw away all your local changes. To throw away changes to just a single file, just checkout that file again by saying <code>git checkout <var>filename</var></code>. This is the equivalent of Subversions <code>svn revert <var>filename</var></code> command.</p>
<p>Before you actually make your first commit, however, you should properly introduce yourself to git. You don&#8217;t have to do this because git will try to figure out who you are by itself (<a>details explained in detail here</a>), but you probably should at least create global defaults for your user (which git will store in <code>~/.gitconfig</code>). If you want to, you can also create per-repository defaults (which git will store in <code>.git/config</code>), or even system-wide defaults for all users of this computer (which git will store in <code>/etc/gitconfig</code>). To do so, say this:</p>
<pre><kbd>git config --global user.name "Your Full Name"
git config --global user.email "you@example.com"</kbd></pre>
<p>This will create the file <code>~/.gitconfig</code> if it doesn&#8217;t alreay exist and will write your name into it. You can also just edit the file directly yourself instead of using <code>git config</code> commands.</p>
<p>Like Subversion, committing will create a saved, fixed point-in-time that marks the changes you have made to your files. Like branches, commits are also very cheap in git, so go ahead and commit at any time you like. Remember to stage your files (by <code>git add</code>ing them), and then just <code>git commit</code>.</p>
<pre><kbd>git add <var>filepattern</var></kbd>
<kbd>git commit -m "My very frst git commit!"</kbd>
<samp>Created commit ef483c1: My very frst git commit!
 5 files changed, 58 insertions(+), 12 deletions(-)</samp></pre>
<p>If you forget to specify a commit log message (<code>-m "log message"</code>) on the command line, or if you want to enter a multi-line commit log, git will prompt you for it in your favorite <code>$EDITOR</code>. You can view a history, including all the log messages, for your project with <code>git log</code>. You can even the view logs in a number of pretty formats. Check <code>git help log</code> for more information.</p>
<p>If you want to change anything about the commit you just made, such as the author, you can just run <code>git commit</code> again with the <code>--amend</code> flag added to the command. Notice the typo in the commit log? Fixing it is really easy:</p>
<pre><kbd>git commit --amend -m "My very first git commit!"</kbd>
<samp>Created commit 88602f6: My very first git commit!
 5 files changed, 58 insertions(+), 12 deletions(-)</samp></pre>
<p>Finally, with your new code commited to your local git branch, it&#8217;s time to share that code with your colleagues who are (for some inexplicable reason) still using Subversion. This is also extremely simple. Just say <code>git svn dcommit</code>. (That&#8217;s right, <code><strong>d</strong>commit</code>, not just commit. I don&#8217;t know why….)</p>
<p>Not sharing your changes via Subversion, but with a patch instead? <code>git diff -p</code> will generate patches for you. See <code>git help diff-files</code> and look for the &#8220;GENERATING PATCHES WITH -P&#8221; section.</p>
<p>If you found this helpful, you may also enjoy an <a href="//cworth.org/hgbook-git/tour/">alternative tour for beginners from Carl Worth</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maymay.net/blog/2008/03/28/howto-use-git-for-personal-development-when-everyone-else-is-using-subversion-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

