Tuesday, 21 January 2014

Using Private NuGet Packages in Azure Web Sites

After wayyy too long – I’ve finally started breaking up my code into re-usable components and putting together NuGet feeds for them. In many case – I’m trying to put these together into a state that is suitable for others and releasing them as Open Source on GitHub.

However, there is some code that I don’t want to go out to the public – but I still want to be able to break them up into components and generate NuGet packages for them. Enter the awesome MyGet.

MyGet allows you to create your own private NuGet feeds amongst a whole load of other cool stuff – now the next challenge: how do I get Azure to build my site and restore the package from the private feed?

Enable NuGet Package Restore

This is super-easy, and in many cases you might have already done it .

Right click the Solution and click “Enable NuGet Package Restore”. This will create a “.nuget” directory within your solution folder. In here are a few key files:

  • NuGet.Config
  • NuGet.exe
  • NuGet.targets

Now – we just need to tell NuGet about our private package feed.

Update Your .targets File

The “.targets” file is the one we’re really interested in. Open it up in a decent text editor.

You will see something like the following:

<ItemGroup Condition=" '$(PackageSources)' == '' ">
  <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
  <!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
  <!--
    <PackageSource Include="https://www.nuget.org/api/v2/" />
    <PackageSource Include="https://my-nuget-source/nuget/" />
  -->
</ItemGroup>

Go ahead and un-comment the “PackageSource elements and replace the “Include” for the second element with your private NuGet packages feed URL from MyGet.

This will be something like “https://www.myget.org/F/your-feed-name/”.

Push It!

If you’re sane – you’ve set up Azure to deploy via source control. Go ahead and git-add your new files to the repository and push them up to GitHub.

If all goes to plan, your site will be updated using the NuGet package from your private feed.

Happy hacking!

Monday, 20 January 2014

Installing Windows Live Writer on Windows 8

It’s been a LONG time since I blogged – and I figured I’m going to get back ON IT!

So – first things first, I needed to install the awesome Windows Live Writer. So I Google “Windows Live Writer” – and it brings me to this download page.

The problem? This installer doesn’t work on Windows 8. I get the error message:

Couldn’t install programs

You already have a more recent version of Windows Live.

Another quick Google later – and I came across the Windows Live Essentials Page – hit the “Download now” button and you’ll be good to go :)

Side Note: I know that upon expanding “System Requirements” – I can see Windows 8 isn’t listed. But it’s not immediately obvious and the browser knows my OS anyway :P

Monday, 25 February 2013

Could not load file or assembly msshrtmi or one of its dependencies

So, I recently upgraded my Azure Tools to October 2012, and everything decided to fall apart in my deployment environment. Great. Thanks Microsoft.

I installed the latest tools, fixed the code caused by the breaking changes in the Azure Storage Client Library and then having tested locally - fired off a deployment to Azure.

I then got greeted with a YSOD saying:

Could not load file or assembly msshrtmi or one of its dependencies

Erm, say what now? I don't even have a reference to this anywhere in my project. However, I know that when that is the case, this is normally some low-level GAC'd thing that is causing the problems.

A quick Google reveals that I am far from alone on this issue. I ended up trying out the steps outlined

All to no avail..

I Found This Fix

I then did this - and it worked!

  • Right-click your Azure project (the one with the blue globe).
  • Click the "Application" tab.
  • Note that there is a button telling you that you have a newer SDK installed?
  • CLICK IT!
So, it turns out that some minor changes get made to a few files that make all the difference:
  • .csdef file - 'schemaVersion' is updated.
  • .ccproj - 'ProductVersion' and 'CloudExtensionsDir' are updated.
  • .csproj - You're Azure SDK references will be updated (ServiceRuntime, Diagnostics etc.)

I think the killer was the 'CloudExtensionsDir' for me, this changed FROM:

<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\1.7\</CloudExtensionsDir>

TO:

<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\1.8\</CloudExtensionsDir>

There you have it - check for the button in the Cloud Project Properties "Application" tab, and make sure your 'CloudExtensionsDir' is pointing to the latest install of your SDKs, which are located:

C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK

I hope this helps!

Tuesday, 5 February 2013

I'm Debt Free!

Hello Ladies and Gentlemen!

I've just logged into my Internet banking and confirmed it - I'm finally debt free.

Loan Status

The last payment on my last loan went out yesterday, and the only credit I have now is on a air miles card that I pay off in full every month.

My money is my own again.

This is awesome stuff - not only for the financial gain, but also for the immense emotional relief this gives me.

To Be Cathartic..

