Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
On Sat, May 9, 2015 at 7:12 PM, Jerry Jensen  wrote:

> We went through this a while ago, I think a challenge forwarded by Mark
> Wieder. The problem is that integers overflow and start giving wrong
> answers part way to 100. I forget the exact place it happens.
>
> I wrote a few that did it the hard way (character by character arithmetic)
> - I’ll see if I can find them.
>

Ha, I totally didn't think about overflow -- I fail :-)

Here's a version that I think works. At least the result matches entries
for the value on the web:

function fib N
   put "0,1" into R
   if N <= 2 then return item 1 to N of R
   put 0 into F1
   put 1 into F2
   repeat N - 2
  put bigAdd(F1,F2) into F3
  put "",F3 after R
  put F2 into F1
  put F3 into F2
   end repeat
   return R
end fib

function bigAdd X,Y
   put 0 into C
   repeat
  if X is empty and Y is empty and (C is empty or C=0) then exit repeat
  put "00" & ((char -14 to -1 of X) + (char -14 to -1 of Y)
+ C) into RT
  put char -14 to -1 of RT before R
  put 0 + char 1 to -15 of RT into C
  delete char -14 to -1 of X
  delete char -14 to -1 of Y
   end repeat
   repeat
  if R is empty or (R = 0 and length(R) = 1) or char 1 of R <> 0 then
return R
  delete char 1 of R
   end repeat
end bigAdd
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Jerry Jensen
Fibonacci calculator that won’t overflow.

Here’s one, I think there were others. The script is in the GO button.
Copy into your message box:
go url "http://sysoper0.com/calcFibs.livecode”
.Jerry

> On May 9, 2015, at 5:12 PM, Jerry Jensen  wrote:
> 
> We went through this a while ago, I think a challenge forwarded by Mark 
> Wieder. The problem is that integers overflow and start giving wrong answers 
> part way to 100. I forget the exact place it happens.
> 
> I wrote a few that did it the hard way (character by character arithmetic) - 
> I’ll see if I can find them.
> .Jerry
> 
>> On May 9, 2015, at 4:32 PM, Geoff Canyon  wrote:
>> 
>> Problem 3
>> 
>> Write a function that computes the list of the first 100 Fibonacci numbers.
>> By definition, the first two numbers in the Fibonacci sequence are 0 and 1,
>> and each subsequent number is the sum of the previous two. As an example,
>> here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and
>> 34.
>> 
>> I didn't hard code, instead taking an argument for the number of Fibonnaci
>> numbers to return:
>> 
>> function fib N
>>  put "0,1" into R
>>  if N <= 2 then return item 1 to N of R
>>  put 0 into F1
>>  put 1 into F2
>>  repeat N - 2
>> put F1 + F2 into F3
>> put "",F3 after R
>> put F2 into F1
>> put F3 into F2
>>  end repeat
>>  return R
>> end fib
>> 
>> Test Data
>> 0
>> 1
>> 2
>> 20
>> 
>> Test Results
>> 
>> 0
>> 0,1
>> 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Kerner
4's another one that I think would look a lot nicer in LC than in most
other languages.

On Sat, May 9, 2015 at 9:44 PM, Mike Kerner 
wrote:

