<?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>SAOB &#124; Senseless Acts of Beauty &#187; Gravityone</title>
	<atom:link href="http://www.saobart.com/author/gravityone/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.saobart.com</link>
	<description>The Work, Blog, and Art of Christopher Beaven</description>
	<lastBuildDate>Sat, 29 May 2010 17:13:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MD5 Hash in Objective-C</title>
		<link>http://www.saobart.com/md5-has-in-objective-c/</link>
		<comments>http://www.saobart.com/md5-has-in-objective-c/#comments</comments>
		<pubDate>Mon, 10 May 2010 00:54:23 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[OSX Development]]></category>
		<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=666</guid>
		<description><![CDATA[After too much time spent searching the web via Google and getting a bunch of half answers and unfinished code for, what I though should be a very simple problem, I decided to make this post about how to create an MD5 hash from a string in Objective-c. My pain began when I decided to [...]]]></description>
			<content:encoded><![CDATA[<p>After too much time spent searching the web via Google and getting a bunch of half answers and unfinished code for, what I though should be a very simple problem, I decided to make this post about how to create an MD5 hash from a string in Objective-c.<span id="more-666"></span></p>
<p>My pain began when I decided to learn objective-c to build an OSX application using the <a title="the remember the milk api REST informational page" href="http://www.rememberthemilk.com/services/api/">Remember The Milk API</a> and after a bit of reading over their documentation realizing that the authorization can be a bit complex. I know that for some objective-c maybe as easy as breathing but let me just say that this is the first time I have ever attempted working with an API using <a title="Documentation on the REST protocol" href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a>, and also this is the first time attempting to build an application on the MAC, but I have had some experience building iPhone applications. So needless to say I am a beginner at this.</p>
<p>Now, for many online API&#8217;s there needs to be some kind of authorization that happens, which makes since, and the Remember The Milk REST API requires that you send a correctly formatted URL to them. One of the major parts of this url is the signature. The REST signature is a combination of several different strings tied together and hashed using MD5. It may be good to note here that MD5 is NOT encryption, and never use it as such. Its basically my understanding that all MD5 does is take a string and produce a binary code that can be decoded just about anywhere. So all in all after the signature is hashed using MD5 it should look something like this.</p>
<p>00be938d9cab78d2e24dfa21f40f4e0caf1</p>
<p>Yeah, just a bunch of gibberish. Notice that its all lowercase, more on that in a bit.</p>
<p>Ok, regardless of what its going to be used for the basic need here is to take a string(any string) turn it into an MD5 hash then return that has as a UTF-8 encoded string. The reason for the UTF-8 encoding si that most of these REST API&#8217;s call for it. Unfortunately Cocoa doesn&#8217;t seem to have any nice and simple method to produce an MD5, even after hour of searching on the net I still find this hard to believe. It would be so nice if we could just do this: md5(&#8216;mystring&#8217;) and get a nicely formatted string.</p>
<p>For my project I created a class called Utilities and placed the following method there. This is a good idea because we really want this method to be reusable for every project that we may undertake, but all we want to have to do is include these file in our project and have the functionality easily accessible.</p>
<p><strong><em>Utilities.h</em></strong></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;Cocoa/Cocoa.h&gt;</span>
<span style="color: #6e371a;">#import &lt;CommonCrypto/CommonDigest.h&gt;</span>
<span style="color: #a61390;">@interface</span> Utilities <span style="color: #002200;">:</span> <span style="color: #400080;">NSObject</span> <span style="color: #002200;">&#123;</span>
&nbsp;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #11740a; font-style: italic;">//generates md5 hash from a string</span>
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> returnMD5Hash<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>concat;
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>As you can see from above you will need to Import &lt;CommonCrypto/CommonDigest.h&gt; into your class, which provides some cryptographic voodoo which I am not bothering to learn unless absolutely necessary.  Next is the normal @interface, then the class method to produce an MD5 hash.</p>
<p><strong><em>Utilities.m</em></strong></p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &quot;Utilities.h&quot;</span>
<span style="color: #a61390;">@implementation</span> Utilities
&nbsp;
<span style="color: #11740a; font-style: italic;">//generate md5 hash from string</span>
<span style="color: #002200;">+</span> <span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span> returnMD5Hash<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><span style="color: #400080;">NSString</span><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>concat <span style="color: #002200;">&#123;</span>
    <span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>concat_str <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>concat UTF8String<span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> result<span style="color: #002200;">&#91;</span>CC_MD5_DIGEST_LENGTH<span style="color: #002200;">&#93;</span>;
    CC_MD5<span style="color: #002200;">&#40;</span>concat_str, <span style="color: #a61390;">strlen</span><span style="color: #002200;">&#40;</span>concat_str<span style="color: #002200;">&#41;</span>, result<span style="color: #002200;">&#41;</span>;
    <span style="color: #400080;">NSMutableString</span> <span style="color: #002200;">*</span>hash <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSMutableString</span> <span style="color: #a61390;">string</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">for</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">int</span> i <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>; i &lt; <span style="color: #2400d9;">16</span>; i<span style="color: #002200;">++</span><span style="color: #002200;">&#41;</span>
        <span style="color: #002200;">&#91;</span>hash appendFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%02X&quot;</span>, result<span style="color: #002200;">&#91;</span>i<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
    <span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span>hash lowercaseString<span style="color: #002200;">&#93;</span>;
&nbsp;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></div></div>

<p>Above is the objective-c class method used to return a MD5 hash. All you would need to do is call the class method within any other class in your project like this.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>rtmApiSig <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>Utilities returnMD5Hash<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSString</span> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%@api_key%@method%@&quot;</span>, rtmSecret, rtmApiKey, rtmMethod<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>This is the actual code that I used for my Remember The Milk signature. A more simple way to demonstrate the usage of this would be.</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>myMD5String <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>Utilities returnMD5Hash<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;test&quot;</span><span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>This will produce, <strong>098f6bcd4621d373cade4e832627b4f6</strong>. You can test your results by using <a title="Test or compare your generated md5 hash to see if its correct" href="http://www.adamek.biz/md5-generator.php">this great tool</a>.</p>
<p>One of the problems that I ran into is that most REST API&#8217;s require the hash to be lowercase and after wondering for to long of why the heck it wasn&#8217;t working I used that tool to figure out that the hash I was producing was incorrect, so I quickly changed the method to produce a lowercase string and everything was fixed.</p>
<p>So, now you should have a new utilities class which you can start piling with things like this for easy reuse in everyone of your projects. I haven&#8217;t done any extensive testing but you should be able to use this code for an iPhone application. But one thing I am sure about is that you can use this MD5 has for the Remember The Milk API or the Flickr API.</p>
<p><strong>Please let me know if you have any questions or maybe even a better way of doing this, I will try to answer quickly.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/md5-has-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Graphic Creations Design &amp; Development</title>
		<link>http://www.saobart.com/graphic-creations-design-development/</link>
		<comments>http://www.saobart.com/graphic-creations-design-development/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 23:08:29 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=571</guid>
		<description><![CDATA[A new site that I designed and coded is about to go live after a few changes from the client. This is just a quick post to show a bit of the evolution of their current website to the proposed design and then the final draft. &#8230; As you can see the final design has [...]]]></description>
			<content:encoded><![CDATA[<p>A new site that I designed and coded is about to go live after a few changes from the client. This is just a quick post to show a bit of the evolution of their current website to the proposed design and then the final draft.</p>
<p><img class="alignnone size-full wp-image-597" title="Graphic-Creations-single-top" src="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/Graphic-Creations-single-top.jpg" alt="" width="590" height="370" /></p>
<p><span id="more-571"></span></p>
<div style="margin: 20px 0; padding: 20px 0; border: 1px #ccc solid; border-width: 1px 0;">
<div id="attachment_572" class="wp-caption alignleft" style="width: 160px"><a class="thickbox" rel="lightbox" href="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/graphicCreationsBefore.png"><img class="size-thumbnail wp-image-572 thickbox " title="graphicCreationsBefore" src="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/graphicCreationsBefore-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">Here is a look at their old website design.</p></div>
<div id="attachment_578" class="wp-caption alignleft" style="width: 160px"><a class="thickbox" rel="lightbox" href="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/Graphic-Creations-Home-Page-changes.jpg"><img class="size-thumbnail wp-image-578 " title="Graphic-Creations-Home-Page-changes" src="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/Graphic-Creations-Home-Page-changes-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">The design I did for Graphic Creations.</p></div>
<div id="attachment_579" class="wp-caption alignleft" style="width: 160px"><a class="thickbox" rel="lightbox" href="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/Graphic-Creations-Home-Page-final.jpg"><img class="size-thumbnail wp-image-579 " title="Graphic-Creations-Home-Page-final" src="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/04/Graphic-Creations-Home-Page-final-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">And the final design for their new website.</p></div>
<div class="clearfix">&#8230;</div>
</div>
<p>As you can see the final design has but one major change to it which is the background color is completely green with some shadow edges for the content of the site. I&#8217;m guessing that the client, like so many others that I have had experience with, wanted to have a rigid structure and definition for what is the actual website area and the free space that one sees with a larger monitor. Since most design now used a fixed width layout I seem to be getting this request more often. Although, in my opinion, flanking the content with super bright green tends to be very garish especially when viewing the page on a 27&#8243; monitor.</p>
<p>To see larger images and some more detail about this website and a link to get there check it out in my work gallery here.</p>
<p>Thanks to <a title="Printing Storefront Solutions" href="http://printingstorefrontsolutions.com/" target="_blank">Printing Storefront Solutions</a> for making this design and development possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/graphic-creations-design-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Model-View-Controller?</title>
		<link>http://www.saobart.com/what-is-model-view-controller/</link>
		<comments>http://www.saobart.com/what-is-model-view-controller/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 07:46:02 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=464</guid>
		<description><![CDATA[At first for me this concept was a bit hard to grasp, hopefully i can break it down to basics here. The Model-View-Controller is basically a design theory and a very logical organization of the parts or an iPhone application. Model is basically the classes that hold your application&#8217;s data. For example if you created [...]]]></description>
			<content:encoded><![CDATA[<p>At first for me this concept was a bit hard to grasp, hopefully i can break it down to basics here.</p>
<p>The Model-View-Controller is basically a design theory and a very logical organization of the parts or an iPhone application.</p>
<p><strong>Model</strong> is basically the classes that hold your application&#8217;s data. For example if you created an application that when a button was pressed would take the name of that button (a string) then output that string to a label or a text field, then in this instance the Model object would be the string itself, the actual data that was used and transferred. This is a very loose example actually but, its simplicity I think makes the Model object more understandable. Most application that use a Model object will be storing or preserving data like when using Core Data classes.<span id="more-464"></span></p>
<p><strong>View</strong> is fairly easy, if you can see it then its place in the MVC theory is <strong>View</strong>.  Although in some application there is a necessity for View objects to be hidden or invisible, these are still considered to be View objects. A view object can be windows, buttons, labels, etc&#8230;</p>
<p><strong>Controller</strong> is the mediator between the Model and View. A controller object interprets user actions made in view objects and communicates new or changed data to the model layer. When model objects change, a controller object communicates that new model data to the view objects so that they can display it. Simply, the Controller object looks at changes from either the Model or View and Tell them how to behave.</p>
<p><a href="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/01/model_view_controller.jpg"><img class="aligncenter size-full wp-image-465" title="model_view_controller" src="http://saob-wp-plugin.s3.amazonaws.com/wp-content/uploads/2010/01/model_view_controller.jpg" alt="" width="440" height="125" /></a></p>
<p>The main reason for MVC theory is very similar to Object Oriented theory, where any object that is written should be easily identifiable as belonging to one of these three categories and no functionality within that object could be classified as belonging to any of the other two categories. Its all about abstraction and portability! An object that implements a button (View) should contain code that processes data (Controller) when it is tapped.  A class that implements a button can be used in any application but, a class that implements a button that processes a specific action or calculation can only be used in that one particular application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/what-is-model-view-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are Actions?</title>
		<link>http://www.saobart.com/what-are-actions/</link>
		<comments>http://www.saobart.com/what-are-actions/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 07:01:15 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[iPhone Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=461</guid>
		<description><![CDATA[Actions are methods that are part of your controller class and are declared with a special keyword, IBAction.  This keyword tells Interface Builder that this is an action and can be triggered by a control.  In short if you want to have interface objects in the nib (like buttons) trigger methods in the controller class [...]]]></description>
			<content:encoded><![CDATA[<p>Actions are methods that are part of your controller class and are declared with a special keyword, <strong>IBAction</strong>.  This keyword tells Interface Builder that this is an action and can be triggered by a control.  In short if you want to have interface objects in the nib (like buttons) trigger methods in the controller class then you would use special methods called Actions.<span id="more-461"></span></p>
<p>Example declaration of an action method:</p>
<p><code>- (IBAction)doSomething:(id)sender;</code></p>
<ul>
<li>-(IBAction) = the return type</li>
<li>doSomething: = name of the action</li>
<li>(id) = argument</li>
<li>sender; = argument name</li>
</ul>
<p>The name of the action can be anything you want but must have a return type of <strong>IBAction</strong>, which is the same as declaring a return type of -(void).  It just says that action methods do not return a value.</p>
<p>Usually an action method will take one argument and is typically defined as id and given a name of sender.  (id)sender; is not always necessary when declaring an action method but is typically used all the time.  The purpose of (id)sender; is to contain a reference to the control that has triggered the action method.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/what-are-actions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are Outlets?</title>
		<link>http://www.saobart.com/what-are-outlets/</link>
		<comments>http://www.saobart.com/what-are-outlets/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 02:49:17 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=446</guid>
		<description><![CDATA[When building an iPhone app there comes a need for the code you write to interact with the elements you create in Interface Builder, this is called an Outlet. The Outlet is and instance variable, and our controller class can refer to objects in the nib by using Outlets.  Outlets are used to effect objects [...]]]></description>
			<content:encoded><![CDATA[<p>When building an iPhone app there comes a need for the code you write to interact with the elements you create in Interface Builder, this is called an Outlet.</p>
<p>The Outlet is and instance variable, and our controller class can refer to objects in the nib by using Outlets.  Outlets are used to effect objects in your nib such as text labels, buttons and so on.  By declaring an outlet and connecting that outlet to an object in the nib, you could use the outlet from within your code to change any object in your nib.<span id="more-446"></span></p>
<p>The Outlet is declared using (IBoutlet)</p>
<p>Example:</p>
<pre>@property (nonatomic, retain) <strong>IBOutlet</strong> UILabel *statusText;</pre>
<p>The IBOutlet keyword is defined like this:</p>
<p>#ifndef IBOutlet<br />
#define IBOutlet<br />
#endif</p>
<p><strong>IBOutlet</strong> does nothing as far as the compiler is concerned. Its purpose is to act as an indicator or hint to tell Interface Builder that this is an instance variable that were going to use to connect to an object in the nib. At any time if you want an instance variable to connect to an object in the nib then it must be preceded by the <strong>IBOutlet</strong> keyword.</p>
<p>Connections made from your code to the nib must use these instance variables.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/what-are-outlets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jquery and WordPress, the 6 Million Dollar upgrade</title>
		<link>http://www.saobart.com/jquery-and-wordpress-the-6-million-dollar-upgrade/</link>
		<comments>http://www.saobart.com/jquery-and-wordpress-the-6-million-dollar-upgrade/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 21:35:51 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=384</guid>
		<description><![CDATA[The combination of WordPress and Jquery fits together just like Steve Austin and the 6 Million Dollar Man. Imagine your website as the meaty parts of Steve Austin that didn&#8217;t get turned into hamburger after his horrendous crash, and Jquery as the bionic upgrades stitched to his body by the OSI. Your blog may look [...]]]></description>
			<content:encoded><![CDATA[<p>The combination of WordPress and <a title="The super awesome Jquery library" href="http://jquery.com/" target="_blank">Jquery</a> fits together just like Steve Austin and the <a title="Wiki on the 6 Million Dollar Man" href="http://en.wikipedia.org/wiki/The_Six_Million_Dollar_Man" target="_blank">6 Million Dollar Man</a>. Imagine your website as the meaty parts of Steve Austin that didn&#8217;t get turned into hamburger after his horrendous crash, and Jquery as the bionic upgrades stitched to his body by the OSI. Your blog may look great and get the ladies like Lee Majors but, what really makes the chicks drool are the bionic enhancements.</p>
<p><span id="more-384"></span></p>
<p>I wonder where Google will index that last statement..?</p>
<p>Anyway, If I was making a 6 million dollar man I would really make sure that I stitched the bionic parts on correctly to avoid any conflicts with current body structure. The same is true with Jquery and WordPress. You don&#8217;t want your awesome bionic enhancements to fail after uploading the latest super awesome plugin that uses <a title="This Js library rocks" href="http://mootools.net/" target="_blank">MooTools</a> or <a title="The prototype library" href="http://www.prototypejs.org/" target="_blank">Prototype</a>. The main reason why Jquery would conflict with other libraries like Prototype is the &#8220;$&#8221;, which is used to replace getElementById(), Prototype uses the same symbol but in different ways, Its as if Jquery and Prototype are fighting for control over that id. Or, comparatively its like the 6 Million Dollar Man battling it out with the 6 Million Dollar woman. The resulting barrage of bell-bottoms, hairspray and bionic sound effects may just rip your face off!</p>
<p>None of us want to see that happen so read on.</p>
<h3>Jquery loaded correctly</h3>
<p>After reading several posts on the subject, listed at end of post,  I came up with the ultimate way of calling Jquery into WordPress. Here is what the following code will do for you.</p>
<ul>
<li>Deregister the local copy of Jquery used by wordpress</li>
<li>Call Jquery hosted from Google</li>
<li>Register Jquery from Google and place it in the footer</li>
<li>Register your other external js files and place them after Jquery</li>
</ul>
<p>[php]<br />
&lt;?php<br />
// Footer scripts<br />
function jquery_init() {<br />
	if (!is_admin()) {//load scripts for non admin pages<br />
		wp_deregister_script(&#8216;jquery&#8217;);//deregister current jquery<br />
		wp_register_script(&#8216;jquery&#8217;, &#8216;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#8217;, false, &#8217;1.3.2&#8242;, true);//load jquery from google api, and place in footer<br />
		wp_enqueue_script(&#8216;jquery&#8217;);</p>
<p>		// load a additional js files<br />
		wp_enqueue_script(&#8216;my_script&#8217;, get_bloginfo(&#8216;template_url&#8217;) . &#8216;/js/my-script.js&#8217;, array(&#8216;jquery&#8217;), &#8217;1.0&#8242;, true);<br />
		wp_enqueue_script(&#8216;my_script2&#8242;, get_bloginfo(&#8216;template_url&#8217;) . &#8216;/js/my-script2.js&#8217;, array(&#8216;jquery&#8217;), &#8217;1.0&#8242;, true);<br />
	}elseif (is_admin()){//load scripts for admin page<br />
		wp_enqueue_script(&#8216;my_admin_script&#8217;, get_bloginfo(&#8216;template_url&#8217;) . &#8216;/js/my-admin-script.js&#8217;, array(&#8216;jquery&#8217;), &#8217;1.0&#8242;, true);<br />
		wp_enqueue_script(&#8216;my_admin_script2&#8242;, get_bloginfo(&#8216;template_url&#8217;) . &#8216;/js/my-admin-script2.js&#8217;, array(&#8216;jquery&#8217;), &#8217;1.0&#8242;, true);<br />
	}<br />
}<br />
add_action(&#8216;init&#8217;, &#8216;jquery_init&#8217;);<br />
// END :Footer scripts<br />
?&gt;<br />
[/php]</p>
<div class="highlight">Please Note: I do not recommend using two javascript libraries on one page. Its better, faster, and stronger to just stick with one library.</div>
<p>Ok, there area  couple of things I want to go over here.</p>
<ol>
<li><strong>You should always always put all of your scripts in the footer.</strong> Why? Because, when a web page loads the markup it loads from top to bottom. So, if you have several scripts at the top of the page your users have to wait for all that stuff to load in the background before any of the lower content will load. That&#8217;s almost as unbearable as Steve Austin running in slow-mo. Also, most of your javascript is no good unless it has content to play with, so just put the scripts at the bottom of the page and it will load faster with every thing working correctly. If you don&#8217;t believe me just view the source on my website and see, all the scripts in the footer.</li>
<li><strong>Let google host it, its faster. </strong>Google provides <a title="Google ajax hosting" href="http://code.google.com/apis/ajaxlibs/documentation/" target="_blank">AJAX Libraries API</a> hosting for most well known javascript libraries and we can definitely take advantage of this CDN.</li>
<li><strong>Have WordPress place your external scripts according to their javascript library</strong>. The <a title="Wordpress speck on wp_engueue_script" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">wp_engueue_ascript()</a> function allows for an argument called <strong>$deps, </strong>which you can use to attach any other external scripts to its library and then WordPress will place it on the page accordingly.</li>
</ol>
<h3>Loading inline scripts</h3>
<p>One of my scripts needs to be loaded from another external file and it needs to go below the previous scripts on the page. Here is how you can do that.</p>
<p>[php]<br />
&lt;?php // Banner Footer scripts<br />
function alt_footer_files(){ ?&gt;<br />
    &lt;script type=&quot;text/javascript&quot;&gt;<br />
    jQuery(document).ready(function($) {<br />
		//my javascript here using $<br />
	});<br />
	&lt;/script&gt;</p>
<p>&lt;?php }	}<br />
add_action(&#8216;wp_footer&#8217;, &#8216;alt_footer_files&#8217;, 10);<br />
// END :Footer scripts<br />
?&gt;<br />
[/php]</p>
<p>Here I use add_action() to load scripts into the wordpress footer at position 10, which will be below all of the previous script links. You should also notice that I am calling Jquery using <strong>&#8220;jQuery(document).ready(function($)&#8221;</strong>. This replaces the normal &#8220;$(document).ready(function()&#8221; and allows jquery to function in a no conflict mode but still being able to use the $ in your markup.</p>
<h3>Awesome posts about the subject</h3>
<ul>
<li>Eric Martin, most of the information comes from <a title="EricMartin.com" href="http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/" target="_blank">this</a> great post.</li>
<li>The WordPress Codex on <a title="wordpress codex" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">this subject</a>.</li>
<li>Using Jquery with other libraries, from the <a title="using jquery with other libraries" href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries" target="_blank">jquery site</a>.</li>
<li>Including Jquery the right way from the <a title="very cool site" href="http://digwp.com/2009/06/including-jquery-in-wordpress-the-right-way/" target="_blank">diggwp site</a>.</li>
<li>Wow the <a href="http://www.youtube.com/watch?v=HofoK_QQxGc" target="_blank">original TV intro</a> of 6 Million Dollar man brings back memories of my childhood</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/jquery-and-wordpress-the-6-million-dollar-upgrade/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ImageMagick usage and examples with PHP: #2</title>
		<link>http://www.saobart.com/imagemagick-usage-and-examples-with-php-2/</link>
		<comments>http://www.saobart.com/imagemagick-usage-and-examples-with-php-2/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 22:20:27 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=358</guid>
		<description><![CDATA[Continuing my series on working with ImageMagic here is an example on how to annotate an image with text and using fonts already on the server. There are so many ImageMagick annotate options that I can&#8217;t list them all here! Annotate and image with ImageMagic and PHP How its done Here is the code used [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing my series on working with ImageMagic here is an example on how to annotate an image with text and using fonts already on the server. There are so many ImageMagick annotate options that I can&#8217;t list them all here!</p>
<p><span id="more-358"></span></p>
<h3>Annotate and image with ImageMagic and PHP</h3>
<div class="wp-caption alignleft" style="width: 210px"><img title="ImageMagick test image" src="/wp-content/themes/saob/magick/saob.jpg" alt="Original test saob image" width="200" height="200" /><p class="wp-caption-text">Original test image</p></div>
<div class="wp-caption alignleft" style="width: 210px"><img title="ImageMagick test image" src="/wp-content/themes/saob/magick/annotate.php" alt="Original test saob image" width="200" height="200" /><p class="wp-caption-text">Simple annotate</p></div>
<h3 style="clear:both;">How its done</h3>
<p>Here is the code used for the above image annotation.</p>
<p>[php]<br />
&lt;?php<br />
header( &#8216;Content-Type: image/jpg&#8217; );<br />
system(&quot;convert saob.jpg -font AvantGarde-Book -fill black -pointsize 20 -gravity center -annotate +0+0 &#8216;Senseless Acts of Beauty&#8217; jpg:-&quot;);<br />
?&gt;<br />
[/php]</p>
<h3>Code Breakdown</h3>
<ul>
<li><span style="color: #000000;">saob.jpg</span> (The location of the original test image)</li>
<li><span style="color: #000000;">-font AvantGarde-Book</span> (The font command sets the font family, I chose AvantGarde-Book which is already used by my server)</li>
<li><span style="color: #000000;">-fill black</span> (fill is the command that sets the fill for the font, I set the color to black)</li>
<li><span style="color: #000000;">-pointsize 20</span> (set the size of the font to 20)</li>
<li><span style="color: #000000;">-gravity center</span> (tells the font to be placed in absolute center of the image, vertically and horizontally)</li>
<li><span style="color: #000000;">-annotate +0+0 &#8216;Senseless Acts of Beauty&#8217;</span> (command to apply text to image, you can use the +0+0 as x and y coordinates)</li>
<li><span style="color: #000000;">jpg:-</span> (output a jpg file)</li>
</ul>
<p>See reference and tons of example <a title="reference to imagemagick" href="http://www.imagemagick.org/Usage/text/#annotate" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/imagemagick-usage-and-examples-with-php-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageMagick usage and examples with PHP: #1</title>
		<link>http://www.saobart.com/imagemagick-usage-and-examples-with-php-1/</link>
		<comments>http://www.saobart.com/imagemagick-usage-and-examples-with-php-1/#comments</comments>
		<pubDate>Sun, 13 Sep 2009 21:27:03 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=331</guid>
		<description><![CDATA[Several times in my career i have played around with ImageMagick and have always found the documentation of its usage with PHP to be severely lacking.  Or in most cases though the problem originates with the server. Why can&#8217;t I get ImageMagick to work? Either its not installed on your shared host, or its installed [...]]]></description>
			<content:encoded><![CDATA[<p>Several times in my career i have played around with ImageMagick and have always found the documentation of its usage with PHP to be severely lacking.  Or in most cases though the problem originates with the server.<span id="more-331"></span></p>
<h3>Why can&#8217;t I get ImageMagick to work?</h3>
<p>Either its not installed on your shared host, or its installed and crippled so you can&#8217;t use php functions like &#8220;exec(), or system()&#8221;. Its good to mention that if you are running into this problem you may want to check out some API&#8217;s that hook into ImageMagick like <a title="Imagick api for php, working with imagemagick" href="http://us.php.net/imagick" target="_blank">Imagick</a> for PHP, or <a title="MagickWand and api for imagemagick" href="http://www.imagemagick.org/script/magick-wand.php" target="_blank">MagickWand</a>.  Both are very good API&#8217;s but, you will find less examples working with them then the original <a title="ImageMagick.org all the usage you will need to learn imagemagick" href="http://www.imagemagick.org/Usage/" target="_blank">ImageMagick documentation</a>.</p>
<p>Now, before we get into an example, I would like to point out that most of the examples around the net are using personal installs of ImageMagick, or from a person that has root access to a dedicated server. This allows these code guru&#8217;s to edit the Apache server to accept functions that most shared hosting has turned off.</p>
<p>The first time I tried ImageMagick I installed a virtual machine on my computer running Linux(Umbuntu) and I used and SSH connection to run bash commands on the local server that had the perfect install of ImageMagick that let me do whatever I wanted. Here the bad thing about that, It took FOREVER! And not only was I unsure about the security of my server but I also didn&#8217;t know how it would effect and actual server CPU, of even if all my code would work on the server that I moved it to.</p>
<p>So, the perfect solution came to me the other day when I ran phpinfo() on my current host <a title="In my opinion the best hosting out there, HostGator" href="http://www.hostgator.com/" target="_blank">HostGator</a>, and found that ImageMagick was installed. Within minutes I was running ImageMagick commands on my development domain, AWESOME!</p>
<p>So, Long story short, don&#8217;t try installing ImageMagick unless you have all the time in the world and your an Apache guru, just use <a title="HostGator has imagemagick installed automatically" href="http://www.hostgator.com/" target="_blank">HostGator</a>!</p>
<h3>Is ImageMagick installed on my current host?</h3>
<p>The first thing you want to do before you begin working with ImageMagick is make sure that its installed on your host&#8217;s server, along with what font&#8217;s you can use and what convert commands are installed on the server.</p>
<p><span style="font-size: small;"><span style="color: #993300;">note: The following code will assume that you have FTP access to your server and have basic knowledge of PHP.</span></span></p>
<p>Just create a page called magicktest.php and paste in the following code</p>
<p>[php]<br />
&lt;?php<br />
  header(&#8216;Content-Type: text/plain&#8217;);<br />
  system(&quot;exec 2&gt;&amp;1; type convert&quot;);<br />
  system(&quot;exec 2&gt;&amp;1; locate */convert&quot;);<br />
  system(&quot;exec 2&gt;&amp;1; convert -version&quot;);<br />
  system(&quot;exec 2&gt;&amp;1; convert -list type&quot;); // &lt;&lt; before IM v6.3.5-7<br />
  system(&quot;exec 2&gt;&amp;1; convert -list font&quot;);<br />
?&gt;<br />
[/php]</p>
<p>This will run a few of commands on your server to see what is present.</p>
<ul>
<li>header (tells the browser what type of content will be displayed, nothing before this or you will get a header error)</li>
<li><code>type</code> (Tells you if <code>convert</code> is available on the command PATH and where it is)</li>
<li><code>locate</code> (finds all convert commands that exist on the server, including ones that are NOT ImageMagick commands)</li>
<li><code>convert -version</code> (prints the version number of convert)</li>
<li><code>convert -list type</code> (lists fonts for an older version of ImageMagick)</li>
<li><code>convert -list font</code> (lists the fonts that ImageMagick has access to)</li>
</ul>
<p>If all you see ar errors, then &#8220;<code>convert</code>&#8221; is not on the command line path,  and your ISP provider did not initialize the web server PATH properly to include it.   If this is the case you will need to find out exactly where it is located and use something like this for you PHP scripts, which makes your script less portable.   For example suppose the &#8220;<code>convert</code>&#8221; command is in &#8220;<code>/opt/php5extras/ImageMagick/bin</code>&#8220;, then you can set that in a variable at the top (for quick changes for different ISP hosts), and directly specify its location. For more explanation on this see the master of all things ImageMagick <a href="http://www.cit.gu.edu.au/%7Eanthony/anthony.html" target="_blank">Anthony Thyssen</a> and <a title="Api ImageMagick examples with php" href="http://www.imagemagick.org/Usage/api/" target="_blank">this post</a>.</p>
<p>Now once you have all that information save it somewhere, you will always need to reference the convert path or fonts installed.</p>
<h3>Can I use exec() to run commands on my host?</h3>
<p>An easy way to test and see if exec() is available and working on your server is to run the following code provided by php.net.</p>
<p>[php]<br />
// outputs the username that owns the running php/httpd process<br />
// (on a system with the &quot;whoami&quot; executable in the path)<br />
echo exec(&quot;whoami&quot;);<br />
?&gt;<br />
[/php]</p>
<p>If you see your user name then its all working fine. If not, you may want to try system(), and/or passthru(). Actually in most cases if your code doesn&#8217;t work try system() or passthru(), I will be using a combination of the three in my post examples.</p>
<h3>Difference between ImageMagick images and normal image files</h3>
<p>The basic idea of ImageMagick is that you want the server to adjust your images just like you could do in photoshop. But, you won&#8217;t be referencing your images the same as <code> &lt;img src="myimage.jpg" /&gt;</code>. With photoshop you edit and image then save it as a file then reference the file, src=&#8221;myfile.jpg&#8221;.  With ImageMagick, you ask the server to do the image edits and then it returns code that builds the image in the browser, this is the main reason why we need header() at the top of your php file. If you didn&#8217;t specify headers before your code you would get a bunch of crazy characters all over the page.</p>
<p>Here is how its done. You create a file called rotateImage.php, then you reference it just like and image, &lt;img src=&#8221;rotateImage.php&#8221; /&gt;. So you pull the php file in through the image tag and it displays your image as if the php file WAS an image file. Very cool right!!</p>
<h3>Examples!! Rotate</h3>
<div class="wp-caption alignleft" style="width: 210px"><img title="ImageMagick test image" src="/wp-content/themes/saob/magick/saob.jpg" alt="Original test saob image" width="200" height="200" /><p class="wp-caption-text">Original test image</p></div>
<div class="wp-caption alignleft" style="width: 292px"><img title="ImageMagick rotate with php" src="/wp-content/themes/saob/magick/rotate.php" alt="ImageMagick rotate with php" width="282" height="282" /><p class="wp-caption-text">Rotate image 45 degrees</p></div>
<p style="clear:both;">The magick! Rotate and image with just two lines of code!</p>
<p>[php]<br />
&lt;?php<br />
header( &#8216;Content-Type: image/jpg&#8217; );<br />
system(&quot;convert saob.jpg -rotate 45 jpg:-&quot;);<br />
?&gt;<br />
[/php]</p>
<h3>Example:  Annotate, negate, resize&#8230;</h3>
<div class="wp-caption alignnone" style="width: 410px"><img title="ImageMagick annotate with php" src="/wp-content/themes/saob/magick/negateAnnotate.php" alt="ImageMagick annotate with php" width="400" height="400" /><p class="wp-caption-text">Several commands in one!</p></div>
<p style="clear:both;">The magick! Annotate, Negate, Resize, swap, composite</p>
<p>[php]<br />
&lt;?php<br />
header( &#8216;Content-Type: image/jpg&#8217; );<br />
$color=&quot;white&quot;;<br />
  $image=&quot;saob.jpg&quot;;<br />
  $scale=&quot;200%&quot;;<br />
  $size=&quot;140&#215;96&quot;;<br />
  $string=&quot;Senseless Acts of Beauty&quot;;<br />
  passthru(&quot;convert -background none -fill &#8216;$color&#8217; -gravity center&quot; .<br />
            &quot; -font AvantGarde-Book -size &#8216;$size&#8217; caption:&#8217;$string&#8217;&quot; .<br />
            &quot; \\( &#8216;$image&#8217; -negate -resize &#8216;$scale&#8217; \\) -swap -2,-1 -composite&quot; .<br />
            &quot; jpg:-&quot; );<br />
?&gt;<br />
[/php]</p>
<p>Its almost limitless of what you can do with ImageMagick so, that being said, I plan on making a bunch of short posts just showing examples of ImageMagick usage along with the code on how you can do the same. As always if you have any questions just post a comment. THANKS!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/imagemagick-usage-and-examples-with-php-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Speed up WordPress plugins</title>
		<link>http://www.saobart.com/speed-up-wordpress-plugins/</link>
		<comments>http://www.saobart.com/speed-up-wordpress-plugins/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 04:55:23 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=165</guid>
		<description><![CDATA[One of the biggest problems with a WordPress site is optimizing its speed.  If you use the popular plug-in for FireFox Yslow, or Google&#8217;s page speed they will always tell you to move the JavaScript to the footer in order to make your page load faster. Or, you have too many style sheets and scripts [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest problems with a WordPress site is optimizing its speed.  If you use the popular plug-in for FireFox <a title="Yslow plugin download page" href="https://addons.mozilla.org/en-US/firefox/addon/5369" target="_blank">Yslow</a>, or<a title="Page speed download page" href="http://code.google.com/speed/page-speed/download.html" target="_blank"> Google&#8217;s page speed</a> they will always tell you to move the JavaScript to the footer in order to make your page load faster.<span id="more-165"></span> Or, you have too many style sheets and scripts on one page and it wants you to combine them. I have a pretty simple solutions that you can use to tell any plug-in your using to only be displayed on the page it is being used AND put the JavaScript in the footer.</p>
<h3>Optimize: Contact Form 7</h3>
<p>One of the top WordPress plug-ins to download is <a title="Contact Form 7 Plugin Home page" href="http://ideasilo.wordpress.com/2007/04/30/contact-form-7/" target="_blank">Contact Form 7</a> (best form plug-in in my opinion). One great thing about this plug-in is that it automatically moves its JavaScript to the footer of your site. But, the JavaScript is still used on every page as well as the style sheets. Now, if your like me you just need these styles and scripts to run on one page, not throughout the entire site. Here is how to fix this.</p>
<p><span style="color: #993300;"><em>First things first, make sure you set up Contact Form 7 and its working 100% correctly out of the box before you begin editing its current functionality.</em></span></p>
<h3>Step 1</h3>
<p>Open the main PHP file for the plug-in, in this case its <em>wp-contact-form-7.php </em>located in the plug-in&#8217;s root folder. What I usually do is search for any reference to the scripts or styles that I want to move. If you do a search for <em>.js</em> you will come to several lines of code seen in the image below.<br />
<a href="http://www.saobart.com/wp-content/uploads/2009/08/cf7php.jpg"><img class="alignnone size-full wp-image-167" title="Contact Form 7 php code, to find the function we need" src="http://www.saobart.com/wp-content/uploads/2009/08/cf7php.jpg" alt="Contact Form 7 php code, to find the function we need" width="660" height="212" /></a></p>
<p>As you can see above <em>wp_enqueue_script()</em> is being used to queue the JavaScript into the WordPress loop. The most important part of this function is the name of the script that is being queued, &#8220;contact-form-7&#8243;. Make note of this.</p>
<h3>Step 2</h3>
<p>Now one of the most important parts of moving this code around, so we can speed up our page, is to do it without editing any of the original plug-in files. And you ask &#8220;WHY?&#8221;.</p>
<p>Well, lets say you do all kinds of edits to this plug-in&#8217;s php files and you get your page to humm like a top and your all super happy eating ice-cream and smiling. Then the next time you open up your WordPress dashboard you see a warning to update your plug-in because it has a security bug or something, put down the ice-cream, update your plug-in and watch all your awesome work go away&#8230;</p>
<p>Yeah sucks doesn&#8217;t it?</p>
<p>So, how can you edit what a plug-in does without touching it? MAGIC!! No, just kidding, all you need is your <em>functions.php</em> file in your child theme, or if you don&#8217;t have one just create it and add the code below.</p>
<p>[php]<br />
&lt;?php<br />
function my_deregister_javascript() {<br />
 if (!is_page(&#8216;contact&#8217;)){<br />
 wp_deregister_script( &#8216;contact-form-7&#8242; );<br />
 }<br />
}<br />
add_action( &#8216;wp_print_scripts&#8217;, &#8216;my_deregister_javascript&#8217;, 100 );<br />
?&gt;<br />
[/php]</p>
<h3>Step 3</h3>
<p><span style="color: #993300;">Now you can paste that code in your functions.php file and wonder why its not working or you can continue reading.</span> Here is what this function is doing.</p>
<pre><strong><span style="color: #333333;">function my_deregister_javascript() {</span></strong></pre>
<p style="padding-left: 30px;">The above line begins your function and names it, you can make it say whatever you want, as long as it is unique, but I like <em>my_deregister_javascript().</em></p>
<pre><strong><span style="color: #333333;">if (!is_page('contact')){</span></strong></pre>
<p style="padding-left: 30px;">This is very important! The above line looks for the pages that ARE NOT! named &#8220;contact&#8221;. So, if you have Contact Form 7 on a page called &#8220;snuffalupagus&#8221; then this line should read,</p>
<p style="padding-left: 30px;">if (!is_page( &#8216;snuffalupagus&#8217; )){</p>
<p style="padding-left: 30px;">If you have multiple forms on different pages then it would change to,</p>
<p style="padding-left: 30px;">if(!is_page(array(&#8216;page1&#8242;,&#8217;page2&#8242;,&#8217;page3&#8242;)){</p>
<pre><strong><span style="color: #333333;">wp_deregister_script( 'contact-form-7' );</span></strong></pre>
<p style="padding-left: 30px;">The above line is the action line. It de-registers the script from the loop, kills it, stops it from running, EXTERMINATE! Sorry, was just watching some Doctor Who&#8230;.</p>
<pre><strong><span style="color: #333333;">add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );</span></strong></pre>
<p style="padding-left: 30px;">The above last line just ads our new function into the queue at position 100.</p>
<h3>Step 4</h3>
<p>Check to make sure that the scripts used for Contact Form 7 are no longer in the footer for every page except for the page/pages where your forms are being used, and pick up your ice-cream again.</p>
<h3>Step 5</h3>
<p>Paste the code below into your <em>functions.php</em> file. This will remove the Contact Form 7 style sheets from the head of all your pages except for the page named &#8220;contact&#8221;. Essentially, this is the same code as above, and you should adjust accordingly.</p>
<p>[php]<br />
&lt;?php<br />
function remove_contact_style(){<br />
 if (!is_page(&#8216;contact&#8217;)){<br />
 remove_action( &#8216;wp_head&#8217;, &#8216;wpcf7_wp_head&#8217; );<br />
 }<br />
}<br />
add_action(&#8216;wp_head&#8217;, &#8216;remove_contact_style&#8217;, 9);<br />
?&gt;<br />
[/php]</p>
<h3>Your Done!</h3>
<p>Hopefully that wasn&#8217;t too hard <img src='http://www.saobart.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<h3>Optimize: WP-Cufon</h3>
<p><a title="Wp-Cufon download page" href="http://wordpress.org/extend/plugins/wp-cufon/" target="_blank">WP-Cufon</a> is a great plug-in that i use on my site to turn all heading into a no web safe font. The JavaScript used for this plug-in is needed on every page but, using the code below you can remove the JavaScript from the head and put it in the footer where it belongs.</p>
<p>[php]<br />
&lt;?php<br />
function remove_scripts() {<br />
 remove_action(&#8216;wp_head&#8217;, &#8216;wpcufon_init&#8217;);<br />
 add_action(&#8216;wp_footer&#8217;, &#8216;wpcufon_init&#8217;, 9);<br />
}<br />
add_action(&#8216;init&#8217;, &#8216;remove_scripts&#8217;);<br />
?&gt;<br />
[/php]</p>
<p>That&#8217;s all for now, more to come later&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/speed-up-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script to help diagnose WordPress speed</title>
		<link>http://www.saobart.com/script-to-help-diagnose-wordpress-speed/</link>
		<comments>http://www.saobart.com/script-to-help-diagnose-wordpress-speed/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 00:23:24 +0000</pubDate>
		<dc:creator>Gravityone</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.saobart.com/?p=29</guid>
		<description><![CDATA[Ever wanted to know exactly how many times your browser is querying the server? Or how long it takes for you page to load? Even Yslow cannot detect these queries! Just add the script below to your functions.php file in your WordPress installation and the queries will appear in the bottom left or your browser [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Ever wanted to know exactly how many times your browser is querying the server? Or how long it takes for you page to load? Even Yslow cannot detect these queries!</p>
<p><span id="more-29"></span></p>
<p style="text-align: justify;">Just add the script below to your functions.php file in your WordPress installation and the queries will appear in the bottom left or your browser as long as your logged in (<em>and only if you logged in</em>).</p>
<p>[php]<br />
&lt;?<br />
php if (is_user_logged_in()) {<br />
?&gt;<br />
   &lt;div id=&quot;speed-test&quot; style=&quot;padding:10px;background:#F66;color:#fff;font-weight:bold; position:fixed;bottom:0;&quot;&gt;<br />
      &lt;?php echo get_num_queries(); ?&gt; queries in &lt;?php timer_stop(1); ?&gt; seconds.<br />
   &lt;/div&gt;<br />
&lt;?php } ?&gt;<br />
[/php]</p>
<p style="text-align: justify;">If you like this script or need help installing it please leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.saobart.com/script-to-help-diagnose-wordpress-speed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
