Posts

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 https://nodejs.org/en/ 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

Image
Like always will come directly to point:

Disclaimer:
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

Image
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

Image
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

Image
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 …

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

Image
It's a 2 part process:
The script part to find all the pre blocks having code in it and append a copy button to it dynamically.The style part to place our copy button at the specified location(on top right of every code block in this case) The script part:
<script> var pre = document.getElementsByTagName('pre'); for (var i = 0; i < pre.length; i++) {             var button = document.createElement('button');                     button.className = 'copy-button';                     button.textContent = 'Copy';                     var s = pre[i].innerText;                     button.setAttribute("data-clipboard-text",s);                     pre[i].appendChild(button);        } var clipboard = new Clipboard('.copy-button'); clipboard.on('success', function(e) {     console.info('Action:', e.action);     console.info('Text:', e.text);     console.info('Trigger:', e.trigger);     e.trigg…

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

Image
Here is how to do it :

Add this code in your blogger template(where to add this code is mentioned before 2nd code snippet of this post) ,now the value 1300px is the screen size for which I want the sidebar to be always visible for, you can reduce this value as you like, but be aware that reducing this value to much smaller digit will result in showing the overlapped sidebar instead of content body for your blog readers who are using much smaller screen devices such as mobiles which you might not want to happen so be wise :

@media screen and (max-width: 1300px) {   .sidebar-container {     bottom: 0;     position: fixed;     top: 0;   }   .sidebar-container {     left: 0;     right: auto;   }   .sidebar-container.sidebar-invisible {     -webkit-transition-timing-function: cubic-bezier(0.4,0.0,0.6,1);             transition-timing-function: cubic-bezier(0.4,0.0,0.6,1);   }   .sidebar-container.sidebar-invisible {     -webkit-transform: translateX($(sidebar.width * -1));         -ms-tran…

Connecting Microsoft SQL Server using PHP

Image
Throwing Steps Right away without wasting much time :
3 things you need to have: WAMP/XAMPP installed on your system to run PHP.SQL Server for creating and connecting to Databases etc.PHP Drivers : For bridging SQL Server and PHP. Latest version of PHP Drivers can be download from this Download link which now supports PHP version 7.x.

Steps for installing PHP drivers:
The file that you will download is a nothing but a zip containing some dll files which are nothing but PHP extensions.Find the PHP extension folder for the version you are using and place the files inside that folder.Next open the Php.ini files for the version in use and add the initialization for the dll/plugins files that you just placed in extensions folder cos without initialization those files are good for nothing.Restart the wamp services.Goto Php extension from wamp menu and select the options which are having the same name as those files. This completes the installation part and now we are all ready to test the con…