Random snippets of all sorts of code, mixed with a selection of help and advice.
How could we Help to save this site pfrom AI
7 June 2026 @ 12:36 pm
How could I help this website which is dying because of AI , answer me
Cuz human being is answering me
Not a machine like AI
Answer my question as soon as possible
This is my question
I don't know what to write
I have nothing to say :)
Adding visibility to viewEntity pcf
7 June 2026 @ 12:26 pm
I want to add visibility conditions in DesktopView.pcf. The condition is based on a new viewEntityColumn by extending the exiting viewEntity. It always complains about "No Static property Descriptor found for property". I am facing the same issue when trying to refer this entity in fontcolor/icon/iconcolor. Has anyone faced these issues? If yes, then how did you resolve?
How do I remove the "const" from a custom class, or make the "this" pointer pass on itself, but in non-const form?
7 June 2026 @ 12:09 pm
I'm trying to use a vector to store every class that I need in a program, and I use the erase method to remove a self reference from the planet list. However, my implementation always gives me the problem of having "*this" being a const planet, and C++ apparently doesn't like it when I compare planets with const planets, giving me the error of "[Error] no match for 'operator==' (operand types are 'planet' and 'const planet')".
Minimally reproducible example is below:
#include<bits/stdc++.h>
using namespace std;
class myClass{
public:
void doAbsolutelyNothing(vector<myClass> listing){
vector<myClass> v = listing;
v.erase(find(v.begin(), v.end(), *this));
}
};
Replacing xls file input with txt input
7 June 2026 @ 11:58 am
I have some code suitable for .xls file handling. But the input files are not consistent.
If I use .txt files as input the problem maybe solved. I need some sample code for the same functionality.
xls_file_link
txt_file_link
The below code works for .xls file input:
import pandas as pd
import glob
import re
# Step 1: Find the first wasde file
files = glob.glob("WASDE*.xls")
if not files:
raise FileNotFoundError("No .xls file starting with 'wasde' found.")
file_path = files[0]
# Step 2: Read sheet, grabbing row headers
sheet_name = "Page 12"
df = pd.read_excel(file_path, sheet_name=sheet_name, header=None)
# Step 3: Slice rows 33-49
AWS Trust Policy Role chaining
7 June 2026 @ 10:42 am
I'm a bit confused about the following trust policy and permission role.
In the trust policy, it has the following role eksctl-demo-eks-cluster-nodegroup--NodeInstanceRole.
s3-velero-policy will be attached to an EC2 instance.
eksctl-demo-eks-cluster-nodegroup--NodeInstanceRole will be attached to the eks-node.
Does this mean ec2 instance will assume eksctl-demo-eks-cluster-nodegroup--NodeInstanceRole role along with s3-velero-policy role?
or
Does this mean that eks node can assume s3-velero-policy role along with eksctl-demo-eks-cluster-nodegroup--NodeInstanceRole role
I have this doubt because documentation says Principal element is used to define who is allowed to assume that role
And when I look at the trust policy, I wonder if eksctl-demo-eks-cluster-nodegroup--NodeInstanceRole (s
Why is `as.logical()` much faster than `logical(0)`?
7 June 2026 @ 9:06 am
as.logical() returns a logical(0):
as.logical()
#> logical(0)
but I’m surprised to see that logical(0) is much slower than as.logical(). Why is that? This is also the case for the other as.*() functions:
bench::mark(as.logical(), logical(0), iterations = 1e5)
#> # A tibble: 2 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 as.logical() 48.1ns 76ns 8467061. 0B 0
#> 2 logical(0) 468ns 571ns 1541503. 0B 30.8
bench::mark(as.character(), character(0), iterations = 1e5)
#> # A tibble: 2 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm>
Spring STOMP not resolving session token from connect header while enabled WebSocket security
7 June 2026 @ 8:46 am
I did a demo project that integrates Spring Security, Spring Session, Spring Websocket, with the HTTP header session id resolving enabled to avoid cookies usage, and a simple browser web page frontend.
I also tried running the Spring official demo of spring-session-sample-boot-websocket with Maven migration successfully, that resolves the session ID from cookies.
But it seems that the HeaderHttpSessionIdResolver could not be used while enabled @EnableWebSocketSecurity along a related bean, which enables resolving session ID from the request HTTP header, and secure the websocket STOMP communication with user information available.
If I turned on the debug level of logging, the console threw an AccessDeniedException saying 'Access Denied' when the browser STOMP connect request is sent, with a nearer Exception says
Failed to send message to ExecutorSubscribableChannel[clientInbound
Flask app SQLite3 objects created in one thread cannot be used in another
7 June 2026 @ 6:53 am
I've defined all functions of my code, which require the execution of SQLite3 SQL statements in a file, main2.py . I have imported all functions and objects into my app.py file which will create a Flask backend. However, whenever the request is called, this is the end of the error message.
File "/Users/rifah/Desktop/p/learning agent /main2.py", line 170, in generate_topic
cursor.execute(all_topics_sql)
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 4643939840 and this is thread id 123145374916608.
This is the app.py file, I've even added the cursor objects to this file but this doesn't help:
from flask import Flask, request
from flask_cors import CORS
from main2 import setup,mark_response,generate_question,get_ans,generate_topic,api,agent_state,connection, cursor, sql1,sql2,model,Topic_structure,Question_struc
Can C for-loop syntax can be shorten?
7 June 2026 @ 5:04 am
C for-loop syntax is pretty short:
for (int i = 0; i < n; i++)
But what's about shorter version:
for int i(0)++ < n
where i(0) is iterator i initialization.
In this variant we have only one instance of iterator i versus 3 in C variant.
Do you think it makes sense to shorten for-loop syntax?
Or it is just overindulgent thinking?
Keep cell reference even if cells are inserted deleted and ALSO be able to copy formula to other cells
6 June 2026 @ 12:32 pm
So, at the top, I have cells with a simple formula =IFERROR((TurboData!G3-TurboData!H3)/TurboData!H3,""). At the bottom (which is the 'TurboData' sheet), there are simply just values, but every day there's a new column inserted between columns E and F in this sheet.
I want the cells on the left sheet to discard the newly inserted column and keep referring as if that didn't happen. So, the formula should not become
=IFERROR((TurboData!H3 - TurboData!I3) / TurboData!I3, "")
which it usually would.
I am aware of the INDIRECT function, however this does not seem to work for me, because I want the formula to be copy/pasted on a whole lot of cells and then keep their relative positions. So for instance, when I copy/paste the formula to