> Most of those (and especially #5) are ones that I think would look much
> nicer in LC than in most other languages.
>
> On Sat, May 9, 2015 at 8:31 PM, Mark Schonewille <
> m.schonewi...@economy-x-talk.com> wrote:
>
>> It looks like this also doesn't solve it. Perhaps getting all
>> combinations and taking the maximum is the only right solution?
>>
>> --
>> Best regards,
>>
>> Mark Schonewille
>>
>> Economy-x-Talk Consulting and Software Engineering
>> Homepage: http://economy-x-talk.com
>> Twitter: http://twitter.com/xtalkprogrammer
>> KvK: 50277553
>>
>> Installer Maker for LiveCode:
>> http://qery.us/468
>>
>> Buy my new book "Programming LiveCode for the Real Beginner"
>> http://qery.us/3fi
>>
>> LiveCode on Facebook:
>> https://www.facebook.com/groups/runrev/
>>
>> On 5/10/2015 02:28, Mark Schonewille wrote:
>>
>>> Geoff,
>>>
>>> There's my new attempt. I haven't tested it thoroughly, but I'm leaving
>>> it at this for tonight.
>>>
>>> I'm padding the numbers now, but if the number is padded, I give it an
>>> advantage while sorting.
>>>
>>> // OK, not /that/ easy.
>>> function problem4
>>>   put
>>> "642,6,4,3;642,6,4,1;642,6,661,4,3;5,50,56;420,42,423;262,26;26,262"
>>> into myData
>>>   set the itemDel to ";"
>>>   repeat for each item myList in myData
>>>put myList into myOldList
>>>set the itemDel to comma
>>>sort items of myList numeric descending by len(each)
>>>sort items of myList numeric descending by
>>> padded(each,len(item 1 of myList))
>>>replace comma with empty in myList
>>>put myOldList && myList & cr after myNewData
>>>set the itemDel to ";"
>>>   end repeat
>>>   return myNewData
>>> end problem4
>>>
>>> function padded theItem,theLength
>>>   set the itemDel to 0
>>>   put 0 into item theLength of myNewItem
>>>   put theItem into char 1 to len(theItem) of myNewItem
>>>   if len(myNewItem) > len(theItem) then add .1 to myNewItem
>>>   return myNewItem
>>> end padded
>>>
>>>
>>>
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
>
> --
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>and did a little diving.
> And God said, "This is good."
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Kerner
Most of those (and especially #5) are ones that I think would look much
nicer in LC than in most other languages.

On Sat, May 9, 2015 at 8:31 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> It looks like this also doesn't solve it. Perhaps getting all combinations
> and taking the maximum is the only right solution?
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Installer Maker for LiveCode:
> http://qery.us/468
>
> Buy my new book "Programming LiveCode for the Real Beginner"
> http://qery.us/3fi
>
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
>
> On 5/10/2015 02:28, Mark Schonewille wrote:
>
>> Geoff,
>>
>> There's my new attempt. I haven't tested it thoroughly, but I'm leaving
>> it at this for tonight.
>>
>> I'm padding the numbers now, but if the number is padded, I give it an
>> advantage while sorting.
>>
>> // OK, not /that/ easy.
>> function problem4
>>   put
>> "642,6,4,3;642,6,4,1;642,6,661,4,3;5,50,56;420,42,423;262,26;26,262"
>> into myData
>>   set the itemDel to ";"
>>   repeat for each item myList in myData
>>put myList into myOldList
>>set the itemDel to comma
>>sort items of myList numeric descending by len(each)
>>sort items of myList numeric descending by
>> padded(each,len(item 1 of myList))
>>replace comma with empty in myList
>>put myOldList && myList & cr after myNewData
>>set the itemDel to ";"
>>   end repeat
>>   return myNewData
>> end problem4
>>
>> function padded theItem,theLength
>>   set the itemDel to 0
>>   put 0 into item theLength of myNewItem
>>   put theItem into char 1 to len(theItem) of myNewItem
>>   if len(myNewItem) > len(theItem) then add .1 to myNewItem
>>   return myNewItem
>> end padded
>>
>>
>>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: muddling around in the source for revOpenDatabase()for postgresq

2015-05-09 Thread Mark Wieder

On 05/09/2015 04:51 PM, Dr. Hawkins wrote:


So I started poking around github.   It  seems like the first piece of
code is for *revdb.cpp* at e


That way lies madness.

I started looking at that code a few times a while back, hoping to fix 
things, add functionality, etc, and gave up. I ran into it again 
attempting to add mongodb to the menagerie. The database layer is 
hopelessly strangled in its own constructs, and nothing short of a 
complete rewrite will save it. Fortunately, a complete rewrite is right 
around the corner. Or so I was told in 2006 (new database layer 
scheduled for Rev 2.8). And note that all existing database bugs in the 
bugzilla database at that time were marked Resolved in favor of a single 
bug report (3662) to cover the omnibus database layer rewrite.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mark Schonewille
It looks like this also doesn't solve it. Perhaps getting all 
combinations and taking the maximum is the only right solution?


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/10/2015 02:28, Mark Schonewille wrote:

Geoff,

There's my new attempt. I haven't tested it thoroughly, but I'm leaving
it at this for tonight.

I'm padding the numbers now, but if the number is padded, I give it an
advantage while sorting.

// OK, not /that/ easy.
function problem4
  put
"642,6,4,3;642,6,4,1;642,6,661,4,3;5,50,56;420,42,423;262,26;26,262"
into myData
  set the itemDel to ";"
  repeat for each item myList in myData
   put myList into myOldList
   set the itemDel to comma
   sort items of myList numeric descending by len(each)
   sort items of myList numeric descending by
padded(each,len(item 1 of myList))
   replace comma with empty in myList
   put myOldList && myList & cr after myNewData
   set the itemDel to ";"
  end repeat
  return myNewData
end problem4

function padded theItem,theLength
  set the itemDel to 0
  put 0 into item theLength of myNewItem
  put theItem into char 1 to len(theItem) of myNewItem
  if len(myNewItem) > len(theItem) then add .1 to myNewItem
  return myNewItem
end padded





___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mark Schonewille

Geoff,

There's my new attempt. I haven't tested it thoroughly, but I'm leaving 
it at this for tonight.


I'm padding the numbers now, but if the number is padded, I give it an 
advantage while sorting.


// OK, not /that/ easy.
function problem4
 put 
"642,6,4,3;642,6,4,1;642,6,661,4,3;5,50,56;420,42,423;262,26;26,262" 
into myData

 set the itemDel to ";"
 repeat for each item myList in myData
  put myList into myOldList
  set the itemDel to comma
  sort items of myList numeric descending by len(each)
  sort items of myList numeric descending by 
padded(each,len(item 1 of myList))

  replace comma with empty in myList
  put myOldList && myList & cr after myNewData
  set the itemDel to ";"
 end repeat
 return myNewData
end problem4

function padded theItem,theLength
 set the itemDel to 0
 put 0 into item theLength of myNewItem
 put theItem into char 1 to len(theItem) of myNewItem
 if len(myNewItem) > len(theItem) then add .1 to myNewItem
 return myNewItem
end padded

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/10/2015 02:01, Geoff Canyon wrote:

On Sat, May 9, 2015 at 6:59 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:


Apparently, not as easy as I thought, but that makes it more interesting.



Yeah, I'm now trying to salvage my padding solution, which is better than
the padding solutions he gave on the site, but still wrong.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mark Wieder

On 05/09/2015 05:12 PM, Jerry Jensen wrote:


We went through this a while ago, I think a challenge forwarded by Mark Wieder. 
The problem is that integers overflow and start giving wrong answers part way 
to 100. I forget the exact place it happens.

I wrote a few that did it the hard way (character by character arithmetic) - 
I’ll see if I can find them.
.Jerry


Yeah, it's kind of a trick question in the context of this blog. Not 
that I think much of the blog post in general, but giving the writer the 
benefit of the doubt, I believe the point is that if you just code 
something up and don't test it fully, thinking you've come up with the 
correct formulation, you've still failed.


--
 Mark Wieder
 ahsoftw...@gmail.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Bonner
To do number 4, it seems that:

first find digit one.  Easy enough.  Then with every item that starts with
that digit, see if there is a singleton.  If there is NOT a singleton, move
to digit 2 of all numbers that start with that number.  If there is a
singleton, you must check second digits that start with the highest number,
as well as first digits of everything else. It gets rather complicated
rather fast.

On Sat, May 9, 2015 at 6:12 PM, Jerry Jensen  wrote:

> We went through this a while ago, I think a challenge forwarded by Mark
> Wieder. The problem is that integers overflow and start giving wrong
> answers part way to 100. I forget the exact place it happens.
>
> I wrote a few that did it the hard way (character by character arithmetic)
> - I’ll see if I can find them.
> .Jerry
>
> > On May 9, 2015, at 4:32 PM, Geoff Canyon  wrote:
> >
> > Problem 3
> >
> > Write a function that computes the list of the first 100 Fibonacci
> numbers.
> > By definition, the first two numbers in the Fibonacci sequence are 0 and
> 1,
> > and each subsequent number is the sum of the previous two. As an example,
> > here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and
> > 34.
> >
> > I didn't hard code, instead taking an argument for the number of
> Fibonnaci
> > numbers to return:
> >
> > function fib N
> >   put "0,1" into R
> >   if N <= 2 then return item 1 to N of R
> >   put 0 into F1
> >   put 1 into F2
> >   repeat N - 2
> >  put F1 + F2 into F3
> >  put "",F3 after R
> >  put F2 into F1
> >  put F3 into F2
> >   end repeat
> >   return R
> > end fib
> >
> > Test Data
> > 0
> > 1
> > 2
> > 20
> >
> > Test Results
> >
> > 0
> > 0,1
> > 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Dr. Hawkins
On Sat, May 9, 2015 at 12:03 PM, Mark Waddingham  wrote:

> The reason I wrote the outline as a 'ping-pong' of reads and writes is
> because that is what most protocols entail, but you could schedule a
> sequence of 'read with message' and/or a sequence of 'write with message'
> and they would be serviced in order for each read queue and write queue
> (the actual nature of the interleaving of the two would depend on when data
> finishes sending, or is received).
>

So where I really should be going then, is

on newClient clAdr
doSomeStuff
read from socket clAdr with message "dhbkProcScktDat"
end newClient

on dhbkProcScktDat skt, msg
doSomethingWith Data
read from socket sckt with message "dhbkProcScktDat"
end dhbkProcScktDat

So that when it processes data, it puts itself back in place to do it again.

Or should it be more like

on dhbkProcScktDat skt, msg
doSomethingWith Data
send readAgain socket to me in 0
end dhbkProcScktDat

on readAgain sckt
read from socket sckt with message "dhbkProcScktDat"
end readAgain

so that dbkProcScktDat actually exists instead of nesting umpteen layers?

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Jerry Jensen
We went through this a while ago, I think a challenge forwarded by Mark Wieder. 
The problem is that integers overflow and start giving wrong answers part way 
to 100. I forget the exact place it happens.

I wrote a few that did it the hard way (character by character arithmetic) - 
I’ll see if I can find them.
.Jerry

> On May 9, 2015, at 4:32 PM, Geoff Canyon  wrote:
> 
> Problem 3
> 
> Write a function that computes the list of the first 100 Fibonacci numbers.
> By definition, the first two numbers in the Fibonacci sequence are 0 and 1,
> and each subsequent number is the sum of the previous two. As an example,
> here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and
> 34.
> 
> I didn't hard code, instead taking an argument for the number of Fibonnaci
> numbers to return:
> 
> function fib N
>   put "0,1" into R
>   if N <= 2 then return item 1 to N of R
>   put 0 into F1
>   put 1 into F2
>   repeat N - 2
>  put F1 + F2 into F3
>  put "",F3 after R
>  put F2 into F1
>  put F3 into F2
>   end repeat
>   return R
> end fib
> 
> Test Data
> 0
> 1
> 2
> 20
> 
> Test Results
> 
> 0
> 0,1
> 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
On Sat, May 9, 2015 at 6:59 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> Apparently, not as easy as I thought, but that makes it more interesting.


Yeah, I'm now trying to salvage my padding solution, which is better than
the padding solutions he gave on the site, but still wrong.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
On Sat, May 9, 2015 at 6:51 PM, Geoff Canyon  wrote:

> function sumPermute S,T
>repeat
>   put offset(",",line 1 of S) into F
>   put F into fld 1
>   wait 0 ticks
>   if F = 0 then exit repeat
>   put empty into newS
>   repeat with i = 1 to 3
>  put char i of "+- " into C
>  repeat for each line L in S
> put C into char F of L
> put L & cr after newS
>  end repeat
>   end repeat
>   put char 1 to -2 of newS into S
>end repeat
>repeat for each line L in S
>   replace space with empty in L
>   if value(L) = T then put L & cr after R
>end repeat
>return R
> end sumPermute
>

Debug code snuck in. That should be:

function sumPermute S,T
   repeat
  put offset(",",line 1 of S) into F
  if F = 0 then exit repeat
  put empty into newS
  repeat with i = 1 to 3
 put char i of "+- " into C
 repeat for each line L in S
put C into char F of L
put L & cr after newS
 end repeat
  end repeat
  put char 1 to -2 of newS into S
   end repeat
   repeat for each line L in S
  replace space with empty in L
  if value(L) = T then put L & cr after R
   end repeat
   return R
end sumPermute
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mark Schonewille
You're right, Geoff. Apparently, not as easy as I thought, but that 
makes it more interesting.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/10/2015 01:57, Geoff Canyon wrote:

On Sat, May 9, 2015 at 6:34 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:


function problem4
  put "50,2,1,9" into myList
  sort items of myList numeric descending by char 1 of each
  replace comma with empty in myList
  return myList
end problem4



Doesn't work on several inputs, here's one:
642,6,4,3 -- returns 642643, should return 664243
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
On Sat, May 9, 2015 at 6:34 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> function problem4
>  put "50,2,1,9" into myList
>  sort items of myList numeric descending by char 1 of each
>  replace comma with empty in myList
>  return myList
> end problem4
>

Doesn't work on several inputs, here's one:
642,6,4,3 -- returns 642643, should return 664243
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
On Sat, May 9, 2015 at 5:33 PM, Mike Bonner  wrote:

> What is the recursion limit?


As far as I know it's a memory thing, so there's no set depth. I could be
wrong.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
Problem 5

Write a program that outputs all possibilities to put + or - or nothing
between the numbers 1, 2, ..., 9 (in this order) such that the result is
always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.



function sumPermute S,T
   repeat
  put offset(",",line 1 of S) into F
  put F into fld 1
  wait 0 ticks
  if F = 0 then exit repeat
  put empty into newS
  repeat with i = 1 to 3
 put char i of "+- " into C
 repeat for each line L in S
put C into char F of L
put L & cr after newS
 end repeat
  end repeat
  put char 1 to -2 of newS into S
   end repeat
   repeat for each line L in S
  replace space with empty in L
  if value(L) = T then put L & cr after R
   end repeat
   return R
end sumPermute

Test Input
put sumPermute("1,2,3,4,5,6,7,8,9",100) into fld 1

Test Output
1+23-4+56+7+8+9
12+3-4+5+67+8+9
1+2+34-5+67-8+9
1+2+3-4+5+6+78+9
123-4-5-6-7+8-9
123+45-67+8-9
1+23-4+5+6+78-9
12-3-4+5-6+7+89
12+3+4+5-6-7+89
123-45-67+89
123+4-5+67-89
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: muddling around in the source for revOpenDatabase()for postgresq

2015-05-09 Thread Dr. Hawkins
[*bump*]

Trying again.  Can anyone get me further than this to find the code that
actually opens the connections for mySQL and postgres?  I'd try to adapt it
if I knew where to look (continuing my long history of using languages I
don't know . . .  [ok, for C & C++, I tend to learn them again, and then
forget all but the most basic syntax when I stop])

On Sat, Apr 4, 2015 at 10:16 AM, Dr. Hawkins  wrote:

> After letting ideas percolate in my head for a few months, I realized that
> it  would probably only take a couple or few lines of code to let
> revOpenDatabase() open a postgres database with the ssl option.
>
> So I started poking around github.   It  seems like the first piece of
> code is for *revdb.cpp* at e
> https://github.com/runrev/livecode/blob/830646697a332aadefd5e9af4d439374fe9d031e/revdb/src/revdb.cpp
>
> It looks to me like the connection is opened at line 840, after loading a
> module for the particular db type at 837. (but then, my C/C++ is beyond
> stale at this point; 15 years since I used it)
>
> And that's where the trail went dead.  I can't tell if LoadDatabaseDriver
> is part of livecode, C++, or something else (github colors it as a
> codeword, but it seems to be defined in this code at line 236, and doesn't
> appear elsewhere in livecode)
>
> however, it appears to me (did I mention my C is past rusty?) that the
> optional sixth argument to revOpenDatabase() simply gets passed on to the
> loaded driver; it didn't look to me like there's a trap anywhere to only do
> this for mySql and Valentina).
>
> But I can't figure out what it's doing to load the module, or read C++
> well enough to figure out how the arguments are passing.
>
> A postgres server may be set in its configuration file to accept ssl,
> nossl, or both.
>
>
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
>



-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
Problem 4

Write a function that given a list of non negative integers, arranges them
such that they form the largest possible number. For example, given [50, 2,
1, 9], the largest formed number is 95021.


Again, not enough test cases, and in this case his initial solution failed
when tested more rigorously. If this were a discussion at my work, this is
the point where someone would break out the sound from The Price is Right
when someone screws up (wa, wa, wa, Waaa).

