Enable Third-party Casting on the ADT-1

If you were one of the lucky developers to get an ADT-1 at Google I/O this year, or from the form for developers, you’ve probably wanted to use it as a replacement for your Chromecast. By default the ADT-1 only supports casting to a select few applications:

  • YouTube
  • Netflix
  • Google+ Photos
  • Google Play Movies and TV (Android and iOS only)
  • Google Play Music
  • Mirror your Android device screen to ADT-1

We can fix this with a simple modification to your ADT-1 using a custom ClockworkMod Recovery and a simple text editor.

Enable USB Debugging

You’ll need to enabled USB debugging before you can do anything.

  • Go to the home screen
  • Go to Settings > About
  • Click on the Build Number 8 times (until it says you’re a developer)
  • Go back to the home screen
  • Go to Settings > Developer options > Debugging
  • Change USB debugging to On

Flash CWM Recovery

Enabling Chromecast for other applications (such as Plex and Songza) is pretty easy. We first need to reboot into the bootloader and flash a custom recovery:

adb reboot bootloader
fastboot flash recovery cwm_molly_recovery_lpx13d.img

You’ll need to reboot into the recovery now, click the back button to highlight the Recovery Kernel option (less than 1 second to switch) then hold the button down for over a second to select it.

Once you’re in the recovery you can choose to do a backup in case you can’t get things fixed up.

Mount the System Partition

We’ll need to mount the /system partition to a new folder, the one that is already mounted is from the recovery drive.

adb shell
$ mkdir /main_system
$ mount -o rw /dev/block/platform/sdhci-tegra.3/by-name/system /main_system

Download and Modify build.prop

We need to download the current boot.prop, and also back it up.

adb shell
$ cd /main_system
$ cp build.prop build.prop.bak

On your system (not in adb shell)

adb pull /main_system/build.prop

Modify build.prop, you want to change the following:


to be:


And then push things back up to the ADT-1 and fix permissions

adb push build.prop /main_system/build.prop
adb shell
$ cd /main_system
$ chmod 0644 build.prop

That’s it, you can reboot now:

adb reboot

Stuck in a Boot Loop?

If you get stuck in a boot loop the permissions probably weren’t fixed on the build.prop, or another setting was changed. You can reboot into the bootloader by holding down the rear button while powering on, then choosing the recovery kernel option again. Once there you can remount the system partition again and try fixing the permissions using chmod.

You can also restore the original factory images using this zip and the custom recovery if you want to start fresh.

Limiting Go Concurrency

Reasons to limit concurrency

There are many reasons you might want to limit concurrency in your application; most of the time you have access to some limited resource and want to avoid overwhelming it.

Example Code

This code will serve as the base for explaining each of the parts required to limit concurrency properly.

package main

import "sync"

func main() {
 var wg sync.WaitGroup

 go func(wg *sync.WaitGroup) {



sync.WaitGroup will allow you to wait on arbitrary operations to complete before proceeding operations. Essentially, it will allow you to track the number of currently running goroutines and wait at certain points for them to finish before resuming.


WaitGroup.Add lets you increment the number of available resources. In the example we indicate that we are going to run a single goroutine before resuming the main execution. You can Add multiple times; one thing to remember is that you will require a call to WaitGroup.Done for every additional resource you add, your main execution will pause indefinitely otherwise.


This indicates that your particular resource is available again. You generally want to call this at the end of your routine, or before harmless operations that no longer access a resource are started.


This is the point in the main execution that you will pause until WaitGroup.Done has been called the specified number of times.


These are all the pieces you need to limit your concurrency in Go. WaitGroups will allow you to pause the main execution thread until all of the allocated resources have been returned and will prevent you accidentally DoS’ing yourself.

DRY Up Your Constructors in Batman.js

Need a value to always be returned by one of your models, but have situations where it can come back as null or undefined? Wrap accessors are a convenient way to guarantee you always receive a value, and that it remains modifiable.

An Example

Here is an example using a product price:

<span data-bind="product.price"></span>

Generally we always want a value here, here is a wrap accessor to do this for us which can be placed on the model itself:

@wrapAccessor 'price', (core) ->
  get: (key) -> core.get.call(this, key) || 0.toFixed(2)

This will prevent situations where your object hasn’t yet been initialized, or only has defaults filled in on save.

Why Not To Use Set

Why should we use a wrapAccessor for defaults instead of just setting them. Consider this code:

constructor: ->
  BaconTracker.Bacon.find 1, (err, bacon) =>
    @set('bacon', bacon)

  unless @get('bacon.quantity')?
    @set('bacon.quantity', 0)

If we had to do this in every controller or view, we’d have a lot of defaults to set. Instead by providing a safe default on the model itself we avoid having to set properties from the controller.