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

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
Photoshop

Photoshop: Master Blend Modes for Creative Effects

- 07.07.26 - ErcanOPAK comment on Photoshop: Master Blend Modes for Creative Effects

๐ŸŽจ Blend Modes = Creative Power Layers overlap. Blend modes control interaction. Multiply, screen, overlay โ€” endless creative possibilities. ๐Ÿ“ Essential Blend Modes # Normal (Default) – No blending – Top layer covers bottom # Darken Group (Makes darker) – Darken: Keeps darker pixels – Multiply: Multiplies colors (darkens) – Color Burn: Intense darkening – […]

Read More
Visual Studio

Visual Studio: Use IntelliCode for AI-Assisted Development

- 07.07.26 - ErcanOPAK comment on Visual Studio: Use IntelliCode for AI-Assisted Development

๐Ÿค– IntelliCode = AI-Powered Coding IntelliSense is smart. IntelliCode is AI-assisted. Suggests completions based on patterns. Learns from your code. Supercharges productivity. ๐Ÿค– IntelliCode Features # AI-Assisted IntelliSense – Top 10 completion predictions – Context-aware suggestions – Learns from your code patterns – Team-wide recommendations # Code Analysis – Identifies common patterns – Suggests better […]

Read More
C#

C#: Use Lambda Expressions for Concise Code

- 07.07.26 - ErcanOPAK comment on C#: Use Lambda Expressions for Concise Code

โšก Lambdas = Concise Functions Anonymous methods are verbose. Lambda expressions are concise. One-liners for LINQ, delegates, events. โŒ Anonymous Method Func square = delegate(int x) { return x * x; }; โœ… Lambda Expression Func square = x => x * x; ๐Ÿ“ Lambda Syntax // Basic syntax (parameters) => expression (parameters) => { […]

Read More
C#

C#: Use Generics for Type-Safe Reusable Code

- 07.07.26 - ErcanOPAK comment on C#: Use Generics for Type-Safe Reusable Code

๐Ÿงฉ Generics = Type-Safe Code Object types are unsafe. Generics create type-safe reusable code. Performance, safety, flexibility. โŒ Object (Unsafe) public class Stack { private object[] items; public void Push(object item) { } public object Pop() { } } Stack s = new Stack(); s.Push(123); // Boxed int i = (int)s.Pop(); // Cast โœ… Generic […]

Read More
SQL

SQL: Use CTEs for Readable Complex Queries

- 07.07.26 - ErcanOPAK comment on SQL: Use CTEs for Readable Complex Queries

๐Ÿ“Š CTE = Readable Complex Queries Nested subqueries are messy. CTEs make queries readable. Break complex queries into steps. Essential for maintainable SQL. ๐Ÿ“ CTE Syntax WITH cte_name AS ( SELECT column1, column2 FROM table WHERE condition ) SELECT * FROM cte_name WHERE another_condition; — Multiple CTEs WITH cte1 AS ( SELECT … ), cte2 […]

Read More
Asp.Net Core

.NET Core: Build Web UI with Razor Pages

- 07.07.26 - ErcanOPAK comment on .NET Core: Build Web UI with Razor Pages

๐Ÿ“„ Razor Pages = Page-Based Web Apps MVC can be heavy. Razor Pages are page-focused. Simpler, more organized, great for UI. ๐Ÿ“ Razor Page Example // Program.cs builder.Services.AddRazorPages(); app.MapRazorPages(); // Pages/Index.cshtml @page @model IndexModel @{ ViewData[“Title”] = “Home”; } <div class=”text-center”> <h1>Welcome to My App</h1> <p>Current time: @Model.CurrentTime</p> <form method=”post”> <input type=”text” asp-for=”UserName” /> <button […]

Read More
Git

Git: Use Submodules for External Repositories

- 07.07.26 - ErcanOPAK comment on Git: Use Submodules for External Repositories

๐Ÿ“ฆ Submodules = External Repos Projects depend on other repos. Submodules include external repositories. Track dependencies, version control included. ๐Ÿ“ Submodule Commands # Add submodule git submodule add https://github.com/user/repo.git path/to/submodule # Clone with submodules git clone –recursive https://github.com/your/repo.git # Initialize submodules git submodule init # Update submodules git submodule update # Update with recursive git […]

Read More
Ajax

Ajax: Understand CORS for Cross-Origin Requests

- 07.07.26 - ErcanOPAK comment on Ajax: Understand CORS for Cross-Origin Requests

๐ŸŒ CORS = Cross-Origin Security Browsers block cross-origin requests. CORS enables secure cross-origin communication. Essential for APIs and frontend apps. ๐Ÿ“ CORS Headers # Server Headers Access-Control-Allow-Origin: https://myapp.com Access-Control-Allow-Methods: GET, POST, PUT, DELETE Access-Control-Allow-Headers: Content-Type, Authorization Access-Control-Allow-Credentials: true Access-Control-Max-Age: 3600 # Preflight Request OPTIONS /api/data Origin: https://myapp.com Access-Control-Request-Method: POST Access-Control-Request-Headers: Content-Type # Simple Request GET […]

