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

Windows

Why WSL File Location Can Kill Performance

- 24.01.26 - ErcanOPAK comment on Why WSL File Location Can Kill Performance

Rule: Code inside WSL filesystem, not /mnt/c This: /home/user/project Not this: /mnt/c/project Because NTFS ↔ Linux IO is expensive.

Read More
Windows

Power Plans Still Exist (And They Still Matter)

- 24.01.26 - ErcanOPAK comment on Power Plans Still Exist (And They Still Matter)

powercfg /list powercfg /setactive SCHEME_MIN Why this matters:Windows 11 hides performance plans — it doesn’t remove them. Perfect for: Dev machines Compiling Docker workloads

Read More
Photoshop

Turn Any Photo into a Lighting-Corrected Asset

- 24.01.26 - ErcanOPAK comment on Turn Any Photo into a Lighting-Corrected Asset

Use Blend If sliders instead of masks. Why it works: Physically accurate light blending No edge artifacts Faster than manual masking Hidden gem for UI assets.

Read More
Photoshop

Non-Destructive “Repair” with Frequency Separation

- 24.01.26 - ErcanOPAK comment on Non-Destructive “Repair” with Frequency Separation

Instead of healing tools: Separate texture and color Fix them independently Why pros do this:You can “repair” images without destroying original data.

Read More
Kubernetes

Why Readiness Probes Matter More Than Liveness

- 24.01.26 - ErcanOPAK comment on Why Readiness Probes Matter More Than Liveness

Most outages happen because traffic hits half-ready pods. readinessProbe: httpGet: path: /health/ready port: 80 Key idea: Liveness = “restart me” Readiness = “send traffic or not” If you only use liveness → Kubernetes will happily route traffic to chaos.

Read More
Docker

Why Multi-Stage Builds Are About Security, Not Size

- 24.01.26 - ErcanOPAK comment on Why Multi-Stage Builds Are About Security, Not Size

Most people say multi-stage builds are for smaller images.Wrong. They’re about attack surface. FROM mcr.microsoft.com/dotnet/sdk AS build WORKDIR /src COPY . . RUN dotnet publish -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet WORKDIR /app COPY –from=build /app . Why it matters: No SDK in production Fewer CVEs Faster cold starts Smaller image is just a side […]

Read More
AI

Mental Load Optimizer

- 24.01.26 - ErcanOPAK comment on Mental Load Optimizer

Act as a cognitive load optimizer. Ask me 5 questions. Then redesign my daily routines to: – Reduce decision fatigue – Increase deep focus – Remove low-value tasks This is not motivation — it’s mental infrastructure design.

Read More
AI

Explain Code Like a Future Incident Report

- 24.01.26 - ErcanOPAK comment on Explain Code Like a Future Incident Report

Explain this code as if it caused a production outage. Include: – Root cause – Hidden assumptions – Failure conditions – How to prevent it Why it works:It forces the model to think defensively, not descriptively. Perfect for: Code reviews Risk analysis Legacy systems

Read More
AI

Turn Any Codebase Into a Performance Map

- 24.01.26 - ErcanOPAK comment on Turn Any Codebase Into a Performance Map

You are a senior performance engineer. Analyze this codebase and: 1. Identify allocation hotspots 2. Explain why each hotspot exists 3. Suggest refactors with before/after code 4. Rank fixes by ROI Assume production traffic. Why it’s gold:You’re not asking for refactoring — you’re asking for decision intelligence.

Read More
C#

Avoid “new” in Loops with Object Pooling

- 24.01.26 - ErcanOPAK comment on Avoid “new” in Loops with Object Pooling

Heavy loops + object creation = GC pressure. var pool = new ObjectPool<MyDto>(() => new MyDto()); var obj = pool.Get(); // use obj pool.Return(obj); Why it works: Reuses memory Reduces Gen0/Gen1 collections Stabilizes latency Perfect for: Parsers Serializers Message processing This is how you make C# behave like systems code.

Read More
C#

Span Can Replace 80% of Your String Allocations

- 24.01.26 - ErcanOPAK comment on Span Can Replace 80% of Your String Allocations

If you process strings heavily, Span<T> is a silent performance killer… in a good way. ReadOnlySpan<char> input = “order:12345”.AsSpan(); var idPart = input.Slice(input.IndexOf(‘:’) + 1); int id = int.Parse(idPart); Why this is powerful: No substring allocations No temporary strings Works directly on memory When to use it:Parsing, slicing, validation, protocol handling. When NOT to:Async methods […]

