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
--SQL 2012 Extended Event | |
CREATE EVENT SESSION [Long_Running_Queries] ON SERVER | |
ADD EVENT sqlserver.sql_statement_completed( | |
ACTION(package0.collect_cpu_cycle_time,package0.collect_system_time,sqlos.task_time,sqlserver.plan_handle,sqlserver.sql_text,sqlserver.username) | |
WHERE ([package0].[greater_than_int64]([duration],(2000000)) AND [sqlserver].[equal_i_sql_unicode_string]([sqlserver].[database_name],N'INSERT_DB_NAME_HERE'))) | |
ADD TARGET package0.ring_buffer(SET max_memory=(131072)) | |
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=OFF) | |
GO |
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
OPTION EXPLICIT | |
DIM strExtensionsToZip,strFolder | |
DIM objFSO, WshShell, MaxAge, IncludeSubFolders | |
' Folder to zip files | |
strFolder = "c:\myfolder" | |
'Include subfolders? | |
includeSubfolders = true | |
' File extension to search for | |
strExtensionsToZip = "txt" |
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
require 'rss' | |
require 'open-uri' | |
url = 'http://www.cwtd.org/cwtd.rss' | |
folder = '/mypodcasts/' | |
open(url) do |rss| | |
feed = RSS::Parser.parse(rss,false) | |
puts "Lets go get: #{feed.channel.title}" | |
feed.items.each do |item| | |
if !File.file?(folder + File.basename(URI.parse(item.enclosure.url).path)) |
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
require 'date' | |
files = Dir.glob('//myserver/myfolder/*.log') | |
files.each do |file| | |
previousLine = "" | |
requests = Hash.new | |
responses = Hash.new |
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
CREATE FUNCTION fn_HexToInt( @HexValue VARCHAR(20) ) | |
RETURNS INTEGER | |
AS | |
BEGIN | |
DECLARE @iOutput INTEGER | |
DECLARE @sChar CHAR(1) | |
DECLARE @iChar INT | |
SET @iOutput = 0 |
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
-- | |
-- Here is a dissected view of one method to get at the JMS payload stored within a Blob column. | |
-- | |
-- 1. First look within the Blob to find the word MyIdentifier and obtain the start position: | |
-- | |
-- DBMS_LOB.INSTR(MESSAGE, UTL_RAW.CAST_TO_RAW('MyIdentifier'), 1, 1) | |
-- | |
-- 2. Next pass the position from INSTR to the SUBSTR function and return 120 characters from the word 'MyIdentifier' | |
-- (needs to be less than the RAW limit of 2000 but enough to contain the info you want) | |
-- |