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: Understand Hoisting to Avoid Surprises

- 24.06.26 - ErcanOPAK comment on JavaScript: Understand Hoisting to Avoid Surprises

๐Ÿ“ˆ Hoisting = Declarations Move to Top JavaScript hoists declarations. Understand hoisting to avoid bugs. var, let, const, function declarations โ€” different hoisting behavior. ๐Ÿ“ var Hoisting console.log(x); // undefined (not error) var x = 5; // Equivalent to: var x; console.log(x); // undefined x = 5; // Function declaration hoisting sayHello(); // Works! function […]

Read More
HTML

HTML: Use Lists to Structure Content

- 24.06.26 - ErcanOPAK comment on HTML: Use Lists to Structure Content

๐Ÿ“‹ Lists = Organized Information Lists organize content. Ordered, unordered, definition lists. Essential for navigation, features, specs. ๐Ÿ“ List Types <!– Unordered list (bullets) –> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <!– Ordered list (numbers) –> <ol> <li>First step</li> <li>Second step</li> <li>Third step</li> </ol> <!– Nested lists –> <ul> <li>Category 1 <ul> <li>Sub-item […]

Read More
CSS

CSS: Use Z-Index to Control Element Layering

- 24.06.26 - ErcanOPAK comment on CSS: Use Z-Index to Control Element Layering

