When .gitignore stops being your friend - Debugging missing Git repository files

comments
One of the first things you figure out when working with Git is that like other source control providers, you want an easy way to exclude files from ending up on your source control to save yourself uploading items such as binaries and local user files (here’s looking at you Resharper!). By adding a .gitignore file to your repository you easily make this possible (if you’re using Windows, feel free to take a look at my post on creating these files successfully in Windows). The problem you have next is when you add a gitignore rule that’s a little too aggressive and your new project files fail to be picked up by Git, but you’re not quite sure which rule is the cause – this post shows you how you can troubleshoot these issues.

Investigating ASP.Net Memory Dumps for Idiots (like Me)

comments
Sometimes your ASP.Net sites crash or hang, and you have no idea why. No exceptions, no event logs. This leaves you a little light on places to start your debug investigation journey. Microsoft Developers who live a little closer to the metal (i.e. non web developers) will know of tools like WinDbg, but for web developers these tools can seem a little scary/low level. This post is aimed at allowing you to get a closer view on your ASP.Net website at the time of a failure, without any of complexity of learning WinDbg on your own.

Html.AntiForgeryToken – Balancing Security with Usability

comments
When writing forms for your ASP.Net MVC websites the common approach to ensuring only real people use them site is to simply add an Html.AntiForgeryToken() to your form’s view mark-up and controller and be on your way. I've recently found out this approach while simple, can actually have pretty serious affects on both how your visitors use of your site as well as their view of it’s professionalism and stability – two things you really don’t want any trouble with.

Make 2014 the year you unleash Awesome

comments
The past year has been a crazier year than most for me. I moved jobs to working in publishing where I've created a new thriving user group within the very company (post to come soon), launched the most awesome way for ASP.Net web developers to deploy their sites and generally loved being a developer for another 365 days. Our jobs are made so much easier by the online contributions of others, and moving into another year we get a chance to give something back.

Sorrow and Elation – Why Reflection Isn't Always Your Friend

comments
Over the past two weeks I've begun moving a lot of my hosting infrastructure onto Microsoft Azure. This has consisted of all sorts of configuration – virtual networks, VPN's, backups, servers, databases and sites. One of my sites uses Code First Migrations at it's core, and during the migration simply nothing would work. After much pain and frustration I made the worst mental leap a developer can make: I came to the simple conclusion that is was everyone else's fault. Like most of these kinds of problems, I was to blame all along.

Deconstructing the Azure Point-to-Site VPN for Command Line usage

comments
When configuring an Azure Virtual Network one of the most common things you'll want to do is setup a Point-to-Site VPN so that you can actually get to your servers to manage and maintain them. Azure Point-to-Site VPNs use client certificates to secure connections which can be quite complicated to configure so Microsoft has gone the extra mile to make it easy for you to configure and get setup – sadly at the cost of losing the ability to connect through the command line or through PowerShell – Let's change that.

Testing connectivity to Microsoft SQL Server without any tools installed

comments
Often you'll find yourself logged into a web or application server and need to simply test that you can get to the SQL server you've unsuccessfully been trying to point your app at. Luckily there is a nifty trick built into Windows that allows you to save the day without having to install anything on your box – and it works on both client and server operating systems just as well.

Let New Relic know about your Deployments with TeamCity and PowerShell

comments
New Relic's Deployment notes features have definitely been around for a while, but like a lot of things experienced by developers outside Microsoft's ecosystem, this is another service where we're a bit late to the party. The ability to track application performance against a certain release of your application is a great way to track the progress of any work your team has put in to improve your application's performance and visitor's overall experience. Implementing it is surprisingly simple which begs the question, if you're not doing it, why not?

TeamCity and Git Behind a Corporate NTLM Proxy Server

comments
Recently I’ve had the pleasure of setting up a new build environment at work to replace our TFS Team Build setup and its build-information-opaqueness. In the process I uncovered a lot of not-so-fun-to-be-a-developer things that our large corporate IT Infrastructure team have in place to keep the masses at bay – one of those things is an NTLM proxy server. And so the head banging began – hopefully I can save you some brain cells and get you home on time.

Testing the Untestable with Microsoft Fakes and Visual Studio 2012 Update 2

