Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Author: ErcanOPAK

Wordpress

WordPress: Finding the Plugin That’s Slowing You Down

- 01.03.26 - ErcanOPAK comment on WordPress: Finding the Plugin That’s Slowing You Down

Is your admin dashboard crawling? You don’t need a new host; you need the Query Monitor plugin. What it exposes: Database queries triggered by each plugin. Slow API calls to external services. PHP errors and warnings hidden in the background. Once installed, look at the top bar. It will turn red if a query takes […]

Read More
Wordpress

WordPress: Stop Developing on Live Servers! Use LocalWP

- 01.03.26 - ErcanOPAK comment on WordPress: Stop Developing on Live Servers! Use LocalWP

⚠️ Live Editing is Dangerous Breaking your site while customers are browsing is a nightmare. LocalWP creates a perfect mirror of your site on your PC. Feature Benefit Live Links Share your local site with clients over the internet. One-Click SSL Test HTTPS without complicated setups. Blueprints Save your favorite plugin/theme combos as a template.

Read More
Photoshop

Photoshop: One-Click Epic Skies (The Ultimate Guide)

- 01.03.26 - ErcanOPAK comment on Photoshop: One-Click Epic Skies (The Ultimate Guide)

A boring gray sky can ruin a perfect architectural shot. Don’t waste time with the Pen Tool. Step 1: Select Edit -> Sky Replacement. Step 2: Choose from Dramatic, Sunset, or Blue Sky presets. Step 3: Photoshop automatically masks the edges, trees, and buildings perfectly. Expert Tip: Always adjust the ‘Foreground Lighting’ slider to ensure […]

Read More
Photoshop

Photoshop: AI-Powered Magic with Neural Filters

- 01.03.26 - ErcanOPAK comment on Photoshop: AI-Powered Magic with Neural Filters

🧠 Meet the Future of Editing Forget manual retouching for hours. Photoshop’s Neural Filters use machine learning to edit features in seconds. ✅ Smart Portrait: Change a subject’s age, gaze, or expression with one slider. ✅ Photo Restoration: Instantly remove scratches and noise from old scans. ✅ Depth Blur: Create a realistic bokeh effect even […]

Read More
Visual Studio

Visual Studio: Modernizing Your IDE for Extreme Focus

- 01.03.26 - ErcanOPAK comment on Visual Studio: Modernizing Your IDE for Extreme Focus

🚀 Code Like a Rockstar Stop squinting at your braces! Visual Studio 2022’s native Rainbow Braces and Sticky Scroll change the game. Why Your Current Setup Sucks: Deeply nested code is a cognitive drain. When you lose track of which ‘}’ belongs to which ‘if’, you lose flow. Sticky ScrollKeeps the class/method header at the […]

Read More
C#

C#: Throttling Concurrent Operations with SemaphoreSlim

- 01.03.26 - ErcanOPAK comment on C#: Throttling Concurrent Operations with SemaphoreSlim

If you run 1000 Tasks in parallel, you might overwhelm your DB or external API. Use SemaphoreSlim to limit concurrency. private static SemaphoreSlim _gate = new(5); // Only 5 at a time await _gate.WaitAsync(); try { await CallExternalApi(); } finally { _gate.Release(); }

Read More
C#

C#: Clean Metadata with Generic Attributes

- 01.03.26 - ErcanOPAK comment on C#: Clean Metadata with Generic Attributes

Before C# 11, passing types to attributes was messy ([Service(typeof(IUser))]). Now you can use generics. public class ServiceAttribute : Attribute where T : class { } [ServiceAttribute] public class MyRepo { … } It’s type-safe, cleaner, and allows for better IDE support and refactoring.

Read More
C#

C#: Writing Allocation-Free High Performance Code with Span

- 01.03.26 - ErcanOPAK comment on C#: Writing Allocation-Free High Performance Code with Span

Parsing strings usually creates hundreds of substrings on the heap. Span<T> provides a ‘view’ into memory without copying it. ReadOnlySpan text = “2024-03-01”; var year = text.Slice(0, 4); // Zero allocation! The Impact: This is how the .NET team made the runtime 10x faster in recent versions. Use it for high-frequency string or array processing.

Read More
SQL

SQL: Why Your Query Plan is Wrong – The Importance of Statistics

- 01.03.26 - ErcanOPAK comment on SQL: Why Your Query Plan is Wrong – The Importance of Statistics

