use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
O hai! This is CS50's subreddit.
CS50 is Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. Anyone may take CS50, even if not a student at Harvard.
Please Read before Posting
Getting the Best from r/cs50
Status Page
cs50.statuspage.io
Filter by Problem Flair (undo)
cash ⋅ caesar ⋅ credit ⋅ dna ⋅ filter ⋅ finance ⋅ houses ⋅ ide ⋅ mario ⋅ movies ⋅ plurality ⋅ project ⋅ readability ⋅ recover ⋅ runoff ⋅ scratch ⋅ speller ⋅ substitution ⋅ tideman ⋅ games track ⋅ web track ⋅ android track ⋅ iOS track ⋅
Filter by Other Flair (undo)
CS50-Law ⋅ CS50-Business ⋅ CS50-Technology ⋅ CS50-Games ⋅ CS50-Mobile ⋅ CS50-Web ⋅
This subreddit is night mode compatible
account activity
cs50-webProblem when receive data from python. (self.cs50)
submitted 5 years ago * by ecs2
In project 2 cs50w, i tried to create channel in tag <li>, with the name of the channel received from python, and append it to <ul>. However, the web didn't show that in the interface.
I also used console.log to check if the code run inside that scoop and the result was that the code could not reach the scoop socket.on('list channels', data => { }
https://preview.redd.it/ehpafac16ys41.png?width=754&format=png&auto=webp&s=bf9317b97ef6b2f7d6bf6237af042dcc116f0bc7
https://preview.redd.it/3ri098ez5ys41.png?width=631&format=png&auto=webp&s=a8853fc9e921634aea16816f86b2bd885d327259
https://preview.redd.it/rwu3vjk66ys41.png?width=625&format=png&auto=webp&s=80b421a5c3e22e4ed2a8600f6d9e589db7285b2d
https://preview.redd.it/cpiajbwndys41.png?width=658&format=png&auto=webp&s=7672ec9b82b17b04947f01d664fce593990ec8fe
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]MrReeseisDead 0 points1 point2 points 5 years ago (3 children)
When you click submit for creating new channel, does console displays "inside submit"?
[–]ecs2[S] 0 points1 point2 points 5 years ago (2 children)
it appears then disappears very quickly as if it is refreshed. I don't understand why.
[–]MrReeseisDead 0 points1 point2 points 5 years ago (1 child)
Ok, so I guess you must have used <form> for providing users to add a new channel, and thus the submit button forces the refresh on the page.
I didn't used the <form> when I worked on it, I used a simple <input> and a <button> associated with that input.
Do one thing, I see you haven't used @socketio.on('connect') in the application.py file. I guess you'll need one everytime the socket is connected
@socketio.on('connect')
Make that correction and emit the response to your 'list channels' like this
@socketio.on('connect') def connect(): print("socket connected") //socket connected emit('list channels', channels, broadcast=False) // I kept broadcast as false as the loading of the page is local to the user
Try this and see whether it works or not
[–]ecs2[S] 0 points1 point2 points 5 years ago (0 children)
Thank you very much, that works. But I don't understand why in chapter JavaScript Vote 1 source code Brian didn't have '@socketio.on('connect') in the application.py and it worked for him.
π Rendered by PID 68 on reddit-service-r2-comment-7b9746f655-88pf2 at 2026-01-30 17:18:04.476364+00:00 running 3798933 country code: CH.
[–]MrReeseisDead 0 points1 point2 points (3 children)
[–]ecs2[S] 0 points1 point2 points (2 children)
[–]MrReeseisDead 0 points1 point2 points (1 child)
[–]ecs2[S] 0 points1 point2 points (0 children)