npm ERR! stack Error: EACCES: permission denied, mkdir
sudo npm install --unsafe-perm=true --allow-root
npm config set unsafe-perm true
npm config set allow-root true
All software and software code is released under the BSD license (http://www.opensource.org/licenses/bsd-license.php), unless otherwise specified or if the code is part of a project governed by another license. All trademarks are owned by their respective companies and/or individuals.
--****************************************************************** --****************************************************************** --****************************************************************** --****************************************************************** -- Algorithm by Carlos Klapp --****************************************************************** --****************************************************************** --****************************************************************** --****************************************************************** /* This algorithm splits the data into positive and negative values. It then finds the rows in the same position and flags them as a wash. If the row does not have a matching pair then it is a unique transaction and is NOT a wash. | Positive values | | Negative values | | AccountId | TransactionDate | Value | | AccountId | TransactionDate | Value | | 1 | 2016/01/01 | $7 | <-> | 1 | 2016/01/01 | -$7 | <- can be deleted | 1 | 2016/02/01 | $7 | <-> | 1 | 2016/06/01 | -$7 | <- can be deleted | 1 | 2016/04/01 | $7 | <-> | 1 | 2016/07/01 | -$7 | <- can be deleted | | | | | 1 | 2016/09/01 | -$7 | <- keep this row | 2 | 2016/05/01 | $8 | <-> | 2 | 2016/11/01 | -$8 | <- can be deleted | | | | | 2 | 2016/12/01 | -$8 | <- keep this row */ --****************************************************************** --****************************************************************** -- Build a tally table --****************************************************************** --****************************************************************** IF OBJECT_ID('dbo.Numbers') IS NOT NULL DROP TABLE dbo.Numbers SELECT TOP 10000 N=IDENTITY(INT, 1, 1) INTO dbo.Numbers FROM master.dbo.syscolumns a CROSS JOIN master.dbo.syscolumns b; ALTER TABLE dbo.Numbers ADD CONSTRAINT NBR_pk PRIMARY KEY(N); --****************************************************************** --****************************************************************** -- Create the table that will hold our test data --****************************************************************** --****************************************************************** IF OBJECT_ID('dbo.WashValues') IS NOT NULL DROP TABLE dbo.WashValues CREATE TABLE dbo.WashValues( RowId int IDENTITY(1,1) PRIMARY KEY ,AccountId INT NOT NULL ,TransactionDate datetime NOT NULL ,Value MONEY NOT NULL ,AbsValue AS CAST(ISNULL(abs(Value), 0) AS MONEY) PERSISTED ,IsWash BIT NOT NULL DEFAULT(0) ) --****************************************************************** --****************************************************************** -- Create our sample data --****************************************************************** --****************************************************************** INSERT INTO dbo.WashValues(AccountId, TransactionDate, Value) SELECT CAST(CRYPT_GEN_RANDOM(1) AS INT) % 10 + 1 AS AccountId ,DATEADD(DAY, n.N, GETDATE()) AS TransactionDate ,CAST(CRYPT_GEN_RANDOM(1) AS INT) % 10 * IIF(CAST(CRYPT_GEN_RANDOM(1) AS INT) % 2 = 0, 1, -1) AS Value FROM dbo.Numbers n WHERE n.N BETWEEN 1 AND 10000 --****************************************************************** -- Insert unique case: single positive row without a wash --****************************************************************** INSERT INTO dbo.WashValues(AccountId, TransactionDate, Value) SELECT 999 AS AccountId ,GETDATE() AS TransactionDate ,999 AS Value --****************************************************************** -- Insert unique case: single negative row without a wash --****************************************************************** INSERT INTO dbo.WashValues(AccountId, TransactionDate, Value) SELECT 888 AS AccountId ,GETDATE() AS TransactionDate ,-888 AS Value --****************************************************************** -- Delete the zero money rows. They sum to zero, so we can ignore them. --****************************************************************** DELETE from dbo.WashValues WHERE AbsValue = 0 --****************************************************************** --****************************************************************** --****************************************************************** --****************************************************************** -- Split the data into a positive and negative list. In this -- example we order the lists by the TransactionDate in ascending -- order. This essentially gives us a FIFO (First In First Out) -- list. --****************************************************************** --****************************************************************** --****************************************************************** --****************************************************************** --****************************************************************** -- Build negative list --****************************************************************** IF OBJECT_ID('dbo.WashValues_Negative') IS NOT NULL DROP TABLE dbo.WashValues_Negative SELECT RowId ,AccountId ,AbsValue ,ROW_NUMBER() OVER(PARTITION BY AccountId, Value ORDER BY TransactionDate) AS SequenceId INTO dbo.WashValues_Negative FROM dbo.WashValues WHERE Value < 0 --****************************************************************** -- Build negative list --****************************************************************** IF OBJECT_ID('dbo.WashValues_Positive') IS NOT NULL DROP TABLE dbo.WashValues_Positive SELECT RowId ,AccountId ,AbsValue ,ROW_NUMBER() OVER(PARTITION BY AccountId, Value ORDER BY TransactionDate) AS SequenceId INTO dbo.WashValues_Positive FROM dbo.WashValues WHERE Value > 0 --****************************************************************** --****************************************************************** -- Locate the equivalent rows and mark them as a wash. --****************************************************************** --****************************************************************** UPDATE w SET w.IsWash = 1 FROM dbo.WashValues w JOIN ( SELECT p.RowId AS n_RowId ,n.RowId AS p_RowId FROM dbo.WashValues_Positive p JOIN dbo.WashValues_Negative n ON p.AccountId = n.AccountId AND n.AbsValue = p.AbsValue AND n.SequenceId = p.SequenceId ) q ON w.RowId IN (q.n_RowId, q.p_RowId) --****************************************************************** --****************************************************************** -- Debug: Inspect the data and make sure the rows are -- correctly paired. --****************************************************************** --****************************************************************** SELECT pw.RowId ,pw.AccountId ,pw.TransactionDate ,pw.Value ,pw.AbsValue ,pw.IsWash ,p.SequenceId ,nw.RowId ,nw.AccountId ,nw.TransactionDate ,nw.Value ,nw.AbsValue ,nw.IsWash ,n.SequenceId FROM dbo.WashValues_Positive p JOIN dbo.WashValues_Negative n ON p.AccountId = n.AccountId AND n.AbsValue = p.AbsValue AND n.SequenceId = p.SequenceId JOIN dbo.WashValues pw ON pw.RowId = p.RowId JOIN dbo.WashValues nw ON nw.RowId = n.RowId GROUP BY pw.RowId ,pw.AccountId ,pw.TransactionDate ,pw.Value ,pw.AbsValue ,pw.IsWash ,p.SequenceId ,nw.RowId ,nw.AccountId ,nw.TransactionDate ,nw.Value ,nw.AbsValue ,nw.IsWash ,n.SequenceId ORDER BY pw.AccountId ,pw.AbsValue ,p.SequenceId --****************************************************************** --****************************************************************** -- Unit Test: The grand total by AccountId must always be the same. --****************************************************************** --****************************************************************** IF EXISTS( SELECT * FROM ( SELECT AccountId ,SUM(Value) AS Total ,COUNT(*) AS NumRows FROM dbo.WashValues WHERE IsWash = 0 GROUP BY AccountId ) q1 FULL OUTER JOIN ( SELECT AccountId ,SUM(Value) AS Total ,COUNT(*) AS NumRows FROM dbo.WashValues GROUP BY AccountId ) q2 ON q2.AccountId = q1.AccountId AND q2.Total = q1.Total where q1.AccountId IS NULL OR q2.AccountId IS null ) BEGIN RAISERROR('Bug in code. Total do not match', 18, 0) end
from http://www.idilks.com/mssql/md5
-- select md5 as a hex string (regular string)
SELECT master.sys.fn_varbintohexsubstring(0, HashBytes('MD5', 'SQL Centroid'), 1, 16)
-- convert a hex string from a string to varbinary(16)
SELECT CAST('' as xml).value('xs:hexBinary("2655a2b5ef3531c4fd330c9ab409afa9")', 'varbinary(16)')
-- convert a hex string from a variable to varbinary(16)
DECLARE @thestring CHAR(32)
SELECT @thestring = '2655a2b5ef3531c4fd330c9ab409afa9'
SELECT CAST('' AS XML).value('xs:hexBinary(sql:variable("@thestring"))', 'varbinary(16)')
-- convert a hex string from a varchar column to varbinary(16)
DECLARE @TABLEA TABLE (tID int IDENTITY(1,1) PRIMARY KEY, tst varchar(200))
INSERT INTO @TABLEA (tst) VALUES ('2655a2b5ef3531c4fd330c9ab409afa9')
SELECT CAST('' AS XML).value('xs:hexBinary(sql:column("t.tst"))', 'varbinary(16)')
FROM @TABLEA t
SELECT top 10
cast(CAST('' AS XML).value('xs:hexBinary(sql:column("f.crcString"))', 'varbinary(8)') as bigint)
,f.crcString
FROM
filecompare f
select
'[' + s.name + '].[' + o.name + ']' as TblName
,p.data_compression_desc
from
sys.partitions p
join sys.objects o
on p.object_id = o.object_id
join sys.schemas s
on o.schema_id = s.schema_id
where
p.data_compression != 0
use [ReportServer]
go
-- http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=PDF&myparam1=Value1&myparam2=Value2
-- http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=CSV&rc:FieldDelimiter=%09
SELECT
'curl --ntlm -u "ntlmDomain\ntlmUserName:Password" "'
+ replace(replace('http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=CSV&rc:FieldDelimiter=%09', 'REPORT_PATH', c.Path),' ', '%20')
+ '" > "' + replace(c.Path, '/', '_') + '.txt"'
FROM
[dbo].[Catalog] c
WHERE
Type = 2
--and Path like '/BetaSite/%'
http://MYSERVER/ReportServer?MyReport&rs:Command=Render&rs:Format=CSV&rc:FieldDelimiter=%09
http://MYSERVER/ReportServer?MyReport&rs:Command=Render&rs:Format=PDF&myparam1=Value1&myparam2=Value2
IF OBJECT_ID('tempdb..#RunnersBig') IS NOT NULL drop table #RunnersBig
go
Create Table #RunnersBig
(
RunnerId integer identity ,
Time integer not null,
Age integer not null
)
go
insert into #runnersbig ( Time , Age )
select top 1000000 ABS ( checksum ( newid ()))% 1000 ,
ABS ( checksum ( newid ()))% 99
from sys . columns a cross join sys . columns b cross join sys . columns c
go
create index idxrunnersbig on #runnersbig ( age , time ) include ( runnerid )
with cteN
as
(
select number from master .. spt_values
where type = 'p' and number between 0 and 100
)
Select *
from cteN cross apply ( Select top ( 2 ) * from #RunnersBig where #RunnersBig . Age = cteN . number order by Time ) as runners
order by cteN . number , runners . Time
BEGIN TRY
begin tran
-- RAISERROR with severity 11-19 will cause execution to
-- jump to the CATCH block.
RAISERROR ('Error raised in TRY block.', -- Message text.
16, -- Severity.
1 -- State.
);
commit tran
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
rollback tran
-- Use RAISERROR inside the CATCH block to return error
-- information about the original error that caused
-- execution to jump to the CATCH block.
RAISERROR (@ErrorMessage, -- Message text.
@ErrorSeverity, -- Severity.
@ErrorState -- State.
);
END CATCH;
create table Parent
(
ParentID INT
,ParentString VARCHAR(100)
)
INSERT Parent VALUES (1, 'Parent 1 String')
INSERT Parent VALUES (2, 'Parent 2 String')
INSERT Parent VALUES (3, 'Parent 3 String')
SELECT Parent.ParentString
FROM Parent
-- PERFORM THE TRICK
-- PIVOT Parent VALUES INTO 1 COLUMN FOR 1 BASE ROW
SELECT STUFF(( SELECT [text()]= ',' + ISNULL(Parent.ParentString, '') + ''
FROM Parent
ORDER BY Parent.ParentString
FOR XML PATH('')), 1,1, '') AS Parent_CSV
exec sp_help 'sp_checknames'
exec sp_help 'sp_columns_rowset'
exec sp_help 'sp_enumoledbdatasources'
exec sp_help 'sp_fixindex'
exec sp_help 'sp_gettypestring'
exec sp_help 'sp_MS_marksystemobject'
exec sp_help 'sp_MSaddguidcolumn'
exec sp_help 'sp_MSaddguidindex'
exec sp_help 'sp_MSaddlogin_implicit_ntlogin'
exec sp_help 'sp_MSadduser_implicit_ntlogin'
exec sp_help 'sp_MScheck_uid_owns_anything'
exec sp_help 'sp_MSdbuseraccess'
exec sp_help 'sp_MSdbuserpriv'
exec sp_help 'sp_msdependencies'
exec sp_help 'sp_MSdrop_object'
exec sp_help 'sp_MSforeachdb'
exec sp_help 'sp_MSforeachtable'
exec sp_help 'sp_MSget_qualified_name'
exec sp_help 'sp_MSgettools_path'
exec sp_help 'sp_MSgetversion'
exec sp_help 'sp_MSguidtostr'
exec sp_help 'sp_MShelpcolumns'
exec sp_help 'sp_MShelpindex'
exec sp_help 'sp_MShelptype'
exec sp_help 'sp_MSindexspace'
exec sp_help 'sp_MSis_pk_col'
exec sp_help 'sp_MSkilldb'
exec sp_help 'sp_MSloginmappings'
exec sp_help 'sp_MStablekeys'
exec sp_help 'sp_MStablerefs'
exec sp_help 'sp_MStablespace'
exec sp_help 'sp_MSunc_to_drive'
exec sp_help 'sp_MSuniquecolname'
exec sp_help 'sp_MSuniquename'
exec sp_help 'sp_MSuniqueobjectname'
exec sp_help 'sp_MSuniquetempname'
exec sp_help 'sp_tempdbspace'
exec sp_help 'sp_who2'
exec sp_help 'xp_delete_file'
exec sp_help 'xp_dirtree'
exec sp_help 'xp_enum_oledb_providers'
exec sp_help 'xp_enumcodepages'
exec sp_help 'xp_enumdsn'
exec sp_help 'xp_enumerrorlogs'
exec sp_help 'xp_enumgroups'
exec sp_help 'xp_fileexist'
exec sp_help 'xp_fixeddrives'
exec sp_help 'xp_get_MAPI_default_profile'
exec sp_help 'xp_get_MAPI_profiles'
exec sp_help 'xp_getnetname'
exec sp_help 'xp_qv'
exec sp_help 'xp_readerrorlog'
exec sp_help 'xp_regaddmultistring'
exec sp_help 'xp_regdeletekey'
exec sp_help 'xp_regdeletevalue'
exec sp_help 'xp_regenumvalues'
exec sp_help 'xp_regread'
exec sp_help 'xp_regremovemultistring'
exec sp_help 'xp_regwrite'
exec sp_help 'xp_subdirs'
exec sp_help 'xp_varbintohexstr'
declare @code nvarchar(4000)
declare @template nvarchar(4000)
declare @PRIM_TABLE_SCHEMA sysname
declare @PRIM_TABLE_NAME sysname
declare @PRIM_COLUMN_NAME sysname
declare @CHILD_TABLE_SCHEMA sysname
declare @CHILD_TABLE_NAME sysname
declare @CHILD_COLUMN_NAME sysname
declare @rowid bigint
declare @maxrows bigint
declare @guid uniqueidentifier
set @template =
'ALTER TABLE <<CHILD_TABLE_SCHEMA>>.<<CHILD_TABLE_NAME>> ADD CONSTRAINT
FK_<<CHILD_TABLE_NAME>>_<<PRIM_TABLE_NAME>>_<<GUID>> FOREIGN KEY
(
<<CHILD_COLUMN_NAME>>
) REFERENCES <<PRIM_TABLE_SCHEMA>>.<<PRIM_TABLE_NAME>>
(
<<PRIM_COLUMN_NAME>>
) ON UPDATE NO ACTION
ON DELETE NO ACTION'
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
if OBJECT_ID('tempdb..#primkeys') is not null
drop table #primkeys
select distinct
col.TABLE_SCHEMA
,col.TABLE_NAME
,col.COLUMN_NAME
into #primkeys
from
INFORMATION_SCHEMA.TABLES t
JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS con
on con.TABLE_SCHEMA = t.TABLE_SCHEMA
and con.TABLE_NAME = t.TABLE_NAME
AND con.CONSTRAINT_TYPE = 'PRIMARY KEY'
join INFORMATION_SCHEMA.KEY_COLUMN_USAGE u
on con.CONSTRAINT_SCHEMA = u.CONSTRAINT_SCHEMA
and con.CONSTRAINT_NAME = u.CONSTRAINT_NAME
join INFORMATION_SCHEMA.COLUMNS col
on u.TABLE_SCHEMA = col.TABLE_SCHEMA
and u.TABLE_NAME = col.TABLE_NAME
and u.COLUMN_NAME = col.COLUMN_NAME
where
t.TABLE_TYPE = 'base table'
and t.TABLE_NAME != 'sysdiagrams'
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
if OBJECT_ID('tempdb..#NonKeyColumns') is not null
drop table #NonKeyColumns
select distinct
col.TABLE_SCHEMA
,col.TABLE_NAME
,col.COLUMN_NAME
into #NonKeyColumns
from
INFORMATION_SCHEMA.TABLES t
join INFORMATION_SCHEMA.COLUMNS col
on t.TABLE_SCHEMA = col.TABLE_SCHEMA
and t.TABLE_NAME = col.TABLE_NAME
where
t.TABLE_TYPE = 'base table'
and t.TABLE_NAME != 'sysdiagrams'
except
select
*
from
#primkeys
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
if OBJECT_ID('tempdb..#colMappings') is not null
drop table #colMappings
select
ROW_NUMBER() over(order by p.TABLE_SCHEMA, p.TABLE_NAME, p.COLUMN_NAME,
n.TABLE_SCHEMA, n.TABLE_NAME, n.COLUMN_NAME) as RowID
,p.TABLE_SCHEMA as PRIM_TABLE_SCHEMA
,p.TABLE_NAME as PRIM_TABLE_NAME
,p.COLUMN_NAME as PRIM_COLUMN_NAME
,n.TABLE_SCHEMA as CHILD_TABLE_SCHEMA
,n.TABLE_NAME as CHILD_TABLE_NAME
,n.COLUMN_NAME as CHILD_COLUMN_NAME
into #colMappings
from
#primkeys p
join #NonKeyColumns n
on (
p.TABLE_SCHEMA != n.TABLE_SCHEMA
or p.TABLE_NAME != n.TABLE_NAME
)
and p.COLUMN_NAME = n.COLUMN_NAME
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
-- *******************************************************************************************
select
@rowid = 1
,@maxrows = MAX(RowID)
from
#colMappings
while (@rowid <= @maxrows)
begin
select
@PRIM_TABLE_SCHEMA = PRIM_TABLE_SCHEMA
,@PRIM_TABLE_NAME = PRIM_TABLE_NAME
,@PRIM_COLUMN_NAME = PRIM_COLUMN_NAME
,@CHILD_TABLE_SCHEMA = CHILD_TABLE_SCHEMA
,@CHILD_TABLE_NAME = CHILD_TABLE_NAME
,@CHILD_COLUMN_NAME = CHILD_COLUMN_NAME
,@guid = NEWID()
from
#colMappings m
where
m.RowID = @rowid
set @code = replace(@template, '<<PRIM_TABLE_SCHEMA>>', @PRIM_TABLE_SCHEMA)
set @code = replace(@code, '<<PRIM_TABLE_NAME>>', @PRIM_TABLE_NAME)
set @code = replace(@code, '<<PRIM_COLUMN_NAME>>', @PRIM_COLUMN_NAME)
set @code = replace(@code, '<<CHILD_TABLE_SCHEMA>>', @CHILD_TABLE_SCHEMA)
set @code = replace(@code, '<<CHILD_TABLE_NAME>>', @CHILD_TABLE_NAME)
set @code = replace(@code, '<<CHILD_COLUMN_NAME>>', @CHILD_COLUMN_NAME)
set @code = replace(@code, '<<GUID>>', replace(@guid, '-', ''))
print @code
--exec sp_executesql @code
set @rowid = @rowid +1
end
public override bool CanHandleDialog(Window window)
{
return (window.StyleInHex == "96CC20C4") || (window.StyleInHex == "96CC02C4")
|| (window.StyleInHex == "97CC02C4") || (window.StyleInHex == "97CC02C4");
}
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile("UninstallAppList.tsv", True)
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
objTextFile.WriteLine "DisplayName" & vbtab & _
"InstallDate" & vbtab & "ProdId" & vbtab & _
"Publisher" & vbtab & "Version" & vbtab & "32/64Bits"
'add a where clause
Set colSoftware = objWMIService.ExecQuery("Select * from Win32Reg_AddRemovePrograms")
For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.DisplayName & vbtab & _
objSoftware.InstallDate & vbtab & _
objSoftware.ProdId & vbtab & _
objSoftware.Publisher & vbtab & _
objSoftware.Version & vbtab & _
"32"
Next
Set colSoftware = objWMIService.ExecQuery("Select * from Win32Reg_AddRemovePrograms64")
For Each objSoftware in colSoftware
objTextFile.WriteLine objSoftware.DisplayName & vbtab & _
objSoftware.InstallDate & vbtab & _
objSoftware.ProdId & vbtab & _
objSoftware.Publisher & vbtab & _
objSoftware.Version & vbtab & _
"64"
Next
objTextFile.Close
'Use this code to uninstall the application
'Set objShell = CreateObject("Wscript.Shell")
'For Each objSoftware in colSoftware
' objShell.Run objShell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & objSoftware.ProdId & "\UninstallString"), 1, true
'Next