The SQL Optimizer uses Statistics (histograms of data distribution) to decide between a Scan or a Seek. If stats are stale, SQL makes bad decisions. The Fix: Regularly run UPDATE STATISTICS MyTable. If you just performed a massive data import, this is more important than rebuilding indexes to maintain performance.

Read More
SQL

SQL: Identifying and Resolving Deadlocks in High-Concurrency DBs

- 01.03.26 - ErcanOPAK comment on SQL: Identifying and Resolving Deadlocks in High-Concurrency DBs

A Deadlock occurs when Task A waits for Task B, and Task B waits for Task A. The DB kills one to save the other. Prevention Strategy Implementation Access Order Always update Table A then B, never mix. Snapshot Isolation READ_COMMITTED_SNAPSHOT ON. Use DBCC TRACEON (1222, -1) to capture detailed deadlock graphs in the error […]

Read More
Asp.Net Core

.NET Core: Architecting Scalable Services with Minimal APIs

- 01.03.26 - ErcanOPAK comment on .NET Core: Architecting Scalable Services with Minimal APIs

Minimal APIs are not just for ‘small’ apps. They offer less overhead than Controllers by avoiding the MVC filter pipeline where it’s not needed. app.MapGet(“/user/{id}”, async (int id, IUserService service) => await service.GetById(id)) .WithName(“GetUser”) .WithOpenApi(); Senior Tip: Use ‘Endpoint Filters’ to handle cross-cutting concerns like validation and logging without the complexity of traditional Action Filters.

Read More
Asp.Net Core

.NET Core: High-Performance Code with C# Source Generators

- 01.03.26 - ErcanOPAK comment on .NET Core: High-Performance Code with C# Source Generators

Reflection is slow. Source Generators allow you to generate C# code during compilation based on your existing code, moving logic from runtime to compile time. Pro Use Case: Automatically generating mapping code (like AutoMapper but zero runtime cost) or creating strongly-typed API clients. This is how modern .NET achieves world-class performance.

Read More
Git

Git: Automating Code Quality with Client-Side Git Hooks

- 01.03.26 - ErcanOPAK comment on Git: Automating Code Quality with Client-Side Git Hooks

Prevent broken code from even reaching the server. Use a pre-commit hook to run linter and unit tests locally. By placing a script in .git/hooks/pre-commit, you ensure that if tests fail, the commit is blocked. This creates a ‘Quality First’ culture in the development team.

Read More
Git

Git: Recovering ‘Lost’ Commits with the Power of Reflog

- 01.03.26 - ErcanOPAK comment on Git: Recovering ‘Lost’ Commits with the Power of Reflog

Did you git reset –hard and lose your work? Don’t panic. Git almost never deletes anything immediately. Reflog tracks every move of the HEAD. git reflog # Find the hash before the mistake git reset –hard [HASH] This is the ‘Undo’ button for your entire Git history. It’s the difference between a productive day and […]

Read More
Ajax

Ajax: Mastering Request Cancellation with AbortController

- 01.03.26 - ErcanOPAK comment on Ajax: Mastering Request Cancellation with AbortController

If a user types fast, you don’t want 10 simultaneous API calls. You should abort the previous one before starting a new search. let controller = new AbortController(); fetch(url, { signal: controller.signal }).catch(e => { if (e.name === ‘AbortError’) console.log(‘Request Cleaned Up!’); }); // To cancel: controller.abort(); This saves server resources and prevents ‘Race Conditions’ […]

Read More
JavaScript

JavaScript: Advanced Memory Cleanup with WeakRef

- 01.03.26 - ErcanOPAK comment on JavaScript: Advanced Memory Cleanup with WeakRef

In complex SPAs, caching large objects can lead to ‘Slow Leaks’. WeakRef allows you to hold a reference to an object without preventing it from being Garbage Collected. let cache = new WeakRef(largeObject); // Later… const obj = cache.deref(); if (obj) { /* Use object */ } else { /* Re-fetch, it was cleaned up […]

Read More
HTML

HTML5: Encapsulating Styles with Shadow DOM and Web Components

- 01.03.26 - ErcanOPAK comment on HTML5: Encapsulating Styles with Shadow DOM and Web Components

