❯ Guillaume Laforge

tips

Serverless tip #2 — Deploy an executable JVM application with gcloud without app.yaml or build tool plugin

Requirements: an existing Google Cloud Platform account and project a Java or alternative language web application a build that creates a standalone executable JAR file Usually App Engine applications in Java are deployed with the gcloud command-line interface, or via a Maven or Gradle build plugin. Either way, an app.yaml file to describe your application is required to let the cloud SDK know that the project at hand is an App Engine project. Read more...

Serverless tip #1 — Deploy a standalone JVM web app with Gradle and the App Engine plugin

Requirements: an existing Google Cloud Platform account and project a Java or alternative language web application a Gradle build that creates a standalone executable JAR file In youd build.gradle file, add the App Engine gradle plugin to your buildscript dependencies: buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.+' } } Apply the plugin, to make use of it: apply plugin: "com.google.cloud.tools.appengine-appyaml" Then you can configure the appengine task to point at the standalone executable JAR: Read more...

Tip: Making a Google Cloud Storage bucket or file public

Google Cloud Storage is the ideal product to store your object files (binary files, pictures, audio/video assets, and more). Until recently, there was an option in the Google cloud console with a checkbox to quickly make a file or bucket public. However, and I would add “unfortunately”, users tended to inadvertently clicking the checkbox, thus making potentail confidential assets public. So this risky, but easy, option, has been removed to avoid any unwanted data leak. Read more...

bash tip: find and grep through files

It happens once in a while that I want to find all files containing a certain string. I know command-line tools such as grep, cat, and find, but I never remember the right combination to achieve that task. So as to remember and reference it later, I write this small blog post to remind me how to do it: find . -type f -exec grep YOURSTRING /dev/null {} \; The find . Read more...

Handy Gradle startup script

Dierk published a gist on GitHub with a handy Gradle build script to help you bootstrap a Gradle-built project from scratch, without having to create the directory layout manually, or install the Gradle wrapper. This is pretty neat and should be integrated in Gradle to ease the creation of projects! I’ve updated the gist with a more recent version of Groovy and Gradle. And so that I never forget about this handy Gradle build script, I’m blogging about it and reproducing it here, to save me precious minutes finding it again the next time I need it! Read more...

Tip: View unread mails in Gmail

When you’re subscribed to many mailing-lists, you often have hundreds of mails a day that you don’t even bother reading. So usually, you mark them as read. But if you’re like me and that your using tags as folders and sort all incoming mailing-lists in those folders, when you want to mark all mails as read, you need to go to each label and select them all, mark them as read each time. Read more...

How to remove accents from a String

My little puzzle of the day is to find how to remove accents from a String. There are different alternatives, different strategies, but none really suits my needs – or my taste. The naive approach is to use String.replace() to replace manually all characters, with a correspondance table, like “é” should be replaced with “e”, etc. That’s fine for some languages I know, like French or German, or even some latin languages, since we share the same alphabet. Read more...

Maven tip: using Ant's optional FTP task

Maven is a pretty powerful tool, but sometimes, simple things can get complicated… I had to customize my build to upload some files through FTP. But it wasn’t just a mere artifact to upload through FTP to the enterprise repository, so I couldn’t use Maven’s artifact plugin and its FTP method. So the solution was to use Ant’s optional FTP task. At first, it doesn’t seem very complicated, since Maven can basically use any Ant task very easily, but the fact is that this optional Ant task is dependent on another library that you have to add to Maven’s root classloader, otherwise you’ll get a NoClassDefFound! Read more...

Castor tip: generating Java classes for XSD simple types

At work, I’m using Castor XML to Java binding to marshall/unmarshall messages in my Web Services, inside a custom framework (Struts, OJB, JAXM, etc). I have defined my messages as XSD Schemas, and I’m using Castor’s Maven plugin to auto-generate my Java classes at build time. All is good and well… Hmm, almost! Castor’s SourceGenerator generates Java classes for complex types and elements, but not for simple types, and unfortunately, I badly needed to marshall those simple types as well. Read more...

Tip O' the day : SSH on Windows

My fellow readers might remember my problems with SSH which have often bothered me. I faced again a similar issue: I wanted to upload a new Groovy snapshot Jar, before we release RC-1 next week. As a Groovy despot, with the help of some wonderful hausmates (particularly Trygve and Bob) I managed to authenticate myself with ssh-agent + ssh-add on the Codehaus server, so that maven doesn’t require me to enter my passphrase for my key. Read more...