Riding the Dinosaur: The Joys of Old Technology

Using old technology is a bit like driving a Model T on the Indy Speedway. It can be a bit scary, but most of the time it is incredibly frustrating and everything seems dino1to be zooming past at a mind-boggling rate of speed.

Case in point: I have a version of Photoshop from 2002. It’s a robust program that I know inside out. It can do a lot of things, and when it came out, it was pretty mind-blowing. But, it’s from 2002. That means it is 14 years old. In Computer Years, that is like comparing something from the Jurassic Period to Present Day.

This ancient program is on my ancient laptop, which is also from 2002. I’ve never had cause to replace it, because it still works after all these years. However, it cannot go on the internet. It could 14 years ago, but I feel like if I plugged an ethernet cable into it now, it would probdino2ably burst into flames and then explode. I have a much newer computer – I’m clearly on the internet as I am writing this – but the old one has retained its usefulness because it has Photoshop.

And so, I’ve been doing a lot of artwork for Goal Buddy (and for other things like Migrator) on the Ancient Beast, as it is known. Drawing on it is really hard. Do you remember Scary Sun? Yeah. I can’t unsee it either. That’s what happens when I try drawing with the touchpad mouse. I am still puttering away, trying to draw background things (thank goodness for the “gradient” tool), but then I am constantly switching between sitting on the floor with the laptop to sitting at the desk with the real computer. Plus, I am saving things on USB keys and going back and forth between the one with internet and the one without. If this sounds inefficient, you are right.

It’s why I have resorted to hand-drawing art for the blog posts, and most of dino3the art you’ve seen is drawn with ink and pencil crayon, then scanned. It seems a little preposterous that going back to good ol’ pencil and paper is faster than using a computer program, but that’s what happens when you use old technology! I’m still finding uses for my ancient Photoshop, and until it is no longer useful, I will continue to use it. It’s like driving the Model T. It is slow, but you get there eventually and mostly in one piece.

 

Save

Posted in Fun, Goal App | Comments Off on Riding the Dinosaur: The Joys of Old Technology

Today I Learned Bait and Switch for .NET PCL’s

If you have worked with Xamarin for longer than me (i.e. one year) then you probably already know about PCL bait and switch technique, especially if you consumed one of the many Xamarin plugins.

As usual I’m late to the party.  It’s November 2016 and the first article I found was written May 2014.  There is also a good video about the bait and switch technique for creating Xamarin plugins which I think was recorded in September 2014.  That said, I’m more an Early Adopter or Early Majority than an Innovator.

Diffusion of Innovation

Back to bait and switch.  I’m not a fan of it because of its strict requirements for it to work.  A separate project is required for each environment you want to target.  For example BaitAndSwitch.PCL, BatiAndSwitch.Droid, BaitAndSwitch.iOS, etc.

Separate projects are not the problem.  The problem is each of the separate projects must have the same namespace, version numbers, and assembly names.  You also need to share the common interface file between all the projects.  You can then switch out the DLLs for each different platform.

My problem is this seems hacky.  It gets my smelly code senses tingling.  Maybe my senses shouldn’t be tingling.  The technique is used in most of the existing Xamarin plugins.

For now I won’t use that technique but I reserve the right to change my mind.  I’ve been wrong before, as my wife can tell you.  Who knew you could cook bacon and eggs in a paper bag?

P.S. – My programming music this time is the Okeefe music.  It’s kids playing rock songs, such as Slipknot.  The kids are talented and this video is funny.

 

Save

Save

Save

Save

Save

Save

Posted in Today I Learned | Comments Off on Today I Learned Bait and Switch for .NET PCL’s

When the going gets tough, the tough have a training montage

Unforeseen circumstances.

It isn’t a phrase that makes you jump for joy. Instead, it is a vaguely menacing combination of words that foretells of something throwing your plans off the rails. For me, it was a leg injury. If you have been following this blog series, you’ll know that I have been training to apply to the Edmonton Police Service. Things were falling into place. I had collected all the supporting documents for my application (transcripts, first aid certification and so forth), and was studying hard to write the entrance exams. I was in the best shape of my life, thanks to working with a personal trainer.

