Random snippets of all sorts of code, mixed with a selection of help and advice.
How can I connect HTML and Python without using any libraries or frameworks?
1 March 2026 @ 4:44 pm
I’m trying to create a simple web project where a user submits data through an HTML form, and a Python script processes the input and returns a response. I want to do this without using any external libraries or frameworks like Flask or Django. Is CGI an ideal way to do this, or is there a better way?
Elektrischer Rollstuhl
1 March 2026 @ 4:33 pm
ich brauche für längere Wege einen elektrischen Rollstuhl.
Manchmal möchte ich von Google Maps wissen, wie viele km zwischen Weg A und B liegen. Dann möchte ich noch wissen wie viel Zeit ich für diese Wegstrecke mit meinem elektrischen Rollstuhl, der 6 km schnell (langsam für mich) ist. Da beginnt mein Problem, denn für elektrische Rollstühle die mit 6 km auf den Gehwegen fahren dürfen, gibt es nichts. Ich gucke dann immer nach den Füßgängern, das kommt irgendwie hin. Könnte man sowas nicht mit der hochgelobten KI ausführen?
Liebe Grüße
Christa (74 J.)
Monaco knowing about .d.ts files?
1 March 2026 @ 3:41 pm
[email protected] allowed the following code
monaco.languages.typescript.typescriptDefaults.addExtraLib(
rxjsIndex,
'file:///node_modules/rxjs/index.d.ts'
)
Thats not possible anymore in [email protected] since they introduced the worker setup.
What my goal is basically is that I provide for monaco the intelisense of which node_modules it can work with in an Angular project. How should I go about it?
__
Below setup code so far
main.ts
import { useInMemoryScrolling } from './shared/use-in-memory-scrolling.helper';
self.MonacoEnvironment = {
getWorkerUrl: (_moduleId: string, label: string) => {
const base = '/assets/monaco/';
switch (label) {
case 'json':
return base + 'language/json/json.worker.js';
case 'css':
return base + 'language/css/css.worker.js';
case 'html':
return base + 'language/html/html.worker.js
HorizontalHeaderView not displaying headerData
1 March 2026 @ 2:54 pm
I am trying to create a TableView in QML (Qt 6, Qt Quick Controls 2) that looks similar to the following layout:
I have the following methods in my LatticeTableModel:
QVariant LatticeTableModel::headerData(int section,
Qt::Orientation orientation,
int role) const
{
if (role != Qt::DisplayRole)
return {};
if (orientation == Qt::Horizontal) {
switch (section) {
case 0: return QStringLiteral("Lattice");
case 1: return QStringLiteral("");
default: return {};
}
}
return {};
}
and
QVariant LatticeTableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || role != Qt::DisplayRole || !m_controller)
return
I have the following methods in my LatticeTableModel:
QVariant LatticeTableModel::headerData(int section,
Qt::Orientation orientation,
int role) const
{
if (role != Qt::DisplayRole)
return {};
if (orientation == Qt::Horizontal) {
switch (section) {
case 0: return QStringLiteral("Lattice");
case 1: return QStringLiteral("");
default: return {};
}
}
return {};
}
and
QVariant LatticeTableModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || role != Qt::DisplayRole || !m_controller)
return Oracle pl sql and Java
1 March 2026 @ 2:52 pm
I’m a PL/SQL developer with strong Oracle experience, interviewing for a role in a Java-based team. They’re happy with my database skills but want me to learn few Java skills before the next round.
What core Java and JDBC topics should I focus on for a database-centric role? How deep should I go into OOP concepts?
Any quick preparation advice would be appreciated
Faster way to apply a function across rows?
1 March 2026 @ 2:47 pm
If we wanted to apply a function across rows where there currently is no built-in method, like rank_horizontal, what is the fastest way?
data = {0: [0, 1, 0, 1, 1, 0, 1, 0, 1, 1],
1: [0, 0, 0, 0, 0, 0, 1, 0, 1, 1],
2: [0, 0, 1, 0, 1, 0, 1, 0, 0, 1],
3: [0, 1, 0, 0, 1, 0, 0, 0, 1, 0],
4: [0, 1, 1, 0, 1, 0, 0, 0, 1, 1]}
Input df (pandas):
0 1 2 3 4
0 0 0 0 0 0
1 1 0 0 1 1
2 0 0 1 0 1
3 1 0 0 0 0
4 1 0 1 1 1
5 0 0 0 0 0
6 1 1 1 0 0
7 0 0 0 0 0
8 1 1 0 1 1
9 1 1 1 0 1
In pandas we can do this:
df.rank(axis=1)
In polars, this is one way to do it. Is there a faster way?
(df2.select(
pl.concat_arr(
pl.all()).arr.eval(pl.element().rank())
)
.
What are the semantics of a+ mode in standard fopen()?
1 March 2026 @ 1:25 pm
I have an application that fopen's a file in the a+ mode, locks it, reads its entire contents, then truncates it and writes into it.
The application works under Linux, but failed to run under Cygwin. Apparently it was not seeing anything in the file. I had to add fseek(f, 0, SEEK_SET) line to explicitly seek to the start of the file.
I don't know why the application failed to work. Either Linux just happened to be at the start of the file for reading whereas the standards allow any location within the file, or Cygwin failed to follow the standards (maybe out of necessity, maybe Windows does not have separate read and write locations).
So, I would like to know, what the semantics of the a+ mode given to fopen() are.
Writing is probably always to the end of the file, right?
But what about reading? Is an implementation permitted to start reading too at the end of the file? Or should a co
Railway deployment failed from GitHub repo
1 March 2026 @ 12:54 pm
I have created a start command:
uvicorn main:app --host 0.0.0.0 --port $PORT
for FastAPI and tried deploying multiple times and added a start.sh file and still it is saying "⚠ Script start.sh not found". I have tried out different settings and still could not get it to work.
Does anyone know what's happening here?
How do I reduce the remaining health here to zero? [closed]
1 March 2026 @ 11:28 am
I haven't been able to figure out how to solve this problem.
const healths = [{
1: 100
}, {
2: 100
}, {
3: 100
}, {
4: 100
}, {
5: 100
}, {
6: 100
}];
healths.forEach((curr, i) => {
// console.log(`${curr[i + 1]}`)
const damage = Math.trunc(Math.random() * (12 - 4 + 1)) + 4;
let remainingHealth = curr[i + 1] - damage;
if (i < healths.length - 1) {
console.log(`${i + 1}. player made a move, ${i + 2} knight's remaining health is ${remainingHealth}`)
} else if (i === healths.length - 1) {
console.log(`${i + 1}. player made a move, ${i - (healths.length - 2)} knight's remaining health is ${remainingHealth}`)
}
})
I updated an old factorization algorithm of mine "factorization_nr_138132535-".What do you think?
1 March 2026 @ 10:45 am
I updated an old factorization algorithm of mine "factorization_nr_138132535-"
Integer factorization
M=b*N
X=(a^(M^2)-a) mod (a*M^2)
p=gcd(X,M)
P=gcd(N,p)
version 2 is much faster
What do you think?
https://github.com/Piunosei/factorization_nr_138132535-
UPDATE1:
Algorithm:
Input N (number to factor)
P=1
a=2
b=1
while( P==1 || P==N ){
M=b*N
while(a < max_a){
X= (a^(M^2)-a) mod (a*M^2)
p= gcd(X,M)
P=gcd(N,p)
a=a+2
}
a=2
b++
}
Output P (factor of N)
I wrote the algorithm in #C with the #GMP library and set max_a=100.