Re: Sort IP List

2018-07-02 Thread Tom Glod via use-livecode
ok i will try to provide more info on this from my stack when it happens next. On Mon, Jul 2, 2018 at 12:17 PM, J. Landman Gay via use-livecode < use-livecode@lists.runrev.com> wrote: > There used to be a barrage of pending messages generated by the IDE that > were updating in the message box.

Re: Sort IP List

2018-07-02 Thread J. Landman Gay via use-livecode
There used to be a barrage of pending messages generated by the IDE that were updating in the message box. Look at the messages pane and set it to auto-update, see if they're still there -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On

Re: Sort IP List

2018-07-02 Thread Mark Wieder via use-livecode
On 07/02/2018 06:59 AM, Tom Glod via use-livecode wrote: oh yes. message box makes LC slow to a crawl..I've noticed that. i can confirm that. Win 10 LC 9 too. I've seen that too, especially when spewing debugging statements to the messagebox. But not all the time, and nothing I can get a

Re: Sort IP List

2018-07-02 Thread Tom Glod via use-livecode
age- > From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On > Behalf > Of Mark Wieder via use-livecode > Sent: Saturday, June 30, 2018 11:05 PM > To: Ralph DiMola via use-livecode > Cc: Mark Wieder > Subject: Re: Sort IP List > > Ralph- > >

RE: Sort IP List

2018-07-01 Thread Ralph DiMola via use-livecode
e-livecode-boun...@lists.runrev.com] On Behalf Of Mark Wieder via use-livecode Sent: Saturday, June 30, 2018 11:05 PM To: Ralph DiMola via use-livecode Cc: Mark Wieder Subject: Re: Sort IP List Ralph- Not that I'm doubting your findings, but those both seem mind-bogglingly nonsensical to me. Can you

Re: Sort IP List

2018-06-30 Thread Mark Wieder via use-livecode
Ralph- Not that I'm doubting your findings, but those both seem mind-bogglingly nonsensical to me. Can you post your test code? -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url

RE: Sort IP List

2018-06-30 Thread Ralph DiMola via use-livecode
-livecode-boun...@lists.runrev.com] On Behalf Of Tom Glod via use-livecode Sent: Saturday, June 30, 2018 3:51 PM To: How to use LiveCode Cc: Tom Glod Subject: Re: Sort IP List good thread you guys...code optimization questswhat fun. On Sat, Jun 30, 2018 at 2:01 PM, Niggemann, Bernd via use

Re: Sort IP List

2018-06-30 Thread Tom Glod via use-livecode
good thread you guys...code optimization questswhat fun. On Sat, Jun 30, 2018 at 2:01 PM, Niggemann, Bernd via use-livecode < use-livecode@lists.runrev.com> wrote: > Hermann, > > I did not see Alex's solution until after I posted. I agree that inline is > probably always faster. > > And

Re: Sort IP List

2018-06-30 Thread Niggemann, Bernd via use-livecode
Hermann, I did not see Alex's solution until after I posted. I agree that inline is probably always faster. And after I saw Alex's post I would not have thought that one could do it that way, thanks Alex. On top it is by far the fastest. On the other hand sort by myFunction(each) is so

Re: Sort IP List

2018-06-30 Thread Brian Milby via use-livecode
Here are some times on my system for comparison (10 random IPs): 216% - ip2dec: 463 ms 190% - ip2decpvt: 407 ms 171% - ip2dec2: 366 ms 147% - ip2dec2pvt: 314 ms 200% - sortIPList: 427 ms --> original from Bob 100% - sortIPList2: 215 ms --> Alex's inline with constants 152% - sortIPList3: 325

Re: Sort IP List