Read More
C#

ValueTask Is Not a Faster Task (Unless You Use It Right)

- 24.01.26 - ErcanOPAK comment on ValueTask Is Not a Faster Task (Unless You Use It Right)

Most developers replace Task with ValueTask expecting instant performance gains.The truth: misusing ValueTask can actually make your code slower and more fragile. ValueTask shines only when: The result is often synchronous Allocation pressure matters (high-throughput paths) public ValueTask<int> GetCachedValueAsync() { if (_cache.TryGetValue(“x”, out int value)) return new ValueTask<int>(value); return new ValueTask<int>(LoadFromDbAsync()); } Why it matters:ValueTask […]

Read More
Windows

Why Disabling Startup Apps Is Not Enough (And What Actually Works)

- 24.01.26 - ErcanOPAK comment on Why Disabling Startup Apps Is Not Enough (And What Actually Works)

Startup apps load from multiple layers, not just Task Manager. Real fix path: Task Manager → Startup Settings → Apps → Startup Registry & Scheduled Tasks (advanced) Cause → Effect Multiple startup vectors → slow boot Layered cleanup → consistent performance

Read More
AI

Create a Personal “Decision Filter”

- 24.01.26 - ErcanOPAK comment on Create a Personal “Decision Filter”

Ask me 5 questions to understand how I make decisions. Then create a simple rule-based decision framework I can reuse daily. Perfect for: Work prioritization Purchases Time management

Read More
AI

Convert Business Logic Into Testable Units

- 24.01.26 - ErcanOPAK comment on Convert Business Logic Into Testable Units

Refactor this logic into small, testable methods. Explain: – Responsibility boundaries – Why each function exists – How it improves maintainability This prompt forces architectural thinking, not just refactoring.

Read More
AI

Turn Any Codebase Into a Performance Report

- 24.01.26 - ErcanOPAK comment on Turn Any Codebase Into a Performance Report

Analyze the following code. 1. Identify hidden performance costs 2. Highlight unnecessary allocations 3. Suggest safer, idiomatic optimizations 4. Explain WHY each change improves performance Use this before: Code reviews Refactoring sessions Legacy cleanups

Read More
SQL

Why EXISTS Beats COUNT(*) in Conditional Queries

- 24.01.26 - ErcanOPAK comment on Why EXISTS Beats COUNT(*) in Conditional Queries

You don’t need numbers when you only need truth. IF EXISTS ( SELECT 1 FROM Orders WHERE CustomerId = 42 ) BEGIN PRINT ‘Has orders’ END Why it’s faster Stops at the first match Avoids full scans Reduces CPU usage

Read More
SQL

Why SELECT * Is a Silent Performance Killer (Even With Indexes)

- 24.01.26 - ErcanOPAK comment on Why SELECT * Is a Silent Performance Killer (Even With Indexes)

Databases return exactly what you ask for.SELECT * forces unnecessary IO, memory usage, and network transfer. SELECT OrderId, OrderDate, TotalAmount FROM Orders WHERE CustomerId = 42; Cause → Effect Extra columns → wider rows → slower queries Explicit columns → faster reads + stable schemas Bonus: Schema changes won’t break consumers.

Read More
Asp.Net Core / C#

Why IAsyncEnumerable Is a Game-Changer for Data Streaming APIs

- 24.01.26 - ErcanOPAK comment on Why IAsyncEnumerable Is a Game-Changer for Data Streaming APIs

Returning large datasets blocks memory.Streaming them changes the entire performance profile. public async IAsyncEnumerable<int> StreamNumbers() { for (int i = 0; i < 1000; i++) { await Task.Delay(10); yield return i; } } Why it works Consumers process data as it arrives Lower memory footprint Faster perceived response times Perfect for: Reporting APIs Log streaming […]

Read More
C#

The Hidden Cost of async Without await in Real Applications

- 24.01.26 - ErcanOPAK comment on The Hidden Cost of async Without await in Real Applications

An async method without await still creates a state machine.That means overhead without benefit. public async Task<int> CalculateAsync() { return 42; } Why this matters: Extra allocations Confusing stack traces No real async benefit Better: public Task<int> CalculateAsync() { return Task.FromResult(42); } Cause → Effect Unnecessary async → hidden performance tax Explicit tasks → clearer […]

Read More
C#

Why Span Can Quietly Make Your C# Code Faster (Without Unsafe Code)

