Bizarre Number Sort of Files Mac

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
On Mac, on disk,  you will finder files in order

_categories.txt
_date.txt
_title.txt
01-11-04-09-09_2018-Noni-Building-Blessing.jpg
01-11-04-09-09_2018-Noni-Building-Blessing.txt
02-02-10-02-03_2018-Noni-Building-Blessing.jpg
02-02-10-02-03_2018-Noni-Building-Blessing.txt
03-06-01-10-10_2018-Noni-Building-Blessing.jpg
04-09-09-08-08_2018-Noni-Building-Blessing.jpg
04-09-09-08-08_2018-Noni-Building-Blessing.txt
05-05-02-12-12_2018-Noni-Building-Blessing.jpg
06-12-05-03-02_2018-Noni-Building-Blessing.jpg
06-12-05-03-02_2018-Noni-Building-Blessing.txt
07-07-12-07-07_2018-Noni-Building-Blessing.jpg
07-07-12-07-07_2018-Noni-Building-Blessing.txt
08-10-03-04-04_2018-Noni-Building-Blessing.jpg
08-10-03-04-04_2018-Noni-Building-Blessing.txt
09-08-06-06-06_2018-Noni-Building-Blessing.jpg
09-08-06-06-06_2018-Noni-Building-Blessing.txt
10-03-11-05-05_2018-Noni-Building-Blessing.jpg
10-03-11-05-05_2018-Noni-Building-Blessing.txt
11-01-07-11-11_2018-Noni-Building-Blessing.jpg
11-01-07-11-11_2018-Noni-Building-Blessing.txt
12-04-08-01-01_2018-Noni-Building-Blessing.jpg
12-04-08-01-01_2018-Noni-Building-Blessing.txt
gallery-story.txt

Now when open that for file import, I see in the dialogue (dimmed)

04-09-09-08-08_2018-Noni-Building-Blessing.jpg
02-02-10-02-03_2018-Noni-Building-Blessing.txt
11-01-07-11-11_2018-Noni-Building-Blessing.jpg
09-08-06-06-06_2018-Noni-Building-Blessing.txt
01-11-04-09-09_2018-Noni-Building-Blessing.jpg
12-04-08-01-01_2018-Noni-Building-Blessing.txt
11-01-07-11-11_2018-Noni-Building-Blessing.txt
02-02-10-02-03_2018-Noni-Building-Blessing.jpg
04-09-09-08-08_2018-Noni-Building-Blessing.txt
01-11-04-09-09_2018-Noni-Building-Blessing.txt
09-08-06-06-06_2018-Noni-Building-Blessing.jpg
12-04-08-01-01_2018-Noni-Building-Blessing.jpg
10-03-11-05-05_2018-Noni-Building-Blessing.txt
.DS_Store
06-12-05-03-02_2018-Noni-Building-Blessing.jpg
07-07-12-07-07_2018-Noni-Building-Blessing.txt
_categories.txt
_title.txt
08-10-03-04-04_2018-Noni-Building-Blessing.txt
_date.txt
gallery-story.txt
07-07-12-07-07_2018-Noni-Building-Blessing.jpg
10-03-11-05-05_2018-Noni-Building-Blessing.jpg
06-12-05-03-02_2018-Noni-Building-Blessing.txt
03-06-01-10-10_2018-Noni-Building-Blessing.jpg
08-10-03-04-04_2018-Noni-Building-Blessing.jpg
05-05-02-12-12_2018-Noni-Building-Blessing.jpg

now, put those files into a field, with still get the "amazing" order…

on mouseup
     sort lines fld "theFiles" ascending numeric
end mouseup

I get the  same result?  It is in "ascending numeric" does see the files at all?

If I sort lines by

on mouseup
sort lines fld "theFiles" ascending text
end mouseup

Then they they same as finder.


Try again, to sort of line by ascending number file, does not changes files …
do not change from the text sort which remain into the order "ascending text"

