Live data from Hacker News

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

sebastiano.tronto.net

131–140 of 385 posts

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

#131
post #20

That’s why I don’t even bother with the file name for photos. 1. Sync all equipments to the same clock. 2. Sort by Date Taken, if unavailable, sort by Date Created.

Yes, sounds to me like the user really wanted to sort by time created. And got used to sorting alphabetically as a poor proxy for that.

When copying files from a device and then between systems, too often the dates get lost (shouldn't, but still...)

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

#132
post #60

Earlier quoted context omitted.

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…

The sort rules are simple (1). Treat any consecutive sequence of digits as a number when sorting. So for example version numbers (which must be massively more common than decimals in filenames) work correctly, and 5.9 is indeed smaller than 5.10 and the latter is not identical to 5.1 . Given that this idea goes back more than two decades, has been the default behaviour of the most used OSes for many years, with no ma…

> Treat any consecutive sequence of digits as a number when sorting.

Based on this description, I have no idea how the following would be sorted:

• photo.jpg

• photo1.jpg

• photo01.jpg

• photos.jpg

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

#133

I got used to naming files/folders with leading zeros when I want them to be sorted alphabetically (for example payslips/invoices, etc). But I'm a tech guy, I know what does "alphabetically" mean in the tech world. And it probably is not what common folks mean when they think "alphabetically" outside the tech world. Edit: in fact, if I recall correctly, the proper term for this kind of sort (the one OP wants) is alph…

I also got used to it, but especially when writing short scripts that generate numbered files it gets annoying to have to pad with zeroes every time, and also precommit to a specific amount of digits you want to allow (finding a compromise between adding a ridiculous amount, like 20, and using only 4 despite knowing the script might one day surpass 10⁵ files).

The natural numbers are ordered. Let me use its ordering instead of having to rely on an ad-hoc lexicographic fixed-length tuple representation of decimal digits, without any padding. My position is that numbers in filenames should always be considered atomically unless explicitly instructed otherwise.

If there were no issues of backwards compatibility, I would thus advocate for changing ls. Eza (maintained fork of Exa, Rust-based ls alternative) actually does sort this way by default, much to my delight.

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

#134

I thought this was going to be a deep dive into what "alphabetical" means and how that's itself not a universal term between locales, what with so many different collation preferences.

That would likely have been a more useful article for the average developer. It is extremely hard to be aware of all the ways strings of different locales can defy our intuitions.

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

#135
post #60

Earlier quoted context omitted.

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…

The sort rules are simple (1). Treat any consecutive sequence of digits as a number when sorting. So for example version numbers (which must be massively more common than decimals in filenames) work correctly, and 5.9 is indeed smaller than 5.10 and the latter is not identical to 5.1 . Given that this idea goes back more than two decades, has been the default behaviour of the most used OSes for many years, with no ma…

[deleted]

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

#136
post #95

Earlier quoted context omitted.

the one true way: budget_09.csv, budget_10.csv

Then `budget_100.csv` comes by and now you need to rename 99 files.

It’s been about two thousand years since the number of months in a year has been increased. I don’t think we’re getting 88 new ones anytime soon.

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

#137
I think the real issue here is that two Android phones take photos with incompatible naming schemes.

I am sure that at some point someone thought the milliseconds should or should not be separated from the seconds and made that change without thinking through the consequences.

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

#138

I have the same problem on Nemo. More specifically, I had made a small app that displayed files of a directory in alphabetical order, and then when I look at it in Nemo it isn't the same order because I didn't implement their smart algorithm.

I fail to see how this is a "problem"? You implemented a sorting mechanism that was useful to your application, while Nemo implemented another which as this thread demonstrates seems to be much more useful and intuitive for the average user. This is also of course not specific to Nemo, as no 'modern' file manager on Linux sorts filenames like it's 1980 and all you are able to feasibly do is step through the bytes.

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

#139
post #132

Earlier quoted context omitted.

The sort rules are simple (1). Treat any consecutive sequence of digits as a number when sorting. So for example version numbers (which must be massively more common than decimals in filenames) work correctly, and 5.9 is indeed smaller than 5.10 and the latter is not identical to 5.1 . Given that this idea goes back more than two decades, has been the default behaviour of the most used OSes for many years, with no ma…

> Treat any consecutive sequence of digits as a number when sorting. Based on this description, I have no idea how the following would be sorted: • photo.jpg • photo1.jpg • photo01.jpg • photos.jpg

Does it matter?

There's a user expectation that photo20.jpg comes after photo3.jpg.

There's no user expectation around whether photo1.jpg or photo01.jpg comes first. Just like there's no user expectation around whether photo1.jpg or Photo1.jpg comes first. Users also don't have the slightest idea about what order punctuation gets sorted in.

Just sort the things that matter in the way users expect (natural sort order) and come up with something reasonably consistent for the rest.

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

#140
I rename all of my photos upon import using the created date, formatted as `YYYY-MM-DD kk:mm:ss`.

But it would frankly be great if most file browsers just let me sort photos based on metadata. But then I just end up in a dedicated photo browser, instead.

Post reply on HN