comments
When maintaining applications built in ways that make unit testing them high friction, difficult or down right impossible, we often turn to integration tests or no tests at all. Poking around the outside of your logic to see that the outcomes our code produces is often fiddly, brittle and in most cases so time consuming it just doesn’t happen. Lucky for us all, if there has been a case in the past where we’ve been unable to test part of our business logic, Visual Studio 2012 Update 2 is here to offer an answer to your prayers which you just might not be aware of.

Preparing Your Windows Phone 8 App For Submission to the Windows Phone Store

comments
Finishing your Windows Phone 8 application isn’t the end of your Windows Phone journey. You’ve now got to get it into everyone’s hot little hands – by submitting it to the Store. Having developed for the Windows Phone platform now for a number of years, I can attest that just uploading  your XAP file isn’t the only thing required to make this happen. Similar to my post on “Must have tools for Windows Phone” I'll try and fill you in on a few things I wish I'd known before I submitted.

Music to Your Ears - Fixing the Win 8 Music App

comments
Windows 8 comes with some pretty awesome new toys, one of these for me is the Music app. As a Windows phone user for many years now I’ve fallen in love with the all-you-can-eat music subscription service that Microsoft has on offer. Sadly for me when I installed Windows 8 the app simply crashed every time I tried to play music. I searched for months and months, and now have the answer – in the hope that I save someone else the heart ache I’m happy to share what I discovered.

All Bugs Are Not Created Equal

comments
You’re close to shipping and you receive a shopping list of bugs and changes. Some are tiny and un-eventful, some are show stoppers, some let the bad guys in, and some are simply scope creep trying to sneak through the door. It’s hard to know where to start without reclassifying them because the majority of them are all labelled Critical. It’s time to sit down with whoever documented your bugs and do some talking…

Why Nuget Package Restore’s Not For Me

comments
Nuget has become such a valuable part of the .Net ecosystem it's any wonder how we got the job done with 3rd party packages without it. When working on projects in a team many developers turn on Nuget Package Restore to save them having to check their packages into Source Control. This allows them to have their packages download whenever a new developer goes to build. It’s also quite popular with project teams that have Continuous Integration setup. I recommend against Nuget Package Restore, as I’m simply not a fan.

Mobile, Tablet and Desktop Development All at The Same Time

comments
When you go to create a mobile app for each major platform you quickly realise that it’s a mind boggling task with many languages and tools out there to learn along the way. A number of products have arrived over the last few years that enable you the freedom of only having to care about one language and toolset, with the dream being that they take care of the rest. Does this type of approach work? DXTREME does a pretty good job of making the answer to this question Yes.

Entity Framework Code First Migrations in Teams

comments
Migrating to a Code-First or Model-First approach to database development can be very liberating. At the end of the day your database is just a way of storing state, so getting away from the implementation details can really help speed up development and allow you to focus your efforts. Code First’s awesomeness aside, when you try and implement this kind of paradigm shift within a team you unlock a different set of problems. Here are two potential ways to alleviate some of the headaches.

Teaching Your Application to Read

comments
Geeky salesman have spent decades selling us a pipedream of the end of “Tree based communication”. To date not much has changed and I’m not holding my breath. In the mean time, what do we do with all this paper? If like me you are dabbling with ways to get your code to convert the physical to the digital, I’ve got news for you: Smarter people have already solved the problem for you and it’s simply a matter of plug and play.

The Pitfalls of Cut and Paste Coding

comments
We’ve all been guilty of it in our development careers at one time or another. When starting out using a language or framework that you’ve never used before you often have no choice but to. What I’m talking about is the act of “copy paste coding”, and it’s as common in the programming world as chewing gum under seats. When you copy and paste other developer’s code into your application it’s important to fully understand what the code does before you continue; or risk joining the many fools that have gone before you.

Integration Testing FTP Connections in .Net

comments
When writing testable code your first port of call is often to abstract any dependencies and make them easy to mock. This is the same for any of your codebase that talks to FTP servers. Testing the way your code behaves under real world conditions makes integration tests important regardless of abstraction though. Here’s a simple trick to test FTP code in the wild.

Problems with .Net 2.0 Mixed Mode Assemblies inside Visual Studio .Net 4.5 Test Projects

