๐ฆ One .exe, No Runtime Required .NET app needs runtime installed. Native AOT compiles to single native executable. Fast startup, small container size, no .NET on target machine. ๐ง Enable Native AOT <PropertyGroup> <PublishAot>true</PublishAot> </PropertyGroup> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <PublishAot>true</PublishAot> <JsonSerializerIsReflectionEnabledByDefault>false</JsonSerializerIsReflectionEnabledByDefault> <TrimMode>full</TrimMode> </PropertyGroup> โ๏ธ Publish Command # Windows (x64) dotnet publish -c Release -r win-x64 –self-contained -p:PublishAot=true […]
Day: May 28, 2026
C#: Use Span for High-Performance Memory Access Without Allocation
โก Zero-Allocation Slicing Span<T> gives a view into memory without copying. No allocations, no GC pressure. Ideal for parsing, string manipulation, and high-performance scenarios. โ Allocating Substring // Allocates new string (GC pressure) string data = “123,456,789”; string first = data.Substring(0, 3); // New string allocation string second = data.Substring(4, 3); // Another allocation // […]
SQL: Use Partial Indexes to Index Only Relevant Rows
๐ฏ Index Only What You Query Full indexes waste space. Partial indexes index only rows matching a WHERE clause. Smaller, faster, more efficient. ๐ Basic Partial Index — Index only active users (not soft-deleted) CREATE INDEX idx_active_users_email ON users(email) WHERE deleted_at IS NULL; — Query uses this index automatically SELECT * FROM users WHERE email […]
.NET Core: Understanding Middleware Order (It Matters!)
๐ Order of Registration = Order of Execution Wrong middleware order = broken app. Auth before Routing? Exception handling after everything? Order matters dramatically. โ Correct Order (Recommended) var app = builder.Build(); // 1. Exception handling (catch errors from everything) if (app.Environment.IsDevelopment()) app.UseDeveloperExceptionPage(); else app.UseExceptionHandler(“/error”); // 2. Security (run early) app.UseHsts(); app.UseHttpsRedirection(); // 3. Static […]
Git: Use Reflog to Recover Deleted Commits and Branches
๐ฐ๏ธ Git’s Time Machine Accidentally deleted branch? Reset –hard too far? Reflog logs every HEAD change. Rewind time, recover lost work. ๐ View Reflog # View all reflog entries git reflog # Output: # a1b2c3d HEAD@{0}: commit: Add feature # d4e5f6g HEAD@{1}: checkout: moving from main to feature # g7h8i9j HEAD@{2}: reset: moving to HEAD~2 […]
Ajax: Use FormData API for File Uploads Without Libraries
๐ Drag & Drop + Progress Bar, Native No more FormData polyfills. FormData API sends forms + files with fetch. Track upload progress, handle multiple files. ๐ Basic File Upload <input type=”file” id=”fileInput” multiple> <button onclick=”uploadFiles()”>Upload</button> <progress id=”progressBar” value=”0″ max=”100″></progress> async function uploadFiles() { const files = document.getElementById(‘fileInput’).files; const formData = new FormData(); for (let […]
JavaScript: Use Top-Level Await in Modules for Cleaner Async Code
โฐ Async Without Async Function Wrapper Need await at top level? Used to need IIFE. Top-level await works directly in ES modules. Cleaner initialization code. โ Old Way (IIFE) (async () => { const data = await fetch(‘/api/config’); const config = await data.json(); startApp(config); })(); โ Top-Level Await // In .mjs or type=”module” script const […]
HTML: Use Native Dialog Element for Modals Without JavaScript Libraries
๐ฑ Built-in Modal, No Library <dialog> element creates native modals. Accessibility, focus management, backdrop โ all built-in. No more 100KB modal libraries. ๐ Basic Dialog <dialog id=”myDialog”> <h2>Confirm Action</h2> <p>Are you sure you want to delete this item?</p> <form method=”dialog”> <button value=”cancel”>Cancel</button> <button value=”confirm”>Confirm</button> </form> </dialog> <button onclick=”myDialog.showModal()”>Open Modal</button> <script> myDialog.addEventListener(‘close’, () => { console.log(‘Closed […]
CSS: Use :has() Selector to Style Parent Elements Based on Children
๐จโ๐ง Parent Finally Knows About Child CSS couldn’t select parent based on children. Until now. :has() changes everything โ style parent when child exists. โ Before :has() // JavaScript needed if (card.querySelector(‘.badge’)) { card.classList.add(‘has-badge’); } โ With :has() // Pure CSS! .card:has(.badge) { border-left: 4px solid gold; } ๐ฏ Powerful Examples // Style form that […]
Windows 11: Use Focus Sessions to Eliminate Distractions
๐ง Built-In Pomodoro Timer Notifications, taskbar badges, flashing icons โ all distractions. Focus Sessions silence everything, set timers, track productivity. ๐ง Start a Focus Session Method 1: Clock app โ Focus Sessions Method 2: Taskbar clock/calendar โ Focus Method 3: Settings โ System โ Focus Shortcut: Win + N โ Focus โ๏ธ Configure Do Not […]
AI Prompt: Analyze Log Files and Identify Error Patterns
๐ AI Reads Your Logs So You Don’t Have To Thousand lines of logs. One needle in haystack. AI log analysis finds patterns, clusters errors, suggests fixes. ๐ Log Analysis Prompt Analyze these application logs and: 1. Identify the most frequent errors (top 5) 2. Find patterns in timestamps (does error spike at specific times?) […]
Docker: Add Health Checks to Detect Unhealthy Containers
โค๏ธ Is Your Container Actually Working? Container running but app crashed? Health checks test if app is responsive. Automatically restart unhealthy containers. ๐ Dockerfile Healthcheck # Web app HEALTHCHECK –interval=30s –timeout=3s –start-period=5s –retries=3 \ CMD curl -f http://localhost/ || exit 1 # Database HEALTHCHECK –interval=30s –timeout=10s –retries=5 \ CMD pg_isready -U postgres || exit 1 […]
Kubernetes: Use Network Policies to Restrict Pod Communication
๐ Zero Trust for Pods By default, all pods can talk to all pods. That’s a security risk. Network policies define who can talk to whom. ๐ Deny All Ingress apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: deny-all-ingress spec: podSelector: {} # Applies to all pods policyTypes: – Ingress ingress: [] # Empty = deny all […]
WordPress: Create Custom URL Structures with Rewrite Rules
๐ Beautiful URLs for Everything Want /events/2024/summer-festival instead of /?post_type=event&event_id=123? Rewrite rules create clean, SEO-friendly URLs. ๐ Basic Rewrite Rule function add_custom_rewrite_rules() { add_rewrite_rule( ‘^events/([0-9]{4})/([^/]+)/?$’, ‘index.php?post_type=event&year=$matches[1]&event_slug=$matches[2]’, ‘top’ ); } add_action(‘init’, ‘add_custom_rewrite_rules’); // Add query vars function add_query_vars($vars) { $vars[] = ‘year’; $vars[] = ‘event_slug’; return $vars; } add_filter(‘query_vars’, ‘add_query_vars’); // Flush rules after adding (visit […]
Photoshop: Use Adjustment Layers for Non-Destructive Color Correction
๐จ Edit Colors Without Destroying Pixels Direct color changes = permanent. Adjustment layers sit above your image. Toggle on/off, change settings anytime, never lose original. ๐ Levels Adjust shadows, midtones, highlights. Fix underexposed or washed-out images. ๐จ Hue/Saturation Change color cast, boost vibrance, or completely recolor specific ranges. ๐ Curves Precise tonal control. Professional-grade color […]
Visual Studio: Automate Code Formatting with Code Cleanup Profiles
๐งน One Click, Whole File Formatted Remove unused usings, sort imports, fix spacing, apply conventions โ all automatically. Code Cleanup saves hours of manual formatting. ๐ง Set Up Profile Analyze โ Code Cleanup โ Configure Create profiles: – “Full Cleanup”: Remove/sort usings, format document, apply file header – “Quick Fix”: Only remove usings + format […]













