Home > Blog

Attackmonkey Blog

Upgrading to Umbraco 7.3

A week or so ago Niels from Umbraco tweeted that you could now upgrade the database from an old 4.7.1 install all the way up to 7.3 with the new installer. This was pretty exciting news, as upgrading Umbraco (especially through a lot of versions) is traditionally a very painful experience.

As luck would have it, we had a client who wants to update an old 4.7.1 site to 7.3 to use some of the newer features. Fortuitously, it's also a fairly simple Umbraco install with only handful of plugins, most of which aren't needed in 7.

So, fully expecting things to not go as smoothly as expected, I embarked on my upgrade quest. I decided to do a fresh install of 7.3 via Nuget into a VS project, and then merge in the relevant config bits into the site. I'd check the database had upgraded OK, then add back in the bits that I needed. Next I pointed the installer at the old 4.7.1 database (use the customize option during the setup wizard). Finally I copied in my masterpages, CSS, JS and images.

I ran the wizard and immediately hit an error that I thought was down to some of the additional tables in the database, but which turned out to be down to an issue with schema ownership in the database. Once I'd fixed that, I ran the installer again, and crossed my fingers. About a minute later, and BAM!!! I was staring at the 7.3 back office with all of the content from the old site in it!

I went through the site, and everything seemed to be working fine, happy days! I then swapped the uComponents tree pickers for the built in multinode pickers (as I was storing them as CSV already), and viola, it all worked! I had to go through and re-add some of the associated packages, but other than that, I was golden. I ran into a couple of minor gotchas on the XSLT front, mostly caused by the site using EXSLT extensions that were removed from the site in v7. Those were pretty straighforward to fix though.

All in all, I'm very impressed with the way it went, it really was remarkably straightforward, and it makes upgrading much older sites a much more appealing prospect. If you have a more complex site with tons of custom DataTypes etc, you'll need to port those to Angular and migrate the data, but for most simple sites, it should be relatively painless to upgrade from the look of it.

Kudos to the HQ guys for the hard work they've put into this, it looks like the effort paid off!

Once I've fully completed the upgrade, I'll document it here on my blog, to help anyone else who's considering upgrading older sites.

Protecting Your Admin URL With IIS Rewrite

If you have an Umbraco site that's load balanced, you may have a dedicated admin sub-domain to force your users to use the primary server (e.g. admin.yourdomain.com). That being the case, you may also want to lock that domain down so not just anyone can access it.

You COULD do that with IP restrictions in IIS, but that doesn't allow for the client wanting to work on a train, or in a coffee shop, or for you needing to jump onto the site away from the office in case of emergency.

I came up with a simple solution that uses IIS Rewrite. You can use IIS Rewrite to check the value of cookies, so on the admin site, we allow access only to the /umbraco/ URL so that you can log in. Any other URL will result in you being redirected to the primary domain. The rule checks for the presence of the UMB_UCONTEXT cookie that's set by the back office, and if it's set, it allows you to access the rest of the admin site. Simples!

Here's an example of the rule:

<rule name="AdminLockout" stopProcessing="true">
                   <match url="(.*)" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{URL}" pattern="(favicon\.ico|umbraco|webresource|scriptresource)" negate="true"/>
                        <add input="{HTTP_COOKIE}" pattern="UMB_UCONTEXT=(\b[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}\b)" negate="true" />
                        <add input="{HTTP_HOST}" pattern="^admin\.mysite\.co\.uk" />
                    </conditions>
                   <action type="Redirect" url="http://www.mysite.co.uk/{R:1}" appendQueryString="true" />
             </rule>

 

I Went Mac, Would I Go Back?

So, at the beginning of last October, I switched to a Macbook Pro as my primary dev laptop, having used a collosal desktop replacement for the last five years. I've been using it now for four months, so I thought I'd post a bit about how I have it set up for web dev and what I think of it.

First, my set up. I decided to go with dual boot using Bootcamp, and then run the bootcamp partition as a VM. My reasoning being that I'd like to experiment with using OSX for my productivity stuff (email, office stuff, general browsing), and Windows for the heavy duty work stuff. Having the option to boot directly into Bootcamp also meant that if I wanted to do anything that would run better natively (like light gaming for example), I have the option of booting straight into Windows if I want.

I split my drive 50/50, 500Gb for the Mac, 500Gb for Windows, and installed Windows 8.1 on the Bootcamp partition. Although setting up Bootcamp is meant to be simple, in my case I ran into loads of issues installing it from a USB pen, and in the end, I installed from a USB CD-ROM drive, which worked perfectly first time. Just works my arse, but in the grand scheme of things, not a massive issue!

Once that was up and running, I set up the VM software. It was a toss up between VMWare and Parallels, but in the end, I decided to go for Parallels, as according to current benchmarks, it was slightly faster. I set that up, and it was pretty straightforward. I split the resources of the MacBook 50/50, as that should be plenty of grunt for most of the web dev work that I do on the laptop.

