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: July 7, 2026

C#

C#: Use Nullable Reference Types for Null Safety

- 07.07.26 - ErcanOPAK comment on C#: Use Nullable Reference Types for Null Safety

๐Ÿ›ก๏ธ Nullable Reference Types = Null Safety Null reference is #1 error. Nullable reference types prevent null bugs. Compiler help, fewer crashes, safer code. โŒ Null (Unsafe) public class User { public string Name { get; set; } public string Email { get; set; } } // Potential null reference โœ… Nullable Reference (Safe) public […]

Read More
C#

C#: Use Pattern Matching for Elegant Code

- 07.07.26 - ErcanOPAK comment on C#: Use Pattern Matching for Elegant Code

๐ŸŽฏ Pattern Matching = Elegant Code If-else chains are messy. Pattern matching is elegant. Switch expressions, type matching, property patterns. โŒ If-Else Chains if (obj is string) { … } else if (obj is int) { … } else if (obj is bool) { … } โœ… Pattern Matching switch (obj) { string s => […]

Read More
SQL

SQL: Use Stored Procedures for Database Logic

- 07.07.26 - ErcanOPAK comment on SQL: Use Stored Procedures for Database Logic

๐Ÿ“ฆ Stored Procedures = Database Logic Business logic in code is fine. Stored procedures move logic to database. Performance, security, consistency. ๐Ÿ“ Creating Procedures — Basic procedure CREATE PROCEDURE GetUserById @UserId INT AS BEGIN SELECT * FROM Users WHERE Id = @UserId; END; — Execute EXEC GetUserById 1; — With OUTPUT parameter CREATE PROCEDURE GetUserCount […]

Read More
Asp.Net Core

.NET Core: Use SignalR for Real-Time Web Apps

- 07.07.26 - ErcanOPAK comment on .NET Core: Use SignalR for Real-Time Web Apps

๐Ÿ“ก SignalR = Real-Time Web Real-time is essential. SignalR adds real-time to .NET. Chat, notifications, live updates โ€” simple and powerful. ๐Ÿ“ Setting Up SignalR # Install packages dotnet add package Microsoft.AspNetCore.SignalR dotnet add package Microsoft.AspNetCore.SignalR.Client # Program.cs builder.Services.AddSignalR(); app.MapHub<ChatHub>(“/chatHub”); # Create Hub public class ChatHub : Hub { public async Task SendMessage(string user, string […]

Read More
Git

Git: Choose the Right Branching Workflow

- 07.07.26 - ErcanOPAK comment on Git: Choose the Right Branching Workflow

๐ŸŒฟ Branching Workflows = Git Success Random branching causes chaos. Git workflows bring order. Choose the right strategy for your team. ๐Ÿ“ GitHub Flow (Simple) # Main branch (always deployable) main # Feature branches feature/xxx bugfix/xxx # Workflow git checkout -b feature/add-login # Make changes git add . git commit -m “Add login feature” git […]

Read More
Ajax

Ajax: Use WebSockets for Real-Time Communication

- 07.07.26 - ErcanOPAK comment on Ajax: Use WebSockets for Real-Time Communication

๐Ÿ”Œ WebSockets = Real-Time Communication HTTP is request-response. WebSockets are bidirectional. Real-time updates, chat, live data โ€” essential for modern apps. ๐Ÿ“ WebSocket Basics // Client-side const socket = new WebSocket(‘ws://localhost:8080’); // Connection opened socket.onopen = function(event) { console.log(‘Connected to server’); socket.send(‘Hello Server!’); }; // Listen for messages socket.onmessage = function(event) { console.log(‘Message from server:’, […]

Read More
JavaScript

JavaScript: Use Web Workers for Multi-threading

- 07.07.26 - ErcanOPAK comment on JavaScript: Use Web Workers for Multi-threading

๐Ÿงต Web Workers = Multi-threading JavaScript is single-threaded. Web Workers enable multi-threading. Heavy tasks offloaded, UI remains responsive. ๐Ÿ“ Worker Basics // Main thread (app.js) const worker = new Worker(‘worker.js’); // Send message to worker worker.postMessage({ type: ‘calculate’, data: [1, 2, 3, 4, 5] }); // Receive message from worker worker.onmessage = function(event) { console.log(‘Result:’, […]

Read More
HTML

HTML: Use Responsive Images for Adaptive Content

- 07.07.26 - ErcanOPAK comment on HTML: Use Responsive Images for Adaptive Content

๐Ÿ–ผ๏ธ Responsive Images = Adaptive Content Desktop images on mobile are slow. Responsive images adapt to screen. srcset, sizes, picture โ€” optimize delivery. ๐Ÿ“ srcset and sizes <!– Simple srcset –> <img src=”image-small.jpg” srcset=”image-small.jpg 480w, image-medium.jpg 768w, image-large.jpg 1024w” sizes=”(max-width: 480px) 100vw, (max-width: 768px) 75vw, 50vw” alt=”Responsive image”> <!– Different images for different screens –> […]

Read More
CSS

CSS: Master Media Queries for Responsive Design

- 07.07.26 - ErcanOPAK comment on CSS: Master Media Queries for Responsive Design

๐Ÿ“ฑ Media Queries = Responsive Design One size fits none. Media queries make responsive designs. Mobile, tablet, desktop โ€” adapt to every screen. ๐Ÿ“ Media Query Syntax /* Basic syntax */ @media (condition) { /* CSS rules */ } /* Width-based */ @media (max-width: 768px) { /* Mobile styles */ } @media (min-width: 769px) and […]

Read More
Windows

Windows 11: Use System Restore for Safe Recovery

- 07.07.26 - ErcanOPAK comment on Windows 11: Use System Restore for Safe Recovery

๐Ÿ”„ System Restore = Safe Recovery Windows issues are inevitable. System Restore creates recovery points. Roll back changes, fix problems, restore stability. ๐Ÿ“ Setting Up System Restore # 1. Enable System Restore – Search: “Create a restore point” – Click “Create” in System Properties – System Protection tab – Select drive (C:) – Click Configure […]

Read More
AI

AI Prompt: Generate Professional Meeting Agendas

- 07.07.26 - ErcanOPAK comment on AI Prompt: Generate Professional Meeting Agendas

๐Ÿ“‹ AI-Powered Meeting Agendas Meeting without agenda wastes time. AI generates meeting agendas โ€” topics, time allocation, outcomes. Efficient meetings. ๐Ÿ“ The Prompt Generate a meeting agenda for: Meeting Type: [e.g., Stand-up, Review, Planning] Duration: [e.g., 30 minutes, 1 hour] Attendees: [Roles and participants] Topic: [Main subject of meeting] Provide: 1. Meeting Title 2. Objective […]

Read More
Docker

Docker: Use Health Checks for Container Monitoring

- 07.07.26 - ErcanOPAK comment on Docker: Use Health Checks for Container Monitoring

๐Ÿฅ Health Checks = Container Monitoring Containers can fail silently. Health checks monitor container health. Detect issues, restart automatically. Essential for production. ๐Ÿ“ Health Check Types # 1. Command Check HEALTHCHECK –interval=30s –timeout=10s –retries=3 \ CMD curl -f http://localhost:8080/health || exit 1 # 2. HTTP Check (Dockerfile) FROM node:18-alpine HEALTHCHECK –interval=30s –timeout=10s –retries=3 \ CMD […]

Read More
Kubernetes

Kubernetes: Use Operators for Automated Management

- 07.07.26 - ErcanOPAK comment on Kubernetes: Use Operators for Automated Management

๐Ÿค– Operators = Automated Management Manual operations are error-prone. Operators automate complex applications. Database, monitoring, custom apps โ€” self-healing. ๐Ÿ“ Popular Operators # Databases – Postgres Operator (Crunchy Data) – MySQL Operator (Oracle) – MongoDB Operator – Elasticsearch Operator – Redis Operator # Monitoring – Prometheus Operator – Grafana Operator – Datadog Operator # Infrastructure […]

Read More
Wordpress

WordPress: Performance Optimization for Speed

- 07.07.26 - ErcanOPAK comment on WordPress: Performance Optimization for Speed

โšก WordPress Speed Optimization Slow sites lose visitors. Performance optimization makes WordPress fast. Better UX, higher SEO, happy visitors. ๐Ÿ“ Optimization Strategies # 1. Caching – Page caching (WP Rocket, W3 Total Cache) – Browser caching – Object caching (Redis/Memcached) – CDN caching # 2. Image Optimization – Compress images (Smush, ShortPixel) – WebP format […]

Read More
Photoshop

Photoshop: Create Stunning Text Effects

- 07.07.26 - ErcanOPAK comment on Photoshop: Create Stunning Text Effects

โœ๏ธ Text Effects = Typography Magic Plain text is boring. Text effects create stunning typography. 3D, neon, vintage โ€” endless creative possibilities. ๐Ÿ“ Text Effect Techniques # 3D Text – Create text layer – 3D โ†’ New 3D Extrusion from Selected Layer – Adjust lighting, materials – Render for final effect # Neon Glow Effect […]

Read More
Visual Studio

Visual Studio: Use Test Explorer for Unit Testing

- 07.07.26 - ErcanOPAK comment on Visual Studio: Use Test Explorer for Unit Testing

๐Ÿงช Test Explorer = Quality Assurance Manual testing is slow. Test Explorer runs unit tests. Run, debug, analyze โ€” ensure code quality. ๐Ÿ“ Test Frameworks # xUnit (Popular) dotnet add package xunit dotnet add package xunit.runner.visualstudio # NUnit dotnet add package NUnit dotnet add package NUnit3TestAdapter # MSTest dotnet add package MSTest.TestFramework dotnet add package […]

Read More
C#

C#: Use Records for Immutable Data Types

- 07.07.26 - ErcanOPAK comment on C#: Use Records for Immutable Data Types

๐Ÿ“ Records = Immutable Data Classes are mutable. Records are immutable. Value-based equality, concise syntax, data-centric. โŒ Class (Mutable) public class Person { public string Name { get; set; } public int Age { get; set; } } โœ… Record (Immutable) public record Person(string Name, int Age); ๐Ÿ“ Record Features // Positional record public record […]

Read More
C#

C#: Use Using Statements for Resource Management

- 07.07.26 - ErcanOPAK comment on C#: Use Using Statements for Resource Management

๐Ÿ“ฆ Using = Resource Management Resources leak without cleanup. Using statements ensure disposal. Files, connections, streams โ€” cleanup automatically. โŒ Manual Cleanup (Error-Prone) var file = File.Open(“file.txt”); try { // Use file } finally { file.Dispose(); } โœ… Using Statement (Clean) using var file = File.Open(“file.txt”); // Use file – auto-disposed ๐Ÿ“ Using Examples // […]

Read More
SQL

SQL: Use Indexes to Boost Query Performance

- 07.07.26 - ErcanOPAK comment on SQL: Use Indexes to Boost Query Performance

โšก Indexes = Query Performance Slow queries kill performance. Indexes speed up queries. Find data fast, optimize SELECTs. Essential for database performance. ๐Ÿ“ Index Types # B-Tree Index (default) CREATE INDEX idx_users_email ON users(email); # Unique Index (enforces uniqueness) CREATE UNIQUE INDEX idx_users_email ON users(email); # Composite Index (multiple columns) CREATE INDEX idx_users_name_email ON users(name, […]

Read More
Asp.Net Core

.NET Core: Use Entity Framework Core for Database Access

- 07.07.26 - ErcanOPAK comment on .NET Core: Use Entity Framework Core for Database Access

๐Ÿ—„๏ธ EF Core = Database ORM SQL is tedious. Entity Framework Core is ORM. Query with C#, change tracking, migrations. Essential for .NET data access. ๐Ÿ“ Setting Up EF Core # Install packages dotnet add package Microsoft.EntityFrameworkCore dotnet add package Microsoft.EntityFrameworkCore.SqlServer dotnet add package Microsoft.EntityFrameworkCore.Design dotnet add package Microsoft.EntityFrameworkCore.Tools # Create DbContext public class AppDbContext […]

Read More
Git

Git: Use Rebase for Clean Commit History

- 07.07.26 - ErcanOPAK comment on Git: Use Rebase for Clean Commit History

๐Ÿงน Rebase = Clean History Merge commits are messy. Rebase creates clean history. Linear, readable, professional. โŒ Merge (Messy) * Merge commit |\ | * Feature commit | * Feature commit | * Feature commit * | Main commit * | Main commit โœ… Rebase (Clean) * Feature commit * Feature commit * Feature commit […]

Read More
Ajax

Ajax: Master Error Handling in Async Requests

- 07.07.26 - ErcanOPAK comment on Ajax: Master Error Handling in Async Requests

โš ๏ธ Error Handling = Robust AJAX Async requests fail. Error handling makes them robust. Network errors, timeouts, server errors โ€” handle them all. ๐Ÿ“ Common Errors # Network Errors – No internet connection – DNS resolution failed – CORS issues # HTTP Errors – 400 Bad Request – 401 Unauthorized – 403 Forbidden – 404 […]

Read More
JavaScript

JavaScript: Use ES6 Modules for Organized Code

- 07.07.26 - ErcanOPAK comment on JavaScript: Use ES6 Modules for Organized Code

๐Ÿ“ฆ ES6 Modules = Organized Code Global namespace is messy. ES6 modules organize code. Import/export, encapsulation, dependency management. โŒ Script Tags (Messy) <script src=”utils.js”></script> <script src=”app.js”></script> // Global variables everywhere โœ… ES6 Modules (Clean) <script type=”module” src=”app.js”></script> // Import/export only what’s needed ๐Ÿ“ Module Examples // math.js (exports) export const add = (a, b) => […]

Read More
HTML

HTML: Implement Microdata for Semantic Web

- 07.07.26 - ErcanOPAK comment on HTML: Implement Microdata for Semantic Web

๐Ÿ” Microdata = Semantic Web Search engines understand structure. Microdata adds semantic meaning. Rich snippets, better SEO, enhanced search results. ๐Ÿ“ Microdata Basics <!– Schema.org Vocabulary –> <div itemscope itemtype=”http://schema.org/Product”> <span itemprop=”name”>Product Name</span> <img itemprop=”image” src=”product.jpg” alt=”Product”> <span itemprop=”description”>Product description…</span> <span itemprop=”sku”>SKU-123</span> <div itemprop=”offers” itemscope itemtype=”http://schema.org/Offer”> <span itemprop=”price” content=”99.99″>$99.99</span> <span itemprop=”priceCurrency” content=”USD”>USD</span> <link itemprop=”availability” href=”http://schema.org/InStock” […]

Read More
CSS

CSS: Master Animations with Keyframes and Transitions

- 07.07.26 - ErcanOPAK comment on CSS: Master Animations with Keyframes and Transitions

๐ŸŽฌ CSS Animations = Motion Magic Static pages are boring. CSS animations bring life. Transitions, keyframes, motion โ€” engaging user experiences. ๐Ÿ“ Transitions vs Animations /* Transitions (state changes) */ .button { background: blue; transition: background 0.3s ease, transform 0.2s ease; } .button:hover { background: darkblue; transform: scale(1.05); } /* Keyframe Animations (complex sequences) */ […]

Read More
Windows

Windows 11: Troubleshoot Common Issues Like a Pro

- 07.07.26 - ErcanOPAK comment on Windows 11: Troubleshoot Common Issues Like a Pro

๐Ÿ”ง Windows Troubleshooting Guide Windows issues are inevitable. Troubleshooting skills fix problems fast. Save time, avoid frustration. ๐Ÿ“ Common Issues & Solutions # 1. Slow Performance – Task Manager โ†’ Check CPU/Memory – Disable startup apps (Task Manager) – Run Disk Cleanup – Check for malware – Update drivers # 2. Internet Connection – Network […]

Read More
AI

AI Prompt: Generate Compelling Product Descriptions

- 07.07.26 - ErcanOPAK comment on AI Prompt: Generate Compelling Product Descriptions

๐Ÿ“ AI Product Descriptions Product descriptions take time. AI generates compelling descriptions โ€” benefits, features, SEO-friendly. Convert browsers to buyers. ๐Ÿ“ The Prompt Generate compelling product descriptions for: Product Name: [Your product name] Category: [e.g., Electronics, Fashion, Food] Target Audience: [e.g., Professionals, Parents, Fitness] Unique Selling Points: 1. [Feature 1] 2. [Feature 2] 3. [Feature […]

Read More
Docker

Docker: Use Multi-Stage Builds for Smaller Images

- 07.07.26 - ErcanOPAK comment on Docker: Use Multi-Stage Builds for Smaller Images

๐Ÿ“ฆ Multi-Stage = Smaller Images Build tools bloat images. Multi-stage builds separate build and runtime. Smaller, faster, more secure images. โŒ Single Stage (Large) FROM node:18 COPY . . RUN npm install RUN npm run build RUN npm install -g serve CMD [“serve”, “-s”, “build”] โœ… Multi-Stage (Small) FROM node:18 AS builder COPY . . […]

Read More
Kubernetes

Kubernetes: Use Ingress Controllers for HTTP Routing

- 07.07.26 - ErcanOPAK comment on Kubernetes: Use Ingress Controllers for HTTP Routing

๐Ÿšช Ingress = HTTP Routing NodePort and LoadBalancer are basic. Ingress provides advanced HTTP routing. Single entry point, multiple services, SSL. ๐Ÿ“ Ingress Basics # Install NGINX Ingress Controller kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.1/deploy/static/provider/cloud/deploy.yaml # Ingress Resource apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: my-ingress spec: rules: – host: app.example.com http: paths: – path: / pathType: Prefix […]

Read More
Wordpress

WordPress: Essential Security Best Practices

- 07.07.26 - ErcanOPAK comment on WordPress: Essential Security Best Practices

๐Ÿ›ก๏ธ WordPress Security Guide WordPress is popular, hence targeted. Security best practices protect your site. Proactive security = peace of mind. ๐Ÿ“ Essential Security Steps # 1. Keep Everything Updated – WordPress core – Themes – Plugins – PHP version # 2. Strong Passwords – Use password manager – 16+ characters – Mix of characters […]

Read More
Page 1 of 2
1 2 Next ยป

Posts pagination

1 2 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 (858)
  • 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 (858)
  • 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