What is going on? It seems that the ascending numeric, just doesn’t see the files at all?

BR







_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
When you add text to a number, it ceases to be a number.

If you had a space between 01-11-04-09-_2018 and the rest of the line you might be able to

sort lines of field “TheFiles” dateTime ascending by word one of each


Paul Looney

> On Mar 9, 2018, at 10:31 AM, Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> On Mac, on disk,  you will finder files in order
>
> _categories.txt
> _date.txt
> _title.txt
> 01-11-04-09-09_2018-Noni-Building-Blessing.jpg
> 01-11-04-09-09_2018-Noni-Building-Blessing.txt
> 02-02-10-02-03_2018-Noni-Building-Blessing.jpg
> 02-02-10-02-03_2018-Noni-Building-Blessing.txt
> 03-06-01-10-10_2018-Noni-Building-Blessing.jpg
> 04-09-09-08-08_2018-Noni-Building-Blessing.jpg
> 04-09-09-08-08_2018-Noni-Building-Blessing.txt
> 05-05-02-12-12_2018-Noni-Building-Blessing.jpg
> 06-12-05-03-02_2018-Noni-Building-Blessing.jpg
> 06-12-05-03-02_2018-Noni-Building-Blessing.txt
> 07-07-12-07-07_2018-Noni-Building-Blessing.jpg
> 07-07-12-07-07_2018-Noni-Building-Blessing.txt
> 08-10-03-04-04_2018-Noni-Building-Blessing.jpg
> 08-10-03-04-04_2018-Noni-Building-Blessing.txt
> 09-08-06-06-06_2018-Noni-Building-Blessing.jpg
> 09-08-06-06-06_2018-Noni-Building-Blessing.txt
> 10-03-11-05-05_2018-Noni-Building-Blessing.jpg
> 10-03-11-05-05_2018-Noni-Building-Blessing.txt
> 11-01-07-11-11_2018-Noni-Building-Blessing.jpg
> 11-01-07-11-11_2018-Noni-Building-Blessing.txt
> 12-04-08-01-01_2018-Noni-Building-Blessing.jpg
> 12-04-08-01-01_2018-Noni-Building-Blessing.txt
> gallery-story.txt
>
> Now when open that for file import, I see in the dialogue (dimmed)
>
> 04-09-09-08-08_2018-Noni-Building-Blessing.jpg
> 02-02-10-02-03_2018-Noni-Building-Blessing.txt
> 11-01-07-11-11_2018-Noni-Building-Blessing.jpg
> 09-08-06-06-06_2018-Noni-Building-Blessing.txt
> 01-11-04-09-09_2018-Noni-Building-Blessing.jpg
> 12-04-08-01-01_2018-Noni-Building-Blessing.txt
> 11-01-07-11-11_2018-Noni-Building-Blessing.txt
> 02-02-10-02-03_2018-Noni-Building-Blessing.jpg
> 04-09-09-08-08_2018-Noni-Building-Blessing.txt
> 01-11-04-09-09_2018-Noni-Building-Blessing.txt
> 09-08-06-06-06_2018-Noni-Building-Blessing.jpg
> 12-04-08-01-01_2018-Noni-Building-Blessing.jpg
> 10-03-11-05-05_2018-Noni-Building-Blessing.txt
> .DS_Store
> 06-12-05-03-02_2018-Noni-Building-Blessing.jpg
> 07-07-12-07-07_2018-Noni-Building-Blessing.txt
> _categories.txt
> _title.txt
> 08-10-03-04-04_2018-Noni-Building-Blessing.txt
> _date.txt
> gallery-story.txt
> 07-07-12-07-07_2018-Noni-Building-Blessing.jpg
> 10-03-11-05-05_2018-Noni-Building-Blessing.jpg
> 06-12-05-03-02_2018-Noni-Building-Blessing.txt
> 03-06-01-10-10_2018-Noni-Building-Blessing.jpg
> 08-10-03-04-04_2018-Noni-Building-Blessing.jpg
> 05-05-02-12-12_2018-Noni-Building-Blessing.jpg
>
> now, put those files into a field, with still get the "amazing" order…
>
> on mouseup
>     sort lines fld "theFiles" ascending numeric
> end mouseup
>
> I get the  same result?  It is in "ascending numeric" does see the files at all?
>
> If I sort lines by
>
> on mouseup
> sort lines fld "theFiles" ascending text
> end mouseup
>
> Then they they same as finder.
>
>
> Try again, to sort of line by ascending number file, does not changes files …
> do not change from the text sort which remain into the order "ascending text"
>
> What is going on? It seems that the ascending numeric, just doesn’t see the files at all?
>
> BR
>
>
>
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
Hmmm... I ran into this a few days ago. If you sort numeric, and any of the values are not numeric, the sort fails silently. I would have expected it to sort with the affinity for numeric, but that apparently is not how the sort command works. If you were to simply sort without the numeric arguement, it would work, since your filenames are already padded with zeros. If this needs to work with *any* file list, I think you may be in trouble.