comments
When you include .Net 2.0 mixed mode assemblies in .Net 4.0 or .Net 4.5 projects you often have to add some start up options to your project’s config file to get it all to play nice when your app starts up. This backwards compatibility feature is great as it allow you to use older/non supported projects in your recent work.When when using Visual Studio 2012’s new unit testing tools this magical piece of app.config code doesn’t seem to help though, and the solution is pretty simple.

Setting up a VPN server on Windows 7 or Windows 8 – Secure your Internet use while away

comments
These days we’re lucky. SSL is becoming pretty pervasive. Facebook uses it. Twitter uses it. Most modern start ups now use it. Sadly there are still other sites or services that you may be accessing on the internet that are still insecure allowing others to listen in on your internet usage, and for these your want an encrypted VPN link to route your traffic through. VPN’s can be expensive though if all you have is a home PC and a laptop on the road – lucky for us this can be a magic combination that is all you need and saves the day.

Visual Studio 2012 Web Deployment Projects are Dead – Long Live Publishing Profiles

comments
I’ve been a long time supporter of Visual Studio Web Deployment projects. Not because I built ASP.Net websites and wanted to compile them, but more because they held so much unadulterated power from the simplicity of just being an MSBUILD file inside your solution. With the launch of Visual Studio 2012 Microsoft has made the call to no longer support WDP moving forward. This made me sad; but I was just being naive. Visual Studio 2012’s Publishing profiles are even more powerful, and they bring all your old friends along for the ride.

Up Log Creek Without a Paddle – Part 2: IIS Log File Investigations

comments
When it comes to reviewing visitor site usage, server bandwidth usage, or forensic security investigations; IIS log files often hold the answers. Although as I'm sure you’re more than aware, gigantic text files can be hard to view let alone pull intelligence from. Investigating a website attack can be really daunting when looking at log files as an information source. In my previous post I covered a tool to help with Windows Security Logs. Lucky for us it’s just as awesome when dealing with huge IIS logs.

Up Log Creek Without a Paddle – Part 1: Windows Audit Logs

comments
When bad things happen to either your website or your server you’re usually faced with a situation that either makes or breaks you. Much like having a good backup and restore plan, being able to filter and scan log files for what you need to help draw conclusions on how a situation occurred or by whom it was conducted, is an important part of your security plan. However if you have a heavily traffic’d website, network share or part of your file system and you’re doing a lot of logging, you probably have files the size of the moon to wade through, so making sense of them can be a nightmare.

Micro Benchmarking Your ASP.Net Pages Using Apache Bench

comments
In ASP.net land we are often lead to think the “Microsoft way” when it comes to a lot of things. Running performance tests and benchmarking is one of these tasks where we are often found looking into commercial tooling or products to help us find out how our applications handle load. Meanwhile a lot of web developers on other stacks are doing it with great free tooling. There is nothing stopping us from stealing the best parts from these stacks and bringing them back to the land of ASP.Net.

Show Your Recipients You Care – Avoid noreply@

comments
When delivering messages to people using email, companies and website owners have fallen into a common fallacy about the internet: believing its OK to show contempt for our readers by not caring for their reply. We do this every time we send an email, however important, that comes from noreply@mywebsite.com. Like a number of life’s oddities this doesn’t make sense – let’s look at why and how we can change it.

Autoplay, a New Type of Popup Plaguing the Web

comments
When placing audio and video elements on a web page I’ve worked on a number of pieces of work where, for one reason or another, clients want to have their media Autoplay. To us nerds it may seem like common sense that Automatically playing media to a visitor is a bad idea for accessibility. The W3C has made this clear with it’s WCAG guidelines – we’re nerds; we care about these kinds of things. It’s worth mentioning that as with most accessibility features though, proper use of Autoplay also does a lot for usability and visitor sanity for the rest of your audience as well.

Don’t Accept Gifts From Strangers – Even Through HTML Form File Elements

comments
If you’re developing on the ASP.Net web stack you’ve probably used either the WebForms FileUpload control or the MVC HttpPostedFileBase model binding parameter many times before. On a badly configured website this can create a perfect storm of insecurity potentially exploited by anyone who uploads malicious files. As this very attack can be your website’s undoing let’s take a look at why it’s a problem and what you can do to fix it.

Forget what your Mother told you, IIS and Apache CAN be Friends