Interestingly, the solution he chose -- padding -- is what I chose as well.
He bailed on it once people pointed out cases that fail. My implementation
stands up so far, but I wouldn't bet my left thumb it can't be broken. The
difference is that I pad with the first digit (not the last, not 0). So in
the final example, 42 gets ranked as 424 and thus comes before 423.

However, (this conversation just happened) another test case makes it fail.
So this is still a work in progress...

function maxValue L
   put 0 into ml
   repeat for each item i in L
  if length(i) > ml then put length(i) into ml
   end repeat
   repeat with i = 0 to 9
  repeat ml
 put i after d[i]
  end repeat
   end repeat
   repeat for each item i in L
  put i & cr after C[char 1 to ml of (i & d[char 1 of i])]
   end repeat
   put keys of C into kList
   sort kList descending numeric
   repeat for each line K in kList
  put C[K] after R
   end repeat
   replace cr with empty in R
   return R
end maxValue


Test Data
642,6,4,3
642,6,4,1
642,6,661,4,3
5,50,56
420,42,423
262,26
26,262

Test Results
664243
664241
666164243
56550
42423420
26226  -- fail
26262
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


arghh. Neither postgres nor mySQL fully supported, even in 7.

2015-05-09 Thread Dr. Hawkins
Trying to have something usable by others while I get the server going, I
took another try at mySQL today--and, after a few hours and web searches,
got reminded why I stopped . . .

Livecode can't handle  multi-line mySQL transactions in a single livecode
transaction!  You need to send the commands individually, and then commit
(A non-starter for me, as the enemy is network latency, not bandwidth or
load on the SQL server).

Whereas this is not a problem in postgres--but livecode hasn't implemented
ssl for postgres (which I suspect is only a few lines of code).

So until I have my server written, access will remain only through VPN . . .
-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mark Schonewille

Hi,

I think this should be something like this (below). Mind line wraps, 
especially in the solution for problem 5.


My solution for problem 5 is much easier but also less elegant than the 
Java solution on the website. If anyone has better (faster or easier) 
solutions, especially for problem 5, I'd like to see them.



Solutions:

// sorry, but I really can't care about the 3 different methods.
// They're silly.
function problem1
 put sum(myGivenList)
end problem1

// piece of cake for LC but in PHP and C++ also not that difficult
on problem2
 repeat with x = 1 to number of items of myList1
  put item x of myList1,item x of myList2 & comma after myNewList
 end repeat
 delete last char of myNewList
end problem2

// doh
function problem3
 put "0,1" into myList
 repeat 98
  put comma & item -2 of myList + item -1 of myList after myList
 end repeat
 return myList
end problem3

// easy
function problem4
 put "50,2,1,9" into myList
 sort items of myList numeric descending by char 1 of each
 replace comma with empty in myList
 return myList
end problem4

/* I would rather do this as a recursive function, avoiding the
multiple repeat loops and allowing for an arbitrary number of digits
(e.g. 123 or 1234 or 1468 etc) but that seems to take too much time */
function problem5
 put "+-o" into signs
 repeat with x1 = 1 to 3
  repeat with x2 = 1 to 3
   repeat with x3 = 1 to 3
repeat with x4 = 1 to 3
 repeat with x5 = 1 to 3
  repeat with x6 = 1 to 3
   repeat with x7 = 1 to 3
repeat with x8 = 1 to 3
 put 1 into myLine
 repeat with c = 2 to 9
  put char 
value("x"&c-1) of signs & c after myLine

 end repeat
 replace "o" with empty in 
myLine
 do "put" && myLine && 
"into mySum"
 if mySum is 100 then put 
myLine && mySum & cr after myList

end repeat
   end repeat
  end repeat
 end repeat
end repeat
   end repeat
  end repeat
 end repeat
 return myList
end problem5



--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/9/2015 23:49, Geoff Canyon wrote:

https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour

Interesting blog post, made doubly interesting because when the author
posted his solutions to problems 4 and 5, one of his solutions was
incorrect. So I guess he won't be hiring himself...

In any case, I thought they were interesting so I gave it a shot. I
finished in something like 40 minutes, but I think some of my solutions are
more expedient than I would like.

I'll post the code in replies, so don't read those if you want to try
yourself.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
Problem 3

Write a function that computes the list of the first 100 Fibonacci numbers.
By definition, the first two numbers in the Fibonacci sequence are 0 and 1,
and each subsequent number is the sum of the previous two. As an example,
here are the first 10 Fibonnaci numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, and
34.

I didn't hard code, instead taking an argument for the number of Fibonnaci
numbers to return:

function fib N
   put "0,1" into R
   if N <= 2 then return item 1 to N of R
   put 0 into F1
   put 1 into F2
   repeat N - 2
  put F1 + F2 into F3
  put "",F3 after R
  put F2 into F1
  put F3 into F2
   end repeat
   return R
end fib

Test Data
0
1
2
20

Test Results

0
0,1
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
Problem 2

Write a function that combines two lists by alternatingly taking elements.
For example: given the two lists [a, b, c] and [1, 2, 3], the function
should return [a, 1, b, 2, c, 3].



function interleave X,Y
   split X using comma
   split Y using comma
   repeat with i = 1 to max(item 2 of the extents of X,item 2 of the
extents of Y)
  put X[i],Y[i],"" after R
   end repeat
   return char 1 to -2 of R
end interleave


Test Data (taken in pairs of lines)
1,2,3
a,b,c

1,2,3
a,b,c,d
1,2,3

Test Output
1,a,2,b,3,c
,1,,2,,3
a,1,b,2,c,3,d,
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Bonner
Ah k.  Yep. don't do it that way.

On Sat, May 9, 2015 at 5:08 PM, Mike Bonner  wrote:

> Number 4 is cool actually, but I wonder if there are reasons NOT to do it
> the way I'm doing it.
>
> Basically, I sort the lines of the list, descending, as text rather than
> numeric, then replace cr with empty.
>
> function genLargest pList
>sort lines of pList descending
>replace cr with empty in pList
>return pList
> end genLargest
>
>
> On Sat, May 9, 2015 at 4:33 PM, Mike Bonner  wrote:
>
>> What is the recursion limit? I decided to do a speed test on larger
>> lists, and strangely, if I have a list that is 704 lines (I used lines
>> rather than items)  things work fine.  As soon as I hit 705, I get the
>> following:
>>
>> executing at 4:30:55 PM
>> Type Function: error in function handler
>> Object Button
>> Line return (line 1 of pList + withRecurse( line 2 to -1 of pList))
>> Hint withRecurse
>>
>> dropping back to 704, (no changes to my script)  and viola' it works
>> again.
>> Needless to say, if I'm hitting a recursion limit, a better error message
>> would be nice.  This is using 6.6.2.
>>
>> On Sat, May 9, 2015 at 3:55 PM, Geoff Canyon  wrote:
>>
>>> Problem 1
>>>
>>> Write three functions that compute the sum of the numbers in a given list
>>> using a for-loop, a while-loop, and recursion.
>>>
>>> Note that he doesn't provide any test cases, so for each problem I
>>> provided
>>> my own in a field, and then called the functions for each line in the
>>> test
>>> field, putting the output in another field. On to the functions:
>>>
>>> function sumFunction X
>>>   -- just because I could, not part of the original requirements
>>>return sum(X)
>>> end sumFunction
>>>
>>> function sumFor X
>>>repeat for each item i in X
>>>   add i to R
>>>end repeat
>>>return R
>>> end sumFor
>>>
>>> function sumWhile X
>>>repeat while X is not empty
>>>   add item 1 of X to R
>>>   delete item 1 of X
>>>end repeat
>>>return R
>>> end sumWhile
>>>
>>> function sumRecurse X
>>>if the number of items of X <= 1
>>>  then return X
>>>  else return item 1 of X + sumRecurse(item 2 to -1 of X)
>>> end sumRecurse
>>>
>>> Test data (first line was blank on purpose):
>>>
>>> 5
>>> 2,3,5,6,2,3,1
>>> -4,4
>>> -4,4,-5,5
>>>
>>> Test output (not entirely happy about the disparity in results for empty
>>> input):
>>> 0
>>> 5 5 5 5
>>> 22 22 22 22
>>> 0 0 0 0
>>> 0 0 0 0
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Bonner
Number 4 is cool actually, but I wonder if there are reasons NOT to do it
the way I'm doing it.

Basically, I sort the lines of the list, descending, as text rather than
numeric, then replace cr with empty.

function genLargest pList
   sort lines of pList descending
   replace cr with empty in pList
   return pList
end genLargest


On Sat, May 9, 2015 at 4:33 PM, Mike Bonner  wrote:

> What is the recursion limit? I decided to do a speed test on larger lists,
> and strangely, if I have a list that is 704 lines (I used lines rather than
> items)  things work fine.  As soon as I hit 705, I get the following:
>
> executing at 4:30:55 PM
> Type Function: error in function handler
> Object Button
> Line return (line 1 of pList + withRecurse( line 2 to -1 of pList))
> Hint withRecurse
>
> dropping back to 704, (no changes to my script)  and viola' it works
> again.
> Needless to say, if I'm hitting a recursion limit, a better error message
> would be nice.  This is using 6.6.2.
>
> On Sat, May 9, 2015 at 3:55 PM, Geoff Canyon  wrote:
>
>> Problem 1
>>
>> Write three functions that compute the sum of the numbers in a given list
>> using a for-loop, a while-loop, and recursion.
>>
>> Note that he doesn't provide any test cases, so for each problem I
>> provided
>> my own in a field, and then called the functions for each line in the test
>> field, putting the output in another field. On to the functions:
>>
>> function sumFunction X
>>   -- just because I could, not part of the original requirements
>>return sum(X)
>> end sumFunction
>>
>> function sumFor X
>>repeat for each item i in X
>>   add i to R
>>end repeat
>>return R
>> end sumFor
>>
>> function sumWhile X
>>repeat while X is not empty
>>   add item 1 of X to R
>>   delete item 1 of X
>>end repeat
>>return R
>> end sumWhile
>>
>> function sumRecurse X
>>if the number of items of X <= 1
>>  then return X
>>  else return item 1 of X + sumRecurse(item 2 to -1 of X)
>> end sumRecurse
>>
>> Test data (first line was blank on purpose):
>>
>> 5
>> 2,3,5,6,2,3,1
>> -4,4
>> -4,4,-5,5
>>
>> Test output (not entirely happy about the disparity in results for empty
>> input):
>> 0
>> 5 5 5 5
>> 22 22 22 22
>> 0 0 0 0
>> 0 0 0 0
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread BNig
Richmond,

