Saturday, July 4, 2026

kill many process in sql server

 To kill multiple processes in SQL Server, you cannot pass a list of IDs directly into a single KILL command. Instead, you have to generate and execute individual KILL <spid> statements.

Here are the three most efficient ways to do this, depending on your needs.

Method 1: The Quick Filter Script (Recommended)

If you want to kill processes tied to a specific database or a specific user, you can run a query that automatically generates the syntax for you.

Run this script to generate the list of kill commands:


SQL

DECLARE @sql NVARCHAR(MAX) = '';


SELECT @sql += 'KILL ' + CAST(session_id AS VARCHAR(10)) + ';' + CHAR(13)

FROM sys.dm_exec_sessions

WHERE database_id = DB_ID('YourDatabaseName') -- Filter by database

  AND is_user_process = 1                     -- Only target user processes, not system tasks

  AND session_id <> @@SPID;                   -- Do not kill your current connection


-- STEP 1: Preview the commands to make sure they look correct

PRINT @sql;


-- STEP 2: Uncomment the line below when you are ready to execute them all at once

-- EXEC sp_executesql @sql;

Method 2: The Cursor Approach (Fully Automated)

If you want a single script that finds and drops connections instantly without a copy-paste preview step, you can loop through them using a CURSOR. This is highly effective if you are preparing a database for a restore or a drop.


SQL

DECLARE @spid INT

DECLARE @kill_cmd NVARCHAR(50)


DECLARE spid_cursor CURSOR FOR

SELECT session_id

FROM sys.dm_exec_sessions

WHERE database_id = DB_ID('YourDatabaseName')

  AND is_user_process = 1

  AND session_id <> @@SPID;


OPEN spid_cursor

FETCH NEXT FROM spid_cursor INTO @spid


WHILE @@FETCH_STATUS = 0

BEGIN

    SET @kill_cmd = 'KILL ' + CAST(@spid AS VARCHAR(10))

    EXEC sp_executesql @kill_cmd

    FETCH NEXT FROM spid_cursor INTO @spid

END


CLOSE spid_cursor

DEALLOCATE spid_cursor

Method 3: Kick Everyone Off via ALTER DATABASE

If your goal is to kill every single connection to a specific database right now (for instance, to perform maintenance, rename it, or drop it), the fastest and safest approach doesn't require looking up SPIDs at all. You can forcefully transition the database into SINGLE_USER mode, which automatically terminates all other active connections.


SQL

USE master;

ALTER DATABASE YourDatabaseName

SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


-- Perform your work here...


-- Don't forget to set it back to multi-user mode when finished!

ALTER DATABASE YourDatabaseName

SET MULTI_USER;

Note on ROLLBACK IMMEDIATE: This option specifies that any open transactions in the database will be instantly rolled back, and their underlying connections severed immediately.


Best Practices & Precautions

Check Status: If you kill a long-running write transaction (like a massive data import or index rebuild), SQL Server must roll back the changes to ensure data integrity. If you check sys.dm_exec_requests, you might see the status as KILLED/ROLLBACK. Do not restart the SQL service to speed this up, as the rollback will simply resume upon startup and often take longer.


Avoid System SPIDs: Always include is_user_process = 1 or filter out session_id <= 50 to avoid accidentally targeting background SQL Server engine processes.


Cheers

Samitha

Sunday, June 28, 2026

create a new table based on an existing view

 The absolute fastest and cleanest way to create a new table with the exact same schema (structure and data types) as an existing view in SQL Server is to use a SELECT ... INTO statement combined with a WHERE 1 = 0 clause.


The WHERE 1 = 0 condition acts as a false flag—it forces SQL Server to clone the structural definition of the view without actually copying any of the rows into your new table.


Run this script in your SQL Server Management Studio (SSMS):


SQL

-- Creates an empty table with the exact structure of the view

SELECT *

INTO q2AIR_MDPL_RPT_TimecardSalaryReport

FROM q2vAIR_MDPL_TimecardSalaryReport

WHERE 1 = 0;


Cheers

Samitha

Saturday, June 20, 2026

CSS focus ring

 The CSS focus ring is the visual indicator (usually a blue or dotted outline) that appears around interactive elements like links, buttons, and inputs when they are focused via keyboard navigation (like pressing the Tab key).


It is a critical feature for accessibility (a11y), allowing users who don't use a mouse to see exactly where they are on a page.