comments
Running Apache and IIS on the same web server might seem like sacrilege to some folks, but like a lot of things in life there is a time and a place for everything. I’ve overseen some quite successful deployments that have had the two running side by side on the same machine, and the flexibility that Apache can bring to an application as a value add can be really exciting. For both future keepsake and to share with all of you folk, here is a quick how-to guide so that all you have to do is follow the bouncing ball.

Configure Your Next Website’s Signal to Noise Ratio Today – Install a www. Filter

comments
The "www." prefix in a website's address was originally thought up by Tim Berners-Lee (The creator of the interwebs) to help us differentiate between a website’s address and that of a mail server, FTP, or Gopher server (remember those kiddies?).  The world has moved on from gopher servers and the like, but for different reasons has continued using this prefix without much purpose or reason. In the last few years many people have commented on their religious decision either way to support or ditch it. I put it to you: do you www. or not?

Find, Forgive and Forget Your Coding Indiscretions With NDepend

comments
Microsoft developers hear a lot about tools that will make them write faster, more efficient, more refactored, more unit tested code all the time. People don’t often talk of tools that help you to visualise your project’s growing code smell though – among other reasons, everyone’s inner sense of pride may be a behind this, however unless you or your employer has forked out the $11,879 odd dollars for Visual Studio Ultimate Edition you don’t have much to go on without more than the basic reporting on Cylcomatic Complexity, Dependency Depth and Class coupling reports that come in the pro and premium editions. These don’t really help you pin point any of your architectural problems that well – something  where NDepend proves itself to be a diamond in the rough.

Make Your Own Wi-Fi Hotspot - Testing Development Websites on Mobiles and Tablets

comments
Often you need to test a website on an tablet device such as an iPad using a local development machine’s web server. For whatever reason the available Wi-Fi when developing your site may be on another subnet or network entirely to you development machine (such as in an office environment). Situations like these call for a bit of creative thinking and a different approach, so if this is a problem you face here’s my take on a possible solution.

Things I Missed So You Won’t Have To – WP7 SDK

comments
During my development journey with Windows Phone 7 , there have been a number of things that I overlooked when writing your first app – things I wished I’d kept front of mind. None of these items are necessarily difficult or complicated things to cover off, so I thought I'd mention them here to save you the trouble, and at the same time show you ways to overcome each of them.

DevOps DNS for Developers – Now There’s No Excuse Not To Know

comments
Over the years I have had the luck to work alongside many really smart, switched on people in the development community. I’ve learnt from them many intermediate and experienced programming skills. Generally when it comes understanding the very basis of how the internet functions using DNS, most of these very same experienced developers haven’t got a clue. I wrote this post to hopefully help pay back some of the awesome karma they  have earned helping me over the years, by teaching them something in return. Lets learn about DNS.

8 Must-Have Tools for Windows Phone 7 Development

comments
After developing Windows Phone 7 applications in my spare time over the last year, I've collected an assortment of tools that make developing apps so much easier than when I first jumped in to Silverlight/Windows Phone 7 development. I only wish I'd know about them all when I first started down the Windows Phone 7 path. Whether you are just starting out or have been developing Windows Phone 7 apps for a while now, there’s something here for everyone.

Scheduling TeamCity backups in Windows

comments
Jetbrains’ build server software TeamCity is an awesome product to get up and running with continuous integration and deployment, however with its ease of operation it leaves a few nice to have business features aside. One of these is Scheduled backup – and if there is anything that your career has probably taught you to date, it’s that when things break, having a backup is priceless.

Getting your Windows Phone 7 Device Syncing after upgrading to Mango on a Guest PC

comments
During the big Mango update rush over the last 3 weeks i joined the rest of the Windows Phone 7 Development community and excitedly upgraded my phone from Windows Phone 7 Mango Beta to the real thing. I was so eager to upgrade right now that I did so on my work PC where I connect my phone as a Guest. This happily got me up and running (definite thanks to the WP7 team for doing such a great job of the upgrade experience). My troubles only began when i tried to synch my phone at home a couple of days later. Hopefully i can save a few of you the time i spent looking into this.

What good Web Developers should know about sending E-mail

