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

Ajax

Ajax: Why fetch() Doesn’t ‘Fail’ on 404s and How to Fix It

- 21.02.26 - ErcanOPAK comment on Ajax: Why fetch() Doesn’t ‘Fail’ on 404s and How to Fix It

A common beginner mistake is thinking .catch() handles API errors like 404 or 500. It doesn’t! Note: fetch() only rejects on network failure. const res = await fetch(url); if (!res.ok) throw new Error(‘API Error: ‘ + res.status);

Read More
JavaScript

JavaScript: Using the Proxy API for State Management

- 21.02.26 - ErcanOPAK comment on JavaScript: Using the Proxy API for State Management

Ever wondered how Vue.js handles reactivity? The answer is the Proxy API. It lets you ‘intercept’ object changes. const data = { price: 100 }; const reactive = new Proxy(data, { set(target, key, value) { console.log(`${key} changed to ${value}!`); target[key] = value; return true; } });

Read More
HTML

HTML5: Pro Form Validation without a Single Line of JavaScript

- 21.02.26 - ErcanOPAK comment on HTML5: Pro Form Validation without a Single Line of JavaScript

Native HTML5 validation is faster and more secure than JS-only checks. Combined with the :invalid CSS pseudo-class, you can build a full-featured validation system natively.

Read More
CSS

CSS: Creating App-like Scrolling Experiences with ‘Scroll Snap’

- 21.02.26 - ErcanOPAK comment on CSS: Creating App-like Scrolling Experiences with ‘Scroll Snap’

Stop using heavy JS sliders. Use pure CSS to make your image galleries feel like a mobile app. .container { scroll-snap-type: x mandatory; overflow-x: scroll; display: flex; } .item { scroll-snap-align: center; flex: 0 0 100%; } Result: Smooth, flick-to-scroll galleries that work perfectly on touch screens.

Read More
Windows

Windows 11: WSL2 – The Best Linux Distro is Now… Windows?

- 21.02.26 - ErcanOPAK comment on Windows 11: WSL2 – The Best Linux Distro is Now… Windows?

Forget dual-booting. WSL2 (Windows Subsystem for Linux) lets you run Ubuntu inside Windows with near-native performance. Why WSL2? ✅ Full Linux Kernel ✅ Docker Desktop Integration ✅ Access Windows files from Linux (and vice versa)

Read More
Windows

Windows 11: Debloating the OS for Maximum Gaming & Dev Speed

- 21.02.26 - ErcanOPAK comment on Windows 11: Debloating the OS for Maximum Gaming & Dev Speed

Windows 11 comes with heavy telemetry and background apps. Clean them up professionally. The Fix: Use the open-source tool ‘Chris Titus Tech’s Windows Utility’. Run this in PowerShell as Admin: irm christitus.com/win | iex It disables tracking, stops unnecessary services, and sets your PC to ‘Ultimate Performance’ mode.

Read More
AI

AI Prompt: Winning Your Next Salary Negotiation

- 21.02.26 - ErcanOPAK comment on AI Prompt: Winning Your Next Salary Negotiation

Go into your performance review with data-backed confidence. The Prompt: “Act as a Career Coach. I am a [Job Title] with [X] years of experience. My achievements this year: [List]. The market average for my role is [Amount]. 1. Write 3 scripts for the negotiation meeting. 2. List 5 non-monetary benefits I can ask for. […]

Read More
AI

AI Prompt: The ‘Fridge-to-Table’ Culinary Expert

- 21.02.26 - ErcanOPAK comment on AI Prompt: The ‘Fridge-to-Table’ Culinary Expert

Don’t know what to cook? Let AI be your Michelin-star chef based on what’s left in your fridge. “Act as a professional Chef. I have: [Chicken, half an onion, old spinach, and heavy cream]. Create a 20-minute gourmet recipe. Suggest 2 variations: one low-carb and one kid-friendly. List the techniques (e.g., deglazing) that will make […]

Read More
AI

AI Prompt: The ‘Bulletproof’ Method for 100% Code Coverage

- 21.02.26 - ErcanOPAK comment on AI Prompt: The ‘Bulletproof’ Method for 100% Code Coverage

Get AI to think like a hacker trying to break your code. Copy this Prompt: “Act as a Lead SDET. Analyze this [Language] function: [Paste Code]. Create a test plan covering: 1. Happy Path. 2. Edge Cases (null, empty, max/min). 3. Malicious input. Write the tests in [Framework] using a ‘Given/When/Then’ structure.”

Read More
Docker

Docker: Stop Guessing if Your Container is Truly ‘Healthy’