Then came the unforeseen circumstances. One frosty September morning, my leg felt peculiar as I sprinted up a set of stairs in the river valley. I ignored it, thinking I should “suck it up, buttercup.” I trained the next day and the day after, and the pain screamed at me until I couldn’t ignore it. By Saturday morning, I couldn’t walk. I knew that something had gone majorly wrong.

I discovered that I’d strained part of my quad in my left leg (the rectus femoris muscle, to be exact) and it might be several months before it was healed. My life flashed before my eyes. I was ready to go in and slay those entrance exams and had hoped to do the physical exam soon thereafter. But now I could hardly walk and had no idea how long it would take to heal. At that moment, it felt like my big plans had crashed and burned like a plane falling out of the sky.

montagetime

Being the logical person that I am, I wallowed in misery for a few days and then formulated a plan. TRAINING MONTAGE! Stretching. Physio. Exercise. Rest. Repeat. Preferably set to music.

Flash forward two months and my leg is finally almost at its pre-injury state. It’s been slow and frustrating, but I knew that if I pushed it too hard too soon, I would be worse off. The take-home message here is that unforeseen circumstances are inevitable. You don’t have control over them. The only thing you have control over is how you react.

eyeofthetiger

Grey tracksuit optional but recommended.

Save

Posted in Fun, Goal App | Comments Off on When the going gets tough, the tough have a training montage

Today I Learned Xamarin Push Notification Plugins

I learned this week that there is no built-in support for Push Notifications in Xamarin Forms.  On the plus side there are several open source projects trying to fill this hole.  The one that has caught my eye is edsnider/Xamarin.Plugins.

It only supports local notifications but that is all I need right now.  I like it because it looks simple to use.  The only downside is it looks abandoned.  Hopefully I’ll get around to actually trying it this week.

I was also looking at the EgorBo/Toasts.Forms.Plugin.  At first I was confused about the difference between notifications and toasts.  A Toast is a non-modal, unobtrusive window element used to display brief, auto-expiring windows of information to a user.  You can find that quote here.

My guess is that most users would call toasts notifications.  I think I’ll define the notifications as an actual notification (remote or local) that arrives in the application and the toast one of the ways of showing the notification.  In my case I want the notification to show a pre-defined page in the Xamarin Forms application.  I wonder what will be easier, iOS or Android?

P.S. – I also learned that the new DOOM (2016) soundtrack is excellent music to program to.  Best song, in my humble opinion, is Rip and Tear.

Posted in Today I Learned | Tagged , , | Comments Off on Today I Learned Xamarin Push Notification Plugins

Notes on Converting Mini-Compressor to UWP Application (Trying to at Least)

I was inspired to get Mini-Compressor to UWP into the Windows 10 Store a while back this summer. I saw this video several months ago when it was called Project Centennial:

https://channel9.msdn.com/Events/Build/2015/2-692

Then a couple weeks ago there was a form you could fill out and a Microsoft employee would help you convert your application.  So I filled out the form about my tiny little application called Mini-Compressor and was surprised when I heard back.  The fellow was very helpful but in the end we couldn’t get Mini-Compressor ported to UWP.

Spoiler: UWP applications can have custom context menu items but not for *.jpeg files.

So why am I writing this if we failed?  Because I think there is still something to learn from my failure.  Same reason scientist should publish failed experiments.

Also I setup a goal to post something and figured this would do.  So without further ado here are the notes I took.

Doing Research

Read about converting applications and the requirements.  Right away I saw potential show stopper: Shell Extensions are not supported in UWP.  There where a couple other minor issues, like registry entries not allowed in the machine hive, but I could work around those.  The whole point of Mini-Compressor is to right click on a file or folder to compress the images.  Being the optimistic guy I am I think there might be a way around this so I decide to proceed.  With the help of my new Microsoft contact we made good progress.

The next thing I read was setting up the Desktop App Converter program.  It’s actually not too hard, just follow the instructions.  I’ll show you my instructions a little later.

Upgrade to .NET 4.6.2

Before I did anything I updated Mini-Compressor to .NET 4.6.2.  This was actually pretty painless.  I just picked each C# project and upgraded it to .NET 4.6.2.  Everything still compiled, tests passed, and the automated build succeeded.

Remove the Shell Extension Project