if you use colorTrace on HturtleColor.png  and choose radio button 2 for the
posterized image to trace then it traces HturtleColor.png all right.

If everything failes convert these funny pngs to jpeg and do a colorTrace on
that. Again choose from the radio buttons the number of colors that give you
the best approximation to the original image with the lowest number of
colors.

Kind regards

Bernd



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Converting-an-image-into-a-vector-object-tp4692027p4692061.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Mike Bonner
What is the recursion limit? I decided to do a speed test on larger lists,
and strangely, if I have a list that is 704 lines (I used lines rather than
items)  things work fine.  As soon as I hit 705, I get the following:

executing at 4:30:55 PM
Type Function: error in function handler
Object Button
Line return (line 1 of pList + withRecurse( line 2 to -1 of pList))
Hint withRecurse

dropping back to 704, (no changes to my script)  and viola' it works again.

Needless to say, if I'm hitting a recursion limit, a better error message
would be nice.  This is using 6.6.2.

On Sat, May 9, 2015 at 3:55 PM, Geoff Canyon  wrote:

> Problem 1
>
> Write three functions that compute the sum of the numbers in a given list
> using a for-loop, a while-loop, and recursion.
>
> Note that he doesn't provide any test cases, so for each problem I provided
> my own in a field, and then called the functions for each line in the test
> field, putting the output in another field. On to the functions:
>
> function sumFunction X
>   -- just because I could, not part of the original requirements
>return sum(X)
> end sumFunction
>
> function sumFor X
>repeat for each item i in X
>   add i to R
>end repeat
>return R
> end sumFor
>
> function sumWhile X
>repeat while X is not empty
>   add item 1 of X to R
>   delete item 1 of X
>end repeat
>return R
> end sumWhile
>
> function sumRecurse X
>if the number of items of X <= 1
>  then return X
>  else return item 1 of X + sumRecurse(item 2 to -1 of X)
> end sumRecurse
>
> Test data (first line was blank on purpose):
>
> 5
> 2,3,5,6,2,3,1
> -4,4
> -4,4,-5,5
>
> Test output (not entirely happy about the disparity in results for empty
> input):
> 0
> 5 5 5 5
> 22 22 22 22
> 0 0 0 0
> 0 0 0 0
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Automated Drawing

2015-05-09 Thread Jim Hurley
P.S.

I should have said that "startTurtle" (or simply "st") is the command that 
initiates the turtle.

Jim


> Message: 8
> Date: Sat, 09 May 2015 19:59:15 +0300
> From: Richmond 
> To: How to use LiveCode 
> Subject: Re: Automated Drawing
> Message-ID: <554e3ce3.2030...@gmail.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> On 09/05/15 16:52, Richmond wrote:
>> On 21/03/15 18:17, Jim Hurley wrote:
>>> Richmond,
>>> 
>>> I wrote this Turtle Graphics library in the dark ages of RR, before 
>>> ?sum? became a reserved word.
>>> 
>>> So, comment out the ?sum? handler in the stack script.
>>> 
>>> Jim
>>> 
>> 
>> Having copied your stack script across into my stack I am stuck with 2 
>> problems:
>> 
>> 1. How to make the line to show as 'pd' [penDown] doesn't seem to work.
>> 
>> 2. How to exchange your graphic "turtleGraphic" for an img.
>> 
>> In all other respects the thing is super!
>> 
>> Richmond.
> 
> Actually my "big" problem at the moment is, with this script:
> 
> on right dangl
>  rt dangl
> end right
> 
> on rt dangl
>  subtract dangl from angl
>  drawTurtle
> end rt
> 
> on drawTurtle
>  myWait waitTime
>  if noDraw then exit drawturtle
>  put 5 into distance
>  put round(x0 +x)&comma& round(-y+y0) & return into gPoints
>  put distance * cos(radPerDeg * angl) into dx
>  put dx into fld "dx"
>  put distance * sin(radPerDeg * angl) into dy
>  put dy into fld "dy"
>  put round(x+x0+dx)&comma&round(-y+y0-dy) after gPoints
>  set points of graphic "turtleGraphic" to gPoints
>  set the angle of img "turt" to ((the angle of img "turt") - angl)
> end drawTurtle
> 
> with the graphic "turtleGraphic" and the img "turt" initially pointing 
> in the same direction,
> why they don't go on pointing in the same direction everytime I send 
> "right 45" via the message box?
> 
> Richmond.
> *


Hi Richmond,

I suspect the problem your are having is that the turtle has to initiated 
before he will respond.

Try this script in a button as see if it draw a line, shows the arrow pointing 
in the direction of the next move and then repeats.
The result  should be a square 100 units on a side.

on mouseUp
  startTurtle
  showturtle
  repeat 4 times
 fd 100
 lt 90
 wait 50  ticks
  end repeat
  choose the browse tool
end mouseUp

Jim


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Automated Drawing

2015-05-09 Thread Richmond

On 10/05/15 01:22, Jim Hurley wrote:

Message: 8
Date: Sat, 09 May 2015 19:59:15 +0300
From: Richmond 
To: How to use LiveCode 
Subject: Re: Automated Drawing
Message-ID: <554e3ce3.2030...@gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed

On 09/05/15 16:52, Richmond wrote:

On 21/03/15 18:17, Jim Hurley wrote:

Richmond,

I wrote this Turtle Graphics library in the dark ages of RR, before
?sum? became a reserved word.

So, comment out the ?sum? handler in the stack script.

Jim


Having copied your stack script across into my stack I am stuck with 2
problems:

1. How to make the line to show as 'pd' [penDown] doesn't seem to work.

2. How to exchange your graphic "turtleGraphic" for an img.

In all other respects the thing is super!

Richmond.

Actually my "big" problem at the moment is, with this script:

on right dangl
   rt dangl
end right

on rt dangl
   subtract dangl from angl
   drawTurtle
end rt

on drawTurtle
   myWait waitTime
   if noDraw then exit drawturtle
   put 5 into distance
   put round(x0 +x)&comma& round(-y+y0) & return into gPoints
   put distance * cos(radPerDeg * angl) into dx
   put dx into fld "dx"
   put distance * sin(radPerDeg * angl) into dy
   put dy into fld "dy"
   put round(x+x0+dx)&comma&round(-y+y0-dy) after gPoints
   set points of graphic "turtleGraphic" to gPoints
   set the angle of img "turt" to ((the angle of img "turt") - angl)
end drawTurtle

with the graphic "turtleGraphic" and the img "turt" initially pointing
in the same direction,
why they don't go on pointing in the same direction everytime I send
"right 45" via the message box?

Richmond.
*


Hi Richmond,
   
I suspect the problem your are having is that the turtle has to initiated before he will respond.


Try this script in a button as see if it draw a line, shows the arrow pointing 
in the direction of the next move and then repeats.
The result  should be a square 100 units on a side.

on mouseUp
startTurtle
showturtle
repeat 4 times
   fd 100
   lt 90
   wait 50  ticks
end repeat
choose the browse tool
end mouseUp

Jim





Yesd, it is, and it is my bl**dy silly fault that I fired off that 
e-mail before I did a bit more digging and sorted the whole thing out.


Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Automated Drawing

2015-05-09 Thread Jim Hurley
> 
> Message: 8
> Date: Sat, 09 May 2015 19:59:15 +0300
> From: Richmond 
> To: How to use LiveCode 
> Subject: Re: Automated Drawing
> Message-ID: <554e3ce3.2030...@gmail.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> On 09/05/15 16:52, Richmond wrote:
>> On 21/03/15 18:17, Jim Hurley wrote:
>>> Richmond,
>>> 
>>> I wrote this Turtle Graphics library in the dark ages of RR, before 
>>> ?sum? became a reserved word.
>>> 
>>> So, comment out the ?sum? handler in the stack script.
>>> 
>>> Jim
>>> 
>> 
>> Having copied your stack script across into my stack I am stuck with 2 
>> problems:
>> 
>> 1. How to make the line to show as 'pd' [penDown] doesn't seem to work.
>> 
>> 2. How to exchange your graphic "turtleGraphic" for an img.
>> 
>> In all other respects the thing is super!
>> 
>> Richmond.
> 
> Actually my "big" problem at the moment is, with this script:
> 
> on right dangl
>   rt dangl
> end right
> 
> on rt dangl
>   subtract dangl from angl
>   drawTurtle
> end rt
> 
> on drawTurtle
>   myWait waitTime
>   if noDraw then exit drawturtle
>   put 5 into distance
>   put round(x0 +x)&comma& round(-y+y0) & return into gPoints
>   put distance * cos(radPerDeg * angl) into dx
>   put dx into fld "dx"
>   put distance * sin(radPerDeg * angl) into dy
>   put dy into fld "dy"
>   put round(x+x0+dx)&comma&round(-y+y0-dy) after gPoints
>   set points of graphic "turtleGraphic" to gPoints
>   set the angle of img "turt" to ((the angle of img "turt") - angl)
> end drawTurtle
> 
> with the graphic "turtleGraphic" and the img "turt" initially pointing 
> in the same direction,
> why they don't go on pointing in the same direction everytime I send 
> "right 45" via the message box?
> 
> Richmond.
> *


Hi Richmond,
  
I suspect the problem your are having is that the turtle has to initiated 
before he will respond.

Try this script in a button as see if it draw a line, shows the arrow pointing 
in the direction of the next move and then repeats.
The result  should be a square 100 units on a side.

on mouseUp
   startTurtle
   showturtle
   repeat 4 times
  fd 100
  lt 90
  wait 50  ticks
   end repeat
   choose the browse tool
end mouseUp

Jim


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread Richmond

On 09/05/15 23:48, BNig wrote:

Dear Richmond,

could you send me the original image off-list.

Not the one converted to grayscale. That seems a little funny.

Kind regards

Bernd


Yes, of course: 
https://www.dropbox.com/sh/ja47l87gg87sn0q/AAAIj99kEQVOb8ev3jz8C5ORa?dl=0 file: 
HturtleColor.png


Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


problems with revdb_connect

2015-05-09 Thread Inselfan
Good evening,

after a long long time, I'm back here :)

I'm still using LC 4.3.5, which is, like me a bit older but it works (like
me) and I learned to handle the bugs there.

Since years I use 
put revdb_connect ("mySQL","192.168.Y.XX","databasename","root",,,) into
DB_ID 

which is doing what ist has to do. Since today I get an unexpected error: 

revdberr,invalid database type

in the programmers-version with the source code. Strange enough, it works
with the same, but compiled code on the same computer

