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

CSS

CSS: Understand Margin vs Padding for Spacing

- 04.07.26 - ErcanOPAK comment on CSS: Understand Margin vs Padding for Spacing

๐Ÿ“ Margin Outside, Padding Inside Spacing confuses beginners. Margin is outside the element. Padding is inside. Use margin for spacing elements, padding for spacing content. โ†”๏ธ Margin .box { margin: 20px; /* Space outside */ margin-top: 10px; margin-bottom: 10px; margin-left: 20px; margin-right: 20px; margin: 10px 20px; /* top/bottom, left/right */ margin: 10px 20px 30px 40px; […]

Read More
Windows

Windows 11: Configure Multiple Monitors for Productivity

- 04.07.26 - ErcanOPAK comment on Windows 11: Configure Multiple Monitors for Productivity

๐Ÿ–ฅ๏ธ Two Monitors = 2x Productivity Multiple monitors boost productivity. Display settings configure extend, duplicate, primary monitor. Maximize screen real estate. ๐Ÿ”ง Display Settings Settings โ†’ System โ†’ Display Multiple displays: – Duplicate: Same on both monitors – Extend: Desktop across monitors – Second screen only: Use external only Identify: Shows which monitor is which […]

Read More
AI

AI Prompt: Generate Social Media Content Calendar

- 04.07.26 - ErcanOPAK comment on AI Prompt: Generate Social Media Content Calendar

๐Ÿ“… Plan a Month of Content in Minutes Content planning takes hours. AI generates content calendar โ€” topics, platforms, post types, hashtags. Ready to execute. ๐Ÿ“ The Prompt Generate a 30-day social media content calendar for: Topic: [e.g., Productivity Tips for Developers] Target platforms: [Twitter, LinkedIn, Instagram, Facebook] Target audience: [e.g., Software Developers, Project Managers, […]

Read More
Docker

Docker: Use Docker Compose for Multi-Container Apps

- 04.07.26 - ErcanOPAK comment on Docker: Use Docker Compose for Multi-Container Apps

๐Ÿณ One Command, All Containers Managing containers individually is painful. Docker Compose defines and runs multi-container apps. One YAML file, one command. ๐Ÿ“ Docker Compose File version: ‘3.8’ services: web: build: . ports: – “8080:8080” environment: – DB_HOST=postgres – REDIS_HOST=redis depends_on: – postgres – redis postgres: image: postgres:15 environment: POSTGRES_PASSWORD: secret volumes: – postgres_data:/var/lib/postgresql/data redis: […]

Read More
Kubernetes

Kubernetes: Use StatefulSets for Stateful Applications

- 04.07.26 - ErcanOPAK comment on Kubernetes: Use StatefulSets for Stateful Applications
Read More
Wordpress

WordPress: Create Custom Page Templates for Unique Layouts

- 04.07.26 - ErcanOPAK comment on WordPress: Create Custom Page Templates for Unique Layouts

๐Ÿ“„ One Page, Different Layout Default page template is boring. Custom page templates create unique layouts. Landing pages, full-width, sidebar left/right. ๐Ÿ“ Creating Page Template // page-templates/landing.php <?php /* Template Name: Landing Page Description: Full-width landing page template */ get_header(); ?> <main id=”main” class=”site-main landing-page”> <?php while (have_posts()) : the_post(); the_content(); endwhile; ?> </main> <?php […]

Read More
Photoshop

Photoshop: Save and Load Presets for Consistency

- 04.07.26 - ErcanOPAK comment on Photoshop: Save and Load Presets for Consistency

๐Ÿ’พ One Click, Perfect Settings Recreating settings every time is tedious. Presets save your settings. Curves, Levels, Layer Styles โ€” reuse with one click. ๐Ÿ“ Saving Presets 1. Open adjustment layer (Curves, Levels, etc.) 2. Adjust settings 3. Click the gear icon โ†’ Save Preset 4. Name your preset 5. Click Save Or: 1. Layer […]

Read More
Visual Studio

Visual Studio: Toggle Line Comments with Ctrl + K, Ctrl + C/U

- 04.07.26 - ErcanOPAK comment on Visual Studio: Toggle Line Comments with Ctrl + K, Ctrl + C/U

๐Ÿ’ฌ Comment and Uncomment Faster Manually adding // to each line is slow. Ctrl + K, Ctrl + C comments. Ctrl + K, Ctrl + U uncomments. Essential for debugging. โŒจ๏ธ Shortcuts Ctrl + K, Ctrl + C โ†’ Comment selection Ctrl + K, Ctrl + U โ†’ Uncomment selection Ctrl + Shift + / […]

Read More
C#

C#: Use Exception Filtering to Catch Specific Exceptions

- 24.06.26 - ErcanOPAK comment on C#: Use Exception Filtering to Catch Specific Exceptions

๐ŸŽฏ Catch Only When Condition Is True Catching all exceptions can hide bugs. Exception filtering (when) catches only when conditions met. More precise error handling. โŒ Without Filter try { // code } catch (Exception ex) { // Catches everything } โœ… With Filter try { // code } catch (Exception ex) when (ex.Message.Contains(“timeout”)) { […]

Read More
C#

C#: Use Extension Methods to Extend Existing Types

- 24.06.26 - ErcanOPAK comment on C#: Use Extension Methods to Extend Existing Types

โž• Add Methods Without Changing Original Class Can’t modify string class? Extension methods add methods. Like IsValidEmail() for string. Clean, discoverable. โŒ Before string email = “test@example.com”; bool valid = IsValidEmail(email); โœ… Extension Method string email = “test@example.com”; bool valid = email.IsValidEmail(); ๐Ÿ“ Creating Extensions public static class StringExtensions { // Extend string public static […]

Read More
SQL

SQL: Understand Database Normalization (1NF, 2NF, 3NF)

- 24.06.26 - ErcanOPAK comment on SQL: Understand Database Normalization (1NF, 2NF, 3NF)

๐Ÿ“Š Normalization = Organized Data Bad design = duplicate data, anomalies. Normalization organizes data. 1NF, 2NF, 3NF โ€” reduce redundancy, improve integrity. ๐Ÿ“ First Normal Form (1NF) โŒ Not 1NF (repeating groups) Order: 1, Customer: Alice, Products: Laptop, Phone, Tablet โœ… 1NF (atomic values, separate rows) OrderID Customer Product 1 Alice Laptop 1 Alice Phone […]

Read More
Asp.Net Core

.NET Core: Use API Controllers for RESTful Services

- 24.06.26 - ErcanOPAK comment on .NET Core: Use API Controllers for RESTful Services

๐ŸŒ Build REST APIs with Controllers REST APIs need structure. API Controllers handle HTTP requests. GET, POST, PUT, DELETE โ€” clean and organized. ๐Ÿ“ Basic API Controller [ApiController] [Route(“api/[controller]”)] public class UsersController : ControllerBase { private readonly IUserService _userService; public UsersController(IUserService userService) { _userService = userService; } [HttpGet] public async Task GetUsers() { var users […]

Read More
Git

Git: Use Git Add to Stage Changes for Commit

- 24.06.26 - ErcanOPAK comment on Git: Use Git Add to Stage Changes for Commit

๐Ÿ“ฆ git add = Stage Changes Changed files need staging. git add stages changes for commit. Select what to commit, commit later. ๐Ÿ“ Git Add Commands # Stage all changes git add . # Stage specific file git add file.txt # Stage multiple files git add file1.txt file2.txt # Stage all .js files git add […]

Read More
Ajax

Ajax: Send Custom Headers with Requests

- 24.06.26 - ErcanOPAK comment on Ajax: Send Custom Headers with Requests

๐Ÿ“‹ Headers = Request Metadata API needs authentication, content type, custom data. Request headers send additional info. Essential for API integration. ๐Ÿ“ Sending Headers // Fetch with headers const response = await fetch(‘/api/data’, { headers: { ‘Content-Type’: ‘application/json’, ‘Authorization’: ‘Bearer your-token’, ‘X-API-Key’: ‘your-api-key’, ‘Accept’: ‘application/json’ } }); // With authentication const token = ‘jwt-token-here’; await […]

Read More
JavaScript

JavaScript: Use setTimeout and setInterval for Timers

- 24.06.26 - ErcanOPAK comment on JavaScript: Use setTimeout and setInterval for Timers

โฐ Timers = Delayed or Repeated Execution Need to delay execution? Run repeatedly? setTimeout and setInterval handle timing. Animations, polling, delays. ๐Ÿ“ setTimeout (Delay) // Execute after 2 seconds setTimeout(() => { console.log(‘2 seconds passed’); }, 2000); // With parameters setTimeout((name) => { console.log(`Hello ${name}`); }, 1000, ‘Alice’); // Clear timeout const timer = setTimeout(() […]

Read More
HTML

HTML: Use Tables for Tabular Data

- 24.06.26 - ErcanOPAK comment on HTML: Use Tables for Tabular Data

๐Ÿ“Š Tables = Tabular Data Tables display data in rows and columns. <table> is for tabular data, not layout. Use for reports, dashboards. ๐Ÿ“ Basic Table <table> <thead> <tr> <th>Name</th> <th>Age</th> <th>Country</th> </tr> </thead> <tbody> <tr> <td>Alice</td> <td>30</td> <td>USA</td> </tr> <tr> <td>Bob</td> <td>25</td> <td>UK</td> </tr> </tbody> <tfoot> <tr> <td>Total</td> <td>2</td> <td></td> </tr> </tfoot> </table> ๐ŸŽฏ […]

Read More
CSS

CSS: Understand Display Property โ€” Block, Inline, Flex, Grid

- 24.06.26 - ErcanOPAK comment on CSS: Understand Display Property โ€” Block, Inline, Flex, Grid

๐Ÿ“ Display = Layout Behavior display: block vs inline vs flex vs grid. Understanding display is key to CSS layouts. Choose the right one. ๐Ÿ“ Display Values /* Block: Takes full width, starts new line */ .block { display: block; width: 100%; } /* Inline: Takes only needed width, no new line */ .inline { […]

Read More
Windows

Windows 11: Use Windows Security as Your Antivirus

- 24.06.26 - ErcanOPAK comment on Windows 11: Use Windows Security as Your Antivirus

๐Ÿ›ก๏ธ No Need for Third-Party Antivirus Windows Security is built-in. Real-time protection, virus scanning, firewall. Enough for most users. No need to buy antivirus. ๐Ÿ”ง Windows Security Features Settings โ†’ Privacy & Security โ†’ Windows Security Core features: – Virus & threat protection (real-time scanning) – Account protection (Windows Hello, sign-in) – Firewall & network […]

Read More
AI

AI Prompt: Summarize Meeting Notes and Action Items

- 24.06.26 - ErcanOPAK comment on AI Prompt: Summarize Meeting Notes and Action Items

๐Ÿ“ Turn Meeting Notes into Action Plans Meeting notes are messy. AI summarizes meetings โ€” key decisions, action items, next steps. Share instantly. ๐Ÿ“ The Prompt Summarize these meeting notes: [Paste meeting notes or transcript here] Meeting type: [Daily Standup / Sprint Planning / Client Review / Team Sync] Create a summary with: 1. Meeting […]

Read More
Docker

Docker: Dockerfile Best Practices for Smaller, Faster Images

- 24.06.26 - ErcanOPAK comment on Docker: Dockerfile Best Practices for Smaller, Faster Images

๐Ÿ“ฆ Write Efficient Dockerfiles Bad Dockerfiles = large images, slow builds. Best practices reduce image size, speed up builds, improve security. โŒ Bad Dockerfile FROM node:18 WORKDIR /app COPY . . RUN npm install RUN npm run build CMD [“npm”, “start”] # 1.2GB image, slow builds โœ… Good Dockerfile FROM node:18-alpine AS builder WORKDIR /app […]

Read More
Kubernetes

Kubernetes: Use HPA to Auto-Scale Pods Based on Load

- 24.06.26 - ErcanOPAK comment on Kubernetes: Use HPA to Auto-Scale Pods Based on Load

๐Ÿ“ˆ Scale Pods Automatically Fixed replicas waste resources. HorizontalPodAutoscaler scales pods based on CPU/memory. Scale up during load, down during low traffic. ๐Ÿ“ HPA Configuration apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: myapp-hpa spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: myapp minReplicas: 2 maxReplicas: 10 metrics: – type: Resource resource: name: cpu target: type: Utilization averageUtilization: […]

Read More
Wordpress

WordPress: Use Custom Fields to Store Additional Post Data

- 24.06.26 - ErcanOPAK comment on WordPress: Use Custom Fields to Store Additional Post Data

๐Ÿ“ฆ Store Extra Data with Posts Posts need extra data. Custom fields (post meta) store additional information. Product price, event date, author bio. ๐Ÿ“ Using Custom Fields // Add custom field add_post_meta($post_id, ‘product_price’, 99.99, true); // Update custom field update_post_meta($post_id, ‘product_price’, 89.99); // Get custom field $price = get_post_meta($post_id, ‘product_price’, true); // Get all custom […]

Read More
Photoshop

Photoshop: Use Selective Color for Precise Color Grading

- 24.06.26 - ErcanOPAK comment on Photoshop: Use Selective Color for Precise Color Grading

๐ŸŽจ Cinema-Grade Color Control Adjust individual colors without affecting others. Selective Color gives cinema-grade control. Perfect for color grading. ๐Ÿ“ Using Selective Color 1. Adjustment Layer โ†’ Selective Color Colors to adjust: – Reds – Yellows – Greens – Cyans – Blues – Magentas – Whites – Neutrals – Blacks Each color has: – Cyan […]

Read More
Visual Studio

Visual Studio: Use PerfTips to See Method Execution Time

- 24.06.26 - ErcanOPAK comment on Visual Studio: Use PerfTips to See Method Execution Time

โฑ๏ธ Know How Long Your Code Takes Slow code needs profiling. PerfTips shows method execution time during debugging. Identify bottlenecks instantly. ๐Ÿ”ง Using PerfTips 1. Start debugging (F5) 2. Step through code (F10, F11) 3. PerfTips appear next to method calls 4. Shows elapsed time in milliseconds PerfTips show: – Total execution time – Time […]

Read More
C#

C#: Use Static Members for Class-Level Data

- 24.06.26 - ErcanOPAK comment on C#: Use Static Members for Class-Level Data

๐Ÿ“ฆ Static = Shared Across All Instances Instance members belong to objects. Static members belong to the class. Shared state, utility methods, global config. ๐Ÿ“˜ Instance public class Counter { public int Count { get; set; } } var c1 = new Counter(); c1.Count = 1; var c2 = new Counter(); c2.Count = 2; // […]

Read More
C#

C#: Use Encapsulation to Protect Data

- 24.06.26 - ErcanOPAK comment on C#: Use Encapsulation to Protect Data

๐Ÿ”’ Encapsulation = Hide Internal State Public fields break encapsulation. Private fields + public properties protect data. Validation, computed values, change tracking. โŒ No Encapsulation public class User { public string Name; // Direct access public int Age; // No validation } // Any code can set invalid values user.Age = -5; // Valid but […]

Read More
SQL

SQL: DELETE vs TRUNCATE โ€” Know the Difference

- 24.06.26 - ErcanOPAK comment on SQL: DELETE vs TRUNCATE โ€” Know the Difference

๐Ÿ—‘๏ธ DELETE removes rows. TRUNCATE removes all rows. Both remove data. DELETE can use WHERE, fires triggers. TRUNCATE is faster, resets identity, cannot use WHERE. ๐Ÿ“ DELETE DELETE FROM users WHERE id = 123; DELETE FROM users WHERE status = ‘inactive’; – Can use WHERE (selective) – Fires triggers – Slower (logs each row) – […]

Read More
Asp.Net Core

.NET Core: Use Identity for User Authentication

- 24.06.26 - ErcanOPAK comment on .NET Core: Use Identity for User Authentication

๐Ÿ” Identity = Built-in Authentication User login, registration, password reset. ASP.NET Core Identity handles it all. Secure, extensible, built-in. ๐Ÿ“ Setup Identity # Install packages dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore dotnet add package Microsoft.EntityFrameworkCore.SqlServer # Program.cs builder.Services.AddDbContext(options => options.UseSqlServer(connectionString)); builder.Services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); builder.Services.Configure(options => { // Password settings options.Password.RequireDigit = true; options.Password.RequiredLength = 8; options.Password.RequireNonAlphanumeric = […]

Read More
Git

Git: Use Git Init to Create a New Repository

- 24.06.26 - ErcanOPAK comment on Git: Use Git Init to Create a New Repository

๐Ÿ“‚ git init = Start Version Control New project? git init creates .git folder. Start tracking changes. Essential for any project. ๐Ÿ“ Git Init # Initialize repository git init # Initialize in specific directory git init my-project # Initialize with default branch name git init –initial-branch=main # Initialize bare repository (for server) git init –bare […]

Read More
Ajax

Ajax: Understand HTTP Status Codes

- 24.06.26 - ErcanOPAK comment on Ajax: Understand HTTP Status Codes

๐Ÿ“Š HTTP Status Codes = Server’s Response 200 OK, 404 Not Found, 500 Server Error. Status codes tell what happened. Know them for debugging. ๐Ÿ“ Status Code Groups 2xx: Success – 200 OK: Request successful – 201 Created: Resource created – 204 No Content: Success, no response body 3xx: Redirection – 301 Moved Permanently: URL […]

Read More
Page 12 of 97
ยซ Previous 1 … 7 8 9 10 11 12 13 14 15 16 17 … 97 Next ยป

Posts pagination

« Previous 1 … 10 11 12 13 14 … 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