My Takeaway from Reading Meatball Sundae

Meatball Sundae CoverBook: Meatball Sundae: Is Your Marketing out of Sync?
Author: Seth Godin

My takeaway from Meatball Sundae is don’t use a new marketing trend because it’s the hip new thing to do.  Make sure the marketing you do aligns with your business.  If the new marketing you does not align either change your business or don’t bother with the new marketing.

The book was written in 2007 and focuses mostly on marketing using the web but the basic idea applies to any new marketing technology.  Just because others companies use dream ads doesn’t mean you need too.

For me personally it means I should understand the social media platforms I use.  My Twitter, Facebook, and LinkedIn post mostly links back to this blog.  Is that the best way to use these platforms?  Probably not.

For October I’ll focus on Twitter and see if I can figure out if it aligns with my basement based business.  Do I need to change my business, change how I use Twitter, or give up on Twitter?

 

Posted in Takeaways | Tagged , , | Comments Off on My Takeaway from Reading Meatball Sundae

Today I Learned How to Lock a Dependency to a Specific Version in Project JSON

While upgrading the NUnitXmarin project the project maintainers asked me lock the version of NUnit to a specific version.  They where also kind enough to provided a link to a possible solution.  Lets test if it works.

First lets review how NuGet resolves dependencies.  If you specify a dependency version the standard way, i.e. just listing the version number with not brackets, NuGet tries to find the version you specified of the next highest version.

For example the NuGet feed for NUnit has the following versions in it’s feed:

3.6.1
3.7.0
3.7.1
3.8.0
3.8.1

If you list version 3.7.1 in project.json file, as shown below, then NuGet uses version 3.7.1.  Duh.

"dependencies": {
  "NUnit": "3.7.1"
}

Now say you list version 3.7.99 as shown below.  Now 3.7.99 does not exist so NuGet find the next highest version, which is 3.8.0, and uses that version.

"dependencies": {
 "NUnit": "3.7.99"
}

When you compile you will see a message similar to the below.

Dependency specified was NUnit (>= 3.7.99) but ended up with NUnit 3.8.0.

NuGet Dependency Resolution Message

To tell NuGet to only use the version you specified you need to put square brackets around the version number.  This changes the logic from “>= Version#” to “= Version#”.

"dependencies": {
 "NUnit": "[3.7.99]" 
} 

Now when you try to build you will get an error because version 3.7.99 does not exist and NuGet will not try to find a newer version.

NuGet Package restore failed for project Runner\nunit.runner.Droid for 'NUnit (= 3.7.99)'.

NuGet Dependency Error Message

That’s great you say, but why would you link to a version that does not exist?  That is stupid.

Let’s try something that might actually happen.  Your project references a project but another package links to a different version.  Say you have the following in your JSON file:

"dependencies": {
  "NUnit": "[3.6.1]",
  "NUnitLite": "3.8.1" 
} 

NUnitLite 3.8.1 references to NUnit 3.8.1.  If you compile you get the following warning:

Detected package downgrade: NUnit from 3.8.1 to 3.6.1  
ClassLibrary1 (>= 1.0.0) -> NUnitLite (>= 3.8.1) -> NUnit (= 3.8.1)  
ClassLibrary1 (>= 1.0.0) -> NUnit (= 3.6.1)

NuGet Dependency Warning Message

That’s good.  It’s what we wanted.  Now what happens if we remove the square brackets from the NUnit dependency so our JSON file looks like:

"dependencies": {
 "NUnit": "3.6.1",
 "NUnitLite": "3.8.1" 
} 

Will it use NUnit 3.6.1 that we reference in the project or NUnit 3.8.1 referenced by NUnitLite?

Detected package downgrade: NUnit from 3.8.1 to 3.6.1  
ClassLibrary1 (>= 1.0.0) -> NUnitLite (>= 3.8.1) -> NUnit (= 3.8.1)  
ClassLibrary1 (>= 1.0.0) -> NUnit (= 3.6.1)

NuGet Dependency Warning Message