Does anybody has an idea, what is going on there and what I should
control/test?

Thanks for your help and helpfull ikdeas

Horst




--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/problems-with-revdb-connect-tp4692055.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
Problem 1

Write three functions that compute the sum of the numbers in a given list
using a for-loop, a while-loop, and recursion.

Note that he doesn't provide any test cases, so for each problem I provided
my own in a field, and then called the functions for each line in the test
field, putting the output in another field. On to the functions:

function sumFunction X
  -- just because I could, not part of the original requirements
   return sum(X)
end sumFunction

function sumFor X
   repeat for each item i in X
  add i to R
   end repeat
   return R
end sumFor

function sumWhile X
   repeat while X is not empty
  add item 1 of X to R
  delete item 1 of X
   end repeat
   return R
end sumWhile

function sumRecurse X
   if the number of items of X <= 1
 then return X
 else return item 1 of X + sumRecurse(item 2 to -1 of X)
end sumRecurse

Test data (first line was blank on purpose):

5
2,3,5,6,2,3,1
-4,4
-4,4,-5,5

Test output (not entirely happy about the disparity in results for empty
input):
0
5 5 5 5
22 22 22 22
0 0 0 0
0 0 0 0
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Five programming problems every Software Engineer should be able to solve in less than 1 hour

2015-05-09 Thread Geoff Canyon
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour

Interesting blog post, made doubly interesting because when the author
posted his solutions to problems 4 and 5, one of his solutions was
incorrect. So I guess he won't be hiring himself...

In any case, I thought they were interesting so I gave it a shot. I
finished in something like 40 minutes, but I think some of my solutions are
more expedient than I would like.

I'll post the code in replies, so don't read those if you want to try
yourself.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread BNig
Dear Richmond,

could you send me the original image off-list.

Not the one converted to grayscale. That seems a little funny.

Kind regards

Bernd



--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Converting-an-image-into-a-vector-object-tp4692027p4692052.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread BNig
Dear Richmond,

that is a monochrome png with transparency.

It is not for colorTrace.

Try this stack

http://forums.livecode.com/viewtopic.php?f=10&t=19040&hilit=+tracing

it traces the alphachannel instead

and tell me if this works

Kind regards

Bernd




--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Converting-an-image-into-a-vector-object-tp4692027p4692051.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Editing a cell in a DataGrid

2015-05-09 Thread Terence Heaford

Thanks André,

 I did not realise that CloseFieldEditor was passed to the DataGrid Group. I 
could not find much information about it’s use.

All the best

Terry