The CSS Focus Pseudo-Classes

To style the focus ring, you will primarily use three pseudo-classes depending on how you want the ring to behave:


:focus: Applies whenever an element receives focus, whether by keyboard, mouse click, or touch. (Can look messy when mouse users click a button and get a big ring).


:focus-visible: The modern standard. It only applies the focus ring when the browser determines it’s helpful—typically only for keyboard users, leaving mouse users with a clean interface.


:focus-within: Applies to a parent element when any of its child elements gain focus.


How to Style the Focus Ring

Historically, developers used outline, but modern CSS gives us much better control using outline, box-shadow, and outline-offset.


1. The Modern Standard (:focus-visible)

Use this for 95% of your use cases to keep things accessible for keyboard users without annoying mouse users.


CSS

/* Target buttons and links when focused via keyboard */

button:focus-visible, 

a:focus-visible {

  outline: 3px solid #3b82f6; /* Thicker, vibrant blue ring */

  outline-offset: 2px;       /* Pushes the ring away from the element */

}

2. The Custom Glow Effect (box-shadow)

If you want a smoother, curved focus ring that matches an element's border-radius, box-shadow is excellent. Note that you should always pair it with a transparent outline so users with Windows High Contrast Mode can still see it.


CSS

input:focus-visible {

  outline: 2px solid transparent; /* Fallback for high-contrast accessibility */

  border-color: #3b82f6;

  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5); /* Soft outer glow */

}

3. Styling the Parent (:focus-within)

Great for form cards or search bars where you want the entire container to light up when the input inside is active.


CSS

.search-form-container:focus-within {

  border-color: #10b981;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

}

The Golden Rule: Never Just outline: none

⚠️ Accessibility Warning: Never use outline: none or outline: 0 without immediately providing a custom, highly visible focus alternative. Removing the focus ring entirely breaks website navigation for millions of keyboard and assistive technology users.


If you hate how the default focus ring looks on mouse clicks, don't kill it completely. Just use :focus-visible instead:


CSS

/* Bad: Breaks accessibility completely */

button:focus {

  outline: none;

}


/* Good: Removes default for mouse, keeps/customizes for keyboard */

button:focus {

  outline: none; /* Reset default */

}

button:focus-visible {

  outline: 3px solid #ff4757; /* Custom keyboard focus */

}

Cheers

Samitha

Friday, June 5, 2026

Best way to crop image without losing quality

 Cropping itself does NOT reduce quality — it simply removes unwanted pixels. [wildandfreetools.com]

Quality loss usually happens because of:

  1. Saving as low‑quality JPG
  2. Re-compressing multiple times
  3. Resizing after cropping [picovert.com]


Recommended steps

  • Upload your image to a crop tool
  • Drag the crop box to exclude the right side (text)
  • DON’T resize unless needed
  • Export with: PNG (best quality, lossless) OR JPG at 90–100% quality [fixtools.io]


Best FREE online crop tools (no quality loss)

Here are reliable ones:

1. Adobe Express Crop Tool

Easy drag-and-drop cropping

Keeps high quality

No signup needed

https://www.adobe.com/express/feature/image/crop [adobe.com]


2. FixTools (Lossless crop)

True lossless cropping

Lets you control export quality precisely

 https://www.fixtools.io/image-tools/crop-image-without-losing-quality [fixtools.io]


 3. FastConvert Crop Tool

Supports custom dimensions (good for your unusual size)

No registration required

 https://fastconvert.co/crop-image [fastconvert.co]


4. FormatFuse Cropper

Pixel-accurate cropping

Keeps original format (lossless for PNG)

https://formatfuse.com/tools/image-crop [formatfuse.com]


5. ArtsFlick Crop Tool

Designed to crop without blur or compression

 https://artsflick.com/features/crop [artsflick.com]


For UI banners or screenshots:

Always use PNG (text remains sharp)


Cheers

Samith

Saturday, May 9, 2026

Using Helvetica Neue font

 Adding Helvetica Neue to your CSS is a classic choice for a clean, modern look. However, because it is a licensed font owned by Monotype, it isn't "free" to host like a Google Font. You have to handle it differently depending on whether you're relying on the user's system or hosting the files yourself.1. The "System Font" Method (Recommended)This is the fastest and most common way. Since Helvetica Neue comes pre-installed on almost all Macs and iOS devices, you can simply call it in your font stack. If the user doesn't have it (like on most Windows or Android devices), the browser will fall back to the next font in your list.CSS.your-class {

  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;

}

