<?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>Cupcake With Sprinkles</title>
	<atom:link href="http://www.cupcakewithsprinkles.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cupcakewithsprinkles.com</link>
	<description>Hunter Ford</description>
	<lastBuildDate>Wed, 23 Jun 2010 20:19:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Amazon EC2 and NFS</title>
		<link>http://www.cupcakewithsprinkles.com/amazon-ec2-and-nfs/</link>
		<comments>http://www.cupcakewithsprinkles.com/amazon-ec2-and-nfs/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 18:55:38 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Systems Administration]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=184</guid>
		<description><![CDATA[There is a lack of updated information online about launching NFS in EC2 specifically, so I thought I would contribute to help those who might encounter this in the future; and it&#8217;s actually quite easy. We&#8217;re running Fedora 8 (while we wait for Fedora 13 to be supported). NFS-utils and rpcbind should already be installed, [...]]]></description>
			<content:encoded><![CDATA[<p>There is a lack of updated information online about launching NFS in EC2 specifically, so I thought I would contribute to help those who might encounter this in the future; and it&#8217;s actually quite easy.</p>
<p>We&#8217;re running Fedora 8 (while we wait for Fedora 13 to be <a href="https://fedoraproject.org/wiki/Features/FedoraOnEC2">supported</a>).</p>
<p>NFS-utils and rpcbind should already be installed, but if not, you need to run the following on the instance that will act as the server:</p>
<pre class="brush: bash;">
yum install nfs-utils rpcbind
</pre>
<p>*Note: you&#8217;ll find in a lot of tutorials portmap is used instead of rpcbind. Portmap was renamed to rpcbind.</p>
<p>Still on the server, we need to define what directory we want to share, with whom (which server), along with the permissions and options for that share.</p>
<pre class="brush: bash;">
# open up our definition file
nano /etc/exports
</pre>
<p>You can look at all the options in the exports man page.</p>
<p>For the purpose of this tutorial I&#8217;m just going to share a directory I created under /var/www</p>
<pre class="brush: bash;">
/var/www/test   ec2-180-71-131-129.compute-1.amazonaws.com(rw,async)
</pre>
<p>In the example above, I&#8217;m using the public DNS of one of my instances that has an elastic IP. Elastic IP DNS names inside EC2 get translated to internal IPs (you can verify it with ping). You can use hostnames, IPs, netmasks and even wildcards. <em>rw</em> specifies that it&#8217;s read/writable and <em>async</em> allows disk operations to happen asynchronously. Next we need to load the changes.</p>
<pre class="brush: bash;">
exportfs -ar
</pre>
<p>You can use that anytime you add another mount point.</p>
<p>And now we need to start the server and related services:</p>
<pre class="brush: bash;">
service rpcbind start
service nfs start
service nfslock start
</pre>
<p>Next, we need to open up some ports in Amazon&#8217;s security group. Through the EC2 Console or API, you want to allowing connections from your client to your server on the following ports:</p>
<p>TCP: 111, 2049<br />
UDP: 111, 32806</p>
<p>On the client, you need to start nfslock and rpcbind, and optionally add them to startup:</p>
<pre class="brush: bash;">
service rpcbind start
service nfslock start
chkconfig --level 2345 rpcbind on
chkconfig --level 2345 nfslock on
</pre>
<p>We need to create a directory as a mount point and mount the NFS server:</p>
<pre class="brush: bash;">
mkdir /var/www/test
mount -t nfs ec2-180-71-131-132.compute-1.amazonaws.com:/var/www/test /var/www/test
</pre>
<p>*Make sure to change the host name to the hostname or IP of your NFS server.</p>
<p>That&#8217;s all there is to it.</p>
<p>Originally I had only opened up port TCP 111 and 2049. This only gave me this error:</p>
<blockquote><p>mount to NFS server &#8217;10.214.58.54&#8242; failed: timed out, retrying</p></blockquote>
<p>I then opened up UDP 111 and by running the mount command in verbose mode (-v) I saw that I needed to open UDP 32806. It looks like the mount command requires TCP and UDP 111, but only TCP 2049 and UDP 32806.</p>
<p>If you want these services to run on startup, you&#8217;ll want to do the following:</p>
<pre class="brush: bash;">
chkconfig --level 2345 rpcbind on
chkconfig --level 2345 nfs on
chkconfig --level 2345 nfslock on
</pre>
<p>And to have the mounts created at startup, edit /etc/fstab</p>
<pre class="brush: bash;">
ec2-180-71-131-132.compute-1.amazonaws.com:/var/www/test    /var/www/test       nfs rsize=8192,wsize=8192,timeo=14,intr 0 0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/amazon-ec2-and-nfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Custom Model Manager Chaining</title>
		<link>http://www.cupcakewithsprinkles.com/django-custom-model-manager-chaining/</link>
		<comments>http://www.cupcakewithsprinkles.com/django-custom-model-manager-chaining/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 21:03:22 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=173</guid>
		<description><![CDATA[Let&#8217;s say you have a custom model manager like this: from datetime import datetime from django.db import models class PostManager(models.Manager): def by_author(self, user): return self.filter(user=user) def published(self): return self.filter(published__lte=datetime.now()) class Post(models.Model): user = models.ForeignKey(User) published = models.DateTimeField() objects = PostManager() But let&#8217;s say you are want to filter those results that are both published and [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you have a custom model manager like this:</p>
<pre class="brush: python;">from datetime import datetime

from django.db import models

class PostManager(models.Manager):
    def by_author(self, user):
        return self.filter(user=user)

    def published(self):
        return self.filter(published__lte=datetime.now())

class Post(models.Model):
    user = models.ForeignKey(User)
    published = models.DateTimeField()

    objects = PostManager()</pre>
<p>But let&#8217;s say you are want to filter those results that are both published and by a certain author. There is no built-in mechanism that will allow you to chain the two together.</p>
<p>So for example, the following will fail since <em>by_author</em> returns a QuerySet:</p>
<pre class="brush: python;">Post.objects.by_author(user=request.user).published()</pre>
<p>There are a few discussions on the matter:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/809210/django-manager-chaining">Django Manager Chaining</a></li>
<li><a href="http://simonwillison.net/2008/May/1/orm/">jQuery style chaining with the Django ORM</a></li>
<li><a href="http://mcarthurgfx.com/blog/article/extending-django-models-managers-and-querysets">Extending Django Models, Managers, And QuerySets</a></li>
</ul>
<p>But using Python mixins I&#8217;ve developed what I think to be a better way:</p>
<pre class="brush: python;">from django.db.models.query import QuerySet

class PostMixin(object):
    def by_author(self, user):
        return self.filter(user=user)

    def published(self):
        return self.filter(published__lte=datetime.now())

class PostQuerySet(QuerySet, PostMixin):
    pass

class PostManager(models.Manager, PostMixin):
    def get_query_set(self):
        return PostQuerySet(self.model, using=self._db)</pre>
<p>It keeps with DRY principles and works just like you expect Django&#8217;s ORM to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/django-custom-model-manager-chaining/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GoDaddy SSL Certificate and Chrome</title>
		<link>http://www.cupcakewithsprinkles.com/godaddy-ssl-certificate-and-chrome/</link>
		<comments>http://www.cupcakewithsprinkles.com/godaddy-ssl-certificate-and-chrome/#comments</comments>
		<pubDate>Tue, 18 May 2010 16:18:30 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=163</guid>
		<description><![CDATA[On one of my recent projects, I was getting a message from Google Chrome saying: &#8220;The site&#8217;s security certificate is not trusted!&#8221; It was was a valid certificate in all other major browsers. And a few different computers running Chrome had no issues. So what gives? Through some Googling, I learned this: This could be [...]]]></description>
			<content:encoded><![CDATA[<p>On one of my recent projects, I was getting a message from Google Chrome saying: &#8220;The site&#8217;s security certificate is not trusted!&#8221;</p>
<p style="text-align: center;"><img class="size-full wp-image-164 aligncenter" title="Screen shot 2010-05-18 at 11.47.48 AM" src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2010/05/Screen-shot-2010-05-18-at-11.47.48-AM-e1274198216952.png" alt="" width="600" height="354" /></p>
<p>It was was a valid certificate in all other major browsers. And a few different computers running Chrome had no issues. So what gives?</p>
<p>Through some Googling, I learned this:</p>
<blockquote><p>This could be because the SSL provider is using a new Root certificate that isn&#8217;t included in the old browsers and devices. The error can usually be fixed by installing an Intermediate certificate that will link the new Root certificate to an old trusted certificate. –Robert [<a href="http://www.sslshopper.com/ssl-certificate-not-trusted-error.html" target="_blank">SSL Certificate Not Trusted Error</a>]</p></blockquote>
<p>If your curious to learn more about intermediate certificates, GoDaddy has a decent explanation: <a href="http://help.godaddy.com/article/868" target="_blank">What is an intermediate certificate?</a></p>
<p><strong>How to Fix</strong></p>
<p>You need to download a GoDaddy Secure Server Certificate (Intermediate Certificate): <a id="j_id12:0:j_id14:2:j_id16" href="https://certs.godaddy.com/anonymous/repository.seam?streamfilename=gd_intermediate.crt&amp;actionMethod=anonymous%2Frepository.xhtml%3Arepository.streamFile%28%27%27%29&amp;cid=315573" target="_blank">gd_intermediate.crt</a> [<a href="https://certs.godaddy.com/anonymous/repository.seam" target="_blank">GoDaddy Repository</a>]</p>
<p>For <strong>Apache</strong>, you need to add the following to your configuration:</p>
<pre class="brush: plain;">SSLCertificateChainFile /etc/certs/gd_intermediate.crt</pre>
<p>For <strong>Nginx</strong>, there&#8217;s a little more work to do the same thing. You need to concatenate your existing certificate file with the intermediate certificate to produce a new certificate file, which you will as your new certificate.</p>
<pre class="brush: plain;">cat example.com.crt gd_intermediate.crt &gt; example.com-combined.crt</pre>
<p>Then in your nginx configuration file you can change</p>
<pre class="brush: plain;">ssl_certificate      /etc/certs/example.com.crt;</pre>
<p>to</p>
<pre class="brush: plain;">ssl_certificate      /etc/certs/example.com-combined.crt;</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/godaddy-ssl-certificate-and-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB Startup Item for Mac OS X Snow Leopard</title>
		<link>http://www.cupcakewithsprinkles.com/mongodb-startup-item/</link>
		<comments>http://www.cupcakewithsprinkles.com/mongodb-startup-item/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 18:12:33 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=161</guid>
		<description><![CDATA[Save the following as /System/Library/LaunchDaemons/org.mongo.mongod.plist &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;!DOCTYPE plist PUBLIC &#34;-//Apple//DTD PLIST 1.0//EN&#34; &#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#34;&#62; &#60;plist version=&#34;1.0&#34;&#62; &#60;dict&#62; &#60;key&#62;Label&#60;/key&#62; &#60;string&#62;org.mongo.mongod&#60;/string&#62; &#60;key&#62;RunAtLoad&#60;/key&#62; &#60;true/&#62; &#60;key&#62;ProgramArguments&#60;/key&#62; &#60;array&#62; &#60;string&#62;/usr/local/bin/mongod&#60;/string&#62; &#60;string&#62;--dbpath&#60;/string&#62; &#60;string&#62;/var/lib/mongodb/&#60;/string&#62; &#60;string&#62;--logpath&#60;/string&#62; &#60;string&#62;/var/log/mongodb.log&#60;/string&#62; &#60;/array&#62; &#60;/dict&#62; &#60;/plist&#62; You will need to create a file for the log and a directory for the database. sudo touch /var/log/mongodb.log sudo mkdir /var/lib/mongodb And [...]]]></description>
			<content:encoded><![CDATA[<p>Save the following as /System/Library/LaunchDaemons/org.mongo.mongod.plist</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//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;Label&lt;/key&gt;
	&lt;string&gt;org.mongo.mongod&lt;/string&gt;
	&lt;key&gt;RunAtLoad&lt;/key&gt;
	&lt;true/&gt;
	&lt;key&gt;ProgramArguments&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;/usr/local/bin/mongod&lt;/string&gt;
		&lt;string&gt;--dbpath&lt;/string&gt;
		&lt;string&gt;/var/lib/mongodb/&lt;/string&gt;
		&lt;string&gt;--logpath&lt;/string&gt;
		&lt;string&gt;/var/log/mongodb.log&lt;/string&gt;
	&lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
<p>You will need to create a file for the log and a directory for the database.</p>
<pre class="brush: bash;">
sudo touch /var/log/mongodb.log
sudo mkdir /var/lib/mongodb
</pre>
<p>And in a bash session, run the following:</p>
<pre class="brush: bash;">
sudo chown root:wheel /System/Library/LaunchDaemons/org.mongo.mongod.plist
sudo launchctl load /System/Library/LaunchDaemons/org.mongo.mongod.plist
sudo launchctl start org.mongo.mongod
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/mongodb-startup-item/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Django Messaging for AJAX Calls Using Jquery</title>
		<link>http://www.cupcakewithsprinkles.com/django-messaging-for-ajax-calls-using-jquery/</link>
		<comments>http://www.cupcakewithsprinkles.com/django-messaging-for-ajax-calls-using-jquery/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 14:32:14 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=153</guid>
		<description><![CDATA[The messaging contrib app for Django has always been been tied to a user, which has prevented me from using it in any of my apps. Now that the Django 1.2 Alpha has been released, I&#8217;ve been able to play with it, and feel good about using it. My sites usually have a mix of [...]]]></description>
			<content:encoded><![CDATA[<p>The messaging contrib app for Django has always been been tied to a user, which has prevented me from using it in any of my apps. Now that the Django 1.2 Alpha has been released, I&#8217;ve been able to play with it, and feel good about using it. My sites usually have a mix of AJAX and traditional HTTP requests. So figuring out a good solution to handle messages for the AJAX requests, while maintaining consistency in interacting with the API was important to me. Here&#8217;s my solution for handling messages in AJAX requests.</p>
<p>First we need a middleware that will detect if the request is an AJAX request. I always use JSON, but if you mix the data types, you might have to add some additional logic here. The middleware adds to the JSON any messages that we might have added in the view.</p>
<pre class="brush: python;">import simplejson as json

from django.contrib import messages

class AjaxMessaging(object):
    def process_response(self, request, response):
        if request.is_ajax():
            if response['Content-Type'] in [&quot;application/javascript&quot;, &quot;application/json&quot;]:
                try:
                    content = json.loads(response.content)
                except ValueError:
                    return response

                django_messages = []

                for message in messages.get_messages(request):
                    django_messages.append({
                        &quot;level&quot;: message.level,
                        &quot;message&quot;: message.message,
                        &quot;extra_tags&quot;: message.tags,
                    })

                content['django_messages'] = django_messages

                response.content = json.dumps(content)
        return response</pre>
<p>Make sure to add the new middleware to <em>settings.py</em>.</p>
<pre class="brush: python;">'apps.main.middleware.AjaxMessaging'</pre>
<p>So if we have a view that responds to an AJAX request, we can add a message the same way we would for a traditional HTTP response:</p>
<pre class="brush: python;">if success:
    messages.success(request, &quot;The object has been modified.&quot;)
else:
    messages.error(request, &quot;The object was not modified.&quot;)</pre>
<p>We need a place to put the messages in our template:</p>
<pre class="brush: xml;">&lt;ul id=&quot;messages&quot;&gt;
    {% for message in messages %}
    &lt;li{% if message.tags %} class=&quot;{{ message.tags }}&quot;{% endif %}&gt;{{ message }}&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;</pre>
<p>We&#8217;ll be using a global ajaxComplete handler, so we&#8217;ll have to use a JSON parser. Simply include it with the rest of our javascript. <a href="http://code.google.com/p/jquery-json/" target="_blank">jquery.json.js</a></p>
<p>And finally the handler, which simply loops through all the Django messages, and fades them out after three seconds.</p>
<pre class="brush: jscript;">function addMessage(text, extra_tags) {
    var message = $('&lt;li class=&quot;'+extra_tags+'&quot;&gt;'+text+'&lt;/li&gt;').hide();
    $(&quot;#messages&quot;).append(message);
    message.fadeIn(500);

    setTimeout(function() {
        message.fadeOut(500, function() {
            message.remove();
        });
    }, 3000);
}

$(document).ready(function() {
    $('#messages').ajaxComplete(function(e, xhr, settings) {
        var contentType = xhr.getResponseHeader(&quot;Content-Type&quot;);

        if (contentType == &quot;application/javascript&quot; || contentType == &quot;application/json&quot;) {
            var json = $.evalJSON(xhr.responseText);

            $.each(json.django_messages, function (i, item) {
                addMessage(item.message, item.extra_tags);
            });
        }
    }).ajaxError(function(e, xhr, settings, exception) {
        addMessage(&quot;There was an error processing your request, please try again.&quot;, &quot;error&quot;);
    });</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/django-messaging-for-ajax-calls-using-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Handle HTTP Redirects with Jquery and Django</title>
		<link>http://www.cupcakewithsprinkles.com/how-to-handle-http-redirects-with-jquery-and-django/</link>
		<comments>http://www.cupcakewithsprinkles.com/how-to-handle-http-redirects-with-jquery-and-django/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 23:09:46 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=132</guid>
		<description><![CDATA[Jquery has a funny way of handling 302 redirects during AJAX calls. These frequently come up when I need to redirect a user to a login page. Here&#8217;s how I&#8217;m handling it with Django. The underlying problem we experience with redirects in Jquery is that the redirects are followed. So instead of getting a status [...]]]></description>
			<content:encoded><![CDATA[<p>Jquery has a funny way of handling 302 redirects during AJAX calls. These frequently come up when I need to redirect a user to a login page. Here&#8217;s how I&#8217;m handling it with Django.</p>
<p>The underlying problem we experience with redirects in Jquery is that the redirects are followed. So instead of getting a status code of <em>HTTP/1.1 302 Found</em>, we get <em>HTTP/1.1 200 OK</em>. So one way to get around this is to return a made up status code. This is easily accomplished with a middleware in django.</p>
<pre class="brush: python;">from django.http import HttpResponseRedirect

class AjaxRedirect(object):
    def process_response(self, request, response):
        if request.is_ajax():
            if type(response) == HttpResponseRedirect:
                response.status_code = 278
        return response</pre>
<p>Make sure to add the new middleware to <em>settings.py</em>.</p>
<pre class="brush: python;">'apps.main.middleware.AjaxRedirect'</pre>
<p>And the final piece of the puzzle is to add a global AJAX complete handler, that checks for the new status code, redirects the page to the <em>Location</em> header in the HTTP response, and replace the <em>next</em> query variable. The last part is important because the login_<em>required</em> decorator automatically sets the next query variable to the <em>HTTP Referrer</em>, which in this case would be the URL of the AJAX call. So we want to replace it with the page we&#8217;re currently on.</p>
<pre class="brush: jscript;">$(document).ready(function() {
    $('body').ajaxComplete(function(e, xhr, settings) {
        if (xhr.status == 278) {
            window.location.href = xhr.getResponseHeader(&quot;Location&quot;).replace(/\?.*$/, &quot;?next=&quot;+window.location.pathname);
        }
    });
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/how-to-handle-http-redirects-with-jquery-and-django/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting Up Apache-PHP-Python-MySQL on Mac OS X Snow Leopard 10.6</title>
		<link>http://www.cupcakewithsprinkles.com/setting-up-apache-php-python-mysql-on-mac-os-x-snow-leopard-10-6/</link>
		<comments>http://www.cupcakewithsprinkles.com/setting-up-apache-php-python-mysql-on-mac-os-x-snow-leopard-10-6/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 23:56:07 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=68</guid>
		<description><![CDATA[Download and install MySQL Package file [MySQL 5.1 for 10.5 (x86_64)] Install MySQL Startup Item [Howto] Turn on Web Sharing in System Preferences -&#62; Sharing Copy /etc/php.ini.default to /etc/php.ini sudo cp /etc/php.ini.default /etc/php.ini Add timezone information to php.ini (PHP will error without this) date.timezone = 'America/New_York' Install php-mcrypt Download libmcrypt 2.5.8 Build and install . [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Download and install MySQL Package file [<a href="http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41-osx10.5-x86_64.dmg/from/http://mysql.he.net/" target="_blank">MySQL 5.1 for 10.5 (x86_64)</a>]</li>
<li>Install MySQL Startup Item [<a href="http://www.cupcakewithsprinkles.com/mysql-startup-item-for-mac-os-10-6-snow-leopard/" target="_blank">Howto</a>]</li>
<li>Turn on Web Sharing in System Preferences -&gt; Sharing<br />
<a href="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/11/Screen-shot-2009-11-29-at-5.19.43-PM.png"><img class="alignnone size-medium wp-image-103" style="border: 0pt none;" title="Screen shot 2009-11-29 at 5.19.43 PM" src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/11/Screen-shot-2009-11-29-at-5.19.43-PM-300x251.png" alt="Screen shot 2009-11-29 at 5.19.43 PM" width="300" height="251" /></a></li>
<li>Copy /etc/php.ini.default to /etc/php.ini
<pre class="brush: bash;">sudo cp /etc/php.ini.default /etc/php.ini</pre>
</li>
<li>Add timezone information to php.ini (PHP will error without this)
<pre class="brush: plain;">date.timezone = 'America/New_York'</pre>
</li>
<li>Install php-mcrypt
<ol>
<li>Download <a href="http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz" target="_blank">libmcrypt 2.5.8</a></li>
<li>Build and install .
<pre class="brush: bash;">./configure --disable-posix-threads --enable-dynamic-loading
make
sudo make install</pre>
</li>
<li>Download <a href="http://www.php.net/get/php-5.3.1.tar.gz/from/a/mirror" target="_blank">PHP 5.3.1</a></li>
<li>Navigate to php-5.3.1/ext/mcrypt/</li>
<li>Build and install .
<pre class="brush: bash;">phpize
./configure
make
sudo make install</pre>
</li>
<li>Add extension to php.ini
<pre class="brush: bash;">extension=mcrypt.so</pre>
</li>
</ol>
</li>
<li>Install APC
<ol>
<li>Download <a href="http://downloads.sourceforge.net/project/pcre/pcre/8.00/pcre-8.00.tar.gz?use_mirror=cdnetworks-us-1" target="_blank">PCRE 8.0</a></li>
<li>Build and install .
<pre class="brush: bash;">./configure
make
sudo make install</pre>
</li>
<li>Download <a href="http://pecl.php.net/get/APC-3.1.3p1.tgz" target="_blank">APC 3.1.3p1</a></li>
<li>Navigate to APC-3.1.3p1/APC-3.1.3p1/</li>
<li>Build and install .
<pre class="brush: bash;">phpize
./configure
make
sudo make install</pre>
</li>
<li>Add extension to php.ini
<pre class="brush: bash;">extension=apc.so</pre>
</li>
</ol>
</li>
<li>Download and install <a href="http://downloads.sourceforge.net/project/mysql-python/mysql-python-test/1.2.3c1/MySQL-python-1.2.3c1.tar.gz?use_mirror=softlayer" target="_blank">MySQL-python 1.2.3c1<br />
</a>
<pre class="brush: bash;">sudo python setup.py install</pre>
</li>
<li>Download and install <a href="http://www.ijg.org/files/jpegsrc.v7.tar.gz" target="_blank">libjpeg.v7</a>
<pre class="brush: bash;">./configure --enable-shared
make
sudo make install</pre>
</li>
<li>Download and install <a href="http://effbot.org/downloads/Imaging-1.1.6.tar.gz" target="_blank">Python Imaging Library 1.1.6</a>
<pre class="brush: bash;">sudo python setup.py install</pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/setting-up-apache-php-python-mysql-on-mac-os-x-snow-leopard-10-6/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>MySQL Startup Item for Mac OS 10.6 Snow Leopard</title>
		<link>http://www.cupcakewithsprinkles.com/mysql-startup-item-for-mac-os-10-6-snow-leopard/</link>
		<comments>http://www.cupcakewithsprinkles.com/mysql-startup-item-for-mac-os-10-6-snow-leopard/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 22:18:14 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=98</guid>
		<description><![CDATA[Save the following as /System/Library/LaunchDaemons/org.mysql.mysqld.plist &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;!DOCTYPE plist PUBLIC &#34;-//Apple//DTD PLIST 1.0//EN&#34; &#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#34;&#62; &#60;plist version=&#34;1.0&#34;&#62; &#60;dict&#62; &#60;key&#62;RunAtLoad&#60;/key&#62; &#60;true/&#62; &#60;key&#62;Umask&#60;/key&#62; &#60;integer&#62;7&#60;/integer&#62; &#60;key&#62;UserName&#60;/key&#62; &#60;string&#62;_mysql&#60;/string&#62; &#60;key&#62;Disabled&#60;/key&#62; &#60;false/&#62; &#60;key&#62;WorkingDirectory&#60;/key&#62; &#60;string&#62;/usr/local/mysql&#60;/string&#62; &#60;key&#62;GroupName&#60;/key&#62; &#60;string&#62;_mysql&#60;/string&#62; &#60;key&#62;KeepAlive&#60;/key&#62; &#60;true/&#62; &#60;key&#62;Program&#60;/key&#62; &#60;string&#62;/usr/local/mysql/bin/mysqld&#60;/string&#62; &#60;key&#62;Label&#60;/key&#62; &#60;string&#62;org.mysql.mysqld&#60;/string&#62; &#60;key&#62;ProgramArguments&#60;/key&#62; &#60;array&#62; &#60;string&#62;--user=_mysql&#60;/string&#62; &#60;/array&#62; &#60;/dict&#62; &#60;/plist&#62; And in a bash session, run the following: sudo chown root:wheel /System/Library/LaunchDaemons/org.mysql.mysqld.plist sudo [...]]]></description>
			<content:encoded><![CDATA[<p>Save the following as /System/Library/LaunchDaemons/org.mysql.mysqld.plist</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//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;RunAtLoad&lt;/key&gt;
	&lt;true/&gt;
	&lt;key&gt;Umask&lt;/key&gt;
	&lt;integer&gt;7&lt;/integer&gt;
	&lt;key&gt;UserName&lt;/key&gt;
	&lt;string&gt;_mysql&lt;/string&gt;
	&lt;key&gt;Disabled&lt;/key&gt;
	&lt;false/&gt;
	&lt;key&gt;WorkingDirectory&lt;/key&gt;
	&lt;string&gt;/usr/local/mysql&lt;/string&gt;
	&lt;key&gt;GroupName&lt;/key&gt;
	&lt;string&gt;_mysql&lt;/string&gt;
	&lt;key&gt;KeepAlive&lt;/key&gt;
	&lt;true/&gt;
	&lt;key&gt;Program&lt;/key&gt;
	&lt;string&gt;/usr/local/mysql/bin/mysqld&lt;/string&gt;
	&lt;key&gt;Label&lt;/key&gt;
	&lt;string&gt;org.mysql.mysqld&lt;/string&gt;
	&lt;key&gt;ProgramArguments&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;--user=_mysql&lt;/string&gt;
	&lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
<p>And in a bash session, run the following:</p>
<pre class="brush: bash;">
sudo chown root:wheel /System/Library/LaunchDaemons/org.mysql.mysqld.plist
sudo launchctl load /System/Library/LaunchDaemons/org.mysql.mysqld.plist
sudo launchctl start org.mysql.mysqld
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/mysql-startup-item-for-mac-os-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nginx Startup Script for Mac OS 10.6 Snow Leopard</title>
		<link>http://www.cupcakewithsprinkles.com/nginx-startup-script-for-mac-os-10-6-snow-leopard/</link>
		<comments>http://www.cupcakewithsprinkles.com/nginx-startup-script-for-mac-os-10-6-snow-leopard/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 19:49:48 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Systems Administration]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=93</guid>
		<description><![CDATA[If you don&#8217;t use MacPorts, and have a hard time finding a startup plist file for Nginx, and had trouble getting Nginx to startup with your custom plist file, this might be your solution: &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;!DOCTYPE plist PUBLIC &#34;-//Apple//DTD PLIST 1.0//EN&#34; &#34;http://www.apple.com/DTDs/PropertyList-1.0.dtd&#34;&#62; &#60;plist version=&#34;1.0&#34;&#62; &#60;dict&#62; &#60;key&#62;Label&#60;/key&#62; &#60;string&#62;nginx&#60;/string&#62; &#60;key&#62;Program&#60;/key&#62; &#60;string&#62;/usr/local/nginx/sbin/nginx&#60;/string&#62; &#60;key&#62;KeepAlive&#60;/key&#62; &#60;true/&#62; &#60;key&#62;NetworkState&#60;/key&#62; &#60;true/&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t use MacPorts, and have a hard time finding a startup plist file for Nginx, and had trouble getting Nginx to startup with your custom plist file, this might be your solution:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//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;Label&lt;/key&gt;
    &lt;string&gt;nginx&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/usr/local/nginx/sbin/nginx&lt;/string&gt;
    &lt;key&gt;KeepAlive&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;NetworkState&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;LaunchOnlyOnce&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
<p>Just save this as /System/Library/LaunchDaemons/org.nginx.nginx.plist and perform the following in a bash session:</p>
<pre class="brush: bash;">
sudo chown root:wheel /System/Library/LaunchDaemons/org.nginx.nginx.plist
sudo launchctl load /System/Library/LaunchDaemons/org.nginx.nginx.plist
sudo launchctl start org.nginx.nginx
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/nginx-startup-script-for-mac-os-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Growl Notifications for Apple Mail on Mac OS X Snow Leopard (10.6)</title>
		<link>http://www.cupcakewithsprinkles.com/growl-notifications-for-apple-mail-on-mac-os-x-snow-leopard-10-6/</link>
		<comments>http://www.cupcakewithsprinkles.com/growl-notifications-for-apple-mail-on-mac-os-x-snow-leopard-10-6/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 21:06:56 +0000</pubDate>
		<dc:creator>Hunter Ford</dc:creator>
				<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apple Mail]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://www.cupcakewithsprinkles.com/?p=73</guid>
		<description><![CDATA[UPDATE: You can grab a beta version of 64-bit Growl 1.2 from the Growl beta site. GrowlMail is broken on Mac OS X Snow Leopard (10.6). The dev team for Growl has a fix in the works, but I use Prowl and like to have notifications go to my iPhone when I&#8217;m not at my [...]]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: You can grab a beta version of 64-bit Growl 1.2 from the Growl <a href="http://growl.info/beta.html">beta site</a>.</strong></p>
<p><a href="http://growl.info/documentation/growlmail.php">GrowlMail</a> is broken on Mac OS X Snow Leopard (10.6). The dev team for <a href="http://growl.info/">Growl</a> has a fix in the works, but I use <a href="http://prowl.weks.net/">Prowl</a> and like to have notifications go to my iPhone when I&#8217;m not at my computer. So in the meantime, here is my solution.</p>
<p><img src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/09/Screen-shot-2009-09-02-at-9.51.22-AM.png" alt="Screen shot 2009-09-02 at 9.51.22 AM" title="Screen shot 2009-09-02 at 9.51.22 AM" width="328" height="123" class="aligncenter size-full wp-image-86" /></p>
<p>I was originally inspired by <a href="http://blog.jameshiggs.com/2009/08/28/growlmail-on-snow-leopard-a-temporary-fix/">James Higgs</a>.</p>
<p>You first want to create a new AppleScript using AppleScript Editor and save it somewhere logical. I used <code>/Library/Scripts/Mail Scripts/Rule Actions/Growl.scpt</code> Below is the code:</p>
<pre class="brush: applescript;">
-- Growl Alerts in Mail
-- Hunter Ford [http://www.cupcakewithsprinkles.com]
-- This script arises from the lack of any Growl Support in Mac OS X Snow Leopard (10.6)
-- Code inspired by and adapted from James Higgs [http://blog.jameshiggs.com/2009/08/28/growlmail-on-snow-leopard-a-temporary-fix/] as well as those mentioned.

tell application &quot;GrowlHelperApp&quot;
	-- Make a list of all the notification types
	-- that this script will ever send:
	set the allNotificationsList to {&quot;New Email&quot;}

	-- Make a list of the notifications
	-- that will be enabled by default.
	-- Those not enabled by default can be enabled later
	-- in the 'Applications' tab of the growl prefpane.
	set the enabledNotificationsList to {&quot;New Email&quot;}

	-- Register our script with growl.
	-- You can optionally (as here) set a default icon
	-- for this script's notifications.
	register as application &quot;Mail&quot; all notifications allNotificationsList default notifications enabledNotificationsList icon of application &quot;Mail&quot;
end tell

-- Mail Rule Trigger
--
-- Source: Benjamin S. Waldie [http://www.mactech.com/articles/mactech/Vol.21/21.09/ScriptingMail/index.html]
using terms from application &quot;Mail&quot;
	on perform mail action with messages theSelectedMessages for rule theRule
		repeat with thisMessage in theSelectedMessages
			-- Process the current message

			-- Grab the subject and sender of the message
			set growlSubject to subject of thisMessage
			set growlSender to my ExtractName(sender of thisMessage)

			-- Use the first 100 characters of a message
			set growlMessage to (content of thisMessage)
			set growlLength to (length of growlMessage)

			if growlLength &gt; 100 then
				set growlMessage to (characters 1 through 100 of growlMessage) &amp; &quot;…&quot;
			end if

			set growlMessage to growlSubject &amp; &quot;

&quot; &amp; growlMessage

			-- Send a Notification
			tell application &quot;GrowlHelperApp&quot;
				notify with name &quot;New Email&quot; title growlSender description growlMessage application name &quot;Mail&quot;
			end tell
		end repeat
	end perform mail action with messages
end using terms from

-- *ExtractName*
--
-- gathers the name portion from the &quot;From: &quot; line
--
-- Source: robJ [http://forums.macosxhints.com/archive/index.php/t-19954.html]
to ExtractName(sender_)
	if sender_ begins with &quot;&lt;&quot; then
		return text 2 thru -2 of sender_
	else
		set oldTIDs to text item delimiters
		try
			set text item delimiters to &quot;&lt;&quot;
			set name_ to first text item of sender_
			set text item delimiters to oldTIDs
		on error
			set text item delimiters to oldTIDs
		end try
		return name_
	end if
end ExtractName
</pre>
<p><strong>Run this first in the AppleScript Editor. As this is what will &#8220;register&#8221; the notification with Growl.</strong> Click the green &#8220;play&#8221; button that says &#8220;Run&#8221;.</p>
<p><img src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/09/Screen-shot-2009-09-01-at-10.46.18-PM.png" alt="Screen shot 2009-09-01 at 10.46.18 PM" title="Screen shot 2009-09-01 at 10.46.18 PM" width="543" height="560" class="aligncenter size-full wp-image-83" /></p>
<p>Then you want to create a new rule in mail that will run this script on every message that comes in. </p>
<p><img src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/09/Screen-shot-2009-09-01-at-4.45.20-PM.png" alt="Screen shot 2009-09-01 at 4.45.20 PM" title="Screen shot 2009-09-01 at 4.45.20 PM" width="570" height="232" class="aligncenter size-full wp-image-75" /></p>
<p>Make sure to select &#8220;Don&#8217;t Apply&#8221; that way you don&#8217;t flood your screen with tons of Growl notifications.</p>
<p><img src="http://www.cupcakewithsprinkles.com/wp-content/uploads/2009/09/Screen-shot-2009-09-01-at-4.53.15-PM.png" alt="Screen shot 2009-09-01 at 4.53.15 PM" title="Screen shot 2009-09-01 at 4.53.15 PM" width="434" height="165" class="aligncenter size-full wp-image-76" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cupcakewithsprinkles.com/growl-notifications-for-apple-mail-on-mac-os-x-snow-leopard-10-6/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
	</channel>
</rss>
