<?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>Stereo Interactive &#38; Design - Ann Arbor, Michigan Web Design</title>
	<atom:link href="http://stereointeractive.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://stereointeractive.com/blog</link>
	<description>Development Blog</description>
	<lastBuildDate>Tue, 20 Mar 2012 08:00:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Import SVN project into Git</title>
		<link>http://stereointeractive.com/blog/2012/03/20/import-svn-project-into-git/</link>
		<comments>http://stereointeractive.com/blog/2012/03/20/import-svn-project-into-git/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 06:57:03 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=619</guid>
		<description><![CDATA[Recently we converted a few SVN projects to Git. We used a method that converts svn authors to git authors and then uploads the repository to github. It also maintains tags and branches. Here is how we did it: echo &#34;svnuser &#60;mygithubemail@example.com&#62;&#34; &#62; authors mkdir myproject-git cd myproject-git git svn init -t tags -b branches [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we converted a few SVN projects to Git. We used a method that converts svn authors to git authors and then uploads the repository to github. It also maintains tags and branches. Here is how we did it:<br />
<span id="more-619"></span></p>

<div class="wp_syntax"><div class="code"><pre class="shell">echo &quot;svnuser &lt;mygithubemail@example.com&gt;&quot; &gt; authors
mkdir myproject-git
cd myproject-git
git svn init -t tags -b branches -T trunk svn+ssh://svnuser@mysvnhost/path/to/svn/repo
git svn fetch --authors-file=../authors
git for-each-ref refs/remotes/tags --shell --format=&quot;r=%(refname:short) t=\${r#tags/}&quot; | while read e; do eval &quot;$e&quot;; git tag -f $t refs/remotes/$r; git branch -d -r $r; done
git remote add origin git@github.com:gituser/mygitrepo.git
git push -u origin master
git push --tags</pre></div></div>

<p>The git for-each-ref script was taken from <a href="http://gitready.com/advanced/2009/02/16/convert-git-svn-tag-branches-to-real-tags.html">gitready.com</a> and converts the tag branches into actual git tags and then delete those branches from the new git repository.</p>
<p>SVN externals will not be imported. In that event, you may find a git mirror of the svn repositories and you can set them up as submodules:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span class="kw2">git</span> submodule add <span class="kw2">git</span>:<span class="sy0">//</span>github.com<span class="sy0">/</span>path<span class="sy0">/</span>an-old-svn-external.git vendor<span class="sy0">/</span>my-new-submodule
<span class="kw3">cd</span> vendor<span class="sy0">/</span>my-new-submodule
<span class="kw2">git</span> checkout v1.0
<span class="kw3">cd</span> ..
<span class="kw2">git</span> add my-new-submodule
<span class="kw2">git</span> commit <span class="re5">-m</span> <span class="st0">&quot;adding submodule at v1.0&quot;</span>
<span class="kw2">git</span> push</pre></div></div>

<p>sources: <a href="http://stackoverflow.com/questions/1777854/git-submodules-specify-a-branch-tag">http://stackoverflow.com/questions/1777854/git-submodules-specify-a-branch-tag</a></p>
<p>If you need to find a specific svn revision number so you can tie your git submodule to the same revision, this will parse all of the git log messages (which will contain the svn revision number of it was imported from an svn repository) and display the revision numbers for you:</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span class="kw2">git</span> log <span class="re5">-z</span> <span class="sy0">|</span> <span class="kw2">tr</span> <span class="st_h">'\n\0'</span> <span class="st_h">' \n'</span> <span class="sy0">|</span> <span class="kw2">sed</span> <span class="st_h">'s/\(commit \S*\) .*git-svn-id: svn:[^@]*@\([0-9]*\) .*/\1 r\2/'</span></pre></div></div>

<p>source: <a href="http://stackoverflow.com/a/2872369/149503">http://stackoverflow.com/a/2872369/149503</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2012/03/20/import-svn-project-into-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS 10.7 Lion PHP Ruby upgrade notes</title>
		<link>http://stereointeractive.com/blog/2011/07/20/mac-os-10-7-lion-php-ruby-upgrade-notes/</link>
		<comments>http://stereointeractive.com/blog/2011/07/20/mac-os-10-7-lion-php-ruby-upgrade-notes/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 21:51:47 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=615</guid>
		<description><![CDATA[A new notes regarding my local development environment after upgrading to Lion this morning. 1. mycrypt extension is no longer installed. To get this working I had to update/reinstall Developer Tools (from the App Store), install libmcrypt using macports, and then more or less follow the instructions here (changing 10.6 to 10.7 as necessary). 2. [...]]]></description>
			<content:encoded><![CDATA[<p>A new notes regarding my local development environment after upgrading to Lion this morning.</p>
<p>1. mycrypt extension is no longer installed. To get this working I had to update/reinstall Developer Tools (from the App Store), install libmcrypt using macports, and then more or less follow the <a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10-6-1/">instructions here</a> (changing 10.6 to 10.7 as necessary).</p>
<p>2. Path to ruby gems was missing/changed. Reinstalling the gems I needed fixed the issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/07/20/mac-os-10-7-lion-php-ruby-upgrade-notes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Suggestions for Free Websites</title>
		<link>http://stereointeractive.com/blog/2011/06/15/suggestions-for-free-websites/</link>
		<comments>http://stereointeractive.com/blog/2011/06/15/suggestions-for-free-websites/#comments</comments>
		<pubDate>Wed, 15 Jun 2011 17:00:25 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=605</guid>
		<description><![CDATA[Friends often ask us for recommendations on how to set up their own personal websites, but don&#8217;t have the budget to build something custom. Here is my take on it. It&#8217;s hard to find good, free (or even cheap), web site templates. You may want to experiment with either a free hosted wordpress blog (http://wordpress.com), [...]]]></description>
			<content:encoded><![CDATA[<p>Friends often ask us for recommendations on how to set up their own personal websites, but don&#8217;t have the budget to build something custom. Here is my take on it. <span id="more-605"></span></p>
<p>It&#8217;s hard to find good, free (or even cheap), web site templates. You may want to experiment with either a free hosted wordpress blog (<a href="http://wordpress.com">http://wordpress.com</a>), or a free tumblr account (<a href="http://www.tumblr.com">http://www.tumblr.com</a>). Both have a lot of free web templates to choose from and you might find one you like. </p>
<p>I would sign up with both and poke around a bit to see which one you like the best. Although both market themselves as blogs (or &#8216;tumble-logs&#8217;, which is for short-form blogging), they each let you create basic pages, too. You might find the multimedia features are lacking (especially if you are used to a paid service dedicated to photographers, for example) but with the right template I&#8217;m sure you can display your portfolio nicely. </p>
<p>Both with let you point your own web address to your new site (wordpress charges something like $12/year for this).</p>
<p>I would start with a free wordpress account for now (<a href="https://en.wordpress.com/signup/">https://en.wordpress.com/signup/</a>) and if you like it you can upgrade to use your own URL later. You can explore the themes they have at <a href="http://theme.wordpress.com/themes/">http://theme.wordpress.com/themes/</a>. </p>
<p>Tumblr has some nice themes too. Generally I think tumblr expects you to post short little blog snippets rather than use it to host a full website (tumblr themes are at <a href="http://www.tumblr.com/themes/">http://www.tumblr.com/themes/</a>), but you might find a template that works. (You may also want to explore posterous.com, which in my opinion has less artist themes but better functionality for group-blogs where you have multiple people posting to the same site.)</p>
<p>I&#8217;d create accounts and both and try to build a simple &#8220;About&#8221; page to see which you enjoy working with more. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/06/15/suggestions-for-free-websites/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Hit List for Mac Safari Extension</title>
		<link>http://stereointeractive.com/blog/2011/06/01/the-hit-list-for-mac-safari-extension/</link>
		<comments>http://stereointeractive.com/blog/2011/06/01/the-hit-list-for-mac-safari-extension/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 16:57:17 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=603</guid>
		<description><![CDATA[My favorite task management apps for mac, The Hit List by The Potion Factory, finally came out of beta yesterday after a very long wait. One of the new features, besides the biggest enhancement (iOS synchronization) is that you can install a safari extension (via a link in the release notes) which will allow you [...]]]></description>
			<content:encoded><![CDATA[<p>My favorite task management apps for mac, <a href="http://www.potionfactory.com/thehitlist/">The Hit List</a> by The Potion Factory, finally came out of beta yesterday after a very long wait. <span id="more-603"></span>One of the new features, besides the biggest enhancement (iOS synchronization) is that you can install a safari extension (<a href="http://www.potionfactory.com/thehitlist/releasenotes/">via a link in the release notes</a>) which will allow you to create tasks using URLs. The docs for this extension are buried within the compressed archive for the extension, so here is how it works.</p>
<p>If you just want to jump to the fun stuff, <strong>install the hit list 1.0 on your mac, install the safari extension,</strong> and then try <a href="thehitlist:///inbox/tasks?method=POST&#038;title=Do something crazy&#038;notes=Testing The Hit List safari extension&#038;url=stereointeractive.com/blog">clicking this link to add a todo to you task inbox</a>. Here is what the link looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="html">&lt;a href=&quot;thehitlist:///inbox/tasks?method=POST&amp;title=Do something crazy&amp;notes=Testing The Hit List safari extension&amp;url=stereointeractive.com/blog&quot;&gt;Click here to add a task&lt;/a&gt;</pre></div></div>

<p>The basic idea is to use <code>thehitlist:///<taskgroup>/tasks?method=POST</code> and then add various parameters to the URL with the title, description, or priority for the task.</p>
<p>Here are the full docs for the URL scheme.</p>
<p><strong>The Hit List Safari Extension Readme</strong></p>

<div class="wp_syntax"><div class="code"><pre class="txt">The Hit List handles URLs with 'thehitlist' scheme in the following manner:
Look up by UID
==============
&nbsp;
Show the task or group with the UID in The Hit List application.
&nbsp;
	thehitlist:///&lt;UID&gt;
&nbsp;
&nbsp;
Look up by Group Name
=====================
&nbsp;
Show group with name 'group2', that is a subgroup of 'group1'.
&nbsp;
	thehitlist:///&lt;group1&gt;/&lt;group2&gt;
&nbsp;
&nbsp;
Task Creation
=============
&nbsp;
Add new task to group with name 'group'.
&nbsp;
	thehitlist:///&lt;group&gt;/tasks?method=POST&amp;index=&lt;n&gt;&amp;title=&lt;title&gt;&amp;notes=&lt;notes&gt;
&nbsp;
	You can only add to lists and the Today group.
&nbsp;
&nbsp;
Parameters
-------------------
&nbsp;
- method
&nbsp;
	This has to be 'POST' for task creation.
&nbsp;
- title
&nbsp;
	Title of the new task
&nbsp;
- notes
&nbsp;
	Notes to include in the task
&nbsp;
- url
&nbsp;
	The URL to include in the task notes
&nbsp;
- startDate, dueDate
&nbsp;
	Dates can be specified using the shorthand value that The Hit List application understands. For
	example, &quot;6/4&quot;, &quot;June 4, 2010&quot;, &quot;4&quot; (4th of the next month), &quot;wed&quot;, &quot;4d&quot; (in four days),
	&quot;today&quot;, &quot;t&quot; (today), and so on and so on. If you add a task to the Today group, the start date
	gets automatically set to today.
&nbsp;
- estimatedTime
&nbsp;
	Example values are 30m, 0.5h 1d, and so on.
&nbsp;
- priority
&nbsp;
	Priority can range from 0 to 9 where 0 is no priority
&nbsp;
- index
&nbsp;
	An index value of n will insert to that index in the group or task. Index of -1 is a special
	case where it will add to the end of the list, the default is 0.</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/06/01/the-hit-list-for-mac-safari-extension/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress embed html5 video, encoding</title>
		<link>http://stereointeractive.com/blog/2011/05/24/wordpress-embed-html5-video-encoding/</link>
		<comments>http://stereointeractive.com/blog/2011/05/24/wordpress-embed-html5-video-encoding/#comments</comments>
		<pubDate>Wed, 25 May 2011 00:21:30 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=600</guid>
		<description><![CDATA[My current favorite plugin for embedding video is VideoJS WordPress Plugin which uses the HTML5 Video Player VideoJS. After you install the plugin, you can use a shortcode to embed your video in various formats like mp4, ogg, and webm. To encode video on a mac, I like Miro Video Converter. It has a super [...]]]></description>
			<content:encoded><![CDATA[<p>My current favorite plugin for embedding video is <a href="http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress">VideoJS WordPress Plugin</a> which uses the <a href="http://videojs.com/">HTML5 Video Player VideoJS</a>.<br />
<span id="more-600"></span><br />
After you install the plugin, you can use a shortcode to embed your video in various formats like mp4, ogg, and webm.</p>
<p>To encode video on a mac, I like <a href="http://www.mirovideoconverter.com/">Miro Video Converter</a>. It has a super simple drag and drop interface and can encode Theora, WebM, and many others. </p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/05/24/wordpress-embed-html5-video-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 3.1 sortable admin tables</title>
		<link>http://stereointeractive.com/blog/2011/02/26/wordpress-3-1-sortable-admin-tables/</link>
		<comments>http://stereointeractive.com/blog/2011/02/26/wordpress-3-1-sortable-admin-tables/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 01:03:30 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=594</guid>
		<description><![CDATA[With the release of 3.1, WordPress enabled list-type admin screen enhancements to provide sortable columns for list-type screens and better pagination. This begs the question, how do we make our custom columns sortable, too? If we add custom meta attributes to posts or create custom post types, sometimes it&#8217;s nice to display these fields in [...]]]></description>
			<content:encoded><![CDATA[<p>With the release of <a href="http://codex.wordpress.org/Version_3.1">3.1</a>, WordPress enabled list-type admin screen enhancements to provide sortable columns for list-type screens and better pagination. </p>
<p>This begs the question, how do we make our custom columns sortable, too? If we add custom meta attributes to posts or create custom post types, sometimes it&#8217;s nice to display these fields in the admin tables. There are <a href="http://www.google.com/search?q=wordpress+custom+table+column">plenty of posts out there</a> that describe how do that. So, let&#8217;s focus on how to make these columns sortable.<span id="more-594"></span></p>
<p>A new filter was introduced called <code>manage_{$screen->id}_sortable_columns</code>. This works just like the existing filter that we use to add our own column headings to the table. Let&#8217;s imagine we created a meta field for our posts called &#8216;my_author&#8217;. (Remember, it&#8217;s a good idea to prepend your meta columns with a custom prefix. As an example we&#8217;ll use &#8220;my_&#8221; but you should probably use something more specific in your code. We usually use &#8220;stereo_&#8221;.</p>
<pre><code lang="php">
      // add this code to wherever you define your custom post type, usually within a plugin or your theme's functions.php file.
      // you should be familiar with this filter from earlier versions of wp...
      add_filter("manage_edit-".$post_type."_columns", 'my_edit_columns'));
      // this is the new filter which expects an array in the format of id => data
      add_filter("manage_edit-".$post_type."_sortable_columns", 'my_sortable_columns');

      // ...
        function my_sortable_columns($columns)
  	{
  	  $custom = array(
            // meta column id => sortby value used in query
  	    'my_author'    => 'my_author',
  	  );

  	  return wp_parse_args($custom, $columns);
  	}</code></pre>
<p>If you have it set up correctly, when you view your list of posts in the admin area, the columns defined in your my_sortable_columns function should be active links, and clicking on them toggle sort order.</p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/02/26/wordpress-3-1-sortable-admin-tables/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress: Adding custom boxes to posts</title>
		<link>http://stereointeractive.com/blog/2011/02/26/wordpress-adding-custom-boxes-to-posts/</link>
		<comments>http://stereointeractive.com/blog/2011/02/26/wordpress-adding-custom-boxes-to-posts/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 22:43:15 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=592</guid>
		<description><![CDATA[I stumbled on a great post about how to custom boxes for your wordpress posts. In this case it was promo boxes, but it could be used anytime you want to relate certain custom types of content to your wordpress pages (for example, a portfolio of work, a list of employees, etc). http://wordpress.stackexchange.com/questions/5750/custom-field-meta-populated-by-dropdown-of-existing-posts]]></description>
			<content:encoded><![CDATA[<p>I stumbled on a great post about how to custom boxes for your wordpress posts. In this case it was promo boxes, but it could be used anytime you want to relate certain custom types of content to your wordpress pages (for example, a portfolio of work, a list of employees, etc).</p>
<p><a href="http://wordpress.stackexchange.com/questions/5750/custom-field-meta-populated-by-dropdown-of-existing-posts">http://wordpress.stackexchange.com/questions/5750/custom-field-meta-populated-by-dropdown-of-existing-posts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/02/26/wordpress-adding-custom-boxes-to-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CURL through a SOCKS proxy to post XML data</title>
		<link>http://stereointeractive.com/blog/2011/01/13/using-curl-through-a-socks-proxy-to-post-xml-data/</link>
		<comments>http://stereointeractive.com/blog/2011/01/13/using-curl-through-a-socks-proxy-to-post-xml-data/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 23:43:34 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[socks]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=581</guid>
		<description><![CDATA[Recently we had to communicate with an API that requires we post XML from a white-listed IP address. This made it difficult to develop against since the only way we could get a response from the API service was if we were accessing it from our production machine. This is how you set up PHP&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we had to communicate with an API that requires we post XML from a white-listed IP address. This made it difficult to develop against since the only way we could get a response from the API service was if we were accessing it from our production machine. This is how you set up PHP&#8217;s cURL (client URL) library to post xml data through a proxy server.<br />
<span id="more-581"></span><br />
First, use ssh to set up a tunnel to your server and set up the socks proxy.</p>

<div class="wp_syntax"><div class="code"><pre class="bash"><span class="kw2">ssh</span> <span class="re5">-D</span> <span class="nu0">8080</span> <span class="re5">-f</span> <span class="re5">-C</span> <span class="re5">-q</span> <span class="re5">-N</span> user<span class="sy0">@</span>yourserver.com</pre></div></div>

<ul>
<li>-D 8080 is a switch that makes this session act as a SOCKS server. You can use any free port above 1023.</li>
<li>-f &#8220;forks&#8221; this process so it runs in the background&#8230; you don&#8217;t have leave your terminal session open to keep the connection alive.</li>
<li>-C is for &#8220;compression&#8221;. This actually may not help you if you have a fast connection, so you might want to try without it.</li>
<li>-q is for &#8220;quiet mode&#8221; and suppresses most warning and diagnostic messages (leave this out if you are having trouble)</li>
<li>-N is for &#8220;no command&#8221; and is useful when you are just forwarding ports like we are, and is necessary when you fork the process</li>
</ul>
<p>You can get the full rundown of these switches in the <code>man</code> page.</p>
<p>If this works, the command will just run and put you right back at your prompt. If you want check if it is running, use <code>ps -aux | grep ssh</code> to see the process.</p>
<p>Now that your secure tunnel is configured, it&#8217;s time to update your PHP cURL code to use it.</p>

<div class="wp_syntax"><div class="code"><pre class="php">  <span class="re0">$ch</span> <span class="sy0">=</span> <span class="kw3">curl_init</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_URL<span class="sy0">,</span> <span class="re0">$url</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="co1">// we want to post XML, so lets change the content type header</span>
  <span class="kw3">curl_setopt</span> <span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_HTTPHEADER<span class="sy0">,</span> <span class="kw3">Array</span><span class="br0">&#40;</span><span class="st0">&quot;Content-Type: text/xml&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="co1">// make it a POST request, rather than the default GET</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_POST<span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="co1">// the POSTFIELDS option doesn't just take an array, you can also use a string!</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_POSTFIELDS<span class="sy0">,</span> <span class="re0">$xml</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="co1">// without this curl will not return the server response</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_RETURNTRANSFER<span class="sy0">,</span> <span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span> 
&nbsp;
  <span class="co1">// configure curl to use SOCKS5</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_PROXYTYPE<span class="sy0">,</span> CURLPROXY_SOCKS5<span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
  <span class="co1">// 127.0.0.1 is your local IP, and 8080 is the port number we used for our tunnel</span>
  <span class="kw3">curl_setopt</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="sy0">,</span> CURLOPT_PROXY<span class="sy0">,</span> <span class="st_h">'127.0.0.1:8080'</span><span class="br0">&#41;</span><span class="sy0">;</span> 
&nbsp;
  <span class="co1">// perform the curl session</span>
  <span class="re0">$result</span> <span class="sy0">=</span> <span class="kw3">curl_exec</span><span class="br0">&#40;</span><span class="re0">$ch</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/01/13/using-curl-through-a-socks-proxy-to-post-xml-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony 1.4 admin generator sort on custom column</title>
		<link>http://stereointeractive.com/blog/2011/01/08/symfony-1-4-admin-generator-sort-on-custom-column/</link>
		<comments>http://stereointeractive.com/blog/2011/01/08/symfony-1-4-admin-generator-sort-on-custom-column/#comments</comments>
		<pubDate>Sat, 08 Jan 2011 20:01:05 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Doctrine]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=569</guid>
		<description><![CDATA[If you use the symfony 1.4 admin generator with doctrine you may notice that the column headings in the list view are links that enable you to sort your results by that column. If you customize the list view to include columns that include data from a foreign table, the generator will not automatically create [...]]]></description>
			<content:encoded><![CDATA[<p>If you use the symfony 1.4 admin generator with doctrine you may notice that the column headings in the list view are links that enable you to sort your results by that column. If you customize the list view to include columns that include data from a foreign table, the generator will not automatically create these sort links. Here is how I make foreign columns sortable. <span id="more-569"></span></p>
<p>Let&#8217;s say I have a model &#8220;Payment&#8221; and it has a one-to-many relationship with &#8220;Person&#8221; (i.e. one person has many payments, or the payment table has a foreign key &#8220;person_id&#8221;). I want the list of payments sortable by &#8220;last_name&#8221;.</p>
<p>In generator.yml:</p>

<div class="wp_syntax"><div class="code"><pre class="yml"> config:
  fields:
   last_name: { is_real: true }
...
  list:
    display:  [id, date, amount, last_name]</pre></div></div>

<p>Let&#8217;s update our Payment.class.php file with methods to fetch the person&#8217;s last name.</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span class="kw2">class</span> Payment <span class="kw2">extends</span> BasePayment
<span class="br0">&#123;</span>
<span class="sy0">...</span>
  <span class="kw2">public</span> <span class="kw2">function</span> getLastName<span class="br0">&#40;</span><span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">Person</span><span class="sy0">-&gt;</span><span class="me1">last_name</span><span class="sy0">;</span>
  <span class="br0">&#125;</span></pre></div></div>

<p>Now, if you reload your generated list view, you&#8217;ll see the column heading for last_name has been converted to a link. Now, we&#8217;ll have to add this foreign column (last_name) to our query and also add some logic to sort by the proper column when necessary.</p>
<p>Let&#8217;s add a custom table method to our list query, adding another line to generator.yml:</p>

<div class="wp_syntax"><div class="code"><pre class="yaml">...
config:
  list:
  ...
    table_method: doSelectJoinPerson</pre></div></div>

<p>Let&#8217;s add the new method to our PaymentTable.class.php:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span class="kw2">class</span> PaymentTable <span class="kw2">extends</span> Doctrine_Table
<span class="br0">&#123;</span>
  <span class="sy0">...</span>  
  <span class="kw2">public</span> static <span class="kw2">function</span> doSelectJoinPerson<span class="br0">&#40;</span><span class="re0">$query</span><span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    <span class="re0">$rootAlias</span> <span class="sy0">=</span> <span class="re0">$query</span><span class="sy0">-&gt;</span><span class="me1">getRootAlias</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
    <span class="kw1">return</span> <span class="re0">$query</span><span class="sy0">-&gt;</span><span class="me1">select</span><span class="br0">&#40;</span><span class="re0">$rootAlias</span> <span class="sy0">.</span> <span class="st_h">'.*, p.last_name'</span><span class="br0">&#41;</span>
      <span class="sy0">-&gt;</span><span class="me1">leftJoin</span><span class="br0">&#40;</span><span class="re0">$rootAlias</span> <span class="sy0">.</span> <span class="st_h">'.Person p'</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span></pre></div></div>

<p>The table_method parameter in our list configuration is used to define which method should be executed on our model&#8217;s table when it fetches results from the database.  Our main model will always have an alias &#8220;r&#8221; as defined in the symfony/doctrine source code (check out <code>sfFormFilterDoctrine::doBuildQuery()</code>). </p>
<p>We now need to pass the table alias for our foreign table (in this case, we used &#8216;p&#8217; for Person) into our sort query if &#8216;last_name&#8217; is given as our sort parameter. Let&#8217;s override the <code>addSortQuery($query)</code> in our actions class:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span class="kw2">class</span> paymentActions <span class="kw2">extends</span> autoPaymentActions
<span class="br0">&#123;</span>
<span class="sy0">...</span>
  <span class="kw2">protected</span> <span class="kw2">function</span> addSortQuery<span class="br0">&#40;</span><span class="re0">$query</span><span class="br0">&#41;</span>
  <span class="br0">&#123;</span>
    <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">array</span><span class="br0">&#40;</span><span class="kw4">null</span><span class="sy0">,</span> <span class="kw4">null</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="br0">&#40;</span><span class="re0">$sort</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-&gt;</span><span class="me1">getSort</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
    <span class="br0">&#123;</span>
      <span class="kw1">return</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
&nbsp;
    <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">in_array</span><span class="br0">&#40;</span><span class="kw3">strtolower</span><span class="br0">&#40;</span><span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="st_h">'asc'</span><span class="sy0">,</span> <span class="st_h">'desc'</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>
    <span class="br0">&#123;</span>
      <span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'asc'</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
&nbsp;
    <span class="kw1">switch</span> <span class="br0">&#40;</span><span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
      <span class="kw1">case</span> <span class="st_h">'last_name'</span><span class="sy0">:</span>
        <span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="st_h">'p.last_name'</span><span class="sy0">;</span>
        <span class="kw1">break</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
&nbsp;
    <span class="re0">$query</span><span class="sy0">-&gt;</span><span class="me1">addOrderBy</span><span class="br0">&#40;</span><span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">.</span> <span class="st_h">' '</span> <span class="sy0">.</span> <span class="re0">$sort</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="sy0">...</span></pre></div></div>

<p><strong>Update:</strong>A few comments below pointed out for the default admin generator theme you&#8217;ll also need to add the following method to your controller (actions.class.php):</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span class="kw2">protected</span> <span class="kw2">function</span> isValidSortColumn<span class="br0">&#40;</span><span class="re0">$column</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
  <span class="kw1">return</span> Doctrine_Core<span class="sy0">::</span><span class="me2">getTable</span><span class="br0">&#40;</span>‘Payment’<span class="br0">&#41;</span><span class="sy0">-&gt;</span><span class="me1">hasColumn</span><span class="br0">&#40;</span><span class="re0">$column</span><span class="br0">&#41;</span> <span class="sy0">||</span> <span class="re0">$column</span> <span class="sy0">==</span> ‘last_name’<span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>

<p>Once you get used to this process, it&#8217;s really not too hard to implement for all of your admin-generated modules. No plugins necessary. </p>
<p><strong>Update 2:</strong> Updated doSelect query to use root alias defined in the query per the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2011/01/08/symfony-1-4-admin-generator-sort-on-custom-column/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Installing Phusion Passenger on WHM/cPanel</title>
		<link>http://stereointeractive.com/blog/2010/11/18/installing-phusion-passenger-on-whmcpanel/</link>
		<comments>http://stereointeractive.com/blog/2010/11/18/installing-phusion-passenger-on-whmcpanel/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 22:02:00 +0000</pubDate>
		<dc:creator>Scott Meves</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://stereointeractive.com/blog/?p=538</guid>
		<description><![CDATA[Login to your server and switch to root (yes, you need root access). gem install passenger export APXS2=/usr/local/apache/bin/apxs export APR_CONFIG=/usr/local/apache/bin/apr-1-config passenger-install-apache2-module Here the installer (which is awesome and very user friendly) will tell you if you have all the required components, and if not, it will tell you what you need to do to install [...]]]></description>
			<content:encoded><![CDATA[<p>Login to your server and switch to root (yes, you need root access).</p>
<p><code>gem install passenger</p>
<p>export APXS2=/usr/local/apache/bin/apxs<br />
export APR_CONFIG=/usr/local/apache/bin/apr-1-config</p>
<p>passenger-install-apache2-module</code><br />
<span id="more-538"></span><br />
Here the installer (which is awesome and very user friendly) will tell you if you have all the required components, and if not, it will tell you what you need to do to install them.</p>
<p>I was missing Curl development headers with SSL support.</p>
<p><code>yum install curl-devel </code></p>
<p>once that finished, try again:</p>
<p><code>passenger-install-apache2-module</code></p>
<p>If you have all of the required components, passenger will compile and you&#8217;ll end up with an apache2 module. It tells us to update our apache configuration with these lines&#8230; don&#8217;t do it yet:</p>
<p><code>   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so<br />
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.0<br />
   PassengerRuby /usr/bin/ruby</code></p>
<p>As you may have discovered, WHM really does want to manage all of your apache configuration files for you, and thus if you start messing with them directly they will likely get overwritten the next time you update your server (i.e. with Apache EasyUpdate).</p>
<p>The correct way to add changes to your apache configuration is to add it to /usr/local/apache/conf/includes/pre_virtualhost_global.conf. It might not exist. (Mine had just a few lines we had put in there for PCI compliance, such as &#8220;ServerSignature Off&#8221;).</p>
<p>Once you have added those three lines to your pre_virtualhost_global.conf file, it&#8217;s time to restart apache.</p>
<p><code> /etc/rc.d/init.d/httpd restart</code></p>
<p>Magically, apache restarted without any errors. If you run into any trouble, go back and comment out the lines in your conf file above and try to restart the service again. If you need help looking at logs, restarting services, etc, check out the <a href="http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/RestartServices#How%20to%20restart%20services">WHM docs</a>.</p>
<p>Finally, passenger tells us this:<br />
<code><br />
Deploying a Ruby on Rails application: an example</p>
<p>Suppose you have a Rails application in /somewhere. Add a virtual host to your<br />
Apache configuration file and set its DocumentRoot to /somewhere/public:</p>
<p>   <VirtualHost *:80><br />
      ServerName www.yourhost.com<br />
      DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!<br />
      <Directory /somewhere/public><br />
         AllowOverride all              # <-- relax Apache security settings<br />
         Options -MultiViews            # <-- MultiViews must be turned off<br />
      </Directory><br />
   </VirtualHost><br />
</code></p>
<p>So, how do you add custom directives to your accounts in WHM? Check out the <a href="http://docs.cpanel.net/twiki/bin/view/EasyApache3/InsideVHost">documentation on custom VirtualHost directives</a>. </p>
<p>More information:</p>
<ul>
<li><a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html">http://www.modrails.com/documentation/Users%20guide%20Apache.html</a></li>
<li><a href="http://ashleyangell.com/2010/02/how-to-install-phusion-passenger-on-a-centoscpanel-box/">http://ashleyangell.com/2010/02/how-to-install-phusion-passenger-on-a-centoscpanel-box/</a></li>
]]></content:encoded>
			<wfw:commentRss>http://stereointeractive.com/blog/2010/11/18/installing-phusion-passenger-on-whmcpanel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