- 21.02.26 - ErcanOPAK comment on Docker: Stop Guessing if Your Container is Truly ‘Healthy’

A container can be ‘running’ but the app inside could be crashed or stuck in a loop. Use native Docker Healthchecks. HEALTHCHECK –interval=30s –timeout=3s \ CMD curl -f http://localhost/health || exit 1 Now, docker ps will show (healthy) or (unhealthy) instead of just ‘Up’.

Read More
Kubernetes

Kubernetes: Advanced Node Scheduling with Taints and Tolerations

- 21.02.26 - ErcanOPAK comment on Kubernetes: Advanced Node Scheduling with Taints and Tolerations

In a production cluster, you often want to keep ‘special’ nodes (like GPU-powered ones) only for specific pods. Concept: • Taint: The Node says “I only allow special pods.” • Toleration: The Pod says “I am allowed on that special node.” # Add taint to node kubectl taint nodes node1 key1=value1:NoSchedule

Read More
Wordpress

WordPress: Identifying Slow Plugins with Query Monitor

- 21.02.26 - ErcanOPAK comment on WordPress: Identifying Slow Plugins with Query Monitor

Is your site slow? Don’t guess. Query Monitor is the professional debugger for WP. It highlights: ❌ Duplicate SQL queries. ⚠️ Slow API requests (external). 🔥 Memory-hungry plugins. Check the ‘Queries by Component’ section to see exactly which plugin is adding 500ms to your load time.

Read More
Wordpress

WordPress: Manage Your Entire Site from the Terminal with WP-CLI

- 21.02.26 - ErcanOPAK comment on WordPress: Manage Your Entire Site from the Terminal with WP-CLI

Why use a slow GUI when you can update 50 plugins in 2 seconds? # Update everything at once wp core update && wp plugin update –all # Regenerate all thumbnails wp media regenerate –yes ⚠️ Warning: Always take a snapshot with wp db export before running bulk commands!

Read More
Photoshop

Photoshop: Healing Complex Backgrounds with AI Generative Fill

- 21.02.26 - ErcanOPAK comment on Photoshop: Healing Complex Backgrounds with AI Generative Fill

The days of manual Clone Stamping for hours are over. Generative Fill (Firefly) has changed the game. “The key to AI in Photoshop isn’t letting it do all the work, but using it to handle the tedious tasks so you can focus on the art.” The Pro Strategy: Select the object to remove with a […]

Read More
Photoshop

Photoshop: Cinematic Color Grading using Gradient Maps

- 21.02.26 - ErcanOPAK comment on Photoshop: Cinematic Color Grading using Gradient Maps

