Random snippets of all sorts of code, mixed with a selection of help and advice.
How can I define and reference variables in flake.nix inputs?
19 March 2026 @ 7:13 pm
Consider a flake used in a home-manager configuration where I specify a release version (25.11) three times:
{
description = "Home Manager configuration";
inputs = {
# Specify the sources of Nixpkgs and Home Manager .
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-25.11"; # first time
};
home-manager = {
url = "github:nix-community/home-manager/release-25.11"; # second time
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = builtins.currentSystem;
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations = let
user = builtins.getEnv "USER";
homedir = builtins.getEnv "HOME";
release = "25.11"; # third time
in {
${user} = home-manager.lib.homeManagerConfiguration {
inh
How to configure/debug Python chat application on a production Ubuntu system
19 March 2026 @ 7:12 pm
I have developed an application using Python and Django. As part of a recent update I have added a chat window. This all worked fine on my development system (Windows 11 using runserver) using both InMemoryChannelLayer and RedisChannelLayer. I am now trying to get a test production server configured correctly. The production environment is Ubuntu running under apache2. So far I have installed: channels, daphne, django-redis, and redis-server. I have added this configuration to /etc/systemd/system/daphne.socket
[Unit]
Description=daphne socket
[Socket]
ListenStream=/run/daphne.sock
[Install]
WantedBy=sockets.target
I have added this configuration to /etc/systemd/system/daphne.service
[Unit]
Description=daphne daemon
Requires=daphne.socket
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/home/csrmedical/CSRMedical/medical
ExecStar
Editing SQL view to include description
19 March 2026 @ 7:12 pm
I have created the following view (below) now I need to edit it to include showing the WOTEMPLATEID as the DESCRIPTION:
SELECT WOTEMPLATEID, COUNT(AR) AS Armondale, COUNT(CB) AS [Central Business District], COUNT(DL) AS [Dayton Lane], COUNT(EE) AS [East End], COUNT(GV) AS [German Village], COUNT(EP) AS [Enterprise Park], COUNT(HP)
AS [Highland Park], COUNT(JEF) AS Jefferson, COUNT(LWALD) AS Lindenwald, COUNT(MIL) AS Milikin, COUNT(NL) AS [New London], COUNT(NE) AS [North End], COUNT(PH) AS [Prospect Hill], COUNT(RV) AS Riverview,
COUNT(ROSV) AS Rossville, COUNT(TPGH) AS [Taft Place/Governors Hill], COUNT(WASH) AS Washington
FROM (SELECT WORKORDERID, WOTEMPLATEID, CASE WHEN Mappage = 'Armondale' THEN Mappage END AS AR, CASE WHEN Mappage = 'Central Business District' THEN Mappage END AS CB,
CASE WHEN Mappage = 'Dayton Lane' THEN Mappage END A
Visual Studio Git, pull from remote origin?
19 March 2026 @ 6:55 pm
I'm using Git with Visual Studio (2026). In VS I clone a branch from our DevOps. Let's call this branch "A". Then from branch "A" I make branch "B". So far so good.
Any remote changes to remote origin/A I would like merged into my branch "B". So I went to "Git Changes", clicked the ellipses, selected "Pull From", but the only option is "origin". In this case I assume "origin" is remote/A (which wouldn't exist until I first push)? I'd like to pull from the remote/A.
How do I do this?
I know I can do the following, but it's tedious:
Click the ellipses in Git changes
Choose "Manage Branches"
Expand "remotes/origin"
Right click on the remote branch and "Fetch"
Right click on the remote branch again and choose the option to merge into branch "B"
AI
Counting Binary Palindromic Numbers
19 March 2026 @ 6:53 pm
I'm trying to solve the Leet Code question #3677 (Count Binary Palindromic Numbers) in javascript. The algorithm works correctly, but I keep getting a 'Time Limit Exceeded' error when I submit.
I've tried to optimize it, but doesn't work. My current approach compares the first and last bits of every number up to n, but checking every value bit-by-bit seems to be too slow.
So, is there a way to optimize?
Here's the code:
var countBinaryPalindromes = function(n)
{
if (n === 0) return 1;
else if (n === 1) return 2;
let i, j, amount, numberOfDigits, firstDigit, lastDigit, palindrome;
i = 1;
amount = 1;
while (i <= n)
{
j = 0;
numberOfDigits = Math.floor(Math.log2(i)) + 1;
lastDigit = 1 << (numberOfDigits - 1);
palindrome = true;
while
error: "EldersWidget" requires a provisioning profile with the App Groups feature. Select a provisioning profile in the Signing & Capabilities editor
19 March 2026 @ 6:50 pm
I am new to iOS application code building and archiving. When I try to archive the project using the Xcode@5 task in my Azure DevOps YAML pipeline, I keep getting the same error (shared below). I have already uploaded the required certificates and two provisioning profiles—one for the main Elder app and one for the Elder Widget extension. I verified that the provisioning profiles and the .p12 certificate are valid, but I still encounter the error repeatedly. I am sharing my YAML file and the error logs below. Can someone please help me understand what is causing this issue and how to fix it?
trigger:
- main
pool:
vmImage: 'macOS-latest' # Consider pinning to macOS-15 for consistency
variables:
- group: Weatherzone-iOS
- name: scheme
value: 'Elders'
- name: workspace
value: 'mobile-app-eldersweather-ios/Elders.xcworkspace'
- name: configuration
value: 'Release'
- name: exportPath
value: 'iOS-ipa'
- name: artifactName
value: 'ios_build'
steps:
- t
What is the !! operator after a parameter name in C#?
19 March 2026 @ 6:48 pm
In the .NET Runtime Source Code, on this line, we will see:
public override string Get( string value!! ) {
if ( value.Length == 0 ) {
return string.Empty;
}
// ...
}
The value parameter has two exclamation marks after it.
At first, I thought this may be some C# language feature that I missed related to nullability annotations, until I realized, this is not even valid C# code, and is still compiled in the .NET Runtime.
The !! does not make sense for Visual Studio. I'm using the latest C# language features and does not compile:
It is definitely
It is definitely Why does 'white dot' badge sometimes appear on the taskbar icon?
19 March 2026 @ 5:49 pm
Windows 11: VS Code and extensions always kept updated.
I generally keep the taskbar hidden, but when it is revealed, VS Code's taskbar icon sometimes displays a white dot, as shown in the attached image.
I can't reproduce it on demand - does anyone know what might cause it?
The badge persists until the entire PC is restarted—no action within VS Code clears it (closing the application, restarting VS Code, etc.).


Adapt table size to window [duplicate]
19 March 2026 @ 3:37 pm
I'm new in Pyqt and triing to do something simple.
I have a table in my window where I color some cells. Everything works but I struggle to find a way to adapt the table to the size of the window.
What I want is to have all the cells always visible with no scrollbar and let them expand or reduce depending of the space the table has because the point of what I want to do is to have an overview of all the cells.
Below is a sample of the code I use :
class ProductsTable(QTableWidget):
def __init__(self, table_rows, table_columns):
super().__init__()
self.setDragEnabled(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
self.setAcceptDrops(True)
self.setRowCount(table_rows)
self.setColumnCount(table_columns)
self.viewport().installEventFilter(self)
self.controllers = None
self.verticalScrollBar().setVisible(False)
self.horizontalScrollBar().setVisible(Fal
Java this Keyword used to call other Constructors
19 March 2026 @ 3:05 pm
In class, our teacher showed us this:
The third is a way to call alternate constructors from within a constructor. Use this to call alternate constructors. When you have multiple constructors for a single class, you can use this(arg0, arg1, ...) to call another constructor of your choosing, provided you do so in the first line of your constructor.
class Foo
{
public Foo()
{
this("Some default value for bar");
// Additional code here will be executed
// after the other constructor is done.
}
public Foo(String bar)
{
// Do something with bar
}
// ...
}
However, we didn't get a chance to talk about why one would do this before class ended. I am trying to prepare for Friday lecture, but am not sure I see the need for implementing constructors this way. I suppose that constructor