- 24.01.26 - ErcanOPAK comment on Why Span Can Quietly Make Your C# Code Faster (Without Unsafe Code)

Most C# performance gains come from avoiding allocations, not from writing complex algorithms.Span<T> lets you work with slices of memory without creating new objects, which means less GC pressure and smoother performance. Why it matters:String slicing, parsing, or buffer manipulation usually creates hidden allocations. Span<T> works directly on memory. ReadOnlySpan<char> span = “Invoice-2026-0198”.AsSpan(); var year […]

Read More
HTML

Stop Using div for Everything — Accessibility Depends on This

- 24.01.26 - ErcanOPAK comment on Stop Using div for Everything — Accessibility Depends on This

Semantic HTML isn’t about style — it’s about meaning. <nav> <main> <article> <section> Why this mattersScreen readers, SEO bots, and search rankings depend on semantics.

Read More
CSS

The Real Fix for Sticky Headers That Jump on Scroll

- 24.01.26 - ErcanOPAK comment on The Real Fix for Sticky Headers That Jump on Scroll

The issue is usually layout reflow, not position: sticky. header { position: sticky; top: 0; will-change: transform; } Why this workswill-change hints the browser to optimize rendering early.

Read More
Windows

Fix Random Bluetooth Drops Instantly

- 24.01.26 - ErcanOPAK comment on Fix Random Bluetooth Drops Instantly

Most Bluetooth issues are driver power-saving bugs. Device Manager → Bluetooth Adapter → Power Management❌ Uncheck “Allow the computer to turn off this device” Why this worksWindows prioritizes battery life over connection stability.

Read More
Windows

Why Your Laptop Is Slow Even With High-End Specs

- 24.01.26 - ErcanOPAK comment on Why Your Laptop Is Slow Even With High-End Specs

The silent killer: Core Parking + Power Throttling. Windows aggressively parks CPU cores to save power — sometimes too aggressively. powercfg /setactive SCHEME_MIN ResultImmediate responsiveness boost for dev machines and build times.

Read More
AI

Decision-Making Under Uncertainty

- 24.01.26 - ErcanOPAK comment on Decision-Making Under Uncertainty

Act as a strategic advisor. Given this decision, list hidden risks, second-order effects, and long-term consequences. Then propose a safer alternative with reasoning. Why this mattersMost bad decisions fail after step 2 — not at step 1.

Read More
AI

Debug Production Issues With Missing Context

- 24.01.26 - ErcanOPAK comment on Debug Production Issues With Missing Context

You are a production debugging expert. Given this stack trace and partial logs, infer the most likely root cause, list hypotheses ranked by probability, and propose minimal-risk fixes suitable for hotfix deployment. Why this worksAI becomes a senior on-call engineer, not a code generator.

Read More
AI

Refactor Legacy Code Without Breaking Anything

- 24.01.26 - ErcanOPAK comment on Refactor Legacy Code Without Breaking Anything

Act as a senior software architect. Refactor the following legacy code to modern best practices without changing public behavior. Explain each refactoring step and why it improves maintainability, performance, or safety. Highlight potential breaking changes and how to avoid them. Why this worksYou force the model to preserve contracts, not just “rewrite prettier code”.

Read More
Docker

The Hidden Reason Your Containers Randomly Die in Production

- 24.01.26 - ErcanOPAK comment on The Hidden Reason Your Containers Randomly Die in Production

Most “random” container crashes are not random at all — they’re OOM kills. By default, Docker containers have no memory awareness unless you explicitly define it. services: api: image: my-api deploy: resources: limits: memory: 512M Why this mattersWithout limits, the container can consume host memory freely.Linux kernel steps in → kills your container → zero […]

Read More
Kubernetes

Detect CrashLoopBackOff Root Cause in 10 Seconds

- 24.01.26 | 24.01.26 - ErcanOPAK comment on Detect CrashLoopBackOff Root Cause in 10 Seconds

Most people stare at logs too long. Kubernetes already tells you why your pod died. Fastest diagnostic command: kubectl describe pod <pod-name> Look for: Last State: Terminated Reason: OOMKilled Why this matters:Logs may be empty if the container never fully started. Real fix:Increase memory requests, not limits: resources: requests: memory: “512Mi” limits: memory: “1Gi” Result:Stable […]

Read More
Page 31 of 69
« Previous 1 … 26 27 28 29 30 31 32 33 34 35 36 … 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 (837)
  • 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 (837)
  • 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