A little late to the Band Party

My Band with some decoration for the upcoming US MVP Open Days

My Microsoft Band arrived last week. I had first tried one out last November at a Microsoft Store and it felt like a handcuff. It turned out I was indeed holding it wrong. I put it on with the face on the top of my wrist, but it’s really designed so that the face of the band is on the inside of the wrist. When I wear as an “innie”, I don’t really notice that I’m wearing anything.

At work, I check the number of steps that it was recorded.  It’s a motivational tool for me to get up and walk around the office.  I hate running, but I’m looking forward to riding my bike in warmer weather and having it record my rides.

The other thing that I am looking forward to doing is to write some apps that will work with the Band.  Microsoft has released a preview version of an SDK that will let you write apps on Windows Phone, Android, and even iOS that can read the sensors on the Band and send notifications back to the band.  Xamarin has already released a Xamarin port of that SDK for iOS and Android.

Right now the SDK is limited to apps that running in the foreground, it does not yet support accessing the Band from a background app process.  That will initially limit the types of 3rd party apps that can be written for the Band.  But I’m confident that will be addressed in a later release.

I was able to use a custom background image and send it to the Band with the app Pimp My Band.  I’ll be attending the first US MVP Open Days later this week and it makes for a nice touch to show the MVP logo.

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

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

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.

Ignite your IT and Enterprise Dev skills this May

Get ready for a glimpse at what’s possible today and in the future

Consolidating the various IT and Enterprise developer conferences, Microsoft Ignite will be in Chicago this May.  Microsoft Ignite kicks off with pre-conference sessions on Sunday, May 3, and concludes the afternoon of Friday, May 8.

This is a new conference and is aimed at IT professionals and enterprise developers looking to learn about new and existing technologies and network with the best in the business.  Ignite replaces TechEd and other IT/Enterprise related conferences.

Microsoft CEO Satya Nadella

Microsoft CEO Satya Nadella will be the key note speaker and will be joined by other Microsoft leaders.  Brad Anderson, Joe Belfiore, Julie Larsen-Green, and Mark Russinovich are just some of the Microsoft executives that will be appearing at Ignite.

With over 270 sessions, there are topics to interest both IT and developers.  The topics cover Microsoft technology from A to V.

The conference will be held at the McCormick Place Convention Center, near downtown Chicago.  Registration is already open and if you are planning on attending, sign up now to get a good hotel close to McCormick Place.

On February 3rd at 9am (PT), join the Ignite team for #IgniteJam on Twitter.  The Ignite Team and conference speakers will be online to answer your questions.  To participate in this #IgniteJam

  1. Log in to Twitter at 9:00 AM PT on February 3rd. For easier real-time participation, use Twubs and join the Ignite Team at: http://twubs.com/ignitejam.
  2. Introduce yourself and include the hashtag #ignitejam and tag the Ignite Team at @MS_Ignite.
  3. Watch for questions coming from @MS_Ignite and chime in with your answers and commentary, using the hashtag #ignitejam.

You can find Ignite on Twitter, Facebook, Instagram, and for some odd reason, Google+.

Quick work around for unresolved Xamarin components in Visual Studio

Have you ever had an unresolved component when  using the Xamarin plugin win Visual Studio?  You add a component from the Xamarin Component Store and after you installed it, it comes up as unresolved.

There is a path limitation that causes this error.  The components come packaged in a zip file with files inside folders.  When this length of the file paths in the zip file are factored in with the path length of your project, it can exceed Windows limits when the component is being added.

This only seems to be a factor when the component is being added.  Once the component has been added to the project, the path length is well within what Windows allows.  It also appears to be a Windows only issue, Xamarin Studio on OS X does not have this issue.

The way around this is to have your project on a shorter path.  There are a couple of ways of doing this.  The obvious way is to move your solution to a shorter path.  That’s annoying, especially if your code is already mapped a source control system that is expecting the files to be in the original path.

Another way around it is to make the path shorter via a directory junction. A directory junction is like a symbolic link, but is easier to get rid of when you are done with it.  You create a link with a shorter path to the original path and then reopen the solution using the shorter path.  You add the component, it will install cleanly now because the path length is no longer an issue.

