<?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>Halfslide Design Blog - Austin, Texas Website Design &#187; Tutorials</title>
	<atom:link href="http://www.halfslide.com/blog/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.halfslide.com/blog</link>
	<description>Austin, Texas Website Design</description>
	<lastBuildDate>Tue, 03 Aug 2010 19:52:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dropping Spam with Postfix and SpamAssassin on GoDaddy&#8217;s Dedicated Servers</title>
		<link>http://www.halfslide.com/blog/2010/01/30/dropping-spam-with-postfix-and-spamassassin-on-godaddys-dedicated-servers/</link>
		<comments>http://www.halfslide.com/blog/2010/01/30/dropping-spam-with-postfix-and-spamassassin-on-godaddys-dedicated-servers/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 17:26:33 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[godaddy]]></category>
		<category><![CDATA[godaddy dedicated server]]></category>
		<category><![CDATA[header_checks]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://www.halfslide.com/blog/?p=105</guid>
		<description><![CDATA[We recently ran into a situation where one of our users was receiving a large amount of spam to their forwarded email account. Our setup is a dedicated server running Simple Control Panel at Godaddy. We handle email for a few clients and this one in particular was receiving 100&#8217;s of spam emails every hour.  [...]]]></description>
			<content:encoded><![CDATA[<p>We recently ran into a situation where one of our users was receiving a large amount of spam to their forwarded email account. Our setup is a dedicated server running Simple Control Panel at Godaddy. We handle email for a few clients and this one in particular was receiving 100&#8217;s of spam emails every hour.  Pretty much as soon as we set up this client, we started hitting our <a title="1,000 SMTP Relay Limit Godaddy" href="http://jimwarholic.com/2008/01/godaddy-1000-emails-smtp-relay-limit.php" target="_blank">1,000 SMTP Relay limit</a> which prevented us from sending any further emails for any other client on the server.</p>
<p>There is a simple fix to this that I had a difficult time finding so I decided to create a post on this for anyone else who might run into this issue.</p>
<p>The first thing I tried was to turn on SpamAssassin through the Simple Control Panel (log in to your control panel, choose &#8220;Email&#8221; from the &#8220;Server Configuration&#8221; section, and choose &#8220;Filter incoming email using SpamAssassin&#8221;).  The result of this is that SpamAssassin started analyzing the emails coming in and marking them as Spam.  This didn&#8217;t fix the problem because the emails were not being dropped, but were instead being forwarded onto the receipient, just now with the &#8220;SPAM&#8221; designation in the message subject.</p>
<p>The only solution I discovered was to utilize Postfix&#8217;s header_checks.  This uses a regular expression to check the header of the email message and then apply a rule to the message accordingly.  Here&#8217;s what we did.</p>
<ol>
<li>edit the /etc/postfix/header_checks file.</li>
<li>add the following line to the bottom of the file:<br />
<blockquote class="code"><p>/^X-Spam-Flag:.YES/ DISCARD spam</p></blockquote>
</li>
<li>edit the /etc/postfix/main.cf file an make sure the following line is in your file (it may just be commented out):<br />
<blockquote class="code"><p>header_checks = regexp:/etc/postfix/header_checks</p></blockquote>
</li>
<li>Now restart your postfix process by using the following command:<br />
<blockquote class="code"><p>postfix reload</p></blockquote>
</li>
</ol>
<p>What this does is look for the existence of &#8220;X-Spam-Flag&#8221; in the header of the message.  This flag is put there by SpamAssassin, so it is important that SpamAssassin is running.  Once it sees the &#8220;X-Spam-Flag&#8221;, it will discard the message.  This will effectively prevent your server from forwarding any spam emails onto your user&#8217;s email accounts.  So far this has worked out well for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halfslide.com/blog/2010/01/30/dropping-spam-with-postfix-and-spamassassin-on-godaddys-dedicated-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Posts from Two Wordpress Blogs on the Same Page</title>
		<link>http://www.halfslide.com/blog/2009/10/06/display-posts-from-two-wordpress-blogs-on-the-same-page/</link>
		<comments>http://www.halfslide.com/blog/2009/10/06/display-posts-from-two-wordpress-blogs-on-the-same-page/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 20:09:23 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.halfslide.com/blog/?p=69</guid>
		<description><![CDATA[I recently got a request from a client of mine to setup two different wordpress blogs for her company and then display the posts from both blogs in a single list on the home page of her web site.  I wasn&#8217;t able to find much documentation of people doing this type of thing through [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got a request from a client of mine to setup two different wordpress blogs for her company and then display the posts from both blogs in a single list on the home page of her web site.  I wasn&#8217;t able to find much documentation of people doing this type of thing through various searches, so I figured I&#8217;d post an entry on it when I finished.  <strong><em>As a disclaimer, I&#8217;m sure that this can be done more efficiently or in less code.  If you have a better way to do it, please leave me a comment.  I&#8217;m always open to learning new techniques.</em></strong></p>
<p><span id="more-69"></span></p>
<p>The first step is to set up two includes that will make the connection to your database.  In my case, I called these &#8220;blog_db_connect.php&#8221; and &#8220;blog_db_connect2.php&#8221;.  Here&#8217;s an example of how they should look:</p>
<blockquote class="code"><p>$hostname=<em>your hostname</em>;<br />
$username=<em>your username</em>;<br />
$password=<em>your password</em>;<br />
$dbname=<em>your dbname;</em><br />
$dbh = mysql_connect($hostname, $username, $password);<br />
mysql_select_db($dbname);</p></blockquote>
<p>You would create one of these each with the credentials of each of your blog databases.</p>
<p>Next, you&#8217;ll need to write some php code that connects to each blog database and sucks in the posts.  The query I used for each blog to get only the five most recent published posts is below.  This will get me the post id, post title and date that the post was published.  (It&#8217;s important to search for posts with a post_status of &#8216;publish&#8217;, otherwise you&#8217;ll get all the drafts that go with it.)</p>
<blockquote class="code"><p>select `ID`, `post_title`, `post_date` from `wp_posts` where `post_status` = &#8216;publish&#8217;  order by `post_date` desc limit 0,5</p></blockquote>
<p>Once you have the posts, you&#8217;ll want to iterate over them and store the fields you returned into an array.  A few notes about the code below:  1) I&#8217;m setting various things specific about this blog such as the blog&#8217;s title and the url where the blog sits.  These are defined in the $blog1title and $blog1url variables.  2) The post information is being stored in an associative array with the post&#8217;s date being the key.  This allows me to do a sort based on the array&#8217;s key (krsort()) later on and get my posts in chronological order.</p>
<blockquote class="code"><p>$result = mysql_query($blogQuery);<br />
while($row=mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post = array();<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['title'] = $row[&#34;post_title&#34;];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['source'] = $blog1title;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['blog_url'] = $blog1url;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['url'] = $blog1url.&#8217;/?p=&#8217;.$row['ID'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['date'] = date(&#34;m/d/y&#34;, strtotime($row[&#34;post_date&#34;]));<br />
&nbsp;&nbsp;&nbsp;&nbsp;$posts[strtotime($row[&#34;post_date&#34;])] = $post;<br />
}</p></blockquote>
<p>Once you&#8217;ve stored all of your posts in the array, you&#8217;ll want to do a ksort:</p>
<blockquote class="code"><p>krsort($posts)</p></blockquote>
<p>Here&#8217;s the full code for building and sorting the array for both blogs:</p>
<blockquote class="code"><p>$posts = array();</p>
<p>/** Blog 1 **/<br />
include(&#8216;includes/blog_db_connect.php&#8217;);<br />
$blogQuery = &#34;select ID, `post_title`, `post_date` from `wp_posts` where `post_status` = &#8216;publish&#8217; &#34;<br />
&nbsp;&nbsp;.&#34; order by `post_date` desc limit 0,5&#34;;</p>
<p>$blog1url = &#34;http://www.blog1.com&#34;;<br />
$blog1title = &#8220;Blog 1&#8243;;</p>
<p>$result = mysql_query($blogQuery);<br />
while($row=mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post = array();<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['title'] = $row[&#34;post_title&#34;];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['source'] = $blog1title;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['blog_url'] = $blog1url;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['url'] = $blog1url.&#8217;/?p=&#8217;.$row['ID'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['date'] = date(&#34;m/d/y&#34;, strtotime($row[&#34;post_date&#34;]));<br />
&nbsp;&nbsp;&nbsp;&nbsp;$posts[strtotime($row[&#34;post_date&#34;])] = $post;<br />
}</p>
<p>/** Blog 2 **/<br />
include(&#8216;includes/blog_db_connect2.php&#8217;);</p>
<p>$blog2url = &#34;http://www.blog2.com&#34;;<br />
$blog2title = &#34;Blog 2&#34;;</p>
<p>$result = mysql_query($blogQuery);<br />
while($row=mysql_fetch_array($result)) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post = array();<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['title'] = $row[&#34;post_title&#34;];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['source'] = $blog2title;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['blog_url'] = $blog2url;<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['url'] = $blog2url.&#8217;/?p=&#8217;.$row['ID'];<br />
&nbsp;&nbsp;&nbsp;&nbsp;$post['date'] = date(&#34;m/d/y&#34;, strtotime($row[&#34;post_date&#34;]));<br />
&nbsp;&nbsp;&nbsp;&nbsp;$posts[strtotime($row[&#34;post_date&#34;])] = $post;<br />
}<br />
krsort($posts);</p></blockquote>
<p>Finally, you want to iterate over the post entries and display them on your page.  Here&#8217;s a simple example of what I did to display them in an unordered list:</p>
<blockquote class="code"><p>
&#60;ul&#62;<br />
&#60;? foreach($posts as $post) {?&#62;<br />
&nbsp;&nbsp;&#60;li&#62;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#60;a href=&#34;&#60;?=$post['url']?&#62;&#34;&#62;&#60;?=cleanString($post['title'])?&#62;&#60;/a&#62;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#60;ul class=&#34;blog-title&#34;><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#60;li&#62;&#60;a href=&#34;&#60;?=$post['blog_url']?&#62;&#34;&#62;&#60;?=$post['source']?&#62;&#60;/a&#62; &#8211; &#60;?=$post['date']?&#62;&#60;/li&#62;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&#60;/ul&#62;<br />
&nbsp;&nbsp;&#60;/li&#62;<br />
&#60;?&nbsp;}?&#62;<br />
&#60;/ul&#62;
</p></blockquote>
<p>The clean string is a function I&#8217;m using to cleanse the blog title of any invalid content.  You can see more about that function <a href="http://www.halfslide.com/blog/2009/09/29/simple-php-function-to-remove-invalid-characters-from-a-string/">here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.halfslide.com/blog/2009/10/06/display-posts-from-two-wordpress-blogs-on-the-same-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple PHP Function to Remove Invalid Characters from a String</title>
		<link>http://www.halfslide.com/blog/2009/09/29/simple-php-function-to-remove-invalid-characters-from-a-string/</link>
		<comments>http://www.halfslide.com/blog/2009/09/29/simple-php-function-to-remove-invalid-characters-from-a-string/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:46:02 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.halfslide.com/blog/?p=54</guid>
		<description><![CDATA[I&#8217;ve run into situations where I&#8217;ve installed content management systems for customers who like to add their own content and/or copy content from documents they&#8217;ve created.  Often, this results in them copying non-ASCII characters such as smart quotes, elipsis, or em dashses.  I&#8217;m not sure why (maybe someone can educate me by posting [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve run into situations where I&#8217;ve installed content management systems for customers who like to add their own content and/or copy content from documents they&#8217;ve created.  Often, this results in them copying non-ASCII characters such as smart quotes, elipsis, or em dashses.  I&#8217;m not sure why (maybe someone can educate me by posting a comment below) that PHP can&#8217;t handle these characters, but I&#8217;ve come up with a way to replace these characters with characters or character sequences that PHP understands.  The function is below.</p>
<blockquote class="code"><p>function cleanString($string) {<br />
&nbsp;&nbsp;$find[] = &#39;“&#39;;  // left side double smart quote<br />
&nbsp;&nbsp;$find[] = &#39;”&#39;;  // right side double smart quote<br />
&nbsp;&nbsp;$find[] = &#34;‘&#34;;  // left side single smart quote<br />
&nbsp;&nbsp;$find[] = &#34;’&#34;;  // right side single smart quote<br />
&nbsp;&nbsp;$find[] = &#39;…&#39;;  // elipsis<br />
&nbsp;&nbsp;$find[] = &#39;—&#39;;  // em dash<br />
&nbsp;&nbsp;$find[] = &#39;–&#39;;</p>
<p>&nbsp;&nbsp;$replace[] = &#39;&quot;&#39;;<br />
&nbsp;&nbsp;$replace[] = &#39;&quot;&#39;;<br />
&nbsp;&nbsp;$replace[] = &#34;&#39;&#34;;<br />
&nbsp;&nbsp;$replace[] = &#34;&#39;&#34;;<br />
&nbsp;&nbsp;$replace[] = &#39;&#46;&#46;&#46;&#39;;<br />
&nbsp;&nbsp;$replace[] = &#39;&#45;&#39;;<br />
&nbsp;&nbsp;$replace[] = &#39;&#45;&#39;;</p>
<p>&nbsp;&nbsp;return str_replace($find, $replace, $string);<br />
}</p></blockquote>
<p>The function essentially is a very simple string replacement that attempts to match an invalid character with a valid character and output the change.  This will prevent the weird diamonds or boxes that you may be seeing in text output using &#8220;echo&#8221; in php.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.halfslide.com/blog/2009/09/29/simple-php-function-to-remove-invalid-characters-from-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Image Slideshow with jQuery and jQuery Cycle Plugin</title>
		<link>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/</link>
		<comments>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 15:31:40 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Image Slideshow]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery Cycle]]></category>

		<guid isPermaLink="false">http://www.halfslide.com/blog/?p=30</guid>
		<description><![CDATA[See The Demo
I recently completed a website design project for a local austin company that involved creating a simple image slideshow on the login page of their application. These types of slideshows have traditionally been done using an animation toolkit or framework such as Adobe&#8217;s Flash product. Starting around three years ago, I was introduced [...]]]></description>
			<content:encoded><![CDATA[<p><a class="demo" title="jQuery Image Slideshow" href="http://www.halfslide.com/sample/slideshow/" target="_blank">See The Demo</a></p>
<p>I recently completed a website design project for a local austin company that involved creating a simple image slideshow on the login page of their application. These types of slideshows have traditionally been done using an animation toolkit or framework such as Adobe&#8217;s Flash product. Starting around three years ago, I was introduced to <a title="Scriptaculous Javascript Framework" href="http://script.aculo.us/" target="_blank">script.aculo.us</a> which provided the ability to use effects with DOM elements to provide cool animations.</p>
<p>Just within the last year, I&#8217;ve started working more with jQuery and have been introduced to the slew of extremely cool plugins.  The newest one I&#8217;ve come across is <a title="jQuery Cycle" href="http://malsup.com/jquery/cycle/" target="_blank">jQuery Cycle</a>.  Using this plugin and 9 lines of javascript code, I was able to create an extremely simple but cool image slide-show for the website project for my client.</p>
<p>The first step in building the slideshow is to create the html element that will hold the images for your slideshow:</p>
<blockquote class="code"><p>&lt;div id=&#8221;slideshow&#8221;&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-1.jpg&#8221; border=&#8221;0&#8243;/&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-2.jpg&#8221; style=&#8221;display:none&#8221;/&gt;<br />
&nbsp;&nbsp;&lt;img src=&#8221;slides/slide-3.jpg&#8221; style=&#8221;display:none&#8221;/&gt;<br />
&lt;/div&gt;</p></blockquote>
<p>The above is a simple list of images within the div element that&#8217;s identified by the &#8220;slideshow&#8221; id.  This will enable jQuery to pick up the &#8220;slideshow&#8221; element and then iterate over the &lt;img&gt; elements within it when building the slideshow.</p>
<p>The second step is to write the actual javascript that will use the plugin to build and run the slideshow:</p>
<blockquote class="code"><p>$(document).ready(function(){<br />
&nbsp;&nbsp;$(function(){<br />
&nbsp;&nbsp;&nbsp;&nbsp;$(&#8220;#slideshow&#8221;).cycle({<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fx: &#8216;fade&#8217;,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;speed:2500,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout: 1000<br />
&nbsp;&nbsp;&nbsp;&nbsp;});<br />
&nbsp;&nbsp;});<br />
});</p></blockquote>
<p>A little explanation on what is happening here: The $(&#8220;#slideshow&#8221;) is grabbing the slideshow div element and feeding the images into jQuery Cycle Plugin&#8217;s initialization.  The plugin is applying the fade effect <a title="jQuery Cycle Effects" href="http://malsup.com/jquery/cycle/browser.html" target="_blank">(see more information on the effects you can use here)</a> at a speed of 2500 milliseconds and a timeout of 1000 milliseconds.  Speed controls how long the transition takes to complete and timeout controls the time between slide transitions.  You can find more information on the <a title="jQuery Cycle Options" href="http://malsup.com/jquery/cycle/options.html" target="_blank">options for the plugin here.</a></p>
<p>All-in-all, this has turned out to be a ridiculously easy way to code up a simple slideshow.  You can enhance your slideshow in all sorts of ways such as loading your images through ajax after the page loads, randomizing ordering, and providing new transitions.  All without having to worry about motion tweens in Flash!</p>
<p><a class="demo" title="jQuery Image Slideshow" href="http://www.halfslide.com/sample/slideshow/" target="_blank">See the Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.halfslide.com/blog/2009/09/16/simple-image-slideshow-with-jquery-and-jquery-cycle-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
