<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Conecuh Software]]></title>
  <link href="http://conecuh.com/atom.xml" rel="self"/>
  <link href="http://conecuh.com/"/>
  <updated>2021-08-29T17:22:34-05:00</updated>
  <id>http://conecuh.com/</id>
  <author>
    <name><![CDATA[David H. Wilkins]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[That famous Red Velvet Cake recipe]]></title>
    <link href="http://conecuh.com/blog/2014/05/31/that-famous-red-velvet-cake-recipe/"/>
    <updated>2014-05-31T18:12:00-05:00</updated>
    <id>http://conecuh.com/blog/2014/05/31/that-famous-red-velvet-cake-recipe</id>
    <content type="html"><![CDATA[<div class='lead-in'>
  <p>
    <img alt='Red Velvet Cake' class='left' itemprop='image' src='http://conecuh.com/images/redvelvet.png' title='Red Velvet Cake' />
  </p>
  Red Velvet Cake ready for delivery to a lucky family
</div>
<div class='cake' itemscope='' itemtype='http://schema.org/Recipe'>
  <h2 itemprop='name'>
    Red Velvet Cake
  </h2>
  <p>
    There&#8217;s nothing that says Christmas Time in the South like a Red Velvet cake.   Made from the same goodness that powers Santa&#8217;s suit itself,
    it&#8217;s the centerpiece of your Christmas party, that one dessert that everyone will leave talking about
  </p>
  <!-- more -->
  <p>
    This recipe is tried-and-true.  Ms. Sharon&#8217;s original recipe - the one that people from Dothan to Huntsville request each year.  In her heyday,
    my wife would make twenty or more of these in a day.  Now, just a few neighbors and very close friends get one each year.
  </p>
  <meta content='baking' itemprop='cookingMethod' />
  <meta content='/images/redvelvet.png' itemprop='image' />
  <ul>
    <li itemprop='ingredients'>
      1 &frac12; cups sugar
    </li>
    <li itemprop='ingredients'>
      1 &frac12; cups oil
    </li>
    <li itemprop='ingredients'>
      2 eggs
    </li>
    <li itemprop='ingredients'>
      2 &frac12; cups plain flour
    </li>
    <li itemprop='ingredients'>
      1 tsp baking soda
    </li>
    <li itemprop='ingredients'>
      1 tsp salt
    </li>
    <li itemprop='ingredients'>
      &frac12; tsp baking powder
    </li>
    <li itemprop='ingredients'>
      2 tbsp cocoa
    </li>
    <li itemprop='ingredients'>
      1 tsp vinegar
    </li>
    <li itemprop='ingredients'>
      1oz red food coloring
    </li>
    <li itemprop='ingredients'>
      1 cup buttermilk
    </li>
    <li itemprop='ingredients'>
      1 tsp vanilla
    </li>
  </ul>
  <ol itemprop='recipeInstructions'>
    <li>
      Mix sugar, oil and eggs
    </li>
    <li>
      Add vanilla to the buttermilk
    </li>
    <li>
      Mix vinegar, cocoa and color into a paste
    </li>
    <li>
      Add paste to sugar mixture
    </li>
    <li>
      Sift dry ingredients together, alternating with buttermilk mixture
    </li>
    <li>
      Separate evenly into 3 x 9in baking pans
    </li>
    <li>
      Bake at 325
    </li>
  </ol>
</div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Loading Arduino code over Bluetooth with avrdude]]></title>
    <link href="http://conecuh.com/blog/2014/01/11/loading-arduino-code-over-bluetooth-with-avrdude/"/>
    <updated>2014-01-11T23:33:00-06:00</updated>
    <id>http://conecuh.com/blog/2014/01/11/loading-arduino-code-over-bluetooth-with-avrdude</id>
    <content type="html"><![CDATA[<div class='lead-in'>
  <p>
    <img class='left' src='http://conecuh.com/images/ArduinoCommunityLogo.png' />
  </p>
</div>
Loading
<a href='http://arduino.cc'>
  Arduino
</a>
code to your target is simple with<a href='https://savannah.nongnu.org/projects/avrdude'> avrdude</a>.  Using Bluetooth to load that code with
<a href='https://savannah.nongnu.org/projects/avrdude'>
  avrdude
</a>
is nearly as simple
<!-- more -->
<h2>rfcomm</h2>
<p>
  <a href='http://linuxmanpages.net/manpages/fedora19/man1/rfcomm.1.html'>rfcomm</a>
  is used to set up, maintain, and inspect the RFCOMM configuration of the Bluetooth
  subsystem in the Linux kernel.   First of all, create
  <code>/etc/bluetooth/rfcomm.conf</code>
</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'># /etc/bluetooth/rfcomm.conf
</span><span class='line'>rfcomm0 {
</span><span class='line'>bind yes;
</span><span class='line'># Replace the device address with the address of your bluetooth serial device
</span><span class='line'>device 20:13:10:25:40:43;
</span><span class='line'># channel 1 is VERY IMPORTANT
</span><span class='line'>channel 1;
</span><span class='line'>comment "Bluetooth Serial";
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>
Then use the rfcomm command to bind to the /dev/rfcomm0 device:
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>rfcomm bind 0</span></code></pre></td></tr></table></div></figure>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Database Regex Performance]]></title>
    <link href="http://conecuh.com/blog/2013/12/18/database-regex-performance/"/>
    <updated>2013-12-18T11:38:00-06:00</updated>
    <id>http://conecuh.com/blog/2013/12/18/database-regex-performance</id>
    <content type="html"><![CDATA[<div class='lead-in'>
  <p>
    <img class="left" src="http://conecuh.com/images/owlregex.gif" title="Mastering Regular Expressions" alt="Mastering Regular Expressions">
    Comparing regex performance between MongoDB, MySQL and PostgreSQL
  </p>
</div>
<p>
  <a href='http://www.mongodb.org/'>MongoDB</a>
  has a very rich regular expression (regex) interface.   Regex is available in many of
  the places that ordinary character strings are accepted.   While convenient to use,
  I had some questions about how MongoDB regex performance stacks up to regex performance in other
  (SQL) Databases.
</p>
<!-- more -->
<p>
  <em>
    To run the examples in this post, clone the github repository at
  </em>
  <a href='https://github.com/dwilkins/mongoregexp'>
    https://github.com/dwilkins/mongoregexp
  </a>
  <em>
    and follow the instructions in the
    <a href='https://github.com/dwilkins/mongoregexp/blob/master/README.md'>README.md</a>
    file
  </em>
</p>
<h2>Simplicity</h2>
<p>
  MongoDB regexes are simple to use.  Instead of using double quotes, use forward slashes to delimit strings to match:
</p>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='javascript'><span class='line'><span class="nx">db</span><span class="p">.</span><span class="nx">loglines</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">logline</span><span class="o">:</span> <span class="s2">&quot;66.249.65.20&quot;</span> <span class="p">,</span><span class="nx">$comment</span><span class="o">:</span> <span class="s2">&quot;No Regex&quot;</span><span class="p">}).</span><span class="nx">count</span><span class="p">();</span>
</span><span class='line'><span class="nx">db</span><span class="p">.</span><span class="nx">loglines</span><span class="p">.</span><span class="nx">find</span><span class="p">(</span> <span class="p">{</span> <span class="nx">logline</span><span class="o">:</span> <span class="sr">/^66\.249\.65\.20/</span> <span class="p">,</span><span class="nx">$comment</span><span class="o">:</span> <span class="s2">&quot;Using Regex&quot;</span><span class="p">}).</span><span class="nx">count</span><span class="p">();</span>
</span></code></pre></td></tr></table></div></figure>
<p>
  The difference is, double quotes require a full, exact string match.   Forward slash (regex) will match
  rows where the string matches the pattern given.   If no special regex characters are given columns
  that contain the search string anywhere in the column are considered positive matches.
</p>
<p>
  The first query will only find rows that exactly match the IP Address of
  <code>"66.249.65.20"</code>
  The second query will find rows that match that IP address at the beginning of the line
  and with any (or none) characters following.   The
  <code>"^"</code>
  character is an
  <strong>anchor</strong>
  which means that it helps the regex engine restrict the search to the beginning of a string.
</p>
<p>
  <a href='http://www.mysql.com/'>MySQL</a>
  and
  <a href='http://www.postgresql.org/'>PostgreSQL</a>
  regexes are just as simple to use:
</p>
<strong>MySQL</strong>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sql'><span class='line'><span class="k">select</span> <span class="k">count</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">into</span> <span class="o">@</span><span class="k">rows</span> <span class="k">from</span> <span class="n">loglines</span> <span class="k">where</span> <span class="n">logline</span> <span class="n">regexp</span> <span class="s1">&#39;^66\.249\.65\.20&#39;</span><span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>
<strong>PostgreSQL</strong>
<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sql'><span class='line'><span class="k">select</span> <span class="s1">&#39;bolanchor&#39;</span> <span class="k">as</span> <span class="n">Query</span><span class="p">,</span><span class="k">count</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">from</span> <span class="n">loglines</span> <span class="k">where</span> <span class="n">logline</span> <span class="o">~</span> <span class="s1">&#39;^66\.249\.65\.20&#39;</span><span class="p">;</span>
</span></code></pre></td></tr></table></div></figure>
<p>
  Notice that MySQL uses
  <code>regexp</code>
  instead of
  <code>=</code>
  .  PostgreSQL uses the
  <code>~</code>
  (tilde) character instead of
  <code>=</code>
</p>
<h2>Tested Queries</h2>
<p>
  I tested three different queries for performance on MongoDB, MySQL and PostgreSQL:
</p>
<table class='table table-bordered table-striped'>
  <caption>
    Regex query strings used to compart MongoDB, MySQL and PostgreSQL
  </caption>
  <thead>
    <tr>
      <th>Query</th>
      <th>MongoDB Pattern</th>
      <th>MySQL/PostgreSQL Pattern</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>bolanchor</td></td>
      <td><code>/^66\.249\.65\.20/</td>
      <td><code>^66\.249\.65\.20</td>
    </tr>
    <tr>
      <td>msiecount</td></td>
      <td>
        <code>/MSIE [0-9]{1,}[\.0-9]{0,}/i</code>
      </td>
      <td>
        <code>MSIE [0-9]{1,}[\.0-9]{0,}</code>
      </td>
    </tr>
    <tr>
      <td>eolanchor</td></td>
      <td>
        <code>/baidu\.com\/search\/spider\.html\)"$/</code>
      </td>
      <td>
        <code>baidu\.com\/search\/spider\.html\)"$</code>
      </td>
    </tr>
  </tbody>
</table>
<ul>
  <li>bolanchor - Regex Query with a beginning of line anchor - only matches at the beginning of the line</li>
  <li>msiecount - Regex Query to select lines with matching characters in the middle of the line</li>
  <li>bolanchor - Regex Query with a end of line anchor - only matches at the end of the line</li>
</ul>
<h2>Results:</h2>
<table class='table table-bordered table-striped'>
  <caption>
    Millisecond timings of regex queries performed in MongoDB, MySQL and PostgreSQL
  </caption>
  <thead>
    <tr>
      <th>Query</th>
      <th>Rows</th>
      <th>MongoDB ms</th>
      <th>PostgreSQL ms</th>
      <th>MySQL ms</th>
      <th>Winner</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>bolanchor</td></td>
      <td align='right'>128</td>
      <td align='right'>
        <strong>
          295ms
        </strong>
      </td>
      <td align='right'>2768ms</td>
      <td align='right'>7769ms</td>
      <td align='right'>MongoDB</td>
    </tr>
    <tr>
      <td>msiecount</td></td>
      <td align='right'>371217</td>
      <td align='right'>8512ms</td>
      <td align='right'>
        <strong>5278ms</strong>
      </td>
      <td align='right'>48027ms</td>
      <td align='right'>
        PostgreSQL
        <sup>
          1
        </sup>
      </td>
      <tr>
        <td>eolanchor</td></td>
        <td align='right'>566760</td>
        <td align='right'>
          <strong>
            3190ms
          </strong>
        </td>
        <td align='right'>15892ms</td>
        <td align='right'>61951ms</td>
        <td align='right'>MongoDB</td>
      </tr>
    </tr>
  </tbody>
</table>
<ul>
  <sup>
    1
  </sup>
  MongoDB wins on the second execution, once it caches some of the data in memory.
  MongoDB doesn&#8217;t have a query cache like MySQL, so you can&#8217;t get instant results for
  the exact same query.
</ul>
<p>
  So, MongoDB wins handily in two cases.   PostgreSQL makes a mostly respectable showing,
  but MySQL (MariaDB in this test) brings up a distant third place.
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[mkduino: Using GNU Tools for Arduino development]]></title>
    <link href="http://conecuh.com/2013/04/mkduino-using-gnu-tools-for-arduino-development/"/>
    <updated>2013-11-17T22:57:00-06:00</updated>
    <id>http://conecuh.com/2013/04/mkduino-using-gnu-tools-for-arduino-development</id>
    <content type="html"><![CDATA[<div class='lead-in'>
  <p>
    <img class="left" src="http://conecuh.com/images/gnu-small.png" title="Use GNU Automake with Arduino" alt="Use GNU Automake with Arduino">
  </p>
</div>
<p>
  <a href='https://github.com/dwilkins/mkduino'>
    <code>mkduino</code>
  </a>
  is a small ruby script for building a GNU Automake environment for your
  Arduino development.
</p>
<!-- more -->
<p>
  A couple of years ago I grew tired of using the Arduino IDE.  I realized that there was nothing special about
  a &#8220;sketch&#8221; - it was just regular C/C++ code.  Having written C++ code professionally for several years, I had
  arrived at an environment that worked for me.   This Arduino IDE bore no resemblance to that environment.
  Everything about it seemed to cause  me problems
  <div class='clearfix'>
    <ul>
      <li>
        It&#8217;s Java heritage
      </li>
      <li>
        Neither emacs nor vi key-bindings
      </li>
      <li>The strange file hierarchy</li>
      <li>Line numbers on errors didn&#8217;t match up</li>
      <li>and I&#8217;m sure there are others.</li>
    </ul>
  </div>
</p>
<p>
  I started doing all of my Arduino development using the avr-g++ with my own hand crafted Makefile.   The problem
  was that it was hard to give these to any of my friends.   I started working on a
  <code>rvm-like</code>
  system to download all of the Arduino requirements, build them and then use that for development.  That took
  hours (literally) to compile and seemed a little much for the typical Arduino hacker.
</p>
<p>
  So, I quickly hacked together this ruby script to spit out the required files for a barebones
  gnu automake system.
</p>
<h2>Usage</h2>
<hr />
Go to the directory where your source code is (or should be):
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>./path/to/mkduino.rb
</span><span class='line'>./autogen.sh
</span><span class='line'>./configure --host=avr
</span><span class='line'>make
</span><span class='line'># upload to your device
</span><span class='line'>make upload</span></code></pre></td></tr></table></div></figure>
<p>
  <code>mkduino</code>
  will overwrite your code if you already have a Makefile.am or any of the files it
  generates.   You probably wouldn&#8217;t be running this utility if you already had a makefile
  or any of the files it generates.
</p>
<p>
  Go ahead, use emacs or vi to do development for arduino.   These tools have evolved over time
  to provide professional developers with the power they need to get stuff done.
</p>
<p>
  There&#8217;s more information on
  <code>mkduino</code>
  over on the
  <a href='https://github.com/dwilkins/mkduino'>Github Page</a>
</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Intel Graphics configuration for Fedora 19 (et. al.)]]></title>
    <link href="http://conecuh.com/blog/2013/09/06/intel-graphics-configuration-for-fedora-19-et-al-dot/"/>
    <updated>2013-09-06T08:12:00-05:00</updated>
    <id>http://conecuh.com/blog/2013/09/06/intel-graphics-configuration-for-fedora-19-et-al-dot</id>
    <content type="html"><![CDATA[<div class='lead-in'>
  <p>
    <img class="left" src="http://conecuh.com/images/sandybridge-150x150.png" title="Intel Sandybridge" alt="Intel Sandybridge">
    The Intel Sandybridge i7-2620M processor is capable of overheating Linux
  </p>
</div>
<p>
  I&#8217;ve been plagued for the last few months with problems with my
  <a href='https://01.org/linuxgraphics/'>Intel Graphics</a>
  on my
  <a href='http://support.lenovo.com/en_US/downloads/detail.page?DocID=PD015734'>Lenovo T420.</a>
  I originally bought this laptop specifically because of traditionally great Linux support
  for Thinkpad hardware.   I had the option of Intel vs Nvidia graphics, and I chose Intel
  because
  <a href='http://www.gnome.org/gnome-3/'>Gnome3</a>
  was reputed to work better with the Intel graphics.
</p>
<p class='clearfix'>
  This laptop has pretty impressive
  <a href='http://ark.intel.com/products/52231'>specs</a>
  An excerpt from
  <code>/proc/cpuinfo</code>
  on Linux
</p>
<!-- more -->
<div class='cpuinfo-gist clearfix'>
  <div><script src='https://gist.github.com/6464847.js'></script>
</div>
<noscript><pre><code></code></pre></noscript></div>
<p>
  I&#8217;ve also got plenty of ram (excerpt from
  <code>/proc/meminfo:</code>
</p>
<div><script src='https://gist.github.com/6464874.js'></script>
<noscript><pre><code></code></pre></noscript></div>
<p>
  My problems were:
</p>
<ul>
  <li>Overheating</li>
  <li>Poor performance when overheating</li>
  <li>Overheating</li>
</ul>
<p>
  Frequently the temperature as reported by
  <a href='https://extensions.gnome.org/extension/120/system-monitor/'>system monitor</a>
  would register around 95C degrees, which is uncomfortably warm to both the lap and hands.
  I did a lot of probing around and eventually wrote a script to just detect when the
  graphics card was in a wierd state
  <div><script src='https://gist.github.com/6464152.js'></script>
</p>
<noscript><pre><code></code></pre></noscript></div>
<p>
  After a lot of mailing list and Google research (months, not days or hours) I finally stumbled
  on this tidbit on the
  <a href='https://www.archlinux.org/'>ArchWiki</a>
</p>
<p>
  Link:
  <a href='https://wiki.archlinux.org/index.php/Intel_Graphics#Choose_acceleration_method'>https://wiki.archlinux.org/index.php/Intel_Graphics#Choose_acceleration_method</a>
  File to create: /etc/X11/xorg.conf.d/20-intel.conf
  <div><script src='https://gist.github.com/6464308.js'></script>
</p>
<noscript><pre><code></code></pre></noscript></div>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Hardware PWM implementation for Cubie and Allwinner A10]]></title>
    <link href="http://conecuh.com/blog/2013/08/23/a-hardware-pwm-implementation-for-cubie-and-allwinner-a10/"/>
    <updated>2013-08-23T15:30:00-05:00</updated>
    <id>http://conecuh.com/blog/2013/08/23/a-hardware-pwm-implementation-for-cubie-and-allwinner-a10</id>
    <content type="html"><![CDATA[<div class="lead-in">
<p>
    <img class="left" src="http://conecuh.com/images/cubie-150x150.png" title="Cubieboard" alt="Cubieboard">
    Cubieboard-1 - powered by the Allwinner A10 Arm SOC
</p>
</div>


<p>When I received my first Allwinner A10 board it lacked support for hardware PWM.
Without a driver for hardware PWM it&rsquo;s very hard to use this very powerful
SOC for controlling motors</p>

<p>This article describes the design of one such <a href="http://github.com/dwilkins/pwm-sunxi">hardware pwm driver</a>
interface.</p>

<!-- more -->


<p><img src="http://conecuh.com/images/Duty50Pos.png" title="PWM Signal with 50% duty - positive polarity" alt="PWM signals" /></p>

<p>The Arduino has a simple to use PWM interface and other implementations should
strive to have a similarly developer friendly interface.  The &ldquo;analogWrite&rdquo;
Arduino interface is both easy to understand and implement.   For instance the
following code implements a 50% duty cycle on digital pin 5:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="n">pinMode</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="n">OUTPUT</span><span class="p">);</span>    <span class="c1">// Declare pin 5 as output</span>
</span><span class='line'><span class="n">analogWrite</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="mi">128</span><span class="p">);</span>   <span class="c1">// Output a valud between 0 (off) and 255 (full on)</span>
</span></code></pre></td></tr></table></div></figure>


