This file contains hidden or 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
/* | |
Snippet from: Linux System Programming | |
Purpose: read file to avoid system interuption | |
Relative: Nonblocking reads | |
*/ | |
ssize_t ret; | |
while (len != 0 && (ret = read (fd, buf, len)) != 0 ) { | |
if(ret == -1){ |
This file contains hidden or 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
Imports System | |
Public Module Module1 | |
Public Sub Main() | |
Dim a as Integer? = Nothing | |
Dim b as Integer = 5 | |
Dim c as Integer? = 5 | |
a = If(1=1, nothing, b) | |
Console.WriteLine(a) ' 0 | |
a = Nothing |
This file contains hidden or 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
DBCC DROPCLEANBUFFERS | |
DBCC FREEPROCCACHE |
This file contains hidden or 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
-- Check last time SP ran. | |
select b.name, a.last_execution_time | |
from sys.dm_exec_procedure_stats a | |
inner join sys.objects b | |
on a.object_id = b.object_id | |
where DB_NAME(a.database_ID) = DB_NAME() -- Current database or change it to your database name |
This file contains hidden or 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
-- sp_who2 60 | |
-- DBCC OPENTRAN() -- check open transactions in DB | |
SET NOCOUNT ON | |
DECLARE @SPID SMALLINT | |
DECLARE @WAIT TINYINT | |
DECLARE @NoLoop BIT | |
SET @SPID = 81 -- MODIFY to correct SPID. |
This file contains hidden or 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
-- | |
-- SQL SERVER 2008 | |
-- | |
DECLARE @DBName VARCHAR(64) = DB_NAME() -- databasename | |
DECLARE @ErrorLog AS TABLE([LogDate] CHAR(24), [ProcessInfo] VARCHAR(64), [TEXT] VARCHAR(MAX)) | |
INSERT INTO @ErrorLog | |
EXEC sys.xp_readerrorlog 0, 1, 'Recovery of database', @DBName | |
This file contains hidden or 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
-- | |
-- Disabled indexes. | |
-- | |
select | |
sys.objects.name, | |
sys.indexes.name | |
from sys.indexes | |
inner join sys.objects on sys.objects.object_id = sys.indexes.object_id | |
where sys.indexes.is_disabled = 1 | |
order by |
This file contains hidden or 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
declare @tableName VARCHAR(256), @id INT, @sql NVARCHAR(MAX) | |
set @id = 0 | |
while(1=1) | |
begin | |
SELECT Top 1 | |
@tableName = name, | |
@id = object_ID | |
FROM sys.objects | |
WHERE name LIKE 'Import%' -- Change to the table you would like to get the count. | |
AND type = 'U' |
This file contains hidden or 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
module.exports = { | |
readlines : function (filename){ | |
var fs = require('fs'); | |
if (fs.existsSync(filename)) { | |
return fs.readFileSync(filename).toString().split(/\r?\n/); | |
} | |
else { | |
return null; | |
} |
This file contains hidden or 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
var fs = require("fs"); | |
// General function | |
var dive = function (dir, action) { | |
// Assert that it's a function | |
if (typeof action !== "function") | |
action = function (error, file, path) { }; | |
// Read the directory | |
fs.readdir(dir, function (err, list) { |
OlderNewer