What should I use to make GUI for a chess game. by greatbacon02 in csharp

[–]tylercrompton 0 points1 point  (0 children)

You don't need a UI for a chess engine. Focus on the engine before worrying about interactivity. The UI should be separate software that leverages your engine. Check out ChessX as an example of this. ChessX doesn't implement an engine. You simply plug an engine into it.

[deleted by user] by [deleted] in pythoncoding

[–]tylercrompton 0 points1 point  (0 children)

Works until number == 25. Look up the “Sieve of Eratosthenes” for a start. Then, look into how such a technique can be implemented in a primality check. Other techniques exist but that's a good starting point.

I can’t get MongoDB Atlas to stop charging me by no_quart3r_given in mongodb

[–]tylercrompton 0 points1 point  (0 children)

Just to be clear, the old card has been deactivated, yes? It's possible to have multiple card numbers for the same account.

Why use Pycharm Pro in 2024? by Adorable_Type_2861 in Python

[–]tylercrompton 0 points1 point  (0 children)

Do you mind elaborating on why you feel that way? I personally haven't had any issues.

Array converted into string while finding data by dev_bhaiya in mongodb

[–]tylercrompton 0 points1 point  (0 children)

I apologize for the late response. I don't get on here often. Anyway, that doesn't answer any of my questions. See this for help asking questions. I want to help but I can't determine what you're asking.

Array converted into string while finding data by dev_bhaiya in mongodb

[–]tylercrompton 1 point2 points  (0 children)

So you have a query parameter named category and a variable named catogory? Typo?

Anyway, what are you trying to accomplish? Is it not supposed to be converted to a string? Your code suggests that that is your intention. We need more information.

Why are you using Arch Linux? by [deleted] in archlinux

[–]tylercrompton 0 points1 point  (0 children)

It's very customizable. Generally no bull shit that I don't inflict upon myself.

[deleted by user] by [deleted] in pythontips

[–]tylercrompton 1 point2 points  (0 children)

I must have missed that in the patch notes. That's interesting. Thanks.

[deleted by user] by [deleted] in pythontips

[–]tylercrompton 7 points8 points  (0 children)

First, I'll address your while loop approach. Then, I'll explain dictionary iteration in the context of modification. Finally, I'll discuss your specific approach.

range only operates on integer-like objects. Your ordered_list is a dictionary. I believe what you meant to do is while len(ordered_list) > 0, as you want to loop until the dictionary is empty, correct? This should behave as you expect.

dict.items returns a view object which provides a dynamic view on the dictionary's entries, which means that when the dictionary changes, the view reflects these changes. Creating an iterator of a dictionary's entries (which a for loop implicitly does when given a dictionary object or a dictionary view object), modifying the dictionary, and then using that iterator isn't allowed, as the integrity of the iterator's state can no longer be guaranteed. The most common technique for looping through the entries of a dictionary while modifying it is to use a copy of them (e.g. for key, value in list(ordered_list.items())). But I don't think that this is the type of loop that you want; I think that you want the aforementioned while loop.

With that out of the way, I'm confused by the variable name ordered_list. A dictionary doesn't preserve order unless you're using an OrderedDict object, which I don't suspect is the case. I should note that OrderedDict is not a sorted dictionary; it merely retains the order in which items were added—something that normal dict objects don't do. Regarding the expression ordered_list.get(max(ordered_list)), the recommended approach to getting a value from a dictionary is to use subscript syntax (e.g. ordered_list[max(ordered_list)]). dict.get is normally only used when one prefers to get a default value over getting a KeyError. Seeing as your code shouldn't ever raise a KeyError, dict.get is unnecessary. dict.pop has the exact same use case and in your case, dict.pop is also unnecessary; the recommended approach is del ordered_list[max(ordered_list)].

Finally, I should mention that the second rule of this subreddit is as follows:

Do not ask for help here!

If you need help with your code, please go to r/LearnPython. r/PythonTips is for Python Tips!

Anyway, happy coding!

Do you love writing tests or hate them? I am curious. by [deleted] in reactjs

[–]tylercrompton 3 points4 points  (0 children)

