What is GraphQL?

GraphQL is a data query and manipulation language that was created by Facebook in 2012. It’s often hyped as a replacement for REST. It’s not. Really, it’s more of a web-friendly SQL.

The essence of a GraphQL request is super-simple. You send a post request with a query in the body and the GraphQL server responds with the the results of your query as JSON. There are a few things that can trip you up, but once you are aware of them, you can easily make GraphQL calls without using any special frameworks.

Example GraphQL Request/Response

Phase 1 — Prepare your images and localized annotations

Step 1 — Make your images publicly accessible

FathomNet expects that your images are hosted on a public web server.

Step 2 — Add localizations using your favorite annotation tool

There are a number of tools that are popular in the marine science community for annotating images and/or video. Keep in mind that FathomNet uses rectangular localizations, also called bounding boxes, that define a region of interest for an annotation. If you are defining other types of regions of interest (ROI), such as points, free-form polygons, or pixel masks, those will need to be converted to rectangular ROI’s when submitting your data to FathomNet.

Step 3— Format your localizations as a CSV file

Below is an example CSV file showing the minimum required columns. …

Pascal VOC is an XML format used for defining rectangular regions of interest in images. Created for the Visual Object Challenge (VOC), it’s commonly used in machine learning communities as an interchange format for detection labels on images. Here’s an example VOC file:

It’s quick and easy to parse this using Scala. Recent versions of Scala do not ship with an XML parsing library, so be sure to include it in your project with these sbt coordinates:

"org.scala-lang.modules" %% "scala-xml" % "1.3.0"

Note that it’s possible to put other fields into a VOC file but, in general, the most…

Photo by Tejasvi Ganjoo on Unsplash

Circe is a Scala library for decoding (reading) and encoding (writing) JSON. I’m a big fan of it’s simplicity, flexibility, and conciseness. This guide walks through a simple use case that illustrates Circe’s basic usage, creating a custom encoder and decoder, and common gotchas.

Below, I’ve created a simple JSON schema. The schema is composed of catalogs, which are named grouping of files, and blobs, which are composed of a URL pointer to a file and its checksum. Every object will have a UUID to uniquely identify it.

JSON Data Model

An example JSON object is below:

Scala Data Model

Circe can model JSON using…

Nerd Cave. Copyright Brian Schlining 2020

Security is imperative when writing web apps; but security and authentication are hard to do right. When developing client/server applications, I want to take advantage of solutions that are written by teams that really know how to do security well. For a recent project, I used the combination of Firebase for user authentication and JWT for securing the server-side APIs.

In this article, the server is a REST API written in Micronaut. All authentication and security is done using bearer tokens. The security flow is simple:

  1. A web or mobile app authenticates a user against Firebase and retrieves an id…

Java has about a googol available libraries for your software enjoyment. Most of them deployed to Maven repositories. If want a fast way to try them out, you can quickly…

Photo by Shahadat Rahman on Unsplash

Scripting is the art of creating a small, simple program to execute some task. Probably the most common examples are the bash scripts used to launch a program on macOS or Linux. If you find yourself typing the same set of commands over and over to accomplish a task, you may decide to wrap those in a simple script to save the tedious typing and mental real-estate needed to hold the sequence and syntax of the commands in your head. …

From https://cibotech.github.io/evilplot/plots.html

Jupyter notebooks are becoming a popular tool in data scientist’s toolboxes. As a free, open-source, interactive web notebook, researchers can combine software, explanatory text, and computational results in a single easy-to-follow document. Their interactive nature allows for users to execute code, quickly see the resulting output, and iteratively modify the notebook. This creates a living document allowing researchers to have an exploratory “conversation” with their data.

While Python is the default programming language used in Jupyter, Jupyter’s architecture supports back-end “kernels”, with different kernels providing support for additional programming languages. …

Photo by Scott Webb on Unsplash

In the Beginning

Once upon a time, I needed to call a microservice that could return a lot of data. So much data, that the request would often timeout. The usual solution to this is to request smaller chunks of data, also called pages. A page request takes two parameters, often called limit and offset. Limit is the number of items to be returned. Offset is the number of items to be skipped before beginning to return items

This being programming, solving one problem creates others. In my case, two problems appeared. First, this being the internet, an occasional page request would fail…

I recently purchased the book Classic Computer Science Problems in Python to help me brush up on my python. As I’m working through the Python code in the book, I’m taking some time to also port the Python to Scala. Below is an example the illustrates trivial compression for efficiently storing genes. A little science refresher, genes are typically made of Five nucleobases — adenine (A), cytosine ©, guanine (G), thymine (T), and uracil (U). Uracil (U) and thymine (T) are very similar except uracil is found in RNA, thymine (T) replaces uracil in DNA.

Below I’ll show the example…

Brian Schlining

Polyglot coder. Deep-sea Researcher. Zazen aficionado. I think squids are pretty cool.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store