Quick Fix to Bolt Sips

Bolt sips, a Neo4j driver for Elixir, works really well except I couldn’t get the stupid localhost port to get established. RAGE.

via GIPHY

So instead of the steps outlined in the README, I did the following (thanks Luke! 😘 )

iex(1)> {:ok, pid} = Bolt.Sips.start_link(Application.get_env(:bolt_sips, Bolt))
iex(2)> conn = Bolt.Sips.conn

And it worked like a charm!

Model-View-Controller

In modern web and mobile development there’s a concept of Model-View-Controller (MVC) which is simply a design pattern in which every instance belongs to one of three layers -> Model Layer, View Layer, or Controller Layer.  Layer is just a fancy term for objects that fulfill a role.

  • Model Layer
    • holds data
    • has no info about User Interface (UI)
    • called things like you would call them IRL
      • For Crapper Keeper I had models for:
        • Users
        • Containers
        • Items
  • View Layer
    • UI primarily
      • things users can see
    • Things they can interact with go here
      • buttons, text fields, etc.
    • Sends message to controller
  • Controller Layer
    • Management for the app
      • configure the views that the users can see and when they can see it
      • the directions for how the app should work/flow
    • Takes data from model objects that its views want information on
    • Updates model objects
    • Updates view with changes in model objects

Models do not interact directly with views – the controller layer does all of the talking between these layers, receiving and dispatching requests.

 

Drop/Create/Migrate Postgres Database On Heroku

I’m ALWAYS forgetting how to reset the postgres database on Heroku, because the typical rake db:drop/create/migrate won’t work on the Heroku command line. This is 99% for my own future reference, but to reset the database on Heroku:

  1.  heroku pg:reset
    •  it will ask you to type in your heroku url, follow the directions and do so!
  2.  heroku run rake db:migrate
    •  this may take a little while!

Easy breezy, I just always forget it!

Ruby’s Method Lookup

In many programming languages you are able to lookup methods without much trouble – just start at the receiver and work up the chain until you find the method you want.  However, in Ruby, you are able to mix in modules and singleton classes, so it gets weird fast.

There are just a few steps on how Ruby looks up methods:

  1.  Look within singleton class
    • A singleton method is a method that is defined on a instance vs. to a class where the method would be available on all instances
  2.  Look within modules that extend singleton classes
    • If you can’t find the method on the singleton class, look at modules that extend the singleton class
    • If there are multiple extend modules, the later modules are more important and take precedence
  3.  Look within methods prepended to the method and methods defined on a class
  4.  Look within modules that were mixed in when class was defined
  5.  Look up the ancestor chain
  6.  Start again checking method_missing

Open Government

This was an assignment for class, Open Source Software.  

I’ll be summarizing “How the Internet will (one day) transform government” by Clay Shirky

https://www.ted.com/talks/clay_shirky_how_the_internet_will_one_day_transform_government

The main point that Shirky was making is that communication has fundamentally changed and our government should reflect that.  Open government, as it works today, is only open one way, with information going from government to constituents.  The open source model, by contrast, allows information to go both ways, from government to constituents and people to the government.  The ability for people to directly communicate with their government and with other people makes the communication two way, allowing more access for everyone involved.  

 

I have some experience with communicating with my government.  I call my senator, Ted Cruz, on a near-weekly basis, usually telling his staffers that I appreciate their work but I disagreed or agreed with some platforms or positions.  I’m kind to the staffers and tell them what I think, but they usually say very little about the Senator’s positions.  I would love to be able to have Ted Cruz, or more likely his staffers, to answer me directly.  Our communication is me calling them and they noting the call but otherwise not saying much.  The only direct communication I’ve received has been in the form of a Christmas card.  Government can and should do better to communicate directly with us, the people.  

 

I do not, however, want us to get to a government transparency as seen in the book, The Circle.  There, government officials wear a camera that shows all of their meetings and all of their conversations for anyone to see.  That’s a level of transparency that leads to privacy issues for all involved, which is a separate conversation!  

Learning AngularJS

I’ve been learning more front end development as I don’t feel that I actually know enough to call myself ‘full-stack’.  I know HTML/CSS pretty solidly and vanilla Javascript, but the frameworks have always been vaguely mysterious.  I am working though Code School to learn Angular and lucky for me, it’s set up a lot like Ruby on Rails.  Putting so much stuff in the HTML tags feels a lot like Bootstrap.

I’m also working on 100 days of code, but have already fallen off.  Coding while sick is a dangerous thing to do, folks.