Sunday, 5 July 2026

Create modal using HTML and CSS

<body>
  <dialog id = "modal">
     <div>
       <h1>Title</h1>
       <p>Sample Text</p>
       <button onclick="modal.close()">Close</button>
     </div>
  </dialog>
  <button onclick=modal.showModal()>Click</button>
</body>


#modal {
  width: 50vw;
  max-width: 50%;
  padding: 1rem;
  border: none;
  border-radius: 8px;
  background-color: #eaeaea;
  color: #333;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#modal::backdrop {
  background: rgba(0, 0, 0, 0.2);
}


Wednesday, 22 April 2026

Generate Secure Files using PGP (Pretty Good Privacy)

Pretty Good Privacy (PGP) is a data encryption program used for signing, encrypting, and decrypting emails, files, and text to ensure secure communication.

Generating a PGP (Pretty Good Privacy) file involves creating an RSA key pair and then using that key to encrypt or sign data. While PowerShell doesn't have a "native" PGP command, the industry standard is to use GnuPG (gpg) via PowerShell.

Process to set up RSA 2048 keys and generate PGP files

1. Install GnuPG
Before starting, ensure you have GPG installed. The most common version for Windows is Gpg4win.
Check installation: Open PowerShell and type gpg --version
> Install if missing: 
winget install GnuPG.GnuPG
> Or install from: 
https://www.gnupg.org/download/

2. Generate RSA 2048 Key Pair
We will use the --full-generate-key command to ensure we specify the RSA algorithm and 2048-bit size.
> Run the following command:
gpg --full-generate-key
> Follow the prompts:
Selection: Select (1) RSA and RSA (default).
Key size: Type 2048.
Validity: Choose how long the key should last (e.g., 0 for no expiration).
Identity: Enter your Name and Email address.
Passphrase: Enter a strong password to protect your private key.

3. Exporting the Keys (Generating .asc Files)
PGP files are often shared as ASCII-armored (.asc) files. You’ll need to export your public key to share it with others.
> Export Public Key:
gpg --armor --export "your-email@example.com" > MyPublicKey.asc
> Export Private Key (Backup only!):
gpg --armor --export-secret-keys "your-email@example.com" > MyPrivateKey.asc

4. Encrypting a File (Generating .pgp/.gpg Files)
Once your keys are set up, you can generate an encrypted PGP file from any document.
Encrypt a file for yourself
            > If you want to encrypt a file so only you can open it: (A new file named document.txt.gpg will be created)
gpg --recipient "your-email@example.com" --encrypt "C:\path\to\document.txt"


Very Important
Encrypt a file for someone else
To encrypt a file for a colleague, you must first import their public key:
> Import their key: gpg --import their_key.asc
> Encrypt for them:
gpg --recipient "colleague@example.com" --encrypt "SecretData.docx"

Summary Table of PowerShell Commands
Generate Key gpg --full-generate-key
List Keys gpg --list-keys
Export Public Key gpg --armor --export [ID] > public.asc
Encrypt File gpg --recipient [ID] --encrypt [filename]
Decrypt File gpg --decrypt [filename].gpg > original.txt


Very Important
Security Tip: Never share your Private Key (.asc or .gpg). If you lose your private key or your passphrase, you will lose access to any files encrypted with that key pair forever.



Sunday, 5 April 2026

Setup Data API Builder (DAB)

 1. Create a .env file and paste these lines inside it:

conn ="Server=localhost,1433;
          User ID=<UserName>;
          Password='<Password>';
          Database=<DB_Name>;
          TrustServerCertificate=True;
          Encrypt=True;"

ASPNETCORE_URLS=http://<Server>:<Port>

2. Initialize DAB - this will create 

dab init --database-type "mssql" --host-mode "Development" --connection-string "@env('conn')"

3. Add entity to the DAB dab-config.json

dab add <Name> --source dbo.<TableName> --permissions "anonymous:*"

4. Start DAB

dab start

5. Make sure the tables in the database have the PK; otherwise, the DAB won't start