Next, I set up all the dev tools I use on Windows on the Bootcamp partition (SQL Server, various versions of Visual Studio etc), apart from the abysmal UI on 8.1, this was pretty straightforward, same as with any straight Windows PC.

If you're running your Bootcamp partition as a VM, there is one thing to watch out for, Windows will think that the VM is a new install, as the hardware in the VM is different to the Bootcamp partition you installed it on. You have to register it twice, in a specific order, and you should be set (your VM software's website will have a page detailing the steps). It involved making a call to a number to get an activation code. If you're running a non MSDN version Office, you'll have a similar issue, except that as far as I can tell, you can only activate it on one of the instances. I have Office on the Mac, so I left Office on the Bootcamp licensed to the bare metal.

Importing emails onto the Mac was a ballache, I used LiveMail on my old PC, which doesn't export in a format that Mac Mail will read. In the end after evaluating various Mac email tools, I decided to use Outlook on the Mac, as most of my clients use Outlook anyway, and it works just fine for my relatively simple email needs. If you don't want to run Oulook, you'll probably have to fork out for a third party mail format conversion tool, which is a pain in the arse.

Now that I'm set up, I usually have one screen set to OSX with all my mail etc, and the others set to the Windows VM. It works pretty well so far, and I've not run into any show stopping issues. I use an external mouse in most client offices, and a keyboard at home.

The keyboard takes a bit of getting used to, but to be honest I got used to it fairly quickly. The only times It causes me problems mainly now is on older versions of Windows Server over RDP, which don't map the keys correctly, so it treats your keyboard as a PC keyboard, so you have to remember where all the keys are on a Windows keyboard.

I did think I'd miss the extra screen estate dropping from a 17" screen to a 15", but so far I've been pleasantly surprised, and I've not missed it as much as I thought I might. I suspect the hihj density screen helps in this regard.

Here are some of my thoughts on things I like about the set up so far:

  • The hardware is excellent, light, nicely laid out, the power brick is teeny tiny, and it all seems to work well
  • Using VM software is handy as if needed I can set up test VMs to try and replicate bugs etc and try out new versions of Windows quickly
  • Having both OSs makes testing browser bugs that bit easier, as if someone says somethings broken on a Mac, I no longer need BrowserStack or whatever, I can just switch to my OSX desktop and test it
  • The high resolution screen is very nice, OSX handles it way better than Windows does though. Random parts of Windows will just upscale badly (IIS is a prime example), whereas other parts of the OS scale just fine, Microsoft REALLY needs to sort this out, high density screens aren't that rare any more, and it's a bit embarrasising that some stuff works and some doesn't in the OS
  • The battery life is VERY good, although to be fair, I'm coming from something where the battery could charitably be described as a decent UPS, rather than something you could use for extended work
  • Boot up is FAST
  • Sleep and wake up is equally impressive
  • Syncing across other Apple devices is realy well handled
  • The track pad implementation is REALLY good, I've yet to encounter a Windows laptop that comes close

