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

Docker

Why Docker Containers Get Slower Over Time (Even Without Traffic)

- 29.01.26 - ErcanOPAK comment on Why Docker Containers Get Slower Over Time (Even Without Traffic)

A container runs fine at first… then slowly degrades. No spikes. No crashes. Just silent slowness. Root cause Layered filesystem (OverlayFS) grows Log files inside containers never rotate Memory fragmentation inside long-lived containers Golden rule Containers are not VMs. They are disposable. Fix Never log to disk inside containers Use external logging drivers Restart containers […]

Read More
Kubernetes

Why Pods Restart Without Errors (OOMKilled Isn’t Always Logged)

- 29.01.26 - ErcanOPAK comment on Why Pods Restart Without Errors (OOMKilled Isn’t Always Logged)

Pods restart, logs look clean. Hidden reason Memory limit hit → kernel kills container → no app log. Check kubectl describe pod <pod-name> Look for: Reason: OOMKilled Fix Increase memory or fix memory leak — don’t just scale blindly.

Read More
Wordpress

Why wp-cron Breaks Under Traffic (And How to Fix It)

- 29.01.26 - ErcanOPAK comment on Why wp-cron Breaks Under Traffic (And How to Fix It)

wp-cron.php is not real cron. Problem High traffic = cron spamLow traffic = cron never runs Correct setup Disable wp-cron Use real server cron define(‘DISABLE_WP_CRON’, true); Then schedule: */5 * * * * curl https://example.com/wp-cron.php  

Read More
Wordpress

Fix Random Logouts Caused by Cookie Domain Mismatch

- 29.01.26 | 29.01.26 - ErcanOPAK comment on Fix Random Logouts Caused by Cookie Domain Mismatch

Users get logged out randomly. No errors. Nightmare. Root cause WP_HOME, WP_SITEURL, and cookie domain mismatch (especially behind proxies or Cloudflare). Permanent fix define(‘WP_HOME’, ‘https://example.com’); define(‘WP_SITEURL’, ‘https://example.com’); define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’]); This stabilizes sessions instantly.

Read More
Photoshop

Reduce File Size Without Losing Quality (The Right Way)

- 29.01.26 - ErcanOPAK comment on Reduce File Size Without Losing Quality (The Right Way)

“Save for Web” is not the best option for modern workflows. Correct approach Convert to Smart Objects Use Camera Raw Filter Reduce noise before export Export as PNG-24 or WebP, not JPG when transparency exists Result: 30–60% smaller files, same visual quality.

Read More
Photoshop

Recover a Corrupted PSD That Refuses to Open

- 29.01.26 - ErcanOPAK comment on Recover a Corrupted PSD That Refuses to Open

Photoshop crashes → PSD won’t open → panic. Why it works Photoshop writes recovery data in temp folders even when the main file is broken. Fix Copy the PSD Change .psd → .zip Extract and look for compositeImage or layerData Rebuild layers manually if needed This trick saves hours of lost design work.

Read More
Visual Studio

Stop Visual Studio From Silently Using the Wrong Build Configuration

- 29.01.26 - ErcanOPAK comment on Stop Visual Studio From Silently Using the Wrong Build Configuration

One of the most dangerous Visual Studio behaviors is building and running with a different configuration than you think.You debug Debug, but the app actually runs Release — or worse, a cached build. Why this happens Multiple startup profiles IIS Express vs Kestrel mismatch Configuration Manager not synced across projects Life-saving fix Open Configuration Manager […]

Read More
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
Page 27 of 69
« Previous 1 … 22 23 24 25 26 27 28 29 30 31 32 … 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 (858)
  • 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 (448)

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 (858)
  • 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