Thinking in ecto part 2

Queries and Relations Now that we’ve created a basic query, you can perform a search on it using a primary key using Repo.get. user = Repo.get(User, 1) Repo is a genserver process started up in your supervisor tree that manages connections to postgresql. Using Repo methods allows you to send messages to the Repo process which performs the database call and performs the action on your behalf. With a primary key, its easy to perform a basic query using Repo.

Thinking in Ecto - schemas and changesets

Note: I’m basing much of this code paths on the new phoenix 1.3 RC1. I started writing elixir 6 months ago and it’s been pure love. Ecto specifically, makes developing saas applications a real joy. Ecto is the database abstraction layer for elixir and comes baked into phoenix. Unlike an ORM like activerecord or rails, ecto provides a set of macros that expose a dsl layer for operating on your database similar to .

learning rust with blackjack p2

I realize I’ve grown soft relying on garbage collection and rust is a harsh but fair taskmaster. Its been 4 days since I picked up rust and I’m finally starting to get the hang of the borrow checker. Learning rust is a very different experience than learning c++. A tight feedback loop is essential to the learning process. As I continue to build this blackjack, I find that the compiler picks up issues that would lead to segfaults when I learned c.

Learning Rust With Blackjack Part 1

I never got very far with c. I was still a noob at programming and constant segaults with no feedback plagued my path to success. I ultimately moved on to ruby and eventually javascript and elixir. C is honest and close to the metal and systems program has been on my list of things to get back into. My two primary languages these days are javscript and elixir. This leaves my repertoire of skills with a hole in systems programming.

Better living through blockchains - Finance

Most people looking at Etheream see only the altcoin which you can now purchase on coinbase. Its so much more than that. As I mentioned earlier, Bitcoin’s ruleset for registering transactions is a simple stack based instruction set only supporting a transfer of assets. Etheream’s transaction engine, on the other hand, is turing complete. The consequences of this is that transactions into the etheream blockchain can embed computer programs. Etheream consequently can run applictaions on a distributed network.

It takes a little imagination to see the potential of the technology. The main benefit is in removing the need of a centralized trusted arbiter.

Better living through blockchains - Intro

2 years ago, I bought 10 bitcoins at $134 each. A week later they shot up to $240. Naivly I flipped them and made a tidy thousand dollar profit. My initial glee had turned out to be one of my biggest regret as you might guess from the current valuation of $1.2k per bitcoin. Nevertheless, It cemented cryptocurrencies into the horizon of my view.

While Bitcoin gets most of the attention, Its only the tip of the iceburg. More disruptive is the potential enabled by the blockcahin in creating decentralized transaction. Bitcoin’s blockchain is limited in features and is oriented towards cryptocurrency. Etheream takes the ideas introduced by etheream and delivers a quantum leap in functionality.

Auth0 on Phoenix Ueberauth

Previously I covered how to install auth0 on your browser. There are limitations to a client based approach. For one, you are limited strictly to jwt login. Furthermore, you can’t run execute any jobs to be performed on login. If you want to enable cookie sessions or run any sorts of side effect behavior to occur on login, you’re going to need to setup the oauth redirect to go through your phoenix server.

Project Level go environment with direnv

I had a spare weekend to start goin through Writing An Interpreter In Go. I came into it knowing zero go and was running into the this error. warning: GOPATH set to GOROOT (/Users/cultofmetatron/projects/waiig_code_1.3/01/src/monkey) has no effect lexer/lexer.go:3:8: cannot find package "monkey/token" in any of: /Users/cultofmetatron/projects/waiig_code_1.3/01/src/monkey/src/monkey/token (from $GOROOT) ($GOPATH not set. For more details see: 'go help gopath') package ./lexer imports runtime: cannot find package "runtime" in any of: /Users/cultofmetatron/projects/waiig_code_1.

Auth0 on Phoenix - Basic Configuration

Today I’m documenting the process of setting up Auth0 and webpack2 on a newly created Phoenix project

10 reasons you should bet on elixir for your next startup

Everything we touch on a computer is just 1’s and 0’s. Yet, its easy to forget that with all the libraries we have to abstract away the innate complexity of the myriad of protocols that form the backbone of the internet. Elixir itself has really nice built in primatives for dealing with binary streams. Before I go into that, lets cover some background.

Elixir first impressions

Software engineering is a game of tradeoffs. Both for building systems that serve our users with reliability and cost that keeps us in buisness. I’ve delved into learning Elixir as a new toolkit for developing software and experiences with more reliablity and less downtime. Elixir is a langugae that runs on top of the Erlang VM. While still young for a langugae, it has the benefit of leveraging the Erlang platform; a best of breed high performance system developed at Ericson to run cellphone and telecom operations running with minimal downtime.

concurrency by message passing in elixir

In my last post, I talked about Elixir’s core syntax. While I love the brevity and pure functional style favored in elixir, I didn’t even touch on it primary value added proposition. Elixir is really a process oriented programming langauge.

one wierd trick to improving your javascript

As the complexity of the projects I tackle as an engineer have increased over the years. I’ve noticed that while my capacity to understand project scope have increased linearly, The problems that I’ve had to deal with have increased exponentially in difficulty. The human mind can only hold so much complexity at a time. To rise to the needs of being a software engineer in the 21’st century, it takes a healthy dose of humilty to recognize my weaknesses and develop a methodology to handle the complexity. Without further ado, I introduce one of the most powerful axioms you can adopt in your own code. The extra thinking reqiuired might increase the time it takes to write the code. However, that will be more than paid back in the ability to read your own code and debug it later on.

my reaction to reactive extensions

Every javascript programmer is on their own hero’s journey to mastery.

It begins with the basic language. Before you know it, You run into the initially paradoxic behavior of asynchronous programming. Trying to chain diffrent asynchronous functions results in nested callbacks. We all get to a point we’ve written a program and found ourselves entombed in our own Pyramid of Doom.

binary streams in elixr

Everything we touch on a computer is just 1’s and 0’s. Yet, its easy to forget that with all the libraries we have to abstract away the innate complexity of the myriad of protocols that form the backbone of the internet. Elixir itself has really nice built in primatives for dealing with binary streams. Before I go into that, lets cover some background.

the point of promises

You’ve learned the basics of javascript. Hell, I dare say you’ve probably squeezed out a first project. I’m willing to bet that for most of you, the idea of asynchronous code still seems like magic.

True enough, javascript’s event loop model of execution is strange and fantastical when you are first learning it and downright aggravating when you suddenly realize that you have a list of filenames. You need to load them all up and run another function with the contents of each respective file.

Need to do this with two? Easy.