Tips for a .NET startup

Tips for a .NET startup

Over the past two years I've been standing on the shoulders of giants (read: stealing code/ hiding my sources) in order to create and launch my start-up (oh how I hate calling it a start-up).
So, if you use .Net and you'd like my opinion on some of the best tools and techniques out there, read on my friend, read on....

For many of you the following list may seem a little obvious, for others it may be a revelation, take it as it comes:
Most of the items listed below are FREE where they are not, I tells ya.

Subtext: If you cannot spend any money but you have an awesome tech idea, guess what, it. doesn't. matter. anymore.

PS. If you are looking for a comprehensive and detailed list of developer power tools check out Scott Hanselmans list.

*I'm going to be updating this list as we grow so check back for updates.

**This is quite a long post, think of it more as a reference/cheat sheet than a short story.


Contents

1. The Basics - Frameworks, cloud, source control.

2. Business Applications - Micropayments, telephone, email, domains.

3. .Net Specifics - ELMAH, PDF generation, minifying HTML, IIS caching.

4. Image Tools - Optimising, sprites, background removal.

5. Debug Tools - Firebug, YSlow/Pagespeed, Fiddler.

6. Database Tools - Dapper, SQL schema/data migration, mini-profiler.

7. Website Monitoring Tools - Monitor.us

8. Security Tools and Processes - Changing defaults, security analysis, remove default headers.

9. Productivity Tools - Resharper, DropBox.

10. Text Tools - Merging, reading huge log files.

11. Contacting The Customer Tools - Cloud email services, email formats, SMS.

12. Layout, Branding, Fonts, Icons - Layout, logo/brand design, web fonts, icons as fonts, stock images.


1. The Basics

Web Framework

ASP.NET MVC

Naturally, Its the core of our Web app, and its awesome. Simple yet extensive ASP.NET is one of the main reasons our product made it to market with such impact, as the framework never gets in the way any allows you to get on with what you need to be doing, namely writing code.
Interesting links: Lifetime of a ASP.NET MVC 5 request

Cloud Compute

Microsoft BizSpark

Let me be quite clear. Bizspark has had a MASSIVE positive impact on our startup, it removes the barriers to creativity and experimentation. I'd go as far as to say we would be at least 6 months behind without it.

If you intend to build your software on Microsoft technologies, if your company is less than five years old and privately owned, and if you turnover less than $1m, you probably qualify.
Bizspark gives you three years of incredible access to over 900 Microsoft products and £100 of Azure credits per month. Its really allowed us to build a sustainable business for literally £0 of infrastructure/software cost.
We primarily use the virtual machines and database services, but as you can imagine, there is not much they don't offer.

Amazon Web Services

Similar to the Azure offering, you can get twelve months of AWS services for free. The overriding message here is that if you have a product idea, or are creating a startup, there is little reason to part with your cash until you have to as there are plenty of free-offers available.

Source Control

We use Assembla and they support Subversion, Git, Perforce and offer:

1 Private Project & 2 Team Members
1 Repo, 500MB Storage

For FREE... so, if nothing else it'll get you started.
I have had zero issues with Assembla, its rock solid and I totally recommend them.

Recently I've also been made aware of BitBucket (Mercurial/GIT) who offer unlimted repositories (and unlimited space, subject to fair use) for up to 5 users.


2. Business Applications

Taking Micro-payments (i.e. <£5) online

I did alot of research into the cheapest way to take payment for products/services that cost a total of less than £5 online, the winner?
Paypal Micropayments It costs 5% + 5p per transaction (their normal fee is 3.4% + 20p). You have to call them to ask for it, they will ask you some questions, but generally it'll be set up in less than three days.
Importantly, if your product range includes products/services that cost prices both under £5 and over £5, you can use server side logic to decide which type of transaction to complete (i.e. micropayment or normal). Significant savings to be made.
They have a decent enough sandbox environment too, so testing outside of live is pretty straight-forward.

Telephone

If you need a landline telephone number to give to contacts but haven't actually got a physical landline telephone (maybe your start-up is operated from home), then Skype Number is the way forward.
Essentially you get to choose a landline number, when peope call it it will appear as an incoming call on Skype. You even get free voice mail!
It costs me £4.03 per month for a number I can give out to anyone with a telephone. Gold dust.
And trust me.. this way is waaaay cheaper than any other solution I could find.

Email Hosting

Assuming you have a website, lets say foobar.com, you want to start hosting email like [email protected] or [email protected].
My advice would be DON'T use Google Apps they charge £3.30 per user, per month.. that's expensive for hosting email (granted you get access to other google apps too).
Instead go for Zoho mail its free for up to 5 users, and once its set up you can connect it up to your local mail client, easy.

