Passing Parameters in C#

C# MEMORY MANAGEMENT — Part 1 In this article, I want to mention how memory management is done in .NET environment. I will try to keep it simple and… medium.com In this post, I will write about how to pass parameters to the functions in C#. I will give code […]

C# Conditional logic ( switch / if )

Description Americans are odd people: in their buildings, the first floor is actually the ground floor and there is no 13th floor (due to superstition). Write a function that given a floor in the american system returns the floor in the european system. With the 1st floor being replaced by […]

ASP.NET DbContext setup

Will look somethng like appsettings.json “ConnectionStrings”: { “DefaultConnection”: “Server=(localdb)\\mssqllocaldb;Database=aspnet-database;Trusted_Connection=True;MultipleActiveResultSets=true”, “BlogsConnection”: “Server=(localdb)\\mssqllocaldb;Database=BlogsDb” }, “Logging”: { “IncludeScopes”: false, “LogLevel”: { “Default”: “Warning” } } BlogsDbContext.json public class BlogsDbContext : DbContext { public DbSet Blogs { get; set; } public DbSet Posts { get; set; } public BlogsDbContext(DbContextOptions options) : base(options) { } […]

Installing dotnet ef tool

Global tools can be installed in the default directory or in a specific location. The default directories are: Linux/macOS —> $HOME/.dotnet/tools Windows —> %USERPROFILE%\.dotnet\tools If you’re trying to run a global tool, check that the PATH environment variable on your machine contains the path where you installed the global tool […]

WordPress API Register routes

Will set up a Rest API endpoint that will give all our posts Reference guide: wordpress link It will be a 2 step process 1. Register Route add_action( ‘rest_api_init’, function() { register_rest_route( ‘myplugin/v1’, ‘/author/(?P\d+)’, array( ‘methods’ => ‘GET’, ‘callback’ => ‘my_awesome_func’, ) ); register_rest_route( ‘myplugin/v1’, ‘/allposts’, array( ‘methods’ => ‘GET’, […]

Linux run scripts on startup

Good material https://www.baeldung.com/linux/run-script-on-startup https://www.baeldung.com/linux/systemd-multiple-parameters https://operavps.com/docs/run-command-after-boot-in-linux/ Running commands in a subshell #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will “exit 0” on success or any other # value on error. # # In order […]

Umbraco Models builder – Generating models to the project source control

// .csproj add <PropertyGroup> <TargetFramework>net7.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> <CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory> </PropertyGroup>   // appsettings add “CMS”: { “ModelsBuilder”: { “ModelsMode”: “SourceCodeAuto”, // additional optional fields “ModelsNamespace”: “Umbraco.Cms.Web.Common.PublishedModels”, “FlagOutOfDateModels”: false, // /a o f “ModelsDirectory”: “~/Models/ModelsBuilder/”, “AcceptUnsafeModelsDirectory”: true, “DebugLevel”: 1 }, More on Linux Dotnet material https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-7.0&tabs=linux-ubuntu

Dotnet – store and publish project

 ON THIS PAGE WHERE TO STORE AND PUBLISH WHATEVER COMES OUT OF MY PROJECT? GITHUBRELEASEMANAGER .NET CORE DOTNET PUBLISH PACKING GITHUB RELEASE My latest project is supposed to be public and that was a new requirement for me. Where to store and publish whatever comes out of my project? I […]

Set up a WordPress Test Site in 60 seconds using Bash Script

Good Example https://ayeshalshukri.co.uk/category/guides/bash-shell-script-for-deploying-your-web-app/ Contents Apache2 configuration Creating the MYSQL database Gitlab deploy keys SSL certificate SSH account Git init WP CLI Htpassword Displaying summary Bash script to set up the WordPress test page FPM config Apache virtualhost Creating a new test site Bash wizard Alternatives   Have you ever struggled […]