USEFUL URLS:

  • http://localhost:5000/api/<Entity>
  • http://localhost:5000/api/<Entity>/id/4
  • http://localhost:5000/api/<Entity>?$select=Name&$filter=where predicate
  • http://localhost:5000/graphql/
  • http://localhost:5000/swagger/index.html


Reference: 



Saturday, 28 March 2026

Saturday, 7 February 2026

Windows Problem Steps Recorder

Windows Problem Steps Recorder (PSR) is a built-in Windows utility that automatically captures screenshots and annotates steps to help troubleshoot issues or document processes.


Monday, 26 January 2026

Google Search Hack

linux -mint +ubuntu "best"

  • - exclude phrase
  • + include phrase
  • "" find exact match

Saturday, 3 January 2026

Generate QR Code in MS Word

  • Press CTRL + F9
  • Inside the braces, type: {displaybarcode”your-website.domain”qr\q3}
  • Press ALT + F9 to generate the QR code

Thursday, 4 December 2025

Google Form using App Script

  • Create a Google Sheet with the following headers: First Name, Last Name, DoB
  • Create a Google Form with the exact headers as Google Sheet headers:  First Name, Last Name, DoB
  • In Google Form, create an App Script Trigger as follows - this code will link the data in the Form to the created Google Sheet:

function onFormSubmit(event)
{
record_array = []
var form = FormApp.openById('Form Id in Edit Mode'); // Form ID
var formResponses = form.getResponses();
var formCount = formResponses.length;
// get the latest form response
var formResponse = formResponses[formCount - 1];
var itemResponses = formResponse.getItemResponses();
for (var j = 0; j < itemResponses.length; j++) {
var itemResponse = itemResponses[j];
var title = itemResponse.getItem().getTitle();
var answer = itemResponse.getResponse();
Logger.log(title);
Logger.log(answer);
record_array.push(answer);
}
AddRecord(record_array[0], record_array[1], record_array[2]);
}
function AddRecord(first_name, last_name, dob) {
var url = 'https://'; //URL OF GOOGLE SHEET;
var ss= SpreadsheetApp.openByUrl(url);
var dataSheet = ss.getSheetByName("Sheet1");
dataSheet.appendRow([first_name, last_name, dob, new Date()]);
}

 

Using JS in GoogleSheets

function func() 
{
    // sheet initial
    var app= SpreadsheetApp;
    var activeSheet = app.getActiveSpreadsheet().getActiveSheet();

    // get value
    var cell = activeSheet.getRange(row, col).getValue();

    // set value
    activeSheet.getRange(row, col).setValue(cell);

    // console log
    Logger.log (cell);
}


Tuesday, 25 November 2025

NU1101 Errors in Blazor Projects

These NU1101 errors in your Blazor project suggest that the required NuGet packages aren't being found in the configured sources. To resolve this, Update NuGet Package Sources in Visual Studio:
  • Go to Tools > Options > NuGet Package Manager > Package Sources
  • Add or enable the official NuGet source:
    • Name:   nuget.org
    • Source: https://api.nuget.org/v3/index.json

Wednesday, 22 October 2025

Connect PowerBI to SQL Server - TrustServerCertificate

Under the server that Power BI installed, 

  • Go to System Properties -> Advanced -> Environment Variables 
  • Add this Variable Name PBI_SQL_TRUSTED_SERVERS
  • Set the Variable Value to the servers that are trying to reach out to this Power BI box
  • Restart the machine


Sunday, 21 September 2025

Setup Windows Local Account without the Internet

During the Windows setup, 

  • On the WiFi screen, press SHIFT + F10 or FN + SHIFT + F10 
  • This will open the command prompt window with administrator rights 
  • Type: start ms-cxh:localonly and hit Enter 


Thursday, 3 July 2025

Analysis Service in Power BI Report Server

 We couldn’t connect to the Analysis Services server. Make sure you’ve entered the connection string correctly... link

Tuesday, 1 July 2025

Setup PowerShell Universal Dashboard

# Run PowerShell as Administrator
Install-Module -Name UniversalDashboard.Community

# Check PowerShellGet version
Get-Module -Name PowerShellGet -ListAvailable

# If you do not have PowerShellGet version 2.0 or higher
Install-Module -Name PowerShellGet -Force