Wait, that is exactly the same message we got last time.  What is going on?  It turns NuGet prefers the version of a package directly referenced by your project then one referenced by another package.  This is all explained in the How NuGet resolves package dependencies article but in summary NuGet tries to use the lowest version it can get away with with direct references overriding sub-references.

P.S. – I’m glad Barenaked Ladies (it’s a Canadian band, link is SFW) where able to continue without Steven Page but I miss his melancholy.  Plus him and Ed harmonized really well together.  This is one of my favorite melancholy BNL songs.  Yes I like it more then Brian Wilson.  Just ignore the cheesy video.

I couldn’t tell you
That I was wrong
I chickened out grabbed a pen and a paper
Sat down and I wrote this song

I couldn’t tell you
That you were right
So instead I looked in the mirror
Watched TV, laid awake all night

Posted in Uncategorized | Comments Off on Today I Learned How to Lock a Dependency to a Specific Version in Project JSON

My Takeaway from Reading Option B

Option B Book Cover

Book: Option B: Facing Adversity, Building Resilience, and Finding Joy
Author: Sheryl Sandberg, Adam Grant

Option B is not what I thought it would be about.  I thought it would be about what to do when your first plan fails for some reason.  Like plans you consciously made, such as a business plan, trip, etc.

Turns out the book is coming up with an option B for plans you didn’t even think you where making.  Such as assuming your family won’t die or won’t get seriously ill.  It is Sheryl Sandberg’s account of her husbands unexpected passing how she dealt with it.  She talks to others who dealt with death of loved ones and also what research says about dealing with death.  It does focus on other issues such as illness and other major life tragedies but mostly about death.

I have two takeaways from this book.  The first is that we have plans that we don’t even know about.  I dubbed them default plans but they are still plans.  That same way not making a choice is still a choice.

The second is that you should acknowledge and talk to the survivor about the death of their loved one.  We are often afraid of hurting the survivor by bringing up the subject.  That and hurting ourselves by bring up the topic.  The takeaway is to talk to your friends and family about the traumatic events.  They will appreciate it more then ignoring the elephant in the room.

 

Posted in Takeaways | Tagged , | Comments Off on My Takeaway from Reading Option B

Notes: Upgrade NUnit.Xamarin to NUnit 3.8.1

The notes I took when trying to upgrade the NUnit Xamarin project to NUnit 3.8.1.  The reason I did this was to fix issue #87.  When I try to us NUnit Xamarin on another project it fails with the following error:

 
D/Mono ( 2233): Assembly Loader probing location: 'System.Runtime.Loader'. 
F/monodroid-assembly( 2233): Could not load assembly 'System.Runtime.Loader' during startup registration. 
F/monodroid-assembly( 2233): This might be due to an invalid debug installation. 

Remember these are just notes and lack the polish [what polish? –Ed] of my other technical articles.

Compile

First I forked the project to my personal GitHub account then I cloned the repo to my local machine.

Open and compile the application.  No errors on the first try, that is a good sign.

NUnit Xamarin Compile Successful

For some reason ReSharper says there are 796 errors in 31 files.  The ReSharper “errors” are mostly in the shared projects.  I don’t think ReSharper knows how to deal with Shared projects correctly.  I’ll just ignore these errors for now.

Run iOS Project

Try to run it on iOS.  Can’t start the nunit.runner.iOS project because of the following error:

NUnit Xamarin Error Running NUnit.Runner.iOS Project

Changed it to nunit.runner.tests.iOS and it ran with the following results:

NUnit Xamarin iOS Test Result Summary

NUnit Xamarin iOS Test Result Failed Tests

Some of the tests failed.  Are they supposed to fail?  One second while I take a look at the tests.  I see some of them are supposed fail.  Thanks deliberate failure comment.

NUnit Xamarin Deliberate Failure Comment

Run Droid Project

I assume everything works on iOS.  Lets try running the Droid project.  Bummer, it no work.

NUnit Xamarin Droid Version Error