Finding a domain

I often joke that the best ideas start with a domain name (I mean, who needs a solid business model when you have domain like www.superlazermonkey.com, I jest).

Domainr is my go-to, as its got a cool autocomplete and tells you if/where the domains are available.


3. .Net Specifics

Error Logging - ELMAH

I'd go as far as to say that ELMAH is the best package I've ever used with MVC.net.
Presently we don't use Log4Net, we just use ELMAH. (Yes, I realise they are supposed to be used for different purposes)
That's how good it is.
It catches unhandled exceptions, logs them to a database and has a super easy-to-use UI to inspect the exceptions.

In addition, if you want to raise your own errors to the log simply do something like:

Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
// Or where you don't have a HTTPContext:
Elmah.ErrorLog.GetDefault(null).Log(new Error(ex));

PDF Generation

There is a great tool called WebKit HTML-to-PDF, its an .EXE that allows you to pass in HTML and get out a PDF document. As its an .EXE so you'll have to decide how to best call it, or wrap it up, but its fast and accurate. We use it in conjunction with RazorEngine which is a standalone implementation of the Razor view engine.
Essentially we have a .cshtml file with our template in it, we run that, with a viewModel through RazorEngine to get HMTL, and pass the HMTL to the WKHTMLtopPDF.exe, out comes a pdf which we then email to our users.
You can use RazorEngine for all sorts of things, we use it to generate PDF's and also to generate emails. If you are going to use it you going to want to read this stackoverflow post for some great tips and tricks.

Minifying HTML

One of the things Google page speed will almost always complain about is that you have not minified the HTML on your website, they will suggest something like this:

Compacting HTML code, including any inline JavaScript and CSS contained in it, can save many bytes of data and speed up download and parse times.

Now, when I see this I thought a few things:
1) How much bandwidth is this really going to save?
2) Is minifying each page on-the-fly going to add an overhead to the page load time that renders minifying the HMTL counter-productive?

However a better solution is to minify the HTML on publish, so the HTML is already sitting their in its minified state. Dean Hume has a great guide on how to do this, essentially its a post publish task, and it works like a charm.

FYI: We started out by using Meleze minifier, this minifies the content on the fly, so has a small over head, but in my opinion Deans solution is way better.

IIS Caching

Did you know, out of the box, IIS 7 won't add any HTTP Expires headers to your website content? This means all HTTP requests to all content cannot be cached locally on any browser. Much of your content will be static, you can either configure Expire headers for your whole site to cache content for a specific period of time, or set an Expires header per folder/file


4. Image Tools

Optimising Images

Most of the images used on a website (jpg, png, giff, tiff etc) can be reduced in file size without any loss in quality.
I've used PNG Guantlet to do just this on our website, it means we never push a byte more than we have to. There is an option to overwrite the original files, so you can run it adhoc, or as part of your build.

Image Sprites

Just a note really.. its a no brainer.. if you have lots of images on your site, combine them into a CSS image sprite to reduce HTTP traffic, lots of options: http://zerosprites.com/, http://www.spritecow.com/ are two examples.

Image Background Removal

This is quite specific, but useful non the less.
Have you ever got an image and you want to remove everything but the 'object' in the photo? Problem solved: http://clippingmagic.com/


5. Debug Tools

Firebug

For me, Firebug is the best HTML/.JS/CSS debugging tool out there, its just an opinion, but there it is. I feel like I am fighting against the other tools, whereas Firebug definately has the principle of least surprise built in.

YSlow / Page Speed

I use both of these as plugins for Firefox. Its important to understand the rules, not just follow them blindly, but these tools can really help you identify quick wins in terms of your site page load time.

Fiddler

For those times that you need to see EXACTLY what is being sent by the server and received by the client, Fiddlers your tool.


6. Database Tools

Dapper

Dapper is a single file(!!) that you can drop into your solution to start writing SQL against your database. There is nothing I have found it can't do, its SUPER fast, and super easy to use. I use it for everything, SELECTs, INSERTS, Stored Procs, you name it.
Example:

var dog = connection.Query<Thing>("SELECT * from Things WHERE Id = @Id", new { Id = myId });

SQL Server schema and data migration tool

This has saved me many, many times.
One of the big issues with 'Cloud Databases' is how do you get data into them, and how do you migrate schema/data between them? Problem solved.
It's misleadingly referred to as the SQL Azure Migration Wizard, and although its true that it works with Azure, it works with ANY SQL server instance (I, for example have used it to migrate from Amazon RDS to Azure SQL Server). Its essentially a GUI on top of BCP.exe, and is truly excellent.
(For example I used it to migrate twelve million rows in 12 minutes.)

