Install Redis on Ubuntu 20.04

sudo apt install redis-server

Configure Redis

sudo nano /etc/redis/redis.conf

find the line specifying the supervised directive. By default, this line is set to no. However, to manage Redis as a service, set the supervised directive to systemd (Ubuntu’s init system).

Secure Redis

sudo nano /etc/redis/redis.conf

locate the requirepass directive under the SECURITY section and uncomment it (by removing #).Once you have uncommented the line, replace foobared with the password of your choice.

sudo systemctl restart redis.service

References
https://phoenixnap.com/kb/install-redis-on-ubuntu-20-04

Applying Layouts in ASP.NET Core Blazor

Apply a layout to a component

@page "/episodes"
@layout DoctorWhoLayout

<h2>Episodes</h2>

<ul>
    <li>
        <a href="https://www.bbc.co.uk/programmes/p00vfknq">
            <em>The Ribos Operation</em>
        </a>
    </li>
    <li>
        <a href="https://www.bbc.co.uk/programmes/p00vfdsb">
            <em>The Sun Makers</em>
        </a>
    </li>
    <li>
        <a href="https://www.bbc.co.uk/programmes/p00vhc26">
            <em>Nightmare of Eden</em>
        </a>
    </li>
</ul>

Apply a layout to a folder of components

_Imports.razor:

@layout DoctorWhoLayout
...

Apply a default layout to an app

App.razor:

<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>
    <NotFound>
        <p>Sorry, there's nothing at this address.</p>
    </NotFound>
</Router>

Apply a layout to arbitrary content (LayoutView component)

App.razor:

<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>
    <NotFound>
        <LayoutView Layout="@typeof(ErrorLayout)">
            <h1>Page not found</h1>
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
</Router>

References
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/layouts?view=aspnetcore-6.0#apply-a-layout
https://blazor-university.com/layouts/using-layouts/

Navigate from One Component to another Component in ASP.NET Core Blazor

Navigating from link

<h3>Anchor Link</h3>
<p>
    <a href="/navigate1">Navigate 1</a><br />
</p>

<h3>Nav Link</h3>
<p>
    <NavLink href="/navigate2">Navigate 2</NavLink><br />
</p>

Navigate from code

@page "/page1"
@inject NavigationManager UriHelper

<h3>Naviagte to another component Programatically</h3>
<button @onclick=@Navigate>Navigate</button>


@code {
void Navigate()
{
    UriHelper.NavigateTo("page2");
}
}

References
https://www.syncfusion.com/faq/blazor/routing/how-do-you-navigate-from-one-component-to-another-component-in-asp-net-core-blazor

Built-in Event Arguments in ASP.NET Core Blazor

@page "/event-handler-example-3"

@for (var i = 0; i < 4; i++)
{
    <p>
        <button @onclick="ReportPointerLocation">
            Where's my mouse pointer for this button?
        </button>
    </p>
}

<p>@mousePointerMessage</p>

@code {
    private string? mousePointerMessage;

    private void ReportPointerLocation(MouseEventArgs e)
    {
        mousePointerMessage = $"Mouse coordinates: {e.ScreenX}:{e.ScreenY}";
    }
}

References
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/event-handling#built-in-event-arguments

Event Handling in ASP.NET Core Blazor

<button @onclick="() => { counter += 1; }">Button1</button>
<button @onclick="Increment1">Button2</button>
<button @onclick="Increment2">Button2</button>

<div>
    <span>Count : </span>
    <span>@counter</span>
</div>

@code
{
    private int counter = 0;

    private void Increment1()
    {
        counter += 1;
    }

    private async Task Increment2()
    {
        await Task.Delay(1000);
        counter += 1;
    }
}

References
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/event-handling

Data Binding in ASP.NET Core Blazor

<p>
    <input @bind="inputValue" />
</p>

<p>@inputValue</p>

@code {
    private string? inputValue;
}

Equivalent HTML binding

<p>
    <label>
        Normal Blazor binding: 
        <input @bind="InputValue" />
    </label>
</p>

<p>
    <label>
        Demonstration of equivalent HTML binding: 
        <input value="@InputValue"
            @onchange="@((ChangeEventArgs __e) => InputValue = __e?.Value?.ToString())" />
    </label>
</p>

<p>
    <code>InputValue</code>: @InputValue
</p>

@code {
    private string? InputValue { get; set; }
}

Bind a property or field on other Document Object Model (DOM) events

@page "/bind-event"

<p>
    <input @bind="InputValue" @bind:event="oninput" />
</p>

<p>
    <code>InputValue</code>: @InputValue
</p>

@code {
    private string? InputValue { get; set; }
}

References
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/data-binding

Install NVIDIA 340.108 Driver on Ubuntu

Install NVIDIA proprietary drivers on Debian / Ubuntu / Linux Mint / LMDE and disable the nouveau driver

Make sure that you system is up-to-date and you are running latest kernel, also make sure that you don’t have any Debian / Ubuntu / Linux Mint / LMDE NVIDIA package installed

## Ubuntu / Debian / Linux Mint / LMDE ##
apt update

apt upgrade

## Debian and Linux Mint ##
apt autoremove $(dpkg -l nvidia-driver* |grep ii |awk '{print $2}')

## Ubuntu ##
apt autoremove $(dpkg -l xserver-xorg-video-nvidia* |grep ii |awk '{print $2}')

apt reinstall xserver-xorg-video-nouveau

Install needed dependencies

## Ubuntu / Debian / Linux Mint ##
apt install linux-headers-$(uname -r) gcc make acpid dkms libglvnd-core-dev libglvnd0 libglvnd-dev dracut wget patch libgtk2.0-0

Disable nouveau

Create or edit /etc/modprobe.d/blacklist.conf

Append ‘blacklist nouveau’

echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf

Edit /etc/default/grub

Append ‘rd.driver.blacklist=nouveau’ to end of ‘GRUB_CMDLINE_LINUX=”…”‘.

## Example row on Debian ##
GRUB_CMDLINE_LINUX_DEFAULT="quiet rd.driver.blacklist=nouveau"

## OR with Ubuntu and Linux Mint ##
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rd.driver.blacklist=nouveau"

Update grub2 conf

## BIOS and UEFI ##
update-grub2

Generate initramfs

## Backup old initramfs nouveau image ##
mv /boot/initrd.img-$(uname -r) /boot/initrd.img-$(uname -r)-nouveau
 
## Generate new initramfs image ##
dracut -q /boot/initrd.img-$(uname -r) $(uname -r)

Create new directory for inttf NVIDIA patcher

cd ~
mkdir NVIDIA
cd NVIDIA

Download / Update inttf NVIDIA patcher

wget -O inttf-nvidia-patcher.sh https://nvidia.if-not-true-then-false.com/patcher/inttf-nvidia-patcher.sh

Make inttf NVIDIA patcher executable

chmod +x inttf-nvidia-patcher.sh

Download and patch your drivers

./inttf-nvidia-patcher.sh -v 340.108

Reboot to runlevel 3

systemctl set-default multi-user.target

reboot

Run NVIDIA Binary

./NVIDIA-Linux-x86_64-340.108-patched-kernel-5.15.run
systemctl set-default graphical.target

reboot

References
https://www.if-not-true-then-false.com/2021/debian-ubuntu-linux-mint-nvidia-guide/
https://www.if-not-true-then-false.com/2020/inttf-nvidia-patcher/