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

AI

AI — Temperature Controls Creativity vs Accuracy

- 29.12.25 - ErcanOPAK comment on AI — Temperature Controls Creativity vs Accuracy

High temperature ≠ better answers. ✅ Rule Low → factual High → creative

Read More
AI

AI — Prompt Length Affects Model Reasoning Quality

- 29.12.25 - ErcanOPAK comment on AI — Prompt Length Affects Model Reasoning Quality

Too long = diluted intent. ✅ Tip Use structured prompts, not massive text dumps.

Read More
Visual Studio

Visual Studio — IntelliSense Uses Different Compiler

- 29.12.25 - ErcanOPAK comment on Visual Studio — IntelliSense Uses Different Compiler

Code builds but IntelliSense errors appear. 🧠 Reason Different language service pipeline. ✅ Fix Restart language service or clear .vs folder.

Read More
Wordpress

WordPress — Heartbeat API Triggers Admin CPU Spikes

- 29.12.25 - ErcanOPAK comment on WordPress — Heartbeat API Triggers Admin CPU Spikes

Runs every 15 seconds by default. ✅ Fix Throttle or disable outside editor pages.

Read More
Windows

Windows 11 — Clipboard History Can Leak Sensitive Data

- 29.12.25 - ErcanOPAK comment on Windows 11 — Clipboard History Can Leak Sensitive Data

Passwords copied once… stay forever. ✅ Fix Disable clipboard history or clear frequently.

Read More
Windows

Windows 11 — Core Isolation Slows Virtualization

- 29.12.25 - ErcanOPAK comment on Windows 11 — Core Isolation Slows Virtualization

Memory integrity adds overhead. ✅ Tip Disable on dev machines if not required.

Read More
Ajax / JavaScript

AJAX — 204 Responses Break JSON Parsing

- 29.12.25 - ErcanOPAK comment on AJAX — 204 Responses Break JSON Parsing

204 No Content has no body. ❌ Crash response.json() ✅ Fix Check status before parsing.

Read More
JavaScript

JavaScript — Object.freeze() Is Shallow

- 29.12.25 - ErcanOPAK comment on JavaScript — Object.freeze() Is Shallow

Nested objects remain mutable. ✅ Fix Use deep-freeze utilities if immutability matters.

Read More
HTML

HTML5 —

- 29.12.25 - ErcanOPAK comment on HTML5 —

Default behavior surprises many. ✅ Fix Always set: <button type=”button”>  

Read More
CSS

CSS — gap Works for Flexbox (Not Just Grid!)

- 29.12.25 - ErcanOPAK comment on CSS — gap Works for Flexbox (Not Just Grid!)

Many devs still use margins. display: flex; gap: 12px; Cleaner, safer layouts.

Read More
Asp.Net Core

.NET Core — ProblemDetails Improves API Debugging

- 29.12.25 - ErcanOPAK comment on .NET Core — ProblemDetails Improves API Debugging

Standardized error responses save hours. ✅ Benefit Consistent client handling Better logging

Read More
Asp.Net Core

.NET Core — Middleware Exceptions Bypass Filters

- 29.12.25 - ErcanOPAK comment on .NET Core — Middleware Exceptions Bypass Filters

Exceptions thrown in middleware skip MVC filters. ✅ Fix Handle critical errors inside middleware itself.

Read More
Development / SQL

SQL — ORDER BY Without Index Causes TempDB Spikes

- 29.12.25 - ErcanOPAK comment on SQL — ORDER BY Without Index Causes TempDB Spikes

Large sorts spill to TempDB. ✅ Fix Create supporting indexes for ORDER BY columns.

Read More
SQL

SQL — ISNULL() Can Break Index Usage

- 29.12.25 - ErcanOPAK comment on SQL — ISNULL() Can Break Index Usage

WHERE ISNULL(Deleted, 0) = 0 ❌ Effect Index seek becomes scan. ✅ Fix Rewrite conditions without functions.

Read More
C#

C# — List.ForEach() Is Slower Than foreach

- 29.12.25 - ErcanOPAK comment on C# — List.ForEach() Is Slower Than foreach

It allocates a delegate and blocks break/continue. ✅ Prefer foreach (var item in list) { }  

Read More
C#

C# — DateTimeKind.Unspecified Breaks Serialization

- 29.12.25 - ErcanOPAK comment on C# — DateTimeKind.Unspecified Breaks Serialization

Unspecified kind leads to wrong conversions. ✅ Rule Always specify: DateTime.SpecifyKind(date, DateTimeKind.Utc)  

Read More
C#

C# — record Types Can Accidentally Leak Data

- 29.12.25 - ErcanOPAK comment on C# — record Types Can Accidentally Leak Data

record auto-generates ToString(). public record User(string Email, string Password); ❌ Risk Sensitive data may appear in logs. ✅ Fix Override ToString() or avoid records for secrets.

Read More
Git

The Time Machine: git reflog

- 29.12.25 - ErcanOPAK comment on The Time Machine: git reflog

The Problem: You did a git reset –hard and accidentally deleted code you actually needed. You think it’s gone forever. The Fix: Run git reflog. Git keeps a log of every movement of the HEAD, even commits you deleted. Find the ID of the state before you messed up and run git reset –hard <ID>. […]

Read More
Photoshop

Generative Fill is Magic