SQL Express Mini-Profiler

If you are running on SQL-Express in your development environment like us I recommend this tool, its a simple .exe that allows you to inspect SQL commands, and avoids having to 'drink from the firehose' of the full SQL Profiler.


7. Website Monitoring Tools

Want to know when your website goes 'down'? Monitor.us offer free monitoring of a website via email alerts and a useful dashboard too. You can also pay to receive SMS's when the website is 'down'


8. Security Tools and Processes

Changing Default Ports In Azure

Azure ports configuration

If you are using Azure, I'd advise changing the default ports for both Remote Desktop and Powershell. The reason I advise this is purely that the default ports mean 'hackers' will run bots against these ports all day, everyday, trying to guess your login details. You can see these failed login attempts in Windows Event Viewer. Simply by changing the default port reduces this by about 99.99%. (In truth, since changing the ports we haven't seen any hack attempts). Changing the default ports does not mean hackers cannot find the RDP port, as they can perform a port scan and inspect the responses to see the RDP signature, however, in practice, they'll try port 3389, get bounced and move on to someone elses box.

Can't change the port from 3389?

No problem, we have this situation too. I installed a great tool called TS Block it blocks IP's based on the number of failed attempts.

Security Analysis Of Your Site

The first thing I'll recommend is that you run your website through the great Automated Security Analyser for ASP.NET Websites it'll tell you lots about potential issues.

Remove default HTTP headers

Next, I'd recommend removing the default MVC response headers (spolier alert, removing the 'Server' header is hard) you can read how here: http://stackoverflow.com/questions/3418557/how-to-remove-asp-net-mvc-default-http-headers


9. Productivity Tools

ReSharper

A visual studio productivity tool, it costs money, but wow, it makes it much easier to navigate and refactor code. Over the lifetime of my company has probably saved me many 'man weeks'.

DropBox

99% of you know about this, but I want to reiterate how it simplifies your life. It means I can dump files I use at different PC's/Laptops into DropBox and avoid the whole 'damn it, that file is on another computer' moment. Not to be underrated.


10. Text Tools

Merging Files

For me, nothing comes close to P4 Merge, it Perforce's merge tool and its effortlessly good.

Reading HUGE log files

If you need to open a massive text file (read-only) on Windows (think 1GB+) try Glogg, most other tools I tried on windows died when trying to open a multi-gig file.


11. Contacting The Customer Tools

Email services in the cloud

I've only used two, and I recommend both.
Amazon Simple Email Service - Their free tier allows you to send 2000 a day for free, see link for full pricing details.

SendGrid - If you are using Azure its actually free to send up to 25,000 emails per month

Email Formats

I wanted the emails we sent out to be HTML with no images (because 100% of clients will block the images anyway and make the email look poor), and I didn't want to reinvent the wheel.
Take a look at mailchimps free email templates if you want some tried and tested email formats and styles that will render well in any inbox.

SMS Sending Services

If your service sends SMS txt messages this is for you:
After much price and service comparison we settled on using TextMarketer they have an easy to use API and are cheap, job done.


12. Layout, Branding, Fonts, Icons

Layout

Twitter Bootstrap wins.

If you would like a site that will work across a wide range of devices (all with different physical screen sizes and resolutions) you are going to need this.
Its grid system means you can split a page into parts and guarantee it will be responsive.
I'd go as far as to say, if you are are not using this, you are going to need a darn good reason.

Logo/Brand design

If you are concerned about creating a good looking site, perhaps one of the first things you will think about is your product/service logo. I can heartily recommend 99Designs.
The premise is simple, you create a brief (a description of what you want your logo to look like) and designers submit entries, you give them feedback, you iterate, and then you choose one. Its fixed price, and under certain bands, if you you don't find a design you like, you don't have to pay a penny.
We probably got 40-50 different designs submitted over a week.

Web Fonts

Google Web Fonts

Lets be clear. You don't need to use a Web Font.
Arial, Tahoma, Times New Roman.. they are all fine.
But.
If you're site requires some personality, use one of these.

Icons as fonts

Difficult concept to describe, but basically it saves you from having to insert images for popular graphics (think arrow up down, tick, cross etc.)
Perfectly delivered by Font Awesome. They have an icon for most common uses and its super simple to integrate.

Stock Images

If you need a few stock images and don't want to pay the Earth for them I can recommend ShutterStock they charge £29 for a one year subscription, in which you can download up to 12 medium sized images. That's £2.41 per image, which is pretty fair.