<p>One problem with the Arduino interface is the learning curve required to venture beyond
the primary interface.  For instance, the above code doesn&rsquo;t specify the PWM period.
Many motors (servos..) function best within a specific PWM period.</p>

<p>This implementation doesn&rsquo;t allow specification of the signal polarity either.   If the hardware interface
requires an inverted signal, then duty will have to be computed as 1/duty manually.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="kt">void</span> <span class="n">TimerOne</span><span class="o">::</span><span class="n">setPeriod</span><span class="p">(</span><span class="kt">long</span> <span class="n">microseconds</span><span class="p">)</span>             <span class="c1">// AR modified for atomic access</span>
</span><span class='line'><span class="p">{</span>
</span><span class='line'>
</span><span class='line'>  <span class="kt">long</span> <span class="n">cycles</span> <span class="o">=</span> <span class="p">(</span><span class="n">F_CPU</span> <span class="o">/</span> <span class="mi">2000000</span><span class="p">)</span> <span class="o">*</span> <span class="n">microseconds</span><span class="p">;</span>                                <span class="c1">// the counter runs backwards after TOP, interrupt is at BOTTOM so divide microseconds by 2</span>
</span><span class='line'>  <span class="k">if</span><span class="p">(</span><span class="n">cycles</span> <span class="o">&lt;</span> <span class="n">RESOLUTION</span><span class="p">)</span>              <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS10</span><span class="p">);</span>              <span class="c1">// no prescale, full xtal</span>
</span><span class='line'>  <span class="k">else</span> <span class="k">if</span><span class="p">((</span><span class="n">cycles</span> <span class="o">&gt;&gt;=</span> <span class="mi">3</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">RESOLUTION</span><span class="p">)</span> <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS11</span><span class="p">);</span>              <span class="c1">// prescale by /8</span>
</span><span class='line'>  <span class="k">else</span> <span class="k">if</span><span class="p">((</span><span class="n">cycles</span> <span class="o">&gt;&gt;=</span> <span class="mi">3</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">RESOLUTION</span><span class="p">)</span> <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS11</span><span class="p">)</span> <span class="o">|</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS10</span><span class="p">);</span>  <span class="c1">// prescale by /64</span>
</span><span class='line'>  <span class="k">else</span> <span class="k">if</span><span class="p">((</span><span class="n">cycles</span> <span class="o">&gt;&gt;=</span> <span class="mi">2</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">RESOLUTION</span><span class="p">)</span> <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS12</span><span class="p">);</span>              <span class="c1">// prescale by /256</span>
</span><span class='line'>  <span class="k">else</span> <span class="k">if</span><span class="p">((</span><span class="n">cycles</span> <span class="o">&gt;&gt;=</span> <span class="mi">2</span><span class="p">)</span> <span class="o">&lt;</span> <span class="n">RESOLUTION</span><span class="p">)</span> <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS12</span><span class="p">)</span> <span class="o">|</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS10</span><span class="p">);</span>  <span class="c1">// prescale by /1024</span>
</span><span class='line'>  <span class="k">else</span>        <span class="n">cycles</span> <span class="o">=</span> <span class="n">RESOLUTION</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="n">clockSelectBits</span> <span class="o">=</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS12</span><span class="p">)</span> <span class="o">|</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS10</span><span class="p">);</span>  <span class="c1">// request was out of bounds, set as maximum</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">oldSREG</span> <span class="o">=</span> <span class="n">SREG</span><span class="p">;</span>
</span><span class='line'>  <span class="n">cli</span><span class="p">();</span>                                                        <span class="c1">// Disable interrupts for 16 bit register access</span>
</span><span class='line'>  <span class="n">ICR1</span> <span class="o">=</span> <span class="n">pwmPeriod</span> <span class="o">=</span> <span class="n">cycles</span><span class="p">;</span>                                          <span class="c1">// ICR1 is TOP in p &amp; f correct pwm mode</span>
</span><span class='line'>  <span class="n">SREG</span> <span class="o">=</span> <span class="n">oldSREG</span><span class="p">;</span>
</span><span class='line'>
</span><span class='line'>  <span class="n">TCCR1B</span> <span class="o">&amp;=</span> <span class="o">~</span><span class="p">(</span><span class="n">_BV</span><span class="p">(</span><span class="n">CS10</span><span class="p">)</span> <span class="o">|</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS11</span><span class="p">)</span> <span class="o">|</span> <span class="n">_BV</span><span class="p">(</span><span class="n">CS12</span><span class="p">));</span>
</span><span class='line'>  <span class="n">TCCR1B</span> <span class="o">|=</span> <span class="n">clockSelectBits</span><span class="p">;</span>                                          <span class="c1">// reset clock select register, and starts the clock</span>
</span><span class='line'><span class="p">}</span>
</span></code></pre></td></tr></table></div></figure>


