Friday, May 24, 2013

Certified Xamarin Mobile Developer

I just received the email notification from Xamarin that I successfully passed their Mobile Developer certification exam. I was given a free pass for the exam for attending the Xamarin Evolve Developer conference back in April.

It was a tough exam, it went pretty deep on some of the internals and covered a lot of iOS and Android territory. Passing grade was 50% correct of 100 questions. I hit 90% and the exam software showed me what the correct answers were for what I got wrong. Does it make me a better developer? No, but it shows that I have the knowledge and skill set to create iOS and Android apps using C# with Xamarin technology.

More importantly, I am using the skills that I learned at Evolve while I work on a new app for work.  I really like how Xamarin had put together the training materials for sessions. Instead of the usual slide deck and sample code that you get a conference training session, Xamarin provided chapters of an training manual that covered each session. Plus the source code. You still get the source code.

Yesterday, I went from zero experience with SQLite to being able to create, populate, and use a SQLite database with the sqlite-net ORM code in just a couple of hours. My only reference was the materials from the Evolve session on cross platform data handling. It's been hugely productive to be able to use C# and the .NET Framework on the mobile side as well as the server side.
As a side note, the SQLite Database Browser is great open source tool for checking the contents of a database created in the iPhone/iPad simulator. It's also useful testing SQL queries before you compile them into your code.
Evolve had two parallel training tracks going on at the same time. I was taking the Fundamentals track to make sure that I had the foundation of Xamarin coding down. Now I can review the Advance training materials and move up to the next level.

Wednesday, May 15, 2013

There should be a Blue Rhino for Electric Cars

What if the car companies came together and come up with a standard for replaceable electric car batteries?  It takes hours to charge an electric car battery.  That just pretty much limits the use of an all electric car to local use for small amounts of time. It also limits the number of vehicles that could be charged at any time.

I’m starting to see charging stations around here where you can let your car charge up during the day.  But it doesn’t help if you do errands all day and you are not parked in any single location.  At some point, you’ll have to call it day and head home to your own charging station.

What if you could get around the charging period by using swappable batteries? You could go a gas station and they would swap out your depleted battery with one with a full charge.  It would be like the “Blue Rhino” model for swapping gas grill tanks.  That’s where you bring your propane tank in the hardware store, the grocery store, etc.  And they give you a different one already filled.  You are in and out in a few minutes and the store can service many more customers at peak times.  The Blue Rhino people come in and swap the tanks with fresh ones.  It’s a good model and works pretty well.

For electric car batteries, this is not a trivial problem to solve.  The biggest one is that every car has a different layout for their batteries and they are not designed to be swappable.  This would require major design changes for the car companies.  Plus you would have to have the infrastructure to support a network of batteries.  There would have to be away to easily remove the exiting battery pack and attach the new one.  The filling stations could recharge the batteries overnight when the rates are lower. 

If the car companies could come to a standard for the charging port (which avoided the betamaxing of the electric car market), they could come up with a standard battery pack. You could have a mix of replaceable batteries, plus a fixed set that was optimized for that car. You don’t need to have a full set of batteries to be swapped, just one large enough to go 50 miles or so. That would make it easier for car designers. They can design a rack that provides easy access via the trunk or a car, but have the rest of the car to place the other batteries.

There should be a smart network for locating battery packs.  When your battery is low, the car could check for the closest filling station or car dealership that had full batteries in stock.  This would take some of the fear out of running out of battery power while you are out and about.  You have a smart phone app or web page show the closest station, or just add a 3G/4G radio to the car.

Someone should design a smart rack for the battery packs.  This rack could charge all the battery packs, eliminating the need for someone to swap charging cables.  It could also report it’s status and location to the smart battery network in real time.  When your car told you that fresh batteries where at the Mobil station 2 miles down the road, that information would be current and accurate.  You could also bring fresh smart racks to locations that were running low during a busy day.

This also helps with another issue that electric car owners deal with: rechargeable battery packs have a finite life span. Lithium Ion batteries typically last 3 years. By swapping batteries out, you are not stuck with a battery that’s at the end of it’s life cycle. You can have government subsidize the cost of replacement batteries or factor it in as part of the cost when you swap the batteries. Either way, you avoid financial hit at the 3 year mark.

If we could do this, I think we would see more electric cars on the road.

Monday, May 13, 2013

I git it now

Sharing code across OS X and Windows was a bit more challenging than what I had expected. We have our own TFS servers, but Xamarin Studio on the Mac really can't do much with them. XS does support git, so I have been using a local repository on the Macbook to version control the source code.  I needed to have that source backed up in a sane mannor.

