Friday, September 25, 2015

Locking your network password

NEVER EVER have Scheduled TASKs, SERVICES or be logged into another machine when changing your password.  NEVER!!!!!

In other words, always run Services and Scheduled TASKS with a different Active Directory (AD) account.  I don't care how long it takes to get an AD admin to create the account  never, ever use your own login for another process.  I am 15 years into this work and I should know better.

Please do not make this mistake, because you will ALWAYS forget another process is running under your ID. You know, one of those SENIOR Moments.

Thursday, September 24, 2015

KNOW YOUR DATA, KNOW YOUR WORKLOAD AND KNOW YOUR DB ENGINE


SQL SERVER – Index Seek Vs. Index Scan (Table Scan)

Index Scan retrieves all the rows from the table. Index Seek retrieves selective rows from the table.
Index Scan:
Since a scan touches every row in the table whether or not it qualifies, the cost is proportional to the total number of rows in the table. Thus, a scan is an efficient strategy if the table is small or if most of the rows qualify for the predicate.
Index Seek:
Since a seek only touches rows that qualify and pages that contain these qualifying rows, the cost is proportional to the number of qualifying rows and pages rather than to the total number of rows in the table.
Index Scan is nothing but scanning on the data pages from the first page to the last page. If there is an index on a table, and if the query is touching a larger amount of data, which means the query is retrieving more than 50 percent or 90 percent of the data, and then optimizer would just scan all the data pages to retrieve the data rows. If there is no index, then you might see a Table Scan (Index Scan) in the execution plan.
Index seeks are generally preferred for the highly selective queries. What that means is that the query is just requesting a fewer number of rows or just retrieving the other 10 (some documents says 15 percent) of the rows of the table.
In general query optimizer tries to use an Index Seek which means that optimizer has found a useful index to retrieve recordset. But if it is not able to do so either because there is no index or no useful indexes on the table then SQL Server has to scan all the records that satisfy query condition.
Reference : Pinal Dave (http://blog.SQLAuthority.com)

Friday, September 18, 2015

Chrome developer tools - DOM Bread Crumb

Today, I was really stumped with some CSS and setting display:none; and display: block; on the correct DOM element. depending on @media query for Mobile responsive design.  Over and over I was incorrectly setting the correct DOM Element and then for some reason or another I finally looked at the bread crumb in Chomes F12 Developer tools, which quickly help me figure out the correct element and parent that needed the CSS applied to.  I will be using this for a long time to come. +Walt Daniels is still the best mentor to push me to use Chrome Dev tools and I am thankful for his mentoring and knowledge sharing.

Maybe this will help another developer out.

Thursday, September 10, 2015

When should I use jQuery's document.ready function?

Credit stackoverflow - http://stackoverflow.com/questions/13062246/when-should-i-use-jquerys-document-ready-function
In simple words,
$(document).ready is an event which fires up when document is ready.
Suppose you have placed your jQuery code in head section and trying to access a dom element (an anchor, an img etc), you will not be able to access it because html is interpreted from top to bottom and your html elements are not present when your jQuery code runs.
To overcome this problem, we place every jQuery/javascript code (which uses DOM) inside $(document).ready function which gets called when all the dom elements can be accessed.
And this is the reason, when you place your jQuery code at the bottom (after all dom elements, just before </body>) , there is no need for $(document).ready
There is no need to place on method inside $(document).ready only when you use on method on document because of the same reason I explained above.
    //No need to put inside $(document).ready
    $(document).on('click','a',function () {
    });

    // Need to put inside $(document).ready if placed inside <head></head>
    $('.container').on('click','a',function () {
    });
EDIT
From comments,
  1. $(document).ready does not wait for images or scripts. Thats the big difference between $(document).ready and $(document).load
  2. Only code that accesses the DOM should be in ready handler. If it's a plugin, it shouldn't be in the ready event.

Wednesday, September 02, 2015

Quiz Day - What does this do?

var nyc = {
    fullName: "New York City",
    mayor: "Bill de Blasio",
    population: 8000000,
    boroughs: 5
};

for(var property in nyc){
    console.log(property);
}