<p>*example code from <a href="https://code.google.com/p/arduino-timerone/source/browse/trunk/TimerOne.cpp#57">Timer One Library for Arduino</a></p>

<p>The Linux OS and expanded ram of the <a href="http://cubieboard.org">cubieboard</a> make possible a much more rich
interface than the arduino affords.  File based programming interfaces are
available to extend the PWM control to many more languages.  One possible implementation
might include the following interface (examples in shell script):</p>

<ul>
<li><h3>/sys/class/pwm-sunxi/pwmX</h3>

This is the sysfs directory that contains the PWM interface. X is the PWM channel.
The Allwinner A10 has 2

<ul>
<li><h4>period (r/w)</h4>

<p>period that makes up a cycle.  Can be expressed as hz, khz, ms, or us.
Whole numbers only.  Examples:
<code>echo 10hz &gt; /sys/class/pwm-sunxi/pwm0/period</code><br />
<code>echo 1khz &gt; /sys/class/pwm-sunxi/pwm0/period</code><br />
<code>echo 100ms &gt; /sys/class/pwm-sunxi/pwm0/period</code><br />
<code>echo 100us &gt; /sys/class/pwm-sunxi/pwm0/period</code><br />
<code>echo 150khz &gt; /sys/class/pwm-sunxi/pwm0/period</code><br /></p></li>
<li><h4>duty (r/w)</h4>

