Stop OSX Relaunching Apps on Restart

OSX is great, until its not.  In the last few versions of OSX, no matter how you set the check box when shutting down or restarting, OSX insists on relaunching all your open apps.

Sometimes it takes a sledgehammer to solve what should be a simple problem. So here is my sledge hammer.

OSX stores a list of currently open apps in a .plist file down in ~Library/Preferences/ByHost.  If you lock this file to keep OSX from reading and writing to it, you can prevent all those apps from opening.

You will need to set the ownership of the file to root, or the OS with all its power will simply replace it when it wants to write to it later one.

sudo chown root ~/Library/Preferences/ByHost/*

The next step is to remove all permissions

sudo chmod 000 ~/Library/Preferences/ByHost/*

Use the astrick because OSX stores a few backups that it will try to revert to.

Building the NativeScript CLI from Source

So today I needed some features in NativeScript that had been committed to their repo, but had not been released via npm yet. I thought I’d be smart, clone the repo and just build it myself.  It wasn’t quite that simple, so here is the path I took to get it all working on OSX.

WARNING: Bleeding Edge Repos can break things.

Clone the repo

git clone
cd nativescript-cli

Grab the submodule(s)

git submodule init
git submodule update

If this were just a JS module, you could simply use npm to install it. But its not, this module contains TypeScript. Ah, a Gruntfile exists in the repo!

Install Grunt and its requirements (I already have the grunt-cli installed globally)

npm install grunt
npm install grunt-ts
npm install grunt-contrib-clean
npm install grunt-contrib-copy
npm install grunt-contrib-watch
npm install grunt-shell

Now if we run grunt, we will see that a JS and a MAP file is created for each TS file within the project.


To package up a zip (ex: nativescript-0.9.4-non-ci.tgz) you can install from, you can use

grunt pack

To install from that zip

sudo npm install -g nativescript-0.9.4-non-ci.tgz

WARNING: If you missed it above, worth restating: Bleeding Edge Repos can break things.

Getting Started with Gimbals

So one of the biggest questions I get asked after giving a session on beacon technology is ‘where do I get beacons?’  Google is your friend in this regard, with tons of new hardware vendors rolling out new beacon brands.

I really like the Gimbals though as a starter bit of kit. Why?

  1. First 3 are free
  2. Secured
  3. iBeacon compatible since firmware 1.7x
  4. Low cost
  5. Great team behind the project

First 3 are free

FREE? Yes, free. For the time being, Gimbal will ship new eligible developers 3 of their Series 10 beacons for free.  Simply visit and register for an account.  Once confirmed, sign in, you should a new store link near the bottom of the left hand menu.  You may have to create an account for the store, I know that we had to, but we also were early adopters, so maybe our old account hadn’t been imported into the store.  Either way, in the store you will find the ‘3 Pack Promo’. If you are eligible, add if to you cart, and place the order. Sit back and wait for a confirmation email, a tracking number email, and then the package. Unless you are Dan in Spain, they should arrive within a week.


So your box has arrived, and you want to play with these new magical toys! To help in managing your new Gimbals, you will need to download the Gimbal Beacon Manager from the App Store on a beacon compatible device with a beacon compatible iOS version.

Once installed, you will be prompted to log in to the app with your Gimbal credentials.

The Gimbals ship with a piece of plastic between the battery and the connector.  This is great because, unlike estimotes, these things aren’t wasting battery power during shipping.  The plastic strip is also not designed to be just pulled out.  This is by design.  You will need to take a coin and open up each of your new beacons. Each Gimbal has a unique hardware id.  See? You have to open the device to get the id.  Thats why you couldn’t just rip that piece of plastic out!


So, now it is time to program your Gimbals.  The Gimbal Beacon Manager fetches profiles and firmware from the Gimbal portal and applies them to the device.  So, we will need to register our new gimbals in the Gimbal portal.  This will associate these devices with your account.

Log in to the portal, select Proximity and then Beacons on the left hand menu, then choose Activate Beacon from the buttons (or drop down) in the upper right hand corner.

Gimbal Activation

Only two bits of information are required for each beacon, a name and the Factory ID, found inside your beacon.  You can assign a gps coord to each of you beacons as well. This information, along with the custom icon and visibility setting only apply to gimbal beacon profiles and not to iBeacon compatible profiles (we will touch on this a bit further down)

Gimbal Activation Details

A quick tip regarding your beacons.  For now I suggest placing small dots to indicate which beacon is which on the back of your new toys.  This makes it a lot easier to identify them while playing with different scenarios.  As you can see i this account, we have named them ‘Test Beacon’ and given each a number.  That corrosponds to the number of dots on the back of each one.  Don’t place the dots on the face plates, as those can get mixed up.

Gimbal Tip: Mark your beacons to identify

Your new beacons will be assigned, by default, a gimbal managed profile.  You will need to create an iBeacon compatible profile for your beacons and push that profile to them using the iOS beacon manager app.  

With your beacons registered, you can open up the iOS app.  Confirm enabling all the BLE settings when asked by iOS.  In the sliding drawer of the app, choose Configure. Now place a battery into one of your beacons.  Because you will be popping the battery out again in a bit, you may want to just press it in firmly for now instead of popping the back onto the beacon.  When a battery is first inserted, the Gimbal is programmable.  When the app sees the beacon, go ahead and select update firmware.  This will bring your beacon up to the latest available firmware (1.8.0 as of this writing).  Depending on radio strength, this may take a bit.  Then apply a profile to the beacon.  The app will query the portal, pull down the profile assigned to the hardware, and save it to the beacon. Once done, you can go ahead and do the same for your other two beacons.  

iBeacon compatible

So you now have 3 beacons registered to your account. Now, don’t get me wrong here, the Gimbal SDK for iOS is well documented right now.  You can require user registration before an app interacts with your beacons, can pull the gps coords you assigned to your beacons down and use that to give you some locations.  Tons of things you can do.  But in their current state, they are not iBeacon compatible.

So lets change that. In the Gimbal portal, lets create a new profile. In the drop down, or from a button in the top right, choose Manage Configurations

Gimbal Manage Configuration

We are then going to Add New Configuration. Give your profile a name, from the drop down select iBeacon. Now, you will have and to decide what your projects architecture will be as you must now assign your beacons UUIDs, along with major and minor numbers.  This is a discussion for another post.  If you are so inclined, you can also mess around with Transmission Power. If you will be working with your beacons day in and day out, leave the defaults alone. If you are only working with your beacons at your desk, you could reduce the power to conserve battery life.  However, this affects range, and also the accuracy of ranging. Decisions, Decisions.

Create Configuration to save. You can now go back to your list of beacons and assign the new profile to them.  You will need to pop out your batteries and reinsert to put the beacons back into programmable mode, run through the process from above in the Gimbal Manager App to push the new profiles to the devices.

There is a bit of a pain point.  You cannot adjust a profile while it is assigned to a beacon in the portal.  That means to adjust radio power, you need to change the assignment for the beacon to a different profile, adjust the settings in the profile, then reassign the profile back to the beacon, pop the batteries, and push the profile to the hardware. Just an FYI.

Low Cost

Cost is a big deal, particularly when you are planning to roll out a bunch of beacons.  The series 10 beacons are $5 each in packs of 3. That is a terrific price for FCC certified hardware that you can place into service within the United States immediately.

Great Team

Our application to join the developer program included use cases that were NOT in the retail space.  This got the attention of someone in sales, and that started a chain of telephone conversations with both sales and marketing at Gimbal.  Great folks.

Because we were early adopters, we had some questions that were not addressed in the documentation.  We have talked to support twice so far and have had a great experience both times.

Titanium Studio Tip: Maximizing an Eclipse Heritage – Talking to JIRA

Titanium Studio is based upon the Eclipse product family.  Because of that, we can install a good number of Eclipse add-ons into Titanium Studio.  In this article, we will walk through how to install the add-ons required so we can manage our issues from within Titanium Studio.

1. In Titanium Studio, choose ‘Install New Software…’ from the Help menu

install new software

2. If the Eclipse Indigo Update Site isn’t already available as a source site, you may need to add it ( But we will search for ‘github’. Check the result. Be sure to also check ‘Contact all update sites during install to find the required software’. This will allow the installer to find and download required prerequisites for you.

install the github connector

3. Once the add-on has been installed, you will most likely be prompted to restart Titanium Studio.  It is ALWAYS worth restarting. Nothing good ever comes from ‘try and see’.

4. Once Studio has come back up, we need to open up a new perspective.

open a new perspective

5. From the list choose, ‘Planning’

planning perspective

6. Now in our perspectives list we have a new one:

new planning perspective

7. So lets add the JIRA connector. Back to Install New Software like we did in step 2. Only we will be using as our update site.  You could search for it inside the Add Repository interface (will point that out later) but 9 times out of ten you will get a requirement error. Select Commons as well as the required add-on. Again, be sure that ‘Contact all update sites…’ is checked at the bottom.

Tasks 14

8. Just like step 3, restart studio.

9. So lets add a repository.

add a repository

10. You are presented with the available connectors you can use. The ‘Install More Connectors’ will offer additional site resources, most paid/commercial, some free.

connector selection

11. Lets setup a JIRA first

jira connector

12. This example uses an Atlassian Hosted JIRA service.  If you are self hosting, simply change your server.  Keep in mind that Atlassian uses a secured SSL service, so you will need to preface your server with https://. The label is NOT the labels you use to preface your JIRA issues, but the label that references this connection in Titanium Studio.

setting up a jira connector

13. Once you have configured the repository, you will be prompted to create a query. You can create a variety of queries.  You can choose to have all tickets from all projects displayed, or maybe just your tickets from a particular project displayed. These queries appear as folders in your Planning perspective.

create a jira query

14. In this example, I’m going to create a query of all the tickets I’ve reported to the NeoLife project.

example jira connector query

15. Once finished, and the sync has taken place, my tickets appear in the planning view.

issues list

16. Hovering over a ticket gives me a quick over view. In this case, the ticket has been assigned to Daniel

ticket over view

17. If I need more details, or wish to modify a ticket, I can double click on one and the ticket opens in the editor pane.

task editor

18. If you need to pull issues from Github, Add your repository, and create a query.  You can also have a query of your gists for quick access to code as well.

TiShadow – Educational Potential



Let me tell you a little bit of the back story to this segment or the series. Here in the states Tim Poulson from Rochester and I have been discussing the use of Titanium in a classroom environment to teach, not just mobile program, but programming in general to high school aged students and higher.

Towards that end, we have both been investigating the ways in which we could push lessons plan and operational code to devices. Android isn’t really a problem as most devices will run unsigned code or accept code from non-market sources with the change of a setting or two on device. But iOs devices presented much more of a challenge due to Apple’s insistence on locking up the device access.

Following David Bankier’s Hacking Titanium presentation at Codestrong 2012 in San Francisco, he revealed a number of these new features I’m about to show you to a group of Titans and Appcelerator engineers who had gathered to investigate the use of David’s technology to reduce the learning curve of Titanium.

So I have 4 devices here, they represent my classroom. I have two different tiers of students in this group and I have sgemented them into the blue team and the red team. In the advanced tab of the connection dialog I simply designate which room to put them in.

I can then push a red lesson plan to the team in the red room and I can push a blue lesson plan to the team in the blue room.
We can also push a blue lesson plan to the team in the red room if we need to.

Now, we could place each student into their own room, lets say for instance student01 student02 etc.

We could have a script iterate through the list of rooms and push the same lesson plan to all the students.
But this would also allow each student to push their own work to their individual device.

I hope this gives you some ideas on how you could use TiShadow in a training environment.

I’v placed a link below to Tim Poulson’s in-progress lesson plans and feedback is welcomed.


Tim Poulsen – TiSchool on Github

David Bankier – Hacking Titanium session from Codesstrong 2012 (vimeo)



Series Links

TiShadow – Getting Started (Part 1) 

TiShadow – Getting Started (Part 2)

TiShadow – Increasing Productivity in your Shop

TiShadow – Educational Potential

TiShadow – Taking it to the Cloud



TiShadow – Increasing Productivity in your Shop

Today’s article will be on the use of TiShadow within a development shop.

Personal Application

I want to first give you an idea of what part of my workspace looks like and show how:

Now, these are not all of the devices have for testing, this is just the ones I’m using currently.

From top left we have Kindle Fire, iPad 2, Droid Pro, Nexus 7, iPhone 4s, Samsung S3 and a Droid X down in the front.

IMG 3005


Now, can you imagine pushing a test to all of these devices?

If you look closely, you can see that they all have the TiShadow client up at the connection screen. I figured the best way to explain the speed benefits would be to just show you.  These have been built with the 1 second timeout but the binaries we make available to clients have a 15 second timeout to allow for problems with Internet connectivity.  I wanted to give you a true feel for some of the minor issues that pop up from time to time. In the first part of the video you will see the iOS devices timeout.  In the second part of the video, a few of the Android’s timeout.  Part of the problem here is that I have data being uploaded to a client and my poor little Mac is taking a beating trying to do all of this at one time tonight. We work around this by increasing the time out in the client binary we use on a regular basis. The other thing to watch is just how long it takes that little old Droid Pro to kick in and run the application. The bottleneck on that particular devices is that it handles zip files poorly, a problem I can only assume stems from its processor.



So you can see how easy it is to push changes out to a variety of devices to see how a modification may look on each.  This alone saves time which, in the long run, saves money.

In-House Application

But where else can this be used? We use it for presenting between development groups.  Sometimes a screenshot just doesn’t do a designer’s work justice, or, sometimes it doesn’t make the designer’s idea look as bad as it really is.  While a lot of UX may look good on paper, how many times have you discovered that what your team thought was a great idea just doesn’t work well on device?

I can throw together some sample code and a developer on the other side of town connects to our TiShadow server over the net and I can push the code to his device and he can play with it live. No building a binary, no pushing it to Testflight or dropbox. It’s just done.

So now we are reducing wasted time between development teams.

Client Facing Application

The customer likes to see how a project is progressing. But getting a binary to their devices is always a complicated process. Yes, as geeks we know it can be done, and we have tools to work around the roadblocks, but how many of our clients really know much about their devices?

We use Testflight to push an adhoc build of a customized TiShadow client.  It connects to a client facing TiShadow server and with them on the phone, we simply push a sample of their project to their device. Eazy Peazy as some may say.

So now, less frustration by our clients. Better communication. Quicker feedback.



Series Links

TiShadow – Getting Started (Part 1) 

TiShadow – Getting Started (Part 2)

TiShadow – Increasing Productivity in your Shop

TiShadow – Educational Potential

TiShadow – Taking it to the Cloud



TiShadow – Getting Started (Part 2)

So this evening I was in a good mood and had some free time available. So combine those and you get part 2 of the getting started article, which wasn’t originally planned.

As I’m a very visual guy, I figured a few screenshots might help some of you get started building your custom client for iOS.

Step 1: Get the source code for the TiShadow client app.

Just head over to Github and download the zip from

Download TiShadow from Github

Step 2: Create a Project in Titanium Studio for our app. 

For our demo purposes we will just quickly import the source code into our project.  If you find that TiShadow is going to meet your needs, you will want to create a new, blank project and copy the source files into your new project.  I’ll explain the reasons for this later.

From the file menu of Titanium Studio, choose File then Import…

Tishadow02 0


We are going to import an Existing Titanium Project.

Tishadow02 1


Point the Project directory to the app directory inside the folder you extracted from the ZIP file you downloaded from Github in Step 1.


Step 3: Edit the tiapp.xml file to meet your environment.

You will need to change the Application Id to something different and unique if you intend to use this in an ad-hoc provisioning profile through the iTunes Connect site.



You may need to enable or disable some of the default modules. In this case, Tony Lukasavage’s module for android is unhappy with our development environment. Because I am not planning on building out a new android client right now, I’ll leave it.  You all need the latest CI build of the TiMobileSDK and Titanium Studio 3beta to get rid of this warning.  This is also where you would add any additional modules that you would plan on using in your application.  However, the imported project has a guid thats connected with David’s account. If you try to build with a module you downloaded from Appcelerator’s market you will end up with a warning about unlicensed modules.  This is one of the reason’s to build a clean project and copy over the source files into that project for a long term plan.

2012 11 29 1601


You will not enable cloud services here.  Doing so would connect cloud services to your TiShadow application and not to the project you will be pushing through TiShadow.  Later this week I’ll post a quick explanation on how to work around this.


Step 4: Build your project and run it on your iOS Simulator

Step 5: Starting TiShadow Server

Open up one terminal and run ’tishadow server’

After the server has started, put in the IP address of the system running your TiShadow Server. For now this will be your local machine.

Click Connect.

Open up a second terminal and change to the directory of a project you want to run through TiShadow.

2012 11 29 1733


Type ’tishadow run’ and if all is well, your app will appear within the TiShadow app.

Tishadow10 Tishadow11


Series Links

TiShadow – Getting Started (Part 1) 

TiShadow – Getting Started (Part 2)

TiShadow – Increasing Productivity in your Shop

TiShadow – Educational Potential

TiShadow – Taking it to the Cloud



TiShadow – Getting Started (Part 1)

The Problem

One of the most frustrating things about development is the time wasted waiting for the compiler to build up your binary and then installing it either in a simulator (emulator if on Android) or on an actual device.  It doesn’t matter if you are using Titanium, or xCode or Eclipse, it just takes time.

Now lets throw in that Apple locks up our devices and makes it difficult to actually push a binary to our devices.

In our shop, we use Titanium to build both iOS and Android applications from the same codebase.  In over 2 years of development, only one app has gone our our doors that was single platform.

With that in mind, you can understand why I started looking for quicker ways to test code, either on my own devices, or on our developers’ devices.

iOS distribution was partially resolved with TestFlightApp, a (currently) free service that facilitates the distribution of apps built with ad-hoc provisioning profiles.  The entire distribution process was a good bit faster overall, but we were still building and uploading a binary for each build. And it was only for iOS. If we wanted to test on Android, well, that was another build cycle and distribution through Dropbox.

The Solution

I began to hear rumors and stories of black magic from Australia called ‘TiShadow’.

A Brief History of TiShadow

In March 2012, David Bankier, Director at YY Digital in Melbourne Australia, pushed a working copy of TiShadow to Github for the public to take a look at.  He had allowed some folks to play with it early on.

In July 2012, David demonstrated TiShadow for the London Titanium Meetup from his offices in Melbourne over the Internet, a not so insignificant distance of 10,500 miles (16,800 km for those that haven’t rebelled yet).

In October 2012, David was invited to Appcelerator’s CodeStrong in San Francisco to demonstrate not only his previous work with TiShadow, but some of his plans for the future. (video, slides)

In November 2012, David demonstrated his very latest modifications to his project at the Melbourne Titanium Meetup, features that we will look at in our second article on TiShadow.

So What Is It

TiShadow used to be a pretty big core hack. If you wanted to use it, had to download a custom modified Titanium Mobile SDK and build it yourself. Not an easy task for the majority of Titanium developers.

TiShadow essentially works by building and installing a single app on iOS and Android.  This acts as a host or controller on the device.  That client app connects to your TiShadow server which pushes your Titanium project source code and resources out to the device and runs it as if it was compiled into the client app.

How much time did it take? Well, how long does it take to zip up your project and push it OTA to a device? Thats it.  Now think about this.  You aren’t just pushing to a single device.  You are pushing to all your test devices at the same time. Multiple savings.

How do I get Started

Those that know me, understand that I am brutally honest but not mean spirited.  With that statement in mind, let me say: If you can’t follow the in the GitHub Repo of TiShadow, you probably ought not to be thinking about using it.

David has done a very good job of making the installation as easy as possible and I am not going to take the time to duplicate his efforts.

  1. Install TiShadow from npm
  2. If you are using Android, you can find a client app already in Google Play.  To build the binary yourself:
    mkdir ~/tishadowapp 
    tishadow app -d ~/tishadowapp
  3. Open up 2 terminals (osx) or a command prompts (winders).
  4. In one you start the server ’tishadow server’.
  5. Start your client app on the device and enter the ip address of the the system running the tishadow server.
  6. Now in the other command line interface, you cd on over to the root of a titanium project and type ’tishadow run’
  7. Your project, built properly and to good form using nice commonJS coding styles should pop up on your devices.


The prebuilt binary on Play may not have all the modules you will need in your project.  It is enough to get you started, but be prepaired to build out your own custom client down the line.

Ti.include works partially.  My belief is that you need to move away from this, so just updated your code and make your life so much easier already.

Series Links

TiShadow – Getting Started (Part 1) 

TiShadow – Getting Started (Part 2)

TiShadow – Increasing Productivity in your Shop

TiShadow – Educational Potential

TiShadow – Taking it to the Cloud

Titanium – Open PDF with Intents Resolved (Android)

Just over a year ago, Tony Lukasavage wrote a great blog post on the Appcelerator Developer Blog explaining why extra steps were required in Android apps to open PDF files and how to go about it.

Starting about 6 months or so ago, the Appcelerator Q&A began seeing questions regarding this process and the problems users were having.  Now, I haven’t pushed out an app that needed PDF support in nearly 18 months.  Not that PDFs are a bad thing, but none of our clients have required that functionality recently.

So tonight Tim Kimberly asked if I could possibly look into the problem, following an exchange we had earlier in the week on the Q&A.

I copied Tony’s code into an existing project’s app.js. The code performed as expected on an emulator without an SDCard (alert received) and on an emulator with an SDCard but no PDF viewer (alert received).  The code also worked on my Samsung S3, opening the PDF with 3 different viewers.

So now I turned to the Nexus 7, this being the device that Tim Kimberly was testing on.  FAILURE.

Well, with Android development, when in doubt throw in a bunch of statements and open up DDMS.

From DDMS learned that the line

tmpFile = Ti.Filesystem.createTempFile();

created its file in


Problem #1: Ti.Filesystem.createTempFile() may be creating its file in NONE world readable locations.

Fine, the solution then is to create our own filename in the Ti.Filesystem.tempDirectory to be sure.

var filenameBase = new Date().getTime();
tmpFile = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory,filenameBase+'.pdf');

Excellent! We check to see if tmpFile.exists() is true and it is! Success!
The user now hits the button, fires up an intent and….failure.

Say what? Yeah, file is missing. How can this be? So, throw in some and learn that from the time we write out the file and check if it exists until the time we hit the button to fire up an intent the file is removed be the system.

11-06 18:44:35.215: I/TiAPI(2451): file written tmpFile exists: true
11-06 18:44:45.385: I/TiAPI(2451): starting intent tmpFile exists: false

Problem #2: The file is being deleted by the system in less than 10 seconds after being written.

Wow! So now what do we do? Eliminate the user delay. Create our temp file immediately before firing up the intent. Move our file system work inside the button event listener. We also change the if statement that was merely checking to see if the variable tmpFile existed to a statement that checks for the actual file’s existence.

button.addEventListener('click', function(e) {
if (Ti.Filesystem.isExternalStoragePresent()) {
var filenameBase = new Date().getTime();
tmpFile = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory,filenameBase+'.pdf');
if (tmpFile.exists()) {
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_VIEW,
type: "application/pdf",
data: tmpFile.nativePath
try {
} catch(e) {
alert('No apps PDF apps installed!');
} else {'starting intent tmpFile exists: '+tmpFile.exists());
alert('Our file disappeared!');

This code will require some testing against multiple devices to ensure compatibility, but it should get most of you started on the right track.

Work Smart, Code Strong.

Titanium Mobile SDK , build: 3.0.0.v20121030170824

My Piano nearly released

In the process of creating My Communicator, a sequencer process had to be developed. Another request from the teachers at The Joseph Sams School was for a unique music app that would play the next note in a song regardless of where a child touched the device’s screen.  It comes preloaded with 5 songs for now. We hope to have few more public domain tunes included upon release.

My Piano has been test on iPad, iPhone, Samsung S3 and Nexus 7.