|
Way back when, you could ask, eg, Quake (2?), to search for nearby servers, and it would list multiplayer servers in your geographical area (or anyway according to some number of network hops). What is the name of this type of network-crawl service discovery?
|
# ? Mar 13, 2022 16:17 |
|
|
# ? Jun 7, 2024 19:12 |
|
Newf posted:Way back when, you could ask, eg, Quake (2?), to search for nearby servers, and it would list multiplayer servers in your geographical area (or anyway according to some number of network hops). What is the name of this type of network-crawl service discovery? Tangentially related, your question made me remember the old days of finding multiplayer servers thru GameSpy.
|
# ? Mar 13, 2022 16:41 |
Newf posted:Way back when, you could ask, eg, Quake (2?), to search for nearby servers, and it would list multiplayer servers in your geographical area (or anyway according to some number of network hops). What is the name of this type of network-crawl service discovery? In the case of games, it can be called a Master Server. Hughmoris posted:Tangentially related, your question made me remember the old days of finding multiplayer servers thru GameSpy. I don't think QuakeWorld or Quake 2 had any built-in internet game browser, and you'd use QuakeSpy (later GameSpy when it expanded to more games) to query their master server to find games. I don't remember if the games had built-in registration to the master server or not.
|
|
# ? Mar 13, 2022 16:54 |
|
Hughmoris posted:Tangentially related, your question made me remember the old days of finding multiplayer servers thru GameSpy. Holy smokes that icon is a trip.
|
# ? Mar 13, 2022 16:55 |
|
nielsm posted:In the case of games, it can be called a Master Server. Maybe I'm crazy, but I don't think this was a case of server registration. I *believe* it was pinging adjacent IP addresses and propagating out breadth-first style. EG, there were two major local ISPs at the time, and users from service A would find servers only from service A, and similar for service B.
|
# ? Mar 13, 2022 16:58 |
Newf posted:Maybe I'm crazy, but I don't think this was a case of server registration. I *believe* it was pinging adjacent IP addresses and propagating out breadth-first style. EG, there were two major local ISPs at the time, and users from service A would find servers only from server A, and similar for service B. You can do UDP broadcast, but it's quite limited. If you send a UDP datagram to 255.255.255.255 (in IPv4) then it'll get broadcast to all nodes on the local network segment, i.e. all nodes at most one hop away will see it, but it will not get forwarded through routers. That's generally how discovery of game servers on a LAN works. I haven't heard about it working across customers on an ISP network, in fact I'd say that would be a pretty bad setup security-wise if each customer wasn't isolated to only talk between themselves and the ISP gateway. (Unless you were specifically addressing another customer's IP address.) Although maybe it could be possible for them to set up some kind of thing that recognizes the game discovery broadcasts and relays them to other customers' networks, but that would still be kind of weird.
|
|
# ? Mar 13, 2022 17:04 |
|
nielsm posted:in fact I'd say that would be a pretty bad setup security-wise if each customer wasn't isolated to only talk between themselves and the ISP gateway. (Unless you were specifically addressing another customer's IP address.) Although maybe it could be possible for them to set up some kind of thing that recognizes the game discovery broadcasts and relays them to other customers' networks, but that would still be kind of weird. I'd be completely unsurprised if whatever network conditions allowed this at the time have since been patched over, but I'm talking about the dark ages here. Security?
|
# ? Mar 13, 2022 17:26 |
|
Hey gang! I'm really frustrated in my progress working through this Python curriculum. I'm more than a month behind now; I anticipated I would be behind because I had some real life stuff going on, but I'm two weeks further behind that I'm about ready to take the final, and I'm at this point reasonably confident I can pass it. My biggest hurdles have a lot to do with formatting, and dictionaries are still kind of frustrating me. My last assignment before getting ready to take the practice assessment requires me to read a text file containing on alternating lines the number of seasons and then the name of a television show. So, like: code:
code:
code:
On a kind of related note, I'm wondering, how many of you learned code without any direct instruction whatsoever? This is so frustrating; I can't just raise my hand and ask a teacher if I'm stuck, you know. Often times I will spend hours working through something that could have been solved instantly by a teacher just telling me, "you need to make sure you do this..." or whatever. And while I find all your help invaluable, there is always hiccups and things lost in trying to negotiate teaching/learning in this manner; the code is messy, it's hard to articulate where my understanding of Python ends; I can't really ask these questions on stackoverflow because they're beginner level questions but are similar enough to questions that have already been answered that instead of walking me through it like I'm the beginner I am, they link me to another solved problem that is so far beyond where I'm at
|
# ? Mar 13, 2022 23:30 |
|
You're reading in the lines from the file to a list of strings Then joining all of them into one string Then separating them into a list of strings, likely identical to the original list. Consider operating on the original string list directly. Look at the functions that you can use with lists, can you just go through that original list? If the lines contain '\n' can you use a trim function to remove them? E: for help, used to was I used IRC for help. There's probably a slack channel that serves the same purpose. Volmarias fucked around with this message at 23:58 on Mar 13, 2022 |
# ? Mar 13, 2022 23:51 |
|
credburn posted:Right now my biggest problem is that some keys have multiple values. I can't for the life of me figure out how to update the key within the while loop in which all this is happening. If your keys have multiple values, you can consider using some kind of iterable sequence type (e.g. a list) as the value which will clean up your insertion logic quite a bit. Another thing I would recommend is, to start, any time you have to do a non-obvious thing to some input data to turn it into something useful, you should give it an explicit name. This really helps keep my head clear when I'm reading, and reasoning about, a complicated multi-step process. For example, consider: Python code:
credburn posted:On a kind of related note, I'm wondering, how many of you learned code without any direct instruction whatsoever? This is so frustrating;
|
# ? Mar 14, 2022 00:22 |
|
Another little thing: pop() doesn't just remove the last value, it also returns it - so you can do x = stuff.pop() to get and delete in a single operation. There are also some fancy ways to do this in very few lines - but I'm resisting the temptation to talk about them. Poke us after you're done if you'd like examples.
|
# ? Mar 14, 2022 02:22 |
|
Someone with experience with vim and python, how should I approach this? https://www.youtube.com/watch?v=-AZUIL1rY3U&t=230s I want to write a python strategy to to vimspector test integration except with python instead of javascript. I already have debugpy working properly in nvim, but without test integration settings. He mentions adding runtime arguments to the debug config file, but I have no idea how he's choosing them (and how they'd look for python). Also he's using a jest_strategy function to launch vimspector with the configuration with something that looks like a regex pattern for the test name. No idea how he's getting that.
|
# ? Mar 14, 2022 03:25 |
|
credburn posted:Right now my biggest problem is that some keys have multiple values. I can't for the life of me figure out how to update the key within the while loop in which all this is happening. When you have a problem like this, you should stop and consider how you're structuring your data. It sounds like currently when you get input like "20: Gunsmoke" you are using 20 as the key and gunsmoke as the value. In a dictionary, each key has to be unique, but values can be duplicated as much as you want. When you organize your data like this, you are basically implicitly saying "there can only be one show with 20 seasons, and it is gunsmoke". Then when you get "20: Law & Order" as input later, you get problems. On the other hand, if that code got "21: gunsmoke" as an input, it would be perfectly happy storing that since 21 is a new unique key. The problem is that your key, "20" is not actually a unique identifier for the TV show. Multiple tv shows might have 20 seasons, and a show's season count might even change after the fact. So using the season count as your dictionary key causes problems. To fix it you have to change how you organize your data. The simplest solution is to use the tv show as the key and the season count as the value in your dictionary -- there's only ever one instance of each tv show, and duplicate values are fine. Another solution would be to use a list of pairs instead of a dictionary, like this: code:
edit: spoilered the "answer" since you might not want to just hear it RPATDO_LAMD fucked around with this message at 03:40 on Mar 14, 2022 |
# ? Mar 14, 2022 03:35 |
|
Gosh, thanks again for all your help and patience walking this newb through some of this. I started over because everything was a mess. Much cleaner now, but I'm at another hiccup. My code is:code:
and shows = ['Gunsmoke', 'The Simpsons', 'Will & Grace', 'Dallas', 'Law & Order', 'Murder, She Wrote'] The assignment requires me to use the seasons as the keys, and the names of the shows as values. It expects a dictionary to output one of the keys with two values separated by a semicolon. The part I'm stuck at now, for the key 20, it needs both Gunsmoke and Law & Order added to it. With my current code, it will only add new season/show key/value pairs. When I try to look up methods of adding a second value to an existing key, I'm inundated with (for me) very complex examples to merge and combine and do all kinds of things. I'm just trying to do this simple thing that I suspect takes all of one or two lines of code. Which again is to just add a new value to a key that already has a value, without overwriting said value. edit also for reference: This is what they are expecting the output to look like: code:
credburn fucked around with this message at 22:58 on Mar 15, 2022 |
# ? Mar 15, 2022 22:03 |
|
Dictionaries can only have a single value per key. The type of the values in your dictionary are strings. You could replace the value with a new, longer, string that consisted of the previous value, some kind of separator, followed by the new show. But even easier, you could use a different type for the values in the dictionary, a type capable of storing multiple values, one that you can append to. Edit: Having read what you wrote about the assignment more closely, it sounds like they expect you to actually do the first option. ArcticZombie fucked around with this message at 22:41 on Mar 15, 2022 |
# ? Mar 15, 2022 22:20 |
|
Edit ^^ I'm surprised they are making you use the number of seasons as keys since that's a dumb thing to do but the answer is to set each value to an empty array and then add each show to the correct array as you come across it.
|
# ? Mar 15, 2022 22:22 |
|
ArcticZombie posted:Dictionaries can only have a single value per key. Wait, what? Gosh, I feel like I've wasted a dozen hours working through dictionary tutorials and brute forcing my way through assignments because I didn't understand a really fundamental aspect of dictionaries. I've been working all this time with the understanding that a key can have any number of values -- but I didn't realize that it's only by way of a list that it does so, that the list is itself the only value associated with the key -- am I understanding this correctly? gently caress, now that I know that I feel like I can get through so much of this.
|
# ? Mar 15, 2022 23:05 |
|
credburn posted:Wait, what?
|
# ? Mar 15, 2022 23:17 |
|
This would be one of those things you missed by not going to a formal school, yeah. Same thing happened to me when I was trying to teach myself from scratch, it's so easy to read "key value pair" and gloss over the ramifications of that. Python calls them dictionaries but a more technically correct term could be "hash table" or "associative array". The way they work behind the scenes is complicated, but to super briefly summarize, your "key" is used as the input to a hashing function (link has a pretty good diagram, as well) which points to a particular location in memory. So long as you input the same key, you always get the same result, which is the exact location your data lives at. This means that if you want to determine whether or not "Gunsmoke" is in your worddict, all you have to do is run "Gunsmoke" through the hashing function and check to see if anything is at the address that comes out. This is way faster than if you wanted to check to see if "Gunsmoke" was in wordlist, because you would have no choice but to check every item in it until you found "Gunsmoke", or found the end of the list.
|
# ? Mar 15, 2022 23:20 |
|
Hey gang! Thanks again for your help. I'm still fighting my way through it and I reached another part I don't quite understand. code:
When I run it, I get a TypeError. So, it makes me think, that thing with get and append is where the problem is, but when I print just worddict.get(seasons[n]), without appending anything, it correctly returns an empty list. Please help me understand this better if this is not a correct read, but since an empty list is returned, isn't worddict.get(seasons[n]) effectively the same as an empty list, and therefore I feel I should be able to just append to it, but alas credburn fucked around with this message at 03:16 on Mar 16, 2022 |
# ? Mar 16, 2022 02:50 |
|
append is a function, but you're using square brackets after it as though it were a list you could index. That's where the type error is coming from. You probably intended to call the function using parentheses instead.
|
# ? Mar 16, 2022 03:00 |
|
Oh, yes, god dammit you're right. Sigh. Thanks.
|
# ? Mar 16, 2022 03:09 |
|
Let's say you work with people that insist on sending git-formatted patches through e-mail. Shouldn't everybody, like, explain the branch and commit to use as the base to apply the patch?
|
# ? Mar 16, 2022 03:10 |
|
credburn posted:
It's been a while since I looked at python, but couldn't / shouldn't you just be using i as the index instead of creating a new variable to track and increment? That is, code:
Double edit: does python let you do code:
Or even better (and if it does, correctly, that's quite nice) code:
Volmarias fucked around with this message at 07:51 on Mar 16, 2022 |
# ? Mar 16, 2022 07:42 |
|
credburn posted:Oh, yes, god dammit you're right. this is unrelated but- you might be removing this from your code snippets to keep it simple, but you should also try to get into the habit of adding comments to your code, it can really help comprehension and debugging later (even when it's your own code, rather than someone else's) for eg if your comment says "do Xa" but the code actually says "do Xb", you just saved yourself a lot of time going all sherlock holmes on your own typos and brainfarts, thinking "hm i wonder why i decided to do Xb" when it was a mistake all along I also use a lot of psuedocode as comments when I'm mapping out something more complex so that I can make sure it makes sense before I start and get bogged down in details. Then it just becomes filling it in and working out the kinks, kinda like mapping out an essay at uni by writing a structure first with key sentences etc and fleshing it out with more detailed citations and so forth. It has helped me a lot to avoid coding myself into a corner and going "ahh poo poo I actually need to handle this here, not there" E: this might be a little early for you, but in terms of dictionary values being more than just single strings: a dictionary key value can also be another dictionary with its own nested dictionaries, that's very common (you can look up JSON to see how large parts of the internet send complex data around). A dictionary key value can also be another function, rather than "dumb" data - so you could have a dictionary of functions that you look up by the key, which is used for more dynamic code and to help maintain readable code boofhead fucked around with this message at 09:32 on Mar 16, 2022 |
# ? Mar 16, 2022 09:21 |
|
Anyone who was some experience with UI/UX and more specifically usability testing might help me with this. I'm doing a small research project where I'll be doing some usability tests on a web application and was wondering what are good tools for remote usability testing (preferably unmoderated remote usability testing) that do not cost a lot of money, are free and/or have student licenses? Also what are good criteria for usability testing tools, like what features are must-haves and what features do you consider to be good to have but not absolutely necessary to do usability testing. Thanks in advance!
|
# ? Mar 16, 2022 09:43 |
|
boofhead posted:you might be removing this from your code snippets to keep it simple, but you should also try to get into the habit of adding comments to your code, it can really help comprehension and debugging later (even when it's your own code, rather than someone else's) Code you wrote sufficiently long ago is someone else's code.
|
# ? Mar 16, 2022 14:40 |
|
Volmarias posted:It's been a while since I looked at python, but couldn't / shouldn't you just be using i as the index instead of creating a new variable to track and increment? That is, Yessss i is a variable that increments every loop, of course I don't need a new one. Thanks for helping me clean this up.
|
# ? Mar 16, 2022 15:34 |
|
ultrafilter posted:Code you wrote sufficiently long ago is someone else's code. And that person is invariably the single worst coder you've ever heard of, thank god you would never make those sorts of mistakes again * groundhog day alarm clock rings *
|
# ? Mar 16, 2022 16:00 |
|
I think I'm an OK coder now but give it a couple months and future Protocol7 is gonna hate March 16th Protocol7.
|
# ? Mar 16, 2022 16:07 |
|
credburn posted:confusion I am also a semi-noob, completed my coding bootcamp a year ago. I learned a lot from doing mini challenges on Code Wars. It's great because you can spend ages writing some awful, messy code to solve the puzzle, and then you get to see everyone else's answer. Normally someone's been ultra-clever and done it in one line. But other people will have done something readable. It's a good way to find out the most "correct" solution, but also maybe see some less basic methods used. Also, most puzzles are available in multiple languages, and there's a wide range of difficulty.
|
# ? Mar 16, 2022 16:15 |
|
Protocol7 posted:I think I'm an OK coder now but give it a couple months and future Protocol7 is gonna hate March 16th Protocol7. This is the deep, dark truth of dev: you will come across something in six months time, say to yourself "what the gently caress, what loving idiot wrote this bizarre bullshit" and discover that the loving idiot was you all along. This happens to all of us, at all points in our careers, just embrace it.
|
# ? Mar 16, 2022 16:48 |
|
Excuse me - I've reached the point in my career where I realize I'm being a loving moron when I do it so my code is littered with "//I'm going to regret this" and "//if it's breaking this is probably why"
|
# ? Mar 16, 2022 16:52 |
|
It's more exciting if you're an amnesiac and the villain of the story was you all along!
|
# ? Mar 16, 2022 16:57 |
|
KillHour posted:Excuse me - I've reached the point in my career where I realize I'm being a loving moron when I do it so my code is littered with "//I'm going to regret this" and "//if it's breaking this is probably why" Buddy, if you aren't writing "// this is horrible and I hate that I'm writing this but " at least once a month, you're probably in management.
|
# ? Mar 16, 2022 16:58 |
|
killerwhat posted:I am also a semi-noob, completed my coding bootcamp a year ago. I learned a lot from doing mini challenges on Code Wars. It's great because you can spend ages writing some awful, messy code to solve the puzzle, and then you get to see everyone else's answer. Normally someone's been ultra-clever and done it in one line. But other people will have done something readable. It's a good way to find out the most "correct" solution, but also maybe see some less basic methods used. Also, most puzzles are available in multiple languages, and there's a wide range of difficulty. Oh, thanks for this! I've been looking for something like this that motivates me better. Presently, my only real goal is LEARN THIS and that's a lot to take on. Thanks again everyone for helping me with my dictionary assignment. I'm on minute 196 of this one goddamn assignment and I'm only a third finished. My next task goal here is to take any value that is a list with multiple values and separate the elements of said list with a semicolon. Once again I find myself perplexed as to why the output is what it is (oh, this is Python, in case) code:
I don't get an error, but the list doesn't change. I guess this is related to converting the list to a string, but I want to combine all elements within the list. I thought maybe I could do that by code:
Also: I sure don't want to overly clutter the forums. Would it be helpful to repost the entire program, or is it sufficient to just post the part that's giving me trouble? I believe all the code that precedes the problematic code is functional and ought to be left alone ha Anyway, presently the output looks like {'20': ['Gunsmoke', 'Law & Order'], ...} and I want it to look like{'20': ['Gunsmoke; Law & Order'], ...} credburn fucked around with this message at 18:05 on Mar 16, 2022 |
# ? Mar 16, 2022 17:35 |
|
ultrafilter posted:Code you wrote sufficiently long ago is someone else's code.
|
# ? Mar 16, 2022 17:54 |
|
credburn posted:Oh, thanks for this! I've been looking for something like this that motivates me better. Presently, my only real goal is LEARN THIS and that's a lot to take on. a few suggestions for how to approach this: 1. (not related to your problem) you essentially want to iterate through the key, value for each item in that worddict, right? this is a very common requirement - probably there's an easier way to do that directly rather than getting the len() and increasing the index each loop and referencing the same position in an array multiple times just to get the same value 2. (related to your problem) check more closely at what ";".join(array) and worddict.get(key) are doing.. are these methods that modify the original variable in place (less common in python), or do they return a value that you need to then do something else with? (e.g. save it to a new variable, or overwrite an existing variable with the value) 3. (not related to your problem) if you find yourself writing the same bit of code multiple times, it might be worth storing that in a variable (or, elsewhere, a function) that makes it easier to understand what's going on 4. (semi-related to your problem) every time you get an error from python that you don't understand, make a habit of googling it. python will tell you where the error occurs (i.e. which code is triggering it), and you can see if what you're trying to do makes sense also, the syntax and intention on this line are making python very unhappy (and this is also part of why python is triggering an error): code:
fe: also, if you find yourself banging your head against the wall, there are two common techniques to help combat this: 1. take a break and come back to it later -- get some fresh air, clean some dishes, have a shower or do some exercise. clear your head and break the loop of false/frustrated thinking 2. rubber ducky debugging -- go through the code line-by-line and explain verbally what it's actually doing (not what it SHOULD be doing) to a rubber ducky or an action figure or whatever object you have nearby real edit: if you also just straight up want an example of code that should do what you want, let us know. generally it's better to figure it out yourself but sometimes life doesn't really give you the space to bang your head against the wall for hours on end, and god knows i wouldnt have gotten anywhere without stackoverflow etc boofhead fucked around with this message at 18:22 on Mar 16, 2022 |
# ? Mar 16, 2022 18:15 |
|
Volmarias posted:Buddy, if you aren't writing "// this is horrible and I hate that I'm writing this but " at least once a month, you're probably in management. Yeah, but we do the same just in emails instead of code.
|
# ? Mar 16, 2022 20:56 |
|
|
# ? Jun 7, 2024 19:12 |
|
boofhead posted:real edit: if you also just straight up want an example of code that should do what you want, let us know. generally it's better to figure it out yourself but sometimes life doesn't really give you the space to bang your head against the wall for hours on end, and god knows i wouldnt have gotten anywhere without stackoverflow etc It's difficult to overstate the importance of sites like stack overflow. Putting the error message for something I don't understand into Google and examining the
|
# ? Mar 16, 2022 21:43 |