The Shell Extension is what allows users to right click a folder or file to compress them.   In Mini-Compressor this is the MiniCompShellExt project and is responsible for adding the Mini-Compressor menu item to the popup menu that appears when you right click on the folder or file.  It’s also responsible for determining the file(s)/folders clicked on and passing them to the actual Mini-Compressor program.

It’s sad to have to remove this because this is the hardest part of Mini-Compressor to write.  At least for me.  I had to learn how Shell Extensions work and remember C++ (hadn’t been used since university).  It was also the key feature of Mini-Compressor.  You could right click on a file or folder and compress them.

A moment of silence for the MiniCompShellEx project.

removeshellextension

Thanks to TortoiseSVN and other Tortoise projects,  I modeled my Shell Extension off these projects.

TortoiseSVN
TortoiseGit
TortoiseHg

Remove Unused Build Configurations

Now that we no longer have the Shell Extension project we can remove some build configurations.  Currently Mini-Compressor has 6 build configurations.
The MiniCompShellExt was a C++ project and needed a separate compile for x86 and x64 operating systems.  Mini-Compressor also has a trail and paid-for builds.

buildconfigurations

Side note: Why the trial and paid for-builds?  The answer is Mini-Compressor didn’t use a key to unlock it after you purchased it.  Instead a trial check was hard coded into the application.  Similar idea to a demo version of a game versus the full release version.
I was not a big fan of keys because people tend to lose them, at least back in the day.  Now that is less of an issue with everyone saving their key to e-mail.

Back on topic, just keep the Debug and Release builds.  No need for the x64 builds and trial builds.  Actually now that I think of it how does Microsoft Store handle demos?  I should check that out.

Update the Installer

I used Advanced Installer to create the installer for Mini-Compressor.  I used Advanced Installer because it let me create a single install for both 32-bit and 64-bit applications.  This is no longer needed.

Actually running the Microsoft Bridge application on the single install exe does not work.  What I really want is a single platform, 64-bit, installer.  To make this happen I made the below changes to my existing project.

Package Type: 64-bit (AMD64, EM64T)

Advanced Installer Change Package Type

Remove 32-bit and Shell Extension files.

Advanced Installer Remove Files

Remove registry entry required for shell extension.

Advanced Installer Remove Registry Entries

Remove trial build.

Advanced Installer Remove Trial Version

Add File Associations. (this actually did nothing but I was hoping it would help)

Advanced Installer Add File Assoications

Remove Stopping the Explorer process and .NET Installer.

Advanced Installer Stop Explorer Process

I am using an old version of Advanced Installer (version 9.9, current version is 13.1) and don’t have a license for the new version.  Maybe in the future I’ll update to the new version so I can build AppX applications directly instead of running the Microsoft Bridge.

Setup the Desktop App Converter

Download the Desktop App Converter and the wim image.  Then open a PowerShell as admin and type the following to setup the image:

PS C:\> Set-ExecutionPolicy bypass

PS C:\> .\DesktopAppConverter.ps1 -Setup -BaseImage .\BaseImage-1XXXX.wim –Verbose

This can take a while and only needs to be done once.

Run the Desktop App Converter

Again in PowerShell run the following command:

PS C:>.\DesktopAppConverter.ps1 
-Installer "<path>\Mini-Compressor-9.9.9.9.exe" 
-InstallerArguments "/qn" 
-Destination "<path>\MiniCompConverted" 
-PackageName "MiniCompressor" 
-Publisher "<Full publisher name on your code signing certificate>" 
-Version 9.9.9.9 
-MakeAppx –Verbose

This command takes the existing installer exe and installs it in the wim image you setup earlier.  The process runs some tests on the install process and also notes what file and other install actions are taken.  It then creates a AppX install file.

convertercreateappx

 

Sign the Appx package.  Do this using the Visual Studio command line and the Saturday MP cert.

PS C:>signtool.exe sign 
-f saturdaymp.pfx 
-p <password>
-fd SHA256 
–v MiniCompressor.appx

If you don’t have a code signing certificate then you can create your own certificate.

Now you can double click your AppX application on a Windows 10 machine and it will get installed.  Notice it didn’t include any of the nice images I had in my old installer.

Install AppX Mini-Compressor

No Right Click

I encountered some small issues following the above steps but overall it was relatively painless.  Unfortunately when I was done I couldn’t right click on anything using Mini-Compressor.  I could run the application from the Start menu but no right click.  That said I kind of knew this would happen based on my initial research.

