This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Singleton | |
class Product { | |
$Name | |
Product($name) { | |
$this.Name = $name | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Logger { | |
log($message) { # Define a method called "log" that takes a message as input | |
$message | Out-Host # Output the message to the console | |
} | |
} | |
class TimeStampingLogger : Logger { # Define a class called "TimeStampingLogger" that inherits from "Logger" | |
$logger # Declare a variable called "logger" | |
TimeStampingLogger($logger) { # Define a constructor that takes a "logger" as input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
xp_readerrrorlog - extended stored procedure accepts at least 7 parameters | |
Value of error log file you want to read: 0 = current, 1 = Archive #1, 2 = Archive #2, etc... | |
Log file type: 1 or NULL = error log, 2 = SQL Agent log | |
Search string 1: String one you want to search for | |
Search string 2: String two you want to search for to further refine the results | |
Search from start time | |
Search to end time | |
Sort order for results: N'asc' = ascending, N'desc' = descending | |
EXEC xp_readerrorlog 0, 1, NULL, NULL, NULL, NULL, N'desc' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE <db_name> | |
GO | |
SELECT SUM((size/128.0))/1024 AS [Total Size in GB], | |
SUM(CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/1024 AS [Space Used in GB], | |
SUM(size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)/1024 AS [Available Space in GB], | |
sum((((size)/128.0) - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0)) / sum(((size)/128.0)) * 100 as '% Available' | |
FROM sys.database_files WITH (NOLOCK) | |
--WHERE type = 1 -- log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Find Missing Indexes by Index Advantage | |
-- Look at index advantage, last user seek time, number of user seeks to help determine source and importance | |
-- SQL Server is overly eager to add included columns, so beware | |
-- Do not just blindly add indexes that show up from this query!!! | |
SET NOCOUNT ON | |
GO | |
SELECT TOP 25 | |
DB_NAME(dm_mid.database_id) AS Database_Name, | |
user_seeks * avg_total_user_cost * (avg_user_impact * 0.01) AS [index_advantage], | |
dm_migs.last_user_seek AS Last_User_Seek, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show advanced options | |
-- cost threshold for parallelism | |
-- max degree of parallelism | |
-- max server memory (MB) | |
-- optimize for ad hoc workloads | |
SELECT name, description, value, value_in_use | |
FROM sys.configurations | |
WHERE configuration_id IN (518,1538,1539,1544,1581) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Trace flag 1118 turns off mixed page allocations. Preventing mixed page allocations reduces the risk of page latch contention | |
-- on the SGAM allocation bitmatps that track mixed extents; which Paul says is one of the leading causes for contention in tempdb. | |
-- When doing allocations for user tables always allocate full extents. Reducing contention of mixed extent allocations | |
DBCC TRACEON (1118,-1) | |
-- simply stops SQL Server from writing backup successful messages to the error log. | |
DBCC TRACEON (3226,-1) | |
-- Changes to automatic update statistics | |
DBCC TRACEON (2371,-1) |