Graph Databases + Neo4j

I’m giving a talk tonight about graph databases at AustinRB to talk about one graph database, Neo4j.

This is also the first half of my talk for ElixirConf, so you can think of it as a sneak peek! ūüėé

 

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!

ElixirConf 2017

I’ll be speaking at ElixirConf this year! ¬†My talk is about using Neo4j in an Elixir project. ¬†I’m super excited (and a lil bit nervous!) to be going from speaking at local meetups to national conferences.

 

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

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.

Chromebook OpenVPN

I recently got a new job and had the pleasure/torture of being assigned a Chromebook and needing to get it onto the VPN. This is easy on a Mac, which everybody else has, but since the ChromeOS is so lightweight, it was more challenging. I eventually got it to work though, so here are my directions!

If you don’t already, you’ll need some text editor (not Google Docs) and I had good luck with Caret¬†and you’ll need some sort of sftp system¬†and a shell. ¬†I also recommend using developer mode for the Chromebook, as it makes for a lot less hassle long term. ¬†You can also dual boot into linux, but I don’t do that as ChromeOS in developer mode has been enough for me to be pretty happy!

Network

First, have a read on Errietta’s blog¬†and get an idea on how this will work. ¬†I tried her directions and they weren’t entirely sufficient, but I got 90% there.
First go into your OpenVPN directory and build a key:
./build-key client1my

which will build a key and a certificate (.key and .crt) but they will be generated in the directory that the file vars specifies. I had to run:

openssl pkcs12 -export -in client1.crt -inkey client1.key -certfile ca.crt -name MyClient -out client.p12

Go into your openvpn/ccd directory and copy the most recent file . Don’t forget to increment both IPs in the file by 1 (so you don’t have conflicts later on!)

You should now have a client.p12 file.  Share this with the Chromebook in Google Docs.

 

On the Chromebook

Navigate to chrome://settings/certificates (in the browser) and in the Authorities tab, click ‘Import’ and select the ca.crt file (in the ‘shared with you’ section of Google Docs!) ¬†You will be asked if you want to trust the ca, click on ‘trust this certificate for identifying websites’ and leave the rest blank.

Now navigate to chrome://settings/certificates and click on “your certificates” and then “import and bind to device” (NOTE: NOT JUST IMPORT, IT MUST BE IMPORT AND BIND TO DEVICE) and select the .p12 file from earlier. ¬†You should see your (hardware-backed) by the certificate name.

ONC File

First, make your .onc file, as can be seen here:¬†https://github.com/syedaali/configs/blob/master/openvpn-sample.onc¬†and you will need to upload it. ¬†In a browser tab, open chrome://net-internals and along the left side of the page, click on “ChromeOS” then click on the “choose file” button in the line “Import ONC File”

DO NOT PANIC IF NOTHING HAPPENS!  (I panicked and it was unnecessary!)

After a few short moments, the name you gave your network name should appear in the OpenVPN/L2TP screen (click on the wifi icon near your profile icon in the lower right corner of the Chromebook screen, click on VPN, and the file with your name on it should appear there!)

Fill in your password and leave OTC and group name blank.

 

Congrats, you’re all done!