Live data from Hacker News

When I say “alphabetical order”, I mean “alphabetical order”

sebastiano.tronto.net

61–70 of 385 posts

Re: When I say “alphabetical order”, I mean “alphabetical order”

#61
By the way, there seems to be a "standard" way to sort strings:

> Unicode Technical Report #10 also specifies the Default Unicode Collation Element Table (DUCET). This data file specifies a default collation ordering.

https://en.wikipedia.org/wiki/Unicode_collation_algorithm

I assume this mainly aims at giving a reasonable compromise between the different dictionary and phone book sorting rules of various languages (and even locales), which should give reasonable results for most languages. I assume this also puts "Alice2" before "Alice10".

Re: When I say “alphabetical order”, I mean “alphabetical order”

#62
post #59

I agree with Microsoft/Google/KDE's order. The author's situation is extremely rare, and the situation where someone wants "10" to be before "9" is far more common. Moreover, desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying. > I miss the time when computers did what you told them to, instead…

The file sorting isn’t something relegated to niche users because of the prevalence of tv episode file name sorting (eg S01e01) and it has necessitated the leading zeroes to make it work properly with “alphabetical sorting”.

And that would sort correctly with both methods, though, especially when each "field" is delineated (e.g. Show.S0XE0Y.Episode.Name.HEVC.1080p.mkv)

Re: When I say “alphabetical order”, I mean “alphabetical order”

#63

I agree with Microsoft/Google/KDE's order. The author's situation is extremely rare, and the situation where someone wants "10" to be before "9" is far more common. Moreover, desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying. > I miss the time when computers did what you told them to, instead…

Both should be supported.

Perhaps put the uncommon (true alphanumerical order) behind a nested menu or something. But the mind-reading-less option should be there.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#64
post #42

I think the algorithm is probably incorrect. A number starting with 0 should be treated lexically not numerically. Otherwise you have a situation where img_1_01.jpg and img_01_1.jpg does not have a complete ordering.

That's not the issue.

The issue here is that one camera appends milliseconds to the seconds without a separator, and the other uses a separator.

So of course the ones that include milliseconds look like bigger numbers and get sorted last.

Leading zeros aren't the issue here.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#65
post #35

> Well, apparently all these operating systems have decided that no, users are too dumb and they cannot possibly understand what alphabetical order means. So when you ask them to sort your files alphabetically, they don’t. Instead, they decide that if some piece of the file name is a number, the real numerical value must be used. Well, no. You don't actually ask them to sort in alphabetical order. You ask them to sor…

Clearly a leading zero means the number is in octal (but only if all the subsequent digits are between 0 and 7). I think that would lead to the most intuitive results.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#66

I almost always want the version-sorting that's being presented in this article, rather than an "alphabetical" sort. But on the other hand, it absolutely seems like a valid bug that this is presented as an "alphabetical" sort, rather than something like "alphabetic/numeric" or similar. In other words, a problem of labeling rather than one of sorting.

Notably, some versions of “sort” on Linux have version sort nowadays. sort -V

I actually don’t know exactly how it works internally and it is a little bit magical, but I use it all the time when looking through my files because it just sorta works in most cases. Of course a nice thing about it is easy to turn on or off.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#67
post #60

I agree with Microsoft/Google/KDE's order. The author's situation is extremely rare, and the situation where someone wants "10" to be before "9" is far more common. Moreover, desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying. > I miss the time when computers did what you told them to, instead…

I'm not sure I agree. I think I could be convinced if there was a unique and universal representation for numeric values using characters. But we have so many textual representations of numeric values that I'm assuming the "mind-reading" goodness only works for a small subset. And the subset will be somewhat intuitive for developers but unlikely to be so for non-technical people. For example, does the order handle nu…

Are filenames likely to include those representations? I feel like probably not (can you even include commas in Windows filenames?)

More to the point of the article--if you want things sorted by date, sort by date. I think most laypeople aren't looking at long CHAR1234_5678 filenames anyway, they're looking at thumbnails and dates.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#68

I agree with Microsoft/Google/KDE's order. The author's situation is extremely rare, and the situation where someone wants "10" to be before "9" is far more common. Moreover, desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying. > I miss the time when computers did what you told them to, instead…

> and the situation where someone wants "10" to be before "9" is far more common.

I guess you mean "after"? Otherwise it seems to me you're agreeing with OP.

> desktops don't label this sorting "alphabetical" (E: and it would really be "lexicographic"*), they label it "by name" (an informal criteria), so technically they're not lying.

FYI the more formal name for the "by name" order is "natural sort order".

Re: When I say “alphabetical order”, I mean “alphabetical order”

#70
Be glad you don't have to deal with non-ASCII characters: acute/grave/tilde/umlaut/diaresis/etc. accented characters, dotted vs. dotless 'i' (Turkish), barred i (an 'i' with a sort of dash through the middle, used in some languages for a sort of schwa-like vowel), thorn, not to mention non-Roman characters. And different languages sort the same characters differently, so you can't just pay attention to their Unicode values. (@cubefox has a post here pointing to the Unicode Consortium's doc about sorting)
Post reply on HN