SQL Server Data Tools – September 2013 Update.

New update for SQL Server Data Tools.

sqlserverdatatoolsupdate

You can do one of the following:

  1. For Download and Install go to: http://go.microsoft.com/fwlink/?LinkID=320745
  2. For Administrative Install Point, when you are going to install from a place without internet connection: http://go.microsoft.com/fwlink/?LinkID=320745&clcid=0x409

Then run the following command with administrative privileges (CMD run as administrator)

SSDTSetup.exe /layout <destination>

After the install point is created, run SSDTSetup.exe from <destination> with no arguments.

Posted in SQL Server | Tagged , , | Leave a comment

Failover or Restart Results in Reseed of Identity

Bug with Id: 739013, opened: 4/26/2012

When a table with less than 1000 rows that has an identity value is part of a database that is failed over in an AlwaysOn availability group, the identity is reseeded to 1000. If the identity value is already over 1000 no reseed occurs. This also occurs if you restart the server.

This is happening in Azure databases too.

Example: In a table “X” your Id starts in 1, 2, 3, 4 then suddenly 1005, 1006, etc. And you don’t know when it will happen.

http://connect.microsoft.com/SQLServer/feedback/details/739013/alwayson-failover-results-in-reseed-of-identity

Some people think this has something to do with Sequences like this:

http://msdn.microsoft.com/en-us/library/ff878091.aspx

One workaround is using the startup flag T272 but how to specify this in Azure?

Also some people say this keeps happening even when you get over 1000 rows.

Posted in Azure | Tagged , , , | Leave a comment

14 Rules for faster-loading Web Sites.

These 14 rules came from Steve Souders’ book High Performance Web Sites (O’Reilly Media 2007).

Rule 1 – Make Fewer HTTP Requests
Rule 2 – Use a Content Delivery Network (CDN)
Rule 3 – Add an Expires Header
Rule 4 – Compress Components with Gzip
Rule 5 – Put Stylesheets (CSS) at the Top
Rule 6 – Put Scripts (JavaScript) at the Bottom
Rule 7 – Avoid CSS Expressions
Rule 8 – Make JavaScript and CSS External
Rule 9 – Reduce DNS Lookups
Rule 10 – Minify JavaScript
Rule 11 – Avoid Redirects
Rule 12 – Remove Duplicate Scripts
Rule 13 – Configure ETags (turn off)
Rule 14 – Make AJAX Cacheable and small

The Performance Golden Rule states that developers should “optimize front-end performance first, because that’s where 80% or more of the end-user response time is spent”

Posted in Web Development | Tagged , , , | 1 Comment

SQL Server Data Tools Update August 2013

There is a new update for SQL Server Data Tools (SSDT):
SQL Server Data Tools Update

The button Update takes you to: http://msdn.microsoft.com/en-us/jj650015

There you can Download and Install (you need internet access)http://go.microsoft.com/fwlink/?LinkID=320745

Or you can set up an Administrative Install Point (optional), once downloaded use:

SSDTSetup.exe /layout <destination>

Where <destination> is the location you wish to create the administrative install point, 1.8GB space required. Well in my case it downloaded 406MB.
To install use the install point and run SSDTSetup.exe from the <destination> location with no arguments.

Or you can download an ISO (optional)

Choose your venom.

Microsoft SQL Server Data Tools provides an integrated environment for database developers to carry out all their database design work for any SQL Server platform (both on and off premise) within Visual Studio. Database developers can use the SQL Server Object Explorer in VS to easily create or edit database objects and data, or execute queries.

Posted in SQL Server | Tagged , | Leave a comment

eBook offers.

apressoffer

Apress.

Apress is offering a 50% discount on all eBook purchases through Sept 2nd.

They have a good selection of books maybe the one you need is there and 50% off…!!!

O’Reilly.

O’Reilly is offering 50% on *all* ebooks & videos. Spend more, save more – save 60% on orders greater than $100! Use discount code B2S3, this deal expires September 10, 2013 at 5:00am PT and cannot be combined with other offers. Offer does not apply to Print, or Print & Ebook bundle pricing.

It looks like a good offer too. Maybe the book you need is from O’Reilly!!!

Posted in eBooks | Tagged | 1 Comment

How to use Metro UI CSS in ASP.NET MVC 4 ?

Metro UI CSS allows to create a Web site in the style of Windows 8 quickly and without distractions on routine tasks. You can find more info here: http://metroui.org.ua/

UPDATE. This article is about version 0.95 now Metro UI CSS is in version 2.0 and the following is no longer accurate so you better read this other post https://pepitosolis.wordpress.com/2013/12/29/using-metro-ui-css-version-2-0-with-asp-net-mvc/

To use Metro UI CSS in your ASP.NET MVC 4 project do the following:

Download the Metro UI CSS file “Metro-UI-CSS-master.zip” from https://github.com/olton/Metro-UI-CSS you need to copy some files from this zip to your project.

Copy the following files:

1. In Visual Studio in your “Content” folder copy these 2 files: modern.css and modern-responsive.css, the file theme-dark.css is only necessary if you are intending to use it.

2. Depending on what project template you used you may or may not have the folder “Images”, if you don’t have the folder create it. You should copy these files if you are intending to use them. So copy to your “Images” folder the files in the zip inside “images”:

  • preloader-w8-cycle-black.gif
  • preloader-w8-cycle-white.gif
  • preloader-w8-line-black.gif
  • preloader-w8-line-white.gif

3. In your “Scripts” folder copy the files in the zip inside the folder “javascript”, once again you should copy the files that you are going to use. The files are:

  • accordion.js
  • buttonset.js
  • calendar.js
  • carousel.js
  • contextmenu.js
  • dialog.js
  • dropdown.js
  • input-control.js
  • pagecontrol.js
  • pagelist.js
  • rating.js
  • slider.js
  • start-menu.js
  • tile-drag.js
  • tile-slider.js