<p>portion of the period above that is &ldquo;active&rdquo; or on.  Same units as duty.<br />
<code>echo 100ms &gt; /sys/class/pwm-sunxi/pwm0/period</code> # <em>Period is 100 milliseconds</em><br />
<code>echo 25ms &gt; /sys/class/pwm-sunxi/pwm0/duty</code> # <em>25% duty</em> <br />
<code>echo 50ms &gt; /sys/class/pwm-sunxi/pwm0/duty</code> # <em>50% duty</em> <br />
<code>echo 75ms &gt; /sys/class/pwm-sunxi/pwm0/duty</code> # <em>75% duty</em> <br /></p></li>
<li><h4>duty_percent (r/w)</h4>

<p>duty expressed as a percentage.  Whole numbers only<br />
<code>echo 100ms &gt; /sys/class/pwm-sunxi/pwm0/period</code> # <em>Period is 100 milliseconds</em><br />
<code>echo 25 &gt; /sys/class/pwm-sunxi/pwm0/duty_percent</code> # <em>25% duty</em><br />
<code>echo 50 &gt; /sys/class/pwm-sunxi/pwm0/duty_percent</code> # <em>50% duty</em><br />
<code>echo 75 &gt; /sys/class/pwm-sunxi/pwm0/duty_percent</code> # <em>75% duty</em><br /></p></li>
<li><h4>polarity (r/w)</h4>

