<?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>Endlessly Curious &#187; Mac</title>
	<atom:link href="http://www.endlesslycurious.com/tag/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.endlesslycurious.com</link>
	<description>Programming, Productivity &#38; Software Development.</description>
	<lastBuildDate>Mon, 09 Jan 2012 09:00:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting mac desktop wallpaper with Python</title>
		<link>http://www.endlesslycurious.com/2009/06/15/setting-mac-desktop-wallpaper-with-python/</link>
		<comments>http://www.endlesslycurious.com/2009/06/15/setting-mac-desktop-wallpaper-with-python/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 09:00:18 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.endlesslycurious.com/?p=1269</guid>
		<description><![CDATA[I have been playing with Python recently. Here is a little script to change a mac&#8217;s desktop wallpaper to the file specified as the first argument of the script: Or using the nifty appscript module for python: The more I use Python the more I like it.  I used to think Python was at a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing with Python recently.</p>
<p>Here is a little script to change a mac&#8217;s desktop wallpaper to the file specified as the first argument of the script:</p>
<pre class="brush: python; title: ; notranslate">
import subprocess,sys,os

# Raw apple script
Script = &quot;&quot;&quot;/usr/bin/osascript&lt;&lt;END
tell application &quot;Finder&quot;
set desktop picture to POSIX file &quot;%s&quot;
end tell
END&quot;&quot;&quot;

# get the file name which is the first argument passed to this script
filename = sys.argv[1] 

# run the apple script inserting the filename
subprocess.Popen(Script%filename,shell=True)
</pre>
<p>Or using the nifty <a title="Source Forge" href="http://appscript.sourceforge.net/">appscript</a> module for python:</p>
<pre class="brush: python; title: ; notranslate">
import sys
from appscript import app, mactypes

# get the file name which is the first argument passed to this script
fileName = sys.argv[1]

# use the appscript module to change the desktop wallpaper
app('Finder').desktop_picture.set(mactypes.File(fileName))
</pre>
<p>The more I use Python the more <a title="XKCD (comic)" href="http://xkcd.com/353/">I like it</a>.  I used to think Python was at a similar level to C# in terms of how high a level a programming language it is.  After using Python for a bit I now realise that Python is a <a title="Wikipedia" href="http://en.wikipedia.org/wiki/High-level_programming_language">higher level programming language</a> than C#.  Out of the languages I use reguarally it would seem that Python is the highest level language followed by C# then C++ and finally C.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.endlesslycurious.com/2009/06/15/setting-mac-desktop-wallpaper-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Perforce command line client P4 on Mac OS X</title>
		<link>http://www.endlesslycurious.com/2008/11/11/configuring-p4-command-line-client-on-mac-os-x/</link>
		<comments>http://www.endlesslycurious.com/2008/11/11/configuring-p4-command-line-client-on-mac-os-x/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 09:00:43 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Perforce]]></category>

		<guid isPermaLink="false">http://www.endlesslycurious.com/?p=750</guid>
		<description><![CDATA[I wrote a post yesterday about setting up the Perforce server P4D on Mac OS X once you&#8217;ve done that all that is left is to configure P4V the visual client and P4 the command line client. Fortunately P4V has a helpful set-up wizard to help you configure it for the first time: connect to [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a <a href="http://www.endlesslycurious.com/2008/11/10/setting-up-perforce-server-p4d-on-mac-os-x/">post</a> yesterday about setting up the <a href="http://www.perforce.com/">Perforce</a> server P4D on Mac OS X once you&#8217;ve done that all that is left is to configure P4V the visual client and P4 the command line client.  Fortunately P4V has a helpful set-up wizard to help you configure it for the first time: connect to the server, create your new user account, new client spec and sync up for the first time.</p>
<p>The command line utility P4 takes a little bit more configuration via environment variables which is not quite as simple as setting up P4V, so I thought I would document it.  The first thing I did was run P4V and configured it, this has the side effect of working out the perforce port, creating a user account and associated client spec.  Take a note of the username, clientspec and perforce port as you setup P4V, you&#8217;ll use those values to configure P4.</p>
<p>Note for this to work you need to have P4 already set-up in your system&#8217;s <a href="http://en.wikipedia.org/wiki/Path_(variable)">path</a> variable.  If you don&#8217;t have P4 in your path when you type <span style="color: #000080;">&#8216;p4</span>&#8216; and hit <span style="color: #000080;">enter</span> in a <a href="http://www.apple.com/macosx/technology/unix.html">terminal</a> window you will get a response along the lines of &#8216;<span style="color: #000080;">-bash: p4: command not found</span>&#8216;.  If you don&#8217;t have this already set-up and you are using the default bash terminal on Mac OS X, then you can add P4 to your path by doing the following:</p>
<ol>
<li>Open a Terminal window, (its in the utilities folder in the application folder).</li>
<li>Type <span style="color: #000080;">vi .bash_profile</span> this will open the hidden file that defines your bash profile file in the <a href="http://en.wikipedia.org/wiki/Vi">vi</a> text editor.</li>
<li>Edit the line (press <span style="color: #000080;"><strong>i</strong></span> to start editing and <strong><span style="color: #000080;">esc</span></strong> to stop) that starts with <span style="color: #000080;">path=</span>, insert the path to where you put p4 (in <span style="color: #ff0000;">red</span>) followed by a <span style="color: #000080;">:</span> right after <span style="color: #000080;">path=</span> e.g. <span style="color: #000080;">PATH=&#8221;<span style="color: #ff0000;">/Developer/Perforce/:</span>&#8230;:${PATH}&#8221;</span>.</li>
<li>Save the file (with <span style="color: #000080;">:s <span style="color: #000000;">then</span> enter</span>) and then exit vi (with <span style="color: #000080;">:q <span style="color: #000000;">then</span> enter</span>).</li>
<li>Quit Terminal.</li>
<li>Reopen Terminal.</li>
<li>Type <span style="color: #000080;">p4</span> and hit <span style="color: #000080;">enter</span>, you should now get a response from the p4 application, although this will most likely get an error response unless you&#8217;ve already set-up your Perforce environment variables.</li>
</ol>
<p>Now we can configure the three environment variables that the P4 application requires to work, these are $P4PORT, $P4USER and $P4CLIENT. These variables tell the P4 application how to connect to the server and the user to connect as and clientspec to connect with for that user. As I mentioned above the values of these three variables are the same as the perforce port, username and clientspec you used in P4V.  To setup these environment variables we are going to add them to a hidden system file which is run every time you login to set-up the environment variables for your user profile (from this <a href="http://mactip.blogspot.com/2004/04/setting-environment-variables.html">guide</a>).</p>
<ol>
<li>Open a Terminal window.</li>
<li>Type <span style="color: #000080;">mkdir .MacOSX</span> and hit <span style="color: #000080;">enter</span> to create the hidden directory the file resides in, the dot at the start means it is a hidden file.</li>
<li>Type <span style="color: #000080;">echo &#8220;&#8221; &gt; .MacOSX/environment.plist</span> and hit <span style="color: #000080;">enter</span> to create an empty file called environment.plist in your user directory directory, which is hidden.</li>
<li>Type <span style="color: #000080;">open .MacOSX/environment.plist</span> and hit <span style="color: #000080;">enter</span> to open the file we just created in the plist editor.</li>
<li>Add a child value with name <span style="color: #000080;">P4PORT</span> and the value from P4V e.g. <span style="color: #000080;">localhost:1666</span>.</li>
<li>Add a sibling value with name <span style="color: #000080;">P4USER</span> with the value of your user from P4V e.g. <span style="color: #000080;">daniel</span>.</li>
<li>Add a sibling value with name <span style="color: #000080;">P4CLIENT</span> with the value of the clientspec for your user in P4V  e.g. <span style="color: #000080;">daniels_clientspec</span>.</li>
<li>Save the file and exit the editor.</li>
<li>Quit terminal.</li>
<li>Logout and log back in.</li>
<li>Open terminal and type <span style="color: #000080;">P4</span> and hit enter, you should now get a non-error response from P4.</li>
</ol>
<p>It is worth configuring the P4 command line application as it is the main way to administer a perforce server, so if you want add, delete or manage users, depots etc then you need to have P4 configured.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.endlesslycurious.com/2008/11/11/configuring-p4-command-line-client-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Setting up Perforce Server (p4d) on Mac OS X</title>
		<link>http://www.endlesslycurious.com/2008/11/10/setting-up-perforce-server-p4d-on-mac-os-x/</link>
		<comments>http://www.endlesslycurious.com/2008/11/10/setting-up-perforce-server-p4d-on-mac-os-x/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 09:00:45 +0000</pubDate>
		<dc:creator>Daniel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Perforce]]></category>

		<guid isPermaLink="false">http://www.endlesslycurious.com/?p=739</guid>
		<description><![CDATA[This morning I have been attempting to get p4d running on my intel iMac (running MacOS 10.5.5) so I can do some proper development at home.  I easily found the official Perforce guide to launching p4d at start-up with Launchd here, which seemed helpful and simple enough.  But it would seem I am now bogged [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I have been attempting to get p4d running on my intel iMac (running MacOS 10.5.5) so I can do some proper development at home.  I easily found the official Perforce guide to launching p4d at start-up with Launchd <a href="http://kb.perforce.com/HardwareOsNe..rkReference/OperatingSystems/Mac/UsingLaunchd">here</a>, which seemed helpful and simple enough.  But it would seem I am now bogged down in file permission hell, which is something I don&#8217;t know allot about as I mainly work on Windows systems&#8230;</p>
<p>When I login I get the following message in my Console log and no p4d instance started:<br />
<span style="color: #000080;">&#8220;10/11/08 2:56:59 PM com.apple.launchctl.System[2] launchctl: Dubious ownership on file (skipping): /Library/LaunchDaemons/com.perforce.plist&#8221;</span><br />
The permissions for the plist file are:<br />
<span style="color: #000080;">-rw-r&#8211;r&#8211;@ 1 Daniel  staff  700 10 Nov 11:58 /Library/LaunchDaemons/com.perforce.plist</span><br />
And the permissions for p4 and p4d are:<br />
<span style="color: #000080;">-rwxr-xr-x@  1 Daniel  staff   580272 10 Nov 11:25 /Developer/Perforce/p4<br />
-rwxr-xr-x@  1 Daniel  staff  1695008 10 Nov 11:25 /Developer/Perforce/p4d</span><br />
The rest of the perforce files are set to:<br />
<span style="color: #000080;">-rw-r&#8211;r&#8211;  1 Daniel  staff   * 10 Nov 13:14 *</span></p>
<p>I used the example plist file from the perforce website and filled in the details specific for my installation:</p>
<pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;!DOCTYPE plist PUBLIC &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
&lt;key&gt;Debug&lt;/key&gt;
&lt;false/&gt;
&lt;key&gt;Label&lt;/key&gt;
&lt;string&gt;com.perforce&lt;/string&gt;
&lt;key&gt;OnDemand&lt;/key&gt;
&lt;false/&gt;
&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
&lt;string&gt;/Developer/Perforce/p4d&lt;/string&gt;
&lt;/array&gt;
&lt;key&gt;EnvironmentVariables&lt;/key&gt;
&lt;dict&gt;
&lt;key&gt;P4LOG&lt;/key&gt;
&lt;string&gt;/Developer/Perforce/p4log.log&lt;/string&gt;
&lt;key&gt;P4PORT&lt;/key&gt;
&lt;string&gt;1666&lt;/string&gt;
&lt;key&gt;P4ROOT&lt;/key&gt;
&lt;string&gt;/Developer/Perforce/p4root&lt;/string&gt;
&lt;/dict&gt;
&lt;key&gt;RunAtLoad&lt;/key&gt;
&lt;true/&gt;
&lt;key&gt;ServiceDescription&lt;/key&gt;
&lt;string&gt;Launches Perforce Server&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
<p>This plist file works if I use the following command:<br />
<span style="color: #000080;">launchctl unload /Library/LaunchDaemons/com.perforce.plist</span></p>
<p>Any help on resolving this would be greatly appreciated, I can start the server manaually for now but it would be great to have it running at start-up or login!  I&#8217;ve tried using the same plist file in the /Library/LaunchedAgents/ folder but I get the same results <img src='http://www.endlesslycurious.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<h2><strong>Solution!</strong></h2>
<p>The following solution is from Perforce technical support, the owner and group of the plist file should be <span style="color: #000080;">root:wheel</span> which can be achieved by the following command:<br />
<span style="color: #000080;"> sudo chown root:wheel </span><span style="color: #000080;">/Library/LaunchDaemons/</span><span style="color: #000080;">com.perforce.plist</span><br />
The file should look like this after the change:<br />
<span style="color: #000080;"> -rw-r&#8211;r&#8211;  1 root  wheel  797 11 Nov 11:01 com.perforce.plist</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.endlesslycurious.com/2008/11/10/setting-up-perforce-server-p4d-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

