Skip to content

Category: Coding

XRMToolbox – SQL 4 CDS does not open

Had issues getting SQL 4 CDS to open. I tried reinstalling the plugin and the app, and that didn’t work. Finally went to …\AppData\Roaming\MscrmTools\XrmToolBox\Settings and deleted a file there called “MarkMpn.Sql4Cds.xml”. That seemed to have allowed me back in. Looks like it’s a settings file for SQL 4 CDS. After closing XRMToolbox, the file is regenerated.

Do it at your own risk.

Leave a Comment

Small X Studio – AI Image Generation Entirely in Your Browser

I’ve been experimenting with running AI models locally, exploring different ways to make AI more accessible without depending on cloud services or dedicated AI servers.

My latest project, Small X Studio, takes that experimentation in a different direction: running an AI image generation model directly inside a web browser.

I was inspired by this project https://webllm.mlc.ai/ which allows you to chat with an an agent locally.

Small X Studio is a self-hosted text-to-image application built using .NET 10, JavaScript, ONNX Runtime Web, and Stable Diffusion.

Unlike traditional AI image generation applications, where your browser sends requests to a back-end running the AI model, Small X Studio performs the actual image generation locally in the browser.

The .NET application serves the website and model files. Once the browser loads the model, the image generation process happens entirely on your device.

This means:

  • No cloud AI inference service is required.
  • No dedicated GPU server is needed.
  • Prompts and image generation remain local to the browser.
  • The application can take advantage of supported GPU hardware through WebGPU.
  • CPU-based execution is available as a fallback.
  • The entire application can be self-hosted using Docker.

Code: https://github.com/xavier-hernandez/small-x-studio

Demo/Test Website: https://small-studio.xavier.cc/



Leave a Comment

What is my ip address?

Another “what is my ip address” app.

So far I have 2 apps for telling you your IP address.

One can be found here, https://yourip.sh. This is using GO and was forked from ifconfig.io. I wanted to learn GO so I forked that project and made modifications to it.

Such as…

  • Added MaxMind databases
  • Added dark mode
  • Added the ability to add other HTML elements
  • Added integration with plausible analytics

https://github.com/xavier-hernandez/yourip.sh

My other, older, app can be found here https://whatismyip.biz . This app is built in .NET, Blazor client side, running on a Linux server. This is totally custom built.

Both apps above a are docker images that I’ve created as well.

Leave a Comment

MS Dynamics C# retrieving label/name

This is an example of retrieving the label / name of a code instead of writing another function to look it up.

fakecode --> value (int)
fakecode (formatted) --> FormattedValues["fakecode"]

So in C# you can do:

string labelName =  entity.FormattedValues.Contains("fakecode")
? entity.FormattedValues["fakecode"]
: null;

Or

string labelName = entity.FormattedValues.Contains("fakecode")
? entity.FormattedValues["fakecode"].ToEmptyStringIfNull()
: string.Empty;

Leave a Comment

cronicle-x-plus

GitHub: https://github.com/xavier-hernandez/cronicle-x-plus

Docker Image: https://hub.docker.com/r/xavierh/cronicle-x-plus

This docker is based on https://github.com/soulteary/docker-cronicle with some updates. Look there for settings and more info. This was more of a personal repo/image but since it worked and appears to be stable I thought of making it public.

Cronicle was missing a bunch of tools that I wanted. So I added them to the docker image.

Why, because I wanted to 🙂 I tried using different docker containers and calling them from the Cronicle container but it was a headache.

  • updated the docker image to use node:lts-alpine3.22
  • added the following packages
    • bash
    • borgbackup
    • borgmatic
    • mc
    • nano
    • openssh
    • ripgrep
    • rsync
    • wget
Leave a Comment

Upcoming Updates for Azure Pipelines Agents Images – Windows 2019 being deprecated

Upcoming Updates for Azure Pipelines Agents Images