<p>Polarity of the pin during the duty portion.  Note that the opposite state will be for
the non-duty portion.<br />
1 = high, 0 = low</p></li>
</ul>
</li>
</ul>


<p><img src="http://conecuh.com/images/Duty25Pos.png" title="PWM Signal with 25% duty - positive polarity" alt="PWM signals" /></p>

<p><img src="http://conecuh.com/images/Duty25Neg.png" title="PWM Signal with 50% duty - negative polarity" alt="PWM signals" /></p>

<ul>
<li><h4>pulse (r/w)</h4>

<p>Output one pulse at the specified period and duty<br />
 <code>echo 1 &gt; /sys/class/pwm-sunxi/pwm0/puls</code> # <em>Output 1 pulse when run is 1</em><br /></p></li>
<li><h4>pin (r/o)</h4>

<p>Name of the A10 pin this pwm outputs on.  This is hardwired and informational only.
Example:<br />
<code>cat /sys/class/pwm-sunxi/pwm0/pin</code> # <em>output: PB2</em><br /></p></li>
<li><h4>run (r/w)</h4>

<p>Enable the PWM with the previously set parameters.  Example:<br />
<code>echo 1 &gt; /sys/class/pwm-sunxi/pwm0/run</code> # <em>Start the pwm interface</em><br />
<code>echo 0 &gt; /sys/class/pwm-sunxi/pwm0/run</code> # <em>Stop the pwm interface</em><br /></p></li>
</ul>


