Wednesday, October 7, 2015

Using Web Essentials 2015 Color Palette

One of the most popular Visual Studio extensions is Web Essentials. One of my favorite features is the extra stylesheet support WE gives Visual Studio. Making sure that the numbers of colors in a web site doesn't get out of control can be a big deal. Having a consistent color palette makes a real difference in the overall feel of a web application.

After you install the extension you should see a new menu in the toolbar called Web Essentials. It will look like this.

If you click "Create color palette" you'll add a css file to the Solution Items. This file is named specifically "WE-Palette.css". Do not rename it or move it. If you happen to remove it, but do not delete it then you'll be stuck. The file might still be in the solution folder but hidden from the project. You will have to delete it or Visual Studio won't be able to create it. You'll be stuck in a state of color palette limbo.

In this example I created a solution settings file and a color palette already. The extension sees the existing files and does not let you write over them.

So what does a color palette file look like?

It's nothing to complicated. It's just a list of colors. The trick is that the order matters. When you now type "#" in a CSS or LESS file, Visual Studio's IntelliSense feature gives you a wonderful picker that shows your color palette.

Hit #

It is that easy. It's also easy to extend. So lets add an orange color to the WE-Palette.css file and save the file.

It kind of fits our color scheme. I like it. Let's go add it in our style.css file by hitting #.

Yep. This Web Essentials (WE) Visual Studio extension is pretty darn cool. More stylesheet features can be found at:

Thursday, October 1, 2015

SQL Code Guard Review

Pro Tip: Don't Trust Yourself

I had not used this product for a while but recently installed it again.  When I'm focused on frontend work and other developers are handling the backend, I don't write any SQL.  It's nice to work on teams that have brilliant database developers that you can count on to use best practices.
I'm currently back to being a full stack developer on a project and the database is not my own.  I don't want to make mistakes that might slow up the team.  So I need all the help I can get.  I'm not saying that I'm a bad developer.  In fact, I get a lot of props from other developers on my SQL skills.  But I'm not perfect.
SQL Code Guard is a free add-in for SQL Server Management Studio and Visual Studio.  Sorry, there isn't a VS 2015 build yet that I can find.  That could change by the time you read this.  I use it with SSMS the most. ( You should also install Red Gates SQL Search.  I like it also. )


What does SQL Code Guard do?

The add-in does four different things:
  • Code issues  - my favorite feature
  • Object dependencies - helps solve that oops when Visual Studio missed it
  • Code complexity - Bad SQL is not job security.  It's what should get you fired.
  • Code outline - great for understanding complex stored procedures 


"I have Visual Studio, I don't need anything more."

Visual Studio database projects use msbuild when you build them.  Building your database, parsing it and making sure certain dependencies are checked, is wonderful.  It's probably not enough.  Just take one of your databases that builds fine in VS and use the Code Issues tool in SQL Code Guard once.  I bet it will find something you forgot.  Maybe there is a SELECT *, or a missing ELSE?
You can also add SQL Code Guard to your build.  It even has a Check-in Policy so databases don't get into Team Foundation Server without at least a minimum standard to quality.

My Humble Opinion

The tool is free and is light weight.  I don't see any reason why you shouldn't try it out or give it to other developers.  You might be good enough that the supported issues are just second nature, but maybe a free tool could help.  If it does, then the developers like me who have to work in your database later will thank you for using something.
Whatever you do, please don't leave BP017 out there in your databases.  It's a killer.  See what I did there?  I just dropped a teaser.  Now you have to go and find out what BP017 is. :-)