Notes from Codestock 2018

I was pleasantly surprised by Paige Bailey’s opening keynote.

A talk on “Thinking in Sets”  got me thinking about how make ruby and mongo work faster.  Found this on stack overflow, will keep looking:

good advice in a comment on that SO thread:

`Always avoid iteration if possible, avoid using ‘all’ which loads every record into RAM at once, and since update_attributes already does a save automatically, the additional call to save! will make the entire operation take twice as long.`

Also attended a talk on Elm by Jeremy Fairbank

Missed this one by tyler Jennings  But I did get to learn some new tricks to make my JavaScript cleaner.

Goals for 2018

While I have time on the new year’s holiday I figured I’d share my goals for 2018.

Goals for coding/tech:

Set up a personal RSS feed and get away from social media. I remain interested in exploring and learning about data mining and the facebook/twitter api, but facebook has become a net timesuck for me, and I never really mastered the art of conversation in 140 characters or less. 280 characters is not much better. Somewhat inspired by this post on metafilter  but also by a yearning for the old days of the web, and the feeling that our current tech economy is becoming a panopticon.

On the other hand, I really do want to learn about data mining and social media apis. I picked up a couple books on this last year but only got ankle deep.

I want to build a blockchain just to say I did.

Learn React. It looks like the framework to learn in 2018. I poked around with it a couple years ago but couldn’t quite get the hang. With a little more web dev experience under my belt I’ll be giving it another try.

Get better at JavaScript. I can write make it do stuff but I’d like to gain some more advanced skills and a better understanding of Object Oriented and Functional JavaScript.

Build at least one app in another common back end language. C# and PHP seem to be the best options for employment where I live.

Learn Elixir – I dipped my toes into this a bit before the holidays and really enjoyed it. Hoping it might be one of the next big things.

System Tools to Debug Rails

Want to share this amazing link.  Was having an issue yesterday with a silent failure of a rails app- no error message, no server logs.  The browser just kept waiting for a response from the app.  I suspect the issue had something to do with a gem, and a bundle update fixed the issue.  But while I was looking for resources, I found this:  Debugging Rails with Operating System Tools.

Deconstructing the qbo_api gem

I recently built a CSV parser and Quickbooks importer using the qbo_api gem.  The documentation for the gem was not easy for me to understand, but I was able to hack the functionality I needed into the sample Sinatra app that’s provided with the gem.

I now want to create another Quickbooks import tool and use it with a rails app that I’ve already built.  The trouble is figuring out how to set up a rails app to use the qbo_api gem.  There are no explicit instructions on how to do this in the gem’s documentation.

After a few hours of hacking around last night with a buddy, I have a slightly better understanding of what’s going on under the hood with the gem.

Looking at the example app provided with the gem, you can see from the require statements that there are a few other gems required:  omniauth and omniauth-quickbooks.  Omniauth-quickbooks is a strategy for omniauth to connect to quickbooks, specifically.

Lines 19-21 of the example app tell Sinatra to use the omniauth-quickbooks strategy, with tokens that are stored in the .env file.  Lines 31 – 36 set up the index page of the app, where you connect to quickbooks:

qbo-apiQboApi::APP_CENTER_BASE is a url where some Quickbooks JavaScript is hosted:  ““.  This is used in a script src tag on index.erb which loads the Quickbooks javascript library for connecting the api.  oauth_data is a method that returns a hash with oauth tokens.


In the hash, consumer_key and consumer_secret are constants, pulled from the .env file when the app loads.  But the token, token_secret, and realm_id are pulled from the session.  When the index page is first loaded, these haven’t been saved to the session yet.

The assignment to the session happens in the last route, starting at line 64:

get authThis method is called from index.erb, which is mainly two javascripts, explained here.

I haven’t yet figured out what env[“omniauth.auth”][:credentials] are, but I assume it is created by the omniauth gem and holds the tokens returned from Quickbooks when you connect.

Water Monitoring Database

I built a Rails App that could be used by environmental groups to monitor water quality.  It uses the Google Maps API.  Users can create locations by entering GPS coordinates, or by clicking on a map.  Clicking a location on the map automatically enters the GPS coordinates into the form.  It also has different custom map icons depending on the type of location.


This project took about 8 hours all told.  It uses Devise for authentication and Bootstrap for the layout.  Feel free to check out the public version on heroku.  You will need to create an account in order to add locations.

Using JavaScript in Rails

I’ve been busy the past few months with a contracting gig, so my blogging has suffered. I’ve learned a lot, especially about using JavaScript and Ajax in a rails app. I’m just going to leave this link here for now:  Rails with no JS Framework.

I’m currently seeing no point in using a JavaScript framework on top of a Rails app, with all the functionality that’s built into Rails.  Of course my opinion on that might change over time.

Installing Linux Mint on VirtualBox, on a Windows 10 Laptop

So last month my trusty old Windows 7 laptop (which I grabbed at a great price right when Windows 8 was getting pushed out) died, or at least the monitor did.  My life situation was a little hectic and I needed a laptop fast.  So I rushed out and bought a new one.

I’ve still been using the old laptop for rails development, dual booting Ubuntu, just plugged into a monitor. Meanwhile I’ve been trying to set up Virtual Box to run linux on the new laptop, with a good deal of trouble.

I was finally able to get Linux Mint running, after several hours spread out over a month.  It turns out that I had to follow these instructions to allow any virtual machine to run.  Once that was done, installation was relatively straightforward.

I’ve been struggling with VirtualBox ever since I started learning rails.  I’m excited to start playing around with it now!

React with Rails

I’ve been interested in putting a javascript framework on the front end of a rails app for a while now.  After working through this tutorial, React seemed like the obvious choice.

It’s simple and clean.  With the react-rails gem installed, all you have to do is write some javascript or coffeescript.  No erb, no handlebars, just javascript.  So simple!

I added a view with some basic add, edit and delete actions to the rails app I built for work.  The main problem is that there are none of the rails view helpers, so I am having a problem with figuring out how to implement a select box in coffeescript, and how to deal with associations, so this new view is not ready for production but I hope to get it going soon.

Learning C the Hard Way

I’ve been kind of scattershot in my learning lately.  I’ve been unsure as to what direction I should go.  I’ve dabbled in Angular and Meteor.  I tried a C++ course through Coursera and downloaded Visual Studio but I was turned off by the massive download and new environment.

I went to Meteor Spacecamp this weekend.  I’ve been working on new features for the app I built for work.  I’ve been thinking through a new app for work and made a couple of tries at that.  I’ve also been trying to deploy an existing app as a volunteer project.  That one’s hard.

As far as learning goes, I’ve decided to settle on learning C for now.  I know it’s a language that will be replaced by Rust or some other language and there’s no real reason to write code in it, but it seems like a good opportunity to get a deeper understanding of how code works in general.  Ruby is written in C.  So is PHP.

So I’ve started Zed Shaw’s Learn C the Hard Way, and I’m really liking it!  I’m up to chapter 15 on pointers.  I plan on completing this before I move on to something else.