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

Visual Studio

Visual Studio: Use Live Share for Real-Time Collaboration

- 07.07.26 - ErcanOPAK comment on Visual Studio: Use Live Share for Real-Time Collaboration

๐Ÿค Live Share = Real-Time Pair Programming Screen sharing is passive. Live Share is active collaboration. Multiple devs edit, debug, and navigate code together โ€” in real-time. โŒจ๏ธ Getting Started # Install Live Share – Visual Studio โ†’ Extensions โ†’ Manage Extensions – Search: “Live Share” – Download and install # OR for VS Code […]

Read More
C#

C#: Master Exception Handling for Robust Applications

- 05.07.26 - ErcanOPAK comment on C#: Master Exception Handling for Robust Applications

๐Ÿ›ก๏ธ Exception Handling = Robust Apps Apps crash without errors. Exception handling catches errors gracefully. Log, recover, inform โ€” robust applications. ๐Ÿ“ Try-Catch Basics try { // Code that might throw int result = int.Parse(input); Console.WriteLine($”Result: {result}”); } catch (FormatException ex) { // Handle format errors Console.WriteLine($”Invalid format: {ex.Message}”); } catch (OverflowException ex) { // […]

Read More
C#

C#: Use Extension Methods to Add Functionality to Types

- 05.07.26 - ErcanOPAK comment on C#: Use Extension Methods to Add Functionality to Types

๐Ÿ”Œ Extension Methods = Type Extensions Can’t modify existing types? Extension methods add functionality. Use like instance methods. Essential for building utilities. โŒ Static Methods string email = “USER@EXAMPLE.com”; email = StringHelper.ToTitleCase(email); โœ… Extension Method string email = “USER@EXAMPLE.com”; email = email.ToTitleCase(); ๐Ÿ“ Creating Extension Methods // Static class, static methods public static class StringExtensions […]

Read More
SQL

SQL: Use Window Functions for Advanced Analytics

- 05.07.26 - ErcanOPAK comment on SQL: Use Window Functions for Advanced Analytics

๐Ÿ“Š Window Functions = Advanced Analytics Aggregates are limited. Window functions analyze data without grouping. Rankings, running totals, moving averages. ๐Ÿ“ Window Function Syntax SELECT name, salary, department_id, — Window function AVG(salary) OVER (PARTITION BY department_id) as dept_avg, RANK() OVER (ORDER BY salary DESC) as salary_rank, LAG(salary, 1) OVER (ORDER BY salary) as prev_salary FROM […]

Read More
Asp.Net Core

.NET Core: Manage Configuration with AppSettings

- 05.07.26 - ErcanOPAK comment on .NET Core: Manage Configuration with AppSettings

โš™๏ธ Configuration = App Settings Hardcoding config is bad. AppSettings externalizes configuration. JSON, environment, secrets โ€” all in one. ๐Ÿ“ AppSettings.json // appsettings.json { “Logging”: { “LogLevel”: { “Default”: “Information”, “Microsoft”: “Warning”, “Microsoft.Hosting.Lifetime”: “Information” } }, “AllowedHosts”: “*”, “ConnectionStrings”: { “DefaultConnection”: “Server=localhost;Database=MyDb;User=sa;Password=MyPass123;” }, “AppSettings”: { “ApiKey”: “abc-123-xyz”, “Timeout”: 30, “RetryCount”: 3, “EnableLogging”: true, “BaseUrl”: “https://api.example.com” […]

Read More
Git

Git: Use Git Bisect to Find Bugs with Binary Search

- 05.07.26 - ErcanOPAK comment on Git: Use Git Bisect to Find Bugs with Binary Search

๐Ÿ” Git Bisect = Binary Search for Bugs Bug appeared but don’t know when? git bisect finds the exact commit. Binary search through history. Find bugs fast. ๐Ÿ“ Bisect Commands # Start bisect git bisect start # Mark current commit as bad git bisect bad # Mark known good commit git bisect good commit-hash # […]

Read More
Ajax

Ajax: Fetch vs Axios โ€” Choosing the Right HTTP Library

- 05.07.26 - ErcanOPAK comment on Ajax: Fetch vs Axios โ€” Choosing the Right HTTP Library

๐Ÿค” Fetch vs Axios: Which to Choose? Both make HTTP requests. Fetch is built-in. Axios is feature-rich. Understand differences, choose right tool. ๐Ÿ“ Fetch vs Axios Comparison // Fetch API // GET fetch(‘https://api.example.com/data’) .then(response => { if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); return response.json(); }) .then(data => console.log(data)) .catch(error => console.error(error)); // POST […]

Read More
JavaScript

JavaScript: Use Event Delegation for Efficient Events

- 05.07.26 - ErcanOPAK comment on JavaScript: Use Event Delegation for Efficient Events

๐ŸŽฏ Event Delegation = Efficient Events Many event listeners = slow. Event delegation uses one listener on parent. Efficient, dynamic, clean. โŒ Many Listeners document.querySelectorAll(‘button’) .forEach(btn => { btn.addEventListener(‘click’, handleClick); }); โœ… Event Delegation document.querySelector(‘ul’) .addEventListener(‘click’, (e) => { if (e.target.matches(‘button’)) { handleClick(e); } }); ๐Ÿ“ Delegation Examples // List items document.querySelector(‘ul’).addEventListener(‘click’, (e) => { […]

Read More
HTML

HTML: Advanced Canvas Techniques for Graphics

- 05.07.26 - ErcanOPAK comment on HTML: Advanced Canvas Techniques for Graphics

๐ŸŽจ Advanced Canvas Graphics Basic canvas is powerful. Advanced techniques โ€” animations, transforms, effects โ€” create professional graphics. ๐Ÿ“ Advanced Drawing // Gradients const gradient = ctx.createLinearGradient(x1, y1, x2, y2); gradient.addColorStop(0, ‘red’); gradient.addColorStop(0.5, ‘blue’); gradient.addColorStop(1, ‘green’); ctx.fillStyle = gradient; ctx.fillRect(0, 0, 100, 100); // Radial Gradient const radial = ctx.createRadialGradient(cx, cy, r1, cx, cy, r2); […]

Read More
CSS

CSS: Master Grid for Two-Dimensional Layouts

- 05.07.26 - ErcanOPAK comment on CSS: Master Grid for Two-Dimensional Layouts

๐Ÿ“ CSS Grid = Two-Dimensional Layouts Flexbox is one-dimensional. CSS Grid handles rows AND columns. Complex layouts made simple. โŒ Complex Flexbox Layout .container { display: flex; flex-wrap: wrap; } .item { flex: 1 0 30%; } โœ… Clean Grid Layout .container { display: grid; grid-template-columns: repeat(3, 1fr); } ๐Ÿ“ Grid Properties /* Container Properties […]

Read More
Windows

Windows 11: Master Keyboard Shortcuts to Boost Productivity

- 05.07.26 - ErcanOPAK comment on Windows 11: Master Keyboard Shortcuts to Boost Productivity

โŒจ๏ธ Shortcuts = Productivity Power Mouse is slow. Keyboard shortcuts are fast. Navigate, manage, control โ€” all from keyboard. Essential for power users. ๐Ÿ“ Essential Shortcuts # Window Management Win + Left โ†’ Snap window left Win + Right โ†’ Snap window right Win + Up โ†’ Maximize window Win + Down โ†’ Minimize window […]

Read More
AI

AI Prompt: Generate Professional Customer Support Responses

- 05.07.26 - ErcanOPAK comment on AI Prompt: Generate Professional Customer Support Responses

๐Ÿ’ฌ AI-Powered Support Responses Support replies take time. AI generates professional responses โ€” empathetic, solution-oriented, brand-aligned. ๐Ÿ“ The Prompt Generate a professional customer support response for: Company: [Your company name] Brand Tone: [e.g., Friendly, Professional, Empathetic] Customer Type: – [New user / Long-term customer / Premium customer] – [Angry / Confused / Happy] Issue Summary: […]

Read More
Docker

Docker: Use Container Logging for Debugging

- 05.07.26 - ErcanOPAK comment on Docker: Use Container Logging for Debugging

๐Ÿ“‹ Container Logs = Debugging Power Containers fail silently. Container logs reveal everything. Debug issues, monitor behavior, track problems. ๐Ÿ“ Log Commands # Show logs docker logs container_name # Follow logs (real-time) docker logs -f container_name # Last N lines docker logs –tail 100 container_name # With timestamps docker logs -t container_name # Since specific […]

Read More
Kubernetes

Kubernetes: Use Persistent Volumes for Data Persistence

- 05.07.26 - ErcanOPAK comment on Kubernetes: Use Persistent Volumes for Data Persistence

๐Ÿ’พ Persistent Data in Kubernetes Pods are ephemeral. Data disappears. Persistent Volumes store data beyond pod life. Essential for databases, files, state. ๐Ÿ“ PV and PVC # PersistentVolume (PV) apiVersion: v1 kind: PersistentVolume metadata: name: postgres-pv spec: capacity: storage: 10Gi volumeMode: Filesystem accessModes: – ReadWriteOnce persistentVolumeReclaimPolicy: Retain hostPath: path: /data/postgres # PersistentVolumeClaim (PVC) apiVersion: v1 […]

Read More
Wordpress

WordPress: Use Custom Fields for Extra Data Storage

- 05.07.26 - ErcanOPAK comment on WordPress: Use Custom Fields for Extra Data Storage

๐Ÿ“ฆ Store Extra Data with Custom Fields Posts have limited fields. Custom fields store additional data. Any data, any type โ€” extend WordPress power. ๐Ÿ“ Using Custom Fields # Add custom field (meta box) // In functions.php function add_custom_fields() { add_meta_box( ‘product_details’, ‘Product Details’, ‘display_product_fields’, ‘product’, ‘normal’, ‘high’ ); } add_action(‘add_meta_boxes’, ‘add_custom_fields’); function display_product_fields($post) { […]

Read More
Photoshop

Photoshop: Master Masks for Non-Destructive Selections

- 05.07.26 - ErcanOPAK comment on Photoshop: Master Masks for Non-Destructive Selections

๐ŸŽญ Masks = Non-Destructive Selections Delete pixels permanently? No! Masks hide and show without destroying. Edit anytime, refine forever. ๐Ÿ“ Mask Types 1. Layer Mask – White shows, Black hides – Paint with white to reveal – Paint with black to hide – Gray = partial transparency 2. Vector Mask – Uses paths instead of […]

Read More
Visual Studio

Visual Studio: Use Refactoring Tools to Improve Code Quality

- 05.07.26 - ErcanOPAK comment on Visual Studio: Use Refactoring Tools to Improve Code Quality

๐Ÿ”ง Refactoring = Better Code Without Breaking Messy code is hard to maintain. Refactoring tools improve structure without changing behavior. Clean, maintainable, professional. โŒจ๏ธ Essential Refactoring Shortcuts Ctrl + R, Ctrl + R โ†’ Rename (variables, methods, classes) Ctrl + . โ†’ Quick Actions and Refactorings Ctrl + R, Ctrl + M โ†’ Extract Method […]

Read More
C#

C#: Use Null-Coalescing Operator for Null Safety

- 05.07.26 - ErcanOPAK comment on C#: Use Null-Coalescing Operator for Null Safety

๐Ÿ›ก๏ธ Null Safety Made Easy Null checks are verbose. Null-coalescing operators handle null elegantly. Provide defaults, chain checks, safe navigation. โŒ Verbose Null Checks string name; if (user != null && user.Name != null) name = user.Name; else name = “Unknown”; โœ… Null-Coalescing string name = user?.Name ?? “Unknown”; ๐Ÿ“ Null Operators // Null-coalescing (??) […]

Read More
C#

C#: Use String Interpolation for Clean Formatting

- 05.07.26 - ErcanOPAK comment on C#: Use String Interpolation for Clean Formatting

๐Ÿ“ String Interpolation = Clean Formatting String concatenation is messy. String interpolation embeds expressions directly. Readable, concise, elegant. โŒ Concatenation string msg = “Hello, ” + name + “. You are ” + age + ” years old. Today is ” + date.ToShortDateString(); โœ… Interpolation string msg = $”Hello, {name}. You are {age} years old. […]

Read More
SQL

SQL: Use Subqueries for Complex Data Retrieval

- 05.07.26 - ErcanOPAK comment on SQL: Use Subqueries for Complex Data Retrieval

๐Ÿ“Š Subqueries = Nested Power Single queries are limited. Subqueries nest queries inside queries. Complex conditions, derived data, advanced filtering. ๐Ÿ“ Subquery Examples — Users with orders over $100 SELECT name, email FROM users WHERE id IN ( SELECT user_id FROM orders WHERE total > 100 ); — Users with no orders SELECT name, email […]

Read More
Asp.Net Core

.NET Core: Use Middleware to Handle HTTP Requests

- 05.07.26 - ErcanOPAK comment on .NET Core: Use Middleware to Handle HTTP Requests

๐Ÿ”— Middleware = Request Pipeline Each request goes through pipeline. Middleware processes requests and responses. Logging, auth, error handling โ€” all in pipeline. ๐Ÿ“ Basic Middleware // Program.cs var app = builder.Build(); // Built-in middleware app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); // Custom middleware (lambda) app.Use(async (context, next) => { Console.WriteLine($”Request: {context.Request.Method} {context.Request.Path}”); await next(); Console.WriteLine($”Response: […]

Read More
Git

Git: Use Cherry-pick to Select Specific Commits

- 05.07.26 - ErcanOPAK comment on Git: Use Cherry-pick to Select Specific Commits

๐Ÿ’ Cherry-pick = Selective Commits Don’t need all commits? git cherry-pick applies specific commits. Choose what to bring, leave the rest. ๐Ÿ“ Cherry-pick Commands # Cherry-pick a single commit git cherry-pick commit-hash # Cherry-pick multiple commits git cherry-pick hash1 hash2 hash3 # Cherry-pick range of commits git cherry-pick hash1..hash5 # From hash1 to hash5 git […]

Read More
Ajax

Ajax: Understand JSON for Data Exchange

- 05.07.26 - ErcanOPAK comment on Ajax: Understand JSON for Data Exchange

๐Ÿ“‹ JSON = Universal Data Format XML is heavy. JSON is lightweight. Human-readable, machine-parsable. Universal data exchange. โŒ XML (Heavy) <user> <name>Alice</name> <age>30</age> <email>alice@example.com</email> </user> โœ… JSON (Lightweight) { “name”: “Alice”, “age”: 30, “email”: “alice@example.com” } ๐Ÿ“ JSON Data Types { // String “name”: “John Doe”, // Number “age”: 30, “price”: 99.99, // Boolean “isActive”: […]

Read More
JavaScript

JavaScript: Use Promises for Better Async Handling

- 05.07.26 - ErcanOPAK comment on JavaScript: Use Promises for Better Async Handling

๐Ÿค Promises = Better Async Callback hell is ugly. Promises make async code elegant. Chain, catch, await โ€” async made easy. โŒ Callback Hell getUser(function(user) { getOrders(user, function(orders) { getDetails(orders, function(details) { console.log(details); }); }); }); โœ… Promise Chain getUser() .then(user => getOrders(user)) .then(orders => getDetails(orders)) .then(details => console.log(details)) .catch(err => console.error(err)); ๐Ÿ“ Promise Methods […]

Read More
HTML

HTML: Create Interactive Forms for User Input

- 05.07.26 - ErcanOPAK comment on HTML: Create Interactive Forms for User Input

๐Ÿ“ Forms = User Input Web apps need user input. HTML forms collect data. Text, choices, files โ€” all in one form. ๐Ÿ“ Form Elements <form action=”/submit” method=”POST”> <!– Text input –> <label for=”name”>Name:</label> <input type=”text” id=”name” name=”name” placeholder=”Enter name” required> <!– Email input –> <label for=”email”>Email:</label> <input type=”email” id=”email” name=”email” placeholder=”email@example.com”> <!– Password input […]

Read More
CSS

CSS: Master Flexbox for Modern Layouts

- 05.07.26 - ErcanOPAK comment on CSS: Master Flexbox for Modern Layouts

๐Ÿ“ Flexbox = One-Dimensional Layouts Floats are dead. Flexbox is modern. Align, distribute, order โ€” all with CSS. Essential for responsive design. โŒ Float Layout .container { overflow: hidden; } .item { float: left; width: 33.33%; padding: 10px; } โœ… Flexbox Layout .container { display: flex; flex-wrap: wrap; } .item { flex: 1 0 33.33%; […]

Read More
Windows

Windows 11: Use Virtual Desktops for Better Organization

- 05.07.26 - ErcanOPAK comment on Windows 11: Use Virtual Desktops for Better Organization

๐Ÿ–ฅ๏ธ Multiple Desktops = Better Organization One desktop is messy. Virtual desktops separate workspaces. Work, personal, projects โ€” all organized. โŒจ๏ธ Virtual Desktop Shortcuts Win + Tab โ†’ Task View (all desktops) Win + Ctrl + D โ†’ Create new desktop Win + Ctrl + Left โ†’ Switch to desktop on left Win + Ctrl […]

Read More
AI

AI Prompt: Generate Email Marketing Campaign

- 05.07.26 - ErcanOPAK comment on AI Prompt: Generate Email Marketing Campaign

๐Ÿ“ง AI-Powered Email Campaigns Email marketing needs strategy. AI generates email campaigns โ€” sequences, copy, subject lines. Convert subscribers to customers. ๐Ÿ“ The Prompt Generate a 7-email welcome sequence for: Product/Service: [Your product] Target Audience: [e.g., small business owners] Pain Points: [What problems do they have?] Goal: [e.g., free trial signup โ†’ paid conversion] Email […]

Read More
Docker

Docker: Optimize Images with Dockerfile Best Practices

- 05.07.26 - ErcanOPAK comment on Docker: Optimize Images with Dockerfile Best Practices

๐Ÿ“ฆ Build Efficient Docker Images Large images = slow deploys. Optimized Dockerfiles create small, fast, secure images. Best practices for production. โŒ Unoptimized FROM ubuntu:latest RUN apt-get update RUN apt-get install -y python3 RUN apt-get install -y python3-pip COPY . . RUN pip install -r requirements.txt CMD python3 app.py โœ… Optimized FROM python:3.11-slim WORKDIR /app […]

Read More
Kubernetes

Kubernetes: Use ConfigMaps for Configuration Management

- 05.07.26 - ErcanOPAK comment on Kubernetes: Use ConfigMaps for Configuration Management

โš™๏ธ Centralized Configuration Hardcoding config is bad. ConfigMaps externalize configuration. Change settings without rebuilding. ๐Ÿ“ Creating ConfigMaps # From literal values kubectl create configmap app-config \ –from-literal=env=production \ –from-literal=log-level=debug \ –from-literal=api-url=https://api.example.com # From file kubectl create configmap app-config \ –from-file=./configs/app.properties \ –from-file=./configs/log4j.properties # From directory kubectl create configmap app-config \ –from-file=./configs/ # From YAML apiVersion: […]

Read More
Page 9 of 97
ยซ Previous 1 … 4 5 6 7 8 9 10 11 12 13 14 … 97 Next ยป

Posts pagination

« Previous 1 … 7 8 9 10 11 … 97 Next »
July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Jun    

Most Viewed Posts

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

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes
  • Ajax: Use Axios for HTTP Requests
  • JavaScript: Understand Hoisting
  • HTML: Use Web Storage for Client-Side Data
  • CSS: Use Filter Effects for Visual Magic
  • Windows 11: Unlock God Mode for All Settings

Most Viewed Posts

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

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes

Social

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