There was a lot of bad emotion and memories attached to this loan in particular, here's some mental associations that spring to mind:

  • Not being able to afford proper food - basically living on pasta and ketchup during the worst parts.
  • This of course had the knock-on effect of making me unhealthy, I was sick - a lot.
  • No hot water or heating - this actually did wonders for my ability to take cold showers!
  • The banging of the front door as debt collectors wanted to get money I didn't have.
  • The constant stream of red letters, legal threats, phone calls hassling me (I ended up disconnecting the phone).
  • Even when I started to get some cash (after clearing off smaller loans) - I'd still have to toss-up "food" or "heating" over "geek book to improve my skills and get out of this dead-end job".
But the one that really broke my heart - having to lie to my mother and tell her I was OK and not to worry about me.

People sometimes ask me "why?" - why didn't you ask for help, and then I tell them:
… because I got myself into the mess, I had to get myself out.
I made some bad, stupid decisions. I got myself into a bad situation. I was weak and almost ready to throw in the towel. I thought I was done.
 
But when we are at our weakest is when we show our true strength.
 
I had to get through it, for me - for my own.. Manliness! I had to know that I could right the wrongs and come out better for it. Otherwise, what was the point?
 
What kind of person would it make me if I did all this stuff, took money and property from companies that were built by people just trying to put food on the table for their families  and said "ohhh I can't afford to pay you because I am a fucking idiot who jumped into things that I couldn't handle". I'm not that guy. If I screw up, I fix it. No question.

Get Out of the Hole

So I did all I know how to do. I worked. I studied. I gritted my teeth.
 
I also cried, got frustrated, wanted to give up, got depressed, cried some more and got angry. It's really easy to get sucked into this spiral when you can never afford to go out and can't afford TV to distract you etc.
 
But I carried on working, I carried on studying and I carried on gritting my teeth and smiling to the outside world.
 
Then I cleared a debt. Some crappy high interest card loan that I got to pay off another. (LOL)
Then I cleared another - these guys must have loved me because they kept sending me new ones after I chopped it up - and they were so kind to give me more money (I kept chopping them up - I made it my new personal goal to see if I could chop up enough cards to cover the stupid amount of interest I paid them).
 
Then I felt it - momentum.
 
I was on to something. I realised that it wasn't about the penny-pinching and meticulous planning. It was about focusing on the most wasteful parts of your budget and getting them down as low as you can go. Two things come out of this:
  1. You make money. Last week there was no money, now you've found some. Yay.
  2. You lose the stress. Everything else is in hand and you're focusing on the few things you can actually do something about.

Make It Fun

I was always amazed how people that had to deal with horrific things made games out of them (for example, paramedics that score points based on damage at a roadside traffic accident). It sounds sick, but it's a coping mechanism. If you focus on the game side of it, it removes all the emotional stress that you'd normally have so you can actually focus on the task at hand.

I made it a game. Each month I would pick an item from my budget to pick on, then see "how low I could go". My favourite - "Weekly Groceries". Got that down to £10/week. Impossible? No. Boring? Kinda :) Helped me kick ass? Definitely*.

* this actually freed up about £150 a month. Would you say "no" to an extra £150?

Are You OK?

As my momentum picked up, I continued smashing debt - then one day I awoke and realised something..

I wasn't lying to my mother after all. I was OK.

Grit your teeth. Do the work. It may not be easy work, and it will take time. Sometimes there's only one way out of a situation. Toil.

Fast-forward a few years. It's all over.. I now live a life that I truly love. I have amazing friends that challenge me, help me grow and become a better person. I'm not only financially richer - but I'm mentally richer. I'm good. I'm really, really good!

Lastly...

I have to say a big "thank you" to my friends and family - you're everything to me. There are times when you have saved me and you don't even know it.

I love you all.

Now, I have to get back to work ;)

Tuesday, 27 November 2012

HSBC "Fast Balance" App for iPhone - Unable to Verify *RESOLVED*

Wow, this is just a nice big bag of fail..

I recently downloaded HSBC "Fast Balance" since it'll make keeping my budget up to date, but I was having epic problems registering my account with them, I kept getting an error message saying "Unable to Verify" and something about my address not matching up.

Well, after trying about 500 permutations of my address, I was about ready to give up. I ended up getting on the phone to Internet Banking Support (08456 002 290) and walking through it with them..

Turns out, their address validation doesn't seem to like flat numbers. My address is similar to:

Flat X
A Number Some Street
London
POSTCODE

Turns out, in order to get it to validate, I had to do this:

A Number
Some Street
London
POSTCODE

Which in my mind, is a completely different address. Also keep in mind that when I log into Internet Banking, it appears exactly like the top one.. So as far as I was concerned, that's how they had it on the system.

So, dear app developers for HSBC - as one developer to another GET IT TOGETHER!

I hope others find this useful :)

On a similar note - if you bank with Barclays, check out their iPhone app - it's a polar opposite experience. Well designed, easy to use, feature rich and worked first time. Serious kudos to the Barclays development team.