Local TFS servers do not support git (yet). So to get the git repo into TFS, I need a transfer station of sorts. My other work development box is a Windows 7 machine with access to our TFS server. The fun part is getting the code from OS X to Windows without having to do a bulk copy each time.

The first thing I looked at was gitstack. Gitstack is git server that you can use to push your local repo up to. I spent a few hours, but I could not get the Macbook to push the repo up to it. I'm sure it works somehow, but my basic ignorance of how git works is probably a factor. I don't want to have to think to use version control. Tools should not get in the way of the development process.

While local TFS doesn't support git, TFS in the cloud does. I went in and created an account. I then created a new project by clicking the "New Team Project +Git" button. This will bring up a dialog that will let you create a new tem project and specify git as the version control.

By default TFS uses a Windows Live account for credentials. You can add a secondary set of credentials so that you can pass in a user name/ password to authenticate. I found it non-intuitive to find that option a second time. Follow these steps to create (or edit) a second set of credentials for your account

  1. Login into your TFS account.
  2. In the upper right corner of the screen, you will see a gear icon. Click that gear to go to the control panel
  3. In the upper right corner of the screen, you will see your name or email address and a drop down chevron. Click the chevron and select "My Profile" when the dialog opens up.
  4. The "User Profile" dialog will appear. You can change your avatar and display name here.
  5. Click on the link labeled "CREDENTIALS". This will switch to the Alternate Credentials tab on the dialog.
  6. Now you can enter in the secondary credentials. The user name must be alpha numeric only, you can't use an email address.
  7. Click "Save Changes" to save the new credentials.

Now you can use those new credentials when pushing or pulling changes from git. On the Mac, you store those credentials in the OSX keychain so that you will not be prompted each time. I found that the osxkeychain helper that was installed with the OSX version of git to be completely broken. I manually installed a newer copy based on the instructions posted here.

On the OS X side, I had installed git and it was on the search path. I opened up Terminal and in my source code folder, I used git to clone the TFS repo using the following syntax:

git clone https://myteamname.visualstudio.com/DefaultCollection/_git/myproject

This created the folder for the project with all of the git bindings. From within Xamarin Studio, I was able to perform local commits and that worked just fine. I tried to do a push from within Xamarin, but it failed because I had different local git credentials than I did for TFS. I could not find anyway from with Xamarin Studio to specify the git credentials. I've posted a question about that in the Xamarin forums, I'm hoping it's something simple.

But I can push and fetch from the command line, so I just created a bash script file and I run that to synch with the remote report. There are some OS X GUI clients for git, Harry Wolff reviewed some of them here. Right now, I'm going to stick to the command line until I grok git. At the end of the day, I have what I wanted: a local git repo on the dev boxes, with a master repo in the cloud.

Thursday, May 09, 2013

Getting Hyper-V to work on a HP Envy23


I finally got Hyper-V working on our HP Envy 23.  For Christmas, I had bought a new PC for our family.  We have a shared PC in a our family room that everyone uses for email, browsing, etc.  At the time I was working on a Windows Phone 8 project and I needed a machine that could handle that development.  My own PC was running Windows 7 and you need Windows 8 or better for Windows Phone development.

Actually, you need better than Windows 8 for effective Windows Phone development.  To run the Windows Phone 8 emulator, you need to have Hyper-V installed, which requires Windows 8 Professional and a machine with the virtualization enabled in the chipset.

We wanted an all-in-one PC.  It’s in a shared family space and a AIO will take up less room and generally look nicer.  Dell had some interesting models, but you couldn’t get one with Windows 8 Pro, just Windows 8.

With HP, you could get a machine with Windows 8 Pro.  So I ordered an Envy 23 with an i5, 6GB of RAM, and Windows 8 Pro.  It is a nice machine with a good 23” touchscreen.  We went from a huge mess of power cables, USB cables, and assorted wires, down to just a power cable and an Ethernet cable.

HP Envy 23

As a side note, while this machine has decent WiFi built in.  I prefer that ancient Ethernet technology.  Our house has so many devices using WiFi, anything networkable that's not mobile goes on Ethernet.  I had a few rooms wired for CAT-5e years ago and I use Powerline adapters where the cables don't reach.

As typical of a new PC designed for home use, hardware virtualization was not enabled out of the box. I had to go into the BIOS screen and after a bit of searching, I found the virtualization setting under "Security".  I don't know why they put it there, but that's where it was.  So I turned it on and booted up into Windows.  Since Hyper-V is not typically installed on a new machine, I had to install it.  Pretty easy to do and took less time than trying to find the virtualization setting in the BIOS.