Now that I've covered some of the stuff I like, here are a few gripes:

  • Lack of ports, if you like having a fuckton of USB stuff plugged into your laptop, you're going to need to buy a hub, or daisy chain stuff together (actually not that big an issue for me most of the time)
  • No Kensington lock, probably not a big issue for most folks, but some of my clients require that machines are locked to the desk during work hours (you can get a case with a lock slot, but it's not as good as having it built into the laptop)
  • Not including a DVI adaptor in the box. Seriously, on a 2K+ laptop, you don't include the cable for the most common screen adaptor? That's just cheap IMHO (you do get the Ethernet adaptor though)
  • Not being able to snap windows in OSX, you can buy extensions that let you do it, but this is something you've been able to do in Windows for a while, and I miss it on OSX, I'm fairly shocked this still isn't something you can do natively in OSX
  • The lack of upgradeablility, I maxed the spec to maximise the lifetime of the laptop, but amost every laptop I've owned has had extra RAM/HDD upgrades, and the fact that I can't on this one rankles somewhat
  • Finder is bobbins compared to Windows Explorer, it's OK, but it feels like a toy compared to the Windows equivalent

With all this in mind, would I recommend this set up? If you've got the money to burn, and you want to try new stuff, then I'd say yes. For someone like me who does a bit of everything web dev wise, it's a pretty flexible setup. If you're just going to do Windows dev on it, it might not be as useful. Would I go back to a pure Windows setup? Possibly, it would depend what was out there. My requirements in five years might be completely different to what they are now (indeed the changes in my requirements in the five years since my last laptop prompted my experiment with MacTown). I'm not a system elitist, I'll choose whatever I think will best suit my needs. There are bits of the Mac that I really like, and bits that I'm not so keen on. Running both OS's on one laptop kind of mitigates that though, as I get the best (and worst) of both worlds.

If anyone has any questions about my setup, feel free to ask them in the comments!

CMS Horror Stories

We all know some CMS's are more user firendly than others, but sometimes, even the nicest CMS can be scuppered by an abysmal implementation. Usually this is either the developer not being familiar with the CMS, being on drugs of some kind, or possibly just being a bit rubbish :P

I got to thinking on this recently after being involved in some pitches where the client has stated up front that they hated Umbraco. That's quite unusual for us, most of our clients really love the CMS, so we asked what it was they hated, and got shown the CMS systems they were currently using built on Umbraco. What an eye opener! I think I'd hate my CMS if every single page was just one tab, with a single TextArea that says "Paste HTML here" next to it (and yes, I've seen an actual implementation like this).

We showed the clients some Umbraco implementations that were actual sane, and they changed their mind about Umbraco (yay!) once they saw what you could do with a decently thought out site. This isn't just something I've seen with Umbraco though, I've seen some terrfifying examples with other CMS systems and home grown CMSs as well. Without naming any names, here are some examples I've seen over the years:

  • the aforementioned every single page is a text box that you paste HTML into site
  • a site where the developers put a custom caching framework on top of the CMSs quite fast caching framework, slowing it down to the point that it had to be load balanced just to get even crappy performance out of it
  • a 10 page mobile site that had an insane amount of IOC, business logic and interfaces, probbaly the second most over engineered site I've ever seen
  • sites where all the properties are on one page, sometimes 50+ of them, with little information about what they're for, other than not particularly descriptive labels.......
  • Dropdowns to select things with mystery meat names (how are you supposed to know what Offer 1, Offer 2 and Offer 3 actually are?)

It just goes to show how important it is to think about the editor experience when you build your sites with a CMS. The site could look quite pretty, but if the editor experience is shit, the users will hate using the CMS, and they won't get the most out of it!

So, what are some of your worst CMS horror stories that you've come across?

:)

Farewell to Arms

For as long as I can remember, I've always favoured function over form in my Laptops. From all the way back in the mists of 2001 when I got my first 15" Dell Inspiron, right up until my current (soon to be retired) laptop, my machines have been huge Cold War era looking slabs of plastic that you could beat a man to death with in a street fight if it came down to it.

All of my laptops have been beasts, none more so than my last one, which wasn't so much a desktop replacement, as a desktop motherboard and processor squished into a very large case with a battery that could charitably be described as a fairly decent UPS. That said, it was, and still is, one of the best laptops that I've ever owned. It could chew through hardcore builds and tasks like a chainsaw. It had more ports than you could possibly want to use, and was insanely expadable and upgradeable. But, it came with some significant downsides, which became more of an issue as I worked in client offices more, travelled more, and started cycling into work:

  • It was heavy (almost 10kg including the brick), it got to the point I was leaving spare bricks at random client offices, just so I didn't have to carry them round with me
  • I looked at folks using their laptops unplugged, and wept with envy, the 40 minutes or so I could get from the battery just didn't cut it
  • I couldn't travel with it, the laptop by itself took up pretty much my entire hand luggage allowance on most flights, in the end I ended up buying a smaller 11" machine for travel
  • It was noisey, the bottom of it had four huge fan intakes that ran constantly, which meant that being around me was like being around a 10kg slab that sounded like it was about to launch itself into the stars

That said, it was a fantastic bit of kit, and I always joked that no-one was going to nick it (anyone who could run off lugging that lot was welcome to it frankly).

But after a year of cycling everywhere with it on my back, and a few painful walks into Leeds, I decided enough was enough. After much thought and chatting to other devs, I decided to try a MacBook Pro and try something that combined reasonable performance with portability, and the chance to learn sme new stuff.

I'm pretty much set up on the system now, and I'm going to blog soon about how I've set my machine up to help others who might be interested in doing something similar. It's a 15" Macbook Retina and it's set up with Windows 8.1 running on Bootcamp (which I also run through a VM in OSX). My initial observations after a week are as follows:

  • The "Macs just work" crowd can go fuck themselves, seriously. I've had issues getting it set up, just like any other system.
  • That said, OSX is a much fluffier OS than Windows 8, it's much better OS for personal stuff than Windows is currently
  • The hardware is pretty damned excellent. It could do wiith a few more USB sockets, but hey ho
  • The trackpad is excellent, and I don't seem to be suffereing with the keyboard like some folks have
  • Windows 8.1 is really, really bad at handling high DPI displays, especialy with multiple monitors
  • It's light, gloriously so. Anyone who thinks the MBP is heavy is welcome to borrow one of my other machines for a month and see how heavy they think it is then
  • It's quiet, the fans only really kick in when I'm doing something nasty to either the processor or graphics card, and while they're surprisingly loud for such a slender machine, they're still an improvement on the beast

Hopefully I'll get my blog post up on the exact setup that I'm running and how I set it up done soon! Watch this space.......