Why Java? Tales from a Python Convert

Whenever I tell people I’ve been working with Java I get the same reaction:

“Yuck! Java? Why Java?”

And, admittedly, I had the same reaction — at first. But over time, I’ve come to appreciate Java for its type safety, performance, and rock-solid tooling. I’ve also come to notice that this isn’t the Java I was used to — it’s been steadily improving over the last ten years.

[Read More]

Including a local package as a Maven dependency

Lately I’ve been tasked with developing a Java library for internal use. For testing, its proved useful to package the library for local use. This article describes how to add a Jar file to a local Maven repository for use in your own testing and development. Create your local Maven repository Your local Maven repository lives within the project you are developing for. Creating your local repository is as simple as making a new directory. [Read More]
maven  java 

Writing Repeated BigQuery records using the Java Client Library

I’ve recently been working with Java via the Google Cloud Dataflow SDK. One problem I’ve had is working with the BigQuery Java Client. It was never entirely clear how to create a repeated record. This article explains how it works and how you can accomplish the same thing. First, you need to create a new TableRow. For this example, let’s assume we are logging events using a guid and a timestamp. [Read More]

From JSON to a Google API Client Library object

I have been working on a Cloud Dataflow project that parses incoming App Engine logs to generate status statistics such as numer of errors in the last 10 minutes. The incoming data is a JSON representation of a LogEntry object. A LogEntry object is represented in Java as a LogEntry class. The task I found myself in was converting the JSON representation of a LogEntry into the Java object for downstream processing. [Read More]

Creating a BigQuery Table using the Java Client Library

I haven’t been able to find great documentation on creating a BigQuery TableSchema using the Java Client Library. This blog post hopes to rectify that :). You can use the BigQuery sample code for an idea of how to create a client connection to BigQuery. Assuming you have the connection set up you can start by creating a new TableSchema. The TableSchema provides a method for setting the list of fields that make up the columns of your BigQuery Table. [Read More]