<?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>Mark Parolisi &#187; Tutorials</title> <atom:link href="http://markparolisi.com/category/articles/tutorials/feed/" rel="self" type="application/rss+xml" /><link>http://markparolisi.com</link> <description>Official Portfolio and Blog</description> <lastBuildDate>Wed, 01 Feb 2012 04:35:02 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Run Coverage Reports in Python</title><link>http://markparolisi.com/articles/tutorials/run-coverage-reports-in-python/</link> <comments>http://markparolisi.com/articles/tutorials/run-coverage-reports-in-python/#comments</comments> <pubDate>Wed, 01 Feb 2012 04:32:59 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://markparolisi.com/?p=416</guid> <description><![CDATA[During a recent Code Dojo with my team, we split up into a friendly coding competition. Coverage.py turned out to be a lifesaver.]]></description> <content:encoded><![CDATA[<p>During a recent Code Dojo with my team, we split up into a friendly coding competition. We worked on a generic problem and the winner was decided by a few simple factors: completion time, code coverage and 100% passing of tests. Luckily, <a href="http://nedbatchelder.com/">Ned Batchelder</a> has written a great module for running coverage reports. Simply install (easy_install) the package and run</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">coverage run my_program.py</pre></div></div><p>Then&#8230;</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">coverage report</pre></div></div><p>will print the results to the terminal. You can even output a fancy HTML microsite by running</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">coverage html</pre></div></div><p>That will not only display your result table, but also your code itself.</p><p>It&#8217;s terribly convenient and essential in TDD. Now, go and learn more <a href="http://nedbatchelder.com/code/coverage/">here</a></p> ]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/run-coverage-reports-in-python/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>New WordPress slideshow posted</title><link>http://markparolisi.com/articles/tutorials/new-wordpress-slideshow-posted/</link> <comments>http://markparolisi.com/articles/tutorials/new-wordpress-slideshow-posted/#comments</comments> <pubDate>Sat, 17 Apr 2010 12:30:12 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[News]]></category> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://markparolisi.com/?p=215</guid> <description><![CDATA[I presented an overview of the WordPress application to a recent client and decided to post it on slideshare for anyone interested. It&#8217;s intended for a technical audience, but it]]></description> <content:encoded><![CDATA[<p>I presented an overview of the WordPress application to a recent client and decided to post it on slideshare for anyone interested. It&#8217;s intended for a technical audience, but it is not an overly technical presentation.<br /> Please feel free to comment on it and send in any error I may have made.<br /> Hope you enjoy&#8230;</p><div style="width:425px" id="__ss_3758146"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/markparolisi/wordpress-structure-and-best-practices" title="WordPress Structure and Best Practices">WordPress Structure and Best Practices</a></strong><object width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wpbest-practices-100417071550-phpapp01&#038;stripped_title=wordpress-structure-and-best-practices" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=wpbest-practices-100417071550-phpapp01&#038;stripped_title=wordpress-structure-and-best-practices" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/markparolisi">markparolisi</a>.</div></div> ]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/new-wordpress-slideshow-posted/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Use wp_enqueue_style</title><link>http://markparolisi.com/articles/tutorials/use-wp_enqueue_style/</link> <comments>http://markparolisi.com/articles/tutorials/use-wp_enqueue_style/#comments</comments> <pubDate>Mon, 08 Mar 2010 13:11:56 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://markparolisi.com/?p=186</guid> <description><![CDATA[A few months ago Chris Scott gave a presentation on &#8216;proper&#8217; WordPress plugin development. It was full of great stuff so I thought I&#8217;d pass along a small slice of]]></description> <content:encoded><![CDATA[<p>A few months ago Chris Scott gave a presentation on &#8216;proper&#8217; WordPress plugin development. It was full of great stuff so I thought I&#8217;d pass along a small slice of it here.<br /> <span id="more-186"></span><br /> Instead of writing your CSS and JS to your theme&#8217;s header.php, or echo&#8217;ing it out in a function call; use WP&#8217;s wp_enqueue_style and wp_enqueue_script functions respectively. wp_enqueue_script is really handy to check for/load dependent scripts (jQuery, Scriptalicious, etc) and wp_enqueue_style even works on conditional CSS&#8230;</p><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">wp_enqueue_style<span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'ie7-style'</span><span style="color: #339933;">,</span>
get_template_directory_uri<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>  <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/ie7.css'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_styles</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wp_styles</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add_data</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'ie7-style'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'conditional'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'lte IE 7′ );</span></pre></div></div><p>Chris&#8217; article on condtional CSS is here:<br /> <a href="http://iamzed.com/2010/01/07/using-wordpress-wp_enqueue_style-with-conditionals/">http://iamzed.com/2010/01/07/using-wordpress-wp_enqueue_style-with-conditionals/</a></p><p>and his full presentation is here:<br /> <a href="http://www.slideshare.net/iamzed/youre-doing-it-wrong-wordcamp-orlando">http://www.slideshare.net/iamzed/youre-doing-it-wrong-wordcamp-orlando</a></p> ]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/use-wp_enqueue_style/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Inject Invalid Elements with JS</title><link>http://markparolisi.com/articles/tutorials/inject-invalid-elements-with-js/</link> <comments>http://markparolisi.com/articles/tutorials/inject-invalid-elements-with-js/#comments</comments> <pubDate>Mon, 25 Jan 2010 05:02:17 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://portfolio.markparolisi.com/?p=66</guid> <description><![CDATA[Sometimes you need to add objects to a page from other sources. Like Facebook friendconnect boxes, twitter widgets, or some Google tool(s). Many times, these elements will not pass W3C]]></description> <content:encoded><![CDATA[<p>Sometimes you need to add objects to a page from other sources. Like Facebook friendconnect boxes, twitter widgets, or some Google tool(s). Many times, these elements will not pass W3C validation and ruin your perfectly crafted site. To get around this problem, I use some JavaScript to simply inject these elements into my page after the DOM has rendered.</p><p><span id="more-66"></span>At the bottom of my site I&#8217;ve included a button to launch my Google Voice widget. This was invalidating my markup so I added this bit of code to my jQuery doc.ready to get things squared away.</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="js" style="font-family:monospace;">$(&quot;#content&quot;).append('*google voice object embed code here*');</pre></td></tr></table></div><p>My page now validates perfectly and I didn&#8217;t lose a cool feature.</p> ]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/inject-invalid-elements-with-js/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Open External Links in a New Tab</title><link>http://markparolisi.com/articles/tutorials/open-external-links-in-a-new-tab/</link> <comments>http://markparolisi.com/articles/tutorials/open-external-links-in-a-new-tab/#comments</comments> <pubDate>Mon, 25 Jan 2010 04:39:39 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://portfolio.markparolisi.com/?p=60</guid> <description><![CDATA[This javascript snippet is in almost every site I build. It scans the links on the page and add target=&#8217;_blank&#8217; to any anchor tag with a href not starting with]]></description> <content:encoded><![CDATA[<p>This javascript snippet is in almost every site I build. It scans the links on the page and add target=&#8217;_blank&#8217; to any anchor tag with a href not starting with our domain. Here are two different ways to do it using two different JavaScript libraries.</p><p><span id="more-60"></span>jQuery:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[href^='http://']&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> thehref <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>thehref.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'target'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'_blank'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div><p>mootools:</p><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[href^=&quot;http://&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> href <span style="color: #339933;">=</span> a.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'href'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>href.<span style="color: #660066;">contains</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">location</span>.<span style="color: #660066;">host</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      a.<span style="color: #660066;">setProperty</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'target'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'_blank'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/open-external-links-in-a-new-tab/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Custom WordPress Taxonomies</title><link>http://markparolisi.com/articles/tutorials/custom-wordpress-taxonomies/</link> <comments>http://markparolisi.com/articles/tutorials/custom-wordpress-taxonomies/#comments</comments> <pubDate>Mon, 25 Jan 2010 01:13:28 +0000</pubDate> <dc:creator>Mark</dc:creator> <category><![CDATA[Tutorials]]></category><guid isPermaLink="false">http://portfolio.markparolisi.com/?p=34</guid> <description><![CDATA[I attended the first ever Orlando WordCamp recently and I must say it was amazing. The entire core development team were there. Matt Mullenweg (co-founder) actually told me that this]]></description> <content:encoded><![CDATA[<p>I attended the first ever Orlando WordCamp recently and I must say it was amazing. The entire core development team were there. Matt Mullenweg (co-founder) actually told me that this was the first time they were ever all in one place at the same time, some of them meeting for the first time ever! The day was full of great sessions and I&#8217;d like to impart a nice little trick I learned that may hopefully open up new concepts for your future WP developments.</p><p>We all know how to create categories for our posts. And we can all tag posts too. But how about making a custom taxonomy to greater organize these attributes? Instead of just dumping a bunch of keywords into the tags field, we can make a sort of &#8216;tag category&#8217; if you will.</p><p>I&#8217;m going to cater to my audience and make a taxonomy about programming languages. So let&#8217;s say we have a post that uses both PHP and Mootools, we can tag the post this way.</p><h3>Here is the base function we will use to do this&#8230;</h3><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> register_taxonomy<span style="color: #009900;">&#40;</span><span style="color: #000088;">$taxonomy</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$object_type</span><span style="color: #339933;">,</span>  <span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><ul><li>The first value is the name of our taxonomy. In this case we will call it &#8216;language&#8217;.</li><li>The second refers to what this taxonomy will apply to. We&#8217;ll use &#8216;post&#8217;.</li><li>I won&#8217;t list all of the arguments here, but here are some key ones:<ul><li>hierarchical: Set to &#8216;true&#8217; for category like behavior, &#8216;false&#8217; to use more like tags.</li><li>label: The name that will appear in our Admin Panel.</li><li>query_vars: We will set this to &#8216;true&#8217; so we can call on this data in our template.</li><li>rewrite: Make our links prettier.</li></ul></li></ul><h3>So here is my finished function:</h3><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">register_taxonomy<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'language'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'hierarchical'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'label'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Language'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'query_var'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rewrite'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><h3>THAT&#8217;S IT!</h3><p><a href="http://markparolisi.com/wp-content/uploads/2010/01/taxonomies.png"><img class="alignright size-medium wp-image-35" title="taxonomies" src="http://markparolisi.com/wp-content/uploads/2010/01/taxonomies-300x153.png" alt="" width="300" height="153" /></a>WordPress will automatically build the admin menu&#8217;s for you (see screencap). Now we can assign tags like: &#8216;PHP&#8217;, &#8216;Mootools&#8217;, &#8216;jQuery&#8217;, and they will all be located into the &#8216;language&#8217; taxonomy and not the general &#8216;Post Tags&#8217;.</p><p>So now that we have our custom taxonomy we can call it in our template with these functions</p><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> wp_tag_cloud<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'taxonomy'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'language'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'number'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">45</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #666666; font-style: italic;">//make tag cloud</span></pre></div></div><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #b1b100;">echo</span> get_the_term_list<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'language'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Language: '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #666666; font-style: italic;">//print out the values for the post</span></pre></div></div><div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> query_posts<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'language'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'PHP'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'showposts'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #666666; font-style: italic;">//query the posts for a specified value in your custom taxonomy.</span></pre></div></div><p>Therefore this is a useful tool to greater organize your posts and/or pages</p><p>Well, that&#8217;s it. Hope you&#8217;ve thought of a unique way to incorporate this into your site(s).</p><p>Check out Automattic&#8217;s <a href="http://wordpress.org/extend/themes/p2">P2 theme</a> for a clever usage of this function.</p><p>For more info on custom taxonomies&#8230;</p><p>consult the codex at <a href="http://codex.wordpress.org/">http://codex.wordpress.org/</a></p> ]]></content:encoded> <wfw:commentRss>http://markparolisi.com/articles/tutorials/custom-wordpress-taxonomies/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 1/22 queries in 0.014 seconds using disk: basic
Object Caching 538/575 objects using disk: basic

Served from: markparolisi.com @ 2012-02-05 18:21:40 -->
