Software Engineer, somewhere between irritated and annoyed.

What the fuck woke my PC up

My PC hates hibernating, in fact it hibernates for a whopping minute then wakes up due to the genius default driver power management settings. Quick way to find the culprit. Open command prompt and ask... C:\Users\Chris>powercfg -lastwake Wake History Count - 1 Wake History [0] Wake Source Count - 0 Of course if it had woke up it would tell you what caused it. My network card had reset its settings during…

Updating / Restoring Nuget Packages FAST

The VS NuGet client is great for browsing for new packages; in fact it works pretty well for upgrading when your on a small project. But it locks the UI, lags out, if it errors it does so in a useless fashion, the moment you get past a few projects it becomes unbarably slow (especially updating cross solution) and half of the time you just want to stamp on it. Restoring Nuget Packages Create a file,…

NuGet from command line error - Microsoft.Build.Exceptions.InvalidProjectFileException

Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "E:\_PROJECTS\x\c\src\Services\Azure\.nuget\nuget.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. E:\_PROJECTS\x\c\src\Services\Azure\x\x.csproj at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args) at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(IElementLocation elementLocation, String resourceName, Object arg0) at…

Set Up TeamCity on Ubuntu 14 LTS

Prep essentials Change versions to latest as required... _JetBrains version is on this page: https://www.jetbrains.com/teamcity/download/ PostGres Driver version is on this page: http://jdbc.postgresql.org/_ SSH into your server and lets begin. Go root, type sudo su. Cheat mode (skip to : Create a Database Config file for PostGres) wget https://gist.githubusercontent.com/ChrisMcKee/a45e5cd5d7d9b8f9fa00/raw/2b4a8fea3fcff9e6675e560e908fa785d6ac2697/teamcitysetup.sh && chmod +x teamcitysetup.sh && ./teamcitysetup.sh apt-get…

Forcing SSLv3 Upstream in NGINX... fml

Sometimes you have to make sacrifices; often I wish I could place IT professionals at large Banks on a sodding Altar and cut their balls off. Anyway. In some rare horrible occasions you need to force the type of ssl used for an upstream. You do that as follows. upstream shittyserver { server 8.8.8.8:443; } server { listen 443; server_name dodgyproxy.com; access_log /var/log/nginx/access.log; error_log /var/log/nginx/…

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

If you need a different version or are targeting a different version of Java, change version number accordingly the rest is the same. Going in hard; lets get some root on sudo su Enter password if you need to. If you prefer, you can enter sudo before each command. Install Java apt-get install openjdk-7-jre-headless Find Java Little tip: Installing locate helps a whole lot on Linux, in ubuntu it's usually installed by default (if it's not,…

Dear Umbraco… I Can Haz Content?!

Basic mission; code not my own. Create an advert type; consisting of URL and Image. Additional requirement created setting the type of advert (using uComponents) An AdvertContainer (Doc Type) With two 'types' of advert (i.e. 3rdparty/mpu) ThirdParty contains JS (no image/URL) MPU contains Image/URL var nodes = GetMultiNodeSelection(1101, "adverts"); Foists off into some god awful linq abuse… private IEnumerable<IContent> GetMultiNodeSelection(int id, string property) { var node = _contentService.GetById(id)…

Lowercase Routes in ASP.net MVC4

Back in MVC2 days I wrote a post on setting up a project with lowercase urls / redirecting and a workaround for IIS6. Luckily these days we have MVC4 which is a tad friendlier… to a degree. In the Route collection registration area (Most likely in App_Start lest you've moved it) you can now simply add routes.LowercaseUrls = true; (http://msdn.microsoft.com/en-us/library/system.web.routing.routecollection.lowercaseurls.aspx ) The big bugger about this…

Self Referencing Table Joins in FluentNHibernate

A common usage of the self-referencing joins is the use of 1 table for regions and subregions; its also the laziest example that comes to mind. Entity using System.Collections.Generic; using Domain.Base; public class Region : DomainObject<int, Region> { private IList<Region> _subRegion = new List<Region>(); public virtual string Name { get; set; } public virtual IList<Region> SubRegion { get { return _subRegion; } set { _subRegion = value; } } } ClassMap using Domain; using…

Using Umbraco Content Service outside of Umbraco context/control in Umbraco 6

In order to make user of IContentService outside of Umbraco Controllers/Views/etc you're going to need to expose it. Much in the same way you'd setup NHibernate to create a session factory on application start we grab IContentService and make it accessible. In this case via UmbracoApplication.UmbContentService UmbracoApplication.cs namespace XXX.UI { using System.Web.Http; using System.Web.Mvc; using System.Web.Routing; using Umbraco.Core; using Umbraco.Core.Services; public class UmbracoApplication…

Magento Export Customers with Address

Simple way to export your customers from Magento with their address. In the ADMIN on the menu select System -> Import/Export -> Dataflow Profiles. Select customer on the dropdown then go to the run profile tab and click go. It'll save it on your server in the /var/exports/ folder. By default this will come out with their billing address. Yep, that simple.…

Creating URL Slugs / Permalinks in C# (csharp)

Bit of a code dump but what the hey it will have to do. In wordpress we have a wonderful set of functions that takes your title and converts it to a URL friendly version in the slug or permalink area. This also handles foreign characters converting them to their standard ASCII equivalent. I generally use two string extensions in C# to perform this task; its incredibly simple and pretty darn clean (I hope). Feel free…

Good Sir, Before you UnLoad – cross-browser JavaScript headaches

Sometimes when working with Booking processes and long forms you come across the need to slap that old cross-browser tart, the before-onunload event to warn the user that they appear to be trying to exit the page in a dramatic way (close tab, browse elsewhere) which contradicts the purpose or intentions of the page they’re browsing. So what can we do to assist our user without being a pest; the old beforeunload dialogue event handler…

CSS3 Recipes for Internet Explorer 6, 7 and 8

Recently as a quick fix to a headache I resorted to adding ‘behaviour’ css modifiers to my IE scripts to add CSS3 style behaviours for IE6/7/8; its a quick and easy thing to do simply refer to http://css3pie.com/ , but before you wonder off test one thing for me. Grab the file from that site and upload it to your server, then reference it in a page (nick the source of that webpage…

Fix Magento 1.4.1 @domain.biz Checkout issue

Updated in Magento Trunk Kids >> http://twitter.com/YoavMagento/status/12243446220 @chrismckee fixed in trunk thx for the report— Yoav Kutner (@YoavKutner) April 15, 2010 Nothing makes my week like another bloody issue. Magento as of 1.4.1 will not allow a customer to move on in the shopping journey if theyre using a .biz domain name. This is a simple bug to fix and simply an omission in the original code and someone…