<?xml version="1.0" encoding="UTF-8"?>
<rss version='2.0' xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Steven Turner</title>
    <description>Physics and Software</description>
    <link>http://www.beauhinks.com/feed</link>
    <atom:link href="http://www.beauhinks.com/feed" rel="self" type="application/rss+xml"/>
    <category domain="www.beauhinks.com">Content Management/Blog</category>
    <language>en-us</language>
      <pubDate>Tue, 01 Sep 2020 11:41:41 -1100</pubDate>
    <managingEditor>whathasnotbeenused@gmail.com (Steven Turner)</managingEditor>
      <item>
        <guid>http://www.beauhinks.com/faking-out-temperature-reading-on-aws-ec2#50620</guid>
          <pubDate>Tue, 01 Sep 2020 11:41:41 -1100</pubDate>
        <link>http://www.beauhinks.com/faking-out-temperature-reading-on-aws-ec2</link>
        <title>Faking out Temperature Reading on AWS EC2</title>
        <description>It&#39;s getting hot in here</description>
        <content:encoded><![CDATA[<p>Need to test software that needs to access temperature readings or test on AWS?<br>
Check this out! Thanks Steven Toth!</p>
<div class="highlight"><pre><span></span>git clone git@github.com:steveturner/dummy-hwmon-driver.git
cd dummy-hwmon-driver
make
make load
</pre></div>
<p>Bask in temperature readings.</p>
]]></content:encoded>
      </item>
      <item>
        <guid>http://www.beauhinks.com/configuring-a-2018-mbp-15-i9#41781</guid>
          <pubDate>Wed, 08 Aug 2018 11:27:07 -1100</pubDate>
        <link>http://www.beauhinks.com/configuring-a-2018-mbp-15-i9</link>
        <title>Configuring a 2018 MBP 15&quot; i9</title>
        <description>How to not burn your thighs and other bits of config</description>
        <content:encoded><![CDATA[<p>Check out:<br>
<a href="http://www.stuartellis.name/articles/mac-setup/#do-this-first">http://www.stuartellis.name/articles/mac-setup/#do-this-first</a></p>

<p>Go get the update for the i9 throttling issue (<a href="https://appleinsider.com/articles/18/07/24/apple-targets-thermal-performance-issues-on-2018-macbook-pros-with-free-software-update">https://appleinsider.com/articles/18/07/24/apple-targets-thermal-performance-issues-on-2018-macbook-pros-with-free-software-update</a> )</p>

<ul>
<li>configure inverse scroll</li>
<li>configure tap to click</li>
<li>make sure right click with &quot;tap&quot;</li>
<li>remove unnecessary apps from dock -- pages, keynote, launchpad, iTunes, FaceTime, iBook, photos, contacts</li>
<li>move dock to top left and make smaller</li>
<li>Enable firewall in system preferences</li>
<li>install win10 bootcamp, reboot</li>
<li>install vmware fusion (now supports metal) -- need to get keys paid for</li>
<li>xcode-select --install</li>
<li><a href="https://github.com/drduh/macOS-Security-and-Privacy-Guide#basics">https://github.com/drduh/macOS-Security-and-Privacy-Guide#basics</a></li>
<li>install home-brew to ~/homebrew</li>
<li>install slack with cask <code>slack-beta</code></li>
<li>install ms office with cask <a href="https://github.com/Homebrew/homebrew-cask/blob/master/Casks/microsoft-office.rb">https://github.com/Homebrew/homebrew-cask/blob/master/Casks/microsoft-office.rb</a></li>
<li>cask install google-chrome</li>
<li>cask install 1password</li>
<li>cask install dropbox</li>
<li>cask install arq</li>
<li>cask install iterm2-beta</li>
<li>cask install microsoft-office</li>
<li>cask install zsh</li>
<li>sync zsh history between nodes
<a href="https://apple.stackexchange.com/questions/101090/list-of-all-packages-installed-using-homebrew">https://apple.stackexchange.com/questions/101090/list-of-all-packages-installed-using-homebrew</a>
install additional packages via above list...</li>
<li>Brew bundle allows you to import the following to automate all of this:
<code>
tap &quot;homebrew/boneyard&quot;
tap &quot;homebrew/bundle&quot;
tap &quot;homebrew/cask&quot;
tap &quot;homebrew/cask-fonts&quot;
tap &quot;homebrew/cask-versions&quot;
tap &quot;homebrew/core&quot;
brew &quot;git&quot;
brew &quot;gradle&quot;
brew &quot;hg-flow&quot;
brew &quot;ical-buddy&quot;
brew &quot;locateme&quot;
brew &quot;mas&quot;
brew &quot;maven&quot;
brew &quot;node&quot;
brew &quot;python&quot;
brew &quot;ripgrep&quot;
brew &quot;the_silver_searcher&quot;
brew &quot;thefuck&quot;
brew &quot;tmux&quot;
brew &quot;vim&quot;, args: [&quot;with-luajit&quot;]
cask &quot;1password&quot;
cask &quot;alfred&quot;
cask &quot;arq&quot;
cask &quot;daisydisk&quot;
cask &quot;dropbox&quot;
cask &quot;evernote&quot;
cask &quot;font-firacode-nerd-font&quot;
cask &quot;font-hack-nerd-font&quot;
cask &quot;fork&quot;
cask &quot;gfxcardstatus&quot;
cask &quot;google-chrome&quot;
cask &quot;intellij-idea&quot;
cask &quot;iterm2-beta&quot;
cask &quot;microsoft-office&quot;
cask &quot;slack-beta&quot;
cask &quot;spotify&quot;
cask &quot;tortoisehg&quot;
cask &quot;tunnelblick&quot;
cask &quot;wireshark&quot;
mas &quot;GarageBand&quot;, id: 682658836
mas &quot;HyperDock&quot;, id: 449830122
mas &quot;iMovie&quot;, id: 408981434
mas &quot;JSON Helper&quot;, id: 453114608
mas &quot;Keynote&quot;, id: 409183694
mas &quot;Location Helper&quot;, id: 488536386
mas &quot;Numbers&quot;, id: 409203825
mas &quot;Pages&quot;, id: 409201541
mas &quot;Skitch&quot;, id: 425955336
mas &quot;Wunderlist&quot;, id: 410628904
</code></li>
<li>install jabba for jdk installation and management</li>
<li>install synergy for linking with other platforms you are working with.</li>
</ul>
]]></content:encoded>
      </item>
      <item>
        <guid>http://www.beauhinks.com/netty-pure-java-serial-port#21565</guid>
          <pubDate>Wed, 20 Jan 2016 19:34:17 -1100</pubDate>
        <link>http://www.beauhinks.com/netty-pure-java-serial-port</link>
        <title>Netty Pure Java Serial Port</title>
        <description></description>
        <content:encoded><![CDATA[<h1 id="intro">Intro</h1>

<p>Typically when interacting with serial ports from Java you have three options:</p>

<ul>
<li><a href="http://rxtx.qbang.org/">RxTx</a></li>
<li><a href="https://serialio.com/products/applications/custom-prior-software-versions/java-serial-port">SerialIO</a></li>
<li><a href="https://github.com/scream3r/java-simple-serial-connector/">JSS</a></li>
</ul>

<p>All are actually mature solutions but SerialIO is a commercial product and JSS and RxTx either require the native libraries to be intalled/compiled for the host platform. Personally, I&#39;ve had issues with RxTx and the C++ source code can be a bit difficult to understand when a problem arrises.</p>

<h1 id="solution">Solution</h1>

<p><a href="https://github.com/nyholku/purejavacomm">PureJavaComm</a> is a solution which I&#39;ve had the privilege to work with extensively. What&#39;s nice about PureJavaComm is that it is entirely written in Java except for specific calls to platform functions which leverage JNA. In their own words:</p>

<blockquote>
<p>PJC is written 100% in Java so it is easy for Java programmers to develop and debug and it requires no native libraries. Native access to the underlaying operating system&#39;s serial port programming interface is provided by the wonderful JNA library which takes away all the pain of compiling and deploying native code.</p>
</blockquote>

<p>In my own use, I&#39;ve found PureJavaComm to be extremely easy to use and extend to serial devices with their own platform libraries by leveraging <a href="https://code.google.com/p/jnaerator/">JNAerator</a> to generate JNA wrappers to library code.</p>

<h2 id="netty-and-serial">Netty And Serial</h2>

<p>Netty already provides an excellent wrapper to interacting with a serial port at the application level via the RxTx transport. However, as mentioned above you still need the native libraries installed. To alleviate this, I&#39;ve created <a href="https://github.com/steveturner/netty-transport-purejavacomm/tree/develop">Netty Transport PureJavaComm</a><br>
Here&#39;s a quick sample based on the existing Netty RxTx code:</p>
<div class="highlight"><pre><span></span><span class="n">package</span> <span class="n">com</span><span class="o">.</span><span class="n">beauhinks</span><span class="o">.</span><span class="n">example</span><span class="o">.</span><span class="n">purejavacomm</span><span class="p">;</span>

<span class="kn">import</span> <span class="nn">com.beauhinks.purejavacomm.PureJavaCommChannel</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">com.beauhinks.purejavacomm.PureJavaCommDeviceAddress</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.bootstrap.Bootstrap</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.channel.ChannelFuture</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.channel.ChannelInitializer</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.channel.EventLoopGroup</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.channel.oio.OioEventLoopGroup</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.handler.codec.LineBasedFrameDecoder</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.handler.codec.string.StringDecoder</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">io.netty.handler.codec.string.StringEncoder</span><span class="p">;</span>
<span class="kn">import</span> <span class="nn">purejavacomm.CommPortIdentifier</span><span class="p">;</span>

<span class="kn">import</span> <span class="nn">java.util.Enumeration</span><span class="p">;</span>


<span class="o">/**</span>
 <span class="o">*</span> <span class="n">Sends</span> <span class="n">one</span> <span class="n">message</span> <span class="n">to</span> <span class="n">a</span> <span class="n">serial</span> <span class="n">device</span>
 <span class="o">*/</span>
<span class="n">public</span> <span class="n">final</span> <span class="k">class</span> <span class="nc">PureJavaCommClient</span> <span class="p">{</span>

    <span class="n">public</span> <span class="n">static</span> <span class="n">void</span> <span class="n">main</span><span class="p">(</span><span class="n">String</span><span class="p">[]</span> <span class="n">args</span><span class="p">)</span> <span class="n">throws</span> <span class="ne">Exception</span> <span class="p">{</span>
        <span class="n">CommPortIdentifier</span> <span class="n">portid</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
        <span class="n">Enumeration</span> <span class="n">e</span> <span class="o">=</span> <span class="n">CommPortIdentifier</span><span class="o">.</span><span class="n">getPortIdentifiers</span><span class="p">();</span>
        <span class="k">while</span> <span class="p">(</span><span class="n">e</span><span class="o">.</span><span class="n">hasMoreElements</span><span class="p">())</span> <span class="p">{</span>
            <span class="n">portid</span> <span class="o">=</span> <span class="p">(</span><span class="n">CommPortIdentifier</span><span class="p">)</span> <span class="n">e</span><span class="o">.</span><span class="n">nextElement</span><span class="p">();</span>
            <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s2">&quot;found &quot;</span> <span class="o">+</span> <span class="n">portid</span><span class="o">.</span><span class="n">getName</span><span class="p">());</span>
        <span class="p">}</span>
        <span class="n">EventLoopGroup</span> <span class="n">group</span> <span class="o">=</span> <span class="n">new</span> <span class="n">OioEventLoopGroup</span><span class="p">();</span>
        <span class="k">try</span> <span class="p">{</span>
            <span class="n">Bootstrap</span> <span class="n">b</span> <span class="o">=</span> <span class="n">new</span> <span class="n">Bootstrap</span><span class="p">();</span>
            <span class="n">b</span><span class="o">.</span><span class="n">group</span><span class="p">(</span><span class="n">group</span><span class="p">)</span>
                    <span class="o">.</span><span class="n">channel</span><span class="p">(</span><span class="n">PureJavaCommChannel</span><span class="o">.</span><span class="n">class</span><span class="p">)</span>
                    <span class="o">.</span><span class="n">handler</span><span class="p">(</span><span class="n">new</span> <span class="n">ChannelInitializer</span><span class="o">&lt;</span><span class="n">PureJavaCommChannel</span><span class="o">&gt;</span><span class="p">()</span> <span class="p">{</span>
                        <span class="nd">@Override</span>
                        <span class="n">public</span> <span class="n">void</span> <span class="n">initChannel</span><span class="p">(</span><span class="n">PureJavaCommChannel</span> <span class="n">ch</span><span class="p">)</span> <span class="n">throws</span> <span class="ne">Exception</span> <span class="p">{</span>
                            <span class="n">ch</span><span class="o">.</span><span class="n">pipeline</span><span class="p">()</span><span class="o">.</span><span class="n">addLast</span><span class="p">(</span>
                                    <span class="n">new</span> <span class="n">LineBasedFrameDecoder</span><span class="p">(</span><span class="mi">32768</span><span class="p">),</span>
                                    <span class="n">new</span> <span class="n">StringEncoder</span><span class="p">(),</span>
                                    <span class="n">new</span> <span class="n">StringDecoder</span><span class="p">(),</span>
                                    <span class="n">new</span> <span class="n">PureJavaCommClientHandler</span><span class="p">()</span>
                            <span class="p">);</span>
                        <span class="p">}</span>
                    <span class="p">});</span>

            <span class="n">ChannelFuture</span> <span class="n">f</span> <span class="o">=</span> <span class="n">b</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">new</span> <span class="n">PureJavaCommDeviceAddress</span><span class="p">(</span><span class="s2">&quot;/dev/ttyS0&quot;</span><span class="p">))</span><span class="o">.</span><span class="n">sync</span><span class="p">();</span>
            <span class="n">f</span><span class="o">.</span><span class="n">channel</span><span class="p">()</span><span class="o">.</span><span class="n">write</span><span class="p">()</span>
            <span class="n">f</span><span class="o">.</span><span class="n">channel</span><span class="p">()</span><span class="o">.</span><span class="n">closeFuture</span><span class="p">()</span><span class="o">.</span><span class="n">sync</span><span class="p">();</span>
        <span class="p">}</span> <span class="k">finally</span> <span class="p">{</span>
            <span class="n">group</span><span class="o">.</span><span class="n">shutdownGracefully</span><span class="p">();</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="n">private</span> <span class="n">PureJavaCommClient</span><span class="p">()</span> <span class="p">{</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
<p>To get up and running and test the code there are two VM&#39;s in the develop branch, master and slave. Start the master with <code>vagrant up</code> and then <code>cd</code> into the slave directory and start the slave with <code>vagrant up</code>. <code>cd</code> to /Vagrant and run <code>mvn exec:java</code> to run the samples. The master and slave VM&#39;s will then exchange messages over a simulated serialport via a host named pipe. The great thing about using Netty to interact with a serial port is that you can easily integrate <a href="https://code.google.com/p/kryo/">Kryo</a>, <a href="http://msgpack.org/">MsgPack</a>, or JSON into your pipeline to handle serialization and pass arbitrary POJOS or commands over a serial port without writing a bunch of one-off parsing logic typically seen when dealing with serial ports.</p>

<p>Fork and enjoy.</p>
]]></content:encoded>
      </item>
  </channel>
</rss>