comments
Nearly all websites these days send email and because of this the majority of developers assume that they “know how to send email from a website”. They continue under this assumption until they have a site or server of their get black listed by a Spam blacklist. Then they are forced to scratch their heads to try and figure out why this happened. Before you hit send on that email requesting to be removed from that Spam blacklist, let’s recap what you should be doing to make sure it doesn’t happen again.

Adding filters to your ELMAH installation

comments
One of the most common configurations people use when setting up ELMAH is email exception logging so that you get notified whenever “shit’s goin’ down” on your site. This leads to a follow on issue that stems from this in that you end up receiving 100’s of emails a couple of times a week as your website gets scanned by evil doers looking for vulnerabilities – but there is a simple and elegant solution.

Using Custom Web.config Transformations in MSBUILD

comments
Web.config transformations have been around for a while now, and a lot of developers use them in their staple day-to-day environment deployment strategies – hell, Scott Hanselman was spouting about them way back in the beginning on 2010 with his “Web Deployment Made Awesome: If you’re using XCOPY, you’re doing it wrong” post. As usual though, one size does not fit all – and in the case of Continuous Integration fans out there that may have specific build-configuration-based build and deployment scenarios (such as myself), there is the need to have finer grained control over the Web.config transformation process. If this sounds like you, then this post is aimed to deliver.

Build Accessible web sites with Visual Studio – WCAG reporting

comments
Adding Accessibility to a website for access by sight or hearing impaired users is a thought that many developers have post build. Along with this, when you’re tasked with the job of building an accessible website, Visual Studio probably wouldn’t initially be a tool that comes to mind, but Visual Studio has everyone fooled on this topic as it has this functionality covered, you just need to look a little below the surface.

TeamCity - When 1 build agent just isn’t enough

comments
TeamCity is one of the greatest tools to hit the Continuous Integration world, with free licensing for 20 build configurations and an easy to use interface it ticks all the right boxes (not to mention ease of use for Windows Users) – but once you splash out on an Enterprise license and grow your installation to house many build configurations you start to want more power, and this is when a second build agent is your ticket to freedom.

An Exercise In The Finer Points Of ASP.Net MVC 3 Model Aware Data Annotations

comments
Anyone who asks me will know that i love the simplicity and elegance of creating ASP.Net MVC’s custom data annotations when writing your own validation in ASP.Net MVC. One situation that can be a tricky one to dig yourself out of when coming to more advanced validation logic is writing custom validation attributes that can see/compare properties between itself and other model properties.

XMLSerializer - Removing Namespace & Schema Declarations xmlns:xsi xml:xsd

comments
The XML Serializer built into the .Net framework is a pretty cool side-utility when working with anything that consumes XML. A few years ago I posted about how your should Make your XML strongly-typed: Because you can and it’s easy in which I discussed how easy and awesome it is to use the XSD.exe tool to quickly convert an XML file into a XSD and then further covnert into a Serializable c# class file. The only not-so-perfect part of using the XML Serializer is that it by default adds namespace and schema attributes that point at the W3C standard declarations – but it’s just as easy to remove these so your resulting XML looks perfectly like your original XML file.

Save yourself the trouble – SQL Profiling your Application the easy way

comments
Microsoft SQL Server's Profiler is a necessity when digging around on a SQL server trying to find any bottlenecks or long running queries. How you personally lock down your profiling session to show only your application's data access appears, from the experience of looking over others' shoulders as well as how I personally go about it, to be a "how you taught yourself one day when first debugging queries". Like most things in dev-land someone had this problem WAY before you and there is a final, easy solution.

Solved: Why Don’t ApplicationBar Bindings Work? – Windows Phone 7 SDK

comments
One of the subtleties I've found recently while working with the Windows Phone 7 SDK is found when working with the ApplicationBar programmatically. There are a number of differences that the ApplicationBar has when compared to a normal Windows Phone 7 Silverlight control – these very differences can be really frustrating if you are not aware of them as they stop you from interacting with it in the same way you do other Silverlight controls. Hopefully after we’ve taken a closer look it will make sense why they are so.

ASP.Net WebForms – Partial Page Caching With The Substitution Control

comments
Often when using built-in ASP.Net WebForm Caching to speed up a page’s output time, people feel pigeon holed into either caching the whole page, or setting up output caching for the majority of controls on the page individually. An often overlooked approach is to use the Subsitution control. This allows you to have your cake and eat it too by caching the whole page, and yet still updating a part of the page on every load.

