It's Been Great, Thanks!

So long and thanks for all the fish, or as my Google colleagues would say, there will always be TowerFall. After eight years of running a web development blog, I᾿m finally accepting that I no longer have the time nor daily immersion with the subject matter to write meaningful articles. With my work on Android at Google, I am drifting farther and farther from actual web development, and think you᾿ll be better informed by other sources. As long as people are reading, I᾿ll continue to leave the blog up and respond to comments, but I won᾿t be contributing new articles.

For those who want to stay up-to-date with the latest information, I recommend the https://cooperpress.com/ weekly emails.

In the future, as I start new endeavours (or update existing ones), I᾿ll update the site to include them. And who knows, maybe one day, I᾿ll have the expertise and the desire to write again. Thanks to every one of you readers for exploring web development with me over the years.

For Fun - Script to Rotate Wallpaper in Background

This is a fun little script that I wrote to rotate the wallpaper on my linux (ubuntu) machine. While not strictly on topic, you can use this as a template for your own scripts, such as those that monitor for file changes.

How do it…

We need two files, one to periodically rotate the wallpaper and the other to start the rotating script in the background and exit. But first, setup a directory to ...

Things Web Application Monitoring Can Pick Up From Casino Security

Security exists in order to protect the important things. While network security is constantly being upgraded in order to fend off attackers, it could actually learn a lesson or two from the surveillance of a casino floor. Web-based security, especially for pay-to-play sites, uses multiple layers of protection. Betfair, currently the biggest Internet betting exchange, is one of the providers that use a 2-step authentication, intrusion detection systems, and other methods ...

Simplifying Google Play Games API

Previously we covered Using Google Play Games on the Web and how Google Play Games services[3] can be used for web games[1]. There was a lot of interest on that article, mostly about providing UI components, which is a project that I have started, when I am not working on the refactor of Gaming Engine - Snake Demo v2. However, before building a UI, the API needed to be cleaned up, ...

Using EMCAScript 6 Today

I have been avoiding writing about ECMAScript 6 (E6)[6] for the past couple of years. This is mostly because the standard was not finalized, and consequently most browsers/engines were implementing different and often unstable versions of the various new features. With the E6 spec stabilizing almost a year ago now[1] and the final release date scheduled sometime later this year[1], I expected most browsers/engines would have implemented much of it, with bake ...

Video Recording with MediaProjectionManager

Recording video on an Android device, as a developer, should be as easy as calling a platform-level API, possibly showing an intent for permission approval, before starting to streaming video. Unfortunately, we don’t live in an ideal world, and video recording is far more difficult than it should be. Fortunately, starting in Android Lollipop, there is a new API (MediaProjectionManager[1]) to make recording video easier. However, there is a remarkable amount of incomplete or ...

Karma Test Runner with QUnit in 10 Minutes

This is a ten minute primer for using Karma and QUnit to unit test JavaScript.

Getting ready

Install Karma[1], plugins, and Qunit[2].
 # Install Karma npm install karma --save-dev # Install plugins npm install karma-qunit karma-phantomjs-launcher --save-dev # Add global CLI npm install -g karma-cli # Install QUnit npm install --save-dev qunitjs 

How do it…

In your project directory, run the Karma initialization script:
 karma init ...

Object Pool Pattern in JavaScript

Now that we understand the Recycler Object for Object Pool Pattern, we can build the logic for managing the object pool. An object pool is a simple API that manages recycling and fetching recyclable objects. There are two common models for object pools, one with a fixed number of objects that errors if too many objects are requested, and the other (more flexible approach) is to use the object pool for a fixed number ...

Recycler Object for Object Pool Pattern

Creating or destroying an object is never free and JavaScript is no exception. Generally, the cost of creating/destroying an object in JIT-optimized JavaScript runtimes doesn't affect performance, but other languages will have a performance hit as well. The real culprit is the increase in your application's memory footprint (watch the memory tab in a developer tool while running the tests below for an illustration). This is why, in most cases, reusing a single object is ...

Start Using SRCSET IMG Attribute For Serving Device Specific Images

The article, JavaScript Low Resolution Image Replacer, discussed a JavaScript solution for replacing low resolution images with higher resolution ones after the page finishes loading all the initial resources (thereby reducing the load time of your pages). But what about loading different image sizes based on the resolution of the user’s device. We could write a JavaScript solution for this (and some developers have), but HTML 5 already introduces the concept of <img srcset[