Re: valueDiff for arrays?

2018-08-06 Thread Brian Milby via use-livecode
button "Array (original)" Found 664579 primes in 51.543966 seconds button "Array (bwm)" Found 664579 primes in 49.139622 seconds button "Array (mark)" Found 664579 primes in 43.483821 seconds button "Byte (alex)" Found 664579 primes in 15.016109 seconds button "Byte (bwm)" Found 664579 primes in 11

Re: valueDiff for arrays?

2018-08-06 Thread Mark Waddingham via use-livecode
I'd expect that for two reasons. The first is that all array keys are interred strings (names) so integers need to first be converted to strings and then hashed into a name and then hashed to the slot in the arrays hash table. The second is that byte based version is essentially using a byte se

Re: valueDiff for arrays?

2018-08-06 Thread Mark Wieder via use-livecode
Interesting. I tried a variation using arrays, and it's three times slower than yours. function get_primes pN local tMroot, tPrimes, tIsItPrime if pN < 2 then return empty if pN = 2 then return 2 put trunc(sqrt(pN)) - 1 into tMroot repeat with i=1 to pN step 2 put 1 into t

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread Sannyasin Brahmanathaswami via use-livecode
I found another way. Set standard background a opacity=0 add an new container graphic. then make the background bigger that the controls, But it won't hilite. So I might use your method. On 8/6/18 11:33 AM, zryip theSlug via use-livecode wrote: > I have created this kind of form before: roundr

Re: valueDiff for arrays?

2018-08-06 Thread Niggemann, Bernd via use-livecode
How embarrassing, again an error. I should go to sleep now. repeat pn mod 1 put tYes after tIsItPrime <-- corrected line end repeat Here is the hopfully truly truly last correction. --- function get_primes pN -- bn modified brian local tMroot, tPrimes, tI

Re: valueDiff for arrays?

2018-08-06 Thread Alex Tweedly via use-livecode
Nice improvement ! And I like the variable names much more ... though it could be argued that "tYes", should be called"tMayYetBeAPrime" :-) I now get this version consistently running in 25% of the original time. There is another version which runs about twice as fast - i.e. 14% of the origi

Re: valueDiff for arrays?

2018-08-06 Thread Niggemann, Bernd via use-livecode
There was an error in the code I posted. It should read "if pN >= 1 then" instead of "if pN > 1" this is the corrected version - function get_primes pN local tMroot, tPrimes, tIsItPrime, tYes, tNo put numtobyte(66) into tYes put numtobyte(65) into tNo if pN < 2

Re: valueDiff for arrays?

2018-08-06 Thread Brian Milby via use-livecode
2 should be included, but the original optimized version skipped it. Thanks, Brian On Aug 6, 2018, 6:25 PM -0500, Niggemann, Bernd via use-livecode , wrote: > This also helps a bit. Where is Hermann? > > - > function get_primes pN > local tMroot, tPrimes, tIsItPrime, tYes, tNo

Re: valueDiff for arrays?

2018-08-06 Thread Niggemann, Bernd via use-livecode
This also helps a bit. Where is Hermann? - function get_primes pN local tMroot, tPrimes, tIsItPrime, tYes, tNo put numtobyte(66) into tYes put numtobyte(65) into tNo if pN < 2 then return empty if pN = 2 then return 2 put 2 into tPrimes put trunc(sqrt(pN))

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Jerry Jensen via use-livecode
> On Aug 6, 2018, at 3:18 PM, Mark Waddingham via use-livecode > wrote: > > Although I think I digested Toolbook's reference guide / dictionary at some > point (by reading, not by actually eating and digesting!). An artist friend of mine attempted to _eat_ the Guiness Book of World Records.

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Mark Waddingham via use-livecode
On 2018-08-06 21:49, Richard Gaskin via use-livecode wrote: Mark Waddingham wrote: I think it might be quite unique amongst x-talks in another way too... How much of any of the others were written in themselves? Not many. Toolbook, Gain Momentum, and SuperCard are the only ones I can think

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread zryip theSlug via use-livecode
Dear Swami, I have created this kind of form before: roundrect background and margins between 2 rows. For the background I used my own graphic. The background graphic if present is used by the datagrid library for hiliting the row. I removed it. And for magins, I used a row height upper than the h

Re: valueDiff for arrays?

2018-08-06 Thread Brian Milby via use-livecode
Ah, that is what I was missing (numtobyte)... I knew that 4000 seconds wasn't right :) I was able to shave a bit more off by only calling numtobyte twice (17s to 12s for single pass): function get_primes pN local tMroot, tPrimes, tIsItPrime, tYes, tNo put numtobyte(66) into tYes put numto