> On 9 May 2015, at 16:58, André Bisseret  wrote:
> 
> Bonjour Terry,
> 
> on closeFieldEditor
> you could 
> put the dgHilitedLines of group  «suchDG ino tLine
> put the dgDataOfLine[tLine] of group  «suchDG" into tLineData
> so can get tLineDataBque[«columName"]
> 
> Not sure that’s the best way, but seems that should do what your want 
> 
> HTH
> 
> best regards
> 
> André

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Trouble writing file to server

2015-05-09 Thread Mark Schonewille

Hi Bill,

0777 is for all users who have access to the computer including guests. 
This includes e.g. people who log in over FTP or SSH. However, without 
logging in first, you can't have access to a computer.


Some server accept the put command over http, but many don't. Servers 
that accept it, will still need some credentials, even if it is only 
guest:guest.


More common are FTP commands or POST and GET commands using the http 
protocol. For a file, you may want to use a multipart POST command, but 
you will need to handle the POST in a PHP or OnRev script.


FTP is really simple:

put "ftp://user:passw...@ftp.server.com/www/path/file.xyz"; into myURL

Because it is very simple, it is also slightly insecure.

If you let me know how you want to proceed, I can help.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/9/2015 21:50, William Prothero wrote:

Folks:
I can read a simple text file from my server, but can’t write to the server. My 
code is:

on getTestData
put "http://waterdetective.earthednet.org/rawmeterdata/testdata"; into xURL
put URL xURL into myTestData  --This works.
put “http://waterdetective.earthednet.org/rawmeterdata/mycrap"; into xURL
put "mycrapstuff" into URL( xURL)
end getTestData

I get the testdata file ok. I wrote it using another program. But, I can’t get 
it to write to the file “mycrap”

The directory has permission 0777, so everybody should be able to write to it.
Or, is there some kind of permission and login thing I need to do first.

Aren’t there any error messages returned if the write fails?

Bill

William A. Prothero
http://es.earthednet.org/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Trouble writing file to server

2015-05-09 Thread William Prothero
Folks:
I can read a simple text file from my server, but can’t write to the server. My 
code is:

on getTestData
   put "http://waterdetective.earthednet.org/rawmeterdata/testdata"; into xURL
   put URL xURL into myTestData  --This works.
   put “http://waterdetective.earthednet.org/rawmeterdata/mycrap"; into xURL
   put "mycrapstuff" into URL( xURL)
end getTestData

I get the testdata file ok. I wrote it using another program. But, I can’t get 
it to write to the file “mycrap”

The directory has permission 0777, so everybody should be able to write to it.
Or, is there some kind of permission and login thing I need to do first.

Aren’t there any error messages returned if the write fails?

Bill

William A. Prothero
http://es.earthednet.org/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Converting an image into a vector object

2015-05-09 Thread Richmond

On 09/05/15 22:23, Roger Eller wrote:

That image should work, but you may have to enlarge it in Gimp first, and
give it more white space (increase canvas size).

The final stack that handles color is pretty awesome.  Here's that final
post in the thread:

---
BNig
Feb 22, 2014; 8:43am Re: Tracing Stack (was: the points of graphic)

In reply to this post by BNig
Hi,

Color Tracing, Color Tracking.

here is a version of an image tracing stack that traces color images.

It makes a graphic for each color. And it makes a combined graphic from the
color-subgraphics.

You have quite some options which graphics to include.

note that this stack has a button with a question mark in it with some
instruction how to use it.
The main stack has three substacks. Makes for some clutter but accomodates
larger images.

Please choose a posterization level after loading an image.
Only if the image turns completely black on posterization reload the image
and "Color Trace" it without posterization.

Due to the tricky nature of images/colors you may not get satisfactory
results with all images. Especially subtle gradients are hard to get at a
reasonable resolution.

There is also a substack to use Livecode's Paint Tools to paint simple
forms and convert them into graphics.
Please choose a posterization level before "color tracing".

You can download the stack here:
http://berndniggemann.on-rev.com/ColorTrace/ColorTracing.livecode.zip

Comments welcome.


Dear Bernd, I tried with this image: 
https://www.dropbox.com/sh/ja47l87gg87sn0q/AAAIj99kEQVOb8ev3jz8C5ORa?dl=0 file: 
Hturtle.png


which was set in GIMP to grayscale. On tracing I got a message about it 
containing more than 12 colours; so it did not trace.


Richmond.



What to do with the graphics is anybodys guess. But it was fun to do. I
would be interested in real world use cases.

Kind regards
Bernd
---
  On May 9, 2015 3:15 PM, "Richmond"  wrote:


On 09/05/15 21:57, Roger Eller wrote:


If the stack is still out there (on the forum), it is the best I've seen I
in LiveCode.


http://runtime-revolution.278305.n4.nabble.com/Tracing-Stack-was-the-points-of-graphic-td4674846.html#a4676220


That stack is super . . . But . . .

I have an image with discontinuous black bits:
https://www.dropbox.com/sh/ja47l87gg87sn0q/AAAIj99kEQVOb8ev3jz8C5ORa?dl=0

seaTurtle.png

which I would like to convert into a SINGLE graphic, and am beginning to
suspect is not possible.

Richmond.



1. Trace an image in a stack to get a vector graphic?

I shall be doing that outwith Livecode using Inkscape.

2. Has the Kickstarter goal of importing vector graphics been arrived at
yet?

I shall use Alejandro Tejada's EPS importer:
http://andregarzia.on-rev.com/alejandro/stacks/

2.1. And if so, how come I missed that?

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread Roger Eller
That image should work, but you may have to enlarge it in Gimp first, and
give it more white space (increase canvas size).

The final stack that handles color is pretty awesome.  Here's that final
post in the thread:

---
BNig
Feb 22, 2014; 8:43am Re: Tracing Stack (was: the points of graphic)

In reply to this post by BNig
Hi,

Color Tracing, Color Tracking.

here is a version of an image tracing stack that traces color images.

It makes a graphic for each color. And it makes a combined graphic from the
color-subgraphics.

You have quite some options which graphics to include.

note that this stack has a button with a question mark in it with some
instruction how to use it.
The main stack has three substacks. Makes for some clutter but accomodates
larger images.

Please choose a posterization level after loading an image.
Only if the image turns completely black on posterization reload the image
and "Color Trace" it without posterization.

Due to the tricky nature of images/colors you may not get satisfactory
results with all images. Especially subtle gradients are hard to get at a
reasonable resolution.

There is also a substack to use Livecode's Paint Tools to paint simple
forms and convert them into graphics.
Please choose a posterization level before "color tracing".

You can download the stack here:
http://berndniggemann.on-rev.com/ColorTrace/ColorTracing.livecode.zip

Comments welcome.

What to do with the graphics is anybodys guess. But it was fun to do. I
would be interested in real world use cases.

Kind regards
Bernd
---
 On May 9, 2015 3:15 PM, "Richmond"  wrote:

> On 09/05/15 21:57, Roger Eller wrote:
>
>> If the stack is still out there (on the forum), it is the best I've seen I
>> in LiveCode.
>>
>>
>> http://runtime-revolution.278305.n4.nabble.com/Tracing-Stack-was-the-points-of-graphic-td4674846.html#a4676220
>>
>
> That stack is super . . . But . . .
>
> I have an image with discontinuous black bits:
> https://www.dropbox.com/sh/ja47l87gg87sn0q/AAAIj99kEQVOb8ev3jz8C5ORa?dl=0
>
> seaTurtle.png
>
> which I would like to convert into a SINGLE graphic, and am beginning to
> suspect is not possible.
>
> Richmond.
>
>
>> 1. Trace an image in a stack to get a vector graphic?
>>
>> I shall be doing that outwith Livecode using Inkscape.
>>
>> 2. Has the Kickstarter goal of importing vector graphics been arrived at
>> yet?
>>
>> I shall use Alejandro Tejada's EPS importer:
>> http://andregarzia.on-rev.com/alejandro/stacks/
>>
>> 2.1. And if so, how come I missed that?
>>
>> Richmond.
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread Richmond

On 09/05/15 21:57, Roger Eller wrote:

If the stack is still out there (on the forum), it is the best I've seen I
in LiveCode.

http://runtime-revolution.278305.n4.nabble.com/Tracing-Stack-was-the-points-of-graphic-td4674846.html#a4676220


That stack is super . . . But . . .

I have an image with discontinuous black bits: 
https://www.dropbox.com/sh/ja47l87gg87sn0q/AAAIj99kEQVOb8ev3jz8C5ORa?dl=0


seaTurtle.png

which I would like to convert into a SINGLE graphic, and am beginning to 
suspect is not possible.


Richmond.



1. Trace an image in a stack to get a vector graphic?

I shall be doing that outwith Livecode using Inkscape.

2. Has the Kickstarter goal of importing vector graphics been arrived at
yet?

I shall use Alejandro Tejada's EPS importer:
http://andregarzia.on-rev.com/alejandro/stacks/

2.1. And if so, how come I missed that?

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Pierre Sahores
Many thanks, Mark ! Very useful.

Pierre

> Le 9 mai 2015 à 21:03, Mark Waddingham  a écrit :
> 
>> Or, is it starting a ping-pong between clientDataReceived and
>> clientDataSent, with each calling the other when done?
> 
> Yes - that's precisely what the code does that I outlined.
> 
> Sockets are bidirectional in nature and so you can 'simultaneously' be 
> reading and writing to them at the same time.
> 
> When you do a 'read' or a 'write' and specify a message no direct action 
> takes place at that point at all. Instead, the engine queues the read (or 
> write) request (they are separate queues) and marks the socket to notify the 
> engine when data arrives (or data is sent). As data arrives (or is sent), the 
> engine dispatches the appropriate messages in order to satisfy the requests 
> that have been made. In particular, no blocking occurs at the point of the 
> read/write command, instead things happen the next time the event loop runs 
> (typically when the current handler stack which was initiated by a message 
> completes; but also when a 'wait with messages' command occurs).
> 
> The reason I wrote the outline as a 'ping-pong' of reads and writes is 
> because that is what most protocols entail, but you could schedule a sequence 
> of 'read with message' and/or a sequence of 'write with message' and they 
> would be serviced in order for each read queue and write queue (the actual 
> nature of the interleaving of the two would depend on when data finishes 
> sending, or is received).
> 
>> What I'm not getting is how to handle the client again using that freshly
>> created new socket (call it "sktRefresh") again without using polling.  For
>> example, client program opens the database, which contains various customer
>> files.  A few seconds later, the client wants to update the jones table, so
>> it sends the server a message with the relevant database commands, by
>> writing to sktRefresh.
> 
> I take it by 'sktRefresh' you mean the socket identifier given to you as the 
> parameter to 'newClient'? This is the server-side of the connection to the 
> individual client, so on the server side you issue an appropriate 'read with 
> message' for that socket which will fire when the client sends it some data. 
> Then, on the server you would service that request in the callback message 
> and perform the query returning the data using 'write with message'. Now, if 
> the client needs to be able to send several requests to the client 
> simultaneously then you would probably also want to 'read with message' so 
> the server can catch another (whilst data is being written back) request - 
> but that will depend on the client and how it is going to use the server.
> 
>> As near as I can tell, when this happens* after* the initial opening, that
>> message is going to sit around until something decides to read it, rather
>> than triggering a new message.
> 
> Yes - the only way to read data from a socket is to explicitly use the 'read' 
> command. The blocking form will sit and wait until the client has actually 
> sent some data (which means the server cannot be doing anything else); whilst 
> the 'with message' form tells the engine to watch for data to be delivered 
> and as soon as it satisfies the specified read condition send you a message 
> with the data. i.e. The server can happily go off and do other things until 
> the client *actually* does send some data to process.
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Mark Waddingham
Just using the accept connections will get you that.  The message sent 
is

in the form of 127.0.0.1:50565.  That is, ip:port

Now, *why* that is a different port than I was listening on is beyond 
me .

. .


The port you use at the 'accept' point is the port to which a connection 
needs to be made by the client.


When the server accepts the connection it essentially creates a new 
socket which connects to the client at the other end. The different port 
number is the reflection of the fact that it is the server-side end of 
the client's socket.


I guess you could think of it as a 'switch-board' in a sense - accepting 
sockets are the operator, as soon as a request is received a server-side 
connection point is created and the incoming request is patched directly 
to it... It no longer goes through the operator.


Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Converting an image into a vector object

2015-05-09 Thread Richmond

On 09/05/15 21:57, Roger Eller wrote:

If the stack is still out there (on the forum), it is the best I've seen I
in LiveCode.

http://runtime-revolution.278305.n4.nabble.com/Tracing-Stack-was-the-points-of-graphic-td4674846.html#a4676220


What a fantastic thread with all sorts of marvellous things: 
needless-to-say, I've downloaded the lot, and would urge

everybody else to.

Richmond.

  On May 9, 2015 1:59 PM, "Richmond"  wrote:


Does anyone know of a way to:

1. Trace an image in a stack to get a vector graphic?

I shall be doing that outwith Livecode using Inkscape.

2. Has the Kickstarter goal of importing vector graphics been arrived at
yet?

I shall use Alejandro Tejada's EPS importer:
http://andregarzia.on-rev.com/alejandro/stacks/

2.1. And if so, how come I missed that?

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Mark Waddingham

Or, is it starting a ping-pong between clientDataReceived and
clientDataSent, with each calling the other when done?


Yes - that's precisely what the code does that I outlined.

Sockets are bidirectional in nature and so you can 'simultaneously' be 
reading and writing to them at the same time.


When you do a 'read' or a 'write' and specify a message no direct action 
takes place at that point at all. Instead, the engine queues the read 
(or write) request (they are separate queues) and marks the socket to 
notify the engine when data arrives (or data is sent). As data arrives 
(or is sent), the engine dispatches the appropriate messages in order to 
satisfy the requests that have been made. In particular, no blocking 
occurs at the point of the read/write command, instead things happen the 
next time the event loop runs (typically when the current handler stack 
which was initiated by a message completes; but also when a 'wait with 
messages' command occurs).


The reason I wrote the outline as a 'ping-pong' of reads and writes is 
because that is what most protocols entail, but you could schedule a 
sequence of 'read with message' and/or a sequence of 'write with 
message' and they would be serviced in order for each read queue and 
write queue (the actual nature of the interleaving of the two would 
depend on when data finishes sending, or is received).


What I'm not getting is how to handle the client again using that 
freshly
created new socket (call it "sktRefresh") again without using polling.  
For
example, client program opens the database, which contains various 
customer
files.  A few seconds later, the client wants to update the jones 
table, so

it sends the server a message with the relevant database commands, by
writing to sktRefresh.


I take it by 'sktRefresh' you mean the socket identifier given to you as 
the parameter to 'newClient'? This is the server-side of the connection 
to the individual client, so on the server side you issue an appropriate 
'read with message' for that socket which will fire when the client 
sends it some data. Then, on the server you would service that request 
in the callback message and perform the query returning the data using 
'write with message'. Now, if the client needs to be able to send 
several requests to the client simultaneously then you would probably 
also want to 'read with message' so the server can catch another (whilst 
data is being written back) request - but that will depend on the client 
and how it is going to use the server.


As near as I can tell, when this happens* after* the initial opening, 
that
message is going to sit around until something decides to read it, 
rather

than triggering a new message.


Yes - the only way to read data from a socket is to explicitly use the 
'read' command. The blocking form will sit and wait until the client has 
actually sent some data (which means the server cannot be doing anything 
else); whilst the 'with message' form tells the engine to watch for data 
to be delivered and as soon as it satisfies the specified read condition 
send you a message with the data. i.e. The server can happily go off and 
do other things until the client *actually* does send some data to 
process.


Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: about Mark...

2015-05-09 Thread Roger Eller
"I'm always angry.  That's my secret."  --Dr. Banner
 On May 9, 2015 2:58 PM, "Richmond"  wrote:

> On 09/05/15 21:56, Colin Holgate wrote:
>
>> I didn’t mean it to be.
>>
>>  On May 9, 2015, at 2:53 PM, Richmond 
>>> wrote:
>>>
>>>  This is in no way a complaint! But I’m curious about how much Mark is
 posting these days. Did he run out of things to develop?

>>> That's a bit of a b*tchy comment.
>>>
>>
>>  I never mean my comments to be b*tchy either: but they almost always are
> :)
>
> Richmond.
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: about Mark...

2015-05-09 Thread Richmond

On 09/05/15 21:56, Colin Holgate wrote:

I didn’t mean it to be.


On May 9, 2015, at 2:53 PM, Richmond  wrote:


This is in no way a complaint! But I’m curious about how much Mark is posting 
these days. Did he run out of things to develop?

That's a bit of a b*tchy comment.



I never mean my comments to be b*tchy either: but they almost always are :)

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Converting an image into a vector object

2015-05-09 Thread Roger Eller
If the stack is still out there (on the forum), it is the best I've seen I
in LiveCode.

http://runtime-revolution.278305.n4.nabble.com/Tracing-Stack-was-the-points-of-graphic-td4674846.html#a4676220
 On May 9, 2015 1:59 PM, "Richmond"  wrote:

> Does anyone know of a way to:
>
> 1. Trace an image in a stack to get a vector graphic?
>
> I shall be doing that outwith Livecode using Inkscape.
>
> 2. Has the Kickstarter goal of importing vector graphics been arrived at
> yet?
>
> I shall use Alejandro Tejada's EPS importer:
> http://andregarzia.on-rev.com/alejandro/stacks/
>
> 2.1. And if so, how come I missed that?
>
> Richmond.
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: about Mark...

2015-05-09 Thread Colin Holgate
I didn’t mean it to be. 

> On May 9, 2015, at 2:53 PM, Richmond  wrote:
> 
>> This is in no way a complaint! But I’m curious about how much Mark is 
>> posting these days. Did he run out of things to develop?
> 
> That's a bit of a b*tchy comment.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: about Mark...

2015-05-09 Thread Colin Holgate
I agree. Imagine you’re into relativity, and Einstein posts to your email list, 
you’re going to be inspired.


