Posts

Showing posts from May, 2026

Zig

Zig When to Choose Zig   Performance Focused:  Focused in not using anything on your computer that might be not needed.   Systems Programming: Perfect for operating systems, kernels, and embedded microcontrollers.   No Garbage Collection: Gives you precise control over exactly when memory is allocated and freed.   Predictable Performance: Guarantees no hidden control flow, no macros, and no hidden allocations.   Ultra-lightweight Binaries: Generates tiny standalone executables that do not require a heavy virtual machine or runtime environment.   Compile-time Metaprogramming: Executes regular code at compile time via its innovative comptime keyword.    C Interoperability And Zig As Replacement to C: Functions natively as a seamless C/C++ compiler with zero-overhead foreign function interfaces.   Lack of Dependencies: No LLVM dependency    All Memory Usage Is Pre-Allocated and Explicit     Eliminates notorious C ...

DB First - Code Gen

DB First Code Generation 1. Generate Models from the DB at the Package Manager Console: Scaffold-DbContext "YourConnectionStringHere" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=MyDatabase;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models or this at command line:  dotnet ef dbcontext scaffold XXXXXXXXXXXXXXXXXXX Parameters: -Tables  // Allows explicit list of specific tables to scaffold 2. Generate the Full CRUD Controller & Views: dotnet scaffold controller -name ProductsController -m ProductModel -dc MyDbContext --relativeFolderPath Controllers --useDefaultLayout // a) API Controller with Actions, using EF dotnet scaffold controller -name ProductsController -api -async -m Product -dc MyDbContext -outDir Controllers // Key Flags: Requires -api (to skip HTML views), -m [ModelName], and -dc [DbContextName]. Adding -async creates asynchronous task-based metho...

OOP

 OOP 1) Abstraction: H id es complexity (ex: volume button on remote) 2) Encapsulation: H id e and secur e data Types:   member variable (hide state; ex: private or protected), function (hide behavior steps, ex: expression-bodied method ), class (hide domain responsibility, ex: internal) 3) Polymorphism: EX: man = father, husband, and employee 4) Inheritance

AI: The Ralph Loop

AI: The Ralph Loop "Ralph Loop" (or Ralph Wiggum Loop) is an architectural pattern where an AI coding agent is wrapped in an infinite while loop to execute tasks autonomously over long periods.   How a "Ralph Loop" Works Task: You feed the loop a structured backlog, like a local Product Requirements Document (prd.json) or a checklist. Fresh Instance: The loop spawns a brand-new AI agent session (using tools like Claude Code or Gemini CLI) with a clean context window. Execution & Memory: The agent reads the checklist, picks the highest-priority task, edits the code, and runs your compiler, linter, or test suite. Stop Hook Intercept: When the AI attempts to exit, a custom script or hook intercepts it and verifies if the code compiled and if tests passed. Next Iteration: If the task failed, the script launches a fresh agent instance. Because the previous agent modified files and left notes on disk, the new agent picks up right where the last one left off. The loo...

AI Dev Process Tools

AI Dev Process Tools https://pi.dev/ https://fallow.tools/ <= deterministic finding of coding issues. deterministic =================================================== SQL (prefer Dapper and parameterized SQL) =================================================== https://github.com/bmad-code-org/bmad-method ===================================================   openclaw simon Crop - verify library at: https://github.com/VerifyTests/Verify SlopWatch - detect reward hacking behavior https://github.com/Aaronontheweb/dotnet-slopwatch Opus 4.6 & Sonnet 4.6 Copilot OpenCode Claude Code Codex 5.3 model for debugging Qwen2.5 27B llama.cpp local. tmux - Terminal multiplexer suo apt install -y tmux Ralph LLM loop Akka.NET (should use immutable record types when deal with actor messages) StirTrek, May 1 in Ohio NDC Copenhagen in June

AI Commands

 AI Commands AI commands are commands run in the AI coding tool that start with slash \ or "at" @.  Common  AI commands in AI Coding Tools (GitHub Copilot, Cursor, VS Code) are: /explain : Analyzes the selected code block and explains its logic in plain English. /fix : Scans the selected code for bugs, errors, or security vulnerabilities and proposes a corrected version. /tests : Automatically generates unit tests for the active function or class. /docs : Generates standardized documentation comments (like JSDoc or Docstrings) for a piece of code. @workspace : Tells the AI to look at the entire project repository for context, rather than just the active file. @file:index.js : Pinpoints a specific file in the project to include in the AI's prompt context. Slash commands in AI Coding Tools (Claude Code) are : /compact : Compresses a long chat history into a dense summary to save context window tokens. /clear : Wipes the active conversation completely so you can start a bran...

AI Factory Engineering Coding

 AI Factory Engineering Coding AI-assisted Development Video - Michael Perry:  https://www.youtube.com/watch?v=t13OH8TmeRk AI software factories - Michael Perry:         https://factoryengineering.dev/ Factory AI:   https://factory.ai/news/build-with-agents Factory Model:   https://addyosmani.com/blog/factory-model/ AI Playbook:  https://dev.to/truongpx396/building-production-grade-fullstack-products-with-ai-coding-agents-a-practical-playbook-2idd AI-assisted Development Video - Matt Pocock: https://www.youtube.com/watch?v=-QFHIoCo-Ko AI software factories - Matt Pocock:           https://www.aihero.dev/        with  npx skills@latest add mattpocock/skills grill me => to prd => to issues => tdd => improve codebase architecture (should be clean) =>  Roo Code extension is now Cline extension in VS Code Had Roo models fire off Playwright for testing rsync ...

ML Exam Prep: 10 - Key Algorithms

ML Exam Prep Key Algorithms  Common Algorithms: K-Means algorithm = UL . No e vent planning by 1) K = # of K leaders for people to cluster around, 2) each data point finds closest leader, and 3) the leader moves to the Means = math mean (center) of their group. finds hidden or unlabeled patterns.  KNN algorithm = SL. C lassification . finds absolute distance of data point to class of its neighbors. Ex answers : "Apple", "Orange", "Spam", "Not Spam". Label encoding =  City name  ("Dallas", "Paris", "London") to single column of City of (1, 2, 3).  Linear regression algorithm = SL. predicts "best-fit" line of min diff between input and output.  Can be negative. Answer is continuous range.   D isadv: fails with skewed data.  Logistic regression algorithm = SL. C lassification. e stimates % that input is in category by predicting binary outcome of using Logistic function and Log-odds .  Answer is 0 to 1. O...

ML Exam Prep: 9 - Misc

  ML Exam Prep Misc Search Types 1) Lexical search: matches exact words 2) Semantic search: understands concept   3) Contextual search: adapts results using user data or surrounding conversation Deployment   Types Canary = deploy to alpha sites (small subset of users or servers). A/B testing  = concurrent. some goes to new and rest to production. Shadow =  incoming are mirrored or copied and sent to production and new potential. New potential is logged and analyzed on metrics, but *only* answers from production are returned to end-users. Blue/Green = All goes to “blue“ (production). Once "green" (new version) is ready, traffic switched over. Has a safe rollback mechanism and min downtime. No parallel testing of new model.  Hyperparameters Temperature =  chaos\creative of response Top K = is # of tokens. More tokens = more diverse/chaos of responses. Misc Categorical model = classification model. Data Bias & Security Pre-Training Bias Metr...

ML Exam Prep: 8 - Model Fitting and Tuning

ML Exam Prep Model Fitting and Tuning Problems: 1. Overfitting (Model is too complex) The Problem:   Great on training data since memorizes (including its noise and random errors) or  too many training epochs,  instead of patterns.  Terrible on new data. "High Variance" model. If the  loss curve is affected ( validation loss increases, while training loss decreases), it‘s a strong indicator of overfitting. Fix - Simplify the Model: 1) Early Stopping : Halts when validation loss begins to rise. 2) Increase Regularization : Penalizes extreme values; L1 (Lasso) zeroes out weak features, L2 (Ridge) shrinks them. If L1 and all features go to 0, then decrease regularization parameter. 3) Increase Dropout : Randomly shuts off neurons during training. 4) Fewer Feature Combinations : Removes complex or noisy inputs . 5) Data Augmentation : Tweaks existing training samples (e.g., rotating images) to create new variety. 6) Use Cross-Validation : By rotating t...