Author: martyn

  • WordPress Syntax Highlighting

    WordPress Syntax Highlighting

    Syntax highlighting is the art of formatting text. For a coding blog like this it is formatting “code” to be presentable in a common style where characters are spaced evenly and the notable keywords of the language are highlighted.

    WordPress has a basic builtin Code block and also many available plugins.

    This post will concentrate on the following

    • Code – builtin style
    • SyntaxHighlighter Evolved – a plugin
    • Code Block Pro – a plugin

    To demonstrate I have used the same piece of VB code “Dim iLoop As Integer”

    The following screen shots show the differentpresentations

    Code – BuiltIn

    Code builtin code formatter

    A simple no frills output with basic spacing.

    Syntax Highlighter Evolved – a plugin

    Syntaxhighlighter Pro , plugin formatter

    A slightly better view where the keywords are highlighted.

    Code Block Pro – a plugin

    Code Block Pro, plugin formatter

    Now we have keyword highlighting plus the language and an option to copy the code snippet.

    In my view, Code Block Pro is going to meet my needs for this blog.

    Getting Access to the Syntax Highlighters

    Code – BuiltIn

    Dim iLoop As integer

    SyntaxHighlighter Evolved – Plugin

    Dim iLoop As Integer
    
    Syntax Highlighter Evolved menu options

    Code Block Pro

    Selecting Code Pro from the block picker

    Another highlighter I found was Code Block Pro, which gives a lot more flexibility and also provides the ability to copy the code.

    VB
    Dim iLoop As Integer

    Code Block Pro offers a wide variety of options

    Code Block Pro menu options

    Quick Shortcuts

    Using the mouse and keyboard for picking the block type can be slow, to improve the speed of creating your post consider getting to know a few key shortcuts.

    When editing a post, type “/” and then start typing the name of the block type and then press “enter” eg

    Examples
    /title
    /heading
    /paragraph
    /code

    Note, you do not need to type the full text, for example you can type “/hea” + enter. This will place you inside a heading block.

    Use shortcuts to speed up post editing

    Get to know which blocks you are using and then start trying the shortcuts, you will soon be creating posts in minutes.

  • To Chat or Not To Chat

    To Chat or Not To Chat

    Today, we see the term AI (Artificial Intelligence) all over the place.

    What AI am I using

    • Kodee (Hostinger AI)
    • ChatGPT (Open AI Free version)

    Kodee

    Kodee is the AI assistant hosted within the Hostinger hPanel. It is a helpful tool geared towards helping you with your hosting setup.

    ChatGPT

    ChatGPT is the OpenAI assistant. I use ChatGPT daily for my regular work ranging from coding queries, research queries and idea generation.

    I find ChatGPT to be a powerful tool. However, like all AI tools you need to know the results are correct.

    There are many different AI assistants geared towards generating code, and they do a great job, but do not accept the code “as is”, you need to ensure it is doing what you require and sensitive data is secured.

    How to Use AI

    Normally, when using AI you will be prompted with a prompt. For the very first prompt I will normally prime the query with a set of keywords to give the query some context eg

    .NET Core, Blazor, Auth, Google. I would like to integrate my web solution with Google Login

    This helps the engine provide a relevant answer.

    Sometimes these answers “hollucinate”, which means they provide an answer that looks legitimate, however, it may be that the feature is not supported on that system or the system keyword does not exist.

    Once the AI provides an answer, it will present a prompt for your next question or proposal. You can ask for more information or ask for the answer to be refined, you do not need to repeat anything already entered.

    Repeat until you have the required answer.

    What’s the problem?

    The different AI engines are not created equally, some by default will be super encouraging and others may be a bit more brutal.

    Brutal >>>>>>> High Praise

    Grok – ChatGpt – Gemini

    The AI engines that offer praise tend to come out with phrases like

    • That’s a great idea…
    • You’ve got this…

    The engine will try to be helpful and not offend, so try adding some requirements to the prompt

    Amazing stuff have fun with it..

  • Getting Started with a VPS

    Ok, so I decided to use a VPS for my solution. To get up and running with a website we at least need to provision the following

    • Domain
    • Hosting

    Once we have those we can

    • Map Domain to Hosting
    • Setup Our VPS
      • Choose Operating System
      • Firewall
      • SSH Key

    Domain

    For a domain I went to 123Reg, I have used them before, there are plenty of domain providers out there.

    Why a Separate Domain

    Having a separate domain gives us the option to move our hosting to a new provider.

    This way we can have multiple hosts, and with a simple DNS change which host is providing the service.

    If the domain is purchased with the host from the same provider, sometimes moving the domain becomes difficult and may include an exit\transfer fee.

    Hosting

    For hosting I chose Hostinger, with a reasonable price and specification. Hostinger are a well established organisation with global reach and a good reputation.

    The package I chose was KVM 2.

    Why a VPS

    Virtual Private Server (VPS) is like having your very own server in the cloud. You have the choice of operating systems and the ability to configure it however you choose.

    With the choice comes a learning curve, compromise and troubleshooting.

    Managed Service, this is a valid option and is a good start if all you want to do is setup wordpress. No diving in to the operating system, it just works. Again with a bit of learning and a few plugins, this provides a way for many to get started.

    Point Domain to Hosting

    Ok, now we are setup, but wait how do we get the domain to point to our hosting?

    This is performed by setting up the NameServers.

    To do…

    First Steps

  • 10k Online Side Hustle

    We’ve heard it a million times “escape the rat race with a side hussle…10k a day”… etc.

    In reality how easy it? I’ve been in IT and Software Development for decades, so I should be perfectly suited to create an online side hussle.

    It is quite incredible working in IT, just how many professionals do not have a website or means of demonstrating their accomplishments or abilities.

    When people ask me, “how would you start today?”, the answer is generally “Create a website, solve a problem and present it.”, with the potential that this will at least get you to an interview. So, in some regards I am putting my money where my mouth is.

    What this blog is not:

    • Get rich quick

    What this blog is:

    • A journey into setting up the means to generate a second income by creating an online application or solution
    • Documenting the ups and downs

    The idea is to start small with a narrow scope of requirements and features.

    Initially, I was inspired by reading the blog for https://blog.healthchecks.io/ a site for monitoring system health check pings.

    Tech Stack

    • Backend: .NET API
    • Frontend: Blazor
    • Database: MariaDB/MySQL/Postgres
    • Infrastructure: Ubuntu VPS
    • Docs \ Notes: WordPress

    Did you know WordPress powers 43% of all websites.

    https://www.wpzoom.com/blog/wordpress-statistics

    VPS (Virtual Private Server)

    I chose to host my solution on a VPS, because it will give me a lot of flexibility, a push to learn more by deploying to a Linux box and possibly deploying from Github in a CD\CI pipeline. That is currently in the future but more than achievable.

    Could I have used a managed hosting provider for WordPress? maybe, Managed versus VPS both have there pro and cons as I have found out.

    It all depends on the end goal, WordPress has a vast array of Plugins and an Extensible structure, with some php knowledge you could certainly create something unique.

    Currently

    • Provisioned a VPS
    • Provisioned a Domain
    • Configured the VPS
      • Docker
      • WordPress
      • Traefik
      • Static web site
    • Todo
      • Integrate workflow from Github
      • Create a .NET application
        • Will need to look into this for deployment to Docker

    Next Steps

    • Document the VPS setup including
      • Security
      • Docker
      • Traefik
      • WordPress
    • Git integration

    That’s the start, more to follow…