working on it ...

Filters

Explore Public Snippets

Sort by

Found 15k snippets matching: update

    public by cghersi  328039  0  6  1

    Retrieve useful information regarding indexes in MS SQL Server

    This script helps the DBA to retrieve valuable information regarding indexes. Here the complete explanation of the output fields: object_type: type of object (will either be "U" for User-Defined Table or "V" for View) database_name: name of the database schema_name: name of the schema object_name: name of the object create_date: date the obje
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
    SET NOCOUNT ON
    SET ANSI_WARNINGS OFF
    SET ARITHABORT OFF
    SET ARITHIGNORE ON
    SET TEXTSIZE 2147483647
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Declarations / Sets: Declare And Set Variables
    -----------------------------------------------------------------------------------------------------------------------------
    
    DECLARE @Database_ID AS SMALLINT
    
    
    SET @Database_ID = DB_ID ()
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Error Trapping: Check If Temp Table(s) Already Exist(s) And Drop If Applicable
    -----------------------------------------------------------------------------------------------------------------------------
    
    IF OBJECT_ID (N'tempdb.dbo.#temp_index_breakdown_keys_filters', N'U') IS NOT NULL
    BEGIN
    
    	DROP TABLE dbo.#temp_index_breakdown_keys_filters
    
    END
    
    
    IF OBJECT_ID (N'tempdb.dbo.#temp_index_breakdown_size_info', N'U') IS NOT NULL
    BEGIN
    
    	DROP TABLE dbo.#temp_index_breakdown_size_info
    
    END
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Table Insert: Insert Index Key, Include Key, And Filter Definition Values Into Temp Table
    -----------------------------------------------------------------------------------------------------------------------------
    
    SELECT
    	 sqI.[object_id]
    	,sqI.index_id
    	,STUFF (CONVERT (NVARCHAR (MAX), sqI.index_key), 1, 2, N'') AS index_key
    	,STUFF (CONVERT (NVARCHAR (MAX), sqI.include_key), 1, 2, N'') AS include_key
    	,sqI.filter_definition
    	,RANK () OVER
    				(
    					ORDER BY
    						 sqI.[object_id]
    						,CONVERT (NVARCHAR (MAX), sqI.index_key)
    						,sqI.filter_definition
    				) AS dupe_rank
    INTO
    	dbo.#temp_index_breakdown_keys_filters
    FROM
    
    	(
    		SELECT
    			 I.[object_id]
    			,I.index_id
    			,(
    				SELECT
    					  N', '
    					+ C.name
    					+ N' • '
    					+ TYPE_NAME (C.user_type_id)
    					+ ISNULL ((N': [ ' + (CASE
    											WHEN C.system_type_id <> C.user_type_id THEN LOWER (TYPE_NAME (C.system_type_id))
    											END) + N' ]'), N'')
    					+ N' '
    					+ (CASE
    							WHEN TY.name NOT IN (N'bigint', N'bit', N'date', N'datetime', N'datetime2', N'datetimeoffset', N'decimal', N'float', N'int', N'money', N'numeric', N'real', N'smalldatetime', N'smallint', N'smallmoney', N'time', N'tinyint') THEN CONVERT (NVARCHAR (30), C.max_length)
    							ELSE CONVERT (NVARCHAR (30), C.max_length) + N' (' + CONVERT (NVARCHAR (30), COLUMNPROPERTY (C.[object_id], C.name, 'Precision')) + N',' + ISNULL (CONVERT (NVARCHAR (30), COLUMNPROPERTY (C.[object_id], C.name, 'Scale')), 0) + N')'
    							END)
    					+ N' '
    					+ (CASE
    							WHEN IC.is_descending_key = 0 THEN N'[A]'
    							WHEN IC.is_descending_key = 1 THEN N'[D]'
    							ELSE N'[N/A]'
    							END) AS [text()]
    				FROM
    					sys.index_columns IC
    					INNER JOIN sys.columns C ON C.[object_id] = IC.[object_id]
    						AND C.column_id = IC.column_id
    					INNER JOIN sys.types TY ON TY.user_type_id = C.user_type_id
    				WHERE
    					IC.is_included_column = 0
    					AND IC.[object_id] = I.[object_id]
    					AND IC.index_id = I.index_id
    				ORDER BY
    					IC.key_ordinal
    				FOR
    					 XML PATH ('')
    					,TYPE
    			 ) AS index_key
    			,(
    				SELECT
    					  N', '
    					+ C.name
    					+ N' • '
    					+ TYPE_NAME (C.user_type_id)
    					+ ISNULL ((N': [ ' + (CASE
    											WHEN C.system_type_id <> C.user_type_id THEN LOWER (TYPE_NAME (C.system_type_id))
    											END) + N' ]'), N'')
    					+ N' '
    					+ (CASE
    							WHEN TY.name NOT IN (N'bigint', N'bit', N'date', N'datetime', N'datetime2', N'datetimeoffset', N'decimal', N'float', N'int', N'money', N'numeric', N'real', N'smalldatetime', N'smallint', N'smallmoney', N'time', N'tinyint') THEN CONVERT (NVARCHAR (30), C.max_length)
    							ELSE CONVERT (NVARCHAR (30), C.max_length) + N' (' + CONVERT (NVARCHAR (30), COLUMNPROPERTY (C.[object_id], C.name, 'Precision')) + N',' + ISNULL (CONVERT (NVARCHAR (30), COLUMNPROPERTY (C.[object_id], C.name, 'Scale')), 0) + N')'
    							END) AS [text()]
    				FROM
    					sys.index_columns IC
    					INNER JOIN sys.columns C ON C.[object_id] = IC.[object_id]
    						AND C.column_id = IC.column_id
    					INNER JOIN sys.types TY ON TY.user_type_id = C.user_type_id
    				WHERE
    					IC.is_included_column = 1
    					AND IC.[object_id] = I.[object_id]
    					AND IC.index_id = I.index_id
    				ORDER BY
    					IC.key_ordinal
    				FOR
    					 XML PATH ('')
    					,TYPE
    			 ) AS include_key
    			,I.filter_definition
    		FROM
    			sys.indexes I
    	) sqI
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Table Insert: Insert Size Values Into Temp Table
    -----------------------------------------------------------------------------------------------------------------------------
    
    SELECT
    	 DDPS.[object_id]
    	,DDPS.index_id
    	,SUM (CASE
    			WHEN DDPS.index_id < 2 THEN DDPS.row_count
    			END) AS [rows]
    	,SUM (DDPS.reserved_page_count) AS total_pages
    	,SUM (DDPS.used_page_count) AS used_pages
    	,SUM (CASE
    			WHEN DDPS.index_id < 2 THEN DDPS.in_row_data_page_count + DDPS.lob_used_page_count + DDPS.row_overflow_used_page_count
    			ELSE DDPS.lob_used_page_count + DDPS.row_overflow_used_page_count
    			END) AS data_pages
    INTO
    	dbo.#temp_index_breakdown_size_info
    FROM
    	sys.dm_db_partition_stats DDPS
    GROUP BY
    	 DDPS.[object_id]
    	,DDPS.index_id
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Main Query: Final Display / Output
    -----------------------------------------------------------------------------------------------------------------------------
    
    SELECT
    	 (CASE
    		WHEN sqBAQ.row_filter = 1 THEN sqBAQ.[type]
    		ELSE ''
    		END) AS object_type
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN DB_NAME ()
    		ELSE ''
    		END) AS [database_name]
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN SCHEMA_NAME (sqBAQ.[schema_id])
    		ELSE ''
    		END) AS [schema_name]
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN OBJECT_NAME (sqBAQ.[object_id])
    		ELSE ''
    		END) AS [object_name]
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN sqBAQ.create_date
    		ELSE ''
    		END) AS create_date
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN caMDKL.modify_date
    		ELSE ''
    		END) AS modify_date
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (25), CONVERT (MONEY, sqBAQ.[rows]), 1)), 4, 22))
    		ELSE ''
    		END) AS [rows]
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (25), CONVERT (MONEY, (sqBAQ.total_pages * 8) / 1024.0), 1)
    		ELSE ''
    		END) AS total_mb
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (25), CONVERT (MONEY, (sqBAQ.used_pages * 8) / 1024.0), 1)
    		ELSE ''
    		END) AS used_mb
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (25), CONVERT (MONEY, (sqBAQ.unused_pages * 8) / 1024.0), 1)
    		ELSE ''
    		END) AS unused_mb
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (25), CONVERT (MONEY, (sqBAQ.data_pages * 8) / 1024.0), 1)
    		ELSE ''
    		END) AS data_mb
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (25), CONVERT (MONEY, (sqBAQ.index_pages * 8) / 1024.0), 1)
    		ELSE ''
    		END) AS index_mb
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (6), CONVERT (DECIMAL (5, 2), ISNULL (((sqBAQ.data_pages + .0) / sqBAQ.used_pages) * 100, 0)))
    		ELSE ''
    		END) AS pct_data
    	,(CASE
    		WHEN sqBAQ.row_filter = 1 THEN CONVERT (VARCHAR (6), CONVERT (DECIMAL (5, 2), ISNULL (((sqBAQ.index_pages + .0) / sqBAQ.used_pages) * 100, 0)))
    		ELSE ''
    		END) AS pct_index
    	,sqBAQ.type_desc AS index_type
    	,ISNULL (sqBAQ.index_name, '') AS index_name
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		WHEN sqBAQ.is_primary_key = 0 AND sqBAQ.is_unique = 0 THEN REPLICATE ('.', 6)
    		WHEN sqBAQ.is_system_named = 0 THEN 'No'
    		WHEN sqBAQ.is_system_named = 1 THEN 'Yes'
    		ELSE ''
    		END) AS system_named
    	,(CASE
    		WHEN sqBAQ.is_primary_key = 1 THEN 'Yes'
    		ELSE ''
    		END) AS is_pk
    	,(CASE
    		WHEN sqBAQ.is_unique_constraint = 1 THEN 'C'
    		WHEN sqBAQ.is_unique = 1 THEN 'I'
    		ELSE ''
    		END) AS [unique]
    	,(CASE
    		WHEN sqBAQ.is_disabled = 1 THEN 'Yes'
    		ELSE ''
    		END) AS [disabled]
    	,(CASE
    		WHEN sqBAQ.is_hypothetical = 1 THEN 'Yes'
    		ELSE ''
    		END) AS hypothetical
    	,REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, sqCC.total_columns), 1)), 4, 23)) AS total_columns
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, caMDKL.[index_columns]), 1)), 4, 23))
    		END) AS [index_columns]
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, caMDKL.include_columns), 1)), 4, 23))
    		END) AS include_columns
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, (caMDKL.[index_columns] / sqCC.total_columns) * 100), 1)), 1, 23))
    		END) AS index_pct_of_columns
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, (caMDKL.include_columns / sqCC.total_columns) * 100), 1)), 1, 23))
    		END) AS include_pct_of_columns
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (23), CONVERT (MONEY, ((caMDKL.[index_columns] + caMDKL.include_columns) / sqCC.total_columns) * 100), 1)), 1, 23))
    		END) AS total_pct_of_columns
    	,CONVERT (VARCHAR (25), CONVERT (MONEY, (ISNULL (sqBAQ.individual_index_pages, 0) * 8) / 1024.0), 1) AS key_mb
    	,CONVERT (VARCHAR (6), CONVERT (DECIMAL (5, 2), ISNULL (((sqBAQ.individual_index_pages + .0) / sqBAQ.index_pages) * 100, 0))) AS key_mb_pct
    	,(CASE
    		WHEN sqBAQ.type_desc = N'HEAP' THEN ''
    		ELSE REVERSE (SUBSTRING (REVERSE (CONVERT (VARCHAR (25), CONVERT (MONEY, sqKL.total_max_length), 1)), 4, 22))
    		END) AS max_key_size_bytes
    	,(CASE
    		WHEN sqKL.total_max_length > 900 THEN 'Yes'
    		ELSE ''
    		END) AS over_key_size_limit
    	,ISNULL (ttIBKF.index_key, N'') AS index_key
    	,ISNULL (ttIBKF.include_key, N'') AS include_key
    	,ISNULL (ttIBKF.filter_definition, N'') AS filter_definition
    	,(CASE
    		WHEN sqED02.dupe_id IS NOT NULL THEN CONVERT (VARCHAR (20), sqED02.dupe_id) + ' - [' + CONVERT (VARCHAR (11), sqED02.total_dupes) + ']'
    		ELSE ''
    		END) AS dupe_id
    	,sqBAQ.is_unused AS unused
    	,ISNULL (CONVERT (VARCHAR (10), STATS_DATE (sqBAQ.[object_id], sqBAQ.index_id), 23), '') AS statistics_date
    	,(CASE
    		WHEN sqBAQ.[allow_row_locks] = 0 THEN 'No'
    		WHEN sqBAQ.[allow_row_locks] = 1 THEN 'Yes'
    		ELSE ''
    		END) AS row_locks
    	,(CASE
    		WHEN sqBAQ.[allow_page_locks] = 0 THEN 'No'
    		WHEN sqBAQ.[allow_page_locks] = 1 THEN 'Yes'
    		ELSE ''
    		END) AS page_locks
    	,(CASE
    		WHEN sqBAQ.[ignore_dup_key] = 0 THEN 'No'
    		WHEN sqBAQ.[ignore_dup_key] = 1 THEN 'Yes'
    		ELSE ''
    		END) AS ignore_dupes
    	,(CASE
    		WHEN sqBAQ.no_recompute = 0 THEN 'Yes'
    		WHEN sqBAQ.no_recompute = 1 THEN 'No'
    		ELSE ''
    		END) AS auto_stats
    	,(CASE
    		WHEN sqBAQ.is_padded = 0 THEN 'No'
    		WHEN sqBAQ.is_padded = 1 THEN 'Yes'
    		ELSE ''
    		END) AS padded
    	,(CASE
    		WHEN sqBAQ.fill_factor = 0 THEN 100
    		ELSE sqBAQ.fill_factor
    		END) AS fill_factor
    	,(CASE
    		WHEN sqBAQ.user_seeks > 0 THEN CONVERT (VARCHAR (20), sqBAQ.user_seeks)
    		ELSE ''
    		END) AS user_seeks
    	,(CASE
    		WHEN sqBAQ.user_scans > 0 THEN CONVERT (VARCHAR (20), sqBAQ.user_scans)
    		ELSE ''
    		END) AS user_scans
    	,(CASE
    		WHEN sqBAQ.user_lookups > 0 THEN CONVERT (VARCHAR (20), sqBAQ.user_lookups)
    		ELSE ''
    		END) AS user_lookups
    	,(CASE
    		WHEN sqBAQ.user_updates > 0 THEN CONVERT (VARCHAR (20), sqBAQ.user_updates)
    		ELSE ''
    		END) AS user_updates
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_user_seek, 23), '') AS last_user_seek
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_user_scan, 23), '') AS last_user_scan
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_user_lookup, 23), '') AS last_user_lookup
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_user_update, 23), '') AS last_user_update
    	,(CASE
    		WHEN sqBAQ.system_seeks > 0 THEN CONVERT (VARCHAR (20), sqBAQ.system_seeks)
    		ELSE ''
    		END) AS system_seeks
    	,(CASE
    		WHEN sqBAQ.system_scans > 0 THEN CONVERT (VARCHAR (20), sqBAQ.system_scans)
    		ELSE ''
    		END) AS system_scans
    	,(CASE
    		WHEN sqBAQ.system_lookups > 0 THEN CONVERT (VARCHAR (20), sqBAQ.system_lookups)
    		ELSE ''
    		END) AS system_lookups
    	,(CASE
    		WHEN sqBAQ.system_updates > 0 THEN CONVERT (VARCHAR (20), sqBAQ.system_updates)
    		ELSE ''
    		END) AS system_updates
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_system_seek, 23), '') AS last_system_seek
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_system_scan, 23), '') AS last_system_scan
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_system_lookup, 23), '') AS last_system_lookup
    	,ISNULL (CONVERT (VARCHAR (10), sqBAQ.last_system_update, 23), '') AS last_system_update
    FROM
    
    	(
    		SELECT
    			 O.[type]
    			,O.[schema_id]
    			,O.[object_id]
    			,CONVERT (VARCHAR (10), O.create_date, 23) AS create_date
    			,CONVERT (VARCHAR (10), O.modify_date, 23) AS modify_date
    			,sqDDPS.[rows]
    			,sqDDPS.total_pages
    			,sqDDPS.used_pages
    			,(CASE
    				WHEN sqDDPS.total_pages > sqDDPS.used_pages THEN sqDDPS.total_pages - sqDDPS.used_pages
    				ELSE 0
    				END) AS unused_pages
    			,sqDDPS.data_pages
    			,(CASE
    				WHEN sqDDPS.used_pages > sqDDPS.data_pages THEN sqDDPS.used_pages - sqDDPS.data_pages
    				ELSE 0
    				END) AS index_pages
    			,sqI.type_desc
    			,sqI.name AS index_name
    			,sqI.is_system_named
    			,sqI.is_primary_key
    			,sqI.is_unique
    			,sqI.is_disabled
    			,sqI.is_hypothetical
    			,sqI.individual_index_pages
    			,sqI.is_unused
    			,sqI.[allow_row_locks]
    			,sqI.[allow_page_locks]
    			,sqI.[ignore_dup_key]
    			,sqI.no_recompute
    			,sqI.is_padded
    			,sqI.fill_factor
    			,sqI.user_seeks
    			,sqI.user_scans
    			,sqI.user_lookups
    			,sqI.user_updates
    			,sqI.last_user_seek
    			,sqI.last_user_scan
    			,sqI.last_user_lookup
    			,sqI.last_user_update
    			,sqI.system_seeks
    			,sqI.system_scans
    			,sqI.system_lookups
    			,sqI.system_updates
    			,sqI.last_system_seek
    			,sqI.last_system_scan
    			,sqI.last_system_lookup
    			,sqI.last_system_update
    			,sqI.is_unique_constraint
    			,sqI.index_id
    			,sqI.row_filter
    		FROM
    			sys.objects O
    			INNER JOIN
    
    				(
    					SELECT
    						 ttIBSI.[object_id]
    						,SUM (ttIBSI.[rows]) AS [rows]
    						,SUM (ttIBSI.total_pages) AS total_pages
    						,SUM (ttIBSI.used_pages) AS used_pages
    						,SUM (ttIBSI.data_pages) AS data_pages
    					FROM
    						dbo.#temp_index_breakdown_size_info ttIBSI
    					GROUP BY
    						ttIBSI.[object_id]
    				) sqDDPS ON sqDDPS.[object_id] = O.[object_id]
    
    			INNER JOIN
    
    				(
    					SELECT
    						 I.[object_id]
    						,I.type_desc
    						,I.name
    						,KC.is_system_named
    						,I.is_primary_key
    						,I.is_unique
    						,I.is_disabled
    						,I.is_hypothetical
    						,(CASE
    							WHEN ttIBSI.used_pages > ttIBSI.data_pages THEN ttIBSI.used_pages - ttIBSI.data_pages
    							END) AS individual_index_pages
    						,(CASE
    							WHEN I.[type] = 0 THEN ''
    							WHEN I.[type] = 1 THEN REPLICATE ('.', 6)
    							WHEN I.is_primary_key = 1 THEN REPLICATE ('.', 6)
    							WHEN I.is_unique = 1 THEN REPLICATE ('.', 6)
    							WHEN EXISTS
    
    								(
    									SELECT
    										*
    									FROM
    										sys.index_columns IC
    										INNER JOIN sys.foreign_key_columns FKC ON FKC.parent_object_id = IC.[object_id]
    											AND FKC.parent_column_id = IC.column_id
    									WHERE
    										IC.[object_id] = I.[object_id]
    										AND IC.index_id = I.index_id
    								) THEN REPLICATE ('.', 6)
    
    							WHEN DDIUS.[object_id] IS NOT NULL THEN (CASE
    																		WHEN DDIUS.user_seeks + DDIUS.user_scans + DDIUS.user_lookups + DDIUS.user_updates = 0 THEN 'Y/N'
    																		ELSE 'No'
    																		END)
    							ELSE 'Yes'
    							END) AS is_unused
    						,I.[allow_row_locks]
    						,I.[allow_page_locks]
    						,I.[ignore_dup_key]
    						,S.no_recompute
    						,I.is_padded
    						,I.fill_factor
    						,DDIUS.user_seeks
    						,DDIUS.user_scans
    						,DDIUS.user_lookups
    						,DDIUS.user_updates
    						,DDIUS.last_user_seek
    						,DDIUS.last_user_scan
    						,DDIUS.last_user_lookup
    						,DDIUS.last_user_update
    						,DDIUS.system_seeks
    						,DDIUS.system_scans
    						,DDIUS.system_lookups
    						,DDIUS.system_updates
    						,DDIUS.last_system_seek
    						,DDIUS.last_system_scan
    						,DDIUS.last_system_lookup
    						,DDIUS.last_system_update
    						,I.is_unique_constraint
    						,I.index_id
    						,ROW_NUMBER () OVER
    											(
    												PARTITION BY
    													I.[object_id]
    												ORDER BY
    													 I.is_primary_key DESC
    													,(CASE
    														WHEN I.[type] = 0 THEN 'Z'
    														ELSE 'A'
    														END)
    													,I.[type]
    													,I.name
    											) AS row_filter
    					FROM
    						sys.indexes I
    						INNER JOIN dbo.#temp_index_breakdown_size_info ttIBSI ON ttIBSI.[object_id] = I.[object_id]
    							AND ttIBSI.index_id = I.index_id
    						LEFT JOIN sys.key_constraints KC ON KC.parent_object_id = I.[object_id]
    							AND KC.unique_index_id = I.index_id
    						LEFT JOIN sys.stats S ON S.[object_id] = I.[object_id]
    							AND S.stats_id = I.index_id
    						LEFT JOIN master.sys.dm_db_index_usage_stats DDIUS ON DDIUS.[object_id] = I.[object_id]
    							AND DDIUS.index_id = I.index_id
    							AND DDIUS.database_id = @Database_ID
    				) sqI ON sqI.[object_id] = O.[object_id]
    
    		WHERE
    			O.[type] IN ('U', 'V')
    			AND O.is_ms_shipped = 0
    			AND NOT
    
    				(
    					SCHEMA_NAME (O.[schema_id]) = N'dbo'
    					AND O.name = N'sysdiagrams'
    					AND O.[type] = 'U'
    				)
    
    	) sqBAQ
    
    	INNER JOIN
    
    		(
    			SELECT
    				 C.[object_id]
    				,COUNT (*) + .0 AS total_columns
    			FROM
    				sys.columns C
    			GROUP BY
    				C.[object_id]
    		) sqCC ON sqCC.[object_id] = sqBAQ.[object_id]
    
    	LEFT JOIN dbo.#temp_index_breakdown_keys_filters ttIBKF ON ttIBKF.[object_id] = sqBAQ.[object_id]
    		AND ttIBKF.index_id = sqBAQ.index_id
    	LEFT JOIN
    
    		(
    			SELECT
    				 IC.[object_id]
    				,IC.index_id
    				,SUM (C.max_length) AS total_max_length
    			FROM
    				sys.index_columns IC
    				INNER JOIN sys.columns C ON C.[object_id] = IC.[object_id]
    					AND C.column_id = IC.column_id
    			WHERE
    				IC.is_included_column = 0
    			GROUP BY
    				 IC.[object_id]
    				,IC.index_id
    		) sqKL ON sqKL.[object_id] = sqBAQ.[object_id] AND sqKL.index_id = sqBAQ.index_id
    
    	LEFT JOIN
    
    		(
    			SELECT
    				 sqED01.dupe_rank
    				,sqED01.total_dupes
    				,ROW_NUMBER () OVER
    									(
    										ORDER BY
    											(SELECT NULL)
    									) AS dupe_id
    			FROM
    
    				(
    					SELECT
    						 ttIBKF.dupe_rank
    						,COUNT (*) AS total_dupes
    					FROM
    						dbo.#temp_index_breakdown_keys_filters ttIBKF
    					GROUP BY
    						ttIBKF.dupe_rank
    					HAVING
    						COUNT (*) > 1
    				) sqED01
    
    		) sqED02 ON sqED02.dupe_rank = ttIBKF.dupe_rank
    
    	CROSS APPLY
    
    		(
    			SELECT
    				 (CASE
    					WHEN sqBAQ.modify_date = sqBAQ.create_date THEN REPLICATE ('.', 18)
    					ELSE sqBAQ.modify_date
    					END) AS modify_date
    				,LEN (ttIBKF.index_key) - LEN (REPLACE (ttIBKF.index_key, '•', '')) AS [index_columns]
    				,ISNULL (LEN (ttIBKF.include_key) - LEN (REPLACE (ttIBKF.include_key, '•', '')), 0) AS include_columns
    		) caMDKL
    
    ORDER BY
    	 sqBAQ.[type]
    	,SCHEMA_NAME (sqBAQ.[schema_id])
    	,OBJECT_NAME (sqBAQ.[object_id])
    	,sqBAQ.row_filter
    
    
    -----------------------------------------------------------------------------------------------------------------------------
    --	Cleanup: Drop Any Remaining Temp Tables
    -----------------------------------------------------------------------------------------------------------------------------
    
    IF OBJECT_ID (N'tempdb.dbo.#temp_index_breakdown_keys_filters', N'U') IS NOT NULL
    BEGIN
    
    	DROP TABLE dbo.#temp_index_breakdown_keys_filters
    
    END
    
    
    IF OBJECT_ID (N'tempdb.dbo.#temp_index_breakdown_size_info', N'U') IS NOT NULL
    BEGIN
    
    	DROP TABLE dbo.#temp_index_breakdown_size_info
    
    END

    public by teslamint  225914  1  4  0

    [PATCH][package] AA: update coova-chilli to 1.3.0 and add kmod-coova package

    [PATCH][package] AA: update coova-chilli to 1.3.0 and add kmod-coova package: 0001-update-coova-chilli-to-1.3.0-add-kmod-coova-package.patch
    From 2a7568d17915edd283a71f4cc4d4c71d066df912 Mon Sep 17 00:00:00 2001
    From: Jaehoon You <jhyou@waffle.at>
    Date: Fri, 25 Apr 2014 17:00:48 +0900
    Subject: [PATCH] update coova-chilli to 1.3.0; add kmod-coova package;
    
    Based on David Bird's patch: https://lists.openwrt.org/pipermail/openwrt-devel/2012-December/018075.html
    
    Signed-off-by: Jaehoon You <teslamint@gmail.com> 
    
    ---
     net/coova-chilli/Config.in                         | 56 +++++++++++++
     net/coova-chilli/Makefile                          | 94 ++++++++++++++++++++--
     net/coova-chilli/files/chilli.firewall             | 41 ++++++++++
     net/coova-chilli/files/chilli.init                 | 61 ++++++++++++++
     .../patches/100-fix-sysinfo-redeclaration.patch    | 24 ++++++
     .../patches/200-fix_compile_kmod.patch             | 24 ++++++
     6 files changed, 292 insertions(+), 8 deletions(-)
     create mode 100644 net/coova-chilli/Config.in
     create mode 100644 net/coova-chilli/files/chilli.firewall
     create mode 100644 net/coova-chilli/files/chilli.init
     create mode 100644 net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
     create mode 100644 net/coova-chilli/patches/200-fix_compile_kmod.patch
    
    diff --git a/net/coova-chilli/Config.in b/net/coova-chilli/Config.in
    new file mode 100644
    index 0000000..8057d87
    --- /dev/null
    +++ b/net/coova-chilli/Config.in
    @@ -0,0 +1,56 @@
    +# CoovaChilli advanced configuration
    +
    +menu "Configuration"
    +       depends on PACKAGE_coova-chilli
    +
    +config COOVACHILLI_REDIR
    +       bool "Enable support for redir server. Required for uamregex"
    +       default n
    +
    +config COOVACHILLI_MINIPORTAL
    +       bool "Enable support Coova miniportal"
    +       default n
    +
    +config COOVACHILLI_USERAGENT
    +       bool "Enable recording user-agent"
    +       default n
    +
    +config COOVACHILLI_DNSLOG
    +       bool "Enable support to log DNS name queries"
    +       default n
    +
    +config COOVACHILLI_UAMDOMAINFILE
    +       bool "Enable loading of mass uamdomains from file"
    +       default n
    +
    +config COOVACHILLI_PROXY
    +       bool "Enable proxy"
    +       default n
    +
    +config COOVACHILLI_MINICONFIG
    +       bool "Enable mini configuration file"
    +       default n
    +
    +config COOVACHILLI_BINSTATUSFILE
    +       bool "Enable binary status file"
    +       default n
    +
    +choice
    +       prompt "SSL library"
    +       default COOVACHILLI_NOSSL
    +
    +config COOVACHILLI_NOSSL
    +       bool "No SSL support"
    +
    +config COOVACHILLI_MATRIXSSL
    +       bool "MatrixSSL"
    +
    +config COOVACHILLI_CYASSL
    +       bool "CyaSSL"
    +
    +config COOVACHILLI_OPENSSL
    +       bool "OpenSSL"
    +
    +endchoice
    +
    +endmenu
    diff --git a/net/coova-chilli/Makefile b/net/coova-chilli/Makefile
    index 3b350cb..b5bd93c 100644
    --- a/net/coova-chilli/Makefile
    +++ b/net/coova-chilli/Makefile
    @@ -1,5 +1,5 @@
     #
    -# Copyright (C) 2007-2010 OpenWrt.org
    +# Copyright (C) 2007-2013 OpenWrt.org
     #
     # This is free software, licensed under the GNU General Public License v2.
     # See /LICENSE for more information.
    @@ -8,25 +8,42 @@
     include $(TOPDIR)/rules.mk
    
     PKG_NAME:=coova-chilli
    -PKG_VERSION:=1.2.9
    -PKG_RELEASE:=1
    +PKG_VERSION:=1.3.0
    +PKG_RELEASE:=3
    
     PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
     PKG_SOURCE_URL:=http://ap.coova.org/chilli
    -PKG_MD5SUM:=a493d0562fc3b05fe86d8ad65f7f2dc0
    +PKG_MD5SUM:=dc0037e3cdebcb60508081b4e42e984a
    
    -PKG_FIXUP:=autoreconf
     PKG_INSTALL:=1
    
    +
    +PKG_CONFIG_DEPENDS := \
    +  COOVACHILLI_MINIPORTAL \
    +  COOVACHILLI_REDIR \
    +  COOVACHILLI_USERAGENT \
    +  COOVACHILLI_DNSLOG \
    +  COOVACHILLI_UAMDOMAINFILE \
    +  COOVACHILLI_NOSSL \
    +  COOVACHILLI_MATRIXSSL \
    +  COOVACHILLI_CYASSL \
    +  COOVACHILLI_OPENSSL \
    +  COOVACHILLI_BINSTATUSFILE \
    +  COOVACHILLI_PROXY \
    +  COOVACHILLI_MINICONFIG
    +
     include $(INCLUDE_DIR)/package.mk
    +include $(INCLUDE_DIR)/kernel.mk
    
     define Package/coova-chilli
       SUBMENU:=Captive Portals
       SECTION:=net
       CATEGORY:=Network
    -  DEPENDS:=+kmod-tun +librt
    +  DEPENDS:=+kmod-tun +librt +COOVACHILLI_MATRIXSSL:libmatrixssl +COOVACHILLI_CYASSL:libcyassl +COOVACHILLI_OPENSSL:libopenssl
       TITLE:=Wireless LAN HotSpot controller (Coova Chilli Version)
       URL:=http://www.coova.org/CoovaChilli
    +  MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
    +  MENU:=1
     endef
    
     define Package/coova-chilli/description
    @@ -39,8 +56,59 @@ define Package/coova-chilli/description
            favorite radius server.
     endef
    
    -define Package/coova-chilli/conffiles
    -/etc/chilli.conf
    +define Package/coova-chilli/config
    +  source "$(SOURCE)/Config.in"
    +endef
    +
    +define KernelPackage/coova
    +  URL:=http://www.coova.org/CoovaChilli
    +  SUBMENU:=Network Support
    +  DEPENDS:=+coova-chilli
    +  TITLE:=Coova kernel module
    +  FILES:=$(PKG_BUILD_DIR)/src/linux/xt_coova.$(LINUX_KMOD_SUFFIX)
    +  AUTOLOAD:=$(call AutoLoad,90,coova)
    +endef
    +
    +define KernelPackage/coova/description
    +Kernel module for CoovaChilli
    +endef
    +
    +DISABLE_NLS=
    +
    +CONFIGURE_VARS += \
    +       ac_cv_func_malloc_0_nonnull=yes \
    +       ac_cv_func_realloc_0_nonnull=yes \
    +       ac_cv_func_memcmp_working=yes \
    +       ac_cv_func_setvbuf_reversed=no \
    +       KERNEL_DIR="$(LINUX_DIR)"
    +
    +CONFIGURE_ARGS += \
    +       $(if $(CONFIG_COOVACHILLI_REDIR),--enable,--disable)-chilliredir \
    +       $(if $(CONFIG_COOVACHILLI_DNSLOG),--enable,--disable)-dnslog \
    +       $(if $(CONFIG_COOVACHILLI_MINIPORTAL),--enable,--disable)-miniportal \
    +       $(if $(CONFIG_COOVACHILLI_USERAGENT),--enable,--disable)-useragent \
    +       $(if $(CONFIG_COOVACHILLI_UAMDOMAINFILE),--enable,--disable)-uamdomainfile \
    +       $(if $(CONFIG_COOVACHILLI_MATRIXSSL),--with,--without)-matrixssl \
    +       $(if $(CONFIG_COOVACHILLI_CYASSL),--with,--without)-cyassl \
    +       $(if $(CONFIG_COOVACHILLI_OPENSSL),--with,--without)-openssl \
    +       $(if $(CONFIG_COOVACHILLI_BINSTATUSFILE),--enable,--disable)-binstatusfile \
    +       $(if $(CONFIG_COOVACHILLI_PROXY),--enable,--disable)-chilliproxy \
    +       $(if $(CONFIG_COOVACHILLI_MINICONFIG),--enable,--disable)-miniconfig \
    +       $(if $(CONFIG_PACKAGE_kmod-coova),--with-nfcoova,)
    +
    +MAKE_FLAGS += \
    +       KERNEL_DIR="$(LINUX_DIR)"
    +
    +MAKE_INSTALL_FLAGS += \
    +       KERNEL_DIR="$(LINUX_DIR)" \
    +       INSTALL_MOD_PATH="$(PKG_INSTALL_DIR)"
    +
    +define Build/Configure
    +( \
    +               cd $(PKG_BUILD_DIR); \
    +               rm -rf config.{cache,status} ; \
    +               $(call Build/Configure/Default) \
    +)
     endef
    
     define Package/coova-chilli/install
    @@ -52,6 +120,16 @@ define Package/coova-chilli/install
            $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/chilli* $(1)/usr/sbin/
            $(INSTALL_DIR) $(1)/usr/lib/
            $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
    +       $(INSTALL_DIR) $(1)/etc/init.d
    +       $(CP) files/chilli.init $(1)/etc/init.d/chilli
    +       $(INSTALL_DIR) $(1)/lib/firewall
    +       $(CP) files/chilli.firewall $(1)/lib/firewall/chilli.sh
    +       $(if $(CONFIG_PACKAGE_kmod-coova), \
    +               $(INSTALL_DIR) $(1)/usr/lib/iptables; \
    +               $(CP) $(PKG_BUILD_DIR)/src/linux/lib*.so $(1)/usr/lib/iptables/ \
    +       )
     endef
    
     $(eval $(call BuildPackage,coova-chilli))
    +$(eval $(call KernelPackage,coova))
    +
    diff --git a/net/coova-chilli/files/chilli.firewall b/net/coova-chilli/files/chilli.firewall
    new file mode 100644
    index 0000000..e3856c4
    --- /dev/null
    +++ b/net/coova-chilli/files/chilli.firewall
    @@ -0,0 +1,41 @@
    +#!/bin/sh
    +
    +chilli_firewall() {
    +    local cfg="$1"
    +
    +    local network ifname tun
    +
    +    config_get network "$cfg" network
    +
    +    . /lib/functions/network.sh
    +    network_get_device ifname ${network:-lan}
    +
    +    if [ "$ifname" = "" ]
    +    then
    +       config_get ifname "$cfg" dhcpif
    +    fi
    +
    +    config_get tun "$cfg" tundev
    +
    +    for n in ACCEPT DROP REJECT
    +    do
    +       iptables -F zone_${network}_${n}
    +       iptables -I zone_${network}_${n} -i $tun -j $n
    +       iptables -I zone_${network}_${n} -o $tun -j $n
    +    done
    +
    +    iptables -D forward -i ${ifname} -j zone_${network}_forward
    +    iptables -A forward -i ${ifname} -j DROP
    +    iptables -A forward -i $tun -j zone_${network}_forward
    +
    +    iptables -D input -i ${ifname} -j zone_${network}
    +    iptables -A input -i $tun -j zone_${network}
    +
    +    iptables -I zone_${network} -p tcp --dport 3990 -j ACCEPT
    +    iptables -I zone_${network} -p tcp --dport 3991 -j ACCEPT
    +}
    +
    +chilli_post_core_cb() {
    +    config_load chilli
    +    config_foreach chilli_firewall chilli
    +}
    diff --git a/net/coova-chilli/files/chilli.init b/net/coova-chilli/files/chilli.init
    new file mode 100644
    index 0000000..a72f4f4
    --- /dev/null
    +++ b/net/coova-chilli/files/chilli.init
    @@ -0,0 +1,61 @@
    +#!/bin/sh /etc/rc.common
    +
    +START=30
    +STOP=90
    +
    +config_cb() {
    +    chilli_inst=$2
    +    if [ "$chilli_inst" != "" ]
    +    then
    +       rm -f /var/run/chilli_${chilli_inst}*
    +       chilli_conf=/var/run/chilli_${chilli_inst}.conf
    +       eval "start_chilli_$chilli_inst=1"
    +    fi
    +}
    +
    +option_cb() {
    +    case "$1" in
    +        # UCI settings
    +       network)
    +           . /lib/functions/network.sh
    +           local ifname
    +           network_get_device ifname $2
    +           echo "dhcpif=\"$ifname\"" >> $chilli_conf
    +           ;;
    +       disabled)
    +           eval "start_chilli_$chilli_inst=0"
    +           ;;
    +        # boolean settings
    +       dhcpbroadcast|nodynip|vlanlocation|locationstopstart|locationcopycalled|locationimmediateupdate|locationopt82|coanoipcheck|noradallow|proxymacaccept|proxyonacct|dhcpmacset|dhcpradius|noc2c|eapolenable|uamanydns|uamanyip|uamnatanyip|nouamsuccess|nowispr1|nowispr2|domaindnslocal|radsec|macauth|macreauth|macauthdeny|macallowlocal|strictmacauth|strictdhcp|ieee8021q|only8021q|radiusoriginalurl|swapoctets|statusfilesave|wpaguests|openidauth|papalwaysok|mschapv2|chillixml|acctupdate|dnsparanoia|seskeepalive|usetap|noarpentries|framedservice|scalewin|redir|injectwispr|redirurl|routeonetone|nousergardendata|uamgardendata|uamotherdata|withunixipc|uamallowpost|redirssl|uamuissl|layer3|patricia|redirdnsreq|dhcpnotidle|ipv6|ipv6only)
    +           [ "$2" = "true" -o "$2" = "1" ] && echo "$1" >> $chilli_conf
    +           ;;
    +       *)
    +           echo "$1=\"$2\"" >> $chilli_conf
    +           ;;
    +    esac
    +}
    +
    +start_chilli() {
    +    local cfg="$1"
    +    local start_chilli=$(eval "echo \$start_chilli_$cfg")
    +    [ "$start_chilli" = "0" ] && return
    +    local base=/var/run/chilli_${cfg}
    +    chilli -c ${base}.conf \
    +       --pidfile ${base}.pid \
    +       --cmdsocket ${base}.sock \
    +       --unixipc ${base}.ipc &
    +}
    +
    +start() {
    +    config_load chilli
    +    config_foreach start_chilli chilli
    +}
    +
    +stop() {
    +    ls /var/run/chilli*.pid 2>/dev/null && {
    +       kill $(cat /var/run/chilli*.pid)
    +       sleep 1
    +       killall -9 chilli
    +       rm -f /var/run/chilli*
    +    }
    +}
    diff --git a/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
    new file mode 100644
    index 0000000..446eb63
    --- /dev/null
    +++ b/net/coova-chilli/patches/100-fix-sysinfo-redeclaration.patch
    @@ -0,0 +1,24 @@
    +--- a/src/system.h
    ++++ b/src/system.h
    +@@ -76,10 +76,6 @@
    + #include <sys/stat.h>
    + #endif
    +
    +-#ifdef HAVE_SYS_SYSINFO_H
    +-#include <sys/sysinfo.h>
    +-#endif
    +-
    + #ifdef HAVE_TIME_H
    + #include <time.h>
    + #endif
    +@@ -132,6 +128,10 @@
    + #include <linux/un.h>
    + #endif
    +
    ++#ifdef HAVE_SYS_SYSINFO_H
    ++#include <sys/sysinfo.h>
    ++#endif
    ++
    + #elif defined (__FreeBSD__)  || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
    + #include <net/if.h>
    + #include <net/bpf.h>
    diff --git a/net/coova-chilli/patches/200-fix_compile_kmod.patch b/net/coova-chilli/patches/200-fix_compile_kmod.patch
    new file mode 100644
    index 0000000..799d26e
    --- /dev/null
    +++ b/net/coova-chilli/patches/200-fix_compile_kmod.patch
    @@ -0,0 +1,24 @@
    +--- a/src/linux/Makefile
    ++++ b/src/linux/Makefile
    +@@ -9,7 +9,6 @@ modules:
    +       make -C ${KERNEL_DIR} M=$$PWD $@;
    +
    + modules_install:
    +-      make -C ${KERNEL_DIR} M=$$PWD $@;
    +
    + modules_clean:
    +       make -C ${KERNEL_DIR} M=$$PWD $@;
    +@@ -24,9 +23,9 @@ lib%.o: lib%.c
    +       $(CC) $(CFLAGS) -fPIC -O2 -Wall -I${KERNEL_DIR}/include -D_INIT=lib$*_init -c -o $@ $<;
    +
    + install: modules_install libxt_coova.so
    +-      mkdir -p $(DESTDIR)/lib/xtables/
    +-      cp libxt_coova.so $(DESTDIR)/lib/xtables/
    ++      mkdir -p $(DESTDIR)/usr/lib/iptables/
    ++      cp libxt_coova.so $(DESTDIR)/usr/lib/iptables/
    +
    + distdir:
    +
    +-distclean: clean
    +\ No newline at end of file
    ++distclean: clean
    --
    1.8.2.1
    
    
    

    public by wassim  196385  0  5  0

    IOS reload data with last update data/time

    how to update the last update date/time and hide the refresh control when the data is loaded in the table.
    
    - (void)reloadData
    {
        // Reload table data
        [self.tableView reloadData];
        
        // End the refreshing
        if (self.refreshControl) {
            
            NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
            [formatter setDateFormat:@"MMM d, h:mm a"];
            NSString *title = [NSString stringWithFormat:@"Last update: %@", [formatter stringFromDate:[NSDate date]]];
            NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:[UIColor whiteColor]
                                                                        forKey:NSForegroundColorAttributeName];
            NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:title attributes:attrsDictionary];
            self.refreshControl.attributedTitle = attributedTitle;
            
            [self.refreshControl endRefreshing];
        }
    }

    public by ejmurray  220198  4  3  0

    Updated script to reflect the non console

    Updated script to reflect the non console: scrabble.py
    #!/usr/bin/python
    # encoding: utf-8
    """
    Created: 01/07/15, 11:14
    Description:
    Define a function scrabble_score that takes a string word as input and returns the equivalent scrabble
    score for that word.
    
    Assume your input is only one word containing no spaces or punctuation.
    As mentioned, no need to worry about score multipliers!
    Your function should work even if the letters you get are uppercase, lowercase, or a mix.
    Assume that you're only given non-empty strings.
    
    Have your function loop through the word that you are given as input and look up the score for
    each letter in the score dictionary. Add the score for each letter into a total of some sort.
    
    Remember you can use the string.lower() method to make your string lower case!
    
    In the CodeAcademy console you will need to comment out lines 30, 39 and 40.
    They are there to give console output.
    
    scrabble_score('Quiz') >>> 22
    """
    score = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2,
             "f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3,
             "l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1,
             "r": 1, "u": 1, "t": 1, "w": 4, "v": 4, "y": 4,
             "x": 8, "z": 10}
    
    def scrabble_score(word):
        total = 0
    
        # word = raw_input("Enter a word: ")
        word = word.lower()
    
        for letter in word:
            if letter in score:
                total = total + score[letter]
    
        return total
    
    a = scrabble_score('Quiz')
    print a
    
    
    

    public by Timothy Cyrus  67074  0  3  0

    Example of how to have Google Chrome extensions auto update to Github releases

    Example of how to have Google Chrome extensions auto update to Github releases: updates.xml
    <?xml version='1.0' encoding='UTF-8'?>
    <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
      <app appid='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'>
        <updatecheck codebase='https://github.com/tcyrus/sample-chrome-extension/releases/download/v2.0/sce.crx' version='2.0' />
      </app>
    </gupdate>
    
    

    public by fabio.nosenzo  6049  3  7  0

    Screen update disable in Excel VBA

    How to disable and enable screen update in Excel VBA, speeding up macro execution
    ' disable screen updating
    Application.ScreenUpdating = False
    
    ' enable screen updating
    Application.ScreenUpdating = True
    

    public by Geometry  100013  0  3  0

    Pass: Set the result Success to true

    Set the result Success to true Result to update Message indicating a possible warning Updated source
    C#
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    /// <summary>
    /// Set the result Success to true
    /// </summary>
    /// <param name="source">Result to update</param>
    /// <param name="message">Message indicating a possible warning</param>
    /// <returns>Updated source</returns>
    public static IOperationResult Pass(this IOperationResult source, string message = null)
    {
    	source.Success = true;
    	source.Message = message;
    	return source;
    }

    public by cghersi @ MailUp API DEV  1018  4  7  0

    Data Contract as input parameter for Create/Update List

    This bean collects all the parameters that should be passed to the methods regarding the management of Lists. There are two distinguished beans for the creation and for the update so that the "required" attributes can be set properly for the two different cases. The attribute 'scope' is designed as String, and will be managed in the backend code
    namespace MailUpSOA.Ws.Contract.API.DataContracts.Console
    {
        [DataContract(Name = "ConsoleListCreateDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListCreateDetails : ConsoleListDetails
        {
            [DataMember(IsRequired = true)]
            public String Name { get; set; }
    
            [DataMember(IsRequired = true)]
            public Int32 idSettings { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean useDefaultSettings { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean copyTemplate { get; set; }
    
            [DataMember(IsRequired = true)]
            public String scope { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean business { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean Customer { get; set; }
    
            [DataMember(IsRequired = true)]
            public Boolean copyWebhooks { get; set; }
        }
        
        [DataContract(Name = "ConsoleListUpdateDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListUpdateDetails : ConsoleListDetails
        {
            [DataMember(IsRequired = true)]
            public Int32 IdList { get; set; }
    
            [DataMember(IsRequired = false)]
            public String Name { get; set; }
    
            [DataMember(IsRequired = false)]
            public String scope { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? business { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? Customer { get; set; }
        }
        
        [DataContract(Name = "ConsoleListDetails", Namespace = "http://MailupSoa.Ws.Schema.API.Console")]
        public class ConsoleListDetails : BaseDataContract
        {
            #region OPTIONS
    
            [DataMember(IsRequired = false)]
            public String format { get; set; }
    
            [DataMember(IsRequired = false)]
            public String owneremail { get; set; }
    
            [DataMember(IsRequired = false)]
            public String bouncedemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public String description { get; set; }
    
            [DataMember(IsRequired = false)]
            public String charset { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? @public { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? tracking { get; set; }
    
            [DataMember(IsRequired = false)]
            public String nl_sendername { get; set; }
    
            [DataMember(IsRequired = false)]
            public String sms_sendername { get; set; }
    
            [DataMember(IsRequired = false)]
            public Int32? optout_type { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? sendemailoptout { get; set; }
    
            [DataMember(IsRequired = false)]
            public String notifyemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? frontendform { get; set; }
    
            [DataMember(IsRequired = false)]
            public String disclaimer { get; set; }
    
            [DataMember(IsRequired = false)]
            public String headerxabuse { get; set; }
    
            [DataMember(IsRequired = false)]
            public Int32? kbmax { get; set; }
    
            [DataMember(IsRequired = false)]
            public String replyto { get; set; }
    
            [DataMember(IsRequired = false)]
            public String displayas { get; set; }
    
            [DataMember(IsRequired = false)]
            public String headerlistunsubscriber { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? multipart_text { get; set; }
    
            [DataMember(IsRequired = false)]
            public String conversionlab_trackcode { get; set; }
    
            [DataMember(IsRequired = false)]
            public String default_prefix { get; set; }
    
            [DataMember(IsRequired = false)]
            public String multi_optout_list { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? subscribedemail { get; set; }
    
            [DataMember(IsRequired = false)]
            public Boolean? sendconfirmsms { get; set; }
    
            [DataMember(IsRequired = false)]
            public String senderfaxname { get; set; }
    
            [DataMember(IsRequired = false)]
            public String senderfax { get; set; }
    
            #endregion
        }
        
        /// <summary>
        /// Provides an enumeration of the possible scopes of a list
        /// </summary>
        public enum ListScopeEnum
        {
            /// <summary>
            /// List to be used to send newsletters
            /// </summary>
            newsletters,
            /// <summary>
            /// List to be used to send direct messages
            /// </summary>
            Direct_Advertising,
            /// <summary>
            /// List to be used to send transactional emails
            /// </summary>
            Transactional
        }
    }

    public by lbottaro  5357  7  7  1

    smbclient to remotely copy from linux to windows env

    This script allows to keep synchronized a windows based client with a linux machine. Details for smbclient command: -U: set the credentials to login -c: execute a command (between quotes) The command executed includes: -lcd: set the specified directory to local machine -mput: copy one or more local files to the remote computer
    #!/bin/bash
    
    # Linux source directory to copy from: /home/tmp/
    # Windows target directory where to copy: \\1.2.3.4\SharedDirectory\filesDir
    
    user=myUser
    pwd=myPwd
    targetIP=1.2.3.4
    sharedDirRoot=SharedDirectory
    targetDir=filesDir
    linuxSourceDir=/home/tmp/
    
    echo '- Updating Client folder -'
    smbclient -U $user%$pwd //$targetIP/$sharedDirRoot -c "cd $targetDir; lcd $linuxSourceDir; prompt off;recurse; mput *;"
    echo '- Remote Client Updated -'

    public by cghersi  2642  4  5  1

    Send an update onto Twitter with Twitter API

    Programmatically twitts the given content using the specified credentials. According to the Twitter rules, the same content cannot be sent twice.
    public static bool SendTwitterUpdate(string update, string consumerKey, string consumerSecret, 
      string accessToken, string accessTokenSecret)
    {
      string url = "https://api.twitter.com/1.1/statuses/update.json";
      string newStatus = Uri.EscapeDataString(update);
    
      string nonce = GetNonce();
      string timestamp = UnixTimeNow().ToString();
    
      //compute the signature:
      string stringForSignature = string.Format("POST&{5}&oauth_consumer_key%3D{0}%26oauth_nonce%3D{1}%26" +
        "oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D{2}%26oauth_token%3D{3}%26oauth_version%3D1.0%26status%3D{4}",
        consumerKey, nonce, timestamp, accessToken, Uri.EscapeDataString(newStatus), Uri.EscapeDataString(url));
      string signingKey = string.Format("{0}&{1}", Uri.EscapeDataString(consumerSecret), Uri.EscapeDataString(accessTokenSecret));
      string signature = HmacSha1(signingKey, stringForSignature);
    
      Dictionary<string, string> headers = new Dictionary<string, string>();
      headers.Add("Authorization", string.Format("OAuth oauth_consumer_key=\"{0}\", oauth_nonce=\"{1}\", " +
        "oauth_signature=\"{2}\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"{3}\", " +
        "oauth_token=\"{4}\", oauth_version=\"1.0\"",
        consumerKey, nonce, Uri.EscapeDataString(signature), timestamp, accessToken));
    
      string resp = SendRequest(url + "?status=" + newStatus, "", true, headers);
      return !string.IsNullOrEmpty(resp);
    }
    
    private static string HmacSha1(string secretKey, string signatureString)
    {
      var enc = System.Text.Encoding.UTF8;
      var hmac = new System.Security.Cryptography.HMACSHA1(enc.GetBytes(secretKey));
      byte[] signatureBytes = hmac.ComputeHash(enc.GetBytes(signatureString));
      return Convert.ToBase64String(signatureBytes);
    }
    
    //Snippet da Snip2Code => C#: retrieve the number of seconds from Epoch
    private static long UnixTimeNow()
    {
      TimeSpan timeSpan = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
      return (long)timeSpan.TotalSeconds;
    }
    
    private static string GetNonce()
    {
      byte[] bytes = new byte[32];
      new Random().NextBytes(bytes);
      string base64 = Convert.ToBase64String(bytes);
      return System.Text.RegularExpressions.Regex.Replace(base64, "[^A-Za-z]", "");
    }
    
    
    private static string SendRequest(string serviceUrl, string data, bool isPost, Dictionary<string, string> headers)
    {
      HttpWebRequest webRequest = null;
      try
      {
        webRequest = WebRequest.Create(serviceUrl) as HttpWebRequest;
      }
      catch (UriFormatException ufe)
      {
        Console.WriteLine("Cannot connect to {0} due to {1} ", serviceUrl, ufe.Message);
        return string.Empty;
      }
    
      if (isPost)
      {
        webRequest.Method = "POST";
        webRequest.ContentType = "application/x-www-form-urlencoded";
      }
    
      if (headers != null)
      {
        foreach (string key in headers.Keys)
        {
          webRequest.Headers.Add(key, headers[key]);
        }
      }
    
      if (isPost && (data != null))
        webRequest.ContentLength = data.Length;
    
      StreamReader responseReader = null;
      string responseData = string.Empty;
      WebResponse webResp = null;
      try
      {
        if (isPost)
        {
          // write the form values into the request message
          StreamWriter requestWriter = new StreamWriter(webRequest.GetRequestStream());
          requestWriter.Write(data);
          requestWriter.Flush();
          requestWriter.Close();
          requestWriter.Dispose();
        }
    
        webResp = webRequest.GetResponse();
        Stream webStream = webResp.GetResponseStream();
        responseReader = new StreamReader(webStream);
    
        //read the response:
        responseData = responseReader.ReadToEnd();
      }
      catch (WebException wex)
      {
        return string.Empty;
      }
      catch (IOException ioex)
      {
        return string.Empty;
      }
      finally
      {
        if (responseReader != null)
        {
          responseReader.Close();
          responseReader.Dispose();
        }
        if (webResp != null)
          webResp.Close();
        webRequest = null;
      }
    
      return responseData;
    }
    
    • Public Snippets
    • Channels Snippets