Re: valueDiff for arrays?

2018-08-06 Thread Mark Waddingham via use-livecode
On 2018-08-06 22:04, Alex Tweedly via use-livecode wrote: On 06/08/2018 16:50, Mark Waddingham via use-livecode wrote: Alex Tweedly didn't talk nonsense... Byte x [to y] of z is (truly) constant time if z is strictly a binary string. That's right - the basic principle wasn't nonsense - but mos

Re: valueDiff for arrays?

2018-08-06 Thread Alex Tweedly via use-livecode
On 06/08/2018 16:50, Mark Waddingham via use-livecode wrote: Alex Tweedly didn't talk nonsense... Byte x [to y] of z is (truly) constant time if z is strictly a binary string. That's right - the basic principle wasn't nonsense - but most everything else in my email was :-) I said you only ne

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Richard Gaskin via use-livecode
Mark Waddingham wrote: > I think it might be quite unique amongst x-talks in another way too... > > How much of any of the others were written in themselves? Not many. Toolbook, Gain Momentum, and SuperCard are the only ones I can think of beyond LC that had enough confidence in their tooling

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Mark Waddingham via use-livecode
I think it might be quite unique amongst x-talks in another way too... How much of any of the others were written in themselves? Mark. Sent from my iPhone > On 6 Aug 2018, at 13:26, Richard Gaskin via use-livecode > wrote: > > It isn't. SuperCard is available exclusively for macOS. There w

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Richmond Mathewson via use-livecode
Oh, Yes, ToolBook . . I had to work with ToolBook in 1998 when I was at the UAE University in Al Ain, UAE, making EFL "stuff". Far, far less easy-going than HyperCard. Sheikh Yer-Bomboms, the chancellor of the University (a man who was pointed on merit: the merit of being one of the sons of

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread Sannyasin Brahmanathaswami via use-livecode
On 8/6/18 7:29 AM, zryip theSlug via use-livecode wrote: > Bob, > > A column template exists for each column of a dg table, so you can use any > control you want inside a datagrid column, including widgets. > > Here is a link to a DGH's screenshot . On the left, we have properties for > a column (r

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Richard Gaskin via use-livecode
It isn't. SuperCard is available exclusively for macOS. There was an effort in the mid-90s to port to Windows, but funding dried up before it was completed so no useful version ever saw the light of day. Toolbook is also single-platform, Windows-only. But most of the others were cross-platfo

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Mark Wieder via use-livecode
On 08/06/2018 10:26 AM, Richard Gaskin via use-livecode wrote: 3. The state of the art suggests we're a long way from anything close to the Singularity: Google Translate’s AI starts talking about the end of the world

Re: DataGrid image display woes

2018-08-06 Thread Trevor DeVore via use-livecode
Yes, I did write the original Data Grid. One thing I’ve learned when working with any code in LiveCode that is shared between objects, however, is that when you see one object updating and none of the other objects you’ve forgotten to add “of me”. -- Trevor DeVore On Mon, Aug 6, 2018 at 10:41 AM

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Richmond Mathewson via use-livecode
How "multi" is SuperCard? Richmond. On 6/8/2018 6:47 pm, Bob Sneidar via use-livecode wrote: Except for Supercard. Bob S On Aug 5, 2018, at 13:40 , Alejandro Tejada via use-livecode wrote: LiveCode is multiplatform and this single fact set it apart from all previous x-talk languages. _

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread zryip theSlug via use-livecode
Bob, A column template exists for each column of a dg table, so you can use any control you want inside a datagrid column, including widgets. Here is a link to a DGH's screenshot . On the left, we have properties for a column (row or header). This is a datagrid table with two visible columns. The

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Richard Gaskin via use-livecode
Mark Waddingham wrote: > However the reason google search can do that is because some > programmer at google has added a hook which knows that when that > pattern is searched for it should call a program that has been > explicitly written which looks up the current exchange rate and > then render

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Bob Sneidar via use-livecode
But that too is an illusion. The mysterious servers are not really "learning". They are taking input and then processing it according to rules that a group of software developer somewhere defined. That's why the "A" in "AI" means "Artificial". I think (and therefore I am) we need to keep this fo

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Bob Sneidar via use-livecode
These are great points. This is why I say that computers don't *actually* do anything. All they do is arrange information in a way that humans can understand and act upon. That human may be a software developer who then feeds that information to a manufacturing device to build a widget. Or it ma

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread Bob Sneidar via use-livecode
The template is like the group editor. In fact it may actually BE the group editor. The behavior script determines what to do when a row is drawn. I think the thing to understand about datagrids, table or forms, is that for each array element in the data (itself an array) the template is "clone

Re: valueDiff for arrays?

2018-08-06 Thread Mark Wieder via use-livecode
On 08/05/2018 08:26 PM, Monte Goulding via use-livecode wrote: They are constants.. the point is in order to compare a boolean to a string you need to convert it to a string and therefore you do string comparison on “” v “false”. Doh! Yes, I forgot again about this converting everything to s

Re: valueDiff for arrays?

2018-08-06 Thread Mark Waddingham via use-livecode
Alex Tweedly didn't talk nonsense... Byte x [to y] of z is (truly) constant time if z is strictly a binary string. tArray[x] is constant time if x is already a name - otherwise the string needs turned into a name. If x is coming from repeat for each key x - then it will already be a name. (Not

Re: [OT] The problem with programming and how to fix it

2018-08-06 Thread Bob Sneidar via use-livecode
Except for Supercard. Bob S > On Aug 5, 2018, at 13:40 , Alejandro Tejada via use-livecode > wrote: > > LiveCode is multiplatform and this single fact > set it apart from all previous x-talk languages. ___ use-livecode mailing list use-livecode@l

Re: DataGrid image display woes

2018-08-06 Thread Bob Sneidar via use-livecode
I think Trevor wrote the original datagrid behavior, or at least was instrumental in it. Bob S > On Aug 4, 2018, at 11:17 , Brian Milby via use-livecode > wrote: > > Wow, and Trevor knew right away... pretty impressive! > ___ > use-livecode mailin

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread Sannyasin Brahmanathaswami via use-livecode
Yay! I made my first form. Now for questions *not* covered by the lessons. 1) Is the graphic "Background" a special object? In Navigator I opened stack "Data Grid Temple 333" directly editing the group "Row Template". I set background graphic to roundedRectangle, corners set 20px, and