> On May 9, 2015, at 2:44 PM, Mark Schonewille 
>  wrote:
> 
> Hi Colin,
> 
> I asked the same question on ChatRev the other day. Eventually we pretty much 
> agreed that Mark is probably doing what he is paid for: overseeing the 
> programming team, thinking about what are the most important issues and how 
> to solve them. The latter part probably makes him more involved with the 
> community. I don't know whether Mark sees it this way, but it seems to be a 
> good development.
> 
> --
> Best regards,
> 
> Mark Schonewille
> 
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> 
> Installer Maker for LiveCode:
> http://qery.us/468
> 
> Buy my new book "Programming LiveCode for the Real Beginner" 
> http://qery.us/3fi
> 
> LiveCode on Facebook:
> https://www.facebook.com/groups/runrev/
> 
> On 5/9/2015 20:37, Colin Holgate wrote:
>> This is in no way a complaint! But I’m curious about how much Mark is 
>> posting these days. Did he run out of things to develop?
>> 
>> It is exciting to see him participating here.
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: about Mark...

2015-05-09 Thread Richmond

On 09/05/15 21:37, Colin Holgate wrote:

This is in no way a complaint! But I’m curious about how much Mark is posting 
these days. Did he run out of things to develop?


That's a bit of a b*tchy comment.


It is exciting to see him participating here.


Yes, it is, and it should be welcomed, instead of having snide comments 
lobbed at it.


Richmond.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Dr. Hawkins
On Sat, May 9, 2015 at 11:46 AM, William Prothero 
wrote:

> I’ve been following this thread with interest. Thanks for the code. Now
> I’m wondering how I might use this capability. Can I set up a multi-user
> game using this? I must have to somehow get the user’s ip address. There
> are probably samples in the Livecode examples library and I’ll search
> around for one.


Just using the accept connections will get you that.  The message sent is
in the form of 127.0.0.1:50565.  That is, ip:port

Now, *why* that is a different port than I was listening on is beyond me .
. .



-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Dr. Hawkins
On Sat, May 9, 2015 at 10:54 AM, Mark Waddingham  wrote:

> The idea here is that each time you get a 'newClient' message you have a
> newly named socket 'pClientSocket' which is the other end of the connection
> the client initiated. You can have as many of these client-connected
> sockets as you like, and independently read / write to them with messages
> sent when the action you request completes.


Thank you.  I appreciate this, and here is the catch, or what I'm not
understanding:

In your example, the read in newClient only appears to happen once.  And
part of what I'm trying to clear up is whether execution stops at that
line, or continues--or does this even matter, as an event triggered this,
and several could be simultaneous?  My current understanding is that it
waits if there is active writing, and when that writing is done, it does
clientDataReceived--and then is done.

Or, is it starting a ping-pong between clientDataReceived and
clientDataSent, with each calling the other when done?

In my case, newClient causes the opening of a database session
(revOpenDatabase), and a confirmation goes back to the client.  I have all
that working at this point (i think).

What I'm not getting is how to handle the client again using that freshly
created new socket (call it "sktRefresh") again without using polling.  For
example, client program opens the database, which contains various customer
files.  A few seconds later, the client wants to update the jones table, so
it sends the server a message with the relevant database commands, by
writing to sktRefresh.

As near as I can tell, when this happens* after* the initial opening, that
message is going to sit around until something decides to read it, rather
than triggering a new message.


-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread William Prothero
Mark:
I’ve been following this thread with interest. Thanks for the code. Now I’m 
wondering how I might use this capability. Can I set up a multi-user game using 
this? I must have to somehow get the user’s ip address. There are probably 
samples in the Livecode examples library and I’ll search around for one.
Best,
Bill

> On May 9, 2015, at 10:54 AM, Mark Waddingham  wrote:
> 
>> My sequence is that the client connects to the server, and then sends it
>> periodic messages.  On the initial connection, the server creates a
>> database connection and leaves it open (opening a database takes time
>> measured in hundreds of milliseconds).   The approach of opening and
>> closing a database on each transaction simply isn't a realistic option for
>> me.
> 
> All the socket commands can be used in a non-blocking, message-based way.
> 
> When you 'accept connections' you create a listening socket whose purpose is 
> to wait for connections and then supply you with a 'normal' socket to talk to 
> the client which connected. The listening socket will continue to persist 
> after this (until you close it) continuing to wait for new connections from 
> clients.
> 
> So an outline of an example (which assumes on receiving data from the client 
> you need to send it something):
>  on startServer
>accept connections ... with message "newClient"
>  end startServer
> 
>  on newClient pClientSocket
>read from pClientSocket ... with message "clientDataReceived"
>  end newClient
> 
>  on clientDataReceived pClientSocket, pData
>... process pData ...
>write ... to socket pClientSocket with pData with message "clientDataSent"
>  end clientDataReceived
> 
>  on clientDataSent pClientSocket
>read from pClientSocket ... with message "clientDataReceived"
>  end clientDataSent
> 
> The idea here is that each time you get a 'newClient' message you have a 
> newly named socket 'pClientSocket' which is the other end of the connection 
> the client initiated. You can have as many of these client-connected sockets 
> as you like, and independently read / write to them with messages sent when 
> the action you request completes.
> 
> If you use the blocking form of the socket commands then (as they don't 
> dispatch messages whilst blocking) you can basically only talk to one client 
> at a time. The blocking form may well be fine for a client, if it is 
> connecting to a server, interacting with some sort of linear protocol and 
> then closing the connection; but for a server that wishes to handle multiple 
> clients simultaneously it is a much better idea to use the messaging form.
> 
> Hope this helps,
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: about Mark...

2015-05-09 Thread Mark Schonewille

Hi Colin,

I asked the same question on ChatRev the other day. Eventually we pretty 
much agreed that Mark is probably doing what he is paid for: overseeing 
the programming team, thinking about what are the most important issues 
and how to solve them. The latter part probably makes him more involved 
with the community. I don't know whether Mark sees it this way, but it 
seems to be a good development.


--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Installer Maker for LiveCode:
http://qery.us/468

Buy my new book "Programming LiveCode for the Real Beginner" 
http://qery.us/3fi


LiveCode on Facebook:
https://www.facebook.com/groups/runrev/

On 5/9/2015 20:37, Colin Holgate wrote:

This is in no way a complaint! But I’m curious about how much Mark is posting 
these days. Did he run out of things to develop?

It is exciting to see him participating here.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: about Mark...

2015-05-09 Thread William Prothero
Colin:
I agree! He’s helped me enormously by providing direction for learning new 
things Livecode can do.
Best,
Bill

> On May 9, 2015, at 11:37 AM, Colin Holgate  wrote:
> 
> This is in no way a complaint! But I’m curious about how much Mark is posting 
> these days. Did he run out of things to develop?
> 
> It is exciting to see him participating here.
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

about Mark...

2015-05-09 Thread Colin Holgate
This is in no way a complaint! But I’m curious about how much Mark is posting 
these days. Did he run out of things to develop?

It is exciting to see him participating here.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Where does Mac store provisioning profiles

2015-05-09 Thread William Prothero
Thanks Mark. Got it!
Bill
> On May 9, 2015, at 10:46 AM, Mark Waddingham  wrote:
> 
> On 2015-05-09 18:34, William Prothero wrote:
>> Folks:
>> When I make a provisioning profile using the Mac Developers site, then
>> download it. I double click it to get it incorporated into Xcode.
>> Then, it shows up in the iOS settings. Unfortunately, I generated
>> several of these with the same name and it is getting a bit cluttered.
>> So, how can I delete these? I’ve looked around in the file system and
>> don’t see where they are stored.
> 
> I believe you can manage the iOS provisioning profiles in Xcode itself by 
> deleting the ones you no longer need.
> 
> Alternatively you can just clear out the folder on disk at:
> 
> ~/Library/MobileDevice/Provisioning Profiles
> 
> Although note that these all have UUID names and so aren't particularly 
> readable - it's usually easier to delete them all then just reinstall the 
> ones you need by double-clicking.
> 
> Mark.
> 
> -- 
> Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
> LiveCode: Everyone can create apps
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Converting an image into a vector object

2015-05-09 Thread Richmond

Does anyone know of a way to:

1. Trace an image in a stack to get a vector graphic?

I shall be doing that outwith Livecode using Inkscape.

2. Has the Kickstarter goal of importing vector graphics been arrived at 
yet?


I shall use Alejandro Tejada's EPS importer: 
http://andregarzia.on-rev.com/alejandro/stacks/


2.1. And if so, how come I missed that?

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Mark Waddingham
My sequence is that the client connects to the server, and then sends 
it

periodic messages.  On the initial connection, the server creates a
database connection and leaves it open (opening a database takes time
measured in hundreds of milliseconds).   The approach of opening and
closing a database on each transaction simply isn't a realistic option 
for

me.


All the socket commands can be used in a non-blocking, message-based 
way.


When you 'accept connections' you create a listening socket whose 
purpose is to wait for connections and then supply you with a 'normal' 
socket to talk to the client which connected. The listening socket will 
continue to persist after this (until you close it) continuing to wait 
for new connections from clients.


So an outline of an example (which assumes on receiving data from the 
client you need to send it something):

  on startServer
accept connections ... with message "newClient"
  end startServer

  on newClient pClientSocket
read from pClientSocket ... with message "clientDataReceived"
  end newClient

  on clientDataReceived pClientSocket, pData
... process pData ...
write ... to socket pClientSocket with pData with message 
"clientDataSent"

  end clientDataReceived

  on clientDataSent pClientSocket
read from pClientSocket ... with message "clientDataReceived"
  end clientDataSent

The idea here is that each time you get a 'newClient' message you have a 
newly named socket 'pClientSocket' which is the other end of the 
connection the client initiated. You can have as many of these 
client-connected sockets as you like, and independently read / write to 
them with messages sent when the action you request completes.


If you use the blocking form of the socket commands then (as they don't 
dispatch messages whilst blocking) you can basically only talk to one 
client at a time. The blocking form may well be fine for a client, if it 
is connecting to a server, interacting with some sort of linear protocol 
and then closing the connection; but for a server that wishes to handle 
multiple clients simultaneously it is a much better idea to use the 
messaging form.


Hope this helps,

Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Where does Mac store provisioning profiles

2015-05-09 Thread Mark Waddingham

On 2015-05-09 18:34, William Prothero wrote:

Folks:
When I make a provisioning profile using the Mac Developers site, then
download it. I double click it to get it incorporated into Xcode.
Then, it shows up in the iOS settings. Unfortunately, I generated
several of these with the same name and it is getting a bit cluttered.
So, how can I delete these? I’ve looked around in the file system and
don’t see where they are stored.


I believe you can manage the iOS provisioning profiles in Xcode itself 
by deleting the ones you no longer need.


Alternatively you can just clear out the folder on disk at:

