Background At work, we’ve been focusing on building components that are reusable and more flexible throughout our application. Because of this, we’ve been focusing on making components more composable. To really drive that point home, I gave a small presentation using an awesome library called Code Hike. If you haven’t seen Code Hike before, you should definitely stop right here and at least give Rodrigo Pombo’s (the author of Code Hike) amazing article on Build Your Own React a quick look....
Advent of Code: Day 1
I’ve heard about Advent of Code before, but I never looked into it. After an urge for some programming and no real direction for a side project, I decided I’d try my hand at Advent of Code. To make a hard task even harder, I decided I’d try to solve the problems in Haskell. Problem Essentially, Day 1 of AoC boiled down into parsing an input file of integers and finding two things:...
2019 New Year Resolutions
First of all, I know I’m a little late to this, but I’ve had these resolutions for a while. I just feel like documenting them and putting them somewhere will hopefully make me more accountable. In addition to posting them somewhere to increase accountability, I need to revise some of these goals so that they’re more specific and measurable. I’d like to review myself each month to keep track of my progress....
Elisper: Lisp In Elixir
I recently read a really interesting and great blog post titled Lisp in your Language by Dan Prince. The article walked through an implementation of a subset of Lisp. After reading the post, I thought it was a great project to not only have a deeper understanding of Lisp but also of the language that the implementation is in. In fact, I was so inspired by the post, I decided that maybe I’d give it a shot to write it in Elixir....
2015 Resolutions - One Month Review
Wow! I can’t believe it’s February already! As I stated in my New Year Resolutions post, I wrote down my resolutions so that I could be held accountable for them. Reviewing my resolutions after a year seemed like I would easily lose touch/sight of them. I decided a good idea would be to review my progress month-by-month, so here it goes: Read more (and not programming/technical books) I believe I’ve been doing a good job of this!...
Book Review: Ready Player One
With keeping up on my new year resolutions, the first book of 2015 that I decided to read was Ready Player One by Ernest Cline. I found the book browsing through Barnes and Nobles and realized it was surprisingly cheap on the Google Play Bookstore (sorry local Barnes and Nobles, have to justify my Nexus 7 purchase somehow). I have to say that I hope the rest of the books I read this year are this good....
2015 New Year Resolutions
Well I hope I’m not too late to get my new year resolutions in. I’ve been thinking about this post for a while, but was only finally inspired after my last cup of coffee of 2014. In fact, this day included a lot of lasts. The last swim of the year, the last time I’d visit my brother in 2014, the last time I’d accidentally cut myself in 2014 (I hope), the last....
25 years, 5 months, and 14 days
Today I am 25 years, 5 months, and 14 days old, the exact same age my brother was when he passed away. This day has been on my mind everyday for the past year. I’ve spent long car rides, sleepness nights, and countless laps swimming thinking about today, asking my self what should I do, what should I say. After wrestling with my thoughts, I thought it may be best to write out my thoughts and reflect....
Play! Framework -- Parsing JSON
tl;dr I suggest using ObjectMapper found in the com.fasterxml.jackson.databind.ObjectMapper ObjectMapper mapper = new ObjectMapper(); try { JsonNode root = request().body().asJson(); JsonNode jsonPhoneNumbers = root.get("phoneNumbers"); for(JsonNode phoneNumberString : jsonPhoneNumbers) { String phoneNumber = phoneNumberString.asText(); } catch (NullPointerException npe) { // No valid phone numbers were provided } Using ObjectMapper For parsing arrays in JSON requests, I suggest using the ObjectMapper. Assuming you have a request that looks like: { "phoneNumbers": [ "555-555-5555", "555-555-5556", "555-555-5557" ] } We can easily access the phone number values by using ObjectMapper class....
Play! Framework -- Returning JSON Responses
I’ve recently started a project at working using the Play Framework and while its a great framework, I was having a lot of trouble with some of the simplest tasks. I wouldn’t blame Play for my problems, returning to Java after a long hiatus, being spoiled by dynamicly typed languages, and lack of documentation really made such tasks like returning a JSON response difficult. I figured that I may not be the only in this position, judging by the questions in the IRC channel and lack of responses, I figured it may be a good idea to jot down some of my notes, not only for myself, my coworkers, but for all my fellow Play framework noobs....