Tuning EntityFramework :: Keeping the Context Alive to Save Overhead

In a lot of articles showing you how to get started with EntityFramework they have a good basis if you're using something like a desktop application where you can easily share the context object around your different classes. In the world of ASP.NET though things become a little more confusing.

Read More

Spicing Up The Required Field Notice

Whoever came up with the saying "There's only so many ways to skin a cat." clearly has never seen the innumerable form styles that the internet spits out every day. The problem is simple: we as developers/designers/people need to convey to a user, that we can't talk to, what they must put in for the site to give them the response they want. Why this simple thing is so hard to actually do probably stems from the fact that there's no skeuomorphism to fall back onto to train users with. There's no defined cue on a paper form to indicate "required" short of writing "required" next to the field name.

Read More

Paging Over Azure Table Results

After upgrading to Azure Storage 4 I noticed that a lot of the old methods for getting continuation tokens no longer work. I wasn't able to find a very clean work around so instead I cheated a little bit.

Read More

Inheriting Legacy :: Why We Can't Have Nice Things

Recently I've been tasked with moving a classic ASP site off of Server 2003 onto something a bit newer because the server is dying (not to mention being sunsetted soon).

While trying to figure out why the database refused to connect (jumping from SQL Server 2000 to SQL Server 2013 presents some interesting issues in a dead language) I found this awesome snippet of try.

Read More

How to Create a Clean Markdown Editor for ASP.NET MVC

For two different projects I found myself needing a nice full screen Markdown editor that works well in browsers. After not really finding a finished solution that I liked I ended up rolling my own with a combination of a few different systems.

I had a few requirements since I was also going to be a user of the editor, so here are the main features.

Main Features

  • Automatic/live preview
  • Ctrl + S to save
  • Code support via highlight.js
  • Unsaved changes notification.
  • Markdown help popup

markdown editor window preview

Read on to make your own!

Read More

Search On Azure :: Using Lucene.NET

Lucene.NET is a port of the popular Java search library Lucene (http://lucenenet.apache.org/). And how very awesome it is.

Recently I was porting a SQL server database to SQL Azure, however the original database contained a full text catalog for the website's search functionality, something that SQL Azure does not support. You can get around this by using LIKE, however depending on how your index is built your performance could be terrible. LIKE '%{word}%' does NOT use the column's index on query, it does a table scan, which in SQL Azure is very costly (slow). LIKE '%{word}' and LIKE '{word}%' will use a column's index though so if your data is structured where it only needs to match the start or tail of the index's contents you will be in luck. Because of the drastic performance hit on doing a table scan for each search it was apparent we needed a new way to handle search, enter Lucene.

Read More

Getting Started with HtmlAgilityPack

The HTML Agility Pack is an amazing .NET code library HTML parser. You can find out about and download it from CodePlex at http://htmlagilitypack.codeplex.com/. If you need to parse out HTML pages this is the library that you want to add to your app. It’s biggest draw back is decidedly its giant lack of documentation. So that others don’t have bruise their foreheads on their keyboards like I did all day here are my lessons learned.

Read More

Why I Edit HTML in Visual Studio

I've been seeing a number of posts of reddit the last few days about different editors and IDEs that people use. Over the years I've worked on a huge swath of them, I even remember thinking that it was never going to get better then BBEdit.

These days I work at a full Windows shop which means .NET and C# day in an day out. It also means Visual Studio 2013 Professional is were I live. Combined with ReSharper it's not just a powerful C# IDE, but handles HTML, CSS and JavaScript incredibly well.

While it's not perfect Visual Studio is an incredible tool for those of us in the world of web. With even more awesome features such as Browser Link and support for new languages and technology like Node and CoffeeScript baked in it should definitely be on your list of IDEs to know.

Read More

PHP :: Making The Silly Mistakes

After seeing this reddit post it got me thinking of all of the very terrible code PHP has let me write over the years. Now that I no longer work in PHP I feel like maybe it's time to impart on the world the stupidity in my ways.

Read More