One option would be to iterate in a repeat loop through each line, then iterate through each character, adding the current character to a value then checking if the value is a number. When it's not, put char 1 to -2 of the value into item 1 of a new list, the actual filename into item 2 of the new list, sort lines of <list> numeric ascending by item 1 of each, then iterate through the lies again, putting item 2 of each line in a new list.

You could create a function that does this.

Bob S


> On Mar 9, 2018, at 10:46 , PEL via use-livecode <[hidden email]> wrote:
>
> When you add text to a number, it ceases to be a number.
>
> If you had a space between 01-11-04-09-_2018 and the rest of the line you might be able to
>
> sort lines of field “TheFiles” dateTime ascending by word one of each
>
>
> Paul Looney

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
Well the dictionary has this cryptic entry

"If you don't specify a sortType, the sortType is text.
    numbers)"

??

I thought, wrongly so, sort alpha text, ascending, was the default

sort line fld "imageIist"  # would get you want

But the solution was simple

sort lines fld "imageList" ascending text  # this gets want I need

So, the default is mysterious; but, explicitly call, will work.

BR



Bob Sneidar wrote:

    Hmmm... I ran into this a few days ago. If you sort numeric, and any of the values are not numeric, the sort fails silently. I would have expected it to sort with the affinity for numeric, but that apparently is not how the sort command works. If you were to simply sort without the numeric arguement, it would work, since your filenames are already padded with zeros. If this needs to work with *any* file list, I think you may be in trouble.
   
    One option would be to iterate in a repeat loop through each line, then iterate through each character, adding the current character to a value then checking if the value is a number. When it's not, put char 1 to -2 of the value into item 1 of a new list, the actual filename into item 2 of the new list, sort lines of <list> numeric ascending by item 1 of each, then iterate through the lies again, putting item 2 of each line in a new list.
   
    You could create a function that does this.
   
    Bob S
   
   
    >On Mar 9, 2018, at 10:46 , PEL via use-livecode <[hidden email]> wrote:
    >When you add text to a number, it ceases to be a number.
    >If you had a space between 01-11-04-09-_2018 and the rest of the line you might be able to
    >sort lines of field “TheFiles” dateTime ascending by word one of each
    >Paul Looney
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
That strange dictionary entry was due to a bug in the parser. It is fixed
now (9DP11 does not have that bug, not sure about 8).

Now, not sure about the actual sort issue...
On Sat, Mar 10, 2018 at 10:27 PM Sannyasin Brahmanathaswami via
use-livecode <[hidden email]> wrote:

