Monday, September 27, 2021

Access rights on folder ASP .Net

 https://www.youtube.com/watch?v=qRW53_Xuhi8&ab_channel=BoobyBooby


RightClick on Folder

->Property

->Security

->Edit

->Add

->Advance

->Find Now

->Select IIS_IUSRS

-> OK

->OK

->Apply

->OK

Saturday, September 25, 2021

WKHtmlToPDF

 

What is it?

wkhtmltopdf and wkhtmltoimage are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely "headless" and do not require a display or display service.

There is also a C library, if you're into that kind of thing.

How do I use it?

  1. Download a precompiled binary or build from source
  2. Create your HTML document that you want to turn into a PDF (or image)
  3. Run your HTML document through the tool.
    For example, if I really like the treatment Google has done to their logo today and want to capture it forever as a PDF:

    wkhtmltopdf http://google.com google.pdf

Friday, September 24, 2021

File Zilla Setting for connect to ftp

 i have made multiple changes in my filezilla, if you are not able to connect directly, use below step to make config changes in filezilla


In FileZilla, click on the File menu and choose Site Manager

Add the site or server in the site manager.

Add hostname

change the encryption to = only use plain FTP

Change logon type = Normal

Enter username/password.

Ok/Connect to continue


go to Edit -> Settings

Click on Connection -> FTP: Choose Active

Click on Connection -> FTP -> Active Mode: Select = Ask your operating system for the external IP address

Click on Connection -> FTP -> Passive Mode: Choose Fall Back to Active Mode

Press OK.


you should be able to connect now


make the above changes only if you are not able to connect


let me know if you were able to connect without making these changes or after making them

Tuesday, September 21, 2021

Rename Database

 Select master first

USE master;  

GO  

ALTER DATABASE Logistics SET SINGLE_USER WITH ROLLBACK IMMEDIATE

GO

ALTER DATABASE Logistics MODIFY NAME = Logistics_Org ;

GO  

ALTER DATABASE Logistics_Org SET MULTI_USER

GO

This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

 1. Open "Turn windows features on or off" by: WinKey+ R => "optionalfeatures" => OK

enter image description here

  1. Enable those features under "Application Development Features"

enter image description here

Tested on Win 10 - But probably will work on other windows versions as well.

Thursday, September 9, 2021

Merge Two Memory Stream

 var streamOne = new MemoryStream();

FillThisStreamUp(streamOne);
var streamTwo = new MemoryStream();
DoSomethingToThisStreamLol(streamTwo);
streamTwo.CopyTo(streamOne); // streamOne holds the contents of both

Find data in all tables

 /* Reto Egeter, fullparam.wordpress.com */


DECLARE @SearchStrTableName nvarchar(255), @SearchStrColumnName nvarchar(255), @SearchStrColumnValue nvarchar(255), @SearchStrInXML bit, @FullRowResult bit, @FullRowResultRows int

SET @SearchStrColumnValue = '%notifications_dev%' /* use LIKE syntax */

SET @FullRowResult = 1

SET @FullRowResultRows = 3

SET @SearchStrTableName = NULL /* NULL for all tables, uses LIKE syntax */

SET @SearchStrColumnName = NULL /* NULL for all columns, uses LIKE syntax */

SET @SearchStrInXML = 0 /* Searching XML data may be slow */


IF OBJECT_ID('tempdb..#Results') IS NOT NULL DROP TABLE #Results

CREATE TABLE #Results (TableName nvarchar(128), ColumnName nvarchar(128), ColumnValue nvarchar(max),ColumnType nvarchar(20))


SET NOCOUNT ON


DECLARE @TableName nvarchar(256) = '',@ColumnName nvarchar(128),@ColumnType nvarchar(20), @QuotedSearchStrColumnValue nvarchar(110), @QuotedSearchStrColumnName nvarchar(110)

