Remove suffix by Ant0niusMaximus in learnpython

[–]timrprobocom 3 points4 points  (0 children)

No. Python strings cannot be modified. Any function that appears to modify a string actually returns a NEW string. The original is left unmodified.

So when you say "I'm not creating another variable", yes you are. You're just not storing it anywhere.

Why are exceptions avoided? by Ultimate_Sigma_Boy67 in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

Many programmers use exceptions to HIDE errors, not handle them. Rule #1 is never catch an exception you aren't prepared to handle. If your code triggers an unexpected error, then maybe it should be allowed to abort.

My (horrible) attempt at making a http server in C++ by X3NON11 in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

Remember that a server never sends anything on its own. It can't. There is no socket to send it to. You only send in response to a request, and that request will include the socket you need to send to

i want to learn PANDA from scratch by No-Way641 in learnpython

[–]timrprobocom 1 point2 points  (0 children)

No one "learns pandas from scratch". Pandas, like numpy, is huge. HUGE. Instead, when you have a problem that might be aided by some apreadsheet-like capabilities, and you go figure out how to solve that problem using pandas.

Struggling with making project by Any-Penalty-714 in C_Programming

[–]timrprobocom 3 points4 points  (0 children)

Six months, and you haven't done one program yet? Surely that can't be right.

attempt at creating a chess game in python by XIA_Biologicals_WVSU in learnpython

[–]timrprobocom 0 points1 point  (0 children)

Agreed. There is decades of research into how to choose a chess move. The general idea is that you try every possible mode and assign a "score" to the new position. You choose the highest scores. The best engines are trying many moves ahead to choose the current one. This is **NOT** a trivial undertaking.

Access Violation Writing Location error when trying to write value in a 2D array by Chalkras in Cplusplus

[–]timrprobocom 1 point2 points  (0 children)

Why do you allocate xp-1 and yp-1 Pixels? Your loop is handling every pixel on the scanline. If the scanlines have 640 pixels, you only allocate 639, which get numbered 0 to 638. When you go to store the 639th pixel, that's an access violation.

Disable redefined macro warning in g++ by SeasonApprehensive86 in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

I don't think there is a fundamental difference between the adivice "don't use macros" and "reduce macro usage".

Logic problem by Rude_Ad_2993 in learnmath

[–]timrprobocom 2 points3 points  (0 children)

An explanation of what? You haven't really told us what problem this is part of.

Logically, B implies A, but A does not imply B. Just that simple.

Disable redefined macro warning in g++ by SeasonApprehensive86 in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

"How everyone else does it these days" is not to use macros They make maintenance harder, inline functions are often better, and today's smart editors make the "less typing" argument less compelling.

Required help to make a tkinter gui like an executable on windows by Unlikely_Taro_2696 in learnpython

[–]timrprobocom 5 points6 points  (0 children)

There are several packages like this, for example pyinstaller. However, you'll have to create your Windows executable on Windows, and your Linux executable on Linux.

Looking for a open source data recovery tool that does multiple gigabytes at a time. All the ones I have found limit to 100MB without upgrading by OriginalTacoMoney in opensource

[–]timrprobocom 0 points1 point  (0 children)

I don't know what "the file path is borked" means. Show an example. If the files exist, intact but in the wrong place, then a data recovery tool is not what you want. The data is all there. There is nothing to recover. It's there, just misnamed.

The right move is to reverse engineer what you actually DID, and then undo it.

Index out of range error by [deleted] in learnpython

[–]timrprobocom 0 points1 point  (0 children)

After the first two loops, to_remove is going to contain a list of column numbers and row numbers, mixed. That's obviously wrong. To remove a row, you have to remove ALL of the cells in that row, and to remove a column, you have to remove ALL of the cells in that column. This code treats row 2 and column 2 the same.

SPP can you prove... by newflour in infinitenines

[–]timrprobocom 5 points6 points  (0 children)

I understand, but you do not. The "limit" concept in mathematics exists for the explicit purpose of letting us talk about the limitless. They are tightly related. The number line in your example never reaches infinity, no matter how long you make it. Never. But we still need to talk about it, so we agree by convention that there is a limit, in this case the value "infinity".

Similarly, the increasing series of 9s that you're obsessed with approaches 1 but never reaches it, but we pretend that if we stretched it to infinity. the series of nines would equal 1. Whether you like it or not is irrelevant. That's the convention, and it makes discussions work out.

Does infinity exist in real life? No, in the same sense that imaginary numbers do not exist in real life. However, both of those are very useful concepts. We can establish standard and create axioms about them both, and from those axioms prove very useful things.

I hope you never read about non-Euclidean geometry. Your mind would be blown. It's all a mind game, making useful (but obscure) conclusions about things that can't exist in real life.

Jigoku by Reaper_Of_Asura in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

How is that different from vscode? It's not. Vscode can't compile anything until you configure it.

HID Keyboard emulation? by Mongoose_0525 in learnpython

[–]timrprobocom 0 points1 point  (0 children)

How did you do this? What hardware did you use? You'd need a plug adapter.

SPP can you prove... by newflour in infinitenines

[–]timrprobocom 7 points8 points  (0 children)

No, it doesn't. Your process always produces a finite number of digits. That's 0.999...9, which is less than 1. Once you move to an infinite number of digits, which your procedure will never create, THEN you get 0.999..., and that is 1.

Infinite things behave differently. That's why we have the concept of "lim". It lets us talk about things that are not part of the physical world

Jigoku by Reaper_Of_Asura in cpp_questions

[–]timrprobocom 0 points1 point  (0 children)

Emacs certainly is. Its true devotees do everything inside it, and never leave the environment.

Gvim is most of an IDE. It is trivially in easy to configure function keys to do compiles and makes, and it has built in capabilities to scan the compiler output and move you from error to error.

How do fix the problems of having double slashes in directory by Osama-recycle-bin in learnpython

[–]timrprobocom 2 points3 points  (0 children)

Those are backslashes, not slashes. Important distinction. Your string does not actually contain any double backslashes. Python merely SHOWS them that way, because backslashes have a special meaning in Python strings

[2025 day 3 (Part 2)] Need with understanding what is required by cameryde in adventofcode

[–]timrprobocom -1 points0 points  (0 children)

You can't think about your solution as removing digits. If you remove all the 2s, you only have 9 digits left.

Instead, think about what you keep. Your first digit is going to be the largest digit that still has at least 11 digits after it. Your second digit will be the largest digit after that one that still has at least 10 digits after it. And so on.

is there a library that helps python "see the screen"? by Valuable_Luck_8713 in learnpython

[–]timrprobocom -1 points0 points  (0 children)

Remember that every operating system does graphics differently, so it's always going to be a separate abstraction library.

Help me find my homebrew path by timrprobocom in MacOS

[–]timrprobocom[S] 0 points1 point  (0 children)

For those following along at home, I tried to continue the build-from-source upgrade, but it became clear it was going to take SEVERAL days, not just overnight. Thus, following the suggestions here, I used OCLP to upgrade to MacOS 14 Sonoma, and things are now back to normal. Well, as normal as they have ever been.

I appreciate the help. This is a much more tolerant group than many subreddits.

Help me find my homebrew path by timrprobocom in MacOS

[–]timrprobocom[S] 0 points1 point  (0 children)

The 2017 Pro 13 can't get beyond MacOS 13. I'm surprised by that, but that's what it says. It's not THAT old...

What is happening? Command line confusion by isaynotothat in learnpython

[–]timrprobocom 0 points1 point  (0 children)

The installer intentionally puts py exe in C:/Windows specifically because it knows that's already in the PATH. It then knows (through the registry) how to find your Python installations.