{code that works}

by Sadique Ali

Flushing Metrics in Dropwizard Commands

Posted on Fri, Aug 2, 2019

Users of Dropwizard Metrics will be familiar with ScheduledReporter - it is a nice pattern that allows metrics reporting to be off loaded to a different thread which periodically sends out the collected metrics instead of making a network call every time a metric is collected. In most use cases, this works great - especially if you are running a server.

Managing environment lifecycles for Dropwizard Commands

Posted on Sun, Jul 28, 2019

If you have built background workers or other non-server applications with Dropwizard, chances are that you used the Dropwizard Command pattern. In fact, even the sever you wrote with Dropwizard executes a command - specifically io.dropwizard.cli.ServerCommand. While the server command is great, sometimes you want to build applications that have all the goodies that Dropwizard offers, but you dont want to start a server. Managing Lifecycles is one example of a Dropwizard feature that works great for server applications, but needs some tweaking to get working for non-server commands.

Looking up Enum types and values in Postgres

Posted on Thu, May 9, 2019

In this blog post, we will explore how Postgres stores Enum types and how to query for Enum types and their values. Postgres’ Enum, like their counterparts in many programming languags are data types that allow only a predefined set of values to be assigned to them. An interesting difference is that compared to programming languages, Postgres does allow blanks within the values of Enums.

Viewing Sequence ownership information in Postgres

Posted on Tue, May 7, 2019

This blog post is an exercise in identifying all the sequences in a PostgreSQL database that is associated with a table column via an OWNED BY relationship. Figuring out how to do this was harder than it should have been and this journals my understanding of it.

Understanding trailing @ processing in SAS input

Posted on Sat, Mar 23, 2019

One of the first things I noticed when I started poking around in SAS code is that the input statement is very powerful, flexible and hence sometimes hard to understand. It can read pretty much anything in to a dataset as long as you tell it what to do. The use of trailing @s to take control of how SAS advances the input pointer is a powerful technique to read from input files where the data is laid out in non-standard formats.

Importing the SASUSER datasets in SAS Studio

Posted on Sat, Mar 23, 2019

I have been playing around with SAS for the last two weeks. I started with a SAS University Edition running on a VirtualBox instance on my MacBook, but soon realized that it was way more convenient to use a SAS OnDemand account. Having made the switch, I realized that all learning materials made references to and used examples with datsets from a library named SASUSER. It was not clear how to get these datasets and use them in SAS Studio.

My talk at GraphQL Summit 2018

Posted on Sat, Nov 10, 2018

I had the opportunity to give a talk at GraphQL Summit 2018 about the experience of introducing GraphQL for our Payments API at Braintree. It was well received, as far as I could tell - I received a lot of nice feedback and had great conversations with members of the community. The slides are available here on SpeakerDeck. I will update this post with links to the video of my talk when it becomes available The video of the talk is available here.

Formatting Java Instant for resolutions

Posted on Sat, Jun 9, 2018

I have had to look up how to format Java’s Instant with a given resolution - for example in microseconds or nanoseconds. After fiddling with various formatters, I was happy to finally get this right.

FreeBuilder plugin for IntelliJ

Posted on Sat, May 5, 2018

My work uses FreeBuilder extensively to generate the Builder pattern for Java classes. In addition to this, we use the generated Builder classes to deserialize the data calsses using Jackson. After a while it became tiresome to type @FreeBuilder and class Builder extends ... everywhere. So I decided to write and IntelliJ IDEA plugin that does it for me.

Command line clients for gRPC - polyglot

Posted on Fri, Apr 6, 2018

Polyglot was the second gRPC client that I looked at. One of the things that I liked about it is the fact that it does not need users to generate protoset files. It generates the protoset files in flight every time it runs. This, combined with the fact that it is written in Java does have a disadvantage - every time the client makes a call, it has to fire up a JVM, generate protosets and make the request.