# Check PowerShellGet version
Get-Module -Name PowerShellGet -ListAvailable

# Delete old version of PowerShellGet
    # for x64
    Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet'
    Remove-Item -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1' -Recurse -Force


    # for x86
    Get-ChildItem -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet'
    Remove-Item -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1' -Recurse -Force


# Copy new version from x64 to x86
Copy-Item -Path 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\' -Destination 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\'

# Copy new version from x86 to x64
Copy-Item -Path 'C:\Program Files (x86)\WindowsPowerShell\Modules\PowerShellGet\' -Destination 'C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\'

# Close the PowerShell session and reopen it
# Install the universal dashboard community module
# If you run into a command already available error, explicitly allow the new module to override the existing commands by using the -AllowClobber
Install-Module -Name UniversalDashboard.Community -AllowClobber

# Check
Get-Module UniversalDashboard.Community


Saturday, 22 February 2025

Activate Office Permanently

  • Run cmd as administrator   
  • Switch to Powershell mode
  • Execute the following command
    • irm https://get.activated.win | iex

Sunday, 29 December 2024

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n
FROM 
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) tens(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) hundreds(n),
     (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) thousands(n)
ORDER BY 1


Monday, 25 November 2024

SQL: Cannot execute as the database principal because the principal "dbo" does not exist

Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission. (Framework Microsoft SqlClient Data Provider):

  • Server Name: server_name or IP
  • Error Number: 15517
  • Severity: 16
  • State: 1
  • Line Number: 1

Resolution: ALTER AUTHORIZATION ON DATABASE::[YourDatabaseName] TO [sa];


Wednesday, 6 November 2024

SQL: Linked Server Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'

Sometimes when trying to access a linked server, you’d get an error saying “Login failed for user NT AUTHORITY\ANONYMOUS LOGON”. 

This happens because you’re connected using Windows authentication, and SQL Server fails to “forward” your credentials to the linked server.

To check if SQL is using Kerberos:

USE [master]
GO
SELECT      s.session_id, s.original_login_name, c.net_transport, c.auth_scheme, c.local_net_address, c.local_tcp_port, s.program_name
FROM sys.dm_exec_sessions s

LEFT OUTER JOIN sys.dm_exec_connections c on s.session_id = c.session_id
WHERE s.is_user_process = 1


To determine the authentication method of a connection, execute the following query:

SELECT net_transport, auth_scheme
FROM sys.dm_exec_connections
WHERE session_id = @@SPID;


Validating Authentication Properties Used by Connections

USE [master]
GO
SELECT COUNT(auth_scheme) as sessions_count, net_transport, auth_scheme
FROM sys.dm_exec_connections
GROUP BY net_transport, auth_scheme

 

To resolve this:

  • Both SQL Servers and the Client must be in the same Domain
  • Both SQL Servers must be able to register SPNs (Service Principal names)


Sunday, 3 November 2024

SQL: Create user and grant read-only access to a database

1. Create the Login (if it doesn’t exist)
If the login for the user hasn’t been created at the SQL Server level, you need to create it. This example assumes the user is an SQL Server authentication user.

    USE [master];
    CREATE LOGIN [new_username] WITH PASSWORD = 'your_password';


2. Grant Access to the Database
Now, switch to the database you want to grant access to and create a user associated with the login.

    USE [your_database_name];
    CREATE USER [new_username] FOR LOGIN [new_username];


3. Add the User to the db_datareader Role
Finally, add the user to the db_datareader role to provide read-only access to the database.

    ALTER ROLE [db_datareader] ADD MEMBER [new_username];


Saturday, 11 May 2024

Upgrade Windows 11 Home to Windows 11 Pro

  • Disable internet connection (Wi-Fi, Internet, etc.)
  • Change the product key using the following Generic product key:
                VK7JG-NPHTM-C97JM-9MPGT-3V66T
  • When the upgrade is completed, connect to the Internet
  • Use a purchased product key to Activate the Windows


Create modal using HTML and CSS

<body>   <dialog id = "modal">      <div>        <h1>Title</h1>        <p>Sample Text</p...