๐Ÿ“ Elements Stack in 3D HTML elements stack vertically. Z-index controls overlap. Put modals on top, backgrounds behind. ๐Ÿ“ Z-Index Basics .modal { position: fixed; z-index: 1000; /* High number = on top */ } .dropdown { position: absolute; z-index: 100; /* Above content, below modal */ } .tooltip { position: absolute; z-index: 200; /* […]

Read More
Windows

Windows 11: Use Night Light to Reduce Eye Strain

- 24.06.26 - ErcanOPAK comment on Windows 11: Use Night Light to Reduce Eye Strain

๐ŸŒ™ Blue Light = Sleep Disruption Screen blue light affects sleep. Night Light reduces blue light at night. Warmer colors, better sleep, less eye strain. ๐Ÿ”ง Enable Night Light Settings โ†’ System โ†’ Display โ†’ Night light Quick toggle: Action Center โ†’ Night light Schedule: – Sunset to sunrise (automatic, requires location) – Set custom […]

Read More
AI

AI Prompt: Generate Professional Email Replies

- 24.06.26 - ErcanOPAK comment on AI Prompt: Generate Professional Email Replies

โœ‰๏ธ Reply to Emails Faster and Better Writing email replies takes time. AI generates professional replies based on the email. Edit, send, move on. ๐Ÿ“ The Prompt I received this email: [Paste the email you received] Context: – My role: [e.g., Software Engineer, Manager, Freelancer] – Relationship: [e.g., Client, Colleague, Manager, Vendor] – Desired tone: […]

Read More
Docker

Docker: View Container Logs with docker logs

- 24.06.26 - ErcanOPAK comment on Docker: View Container Logs with docker logs

๐Ÿ“ See What Your Container is Doing Containers run in background. docker logs shows stdout/stderr output. Debug, monitor, troubleshoot. ๐Ÿ“ Log Commands # View all logs docker logs container_name # Follow live logs docker logs -f container_name # Last 100 lines docker logs –tail 100 container_name # Since last 30 minutes docker logs –since 30m […]

Read More
Kubernetes

Kubernetes: Use DaemonSets to Run Pods on Every Node

- 24.06.26 - ErcanOPAK comment on Kubernetes: Use DaemonSets to Run Pods on Every Node

๐Ÿ“ก One Pod Per Node โ€” Automatically Need monitoring agent on every node? Log collector? DaemonSet runs one pod per node. New nodes get pod automatically. ๐Ÿ“ DaemonSet Example apiVersion: apps/v1 kind: DaemonSet metadata: name: node-monitor namespace: kube-system spec: selector: matchLabels: name: node-monitor template: metadata: labels: name: node-monitor spec: containers: – name: monitor image: prom/node-exporter […]

Read More
Wordpress

WordPress: Customize Login Page for Branding

- 24.06.26 - ErcanOPAK comment on WordPress: Customize Login Page for Branding

๐ŸŽจ Professional Login Page for Clients Default WordPress login looks generic. Custom login page shows your brand. Logo, colors, background โ€” professional impression. ๐Ÿ“ Custom Login CSS // functions.php function custom_login_logo() { echo ‘<style> body.login { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); } .login h1 a { background-image: url(‘ . get_stylesheet_directory_uri() . ‘/images/logo.png); background-size: contain; […]

Read More
Photoshop

Photoshop: Use Content-Aware Scale to Resize Images Without Distortion

- 24.06.26 - ErcanOPAK comment on Photoshop: Use Content-Aware Scale to Resize Images Without Distortion

๐Ÿ“ Resize Images, Keep Important Content Intact Normal scaling stretches everything. Content-Aware Scale protects important areas. Resize while preserving people, objects, faces. ๐Ÿ“ How to Use 1. Select layer 2. Edit โ†’ Content-Aware Scale (Ctrl + Alt + Shift + C) 3. Drag handles to resize 4. Protected areas stay intact Protect specific areas: – […]

Read More
Visual Studio

Visual Studio: Use Immediate Window to Execute Code During Debugging

- 24.06.26 - ErcanOPAK comment on Visual Studio: Use Immediate Window to Execute Code During Debugging

๐Ÿ–ฅ๏ธ Debug Like a Pro Need to test a method while debugging? Immediate Window executes code on the fly. Test expressions, call methods, inspect variables. ๐Ÿ”ง Using Immediate Window Debug โ†’ Windows โ†’ Immediate (Ctrl + Alt + I) While debugging (breakpoint hit): – ? variableName โ†’ Show variable value – ? myMethod() โ†’ Call […]

Read More
C#

C#: Use Delegates and Events for Callback Patterns

- 24.06.26 - ErcanOPAK comment on C#: Use Delegates and Events for Callback Patterns

๐Ÿ“ž Delegates = Function Pointers Passing methods as parameters? Delegates enable callbacks. Events enable notifications. Essential for event-driven programming. ๐Ÿ“ Delegates // Declare delegate public delegate void ProcessDelegate(string message); // Method matching delegate public void PrintMessage(string msg) => Console.WriteLine(msg); // Use delegate ProcessDelegate handler = PrintMessage; handler(“Hello”); // Multicast delegate handler += msg => Console.WriteLine($”Another: […]

Read More
C#

C#: Use Generics for Type-Safe and Reusable Code

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

๐Ÿ“ฆ Generics = Type-Safe Reusable Code Object types lose type safety. Generics preserve types. Reusable code, compile-time safety, no casting. โŒ Without Generics public class List { private object[] _items; public void Add(object item) { } public object Get(int index) { } } // Boxed int, cast required โœ… With Generics public class List { […]

Read More
SQL

SQL: Use SELECT to Query Data from Tables

- 24.06.26 - ErcanOPAK comment on SQL: Use SELECT to Query Data from Tables

๐Ÿ“Š SELECT = Read Data from Database Data is useless if you can’t read it. SELECT queries data. The most used SQL command. ๐Ÿ“ Basic SELECT — All columns SELECT * FROM users; — Specific columns SELECT name, email FROM users; — Distinct values SELECT DISTINCT country FROM users; — With alias SELECT name AS […]

Read More
Asp.Net Core

.NET Core: Use Minimal APIs for Lightweight Services

- 24.06.26 - ErcanOPAK comment on .NET Core: Use Minimal APIs for Lightweight Services

โšก APIs in 10 Lines of Code Controllers are overkill for simple APIs. Minimal APIs are lightweight, fast, and simple. Perfect for microservices. โŒ Controller (Verbose) [ApiController] [Route(“api/[controller]”)] public class UsersController : ControllerBase { [HttpGet] public async Task Get() { return await _db.Users.ToListAsync(); } } โœ… Minimal API var app = builder.Build(); app.MapGet(“/api/users”, async (AppDbContext […]

Read More
Git

Git: Use Git Pull to Update Your Local Repository

- 24.06.26 - ErcanOPAK comment on Git: Use Git Pull to Update Your Local Repository

โฌ‡๏ธ git pull = git fetch + git merge Team members push changes. git pull downloads and merges. Keep your local repo up to date. ๐Ÿ“ Basic Pull # Pull from default remote git pull # Pull from specific remote and branch git pull origin main # Pull and rebase (instead of merge) git pull […]

Read More
Ajax

Ajax: Use Query Strings to Pass Data in GET Requests

- 24.06.26 - ErcanOPAK comment on Ajax: Use Query Strings to Pass Data in GET Requests

๐Ÿ”— ?key=value โ€” Query Strings in URLs GET requests need parameters. Query strings pass data in URL. Search, filter, pagination โ€” all in the URL. ๐Ÿ“ Building Query Strings // Manual const url = `/api/users?page=1&limit=10&search=alice`; // URLSearchParams const params = new URLSearchParams(); params.append(‘page’, ‘1’); params.append(‘limit’, ’10’); params.append(‘search’, ‘alice’); const url = `/api/users?${params}`; // From object […]

Read More
JavaScript

JavaScript: Master Array Methods for Data Manipulation

- 24.06.26 - ErcanOPAK comment on JavaScript: Master Array Methods for Data Manipulation

๐Ÿ“Š Arrays Are Everywhere Lists of data need manipulation. Array methods filter, map, reduce, sort. Essential for data processing. ๐Ÿ“ Common Array Methods // forEach: Iterate const numbers = [1, 2, 3, 4, 5]; numbers.forEach(n => console.log(n)); // map: Transform each element const doubled = numbers.map(n => n * 2); // [2, 4, 6, 8, […]

Read More
HTML

HTML: Use Anchor Tag for Links and Navigation

- 24.06.26 - ErcanOPAK comment on HTML: Use Anchor Tag for Links and Navigation

๐Ÿ”— Anchor Tag = The Web’s Foundation Links connect the web. <a> tag creates hyperlinks. Internal pages, external sites, email, phone, downloads. ๐Ÿ“ Basic Links <!– External link –> <a href=”https://example.com”>Example Website</a> <!– Internal link –> <a href=”/about”>About Us</a> <!– Link to section (anchor) –> <a href=”#section1″>Go to Section 1</a> <!– Email link –> <a […]

Read More
CSS

CSS: Use Gradients for Beautiful Backgrounds

- 24.06.26 - ErcanOPAK comment on CSS: Use Gradients for Beautiful Backgrounds

๐ŸŒˆ Solid Colors Are Boring Gradients add depth and visual interest. CSS gradients are easy, fast, no images needed. ๐Ÿ“ Gradient Types /* Linear Gradient */ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(to right, #f093fb, #f5576c); background: linear-gradient(180deg, #4facfe, #00f2fe); /* Radial Gradient */ background: radial-gradient(circle, #ff6b6b, #ee5a6f); background: radial-gradient(ellipse, #56ab2f, #a8e063); /* Conic […]

Read More
Windows

Windows 11: Use Windows Terminal for Multiple Command Line Tabs

- 24.06.26 - ErcanOPAK comment on Windows 11: Use Windows Terminal for Multiple Command Line Tabs

๐Ÿ–ฅ๏ธ PowerShell, CMD, WSL โ€” One Window Multiple terminal windows clutter taskbar. Windows Terminal has tabs. PowerShell, CMD, WSL, Azure Cloud Shell in one window. โŒจ๏ธ Windows Terminal Shortcuts Ctrl + Shift + T โ†’ New tab Ctrl + Shift + W โ†’ Close tab Ctrl + Tab โ†’ Next tab Ctrl + Shift + […]

Read More
AI

AI Prompt: Analyze Customer Feedback and Reviews

- 24.06.26 - ErcanOPAK comment on AI Prompt: Analyze Customer Feedback and Reviews

๐Ÿ“Š Understand What Customers Really Think Hundreds of reviews, hard to summarize. AI analyzes feedback โ€” sentiment, trends, common issues. Actionable insights. ๐Ÿ“ The Prompt Analyze these customer reviews: [Paste 10-20 reviews here] Provide: 1. Overall Sentiment Summary – Positive percentage – Negative percentage – Neutral percentage – Overall score (1-5) 2. Key Themes (Top […]

Read More
Docker

Docker: Use Environment Variables for Configuration

- 24.06.26 - ErcanOPAK comment on Docker: Use Environment Variables for Configuration

๐Ÿ”ง Configure Containers with Environment Variables Hardcoded config in image is bad. Environment variables configure containers at runtime. Change without rebuild. ๐Ÿ“ Setting Environment Variables # Docker run docker run -e DB_HOST=postgres -e DB_USER=admin myapp # Dockerfile ENV DB_HOST=postgres ENV DB_USER=admin # Using .env file docker run –env-file .env myapp # Docker Compose services: app: […]

Read More
Kubernetes

Kubernetes: Use StorageClasses for Dynamic Volume Provisioning

- 24.06.26 - ErcanOPAK comment on Kubernetes: Use StorageClasses for Dynamic Volume Provisioning

๐Ÿ’พ StorageClasses Create Volumes Automatically Manual volume creation is tedious. StorageClasses provision volumes dynamically. Specify storage type, size, performance. ๐Ÿ“ StorageClass Examples apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-ssd provisioner: kubernetes.io/aws-ebs parameters: type: gp3 encrypted: “true” iopsPerGB: “50” allowVolumeExpansion: true — apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: standard provisioner: kubernetes.io/aws-ebs parameters: type: gp2 encrypted: “true” […]

Read More
Wordpress

WordPress: Use Query Monitor to Debug Performance Issues

- 24.06.26 - ErcanOPAK comment on WordPress: Use Query Monitor to Debug Performance Issues

๐Ÿž Debug Slow Queries and Performance Site slow? Query Monitor shows database queries, hooks, memory usage, page speed. Essential debugging plugin. ๐Ÿ“ What Query Monitor Shows Install: Plugins โ†’ Add New โ†’ Query Monitor Dashboard shows: – Database Queries (count + time) – Page Generation Time – Memory Usage – Hook execution – HTTP API […]

Read More
Photoshop

Photoshop: Use Adjustment Layers for Non-Destructive Editing

- 24.06.26 - ErcanOPAK comment on Photoshop: Use Adjustment Layers for Non-Destructive Editing

๐ŸŽจ Edit Colors Without Destroying Pixels Direct color changes are permanent. Adjustment Layers are non-destructive. Toggle on/off, change settings anytime. ๐Ÿ“ Common Adjustment Layers Levels: – Adjust shadows, midtones, highlights – Fix underexposed images Curves: – Precise tonal control – Professional color grading Hue/Saturation: – Change color cast – Boost vibrance – Recolor specific ranges […]

Read More
Visual Studio

Visual Studio: Use Find in Files to Search Across Entire Solution

- 24.06.26 - ErcanOPAK comment on Visual Studio: Use Find in Files to Search Across Entire Solution

๐Ÿ” Ctrl + Shift + F โ€” Search Everything Ctrl+F searches current file. Ctrl+Shift+F searches entire solution. Find references, TODO comments, API usage across all files. ๐Ÿ”ง Find in Files Ctrl + Shift + F โ†’ Open Find in Files Search options: – Current Document – Current Project – Entire Solution – All Open Documents […]

Read More
C#

C#: Use try-catch-finally for Robust Error Handling

- 21.06.26 - ErcanOPAK comment on C#: Use try-catch-finally for Robust Error Handling

โš ๏ธ Handle Errors Gracefully Exceptions happen. try-catch-finally handles them. Prevent crashes, log errors, clean up resources. ๐Ÿ“ Basic Exception Handling try { // Code that might throw int result = 10 / 0; // DivideByZeroException } catch (DivideByZeroException ex) { Console.WriteLine(“Cannot divide by zero: ” + ex.Message); } catch (Exception ex) { Console.WriteLine(“General error: ” […]

Read More
C#

C#: Use Inheritance for Code Reuse

- 21.06.26 - ErcanOPAK comment on C#: Use Inheritance for Code Reuse

๐Ÿ“ฆ Inheritance = Is-A Relationship Duplicate code is bad. Inheritance reuses code. Child inherits from parent. Shared behavior, overridden methods. ๐Ÿ“ Inheritance Example public class Animal { public string Name { get; set; } public void Eat() { Console.WriteLine($”{Name} is eating”); } public void Sleep() { Console.WriteLine($”{Name} is sleeping”); } } public class Dog : […]

Read More
SQL

SQL: Use DELETE to Remove Data from Tables

- 21.06.26 - ErcanOPAK comment on SQL: Use DELETE to Remove Data from Tables

๐Ÿ—‘๏ธ DELETE = Remove Rows Data needs removal. DELETE removes rows. Be careful โ€” without WHERE, deletes all rows. Use transactions. ๐Ÿ“ Basic DELETE — Delete specific row DELETE FROM users WHERE id = 123; — Delete multiple rows DELETE FROM users WHERE status = ‘inactive’; — Delete all rows (careful!) DELETE FROM users; — […]

Read More
Asp.Net Core

.NET Core: Use Authorization for Access Control

- 21.06.26 - ErcanOPAK comment on .NET Core: Use Authorization for Access Control

๐Ÿ” Authorization = Who Can Access Authentication identifies users. Authorization controls access. Roles, policies, permissions โ€” fine-grained control. ๐Ÿ“ Role-Based Authorization [Authorize(Roles = “Admin”)] public class AdminController : Controller { public IActionResult Dashboard() { } } [Authorize(Roles = “Admin,Manager”)] public IActionResult Reports() { } // In Program.cs builder.Services.AddAuthorization(options => { options.AddPolicy(“AdminOnly”, policy => policy.RequireRole(“Admin”)); }); […]

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

Posts pagination

« Previous 1 … 11 12 13 14 15 … 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 (899)
  • 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 (899)
  • 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