Why this order? The browser reads left-to-right. It tries to find "Helvetica Neue" first. If that fails, it looks for "Helvetica," then "Arial," and finally any generic "sans-serif" font.2. Using @font-face (Self-Hosting)If you have purchased a web license and have the font files (e.g., .woff2 or .woff), you can host them on your own server. This ensures the font appears on all devices, even Windows.Upload the font files to your project folder (e.g., /fonts/).Define the font in your CSS:CSS@font-face {

  font-family: 'Helvetica Neue';

  src: url('fonts/helvetica-neue-bold.woff2') format('woff2'),

       url('fonts/helvetica-neue-bold.woff') format('woff');

  font-weight: bold;

  font-style: normal;

}


body {

  font-family: 'Helvetica Neue', Arial, sans-serif;

}



Cheers
Samitha

Sunday, May 3, 2026

Package 'MailKit' 4.7.1.1 has a known moderate severity vulnerability,

 Warning As Error: Package 'MailKit' 4.7.1.1 has a known moderate severity vulnerability, https://github.com/advisories/GHSA-9j88-vvj5-vhgr


The error message you're seeing is a security safeguard. Because your project is likely configured with TreatWarningsAsErrors enabled, NuGet is blocking your build due to a known security vulnerability in MailKit 4.7.1.1.


The Vulnerability: GHSA-9j88-vvj5-vhgr

This is a STARTTLS Response Injection vulnerability.

The Risk: A Man-in-the-Middle (MitM) attacker can inject commands during the "handshake" phase when your app switches from a plain-text connection to an encrypted one (TLS).

The Impact: This can be used to trick your application into "downgrading" its security—for example, forcing it to use a less secure authentication method (like sending passwords in plain text) even though you think you're using an encrypted connection.

How to Fix It

The fix is straightforward: Upgrade MailKit to a patched version.

1. Update via .NET CLI

Run the following command in your terminal at the project root:

Bash

dotnet add package MailKit --version 4.8.0

(Or the latest available version, as 4.8.0+ contains the fix).

2. Update via Package Manager Console (Visual Studio)

PowerShell

Update-Package MailKit

3. Update via Project File (.csproj)

Locate the PackageReference in your .csproj file and update the version manually:

XML

<PackageReference Include="MailKit" Version="4.8.0" />

Why am I seeing this now?

The .NET SDK and NuGet now integrate with the GitHub Advisory Database. When you build your project, it checks your dependencies against known security threats.

If you absolutely cannot upgrade right now (which is not recommended) and need to bypass the error to unblock your build, you can temporarily "suppress" this specific warning by adding the following to your .csproj file, though you should only do this if you have a specific mitigation in place:


XML

<PropertyGroup>

  <NoWarn>$(NoWarn);NU1901;NU1902;NU1903;NU1904</NoWarn>

</PropertyGroup>

Recommendation: Stick with the upgrade. MailKit updates are generally very stable and backward-compatible within the same major version

Sunday, April 26, 2026

Converting an AI (Adobe Illustrator) file to a PNG

 Converting an AI (Adobe Illustrator) file to a PNG is a common task when you need to turn a scalable vector graphic into a web-ready, transparent raster image.


Since AI files are "vector-based" (made of paths) and PNGs are "raster-based" (made of pixels), the process involves a step called rasterization. Here are the best ways to do it depending on the tools you have.


1. Using Adobe Illustrator (Best Quality)

If you have the original software, this is the most reliable method because it gives you control over resolution and transparency.


Export for Screens (Quickest): Go to File > Export > Export for Screens. Select PNG as the format and choose your "Scale" (e.g., 1x, 2x, or 300 ppi for high quality).


Export As: Go to File > Export > Export As.... Choose PNG from the dropdown menu.


Note: In the "PNG Options" pop-up, ensure the Background Color is set to Transparent if you don't want a solid white box around your logo.


2. Using Free Online Converters (No Software Needed)

If you don't have Illustrator, several web-based tools can handle the conversion for you. These are great for one-off tasks.


CloudConvert: Very reliable and maintains high fidelity.


Adobe Express: Adobe offers a free online converter that is specifically optimized for their own file formats.


Zamzar: A classic choice for simple file-to-file swaps.


 Cheers

Samitha