How to create a private key for signing Android apps

To create a private key to sign your Android apps with, you need to run the keytool command (installed when you install a Java development kit) as follows.

keytool -genkey -v -keystore myandroid.keystore -alias myandroidkey -keyalg RSA -keysize 2048 -validity 10000 -dname "O=Acme Ltd"

Replace Acme Ltd with your company name.

When the tool runs it will prompt you for a password and then generate a file called myandroid.keystore. You will need this file, your password and the key’s alias (myandroidkey in this example) to sign your app.

To see the details of your key use the following command:

keytool -list -v -keystore myandroid.keystore

For more information see the Link to Signing Your Application page page in the Android developer’s documentation.

Tech Tip: Start a simple web server

Python ships with a handy little web server that will serve up the files in the folder from which it is run. This is really handy for development.

Run the following command to start the server:

python -m SimpleHTTPServer

Or if you are using Python 3, run:

python -m http.server

Tech Tip: Change AngularJS template delimiters

I have recently been doing some development with the Bottle Python web app framework. Unfortunately it’s simple template system uses the same template delimiters as Angular (“{{” and “}}”). Worse you cannot change these delimiters in Bottle.

Fortunately you can change them in Angular using the following:

var myApp = angular.module('talkpoint', [], function($interpolateProvider) {
    // set custom delimiters for angular templates
    $interpolateProvider.startSymbol('[[');
    $interpolateProvider.endSymbol(']]');
});

Which given a Controller looking like this:

myApp.controller('TodoCtrl', ['$scope', function($scope) {
    $scope.todos = [
        {text:'learn angular', done:true},
        {text:'build an angular app', done:false}];
}]);

Allows you to write Angular template code looking like this:

<div ng-controller="TodoCtrl" class="row">
  <ul >
    <li ng-repeat="todo in todos">
      <input type="checkbox" ng-model="todo.done">
      <span class="done-[[todo.done]]">[[todo.text]]</span>
    </li>
  </ul>
</div>