Friday, November 27, 2015

Tuesday, November 17, 2015

Check LIVE TEMP Tables

SELECT TABLE_NAME FROM tempdb.information_schema.tables

SQL Server Queries are spilling out to tempdb

-- How to rid yourself of tempDB spilage if SORT causing issues Create a Temp Table with a CLUSTERED INDEX

IF OBJECT_ID('tempdb..#tempSizes') IS NOT NULL DROP TABLE #tempTable

SELECT DISTINCT
IDENTITY(INT,1,1) AS ID,
Products.Name,
Product_Families.Parent_Family_Name,

INTO #tempTable
FROM Products
LEFT JOIN Product_Families ON Products.Product_Family_ID = Product_Families.Product_Family_ID
WHERE Products.Discontinued = 0
AND Quantity > 0

CREATE CLUSTERED INDEX IX_ID ON #tempSizes(ID)

SELECT * FROM #tempTable

Friday, October 30, 2015

IIS ApplicationPoolIdentity - Credit - http://stackoverflow.com/users/419/kev

The ApplicationPoolIdentity is assigned membership of the Users group as well as the IIS_IUSRS group. On first glance this may look somewhat worrying, however the Users group has somewhat limited NTFS rights.
For example, if you try and create a folder in the C:\Windows folder then you'll find that you can't. The ApplicationPoolIdentity still needs to be able to read files from the windows system folders (otherwise how else would the worker process be able to dynamically load essential DLL's).
With regard to your observations about being able to write to your c:\dump folder. If you take a look at the permissions in the Advanced Security Settings, you'll see the following:

See that Special permission being inherited from c:\:
That's the reason your site's ApplicationPoolIdentity can read and write to that folder. That right is being inherited from the c:\ drive.
In a shared environment where you possibly have several hundred sites, each with their own application pool and Application Pool Identity, you would store the site folders in a folder or volume that has had the Users group removed and the permissions set such that only Administrators and the SYSTEM account have access (with inheritance).
You would then individually assign the requisite permissions each IIS AppPool\[name] requires on it's site root folder.
You should also ensure that any folders you create where you store potentially sensitive files or data have the Users group removed. You should also make sure that any applications that you install don't store sensitive data in their c:\program files\[app name] folders and that they use the user profile folders instead.
So yes, on first glance it looks like the ApplicationPoolIdentity has more rights than it should, but it actually has no more rights than it's group membership dictates.
An ApplicationPoolIdentity's group membership can be examined using the SysInternalsProcess Explorer tool. Find the worker process that is running with the Application Pool Identity you're interested in (you will have to add the User Name column to the list of columns to display:

For example, I have a pool here named 900300 which has an Application Pool Identity of IIS APPPOOL\900300. Right clicking on properties for the process and selecting the Security tab we see:




As we can see IIS APPPOOL\900300 is a member of the Users group.

Repost - http://stackoverflow.com/users/419/kev 

Wednesday, October 07, 2015

FTP Certificate TLS Encryption fix

  • Windows 2008 R2 - IIS 7.5 using FTP
  • FileZilla (Protocol=FTP; Encryption=Require explicit FTP over TLS; Logon Type:=Normal; UserName=****; Passwword=****** Currently there are 3 virtual drives and when I connect via FileZilla they all display fine, however when I try to configure a 4th virtual directory it will not display in FileZilla.
I am actually getting a sporadic failure all together after the directory is created:
Command: LIST Error: GnuTLS error -110: The TLS connection was non-properly terminated. Status: Server did not properly shut down TLS connection Error: Transfer connection interrupted: ECONNABORTED - Connection aborted Response: 550 Keyset does not exist Error: Failed to retrieve directory listing
If I delete the Virtual Directory the directories will display again. What is wrong, all the permissions are identical. Is there something with the SSL that has to be configured on the directory? Any assistance would be great.

http://serverfault.com/questions/655968/iis-7-5-ftp-and-virtual-directory/690420#690420
ANSWER - The "550 Keyset does not exist" error message may be caused by the pass-through authentication settings for the virtual directory. If pass-trough authentication is configured to use a 'specific user' rather than the default setting of 'application user' then the 550 error will be returned unless(probably) the 'specific user' is granted permission to access the Machine Keys for certificates.
Granted READ ONLY Access to the C:\ProgramData\Microsoft\Crypto\RSA directory for the particular FTP User Account

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.