- 29.12.25 | 29.12.25 - ErcanOPAK comment on Generative Fill is Magic

The Problem: You have a photo that is cropped too tightly, and you need to extend the background, but cloning is tedious. The Fix: Increase the canvas size, select the empty area with the Marquee tool, and click Generative Fill (leave the prompt empty). AI will invent the rest of the background perfectly matching the […]

Read More
AI

AI – Chain of Thought Prompting

- 29.12.25 | 29.12.25 - ErcanOPAK comment on AI – Chain of Thought Prompting

The Problem: You are asking AI a complex coding architecture question, but getting generic or wrong answers. The Fix: Ask the AI to “Think step by step” or “Outline your reasoning before writing the code.” This forces the model to logically structure its answer, resulting in much higher quality code generation.

Read More
AI

Generate Unit Tests with AI

- 29.12.25 | 29.12.25 - ErcanOPAK comment on Generate Unit Tests with AI

The Problem: You wrote the logic, but writing 10 different unit tests for edge cases is boring and time-consuming. The Fix: Highlight your function and ask your AI assistant: “Write xUnit tests for this method covering null inputs, empty strings, and happy paths.” It does 90% of the boilerplate work for you.

Read More
AI

AI – The “Explain Like I’m 5” Regex Trick

- 29.12.25 | 29.12.25 - ErcanOPAK comment on AI – The “Explain Like I’m 5” Regex Trick

The Problem: You found a complex Regex pattern online, but you don’t know if it’s safe or exactly what it does. The Fix: Paste the regex into ChatGPT or Copilot with the prompt: “Explain this regex to me step-by-step.” It breaks down every symbol, ensuring you don’t introduce a vulnerability.

Read More
Visual Studio

Multi-Line Editing

- 29.12.25 - ErcanOPAK comment on Multi-Line Editing

The Problem: You need to change public string to public int on 20 different lines. The Fix: Hold Alt and drag your mouse cursor vertically (or Shift + Alt + Down Arrow). You can now type on multiple lines simultaneously.

Read More
Wordpress

The White Screen of Death Fix (WP_DEBUG)

- 29.12.25 - ErcanOPAK comment on The White Screen of Death Fix (WP_DEBUG)

The Problem: Your WordPress site is showing a blank white screen, and you have no idea which plugin caused it. The Fix: Open your wp-config.php file via FTP and change the debug settings to log the error to a file instead of crashing silently. define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_LOG’, true ); define( ‘WP_DEBUG_DISPLAY’, false […]

Read More
Windows

Extract Text from Anywhere (Snipping Tool)

- 29.12.25 - ErcanOPAK comment on Extract Text from Anywhere (Snipping Tool)

The Problem: You have an image or a PDF where you can’t select the text, but you need to copy it. The Fix: Use the Snipping Tool (Win + Shift + S). Take a screenshot, open it, and click the “Text Actions” button. It uses AI to extract all text so you can copy it […]

Read More
Windows

Clipboard History (Win + V)

- 29.12.25 - ErcanOPAK comment on Clipboard History (Win + V)

The Problem: You copied a snippet, then accidentally copied something else, losing the original snippet forever. The Fix: Turn on Clipboard History. Press Win + V instead of Ctrl + V. You can see and paste the last 25 items you copied (text or images).

Read More
Ajax / JavaScript

Modern Fetch with Async/Await

- 29.12.25 - ErcanOPAK comment on Modern Fetch with Async/Await

The Problem: You are stuck in “Callback Hell” or complex Promise chains using old XHR or jQuery. The Fix: Use modern fetch inside an async function. It reads like synchronous code. async function getData() { try { const response = await fetch(‘https://api.example.com/data’); const data = await response.json(); console.log(data); } catch (error) { console.error(‘Fetch failed:’, error); […]

Read More
JavaScript

Optional Chaining (?.)

- 29.12.25 - ErcanOPAK comment on Optional Chaining (?.)

The Problem: Your console is full of “Uncaught TypeError: Cannot read property ‘x’ of undefined” because an API response was missing data. The Fix: Use ?. to safely access nested properties. It short-circuits to undefined instead of crashing. // Old risky way const street = user && user.address && user.address.street; // Life-saver way const street […]

Read More
HTML

Native Modals with

- 29.12.25 - ErcanOPAK comment on Native Modals with

The Problem: You are importing a massive JavaScript library just to show a simple popup modal. The Fix: HTML5 now has a native <dialog> element with built-in accessibility and backdrop support. <dialog id=”myDialog”> <p>This is a native modal!</p> <button onclick=”document.getElementById(‘myDialog’).close()”>Close</button> </dialog> <button onclick=”document.getElementById(‘myDialog’).showModal()”>Open Modal</button>  

Read More
CSS

The aspect-ratio property

- 29.12.25 | 29.12.25 - ErcanOPAK comment on The aspect-ratio property

The Problem: Images or video embeds cause “Layout Shift” (jumping content) while loading because the browser doesn’t know their height yet. The Fix: Use aspect-ratio. No need for the old “padding-bottom percentage” hack. .card-image { width: 100%; aspect-ratio: 16 / 9; /* Automatically reserves the space */ object-fit: cover; }  

Read More
Page 49 of 69
« Previous 1 … 44 45 46 47 48 49 50 51 52 53 54 … 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 (753)
  • 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 (447)

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 (753)

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