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

Day: February 5, 2026

Windows

Windows 11 Snap Layouts: Organize 10+ Windows Without Alt+Tab Hell

- 05.02.26 - ErcanOPAK comment on Windows 11 Snap Layouts: Organize 10+ Windows Without Alt+Tab Hell

Constantly alt-tabbing between VS Code, browser, terminal, and docs? Snap Layouts organize windows into perfect grids. KEYBOARD SHORTCUTS: Win + ← : Snap window left (50%) Win + → : Snap window right (50%) Win + ↑ : Maximize window Win + ↓ : Restore/Minimize window Win + Z : Open Snap Layouts (choose from […]

Read More
Kubernetes

Kubernetes Ingress: Expose Multiple Services Through One Load Balancer

- 05.02.26 - ErcanOPAK comment on Kubernetes Ingress: Expose Multiple Services Through One Load Balancer

Paying for multiple cloud load balancers? Ingress routes traffic to different services based on hostname or path. # ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: main-ingress annotations: # NGINX Ingress Controller nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/ssl-redirect: “true” nginx.ingress.kubernetes.io/proxy-body-size: “10m” # Cert-Manager for SSL cert-manager.io/cluster-issuer: “letsencrypt-prod” spec: tls: – hosts: – api.example.com – app.example.com – admin.example.com secretName: tls-secret […]

Read More
Docker

Docker Compose: Launch Full Stack Apps with One Command (Node + Redis + Postgres)

- 05.02.26 - ErcanOPAK comment on Docker Compose: Launch Full Stack Apps with One Command (Node + Redis + Postgres)

Manually starting 5 different services for development? Docker Compose defines and runs multi-container apps. # docker-compose.yml version: ‘3.8’ services: # Node.js API api: build: ./api ports: – “3000:3000” environment: – NODE_ENV=development – REDIS_URL=redis://redis:6379 – DATABASE_URL=postgresql://user:pass@db:5432/mydb volumes: – ./api:/app – /app/node_modules depends_on: – redis – db command: npm run dev # React Frontend frontend: build: ./frontend […]

Read More
Visual Studio

Visual Studio Live Share: Real-time Collaborative Coding Like Google Docs

- 05.02.26 - ErcanOPAK comment on Visual Studio Live Share: Real-time Collaborative Coding Like Google Docs

Need to pair program with remote teammates? Live Share turns VS Code into a collaborative editor with shared debugging. # Installation # 1. Install Live Share extension in VS Code # Extensions → Search “Live Share” # Install by Microsoft # 2. Sign in with GitHub/Microsoft account # 3. Start a session # Click Live […]

Read More
Wordpress

WordPress REST API: Turn Your Site into a Headless CMS for React/Vue Apps

- 05.02.26 - ErcanOPAK comment on WordPress REST API: Turn Your Site into a Headless CMS for React/Vue Apps

Building mobile apps or SPAs that need WordPress content? REST API serves your posts as JSON for any frontend. // Fetch WordPress posts from React import React, { useState, useEffect } from ‘react’; function WordPressPosts() { const [posts, setPosts] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetchPosts(); }, []); const fetchPosts = […]

Read More
Wordpress

WordPress Custom Post Types: Build Real Estate, Job Board, or Product Catalogs

- 05.02.26 - ErcanOPAK comment on WordPress Custom Post Types: Build Real Estate, Job Board, or Product Catalogs

Trying to force blog posts to work as products or portfolios? Custom Post Types create dedicated content structures. // functions.php – Create Property Custom Post Type function register_property_post_type() { $labels = array( ‘name’ => ‘Properties’, ‘singular_name’ => ‘Property’, ‘menu_name’ => ‘Properties’, ‘add_new’ => ‘Add New Property’, ‘add_new_item’ => ‘Add New Property’, ‘edit_item’ => ‘Edit Property’, […]

Read More
Photoshop

Photoshop Batch Processing: Edit 1000 Images While You Sleep

- 05.02.26 - ErcanOPAK comment on Photoshop Batch Processing: Edit 1000 Images While You Sleep

Need to resize, watermark, and format hundreds of product photos? Actions and Batch Processing automate repetitive tasks. 1. RECORD THE ACTION – Open Actions panel (Window → Actions) – Click “Create New Action” – Name it: “Product Photo Processing” – Click Record (red button) 2. PERFORM STEPS (they get recorded) – Image → Image Size: […]

Read More
Photoshop

Photoshop Smart Objects: Edit Once, Update Everywhere Without Quality Loss

- 05.02.26 - ErcanOPAK comment on Photoshop Smart Objects: Edit Once, Update Everywhere Without Quality Loss

Updating the same logo in 50 different mockups? Smart Objects maintain quality while allowing global updates. Create Reusable Smart Objects: Step 1: Convert to Smart Object Right-click layer → “Convert to Smart Object” Or: Layer → Smart Objects → Convert to Smart Object Step 2: Edit source Double-click Smart Object thumbnail Edit in new tab […]

Read More
Windows

Windows 11 WSL2: Run Linux at Native Speed Without Dual Boot

- 05.02.26 - ErcanOPAK comment on Windows 11 WSL2: Run Linux at Native Speed Without Dual Boot

Still rebooting to switch between Windows and Linux? WSL2 gives you full Linux kernel running at native speed inside Windows 11. Complete WSL2 Setup in 5 Minutes: # 1. Enable WSL feature dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart # 2. Enable Virtual Machine Platform dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart # 3. Download and install […]

Read More
Wordpress

WordPress Speed Hack: How Lazy Loading Images Cuts Page Load Time in Half

- 05.02.26 - ErcanOPAK comment on WordPress Speed Hack: How Lazy Loading Images Cuts Page Load Time in Half

WordPress sites loading slowly due to images? Native lazy loading with modern techniques dramatically improves performance. // Add to functions.php function add_lazy_loading_attributes($content) { // Only run on frontend if (is_admin() || wp_is_json_request()) { return $content; } // Use DOMDocument for reliable parsing if (class_exists(‘DOMDocument’)) { $dom = new DOMDocument(); @$dom->loadHTML(mb_convert_encoding($content, ‘HTML-ENTITIES’, ‘UTF-8’)); $images = $dom->getElementsByTagName(‘img’); […]

Read More
Git

Git Hooks Automation: Pre-commit Checks That Save Hours of Debugging

- 05.02.26 - ErcanOPAK comment on Git Hooks Automation: Pre-commit Checks That Save Hours of Debugging

Tired of catching bugs in code review? Git hooks automatically validate code before it even reaches the repository. #!/bin/bash # .git/hooks/pre-commit # Exit immediately if any command fails set -e echo “🚀 Running pre-commit checks…” # 1. Check for debugging statements echo “🔍 Checking for console.log statements…” if git diff –cached –name-only | xargs grep […]

Read More
SQL

SQL Window Functions: Analytics Queries That Replace Hundreds of Lines of Code

- 05.02.26 - ErcanOPAK comment on SQL Window Functions: Analytics Queries That Replace Hundreds of Lines of Code

Writing complex analytical queries with self-joins and subqueries? Window functions perform calculations across rows without grouping. Common Window Function Patterns: — Basic structure SELECT column1, column2, WINDOW_FUNCTION() OVER ( PARTITION BY partition_column ORDER BY sort_column ROWS/RANGE BETWEEN frame_start AND frame_end ) AS calculated_column FROM table_name; — Available functions: — Ranking: ROW_NUMBER(), RANK(), DENSE_RANK(), NTILE() — […]

Read More
Ajax

Ajax Revolution: How Fetch API and Async/Await Replace jQuery.ajax()

- 05.02.26 - ErcanOPAK comment on Ajax Revolution: How Fetch API and Async/Await Replace jQuery.ajax()

Still using jQuery for AJAX? Modern JavaScript Fetch API with async/await is cleaner, faster, and built-in. Modern Fetch vs Old jQuery Comparison: // OLD jQuery way $.ajax({ url: ‘/api/users’, method: ‘GET’, dataType: ‘json’, success: function(data) { console.log(data); }, error: function(xhr, status, error) { console.error(error); } }); // MODERN Fetch API async function getUsers() { try […]

Read More
C#

C# Record Types: Immutable Data Patterns That Eliminate Bugs

- 05.02.26 - ErcanOPAK comment on C# Record Types: Immutable Data Patterns That Eliminate Bugs

Mutable objects causing threading issues? C# 9+ records provide immutable data structures with built-in value semantics. Records vs Classes: When to Use Each // Use RECORDS for: // 1. Immutable data transfer objects (DTOs) // 2. Value objects in domain-driven design // 3. Configuration objects // 4. API request/response models // 5. Event objects in […]

Read More
Asp.Net Core

.NET Core Middleware Magic: How to Build Pipeline Filters That Transform Your API

- 05.02.26 - ErcanOPAK comment on .NET Core Middleware Magic: How to Build Pipeline Filters That Transform Your API

Need consistent request/response handling across all endpoints? Custom middleware creates reusable pipeline components. Custom Middleware for Global Exception Handling: // GlobalExceptionMiddleware.cs public class GlobalExceptionMiddleware { private readonly RequestDelegate _next; private readonly ILogger _logger; private readonly IWebHostEnvironment _env; public GlobalExceptionMiddleware( RequestDelegate next, ILogger logger, IWebHostEnvironment env) { _next = next; _logger = logger; _env = env; […]

Read More
AI

AI Coding Assistant: ChatGPT Prompts That Generate Production-Ready Code

- 05.02.26 - ErcanOPAK comment on AI Coding Assistant: ChatGPT Prompts That Generate Production-Ready Code

Tired of AI giving you buggy code snippets? These structured prompts extract perfect, tested code from ChatGPT and Copilot. The Structure for Perfect Code Generation: ROLE: Senior [Language] Developer with 10 years experience TASK: Create [specific feature] CONSTRAINTS: [technical limitations] REQUIREMENTS: [must-have features] OUTPUT FORMAT: [code structure] TEST: [validation criteria] Example: ROLE: Senior C#/.NET Developer […]

Read More
Windows

Windows 11 Power User Secret: How PowerToys Makes You 3x More Productive

- 05.02.26 - ErcanOPAK comment on Windows 11 Power User Secret: How PowerToys Makes You 3x More Productive

Still alt-tabbing between windows like it’s 1995? Microsoft PowerToys transforms Windows 11 into a productivity powerhouse. PowerToys Awesomeness You’re Missing: # Download and install (winget) winget install Microsoft.PowerToys –source winget # Or via GitHub releases # https://github.com/microsoft/PowerToys/releases # Essential modules to enable immediately: FancyZones: Window Management on Steroids Default Windows: Drag window to edge = […]

Read More
Git

Git Rebase Magic: How to Clean Up Messy Commit History Like a Pro

- 05.02.26 - ErcanOPAK comment on Git Rebase Magic: How to Clean Up Messy Commit History Like a Pro

Your git history looking like a war zone? Interactive rebase transforms chaotic commits into a clean, logical story. The Problem: Spaghetti Commit History # Typical messy history $ git log –oneline a1b2c3d Fix typo in README e4f5g6h Update config again h7i8j9k Another attempt k0l1m2n Revert previous change n3o4p5q Merge branch ‘feature-x’ p6q7r8s WIP: trying something […]

Read More
CSS

CSS Grid Magic: How to Create Responsive Layouts That Work Perfectly on Any Device

- 05.02.26 - ErcanOPAK comment on CSS Grid Magic: How to Create Responsive Layouts That Work Perfectly on Any Device

Still struggling with float and position hacks? CSS Grid simplifies complex layouts with clean, maintainable code. The Grid vs Flexbox Decision Tree: /* When to use Grid vs Flexbox: */ /* USE GRID WHEN: */ /* 1. Two-dimensional layouts (rows AND columns) */ /* 2. You need precise control over both axes */ /* 3. […]

Read More
HTML

HTML5 Semantic Secret: How Proper Structure Can Boost SEO by 40% Without Extra Content

- 05.02.26 - ErcanOPAK comment on HTML5 Semantic Secret: How Proper Structure Can Boost SEO by 40% Without Extra Content

Writing more content but getting less traffic? Proper semantic HTML structure tells search engines exactly what your page is about. The SEO Problem with Div Soup: My Site Home About Contact Article Title Article content here… Recent Posts © 2024 Solution: Semantic HTML5 Elements My Awesome Blog Expert tips for developers Home About Contact Search […]

Read More
Asp.Net Core

.NET Core Configuration Magic: How IOptions Pattern Solves Multi-Environment Headaches

- 05.02.26 - ErcanOPAK comment on .NET Core Configuration Magic: How IOptions Pattern Solves Multi-Environment Headaches

Tired of connection strings breaking between dev/test/prod? IOptions pattern with validation ensures your app never starts with wrong config. The Configuration Nightmare: // The old way – scattered magic strings public class OrderService { private readonly string _connectionString; public OrderService(IConfiguration configuration) { _connectionString = configuration.GetConnectionString(“DefaultConnection”); // What if configuration key doesn’t exist? // What if […]

Read More
JavaScript

JavaScript Fetch API Secret: How AbortController Stops Memory Leaks in Single Page Apps

- 05.02.26 - ErcanOPAK comment on JavaScript Fetch API Secret: How AbortController Stops Memory Leaks in Single Page Apps

Single Page Applications leaking memory from unfinished fetch requests? AbortController is your solution to clean up abandoned API calls. The Memory Leak Problem: // Common React/Vue pattern causing leaks async function fetchUserData(userId) { const response = await fetch(`/api/users/${userId}`); const data = await response.json(); setUserData(data); // State update } // User clicks between tabs quickly: // […]

Read More
SQL

SQL Server Indexing Secret: How Covered Indexes Can Make Queries 100x Faster

- 05.02.26 - ErcanOPAK comment on SQL Server Indexing Secret: How Covered Indexes Can Make Queries 100x Faster

Your SQL queries running slow even with indexes? Discover how covered indexes eliminate key lookups and dramatically improve performance. The Problem: Non-Covered Index — Table structure CREATE TABLE Orders ( Id INT PRIMARY KEY, CustomerId INT, OrderDate DATETIME, TotalAmount DECIMAL(10,2), Status VARCHAR(50), ShippingAddress NVARCHAR(500), — 20 more columns… ); — Common query SELECT CustomerId, OrderDate, […]

Read More
AI

AI Prompt Engineering: How to Get Perfect Images Every Time with Midjourney

- 05.02.26 - ErcanOPAK comment on AI Prompt Engineering: How to Get Perfect Images Every Time with Midjourney

Struggling with AI image generators giving you weird results? These precise prompt templates transform random outputs into masterpiece-quality images. The Anatomy of a Perfect AI Image Prompt: [Subject] + [Detailed Description] + [Art Style] + [Artist Reference] + [Technical Parameters] BAD: “A dog in a park” GOOD: “Golden retriever puppy playing with red ball in […]

Read More
C#

C# LINQ Performance Secret: How ToQueryString() Can Reduce Database Calls by 90%

- 05.02.26 - ErcanOPAK comment on C# LINQ Performance Secret: How ToQueryString() Can Reduce Database Calls by 90%

Are your Entity Framework queries making too many database trips? Discover how IQueryable.ToString() reveals the actual SQL and helps you batch queries efficiently. The Hidden Debugging Gem: // Instead of this naive approach (multiple queries) var users = db.Users.Where(u => u.IsActive).ToList(); var orders = db.Orders.Where(o => o.UserId == userId).ToList(); var products = db.Products.Where(p => p.CategoryId […]

Read More
February 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
232425262728  
« Jan    

Most Viewed Posts

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

Recent Posts

  • C#: Use ArgumentNullException.ThrowIfNull for Cleaner Validation
  • C#: Use Discard Pattern to Ignore Unwanted Values
  • C#: Use Deconstruction with Tuples for Cleaner Multiple Returns
  • C#: Use File-Scoped Types to Limit Class Visibility
  • SQL: Use PIVOT to Transform Rows into Columns
  • SQL: Use MERGE OUTPUT to Track What Changed During Upsert
  • .NET Core: Use Polly for Resilient HTTP Requests with Retry Logic
  • .NET Core: Use Dapper for Lightweight ORM Alternative to Entity Framework
  • Git: Use git sparse-checkout to Clone Only Specific Folders
  • Git: Use git switch and git restore Instead of Confusing git checkout

Most Viewed Posts

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

Recent Posts

  • C#: Use ArgumentNullException.ThrowIfNull for Cleaner Validation
  • C#: Use Discard Pattern to Ignore Unwanted Values
  • C#: Use Deconstruction with Tuples for Cleaner Multiple Returns
  • C#: Use File-Scoped Types to Limit Class Visibility
  • SQL: Use PIVOT to Transform Rows into Columns

Social

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