2018-06-30 Thread hh via use-livecode
Remains to remark that the upcoming standard IPv6 with its text representations (Section 2.2 of https://tools.ietf.org/html/rfc4291) will require more detailed methods, both for number base conversion and for item sorts/cosorts (the items are hex numbers ...) @Bernd Depending on the function an

Re: Sort IP List

2018-06-30 Thread Niggemann, Bernd via use-livecode
if you replace ip2dec with the same functionality as Hermann's (HH) function with private function ip2dec2 x set the itemdel to "." return (item 4 of x) + (item 3 of x * 256) + (item 2 of x * 65536) + (item 1 of x * 16777216) end ip2dec2 then the special sort via function is faster than

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
You all are just too darn smart. great solution. On Fri, Jun 29, 2018 at 5:54 PM Alex Tweedly via use-livecode < use-livecode@lists.runrev.com> wrote: > Why not just do it directly (avoid the function call) ... > > function sortIPList2 pIPList > set the itemdelimiter to "." > try >

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
Alex, you win the cookie! 4 ticks for 30,000 IP addresses! If we ever meet at a conference remind me and I will buy you beers. Not saying how namy, just more than one. :-) Bob S > On Jun 29, 2018, at 16:54 , Alex Tweedly via use-livecode > wrote: > > Why not just do it directly (avoid the

Re: Sort IP List

2018-06-29 Thread Alex Tweedly via use-livecode
Why not just do it directly (avoid the function call) ... function sortIPList2 pIPList set the itemdelimiter to "." try sort lines of pIPList ascending numeric \ by (item 1 of each * 16777216) + \ (item 2 of each *65536) + \ (item 3 of each *256) +

Re: Sort IP List

2018-06-29 Thread hh via use-livecode
Your IP addresses [0-255].[0-255].[0-255].[0-255] are the hex IP numbers converted to base 256. So you may try the following sorting function that converts the IPs from base 256 to base 10 (decimal). function ip2dec x set itemdel to "." repeat with i=0 to 3 add (item 4-i of x)*256^i to y

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Now that is weird because the sort is definitely working for me.OH wait, you don't set the numberformat in your function. Do you set it elsewhere, and if so, does it stick when the function is called? The sort is definitely, no question, working for me. I generate a list of IPs then in the

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
I have good news and bad news! function sortIPList2 pIPList set the itemdelimiter to "." try sort lines of pIPList ascending numeric \ by (item 1 of each + 0) & \ (item 2 of each + 0) & \ (item 3 of each + 0) & \ (item 4 of each + 0)

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Yup, that would be it! On Fri, Jun 29, 2018 at 4:15 PM Bob Sneidar via use-livecode < use-livecode@lists.runrev.com> wrote: > Wait I know exactly what is wrong. I have a few lines that use CIDR > notation ie. 192.168.1.0/24 and THAT is not a number! > > Bob S > > > > On Jun 29, 2018, at 15:13 ,

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
Wait I know exactly what is wrong. I have a few lines that use CIDR notation ie. 192.168.1.0/24 and THAT is not a number! Bob S > On Jun 29, 2018, at 15:13 , Bob Sneidar via use-livecode > wrote: > > Yeah mine won't run. I have: > > function sortIPList2 pIPList > set the itemdelimiter to

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
Yeah mine won't run. I have: function sortIPList2 pIPList set the itemdelimiter to "." try sort lines of pIPList ascending numeric by (item 1 of each +0) & (item 2 of each + 0) & (item 3 of each + 0) & (item 4 of each + 0) catch theError breakpoint end try return

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Oh, the above assumes setting the numberformat to "000" as you specified of course. On Fri, Jun 29, 2018 at 4:00 PM Mike Bonner wrote: > Thx for the clue, I see what you mean. > > I had tried to get something similar to your value(item 1 of each +0) > method to work and something wasn't

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Thx for the clue, I see what you mean. I had tried to get something similar to your value(item 1 of each +0) method to work and something wasn't clicking, but after seeing yours, I think I have it working. sort lines of tList ascending numeric by (item 1 of each +0) & (item 2 of each + 0) &

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
Yeah, no I get runtime error. > On Jun 29, 2018, at 14:09 , Bob Sneidar via use-livecode > wrote: > > Yes because your ampersand operator is not passing different arguements, it's > concatenating the items together so that 10.2.245.6 produces the integer > 1022456. But 10.22.2.6 produces

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
Yes because your ampersand operator is not passing different arguements, it's concatenating the items together so that 10.2.245.6 produces the integer 1022456. But 10.22.2.6 produces 102226 which is smaller, but ought to sort higher. Hence the 4 pass sort. But you got me thinking, what if you

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Actually, when using the multiple key sort, dont reverse the order since it does it all in one go. On Fri, Jun 29, 2018 at 11:29 AM Mike Bonner wrote: > Ok, now i'm curious about something.. I know its possible to designate > multiple keys to a single sort using the form.. > sort lines of plist

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
Ok, now i'm curious about something.. I know its possible to designate multiple keys to a single sort using the form.. sort lines of plist by item 1 of each & item 2 of each & item 3 of each & item 4 of each which works fine. But changing it to.. sort lines of plist ascending numeric by item 1

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
A realistic expectation of IP addresses for a given network might only be around 16,535 (class B network) assuming every address was in use, an unlikely scenario. I thought of way to do this for an extremely large number of addresses by reading a large file in 1000 line chunks into 4 columns of

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
## was writing this when your response showed up.. Just did some tests. For reasonable size lists of IP numbers, your method is clearly faster. As lines increase the disparity shrinks (due to 4 processings of the same lines rather than 1) until around 35000 lines at which point positions reverse

Re: Sort IP List

2018-06-29 Thread Bob Sneidar via use-livecode
First, your function returns a single line of numbers. With 30,000 lines of input, yours takes 9 ticks, mine 8. Bob S > On Jun 29, 2018, at 08:37 , Mike Bonner via use-livecode > wrote: > > I don't know what speed differences there might be, but another option is > something like this.. >

Re: Sort IP List

2018-06-29 Thread Mike Bonner via use-livecode
I don't know what speed differences there might be, but another option is something like this.. function ipfunc pIp set the itemdel to "." set the numberformat to "###" -- force length of each chunk to 3 -- append the numbers together sans "." with padded 0's using numberformat repeat