I talked to the helpful fellow at Microsoft and he said there is a way to add shell extensions in AppX applications.  You need to add the following to your AppX manifest file:

<Extensions>
  <uap3:Extension Category="windows.fileTypeAssociation">
    <uap3:FileTypeAssociation Name="imagefiles">
      <uap:DisplayName>Image Files</uap:DisplayName>
      <uap:SupportedFileTypes>
        <uap:FileType>.jpg</uap:FileType>
        <uap:FileType>.jpeg</uap:FileType>
        <uap:FileType>.blah</uap:FileType>
      </uap:SupportedFileTypes>
      <uap2:SupportedVerbs>
        <uap3:Verb Id="Compress" MultiSelectModel="Player" Parameters="&quot;%1&quot;">Compress</uap3:Verb>
        <uap3:Verb Id="CompressExtended" MultiSelectModel="Player" Extended="true" Parameters="&quot;%1&quot;">Compress Extended</uap3:Verb>
      </uap2:SupportedVerbs>
    </uap3:FileTypeAssociation>
  </uap3:Extension>
</Extensions>

Note that after updating the manifest file I needed to re-create the Appx file.  I did this by running the following command:

makeappx.exe pack -d PackageFiles -p Output

Notice that I added the jpg, jpeg, and blah types.  At first I added just the jpg/jpeg types but that did not seem to work.  When I added the blah type I could right click on blah files.

Turns out certain file types are reserved and can’t be used.  Of course the jpg/jpeg file types can’t be used.  That made me sad.  Maybe in the future if Microsoft makes the jpg/jpeg not reserved then maybe I’ll try upgrading Mini-Compressor again.

So that is the end of my long journey.  While it didn’t end the way I wanted it to, I did learn some things and wanted to share them with you.  That, and as I said at the beginning, I think it’s important to share successful as well as failed experiments.

Save

Save

Save

Posted in Business Side, Mini-Compressor, Notes, Software Development | Tagged , , , , , , | Comments Off on Notes on Converting Mini-Compressor to UWP Application (Trying to at Least)

Math is hard.

Math.

Few people tell me that they love math.

It brings back memories of sitting in a small, windowless room, back in grade 11, with my math tutor. My tutor smoked cigars. Lots of cigars. He smelled like a giant cigar. I really didn’t want to be there, but my math grades were abysmal. I tried – superficially, at best – to memorize the patterns of algebra, but desire to receive a non-abysmal grade in that class was overshadowed by a large teenage helping of “not giving a …”

I did pass (somehow), and went on to become a decent statistician in university. The beauty of stats, though, is that you rarely do the computations by hand. You just need to know what kind of analysis need be done on a dataset, plug it into a computer program, and voila. I was so used to doing those analyses that I started to think I was good at math.

math1

Wrong. When a computer does all the analyses for you, it doesn’t mean squat.

I have reached a point in my grander goal that I do not like. Inevitably, there are parts of a goal that you really loathe. For some, it might be getting up early or changing your eating habits. For me, it’s re-learning how to do math by hand. Math is part of the written entrance exams for nearly all police services, EPS included. Yours truly could not do long division to save her life.

math2

Math is worth a significant portion of the exam. I sat down one afternoon, flipped open the study manual, and started math-ing. Ok, first you see how many times the first number goes into…no, wait, what do I do with this decimal…wait, I think you move it over here… no. System failure. Stupid math. I decided to ignore it completely. However, things you ignore have a nasty way of following you around and permeating everything you do. Math was always there, like a malevolent dog that followed me home.

Ignoring it wasn’t making it go away.

There was only one thing left to do. Just study. No way around it. As loathsome a task as math is, refusing to acknowledge its existence is futile. Every goal has nasty bits. In the wise words of Yoda: “Do or do not. There is no try.” Even with math.

 

Posted in Fun, Goal App | Comments Off on Math is hard.

The Olympics versus Accountability

Routines are great. Sure, they can be difficult to get up and running, but once you have one, things don’t feel quite right when you miss part of it. For the last many months I have been going to the gym every other day. For the last month, I’ve been going to Run With Recruiters twice per week. I was feeling pretty darn good about that and was in the best shape of my life. I wrote all these things on my calendar, and felt a great sense of accomplishment every time I looked at it.