It appears that the Droid project file was updated to Android 7.1 but the json file still points to 6.0.  Why did VS auto update the project file to 7.1?  It appears that the project is set to use the latest Android version platform, which is currently 7.1 (Nougat).

NUnit Xamarin Droid Project Uses Default Android Version

Lets try switching it to 6.0 and see what happens.  It sill no work but I have seen this error message before.  It’s the initial bug I experienced in another project.

 
D/Mono ( 2233): Assembly Loader probing location: 'System.Runtime.Loader'.
F/monodroid-assembly( 2233): Could not load assembly 'System.Runtime.Loader' during startup registration.
F/monodroid-assembly( 2233): This might be due to an invalid debug installation.

Oh wait, there is a 3.8.1 branch in the repo that has already updated to Android 7.1.  At least there was an attempt but it looked like it failed.  Do I stay with master or switch to the branch?

Upgrade to NUnit 3.8.1

Lets stay on the master branch and work out a fix.  I’ll then ask if it should be merged to master or the branch.  First things first lets updated to Android 7.1 and see what happens.  First in the project properties switch back to Use the Lastest Platform setting and then updated the json file.  I currently looks like:

 
{
 "dependencies": {
 "NUnit": "3.6.1",
 "Xamarin.Forms": "1.5.0.6447"
 },
 "frameworks": {
 "monoandroid60": {}
 },
 "runtimes": {
 "win": {}
 }
}

It links to an old Xamarin.Forms but lets leave that for now.  Hopefully upgrading to Android 7.1 will work with old version of Xamarin.  Lets upgrade the framework then run it.

 "frameworks": { 
   "monoandroid71": {} },

Well, got the same “Could not load assembly ‘System.Runtime.Loader'” error.

NUnit Xamarin Cannot Load Assembly System Runtime Loader

Lets see how NUnit.Xamarin links to NUnit.  How hard is it to upgrade to NUnit 3.8.1?

NUnit Xamarin NUnit Nuget

Notice that the packages come from NUnit AppVeyor CI.  I know AppVeyor is a continuous build system but not much else about it.  Do we have to use the packages only from AppVeyor?  I’ll have to ask.

It appears that NUnit is linked to via Nuget package.  I heard that it might NUnit.Xamarin might be compiled against NUnit but it appears to just use the Nuget package.  That is promising.  Lets try upgrading it to 3.8.1 and see what happens.

NUnit Xamarin Nuget Upgrade To 3.8.1

NUnit Xamarin Nuget Upgrade To 3.8.1 Changes

After the upgrade everything seems to work.  That is good news.

NUnit Xamarin Droid Success

Now I just need to check with the NUnit.Xamarin team what branch they would like this pull request put into.  I wonder if it will pass automated build tests?

 

Posted in Code Examples, Notes, Software Development | Tagged , , | Comments Off on Notes: Upgrade NUnit.Xamarin to NUnit 3.8.1

PSA: Arduino H Bridge is Sharp and Pointy

Just a quick public service announcement (PSA) that the Arduino H Bridge is sharp and pointy.  Both my daughter and myself hurt our fingers but only I was lucky enough to draw blood when one of the H Bridge pins got stuck under my finger nail.  I mean look at this insect looking pointy bastard.

H Bridge Top

H Bridge Bottom

All that pain and blood was worth it as we did finally get the lesson 10 (Zoetrope) from the Arduino Start Kit working.  We couldn’t get the example as shown in the book to work because we didn’t understand how the H Bridge worked.

Lesson 10 Zeotrope

With help from this article (with a handy diagram) we figured out the H Bridge and got the motor to spin.

Special thanks to Startup Edmonton for hosting us on their Monthly Hack Day.

Posted in Fun, Hardware | Tagged , , , | Comments Off on PSA: Arduino H Bridge is Sharp and Pointy

Today I Learned How to Automate Objective-c Builds in TeamCity

Several months ago I discussed how to manually build an objective-c project so it can be consumed by a Xamarin Binding Project.  In this post I show how to automate the building of the objective-c project.  In my case I need to automate the building of the BEMCheckBox project but hopefully you can generalize this specific example for your own needs.

