Validate Form Submissions In Node.js With Google reCAPTCHA

Anyone that operates a website or web application with a contact page knows how bad the SPAM problem on the internet is. Spammers, phishers, and other malicious people create bots that will crawl search engines for contact forms and send emails to the hosts, register accounts, or something else. There was a point in time that I was receiving more than ten emails a day from spammers that wanted to redesign my website. This kind of activity is incredibly annoying on my inbox.

This is where CAPTCHA and reCAPTCHA form elements come into play. These elements typically require some interaction such as typing words from an image or solving a math problem. Adding this small amount of form complexity can go a long way towards stopping bots.

We're going to see how to hook up a Google reCAPTCHA element into a client facing form and validate that element using a Node.js backend.

TPDP Episode #14: Object Storage for Application Developers

I am pleased to announce that the latest episode of The Polyglot Developer Podcast is now available to download from all the popular podcasting networks. In this episode titled, Object Storage for Application Developers, I’m joined by Krishna Srinivas from Minio to talk about what object storage is and the various solutions that are available.

Episode #14 can be downloaded for free from iTunes, Pocket Casts, and every other popular network, but it can also be heard below.

(more…)

Handle Google Play Services Conflicts In NativeScript Mobile Applications

I’ve been developing with NativeScript for a few years now, but only recently have I started working with the various services offered by Google Play. Using a single Google Play service such as Google Analytics works great, but as soon as you start adding more, you’ll start noticing Android conflicts during the build process.

Different plugins have different requirements on the underlying library versions. For example, one plugin might expect version 9, while another version 10, creating a versioning conflict.

We’re going to see how to get around these common problems that expand beyond NativeScript and into other development frameworks such as Apache Cordova and Ionic Framework.

(more…)

Convert APNS Tokens To FCM Tokens With Simple HTTP APIs

Not too long ago I wrote a guest post regarding push notifications with the Firebase Cloud Messaging (FCM) service at the Telerik Developer Network. While that previous article was directly related to using FCM within a NativeScript application, it followed all the same rules that are required for any mobile development platform. There is a catch, however. The push notification plugin for NativeScript uses FCM for Android and Apple’s Push Notification Service (APNS) for iOS, which can be confusing as you’re then working with two different services.

It often makes sense to use a service like Firebase Cloud Messaging for both Android and iOS to make the application a little less complex. We’re going to see how to convert APNS tokens into FCM tokens using some available Google APIs and HTTP.

(more…)

Extend Legacy Java Android Applications With NativeScript And Angular

As some of you might know, before I started developing cross platform mobile applications using Ionic Framework and NativeScript, I was developing Android applications using nothing more than the Android SDK and Java. I still have one of my first applications, SQLTool, for sale in Google Play, and it was written with Java and Android. When building mobile applications, frameworks like NativeScript are incredibly attractive to web developers because they can use a common set of web design and development skills. However, NativeScript can be equally attractive to development teams writing Android applications with Java.

With NativeScript you can actually build a “polyglot” type application where parts are Java and parts are NativeScript with Angular. To be clear, I’m not talking about rewriting your Java application into modules wrapped in JavaScript like plugins. I’m saying that you can take your 100% Android with Java application and add Activities or Fragments built with NativeScript.

So why is this useful?

Imagine being on a small Android development team with more things to be done than there is time in the day. These Android developers would rather die than use a cross platform framework, but you have plenty of web developers floating around your company. In this scenario, the two worlds can collide and maybe the web developers can create lower (or higher) priority components for the Android application without having to convert the whole application to Android with Java or to NativeScript with Angular.

(more…)

Remove Untagged Docker Images From Your Docker Host Via The CLI

If you’re like me, when it comes to Docker, you probably build images non-stop.  I must admit that when I create images, I don’t create any special tags, even though I should.  Instead every build uses the latest tag because that is enough to meet my needs.  Regardless of what tags you use, you may find yourself building the same thing over and over.  When this happens, the previous image remains on your machine, but becomes untagged to make room for the new build.

So how do you prevent having potentially hundreds of untagged Docker images lingering on your machine?  We’re going to see how to quickly remove them.

(more…)

Add Two-Factor Authentication To A Golang RESTful API

When it comes to authenticating users for making use of your API, it is a good idea to add an extra step beyond standard username and password. This is called two-factor authentication (2FA) and it acts as a second layer of security for users making use of your application.

Not too long ago I had written about adding 2FA to a RESTful API created with Node.js and Express Framework, but what if we wanted to do it in Golang? The logic isn't any different, just a new syntax for a new language.

We're going to see how to add two-factor authentication to a Golang API that makes use of Json Web Tokens (JWT).

Using Network Sockets With The Go Programming Language

A few months back I wrote about using websockets in a Golang application for communication with an Angular client web application.  While very useful and simplistic, in many cases websockets won’t be the means for real-time communication between applications.  It is often easier or better to use standard TCP network sockets as an alternative.  For example, if you’re developing an online video game, it will likely communicate to the server using TCP sockets rather than websockets.

We’re going to see how to create a basic chat application using the Go programming language.  This chat application will have a server for listening and routing client communications and a client for sending and receiving messages from the server.

(more…)

Form Validation In An Angular Web Application With Custom Directives

When creating a web application that accepts user input, it is often a good idea to validate anything the user provides. While you should always validate this information via some backend server-side code, it often provides a good user experience to validate via the frontend as well. By doing form validation on the frontend, you set yourself up for the possibility to catch and display errors before form submission.

If you’ve been keeping up, I once demonstrated how to do form validation in AngularJS via an Ionic Framework application. As of now, AngularJS is ancient technology, so we’re going to see how to do the same with Angular. However, we’ll be seeing from the perspective of a web application, rather than a cross-platform hybrid mobile application.

(more…)

Create A Raspberry Pi Cluster With Docker Swarm And Raspbian Linux

Back when I was first learning about Docker, I had tried to use it on one of my Raspberry Pi devices.  This was when Docker had first become available officially for Raspbian.  When I was playing around with Docker and my Raspberry Pi, I had written a tutorial for deploying containers, or more specifically a Ghost container.  This was a single container on a single device or node.  Since then I started playing around with Docker Swarm and decided to create a Raspberry Pi cluster.

We’re going to see how to take several Raspberry Pi devices, cluster them using Docker Swarm, and deploying containers to Swarm with replica copies.

(more…)