Read More
JavaScript

JavaScript: Understand Closures for Scope and Privacy

- 07.07.26 - ErcanOPAK comment on JavaScript: Understand Closures for Scope and Privacy

๐Ÿ”’ Closures = Scope + Privacy Variables leak globally? Closures create private scope. Data privacy, factory functions, state management. ๐Ÿ“ Closure Examples // Basic closure function outer() { let privateVar = ‘secret’; return function inner() { console.log(privateVar); // ‘secret’ }; } const closure = outer(); closure(); // Uses privateVar // Private counter function createCounter() { […]

Read More
HTML

HTML: Implement Accessibility (A11y) Best Practices

- 07.07.26 - ErcanOPAK comment on HTML: Implement Accessibility (A11y) Best Practices

โ™ฟ Accessibility = Web for Everyone Web is for everyone. Accessibility ensures equal access. Screen readers, keyboard navigation, inclusive design. ๐Ÿ“ Essential Accessibility <!– Semantic HTML –> <!– Use correct elements –> <header></header> <nav></nav> <main></main> <article></article> <section></section> <aside></aside> <footer></footer> <!– ARIA Attributes –> <button aria-label=”Close dialog”>ร—</button> <div role=”dialog” aria-labelledby=”dialog-title”> <h2 id=”dialog-title”>Confirm Action</h2> </div> <nav aria-label=”Main […]

Read More
CSS

CSS: Use CSS Variables for Maintainable Styles

- 07.07.26 - ErcanOPAK comment on CSS: Use CSS Variables for Maintainable Styles

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

Read More
Windows

Windows 11: Use PowerToys for Advanced Productivity

- 07.07.26 - ErcanOPAK comment on Windows 11: Use PowerToys for Advanced Productivity

โšก PowerToys = Productivity Superpower Windows is good. PowerToys makes it incredible. FancyZones, PowerToys Run, Color Picker โ€” productivity at your fingertips. ๐Ÿ“ Essential PowerToys # Install PowerToys – Download from GitHub/Microsoft Store – Install and launch # FancyZones (Window Management) Win + ` โ†’ Launch zones Custom layouts: – Columns (2-4 columns) – Rows […]

Read More
AI

AI Prompt: Generate Blog Post Outlines

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

๐Ÿ“ Blog Outlines with AI Writer’s block is real. AI generates blog outlines โ€” structure, topics, research points. Start writing with clarity. ๐Ÿ“ The Prompt Generate a detailed blog post outline for: Topic: [Your blog 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 […]

Read More
Docker

Docker: Manage Networks with Docker Compose

- 07.07.26 - ErcanOPAK comment on Docker: Manage Networks with Docker Compose

๐ŸŒ Docker Networks with Compose Containers need communication. Docker networks connect containers. Compose makes network management easy. ๐Ÿ“ Network Types # Bridge (default) – Containers on same host – Internal network – Customizable # Host – Uses host’s network – No isolation – Best performance # Overlay – Swarm mode – Across multiple hosts # […]

Read More
Kubernetes

Kubernetes: Use Helm Charts for Package Management

- 07.07.26 - ErcanOPAK comment on Kubernetes: Use Helm Charts for Package Management

๐Ÿ“ฆ Helm = Kubernetes Package Manager Kubernetes YAML is repetitive. Helm packages Kubernetes apps. Templates, versioning, sharing โ€” like apt/yum for K8s. ๐Ÿ“ Helm Commands # Install Helm curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Add repositories helm repo add bitnami https://charts.bitnami.com/bitnami helm repo add stable https://charts.helm.sh/stable helm repo update # Search charts helm search repo nginx […]

Read More
Wordpress

WordPress: Create Custom Gutenberg Blocks

- 07.07.26 - ErcanOPAK comment on WordPress: Create Custom Gutenberg Blocks

๐Ÿงฉ Gutenberg = Modern Block Editor Classic editor is limited. Gutenberg blocks are modern. Custom blocks for any content. User-friendly, flexible, powerful. ๐Ÿ“ Block Registration // functions.php function register_custom_blocks() { register_block_type(__DIR__ . ‘/build/block.json’); } add_action(‘init’, ‘register_custom_blocks’); // block.json { “apiVersion”: 2, “title”: “Custom Block”, “name”: “custom/block”, “category”: “design”, “icon”: “smiley”, “description”: “A custom block”, “supports”: […]

Read More
Photoshop

Photoshop: Master Color Grading for Cinematic Looks

- 07.07.26 - ErcanOPAK comment on Photoshop: Master Color Grading for Cinematic Looks

๐ŸŽจ Color Grading = Cinematic Power Photos are flat. Color grading creates mood. Cinematic looks, professional feel, emotional impact โ€” all with color. ๐Ÿ“ Color Grading Tools # 1. Curves (Powerful) – Image โ†’ Adjustments โ†’ Curves – RGB curve: Overall brightness – Individual channels: Color adjustments – S-curve: Add contrast – Point curve: Precise […]

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

Posts pagination

« Previous 1 … 6 7 8 9 10 … 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 (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