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

27 May 2014
0

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

bluemix

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.
John
23 May 2014
0

BlueMix Tip: Fix error when installing Cloud Foundry CLI via HomeBrew

In this article I quickly show you how to sort out a Formula error that could occur when trying to install Cloud Foundry CLI via HomeBrew for IBM BlueMix.

My Machine Specs

  • Apple MacBook Pro: Max OS X 10.8.5
  • HomeBrew 0.9.4

The Problem

I tried to run the HomeBrew command line to install Cloud Foundry CLI…

brew install cloudfoundry-cli

…but received the following error:

Error: No available formula for cloudfoundry-cli

Why did this happen?

It’s simple. My version of HomeBrew was 0.9.4 and Cloud Foundry requires 0.9.5 (I typed in brew -v to check the version).

To fix this, do the following:

  • Open Terminal
  • Clean and remove current version of HomeBrew by running the following command:

rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

  • Install latest version of HomeBrew by running the following command:

ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”

  • Install Cloud Foundry CLI:

brew install cloudfoundry-cli

Simple as that. You can check the version of Cloud Foundry CLI by typing cf -v in Terminal.

Quick Note

To avoid the above-mentioned fuss, you can also download Cloud Foundry CLI directly by clicking here.

Happy Coding :)
John
22 May 2014
0

Appcelerator Titanium Fix for – dyld: Library not loaded

It seems that after upgrading XCode to version 5.1.1 on my Mac, my iPad Simulator through Appcelerator Titanium no longer works and receives the following error:

Screen Shot 2014-05-20 at 12.27.27 PM

My Specs are the following:

Apple Mountain Lion: 10.8.5
Titanium Studio: 3.2.3
XCode: 5.1.1
Mobile Application: 3.1.2GA SDK (iPad Only)

After some online searching and troubleshooting, I found the following JIRA Ticket that suggests using the “ios-sim” file from the “3.2.2 SDK” in your “3.1.2 SDK”. I tested it and it works.

To apply this fix on your side, do the following:
  • Quit Titanium Studio
  • In Finder, navigate to “Users/{Username}/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/iphone”
  • Copy the “ios-sim” executable
  • In Finder, navigate to “Users/{Username}/Library/Application Support/Titanium/mobilesdk/osx/3.1.2.GA/iphone”
  • Rename the current “ios-sim” executable in this folder (Just in case)
  • Paste the “ios-sim” file you copied
  • Start up Titanium Studio and Test again

I hope this Helps

19 May 2014
0

Quick Tip: Lessen your JavaScript code with 1 liner IF Statements

Not many people know this, but for simple JavaScript “If” Statements, there’s a Syntax that allows you to write out the entire condition on one line.

Let’s take a quick If Statement and type it out the most common way:

1
2
3
4
5
6
7
8
var whatAreMondays = "";
var areMondaysBlue = false;
 
if(areMondaysBlue){
   whatAreMondays = 'Blue';
}else{
   whatAreMondays = 'Awesome';
}

Behold…the 1 liner Syntax:

variable = (condition) ? 'value if TRUE' : 'value if FALSE';

By using a question mark and a colon, we can convert the above If Statement to the following:

1
2
3
4
var whatAreMondays = "";
var areMondaysBlue = false;
 
whatAreMondays = (areMondaysBlue) ? 'Blue' : 'Awesome';

Simple, but effective :)

15 Apr 2014
0

Install previous versions of iOS SDK in your current version of Xcode

In some cases, one might be developing for iOS6 and therefore require the iOS6.1 SDK. Xcode 5 however, no longer has the iOS6.1 SDK installed. In this article I’ll show you how to install the iOS6.1 SDK in your current version of Xcode.

Download Xcode 4.6.3 to get the iOS6.1 SDK and Simulator

  • Make sure Xcode is closed. If you are using Appcelerator Titanium, make sure that’s closed as well.
  • Go to Apple’s Developer Center
  • Log into iOS Dev Center (You will need an Apple Developer License for this)
  • Under Downloads, where it currently shows Xcode 5, Click on “Go to older versions of XCode
  • Let’s say you want the latest iOS6 SDK, that would be XCode 4.6.3. Search for it in the list and download the full Xcode package (about 1.6GB)

xcode463

Install the iOS6.1 SDK and Simulator

  • Once downloaded, double click on the “xxx.dmg” file.
  • Right click on Xcode.app and select “Show Package Contents
  • Navigate to “Contents\Developer\Platforms“.

- When in the Platforms folder, to copy over the iOS 6.1 SDK:

  • In “iPhoneOS.platform\Developer\SDKs”, copy the folder “iPhoneOS6.1.sdk”.
  • In your Finder Window, go to “Applications”.
  • Right click on Xcode.app and select “Show Package Contents”
  • Navigate to “Contents\Developer\Platforms\iPhoneOS.platform\Developer\SDKs”.
  • Paste the “iPhoneOS6.1.sdk” folder.

- When in the Platforms folder, to copy over the iOS 6.1 Simulator:

  • In “iPhoneSimulator.platform\Developer\SDKs”, copy the folder “iPhoneSimulator6.1.sdk”.
  • In your Finder Window, go to “Applications”.
  • Right click on Xcode.app and select “Show Package Contents”
  • Navigate to “Contents\Developer\Platforms\iPhoneSimulator.platform\Developer\SDKs”.
  • Paste the “iPhoneSimulator6.1.sdk” folder.

 Conclusion

That’s it. You can now use iOS6.1 SDK and Simulator as well as whatever current SDK and simulator you had installed.

Till next time, enjoy :)
John