Forget standard filters. If you want that ‘Hollywood Look’, Gradient Maps are your best friend. Step-by-Step Workflow: Add a Gradient Map Adjustment Layer. Set Shadows to deep navy (#000033) and Highlights to warm orange (#ffcc00). Change Blend Mode to Soft Light. Lower Opacity to 30-40%. This technique blends your highlights and shadows into a cohesive […]

Read More
Visual Studio

Visual Studio: The Ultimate ‘Zero-Mouse’ Workflow for Senior Devs

- 21.02.26 - ErcanOPAK comment on Visual Studio: The Ultimate ‘Zero-Mouse’ Workflow for Senior Devs

🚀 Speed Up Your Coding by 300% Mouse movements are the biggest productivity killers. Master these specific chord combinations to stay in the zone. Action Shortcut Quick Refactor Ctrl + . Search Everything Ctrl + T Peek Definition Alt + F12 Pro Tip: Use Ctrl + Shift + V to access your clipboard ring. It […]

Read More
C#

C#: Speed Up Your App with Source Generators

- 21.02.26 - ErcanOPAK comment on C#: Speed Up Your App with Source Generators

Stop using Reflection at runtime. Source Generators create code during compilation, moving the work from the user’s CPU to the developer’s build time.

Read More
C#

C#: Save Memory with ValueTask in High-Throughput Scenarios

- 21.02.26 - ErcanOPAK comment on C#: Save Memory with ValueTask in High-Throughput Scenarios

If your async method often returns synchronously (like from a cache), using ValueTask instead of Task prevents an unnecessary object allocation on the heap.

Read More
C#

C#: Why You Should Use ‘Records’ for Data Objects

- 21.02.26 - ErcanOPAK comment on C#: Why You Should Use ‘Records’ for Data Objects

Records provide built-in immutability and value-based equality, which is much safer for multi-threaded apps. public record User(int Id, string Name);

Read More
SQL

SQL: Professional Soft Delete Strategy for Data Safety

- 21.02.26 - ErcanOPAK comment on SQL: Professional Soft Delete Strategy for Data Safety

Never DELETE from production. Use an IsDeleted bit column and a Global Query Filter to hide deleted data while keeping it recoverable.

Read More
SQL

SQL: Reading Execution Plans to Eliminate Table Scans

- 21.02.26 - ErcanOPAK comment on SQL: Reading Execution Plans to Eliminate Table Scans

A query might look clean but run slow. Execution Plans show you if SQL is using an Index or doing a ‘Table Scan’. If you see ‘Scan’, you need an index.

Read More
Asp.Net Core

.NET Core: Protecting Your API with Native Rate Limiting

- 21.02.26 - ErcanOPAK comment on .NET Core: Protecting Your API with Native Rate Limiting

Don’t let scrapers crash your API. Since .NET 7, you can implement rate limiting natively. builder.Services.AddRateLimiter(options => { options.AddFixedWindowLimiter(“fixed”, opt => { opt.PermitLimit = 10; opt.Window = TimeSpan.FromSeconds(10); }); });

Read More
Asp.Net Core

.NET Core: Master DI Lifecycles (Transient vs Scoped vs Singleton)

- 21.02.26 - ErcanOPAK comment on .NET Core: Master DI Lifecycles (Transient vs Scoped vs Singleton)

Choosing the wrong lifecycle is the #1 cause of bugs in .NET Core APIs. Transient: New every time. Perfect for stateless services. Scoped: Once per request. Ideal for Database Contexts. Singleton: Once for app life. Best for Caching.

Read More
Git

Git: Find the Exact Commit that Broke Your Code with Bisect

- 21.02.26 - ErcanOPAK comment on Git: Find the Exact Commit that Broke Your Code with Bisect

When a bug appears and you don’t know when it started, use Git Bisect. It uses binary search to find the faulty commit in seconds.

Read More
Git

Git: Surgical Fixes with Cherry-Pick – Move One Commit, Not the Branch

- 21.02.26 - ErcanOPAK comment on Git: Surgical Fixes with Cherry-Pick – Move One Commit, Not the Branch

Fixed a critical bug on ‘dev’ but not ready to merge the whole branch to ‘prod’? Use git cherry-pick [hash].

Read More
Ajax

Ajax: Implementing Efficient Long Polling for Real-Time UI Updates

- 21.02.26 - ErcanOPAK comment on Ajax: Implementing Efficient Long Polling for Real-Time UI Updates

Can’t use WebSockets? Long polling is the professional fallback. It keeps a connection open until the server has new data, reducing HTTP overhead.

Read More
JavaScript

JavaScript: Preventing Memory Leaks with WeakMap and WeakSet

- 21.02.26 - ErcanOPAK comment on JavaScript: Preventing Memory Leaks with WeakMap and WeakSet

When you store data in a regular Map, the reference prevents the Garbage Collector (GC) from cleaning up. Use WeakMap for private data. let privateData = new WeakMap(); class User { constructor(id) { privateData.set(this, { secret: ‘123’ }); } } When the ‘User’ object is deleted, its private data is automatically wiped from memory.

Read More
HTML

HTML5: Professional Image Optimization with and WebP

- 21.02.26 - ErcanOPAK comment on HTML5: Professional Image Optimization with and WebP

Don’t serve giant JPEGs to mobile users. Use modern formats with fallbacks. This approach saves up to 70% in bandwidth while ensuring every browser sees the image.

Read More
CSS

CSS: Solving the Nested Grid Problem with ‘subgrid’

- 21.02.26 - ErcanOPAK comment on CSS: Solving the Nested Grid Problem with ‘subgrid’

Aligning elements inside nested components was nearly impossible until CSS Subgrid arrived. .parent { display: grid; grid-template-columns: 1fr 2fr 1fr; } .child { grid-column: 1 / 4; display: grid; grid-template-columns: subgrid; } Now, the child’s items will align perfectly with the parent’s columns. Professional, pixel-perfect layout achieved.

Read More
Windows

Windows 11: Professional Terminal Setup with Oh My Posh

- 21.02.26 - ErcanOPAK comment on Windows 11: Professional Terminal Setup with Oh My Posh

Stop using the old CMD. Use the modern Windows Terminal with ‘Oh My Posh’ to see Git branch status, Node versions, and server health directly in your prompt.

Read More
Page 13 of 69
« Previous 1 … 8 9 10 11 12 13 14 15 16 17 18 … 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 (860)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • 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 (860)
  • Get the First and Last Word from a String or Sentence in SQL (837)
  • How to select distinct rows in a datatable in C# (806)
  • 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