Random snippets of all sorts of code, mixed with a selection of help and advice.
Ideal language for fast binary feature minimization + any other general advice
9 April 2026 @ 10:26 pm
I am working on an optimized implementation of binary feature minimization, which I am familiar with as a computational linguistic task but I would imagine has other applications. Fundamentally, it is a dimensionality reduction task, where values are binary. I am not interested in an approximation, I am aiming for a rigorous solution.
Description of my approach: *The problem space is a certain number of features, f, and a certain number of samples, s, and each sample has a binary value for f features. A given problem is that, for a given subset of samples, what is the minimum number of features such that any two samples can still be distinguished by having at least one remaining feature be different.
My approach consists of a series of preprocessing operations that eliminate features that for sure won't be necessary (ie, a feature that is all 0's for all samples in a given problem), and then identify any features that must be included (ie, two samples have identical bi
Scripts not loading properly when using wp_enqueue_script in custom WordPress theme
9 April 2026 @ 10:21 pm
I am developing a custom WordPress theme and trying to load JavaScript files using wp_enqueue_script, but the script is either not loading or not working as expected.
Here is the code I am using in functions.php:
function my_theme_scripts() {
wp_enqueue_script(
'custom-script',
get_template_directory_uri() . '/assets/js/custom.js',
array('jquery'),
'1.0',
true
);
}
add_action('wp_enqueue_scripts', 'my_theme_scripts');
Problem:
The script does not seem to execute in the browser. When I inspect the page, sometimes the file is not loaded, or it loads but the functionality does not work.
What I have tried:
1. Checked file path and confirmed the JS file exists
2. Cleared browser cache
3. Verified no console errors
4. Tried changing dependency (removed 'jquery')
Expected result:
The script should load in the footer and execute properly.
Actual res
Increasing Firebase App Hosting API Domains per region Qouta
9 April 2026 @ 10:13 pm
I am trying to increase our Firebase App Hosting API Domains per region Qouta from 30 to 1000 but I keep getting this error.
We need a big qouta because we have a domain reseller service and we use app Hosting to generate the DNS records.
How can I increase this qouta?
Secondly is Apphosting the best GCP tool for this type of service?
We need a big qouta because we have a domain reseller service and we use app Hosting to generate the DNS records.
How can I increase this qouta?
Secondly is Apphosting the best GCP tool for this type of service?Remove or modify a native onchange method in Odoo 18
9 April 2026 @ 10:04 pm
In one of its modules, Odoo has this small onchange method that is complicating my operation, since I don’t need it for my business logic and I’m trying to eliminate its behavior.
@api.onchange('street', 'zip', 'city', 'state_id', 'country_id')
def _delete_coordinates(self):
self.partner_latitude = False
self.partner_longitude = False
I already did this, but the method is still being executed.
@api.onchange('street', 'zip', 'city' 'state_id', 'country_id')
def _delete_coordinates(self):
pass
Is there any way to prevent this method from running?
Adding custom view to navigation with Liquid Glass effect like Connect App
9 April 2026 @ 9:56 pm
I would like add buttons that look like chips to the navigation bar using SwiftUI. The Connect app has this:
I tried to achieve this with the following code:
struct ContentView: View {
var body: some View {
NavigationStack {
List {
ForEach(0..<100) { index in
Text("Content")
}
}
.navigationTitle("Demo")
.navigationBarTitleDisplayMode(.inline)
.safeAreaInset(edge: .top) {
ScrollView(.horizontal) {
HStack {
ForEach(0..<5) { index in
Text("Text \(index)")
.padding()
.glassEffect()
}
}
I tried to achieve this with the following code:
struct ContentView: View {
var body: some View {
NavigationStack {
List {
ForEach(0..<100) { index in
Text("Content")
}
}
.navigationTitle("Demo")
.navigationBarTitleDisplayMode(.inline)
.safeAreaInset(edge: .top) {
ScrollView(.horizontal) {
HStack {
ForEach(0..<5) { index in
Text("Text \(index)")
.padding()
.glassEffect()
}
}
What's the right expression to feed an `std::pair<SomeIterator, SomeIterator>` to something that needs an `std::ranges::range`?
9 April 2026 @ 9:55 pm
In C++11, std::pair very specifically did not work with range-based for loops or offer begin() and end() methods.
C++20 has gained much more support for "ranges", so you are now expected to have values you are passing around that satisfy the std::ranges::range concept, and represent something you can iterate that might not itself be a collection. As I understand it, an std::pair of two iterators intentionally does not satisfy std::ranges::range, just like it isn't usable in a range-based for loop.
It seems like std::ranges::subrange is the Right Type to use for representing a range with a pair of iterators. But older code may still use std::pair for this.
I'm looking for the Right Way to bridge the gap and pass an std::pair of two of the same iterator type to newer code that expects a range. I need this to be:
Bad theming for resizing XCB window?
9 April 2026 @ 9:37 pm
All I'm doing is creating a window in XCB:
int main() {
xcb_connection_t *connection = xcb_connect(nullptr, nullptr);
if (xcb_connection_has_error(connection)) {
fputs("Couldn't get an XCB connection.\n", stderr);
return 1;
}
xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(connection)).data;
if (!screen) {
fputs("Couldn't get the XCB screen.\n", stderr);
return 1;
}
xcb_window_t main_window = xcb_generate_id(connection);
xcb_create_window(
connection, XCB_COPY_FROM_PARENT, main_window, screen->root,
100, 100, 400, 400, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
screen->root_visual,
XCB_CW_BACK_PIXEL,
(uint32_t []){0x1E1E1E}
);
xcb_map_window_checked(connection, main_window);
xcb_flush(connection);
while (true) {
xcb_generic_event_t *event = xcb_wait_for_event(connect
Access to function in other lexical scope in JS
9 April 2026 @ 9:27 pm
How can f2() access the inner function f1()?
I know about lexical scope and closures, but is there any way to make f2() access f1()?
(function(global, factory) {
global.m = {};
factory(global.m);
})(this, (function(exports) {
function f1() {
return "f1";
};
function f2(f) {
return f.call(null, "f2");
};
exports.f2 = f2;
}))
m.f2(function(a) {
return a + f1()
})
plumber2 async endpoint does not inherit global environment
9 April 2026 @ 9:23 pm
When using async = TRUE in plumber2 with the default mirai evaluator, the worker processes do not inherit anything loaded or defined in the global environment of the main R session — this includes database connections, environment variables, loaded libraries, and global objects. Here is a minimal example demonstrating the issue with libraries:
Minimal reproducible example:
library(plumber2)
library(dplyr)
pa <- api() |>
api_get("/test", handler = function() {
tryCatch({
my_data <- tibble(x = 1:5)
my_data |> dplyr::filter(x > 3)
}, error = function(e) {
list(error = conditionMessage(e))
})
}, async = TRUE)
mirai::daemons(2)
pa |> api_run(port = 8000, block = FALSE)
Calling the endpoint
curl http://localhost:8000/test
Returns:
Absolutely positioned divs are not positioning correctly [closed]
9 April 2026 @ 6:59 pm
As far as I know, this should work. It has position set to absolute so there should be no problems. Yet when I test it it scrambles everything. Why is this not working?
What I am trying to do is move the red box to be just like the blue box, except in the center, and both of them still inside the green box. However adding things here still does not make it work.
The code:
div {
positon:absolute;
border: black 1px solid;
margin:none;
padding:none;
}
<div id="topbar" style="top:0px;left:0px;height:50px;border-color:green;">
<div style="left:0px;top:0px;height:inherit;border-color:blue;">
<span>LB