Change was a-coming. My parents were heading to Scandinavia for three weeks and needed a house sitter. Of course I wanted to help them, but it meant leaving my routine completely and trading city life for small town Saskatchewan life. No fancy gym. No group of EPS hopefuls to run up and down stairs with. I wondered how I would adapt.

eatenbycouch

I had noble visions of running country roads (and hills…there are indeed hills in Saskatchewan) and going to the small gym in my home town. But eventually, my days started to look like this (see above).

sirensongThe siren song of the Olympics was very strong, and I found myself velcroed to the couch (even while wearing my EPS Run with Recruiters shirt…that makes it count, right?).

I started to wonder what everyone was up to back in Edmonton. I would look at the clock on Mondays at 5 and imagine that enjoyitwhileitlastseveryone in the RWR group was pounding out pushups and burpees. Meanwhile, I convinced myself that watching the Olympics counted as exercising.

However, a month went by very quickly. The party was ending, and soon it would be time to get my sorry self back into my regular routine.

meh

I would like to report that I burst out my front door and ran stairs like a champ the minute I got home. The first few days of getting back in my workout routine went more like this, though (see below)…..

nothingtoseehere

Nothing to see here, folks. Move it along.

I did get a few good runs and workouts in, but sticking to a routine out of the usual context was tough. It’s especially tough when no one is keeping tabs on you, or expects to see you in a certain place at a certain time. Being self-accountable takes a tremendous amount of discipline.

Now that I’m back (and the Olympics are over), it’s time to restart the routine and get back to working on Goal Buddy. The concept of self-accountability is a primary driver in GB’s development. It’s definitely challenging to stick to a routine when there aren’t other humans to answer to, but it’s not impossible! Good thing it’s a while before the next Olympics are on…

Posted in Fun, Goal App | Comments Off on The Olympics versus Accountability

What I Learned this Summer – 2016 Edition

I am about 1 month early on my traditional “what I learned this summer” blog post, but I’m learning so felt the need to write it down!  For those following along at home, here are the lessons covered: 2012, 2013, and 2014.

And now, in the midsummer of 2016, amid the rainstorms, travelling fairs and mosquito bites, I declare that I am learning a lot.  The software developer that I’m married to (Chris) is a lot like an artist or a Granville Island shopkeeper.

Developpers Hours

Sure, I get it – we’re in the middle of developing our Goal Buddy app and there’s only so many hours in between camping and out of town guests.  What if, though, the mood strikes like a clap of lightning?  Off he goes running to chain himself to the basement computer!  Do not disturb, Darling Daughter, when he’s got his early morning revelations and late night inspirations.  You should try dining with him!  I’m proud to know him well enough when he has his “thinking” face on.  Yes, you may be dismissed from the table… I’m sure Joni Mitchell’s family dealt with that too.

While the results are hardly visible like a Jackson Pollock painting, Chris’s dedication to his art is admirable.  There can be so many distractions when your home office is at home, and so many more during the summer when everyone else is on vacation or having backyard sleepovers.

It’s still nice to know that when a particularly cool lightning show hits, he’s able to come upstairs and witness it with us.  Then back to the Goal Buddy Salt Mines he goes.  I wonder if writers like Kristan Higgins and Danielle Steele are the same way.

Save

Save

Save

Save

Posted in Business Side, Fun, Goal App | Comments Off on What I Learned this Summer – 2016 Edition

Push It Real Good – Version Control in Real Life

Several weeks ago, Chris gave Ada and I a mini-workshop on “version control.” Wondering what that is? (I certainly was, at the time) In non-programmer’s terms, version control describes how, when several people are working on the same code, they make sure that they are working on the most up-to-date version that includes everyone’s edits. Version control uses some pretty entertainexplainingversioncontroling jargon; for example, you “pull” the most recent version of a file, and then “push” the changes you’ve made. Each change must be “committed” to update the file. That way, there aren’t a slew of working copies floating out there and no one knows which is the most recent version. Visually, you could think of it like this:

 

A few days later, Ada mentioned that the whole push/pull thing was a lot like going through various stages of life, wherein one “pushes” a life change (like starting university or a job) into your life and that change becomes integrated (i.e., committed)stick01 into the main branch (i.e., the master copy) of your life. I wondered what it might look like on paper…