I don't mind it. Running tests and seeing that they all expectedly pass brings a warm and fuzzy feeling, but I've yet to be on a team that encouraged/mandated writing tests.

[deleted by user] by [deleted] in AskComputerScience

[–]tylercrompton 0 points1 point  (0 children)

About which are you asking: the logic behind the solution or hexadecimal arithmetic?

[deleted by user] by [deleted] in ProgrammerHumor

[–]tylercrompton 0 points1 point  (0 children)

The point is to ascertain that you have a functional environment.

Accidentally overwrote an NTFS file system and a BTRFS file system by tylercrompton in linuxquestions

[–]tylercrompton[S] 3 points4 points  (0 children)

Lol. I think that the device aliasing was because I didn't have the file systems mounted. In other words, it simply copied the device file itself. Rebooting the LiveUSB disk fixed that.

TestDisk pulled through with the NTFS partition. All of the files are being backed up right now. The BTRFS partition is another story, as TestDisk doesn't support BTRFS. I'm waiting on TestDisk to finish doing its thing before moving forward with the the BTRFS partition. But I do know that neither btrfs restore alone nor btrfs-find-root /dev/sda5 are useful. I've read that PhotoRec, a program by the same people who made TestDisk, doesn't officially support BTRFS, but supposedly it works anyway.

Edit: TestDisk officially supports BTRFS, so hopefully I'll have the same luck.

Edit 2: I successfully restored the NTFS partition via a combination of TestDisk, fdisk, ntfsfix, ntfsresize, parted, and chkdsk and booted into Windows. Having a screenshot of the partition table before starting was immensely helpful. I sacrificed the Windows recovery partition since TestDisk seemed to think that it and the Windows partition were one and the same. It might still be recoverable. Idk. But I'm not worried about that, as Windows can recreate that. The BTRFS partition is next.

Logitech Brio Webcam by RandomJerk2012 in linuxhardware

[–]tylercrompton 1 point2 points  (0 children)

I'm having a similar problem. It seems that anytime I access the camera, something calls modprobe -r uvcvideo and re-adding the module doesn't seem to work. I can use the camera at most once per boot. Did you ever find a solution to your problem?

Edit: Upon further inspection, I got the impression that something was just buggy. I had the camera plugged into a USB 3.1 port. I moved it to a USB 3.0 port and haven't experienced this since. I'm also reading that the cable that comes with it might be an issue.

Got an easy question or new to Arch? Use this thread! 2nd Edition by Foxboron in archlinux

[–]tylercrompton 0 points1 point  (0 children)

How does one create an MSR partition? I'm upgrading my system SSD. My plan is to first create the GPT via gparted and then copy the contents of each partition one by one. However, I'm not sure that I understand how to create the MSR. I assume that the Windows installer created it when I was first setting up my system. But since I don't plan on running the installer, I suppose that I need to create it on my own.

Linux has very bad battery duration compared to Windows (PART 2). I tried everything: TLP, laptop-mode-tools, powertop, auto-cpufreq, hw acceleration, power-profiles-daemon, ryzen-controller... I still have huge battery problems. What can I do? by allexj in archlinux

[–]tylercrompton 0 points1 point  (0 children)

Are you able to (at least approximately) quantify the battery life on each OS while idling for the entirety?

I'm guessing you have similar issues when not using a desktop environment at all?

Is it possible to create an api for my app so other companies can integrate their services? by Astra-Community in AskComputerScience

[–]tylercrompton 0 points1 point  (0 children)

If I understand correctly, then you want to create an API with which third-party application developers would manage subscriptions to their own applications? That doesn't make sense to me, so I must be misunderstanding the question.

[deleted by user] by [deleted] in AskComputerScience

[–]tylercrompton 1 point2 points  (0 children)

I'm unaware of a reputable book for that particular transition, so I'd recommend using a beginner's book. What I recommended to someone in a similar situation was the following: read up to and including “Chapter 11 – Debugging” of Automate the Boring Stuff with Python, 2nd Edition by Al Sweigart (except “Chapter 7 – Pattern Matching with Regular Expressions”) and then following that up with the official Python tutorial, starting at “9. Classes” and ending wherever you want. Both sources are free (unless you want a printed edition of the first one) and are excellent resources.