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

JavaScript

JavaScript: Master the this Keyword

- 09.07.26 - ErcanOPAK comment on JavaScript: Master the this Keyword

๐ŸŽฏ Master the this Keyword this is confusing. Understanding this is essential. Context, binding, arrow functions โ€” master it. ๐Ÿ“ this in Different Contexts // Global context console.log(this); // Window (browser) // Function context function showThis() { console.log(this); // Window (strict: undefined) } // Object method const obj = { name: ‘Alice’, greet: function() { […]

Read More
HTML

HTML: Master Meta Tags for SEO and Social Sharing

- 09.07.26 - ErcanOPAK comment on HTML: Master Meta Tags for SEO and Social Sharing

๐Ÿ“‹ Meta Tags = SEO & Social Pages need SEO. Meta tags boost SEO and social sharing. Better ranking, better previews. ๐Ÿ“ Essential Meta Tags <head> <!– Character Encoding –> <meta charset=”UTF-8″> <!– Viewport –> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″> <!– Title (max 60 chars) –> <title>Page Title – Site Name</title> <!– Description (max 160 chars) […]

Read More
CSS

CSS: Use Custom Properties for Maintainable Styles

- 09.07.26 - ErcanOPAK comment on CSS: Use Custom Properties for Maintainable Styles

๐ŸŽจ CSS Variables = Maintainable Styles Hardcoded colors are bad. CSS variables centralize values. Change once, update everywhere. ๐Ÿ“ CSS Variables Basics /* Define variables */ :root { –primary-color: #3498db; –secondary-color: #2ecc71; –text-color: #333; –spacing: 16px; –border-radius: 4px; –font-size: 16px; } /* Use variables */ .button { background: var(–primary-color); color: white; padding: var(–spacing); border-radius: var(–border-radius); […]

Read More
Windows

Windows 11: Automate Tasks with Task Scheduler

- 09.07.26 - ErcanOPAK comment on Windows 11: Automate Tasks with Task Scheduler

โฐ Task Scheduler = Automation Manual tasks are repetitive. Task Scheduler automates them. Run scripts, backups, maintenance โ€” automatically. ๐Ÿ“ Task Scheduler Basics # Open Task Scheduler – Search: “Task Scheduler” – control schedtasks – taskschd.msc # Create Task 1. Action โ†’ Create Basic Task 2. Name and Description 3. Trigger (When to run) 4. […]

Read More
AI

AI Prompt: Generate Blog Post Outlines

- 09.07.26 - ErcanOPAK comment on AI Prompt: Generate Blog Post Outlines

๐Ÿ“ Blog Outlines with AI Staring at blank page? AI generates blog outlines โ€” structure, topics, research points. Start writing fast. ๐Ÿ“ The Prompt Generate a detailed blog post outline for: Topic: [Your topic] Target Audience: [e.g., beginners, professionals] Goal: [e.g., educate, persuade, entertain] Style: [e.g., tutorial, listicle, guide] Word Count: [e.g., 1500-2000 words] Provide: […]

Read More
Docker

Docker: Master Container Networking

- 09.07.26 - ErcanOPAK comment on Docker: Master Container Networking

๐ŸŒ Docker Networking = Container Communication Containers need to communicate. Docker networks connect containers. Bridge, host, overlay โ€” choose right network. ๐Ÿ“ Network Types # Bridge (default) docker network create my-bridge docker run –network my-bridge app # Host (use host network) docker run –network host app # None (isolated) docker run –network none app # […]

Read More
Kubernetes

Kubernetes: Set Resource Limits for Stability

- 09.07.26 - ErcanOPAK comment on Kubernetes: Set Resource Limits for Stability

โš–๏ธ Resource Limits = Stability Pods can consume all resources. Resource limits ensure stability. CPU, memory โ€” protect your cluster. ๐Ÿ“ Setting Limits apiVersion: v1 kind: Pod metadata: name: myapp spec: containers: – name: app image: myapp:latest resources: requests: memory: “64Mi” cpu: “250m” limits: memory: “128Mi” cpu: “500m” # Requests: Minimum guaranteed # Limits: Maximum […]

Read More
Wordpress

WordPress: Optimize Database for Speed

- 09.07.26 - ErcanOPAK comment on WordPress: Optimize Database for Speed

๐Ÿ—„๏ธ Database Optimization = Speed Slow database = slow site. Database optimization speeds up WordPress. Clean, optimize, maintain. ๐Ÿ“ Database Maintenance # phpMyAdmin 1. Select WordPress database 2. Check all tables 3. Optimize table # Command Line (WP-CLI) wp db optimize wp db repair wp db check # Remove Revisions — Limit revisions define(‘WP_POST_REVISIONS’, 3); […]

Read More
Photoshop

Photoshop: Understand Color Modes for Perfect Output

- 09.07.26 - ErcanOPAK comment on Photoshop: Understand Color Modes for Perfect Output

๐ŸŽจ Color Modes = Perfect Colors Wrong color mode ruins prints. RGB, CMYK, LAB โ€” choose the right mode. Perfect color every time. ๐Ÿ“ Color Modes # RGB (Red, Green, Blue) – For screens (web, mobile, monitors) – Additive color (light) – 16.7 million colors – Best for digital work # CMYK (Cyan, Magenta, Yellow, […]

Read More
Visual Studio

Visual Studio: Use Code Snippets to Write Code Faster

- 09.07.26 - ErcanOPAK comment on Visual Studio: Use Code Snippets to Write Code Faster

โšก Code Snippets = Faster Coding Repetitive code is boring. Code Snippets generate code instantly. Type shortcut, press Tab, done. โŒจ๏ธ Essential Snippets C# Snippets: ctor โ†’ Constructor prop โ†’ Auto-property propfull โ†’ Full property with backing field propdp โ†’ Dependency property for โ†’ For loop foreach โ†’ Foreach loop while โ†’ While loop try […]

Read More
C#

C#: Use Native AOT for High-Performance Apps

- 09.07.26 - ErcanOPAK comment on C#: Use Native AOT for High-Performance Apps

๐Ÿš€ Native AOT = Ultra Performance JIT compilation has overhead. Native AOT compiles ahead-of-time. Fast startup, low memory, native performance. ๐Ÿ“ AOT Setup # Project file <Project Sdk=”Microsoft.NET.Sdk”> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net8.0</TargetFramework> <PublishAot>true</PublishAot> <TrimMode>full</TrimMode> <EnableAotAnalyzer>true</EnableAotAnalyzer> </PropertyGroup> </Project> # Publish with AOT dotnet publish -c Release -r win-x64 –self-contained # Or dotnet publish -c Release -r linux-x64 […]

Read More
C#

C#: Use Source Generators for Code Generation

- 09.07.26 - ErcanOPAK comment on C#: Use Source Generators for Code Generation

โšก Source Generators = Code Generation Boilerplate code is tedious. Source Generators generate code at compile time. Efficiency, consistency, performance. ๐Ÿ“ Source Generator Setup // Create generator project dotnet new console -n MyGenerator cd MyGenerator dotnet add package Microsoft.CodeAnalysis.CSharp dotnet add package Microsoft.CodeAnalysis.Analyzers // Generator class using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Text; using System.Text; [Generator] […]

Read More
SQL

SQL: Master Query Optimization for Performance

- 09.07.26 - ErcanOPAK comment on SQL: Master Query Optimization for Performance

โšก Query Optimization = Database Performance Slow queries kill performance. Query optimization speeds up database. Faster responses, better UX. ๐Ÿ“ Optimization Techniques # 1. Avoid SELECT * — Bad SELECT * FROM users; — Good SELECT id, name, email FROM users; # 2. Use WHERE conditions — Bad SELECT * FROM users; — Good SELECT […]

Read More
Asp.Net Core

.NET Core: Build Lightweight APIs with Minimal APIs

- 09.07.26 - ErcanOPAK comment on .NET Core: Build Lightweight APIs with Minimal APIs

โšก Minimal APIs = Lightweight Endpoints Controllers are heavy. Minimal APIs are lightweight. Single-file APIs, faster development, microservices. ๐Ÿ“ Minimal API Setup // Program.cs (Minimal API) var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); // Basic endpoints app.MapGet(“/”, () => “Hello World!”); app.MapGet(“/users”, () => new[] { new { Id = 1, Name = “Alice” […]

Read More
Git

Git: Use Git LFS for Large File Storage

- 09.07.26 - ErcanOPAK comment on Git: Use Git LFS for Large File Storage

๐Ÿ“ Git LFS = Large File Storage Git repos get bloated. Git LFS stores large files efficiently. Images, videos, binaries โ€” keep repo fast. ๐Ÿ“ Git LFS Setup # Install Git LFS # macOS brew install git-lfs # Linux sudo apt install git-lfs # Windows # Download from https://git-lfs.github.com # Initialize LFS git lfs install […]

Read More
Ajax

Ajax: Use Server-Sent Events for One-Way Real-Time

- 09.07.26 - ErcanOPAK comment on Ajax: Use Server-Sent Events for One-Way Real-Time

๐Ÿ“ก Server-Sent Events = One-Way Real-Time WebSockets are bidirectional. SSE is one-way. Real-time updates, notifications, live feeds โ€” simpler than WebSockets. ๐Ÿ“ SSE Basics // Client-side const eventSource = new EventSource(‘/api/events’); // Listen for messages eventSource.onmessage = function(event) { console.log(‘Message:’, event.data); const data = JSON.parse(event.data); updateUI(data); }; // Handle specific event types eventSource.addEventListener(‘user-joined’, function(event) { […]

Read More
JavaScript

JavaScript: Use Proxy for Object Interception

- 09.07.26 - ErcanOPAK comment on JavaScript: Use Proxy for Object Interception

๐Ÿ›ก๏ธ Proxy = Object Interception Objects are exposed. Proxy intercepts operations. Validation, logging, reactivity, access control. ๐Ÿ“ Proxy Basics // Basic proxy const target = { name: ‘Alice’, age: 30 }; const handler = { get: function(obj, prop) { console.log(`Getting ${prop}`); return obj[prop]; }, set: function(obj, prop, value) { console.log(`Setting ${prop} to ${value}`); obj[prop] = […]

Read More
HTML

HTML: Build 2D Games with Canvas

- 09.07.26 - ErcanOPAK comment on HTML: Build 2D Games with Canvas

๐ŸŽฎ Canvas = 2D Game Development Games are fun. Canvas builds 2D games. Movement, collision, scoring โ€” all in JavaScript. ๐Ÿ“ Game Basics <canvas id=”game” width=”800″ height=”600″></canvas> <script> const canvas = document.getElementById(‘game’); const ctx = canvas.getContext(‘2d’); // Player object const player = { x: 400, y: 300, width: 40, height: 40, speed: 5, dx: 0, […]

Read More
CSS

CSS: Use Container Queries for Component-Level Responsive

- 09.07.26 - ErcanOPAK comment on CSS: Use Container Queries for Component-Level Responsive

๐Ÿ“ฆ Container Queries = Component Responsive Media queries are page-based. Container queries are component-based. Responsive design at component level. ๐Ÿ“ Container Query Basics /* Container definition */ .card-container { container-type: inline-size; container-name: card; } /* Container query */ @container card (min-width: 400px) { .card { display: flex; flex-direction: row; } .card-image { width: 200px; } […]

Read More
Windows

Windows 11: Master Disk Management for Storage

- 09.07.26 - ErcanOPAK comment on Windows 11: Master Disk Management for Storage

๐Ÿ’พ Disk Management = Storage Control Storage fills up fast. Disk Management optimizes storage. Partition, format, shrink, extend โ€” full control. ๐Ÿ“ Disk Management Tools # Open Disk Management – Right-click Start โ†’ Disk Management – Search: “Create and format hard disk partitions” – diskmgmt.msc (Run) # Key Operations – Create partition – Format partition […]

Read More
AI

AI Prompt: Repurpose Content for Maximum Reach

- 09.07.26 - ErcanOPAK comment on AI Prompt: Repurpose Content for Maximum Reach

๐Ÿ”„ AI Content Repurposing One piece of content is not enough. AI repurposes content โ€” blog posts, social media, videos, podcasts. Maximum reach. ๐Ÿ“ The Prompt Repurpose the following content for multiple platforms: Original Content: [Paste your content] Platforms: 1. Twitter/X (280 chars) 2. LinkedIn (long-form post) 3. Instagram (visual + caption) 4. Blog Post […]

Read More
Docker

Docker: Use Swarm for Container Orchestration

- 09.07.26 - ErcanOPAK comment on Docker: Use Swarm for Container Orchestration

๐Ÿ“ฆ Docker Swarm = Native Orchestration Kubernetes is complex. Docker Swarm is simpler. Native orchestration, easy setup, good for small-to-medium apps. ๐Ÿ“ Swarm Setup # Initialize Swarm docker swarm init –advertise-addr 192.168.1.100 # Join as worker docker swarm join –token TOKEN 192.168.1.100:2377 # Join as manager docker swarm join –token MANAGER-TOKEN 192.168.1.100:2377 # View nodes […]

Read More
Kubernetes

Kubernetes: Secure Your Cluster with Network Policies

- 09.07.26 - ErcanOPAK comment on Kubernetes: Secure Your Cluster with Network Policies

๐Ÿ›ก๏ธ Network Policies = Cluster Security Default is allow all. Network Policies control traffic. Zero trust, micro-segmentation, security. ๐Ÿ“ Network Policy Basics # Deny all (Default deny) apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-all spec: podSelector: {} policyTypes: – Ingress – Egress # Allow specific ingress apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-nginx spec: podSelector: […]

Read More
Wordpress

WordPress: Master SEO Best Practices to Rank Higher

- 09.07.26 - ErcanOPAK comment on WordPress: Master SEO Best Practices to Rank Higher

๐Ÿ“ˆ WordPress SEO = Higher Rankings Great content needs visibility. SEO best practices rank higher. More traffic, more customers, more success. ๐Ÿ“ On-Page SEO # Title Tags – Include primary keyword – Under 60 characters – Click-worthy – Unique per page # Meta Descriptions – Include primary keyword – 150-160 characters – Compelling copy – […]

Read More
Photoshop

Photoshop: Master Keyboard Shortcuts for Speed

- 09.07.26 - ErcanOPAK comment on Photoshop: Master Keyboard Shortcuts for Speed

โŒจ๏ธ Photoshop Shortcuts = Speed Mouse is slow. Keyboard shortcuts are fast. Master Photoshop, work faster, be more productive. ๐Ÿ“ Essential Shortcuts # Tools V โ†’ Move Tool M โ†’ Marquee Tool L โ†’ Lasso Tool W โ†’ Magic Wand C โ†’ Crop Tool I โ†’ Eyedropper J โ†’ Spot Healing Brush B โ†’ Brush […]

Read More
Visual Studio

Visual Studio: Use Performance Profiler to Optimize Code

- 09.07.26 - ErcanOPAK comment on Visual Studio: Use Performance Profiler to Optimize Code

๐Ÿš€ Performance Profiler = Code Optimization Slow code is frustrating. Performance Profiler finds bottlenecks. CPU, memory, async โ€” optimize your app. ๐Ÿ“ Profiling Tools # Open Diagnostic Tools Debug โ†’ Open Diagnostic Tools (Alt+F2) # Profiling Options – CPU Usage – Memory Usage – Async Profiling – .NET Object Allocation – GPU Usage – Database […]

Read More
C#

C#: Use Span for High-Performance Memory Operations

- 09.07.26 - ErcanOPAK comment on C#: Use Span for High-Performance Memory Operations

โšก Span = Memory Performance Memory allocations slow down apps. Span provides safe, allocation-free access. High-performance, low-allocation code. ๐Ÿ“ Span Basics // Span from array int[] numbers = {1, 2, 3, 4, 5}; Span span = numbers.AsSpan(); // Slice Span slice = span.Slice(1, 3); // {2, 3, 4} // Modify via span slice[0] = 10; […]

Read More
C#

C#: Use Async Streams for Asynchronous Data Sequences

- 09.07.26 - ErcanOPAK comment on C#: Use Async Streams for Asynchronous Data Sequences

๐ŸŒŠ Async Streams = Asynchronous Data Sync streams block. IAsyncEnumerable is async. Process data as it arrives, non-blocking, efficient. ๐Ÿ“ Async Streams Basics // Async stream method async IAsyncEnumerable GenerateNumbersAsync() { for (int i = 0; i < 10; i++) { await Task.Delay(100); // Simulate async work yield return i; } } // Consume async […]

Read More
SQL

SQL: Master Transactions for ACID Compliance

- 09.07.26 - ErcanOPAK comment on SQL: Master Transactions for ACID Compliance

๐Ÿ”„ Transactions = ACID Compliance Data integrity matters. Transactions ensure ACID. Atomic, Consistent, Isolated, Durable โ€” reliable data operations. ๐Ÿ“ Transaction Basics # Basic transaction BEGIN TRANSACTION; UPDATE accounts SET balance = balance – 100 WHERE id = 1; UPDATE accounts SET balance = balance + 100 WHERE id = 2; COMMIT; # With error […]

Read More
Asp.Net Core

.NET Core: Master Logging with Serilog and NLog

- 09.07.26 - ErcanOPAK comment on .NET Core: Master Logging with Serilog and NLog

๐Ÿ“ Logging = Debugging & Monitoring Debugging is hard without logs. Serilog, NLog provide structured logging. Debug, monitor, analyze โ€” powerful logging. ๐Ÿ“ Serilog Setup # Install packages dotnet add package Serilog dotnet add package Serilog.Extensions.Logging dotnet add package Serilog.Sinks.Console dotnet add package Serilog.Sinks.File dotnet add package Serilog.Sinks.Seq # Program.cs using Serilog; var builder = […]

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

Posts pagination

« Previous 1 … 4 5 6 7 8 … 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