The earliest thing I remember wanting to be was an airline pilot. Don’t ask me why. Jumbo jets impressed my 7 year old self.

stick02

I think veterinarian came next. (foreshadowing for cats?)

stick03

Then physician (glad I got that out of my system as an undergrad!).

stick04

Then research scientist. That actually lasted for quite a while.

stick05

 

This overlapped with restaurateur (not going to elaborate that one today…). This is where things got confusing…I think it was a “multiple working copies and I don’t know which version is the most up to date one” kind of situation.

 

stick06And here we are at the Officer Sunglasses version. There are tons of changes in this version (more than I have space for here). Looking back at the chain of command, I can see how all past changes lead to this one, even if that isn’t immediately apparent. So don’t be afraid to push changes. Push it. Push it real good!

Posted in Fun, Goal App | Comments Off on Push It Real Good – Version Control in Real Life

Fixing MSBuild not Exiting

After upgrading to Visual Studio Xamarin 4.1 from 4.0 our TeamCity build suddenly stopped working.  Actually it was working but won’t stop working.  The build would get hang after rebuilding out solution to create the IPA file.

The step in question looked like:

Solution Runner That Hangs

The TeamCity logs looked like:

[09:23:28][Foo\Foo.iOS\Foo.iOS.csproj] _SayGoodbye
[09:23:28][_SayGoodbye] SayGoodbye
[09:23:28][SayGoodbye] Compute signature for bin\iPhone\Release\FooiOS.app

The build would also hang if I logged into the build machine and ran the msbuild via the command line.  However, the build would not hang if built via Visual Studio.

The error only occurs when creating the IPA file.  If compiling non-IPA project, even a iOS project that doesn’t create a IPA, everything works as expected and msbuild ends when it should

Fixing the problem involved telling msbuild to quit once it’s done.  You can do this by setting and environment variable and/or msbuild arguments.  I did both because why not.  The environment variable should be set like:

MSBUILDDISABLENODEREUSE=1

The command switch in question is:

msbuild YourApp.sln /m:4 /nr:false /t:rebuild

The /nr switch tells msbuild to quite once it’s done.  The /m switch tells how many cores to use.  This actually won’t help with the issue but it does speed up my build a bit.

To read more about the above fixes see these Stackoverflow links:

http://stackoverflow.com/questions/13510465/the-mystery-of-stuck-inactive-msbuild-exe-processes-locked-stylecop-dll-nuget

http://stackoverflow.com/questions/3919892/msbuild-exe-staying-open-locking-files

In TeamCity I tried adding the environment variable as a environment property but that didn’t work.  Adding the /nr switch as a parameter to the Solution Runner also didn’t work.  I had to create command line build step as shown below.

Command Line Build Step

The script that is cut off looks like:

set MSBUILDDISABLENODEREUSE=1
"C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" YouApp.sln /m:4 /nr:false /t:rebuild /p:Configuration=Release /p:Platform=iPhone /p:ServerAddress=%MacIP% /p:ServerUser=%MacUser% /p:ServerPassword=%MacPassword% /p:ContinueOnDisconnected=false

By the time you read this this issue will hopefully be resolved but maybe someone will find the above helpful.  That or it’s just me experiencing it due to some weird configuration issue.

P.S. – Xamarin 4.1 also moved and renamed the where the IPA gets created and this will also break you build scripts.  The IP is now created in a time-stamped folder just to make it more of a challenge for your script.  You can read more about it:

https://forums.xamarin.com/discussion/67044/ipa-output-location

Again hopefully this will be fixed the IPA file created in a non-time-stamped location.

Update (August 16th, 2016):

The problem of MSBuild not ending was fixed in the latest Xamarin for Visual Studio release (4.1.2.18) so it’s no longer an issue.  Ignore my above blog post.

That said  my above solution didn’t fully fix the problem.   What I ended up doing was creating a PowerShell script to kill MSBuild.  In TeamCity after the compile step create a PowerShell build step with the following script:

Stop-Process -processname msbuild

This build step is no longer needed but I include it here for completeness sake.

Posted in Code Examples, Software Development | Tagged , , , | Comments Off on Fixing MSBuild not Exiting