<p>So, the above interface as a Linux kernel module can implement a <strong>50% duty cycle</strong> hardware pwm with the following code:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="n">echo</span> <span class="mi">50</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">duty_percent</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">1</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">run</span>
</span></code></pre></td></tr></table></div></figure>


<p>Or a  <strong>25% duty cycle at 250hz</strong> with the following code:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="n">echo</span> <span class="mi">250</span><span class="n">hz</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">period</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">50</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">duty_percent</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">1</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">run</span>
</span></code></pre></td></tr></table></div></figure>


<p>Or a  <strong>25% duty cycle at 500hz with negative polarity</strong> with the following code:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='c++'><span class='line'><span class="n">echo</span> <span class="mi">500</span><span class="n">hz</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">period</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">50</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">duty</span><span class="err">\</span><span class="n">_percent</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">0</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">polarity</span>
</span><span class='line'><span class="n">echo</span> <span class="mi">1</span> <span class="o">&gt;</span> <span class="o">/</span><span class="n">sys</span><span class="o">/</span><span class="n">class</span><span class="o">/</span><span class="n">pwm</span><span class="o">-</span><span class="n">sunxi</span><span class="o">/</span><span class="n">pwm0</span><span class="o">/</span><span class="n">run</span>
</span></code></pre></td></tr></table></div></figure>