For this post I’ll assume you have a TeamCity server setup along with a TeamCity build agent on a Mac.  For help installing a TeamCity server see the official documentation.  For help installing a Mac build agent please see my previous post and/or the official documentation.

Create the Project and Build in TeamCity

In my TeamCity setup I have a  Plugins project and under that a Native Libraries project.  Then under that I created the BEMCheckBox build as shown in the screen shot below.

BEMCheckBox Project Layout

As you can see above the build already exists but I’ll walk through creating it from scratch.  First choose the project you want the build to be in and choose Edit.

TeamCity Edit Project

On this screen choose Create build configuration.  In the screen shot below I already have a build but you might not have any builds yet.

TeamCity Create Build

The BEMCheckBox exists on GitHub but not under my GitHub account so I have to link to the URL manually.  Copy the link to the BEMCheckBox in step 3.

TeamCity Create Build From Url

Then set the name for your build.

TeamCity Set Build Config Name

Next I setup the build steps.  TeamCity might try to figure out the default build steps but you can ignore them and setup your own.

TeamCity Configure Build Steps Manually

Build Steps

We will need to compile the BEMCheckBox twice.  Once to build for the ARM architectures and once for the i386 architectures.  The ARM architecture lets the checkbox run on physical devices and  i386 for simulators.

Build Step 1 – Compile to Device

First up compiling for the iphone.  In my example we want a target based build to compile the BEMCheckBox framework, not the example program.  Make sure the platform is iOS (ARM).  You might have to click the Check/Reparse Project button to get the settings to show up correctly.

TeamCity Compile For Device

To test this step run your build then look for a BEMCheckBox.framework folder in the build/Release-iphoneos folder on you Mac build machine.  The full path on my build machine is:

 
/Users/username/BuildAgent/work/GUID/Sample Project/build/Release-iphoneos/BEMCheckBox.framework

Build Step 2 – Compile to Simulator

Now create another build step for the simulator build.  It will be similar to the previous build step.

TeamCity Compile For Simulator

Again you can test this build step by looking for the BEMCheckBox.framework folder in the Release-iphonesimulator.

/Users/username/BuildAgent/work/GUID/Sample Project/build/Release-iphonesimulator/BEMCheckBox.framework

Build Step 3 – Combine Frameworks

The final step is to combine the two builds into one so the framework can be consumed by Xamarin.  To do this use the lipo command.  The manual steps are outlined in my previous post.  To automate this step create a command line build process as shown below:

TeamCity Combine Frameworks Build Step

The full command line looks like:

 
cp -r Sample\ Project/build/Release-iphoneos/BEMCheckBox.framework .
lipo -create -output BEMCheckBox.framework/BEMCheckBox Sample\ Project/build/Release-iphoneos/BEMCheckBox.framework/BEMCheckBox Sample\ Project/build/Release-iphonesimulator/BEMCheckBox.framework/BEMCheckBox

To test this step run the build and look a BEMCheckBox.framework folder in root of the work/GUID folder.  In my case the folder can be found at:

/Users/username/BuildAgent/work/GUID/BEMCheckBox.framework

Then run a file command to make sure all 4 architectures are supported.

 
file BEMCheckBox.framework/BEMCheckBox

You should get the following output or something similar:

BEMCheckBox.framework/BEMCheckBox: Mach-0 universal binary with 4 architectures: [i386: Mach-0 dynamically lined shared library i386] [x86_x64: Mach-0 dynamically lined shared library x86_x64] [arm_v7: Mach-0 dynamically lined shared library arm_v7] [arm64: Mach-0 dynamically lined shared library arm64]
BEMCheckBox.framework/BEMCheckBox (for architecture i386): Mach-0 dynamically linked shared library i386
BEMCheckBox.framework/BEMCheckBox (for architecture x86_x64): Mach-0 dynamically linked shared library x86_x64
BEMCheckBox.framework/BEMCheckBox (for architecture arm_v7): Mach-0 dynamically linked shared library arm_v7
BEMCheckBox.framework/BEMCheckBox (for architecture arm64): Mach-0 dynamically linked shared library arm64

