<?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>Trent Richardson &#187; Programming</title> <atom:link href="http://trentrichardson.com/category/programming/feed/" rel="self" type="application/rss+xml" /><link>http://trentrichardson.com</link> <description>practical web design &#38; development</description> <lastBuildDate>Wed, 25 Jan 2012 11:43:16 +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>Discussion &#8211; How Asynchronous Should We Get</title><link>http://trentrichardson.com/2011/12/02/discussion-how-asynchronous-should-we-get/</link> <comments>http://trentrichardson.com/2011/12/02/discussion-how-asynchronous-should-we-get/#comments</comments> <pubDate>Fri, 02 Dec 2011 11:06:51 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[ajax]]></category> <category><![CDATA[async]]></category> <category><![CDATA[asyncronous]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=1027</guid> <description><![CDATA[I recently read an article about turning the &#8220;asynchronous-ness&#8221; up a notch. His reasoning was very good, response times keep users on the site longer. Lets go in to more detail. Ajax requests allow users to stay on the same page, while the site contacts the server in the background. This may be to post [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/06/30/clientside-discussion/' rel='bookmark' title='Clientside Discussion'>Clientside Discussion</a></li><li><a
href='http://trentrichardson.com/2011/06/10/filter-select-dropdowns-as-you-type/' rel='bookmark' title='Filter Select Dropdowns as You Type'>Filter Select Dropdowns as You Type</a></li></ol>]]></description> <content:encoded><![CDATA[<p>I recently <a
href="http://alexmaccaw.co.uk/posts/async_ui" target="_blank">read an article</a> about turning the &#8220;asynchronous-ness&#8221; up a notch.  His reasoning was very good, response times keep users on the site longer.  Lets go in to more detail.</p><p>Ajax requests allow users to stay on the same page, while the site contacts the server in the background.  This may be to post some information, or retrieve information, and the polite thing to do these days is to indicate to the user &#8220;Yes, we&#8217;re processing your request, please wait..&#8221;.  But the claim here is there is no need to keep the user waiting.  It&#8217;s pointless and they may as well have done a complete page reload.</p><p>Since we can use asynchronous requests the user can continue what they were doing, while the page request runs in the background.  This makes the response &#8220;feel&#8221; faster to the user, even though it may not technically be.  Now the problem comes in when the user navigates the browser away from the page before an ajax request has completed, causing data incomplete data, or loss of data.  Where is the line drawn where it is &#8220;safe&#8221; to use this method.  To keep all data integrity I would have to say never.</p><p>However, I&#8217;m not going to say &#8220;never&#8221;.  Fact I believe with a little though we can avoid this almost always.  He notes that Google Mail nicely displays a message which is visible, but not in the way of the user moving on to their next task.  And although its ugly we could easily add onbeforeunload listeners to warn the user about navigating away from the page, then remove the listener when the request successfully completes.</p><p>So my thoughts are, why not?</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/06/30/clientside-discussion/' rel='bookmark' title='Clientside Discussion'>Clientside Discussion</a></li><li><a
href='http://trentrichardson.com/2011/06/10/filter-select-dropdowns-as-you-type/' rel='bookmark' title='Filter Select Dropdowns as You Type'>Filter Select Dropdowns as You Type</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/12/02/discussion-how-asynchronous-should-we-get/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Updated Lint for Clientside</title><link>http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/</link> <comments>http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/#comments</comments> <pubDate>Fri, 23 Sep 2011 11:04:53 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[beautify]]></category> <category><![CDATA[clientside]]></category> <category><![CDATA[format]]></category> <category><![CDATA[gedit]]></category> <category><![CDATA[js]]></category> <category><![CDATA[lint]]></category> <category><![CDATA[minify]]></category> <category><![CDATA[plugin]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=940</guid> <description><![CDATA[For those fans of Gedit and Clientside plugin it is time for you to update! The plugin now has updated versions of CSSLint, JSLint, and JSBeautify. As you may know Clientside Plugin provides several utilities to Gedit for working with CSS and Javascript, including minifying, formatting, and error checking/lint. Also as a bonus it can [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li><li><a
href='http://trentrichardson.com/2011/06/29/gedit-clientside-now-with-csslint/' rel='bookmark' title='Gedit Clientside Now with CSSLint'>Gedit Clientside Now with CSSLint</a></li></ol>]]></description> <content:encoded><![CDATA[<p>For those fans of Gedit and Clientside plugin it is time for you to update!  The plugin now has updated versions of CSSLint, JSLint, and JSBeautify.</p><p>As you may know <a
href="http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/" title="Gedit Clientside Plugin for CSS and Javascript" target="_blank">Clientside Plugin</a> provides several utilities to <a
href="http://projects.gnome.org/gedit/" title="Gedit" target="_blank">Gedit</a> for working with CSS and Javascript, including minifying, formatting, and error checking/lint.  Also as a bonus it can batch minify multiple css or javascript files.  Where it really comes in handy is formatting old code from yesteryear, when the developer had no coding style at all.</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li><li><a
href='http://trentrichardson.com/2011/06/29/gedit-clientside-now-with-csslint/' rel='bookmark' title='Gedit Clientside Now with CSSLint'>Gedit Clientside Now with CSSLint</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Inspect and Debug with Email Dissector</title><link>http://trentrichardson.com/2011/08/23/inspect-and-debug-with-email-dissector/</link> <comments>http://trentrichardson.com/2011/08/23/inspect-and-debug-with-email-dissector/#comments</comments> <pubDate>Tue, 23 Aug 2011 11:33:21 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[alternate]]></category> <category><![CDATA[attachment]]></category> <category><![CDATA[debug]]></category> <category><![CDATA[email]]></category> <category><![CDATA[inspect]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[python]]></category> <category><![CDATA[smtp]]></category> <category><![CDATA[source]]></category> <category><![CDATA[test]]></category> <category><![CDATA[text]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=912</guid> <description><![CDATA[Everyone needs to test emails for web applications, but it turns your inbox into a mess. Not to mention constantly refreshing your web mail and clicking Send/Receive. You struggle to find the broken html, and viewing your text and html alternate versions just takes too much time. This is where Email Dissector comes in to [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/10/07/ubuntu-11-10-almost-here/' rel='bookmark' title='Ubuntu 11.10 Almost Here'>Ubuntu 11.10 Almost Here</a></li><li><a
href='http://trentrichardson.com/2011/03/17/send-mail-locally-on-ubuntu/' rel='bookmark' title='Send Mail Locally on Ubuntu'>Send Mail Locally on Ubuntu</a></li></ol>]]></description> <content:encoded><![CDATA[<p>Everyone needs to test emails for web applications, but it turns your inbox into a mess.  Not to mention constantly refreshing your web mail and clicking Send/Receive.  You struggle to find the broken html, and viewing your text and html alternate versions just takes too much time.</p><p><a
href="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-html.png"><img
src="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-html-300x176.png" alt="" title="Email Dissector html tab" width="300" height="176" class="alignright size-medium wp-image-919" /></a></p><p>This is where Email Dissector comes in to play.  Email Dissector creates a dummy smtp server right on your desktop.  It will then intercept any outgoing emails on the host and port it is listening on, and present them to you in a few different formats: HTML, HTML Source, Text (for multipart emails with alternate text versions), raw headers, and attachments.</p><p>Since the email server is contained right in the application, there is zero wait time.  The inbox is refreshed immediately!  Also the Inbox is the only box, as this is development work only.</p><p><span
id="more-912"></span></p><p>Before we get too carried away it needs to be noted right off the bat that the html view uses webkit.  This means it is likely much more advanced than the general email client, so don&#8217;t get too far ahead of yourself with css and javascript. The good part is you can quickly see any major issues before debugging in 50 different email clients.</p><p>The html source view elegantly shows off the markup.  Now you can see what is wrong with your html.</p><p><a
href="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-source.png"><img
src="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-source-300x176.png" alt="" title="Email Dissector Source Tab" width="300" height="176" class="alignnone size-medium wp-image-920" /></a></p><p>The Text tab is for alternate text versions of emails.  If your email client is html capable (which it probably is) it can be difficult to find the the text versions of emails if they are supplied.  Believe it or not but some people actually like text emails as they are generally short and to the point.  Email Dissector presents this conviniently.</p><p><a
href="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-text.png"><img
src="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-text-300x176.png" alt="" title="Email Dissector Text Tab" width="300" height="176" class="alignnone size-medium wp-image-921" /></a></p><p>Looking for the encoding or your reply-to values?  Check the Raw tab to see all the headers sent</p><p><a
href="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-raw.png"><img
src="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-raw-300x176.png" alt="" title="Email Dissector Raw Tab" width="300" height="176" class="alignnone size-medium wp-image-922" /></a></p><p>Finally you can see what attachments were sent.</p><p><a
href="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-attachments.png"><img
src="http://trentrichardson.com/wp-content/uploads/2011/08/Screenshot-Email-Dissector-attachments-300x176.png" alt="" title="Email Dissector Attachments Tab" width="300" height="176" class="alignnone size-medium wp-image-923" /></a></p><p>Thats all there is to this simple little program, but it should surely speed up you email development significantly!  Best part is it is developed in python, so it should run most anywhere python does as long as Webkit is available. (So far tested on Ubuntu and Windows).  Enjoy!</p><p><a
href="https://github.com/trentrichardson/Python-Email-Dissector" title="Python Email Dissector on Github" target="_blank">Python Email Dissector on Github</a></p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/10/07/ubuntu-11-10-almost-here/' rel='bookmark' title='Ubuntu 11.10 Almost Here'>Ubuntu 11.10 Almost Here</a></li><li><a
href='http://trentrichardson.com/2011/03/17/send-mail-locally-on-ubuntu/' rel='bookmark' title='Send Mail Locally on Ubuntu'>Send Mail Locally on Ubuntu</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/08/23/inspect-and-debug-with-email-dissector/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Send Mail Locally on Ubuntu</title><link>http://trentrichardson.com/2011/03/17/send-mail-locally-on-ubuntu/</link> <comments>http://trentrichardson.com/2011/03/17/send-mail-locally-on-ubuntu/#comments</comments> <pubDate>Thu, 17 Mar 2011 11:06:05 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=755</guid> <description><![CDATA[I develop php backends for websites on the regular. And far to often I end up sending emails, and need to test their layouts by sending them to my primary email address. But wouldn&#8217;t it be MUCH more convenient to send them to an email address @localhost and keep my primary account clean? Well you&#8217;re [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2008/04/21/localhost-subdomains-on-ubuntu/' rel='bookmark' title='Localhost Subdomains on Ubuntu'>Localhost Subdomains on Ubuntu</a></li><li><a
href='http://trentrichardson.com/2008/05/18/why-not-to-use-sudo-graphically/' rel='bookmark' title='Why Not To Use Sudo Graphically'>Why Not To Use Sudo Graphically</a></li><li><a
href='http://trentrichardson.com/2008/11/12/intrepid-ibex-and-apache2-virtualhosts/' rel='bookmark' title='Intrepid Ibex and Apache2 VirtualHost'>Intrepid Ibex and Apache2 VirtualHost</a></li></ol>]]></description> <content:encoded><![CDATA[<p>I develop php backends for websites on the regular.  And far to often I end up sending emails, and need to test their layouts by sending them to my primary email address.  But wouldn&#8217;t it be MUCH more convenient to send them to an email address @localhost and keep my primary account clean?  Well you&#8217;re about to.</p><p>As you may know the easiest way on Ubuntu to get up and running with php is through Postfix.  So lets get started and install a couple packages.  You can do this either in Synaptic or the terminal.</p><pre><code class="shell">
sudo apt-get install postfix, mailutils, courier-pop, courier-imap
</code></pre><p>Now we need to tell postfix we want to use MailDir style mailbox, and listen on localhost:</p><pre><code class="shell">
sudo postconf -e "home_mailbox = Maildir/"
sudo postconf -e "mailbox_command = "
sudo postconf -e "mydestination = localhost, mail.localhost"
sudo  /etc/init.d/postfix restart
</code></pre><p>Ok, as you can see you can also add more domains to &#8220;mydestination&#8221;, you can do as you please here.  With a little luck our postfix should be configured.  Next we need to actually create our <a
href="http://en.wikipedia.org/wiki/Maildir">MailDir mailboxes</a>.  These are simply folders in our home directory.  You can do this in your file browser or the terminal:</p><pre><code class="shell">
mkdir ~/Maildir
mkdir ~/Maildir/new
mkdir ~/Maildir/cur
mkdir ~/Maildir/tmp
</code></pre><p>Now we have a place to store all of our messages.  Finally we just need to configure Evolution to read our messages.  You should already have evolution installed.  This part is pretty easy.  Create a new account at username@localhost where your username is your ubuntu login username.  Set your Receiving to Maildir, and on the Sending options use sendmail.</p><p>Now you should be able to send and receive mail to username@localhost.  It would be nice to test html emails in more than just Evolution, however not many email clients appear to support a Maildir receiving format.  I&#8217;m not an email expert however, so I&#8217;m always up suggestions</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2008/04/21/localhost-subdomains-on-ubuntu/' rel='bookmark' title='Localhost Subdomains on Ubuntu'>Localhost Subdomains on Ubuntu</a></li><li><a
href='http://trentrichardson.com/2008/05/18/why-not-to-use-sudo-graphically/' rel='bookmark' title='Why Not To Use Sudo Graphically'>Why Not To Use Sudo Graphically</a></li><li><a
href='http://trentrichardson.com/2008/11/12/intrepid-ibex-and-apache2-virtualhosts/' rel='bookmark' title='Intrepid Ibex and Apache2 VirtualHost'>Intrepid Ibex and Apache2 VirtualHost</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/03/17/send-mail-locally-on-ubuntu/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Advanced Media Queries for Mobile Devices</title><link>http://trentrichardson.com/2011/03/15/advanced-media-queries-for-mobile-devices/</link> <comments>http://trentrichardson.com/2011/03/15/advanced-media-queries-for-mobile-devices/#comments</comments> <pubDate>Tue, 15 Mar 2011 11:18:50 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=750</guid> <description><![CDATA[In my previous post I covered a basic example of using CSS Media Queries to create a slick left menu to auto hide when the screen is smaller than 500px. This post I want to take that a step further. Lets say we want to show the navigation on landscape orientation with the ipad, but [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/11/effective-example-of-css-media-queries/' rel='bookmark' title='Effective Example of CSS Media Queries'>Effective Example of CSS Media Queries</a></li><li><a
href='http://trentrichardson.com/2009/06/18/7-lucky-tips-for-mobile-development/' rel='bookmark' title='7 Lucky Tips for Mobile Development'>7 Lucky Tips for Mobile Development</a></li></ol>]]></description> <content:encoded><![CDATA[<p>In my previous post I covered a basic example of using <a
href="http://trentrichardson.com/2011/03/11/effective-example-of-css-media-queries/">CSS Media Queries</a> to create a slick left menu to auto hide when the screen is smaller than 500px.  This post I want to take that a step further.</p><p>Lets say we want to show the navigation on landscape orientation with the ipad, but hide on portrait orientation.  On top of that if the device is smaller than 480px lets hide as well.  This should include the iPhone.  Lets be honest, there is only so much space on a phone.</p><p>We start out with the same html layout as the previous post:</p><pre><code class="html">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Advanced CSS Media Query&lt;/title&gt;
		&lt;link rel="stylesheet" href="advanced.css" /&gt;
		&lt;script src="http://code.jquery.com/jquery-1.5.min.js"&gt;&lt;/script&gt;
		&lt;script type="text/javascript"&gt;
			$(function(){
				$('#nav').bind('touchend', function(){
					$t = $(this);
					if($t.hasClass('focus'))
						$t.removeClass('focus');
					else $t.addClass('focus');
				});
			});
		&lt;/script&gt;
	&lt;/head&gt;

	&lt;body&gt;

		&lt;div id="wrapper"&gt;

			&lt;div id="nav"&gt;
				&lt;ul&gt;
					&lt;li&gt;&lt;a href="#" title="Link"&gt;Link to Home&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#" title="Link"&gt;Link to There&lt;/a&gt;&lt;/li&gt;
					&lt;li&gt;&lt;a href="#" title="Link"&gt;Link to Here&lt;/a&gt;&lt;/li&gt;

					&lt;li&gt;&lt;a href="#" title="Link"&gt;Link to This&lt;/a&gt;&lt;/li&gt;
				&lt;/ul&gt;
			&lt;/div&gt;

			&lt;div id="content"&gt;
				&lt;h1&gt;This is the Title&lt;/h1&gt;

				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;

				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;
				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;
				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;

				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;
				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
				&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.&lt;/p&gt;
				&lt;p&gt;Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/p&gt;
			&lt;/div&gt;

		&lt;/div&gt;

	&lt;/body&gt;
&lt;/html&gt;
</code></pre><p>You&#8217;ll notice I added a bit of javascript.   We&#8217;ll cover that in a moment.  Now for the CSS:</p><pre><code class="css">
@charset "UTF-8";

/*
*    Mass Reset
*/
*{ margin: 0; padding: 0; border: 0; }
body{ background-color: #f4fff4; font: normal 1em/1.5em Arial, Serif; }

/*
*    Normal layout
*/
#wrapper{  }
#wrapper #nav{ width: 160px; float: left; background-color: #eeeeee; border-right: solid 20px #aaa; height: 100%; position: fixed; z-index: 1000; }
#wrapper #content{ margin-left: 180px; padding: 10px 20px; position: relative; z-index: 100; }

#wrapper #nav ul{ list-style: none; }
#wrapper #nav ul li a{ display: block; padding: 8px 5px 8px 10px; border-bottom: solid 1px #aaa; color: #548f54; text-decoration: none; }
#wrapper #content h1,
#wrapper #content p{ margin: 5px 0; }

/*
*    When screen is smaller than 480px or portrait
*/
@media (orientation:portrait), (max-device-width:480px), (max-width:480px){

	#wrapper #nav{ margin: 0 0 0 -160px; opacity: 0.95; }
	#wrapper #content{ margin-left: 20px; }

	#wrapper #nav:hover,
	#wrapper #nav:focus,
	#wrapper #nav.focus{
		margin: 0 -160px 0 0;

		-moz-transition-property: margin;
		-moz-transition-duration: 1s;
		-moz-transition-timing-function: ease-out;
		-webkit-transition-property: margin;
		-webkit-transition-duration: 1s;
		-o-transition-property: margin;
		-o-transition-duration: 1s;
	}
}
</code></pre><p>Now, we know we have a couple scenarios to consider, orientation: portrait and max-width: 480px.  So as you can see I listed those conditions in my @media.  Pretty straight forward addition to the basic example.</p><p>Ok, so now you&#8217;re wondering about that javascript&#8230;</p><pre><code class="js">
$(function(){
	$('#nav').bind('touchend', function(){
		$t = $(this);
		if($t.hasClass('focus'))
			$t.removeClass('focus');
		else $t.addClass('focus');
	});
});
</code></pre><p>Unfortunately for many touch screen phones these days there is no mouse, so being able to fire the &#8220;hover&#8221; in the css is impossible.  So we are simply going to add a class &#8220;focus&#8221; to the nav on the &#8220;touchend&#8221; event, where when you touch the #nav handle the menu will slide out.  (if you notice we added the .focus class also in the CSS along with the &#8220;:hover&#8221; pseudoselector)</p><p>Thats all there is to it.  You should now have a fully working navigation menu that slides out and hides on certain orientations or screen widths.  And as always I&#8217;ve provided the <a
href="http://trentrichardson.com/examples/css-media-query/advanced.html">working example</a>.</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/11/effective-example-of-css-media-queries/' rel='bookmark' title='Effective Example of CSS Media Queries'>Effective Example of CSS Media Queries</a></li><li><a
href='http://trentrichardson.com/2009/06/18/7-lucky-tips-for-mobile-development/' rel='bookmark' title='7 Lucky Tips for Mobile Development'>7 Lucky Tips for Mobile Development</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/03/15/advanced-media-queries-for-mobile-devices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Javascript Ordering Object: Order Your Hash</title><link>http://trentrichardson.com/2011/02/08/javascript-ordering-object-order-your-hash/</link> <comments>http://trentrichardson.com/2011/02/08/javascript-ordering-object-order-your-hash/#comments</comments> <pubDate>Tue, 08 Feb 2011 13:11:06 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Javascript]]></category> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=707</guid> <description><![CDATA[In my last post I discussed creating a method to inject values into a javascript object in a specific order. However, it was brought to my attention that natively, the javascript standard (ECMA) never specifically says this is a supported feature, and that some browsers treat this differently. So knowing that and the fact that [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/01/27/object-inject-insert-item-into-javascript-hash/' rel='bookmark' title='Object Inject &#8211; Insert Item into Javascript Hash'>Object Inject &#8211; Insert Item into Javascript Hash</a></li><li><a
href='http://trentrichardson.com/2011/09/29/looping-through-dates-with-javascript/' rel='bookmark' title='Looping Through Dates with Javascript'>Looping Through Dates with Javascript</a></li><li><a
href='http://trentrichardson.com/2010/04/06/compute-linear-regressions-in-javascript/' rel='bookmark' title='Compute Linear Regressions in Javascript'>Compute Linear Regressions in Javascript</a></li></ol>]]></description> <content:encoded><![CDATA[<p>In my <a
href="http://trentrichardson.com/2011/01/27/object-inject-insert-item-into-javascript-hash/">last post</a> I discussed creating a method to inject values into a javascript object in a specific order.  However, it was brought to my attention that natively, the javascript standard (ECMA) never specifically says this is a supported feature, and that some browsers treat this differently.  So knowing that and the fact that I needed this functionality I created my own object capable of handling such!  Introducing my <a
href="https://github.com/trentrichardson/Ordering">Ordering object</a>.</p><p>The theory here is that you can create a new object by passing in a normal javascript object.  Also either in the constructor you can specify a sorting function or manually call sort against your object.  From then on when you insert into your object it will be placed in accordance to your sort routine.  The beauty of this is that it brings together the power of the javascript Object and the javascript Array.  Here is how to create a new object:</p><pre><code class="javascript">
// Our sort function, this is how we want to keep our object ordered
var sf = function(ak,av,bk,bv){
	var v1 = av.toLowerCase(),v2 = bv.toLowerCase();

	if(v1 < v2) return -1;
	if(v1 > v2) return 1;
	return 0;
}

var ord = new Ordering({
	Tom: 'first',
	Jane: 'second',
	Sally: 'third',
	Bill: 'forth',
	Lee: 'fifth',
	Carl: 'sixth',
	Stan: 'seventh',
	Earl: 'eighth',
	Paul: 'ninth',
	Tray: 'tenth'
}, sf);
</code></pre><p>This creates an ordering object which will be sorted alphabetically by the values.  Keep in mind the values can be any data type you wish, and you can handle them how you need to in your sort functions.  But wait! There&#8217;s More!</p><p>If you need to inject an item at a specific position, you can use the inject method:</p><pre><code class="javascript">
ord.inject('Trent', 'NEW ITEM', function(pk, pv, nk, nv){
	return (nk=='Earl');
});
</code></pre><p>To set a value:</p><pre><code class="javascript">
ord.set('Ted','ocho');
</code></pre><p>To erase a value:</p><pre><code class="javascript">
ord.erase('Sally');
</code></pre><p>To loop over the object (in order):</p><pre><code class="javascript">
str = '';
ord.each(function(k,v){
	str += k +': '+ v +'\n';
});
</code></pre><p>To resort your object (pass in an optional sort function like the one from the constructor)</p><pre><code class="javascript">
ord.sort();
</code></pre><p>There are also other functions implemented like:</p><ul><li>feed(object) (populate the object)</li><li>every(fn)</li><li>some(fn)</li><li>map(fn)</li><li>filter(fn)</li><li>subset(fn)</li><li>slice(start, end)</li><li>get(key)</li><li>getAt(numeric_index)</li><li>indexOf(key)</li><li>clone()</li><li>keys() (return an array of the keys, in order)</li></ul><p>The source is also very straight forward, so don&#8217;t be shy if you&#8217;re unaware how to use something, just dive right in and figure it out.  There is also an html file with the source with some examples.  Enjoy!</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/01/27/object-inject-insert-item-into-javascript-hash/' rel='bookmark' title='Object Inject &#8211; Insert Item into Javascript Hash'>Object Inject &#8211; Insert Item into Javascript Hash</a></li><li><a
href='http://trentrichardson.com/2011/09/29/looping-through-dates-with-javascript/' rel='bookmark' title='Looping Through Dates with Javascript'>Looping Through Dates with Javascript</a></li><li><a
href='http://trentrichardson.com/2010/04/06/compute-linear-regressions-in-javascript/' rel='bookmark' title='Compute Linear Regressions in Javascript'>Compute Linear Regressions in Javascript</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2011/02/08/javascript-ordering-object-order-your-hash/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Thought: Is else return really necessary?</title><link>http://trentrichardson.com/2010/12/01/thought-is-else-return-really-necessary/</link> <comments>http://trentrichardson.com/2010/12/01/thought-is-else-return-really-necessary/#comments</comments> <pubDate>Wed, 01 Dec 2010 12:55:22 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Programming]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=692</guid> <description><![CDATA[Its probably because I&#8217;m over thinking things, but is &#8220;else return ..something..&#8221; really necessary? Think about it. Shouldn&#8217;t both of these snippets give the same result? if(a == b){ return true; } else return false; And&#8230; if(a == b){ return true; } return false; In theory as well that would be a little less file [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2008/05/22/jsonsql-ported-to-php/' rel='bookmark' title='JsonSQL Ported to PHP'>JsonSQL Ported to PHP</a></li><li><a
href='http://trentrichardson.com/2012/01/04/return-multiple-result-sets-with-php-and-postgresql-functions/' rel='bookmark' title='Return Multiple Result Sets with PHP and PostgreSQL Functions'>Return Multiple Result Sets with PHP and PostgreSQL Functions</a></li></ol>]]></description> <content:encoded><![CDATA[<p>Its probably because I&#8217;m over thinking things, but is &#8220;else return ..something..&#8221; really necessary?  Think about it.  Shouldn&#8217;t both of these snippets give the same result?</p><pre><code class="javascript">
if(a == b){
	return true;
}
else return false;
</code></pre><p>And&#8230;</p><pre><code class="javascript">
if(a == b){
	return true;
}
return false;
</code></pre><p>In theory as well that would be a little less file size by removing all &#8220;else return&#8230;&#8221; and leaving just &#8220;return&#8230;&#8221;.  I started thinking on this while creating the <a
href="http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/">Gedit Clientside Plugin</a> (try it out).</p><p>First off JSLint likes brackets around conditions (even one line conditions).  Not sure why as its perfectly ok not to have brackets.  This seems more like the developers preference to me.  Then JSMin produced bad javascript when handling an else return in some code.  Adding brackets or making the change above solved that problem.</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2008/05/22/jsonsql-ported-to-php/' rel='bookmark' title='JsonSQL Ported to PHP'>JsonSQL Ported to PHP</a></li><li><a
href='http://trentrichardson.com/2012/01/04/return-multiple-result-sets-with-php-and-postgresql-functions/' rel='bookmark' title='Return Multiple Result Sets with PHP and PostgreSQL Functions'>Return Multiple Result Sets with PHP and PostgreSQL Functions</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2010/12/01/thought-is-else-return-really-necessary/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Gedit Clientside Plugin</title><link>http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/</link> <comments>http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/#comments</comments> <pubDate>Tue, 30 Nov 2010 12:56:00 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[beautify]]></category> <category><![CDATA[format]]></category> <category><![CDATA[gedit]]></category> <category><![CDATA[minify]]></category> <category><![CDATA[plugin]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=686</guid> <description><![CDATA[For all of the gedit nuts out there (like myself) who develop css and javascript, I have created a gedit plugin just for you. The Gedit Clientside Plugin. This plugin can minify and beautify javascript and css. Also for javascript you jsLint is included. Finally for good measure, I threw in a gzip method as [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/' rel='bookmark' title='Updated Lint for Clientside'>Updated Lint for Clientside</a></li><li><a
href='http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/' rel='bookmark' title='Gedit Minifier Plugin'>Gedit Minifier Plugin</a></li></ol>]]></description> <content:encoded><![CDATA[<p><a
href="http://trentrichardson.com/wp-content/uploads/2010/11/gedit-clientside-plugin.jpg"><img
src="http://trentrichardson.com/wp-content/uploads/2010/11/gedit-clientside-plugin.jpg" alt="" title="gedit-clientside-plugin" width="422" height="161" class="alignnone size-full wp-image-688" /></a></p><p>For all of the gedit nuts out there (like myself) who develop css and javascript, I have created a gedit plugin just for you.  The Gedit Clientside Plugin.  This plugin can minify and beautify javascript and css.  Also for javascript you jsLint is included.  Finally for good measure, I threw in a gzip method as well.</p><p>Before I go any further, let me get you to the github page where you&#8217;ll find plenty of documentation and more importantly the download:</p><p><a
href="https://github.com/trentrichardson/Gedit-Clientside-Plugin">Gedit Clientside Plugin</a></p><p>This plugin mostly uses other open source tools, such as:</p><ul><li><a
href="http://jsbeautifier.org/">JS-Beautifier</a> to format and &#8220;Unminify&#8221;</li><li><a
href="http://www.crockford.com/javascript/jsmin.html">JSMin</a> to minify</li><li><a
href="http://www.jslint.com/">JSLint</a> to look for syntax issues</li><li><a
href="http://csstidy.sourceforge.net/">CSSTidy</a> to beautify and minify css</li><li><a
href="https://github.com/stubbornella/csslint">CSSLint</a> to look for syntax issues</li></ul><p>And to run these excellent tools there are two prerequisites (you probably already have one):</p><ul><li><a
href="http://php.net/">PHP</a> to run CSSTidy</li><li><a
href="http://nodejs.org/">NodeJS</a> to run JSLint and JS-Beautifier</li></ul><p>As I mentioned there is documentation on the Github page, so for usage and further configuration check there.  Hope you enjoy!</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/' rel='bookmark' title='Updated Lint for Clientside'>Updated Lint for Clientside</a></li><li><a
href='http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/' rel='bookmark' title='Gedit Minifier Plugin'>Gedit Minifier Plugin</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/feed/</wfw:commentRss> <slash:comments>34</slash:comments> </item> <item><title>Updated Gedit Minify Plugin</title><link>http://trentrichardson.com/2010/10/11/updated-gedit-minify-plugin/</link> <comments>http://trentrichardson.com/2010/10/11/updated-gedit-minify-plugin/#comments</comments> <pubDate>Mon, 11 Oct 2010 11:52:31 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[gedit]]></category> <category><![CDATA[minify]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=673</guid> <description><![CDATA[It didn&#8217;t take long to notice a couple changes which needed to be made to the minify plugin. With the amount of javascript development I&#8217;ve been doing I use it regularly. One change is the shortcut keys conflicted with other plugins which I use, so I changed them to the following: Minify JS: Ctrl+U Minify [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/' rel='bookmark' title='Gedit Minifier Plugin'>Gedit Minifier Plugin</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li></ol>]]></description> <content:encoded><![CDATA[<p>It didn&#8217;t take long to notice a couple changes which needed to be made to the minify plugin.  With the amount of javascript development I&#8217;ve been doing I use it regularly.  One change is the shortcut keys conflicted with other plugins which I use, so I changed them to the following:</p><ul><li>Minify JS: Ctrl+U</li><li>Minify CSS: Ctrl+Alt+U</li></ul><p>The other issue (not really an issue but it bothered me) is that the JSMin library the plugin is using didn&#8217;t clean all line breaks, leaving many lines even if there are few characters on each line.  I added a quick regular expression to clean up those.  Now we get a nice one-liner.  I&#8217;ve mainly been minifying the same few scripts over and over so I hope this works for other libraries as well.</p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/' rel='bookmark' title='Gedit Minifier Plugin'>Gedit Minifier Plugin</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2010/10/11/updated-gedit-minify-plugin/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Gedit Minifier Plugin</title><link>http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/</link> <comments>http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/#comments</comments> <pubDate>Tue, 05 Oct 2010 03:42:02 +0000</pubDate> <dc:creator>trent</dc:creator> <category><![CDATA[CSS]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[gedit]]></category> <category><![CDATA[jsmin]]></category> <category><![CDATA[minify]]></category> <category><![CDATA[python]]></category><guid
isPermaLink="false">http://trentrichardson.com/?p=659</guid> <description><![CDATA[I often find myself having to do a lot of jumping around to develop. I write the code, test, then minify, then copy files, etc.. I also have a strange interest in gedit, so I decided I&#8217;d create a quick little plugin to minify files for me. The plugin is dirt simple. While your file [...]
Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li><li><a
href='http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/' rel='bookmark' title='Updated Lint for Clientside'>Updated Lint for Clientside</a></li></ol>]]></description> <content:encoded><![CDATA[<p><a
href="http://trentrichardson.com/wp-content/uploads/2010/10/gedit-minifier-plugin.jpg"><img
src="http://trentrichardson.com/wp-content/uploads/2010/10/gedit-minifier-plugin.jpg" alt="" title="gedit-minifier-plugin" width="550" height="188" class="size-full wp-image-660" /></a></p><p>I often find myself having to do a lot of jumping around to develop.  I write the code, test, then minify, then copy files, etc.. I also have a strange interest in gedit, so I decided I&#8217;d create a quick little plugin to minify files for me.  The plugin is dirt simple.  While your file (javascript or css) is the active document, just go to Tools->Minify JS or Tools->Minify CSS and it will take the contents of the current file, minify it, and save it to the clipboard.  From there you can just paste the new minified code where ever.</p><p>I can&#8217;t take all the credit however, the <a
href="http://www.crockford.com/javascript/jsmin.py.txt">JSMin</a> library is used to do the actual minification, I&#8217;ve just wrapped it up nicely in a gedit plugin.  Please check it out.  I&#8217;ve enjoyed developing this little plugin so I may have found another area of interest!  I&#8217;d love to hear if anyone else uses it!</p><p><a
href="http://github.com/trentrichardson/Gedit-Minifier-Plugin" title="Download Gedit Minifier Plugin">Download Gedit Minifier Plugin</a></p><p>Related posts:<ol><li><a
href='http://trentrichardson.com/2011/03/02/gedit-clientside-plugin-gets-batch-minify-option/' rel='bookmark' title='Gedit Clientside Plugin gets Batch Minify Option'>Gedit Clientside Plugin gets Batch Minify Option</a></li><li><a
href='http://trentrichardson.com/2010/11/30/gedit-clientside-plugin/' rel='bookmark' title='Gedit Clientside Plugin'>Gedit Clientside Plugin</a></li><li><a
href='http://trentrichardson.com/2011/09/23/updated-lint-for-clientside/' rel='bookmark' title='Updated Lint for Clientside'>Updated Lint for Clientside</a></li></ol></p>]]></content:encoded> <wfw:commentRss>http://trentrichardson.com/2010/10/04/gedit-minifier-plugin/feed/</wfw:commentRss> <slash:comments>2</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/118 queries in 0.060 seconds using disk: basic
Object Caching 2711/2842 objects using disk: basic

Served from: trentrichardson.com @ 2012-02-03 22:37:44 -->