[ANN] This Week in LiveCode 140

2018-08-06 Thread panagiotis merakos via use-livecode
Hi all, Read about new developments in LiveCode open source and the open source community in today's edition of the "This Week in LiveCode" newsletter! Read issue #140 here: https://goo.gl/tww8bD This is a weekly newsletter about LiveCode, focussing on what's been going on in and around

Re: Getting Started with DataGrid and another datagrid form

2018-08-06 Thread Sannyasin Brahmanathaswami via use-livecode
I am at the lesson.livecode.com/m/datagrid. They are quite thorough. Much to my chagrin, everything you need to know is there. I would NOT recommend just dragging a Datagrip and "digging in" are even using DG Helper (to start) Read the lessons first (or at same time as you follow along in a sta

Re: Start using stack - Loading stack libraries

2018-08-06 Thread Brian Milby via use-livecode
On my IDE, mainstacks is currently 204. The stacks are stored in a linked list, so no limit other than memory and performance. Thanks, Brian On Aug 6, 2018, 7:14 AM -0500, Stephen MacLean via use-livecode , wrote: > > > On Aug 6, 2018, at 8:05 AM, Paul Dupuis via use-livecode > > wrote: > > >

Re: Start using stack - Loading stack libraries

2018-08-06 Thread Stephen MacLean via use-livecode
> On Aug 6, 2018, at 8:05 AM, Paul Dupuis via use-livecode > wrote: > > On 8/5/2018 11:29 PM, Stephen MacLean via use-livecode wrote: >> @ Paul, they are different, based upon the type of build that needs to >> happen for the source that is being looked at. The code has one handler name >> th

Re: Start using stack - Loading stack libraries

2018-08-06 Thread Paul Dupuis via use-livecode
On 8/5/2018 11:29 PM, Stephen MacLean via use-livecode wrote: > @ Paul, they are different, based upon the type of build that needs to happen > for the source that is being looked at. The code has one handler name that is > the same (The init code in the builder), but after that the code is diffe

Re: valueDiff for arrays?

2018-08-06 Thread Alex Tweedly via use-livecode
Earlier, Alex Tweedly said some nonsense like: arrays are hashed - even if quickly, while byte chunks are constant time. So replace both uses of the array np with a byte chunk. ... Takes about 40% off the time. -- Alex. Operator error ! Forget what I said, it was wrong. I'll do the test mor

Re: valueDiff for arrays?

2018-08-06 Thread Alex Tweedly via use-livecode
arrays are hashed - even if quickly, while byte chunks are constant time. So replace both uses of the array np with a byte chunk. i.e. if byte i of np = "n" then next repeat ... put "n" into byte j of np Takes about 40% off the time. -- Alex. On 06/08/2018 03:36, Richard Gaskin via use-l