SET @QuotedSearchStrColumnValue = QUOTENAME(@SearchStrColumnValue,'''')

DECLARE @ColumnNameTable TABLE (COLUMN_NAME nvarchar(128),DATA_TYPE nvarchar(20))


WHILE @TableName IS NOT NULL

BEGIN

    SET @TableName = 

    (

        SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))

        FROM    INFORMATION_SCHEMA.TABLES

        WHERE       TABLE_TYPE = 'BASE TABLE'

            AND TABLE_NAME LIKE COALESCE(@SearchStrTableName,TABLE_NAME)

            AND QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName

            AND OBJECTPROPERTY(OBJECT_ID(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)), 'IsMSShipped') = 0

    )

    IF @TableName IS NOT NULL

    BEGIN

        DECLARE @sql VARCHAR(MAX)

        SET @sql = 'SELECT QUOTENAME(COLUMN_NAME),DATA_TYPE

                FROM    INFORMATION_SCHEMA.COLUMNS

                WHERE       TABLE_SCHEMA    = PARSENAME(''' + @TableName + ''', 2)

                AND TABLE_NAME  = PARSENAME(''' + @TableName + ''', 1)

                AND DATA_TYPE IN (' + CASE WHEN ISNUMERIC(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@SearchStrColumnValue,'%',''),'_',''),'[',''),']',''),'-','')) = 1 THEN '''tinyint'',''int'',''smallint'',''bigint'',''numeric'',''decimal'',''smallmoney'',''money'',' ELSE '' END + '''char'',''varchar'',''nchar'',''nvarchar'',''timestamp'',''uniqueidentifier''' + CASE @SearchStrInXML WHEN 1 THEN ',''xml''' ELSE '' END + ')

                AND COLUMN_NAME LIKE COALESCE(' + CASE WHEN @SearchStrColumnName IS NULL THEN 'NULL' ELSE '''' + @SearchStrColumnName + '''' END  + ',COLUMN_NAME)'

        INSERT INTO @ColumnNameTable

        EXEC (@sql)

        WHILE EXISTS (SELECT TOP 1 COLUMN_NAME FROM @ColumnNameTable)

        BEGIN

            PRINT @ColumnName

            SELECT TOP 1 @ColumnName = COLUMN_NAME,@ColumnType = DATA_TYPE FROM @ColumnNameTable

            SET @sql = 'SELECT ''' + @TableName + ''',''' + @ColumnName + ''',' + CASE @ColumnType WHEN 'xml' THEN 'LEFT(CAST(' + @ColumnName + ' AS nvarchar(MAX)), 4096),''' 

            WHEN 'timestamp' THEN 'master.dbo.fn_varbintohexstr('+ @ColumnName + '),'''

            ELSE 'LEFT(' + @ColumnName + ', 4096),''' END + @ColumnType + ''' 

                    FROM ' + @TableName + ' (NOLOCK) ' +

                    ' WHERE ' + CASE @ColumnType WHEN 'xml' THEN 'CAST(' + @ColumnName + ' AS nvarchar(MAX))' 

                    WHEN 'timestamp' THEN 'master.dbo.fn_varbintohexstr('+ @ColumnName + ')'

                    ELSE @ColumnName END + ' LIKE ' + @QuotedSearchStrColumnValue

            INSERT INTO #Results

            EXEC(@sql)

            IF @@ROWCOUNT > 0 IF @FullRowResult = 1 

            BEGIN

                SET @sql = 'SELECT TOP ' + CAST(@FullRowResultRows AS VARCHAR(3)) + ' ''' + @TableName + ''' AS [TableFound],''' + @ColumnName + ''' AS [ColumnFound],''FullRow>'' AS [FullRow>],*' +

                    ' FROM ' + @TableName + ' (NOLOCK) ' +

                    ' WHERE ' + CASE @ColumnType WHEN 'xml' THEN 'CAST(' + @ColumnName + ' AS nvarchar(MAX))' 

                    WHEN 'timestamp' THEN 'master.dbo.fn_varbintohexstr('+ @ColumnName + ')'

                    ELSE @ColumnName END + ' LIKE ' + @QuotedSearchStrColumnValue

                EXEC(@sql)

            END

            DELETE FROM @ColumnNameTable WHERE COLUMN_NAME = @ColumnName

        END 

    END

END

SET NOCOUNT OFF


SELECT TableName, ColumnName, ColumnValue, ColumnType, COUNT(*) AS Count FROM #Results

GROUP BY TableName, ColumnName, ColumnValue, ColumnType

Followers

Link