You can also use the lipo command tool to check the library.

lipo -info BEMCheckBox.framework/BEMCheckBox

You should see something like:

Architectures in the fat file: BEMCheckBox.framework/BEMCheckBox are: i386, x86_x64, arm7, arm64

In both cases you should see 4 architectures listed.  If you only see two then there is something with this build step.

Artifact

The end goal of all this work is to get a BEMCheckBox.framework that can be consumed by Xamarin.  Set this up as an artifact of the build by navigating the General Settings page.  Then click on the Artifacts Path directory icon and choose the BEMCheckBox.framework folder.

TeamCity Choose Artifact

 

Run the build one more time and you should see the BEMCheckBox.framework as a artifact.

TeamCity BEMCheckBox Artifact

That’s it.  You are done.  You are a hero for automating a manual process.

Of course you can tweak the build triggers and other settings as needed but the core part of building a Xcode library using TeamCity is done.

You can read how to manually use BEMCheckBox in Xamarin in part 3 and part 4 of the Today I Learned How to Create a Xamarin iOS Binding for Objective-C Libraries post series.  Maybe one day I’ll do a post on how to automate consuming the BEMCheckBox framework in Xamarin.

P.S. – I’m re-watching Stranger Things Season 1 in anticipation of season 2.  One of the more memorable scenes is the end of episode 3 (spoilers) when the Heroes song plays.  In the show the song is preformed by Peter Gabriel but below is the original extended version sung by David Bowie.

 

Posted in Today I Learned | Tagged , , , , | Comments Off on Today I Learned How to Automate Objective-c Builds in TeamCity

First Edmonton .NET Group Talk of the 2017-2018 Season is September 18th

Edmonton .NET User Group LogoThe first Edmonton .NET User Group (EDMUG) talk of the 2017-2018 season is this Monday, September 18th.  The talk is by Shenyi Bao and is titled Web Site Performance Tuning.  All the details can be found here.

Please also don’t forget about the EDMUG survey.  If you are part of the EDMUG group, or are thinking of joining, please take a couple minutes to fill out the survey.

Finally we are always looking for engaging and passionate speakers for the EDMUG meetups.  If you, or someone you know, would like to present please let us know by e-mailing chris.cumming@saturdaymp.com or info@edmug.net.

Posted in Edmonton .NET User Group | Tagged , , , | Comments Off on First Edmonton .NET Group Talk of the 2017-2018 Season is September 18th

Today I Learned How to Install a TeamCity Build Agent on a Mac

When I was first figuring out how to port the BEMCheckBox to Xamarin I built the framework manually.  This is obviously not a good long term solution so I set about figuring out how to automate the build.  The first step was to install the TeamCity build agent on the Mac.  The official TeamCity documentation on how to do this can be found here.

First a little bit about my setup.  My TeamCity server is on a Azure virtual machine (i.e. it’s in the cloud).  My Mac build machine (Mac Book Pro) is sitting beside me in my basement office.  Some of the steps below might differ if your setup is different, such as having the TeamCity server and Mac build machine on the same network.

The Mac build machine and TeamCity server need to talk to each other so make sure you have opened the correct firewall ports and the like.  In my case I had to open up ports on the router in my basement and also ports in Azure.  If you run into trouble try the TeamCity documentation for port numbers.

To test that your TeamCity server and Mac can see each other try installing the build agent via Agent Push.  To do this login to your TeamCity server and click on Agents then Agent Push.

Team City Agent Push

When you click the Install Agent button you will get prompted for some config settings.  Enter them as required.

Team City Agent Push PromptThe Host field is the IP address to your Mac build machine, don’t use the local host address in the example.  The Username and Password is an account on the Mac build machine with administrative rights.

A successful install should end with:

 
Done [729], see log at /Users/username/BuildAgent/logs/teamcity-agent.log
WARNING: The TeamCity Agent installed as standalone application and will not start automatically on machine reboot.
Cleaning temporary installation's resources...
Removing './bootstrapper.sh'
Successfully installed build agent on 'computername.local' to '/Users/username/BuildAgent'

