Posts

NuGet Like a Boss: Part 1 - Don't Check in Packages

Image
After suffering like many with so many Package Restore woes in my projects I decided to make notes on the best way to deal with Nuget packages. Ignore the packages folder Not doing this means you check in the packages which are huge. This is annoying and kind of defeats the purpose of Nuget. When you ignore (and therefore don't check in) your packages folder, anyone getting your source code can run package restore on the solution and Nuget will download the packages automatically. How? First, add a file named .tfignore . This may require some Command prompt renaming as some set ups don't like files beginning with a dot. When you get past this annoyance, open the file in notepad and enter the following: \packages That tells TFS to ignore the packages folder. For some bizarre reason, this doesn't include the respositories.config file. You'll need to add a second line as follows: !\packages\repositories.config You'd think this would be it, but you may

Developing for the Cloud - An Introduction

Image
When you create a web application for the cloud, there are many things that need to be done differently. It's not just a case of saying "I'm doing cloud" and all you're really doing is putting it on someone else's VM. Doing this, the costs are much higher than if the application is designed with cloud in mind. This might be fine from an infrastructure point of view, but the cloud can have profound impacts on development from the ground up. Azure allows us, and also forces us, to engineer our applications completely differently. Forces? Well, this is because when you're hosting in an App Service plan, you're billed based on compute time and resource usage. This forces you to write more efficient code. You can't just write code that performs unnecessary operations and get away with it - the efficiency of code now directly translates to dollars. This demands that you think twice when writing code, espcially loops, to ensure you're being

How to Be an Organised Developer (and spend more time coding!)

As a developer your main focus is to write code. But over time, you'll find that there is a lot more to development than this. If you're not aware of this, you might one day wake up and realise that the notepad file you used for passwords and connection strings has gotten out of hand. Being more organised from the start can help keep you focussed on coding and help you stay more efficient. If you move jobs you'll pick up a lot of information in the first few weeks, you'll want to organise it well from the start. If you stay in the same job for years, the 'other stuff' you accumulate can get messy and cumbersome. Like good code, making an effort to organise yourself well from the start can pay dividends later on, when it comes to navigating and maintaining all your stuff. Here's a list of some of the "stuff" you'll find yourself accumulating as a developer, and how to keep it well organised. OneNote (or Equivalent) An essential tool

Why Bother With Unit Tests?

Image
I still see a lot of scepticism on WHY we should do Unit Tests and if they're really worth it. Of course, they usually add time to the development cycle. They can be hard to create. Quite often, they seem pointless; Why do I need to check if my TwoTimesTwo() method returns 4? Of course it's going to! Well, the benefits of Unit Tests may not always be obvious. Often they're disconnected from the problems caused by not doing them. For example, a manager is not likely to blame a Production issue on the fact that you didn't do Unit tests. Most of the time, if you release some code that performs what it needs to, nobody cares about the quality. However, the people who will care, are those who want to maintain your code later, especially if it ends up being: You; or  A violent psychopath who knows where you live Unit Tests can also help to document code, showing you what it should and shouldn't be doing. They can help you understand it better. But main

The Idea is the Easy Part

Image
Most people are of the belief that coming up with an idea is hard. “If only I could think of an idea, I’d be able to create a business”, they say. They also try and think too big. They hold out for that “killer app” or world changing concept. The next Facebook. But business ideas don’t have to be that ambitious. And they certainly don’t have to be that difficult to come up with. All you need is this simple formula. Idea = Niche + Need Find a niche, find a need. It really is that simple. But let’s dig into it some more. Find a Niche A niche is a small area of interest. A specific area of the market for people with a specific interest. Finding a niche is a balance between finding a market small enough to be focused but large enough to be worthwhile. Finding the right niche can be difficult in itself, but it can be made easier by following what interests you. This is actually incredibly important. Focusing on an area that you’re passionate about will both inspire you and keep you involved

How to Reduce Deployment Risk

Functionality Switches Feature flags controllable by configuration or an "admin tool", are an excellent way to deploy new features. When going live, you can turn on a feature only for your Production test user, and run some smoke tests, before turning the feature on for the wider world. Any issues found later can then easily be mitigated by "switching off" the broken features for live users, while at the same time, leaving them on for the test users so that some fault investigation can be done on Production. Providing there are no breaking regression changes, this will help to avoid rollbacks. Good logging Every significant action should be monitored and logged. Obviously this includes calls to external services, but you should also strive to implement logging based on items in the Acceptance criteria. Log results of actions so that you can see if they match expectations. This allows for granular diagnosis so you can see exactly what isn't working

A Quick Summary of DevOps

Image
What exactly is DevOps? DevOps is the practice of operations and development engineers participating together in the entire service lifecycle, from design through the development process to production support. ( http://theagileadmin.com/what-is-devops/ ) Like Agile, it's a rather large topic, but the main point of it is that developers work much more closely with Operations to ensure a more resilient release cycle. It's also characterised by Operations using many of the same techniques as developers - for example: source control, automation, and of course the Agile methodology.  Adopted by all the big tech companies, DevOps allows for hyper-efficient deployments with much faster releases and far less production issues. In fact, the highest performers use DevOps to do 30x more deployments, 8000 times faster, 2x more successful, with 12x faster Mean Time To Repair than the worst performers (those who aren't using DevOps). As a result, Amazon deploy to Production e

Multitasking with My Work in Visual Studio

In Visual Studio 2012+ there is a button in the Team Explorer you may not use as often as you should. "My Work" contains 4 sections. In Progress Work This contains your current "context", what you're currently working on, your pending code changes. Suspended Work This is the most interesting feature, I think. It allows you to change the context which you are working in so you can switch tasks on request. Imagine you're deep into coding a feature and an urgent bug is raised that demands immediate attention. Your code might not even compile yet but you have to drop it and get a working setup. Simple. Just hit "Suspend" and your current changes will be suspended. But not just your changes. This doesn't just save the current state of the source code, it saves EVERYTHING, breakpoints, watches, open windows. When the bug fix is complete and checked in, simply drag your suspended work back into the "In Progress" section. T

The breakpoint will not currently be hit. No symbols have been loaded for this document

Here are some ways to fix the notorious "The breakpoint will not currently be hit. No symbols have been loaded for this document" issue in Visual Studio. Many of the steps may not apply to your situation, but I've tried to make this a comprehensive list that you can check whenever you get this issue. Get latest code from Source Control Compile. Run iisreset to reset IIS if you are using IIS. Attach to the appropriate IIS instance (or all of them). Add a breakpoint and run your application. If you miss step 3, your breakpoint will not be hit, even though your assemblies has compiled and breakpoint is shown as active. You may need to run iisreset in an administrator command prompt to ensure you have the right permissions. Some more ideas if the above doesn't work: Check where your dll is being referenced from and ensure that is the code you're trying to debug. Check you are in the correct mode when building: Debug/Release as they may put the dlls in

Creating Responsive Tables

Image
When building a responsive website where the main responsibility is to display data in tables, one needs to put some thought into how to present this data on smaller screens. Tables are, of course, as wide as the number of data columns, so this presents some challenges with how to display it when the view width is limited. Using Bootstrap's table-responsive Bootstrap's table-responsive class offers one solution, where the table is given a horizontal scrollbar. This is not ideal as it requires the user to scroll the table to see all the data in a row. This can be done by touching the table but this is not obvious and some users may think they need to use the scrollbar. This then reduces usability when there are more than a few rows in the table - the user would scroll to the bottom of the table before scrolling horizontally, leading to some frustrating vertical scrolling if the data they are looking at is back up at the top of the table. Rotating the Data The