<p>So, the design goal of a simple interface is achieved, with incremental functionality
requiring only incremental amounts of additional code.</p>

<p><em>Next article &ndash; developing the <a href="http://github.com/dwilkins/pwm-sunxi">pwm-sunxi</a> pwm module</em></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[GPIO using Fedora 18 on pcDuino]]></title>
    <link href="http://conecuh.com/2013/04/gpio-using-fedora-18-on-pcduino/"/>
    <updated>2013-04-17T00:00:00-05:00</updated>
    <id>http://conecuh.com/2013/04/gpio-using-fedora-18-on-pcduino</id>
    <content type="html"><![CDATA[<div class="lead-in">
    <p>
    <img class="left" src="http://conecuh.com/images/pcduino-150x150.png" title="A Mini PC with Arduino type Interface powered by ARM Pro Spec" alt="A Mini PC with Arduino type Interface powered by ARM Pro Spec">
    A Mini PC with Arduino type Interface powered by ARM Pro Spec
    </p>
</div>


<!-- more -->


<p>I recently purchased a <a href="1">pcDuino</a> because of it&rsquo;s plenitude of I/O (5v) GPIO pins.
My <a href="2">Raspberry Pi</a> was an interesting board, but it lacked the GPIO and Analog to Digital inputs that make the Arduino so useful.
The Arduino, while imminently useful, lacks the power to handle images and other
high-bandwith tasks so it&rsquo;s relegated to motor control and simple I/O.</p>

<p>The pcDuino comes well-outfitted compared to both the Raspberry Pi and the Arduino:
</p>
* CPU: 1GHz ARM Cortex A8
* GPU: OpenGL ES2.0, OpenVG 1.1 Mali 400 core
* <strong>DRAM: 1GB</strong>
* Onboard Storage: 2GB Flash, SD card slot for up to 32GB
* Video Output: HDMI
* OS: Linux + Android
* Extension Interface: 2.54 mm Headers compatible with Arduino
* Network interface: RJ45 and USB WiFi Dongle</p>

<p>
  Once I saw the horrid version of <a href="http://lubuntu.net/" title="Lubuntu">Lubuntu</a> that came pre-installed on the device, I started looking for a <a href="http://fedoraproject.org/" title="Fedora">Fedora</a> port. Luckily Hans de Goede has published a <a href="http://scotland.proximity.on.ca/contrib-images/hansg" title="Directory of Fedora 18 Port">Fedora port</a> for the Allwinner 10 chip. Loading this was simple and straightforward &#8211; just follow the <a href="http://scotland.proximity.on.ca/contrib-images/hansg/README" title="Readme for Fedora Port by Hans de Goede">README</a>
</p>


<p>Then came the task of accessing the GPIO. The Lubuntu image that came with the device exposed some GPIO pins at <code>/sys/devices/virtual/misc/gpio</code>, but Fedora did not show any pins there. After a couple of days of probing the Internet for the source, I stumbled across the amazing <a href="3">GPIO sysfs</a> capabilities of Linux.</p>

<p>After following the guide on <a href="3">elinux.org</a>, I was still unable to access *any* GPIO. Then I remembered that I chose &#8220;cubieboard&#8221; when I loaded the port by Hans. More hunting revealed <a href="4">uboot</a>, <a href="5">sunxi-tools</a> and the <code>script.bin</code> file. Following are the rough instructions on how to get access to the GPIO on your pcDunio in Fedora&#8230;</p>

<p>Start with the <a href="6">Fedora port</a> by Hans de Goede.</p>

<ul>
<li>In step 6 when it asks you to select a board with:<br/>
<code>sh &lt;uboot-part-mount&gt;/select-board.sh</code><br /></li>
<li>Select the <a href="http://cubieboard.com">cubieboard</a></li>
<li>Clone the <a href="7">linux-sunxi/sunxi-tools</a> on your Linux box (not the pcDunio)</li>
<li>Compile by typing <strong><code>make</code></strong>
Don&rsquo;t worry if it doesn&rsquo;t compile everything. The two commands we need &#8211; <strong><code>bin2fex</code></strong> and <code><strong>fex2bin</code></strong> will be compiled in that directory</li>
<li>Mount your microSD card and grab the script.bin file from the pcDuino (<code>/boot/uboot/script.bin</code>)</li>
<li>Convert it to <a href="8">fex format</a>
<code>bin2fex script.bin &gt; myboard.fex</code></li>
<li>Grab the pcDuino fex file from <a href="https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a10/pcduino.fex" title="pcduino.fex file on github">linux-sunxi / sunxi-boards</a></li>
<li>Copy the lines from section <strong><code>[gpio_para]</code></strong> into your <strong><code>myboard.fex</code></strong> file at about the same place they were in
 the <strong><code>pcduino.fex</code></strong> file</li>
<li>Convert it back to bin format with <code>fex2bin myboard.fex &gt; script.bin</code></li>
<li>Move it back into place as <strong><code>/boot/uboot/script.bin</code></strong></p></li>
<li>Unmount your sdcard from your Linux box and boot your pcDuino &#8211; it&rsquo;s got new superpowers now.</li>
<li>Follow the guide at <a href="3">elinux.org</a></li>
<li><strong>PROFIT</strong></li>
</ul>


<p>Bash shell script that blinks the LED</p>

<script src="https://gist.github.com/dwilkins/5407570.js"></script>


<h2>Pic or it didn&rsquo;t happen</h2>

<div class="embed-video-container"><iframe src="http://www.youtube.com/embed/NY_w2CB3XwI "></iframe></div>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Making Fedora 17, Unicorn and nginx work together]]></title>
    <link href="http://conecuh.com/2013/04/making-fedora-1-unicorn-and-nginx-work-together/"/>
    <updated>2013-04-05T00:00:00-05:00</updated>
    <id>http://conecuh.com/2013/04/making-fedora-1-unicorn-and-nginx-work-together</id>
    <content type="html"><![CDATA[<div class="lead-in">
    <p>
    <img class="left" src="http://conecuh.com/images/fight150x150.png">
    </p>
</div>


<p>I had a heck of a time getting a <a href="1">Rails</a> + <a href="2">Unicorn</a> + <a href="3">nginx</a> deployment going on Fedora 17. The problem was, I could get it running using TCP sockets but not using unix sockets. I loosely followed these <a href="http://isotope11.com/blog/deploying-a-rails-3-dot-2-plus-app-from-scratch-on-ubuntu" title="Deploying a Rails 3.2+ app from scratch on Ubuntu">instructions</a> for deploying a Rails 3.2 app but kept having problems with the unix sockets.</p>

<h2>The Solution:</h2>

<p>  <strong>Don&rsquo;t put the socket file in the /tmp directory.</strong></p>

<!-- more -->


<h2>The Why:</h2>

<p>Fedora has this in <code>/etc/systemd/system/multi-user.target.wants/nginx.service</code></p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[Unit]
</span><span class='line'>Description=The nginx HTTP and reverse proxy server
</span><span class='line'>After=syslog.target network.target remote-fs.target nss-lookup.target
</span><span class='line'>
</span><span class='line'>[Service]
</span><span class='line'>Type=forking
</span><span class='line'>PIDFile=/run/nginx.pid
</span><span class='line'>ExecStartPre=/usr/sbin/nginx -t
</span><span class='line'>ExecStart=/usr/sbin/nginx
</span><span class='line'>ExecReload=/bin/kill -s HUP $MAINPID
</span><span class='line'>ExecStop=/bin/kill -s QUIT $MAINPID
</span><span class='line'>PrivateTmp=true
</span><span class='line'>[Install]
</span><span class='line'>WantedBy=multi-user.target</span></code></pre></td></tr></table></div></figure>


<p>And if you look over on the Unicorn site, you&rsquo;ll see this as the documentation for the <a href="http://unicorn.bogomips.org/Unicorn/Configurator.html#method-i-listen" title="listen documentation">listen</a> method / configuration setting</p>

<p>Adds an <tt>address</tt> to the existing listener set. May be specified more than once. <tt>address</tt> may be an Integer port number for a TCP port, an “IP_ADDRESS:PORT” for TCP listeners or a pathname for UNIX domain sockets.</p>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>listen 3000 # listen to port 3000 on all TCP interfaces
</span><span class='line'>listen "127.0.0.1:3000"  # listen to port 3000 on the loopback interface
</span><span class='line'>&lt;strong&gt;listen "/tmp/.unicorn.sock" # listen on the given Unix domain socket&lt;/strong&gt;
</span><span class='line'>listen "[::1]:3000" # listen to port 3000 on the IPv6 loopback interface</span></code></pre></td></tr></table></div></figure>


<p>Which <em>encourages folks to put the socket in the <code>/tmp</code> directory</em>. This is going to cause trouble for every Fedora user that tries to use Unicorn.</p>

<p>While debugging this I got the infamous &#8220;502 Bad Gateway&#8221; page from nginx. I checked out the <code>error_log</code>, and this message was there:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>2013/04/05 12:25:58 [crit] 2906#0: *29 connect() to unix:/tmp/my_project_name.socket failed
</span><span class='line'>                    (2: No such file or directory) while connecting to upstream,
</span><span class='line'>                    client: 192.168.10.234, server: my_project_name.railsit.com,
</span><span class='line'>                    request: "GET / HTTP/1.1",
</span><span class='line'>                    upstream: "http://unix:/tmp/my_project_name.socket:/",
</span><span class='line'>                    host: "my_project_name.railsit.com:8081"</span></code></pre></td></tr></table></div></figure>


<p>So, after a couple of hours of head scratching and WTF&#8217;ing, I remembered that <a href="http://fedoraproject.org/wiki/Systemd" title="systemd wiki page">systemd</a> did some crazy shenanigans
to mysql, preventing me from setting the file limit higher. As soon as I saw the <strong>PrivateTmp=true</strong> line in the
<code>nginx.service</code> file, I knew that <a href="http://fedoraproject.org/wiki/Systemd" title="Systemd wiki page">systemd</a> was the culprit.</p>

<p>Hope this helps someone.</p>
]]></content>
  </entry>
  
</feed>
