#learning
Posts tagged #learning on Dynamo Geeks: 44 posts from the community, most useful first.
Posts tagged #learning
please how do i fix my react timer, it stays at 1 😭
good evening everyone 🙏🏾 i'm building a pomodoro timer for my portfolio. the seconds go from 0 to 1 and then it just stays at 1 forever. no error in the console. i just came across something called "stale closure" but i don't understand it. here is my code: import { useEffect, useState } from 'react' function Timer() { const [seconds, setSeconds] = useState(0) useEffect(() => { const id = setInterval(() => {…
8 months ago i was making 400 bowls of pho a day. today i…
8 months ago i was making 400 bowls of pho a day. today i fixed my first memory leak (forgot to clear a setInterval lol). if youre thinking about switching careers, its hard but its doable. ok back to standup panic
if you only watch one thing to understand SQL injection, make it this Computerphile one. Tom explains WHY it works with an actual login box, not just " OR 1=1. understanding the query is the whole thing
ayuda xq mi lista original cambia si modifiqué la copia?? (es tarea, lo admito)
q onda, es para una tarea de estructuras de datos, no quiero q me la hagan solo entender q pasa jsjsjs matriz = [[0, 0], [0, 0]] copia = matriz copia[0][0] = 5 print(matriz) # [[5, 0], [0, 0]] ?????? despues lei q se usa .copy() y lo cambie: copia = matriz.copy() copia[0][0] = 5 print(matriz) # [[5, 0], [0, 0]] OTRA VEZ alv xq pasa esto si ya use copy?? el profe dijo algo de "referencias" pero no le entendi
Java: why == works for 127 but not for 1000;
Hello, I am CS student in Thessaloniki, learning Java for my exam. I found something strange and my professor only said "look it up" xD Integer a = 127; Integer b = 127; System.out.println(a == b); // true Integer c = 1000; Integer d = 1000; System.out.println(c == d); // false ;; Why the same code gives different result; Is it a bug in my JDK (Temurin 21); Should I always use equals for Integer; Thank you!
rust: cannot borrow `*self` as mutable because it is also borrowed as immutable
making the pong game for @tomasz_k (long story) and im stuck on the borrow checker. i have a game struct with a list of entities and i want to update each one, but update needs to call a method on self struct Game { items: Vec<Entity>, score: u32, } impl Game { fn tick(&mut self) { for item in self.items.iter() { self.update(item); } } fn update(&mut self, item: &Entity) { // moves the item, maybe changes score } }…
Juniors and career switchers: what scared you most in your first 3 months?
C# async void in a button click handler, the exception just disappears?
Hello, I have a question to you. In my Ausbildung company we have a WinForms tool (yes WinForms xD). I made a button that loads customers from our internal API. When the API is down, nothing happens. No error, no MessageBox, the grid just stays empty. private async void btnLoad_Click(object sender, EventArgs e) { try { LoadData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private async Task…
paano po gawing 3 columns sa laptop tapos 1 column sa phone? (CSS grid)
sorry po if basic question 😭 kakatapos lang ng shift ko kaya medyo lutang pa. practice project ko po is portfolio page na may project cards. gusto ko 3 columns sa laptop, 2 sa tablet, 1 sa phone. ginawa ko po 3 media queries pero ang dami tapos may weird na gap sa tablet size: .projects { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; } @media (max-width: 900px) { .projects { grid-template-columns:…
¿Cómo organizan su tiempo los que trabajan de noche y estudian programación de día?
Hola a todos, disculpen la pregunta, es un poco personal y no tan técnica. Trabajo en un call center atendiendo clientes de Estados Unidos, turno de noche, de 9 pm a 6 am (hora de Lima). Llego a casa, duermo hasta la 1 pm más o menos, y en la tarde intento estudiar JavaScript con cursos gratis. Pero me siento cansada todo el tiempo y avanzo muy lento. A veces leo la misma lección tres veces y no se me queda nada,…
Recursion confusion: why does my function print the numbers in reverse order?
Assalam o Alaikum all. I am a 2nd year CS student. I am having a confusion in recursion. Here is my code: #include <stdio.h> void print(int n) { if (n == 0) return; print(n - 1); printf("%d ", n); } int main() { print(5); return 0; } I expected 5 4 3 2 1 but it prints 1 2 3 4 5 . When I move the printf above the recursive call, it prints 5 4 3 2 1 . Why is the position of one line changing the whole order? Our…
Respected members, why does my Python function remember the old list?
Respected members, I am a mathematics teacher learning Python so that I can teach my Class 9 students properly. I wrote a small function to collect marks, and something very strange is happening. Kindly see: def add_mark(mark, marks=[]): marks.append(mark) return marks print(add_mark(45)) # [45] print(add_mark(78)) # [45, 78] I expected [78] print(add_mark(62)) # [45, 78, 62] Each time I call the function without…
do i actually need to learn C first?? frank keeps telling me to 😭
ok so im 16, been making minecraft mods in java for like a year and i lowkey love it. but every time i post something frank_cpp98 replies "learn C first, kid" and now im scared im doing it wrong lol questions (sorry theres a lot) do i need C to get a job later or is java fine should i learn c++ instead since its closer to java?? will AI take all the jobs before i graduate anyway (fr asking) i just put linux on my…
reminder sa mga students: hindi kailangan ng MacBook para…
reminder sa mga students: hindi kailangan ng MacBook para matuto mag-code. yung una kong React app ginawa ko sa laptop na sira ang letter E. kinopya ko lang yung "e" sa notepad tapos paste paste paste 😂 kung ano ang meron ka, simulan mo na 💪🇵🇭
Teaching SQL joins to Class 12 with the attendance register and the fee register
Every year my Class 12 children memorise "INNER JOIN returns only matching rows" for the exam, write it perfectly, and understand nothing. This year I tried something different and it worked better than I expected, so I am sharing. I borrowed two real registers from the office: the attendance register (roll number, name) and the fee register (roll number, term, amount). I asked the children: "Who has paid fees, with…
the opposite of a burnout story: a first time contributor who did everything right
I complain a lot in this topic, so here is the counterweight, because it is just as true and I do not want anyone reading my rants to think contributing to open source is a trap. most of it is fine. some of it is the best part of my week. this is one of those. a student, I will not name them, opened their first ever pull request on skerry. it was small, a fix to a confusing error message, the kind of thing I had…
Disculpen la pregunta: mi botón no hace nada y la consola dice 'Cannot read properties of null'
Hola, disculpen si es muy básica. Estoy haciendo una lista de tareas para practicar. Cuando hago clic en el botón no pasa nada y en la consola sale esto: Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at app.js:3 Mi HTML: <head> <script src="app.js"></script> </head> <body> <input id="tarea" type="text"> <button id="agregar">Agregar</button> <ul id="lista"></ul> </body> Mi app.js:…
Respected members, which Python book should a 52 year old maths teacher read first?
Python script works when I run it, does nothing in cron. What am I missing?
Quick one. Practicing Linux for the transition (ETS in 7 months, SkillBridge after that if it gets approved). Wrote a Python script that pings a list of hosts and writes the results to a CSV. Works fine when I run it from my home directory. Put it in crontab -e to run every 5 minutes. Nothing. No CSV, no error, nothing. */5 * * * * python3 pinger.py What I checked: cron is running ( systemctl status cron says…
How I explain loops with appam batter (and why my children remember it in the board exam)
Fourteen years of teaching Python to higher secondary children in Kochi has taught me one thing: they will forget the definition, but they will never forget the story. So here is the story I use for loops. Other teachers are welcome to steal it. The appam pan Every child in Kerala has watched their amma or ammachi make appam. You have a bowl of batter and an appachatti (the round pan). One ladle of batter, swirl the…
For the PMs, designers and managers who keep asking me for 'something short that is not marketing': 3Blue1Brown's Large Language Models explained briefly. Short, accurate, and it does not oversell anything.
got 34 comments on my first big PR and i kinda want to crawl into a hole
so i finally got my first real feature (a filters panel for our admin dashboard) and opened the PR today. 34 comments. thirty four. some are tiny like naming, some are "this should be a custom hook", and one just says "lets talk about this" which sounds terrifying my senior is nice and none of the comments are mean. but i kind of feel like a fraud and now everyone can see it. in the kitchen if you messed up the chef…
5.30 am, before the tiffin boxes: relearning Java after a 7 year break (and what changed since Java 8)
Good morning everyone. It is 5.30 am in Pune, the children are asleep, the milk has not come yet, and I have about 50 minutes. So I will write fast. Kindly excuse any mistakes. I was a Java developer at a service company until 2018. Then two children, and my father-in-law's illness, and I took a break that was supposed to be one year and became seven. Three months ago I decided to come back. Many people here have…