Johnno's Workbench - 2/21 - Tips, Tutorials, Domino, XPages, Java, Mobile, Appcelerator, etc

12 Jun 2014

TIP: Create global batch files for use in Terminal

I’m slowly but surely becoming a huge fan of running my development workflows through Terminal on my Mac, especially in the case of mobile development using Appcelerator Titanium. This is a quick tip to show you how to group terminal commands into batch files and have these batch files accessible anywhere when working in Terminal.


  • I haven’t moved to Mavericks as yet, so my example below applies to Mountain Lion, but should also apply to Mavericks
  • In my example below, my batch file navigates to the required folder, builds and runs my mobile app the iPad Simulator
  • To enable/disable hidden folders and files in Finder, I recommend using Funter or Mountain Tweaks
  • You can’t double click on a hidden file to open it, you need to right-click on the file and select “Open”

Do The Following

  • Open TextEdit and add your commands to it, each command on a new line (See below what I did)


  • Save this file and provide a file name without a suffix/file extension (i.e. file name = debugapp) and put it in a folder of your choosing. (e.g. “Users/{username}/Documents/terminalcommands“)
  • Under the “Users/{username}” folder, search for a hidden file called “.bash_profile” and open it
  • NOTE: if you can view hidden files in Finder and you don’t see the “.bash_profile” file, you will need to create it using TextEdit or something similar
  • Next, to add your folder path to the PATH Environment Variable, on a new line, type in export PATH=/Users/{username}/Documents/terminalcommands:$PATH


  • Save and Close
  • Restart Terminal

Test if this worked

  • You can check the $PATH variable by entering echo $PATH in Terminal
  • To run your batch file, simply enter the batch file name (e.g. debugapp) in Terminal
I hope this works for you :)
10 Jun 2014

XCode Tip: Possible fix if Application Loader hangs

I wanted to publish one of my mobile apps to the Apple App Store via Titanium Studio. The Archive was successfully created by Titanium and launched in XCode, but when I tried to distribute my mobile app to the App Store using the Application Loader, I got stuck on the following screen:


After waiting about 30 minutes, I cancelled the upload and started Googling for solutions. Thanks to this article, I managed to fix the issue by doing the following:

  • In Finder, navigate to “Applications”
  • Right click on and select “Show Package Contents”
  • In the Finder Window that opens, navigate to “Contents/Applications”
  • Right click on “Application” and select “Show Package Contents”
  • In the Finder Window that opens, navigate to “Contents/MaxOS/itms/java/lib”
  • Using a Text Editor (TextEdit / Sublime Text / etc), open
  • Check that http.proxyPort is set to 80 and that it’s unhashed (You can try the same with the https.proxyPort setting if this doesn’t work)
  • Save and Close
  • Restart XCode

ApplicationLoaderHangingAfter restarting XCode all was well with the world again :)

Hope this helps
6 Jun 2014

Possible fix for IDFA Warning when uploading to App Store

Even though I’m not using any Advertising in my mobile app, I receive an IDFA warning from XCode  before submitting my app to the App Store.

XCode Warning

Thanks to this Article on the Appcelerator Developer Forum,  I managed to fix the problem.

How Did I fix it?

Because I’m using the following Facebook Module (version 3.1.1) in my mobile app, the module makes use of the AdSupport Framework, which resulted in my app making use of IDFA.

To fix this, I downloaded and installed version 3.1.2 of the FaceBook Module.

Click here to view my article on how to install Appcelerator Modules if you are unsure of the process.

3 Jun 2014

Appcelerator Tutorial: Install Modules globally for Titanium Studio

One of the great features of Appcelerator Titanium is how you can extend its capability by installing Mobile Modules. Examples of some of these modules are:

  • Ti.Paint (A module that allows you to draw on a canvas within your mobile app…e.g. a user adding a signature)
  • Barcode Scanner (Barcode scanning for your mobile application)

A great place to find many of these modules is the Appcelerator Marketplace. You can also find many other modules on Github as well.

The best news is that it’s become very easy to install a mobile module for your Titanium development environment.

Some key notes about this Tutorial

  • For a detailed reference on how to install modules, click here
  • We will use the In-App Billing Module for this exercise
  • I’m using Android for this example but the same applies to a module developed for iOS
  • Mobile Modules are dependent on the Titanium SDK you are currently using for your mobile app
  • Modules are usually downloaded as zip files

To install a mobile module, do the following

  • Download the In-App Billing Module for Android
  • In Titanium Studio, click on “Help\Install Mobile Module…”


  • Select the Zip file you downloaded
  • Keep the Output Location as “Titanium SDK” (Remember, we want the module to be available throughout Titanium Studio)
  • Click “OK


  • Once the module has been installed, restart Titanium Studio (Just to be sure)
  • Once restarted, navigate to one of your mobile projects
  • Open you mobile app’s tiapp.xml file
  • On the right in the “Modules” section, click on the green plus sign (+)
  • In the list of modules dialog, select ti.inappbilling and click “OK”
  • Save the tiapp.xml file


That’s it. The module has been successfully installed and is available for any of your mobile apps via Titanium Studio. In the near future I’ll provide tutorials on how to make use of some of these modules within your mobile applications.

Till next time, happy coding :)
27 May 2014

Quick fix for a Git Push via Terminal to BlueMix if fatal error occurs


I’m going through a node.js tutorial for BlueMix and got stuck when trying to push some changes to the BlueMix Git Repository via Terminal.

When trying to perform a git push, I got the following timeout error:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from ‘matching’ to ‘simple’.
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

It seems I have an earlier version of Git (version 1.9) than what BlueMix uses. The good news is that it’s a simple configuration change to get things going again.

In Terminal, enter the following command:

git config –global push.default simple

This simple config change will do the job and will allow you to work through the BlueMix tutorial step by step.

P.S. I’m no Git expert so i’m not sure what side-effect the above config change produces, but so far all is still working on my side.

NOTE: After this change, you might need to move back to the git add * step in the node.js Tutorial.

I hope this helps.