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

Day: January 28, 2026

C#

Expression-Bodied Members

- 28.01.26 - ErcanOPAK comment on Expression-Bodied Members

int Sum() => a + b; Why it mattersReadable, compact, expressive.

Read More
C#

Span for High-Performance Parsing

- 28.01.26 - ErcanOPAK comment on Span for High-Performance Parsing

Why it mattersZero allocations in hot paths.

Read More
C#

Pattern Matching switch

- 28.01.26 - ErcanOPAK comment on Pattern Matching switch

return obj switch { null => 0, _ => 1 }; Why it mattersClear intent, fewer bugs.

Read More
SQL

Avoid SELECT * in Production

- 28.01.26 - ErcanOPAK comment on Avoid SELECT * in Production

Why it mattersSchema changes won’t silently break performance.

Read More
SQL

Covering Indexes Reduce Lookups

- 28.01.26 - ErcanOPAK comment on Covering Indexes Reduce Lookups

INCLUDE (Name, Email) Why it mattersQueries hit index only → faster reads.

Read More
Asp.Net Core

Environment-Specific Config Overrides

- 28.01.26 - ErcanOPAK comment on Environment-Specific Config Overrides

Why it mattersAvoids prod accidents caused by wrong configs.

Read More
Asp.Net Core / C#

Minimal APIs with Validation

- 28.01.26 - ErcanOPAK comment on Minimal APIs with Validation

app.MapPost(“/users”, (User u) => Results.Ok()); Why it mattersLess ceremony, same power.

Read More
Git

Undo Local Changes Safely

- 28.01.26 - ErcanOPAK comment on Undo Local Changes Safely

git restore . Why it mattersModern replacement for dangerous commands.

Read More
Git

Search History by Content

- 28.01.26 - ErcanOPAK comment on Search History by Content

git log -S “methodName” Why it mattersFind when logic changed, not just files.

Read More
Ajax / JavaScript

Ajax — Always Set Timeouts

- 28.01.26 - ErcanOPAK comment on Ajax — Always Set Timeouts

$.ajax({ timeout: 5000 }); Why it mattersPrevents hanging UI states.

Read More
JavaScript

structuredClone() Beats JSON Hacks

- 28.01.26 - ErcanOPAK comment on structuredClone() Beats JSON Hacks

const copy = structuredClone(obj); Why it mattersHandles Dates, Maps, Sets safely.

Read More
HTML

Native Lazy Loading

- 28.01.26 - ErcanOPAK comment on Native Lazy Loading

<img loading=”lazy” src=”image.jpg”> Why it mattersFaster pages, zero JS.

Read More
CSS

:where() for Zero-Specificity Styling

- 28.01.26 - ErcanOPAK comment on :where() for Zero-Specificity Styling

:where(button) { margin: 0; } Why it mattersStyle globally without specificity wars.

Read More
Windows

App Execution Aliases Cleanup

- 28.01.26 - ErcanOPAK comment on App Execution Aliases Cleanup

Settings → Apps → App execution aliases Why it mattersFixes “wrong app opens” issues for dev tools.

Read More
Windows

Clipboard History Is a Superpower

- 28.01.26 - ErcanOPAK comment on Clipboard History Is a Superpower

Shortcut: Win + V Why it mattersRecover overwritten code, commands, passwords instantly.

Read More
AI

Emergency Household Fix Advisor

- 28.01.26 - ErcanOPAK comment on Emergency Household Fix Advisor

Prompt Act as a practical home repair expert.Give safe, temporary fixes using common household items. Why it mattersUniversal value, highly shareable.

Read More
AI

Generate SQL Index Suggestions

- 28.01.26 - ErcanOPAK comment on Generate SQL Index Suggestions

Prompt Analyze this query and suggest indexes based on read patterns and selectivity. Why it mattersTurns AI into a junior DBA.

Read More
AI

Refactor Without Changing Behavior

- 28.01.26 - ErcanOPAK comment on Refactor Without Changing Behavior

Prompt Refactor this code for readability and maintainability.Do NOT change logic, outputs, or public contracts. Why it mattersSafe refactoring assistant, not a risky code generator.

Read More
Docker

Multi-Stage Builds = Smaller Images

- 28.01.26 - ErcanOPAK comment on Multi-Stage Builds = Smaller Images

FROM mcr.microsoft.com/dotnet/sdk AS build FROM mcr.microsoft.com/dotnet/aspnet Why it mattersFinal image contains only runtime → faster deploys, fewer vulnerabilities.

Read More
Kubernetes

Use Liveness vs Readiness Correctly

- 28.01.26 - ErcanOPAK comment on Use Liveness vs Readiness Correctly

livenessProbe: httpGet: path: /health port: 80 Why it mattersWrong probes cause infinite restarts or traffic to broken pods.

Read More
Wordpress

Custom Login Error Message (Security Trick)

- 28.01.26 - ErcanOPAK comment on Custom Login Error Message (Security Trick)

add_filter(‘login_errors’, fn() => ‘Invalid credentials.’); Why it mattersPrevents username enumeration attacks.

Read More
Wordpress

Disable Emojis Without Plugins

- 28.01.26 | 28.01.26 - ErcanOPAK comment on Disable Emojis Without Plugins

remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); Why it mattersRemoves extra JS/CSS → faster first paint.

Read More
Photoshop

Convert Photos to Blog-Friendly “Flat Depth” Style

- 28.01.26 - ErcanOPAK comment on Convert Photos to Blog-Friendly “Flat Depth” Style

Steps Image → Adjustments → Shadows/Highlights Reduce highlights, slightly lift shadows Desaturate by ~10% Why it mattersImages load lighter and match modern editorial styles.

Read More
Photoshop

Fix Over-Sharpened Text in UI Screenshots

- 28.01.26 - ErcanOPAK comment on Fix Over-Sharpened Text in UI Screenshots

Steps Filter → Blur → Gaussian Blur (0.3–0.5px) Then sharpen slightly using High Pass (0.6px) Why it mattersScreenshots often look harsh on retina displays. This restores natural readability.

Read More
Visual Studio

Solution Filters for Massive Repos

- 28.01.26 - ErcanOPAK comment on Solution Filters for Massive Repos

TipUse .slnf (Solution Filter) files to load only the projects you actually need. Why it mattersLarge solutions kill startup time. Filters reduce memory usage and speed up context switching without touching the main solution.

Read More
January 2026
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Dec    

Most Viewed Posts

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

Recent Posts

  • Why foreach Is Sometimes Slower Than for
  • The Hidden Cost of Exceptions as Flow Control
  • Why lock Can Kill Throughput
  • Indexes Can Make Queries Slower (Here’s Why)
  • Why SELECT * Slowly Destroys Performance
  • The Real Cost of IHostedService Misuse
  • Why Async Controllers Still Block Threads
  • Stop Using git pull (Yes, Really)
  • Why Git Rebase “Loses” Commits (It Doesn’t — You Did)
  • Why Fetch Requests “Randomly” Hang (But Server Is Fine)

Most Viewed Posts

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

Recent Posts

  • Why foreach Is Sometimes Slower Than for
  • The Hidden Cost of Exceptions as Flow Control
  • Why lock Can Kill Throughput
  • Indexes Can Make Queries Slower (Here’s Why)
  • Why SELECT * Slowly Destroys Performance

Social

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