If you get any errors it’s probably related to your firewall settings and/or user permissions.

Once the agent is installed you should take a quick look at the conf/buildAgent.properties file and make sure it’s correct.  In my case I had to fix the serverUrl and set the name properties.  For some reason it’s duplicated.  The initial file looked like:

## TeamCity build agent configuration file

######################################
# Required Agent Properties #
######################################
## The address of the TeamCity server. The same as is used to open TeamCity web interface in the browser.
serverUrl=http://123.123.123.123serverUrl=http://123.123.123.123

## The unique name of the agent used to identify this agent on the TeamCity server
## Use blank name to let server generate it.
## By default, this name would be created from the build agent's host name
name=

I updated the file to:

## TeamCity build agent configuration file

######################################
# Required Agent Properties #
######################################
## The address of the TeamCity server. The same as is used to open TeamCity web interface in the browser.
serverUrl=http://123.123.123.123

## The unique name of the agent used to identify this agent on the TeamCity server
## Use blank name to let server generate it.
## By default, this name would be created from the build agent's host name
name=MyMacBuildMachineName

Once you have updated the properties file create the logs folder.  Then get the build agent to connected to the TeamCity server and update it’s self.  This might take several minutes and you can watch the progress in the log file.

mkdir BuildAgent/logs
sh BuildAgent/bin/mac.launchd.sh load
tail -f BuildAgent/logs/teamcity-agent.log

If this command fails then it’s likely the build agent can’t connect to TeamCity.  Make sure the serverUrl property is correct and double check your firewall ports.  Once it’s done the agent should appear in the TeamCity interface as a unauthorized agent.

Team City New Unauthorized Agent

To authorize this agent click on the Unauthorized link and it will be authorized.  Now you are good to go.  In a future post I’ll describe how I actually build Xcode projects with TeamCity.

 

P.S. – Thought this song might be appropriate today.

Posted in Today I Learned | Tagged , , | Comments Off on Today I Learned How to Install a TeamCity Build Agent on a Mac

Edmonton .NET User Group Survey

Edmonton .NET User Group LogoIf you are part of the Edmonton .NET User Group or are thinking of joining then please fill out this survey.  The survey will help us plan out the 2017-2018 year.  The survey will only take a couple minutes so fill it out during your next coffee break by clicking here.

Don’t live in Edmonton?  Then you should join your city’s local friendly .NET group.  Not a .NET developer then join a local friendly group that talks about technology you are interested in.

P.S. – We are always looking for passionate speakers to share their knowledge.  If you, or someone you know, would like to present at one of our meetups please contact me.

Posted in Business Side | Tagged , , | Comments Off on Edmonton .NET User Group Survey

Sabbatical is Over, Looking for Work

Zig Ziglar Work Job QuoteThe leaves are starting to change, the days are getting shorter, and the garden is ready to harvest.  That means fall is here in all it’s glory.  It also means my summer sabbatical is over.

I spent my sabbatical teaching myself mobile phone development and working on Arduino projects with my daughter.  While I enjoyed my sabbatical I’m looking forward to working again.  It feels good to serve others and be rewarded with multi-coloured certificates of appreciation with The Queen or Prime Ministers faces on them on them (i.e  money).

Some of the ways my work can make your life better include:

  • Create an application to solve a problem.
  • Upgrade and/or refactor your existing legacy application.
  • Help you pick the right technology for your needs.
  • Simplify a complicated part of your application and/or business.
  • Research and develop solutions to hard7uih software problems.
  • Automate your build and deployment process.
  • Database design, optimization, and migration.

More information about me can be found on my company website, resume, LinkedIn, and GitHub profile.  I can be reached by phone at 780-886-3406 or by e-mail at chris.cumming@saturdaymp.com.  I look forward to working with you.

Posted in Business Side | Tagged , , , | Comments Off on Sabbatical is Over, Looking for Work