Showing posts from 2018

List of Questions I have been asked in Interviews

Note: If you are an interviewer and I have a interview scheduled with you in upcoming days or hours, please ask things which are not listed below so that I can have a opportunity to learn few more new things thanks ;)

This Page will be updated from time to time as I face new questions:
Do you know about System Pages GAM SGAM DCM ?Different modes available in Always on?Whats the difference between Synchronous and Asynchronous modes available?Which technology and version facilitates automatic page repairs in SQL Server?Difference between 2016 and 2012 version of SQL Server (New things that are available or absent).If latency is being observed in secondary replicas and transaction log on primary replica is full and not releasing space even after taking backup and shrinking and there is no open transactions what could be the possible reason and its resolution?What is the need of Bulk log recovery model apart from its minimally logged benefit for bulk operations?How did you optimized update…

T-Sql Script for Automating Replication Generation for all Stored Procedures in a SQL Server Database

This involves following steps:
Creating stored procedure named Create_Replication_SP using the code provided in this post. Please find the T-sql script below that can be used to create,configure and run replication for all stored procedures in a database automatically. Once stored procedure is in place all you have to do is provide the name of the database as the parameter as shown in example below:Use NameOfDatabasewhereSpIsCreated GO EXEC [Create_Replication_SP] @Database_Name='NameOfDatabaseHere'This will generate and Print a script in return in messages tab in SSMS. Copy the generated script and paste it in new query window and execute it and wait for its completion, progress gets tracked in Messages tab in Output window. What script does:
This creates Publication with nomenclature DatabaseName_SPor if you want a custom name you can pass the parameter @Publication_Name along with @DatabaseName (should be under 20 characters). Creates a snapshot agent Gets all the stored pro…

Adding Contact form within Blogger Contact Page

Let me be quick on this one :
This is 2 step process I am using Contempo template but things are pretty same for any blogger theme.
Getting the contact form widget: Add a contact form gadget to sidebar from layout section to get the contact form and then hide it from sidebar by using CSS: style="Display:None;" To do that jump to Contact form widget from Theme>> HTML Editor>>contact form widget and expand  <b:includable id='content'> Find this: <div class='contact-form-widget'> and replace it with this:
 <div class='contact-form-widget' style='display:none!important'>Moving the contact form to Page: Create a new contact page from pages section switch to HTML editor add the following html between the div tags already present there and publish it.
Note: Below code is coming from expanded content section of contact form widget from theme editor so in case you are facing some issues that's the place you should be lo…

How to make your own online Code Compiler Platform in 30 minutes

For this Demo Tute we will be showcasing just Python: Install Node.js from this will also install NPM on your Server\System.NPM will be used to install various packages given below to make this work: Install compileX using command given below on cmd:
npm i compilexInstall express using command given below on cmd:
npm i expressInstall body-parser using the command given below on cmd:
npm i body-parserInstall Python on your Server\System as this will be used by our web app to execute code. Set Python in Path variable so that you can execute it from anywhere from cmd without traversing directories again and again.Add code given below to notepad and save it as TestPython.js in some directory.
var express = require('express'); var path = require('path'); var app = express(); var bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({     extended: true   })); app.use(bodyParser.json()); //compileX var compiler = require('compilex…

How to Automatically MSTSC or RDP into Windows Server without entering Password again & again

Like always will come directly to point:

This saves password in clear text in batch file so think before using it on a shared system.If this doesn't bothers you and its really necessary as your connection is too fluctuating go ahead and read below how you can do it.

This is a 2 part process : Create batch file with all the commands given below and save it as NameOfBatchScript.bat this name is used in VBScript so make sure you replace it accordingly.Create a VBScript file with commands  given below to load the batch file we created in above step without showing the mstsc yes no prompts, save this file with any name you like(May be your Jump Server Name is best Choice for its name in case you have multiple due to multiple clients) but make sure to save it with extension  as .VBSNote: Replace the DomainName, Username & Password accordingly also IP with Server name\IP of server you are trying to connect if in same domain or with its FQDN if not in below scripts in SET …

Query to Expand and List All logins within a SQL Server Group

This query will get the details of user logins with in Active directory security group in expanded format which is not available by default in SSMS, this will iterate over all the user logins under Security section and expand and list the users within the group if there are any along with all other logins:
For example DBA team has 10 members who are part of Group Name DBA_GROUP and this Group is added in SQL Server logins so it will list the members with in DBA_GROUP as well (like DOMAIN\DBA1 DOMAIN\DBA2 and so on )instead of just listing DBA_GROUP.

SET NOCOUNT ON CREATE TABLE ##TEMPHOLDUSERS       (        AccountName NVARCHAR(MAX),        AccoutnType NVARCHAR(MAX),        Privilege NVARCHAR(MAX),        MappedLoginName NVARCHAR(MAX),        PermissionPath NVARCHAR(MAX)       ) DECLARE @id NVARCHAR(MAX) DECLARE @getcoinid  CURSOR SET @getcoinid   = CURSOR FOR SELECT name FROM sys.server_principals WHERE TYPE = 'G' AND name NOT LIKE '%$%' and name NOT LIKE 'NT%…

Redirecting all old url to home page or any other page in blogger using script

Adding a 301 redirect for every url which has year older then the value we are setting in our script:

So why this was needed ?

Recently I found in google search console that lot of Page not found errors are triggering for my site and when I looked at the links it was clear that the errors are because the domain was owned by someone else before I got it and google crawlers were still trying to find posts and pages which were published by previous owner.

Although there is a option to create a redirect for links in blogger dashboard but doing that for every single url each and every time was too much of work and also this was a blind game as we don't know for which url the error will trigger next until it was being logged in google search console: So here is quick summary for what I did followed by script and the Long explanations.

Quick Summary: Get current Url user is visiting on my site>Extract Year part from it>If YearFromUrl(is less then)<YearIStartedWritingPostsOnMySite…

SQL Server SSMS Bug: Scripting Delete action to new query window for Maintenance plans is deleting the maintenance plans without even executing the script leaving jobs behind which throws errors during manual delete

SQL Server version: Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64)
Tested using SSMS 17 and SSMS 12

Scripting Delete action to new query window for Maintenance plans is deleting the maintenance plans without actually executing the script:

Steps to reproduce:
Create a maintenance plan using maintenance plan wizardThis creates maintenance plan under path : Server or Instance Name>Management>Maintenance Plans along with a corresponding job under Sql server agent when viewed from SSMSNow right click on the Maintenance plan that gets created from step 1 in location specified in step 2 above and click deleteBut instead of clicking OK use the script button on top of window and select "script action to new query window" and then click CANCEL in the same window from where we just selected script action.So we just scripted the action and haven't actually deleted the plan nor by clicking OK nor by executing the script that gets created in new window.But now …

Popular posts from this blog

Enabling fixed Sidebar for blogger Contempo template for screen sizes smaller than 1440px

Adding copy to clipboard button to every google code prettify pre blocks in blogger

Solution: More Posts & Posts Links not working with Adsense Anchor ads on Touch screen mobiles in blogger

Query to Expand and List All logins within a SQL Server Group

Powershell script to automatically send HTML emails using gmail smtp

Adding code prettify to Blogger