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);
}

Monday, August 31, 2015

New Nick Name - "CoDEcAT --- Taking on PHP...

<!DOCTYPE html>
<html>
    <head>
 <title> Challenge Time! </title>
      <link type='text/css' rel='stylesheet' href='style.css'/>
</head>
<body>
      <p>
        <?php
          // Your code here
          class Cat
          {
              public $isAlive = true;
              public $numLegs = 4;
              public $name;
             
              function __construct($name){
                  $this->name = $name;
              }
             
              public function meow(){
                  return "Meow meow";
              }
          }
         
         
          $myCat = new Cat("CodeCat");
         
          echo $myCat->meow();
         
        ?>
      </p>
    </body>
</html>

Wednesday, August 19, 2015

IIS Blowout Corruption

Had IIS on TEST go corrupted yesterday and had to remove and re-install.  I do not know why, but the following firewall setting got cut off and I had to ensure it was enabled.

PORT :443 Insure inbound traffic rule was turned ON.   This was preventing me from accessing the Web site remotely.

Friday, August 14, 2015

Awesome Disclaimer

Disclaimer ###### Inc., provides this publication as is without warranty of any kind, either expressed or implied. This publication could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein. These changes will be incorporated in new editions of the publication. ######, Inc. may make improvement and/or changes in the product(s) and/or programs(s) described in this publication at any time.

Hmm would you use their software for Credit Card Transactions?  Ifffffffyyyyyyy.

Thursday, August 13, 2015

ThreadAbortException with ASP.NET redirect

Response.Redirect("/newpage.aspx", False) HttpContext.Current.ApplicationInstance.CompleteRequest()

Monday, August 10, 2015

Log Date: 8/10/2015 1619 Hours - Never trust another persons code who no longer works with you or cannot be talked to.

15 years and you would think that I would have learned not to trust another developers code who no longer works for the company.  I am at the closing of a very tough conversion for responsive design and the jQuery is not right from the original developers.

UGH 3 hours on this, but got it figured out.

Wednesday, August 05, 2015

Bootstrap implementation disclaimer

Disclaimer – All BootStrap(http://getbootstrap.com/)  Framework changes being made for the mobile upgrade to the www.domain.com Web site require the following testing once the change is made – All testing is performed in all configurations to include Internet Explorer, Firefox, Chrome Web browsers and on all devices from iPhone, iPad, Android devices, desktop computers and more.  If the change does not look correct the time to debug and fix the design can take anywhere from 5 minutes to great number of hours or even days to research and fix in order to ensure the responsive design works for all devices.

Tuesday, August 04, 2015

SQL Server Table Size Report

SELECT
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB,
    SUM(a.used_pages) * 8 AS UsedSpaceKB,
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM
    sys.tables t
INNER JOIN    
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN
    sys.schemas s ON t.schema_id = s.schema_id
WHERE
    t.NAME NOT LIKE 'dt%'
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255
GROUP BY
    t.Name, s.Name, p.Rows
ORDER BY
    t.Name

Friday, July 31, 2015

Thursday, July 23, 2015

First Byte Time “FBT” www.webpagetest.org

First and foremost I hope this helps some others, I find it very important to share knowledge that will help others to improve their Web sites on the Internet.

I have been scratching my head trying to figure out why I was receiving an “F” rating on www.webpagetest.org for First Byte Time “FBT”.  After some research and additional testing on www.shoeshow.com I have come to the following conclusions:

Reasons why First Byte Time takes so long
  1. Number of requests/responses needed to build the page
  2. Does the page have a lot of Dynamic content on the page (aka how many database calls are going back and forth for data)
  3. Size of the overall page
  4. Size of CPU and MEMORY of the HOSTING SERVER. The more powerful the SERVER the faster processing you will receive. 
  5. Do you have a VM Server or a Dedicated Server

My test sample was for the home page of www.shoeshow.com I got an “F” for FBT every time, that is because this page has a lot of dynamic content and unless I dissect and rebuild this page it will continue to receive an “F” although the overall page is loading in under 2 sec.  However, If I go to https://www.shoeshow.com/reward-points it gets a “B” because there is very little dynamic or programming on that page and not many images.  Finally when I run our https://www.shoeshow.com/404.aspx we get an “A” because there is no images and no coding.


My overall opinion is that FBT is important, but can also be a false/positive.  

And Finally --- Utilize a CDN if you want a fast responsive Web site.  I cannot believe the overall performance of using a CDN ---  Yes I will plug https://www.akamai.com/ 

Wednesday, July 15, 2015

Remove Trailing Comma from List of Strings

myList.RemoveAt(myList.Count - 1);

Boot Strap Search Box with glyphicon glypicon-search

Adding to Code Library OPEN SOURCE

<div class="row">
    <div class="container">
        <div class="col-md-offset-3 col-md-6 col-md-offset-3">
                <div class="input-group">
                  <span class="input-group-btn">
                      <input type="text" id="txtGlobalSearch" class="form-control" placeholder="Search Site..." onkeypress="return submitglobal(this, event);"/>
                      <button type="button" class="btn btn-default" runat="server" onclick="GlobalSearch(); return false;"><span class="glyphicon glyphicon-search"></span></button>
                  </span>
                </div><!-- /input-group -->
          </div><!-- /.col-md-12 -->
        </div><!-- Container -->
</div><!-- Row -->

Monday, July 06, 2015

Caching --- How to ensure you optimize

IIS, Optimising Performance, 304 status codes, and one stupid browser…

How to prevent 304 responses and be sure to know that Chrome acts different with DEV tools --- Great article by Terry Brown... http://idisposable.co.uk/2011/03/iis-optimising-performance-304-status-codes-and-one-stupid-browser/#comment-2119464518 


Note when use the Chrome Developer tools looks at two columns ---


Wednesday, June 17, 2015

What is the difference between ByVal and ByRef?

Xiaoyun Li MSFT answers ---

https://social.msdn.microsoft.com/forums/vstudio/en-US/07b9d3b9-5658-49ed-9218-005564e8209e/what-is-the-difference-between-byval-and-byref

When you write a subroutine or function, you can pass variables from your main code to that subroutine or function.

If you want to pass the value of the variable, use the ByVal syntax. By passing the value of the variable instead of a reference to the variable, any changes to the variable made by code in the subroutine or function will not be passed back to the main code. This is the default passing mechanism when you don’t decorate the parameters by using ByVal or ByRef.

If you want to change the value of the variable in the subroutine or function and pass the revised value back to the main code, use the ByRef syntax. This passes the reference to the variable and allows its value to be changed and passed back to the main code.

For more information about passing Arguments by Value and by Reference, please refer to MSDN document:


C# --- 

.NET Coding: Argument as ByRef (ref in C#) or ByVal (default in C#)

Apache Kafka Tutorial: A Comprehensive Guide for US Business Owners and Decision-Makers

Introduction to Apache Kafka What is Apache Kafka? Apache Kafka is an open-source distributed event streaming platform designed to handl...