Your code is still in the original location.  You didn’t move it, you just created an alias to that location and that aliased location looks and feels like a real path.  Once you have added the component, you can either leave the link or remove it.

You can add the link from the command, or you can install a shell extension and do it from Windows Explorer.  I’m a command line kind of guy so I prefer to do it that way with the mklink command.

Open up a command prompt shell with admin access (Run as Administrator).  Once you have an admin shell, use the following syntax:

mklink /j new-path original-path

For example, to create a shorter path c:\source\xamarin\myapp and have the new path named c:\x, do the following

mklink /j c:\x c:\source\xamarin\myapp

Now you can open your solution from the c:\x folder.

To get rid of a directory junction, just use the rmdir (rd) command.  To get rid of c:\x, you would execute the following:

rd x

That removes the directory junction, but does not touch the original location.

Looking back on Xamarin Evolve 2014

Xamarin’s Evolve 2014 conference was a great experience.  I attended it last week in Atlanta and while you see a lot of the cool new features from the live stream, the personal interactions made attending much more valuable.

Xamarin is much more focused on the enterprise customer.  They have picked up a bunch of new partners (Microsoft, IBM, etc) and companies like Amazon are focusing on Xamarin developers.  The 3rd party component vendors are coming out with component packs for Xamarin.Forms.  If your app needs a charting control, you have a wide range of commercial products to choose from now.

Xamarin.Forms has become a huge hit with developers.  Many of the training and conference sessions were focused on Xamarin.Forms.  If you are looking at Cordova for cross-platform projects, you should take a closer look at Xamarin.Forms.

A big reason to attend conferences like Evolve is to meet and share experiences with other developers and Xamarin staff.  Xamarin does a  really good job of having their people mingle with the users. Many of them were Xamarin users before becoming hired so they have a good understanding of what it’s like to use their software.

Keynote Highlights

Xamarin Android Player

During the keynote, Miguel de Icaza launched the Google Android Emulator.   While it was loading, he went on a long and funny rant about how it was.   At the end of the rant, he presented the Xamarin Android Player, their own emulator that uses hardware virtualization to run as fast (or faster) as an actual Android device.

Xamarin Android Player on OS X
Xamarin Android Player on OS X

The Android Player is similar to the Genymotion Player, and on Windows they both use Oracle’s VirtualBox virtualization product to host the Android images.  If you have used Genymotion, then this will feel familiar.  While everyone uses the personal license for Genymotion, it does require a paid license for commercial use. The Android Player will be free to Xamarin customers.

Android Player is a developer preview release and only has a couple of Android images currently available: Nexus 4 with KitKat and Nexus 5 with Jellybean.  It’s not clear on how you would add Google Play support, that is not in the downloadable images.  If you do anything

Xamarin.Insights
James Montemagno and Nat Friedman with Xamarin Insights

Introduced Xamarin.Insights, which provide real-time monitoring for Xamarin Apps. You can record every crash that happens and access that data from an online dashboard.  Users can opt in to share their contact information.  This gives you the ability to contact users to let them know when a bug that affected them has been fixed. From their blog:

You can add Insights into your application with just a single line of code. Insights will gather and report any uncaught native or managed exceptions. In addition, you will be able to track both past and active sessions, with full access to device statistics such as operating system and screen resolution. If you want a deeper level of control, you can simply “report” any caught exception, along with any additional data that will help you diagnose the issue, using Insights’ simple API.

Xamarin Profiler

Also in beta is the new Xamarin Profiler for iOS and Android.  The Xamarin Profiler will track memory and performance.  It will show you where in the code your application is spending the most amount of time and how much memory is being used over time.  The profiler will work with both Xamarin Studio and with Visual Studio.  This makes for a nice addition to the developers toolkit.

Xamarin Sketches
Xamarin CTO Miguel de Icaza using Sketches

Now you have the ability to play with the code in real time with Xamarin Sketches.  You can write code and see it execute as you write it.  It’s a handy way to test some snippets of code without having to go through the entire build cycle.  It’s kind of like LINQPad for, but works with OS X, iOS, and Android UI elements.

Xamarin.UITest