4. Create a folder called “less” and copy the files in the zip inside the folder “less”. Copy them if you are going to use “less” in your web server.

5. Create a folder called “fonts” and from the zip file copy the files in the folder “fonts”:

  • iconFont.eot
  • iconFont.svg
  • iconFont.ttf
  • iconFont.woff

Open file “modern.css” and “find and replace”

../fonts/iconFont

replace with

/fonts/iconFont

This is necessary to load the icons correctly. For instance: when using checkboxes because the “check” image is inside the iconFont.* file.

There are 4 different font files:

  • iconFont.eot
  • iconFont.svg
  • iconFont.ttf
  • iconFont.woff

In Visual Studio open the file App_Start/BundleConfig.cs and add the following lines:

bundles.Add(new ScriptBundle("~/bundles/metro").Include(
    "~/Scripts/dialog.js",
    "~/Scripts/dropdown.js",
    "~/Scripts/accordion.js",
    "~/Scripts/buttonset.js",
    "~/Scripts/carousel.js",
    "~/Scripts/input-control.js",
    "~/Scripts/pagecontrol.js",
    "~/Scripts/pagelist.js",
    "~/Scripts/rating.js",
    "~/Scripts/slider.js",
    "~/Scripts/tile-slider.js",
    "~/Scripts/tile-drag.js",
    "~/Scripts/calendar.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
    "~/Content/modern.css",
    "~/Content/modern-responsive.css",
    "~/Content/site.css"));

Put bundles.Add(new ScriptBundle(“~/bundles/metro”)… after the jQuery bundles. And the StyleBundle in the same location as the previous StyleBundle, comment or delete the previous StyleBundle.

Complete BundleConfig.cs listing:

using System.Web;
using System.Web.Optimization;

namespace MvcApplication3
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/metro").Include(
 "~/Scripts/dialog.js",
 "~/Scripts/dropdown.js",
 "~/Scripts/accordion.js",
 "~/Scripts/buttonset.js",
 "~/Scripts/carousel.js",
 "~/Scripts/input-control.js",
 "~/Scripts/pagecontrol.js",
 "~/Scripts/pagelist.js",
 "~/Scripts/rating.js",
 "~/Scripts/slider.js",
 "~/Scripts/tile-slider.js",
 "~/Scripts/tile-drag.js",
 "~/Scripts/calendar.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
 "~/Content/modern.css",
 "~/Content/modern-responsive.css",
 "~/Content/site.css"));

            //bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));

            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));
        }
    }
}

UPDATE: As cmmaung commented when you add in the bundle “start-menu.js”

//"~/Scripts/start-menu.js",

You will get an error in the file “start-menu.js” line 128 $(“body”).mousewheel… This error happens in Internet Explorer (tested in version 10 and 11) but works OK in Chrome and Firefox. I commented that line and runs fine but I didn’t correct the error yet. You can look in the following link for more information: http://www.sitepoint.com/html5-javascript-mouse-wheel/

Finally in Visual Studio open the file Views/Shared/_Layout.cshtml and

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body class="metrouicss">
    @RenderBody()
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/metro")
    @RenderSection("scripts", required: false)
</body>
</html>

The metro container class “metrouicss” in body class is required to start using Metro UI CSS.

Example in a view called Index.cshtml

metrouicss

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

<span class="label">Default</span>

<table class="hovered">
   <tr>
      <th>Header 1</th>
      <th>Header 2</th>
   </tr>
   <tr>
      <td>row 1, cell 1</td>
      <td>row 1, cell 2</td>
   </tr>
   <tr>
      <td>row 2, cell 1</td>
      <td>row 2, cell 2</td>
   </tr>
</table>

<label class="input-control checkbox">
    <input type="checkbox" />
    <span class="helper">Checkbox Caption</span>
</label>

   <label class="input-control radio">
        <input type="radio" />
        <span class="helper">CheckBox Caption</span>
    </label>

    <label class="input-control switch">
        <input type="checkbox" />
        <span class="helper">CheckBox Caption</span>
    </label>
<div class="input-control select">
   <select>
      <option>Option 1</option>
      <option>Option 2</option>
   </select>
</div>

<button>Button1</button>
    <button class="default">Button2</button>
    <button disabled="disabled">Button3</button>
    <a class="button">Button4</a>

<div class="image-collection">
    <div>
       <img alt="" src="~/Content/themes/base/images/2.jpg" />
       <div class="overlay">Sample text</div>
    </div>
</div>

    <div class="rating" data-role="rating">
    </div>

There is a NuGet package but it still requires some of the above changes. The package is called RTL Metro UI CSS 0.95-a.

To install, run the following command in the Package Manager Console

PM> Install-Package RTL-Metro-UI-CSS -Pre

It’s free but don’t forget to placed back link to Metro UI CSS site.

Example:
Style with <a href="http://metroui.org.ua">Metro UI CSS</a>

Posted in MVC, Visual Studio 2012 | Tagged , , , , | 8 Comments

Optimize Images with Image Optimizer.

Image Optimizer is a free extension for Visual Studio 2012 created by Mads Kristensen. It uses SmushIt and Punypng for optimization. You can get it from Extensions and Updates, search for “Image Optimizer”:

imageoptimizer

You need to restart Visual Studio and when you right click an image in the Project Window you will see this new options:

imageoptimizer-menu

Optimize Image and Extract data URI to clipboard. You can see the results in the Output Window.

Posted in Visual Studio 2012 | Tagged , , , | Leave a comment