“This deprecation affects Azure DevOps Pipeline customers only if they are using Windows Server 2019 image in a Microsoft Hosted Agent. Please note that it does not impact customers using Windows 2019 in any other Agent (Self-hosted, MDP, VMSS). Refer the guidelines given below to find out the impacted pipelines in your organization. The detailed deprecation plan is outlined below.”

Key Dates:

• Deprecation Start Date: 1st June 2025
• Brownout period: 3rd June 2025 to 24th June 2025
• Full Removal Date: 30th June 2025

Leave a Comment

Azure Pipeline image 20250527.1.0 is missing .NET SDK 9.0.300

I believe this is due to using a .NET Core project using that SDK version. The workaround right now is to add the following task to your pipeline.

For more info: https://developercommunity.visualstudio.com/t/Azure-Pipeline-image-2025052710-is-mis/10913159?sort=newest

Add Task below if using YAML

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '9.0.203'

If using the classic UI
Add task → search “Use .NET Core SDK (UseDotNet@2)”

Update the version to 9.0.203. The YAML should look like this.

This option did not work for me.

“Workaround that worked for me is setting a restore property BuildWithNetFrameworkHostedCompiler to true as documented here.
This configures the build to use a matching version of the MSBuild with the latest SDK version installed. By default a version available with installed VS is being used, creating a mismatch.”

You can also search for…

<Project Sdk="Microsoft.NET.Sdk/9.0.203">

and if found, replace it with…

<Project Sdk="Microsoft.NET.Sdk">
Leave a Comment

CVS file to parquet file, using .net

https://github.com/xavier-hernandez/csv_to_parquet_dotnet

Converts a csv to a parquet file, per the delimiter, in .NET.

Nuget packages used

  • CsvHelper
  • Parquet.Net

This solution which is “as-is” converts a CSV file into a Parquet file. I created this because I could not find anything .NET based or Windows based that I could use to convert a file. ‘

The solution requires an input file, output file, error file, delimiter, and has header (true/false). If the files does not have a header than a fake header is created for the output file. The file is processed under the assumption that all the columns are strings. If an error occurs for a row then that row is written to the error file to be manually looked at. These errors occur sometimes if the row doesn’t match the columns already created by the first row of data.

The only other Windows app I could find was this https://superintendent.app but you need to load all the data then export it.

Further enhancements:

  • I wrote a batch function to process the file faster but the count appears to be off. Not sure why.
  • Performance enhancements. Currently reads and coverts file row by row; which is why I tried doing batches.
  • Better errors handling
  • Except arguments from the console
  • Read from file and do not load file into memory

Note

  • The current solution loads the entire file into memory so be sure you have enough RAM to process the file otherwise your system might become unstable. If your debugging then the memory footprint will be bigger than if you use release.
Leave a Comment

bash script to clean up directories

#!/bin/bash
# Define the directory to search (you can change this to the desired directory)
DIR="/temp"

# Array of file extensions to delete
EXTENSIONS=("*.txt" "*.srt" "*.nzb" "*.sup" "*.ac3" "*.dts" "*.sample.*" "*.srr")

# Counters for deleted files and directories
deleted_files=0
deleted_directories=0

# Loop through the array and delete the files, counting each deletion
for EXT in "${EXTENSIONS[@]}"; do
    count=$(find "$DIR" -type f -name "$EXT" -print -delete | wc -l)
    deleted_files=$((deleted_files + count))
done

# Find and delete empty directories, counting each deletion
count=$(find "$DIR" -type d -empty -print -delete | wc -l)
deleted_directories=$((deleted_directories + count))

# Output the counts
echo "Deleted $deleted_files files with extensions ${EXTENSIONS[*]}."
echo "Deleted $deleted_directories empty directories."

For the most up-to-date version, follow the links below.

https://snippets.cacher.io/snippet/b554e570d8ffc0431ad9

https://gist.github.com/xavier-hernandez/f4979b4ce174068ce5428a26ae08be32

Leave a Comment

tls: failed to verify certificate: x509: certificate signed by unknown authority

In building a docker image for a Go application using the Apline image, I kept getting this error “tls: failed to verify certificate: x509: certificate signed by unknown authority”. I thought it was something with the code I was writing, but it had to do with the docker image.

Adding this to your Dockerfile should fix the problem. The problem is that the docker container doesn’t have the necessary certs to validate the connection. You might also get around this issue by adding the “ca-certificates” package to the image, but I didn’t try that.

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

or (depends on how your building your image)

COPY /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
Leave a Comment

Install dotnet core on Ubuntu 22.04

These are the steps I used to install dotnet core on Ubuntu 22.04, both the SDK and the runtime.

apt update
apt install -y apt-transport-https
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
apt update
apt install -y dotnet-sdk-7.0
apt update
apt install -y aspnetcore-runtime-7.0

To verify installation run the following commands. If the below doesn’t work try to open a new ssh session or terminal.

dotnet --list-runtimes

Microsoft.AspNetCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

dotnet --list-sdks

7.0.102 [/usr/share/dotnet/sdk]
root@srv4311:~# 

If you tried previously to install version 7.0 make sure you remove/purge the old version from the system. Something like below.

apt remove --purge dotnet-sdk-6.0 dotnet-runtime-6.0
apt auto-remove

Also maybe delete the .dotnet folder in your home directory.

Leave a Comment

Finally, put a Spanish wordlist together.

I could finally put a Spanish wordlist together to tie it in with my Wordle Spanish app because the original dictionary I had was not very good and I was getting complaints about some words being used. It was true. I found some words in the original wordlist that were not even Spanish.

So here is the new list that was created with some help from other repos.

https://github.com/xavier-hernandez/spanish-wordlist

Leave a Comment

Getting error An unhandled exception has occurred. See browser dev tools for details.

I deleted all the CSS from site.css and replaced it with mine of course but after that, I started receiving the following error “Getting error An unhandled exception has occurred. See browser dev tools for details. Reload”. It looks like this occurs because blazor needs at least 2 styles to display errors.

Found my answer here.

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

Leave a Comment

PayPal Test Credit Card Numbers

Because I keep losing this content and old pages are coming up with 404s.

More information can be found here: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_guide.pdf

AmountResult
$0 – $1000

RESULT value 0 (Approved)
$1001 – $2000Certain amounts in this range will return specific PayPal results and can be generated by adding $1000 to that RESULT value. For example, for RESULT value 13 (Referral), submit the amount 1013. If the amount is in this range but does not correspond to a PayPal result supported by this testing mechanism, RESULT value 12 (Declined) is returned
$2001+RESULT value 12 (Declined)
Credit Card TypeCredit Card Number
American Express378282246310005
American Express371449635398431
American Express Corporate378734493671000
Australian BankCard5610591081018250
Diners Club30569309025904
Diners Club38520000023237
Discover6011111111111117
Discover6011000990139424
JCB3530111333300000
JCB3566002020360505
MasterCard5555555555554444
MasterCard5105105105105100
Visa4111111111111111
Visa4012888888881881
Visa4222222222222
Note : Even though this number has a different character count than the other test numbers, it is the correct and functional number.
Processor-specific Cards
Dankort (PBS)76009244561
Dankort (PBS)5019717010103742
Switch/Solo (Paymentech)633110199999001
Leave a Comment

.NET and TLS

  • Before .NET 4.6 – TLS 1.1 is default and negotiations start down
  • .NET 4.6 – TLS 1.2 is default and negotiations start down
  • .NET 4.7 – the default value of this property is SecurityProtocolType.SystemDefault. This allows .NET Framework networking APIs based on SslStream (such as FTP, HTTP, and SMTP) to inherit the default security protocols from the operating system or from any custom configurations performed by a system administrator.
Leave a Comment