Visual Studio’s Best Kept Secret – Compare & Update Database Schemas Right From Within Your IDE

comments
When working with different iterations of a SQL database running on Internal, Staging and Production infrastructure it can become a pain in the ass rolling out updates at deployment time or keeping them in sync. Developers often use third party tools to help them do this job, however depending on what version of Visual Studio you have installed, there may be another option you have overlooked, and it’s baked right into the IDE.

How to use ZoneInfo/TZ Time Zones in .Net Applications

comments
While recently working on the live tile implementation for my Windows Phone 7 hobby project InTheKnow, I had a need to implement Unix Time Zone support using a TZ database. This list of Time Zones is widely used by Unix systems around the world as their source of Time Zone information. Sadly Microsoft’s .Net framework doesn’t have any support for this library – but like other parts of the framework that developers have found to be lacking, there is a library out there to fill the gap.

Windows Phone 7 Live Tile Schedules – How to execute instant Live Tile updates

comments
If you’ve worked with Windows Phone 7 Live Tiles, you may have noticed a bit of a hole in the platform SDK’s functionality – the inability to programmatically update the current running applications tile without the push coming from a remote webserver. The purpose of this post is to show you that this is not the end of the world, and there is a way around this. 

Replacing query string elements in c# .Net and JavaScript

comments
While writing list navigation and search features in websites today there is a constant need to find/replace and play with query string elements, so that you can easily manipulate these mystical items while you’re carrying them around in your website’s URLs. I have a few little methods I’ve used over the years and carry with me project to project, and this post is putting them on the record for easy access later.

ASP.Net HttpModule to detect and redirect mobile devices version 2.0

comments
Last year I wrote a post on how to setup an ASP.Net HttpModule that detects and redirects mobile devices so that you can show a different version of your site to users browsing your site using whatever hot new mobile device is going around. Since then the lay of the land has changed a bit, so i thought it was time to reassess the solution i recommended and offer you a new updated one for 2011. The great thing about this solution is it’s a lot more future proof, so hopefully i won’t have to write another blog post next year.

Set up scheduled log file cleaning for Windows Servers running IIS

comments
These days IIS has so many bells and whistles installed that it can be hard to find the settings panel that does what you want it to do (or if you’re an IIS 5/6 guy like me you may just get lost in general some times). The one thing that is lacking as a feature in IIS is log file recycling. If you manage an IIS installation of any decent size, you’ll know first hand how quickly log files can fill up a server’s hard disk, and bring it to its knees if not managed properly – how do i take care of this?

How-to: Quick & Dirty SQL Express scheduled backup

comments
SQL Express is pretty awesome as a light weight database server, and when Microsoft released it using the same database engine as the full version they did the world a huge favour. I have seen SQL Express in use on a lot of Virtual Private Servers & development boxes, but in most cases users don’t backup their databases regularly because of the missing scheduled jobs functionality that doesn’t ship in the Express version of Microsoft SQL Server. Like most limitations there is an easy way around this.

Tips to get your Application in the Windows Phone 7 Marketplace ASAP

comments
So after submitting applications a few times for both myself and a few friends, i have learnt a few a few do’s and don’ts that can make the difference between it taking 2 weeks to get your application in the Windows Phone 7 marketplace, and only a day or two including registration. With the help of the tips below, hopefully i can help some of you avoid any of the frustrations that can come from starting development on a new platform.

Two little tips for working with Silverlight chart DateTime Axes

comments
Over the past few weeks i have spent a fair bit of time creating Silverlight charts for a few Windows Phone apps I've been writing. The Silverlight charting toolkit’s documentation for advanced scenarios is pretty sparse to say the least. My experience in finding information on working with the DateTimeAxis that you can use on these charts was nothing short of frustrating. This post’s purpose is to hopefully serve to better educate others in my situation.

Debugging SQL Queries, Functions, & Stored Procedures with SQL Management Studio’s Integrated Debugger

comments
Working with Stored Procedures and functions on a database tier can be time consuming, hard to debug and sometimes just difficult to get clarity on what is “happening”. A rarely discussed feature of Microsoft SQL Management Studio is its inbuilt debugging features. These allow you to see exactly what is going on, and step through your logic in a similar fashion to working in Visual Studio.