this post was submitted on 28 Nov 2024
90 points (95.9% liked)
Linux
48461 readers
415 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I believe it's correct. If you sort say "A", "AA", "AAA" then you get
Because the first character is compared, which are all the same, then the second. The first one has no second character, so it comes first. The second has no third character, so it comes before the third item.
In your scenario, you have:
The first characters are the same, so it looks at the second character. Item 1 has no second character so it comes first.
Scenario 2:
The first character is the same, so it looks at the second character. The second characters are "." and " ". The "." comes first in the character ranking so is shown first.
yes yes I get what you're saying but it's still odd. Didn't humans do this differently in the old analog days? I'm sure any human when working with a real paper archive in front of him, order 5 A before 5.5 A. Perhaps it has something to do with viewing 5 as 5.0 and 5.00, since they are mathematically equivalent, and come before 5.5. Although humans would also be inconsistent because they would order 5.9 before 5.11 if the context were to be chapters going from 5.9 -> 5.10 -> 5.11. But if these papers were to represent values, humans would order 5.9 AFTER 5.11. And computers obviously don't make exceptions based on context like humans do.
edit: if I understand correctly, I'd be cleaner if spaces come first in character ranking of ANY character. Perhaps that'd make it more human readable.
Humans aren't sorting this though. A computer is.
How should 5.2 and 5.12 be sorted? Numerically 5.12 is less than 5.2. But if it's a version then it's "five dot twelve" and thus 5.12 is greater.
These are contextual things that are very difficult for a computer to know. And trying to guess often just makes things weirder. So they often sort in a way that is at least consistent.
If a person was ordering them, they would do it in numerical order. Despite these being numbers, the computer is still ordering in alphabetical order.
Doing it the way a person would requires the file manager to understand context, which requires a lot more logic for arguably little benefit.
I note that your season and episode start with 0 as well (S01E05), in order to ensure the alphabetical ordering works. Perhaps you should use 5.0 to solve this in the same way.
I'm so glad KDE Dolphin has a "natutal sorting" option. Not sure about this specific case, but I have never been surprised by the order with that setting.
Would be interesting to check the code behind it.
It's an API call which emails a guy who just does it real fast by hand