🏗️ The Architecture of Web Components Avoid CSS collisions forever. Shadow DOM allows you to attach a ‘private’ DOM tree to an element that cannot be accessed by global CSS. const host = document.querySelector(‘#host’); const shadowRoot = host.attachShadow({mode: ‘closed’}); shadowRoot.innerHTML = ‘Private Text’; This is the standard for building reusable UI libraries that work across […]

Read More
CSS

CSS: Container Queries – The End of Media Queries?

- 01.03.26 - ErcanOPAK comment on CSS: Container Queries – The End of Media Queries?

Media queries react to the viewport. Container queries react to the parent element’s size. This is a revolution for component-based design. .card-container { container-type: inline-size; } @container (min-width: 400px) { .card { display: flex; flex-direction: row; } } Why? Now your card component can be placed in a sidebar or a main feed and it […]

Read More
Windows

Windows 11: Using Hyper-V for Ultra-Secure Development Environments

- 01.03.26 - ErcanOPAK comment on Windows 11: Using Hyper-V for Ultra-Secure Development Environments

Don’t clutter your main OS with various SQL versions and SDKs. Use Hyper-V (Professional/Enterprise only). Setting up a ‘Default Switch’ allows your VMs to share internet while staying isolated. You can take a Checkpoint before installing a complex SDK—if it breaks the OS, you revert in 5 seconds.

Read More
Windows

Windows 11: Professional Log Auditing with KQL and Event Viewer

- 01.03.26 - ErcanOPAK comment on Windows 11: Professional Log Auditing with KQL and Event Viewer

Standard Event Viewer is slow and cluttered. Modern Windows pros use KQL (Kusto Query Language) in Azure Data Studio or Sentinel to analyze Windows logs. The Pro Way: Export logs as JSON and run KQL queries to find correlation between hardware interrupts and driver crashes. It’s like having SQL for your operating system’s heartbeat.

Read More
AI

AI Prompt: Personal Growth via ‘Antifragility’ Analysis

- 01.03.26 - ErcanOPAK comment on AI Prompt: Personal Growth via ‘Antifragility’ Analysis

Based on Nassim Taleb’s concept, use AI to turn your weaknesses into strengths. The Prompt: “Act as a Stoic Philosopher and Risk Analyst. I am facing [Current Life Problem]. 1. Explain how I can apply ‘Antifragility’ here—not just surviving, but getting better because of the stress. 2. Identify the ‘fragile’ parts of my current plan. […]

Read More
AI

AI Prompt: Language-to-Language Logic Translation

- 01.03.26 - ErcanOPAK comment on AI Prompt: Language-to-Language Logic Translation

Converting code isn’t just about syntax; it’s about idiomatic patterns. “Act as a Polyglot Developer. Convert this Java Spring Boot code to C# .NET 8: [Paste Code]. Don’t just change syntax; use .NET idioms like LINQ, async/await properly, and replace Java libraries with their most robust .NET equivalents (e.g., AutoMapper, FluentValidation).”

Read More
AI

AI Prompt: The ‘Staff Engineer’ Architectural Review

- 01.03.26 - ErcanOPAK comment on AI Prompt: The ‘Staff Engineer’ Architectural Review

Use this prompt to validate your system design before writing a single line of code. The Prompt: “Act as a Staff Systems Architect. Review this proposed system: [Describe Architecture]. 1. Identify potential Single Points of Failure (SPOF). 2. Evaluate the data consistency model (Strong vs Eventual). 3. Suggest how to handle a total regional outage. […]

Read More
Docker

Docker: Shipping to ARM and x64 Simultaneously with Buildx

- 01.03.26 - ErcanOPAK comment on Docker: Shipping to ARM and x64 Simultaneously with Buildx

With Apple Silicon and ARM-based cloud servers (Graviton) taking over, your Docker images must be multi-arch. docker buildx build –platform linux/amd64,linux/arm64 -t my-app:latest –push . Why? This ensures your container runs natively on everything from a Raspberry Pi to a giant Xeon server without emulation overhead.

Read More
Kubernetes

Kubernetes: Mastering HPA for Elastic Traffic Management

- 01.03.26 - ErcanOPAK comment on Kubernetes: Mastering HPA for Elastic Traffic Management

Static pod counts are either wasteful or dangerous. HPA scales your deployment based on real-time metrics. Standard Config: Scale up when CPU exceeds 70%. Pro Config: Scale based on Custom Metrics (like Request-per-Second) using Prometheus and Keda. This reacts much faster to traffic spikes than CPU metrics.

Read More
Wordpress

WordPress: Fixing the ‘Slow wp_options’ Query with Custom Indexing

- 01.03.26 - ErcanOPAK comment on WordPress: Fixing the ‘Slow wp_options’ Query with Custom Indexing

In massive sites, the wp_options table becomes a bottleneck because autoload columns aren’t always indexed efficiently. The Fix: Running this SQL command can shave milliseconds off every single page load by helping MySQL find autoloaded options faster: CREATE INDEX autoloadindex ON wp_options (autoload, option_name); This is a low-level optimization that even ‘Premium’ caching plugins often […]

Read More
Wordpress

WordPress: Transitioning to Headless Architecture with REST API

- 01.03.26 - ErcanOPAK comment on WordPress: Transitioning to Headless Architecture with REST API

WordPress isn’t just a blog; it’s a powerful Content API. You can use it as a backend for React or Next.js apps. // Add custom field to REST API response add_action(‘rest_api_init’, function () { register_rest_field(‘post’, ‘reading_time’, [ ‘get_callback’ => function($post_array) { return calculate_reading_time($post_array[‘content’][‘rendered’]); } ]); }); This allows you to leverage WP’s amazing admin interface […]

Read More
Photoshop

Photoshop: The ‘Blend If’ Secret for Perfect Texture Overlays

- 01.03.26 - ErcanOPAK comment on Photoshop: The ‘Blend If’ Secret for Perfect Texture Overlays

Forget layer opacity. Blend If allows you to hide parts of a layer based on brightness, creating a much more natural blend. How to: Double-click a layer -> Layer Style. At the bottom, look for ‘Blend If’. Hold ‘Alt’ and click the slider to split it! This creates a smooth transition instead of a harsh […]

Read More
Photoshop

Photoshop: Pro-Level Color Management – ProPhoto RGB vs Adobe RGB

- 01.03.26 - ErcanOPAK comment on Photoshop: Pro-Level Color Management – ProPhoto RGB vs Adobe RGB

If you’re editing in sRGB, you’re losing millions of colors your camera captured. For high-end retouching, use a wider gamut. Space Use Case sRGB Web and Mobile screens. Adobe RGB Professional printing and high-end monitors. ProPhoto RGB Maximum data for 16-bit depth editing. Tip: Always edit in 16-bit ProPhoto to avoid ‘banding’ in gradients, then […]

Read More
Visual Studio

Visual Studio: Post-Mortem Debugging with Managed Memory Dumps

- 01.03.26 - ErcanOPAK comment on Visual Studio: Post-Mortem Debugging with Managed Memory Dumps

🔍 The ‘Unreproducible’ Bug Fix Sometimes a bug only happens in Production. Instead of guessing, take a .dmp file and open it in Visual Studio. The Pro Flow: Go to Debug -> Managed Memory. VS will show you exactly which objects were alive, their size on the heap, and the ‘Root’ that prevents them from […]

Read More
Page 6 of 69
« Previous 1 2 3 4 5 6 7 8 9 10 11 … 69 Next »

Posts navigation

Older posts
Newer posts
April 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Mar    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (950)
  • How to add default value for Entity Framework migrations for DateTime and Bool (859)
  • Get the First and Last Word from a String or Sentence in SQL (836)
  • How to select distinct rows in a datatable in C# (805)
  • How to make theater mode the default for Youtube (754)
  • Add Constraint to SQL Table to ensure email contains @ (578)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (564)
  • Average of all values in a column that are not zero in SQL (531)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (489)
  • Find numbers with more than two decimal places in SQL (449)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries
  • SQL: Use Window Functions for Advanced Analytical Queries
  • .NET Core: Use Background Services for Long-Running Tasks
  • .NET Core: Use Minimal APIs for Lightweight HTTP Services
  • Git: Use Cherry-Pick to Apply Specific Commits Across Branches
  • Git: Use Interactive Rebase to Clean Up Commit History Before Merge

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (950)
  • How to add default value for Entity Framework migrations for DateTime and Bool (859)
  • Get the First and Last Word from a String or Sentence in SQL (836)
  • How to select distinct rows in a datatable in C# (805)
  • How to make theater mode the default for Youtube (754)

Recent Posts

  • C#: Use Init-Only Setters for Immutable Objects After Construction
  • C#: Use Expression-Bodied Members for Concise Single-Line Methods
  • C#: Enable Nullable Reference Types to Eliminate Null Reference Exceptions
  • C#: Use Record Types for Immutable Data Objects
  • SQL: Use CTEs for Readable Complex Queries

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com