<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Shortround.net</title>
	
	<link>http://www.shortround.net</link>
	<description>The little slice of the web of Stephen H. Gerstacker</description>
	<lastBuildDate>Mon, 06 Feb 2012 15:32:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Shortroundnet" /><feedburner:info uri="shortroundnet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>First Serve</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/_taA1DU03P0/</link>
		<comments>http://www.shortround.net/2012/02/06/first-serve/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 15:32:51 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=459</guid>
		<description><![CDATA[Off of a random tweet, I found out that First Serve is a thing. Not only that, it&#8217;s Plug 1 &#38; Plug 2 from De La Soul, or at least their alter egos. That&#8217;s a nice Monday morning present.]]></description>
			<content:encoded><![CDATA[<p>Off of a random tweet, I found out that First Serve is a thing.  Not only that, it&#8217;s Plug 1 &amp; Plug 2 from De La Soul, or at least their alter egos.  That&#8217;s a nice Monday morning present.</p>

<object height="81" width="100%"><param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F33561925&#038;g=1&#038;"></param><embed height="81" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F33561925&#038;g=1&#038;" type="application/x-shockwave-flash" width="100%"> </embed> </object>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/_taA1DU03P0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2012/02/06/first-serve/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2012/02/06/first-serve/</feedburner:origLink></item>
		<item>
		<title>Keyboard Shortcuts in iOS</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/VP2iHUKOmDM/</link>
		<comments>http://www.shortround.net/2011/12/20/keyboard-shortcuts-in-ios/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 23:10:22 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=446</guid>
		<description><![CDATA[iOS 5 has been out for a while, but it seems most people missed out one of my favorite new features. Buried in your settings are your Keyboard Shortcuts. If you&#8217;re familiar with TextExpander, this is a light version of that. Otherwise, it&#8217;s a simple way to type a couple of characters which are then [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.apple.com/ios/" title="Apple - iOS 5 - 200+ new features for iPad, iPhone, and iPod touch.">iOS 5</a> has been out for a while, but it seems most people missed out one of my favorite new features.  Buried in your settings are your Keyboard Shortcuts.  If you&#8217;re familiar with <a href="http://www.smilesoftware.com/TextExpander/" title="TextExpander: Mac Typing Shortcut Utility Saves You Time!">TextExpander</a>, this is a light version of that.  Otherwise, it&#8217;s a simple way to type a couple of characters which are then converted into a larger, harder to type string.  Even though typing on an iOS device works, this streamlines some tedious typing.</p>

<h2>The Setup</h2>

<p>First, you need to find the menu.  Open <em>Settings</em>, go to <em>General</em>, then <em>Keyboard</em> and scroll to the bottom.  You&#8217;ll notice a default one, which I deleted.  Click the <em>Add New Shortcut&#8230;</em> button at the bottom.  You&#8217;re presented with two options: Phrase and Shortcut.  Phrase is the full, final text you want to be displayed.  Shortcut is the short phrase that you want converted.</p>

<p><img src="http://www.shortround.net/wp-content/uploads/2011/12/shortcuts.png" alt="" title="Shortcuts" width="320" height="480" class="alignnone size-full wp-image-453" /></p>

<p>Below is what I use.  I prepend an &#8220;s&#8221; for &#8220;Stephen&#8221;:</p>

<ul>
<li><strong>Phrase</strong>: my email address, <strong>Shortcut</strong>: se-</li>
<li><strong>Phrase</strong>: my phone number, <strong>Shortcut</strong>: sp-</li>
<li><strong>Phrase</strong>: my home address, <strong>Shortcut</strong>: sa-</li>
</ul>

<p>Now, when you&#8217;re in Safari and you need to submit your phone number or email address, you just type <code>se-</code> and the autocorrect field comes up with the full email address.</p>

<p><img src="http://www.shortround.net/wp-content/uploads/2011/12/replacement.png" alt="" title="Replacement" width="320" height="131" class="alignnone size-full wp-image-454" /></p>

<h2>A Bonus</h2>

<p>As a bonus, if you leave the Shortcut field blank, the word in Phrase will be considered spelled correctly.  This eliminates the &#8220;ducking&#8221; problem, if you know what I mean.</p>

<h2>The Down Side</h2>

<p>There are a couple down sides to Apple&#8217;s implementation.</p>

<ol>
<li>Your shortcuts are not portable.  If you have an iPhone and an iPad, you have to put the shortcuts into each device separately.  Maybe this will be fixed with iCloud at some point.</li>
<li>You can&#8217;t put line breaks in to your Phrase.  This means that my address is all on one line.</li>
</ol>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/VP2iHUKOmDM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2011/12/20/keyboard-shortcuts-in-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2011/12/20/keyboard-shortcuts-in-ios/</feedburner:origLink></item>
		<item>
		<title>Multipart Alternative + Multipart Related Email with ActionMailer for Rails 3</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/iEVYeKbyG_4/</link>
		<comments>http://www.shortround.net/2011/04/07/multipart-alternative-multipart-related-email-with-actionmailer-for-rails-3/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 16:46:30 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=99</guid>
		<description><![CDATA[Since the first post on this topic, I have migrated my app from Rails 2.3.11 to Rails 3.0.6. See the first post if you still need the solution for Rails 2. I had a need at work to send email out of our Rails application which met the following criteria: It has both a plain [...]]]></description>
			<content:encoded><![CDATA[<p>Since the <a href="http://www.shortround.net/2010/11/24/multipart-alternative-multipart-related-email-with-actionmailer/">first post</a> on this topic, I have migrated my app from Rails 2.3.11 to Rails 3.0.6.  See the <a href="http://www.shortround.net/2010/11/24/multipart-alternative-multipart-related-email-with-actionmailer/">first post</a> if you still need the solution for Rails 2.</p>

<p>I had a need at work to send email out of our <a href="http://rubyonrails.org" title="Ruby on Rails">Rails</a> application which met the following criteria:</p>

<ul>
<li>It has both a plain text and HTML part.</li>
<li>It may have embedded images in the HTML part.</li>
<li>It may have attachments.</li>
</ul>

<p>Below is the code, which you can put in your <code>app/models</code> directory.</p>

<pre class="prettyprint linenums">class EmbeddedMailer &lt; ActionMailer::Base

  def embedded_mail(to, from, subject, html_message, text_message, files = {}, embeds = {})
    mail(:to =&gt; to, :from =&gt; from, :subject =&gt; subject) do |format|
      format.text { render :text =&gt; text_message }
      format.html { render :text =&gt; html_message }
    end

    # Embeds
    embeds.each do |key, embed|
      attachments.inline[key] = {
        :content =&gt; File.read(embed[:path]),
        :content_id =&gt; "&lt;#{key}&gt;"
      }
    end

    # Attachments
    files.each do |key, embed|
      attachments[key] = File.read(embed[:path])
    end
  end

end
</pre>

<h2>A Quick Explanation</h2>

<p>Rails 3 has made this a lot easier.  The only real hack is handling dynamic inline Content-ID&#8217;s.  ActionMailer will dynamically generate a Content-ID for each inline attachment.  We override that with the <code>:content_id =&gt; "&lt;#{key}&gt;"</code> line.  The brackets are required.</p>

<p>The format of the <code>files</code> and <code>embeds</code> hashes is as follows.  The <code>key</code> is the file name of the attached file.  The <code>value</code> is another hash with <code>content_type</code> set to the content type of the attachment and <code>path</code> is the full path to the file.  For example:</p>

<pre class="prettyprint linenums">{ 'image.png' =&gt;
    'content_type' =&gt; 'image/png',
    'path' =&gt; '/tmp/image.png'
}
</pre>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/iEVYeKbyG_4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2011/04/07/multipart-alternative-multipart-related-email-with-actionmailer-for-rails-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2011/04/07/multipart-alternative-multipart-related-email-with-actionmailer-for-rails-3/</feedburner:origLink></item>
		<item>
		<title>Disabling Chat Accounts At The End Of The Day</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/pLpfDPpaz90/</link>
		<comments>http://www.shortround.net/2011/01/17/disabling-chat-accounts-at-the-end-of-the-day/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 23:00:27 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=93</guid>
		<description><![CDATA[I always forget to turn off my chat accounts at work at the end of the day. Below is a script to take my accounts offline when it&#8217;s time to go home. This is for Ubuntu 10.10 using Empathy for my Jabber accounts. #!/usr/bin/env ruby require 'rubygems' require 'dbus' # Get the proper DBus session [...]]]></description>
			<content:encoded><![CDATA[<p>I always forget to turn off my chat accounts at work at the end of the day.  Below is a script to take my accounts offline when it&#8217;s time to go home.  This is for <a href="http://ubuntu.com" title="Ubuntu homepage">Ubuntu 10.10</a> using <a href="http://live.gnome.org/Empathy" title="Empathy - GNOME Live!">Empathy</a> for my Jabber accounts.</p>

<pre class="prettyprint linenums">#!/usr/bin/env ruby

require 'rubygems'
require 'dbus'

# Get the proper DBus session address
pid = nil
programs = %w( gnome-session )
programs.each do |program|
  pid = `pidof -s #{program}`
  break unless pid.nil?
end

# Fail if we can't find the pid
exit if pid.nil?

# Get the address
info = IO.readlines("/proc/#{pid.strip}/environ").first.split("\0")
info.reject! { |x| !x.include? 'DBUS_SESSION_BUS_ADDRESS' }
address = info.first.split('=', 2)[1]

# Set the address
ENV['DBUS_SESSION_BUS_ADDRESS'] = address

# Get the objects
bus = DBus::SessionBus.instance
service = bus.service('org.freedesktop.Telepathy.AccountManager')
service.introspect

account_manager = service.object('/org/freedesktop/Telepathy/AccountManager');
account_manager.introspect

iface = account_manager['com.nokia.AccountManager.Interface.Query']

accounts = iface.FindAccounts []
accounts.first.each do |account|
  account_object = service.object(account);
  account_object.introspect

  account_iface = account_object['org.freedesktop.DBus.Properties']
  account_iface.Set 'org.freedesktop.Telepathy.Account', 'RequestedPresence', ['(uss)', [1,'offline','']]
end
</pre>

<p>You&#8217;ll need the <a href="https://trac.luon.net/ruby-dbus/" title="Ruby D-Bus implementation">ruby-dbus</a> gem to use this.  I just placed it in a file and call it from a cron job.  The script finds all of your accounts via D-Bus and and then sends them a new presence.</p>

<p><strong>Update 2011-01-31:</strong> Added code to find the correct DBus Session Address, since the cron job does not have it.</p>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/pLpfDPpaz90" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2011/01/17/disabling-chat-accounts-at-the-end-of-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2011/01/17/disabling-chat-accounts-at-the-end-of-the-day/</feedburner:origLink></item>
		<item>
		<title>Visualizing Problem 15 of Project Euler</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/nq7pHRoM1RA/</link>
		<comments>http://www.shortround.net/2011/01/05/visualizing-problem-15-of-project-euler/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 17:32:15 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=87</guid>
		<description><![CDATA[I&#8217;ve been working through Project Euler as a coding / math exercise. Problem 15 asks to find the amount of paths that exist between the top-left and bottom-right points of a 20&#215;20 grid, without backtracking. I decided to visualize it, because just running a command line program and waiting can be boring. Of course, this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working through <a href="http://projecteuler.net/" title="Project Euler">Project Euler</a> as a coding / math exercise.  Problem 15 asks to find the amount of paths that exist between the top-left and bottom-right points of a 20&#215;20 grid, without backtracking.  I decided to visualize it, because just running a command line program and waiting can be boring.</p>

<span style="text-align:center; display: block;"><a href="http://www.shortround.net/2011/01/05/visualizing-problem-15-of-project-euler/"><img src="http://img.youtube.com/vi/QGCadbU-niM/2.jpg" alt="" /></a></span>

<p>Of course, this problem is silly to brute force, but by watching the visualization and working on a pad of paper, I came up with a much faster solution to solving the problem.</p>

<p>The code is available <a href="https://github.com/stack/euler/blob/master/015/015.rb" title="015/015.rb at master from stack/euler - GitHub">on github</a>.  It&#8217;s Ruby and Tk.  Some Ruby installs don&#8217;t compile with Tk, so if the script doesn&#8217;t load the <code>tk</code> requirement, Google around for the solution.</p>

<p>Also note, this is a quick hack.  It leaks memory, it&#8217;s buggy, it might eat your processor and will run for a very long time.</p>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/nq7pHRoM1RA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2011/01/05/visualizing-problem-15-of-project-euler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2011/01/05/visualizing-problem-15-of-project-euler/</feedburner:origLink></item>
		<item>
		<title>Multipart Alternative + Multipart Related Email with ActionMailer</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/oF2fRYzt4_k/</link>
		<comments>http://www.shortround.net/2010/11/24/multipart-alternative-multipart-related-email-with-actionmailer/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 17:12:01 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=73</guid>
		<description><![CDATA[I had a need at work to send email out of our Rails application which met the following criteria: It has both a plain text and HTML part. It may have embedded images in the HTML part. It may have attachments. Below is the code, which you can put in your app/models directory. class EmbeddedMailer [...]]]></description>
			<content:encoded><![CDATA[<p>I had a need at work to send email out of our <a href="http://rubyonrails.org" title="Ruby on Rails">Rails</a> application which met the following criteria:</p>

<ul>
<li>It has both a plain text and HTML part.</li>
<li>It may have embedded images in the HTML part.</li>
<li>It may have attachments.</li>
</ul>

<p>Below is the code, which you can put in your <code>app/models</code> directory.</p>

<pre class="prettyprint linenums">class EmbeddedMailer &lt; ActionMailer::Base

  def embedded_mail(to, from, subject, html_message, text_message, files = {}, embeds = {})
    # Hack TMail to allow embeds
    TMail::HeaderField::FNAME_TO_CLASS.delete 'content-id'

    recipients   to
    from         from
    subject      subject

    content_type 'multipart/mixed'

    # The Message
    part :content_type =&gt; 'multipart/alternative' do |m|

      # Plain Text Message
      m.part :content_type =&gt; 'text/plain' do |p|
        p.transfer_encoding = 'base64'
        p.body = text_message
      end

      # HTML Message
      m.part :content_type =&gt; 'multipart/related' do |x|
        x.part :content_type =&gt; 'text/html' do |p|
          p.body = html_message
        end

        # Embedded
        embeds.each do |key, embed|
          x.part :content_type =&gt; embed[:content_type] do |p|
            p.headers = { 'Content-ID' =&gt; "&lt;#{key}&gt;" }
            p.transfer_encoding = 'base64'
            p.body = File.read embed[:path]
          end
        end
      end
    end

    # Attachments
    files.each do |key, embed|
      attachment :content_type =&gt; embed[:content_type] do |a|
        a.filename = key
        a.body = File.read embed[:path]
      end
    end
  end

end
</pre>

<h2>A Quick Explanation</h2>

<p>You have to hack TMail, the built in email parser for ActionMailer, so that it doesn&#8217;t try to validate the Content-ID header.</p>

<p>To meet all of the criteria above, you have to create a MIME-type hierarchy as follows:</p>

<ul>
<li>multipart/mixed &#8211; a mix of a message and attachments

<ul>
<li>multipart/alternative &#8211; to mark that the text and html parts are equivalent to each other</li>
<li>text/plain &#8211; the plain text section</li>
<li>multipart/related &#8211; the HTML section with embedded images

<ul>
<li>text/html &#8211; the HTML section</li>
<li>Embedded images go here</li>
</ul></li>
<li>attachment/content-type &#8211; attachments are at the bottom</li>
</ul></li>
</ul>

<p>The format of the <code>files</code> and <code>embeds</code> hashes is as follows.  The <code>key</code> is the file name of the attached file.  The <code>value</code> is another hash with <code>content_type</code> set to the content type of the attachment and <code>path</code> is the full path to the file.  For example:</p>

<pre class="prettyprint linenums">{ 'image.png' =&gt;
    'content_type' =&gt; 'image/png',
    'path' =&gt; '/tmp/image.png'
}
</pre>

<p><strong>Update 2010-11-30:</strong> Fixed the layout to add <code>multipart/mixed</code> for attachments.<br />
<strong>Update 2011-04-07:</strong> I have created <a href="http://www.shortround.net/2011/04/07/multipart-alternative-multipart-related-email-with-actionmailer-for-rails-3/">a solution for Rails 3</a>, which is much more simplistic.</p>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/oF2fRYzt4_k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2010/11/24/multipart-alternative-multipart-related-email-with-actionmailer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2010/11/24/multipart-alternative-multipart-related-email-with-actionmailer/</feedburner:origLink></item>
		<item>
		<title>Copying Files From a Corrupt Hard Drive on Windows</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/zSrwD2aRxK4/</link>
		<comments>http://www.shortround.net/2010/11/11/copying-files-from-a-corrupt-hard-drive-on-windows/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 17:58:30 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=68</guid>
		<description><![CDATA[I had a hard drive fail and needed some of the files off of it. It was mostly images and movies, but some of those files were corrupted. This meant that doing copies for the folders would fail and hand copying around those corrupt files would be too time consuming. I wrote this script to [...]]]></description>
			<content:encoded><![CDATA[<p>I had a hard drive fail and needed some of the files off of it.  It was mostly images and movies, but some of those files were corrupted.  This meant that doing copies for the folders would fail and hand copying around those corrupt files would be too time consuming.  I wrote this script to copy each file individually and continue after a failure.  I consider the failed files as lost.</p>

<p>Note: This is a <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" title="Windows PowerShell">PowerShell</a> script, so you will need PowerShell to run it.</p>

<pre class="prettyprint linenums">$source = $args[0];
$dest   = $args[1];

$files = Get-ChildItem "$source" -recurse
foreach($file in $files) {
    if ($file.psiscontainer) {
        $common_directory = $file.FullName.Replace($source, "")
        $new_directory = $dest + $common_directory
        Write-Host "Creating directory $new_directory"
        New-Item $new_directory -type directory
    } else {
        $source_file = $file.FullName
        $common_path = $source_file.Replace($source, "")
        $new_file = $dest + $common_path
        Write-Host "Copying $source_file to $new_file"
        Copy-Item $source_file $new_file -ErrorAction Stop
    }

}
</pre>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/zSrwD2aRxK4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2010/11/11/copying-files-from-a-corrupt-hard-drive-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2010/11/11/copying-files-from-a-corrupt-hard-drive-on-windows/</feedburner:origLink></item>
		<item>
		<title>Veterans Day 2010</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/mbC_R9DoqEI/</link>
		<comments>http://www.shortround.net/2010/11/11/veterans-day-2010/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 15:37:32 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Photos]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=50</guid>
		<description><![CDATA[In honor of Veteran&#8217;s Day, here are some photos of my father in the Army. He served in the 14th Armored Division in France and Germany during World War II. He held the rank of Technician Fourth Grade when he was discharged.]]></description>
			<content:encoded><![CDATA[<p>In honor of Veteran&#8217;s Day, here are some photos of my father in the Army.  He served in the <a href="http://www.14tharmoreddivision.org/" title="14th Armored Division">14th Armored Division</a> in France and Germany during World War II.  He held the rank of <a href="http://en.wikipedia.org/wiki/Technician_Fourth_Grade" title="Technician Fourth Grade">Technician Fourth Grade</a> when he was discharged.</p>

<ul class="media-grid">
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/002_26201247440566086262.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/002_26201247440566086262-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/003_24100770907942361233.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/003_24100770907942361233-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/004_26988401564315103041.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/004_26988401564315103041-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/005_25155109094432389030.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/005_25155109094432389030-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/006_21119136859163013091.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/006_21119136859163013091-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/007_24915989813765166372.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/007_24915989813765166372-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/009_27565068555052459976.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/009_27565068555052459976-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/010_27972771049456736660.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/010_27972771049456736660-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/011_28075449437248744932.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/011_28075449437248744932-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/013_2670206436165884396.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/013_2670206436165884396-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/014_26401934234737641487.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/014_26401934234737641487-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/015_21534345013601336909.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/015_21534345013601336909-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/016_26962204130691668132.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/016_26962204130691668132-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/017_24719738968487619577.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/017_24719738968487619577-150x150.jpg" width="90" height="90" /></a>
</li>
<li>
<a href="http://www.shortround.net/wp-content/uploads/2010/11/018_25045194491081189477.jpg" rel="gallery-50"><img class="thumbnail" src="http://www.shortround.net/wp-content/uploads/2010/11/018_25045194491081189477-150x150.jpg" width="90" height="90" /></a>
</li>
</ul>

<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/mbC_R9DoqEI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2010/11/11/veterans-day-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2010/11/11/veterans-day-2010/</feedburner:origLink></item>
		<item>
		<title>Making an Image-Flip Proxy</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/wYb9ypjktug/</link>
		<comments>http://www.shortround.net/2010/09/24/making-an-image-flip-proxy/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 14:16:56 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=31</guid>
		<description><![CDATA[There have been many articles about creating a proxy server that flips or distorts images that pass through it. They are hilarious, but they tended to lack in certain details. This article will detail how to set up the OS, proxy and routing, giving you the option to either use it directly as a proxy [...]]]></description>
			<content:encoded><![CDATA[<p>There have been many articles about creating a proxy server that flips or distorts images that pass through it.  They are hilarious, but they tended to lack in certain details.  This article will detail how to set up the OS, proxy and routing, giving you the option to either use it directly as a proxy or gateway server.</p>

<p>This is also very quick and dirty.  It is meant to get you started as quickly as possible.  This means any longevity or security concerns are ignored.  <em>You have been warned</em>.</p>

<p>The original idea came from <a href="http://ex-parrot.com/~pete/upside-down-ternet.html" title="Upside-Down-Ternet">here</a>.</p>

<h2>Setting Up An OS</h2>

<p>The proxy is based off of a default install of Debian Lenny from the netinstall iso.  It can be found <a href="http://cdimage.debian.org/debian-cd/5.0.0/i386/iso-cd/debian-500-i386-netinst.iso" title="Debian Lenny netinstall">here</a>.</p>

<p>For the OS install, you can accept the defaults for almost every option.  There are two cases to watch out for.  First, you will be prompted to confirm all of your partitioning options before proceeding.  The default option is to cancel.  The second case is the additional software options.  I unchecked the &#8220;Desktop Environment&#8221; option, since this is going to be server.</p>

<p>Once the OS is installed, log in as <code>root</code> and run the following commands to prepare our environment:</p>

<pre class="prettyprint linenums">apt-get install squid3 apache2 imagemagick
chmod -R 777 /var/www
</pre>

<h2>Configuring the Proxy</h2>

<p>Open the <code>/etc/squid3/squid.conf</code> file in your favorite editor.  Near the top of the file is a configuration option for <code>http_port</code>.  Change it to look like the following:</p>

<pre class="prettyprint linenums">http_port 3128 transparent
</pre>

<p>Next, find the line that begins with <code>INSERT YOUR OWN RULE(S)</code>, which should be around line number 2138.  Below that line, add the following to allow your private network access to your proxy.  Make sure to change the it for your network.</p>

<pre class="prettyprint linenums">acl lan src 192.168.1.0/24
http_access allow lan
</pre>

<p>Lastly, go to the bottom of the file and add the following line.  This is the magic which will flip the images for you.</p>

<pre class="prettyprint linenums">redirect_program /usr/local/bin/flip.pl
</pre>

<p>Save the file and exit your editor.</p>

<h2>The Flip Script</h2>

<p>Edit the file <code>/usr/local/bin/flip.pl</code> and add the following to it:</p>

<pre class="prettyprint linenums">#!/usr/bin/perl

$|=1;
$count = 0;
$pid = $$;
while (&lt;&gt;) {
  chomp $_;
  if ($_ =~ /(.*)(\.jpg|\.png|\.gif)/i) {
    $url = $1 . $2;
    system("/usr/bin/wget", "-q", "-O","/var/www/$pid-$count$2", "$url");
    system("/usr/bin/mogrify", "-flip","/var/www/$pid-$count$2");
    system("/bin/chmod", "777", "/var/www/$pid-$count$2");
    print "http://127.0.0.1/$pid-$count$2\\n";
  } else {
    print "$_\\n";
  }
  $count++;
}
</pre>

<p>The script is fairly simple.  Squid passes URL&#8217;s to the script.  If the URL ends in image type, it is pulled down to root of our web server.  Mogrify then modifies the image in place.  Lastly, it tells Squid to pull the image from our webserver instead of the internet.  If the URL isn&#8217;t an image, we just dump the origin URL back out.</p>

<p>Once the file is in place, make sure to make it executable.</p>

<pre class="prettyprint linenums">chmod +x /usr/local/bin/flip.pl
</pre>

<p>You should have enough to test.  Restart Squid with the following:</p>

<pre class="prettyprint linenums">invoke-rc.d squid3 restart
</pre>

<p>You can now set up any browser to use the server as a proxy on port 3128.  If you visit a page you have been to before, make sure you refresh a couple of times.  Your browser might have cached the images locally, which means they won&#8217;t go through our proxy.</p>

<h2>Making A Transparent Gateway</h2>

<p>The last part of the process is to make the server a gateway which will transparently redirect web requests through the proxy.  Create the file <code>/etc/network/if-up.d/00-firewall</code> and add the following to it:</p>

<pre class="prettyprint linenums">#!/bin/sh

PATH=/usr/sbin:/sbin:/bin:/usr/bin

#
# delete all existing rules.
#
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X

# Always accept loopback traffic
iptables -A INPUT -i lo -j ACCEPT

# Allow established connections
iptables -A INPUT -m state --state ESTABLISHED,RELATED,NEW -j ACCEPT
iptables -A FORWARD -i eth0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

# Allow outgoing connections
iptables -A FORWARD -i eth0 -o eth0 -j ACCEPT

# Masquerade
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

echo 1 &gt; /proc/sys/net/ipv4/ip_forward
</pre>

<p>Now make the the script executable and restart the networking.</p>

<pre class="prettyprint linenums">chmod +x /etc/network/if-up.d/00-firewall
invoke-rc.d networking restart
</pre>

<p>At this point, you should be able to set any computer&#8217;s default gateway to the IP address of your server.  You don&#8217;t need to set a proxy address for your browser.  Everything is now routed and all HTTP requests are redirected through the proxy.</p>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/wYb9ypjktug" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2010/09/24/making-an-image-flip-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2010/09/24/making-an-image-flip-proxy/</feedburner:origLink></item>
		<item>
		<title>Group Design Project: List with Functions</title>
		<link>http://feedproxy.google.com/~r/Shortroundnet/~3/n1Mx6nOrr_o/</link>
		<comments>http://www.shortround.net/2010/09/20/group-design-project-list-with-functions/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 20:04:23 +0000</pubDate>
		<dc:creator>Stack</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.shortround.net/?p=19</guid>
		<description><![CDATA[Over at CSS-Tricks, Chris Coyier posted a call to design something together. I decided to give it a whirl. My attempt uses the paradigm that Mac OS X uses, which is, if you click and hold on something, a menu will pop up. The best example is clicking and holding on an icon in the [...]]]></description>
			<content:encoded><![CDATA[<p>Over at <a href="http://css-tricks.com" title="CSS-Tricks">CSS-Tricks</a>, Chris Coyier posted a call to <a href="http://css-tricks.com/group-design-project-list-with-functions" title="Group Design Project: List with Functions">design something together</a>.  I decided to give it a whirl.  My attempt uses the paradigm  that Mac OS X uses, which is, if you click and hold on something, a menu will pop up.  The best example is clicking and holding on an icon in the dock.  It&#8217;s also used a lot in iOS, such as the Copy/Paste menu and links.</p>

<p>If you want to check it out, go to <a href="http://jsbin.com/ewiti3/3" title="List Example">JSBin</a> to see my example.</p>

<p><img src="http://www.shortround.net/wp-content/uploads/2010/09/Screenshot.png" alt="" title="List Before Click &amp; Hold" width="304" height="189" class="size-full wp-image-20" /><br />
<img src="http://www.shortround.net/wp-content/uploads/2010/09/Screenshot-1.png" alt="" title="List After Click &amp; Hold" width="304" height="189" class="size-full wp-image-21" /></p>

<p>You can also <a href="http://www.shortround.net/wp-content/uploads/2010/09/css-tricks-list-example.html">download the file</a> if you want to play with it on your computer.</p>
<img src="http://feeds.feedburner.com/~r/Shortroundnet/~4/n1Mx6nOrr_o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.shortround.net/2010/09/20/group-design-project-list-with-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.shortround.net/2010/09/20/group-design-project-list-with-functions/</feedburner:origLink></item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 1772/1950 objects using disk: basic

Served from: www.shortround.net @ 2012-02-06 12:34:08 -->

