Random snippets of all sorts of code, mixed with a selection of help and advice.
How to start contributing to open-source and how to enter such communities and what are the best communities?
19 March 2026 @ 4:57 am
Iam a recent graduate from a reputed college in India although I got good job offers from my college I still regret in one aspect of my CS journey, that is I have zero contributions to any open-source projects and almost zero collaborations.
I am a great supporter for the concept of open sourcing and free resources . Because most of my knowledge and experience was based on such resources which made me an anonymous beneficiary of these communities. In return to what I got till date and what iam still getting from these communities all i wanted to do is to contribute something to them even if it is small help.
I don't say iam a great thinker or a prodigy programmer but iam a hardworking person and innovative thinker. So finally here is why iam posting this "I want someone to guide me in beginning my journey in creating and contributing to such free and open-source communities, suggest me such communities from where I learn and begin with, If possible collaborate .&q
How to make Paho MQTT C++ Client Library wait for initial connection?
19 March 2026 @ 4:55 am
I'm using Paho MQTT C++ Client Library on Ubuntu 22.04 and 24.04 to publish messages to remote MQTT broker. Here is the snippet:
#include "mqtt/client.h"
int main() {
mqtt::client client("192.168.0.19", "", nullptr);
mqtt::connect_options connOpts;
connOpts.set_keep_alive_interval(3600);
connOpts.set_connect_timeout(5);
connOpts.set_clean_session(true);
connOpts.set_automatic_reconnect(true);
try {
client.connect(connOpts);
}
catch (std::exception& e) {
std::cout << e.what() << std::endl;
}
}
My test case tries to connect to inactive broker at 192.168.0.19. Despite connect timeout set to 5s and automatic reconnect activated, the program fails immediately with MQTT error [-1]: TCP/TLS connect failure output. It behaves similarily with mqtt::async_client. Is there a way to make it retry for set timeout, i.e. 5s, before failing?
Ploty Graph Breaks with multiple sources
19 March 2026 @ 4:20 am
I'm working on a dashboard to interactively display ride wait times in a theme park. I've got a script running that polls a web API for wait times every 5 minutes. From that script, I have a series of csv files, sorted by date and ride, each containing the time the sample was taken, and the wait time for each ride.
In my dash application, I use pandas to read the csv into a data frame, and then graph that using plotly. It works fine with one ride, but when multiple rides are present, some entries show out of order:
Note the red line going off to be crazy.
These are the functions I use to load the data:
def update_data_frame(self, name, date):
name = name.replace(' ', '_')
df = self.load_data(date, name, "tds")
self.frame = pd.
Note the red line going off to be crazy.
These are the functions I use to load the data:
def update_data_frame(self, name, date):
name = name.replace(' ', '_')
df = self.load_data(date, name, "tds")
self.frame = pd.validating form using preventDefault() but can no longer submit form after validation is addressed php/jquery
19 March 2026 @ 4:06 am
I am trying to validate a form using jquery by calling preventDefault(). After addressing the validation error, what I want is to submit the form when the submit button is pressed again, but for some reason it no longer submits. Here is my code:
html:
<form id="myForm" method="POST">
<input type="text" id="inputA" value="1">
<input type="text" id="inputB" value="2">
<input type="submit" name="go" id="go" value="Submit this" class="btn">
<input type="text" name="message">
</form>
jquery:
$(document).on('click', '#go', function(){
var inputA= $('#inputA').val();
var inputB= $('#inputB').val();
if(inputA != inputB){
alert("not same!");
$(document).on('submit', '#myForm', function(e){
How to use JavaScript to see if a URL's resource exists?
19 March 2026 @ 3:48 am
I'm using JavaScript to load the navbar, sidebars, and footers for my website. I have a "default" asset for my website, and I have the JavaScript working to load that if it doesn't find another applicable HTML file in the same directory. Here is the snippet of the code that I'm working on:
// Loads the element as the default Main asset if a new one is not present
function loadElement(elementID){
// Define the path variable as a placeholder
let newElement = "/assets/main/" + elementID + ".html";
// Define the currently loaded document's path
const docURL = document.URL;
// Find the last "/" in the URL
const lastSlash = docURL.lastIndexOf("/") + 1;
// Trim the docURL into the pathURL
const docDir = docURL.substring(0,lastSlash);
// Find the possible element to load
const pathURL = docDir + elementID + ".html";
// TODO: Test if the new URL exists here
// Fetch the Element data
Is an oblique coordinate system simply a non-rectangular version of a Cartesian system?
19 March 2026 @ 2:55 am
This point plotter https://www.calculators-math.com/graphers/points/ allows for rotating axes to plot data points in an oblique coordinate system. Does anyone know if it has any practical usage? We are used to graphing a set of points in the Cartesian coordinate system, where the axes are orthogonal. In this tool, axes can intersect at any angle. Is the resulting oblique coordinate system still a Cartesian coordinate system-since it still uses abscisa and ordinate? Thanks for any reply.
Could give me feedback on roles table for Rbac?
19 March 2026 @ 2:13 am
I'm building a multi-tenant hotel booking app as a personal project.
role_permissions defines default permissions for each role, and user_roles lets me customize permissions at the user level. For example, an owner can allow a specific manager to add other managers.
Here's my current (minimal) schema:
https://i.sstatic.net/XWorltUc.jpg
global skill files are not being loaded by opencode cli [closed]
19 March 2026 @ 1:29 am
opencode cli won't load global skills files under ~/.config/opencode/skills/
Test: run opencode the issue command /skills - it shows no skill loaded even though the SKILL.md files are there in the correct folder structure.
No error under ~/.local/share/opencode/log/ even when running with DEBUG level log
Obtain prediction confidence intervals for GLS model predictions
19 March 2026 @ 12:14 am
I would like to obtain the prediction confidence intervals (CIs), not the coefficient confidence intervals, for an heteroscedastic GLS model (i.e. allowing for variance to differ amongst groups), in R.
The nlme::intervals function only computes the coefficient CIs and, unfortunately I can't make tidymodels worklfows (using parsnip) work for nlme::gls (see https://github.com/tidymodels/parsnip/issues/1354), to compute CIs using bootstrapping.
I had a look at several online threads (e.g. confint vs intervals for gls (nlme package) models) but they mostly seem to touch on coefficient CIs.
Here's a reprex for an heteroscedastic GLS model from which I would like to get the CIs
library(nlme)
gls(follicles ~
How to Test Builder Pattern that Returns an Object with No Accessors?
18 March 2026 @ 10:02 pm
I have a fairly standard Builder that returns a Command...
Builder:
@Component
@Scope("prototype")
public class CommandBuilder {
private final Repository repository;
private String authoritativeSourceId;
private String title;
public CommandBuilder(Repository repository) {
this.repository = repository;
}
public CommandBuilder setAuthoritativeSourceId(String authoritativeSourceId) {
this.authoritativeSourceId = authoritativeSourceId;
return this;
}
public CommandBuilder setTitle(String title) {
this.title = title;
return this;
}
public CommandBuilder build() {
return new AddCommand(this.repository,
this.authoritativeSourceId,
this.title);
}
}
The command class looks like the following:
public class AddCommand {
private final Repository repository;
private final String authoritativeSou