Random snippets of all sorts of code, mixed with a selection of help and advice.
Need to find the css that controls the input click
22 June 2026 @ 12:46 am
I'm in the middle of styling a drupal theme and I'm having trouble finding the css name that controls the style of input when clicked. This is the image, I'm trying to change the blue/white border when the search input is clicked. I checked all the css files and I can't find any containing :focus
The live version is located here http://drupal.adoreanime.com/
The live version is located here http://drupal.adoreanime.com/SHGetFileInfo on EXE files occasionally incorrectly gives generic app icon system image list index (2), with various flags attempted
21 June 2026 @ 11:32 pm
I have a ListView which displays small icons for files in the Report mode, including EXE files.
The ListView's system image list was first initialized by calling SHGetFileInfo on a dummy filename, and then setting it into the ListView via LVM_SETIMAGELIST with LVSIL_SMALL.
SHFILEINFO sfi;
ZeroMemory(&sfi, sizeof(sfi));
HIMAGELIST hSystemImageList = (HIMAGELIST)SHGetFileInfo(L"NONE",
FILE_ATTRIBUTE_NORMAL,
&sfi,
sizeof(SHFILEINFO),
SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_SMALLICON
);
SendMessage((HWND)hWndListView, LVM_SETIMAGELIST, (WPARAM)LVSIL_SMALL, (LPARAM)hImageList);
When I invoke SHGetFileInfo with SHGFI_SYSICONINDEX and various combinations of SHGFI_ICON and SHGFI_SMALLICON, some EXEs get the correct icon index, but others always get the generic app icon index 2. Various flags and options
How to incorporate a variable in an xlookup formula in Excel VBA coding to pull data from one workbook into a new one
21 June 2026 @ 9:39 pm
I'm trying to integrate a variable into some VBA code. The code is pasted below.
Essentially, what I am trying to do is take an exported data set and transferring the order to run, and a few other pieces of information from one file to another. I have been doing this using an xlookup formula, and want to streamline the process. I have been able to get a pop-up box where I can select the file that will serve as my data source when I update the information, and when I hard code the data source file name into the code, it runs perfectly.
The problem comes when I try to incorporate a variable containing the data sou, except for trying use a variable in place of the "06-11-26 production prioritization" with or without the ".xlsx" file extension. As you can see from the code below, I really am only interested in the value the formula returns, not the formula itself.
Is it worth using a unique pointer for a Huffman Tree
21 June 2026 @ 6:37 pm
I have a file that is a Huffman Tree class. It takes a map of characters to frequencies, and constructs a Huffman Tree using Huffman Coding.
The original design uses raw pointers, but of course deletes them using a destruction function ~ with a delete helper that traverses the tree and deallocates each node.
The next step is to possibly use unique pointers to officiate ownership. But, dealing with the priority queue is so annoying, and the class works as needed for compression (I still have to do decompression).
Is it really worth using unique pointers? What would you do for such a program?
Multi-line editing in a TableView using QComboBox
21 June 2026 @ 6:15 pm
I have a fairly complex model with several “parts” that I'd like to display in a single TreeView. Right now, the people are in one column and the cities are in another column.People and cities are divided into two parts. (This is just an example of a visual division; in reality, both people and cities are part of the same model.)
What I want to do is allow the user to edit this tree as follows:
User select a row in the tree and edit the data in that row. If the user selects multiple rows, I want to allow them to edit those rows. I don’t know how to do this in a more “elegant” way, but right now I’m doing it like this:
#include <QApplication>
#include <QTreeView>
#include <QStandardItemModel>
#include <QComboBox>
#include <QHeaderView>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QPalette lightPalette;
app.setPalette(lightPalette);
QStandardItemModel model(0, 3);
model.setHorizo
Why when I create object, the variable contains a reference to the object, not the object itself?
21 June 2026 @ 6:25 am
Suppose I have A obj = new A(), why the designers of the language designed the language so that obj is reference or a pointer to object? why the language is not designed so that obj is the actual object in memory?
I'm asking about the design choice, I'm questioning the purpose, the 'WHY', not the "WHAT".
I need to see the failure that would happen if we designed the language in other way, can someone give me example please?
Storage Spaces SSD (write cache) tier footprint not increasing during small/big random writes to HDD parity virtual disk
20 June 2026 @ 7:59 pm
I'm trying to build a Storage Spaces array on Windows 11 Pro for Workstations - 8 HDDs (dual parity) and 4 enterprise SAS SSDs intended as a write cache/fast tier.
I've tried two configurations:
1. Tiered pool — SSDs as Auto-Select with a separate SSD mirror tier + HDD parity tier
2. Non-tiered — SSDs set to Usage: Journal with -WriteCacheSize on the virtual disk
In both cases I can't confirm the SSDs are actually being used. I'm testing with small (64KB) random file writes and big files writes, and watching WriteCacheUsedSize and FootprintOnPool on the tiers, but values stay at 0 or don't change.
If I understand it correctly Enable-StorageBusCache and S2D features are Server-only and don't apply here.
Could anyone confirm: which configuration (tiered vs Journal or Both together) actually works for SSD caching on desktop Windows, and what's the correct way to verify its functioning?
Are there any mistakes in how I create it and/or
Web Audio API: play 2-3 sources simultaneously [closed]
20 June 2026 @ 4:33 am
I have a base audio source,.Audiodata.source and 1-2 other audio sources which should start playing at the same time as the base source.
Code:
SomeObj = {
startAllSources : function(){
Audiodata.source.start()
Audiodata.currentSources.forEach(source => {
FX.nodes[source.key].obj.start()
})
}
}
Obviously the default (0) is not quite ideal. The sources, as they are now, are off by less than half a second, but it is noticeable.
Please advise. Thanks. Offline audio context, and all are audiobuffersourcenodes.
Edit: I found this: https://github.com/mdn/webaudio-examples/blob/main/multi-track/index.html
Will be writing my own answer in a few hours. If you write one before I do and it works, I'll accept your answer.
Edit 2: the proposed met
How do I portably define an exactly 32-bit unsigned integer literal?
20 June 2026 @ 2:18 am
So this is a very pedantic question, but in Knuth's Multiplicative Hash, various people have come up with ways to specify the multiplication constant 2654435769 as a 32-bit unsigned integer. The reason it matters so much is because the algorithm must perform a 32-bit multiplication and produce a 32-bit result, throwing away higher bits, then the result is shifted right, so accidentally producing a 64-bit result and shifting in upper bits would produce a hash in the wrong range.
2654435769
2654435769u
(uint32_t)2654435769
uint32_t knuth = 2654435769
UINT32_C(2654435769)
Out of all of these, I think only the explicit/assignment cast uint32_t options and UINT32_C are portably correct (assuming uint32_t
C# winforms how do I Dock a label in a Panel
13 June 2026 @ 1:48 pm
I have a simple panel containing just a label. As the form is resized so does the panel and I am trying to get the label to resize with the panel so the text gets bigger and smaller. I was hoping just setting the labels Dock property to Fill would achieve this just like it does for other controls, but it doesn't. Obviously it is more complicated than I envisaged some advice on how to do this would be appreciated.