MVC Bundling and Minification




When MVC 4 was released one of the features that caught my attention was bundling and minification, what does this mean you may ask.

Well Bundling means combining multiple files into one file, i.e. you can create one bundle will all your javascript files and one css bundle containing all your css files.

Minification  will optimize your scripts and css files by removing white spaces and shortening variable names.

The benefit in this is that your pages will make one request for scripts and one for the css files as opposed to a request for each of the required files. 

You do all this in the BundleConfig.cs in the App_Start folder.

That is all you need to do to help speed up your site’s page loads.

What happens when you have done all this but when you watch your production site with a tool like fiddler or IE Devtools and see that requests for each if your files are issued ? Well the answer is simple debug=true yes remember you had enable it to debud your site in dev and now it has come back to haunt you !!! Go ahead and set it to false then all the magic happens.

You can still override this setting in your BundleConfig file by doing the following:

BundleTable.EnableOptimizations = true; 

Hope you will find useful as I have,


Set user locale on CentOS

Tip for setting user locale on CentOS

Every time is ssh into my vm running CentOS I get :

bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

which was very irritating because the terminal could not understand anything but system commands.

The solution : 

  • Create environment file
    • vi /etc/environment
  • Paste
    • LANG=en_US.utf-8
    • LC_ALL=en_US.utf-8
  • Save

You will need to logoff for the setting to take effect !!!

Scaling #Azure Cloud Services to Zero

Alexandre Brisebois ☁

The Challenge

As developers, we deal with lots of complexity, and this is a good thing. It forces us to be creative, and sometimes to go beyond our known universe to overcome challenges.

Microsoft Azure is designed to help us make the right choices. It imposes performance targets through a multitude of mechanisms like throttling and quotas. One of which, I’m sure you have come to know, is that we cannot scale a Cloud Service to zero instances. Let’s stop for a moment and think about this limitation for a second. How would you creatively overcome this challenge?

View original post 502 more words

Unique Contraints on RavenDb


, ,

A quick way to implement unique constraints in RavenDB

Often times you might find yourself needing to enforce unique constraints on your entities, well RavenDB does not support this out-of-box but do not despair it is very easy to implement this kind of behaviour.

You can follow these instructions from the official site Bundle: Unique Constraints
although I was not able to get the desired results !!!

So after going through posts on their Google group , I came to a conclusion it would be easier to get my hands dirty and do it myself although Oren insists that his bundle works !

In a nutshell what is needed is dummy document that will have the unique property as an Id e.g “Uniqueconstraints/users/” and you are all set , well not quite when you need to do multiple properties though.

I came across the article quick-and-dirty-unique-constraints-in-raven-db which does exactly what I needed except that it is for just one property, I then added support for multiple properties.

The code is hosted on My Git Hub page.

Comments are always welcome.

Find Stored procedures with specific text


To find stored procedures that use a specific table or column even any text that you might be interested in,you can use the script below :

SELECT DISTINCT AS Object_Name,o.type_desc

FROM sys.sql_modules m

INNER JOIN sys.objects o ON m.object_id=o.object_id

WHERE m.definition Like ‘%<your text>%’ and o.type=‘p’

The result will be all the stored procedures who have ‘your text’ in their definition.

Find objects that depend on the table in SQL Server



Sometimes as a developer/DBA you need to do an impact analysis before renaming or dropping a table.

By running sp_depends ‘tablename’ you can determine what objects are using it and be in a better position to assess the impact that your change will introduce.

This little exercise will ensure  that nothing breaks after the change is implemented .