~/Library/MobileDevice/Provisioning Profiles

Although note that these all have UUID names and so aren't particularly 
readable - it's usually easier to delete them all then just reinstall 
the ones you need by double-clicking.


Mark.

--
Mark Waddingham ~ m...@livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Dr. Hawkins
One other possibility I've contemplated: the socket routine never closes
until the socket does.  So on the initial socket, something like

on newClient sckt
repeat while socket is among the lines of the openSockets
read from socket sckt
if it is not empty then
doSomething it
end if
wait 2 seconds with messages
end repeat
end newClient

But this is still a polling approached; I'd really like a message generated
when something is written to an existing socket.
-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: polling only on socket, or can there be a trigger?

2015-05-09 Thread Dr. Hawkins
On Fri, May 8, 2015 at 9:37 PM, Phil Davis  wrote:

>
> There are two basic approaches you can take, which you probably know but
> I'll lay them out for clarity. And maybe you're already doing one of them -
> from what you've told us, I couldn't tell.
>
>
What I have working is similar to the second one, but it doesn't solve my
problem.

I need a server sitting there, accepting connections from numerous
machines, which keeps the socket open indefinitely after the initial
connection.  Everything I can find is basically "one-shot" or blocking.

My sequence is that the client connects to the server, and then sends it
periodic messages.  On the initial connection, the server creates a
database connection and leaves it open (opening a database takes time
measured in hundreds of milliseconds).   The approach of opening and
closing a database on each transaction simply isn't a realistic option for
me.

My application has an in-memory sqlite database, and watches for user
inactivity to synchronize.  If I can get this working, it would let the
synchronizations become asynchronous (client writes and moves on, and later
gets a message of a write back and handles it).

At the moment, though, this only seems to be possible if I keep polling by
a loop that reads, and acts if the read isn't empty.  I certainly *could*
have this work with round robin polling of all connected clients, but I
think this is going to chew processor cycles, which will cause grief on a
shared server initially, and require extra servers in the long run.

Although I strongly prefer postgres for a number of security and liability
reasons, livecode hasn't seen fit to write the couple of lines of code to
allow connection to a secure ssl socket for postgres, restricting it to
mysql.  That means that to use postgres, I need to either run over a vpn,
or encrypt the data and have an application running at the other end.

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Automated Drawing

2015-05-09 Thread Richmond

On 09/05/15 16:52, Richmond wrote:

On 21/03/15 18:17, Jim Hurley wrote:

Richmond,

I wrote this Turtle Graphics library in the dark ages of RR, before 
“sum” became a reserved word.


So, comment out the “sum” handler in the stack script.

Jim



Having copied your stack script across into my stack I am stuck with 2 
problems:


1. How to make the line to show as 'pd' [penDown] doesn't seem to work.

2. How to exchange your graphic "turtleGraphic" for an img.

In all other respects the thing is super!

Richmond.


Actually my "big" problem at the moment is, with this script:

on right dangl
  rt dangl
end right

on rt dangl
  subtract dangl from angl
  drawTurtle
end rt

on drawTurtle
  myWait waitTime
  if noDraw then exit drawturtle
  put 5 into distance
  put round(x0 +x)&comma& round(-y+y0) & return into gPoints
  put distance * cos(radPerDeg * angl) into dx
  put dx into fld "dx"
  put distance * sin(radPerDeg * angl) into dy
  put dy into fld "dy"
  put round(x+x0+dx)&comma&round(-y+y0-dy) after gPoints
  set points of graphic "turtleGraphic" to gPoints
  set the angle of img "turt" to ((the angle of img "turt") - angl)
end drawTurtle

with the graphic "turtleGraphic" and the img "turt" initially pointing 
in the same direction,
why they don't go on pointing in the same direction everytime I send 
"right 45" via the message box?


Richmond.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: [ANN] mergAV 4, mergBanner 2 & iOS 8.3 builds

2015-05-09 Thread Mike Kerner
Did I mention that the barcode scanning is FAST in the new AV?  HOLY CRAP
is it fast.  It is mucho fasto.  I would be hard pressed to scan as fast
with a CCD or laser gun.  It really is screaming fast.  If I lay a bunch of
codes to be scanned next to each other, I am done in a flash with it,
including decoding them to determine if the user is trying to pull a fast
one with one of the scans.  Monte also put in a redLaser-esque trace line
so you can see which one it's reading, and if it is reading it, which is a
great way to let the user know that the focus, angle, etc. are good.  When
I'm oversampling, I am done in no time.

On Thu, May 7, 2015 at 8:56 PM, Skip Kimpel  wrote:

> No problem at all Monte... heck, you are amazing at what you do.  The
> public facing documents are obviously not as high priority.
>
> Look forward to exploring the new capabilities!
>
> SKIP
>
> > On May 7, 2015, at 8:29 PM, Monte Goulding 
> wrote:
> >
> > Sorry Skip, I’ve updated the online docs now.
> >
> >> On 8 May 2015, at 2:42 am, Magicgate Software - Skip Kimpel <
> s...@magicgate.com> wrote:
> >>
> >> I am looking at the online documentation for mergAV but do not see any
> >> reference to the bar coding capabilities?!?
> >>
> >> I am very interested in playing around with this as ZXing worked will
> but
> >> had a few caveats around it.
> >>
> >> SKIP
> >>
> >> On Thu, May 7, 2015 at 8:30 AM, Mike Kerner 
> >> wrote:
> >>
> >>> FYI, barcoding works MUCH better than it did in ZXing.  It's a little
> more
> >>> complicated to set up, and your users have to grant microphone
> priviliges
> >>> in order for it to work (in order to address a crash issue), but it is
> >>> faster, more accurate, and I have been able to implement oversampling
> and
> >>> symbology restrictions, so THANKS, MONTE!
> >>>
> >>> On Thu, May 7, 2015 at 2:12 AM, Monte Goulding <
> >>> mo...@sweattechnologies.com>
> >>> wrote:
> >>>
>  Hi LiveCoders
> 
>  Today I have released builds of all my externals for iOS 8.3 so they
> are
>  now compatible with LiveCode 7.0.5 and Xcode 6.3.1
> 
>  In addition I have also released major updates to mergAV and
> mergBanner.
> 
>  mergAV 4 now includes barcode reading in the camera control.
> 
>  mergBanner 2 now includes interstitial ads
> 
>  Find out more at http://mergext .com
> 
>  Cheers
> 
>  Monte
> 
>  --
>  M E R Goulding 
>  Software development services
>  Bespoke application development for vertical markets
> 
>  mergExt  - There's an external for that!
> 
>  ___
>  use-livecode mailing list
>  use-livecode@lists.runrev.com
>  Please visit this url to subscribe, unsubscribe and manage your
>  subscription preferences:
>  http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> >>>
> >>>
> >>>
> >>> --
> >>> On the first day, God created the heavens and the Earth
> >>> On the second day, God created the oceans.
> >>> On the third day, God put the animals on hold for a few hours,
> >>>  and did a little diving.
> >>> And God said, "This is good."
> >>> ___
> >>> use-livecode mailing list
> >>> use-livecode@lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >>> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> > --
> > M E R Goulding 
> > Software development services
> > Bespoke application development for vertical markets
> >
> > mergExt  - There's an external for that!
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/l

Where does Mac store provisioning profiles

2015-05-09 Thread William Prothero
Folks:
When I make a provisioning profile using the Mac Developers site, then download 
it. I double click it to get it incorporated into Xcode. Then, it shows up in 
the iOS settings. Unfortunately, I generated several of these with the same 
name and it is getting a bit cluttered. So, how can I delete these? I’ve looked 
around in the file system and don’t see where they are stored.

Anybody know how to delete these older provisioning files? When I search on th
Best,
Bill

William A. Prothero
http://es.earthednet.org/

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Editing a cell in a DataGrid

2015-05-09 Thread André Bisseret

> Le 9 mai 2015 à 16:08, Terence Heaford  a écrit :
> 
> I have enabled the editing of a particular column in a table.
> 
> I want to detect when editing of the cell has completed, obtain the line data 
> and then update an SQLite database.
> 
> Is there a message that I can intercept that will advise me when cell editing 
> is complete and perhaps give the line/row in question?
> 
> 
> All the best
> 
> Terry
> 

Bonjour Terry,

on closeFieldEditor
you could 
put the dgHilitedLines of group  «suchDG ino tLine
put the dgDataOfLine[tLine] of group  «suchDG" into tLineData
so can get tLineDataBque[«columName"]

Not sure that’s the best way, but seems that should do what your want 

HTH

best regards

André
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: memory munching group

2015-05-09 Thread J. Landman Gay
On May 9, 2015 7:38:06 AM CDT, David V Glasgow  wrote:
>
>It doesn’t seem to matter whether the same custom property has been
>displayed before.  I can just move back and forth between two buttons
>and get a steady (albeit variable) increment, so I don’t think it is a
>caching thing.  But why don’t I get the same thing on the test stack?

How about the layermode of the field? If it's not static it will be cached. 
-- 
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Editing a cell in a DataGrid

2015-05-09 Thread Terence Heaford
I have enabled the editing of a particular column in a table.

I want to detect when editing of the cell has completed, obtain the line data 
and then update an SQLite database.

Is there a message that I can intercept that will advise me when cell editing 
is complete and perhaps give the line/row in question?


All the best

Terry



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Automated Drawing

2015-05-09 Thread Richmond

On 21/03/15 18:17, Jim Hurley wrote:

Richmond,

I wrote this Turtle Graphics library in the dark ages of RR, before “sum” 
became a reserved word.

So, comment out the “sum” handler in the stack script.

Jim



Having copied your stack script across into my stack I am stuck with 2 
problems:


1. How to make the line to show as 'pd' [penDown] doesn't seem to work.

2. How to exchange your graphic "turtleGraphic" for an img.

In all other respects the thing is super!

Richmond.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: memory munching group

2015-05-09 Thread David V Glasgow

> On 8 May 2015, at 6:31 pm, J. Landman Gay  wrote:
> 
> Does it still happen if you remove the visual effect?
> 
> 

Thanks for the suggestion Jacqueline.  Yes it does.  

However, if I comment out the whole show line, the problem disappears.  It 
seems it is specifically related to that.  

It doesn’t seem to matter whether the same custom property has been displayed 
before.  I can just move back and forth between two buttons and get a steady 
(albeit variable) increment, so I don’t think it is a caching thing.  But why 
don’t I get the same thing on the test stack?

Best wishes,

David G
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode