|
KillHour posted:I do this for a living and PDFs are literally the worst. Every document will be different and it will always be a finicky pain in the rear end. This. MrMoo posted:Feed it to ChatGPT-4-vision and have it OCR the content and render as a CSV? I've had it hallucinate or displace nested stuff like this but that was prob a year ago so could be way better now. Also worth mentioning, Amazon Textract. I've not had GREAT results with it, but sometimes it hits the nail on the head and its easy enough to try it out manually if you have an AWS account. Nested headers are proper hosed though. If possible, I'd prob do the column headings manually and try to extract an image of just the table data and feed that to textract. I'd expect that to work decently. CarForumPoster fucked around with this message at 14:10 on Apr 18, 2024 |
# ? Apr 18, 2024 14:05 |
|
|
# ? May 4, 2024 17:10 |
|
Jesus, I feel like I'm having a stroke. Help me goons:pre:counter = 10 while (counter>0): counter = counter//2 5 4 The loop never ends 3 My gut says 4 times. 10/2 =5, 5//2 =2, 2//1 = 1 //2 = 0. pre:Which of the following values for n will cause the loop to never end/terminate? Group of answer choices 10 8 7 9 pre:Re write as a correct loop based on the three parts of the loop doAgain = "y" while doAgain == "y": word = input("Enter a word:") print("First letter of " + word + " is " + word[0]) doAgain = input("Type ‘y’ to enter another word and anything else to quit.") print("Done!") BUT THIS ALREADY WORKS?! edit: I thought about this and this loop has no exit condition. so, pre:1 doAgain = "y" 2 3 while doAgain == "y": 4 5 word = input("Enter a word:") 6 7 print("First letter of " + word + " is " + word[0]) 8 9 doAgain = input("Type ‘y’ to enter another word and anything else to q uit.") 10 if doAgain != "y": 11 print("Done!") I may be missing something here but whenever I ran that first bit of code with a print(counter) it just outputs zero. A Festivus Miracle fucked around with this message at 21:04 on Apr 21, 2024 |
# ? Apr 21, 2024 20:58 |
|
A Festivus Miracle posted:Jesus, I feel like I'm having a stroke. Help me goons: If the second is a continuation of the first one with no extra information it makes no sense both because of the reason you have stated and because... there is no variable n in the first place? For the third one yeah it makes no sense because it already works. Basically your teacher is still awful I'm sorry.
|
# ? Apr 21, 2024 21:56 |
|
i would assume by "correct loop" they do not mean "runs without errors" but "follows whichever dogmatic loop style-guide the professor told you to use in lecture"
|
# ? Apr 21, 2024 22:07 |
|
RPATDO_LAMD posted:i would assume by "correct loop" they do not mean "runs without errors" but "follows whichever dogmatic loop style-guide the professor told you to use in lecture" This is, unfortunately, the most likely answer
|
# ? Apr 21, 2024 22:18 |
|
RPATDO_LAMD posted:i would assume by "correct loop" they do not mean "runs without errors" but "follows whichever dogmatic loop style-guide the professor told you to use in lecture" It's this. Another gem posted with roughly as much context as I had from her: pre:number = int( input ("Enter a value greater than 0")) product = 0 while (number >=0): for x in range (1, 3): product = number * x + product number = int( input ("Enter a value greater than 0")) print (product)
|
# ? Apr 22, 2024 05:39 |
|
I'm going to take another class with this lady this fall, and I'm starting to realize that not only is she hopelessly incompetent at teaching, she's absolutely stuck on dogmatic ideas of what code should look like. I have no choice, it's the only offering of the class at the college
|
# ? Apr 22, 2024 05:41 |
|
A Festivus Miracle posted:I'm going to take another class with this lady this fall, and I'm starting to realize that not only is she hopelessly incompetent at teaching, she's absolutely stuck on dogmatic ideas of what code should look like. I have no choice, it's the only offering of the class at the college complain to the dean and provost
|
# ? Apr 22, 2024 06:53 |
|
leper khan posted:complain to the dean and provost Seriously. This lady is arguably harming your education more than they're helping.
|
# ? Apr 22, 2024 07:52 |
|
lol at complaining to the dean that some teacher doesn’t like your coding style I’m sure they’ll get RIGHT on that But yes if this lady could code competently she’d make $100k doing it and not $40k. Also camel case in Python so you know she don’t know Python.
|
# ? Apr 22, 2024 11:48 |
|
CarForumPoster posted:lol at complaining to the dean that some teacher doesn’t like your coding style It's more "has a long history of assignments where she only accepts outright wrong answers", from what we've seen.
|
# ? Apr 22, 2024 11:57 |
|
Computer viking posted:It's more "has a long history of assignments where she only accepts outright wrong answers", from what we've seen. yeah. if you really want to screw with the school report to the accredidation board.
|
# ? Apr 22, 2024 13:20 |
|
Computer viking posted:It's more "has a long history of assignments where she only accepts outright wrong answers", from what we've seen. Oh I agree theyre incompetent and terrible. OP needs to know more than OP knows now to articulate why that is and reap any benefit. Like yea they can whistle blow, but how does OP gain from that? The type of person who is so dumb and bad at coding to do what we're accusing them of here is the type to retaliate.
|
# ? Apr 22, 2024 13:33 |
|
Computer viking posted:It's more "has a long history of assignments where she only accepts outright wrong answers", from what we've seen. Unlike working as a professional programmer, right?
|
# ? Apr 22, 2024 13:47 |
|
A Festivus Miracle posted:Jesus, I feel like I'm having a stroke. Help me goons: the correct answer is "what the gently caress is n?" there is no n in that code.
|
# ? Apr 22, 2024 14:49 |
|
CarForumPoster posted:Oh I agree theyre incompetent and terrible. OP needs to know more than OP knows now to articulate why that is and reap any benefit. Like yea they can whistle blow, but how does OP gain from that? The type of person who is so dumb and bad at coding to do what we're accusing them of here is the type to retaliate. If they have to take a class with this person again, maybe the answer is "a better teacher who is actually going to know what they're doing"
|
# ? Apr 22, 2024 18:48 |
|
I’m all for doing something to achieve that outcome but he should know it carries some risk. I suspect he’s gonna need some political capital or an exceptionally well articulated argument for that to happen.
|
# ? Apr 23, 2024 02:04 |
|
That second question is super fishy. These feel like they were written via LLM and consistently wrong answers would track. Like, what is the double slash divide? Is that actually a thing or just an extraneous escape character being glossed over by everyone? Why the unbulleted multiple choice in a weird order? Textual shakeup answers are usually the last one. The second question does the same and what is this random 'Group of answers choices' line? Can you show us more from this teacher? Six edit pileup: Didn't even notice the third one. A Festivus Miracle posted:
I really hope the teacher is just incompetent instead of this being LLM poo poo, because it 1000% smells like LLM poo poo and you deserve way better. Ranzear fucked around with this message at 03:11 on Apr 23, 2024 |
# ? Apr 23, 2024 02:05 |
|
Ranzear posted:Like, what is the double slash divide? Is that actually a thing or just an extraneous escape character being glossed over by everyone? a // b is equivalent to floor(a / b).
|
# ? Apr 23, 2024 04:16 |
|
Ranzear posted:Like, what is the double slash divide? Is that actually a thing or just an extraneous escape character being glossed over by everyone? If the code is Python, that should be a flooring divide as normal Python 3 division is always in floating point. e: beaten
|
# ? Apr 23, 2024 04:17 |
|
Thanks. Never seen it before. Does it show up in any other language? As weird as teaching trivialities of triple-equals otherwise. Festivus will have to clarify if that was actually taught as a concept or just came out of nowhere too. I was taught in 2.7 entirely despite 3 being out for years.
|
# ? Apr 23, 2024 04:40 |
|
Integer division is pretty common but I don't know of any other language that has a built in operator for floor division. (The two are equivalent when the quotient of the arguments is positive but not in general. -1 // 2 is -1 but int(-1 / 2) is 0.)
|
# ? Apr 23, 2024 04:42 |
|
I hate that some languages define integer division and modulus such that the result of the modulus operation can be a negative number depending on the signs of the operands. The result of the modulus operation should always be nonnegative. i have a major bee in my bonnet about this.
|
# ? Apr 23, 2024 08:50 |
|
Hammerite posted:I hate that some languages define integer division and modulus such that the result of the modulus operation can be a negative number depending on the signs of the operands. The result of the modulus operation should always be nonnegative. i have a major bee in my bonnet about this. After the first time that my C# game's code got a negative index when doing the ol' "use the modulus operator to ensure that my index is within the bounds of the array" trick, I wrote my own "Mod" function and never looked back. I'm sure there's a good reason for why it behaves the way it does, and it's entirely possible that, mathematically speaking, my code is "incorrect". But dammit this is what the modulus is for.
|
# ? Apr 23, 2024 12:07 |
|
TooMuchAbstraction posted:After the first time that my C# game's code got a negative index when doing the ol' "use the modulus operator to ensure that my index is within the bounds of the array" trick, I wrote my own "Mod" function and never looked back. I'm sure there's a good reason for why it behaves the way it does, and it's entirely possible that, mathematically speaking, my code is "incorrect". But dammit this is what the modulus is for. i ran into the same thing when i figured out some math in excel using MOD then tried to port it to c#. ended up doing it a different way because i didn't want to explain why a % b is hosed for negative numbers
|
# ? Apr 23, 2024 12:34 |
|
Just wait until you find out that mod in HLSL works like C, but mod in GLSL works the other way.
|
# ? Apr 23, 2024 14:05 |
|
// is mostly just something added to make porting to python 3 easier. They changed the behavior of / in 3 so they added a new operator to get the python 2 behavior. I don't think they would have bothered if they had been designing the language from scratch.
|
# ? Apr 23, 2024 16:24 |
|
Hadlock posted:Pretty open ended question Cross posting KRILLIN IN THE NAME posted:paging TWD to the thread
|
# ? Apr 23, 2024 17:19 |
|
An important thing to remember is that there are classes of problem where the most naive, unoptimized solution is still fast enough.
|
# ? Apr 23, 2024 17:24 |
|
I'd imagine it makes it drastically easier to debug and discover unintended behavior etc. I just thought it was interesting
|
# ? Apr 23, 2024 17:39 |
|
On the one hand, code designs like this pragmatically solve a lot of thorny issues about interactions between effects and the order in which effects are applied. On the other hand, they’re also prone to causing a lot of bugs where effects that absolutely don’t need to interact accidentally do. For example, in Dota 2, every hero except Invoker has the same restrictions on leveling their ultimate ability: you need to be level 6 to put the first point in, level 12 for the second, and level 18 for the third. There was a recent bug (that came up in a recent tournament) where a certain item (that does not have any designed impact on ability leveling) removed this restriction for a specific hero. I feel very confident that that bug was ultimately caused by terrible code structure.
|
# ? Apr 23, 2024 18:41 |
|
If you ever read the changelogs for game updates sometimes you'll see very specific stuff like "fixed problem of armor not appearing in chest after talking to village blacksmith with dwarven fighter character" and you just know the code is a big ol' nest of switch/cases and if/elses.
|
# ? Apr 23, 2024 19:17 |
|
There's a very similar block of code in Waves of Steel, which does parameter parsing and function dispatch for the game's domain-specific scripting language. There's nothing fundamentally wrong with it; you gotta encode the complexity somewhere. As long as there isn't too much boilerplate or repetition, it's fine.
|
# ? Apr 23, 2024 19:23 |
|
The only perplexing thing about that to me is that it's a huge pile of if-then-return rather than a huge table constant and then return ability_info[self.ability.name] or so.
|
# ? Apr 23, 2024 19:33 |
|
KillHour posted:An important thing to remember is that there are classes of problem where the most naive, unoptimized solution is still fast enough. Interviewers don’t like it though
|
# ? Apr 24, 2024 02:18 |
|
MrMoo posted:Interviewers don’t like it though Literally today at work, there was a situation where the three options for running a query were SQL, XQuery or [property query language]. The proprietary language was the fastest, the XQuery was the longest / hardest to understand and 50% slower, and the SQL was the slowest by 100% but a 1-liner. I told them to use the SQL.
|
# ? Apr 24, 2024 02:49 |
|
A Festivus Miracle posted:
IE it's a simple example of obfuscated code. A Festivus Miracle posted:she's absolutely stuck on dogmatic ideas of what code should look like. My advice, write your code, use the pep8 tool if it doesn't completely destroy your code, then find an external/separate tool that can handle custom formatting options and use that to get submissions closer to DummTeacherCode.py. Advanced level is to write the tool yourself, put it on GitHub maybe, but certainly use it as interview leverage. "The simplest way is to use tools to achieve some code parity so teams can spend their time arguing over things that actually matter... like variable names ". PhantomOfTheCopier fucked around with this message at 02:43 on Apr 26, 2024 |
# ? Apr 26, 2024 02:29 |
|
I think I want to do something with containers but I am not sure how or even what. I have to prepare a disk image for CI/CD with an emulator. I start with an .img file with the root and boot EFI partitions. The OS is running a Debian variant where I want to install some more packages using both apt to hit some servers and also dpkg to install some packages I copy into the image. I am trying to do this without involving root. I found with guestmount that I can mount and manipulate the filesystem as a regular user. I have not found similar to chroot. Or specifically, I cannot bind system mount points to have the chroot properly run apt and friends without involving root. A particularly difficult problem here is installing a new kernel package because that relies on some stuff beyond what is in boot. Some stuff in /run? I don't immediately remember. Also, apt can be testy without the parent's resolv.conf. It smells like I should use containers for this, but I guess I am basically defining my own custom container and then having that get modified--rather than downloading one defined from a public repository. The image does have a bunch of stuff on it I ultimately need, and I don't want to try to boot it in an actual VM to do what else I have to do. So generally, what approaches should I try? I am currently looking into LXC and seeing if I can butcher the existing Debian YAML to do what I need, but that is going straight into the deep end.
|
# ? May 2, 2024 04:14 |
|
Use packer It's a hashicorp product that is purpose built for defining and building images
|
# ? May 2, 2024 13:54 |
|
|
# ? May 4, 2024 17:10 |
|
Hey Goons, your gracious assistance please. So, I wrote a game of Pig, which is a dice game in which two players roll a dice, and then add that dice roll to their score. First to 100 wins. The catch is, if you roll a one, your turn ends and the turn switches to Player 2. For ease of testing, I set the win condition for the code at 30. This was for an assignment. My professor said 'no while loops' so I refactored the code into two long for loops. And of course, professor says "we don't break out of loops in this class". So, uh. Here's the code pre:#this program simulates a game of pig import random import time player_one_score = 0 player_two_score = 0 current_player = "Player One" for game_round in range(1, 101):#using an extremely long for loop to simulate 100 rounds print(f"It's {current_player}'s turn.") turn_score = 0 for roll_count in range(40): #going to be randomly extremely statistically unlikely to reach this limit roll = random.randint(1, 6) print(f"{current_player} rolls a {roll}") time.sleep(1)#for ease of play if roll == 1: print("You rolled a 1. Switching to the other player's turn.") time.sleep(1) if current_player == "Player One": player_one_score += turn_score current_player = "Player Two" else: player_two_score += turn_score current_player = "Player One" break else:#if player doesn't roll a one, asks user if they want to roll again turn_score += roll print(f"{current_player}'s score: {player_one_score + turn_score if current_player == 'Player One' else player_two_score + turn_score}") choice = input("Roll again? (y/n): ").lower()#lower to filter input if choice == 'n':#not a super fan of this, but it works if current_player == "Player One": player_one_score += turn_score current_player = "Player Two" else: player_two_score += turn_score current_player = "Player One" break if player_one_score >= 30 or player_two_score >= 30:#from 100 to 30 so this doesn't take a super long time break if player_one_score >= 30: print(f"Congratulations! Player One wins with a score of {player_one_score}") if player_two_score >= 30: print(f"Congratulations! Player Two wins with a score of {player_two_score}")
|
# ? May 4, 2024 03:11 |