<?xml version="1.0" encoding="UTF-8"?><rss 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" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jack Eisenberg on Medium]]></title>
        <description><![CDATA[Stories by Jack Eisenberg on Medium]]></description>
        <link>https://medium.com/@goshijack?source=rss-dfe1ccc541cc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5f6Q-NL9JTKsPKBGejZmZg.jpeg</url>
            <title>Stories by Jack Eisenberg on Medium</title>
            <link>https://medium.com/@goshijack?source=rss-dfe1ccc541cc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 11:16:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@goshijack/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Elixir made me fall in love with programming again]]></title>
            <link>https://medium.com/@goshijack/elixir-made-me-fall-in-love-with-programming-again-b82820a77928?source=rss-dfe1ccc541cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b82820a77928</guid>
            <dc:creator><![CDATA[Jack Eisenberg]]></dc:creator>
            <pubDate>Sat, 10 Sep 2016 12:19:09 GMT</pubDate>
            <atom:updated>2016-09-10T12:19:09.715Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes I’m sure you’ve heard about the hot new language called <a href="http://elixir-lang.org/">Elixir</a>. If you haven’t, it has a functional, ruby-esque syntax and is built on top of the “bulletproof” erlang VM. Yes, the same VM that <a href="http://learnyousomeerlang.com/what-is-otp">powers telephony</a> and the same VM underlying <a href="http://highscalability.com/blog/2014/2/26/the-whatsapp-architecture-facebook-bought-for-19-billion.html">whatsapp’s ability to ridiculously scale with such few resources</a>. It is an out-of-the-box distributed language, which gives it obvious appeal. But performance aside, there is also something to be said about the way I <em>feel</em> as a developer when I crack open my favorite text editor, turn on my favorite house mix, and jam on some code. Here are a few reasons elixir is making me love programming again:</p><h4>The pipe operator</h4><p>Just in the same way I can use | in a bash script, elixir has a neat little piece of syntactic sugar that does the same — it takes the return argument from the left of the pipe and passes it in as the first argument to the function on the right of the pipe. So, who cares, right? Well, it turns out this is extremely powerful. Take a look at this example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b1122c512e847b7148b04474ee6d61a/href">https://medium.com/media/2b1122c512e847b7148b04474ee6d61a/href</a></iframe><p>vs.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a8f2e65a932d3ad4f246faed01feaeb9/href">https://medium.com/media/a8f2e65a932d3ad4f246faed01feaeb9/href</a></iframe><p>Granted this is a little overboard, but you can begin to see how it cleans up your code. It no longer means reassigning a new variable or pattern match, if you will, every step of the way.</p><p>So, yeah. Once you start using it, it’s almost impossible to stop.</p><h4>Macros</h4><p>I remember talking with a friend, an erlang programmer, a couple of years ago when elixir was first announced. He mentioned how it was awesome to be able to use macros. My thought was “what the hell is a macro?” And even after reading the o’reilly book on erlang, I still didn’t quite see the significance.</p><p>Once I started building my first client web app using Phoenix, however, it became an essential and amazing tool that kept on giving. The best way I can describe macros is that you can write easy, discrete helper modules that can be reused with a simple Use call. It’s a way to write features into the language without actually writing them… into the language. Here’s a small example:</p><p>The best part is, they’re insanely easy to write. It literally takes two lines of code to turn a normal module into a macro.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3fb7389db7467ef43ea7813b2cf2d8b7/href">https://medium.com/media/3fb7389db7467ef43ea7813b2cf2d8b7/href</a></iframe><h3>Pattern matching</h3><p>Holy hell, where has this been all of my life? This has been a wonderfully executed part of the language for several reasons:</p><ul><li>I can tailor my functions to do specific things based on what data structure is being passed in. It allows for both clean readability of function names, and keeps them smaller. Here’s an example of how it works in a web controller, which keeps things restful. Me likey:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a625a0f7f7e258add026c05ef03a964/href">https://medium.com/media/0a625a0f7f7e258add026c05ef03a964/href</a></iframe><ul><li>My code feels like its automatically positioned to catch errors. I’ve noticed this comes in particularly handy when reading/writing to/from a separate service, like a database. Or accepting input from a user. Based on the permutations of the data I receive, I get a clear pathway to how my code is executing. And if you don’t feel like pattern matching <em>every possible case</em> you can just use the _ wildcard.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b65794cdbadbd443ba1847fe81be42fb/href">https://medium.com/media/b65794cdbadbd443ba1847fe81be42fb/href</a></iframe><p>I’m sure there are many other reasons to love the language but as someone who has been a web architect/programmer/sysadmin for just about 8 years, this is the most excited I have been since… Docker.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b82820a77928" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to improve your development workflow with Docker compose files]]></title>
            <link>https://medium.com/nelson-cash/how-to-improve-your-docker-development-workflow-with-docker-compose-files-a75a4d791471?source=rss-dfe1ccc541cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a75a4d791471</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Jack Eisenberg]]></dc:creator>
            <pubDate>Thu, 30 Jun 2016 15:26:33 GMT</pubDate>
            <atom:updated>2016-06-30T15:27:47.146Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cY8fCcNwZBpI-LL626idwQ.png" /></figure><h4>Developing with Docker</h4><p>A lot of developers integrate Docker into their <em>deployment</em> workflow because of the immediate ability to run just about anywhere, with any cloud-hosting provider that supports containers (we happen to be fans of <a href="https://aws.amazon.com/elasticbeanstalk/">Elastic Beanstalk</a> right now). However, when we moved our studio to a Docker <em>development</em> workflow, we had to do a little digging around to find a few tricks to make the transition easier. The result was us leaning heavily on <a href="https://docs.docker.com/compose/">Docker Compose</a>.</p><h4>Getting set up</h4><p>Setting up your local application is pretty straightforward. For a standard web application, you’ll want to use your normal Dockerfile set up. There are several great guides out there for <a href="https://docs.docker.com/compose/rails/">Rails</a>, <a href="https://docs.docker.com/compose/django/">Django</a>, and <a href="http://wiredhorizon.com/deploying-phoenix-app-with-docker/">Phoenix</a>. The important thing is that the Dockerfile is in the application root, i.e.:</p><pre>/controllers<br>/models<br>/views<br>/config<br>Dockerfile</pre><p>Start by building your Docker image with the docker build -t &lt;YOUR TAG NAME&gt; . command. Then run your web app as a container with `docker run -i -t &lt;YOUR TAG NAME&gt;` and any port or env arguments with it.</p><p>A good way to start abstracting all of these extra arguments and commands is to use Docker compose files. At Nelson Cash like to put them all in a folder called docker-compose like this:</p><pre>/controllers<br>/models<br>/views<br>/config<br>/docker-compose<br>Dockerfile</pre><p>Then, in n the docker-compose folder, we can create a dev.yml file that looks something like this:</p><pre>version: &#39;2&#39;<br>services:<br>  example:<br>    image: example_corp/example:baseimage<br>    ports:<br>      - &quot;8000:8000&quot;<br>    environment:<br>      MODE: &#39;dev&#39;<br>      DB_NAME: &#39;admin&#39;<br>    entrypoint:<br>      - /bin/bash<br>      - -c<br>      - &quot;cd /app &amp;&amp; run_my_app.sh&quot;</pre><h4>Auto-reloading on code changes</h4><p>Now that the application is running locally, we thought it would be nice to have the container quickly reflect new application states when the underlying files in the directory change. Otherwise, we’d have to rebuild the image and re-run that container every single timewhich is not fun at all.</p><p>We started by editing our dev.yml file in the docker-compose folder and adding the volumes argument. This will link the source code in our app directory to the source code placed in our Docker container, in this case the app folder (this will depend on the configuration of your Dockerfile).</p><pre>version: &#39;2&#39;<br>services:<br>  example:<br>    image: example_corp/example:baseimage<br>    volumes:<br>      - ..:/app</pre><p>When you start the Docker container with the docker-compose -f docker-compose/dev.yml up, it will always reflect the changes in your local directory.</p><h4>Connecting dependent containers</h4><p>Let’s say our web application also relies on other services, like a postgres database or redis. Rather than running these containers separately, we can include them as services in our compose file with the links argument.</p><pre>links:<br>  - redis:redis</pre><p>The awesome thing about this approach is that now I can access the db or the redis instance using hostname of the alias (redis).</p><p>In the event you need to bootstrap these micro-services in a certain order, you can also use the depends_on argument:</p><pre>depends_on:<br>  - redis</pre><p>Now when you run your docker-compose up command, the redis instance will be started first.</p><h4>Setting up testing environments</h4><p>When we first started using Docker, we had to mess around a bit to get the instance to run in various environments. We also wanted to run our test suite within the Docker container, and any other services such as a database. Ultimately, we wound up with a file structure that looked like this:</p><pre>/docker-compose<br>  dev.yml<br>  test.yml<br>  prod.yml</pre><p>The dev.yml contains the basic scaffold for our docker container. In our test.yml, all we have to do is modify any arguments we want to be overwritten from the dev container. For example, our env variables in test.yml would be:</p><pre>version: &#39;2&#39;<br>services:<br>  example:<br>    environment:<br>      MODE: &#39;test&#39;<br>    entrypoint:<br>      - /bin/bash<br>      - -c<br>      - &quot;py.test -x&quot;</pre><p>We can even modify the entrypoint to overwrite the dev entrypoint. Instead of starting our web server, it will run the tests (in this case py.test).</p><p>To put it all together, we can just change the -f args in docker-compose</p><pre>docker-compose -f dev.yml -f test.yml up</pre><p>This will build the image and run the container according to the parameters in dev.yml, but will overwrite any of those parameters found in test.yml.</p><h4>Just remember, ‘Docker compose is your friend.’</h4><p>There are numerous ways to customize your docker compose files, so we recommend playing around as needed using the docs and other tutorials online. We are extremely excited about Docker in general, and look forward to publishing more as we learn even better ways to use it in our day-to-day operations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a75a4d791471" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nelson-cash/how-to-improve-your-docker-development-workflow-with-docker-compose-files-a75a4d791471">How to improve your development workflow with Docker compose files</a> was originally published in <a href="https://medium.com/nelson-cash">Nelson Cash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Neural networks and the stock market]]></title>
            <link>https://medium.com/nelson-cash/a-quick-dive-into-neural-networks-to-predict-stock-market-prices-kind-of-ec9b2c64d205?source=rss-dfe1ccc541cc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec9b2c64d205</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jack Eisenberg]]></dc:creator>
            <pubDate>Tue, 21 Jun 2016 19:56:00 GMT</pubDate>
            <atom:updated>2016-06-21T20:49:02.847Z</atom:updated>
            <content:encoded><![CDATA[<h4>A quick dive into neural networks to predict stock market prices. (kind of.)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zW61UVzgHIhhptkWQdq05g.png" /></figure><h3>What are neural networks?</h3><p>Neural networks fall under the larger category of machine learning, which is used to power technologies like self-driving cars or image-recognition software. A lot has been written about what neural networks are and how they work, but the material remains complex and confusing. In its most basic sense, neural networks can be thought of as a software simulation of the human brain, where constituent elements called ‘neurons’ pass messages back and forth, again and again, ‘training’ themselves along the way. A great visualization can be found <a href="http://playground.tensorflow.org/#activation">here</a>, and a more detailed explanation <a href="http://neuralnetworksanddeeplearning.com/index.html">here</a>. Here, ‘training’ is like reverse engineering a function out of data. For example, in elementary school you learned that 1 + 1 = 2. Of course, we know what ‘+’ means (addition), but imagine for a second that you had never seen this symbol before. Instead, all you had were a few examples of inputs and outputs on both sides of the equals sign:</p><pre>input = [[1, 1], [1, 2], [2, 1], [2, 2]] <br>outputs = [2, 3, 3, 4]</pre><p>“I put 1 and 1 in and I get 2 out. I put 1 and 2 in and I get 3 out.” (And so on.) Obviously we detect a pattern, but let’s play dumb for a second. What happens if we put 2 and 3 in? We don’t know based on our data because our array of inputs don’t contain [2, 3].</p><p>With neural networks, however, we can make a guess at what the output is when we enter any two numbers (like 2 and 3) by ‘training’ our function. As the Tensorflow playground suggests, ‘training’ a program consists of being “asked to solve a problem, which [the network] attempts to do over and over, each time strengthening the connections that lead to success and diminishing those that lead to failure.” This is why it’s important to have a large dataset. In theory, the more data you have to train on, the more accurate your network will be at predicting the outcome.</p><p>In our example, we are going to use an <a href="http://github.com/fxsjy/gonn">open source neural network library</a> written in Go. (A note for serious traders: this is a <em>very</em> high level take on neural networks, and meant to be a primer on their use cases more than anything. Predicting the stock market takes an obscene amount of time and money, and is damn near impossible).</p><p>For the example above, we can set up our code like so:</p><pre>package main <br>import ( “github.com/fxsjy/gonn/gonn” ) <br>// setting up our inputs and targets <br>var ( <br>  inputs [][]float64 <br>  targets [][]float64 <br>) </pre><pre>func main() { <br>// lets create a new default neural network <br>// the first arg is the number of inputs <br>// the second arg is the number of hidden layers <br>// the third arg is the outputcount <br>// fourth arg will change some of the internal math, we’ll leave to true for now <br>nn := gonn.DefaultNetwork(2,3,1,true) // our input data set <br>nnInputs := [][]float64{ []float64{1, 1} []float64{1, 2} []float64{2, 1} []float64{2, 2} } // our output data set <br>nnTargets := [][]float64{ []float64{2} []float64{3} []float64{3} []float64{4} } <br>// lets train our data with 1000 iterations nn.Train(nnInputs, nnTargets, 1000) }</pre><p>With our network set up and trained, we can now input two numbers and get an expected outcome as the prediction.</p><pre>nn.Train(nnInputs, nnTargets, 1000) fmt.Println(nn.Forward([]float{2, 3})</pre><p>Running this program, we get:</p><pre>[4.610611045671515]</pre><h3>Applying Neural Networks to the Stock Market</h3><p>Assuming we can reverse engineer functions using neural networks, we thought it would be fun to try and predict the stock price of a company in the future based on its recent price movements.</p><h4>Getting your data</h4><p>Let’s get started. First we’ll create a project and set up our datasource, in this case from a postgres database. We will be using data fed from a stock ticker streaming application (<a href="https://www.tradeking.com/">Tradeking</a>).</p><pre>package main <br>import ( <br>  “github.com/fxsjy/gonn/gonn” <br>) <br>func main() { // lets say we want to get our data from a postgres    database <br>  DB, err := gorm.Open(“postgres”, “user=USER dbname=DBNAME password=PW sslmode=disable port=5432”) <br>  if err != nil { panic(err) } <br>}</pre><p>With our database connected, we will now structure our data so that it fits with our needs. Assuming this matches the fields in our database, we’ll create a Trade struct for loading and processing our data.</p><pre>type Trade struct { <br>  StockId int `gorm:”column:stock_id”` <br>  Symbol string `gorm:”column:symbol”` <br>  VWap float64 `gorm:”column:vwap”` <br>  Last float64 `gorm:”column:last”` <br>  InsertedAt time.Time `gorm:”column:inserted_at”` <br>  UpdatedAt time.Time `gorm:”column:updated_at”` <br>}</pre><p>Next, let’s load our data with a simple query, grabbing a ticker of a personal favorite of mine, ‘LABU’, a leveraged biotech ETF from Direxion. Because it’s leveraged 3x, the inter and intraday swings tend to be a lot greater.</p><pre>var trades []Trade<br>  DB.Raw(&quot;SELECT vwap, last, inserted_at FROM trades WHERE symbol = ? AND inserted_at IS NOT null ORDER BY inserted_at LIMIT 50000&quot;, &quot;LABU&quot;).Scan(&amp;trades)</pre><h3>Designing our Algorithm</h3><p>For simplicity’s sake, let’s assume we want to try and guess the relationship between stock price and time (lol). Our input array will then want to include two variables, price and time. Let’s do a little cleanup of the trades and dump them into a two-dimensional slice for the input data.</p><pre>nnInputs := make([][]float64, 0)<br>  for _, trade := range trades {<br>    timeToFloat64 := float64(trade.InsertedAt.Unix())<br>    nnInputs := append(nnInputs, []float64{time.Last, timeToFloat64})<br>  }</pre><p>Now we’ll need to get our array of our ‘targets.’ The target will be a one-dimensional slice, where the index of each element in the slice corresponds to the index of the inputs in the nnInput slice. In our example, we will grab the price at a time in the future at an arbitrary date. Rather than calculate the difference in terms of time.Duration, we will just grab the trade value that is forward in the array by 100:</p><pre>nnTargets := make([][]float64, 0)<br>  for i, trade := range trades {<br>    if val, ok := trades[i+100]; ok {<br>      nnTargets = append(nnTargets, val)<br>    }<br>  }</pre><h3>Training the neural network</h3><p>Ok, so this is extremely primitive, but let’s give it a shot and train our neural network:</p><pre>nn.Train(nnInputs, nnTargets, 1000)</pre><p>And then let’s backtest by plugging the inputs into the neural network, and checking against the actual target values:</p><pre>for i, p := range nnInputs {<br>    fmt.Println(&quot;forward&quot;, nn.Forward(p))<br>    fmt.Println(&quot;target&quot;, nnTargets[i])<br>  }</pre><p>As you can probably imagine, this doesn’t work too well. Simply putting in a dataset of stock price over time does not help predict where that stock will be in the future.</p><h3>Where do we go from here?</h3><p>Now that the groundwork has been laid for our neural network, there are a few different ways to take this. One is to break the prices into arbitrary blocks of time (each minute, for example), calculate the slope using linear regression, and use those as inputs. Another idea is to take the number of upticks and downticks in that block of time and weight that block as an up or downtrend. From there, you can predict the price accordingly, or you could incorporate other components of the price like 50MA, RSI, VWap, etc. The sky’s the limit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec9b2c64d205" width="1" height="1" alt=""><hr><p><a href="https://medium.com/nelson-cash/a-quick-dive-into-neural-networks-to-predict-stock-market-prices-kind-of-ec9b2c64d205">Neural networks and the stock market</a> was originally published in <a href="https://medium.com/nelson-cash">Nelson Cash</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>