> Well the dictionary has this cryptic entry
>
> "If you don't specify a sortType, the sortType is text.
>     numbers)"
>
> ??
>
> I thought, wrongly so, sort alpha text, ascending, was the default
>
> sort line fld "imageIist"  # would get you want
>
> But the solution was simple
>
> sort lines fld "imageList" ascending text  # this gets want I need
>
> So, the default is mysterious; but, explicitly call, will work.
>
> BR
>
>
>
> Bob Sneidar wrote:
>
>     Hmmm... I ran into this a few days ago. If you sort numeric, and any
> of the values are not numeric, the sort fails silently. I would have
> expected it to sort with the affinity for numeric, but that apparently is
> not how the sort command works. If you were to simply sort without the
> numeric arguement, it would work, since your filenames are already padded
> with zeros. If this needs to work with *any* file list, I think you may be
> in trouble.
>
>     One option would be to iterate in a repeat loop through each line,
> then iterate through each character, adding the current character to a
> value then checking if the value is a number. When it's not, put char 1 to
> -2 of the value into item 1 of a new list, the actual filename into item 2
> of the new list, sort lines of <list> numeric ascending by item 1 of each,
> then iterate through the lies again, putting item 2 of each line in a new
> list.
>
>     You could create a function that does this.
>
>     Bob S
>
>
>     >On Mar 9, 2018, at 10:46 , PEL via use-livecode <
> [hidden email]> wrote:
>     >When you add text to a number, it ceases to be a number.
>     >If you had a space between 01-11-04-09-_2018 and the rest of the line
> you might be able to
>     >sort lines of field “TheFiles” dateTime ascending by word one of each
>     >Paul Looney
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Bizarre Number Sort of Files Mac

Clarence Martin via use-livecode
I think this is a relevant enhancement request:
http://quality.livecode.com/show_bug.cgi?id=21013

On Sun, Mar 11, 2018 at 5:14 AM Brian Milby via use-livecode <
[hidden email]> wrote:

> That strange dictionary entry was due to a bug in the parser. It is fixed
> now (9DP11 does not have that bug, not sure about 8).
>
> Now, not sure about the actual sort issue...
> On Sat, Mar 10, 2018 at 10:27 PM Sannyasin Brahmanathaswami via
> use-livecode <[hidden email]> wrote:
>
> > Well the dictionary has this cryptic entry
> >
> > "If you don't specify a sortType, the sortType is text.
> >     numbers)"
> >
> > ??
> >
> > I thought, wrongly so, sort alpha text, ascending, was the default
> >
> > sort line fld "imageIist"  # would get you want
> >
> > But the solution was simple
> >
> > sort lines fld "imageList" ascending text  # this gets want I need
> >
> > So, the default is mysterious; but, explicitly call, will work.
> >
> > BR
> >
> >
> >
> > Bob Sneidar wrote:
> >
> >     Hmmm... I ran into this a few days ago. If you sort numeric, and any
> > of the values are not numeric, the sort fails silently. I would have
> > expected it to sort with the affinity for numeric, but that apparently is
> > not how the sort command works. If you were to simply sort without the
> > numeric arguement, it would work, since your filenames are already padded
> > with zeros. If this needs to work with *any* file list, I think you may
> be
> > in trouble.
> >
> >     One option would be to iterate in a repeat loop through each line,
> > then iterate through each character, adding the current character to a
> > value then checking if the value is a number. When it's not, put char 1
> to
> > -2 of the value into item 1 of a new list, the actual filename into item
> 2
> > of the new list, sort lines of <list> numeric ascending by item 1 of
> each,
> > then iterate through the lies again, putting item 2 of each line in a new
> > list.
> >
> >     You could create a function that does this.
> >
> >     Bob S
> >
> >
> >     >On Mar 9, 2018, at 10:46 , PEL via use-livecode <
> > [hidden email]> wrote:
> >     >When you add text to a number, it ceases to be a number.
> >     >If you had a space between 01-11-04-09-_2018 and the rest of the
> line
> > you might be able to
> >     >sort lines of field “TheFiles” dateTime ascending by word one of
> each
> >     >Paul Looney
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode