The coolest tool that you are not yet using (Xamarin edition)

Have you played with Xamarin Sketches yet?  Sketches was announced at Evolve back in October and is available in Xamarin Studio on OS X.  It gives you a real time coding environment and lets you interactively try code out without having to go through a code/compile/deploy cycle.

I was asked by a co-worker on how to display a glyph in a button on iOS to indicate that a popup list was available.  I wanted to display an upside down caret, a triangle if you will, as part of the caption to a button.   Basically, I wanted the text to look more or less like this

Happy ▼

And thanks to Unicode, we have that symbol available to us.  Before telling my colleague to just slap a character to the end of the button caption, I wanted to test for myself that it would display correctly on an iPhone.

Normally, I would just create a new singleview iPhone project and slap a label on it.  I would then fire up the simulator and see how it looked.   That way works, but today I decided to take a shortcut and try Xamarin Sketches.

Xamarin Sketches lets you type in code and it compiles and runs it as you type.  It provides an isolated sandbox to try out some code and basically fool around before you put that code into a project.

It’s similar to Xcode Playground, except being Xamarin, it does cross-platform.  You can interactively test code for iOS and Android,   You can’t do everything in Sketch, you can’t create classes or use anonymous types.

For what I needed to try, Sketches would work just fine.  I created a new Sketch and set the platform to iOS and the toolkit to UIKit.  It can do Xamarin.Forms, but in this case I wanted to test for Xamarin.iOS code.

I created a string variable with some text and included the unicode escape sequence “\u25BE”.  That is code for something called “BLACK DOWN-POINTING TRIANGLE”.  I then created a UILabel and set the text to my string variable.  That was enough to generate the proof of concept that I needed:

Xamarin Sketches (click the picture to embiggen it)

This code was extremely simple, but it was all I needed to verify that the unicode sequence would work correctly.  I was able to do that and help out a co-worker without getting out of the cod that I was working on.

You can do more complicated things in Sketches.  During the Evolve Keynote, Miguel de Icaza wrote a simple little iOS game in Sketches:

And then did a simple Xamarin.Forms apps: 

This only works with Xamarin Studio on OS X, it’s not available in Xamrin Studio for Windows or with the Visual Studio Plugin.  That’s not really a roadblock for me, if you are doing any iOS work, you pretty much have to have access to a Mac.  If you are doing iOS work with Xamarin, you are missing out on a handy tool if you are not using Sketches.

Taking care of a pet peeve with the Xamarin Build Host

I write code in Windows with Visual Studio, but parts of it compile and debug on OS X.  I’m doing mobile (Android, iOS, and Windows) development with Xamarin and the iOS part needs to be compiled on OS X.  Xamarin provides an app called the Xamarin Build Host that runs on OS X and allows for their tools in Visual Studio to communicate with the tools on OS X.

The hardest part with getting that to work is having the Xamarin plugin in Visual Studio make the connection to the Xamarin Build Host.  Xamarin uses Apple’s Bonjour services to identify remote devices on the network.  It works great when it works.  When it doesn’t work, you can specify the IP address of the OS X box and the plugin will connect to Build Host in that way.

As someone wiser than me once said, “Xamarin needs to display the local IP address(es) on the Xamarin Build Host window “. Bonjour doesn’t work on the corporate network at work.  Between my Windows PC being on an Ethernet connection and my Macbook Pro on Wi-Fi, there are enough disturbances in the Space-Time Continuum to keep Bonjour from reliably letting Visual Studio from seeing my copy of the Xamarin Build Host.  Connecting via IP address is the way I have to set the connection.  Which works, until the IP address changes.

My IP address can change depending on the favor of the Wi-Fi gods.  I wanted a quick way of checking the current IP address of my Macbook.  One of my co-workers suggested using GeekTool.  GeekTool is a utility that can display all sorts of useful information via scripts.

I found a nice IP address script in the github account of Jacob Salmela.  I made some changes to have the color match my current desktop, but it’s mostly based on Jacob’s code.  I have it set that GeekTool will run the script every 10 minutes.  It will display the IP information on the desktop like this:

The SSID is displayed, along with the Wi-Fi and Ethernet IP addresses.  Very handy and gives me the same kind of information that I can get on Windows with the wonderful BGInfo tool from SysInternals.

Getting a new dev machine set up, OS X Style

So I’m on my second Macbook. I use a Macbook Pro for iOS development and I was due for a new one.  I went from a Late 2011 MBP to a late 2014 MBP.  Except now I have a Retina display and a 512 SSD. I’ve gained an HDMI port, but lost the Ethernet port.  I’m still not sure if that was a fair trade.

DailyHaHa.com Funny Pictures

I no longer get laptops or PC’s with spinning rust drives.  The performance benefits of a SSD out weigh the extra cost.  The PCI Express controller is faster than SATA, even with full disk encryption (IT policy).

Now I have to get the tools that I need onto the MBP.  I really don’t have a master list of what needs to be installed so I’m making one here.  I’ll continue to update this blog post as I come across stuff to install for development.

XCode
Even though I do my coding with the .NET stack using Xamarin, I still need to have Xcode installed.  Apple makes the Xcode compilers part of the tool chain.  Plus that’s the only way you get the iOS Simulator.
Where to get it:  Apple OS X App Store

Xcode simulator for iOS 7
A new Xcode install wiill just have the current version of iOS in the simulator.  If you want to test against an older version, you need to install it manually.
Where to get it:  Xcode, preferences, downloads

Xcode command line tools
Xamarin needs to have the command line tools installed. That’s the easiest way to get git and svn installed.
Where to get it:  use Terminal to install Xcode Command Line Tools.

$ xcode-select --install

Google Chrome
I’m not looking to go a Safari Adventure…
Where to get it: http://www.google.com/chrome/

 

Xamarin
We are not animals, why use anything else?  I drank the Xamarin Koolaid 2 years ago and I can’t imagine doing mobile development any other way.
Where to get it: Subscription Downloads

Right after Xamarin has finished installing, update the Android SDK. The Android installer will install the latest bits, but if you want to support previous versions of Android, you’ll want to install those SDKs too.
Where to get it: Xamarin Studion -> Tools -> Open Android SDK Manager

VirtualBox
Both the Xamarin Android Player and Genymotion require VirtualBox. VirtualBox is a free and open source virtual machine environment.  If you install that first, it makes the Genymotion install easier.
Where to get it:  Virtual Box Download Page

Genymotion
Genymotion is a fast Android emulator and supports more versions of Android than any other VM based Android Emulator.  Friends don’t let friends use the Google Android Emulator.  Google’s emulator emulates the CPU on the phone, but pays a performance penalty.  Genmotion (and Xamarin and Microsoft) run a version of Android for x86, which gets you virtual machine performance.
Where to get it:  Get Genymotion

Adobe Creative Cloud
When our graphic designers send me the artwork for our apps, they give it to me in Adobe Illustrator format.  From the AI files, I can script the rendering the images through Photoshop for all of the iOS and Android sizes that I need.
Where to get it:  Adobe CC

Alternatives to Adobe CC:  GIMP is a very powerful image editor.  An open source project, GIMP is available on many plaforms.  If I didn’t have an Adobe CC subscription, GIMP would be my tool of choice.  Inkscape is another open source tool, but for vector image editing.  Inkscape has the ability to export to XAML, so you have the ability to use resolution independent images on the Windows platforms,  Android 5 supports SVG for vector images and there is the svg-android library for older versions of Android.  Which brings us to…

PaintCode
PaintCode is an OS X app that will take SVG files and generate iOS drawing code in Objective-C, Swift, or Xamarin C#.  With the image as drawing code, you can manipulate it at runtime, it’s no longer a static image, but one that you can edit via.

VMware Fusion
I run Windows on my Macbook Pro.  When I want to carry just one machine and compile for iOS and Windows Phone, this is the simplest solution for me.  A cool thing with Fusion is that it supports Hyper-V, I can run the Windows Phone emulator in a Fusion session.
Where to get it: VMware Fusion

Air Server
When I want to demo an actual iOS device and be able to display on my Macbook, I use AirServer.  AirServer is an AirPlay receiver for OS X (and Windows). This works great for demos and for sharing with WbeEx or GotoMeeting.  The only caveat is that it uses the same port as the Xamarin Build Host.  The Xamarin Build Host is the app that lets Visual Studio on Window access the Xamarin and Xcode build tools on the Mac.
Where to get it: Airserver Download page

AirServer uses a bunch of ports, 5000 is used for audio and causes the conflict with Xamarin.  To change the audio port used by AirServer, open up Terminal and run the following command:

defaults write com.pratikkumar.airserver-mac com.airserver.raopPort 5010

Paragon NTFS for OS X
Out of the box, OS X can read NTFS but it can’t write to it.  If you have a large capacity USB drive, it’s going to be formatted with NTFS.  Paragon makes a stable and cheap NTFS driver for OS X.
Where to get it: NTFS for Mac

Sublime Text
Sublime is a very nice text editor that is available for multiple platforms.  I like being able to use the same tools on Windows and OS X where possible.  It makes for less things to learn and remember so you can concentrate on getting stuff done.
Where to get it:  Sublime Text Download page

Balsamiq Mockups
Balsamiq is a great tool for doing wireframe mockups.  When doing quick designs, wireframe mockups let you walk do the basic design and flow, without getting distracted by pixel placement.  This is a other one of the multi-platform tools.
Where to get it:  Balsamiq download page

Adium
Adium is a free instant messaging application for OS X that supports multiple chat platforms.  When I want to IM a co-worker, I use whatever platform that they prefer, AIM, Yahoo, Google, Facebook, etc.  Using Adium lets me deal with just one app.
Where to get it: Adium.im

RDP
Right now I’m using the Microsoft Remote Desktop app for OS X.  I used to use CoRD, but Microsoft Remote Desktop looks like it’s more up to date and I’ll stick with it.  I don’t RDP to Windows from OS X that much, the MS one should be enough.  Also CoRD doesn’t appear to support Mavericks or Yosemite.
Where to get it: Apple OS X App Store

Db Browser for SQLite
This is an open source, cross platform tool for working with SQLite databases.  When writing code that writes to a SQLite database, an external database browser can help validate that you are writing the right data.
Where to get it:  Github

When you use the iOS Simulator, you can access files from the simulator image with Finder.  The location will vary, depending on the version of Xcode used.  This Stack Overflow post is a good starting point.

Objective Sharpie
This is a tool that Xamarin developed for building binding libraries for Objective-C libraries.  It’s not the easiest tool to use, but it greatly cuts down the amount of work needed to created a Xamarin C# binding to an Objective-C library.
Where to get it: Objective Sharpie

OneDrive
I use OneDrive.  A lot.  Most of the documents that I work on, I tend to put into OneDrive.  It just makes it easy to not care from which machine that I used to last edit the document.  I have some PhotoShop scripts for generating different sized icons from a single source file.  I keep it in the cloud so I can use it where ever I have Adobe PhotoShop installed.  From a synching perspective, DropBox is probably a better choice, OneDrive is backed into everything else that I use so I’ll stay with it.
Where to get it: Apple OS X App Store

Snagit
TechSmith makes the best screenshot capture tool period.  I use this more often that I would have expected to.  Also falls into the category of being available for OS X and Windows.
Where to get it: TechSmith

Android File Transfer
I had to move some large files from the old MBP to the new MBP and I left my thumb drives at home.  So I used my Nexus tablet as a large, awkward thumb drive.  With Windows, you can just use the tablet as a drive, with a Mac you need the Android File Transfer app.  When you run the app it will display the file system of the connected Android device in a Finder-like window.  You can drag and drop files between the Mac and the Android.
Where to get it: Android.com

Spectacle
I have an external monitor on the Mac and I was amazed that OS X does not include any keyboard shortcuts for resizing windows, docking to screen edges, or moving windows to other displays.  Unless you use both OS X and Windows on a day to day basis, you don’t realize how Windows has passed OS X in many areas for UX.  So I installed Spectacle, an open source app for OS X that provides the keyboard shortcuts for moving windows around.  This should be built into the OS.
Where to get it: spectacleapp.com
Bonus round: Get the cheatsheet from a StackExchange post.

Microsoft Lync
We use Lync as our corporate IM and it’s handy to be able to use from the Mac.  There is an OS X Lync app, but I prefer to use the web application.  It requires a browser plugin, but it more or less works.
Where to get it: Lync Web App

Disk Inventory X
This is the Mac equivalent to WinDirStart. It’s a disk utility app that shows file and folder usage.
Where to get it: Lync Web App

iStat Menus
This app adds an incredible amount of information to your menubar.  From motherboard sensors, world clocks, CPU & drive usage rates, and detailed network information, there is more stuff than you would use.  It’s pretty cheap and is updated often.   When I’m trying to connect the Xamarin plugin in Visual Studio to the Xamarin Build Host, I often have to do it by IP address.  My Macbook’s IP address changes a lot at work, and gives me a fast way to see the Wi-Fi IP address.
Where to get it: bjango.com
B
onus round: Found about it via Nat Friedman‘s newsletter

After I get the tools installed, the next thing is to get Time Machine set up.   I have an external 2TB USB 3 drive that I use for backing up the Macbook Pro.  Time Machine is one of those OS X features that you can set and forget, it just works.  The hard drive crashed on my previous MacBook Pro, I was able to completely recover my stuff from the Time Machine backup.