Posts
Periodic Tasks in Elixir, Conclusion
Following on from the last post, I needed a way to kick off the task of periodically checking for new entries in Redis and adding them to Postgres.
Scheduling tasks There are quite a few libraries to do this. There are also Tasks and Agents. None of these really seem to suit my problem definition.
I don’t need state other than the initial interval and the Redis key, so there’s no need for an Agent.
Posts
Periodic Tasks in Elixir
Tonight, I’ll attempt to set up a Task that runs on some schedule and have it populate the Postgres database.
Quick background I built myself a link-saving site in Ruby, using Sinatra and fully backed by Redis. The site runs fine and I have a tonne of content saved. Amusingly for me, this content mirrors my career progression from the time I built the site until now. In spirit of learning Elixir, I’m rebuilding the site with it and backed by Postgres.
Posts
Deploying Elixir to Digital Ocean
Deploying an Elixir/Phoenix app to Digital Ocean This is a quick post on some gotchas I ran into as I was trying to deploy to my DO droplet. At the bottom of the post are the Dockerfile and the build shell script I’m using, courtesy of Distillery’s documentation, with some modifications.
Releases and architectures To be fair, there are probably easier ways to get an Elixir app running. I could’ve pulled the code from Github and built on the same VM, much like any Ruby app.
Posts
Game of Life in Elixir and OTP
I’m back! During my time away from the blog, I’ve been working hard and (half-)taking various Coursera and EdX courses. The latest one is the inspiration for this blog post.
The course wants me to use Scala and Kompics (course facilitators’ distributed framework thing). I really don’t have an interest in Scala, and I’m auditing the course so I can’t submit work anyway. I thought it’d be interesting to use Elixir and OTP to solve the problems.
Posts
Implementing a queue using an array
Up tonight, I’m going to write a queue implementation using a vector in Clojure and a fixed-size array in Go. The reason for the latter is that the Data Structures course on Coursera shows an interesting way of making a queue work when the backing data structure is of fixed size.
Essentially, what I will do is implement a circular buffer. As items are popped off the front of the queue to be worked on, I’ll have two pointers that will wrap around to the beginning of the array as needed.
Posts
Stacks and queues part 2
Following on from the last post, tonight I am going to try and implement the stack using a linked list instead of an array.
Short background As explained in the course, a linked list might be preferred over an array, because in languages like C, an array has to be of fixed size. Adding a one more element to a full stack will cause an overflow error at best and overwrite random memory addresses at worst.
Posts
Stacks and queues, part 1
I’m auditing the Data Structures course on Coursera. Auditing means I’m taking it for free and not paying them like they want me to. This also means I can’t submit solutions to quizzes. Instead, I will try to write things up here as I learn them.
First up, I’d like to attempt to implement a stack in Clojure and Ruby using an array as the base data structure.
Stack using an list in Clojure and an array in Ruby A stack is known as a Last In, First Out data structure.
Posts
Posting links to Facebook
Tonight, I’ll be doing something slightly different and actually, possibly relevant to my day job. I’m going to take the links I have saved and post them on my Facebook account. Using Clojure and ReactJS! It may be an interesting exploration into interfacing with Facebook or it may not. I have no clue and isn’t that lack of knowledge what makes the life worth living?
Let’s go I’m guessing I can post straight from Javascript, but I’d like to track how links I share will be received.
Posts
Deletion on server-side
Previously, I wrote about how to delete a link from the list of links client-side in the new ReactJS version of my bookmarking app. Tonight, I will finish off that feature by enabling the deletion on the server.
First, a confession It took me nearly a month to write the follow-up post for a few reasons, but the chief problem was this piece of code:
(defn destroy-link [request] (let [id (get-in request [:path-params :id])] (reset!
Posts
Deletion using ReactJS
Tonight, I will start on enabling deletion of links in my ReactJS single-page app. It should be straightforward, but with new tech, you just never know.
Client-side first On the client-side, I need add a small form that will submit the DELETE request to the server using the given ID. The most logical place for the markup is on the component, but I suspect that I’ll need to pass the event up to the root component in order to keep the one-way data flow and easy re-rendering.