Based on the Calabash technology that is in Xamarin Test Cloud, we can now unit the UI with Xamarin.UITest,  You can write up test scripts in C# to simulate the user pressing buttons and entering text into the application.  UITest provides a REPL interface to allow you to interactively query the UI. This is useful for determining the name of the controls to reference in your scripts.

You can run the scripts locally and deploy them to test cloud.  UITest with Nunit allows the developer to set up unit tests for the UI and for the code behind the UI.

Xamarin Insights
Xamarin CTO Miguel de Icaza demoing the new profile

We now have the ability to add real time monitoring of our apps via Xamarin Insights.  You can record every crash that happens and access that data from an online dashboard.  Users can opt in to share their contact information.  That gives you the ability to contact users to let them know when a bug that affected them has been fixed.

And we also learned the proper pronunciation of “PCL” and “nuget”, courtesy of Miguel de Icaza:

It's pronounced as Pickles and Newjay
Xamarin CTO Miguel de Icaza during the Evolve Keynote

And then they added Xamarin support to the Multilingual App Toolkit

As of 6am EDT today, Microsoft’s Multilingual App Toolkit officially supports Xamarin for making it easy to manage language translations in mobile apps. Originally designed for Windows Store apps, the Multilingual App Toolkit (which I’m just going to call MAT) allows you to add new language resources and generate RESX files to compile into your app. It uses the XLIFF format for storing the translated resources and can import, export, and even machine translate your native text into other languages.

XLIFF stands for Xml Language Interchange File Format and is an industry standard file format that language translation companies can use to translate your text. XLIFF has some rudimentary workflow features that you track when a new text string has been added, or translated, or approved.

Prior to version 4, MAT only knew how to generate RESX files. That’s fine for Windows apps, but Android and iOS have their own formats. Android uses XML files in the folders for each language or local. The format is similar to the RESX format. For iOS, they store the string resources in text files, as key value pairs.

Last fall, I played around with that version and used T4 templates to render Android and iOS native resource files from the Windows RESX files. The MAT team decided to add that capability into MAT and improve on it. You can now add MAT support directly to Xamarin.Android and Xamarin.iOS projects. If you enable MAT support for Android, you can right on an Android project and add new languages to the project. They will be XLIFF files and will generate Android strings.xml files for each language.

Microsoft’s Cameron Lerum has been working on MAT and has brought it with him to Xamarin’s Evolve conference. I’ve had early access to beta builds of MAT 4 and it works much better than my mess of T4 scripts.

Microsoft’s Cameron Lerum demoing the Multilingual App Toolkit with Xamarin.iOS for Xamarin CTO Miguel de Icaza

The latest thing from Xamarin has been Xamarin.Forms, which allows you to write common UI code for Android, iOS, and Windows Phone. MAT v4 works just fine with it. Put your string resources in a RESX file and put that file in a shared library. Then you can access the compiled resource strings from both the code behind and in the XAML markup. You’ll need to add an IMarkupExtension to your project, but that will give you databinding to the localized string resources.

To find out more about the new version of the Multilingual App Toolkit, Cameron just posted an article on it on the MAT blog.  If you are attending the Xamarin Evolve conference this week, look for Cameron or myself and we can demo the new version.  If you are in Atlanta on this Saturday, the 11th, I will be doing a presentation at the Atlanta Code Camp that will feature how to use MAT to add localization support to native mobile apps.

Booked my flight for the MVP Summit in November

I finally got around to booking my flights to the MVP Summit in November. Getting a rental car this time, one of my co-workers will be the same flight and we can skip the taxi/shuttle/uber rides and do possibly see a little more of Seattle this time around.

Just got a nice bump in speed from Verizon FiOS

This morning I received an email from Verizon FiOS informing me that my upload speeds are now as fast as my download speeds.  I currently have the 50 Mbps download, 25 Mbps upload package.  I just checked with Ookla’s speedtest.net and my current speed is now 58/63.

Current Internet speed from my home
Current Internet speed from my home

For once, my upload speed is actually faster than the download speed.  One thing about FiOS, my connection speeds are almost always higher than what I am rated for.  I was a loyal Time Warner customer for years, but my upload speed was awful and the download/upload speeds approached, but never reached the speeds that I was paying for.

A work in progress

%d bloggers like this: