Random snippets of all sorts of code, mixed with a selection of help and advice.
Email confirmation after a successful registration - with a 6-digits code, not a link
7 March 2026 @ 11:35 am
Several months ago, I developed a student project (ASP.NET 8 + React + SQL Server) similar to booking.com (much more simplified, of course!), with the difference that accommodations that are NOT accessible to people with disabilities cannot be added. In its initial version, I plan for it to be purely informational, but to include ratings, comments, and favorites. Later on, if I see potential, I will also add booking functionality. I want to resume working on it and turn it into a fully real / professional website.
At this stage, I am using cookie-based authentication + ASP.NET Identity for authentication. After implementing the Register functionality, I now want to add email confirmation after a successful registration. I know that Identity provides a built-in method for this, which generates a token and sends it as a link, but I notice that similar websites send short codes rather than links.
I read that I could do this — options.Tokens.EmailConfirmationTokenP
How does GridDB handle time-series data compression, and what are best practices for optimizing query performance on large time-series collections?
7 March 2026 @ 11:34 am
I'm using GridDB Cloud to store IoT sensor data in a TimeSeries container. I've noticed that as the dataset grows (currently ~10 million rows), range queries using SELECT * FROM sensor_data WHERE timestamp BETWEEN ? AND ? are slowing down noticeably.
I've read the docs on TimeSeries containers and understand GridDB uses internal compression, but I have a few specific questions:
Does GridDB automatically apply row compression on TimeSeries containers, or does it need to be explicitly configured at container creation?
Is there a recommended partition key or index strategy for time-range queries at scale?
Are there query hints or TQL-specific optimizations analogous to SQL EXPLAIN that can help diagnose slow queries?
My container was created with the following definition:
{
"container_name": "sensor_data",
"container_type": "TIME_SERIES",
"columns": [
{"name": "t
How can I host a Jupyter Notebook (.ipynb)
7 March 2026 @ 11:20 am
How can I host a Jupyter Notebook (.ipynb) file online so others can easily access, view, and run it? I'm looking for simple platforms or methods that allow sharing notebooks publicly without requiring users to install anything locally.
Unable to loacte model [closed]
7 March 2026 @ 11:06 am
(Huggingface) D:\GenAI\Huggingface>python test.py modules.json: 100%|████████████████████████████████████████████████████████| 349/349 [00:00<?, ?B/s] config_sentence_transformers.json: 100%|███████████████████████████████████| 116/116 [00:00<?, ?B/s] Traceback (most recent call last): File "D:\GenAI\Huggingface\test.py", line 4, in <module> model = SentenceTransformer("all-MiniLM-L6-v2") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bkuma\.virtualenvs\Huggingface-joIztoVZ\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 318, in _init_ and self._get_model_type( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bkuma\.virtualenvs\Huggingface-joIztoVZ\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 2512,
WSL takes ~30 minutes to start and Kali Linux installation fails with 0x80370114 on Windows 11 [closed]
7 March 2026 @ 10:59 am
I am trying to install Kali Linux using Windows Subsystem for Linux (WSL2), but I am facing multiple issues.
Problem
When I run any WSL command, it takes around 20–30 minutes to start before anything happens.
Installing Kali Linux fails with the following error:
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370114
Error: 0x80370114 The operation could not be started because a required feature is not installed.
Press any key to continue...
System Information
OS: Windows 11 Pro
Version: 25H2
OS Build: 26200.6584
Hardware:
CPU: Intel Core i5-7500
RAM: 16 GB
SSD: 512 GB
WSL Status
PS C:\WINDOWS\system32> wsl --status
Default Distribution: Ubu
How to insert bulk records efficiently into a GridDB TimeSeries container?
7 March 2026 @ 10:58 am
I am experimenting with GridDB Cloud and storing time-series sensor data.
Currently I am inserting records one by one into a TimeSeries container, like this (Java example):
TimeSeries<Row> ts = store.getTimeSeries("sensorData");
Row row = ts.createRow();
row.setTimestamp(0, new Date());
row.setDouble(1, 23.5);
ts.put(row);
This works correctly, but when inserting thousands of records the performance becomes quite slow.
My use case is storing IoT sensor readings where data arrives in batches.
Questions:
Is there a recommended way to batch insert multiple rows into a TimeSeries container?
Does GridDB support any kind of bulk loading or transaction-based insertion for better performance?
Are there best practices for handling large volumes of time-series data?
I checked the documentation but could not find a clear ex
Getting TemplateDoesNotExist for an included template that already exists
7 March 2026 @ 10:54 am
I have these template settings in the realestate/settings.py:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
And this template partial that includes another template partial from different folder.
templates\partials\listings\detail\user_card.html:
{% load static %}
{# Card #}
<div class="card mb-3">
<div class="row
Is there a way to get a ref struct property using reflection?
7 March 2026 @ 10:40 am
Let's use System.Text.RegularExpressions.Match as an example. It has the ref struct member ReadOnlySpan<char> ValueSpan.
Using reflection the usual way won't work, since ref struct members cannot be boxed (turned into System.Object).
Match match = new Regex("\\d+").Match("testing 123"); // Create test data
PropertyInfo[] props = match.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
var values = props.Select(s => (s.Name, s.GetValue(match, null))).ToArray();
If you try to run the code above the program will exit with System.NotSupportedException. When PropertyInfo.GetValue(object? obj, object?[]? index) is called with the PropertyInfo for Match.ValueSpan, the exception gets triggered.
What I'm trying to build is an object inspector that can view objects' fields and properties. Ideally there would be a way to cal
Why does reading offsetTop / offsetHeight in a throttled scroll handler still trigger forced reflow?
7 March 2026 @ 10:34 am
I'm profiling scroll behavior in Chrome DevTools.
I have a scroll handler that is throttled. Inside the handler I calculate
the scroll progress of the page and toggle some UI elements such as a
"back to top" button.
The function reads several layout-related properties, including scrollTop,
scrollHeight, offsetTop and offsetHeight.
Example:
function percent() {
let scrollTop = document.documentElement.scrollTop || window.pageYOffset;
let totalHeight =
Math.max(
document.body.scrollHeight,
document.documentElement.scrollHeight,
document.body.offsetHeight,
document.documentElement.offsetHeight,
document.body.clientHeight,
document.documentElement.clientHeight
) - document.documentElement.clientHeight;
const el =
document.getElementById("post-comment") ||
document.getElementById("footer");
if (el.offsetTop + el.offsetHeight
PyQt - QTabWidget - Tabtext font when moving tabs
7 March 2026 @ 10:24 am
I have a PyQt application with a QTabWidget. I have changed the font for the tabs with the following code and it works.
tbfont = QFont('Verdana', 12)
self.tabWidget.setFont(tbfont)
I have now set the tabs as movable with the option below
self.tabWidget.setMovable(True)
I have a strange behavior now that when I move the tabs, the tab text reverts to another font. Once it has moved to a new position, the above font changes are applied. I could not figure out how to make the tab retain the font changes. Applying the same font to the tabBar did not help.
self.tabWidget.tabBar().setFont(tbfont)
A workaround is setting the application font as the same as tbfont. But this does not allow me to change tbfont later. Does anyone have an idea how to do this?