I rebooted the PC and it hung on the loading Windows screen.  Turned off the virtualization setting and it rebooted just fine.  Tried uninstalling and reinstalling Hyper-V, didn't fix it.  After trying multiple combinations, it was obvious that virtualization and Hyper-V didn't work.  I called HP support and they said that Hyper-V was supported on this hardware and that either I had installed something that conflicted with Hyper-V or I had a hardware fault.

I didn't agree with either assessment, but I had to follow along with HP's support.  When I bought the machine, I had bought 3 years of priority support.  I usually don't bother with extended support, but it was the cheapest way to buy this machine.  They shipped out a new machine and a week later it arrived.  Fired up the new machine and enabled Hyper-V and virtualization.  Same problem.  That both ruled out a machine specific hardware fault and ruled out the installation of another app being the root cause.

At this point, I just wrote off the problem and sent back the new machine.  Other than the Hyper-V problem, the rest of my family was very happy with the Envy 23.  I ended up building a new machine from scratch that happily runs Hyper-V, so I no longer had the pressing need for Hyper-V on the this machine.

But not being able to run Hyper-V on a machine with the CPU and OS that clearly support virtualization bugged me.  Last night, I did a quick search on "Envy23" and "Hyper-V" and saw a few hits.  I was not the only one with this problem.  The first match was on "Enabling Hyper-V and restarting results in a hung system...".  It was posted by another developer with a similar Envy 23 machine and was seeing the same problem.

Someone had responded to that message that he had fixed the same problem on his HP laptop by updating the Bluetooth adapter's driver.  He had included a link to another message thread in a HP forum with details about the version and where to get the file.

The problem seemed to be with the Ralink Bluetooth 4.0 Adapter.  Various people had version 9.2.10.6 of the driver installed.  When they installed to version 9.2.10.10, the problem went away.  That sounded like an option worth pursuing.

So I decided to roll the polyhedral dice and try installing that driver.  Now normally, I'm not a fan of installing hardware drivers unless I know that they are specifically for the hardware that I own.  It's a commodity part and most likely uses a driver for a family of related parts. Also, I back up my machines to a Windows Home Server box.  The worst thing that happens is that I hose the machine and have to do a bare metal restore.

I downloaded the driver and starting installing it. As part of the install, it uninstalled the previous version and I had an "uh oh" moment.  My mouse and keyboard connect over Bluetooth, updating the driver could affect them.  Fortunately, they worked through the process.  After installing the update, I rebooted the PC and everything seemed to work just fine.  The mouse and keyboard still did mouse and keyboardy things, so I knew that Bluetooth was still operational.

I rebooted one more time and enabled virtualization in the BIOS and booted up the machine.  This was the moment of truth.  The PC booted up normally and I was able to verify that Hyper-V was installed and functioning normally.

So, that brings us back to why it failed with the original driver installed.  I don't know why a Bluetooth driver would hose the operating system when Hyper-V was enabled.  That is so random, it's not something that I would have considered as a the root cause.  From reading the messages on the HP forum, it looks like someone had reinstalled the OS and had needed to download the Bluetooth driver.  When they installed the latest version available, they were able to boot with Hyper-V and made the connection that the Ralink driver was the root cause.

Monday, May 06, 2013

My journey into the Center of Gravity

Last Friday I was given a tour of the Center of Gravity (COG).  What exactly (and where exactly) is the Center of Gravity?  It’s full name is the Tech Valley Center of Gravity and it is a community of technical and artistic creators, makers if you will.  They have a permanent makerspace in downtown Troy, NY and their grand opening is today.

I was lucky enough to get a tour on Friday from one of directors of board at COG, Laban Coblentz.  While their location is new, they have managed to collect a fair of equipment already. There is a lot equipment that can be used now.  From old time drill presses to laser cutters, from soldering stations to a bio lab. They are off to a good start.

 

You can sign up for free as an associate member, that will get you a membership card and the opportunity to purchase day passes to access the equipment in their makerspace.  If you plan on doing a lot of building and tinkering, then you’ll want to step up a full membership at $60/month) or “Super User” at $100/month.  The paid membership gives you full access to the makerspace and includes safety training.

If you need to fabricate some one off parts for a project, they have a couple of 3D printers.  In a couple of years, you’ll be able to buy one a Walmart, but right now it’s hard to get access to one around here.  When I did my robotics project last fall, I could have used a 3D printer to make the mounting pieces.

For additional pictures of the COG, the All Over Albany blog posted a large set on their site.