<?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>Red Sweater Blog &#187; WordPress</title>
	<atom:link href="http://www.red-sweater.com/blog/category/articles/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.red-sweater.com/blog</link>
	<description>Mac &#38; Technology Writings by Daniel Jalkut</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:03:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>QuickLogin Plugin For WordPress</title>
		<link>http://www.red-sweater.com/blog/2119/quicklogin-plugin-for-wordpress</link>
		<comments>http://www.red-sweater.com/blog/2119/quicklogin-plugin-for-wordpress#comments</comments>
		<pubDate>Sun, 07 Aug 2011 18:49:37 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=2119</guid>
		<description><![CDATA[This blog runs on WordPress, which has been a great solution for my needs. But as the developer of MarsEdit, you might guess I get the opportunity to see a whole heckuva lot of other systems, and sometimes find myself envious of their advantages, big and small. One such advantage I noticed is that Squarespace [...]]]></description>
			<content:encoded><![CDATA[<p>This blog runs on <a href="http://wordpress.org/">WordPress</a>, which has been a great solution for my needs. But as the developer of <a href="http://www.red-sweater.com/marsedit/">MarsEdit</a>, you might guess I get the opportunity to see <em>a whole heckuva lot</em> of other systems, and sometimes find myself envious of their advantages, big and small.</p>
<p>One such advantage I noticed is that <a href="http://www.squarespace.com/">Squarespace</a> users can log in from any page on their blog, just by <a href="http://help.squarespace.com/customer/portal/articles/10974-i-hid-my-login-prompt-on-my-website-how-do-i-log-in-now-">pressing the escape key</a>.</p>
<p>By default, WordPress requires that you either memorize the admin page URL, or list an ugly &#8220;Login&#8221; link i the blog&#8217;s template. I never liked the idea of having a login link for a site that <em>only I should ever be logging in to</em>, so for years I have omitted the login link from my site.</p>
<p>This means that when I&#8217;m reading comments or something on my site, and am not logged in, I have to do a silly dance before I respond or moderate a comment:</p>
<ol>
<li>Go to the URL bar in my browser.</li>
<li>Change URL to /wp-admin/</li>
<li>Enter the proper login credentials.</li>
<li>Hit back button to get back where I was.</li>
<li>Reload the page to see the comment form as a logged-in user.</li>
</ol>
<p>This ends today. My <a href="https://github.com/danielpunkass/QuickLogin">QuickLogin Plugin</a> for WordPress is a drop-in solution that, when activated, gives your WordPress blog the same delicious escape-key behavior that Squarespace offers. Now when I am browsing my own blog and want to log in, I just press the escape key. After I authenticate, I&#8217;m automatically returned to the reloaded page I was viewing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/2119/quicklogin-plugin-for-wordpress/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>WordPress To Disable Remote Access</title>
		<link>http://www.red-sweater.com/blog/512/wordpress-to-disable-remote-access</link>
		<comments>http://www.red-sweater.com/blog/512/wordpress-to-disable-remote-access#comments</comments>
		<pubDate>Tue, 24 Jun 2008 18:32:48 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[MarsEdit]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=512</guid>
		<description><![CDATA[The WordPress developers have decided that, starting with WordPress 2.6, access to the XMLRPC and AtomPub-based remote publishing interfaces will be disabled by default. Users who wish to use a remote client such as MarsEdit will have to go out of their way to enable the required functionality in their blog&#8217;s settings. There are good [...]]]></description>
			<content:encoded><![CDATA[<p>The WordPress developers have decided that, starting with WordPress 2.6, access to the XMLRPC and AtomPub-based remote publishing interfaces <a href="http://westi.wordpress.com/2008/06/20/making-the-default-install-more-secure/">will be disabled by default</a>. Users who wish to use a remote client such as <a href="http://www.red-sweater.com/marsedit/">MarsEdit</a> will have to go out of their way to enable the required functionality in their blog&#8217;s settings.</p>
<p>
There are good arguments for this, at least on the face of things. They can be packed into a nutshell: <strong>it <em>may</em> reduce the security risks of having these access points opened by default.</strong>
</p>
<p>
But in my opinion, there are also good arguments to be made for <em>rejecting the change</em> as a damaging and misguided solution.
</p>
<p>
First, and obviously near to my heart, is the fact that this <strong>marginalizes remote clients.</strong> For users who would find value in a remote client, this decision will put one more roadblock in their way. Historically, the remote editor interface is already compromised such that remote editors do not have access to all the same functionality as the web interface.  With this change in place, things get even worse. While a screen-scraping application will easily log in and authenticate a fragile WordPress session via the web interface, the well-behaved API clients will be refused access by default. All in the name of improving security.
</p>
<p>
Second, and probably most important, is that this is <strong>not a fundamental security improvement</strong>. Consider a bank with two sets of automated cash machines: one for drive-through cars, and one for walk-up pedestrians.  Two vastly different sets of customers are being served securely by different interfaces, yet the transactions are secure because they ultimately travel through the same bottlenecked safeguard. A fundamental design consideration on the part of the bank is that these two classes of customer are equally important, and each deserves unfettered access.
</p>
<p>
WordPress&#8217;s decision to shut off remote access by default is analogous to a bank offering unrestricted drive-through access to its cash machines, while requiring pedestrians to ring a bell and wait for a security guard to open the door to the machines.
</p>
<p>
Also worth considering: if a service is disabled by default for security considerations, what message does that send to people who choose to, or who are encouraged to turn the service back on? It sets up a perception of insecurity which may not even be warranted. If the remote publishing interfaces are insecure, they should be fixed, not merely disabled!
</p>
<p><h3>A Real Solution</h3>
</p>
<p>
If I&#8217;m so smart, what should WordPress be doing instead?  A real security improvement would be bottlenecking all access to the blog&#8217;s vital authorized content, and making sure that the remote APIs and the web interface all go through the same interface.
</p>
<p>
In my opinion, an entire class of problems with WordPress (and other blogging systems) stems from this interface bifurcation. Establishing a single interface to WordPress would be comparable to the  &#8220;pin code + card&#8221; interface at your bank.  You pass through it by car, on foot, and even at the counter when they ask you to swipe before doing any transaction.
</p>
<p>
If you&#8217;ve only got one &#8220;real API&#8221; that touches the critically important data, then you&#8217;ve only got one door to secure. Furthermore, when all views into the blog are required to share the same API, suddenly none of them is deprived of functionality that the other has.
</p>
<p>
Imagine if the API that the web interface uses to access all features of a blog could be just as easily employed by MarsEdit or any other application you authorized. The end result would be lots less work &#8220;playing catch up&#8221; for the XMLRPC and Atom developers, and more time focusing on innovative and cool features <em>for all blog users</em>.
</p>
<p>
If this sounds like a pipe dream, it&#8217;s worth pointing out that one very popular web service is already employing this strategy, and it works brilliantly. <a href="http://flickr.com/">Flickr</a>, Yahoo&#8217;s incredibly popular photo sharing site, is built on the <a href="http://www.flickr.com/services/api/">very same APIs</a> it makes available to clients. This results in some truly incredible <a href="http://connectedflow.com/flickrexport/">Flickr-enabled applications</a> and web services. And you don&#8217;t see any sign of Flickr disabling access to their API, because there&#8217;s too much at stake.
</p>
<p>
If your web service only provides one, first-class API through which all access flows, then you&#8217;ve only got one point to secure, you&#8217;re likely to have feature parity across interfaces, and the risk of marginalizing one interface is dramatically decreased.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/512/wordpress-to-disable-remote-access/feed</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
		<item>
		<title>If Your WordPress Was Hacked</title>
		<link>http://www.red-sweater.com/blog/509/if-your-wordpress-was-hacked</link>
		<comments>http://www.red-sweater.com/blog/509/if-your-wordpress-was-hacked#comments</comments>
		<pubDate>Fri, 20 Jun 2008 18:41:47 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=509</guid>
		<description><![CDATA[A few releases back, WordPress had a vulnerability that many spam injection &#8230; bastards &#8230; took advantage of. I am not too proud to admit that I was myself a victim of this vulnerability, even though I update pretty religiously to the latest release of WordPress. I noticed over the past few weeks that even [...]]]></description>
			<content:encoded><![CDATA[<p>A few releases back, WordPress had a vulnerability that many spam injection &#8230; <strong>bastards</strong> &#8230; took advantage of.  I am not too proud to admit that I was myself a victim of this vulnerability, even though I update pretty religiously to the latest release of WordPress.</p>
<p>
I noticed over the past few weeks that even though I had updated to the latest WordPress release, which is supposed to be free of vulnerabilities, I was repeatedly having spam links injected into the footer.php file in my theme. Frustrated, I went to some of my friends on the WordPress team, and they pointed me at a <a href="http://ocaoimh.ie/2008/06/08/did-your-wordpress-site-get-hacked/">great article from Donncha O Caoimh</a>:
</p>
<blockquote><p>
Unfortunately for some who did upgrade, it was too late. The hacker slimeballs may have known about the security issues before we did and went about their merry way breaking into blogs and websites, grabbing usernames and passwords, and planting backdoor scripts to log them in again at a later date.
</p></blockquote>
<p>
In this article, Donncha gives an extremely thorough and authoritative treatment of the problem. If you have been the victim of this nasty attack, or even if you don&#8217;t know whether you have, it would be worthwhile to review the article and see how your WordPress install stands up to the scrutiny suggested there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/509/if-your-wordpress-was-hacked/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Check Your WordPress Security</title>
		<link>http://www.red-sweater.com/blog/488/check-your-wordpress-security</link>
		<comments>http://www.red-sweater.com/blog/488/check-your-wordpress-security#comments</comments>
		<pubDate>Mon, 14 Apr 2008 19:01:06 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[MarsEdit]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=488</guid>
		<description><![CDATA[Matt Mullenweg from the WordPress team has posted a message about the security of WordPress, which MarsEdit users who run WordPress should take a look at. It&#8217;s particularly timely because there are a number of attacks going around that impact older WordPress blogs that haven&#8217;t been updated to to the most recent version. In my [...]]]></description>
			<content:encoded><![CDATA[<p>Matt Mullenweg from the WordPress team has posted a message about the <a href="http://ma.tt/2008/04/securityfocus-sql-injection-bogus/">security of WordPress</a>, which MarsEdit users who run WordPress should take a look at. It&#8217;s particularly timely because there are a number of attacks going around that impact older WordPress blogs that haven&#8217;t been updated to to the most recent version.</p>
<p>
In my customer support for MarsEdit, I have been seeing these security problems pop up quite a bit lately. The so-called &#8220;spam injection&#8221; attacks often inject spam links at the oblivious expense of how these links might mess up the XMLRPC interface which blog clients such as MarsEdit use to interact with your blog. It&#8217;s gotten to the point where error messages from the blog such as &#8220;Parse error. Not well formed.&#8221; are almost certain to be symptoms of such a spam injection attack. Updating to the latest WordPress almost always fixes the problem immediately.
</p>
<p>
Matt&#8217;s advice is pretty basic: update to the latest WordPress, and check your posts for signs of tampering. But it&#8217;s nice to have advice &#8220;from the top,&#8221; so to speak. I will be glad to see this wave of blog-attacks pass us by as more and more users get updated to the latest release of WordPress.
</p>
<p>
I commented on the post, suggesting that what WordPress would really benefit from is some kind of automated updater, so that users can easily update without having to worry about whether they&#8217;re doing it right or whether they&#8217;ll mess up their blog. The great news is Matt replied saying that they are in fact working on such a feature for 2.6.
</p>
<p>
Looking forward to a built-in automatic updater for WordPress! But in the mean time, be sure to stay current so you avoid the nasty attacks that are going around.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/488/check-your-wordpress-security/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress 2.5</title>
		<link>http://www.red-sweater.com/blog/483/wordpress-25</link>
		<comments>http://www.red-sweater.com/blog/483/wordpress-25#comments</comments>
		<pubDate>Sat, 29 Mar 2008 22:03:56 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[MarsEdit]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=483</guid>
		<description><![CDATA[Congratulations to the WordPress team and the more than 100 contributors who helped to bring this release to the public today. There are loads of changes, which you can read about in the announcement blog post. Among the most interesting changes for MarsEdit users is the addition of more intelligent &#8220;post status&#8221; information for blog [...]]]></description>
			<content:encoded><![CDATA[<p>Congratulations to the WordPress team and the more than 100 contributors who helped to bring this release to the public today.</p>
<p>
There are loads of changes, which you can read about in the <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/">announcement blog post</a>. Among the most interesting changes for MarsEdit users is the addition of more intelligent &#8220;post status&#8221; information for blog editor clients. Practically speaking, this means the problems I described in my MarsEdit 2.1 announcement will no longer be an issue for WordPress 2.5 users.
</p>
<p>
<strong>But&#8230;</strong> Ugh, it looks like I messed something up and MarsEdit 2.1.2 doesn&#8217;t accurately detect these statuses on WordPress posts. I will try to get a 2.1.3 out soon that fixes this so we can put the post status problem with WordPress behind us for good.
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/483/wordpress-25/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>The Broken Web Editor</title>
		<link>http://www.red-sweater.com/blog/475/the-broken-web-editor</link>
		<comments>http://www.red-sweater.com/blog/475/the-broken-web-editor#comments</comments>
		<pubDate>Fri, 29 Feb 2008 19:00:59 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[MarsEdit]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/475/the-broken-web-editor</guid>
		<description><![CDATA[I often explain the benefits of MarsEdit starting with a premise that editing on the desktop beats editing in a web browser. I believe this to be true even when the playing field is level, and web interfaces are operating at their best. Unfortunately, thanks to a large number of ever-changing browser environments, web interfaces [...]]]></description>
			<content:encoded><![CDATA[<p>I often explain the benefits of <a href="http://www.red-sweater.com/marsedit/">MarsEdit</a> starting with a premise that editing on the desktop beats editing in a web browser. I believe this to be true even when the playing field is level, and web interfaces are operating at their best. Unfortunately, thanks to a large number of ever-changing browser environments, web interfaces frequently don&#8217;t operate at their best. This is part of the nature of that beast. Often, web-based editors provide more frustration than convenience.</p>
<p>
Recently there has been an increase of new MarsEdit buyers who cite as their motivation a frustration with the <a href="http://www.wordpress.org/">WordPress</a> web editor. I respect and admire the WordPress team. In fact, their web interface is among the best out there. But even in the best of circumstances, it&#8217;s hard to compete with the usability of a desktop app. And when something goes bad, it becomes downright impossible.
</p>
<p>
Currently the situation is especially bad for people who use  WordPress with Safari. For whatever reason these two pieces of software have fallen slightly out of accord. It&#8217;s common to hear tales of people who use Safari for &#8220;everything but WordPress.&#8221;<strong> In short, WordPress has a reputation for messing up or even eliminating parts of your post when using the web-based editor in Safari.</strong> I know, because I see the comments of my customers and would-be customers on the web. There is a chorus of confirmation for this problem.
</p>
<p>
I look forward to WordPress and Safari ironing out their differences. I don&#8217;t relish earning customers purely out of frustration with the competition. I prefer to attract customers by exceeding baseline functionality than by my competitors failing to meet it. But if you&#8217;re tired of doing battle with the WordPress editor in Safari, or any other browser for that matter, it&#8217;s a good time to remember that MarsEdit is here for you.
</p>
<p>
I welcome those users who arrive out of desperation, and am hopeful they will find much more than baseline functionality to be delighted with in MarsEdit.
</p>
<p>
<strong>Update:</strong> Lloyd Budd, who is the quality lead for WordPress, has coincidentally written today on the very subject of <a href="http://foolswisdom.com/surfin-wordpress-25-with-safari-3/">Safari and WordPress</a>. He predicts that major improvements are in store with WordPress 2.5:
</p>
<blockquote><p>&#8220;With Safari 3 and WordPress 2.5 you should finally have a great experience if Safari is your preferred browser.&#8221;</p></blockquote>
<p>
This is great news for everybody. I think your experience will be <em>greater still</em> in MarsEdit, but happy WordPress customers are great for the blogging industry in general.
</p>
<p>
<strong>Update 2:</strong> For some reason this post ended up with comments disabled. I don&#8217;t know yet if it&#8217;s a bug in MarsEdit, WordPress, or the author. I have enabled them, now. I welcome your opinions!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/475/the-broken-web-editor/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Livin&#8217; in a WordPress Hacker&#8217;s Paradise</title>
		<link>http://www.red-sweater.com/blog/141/livin-in-a-wordpress-hackers-paradise</link>
		<comments>http://www.red-sweater.com/blog/141/livin-in-a-wordpress-hackers-paradise#comments</comments>
		<pubDate>Mon, 05 Jun 2006 17:22:21 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/141/livin-in-a-wordpress-hackers-paradise</guid>
		<description><![CDATA[I have been happily using WordPress as the infrastructure for this blog since its inception, almost one year ago. Since I&#8217;m perhaps slightly geekier than than the average WordPress customer, I have been wanting to get to know the sources a bit better and possibly make my own tweaks or write plugins to suit my [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css"><!-- .caption { border-style:dashed; border-width:1px; border-color:#BBBBBB; margin-left:20px; padding:10px;}--></style>
<p>
I have been happily using <a href="http://wordpress.org/">WordPress</a> as the infrastructure for this blog since its inception, almost one year ago. Since I&#8217;m perhaps slightly geekier than than the average WordPress customer, I have been wanting to get to know the sources a bit better and possibly make my own tweaks or write plugins to suit my particular needs.  I also like to keep up to date with the latest versions of the software. The problem is that these activities are at odds with each other. See, if you don&#8217;t tweak anything, updating is a simple matter of &#8220;un-tarring&#8221; the package file over your existing installation and visiting the &#8220;update.php&#8221; URL. But if you&#8217;ve made any sneaky changes, you&#8217;re liable to overwrite them when you clobber a source file with the updated version.
</p>
<p>
This situation has led me to an unfortunate state of moaning about having to install WordPress updates. This is bad, because often the small updates contain security fixes, which are exactly the kind of thing I should want to install immediately. Furthermore, I&#8217;d like to stop editing WordPress with vi on the server, and searching the source base with grep. I&#8217;m proficient with these tools, but I have a Mac! It&#8217;s better at such things.
</p>
<p>
I need absolute WordPress control. Specifically, I need to be able to:</p>
<p><ol>
<li>Install WordPress updates with ease and confidence.</li>
<li>Hack on WordPress and test results on my Mac before updating the live blog.</li>
<li>Do so in a way that meshes with my regular work habits.</li>
</ol>
<p>
How do I address this? The problem screams for <a href="http://subversion.tigris.org/">Subversion</a> and <a href="http://developer.apple.com/tools/xcode/">Xcode</a>, so that&#8217;s what I will throw at it. By integrating my WordPress hacking with Apple&#8217;s Xcode, I can treat the technical underpinnings of my blog just like I would any other code project. I spend so much of my day &#8220;building and running&#8221; that it&#8217;s distracting when any technical project does not fit in with that process.
</p>
<p><h4>Step 1: Get Things Under Control</h4>
</p>
<p>
Source control, that is. I decided that I needed a single repository where both my live web site and local Mac could access the same WordPress sources. That means I need an SVN server accessible from both locations, as well as Subversion client tools in each location. Luckily <a href="http://www.dreamhost.com/r.cgi?116511">DreamHost</a> comes standard with Subversion support (minor gripe: they&#8217;re stuck on version 1.1!). If your web host doesn&#8217;t offer Subversion, you might be out of luck for this particular round of magic.
</p>
<p>
Typically with Subversion repositories, the &#8220;mainline&#8221; of the project is identified as a subdirectory of the repository called &#8220;trunk.&#8221; In my case, I don&#8217;t control the mainline of WordPress, so I&#8217;m choosing more clear identifications. My repository is &#8220;all branches,&#8221; if you will, so I&#8217;m not including any folder called trunk, though &#8220;official&#8221; is the closest thing to being that:
</p>
<div class="caption">
<pre>
% svn ls file:///home/jalkut/svn/opensource/wordpress/
hacking/
official/
redsweater/
redsweater-assets/
</pre>
</div>
<p>
What I&#8217;ve done here is take advantage of the &#8220;smart copying&#8221; in Subversion. I started the repository out with &#8220;official,&#8221; containing the latest 2.0.3 release of WordPress. I then copied that in the repository to &#8220;redsweater&#8221; and carefully copied all of custom bits and pieces in. If you do this right, only the customized parts take up repository disk space. Everything that&#8217;s the same is shared in the database. The custom bits include the database configuration, custom themes, installed plugins, images, etc.
</p>
<p>
Where possible, I took advantage of a feature in Subversion called &#8220;svn:externals.&#8221; This lets you specify points in the project hierarchy that, when encountered, will trigger a checkout from a different repository. It&#8217;s sort of like an NFS Mount-Point right in Subversion. In the mysterious &#8220;redsweater-assets&#8221; repository folder above, I&#8217;ve added folders for most of my custom  elements. So when I checkout &#8220;redsweater&#8221; and Subversion gets down to the &#8220;themes&#8221; section, it notices that it needs to checkout my custom theme from the redswetaer-assets/themes repository folder. This technique works great in almost every area of WordPress, except for the plugins directory. Because svn:externals can only specify a directory, it breaks down when one would hope to use it to plop individual files down into a checked out directory. I imagine this limitation comes from the fact that every folder in a working directory has a single &#8220;.svn&#8221; folder for tracking the entries at that level. Therefore, a directory of assets from mixed repositories would be tricky.
</p>
<p>
Even with the svn:externals shortcomings, the setup works pretty well now. I have a &#8220;redsweater&#8221; branch that I can integrate changes into, and then update my web site directly from the command line. At any time, I can examine the differences between my customized branch of WordPress and the official release I last integrated with. Comfort!
</p>
<p><h4>Step 2: Integrate with Xcode</h4>
</p>
<p>
The Subversion infrastructure goes a long way toward calming my nerves about integration and updates. I can carefully stage any update by first updating and testing it on my local machine. That&#8217;s cool, but it&#8217;s not really good enough. I want to be able to hack the heck out of it on my local machine (Note: You need to install a PHP-compatible Apache server before you can really do this on your Mac). Furthermore, I want to possibly be able to maintain a separate, highly experimental copy of WordPress for days, weeks, or months while I continue to serve (and perhaps update) the more stable version of the blog from my site. It&#8217;s time to look at the &#8220;hacking&#8221; branch that I hinted at above.
</p>
<p>
The hacking branch started life as a copy of the redsweater branch. I want it to closely mimic my real blog, but I want to have freedom to mess around with it big time. So the first thing I altered after copying the branch over was the wp-config.php. Instead of pointing to my live database, I pointed to a local MySQL database on my Mac (yet another custom install, sorry!). This database contains a subset of my live blog&#8217;s content. The idea is it&#8217;s a totally safe sandbox for me to work in. I can add comments, posts, pages, etc. I can delete everything and start from scratch. I can even post drafts of my entries from MarsEdit to see how they&#8217;ll <em>really</em> look when they finally go live. The ultimate preview! One of the things I&#8217;ve noticed so far in hacking on WordPress is that I need to provoke different situations before I can play around with the behavior. For instance, if I want to tweak the spam-filtering behavior, I have to first cause a spammy comment to appear on the blog. I don&#8217;t like doing this on the live blog, but fake spam comments are fine in my sandbox.
</p>
<p>
What else does the hacking branch contain? This is where it gets fun. The branch contains an Xcode project file, and supporting shell scripts to facilitate a streamlined development process. First I added all the WordPress sources to the project, for easy global search &#038; replace. It&#8217;s amazing how much faster you can get to know the project when you get a &#8220;birds-eye view&#8221; from Xcode:
</p>
<p>
<img src="http://www.red-sweater.com/blog/images/WPXcodeSearch.jpg"/>
</p>
<p>
I find that I understand a project much better even by doing simple tweaks like globally replacing something so that it behaves differently. When I can observe the changes, it connects my test changes to the project&#8217;s design as a whole.
</p>
<p>
Next up I attacked the problem of &#8220;fixing the workflow.&#8221; What does it mean to &#8220;build &#038; run&#8221; a WordPress project in Xcode? I decided that building WordPress means &#8220;copying the files into my local web server directory,&#8221; and running it means &#8220;opening a suitable URL in my web browser.&#8221; To that end, I added a single  target to the Xcode project, &#8220;Install Local,&#8221; which is a simple copy files build phase target. It takes all the specified files and plops them over to the &#8220;blog&#8221; subdirectory of my local test server:
</p>
<p>
<img src="http://www.red-sweater.com/blog/images/WPCopyFilesBuild.jpg"/>
</p>
<p>
Sweet! Now when I want to try out my changes, I can just press Cmd-B to build and then load up my localhost URL in Safari. But the scenario isn&#8217;t quite complete. When I build an <em>application</em> in Xcode, I don&#8217;t have to navigate to the Finder, find the resulting product, and double-click it. Why should I have to go manually reload this web page? With Xcode custom executables, I don&#8217;t. I added a couple shell scripts to my &#8220;hacking&#8221; tree that, when specified as custom executables, simply cause the local blog to open up in the default browser. This trick is accomplished with some simple AppleScript bridging:
</p>
<div class="caption">
<pre>
#!/bin/sh
osascript -e "open location \"http://localhost/blog/\""
</pre>
</div>
<p>
For every commonly debugged location in the blog, you can just pop another custom executable into the project with a slightly different blog URL. Then you select the desired executable from Xcode and &#8220;run&#8221; the project to see how your results are shaping up.
</p>
<p>
Now I can make changes, build, run, examine the results, and even use Xcode&#8217;s built-in Subversion features to review what I&#8217;ve changed!
</p>
<p>
<img src="http://www.red-sweater.com/blog/images/WPXcodeSCM.jpg"/>
</p>
<p>
If you want a head start at making your own WordPress hacker&#8217;s paradise, you can download and plop my <a href="http://www.red-sweater.com/blog/downloads/WPXcodeProject.zip">WordPress Xcode Project</a> files into your own local WordPress &#8220;hacking&#8221; directory. It should work just fine with a standard 2.0.3 copy of the sources. The archive includes the Xcode project itself as well as a couple example &#8220;executable&#8221; scripts.
</p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/141/livin-in-a-wordpress-hackers-paradise/feed</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Smokin&#8217; Fast Blog</title>
		<link>http://www.red-sweater.com/blog/128/smokin-fast-blog</link>
		<comments>http://www.red-sweater.com/blog/128/smokin-fast-blog#comments</comments>
		<pubDate>Sat, 29 Apr 2006 21:53:10 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/128/smokin-fast-blog</guid>
		<description><![CDATA[I spent a large part of today &#8220;under the hood&#8221; working on this blog&#8217;s WordPress-based engine. My head hurts from all the PHP, but I am pretty happy with the results. What was I doing? Optimizations for CPU and bandwidth efficiency. I have been pumping up DreamHost since I moved over to them a couple [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a large part of today &#8220;under the hood&#8221; working on this blog&#8217;s WordPress-based engine. My head hurts from all the PHP, but I am pretty happy with the results.  What was I doing? Optimizations for CPU and bandwidth efficiency. </p>
<p>
I have been pumping up <a href="http://www.dreamhost.com/r.cgi?116511">DreamHost</a> since I moved over to them a couple weeks ago. They&#8217;re still awesome, but the honeymoon did end a little bit when I got an email from them notifying me that I was exceeding my daily CPU usage allotment. Hmm? I had never even considered this before. I guess I just took for granted that servers were good and fast and they made it all work. I didn&#8217;t consider that with a virtually unlimited bandwidth quota, I would have to watch my step with how hard the server was working to fill that pipe.
</p>
<p>
I&#8217;ve been oblivious to web performance considerations, for the most part. This wake-up call from DreamHost inspired me to finally take the problems by the horns. When your site only gets a half-dozen hits per day, who cares how well it performs?.  But as my traffic continues to increase, I&#8217;m starting to look at things more and more like a webmaster.
</p>
<p>
Some time ago I was chatting with John Gruber about the merits of WordPress vs. Moveable Type. He pointed out that WordPress, with its dynamic content generation, was a lot less likely to stand up to a major traffic burst than Moveable Type with its static generation. Frankly, it was the first time I&#8217;d even considered the issue &#8211; and it scared me so much it almost made me want to jump ship from WordPress. How could it be so inefficient? Basically every WordPress blog comes standard with a complete and utter inability to stand up to being slashdotted? Given the amount of traffic Daring Fireball must receive, it&#8217;s no surprise that John&#8217;s <a href="http://daringfireball.net/linked/2006/april#thu-27-flat_files">thought about this problem</a> a lot.
</p>
<p>
But what was I going to do? Switch from WordPress? Please, no! Thankfully, the amazing <a href="http://mnm.uib.es/gallir/wp-cache-2/">WP-Cache</a> WordPress plugin basically fixes all that. By saving a static copy of every dynamically generated request response, it achieves the best of both worlds by allowing content to be dynamically generated, but letting it stick around for a while on disk for future servings. Today I installed and activated the plugin. When the cache is on, every request that is answered gets appended with an HTML comment describing whether the request was cached or dynamically created, and how long the original dynamic creation took.  I was curious to know how much time I was saving on the cached copies, so I hacked the plugin to also print a timestamp when the cached version is served. The results are pretty impressive. For example, on one entry I just looked at from my browser:
</p>
<p><pre>
&lt;!-- Dynamic Page Served (once) in 0.453 seconds -->
&lt;!-- Cached page served by WP-Cache in 0.002999 seconds -->
</pre>
</p>
<p>
In other words, it went from almost a half-second to almost no time at all. A huge reduction, most of which I assume would be spent as CPU time in the dynamic case. Curious about whether the cache saved you any time just now? Just look at the source for this web page or RSS feed, at the very bottom you&#8217;ll see a comment about the dynamic generation time. If it was cached, you&#8217;ll see a second comment about that. I haven&#8217;t exactly figured out everything that stimulates a cache flush for a particular URL, and it&#8217;s possible that the flushing is a little overly-cautious, but at least it&#8217;s not serving stale data.
</p>
<p>
Being so pleased with the caching success, I was in the mood to keep improving things. A reader pointed out a problem a couple months ago, which I&#8217;ve been meaning to look into. They had installed the latest beta of <a href="http://ranchero.com/netnewswire/">NetNewsWire</a> and noticed in that application&#8217;s &#8220;Bandwidth Statistics&#8221; window, my blog was at the top of the heap for bandwidth used. The problem?  A combination of my notoriously long posts, a fairly large &#8220;item count&#8221; for the feed, and a flaw in WordPress 2.0.2 that causes it to not properly return 304 (Not Modified) responses to clients who ask politely whether there have been any changes. So every time NetNewsWire refreshed, it would grab the full text of my last 10 posts!
</p>
<p>
Today I searched the web and found out that the 304 issue was in fact addressed, and <a href="http://trac.wordpress.org/changeset/3682">the change</a> is so simple I could type it in to the sources myself. Yee haw! I made the change and rushed over to NetNewsWire to try it out for myself. Alas, it still wasn&#8217;t working. The problem now? WP-Cache doesn&#8217;t seem to have any mechanism for supporting such a response, and since it essentially &#8220;takes over&#8221; when serving a cached copy, WordPress never gets a chance to respond. I&#8217;m not 100% sure I did this right, but I managed to hack up the WP-Cache plugin so it looks for the &#8220;If-Modified-Since:&#8221; header and, if it the specified date is not earlier than the cached copy, returns a 304 response. Seems pretty straightforward, but I&#8217;m nervous enough about it that I&#8217;ll postpone sharing the code until it&#8217;s had a chance to simmer.
</p>
<p>
These changes should have a positive effect on both my bandwidth (for whatever it&#8217;s worth) and CPU usage. But more importantly to you, they mean faster page loads in your browser, and faster subscription refreshes in your aggregator. And hopefully I&#8217;ll fall out of first place in your NetNewsWire bandwidth abusers list!
</p>
<p>
<strong>Update:</strong> My changes to WP-Cache seem pretty stable in that they&#8217;ve been running on my blog for a week or so. If anybody is interested you can download the modified file <a href="http://www.red-sweater.com/free/WP-Cache-Mods.zip">here</a>. The only change is to the phase1 script. The mods add support for 304 responses even on cached items, and for printing the elapsed time of page load even when cached.
</p>
<p>
Let me know if you have any feedback!
</p>
</p>
<p><strong>Update: If you are using PHP5, you will want to make a minor tweak to WP-Cache to fix a &#8220;blank pages&#8221; bug. See <a href="http://www.bloggingblog.net/wp-cache-and-the-blank-page-problem/">this page</a> for more information.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/128/smokin-fast-blog/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

