Object Referencing in LC 9.0.0

2018-05-26 Thread Michael Doub via use-livecode

Can someone using 9.0.0 help me out?

This used to work in LC 7 but now generates an error on the second line 
(*put*thelongidofobjRef intot1).  What is the new correct syntax?   This 
popped up in the MasterLibrary.


-= Thanks
  Mike


*on*seSetObjectState objRef, objState*
   put*thelongidofobjRef intot1 *
   put*thelongidofbtn"Lib"ofcd"LibMgr"ofstack"MasterLibrary"intot2*
   if* t1 = t2 andobjState = "applied"*then**
       send*"updateMasterIndex"tocd"LibMgr"ofstack"MasterLibrary"in1ticks*
   end* *if**
   pass*seSetObjectState*
end*seSetObjectState

___
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: is a date

2017-10-14 Thread Michael Doub via use-livecode

What about this from the Master Library from Ken Ray?

function isDate pWhat
   /* isDate Date
   Syntax:
   isDate (pWhat)
   Examples:
   isDate("10/10/2001")
   Description:
   Determines if the container passed to it in  contains a valid 
date.


   Returns true or false.

   Source:
   Ken Ray, sdtlib 1.0b
   isDate */
   convert pWhat to short date
   return not(the result is "invalid date")
end isDate


On 10/14/17 3:52 PM, J. Landman Gay via use-livecode wrote:

On 10/14/17 2:14 PM, Yves COPPE via use-livecode wrote:

Try this

function CheckDate pDateToCheck

return 
matchText(pDateToCheck,"([1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9][0-9][0-9])")


end CheckDate


Promising, but fails with dates like "1/1/19".




___
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: Color Conversion - RGB to HSV and back... (almost)

2017-04-14 Thread Michael Doub via use-livecode
Al,  I wrote some color conversion routines a long time ago. They are in 
the MasterLibrary:


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

I cant comment on their ability to not loose precision on a round trip.

-= Mike


On 4/13/17 6:14 PM, Alejandro Tejada via use-livecode wrote:

Hi All,

Download this GUI Stack for Scott Raney's Color Conversion Functions:
RGB to HSV and HSV to RGB from this forum post:
http://forums.livecode.com/viewtopic.php?f=10&t=29127

Only for certain colors this is a lossy conversion: Once you convert some
RGB colors to HSV, the function HSVtoRGB does not convert them back
exactly as they were before.

Does anyone knows or have created a pair of RGB/HSV color conversion
functions that do not lose (or change) color information?

Thanks in advance!

Al
___
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: Problem with converting time

2017-03-17 Thread Michael Doub via use-livecode
Sorry Mark and Richard.   Here is the real code snipit that includes a 
hack that seems to work:


getaData[x]["time"]
if not(theenvironmentisamongtheitems"development,standalone 
application") then

subtract(4*60*60) fromit
end if
convertit todateitems

Mark, in your situation, you and the server are in the same timezone so 
I would not expect to see a problem.   I have no idea where my server 
is, but it must not be in my timezone.  I am guessing on the west coast 
since taking off 4 hours seems to fix the problem.


It still does not make any sense why a timezone comes into play at all.

Here is the silly little app:   Http://tarwheels.net/weather   It has 
been really cold  here the last few days and I was not able to cycle, so 
this was a fun diversion.  Seems to work, but it has not had much 
testing.  And as you can see I know next to nothing about making things 
look nice in html.


-= Mike


On 3/17/17 4:42 PM, Mark Wieder via use-livecode wrote:

On 03/17/2017 01:20 PM, Michael Doub via use-livecode wrote:

Sorry guys, I must not have been clear in my statement of the problem.
Here is the code:

put 1489755600 into tVar
convert tVar into dateitems
 -- on the mac tVar contains 2017,3,17,9,0,0,6
 -- on the server tVar contains 2017,3,17,12,0,0,6

The local time should not be involved since you are converting a fixed
value.  What is happening?


Sorry - I can't replicate that.
With the desktop and server engines running on the same machine,

put 1489755600 into tVar
convert tVar into dateitems

gives me
IDE message box: 2017,3,17,6,0,0,6
server:  2017,3,17,6,0,0,6

Note that "convert into" is not supported.
It might be better to post the code you're actually using.



___
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: Problem with converting time

2017-03-17 Thread Michael Doub via use-livecode
Sorry guys, I must not have been clear in my statement of the problem.  
Here is the code:


put 1489755600 into tVar
convert tVar into dateitems
 -- on the mac tVar contains 2017,3,17,9,0,0,6
 -- on the server tVar contains 2017,3,17,12,0,0,6

The local time should not be involved since you are converting a fixed 
value.  What is happening?


-= Mike


On 3/17/17 12:44 PM, Richard Gaskin via use-livecode wrote:

Michael Doub wrote:

> time = 1489755600
> Mac:  dateitems = 2017,3,17,9,0,0,6
> server:   dateitems = 2017,3,17,12,0,0,6
>
> Code:   get time
> convertit to dateitems
>
> Richard here is another example:
> time = 1489752000
> mac:dateitems = 2017,3,17,8,0,0,6
> server: dateitems = 2017,3,17,12,0,0,6
>
> I just wanted to double check that I was showing you good comparison
> since I am copying from multiple windows of debug output.
>
> I don't understand how the local time comes into play when converting
> a constant number of seconds.  The resulting date should be a
> constant as well.
>
> What am I missing?

The beauty of "the seconds" is that the value you get is in GMT, 
regardless of where the machine is at the moment that value of 
obtained.  It does the offset according to the locale settings on the 
local machine.


"The seconds" and "the internet date" are the only two forms that take 
local time zone settings into account.


The benefit with this approach is that either can be used in 
applications where usage may span time zones but you need to maintain 
time stamps that will work across any time zones.



For example, suppose I'm in Los Angeles and I share a server app with 
one user in New York, another in Brisbane, and another in Edinburgh.


GMT offsets for each are:

Edinburgh: 0
New York: -4h
Los Angeles: -7h
Brisbane: +10h (they're across the International Dateline)

The "internet date" format reflects this explicitly, noting the GMT 
offset at the end of the string it returns:


  Fri, 17 Mar 2017 09:09:03 -0700

But "the seconds" of course is just an integer, so while the GMT 
offset has also been accounted for it's less evident.


If all four of us get "the seconds" at the same moment, the value we 
get will be the same, in GMT time.


But since only one of us is actually in the GMT time zone, how does it 
know?  That's where the local system settings come into play.


When *obtaining* either "the seconds" or "the internet date", local 
time zone is used to create a value that can be understood globally.


When *converting* either "the seconds" or "the internet date", LC uses 
time conversion routines dependent on the system locale settings of 
the machine where the conversion is taking place.


With "the internet date" the time zone is explicitly included, so it 
adjusts from that GMT offset to bring it into alignment with the GMT 
offset in the local OS.


With "the seconds", the value is already adjusted to be GMT, so 
conversion adjusts it again for the local settings to deliver an 
accurate representation of that moment in local time.



In the example above, all four users would get the same value from 
querying "the seconds" at the same moment, no matter where they are in 
the world.


And when my software needs to display the date and/or time in 
human-readable form, the "convert" command takes local settings into 
account to deliver an accurate representation that makes sense in 
local time.


So if I modify a record right now, in my system it'll show March 17 at 
9:18 AM.  But when my Brisbane use sees the modification date that 
I've stored using "the seconds", he'll see March 18 at 2:18 AM, which 
is the same global moment.



In short:

The key to getting accurate reflections of time is to store either 
"the seconds" or "the internet date" on the server (or really, 
anywhere timestamps may be shared across time zones), and then do any 
conversions needed for human readability locally.


If you do a conversion from either of those two formats on the server 
to any other format, the result will be correct for the server's 
locale, but unless you're nearby probably not correct for you.



Quick Exercise:

It took me a while (and some experimentation) to appreciate that "the 
seconds" reflects GMT just as "the internet date" does, something I 
learned from Sarah Reichelt back in the day.


One quick way to verify this is to check while changing your local 
machine's Date and Time settings:


Set to Los Angeles: 1489768020
5 seconds later,
Set to Montreal:1489768025
10 seconds after that,
Set to London:  1489768035

Except for the few seconds it took me to click on my Locale map in my 
Control Panel, the numbers are effectively all the same.


Once

Re: Problem with converting time

2017-03-17 Thread Michael Doub via use-livecode

Richard here is another example:

time = 1489752000

mac: dateitems = 2017,3,17,8,0,0,6

server: dateitems = 2017,3,17,12,0,0,6

I just wanted to double check that I was showing you good comparison 
since I am copying from multiple windows of debug output.


-= Mike

On 3/17/17 8:46 AM, Michael Doub wrote:


time = 1489755600

Mac:  dateitems = 2017,3,17,9,0,0,6
server:   dateitems = 2017,3,17,12,0,0,6

Code:   get time
convertit to dateitems

I don't understand how the local time comes into play when converting 
a constant number of seconds.  The resulting date should be a constant 
as well.


What am I missing?

-= Mike


On 3/16/17 4:05 PM, Richard Gaskin via use-livecode wrote:

Michael Doub wrote:

> I am getting different answers based on environment when trying to
> convert EPOC seconds to dateitems or internet date.   On my mac I get
> the expected result but on a HostM server I get something totally
> different.

How different?

> Does any one have a conversion function that does not use the
> livecode's convert function that they would be willing to share?

The seconds are usually a very good choice for their compactness and 
ease of calculation, and more so because the value we get is in GMT 
based on the offset from host OS.


What this should mean is that you can convert values obtained from 
"the seconds" and get a good date/time regardless of which time zone 
you're in.


So seconds are usually ideal (along with "internet date") for network 
applications such as the one you're working on.


But for the conversion to take your local system into account, you'll 
need to do the conversion locally.


If you're doing the conversion on the server, the date/time will 
reflect the time zone settings in the server OS.






___
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: Problem with converting time

2017-03-17 Thread Michael Doub via use-livecode

time = 1489755600

Mac:  dateitems = 2017,3,17,9,0,0,6
server:   dateitems = 2017,3,17,12,0,0,6

Code:   get time
convertit to dateitems

I don't understand how the local time comes into play when converting a 
constant number of seconds.  The resulting date should be a constant as 
well.


What am I missing?

-= Mike


On 3/16/17 4:05 PM, Richard Gaskin via use-livecode wrote:

Michael Doub wrote:

> I am getting different answers based on environment when trying to
> convert EPOC seconds to dateitems or internet date.   On my mac I get
> the expected result but on a HostM server I get something totally
> different.

How different?

> Does any one have a conversion function that does not use the
> livecode's convert function that they would be willing to share?

The seconds are usually a very good choice for their compactness and 
ease of calculation, and more so because the value we get is in GMT 
based on the offset from host OS.


What this should mean is that you can convert values obtained from 
"the seconds" and get a good date/time regardless of which time zone 
you're in.


So seconds are usually ideal (along with "internet date") for network 
applications such as the one you're working on.


But for the conversion to take your local system into account, you'll 
need to do the conversion locally.


If you're doing the conversion on the server, the date/time will 
reflect the time zone settings in the server OS.




___
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


Problem with converting time

2017-03-16 Thread Michael Doub via use-livecode
I am getting different answers based on environment when trying to 
convert EPOC seconds to dateitems or internet date.   On my mac I get 
the expected result but on a HostM server I get something totally different.


Does any one have a conversion function that does not use the livecode's 
convert function that they would be willing to share?


Regards,

Mike



___
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: libURL gone mad

2016-09-15 Thread Michael Doub

Matthias,

I am getting a error when attempting the download.

-= Mike



On 9/15/16 2:32 PM, Matthias Rebbe wrote:

Hi all.

I´ve extended that stack with some examples for uploading with FTP, SFTP, FTPS 
implicit and FTPS explicit using the command tsNetUploadSync.

https://dl.dropbox.com/s/q4oec8uu3pcdgfj/index.html 


I´ve kept he previous dropbox url. Therefore the name of the stack is still 
lcmail.livecode. But it definitely contains the ftp stuff. ;)

Matthias




Am 14.09.2016 um 20:51 schrieb Matthias Rebbe 
:

Neil was so kind to sent me that stack a 2 days ago, because i was in urgent 
need of an useful example script for sending emails with tsNet external.

I´ve added a function to that button script. The function builds the complete 
smtp message with all needed smtp headers and it deals with the little problem 
i mentioned in an email to Neil earlier today regarding using the base64Encode 
function for encoding the subject line in the smtp header.

I´ve uploaded it here
https://dl.dropbox.com/s/q4oec8uu3pcdgfj/index.html

Btw.: an easy and very useful tool for Mac OS X to test smtp with your scripts 
is MockSMTP
http://www.mocksmtpapp.com


@Neil
Thanks again for putting that stack together. It helped me a lot.
Maybe you want to replace your stack with mine.

Regards,

Matthias


Am 14.09.2016 um 19:49 schrieb Neil Roger :


Hi Roger,

pSettings is an array. More information on what elements apply to that array 
can be found in the dictionary entry for tsNetSmtpSync

I created a stack for the promo 8.1 promo video which should help with using 
the new tsNetSmtpSync function. This can be downloaded from here

http://techsupport.on-rev.com/LCMail.zip 


All scripts are in the button "send mail"

Things are a little more complex in my example as I am dealing with sending 
unicode chars but it should give you somewhere to start.

Cheers,

Neil




LiveCode Technical Support and Content Creation Lead
n...@livecode.com 

LiveCode
+44 (0) 845 219 8923.
25A Thistle Street Lane South West, Edinburgh, EH2 1EW
http://www.livecode.com

Facebook  Twitter 
 Youtube  Linkedin 



On 14/09/2016 17:41, Roger Eller wrote:

On Wed, Sep 14, 2016 at 11:14 AM, Peter TB Brett 
wrote:


On 14/09/2016 16:12, Richard Gaskin wrote:


Peter TB Brett wrote:

On 14/09/2016 15:50, Richard Gaskin wrote:

A couple weeks ago I wrote:


...
Does anyone here know where I can find a breakdown of which

new networking features are available in which LC 8.1 editions
(Community, Indy, Business)?


https://livecode.com/products/livecode-platform/livecode-net

working-layer/

Perfect - thanks!


The short answer is that since tsNet isn't included in the open source
edition of LiveCode there are no new networking features in the open source
edition of LiveCode 8.1.

Peter

--
Dr Peter Brett 
LiveCode Technical Project Manager


Since SMTP is new to LC, other than some home-made libraries, can you
provide a working example?  The general syntax is in the docs, but no
examples.  And there's the mysterious parameter pSettings.  What is the
format and content of pSettings?

~Roger
___
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: Progress on WP REST API

2016-07-07 Thread Michael Doub

Todd,

I think a good example app would be a simple membership management 
application that collects dues.  This would allow you to demonstrate how 
a user could create an account, collect and edit personal contact 
information (address, phone, email...) and pay their membership dues 
online.  You could also show how to do password recovery.   You could 
have a admin side that would show membership management and the admin 
side of the payment system.


I can see this being used a foundation for a lot of different online 
applications.  It seems like most systems have the notion of user 
accounts, password recovery,  payments,  and even though we don't see 
it, they all have an admin side.


Regards,

Mike




On 7/7/16 1:22 AM, Todd Fabacher wrote:

Here are two plugins that will allow WP to become a customizable DB server
with little to no DB experience. Perfect for LC students and people who
want to get a DB setup online, but don't have the experience or know-how.

https://wordpress.org/plugins/advanced-custom-fields/
https://wordpress.org/plugins/acf-to-rest-api/


but also, I have found many Custom Post Type Plugins:

https://wordpress.org/plugins/custom-post-type-ui/
https://wordpress.org/plugins/types/
https://wordpress.org/plugins/pods/
https://wordpress.org/plugins/custom-post-type-maker/

We can look to adding this to the LiveCode WP Rest API library. I get
emails and I see some post of people asking how to setup a customized web
data server. These would do the trick. Plus most are open source and FREE,
but a few have a more feature rich commercial version.


We would like to focus on creating a sample App in LiveCode that utilized
WooCommerce. I think it is important to have several different example Apps
before we start to pitch to the WP community at large...any ideas

Any other questions [please let me know. I have had about 2 dozen people
email with questions and express interest in integrating WP with LiveCode.

--Todd
___
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: Raspberry Pi GPIO

2016-06-10 Thread Michael Doub
I think you have to poll.   This would be another feature that might go 
on the list to be done with LCB.


-= Mike


On 6/10/16 1:26 PM, Richard Gaskin wrote:

Earlier I wrote:

> What is "the file method"?  How do I treat GPIO connections as file
> paths?  Somewhere in /proc?
>
> Earlier you wrote:
>
> Look at the comments in the library it self for how to solve
> the Accessing the GPIO (of a raspberry pi) without "sudo" problem.
>
> The stack script isn't very big, and perhaps I'm just pre-coffee but I
> couldn't find anything there about sudo.
>
> Where should I be looking?

Coffee helped.  I was looking in "the stack itself", and then for a 
"Hardware" section, overlooking the "Raspberry Pi" section right there 
in front of me once I thought to scroll down to look for it. :)


It seems the "files" method is using a mounted virtual file system, 
similar to /proc or /run/shm, which are actually elements in RAM 
accessible through file-like paths in keeping with the Unix tradition 
of "everything is a file".  This appears to be the common method for 
obtaining GPIO data:



Thanks for maintaining the Master Lib - with what's there I should be 
able to poke around and get what I need.


One last question for now:  is there any mechanism accessible to use 
in LiveCode that allows our app to subscribe to events in 
/sys/class/gpio, or do we need to poll for changes?





___
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: Raspberry Pi GPIO

2016-06-10 Thread Michael Doub

Richard,

You initial gut reaction is STILL correct.   Currently the only solution 
available to livecoders is the file method.  The performance of this 
solution is terrible and limits the types of real world problems that 
can be solved with livecode and raspberry pi.


It would be wonderful if someone could write a library that allowed 
direct access to the actual GPIO driver.  I am hoping someone with 
LiveCode builder skills will solve this problem.  If python can do it, 
so can livecode.


-= Mike


On 6/10/16 11:19 AM, Richard Gaskin wrote:

Michael Doub wrote:

> Richard,  Take a look at the code in the MasterLibrary. Look at the
> comments in the library it self for how to solve the Accessing the
> GPIO (of a raspberry pi) without "sudo" problem.
>
> https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Thanks, Michael.  Downloading now.

I hadn't realized GPIO access was considered a solved problem.  I see 
so many requests for this I had though there must be something else 
needed beyond what LC currently provides.





___
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: Raspberry Pi GPIO

2016-06-10 Thread Michael Doub
Richard,  Take a look at the code in the MasterLibrary.   Look at the 
comments in the library it self for how to solve the Accessing the GPIO 
(of a raspberry pi) without "sudo" problem.


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Regards,

Mike



On 6/9/16 6:38 PM, Richard Gaskin wrote:

What's needed to work with the GPIO on RPi?

I'd like to work with a motion sensor, and would prefer to work with 
LC instead Python if I can.





___
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: Server Help Needed

2016-04-14 Thread Michael Doub

Humm ...  no change when using curl -k


On 4/14/16 10:06 AM, Mike Bonner wrote:

Looks like the certificate setup at the receiving end (ridewithgps) not
sure why it might have changed, but until you get that part tracked down,
you might try using the -k curl option (which allows insecure ssl
connections with some exceptions.. wrong domain certs will still fail)

On Thu, Apr 14, 2016 at 7:44 AM, Michael Doub  wrote:


I need some help in understanding what is going on with my hostm server
relating to security.

I have a script that was working fine for several weeks and now it is no
longer functioning.  Obviously something changed.

put shell (("curl -s" && baseURL & RouteNbr & "/cue_sheet")) into tSource
if tSource is empty then
  return "Err: Route Data is empty" && (baseURL & RouteNbr &
"/cue_sheet") && the result
end if

tSource is empty and the following is being returned:

Err: Route Data is empty https://ridewithgps.com/routes/12969359/cue_sheet
error error setting certificate verify locations: CAfile:
/etc/ssl/certs/ca-certificates.crt CApath: none

Can anyone explain the meaning of what is being returned in the result?
Better yet, how can I fix this.

Thanks,
Mike



___
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


Server Help Needed

2016-04-14 Thread Michael Doub
I need some help in understanding what is going on with my hostm server 
relating to security.


I have a script that was working fine for several weeks and now it is no 
longer functioning.  Obviously something changed.


put shell (("curl -s" && baseURL & RouteNbr & "/cue_sheet")) into tSource
if tSource is empty then
 return "Err: Route Data is empty" && (baseURL & RouteNbr & 
"/cue_sheet") && the result

end if

tSource is empty and the following is being returned:

Err: Route Data is empty 
https://ridewithgps.com/routes/12969359/cue_sheet error error setting 
certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt 
CApath: none


Can anyone explain the meaning of what is being returned in the result?  
Better yet, how can I fix this.


Thanks,
   Mike



___
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: leap to future

2016-02-19 Thread Michael Doub
SFTP might not be the best thing in the world but I have yet to see a 
hosting site that does not support it.   I have been waiting patiently 
for it for too long now.   I am not at all interested in doing server 
side scripting but I would like to have the ability to manage files on 
my server.  SFTP is supported out of the box, FTP is not.


From my perspective this is low hanging fruit that many people would use.

-= Mike



On 2/19/16 3:23 PM, Richard Gaskin wrote:

Sannyasin Brahmanathaswami wrote:

> SFTP was not on the list! That's continues to be such an irritation
> that this is not prioritized.
>
> see bug: bug 6405
> Please, everyone go and vote.

The voting system was retired years ago.  For the sake of keeping 
reports actionable please add only technical details to reports that 
can further the work of implementing them.


I agree that this would be a very valuable addition, and IIRC Kevin's 
said previously that it would be included along with an even higher 
priority for modern work, OAuth2, as part of the network library 
overhaul that was included among the Kickstarter goals.


I believe that library will be written in LC Builder, which is coming 
together as part of v8.0, in development now.


Exactly how soon after that the team will be in a position to work on 
the new networking library is something only the team can comment on, 
but the foundation needed for it is being worked on right now.



> Please, Please PLEEZE! Prioritize this request. it is much more
> important that your realize.  95% of all apps today must communicate
> with the web. This means the teacher, the enterprise, the business,
> the developer etc. must be transferring files to the web server.

As useful as SFTP is for many things, it may not be the best choice 
for all of the use cases outlined there.


FTP/SFTP gives unbridled access to the entire server, at least as far 
as the account can get to.  If uploading content to a web server, this 
means all publicly accessible files on that server as well as private 
configuration files. Unless used with great care, it's very easy to 
move, modify, or even delete files on a server, perhaps 
unintentionally and with unpredictable results.


For this reason most web sites that need content contributions from 
distributed stakeholders create HTTP-based APIs for that. This allows 
much more control over what can be sent and how it's handled, and as 
such is much more secure.  Extra bonus points that HTTP/HTTPS is often 
more more efficient than FTP/SFTP.


Using LiveCode Server right now we can craft an upload receiver script 
in minutes - the sample code has already been delivered with a tutorial:
 



Some stakeholders may indeed need complete access to the server, but 
for the most part those are developers, or at a minimum trusted team 
members with reasonable technical skills.  Developers will probably 
already have shared SSH keys in place so they can enjoy the greater 
efficiency of rsync for file transfers, and once there's a shared SSH 
key in place rsync, scp, and other file transfer tools can be used in 
automated solutions built with LiveCode today using the shell function.


Once we get past the larger use case of folks with limited skills for 
which the control of an HTTP-based API is a good fit, and developers 
who probably already have a shared SSH key on the server, the 
remainder does indeed represent a good case for which SFTP would be 
very useful.  But it is, in all fairness, a subset getting ever 
smaller as more orgs develop APIs to automate content transfer.





___
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: Replacing Stacks in Memory

2016-02-16 Thread Michael Doub
ok, got it working.   Thanks for everyone's help.   Here is what I have 
done,


The launcher has a datagrid AppPicker contains the links to the files 
available to launch.


on mousedoubleup
   set the itemdel to tab
   put the dgHilitedLines of grp "AppPicker" into tLine
   put the dgDataOfLine[tLine] of grp "AppPicker" into tData
   put tData["theLink"] & "#" & the milliseconds into tURL -- this will 
force a reload is the same link is used
   if laststack is among the lines of the openstacks then -- if there 
is a stack in memory, delete it

  delete stack laststack
  put empty into laststack
   end if
   put the openstacks into stacklist  -- remember what was open before 
the call

   go URL tURL
   get the openstacks  -- figure out what is new, this must be the name 
of the new stack

   repeat for each line x in it
  if x is not among the lines of stacklist then
 put x into laststack
 exit repeat
  end if
   end repeat
end mousedoubleup



On 2/16/16 1:54 PM, Mark Waddingham wrote:

On 2016-02-16 19:11, Michael Doub wrote:

I am building a launcher app the loads stacks from DropBox.
I am using

go URL tURL where the tURL is the stack to load using the correct
DropBox format.

This works great for the first load.  However, if I update the stack
in DropBox and try to reload tURL, it does not purge the existing
stack and load the new one.


Okay so when you do 'go url tURL' what is actually happening is you 
are doing:


  go ()

If  evaluates to binary data which looks like a stackfile (after 
the engine's tried viewing it as a name of stack, and failed) it will 
try and load that binary data into memory as a stackfile. If there is 
already a stackfile in memory with that name, then the normal engine 
processes will kick-in and (most likely, as the stack doesn't have a 
filename) cause the existing stack which is in memory to be preserved, 
and the new one ditched.


Now, a stack loaded with the above form will not have a filename, so 
'revert' won't work. Instead, you'll probably need to do:


  delete stack 
  go url ...

Hope this helps!

Mark.




___
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: Replacing Stacks in Memory

2016-02-16 Thread Michael Doub
Thanks Scott, but no luck.   This might work if I was using the same 
url.   In my case I have two urls that point to separate files. file1 is 
rev 1 of the stack, file1 is rev 2 of the stack.   The stack inside each 
file has the same name, but different code.


load file1   you see version 1 of the stack
load file2   your still see version 1 of the stack

I thought about trying to see if the stack was in memory, but I am not 
sure to find out the name of the stack when I only have the filename.


-= Mike

On 2/16/16 1:27 PM, Scott Rossi wrote:

Try this, posted by Mike Bonner a while back:

"Like the timestamp, you can just tack on a # and the milliseconds to each
request.  http://whatever.url.com/mystack.livecode#134513461";

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 2/16/16, 10:11 AM, "use-livecode on behalf of Michael Doub"

wrote:


I am building a launcher app the loads stacks from DropBox.
I am using

go URL tURL where the tURL is the stack to load using the correct
DropBox format.

This works great for the first load.  However, if I update the stack in
DropBox and try to reload tURL, it does not purge the existing stack and
load the new one.

Is there a way to force a reload?

Regards,
Mike


___
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


Replacing Stacks in Memory

2016-02-16 Thread Michael Doub

I am building a launcher app the loads stacks from DropBox.
I am using

go URL tURL where the tURL is the stack to load using the correct 
DropBox format.


This works great for the first load.  However, if I update the stack in 
DropBox and try to reload tURL, it does not purge the existing stack and 
load the new one.


Is there a way to force a reload?

Regards,
   Mike


___
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


Cue sheet generator and livecode server

2016-02-14 Thread Michael Doub
Hello all.   For all of you cyclists out there that use RideWithGPS i 
have written a simple app that creates nicely formatted cue sheets.   
Help yourselves.  It can print directly, make a PDF or save a CSV file.


https://www.dropbox.com/s/13jc0tgynilonpt/ridewithgps_cuesheets.livecode?dl=0

But the real reason for my post is to ask some questions about livecode 
server.   I was thinking about how I might adapt this app to work from a 
web page.In my app, I have two substacks that are used to format the 
output of the PDF.   Am I correct to assume that I can have a livecode 
server script load a normal stack that includes substacks and produce a 
pdf file?


If this is doable, I have a web question.   How do you manage the pdf 
files?   Presumably each has a unique name that is passed to the browser 
so it can be downloaded, but how do you manage the cleanup so the pdfs 
are deleted?


This is first attempt at doing any on the web, so any coaching or best 
practice advice would be appreciated.


Regards,
  Mike


___
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: formattedtext and formattedrect in a substack

2016-02-11 Thread Michael Doub

I think I found the answer to my question set the defaultstack

put the short name of this stack into temp
go invisible stack "B"
set the defaultstack to temp
put "Hello world" into fld 1 of cd 1 of stack "B"  -- works as expected
put the formattedrect of line 1 of fld 1 of cd 1  of stack "B" & cr 
after msg

answer the hilite of btn 1

This seems to work.   Is it the correct solution to this problem?

-= Mike



On 2/11/16 4:04 PM, Michael Doub wrote:
I recently discovered an interesting bug: 
http://quality.livecode.com/show_bug.cgi?id=16881


formattedrec and formattedtext do not work properly it their target is 
in a stack that has not been opened.
So if you have a main stack A with a checkbox on the cd 1 and stack B 
is a substack of stack A with fld 1 on its first card. Execute the 
following code in the stack script of stack A:


open a fresh copy of livecode, and open stack A
execute the following:
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 0,0,0,0 <==

answer the hilite of btn 1

As long a stack B has not been opened you will get bad results.

Now open substack B and close it.
execute the following again...
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - 
returns 58,42,114,56

answer the hilite of btn 1

So now open a fresh copy and livecode and open stack A
now execute the followng:

go invisible to stack "B"
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 58,42,114,56
answer the hilite of btn 1 < gets a runtime error here because 
there is no bnt 1 on cd 1 of stack "B"


So, how do you get the context set back to stack A?

Regards,
  Mike





___
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


formattedtext and formattedrect in a substack

2016-02-11 Thread Michael Doub
I recently discovered an interesting bug: 
http://quality.livecode.com/show_bug.cgi?id=16881


formattedrec and formattedtext do not work properly it their target is 
in a stack that has not been opened.
So if you have a main stack A with a checkbox on the cd 1 and stack B is 
a substack of stack A with fld 1 on its first card.  Execute the 
following code in the stack script of stack A:


open a fresh copy of livecode, and open stack A
execute the following:
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 0,0,0,0 <==

answer the hilite of btn 1

As long a stack B has not been opened you will get bad results.

Now open substack B and close it.
execute the following again...
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - returns 
58,42,114,56

answer the hilite of btn 1

So now open a fresh copy and livecode and open stack A
now execute the followng:

go invisible to stack "B"
put "Hello world" into fld 1 of cd 1 of stack "B"  - works as expected
get the formattedrect of line 1 of fld 1 of cd 1 of stack "B" - fails 
and returns 58,42,114,56
answer the hilite of btn 1 < gets a runtime error here because there 
is no bnt 1 on cd 1 of stack "B"


So, how do you get the context set back to stack A?

Regards,
  Mike



___
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: How to launch a stack from a file.

2016-02-07 Thread Michael Doub
Thanks Richard,   The stack was corrupted.   I had saved it with file: 
rather than binfile: All is well now.Good to know about checking 
the result.


-= Mike


On 2/7/16 2:40 PM, Richard Gaskin wrote:

Michael Doub wrote:
> I am trying to build a simple launcher app and I am stumped as to how
> to load a stack from a file.  I have no problem loading it from my
> dropbox, but not from a local file.
>
> put
> 
/Users/mike/Library/Preferences/CueSheets/ridewithgps_cuesheets.livecode

> into localpath
>
> none of the following work:
>
> go stack localpath
> go stack url ("binfile:" & localpath)
> go stack url ("file:" & localpath)
>
> I have also tryed the "in a new window" clause
>
> What am I missing?

A check of "the result" immediately after the line that fails so you 
can find out what the engine's trying to tell you about how to fix it.





___
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


How to launch a stack from a file.

2016-02-07 Thread Michael Doub
I am trying to build a simple launcher app and I am stumped as to how to 
load a stack from a file.  I have no problem loading it from my dropbox, 
but not from a local file.


put 
/Users/mike/Library/Preferences/CueSheets/ridewithgps_cuesheets.livecode 
into localpath


none of the following work:

go stack localpath
go stack url ("binfile:" & localpath)
go stack url ("file:" & localpath)

I have also tryed the "in a new window" clause

What am I missing?

Thanks
   Mike





___
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] DropboxAPI_2_tester

2015-11-04 Thread Michael Doub

Thanks Gerard.

I have been trying to work thru the steps within you getting started 
page.   I am stuck on step 3 where you say "Click Submit Call". Can you 
clarify that a bit?   I don't see anything that looks like a submit call 
button.


Regards,
Mike



On 11/4/15 6:26 AM, gmcrev wrote:

I have uploaded DropboxAPI_2_tester.livecode to RevOnline:
http://livecodeshare.runrev.com/stack/794/DropboxAPI_2_tester
This demonstrates all the calls in v2 of the Dropbox API.

It uses the FASTJSON v0.4.1 library of  Bob Hall. Thanks Bob for this work.
https://github.com/bhall2001/fastjson

Guglielmo Braguglia published a dropbox library for API v1
http://www.phoenixsea.ch/downloads/Livecode/phxDropboxLib.zip

A free library for v2 of the Dropbox API is needed for the community to use.
Hopefully this stack will be an easy starting point 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


Re: recursion limit when creating file list of harddrive

2015-10-28 Thread Michael Doub
When I saw that the output contained both directories and files, adding 
the "/" allows you to

easily know that you are looking at a folder rather than a file.

put directoryListing(whatfolder) into foo
repeat for each line x of foo
if char -1 of x = "/" then
 put x & cr after directoryList
else
 put x & cr after fileList
end if

Given a random path that could be either a directory or a file, is there 
a clever way to tell what you have?


-= Mike


On 10/28/15 10:55 AM, Geoff Canyon wrote:

The trailing "/" is an interesting point. I checked and the "set the
directory" command will happily take a trailing "/" or not, but when you
"put the directory" you get no trailing "/"

Given that, I'd probably leave it as is, and always assume that the
description of a particular directory needs to have the "/" added when
adding a filename or directoryname to it.



___
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: recursion limit when creating file list of harddrive

2015-10-27 Thread Michael Doub

Geoff,

I would suggest replacing the first statement of the function with

if c is empty then put -1 into c-- set the default to go all the way 
down
put whatFolder & "/" & cr into R  -- add a "/" to directory output so 
they are more easily parsed later


-= Mike


On 10/27/15 12:18 PM, Geoff Canyon wrote:

Revised. Now in function form, with error checking and depth control. You
can hand in a positive number to get that number of layers deep, or a
negative number to go all the way down. I tested it on my home directory
and it came back fine (after some time). I haven't (knowingly) tested with
unusual characters.

on mouseUp
put directoryListing(fld "directory",round(the thumbposition of
scrollbar "depth")) into field "listing"
end mouseUp

function directoryListing whatFolder,c
put whatFolder & cr into R
set the directory to whatFolder
if c = 0 or the result is not empty then return R
put the files into tFileList
sort tFileList
replace cr with cr & whatFolder & "/" in tFileList
put whatFolder & "/" & tFileList & cr after R
put line 2 to -1 of the folders into tDirList
sort tDirList
repeat for each line L in tDirList
   put directoryListing((whatFolder & "/" & L),(c-1)) after R
end repeat
return R
end directoryListing


On Mon, Oct 26, 2015 at 12:00 AM, Geoff Canyon  wrote:


On Sat, Oct 24, 2015 at 7:28 PM, Matthias Rebbe | M-R-D <
matthias_livecode_150...@m-r-d.de> wrote:


I am using a script snippet which was posted by Scott Rossi to the list
and was originally from Geoff Canyon in 2002.
http://lists.runrev.com/pipermail/metacard/2002-August/002274.html


Man, do I hate looking at my old code...


___
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: Starting off with LC & Raspberry Pi's

2015-10-16 Thread Michael Doub

Earp,

Take a look at the Raspberry Pi routines in the MasterLibrary. 
https://www.dropbox.com/s/4uawi24k2gdwa3q/MasterLibrary.txt?dl=0


There are some I/O routines there.

-= Mike



On 10/16/15 1:27 PM, Earp Robert J. wrote:

I’ve been tinkering with my grandkids of late getting them going on basic 
electronics (H/W) and mousing around with rudimentary programming.  I guess I 
should have thought at the start that the two would get together at some point, 
but at the beginning it was a case of explaining the fundamentals of what I was 
doing with electronics in the workshop, primarily fixing things.  The idea of 
programming came after discovering the great  Everything Machine app (from 
Tinybop) for an iPad which then led to showing how the grandkids could use LC 
to do more stuff.  I figure they need to learn how to control the world through 
the Internet of Things before somebody else controls them, not that they don’t 
need controlling at times along with their grandfather ;-)

The H/W side of things has got to the point of considering adding some 
intelligence and I was going the route of PLC’s, and separately an Arduino, but 
of course programming those is not as fun as in LC or as easy.  So, when seeing 
Monty’s mergeBLE announcement I thought great, the Arduino’s and LC can go 
together.  I’m sure that will be the case in the long term but it needs a 
wrapper around it before us plebes will achieve productivity before inept 
frustration sets in.

Then through chance I stumbled across Fraser Gordon’s 2013 announcement of LC 
running on a Raspberry Pi which then led me to wonder if that combination allows LC 
to talk to the physical outside world, that is, through the Pi’s I/O.   
Unfortunately I cannot find much more information except for the LC Forum where I 
can’t find anything fundamental about LC & R-Pi’s, but Fraser’s article did say 
to post questions on this list, so that’s why you are reading it here.

So, here’s some Q’s that I’m hoping somebody can answer, or at least point me 
in the direction of where the answers may be.  Also, if there is a better/more 
appropriate list for this subject, I’d appreciate knowing that too.

Q. Can LC and the Pi’s I/O communicate ?  If so, is that native or through an 
extension ?

Q. Can you run stand-alone’s on the Pi ?

Q. LC v6.5.1seems to be the latest version of LC that will run on the Pi, which 
is fine, but is there any likelihood of future releases being made ?

Q. Is there is a better/more appropriate list, than this one, for the subject 
of LC and Raspberry Pi’s ?

Q. Can you suggest any more resources to look at ?


Many thanks, Bob…

Bob Earp
White Rock, British Columbia.




___
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: Learning Materials

2015-10-11 Thread Michael Doub
Would it be reasonable to ask Livecode to host a wiki site for 
documentation and examples?  I kind of like the idea of having the 
ability to add information or update when I see something that it out of 
date or unclear.


The problem is always organization and searching.   This would still 
need to be dealt with, but the wiki idea lets the community contribute 
and edit.


Sorry if this is out of context.  I am just catching back up on email.

-= Mike


On 10/11/15 1:34 PM, William Prothero wrote:

Richard:
Thanks for the info. I think a task-driven cookbook does really need to be 
community developed. There are so many emails here that ask “how do I do xyz?” 
or “xyz won’t work… why?” Compiling these, with dates and keywords, and a user 
commenting facility, would go a long way toward accomplishing this. If there 
was a web site where users could make these contributions and a reviewer of 
some sort could edit them prior to inclusion in the “master cookbook”, that 
might work.

For me, my main frustration is getting an app onto iPhone. There is a tutorial 
on the livecode site, which helped me a lot. Later, after I forgot its details, 
I tried to make a new iOS app and got burned by the provisioning profile, which 
I tried to make generic, but LC wouldn’t accept a generic one. When I went back 
to the original tutorial, I got it working, but it took me more than a day to 
get there. So, I dread my next try at iOS. Also, getting an Apple certificate 
is another hurdle and I haven’t accomplished that yet, as I’ve been tryin got 
use AppWrapper 3 and it won’t work. Some kind of cookbook, that could be 
updated as Apple adds new hurdles and requirements, would be marvelous.

I have a “Notebook” app that has the following headings. The headings I use 
currently are shown below. There are sub-headings with specific code and for 
different applications. It is just a collection, saved from the email list over 
the last two years for my own use and not refined for mass distribution.

Array handling
Behaviors
Calling handlers, out of path hierarchy
CEF Browser 
Code signing
Color-mouse-at loc
Date
DataGrid
Debugger use and tricks
Detect if app is running and user is "on" it.
DNS mysteries
Drag and Drop
Email thru livecode server
Encryption
Fields, text display
Files and directories
Find out if some program is running
Get Mac camera image
Get Version in iOS
Graphic effects
Groups
Images
iOS mobile stuff
Learning materials links
Memory monitoring
MobGui
Mobile Copying stacks and using them as libraries
Number precision
PHP and databases
Playing sound in SA and Mobile
Playing sounds
Printing
Product version from script
Scientific notation converter
Screen scaling issues
SnapShots
Scrolling
Server stuff
Sorting
Sockets
SSH Tunneling
Ssh and secure transfer
Stacks and substacks
Text Code: Parsing Delimited
Text-Rotating
Text to speech
Text
Time Zone Info
User function names-getting them from scripts
Video
Widgets

Best,
Bill


On Oct 10, 2015, at 12:28 PM, Richard Gaskin  wrote:

William Prothero wrote:


I said we need a dictionary focussed on tasks, not on commands,
but obviously we need both. I know Richard has been leading a
group taking this on. Richard, is this happening?

The focus of an API reference like the LiveCode Dictionary will always have the 
language tokens as their primary index.  This can (and arguably should) be 
augmented with tags to support searching for strings conceptually related but 
not found in the token itself or its description.  I believe that's been put 
into place for the future, but regrettably not available in the current 
shipping product v7.

Task-driven documentation is traditionally the domain of things like 
"Cookbooks".   That format allows for the exploration of related concepts in a 
more detailed  way that would be clumsy or even distracting in a Dictionary. IIRC 
LiveCode 1.0 had Cookbook, but I'm not sure when it was dropped.

To answer your question about the Community Documentation Team, over the last 
year the core team at LiveCode Ltd. has been migrating all documentation 
content into Github markdown so that it can not only be more easily edited but 
also reviewed, merged, and compiled into the product build more easily as well.

Peter Brett at LiveCode Ltd. has taken on the role of stewarding community 
engagement projects like this one, and the process of migrating the content to 
markdown is now far enough along that my next meeting with Dr. Brett will focus 
on conveying the dynamics of the workflow so we can get to work.

The scope defined for the moment, however, is to update existing docs.

If there's a desire for a Cookbook I would encourage the community to consider 
establishing a wiki for that.  Indeed, there is one at wikia.com which may be a 
good starting point:


To help guide such an effort, let me ask you a question related to the CreateIt 
course you mentioned:

You've been using LiveCode for many y

ANN MasterLibrary Version 45 now available.

2015-09-18 Thread Michael Doub
I made some adjustments to take into account the new reserved words of 
7.1 and 8.0.   You can find the current version here:


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

   -= Mike


Release 45
*  Added ArrayEncodeVersion - This function will return the livecode 
version that created the array encoded

string.
*  Added text_is_Caps - This function returns true if the input is all CAPS
*  Floor and Ceiling are now built in function of LiveCode 7.1 and 
above.   Changed the names to _Floor

and _Ceiling.

Release 44
*  Added numToAccounting, accountingToNum  - format and un-format numbers
*  Added PointWithinGrc - test for xyPoint within a grachic

Release 43
*  Added getColumns

Release 42
*  Added WordBounds - given line and word offsets it will return the 
starting and ending character of the

specified word.

Release 41
*  Added ability to create script only stacks, insert scripts. (see 
bottum on help text)  Script only stacks

will be automaticly be saved after any script insertions.
*  added the ScriptOnly function.  This function checks the disc image 
of a stack to see if it is a Script Only
Stack.   It returns true if the first line of the stack script on 
disc is "script".


Release 40
*  Totally fixed the FindinStyledText function.  Sorry, folks somehow a 
very early version found its way into
the Library and was not even close.  This version has been manually 
tested against the data generated

by DummyTextData.

___
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: Colouring words

2015-08-10 Thread Michael Doub
I was going to suggest looking at styledText too,  but it is kind of 
tricky to insert a run within the array.


I think Richmond should look at some of the text routines in the 
masterLibrary.   There are several that might be interesting:


LineOffsets returns a list of lines that contain a string within 
container - create a list of each line that contains "only"


WordOffsets returns a list of word offsets of a string within a 
container - create a new list that has line number and  the word offsets 
within the line.


wordBounds returns the start and end character of a word specified by 
line number and work offset. -  Based on the line number and word 
offset, get the start and end character and change the color within the 
field variable with the screen locked.





On 8/10/15 1:59 PM, Mike Bonner wrote:

It sounds like you might want to look at the styledtext.  Its a bit
convoluted, but once you get it figured out, it should be very fast.

Pseudo code for this would be..
put the text of the field into a variable.
repeat for each line (paragraph) and build up an array of "runs" with
descriptive text styling for each paragraph.
Apply the resulting array to the field.

Sounds simple.. Isn't.


On Mon, Aug 10, 2015 at 11:40 AM, Michael Doub  wrote:


Yet another approach:

put "this is the only  one" into fld 1

put empty into s1
put empty into e1
get MatchChunk (line 1of  fld 1,"(?i).+(only).+",s1,e1)
-- the regexp capture returns the start and end characters the match

set the textcolor of char s1 to e1 of line 1 of fld 1 to red

On 8/10/15 12:03 PM, Mike Bonner wrote:


You can do this..  Still a bit ugly but it works.

set the textcolor of trueword ( truewordoffset("only",line 5 of field 1))
of line 5 of field 1 to red


On Mon, Aug 10, 2015 at 9:13 AM, Richmond 
wrote:

On 10/08/15 16:51, dunb...@aol.com wrote:

@Mark


There is nothing wrong with setting the textColor of an entire line. Any
valid chunk expression would do.

No, there is nothing wrong with that, but that is not what I want to do.

Richmond.


@, Richmond:


What are you seeing? Why does it not work? I am in v 6.7.


Craig Newman




___

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: Colouring words

2015-08-10 Thread Michael Doub

Yet another approach:

   put "this is the only  one" into fld 1

   put empty into s1
   put empty into e1
   get MatchChunk (line 1of  fld 1,"(?i).+(only).+",s1,e1)
-- the regexp capture returns the start and end characters the match

   set the textcolor of char s1 to e1 of line 1 of fld 1 to red

On 8/10/15 12:03 PM, Mike Bonner wrote:

You can do this..  Still a bit ugly but it works.

set the textcolor of trueword ( truewordoffset("only",line 5 of field 1))
of line 5 of field 1 to red


On Mon, Aug 10, 2015 at 9:13 AM, Richmond 
wrote:


On 10/08/15 16:51, dunb...@aol.com wrote:


@Mark


There is nothing wrong with setting the textColor of an entire line. Any
valid chunk expression would do.


No, there is nothing wrong with that, but that is not what I want to do.

Richmond.



@, Richmond:


What are you seeing? Why does it not work? I am in v 6.7.


Craig Newman





___
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: Jane Austen's peculiarity

2015-08-09 Thread Michael Doub

Richmond,

Just so you know what is going on.  Each time a change in made to a 
field, a lot of management code is executed to properly render the field 
in case it is needed to be visible.   So when a field is modified within 
a loop, that field management code is executed over and over.   When the 
data is moved into a variable then manipulated the field management code 
is only executed when the results are put back into the field.


In almost all cases it is much faster to copy a field into a variable, 
manipulate the data, then put it back in the field when you want to make 
it visible.


Regards,
   Mike


On 8/9/15 4:22 PM, Richmond wrote:

On 09/08/15 23:03, Richard Gaskin wrote:

Richmond wrote:
> "Just" by loading the textFields into variables the whole script runs
> considerably faster

If you did the same with the output it'd get even faster.



Aha.

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: Thousands Separators

2015-07-28 Thread Michael Doub
Richard,  I think Hugh had the same thoughts when he created the 
fieldformatter (http://www.flexiblelearning.com/fieldformatter/). Were 
you thinking of something different?


-= Mike


On 7/28/15 9:59 AM, Richard Gaskin wrote:
It's of course very useful that we have a community able and willing 
to share handler for things like number formatting.


But stepping back to look at the big picture, I find myself wondering:

Why is that even necessary?

Why isn't that just a field property, e.g. "the displayFormat"?

The core language is very easy to use, but in many very common cases 
like this it's not so easy at all, as we have to hand-craft things 
that less capable tools provide as simple property settings.


Another good candidate complimenting displayFormat would be 
inputFilter, allowing us to set a property to enforce data entry rules 
for specific types (numeric, phone numbers, email addresses, etc.).


For all the wonderful time-saving features LiveCode provides, we spend 
way too much time re-inventing some very basic wheels.


Sure, we could wait for v8's Widgets for something like this, but I 
wouldn't mind seeing a behavior library for this sooner.  I'd help. 
Anyone have the time to steward such a project?  Even better if 
someone here has the chops to do this in the engine where it's 
arguably most beneficial for all of us.  I'd chip in on a bounty for 
either of these.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.com http://www.FourthWorld.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




___
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: Thousands Separators

2015-07-27 Thread Michael Doub
Peter, there is a function in the MasterLibrary that does this for you.  
Look in the Text section.


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Regards,
   Mike


On 7/27/15 7:12 AM, Peter W A Wood wrote:

I would like to display numbers with a thousand separator. I searched the 
dictionary and the user guide but couldn’t find any mention of inserting a 
thousand separator into a number. Is it a case of do it yourself?

Regards

Peter
___
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: LiveCode and SQLite performance

2015-07-24 Thread Michael Doub
First off, I want to thank all of you that have given me suggestions.  
It really is appreciated.   Here is the update.


I backed up all of my data to an external drive and did a complete 
re-installation of the OS, then resorted the data.   The first few tests 
of the database were fine, but after waiting a few hrs and trying again 
I saw the long open time again.  At this point I exported all of the 
data to csv file and to sql file.I recreated the database file with 
a table where I definitely specified the ID as primary key.   I imported 
the csv data.  I tried importing the sql but I aborted the process after 
an hour, as the progress was really poor.  The csv import was done in 
under a minute.   Now open times are a consistent 7 seconds with the 
load of the entire database into a variable is 4 seconds.   I did all of 
this last night and I am seeing the same behavior this afternoon.


So my take on this is that I did have a systems issue that was slowing 
things down, but I also think that the database was not configured 
correctly initially.


Anyway, I am operational again.   And thanks again for your kind help.

-= Mike



On 7/24/15 1:36 PM, Ralph DiMola wrote:

+10

Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original Message-
From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf
Of Richard Gaskin
Sent: Friday, July 24, 2015 1:04 PM
To: use-livecode@lists.runrev.com
Subject: Re: LiveCode and SQLite performace

Mark Waddingham wrote:

  > I'd get your hdd checked out asap.

This is a good opportunity for all of us to remember that portable
large-capacity hard drives are dirt cheap compared to the cost of lost data.
A USB 3.0 1TB drive can be picked up at the corner market for about US$60,
and a 2TB drive for under US$85.

I know everyone here already has multiple redundant daily backups anyway,
but there was a time many years ago when I didn't, and I paid for it dearly.

Now I have one copy of everything in the cloud, three in my office, and
three at home which are rotated through the office so at least one of those
offsite backups is never older than 24 hrs.

With an rsync script backing up is super-fast and as easy as typing a single
word in Terminal.  Yes, I also use Time Machine, but relying on any single
backup isn't enough; drives fail, software fails, archives corrupt, merde
happens.  rsync takes only a few minutes to learn and can move large amounts
of data with ease anywhere, a perfect compliment to other backup systems for
multiple redundancy.

Far more than needed?  Exactly.  Disks are cheap, but time is the rarest
commodity in the universe.

Last year my MacBook Pro started acting wonky so before I ran any
diagnostics the first thing I did was make a full backup.  Good thing:
the mobo died half an hour later. I just copied the files I needed to
another machine and was back to work in minutes.

--
   Richard Gaskin
   Fourth World Systems
   Software Design and Development for the Desktop, Mobile, and the Web
   
   ambassa...@fourthworld.comhttp://www.FourthWorld.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


___
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: LiveCode and SQLite performace

2015-07-23 Thread Michael Doub

Hey guys,

I think that I have a system issue of some type.   We had a nasty 
thunderstorm last night and we lost power.  Obviously my Mac was 
re-booted.  When I ran my timing tests this morning.   Open was 3 
seconds and loading all the data in to a variable was 1.   Much better.


I just got back from a nice bike ride and tried it again.. some 5 hr 
later with the mac running the whole time.   Open was 93 seconds and 
loading the data was 23.


This tells me that it has nothing to do with livecode or the database, 
but something is going on with my system that is causing a dramatic 
slowdowns.


-= Mike




On 7/23/15 1:46 PM, Peter Haworth wrote:

Hi Michael,
Those are ridiculously long times!  I can't think of anything obvious that
would cause them.  Mark's question about whether the automatic indexes are
being recreated is a possibility but I'm pretty sure that doesn't happen.

I couldn't tell from your original post if your table has a primary
keydefined, looks like the ID column might be it?  Reason I ask is if would
be worth trying "SELECT  FROM mytable" since selecting
all primary key columns is the absolute fastest select statement on a table
so I'd be interested to see how long it takes.  If you don't have a primary
key defined, use "rowid" instead.

That doesn't help with the open time but it might shed some light and
what's going on.

If you would be willing to share the database with me offline, I'd be happy
to see if I can spot anything.  I'd also be happy to post the problem on
the sqlite developers list but in order to do that, I would need the exact
CREATE statement used to create the table plus any other tables in the
database.  Your sqlitebrowser tool should provide that somewhere.

Pete



On Wed, Jul 22, 2015 at 4:33 PM Michael Doub  wrote:


I just updated the database and it now has 608436 records.  Sorry for
the typo. it was 604000.

How long to open - 216 seconds.

I timed put revDataFromQuery(,,db_id,"select * from mydatabase") into
tResult
it was 26 seconds.

216 to open and 26 to copy all of the data into a variable.  This seems
odd to me.

The database is on the main internal drive (same as OS) in folder with
the stack that is accessing the database.

The result of the integrity check is "ok"


On 7/22/15 5:11 PM, Peter Haworth wrote:

Hi Michael,
Out of interest, when you say it takes a long time to open the database,
how long do you mean?

Also, where is the database located?  On your Mac's hard drive, external
drive, on a network?

I'm a bit confused as to the number of records.  Your original email said
600,000+ records, but you mentioned that the ID field (which is defined

as

unique) has values from 1 to 60400.  Maybe a type somewhere?

You'll see auto indexes for any columns that are defined as UNIQUE,

that's

how sqlite enforces that constraint.

Don't worry about indexes for now.  They on;y help if you are having
problems with how long it takes to execute your select commands and this
problem is occurring long before then.

PRAGMAs are just another type of sqlite statement. After opening your
database, do this:

put revDataFromQuery(,,gDBID,"PRAGMA integrity_check)) into tResult
put tResult

gDBID is just the variable with your connection ID in it so replace it

with

your variable name.

The message box will open and you'll see the output from the PRAGMA
command.  It it begins with "revdberr",Livecode detected an error with

the

statement for some reason.  If the PRAGMA does not find any error it
returns OK.  Anything else, there's corruption in your database.

Let me know the result of the integrity check and we'll go from there.



On Wed, Jul 22, 2015 at 1:50 PM Michael Doub  wrote:


Kay and Mark, the database file size is 250Mb.   The performance issue
that surprised me was the open time.  Adds and Queries are as expected.

ID's currently range from 1 to 60400
URL is a typical URL that ranges from 50 to 130 characters, average is
80 char.
tag is currently not being used so empty
local is a mac file path:  of the form

/Volumes/EXTERNAL/XXX/x.xxx

How would I create and index?   When I look at the database with
sqlitebrowser, it looks like an auto index was created.
Can you give me instructions as to how I should have created the
database with an index?

Peter, This is using livecode 7.0.6 on a Mac OSX 10.10.4.   My DataBase
expertise is very limited.  I created the database with sqlitebrowser,
then added the data with livecode.   I don't know anything about PRAMAs
or even how to execute them.   If you can provide instructions I will
give it a try.

-= Mike




On 7/21/15 11:48 PM, Kay C Lan wrote:

An example of half a dozen records please. Maybe a couple of very

short,

a

couple of the longest and a couple of average.

How big is the db file size - MB not record count?

On Wed, Jul 22, 20

Re: LiveCode and SQLite performace

2015-07-22 Thread Michael Doub
I just updated the database and it now has 608436 records.  Sorry for 
the typo. it was 604000.


How long to open - 216 seconds.

I timed put revDataFromQuery(,,db_id,"select * from mydatabase") into 
tResult

it was 26 seconds.

216 to open and 26 to copy all of the data into a variable.  This seems 
odd to me.


The database is on the main internal drive (same as OS) in folder with 
the stack that is accessing the database.


The result of the integrity check is "ok"


On 7/22/15 5:11 PM, Peter Haworth wrote:

Hi Michael,
Out of interest, when you say it takes a long time to open the database,
how long do you mean?

Also, where is the database located?  On your Mac's hard drive, external
drive, on a network?

I'm a bit confused as to the number of records.  Your original email said
600,000+ records, but you mentioned that the ID field (which is defined as
unique) has values from 1 to 60400.  Maybe a type somewhere?

You'll see auto indexes for any columns that are defined as UNIQUE, that's
how sqlite enforces that constraint.

Don't worry about indexes for now.  They on;y help if you are having
problems with how long it takes to execute your select commands and this
problem is occurring long before then.

PRAGMAs are just another type of sqlite statement. After opening your
database, do this:

put revDataFromQuery(,,gDBID,"PRAGMA integrity_check)) into tResult
put tResult

gDBID is just the variable with your connection ID in it so replace it with
your variable name.

The message box will open and you'll see the output from the PRAGMA
command.  It it begins with "revdberr",Livecode detected an error with the
statement for some reason.  If the PRAGMA does not find any error it
returns OK.  Anything else, there's corruption in your database.

Let me know the result of the integrity check and we'll go from there.



On Wed, Jul 22, 2015 at 1:50 PM Michael Doub  wrote:


Kay and Mark, the database file size is 250Mb.   The performance issue
that surprised me was the open time.  Adds and Queries are as expected.

ID's currently range from 1 to 60400
URL is a typical URL that ranges from 50 to 130 characters, average is
80 char.
tag is currently not being used so empty
local is a mac file path:  of the form /Volumes/EXTERNAL/XXX/x.xxx

How would I create and index?   When I look at the database with
sqlitebrowser, it looks like an auto index was created.
Can you give me instructions as to how I should have created the
database with an index?

Peter, This is using livecode 7.0.6 on a Mac OSX 10.10.4.   My DataBase
expertise is very limited.  I created the database with sqlitebrowser,
then added the data with livecode.   I don't know anything about PRAMAs
or even how to execute them.   If you can provide instructions I will
give it a try.

-= Mike




On 7/21/15 11:48 PM, Kay C Lan wrote:

An example of half a dozen records please. Maybe a couple of very short,

a

couple of the longest and a couple of average.

How big is the db file size - MB not record count?

On Wed, Jul 22, 2015 at 7:55 AM, Michael Doub 

wrote:

I need some database consulting help.   I have created an SQLite

database

that has 4 fields:
ID, URL, tag, local.   IS is integer, unique, URL is text not null

unique

and tag and local are just text.   I have 600,000+ records. I use the

ID to

access each record in most cases or I am filtering trying to find

records

based on the contents of the tag, URL or local fields.

It seems to take forever to open the database.  This is normal?   I am
primarily using the database to make sure that I do not have non-unique
URLs, adding performance and selects seem reasonable.   I am just

surprised

about the open performance  Does opening the database load a lot of
information into memory thus the long delay?   Could I have created the
database in someway that is not optimal, thus causing the delay?

This is not a livecode issue as I am seeing the same delay when I open

the

database with sqlitebrowser.

Any advise or incites in how sqlite actually works would be appreciated.

Regards,
 Mike


___
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 l

Re: LiveCode and SQLite performace

2015-07-22 Thread Michael Doub
Kay and Mark, the database file size is 250Mb.   The performance issue 
that surprised me was the open time.  Adds and Queries are as expected.


ID's currently range from 1 to 60400
URL is a typical URL that ranges from 50 to 130 characters, average is 
80 char.

tag is currently not being used so empty
local is a mac file path:  of the form /Volumes/EXTERNAL/XXX/x.xxx

How would I create and index?   When I look at the database with 
sqlitebrowser, it looks like an auto index was created.
Can you give me instructions as to how I should have created the 
database with an index?


Peter, This is using livecode 7.0.6 on a Mac OSX 10.10.4.   My DataBase 
expertise is very limited.  I created the database with sqlitebrowser, 
then added the data with livecode.   I don't know anything about PRAMAs 
or even how to execute them.   If you can provide instructions I will 
give it a try.


-= Mike




On 7/21/15 11:48 PM, Kay C Lan wrote:

An example of half a dozen records please. Maybe a couple of very short, a
couple of the longest and a couple of average.

How big is the db file size - MB not record count?

On Wed, Jul 22, 2015 at 7:55 AM, Michael Doub  wrote:


I need some database consulting help.   I have created an SQLite database
that has 4 fields:
ID, URL, tag, local.   IS is integer, unique, URL is text not null unique
and tag and local are just text.   I have 600,000+ records. I use the ID to
access each record in most cases or I am filtering trying to find records
based on the contents of the tag, URL or local fields.

It seems to take forever to open the database.  This is normal?   I am
primarily using the database to make sure that I do not have non-unique
URLs, adding performance and selects seem reasonable.   I am just surprised
about the open performance  Does opening the database load a lot of
information into memory thus the long delay?   Could I have created the
database in someway that is not optimal, thus causing the delay?

This is not a livecode issue as I am seeing the same delay when I open the
database with sqlitebrowser.

Any advise or incites in how sqlite actually works would be appreciated.

Regards,
Mike


___
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


LiveCode and SQLite performace

2015-07-21 Thread Michael Doub
I need some database consulting help.   I have created an SQLite 
database that has 4 fields:
ID, URL, tag, local.   IS is integer, unique, URL is text not null 
unique and tag and local are just text.   I have 600,000+ records. I use 
the ID to access each record in most cases or I am filtering trying to 
find records based on the contents of the tag, URL or local fields.


It seems to take forever to open the database.  This is normal?   I am 
primarily using the database to make sure that I do not have non-unique 
URLs, adding performance and selects seem reasonable.   I am just 
surprised about the open performance  Does opening the database load a 
lot of information into memory thus the long delay?   Could I have 
created the database in someway that is not optimal, thus causing the 
delay?


This is not a livecode issue as I am seeing the same delay when I open 
the database with sqlitebrowser.


Any advise or incites in how sqlite actually works would be appreciated.

Regards,
   Mike


___
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: Table field

2015-07-12 Thread Michael Doub

Thanks Peter.   I just added it to the MasterLibrary.

https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Regards,
   Mike


On 7/12/15 7:05 AM, Peter M. Brigham wrote:

Here's a general function for extracting a column or columns from a tab-del 
table, based on a handler by Mike Doub for deleting columns. IIRC there was an 
exchange in this list re bug checking and generally tuning it up, and the 
handler I saved in my library came out of that discussion.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

---

function getColumns pData, pColNbrs, pDelim
-- Extract specified columns from a table in order
--pData: a tab-delimited table (delim may be overridden with pDelim)
--pColNbrs: A comma separated list of columns or column ranges
--   to be returned in the order indicated, for example "2,7,5"
--   or an ascending column range: "3-5"
--   or a descending column range: "5-3"
--   or a combination "7,4-5,2,11-9"
    -- based on deleteColumns() by Michael Doub et. al., use-LC list

if pColNbrs = empty then return pData

if pDelim = empty then put tab into pDelim
-- first expand column ranges
repeat for each item pCol in pColNbrs
   put offset("-",pCol) into dashPos
   if dashPos = 0 then
  put pCol & comma after tColsToReturn
   else if dashPos = 1 then
  -- for column numbers like -1, -2, etc.
  put howMany(pDelim,line 1 of pData) + 1 into nbrItems
  put pCol + 1 + nbrItems & comma after tColsToReturn
   else
  -- a column range
  put char 1 to dashPos-1 of pCol into firstColNbr
  put char dashPos+1 to -1 of pCol into lastColNbr
  if firstColNbr < lastColNbr then
 repeat with i = firstColNbr to lastColNbr
put i & comma after tColsToReturn
 end repeat
  else
 repeat with i = firstColNbr down to lastColNbr
put i & comma after tColsToReturn
 end repeat
  end if
   end if
end repeat
delete char -1 of tColsToReturn
-- then extract columns in order
set the columnDelimiter to pDelim
split pData by column
repeat for each item n in tColsToReturn
   add 1 to x
   put pData[n] into rData[x]
end repeat
combine rData by column
return rData
end getColumns


On Jul 11, 2015, at 7:56 PM, JB wrote:


If you want to get all the items in a column
Richard Gaskin wrote a excellent function
specifically for that.  Like all of his code it
is fast.

John Balgenorth


On Jul 11, 2015, at 4:45 PM, dunb...@aol.com wrote:


The colunDelimiter will not. in and of itself, extract, say, the third item of 
all the lines in a tab and return formatted dataSet. DataGrids have this sort 
of functionality built-in, but that is still constructed from standard LC 
techniques.
As per the above, if you wanted that third item all down the table, you have to 
loop through each line and dig it out, as others have already said.


Craig Newman



-Original Message-
From: Peter Haworth 
To: How to use LiveCode 
Sent: Sat, Jul 11, 2015 6:36 pm
Subject: Re: Table field


What Mike said.  It's somewhat confusing since there is a
"columndelimiter"
property which is set to tab by default but it seems to only
be used in
conjunction with the split command.

On Sat, Jul 11, 2015 at 12:57
PM Mike Bonner  wrote:


Its tab and cr delimited data,

so set the itemdelimiter to tab and get item

2 o fline 3 of field "xxx"



On Sat, Jul 11, 2015 at 1:51 PM, Richmond 
wrote:

I have a table field containing some data I copy pasted from a

spreadsheet

[being unable to find a reliable way to import data

directly from a

spreadsheet]

that runs across 3 columns.


When I tried this:

put column 2 of line 3 of fld "XXX"

I

had no joy.

I would be grateful if someone could tell me how to

extract data from

individual cells in a table field.

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@lis

Re: Plain text library stacks

2015-04-24 Thread Michael Doub
I just updated the MasterLibrary to allow you to create a Script Only 
Stack and insert functions and commands with just a few clicks.


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

-= Mike



On 4/23/15 2:58 PM, Thierry Douez wrote:

Absolutely,

that's what Peter was showing in his sample code.

Regards,

Thierry


Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage


2015-04-23 20:56 GMT+02:00 Devin Asay :

I’m curious—can these plain text stacks be used by LC Server just like a 
regular stack as a library?

Devin


Devin Asay
Office of Digital Humanities
Brigham Young University


___
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: Plain text library stacks

2015-04-23 Thread Michael Doub
Mark,   It appears that when you programmatically create a script only 
stack and save it.  The engine auto inserts the first line: script 
"stackname".I see that when I look at the file with a text editor.   
When I edit the script of the stack in livecode the script "stackname" 
line is missing.


Will there be any problems if there are two script "stackname" 
statements in the text file.  This could occur if the user adds it when 
in the livecode editor.


What is the recommended method for determining if a stack is a "script 
only" stack?


Thanks
   Mike


On 4/23/15 1:08 PM, Mark Waddingham wrote:

That is something to be aware of.

The purpose of a script only stack is to be text on disk... Password protection 
requires binary output, so in that case you might as well just use a normal 
stack.

Mark

Sent from my iPhone


On 23 Apr 2015, at 17:49, Peter Haworth  wrote:

Not sure if this is a problem or not but it appears that any password I set
on the stack isn't retained.  If I remove the stack from memory and re-open
it, the password isn't retained.  I guess just something to be aware of
rather than a problem.

Pete
lcSQL Software 
Home of lcStackBrowser  and
SQLiteAdmin 


On Thu, Apr 23, 2015 at 9:26 AM, Mark Waddingham  wrote:

So, script "stackname" must be at the 1st line of the textfile.

Ah yes - that is indeed the case - it is quite picky, for two reasons.

The first was that the main use-case I had in mind when implementing it
was to replace IDE stacks which were only scripts and thus they would be
edited in the IDE.

The second is that the *only* part of the file which the engine retains
when it is loaded is the 'name' on the first line and everything on the
second line onwards. If text before the 'script' line were allowed then it
is not clear how you might access that when the stack is loaded into memory
- it would essentially be invisible information in the internal stack
structure that would only appear when the stack is saved again.

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

___
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: curiosities in object reference

2015-04-20 Thread Michael Doub
The findTextInStyledText function within the MasterLibrary might be 
helpful in this case.   Pass it a string to find and the styledText 
array and it will return to you the LineIndex, RunIndex and Starting 
char within the run.


The MasterLibrary is here... 
https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0


I just updated the Library to version 40.   Somehow a very premature 
version of findTextInStyledText found it way into the library.   A 
useful version is now in place.


Richard and others, since you are now playing with styled text, how 
about sending me a wish list of functions that you think would be 
useful.   I can tinker away at them.


Regards,
   Mike




On 4/20/15 10:44 AM, Richard Gaskin wrote:

Mike Bonner wrote:

> I wish it was easy to work with "the styledtext" but multiple runs
> get really convoluted. They contain the actual text though, so if
> you're better at navigating arrays than I am, it might be possible
> to "put the styledtext of fRef into tStyledA" then make adjustments,
> then "set the styledtext of field fRef to tStyledA"

I've come to enjoy working with styledText arrays since I asked about 
them here last year.  Very helpful for many things, but in this case 
I'd use the simpler htmlText, designed as it is to provide a 
plain-text representation of field contents with complete fidelity, 
and it works on chunks as well as the field object as a whole.





___
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: Large Scripts Run too Slowly

2015-04-20 Thread Michael Doub

Ray,

Take a look at the way the MasterLibrary Works. 
https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0 It 
has an infrastructure in place to add functions and handler to stacks.  
These can easily be turned into substacks.Feel free to copy with 
pride if it makes sense for your situation.   The MasterLibrary was 
intended to be used for code that is re-used multiple times in many 
applications but it might give you some ideas.  Unfortunately, the 
dependance graph is created manually.  It would be really nice if I 
could figure that out dynamically, but it is what it is for now. 
Because of that it may be easier to build the libraries by hand is the 
code was not intended to be reusable reusable.Anyway, food for 
thought...


I just checked the size of the library and it is currently running at 
12250 lines and I am only noticing a minor lag on loading the script 
into the editor.  I guess I am going to add some new content to see if I 
run into the slow downs that you describe.


-= Mike




On 4/20/15 10:28 AM, Ray wrote:
I've got a stack script of over 15,000 lines.  It's recently started 
running too slow to work with.  Everything is painfully slow from 
plain typing to searches to scrolling.  Stepping through lines with 
the debugger is almost impossible.


I start using this stack at launch so all other stacks in the project 
have access to the handlers.


Does anybody have any suggestions regarding splitting it up or something?

___
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


sftp ... again

2015-04-15 Thread Michael Doub
I am looking for a way to push a file on to my ftp site.   It supports 
FTP with TLS/SSL (AUTH TLS - Explicit), SFTP and WebDAV with HTTPS 
(SSL).Based on my searching it seems the FTP path is a dead end, and 
I dont know anything about WebDAV.   I thought I would double check with 
the list and see if there are any late breaking solutions.


  fingers crossed.

My goal in all of this is to create a webpage with the current 
documentation of the MasterLibrary in it so the web search engines can 
find it.   I would like to also create an attractive home page of sorts 
for the library, but my artistic skills are equivalent to a pet rock and 
my web skills are about the same.   If anyone with some artistic web 
talent is willing to help, please let me know.


Thanks
   Mike


___
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: Custom Desktop Folders

2015-04-15 Thread Michael Doub

this might help...

http://helpdeskgeek.com/how-to/customize-folder-icons-desktop-ini/


On 4/15/15 2:20 PM, Mark Schonewille wrote:

Hi Ray,

I used to do this for CD's. Those projects are on an external hard 
disk somewhere. As soon as I find those projects, I'll post a real ini 
file. Meanwhile, you could just check out the syntax for ini files.


--
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 4/16/2015 02:01, Ray wrote:

OK Mark - I've experimented a little doing this:

Made a text file named Desktop.ini

Saved the following content in it:
[.ShellClassInfo]
IconFile=MyIcon.ico
IconIndex=0
InfoTip=Some sensible information.

Created a folder on the Windows desktop named Test

Moved both the file and a .ico file named MyIcon into the folder

This doesn't change the appearance of the folder, although it does
change the appearance of the text file.  It puts a little gear on it.

Am I missing something?

On 4/15/2015 1:43 PM, Mark Schonewille wrote:

Ray,

It is a text file. I gave you an example of the text. LiveCode can
create such text files. The file should be saved inside the folder of
which you want to change the icon.

--
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 4/16/2015 01:37, Ray wrote:

Mark  -  thanks for these tips but I'm afraid I'm not quite following
you.

Should the text file have any text in it?  Which folder should I 
save it
in?  And finally, how do I set the settings you've outlined from 
within

Livecode?  I guess these things are delving into an area of Livecode
I've never used.

Thanks,

Ray

On 4/15/2015 12:56 PM, Mark Schonewille wrote:

Hi Ray,

Make a text file with Notepad. Save it in the folder as Desktop.ini.
Use the following settings:

[.ShellClassInfo]
IconFile=Folder.ico
IconIndex=0
InfoTip=Some sensible information.


--
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 4/15/2015 23:30, Ray wrote:

Does anybody know of a way, from within Livecode, to create a folder
and give it it's own custom display on the desktop?  I'd imagine 
this

would be done with an .ico file.  I'd like to do this for both Mac
and Windows.

I've looked through the RunRev store and haven't found any 
extensions

which do this.  Maybe through a command-line somebody has written?



___
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




___
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: How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub
I was able tp get to the AVD Manager thru Android Studio.   And you are 
correct that it is quite slow.   I am currently getting a failure that 
says that it cant find the package manager... Humm.


This is why I generally build a simple launcher application that I 
manually load on to the device and it fetchs the real app from 
dropbox.   I have never had much luck with the simulator.


Any suggestions for me to try?   I do have your hard link in place.

-= Mike


On 4/13/15 4:50 PM, Mark Schonewille wrote:

Hi Mike,

I start the Android command line app by double-clicking it in 
sdk/tools. This starts the SDK manager, which allows me to manage 
AVD's. I have created an AVD with Android 2.3.3 and start this from 
the AVD manager. Any other version of Android is too slow to be 
practical for testing in the emulator. There is also a newsletter, 
which explain how to set up an emulator in VirtualBox.


--
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 4/13/2015 22:17, Michael Doub wrote:

They have tried to really making installation idiot proof, in doing so
they install the sdk in the Library directory by default and there is no
option to change it.

creating the alias seems to get livecode to build to run cleanly. I am
trying to figure out how to set up the emulator now..
One step at a time.I just got a new Android Phone yesterday.
Watchout!   I am going to be dangerous soon.  ;-)

-= Mike



On 4/13/15 4:06 PM, Mark Schonewille wrote:

Hi Mike,

Can't you install the SDK in the Applications folder? If not, execute
this in the terminal:

ls -s /User/mike/Libraries/Android/sdk 
/Applications/Android/Android_SDK


You may need to use sudo:

sudo ls -s ...

Now you can navigate to the Android_SDK folder in the Applications
folder from within LiveCode.

--
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 4/13/2015 21:42, Michael Doub wrote:

I just installed Android Studio.  It installs the sdk in
/User/mike/Libraries/Android/sdk.   I have not figured out a way to
enter this path into the mobile preferences section.   Can any one
provide me with some guidance?   I filled a bug report, but I need a
work around.

Thanks
Mike



___
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: How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub

Mark,

Are you sure "ls -s" is correct?   I thought ls was a listing command.   
I have not used true UNIX in years.   the -s option in the man page just 
talks about listing the blocks of the file.


-= Mike

On 4/13/15 4:18 PM, Mark Schonewille wrote:

Mike,

I'm not sure that an alias will always work. Hence the trick with a 
hard link in my other reply.


--
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 4/13/2015 22:07, Michael Doub wrote:

I think I answered my own question with this process:

1) using the finder locate the sdk directory by holding down the option
key and navigate using the GO menu.
2) make an alias for the sdk directory
3) move the alias somewhere out of the Library directory
4) now update the livecode preferences to point at the alias

-= Mike


On 4/13/15 3:42 PM, Michael Doub wrote:

I just installed Android Studio.  It installs the sdk in
/User/mike/Libraries/Android/sdk.   I have not figured out a way to
enter this path into the mobile preferences section.   Can any one
provide me with some guidance?   I filled a bug report, but I need a
work around.

Thanks
   Mike




___
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: How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub
Oh one other thing...  make sure that you install the 2.2 API 
libraries.  These are NOT installed by default in the Android Studio 
installation.   LiveCode will not work without them.


-= Mike


On 4/13/15 4:07 PM, Michael Doub wrote:

I think I answered my own question with this process:

1) using the finder locate the sdk directory by holding down the 
option key and navigate using the GO menu.

2) make an alias for the sdk directory
3) move the alias somewhere out of the Library directory
4) now update the livecode preferences to point at the alias

-= Mike


On 4/13/15 3:42 PM, Michael Doub wrote:
I just installed Android Studio.  It installs the sdk in 
/User/mike/Libraries/Android/sdk.   I have not figured out a way to 
enter this path into the mobile preferences section.   Can any one 
provide me with some guidance?   I filled a bug report, but I need a 
work around.


Thanks
   Mike






___
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: How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub
They have tried to really making installation idiot proof, in doing so 
they install the sdk in the Library directory by default and there is no 
option to change it.


creating the alias seems to get livecode to build to run cleanly. I am 
trying to figure out how to set up the emulator now..
One step at a time.I just got a new Android Phone yesterday. 
Watchout!   I am going to be dangerous soon.  ;-)


-= Mike



On 4/13/15 4:06 PM, Mark Schonewille wrote:

Hi Mike,

Can't you install the SDK in the Applications folder? If not, execute 
this in the terminal:


ls -s /User/mike/Libraries/Android/sdk /Applications/Android/Android_SDK

You may need to use sudo:

sudo ls -s ...

Now you can navigate to the Android_SDK folder in the Applications 
folder from within LiveCode.


--
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 4/13/2015 21:42, Michael Doub wrote:

I just installed Android Studio.  It installs the sdk in
/User/mike/Libraries/Android/sdk.   I have not figured out a way to
enter this path into the mobile preferences section.   Can any one
provide me with some guidance?   I filled a bug report, but I need a
work around.

Thanks
Mike



___
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: How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub

I think I answered my own question with this process:

1) using the finder locate the sdk directory by holding down the option 
key and navigate using the GO menu.

2) make an alias for the sdk directory
3) move the alias somewhere out of the Library directory
4) now update the livecode preferences to point at the alias

-= Mike


On 4/13/15 3:42 PM, Michael Doub wrote:
I just installed Android Studio.  It installs the sdk in 
/User/mike/Libraries/Android/sdk.   I have not figured out a way to 
enter this path into the mobile preferences section.   Can any one 
provide me with some guidance?   I filled a bug report, but I need a 
work around.


Thanks
   Mike




___
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


How to enter the Android Sdk Location when it is in "Library"

2015-04-13 Thread Michael Doub
I just installed Android Studio.  It installs the sdk in 
/User/mike/Libraries/Android/sdk.   I have not figured out a way to 
enter this path into the mobile preferences section.   Can any one 
provide me with some guidance?   I filled a bug report, but I need a 
work around.


Thanks
   Mike


___
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: ABC of arrays

2015-04-01 Thread Michael Doub

Graham,

I think one of the things that is confusing you as you are trying to 
learn arrays is the fact that you are looking at output created by 
ConvertXMLToArray.   ConvertXMLToArray is working as designed, but it 
just happens to create key in a syntax that looks like a livecode array 
reference.LiveCode keys are just strings, so ConvertXMLToArray is 
adding a open bracket, a counter, and a close bracket when it sees 
multiples of a xml tag, to make it unique within the array.


This makes perfect sense technically but I can see where it could really 
confuse someone trying to figure out livecode arrays.


-= Mike



On 4/1/15 3:48 PM, Graham Samuel wrote:

Well, Richard, I am always very willing to believe that I’ve misunderstood 
something, but this is what happened (this material is extracted from 
conversations I had on this list in the middle of March).

1. I had an XML file - it was actually a .gpx file, which shows a geographical 
route as a series of waypoints. The ‘top level’ of this structure is ‘gpx’. I 
mean the first three lines are (watch for wordwrap):


http://www.topografix.com/GPX/1/1"; creator="Geolives" version="1.1" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.topografix.com/GPX/1/1 
http://www.topografix.com/GPX/1/1/gpx.xsd";>
   
   

2. I converted it to an array using the function ConvertXMLToArray, by Trevor 
deVore - from Mike Doub’s Master Library.

3. I put the result into an array called ‘gGeneralArray’ - I can see this in 
the IDE as a nested structure.

4. I executed

   put the keys of gGeneralArray

in the message box, and got the result

  gpx

5. I discussed this on the use-list, and Mike Bonner suggested


try
put the keys of gGeneralArray["gpx”]
and you'll get the next level of keys.

6. I did that and got

wpt[1]
trk
@attributes
wpt[4]
wpt[2]
metadata
wpt[3]

I just did this all again to prove to myself that I hadn’t made an obvious 
error.I am definitely only dealing with one array, so I can’t explain this, and 
the LC dictionary certainly doesn’t help.

Tell me where I went wrong!

Graham


On 1 Apr 2015, at 18:27, Richard Gaskin  wrote:

Graham Samuel wrote:

And some things are just wrong: for example the very simple statement

put the keys of myArray

may or may not list all the keys, or it may.  I have never understood
this, especially as the Dictionary doesn’t discuss such ambiguities.

The Dictionary doesn't describe that because it should never happen.

Under what circumstances would "the keys" not returns the keys?

FWIW, I've only seen "the keys" return all keys in every version of LC/MC I've 
ever used.

___
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: How to Turn a Word Into a Graphic Object?

2015-03-28 Thread Michael Doub
I noticed that there is a lock screen command but no unlock screen in 
Jim's handler.   Was that done deliberately?


-= Mike


On 3/28/15 10:38 AM, Richard Gaskin wrote:

Brahmanathaswami wrote:


Also:  I don't see how this (in the docs on snapshot) can apply for
snapshots of words in a field as these are not "objects" perse:

" You can take a snapshot of an object regardless of its visibility
or open status - in particular, snapshots can be taken of objects
that are not on the current card or in stacks that are not open.

an attempt like this results in "empty rectangle"

on MouseUp
repeat with x = 1 to the number of words of fld _Quote of cd 2
   put the formattedRect of word x of fld _Quote of cd 2 into
tNextWordSnapshot
   import snapshot from rect tNextWordSnapshot of cd 2
  set the name of the last image to ("word_"&x)
   end repeat
end MouseUp

Also if you turn the vis of the field off... you get snaps shots of
whatever is visible on the card, not the words in the field...


That script uses the older "from rect" option, which obtains the image 
area from the final composite screen buffer.  It's truly WYSIWYG: if 
it ain't visible, it ain't gonna be seen in the resulting the image.


The newer "from " option is much smarter and more flexible, 
allowing you to capture any object (control, group, or even an entire 
card) whether it's open or not.


It does this by rendering the object into its own image buffer, and 
returns the resulting image data to the newly created image object.


And because it renders into its own buffer, the "from " option 
also maintains blending/transparency, so the resulting object will 
retain empty areas as empty, in many cases making it much more useful 
to using the resulting image as part of other layouts.


Jim's script posted yesterday at 
 creates 
a new field object and obtains the snapshot using the newer "from 
" option, which will not only handle what you need but also 
preserve empty space as transparent.


The only modification I would suggest for Jim's script is to use 
htmlText rather than rtfText.


RtfText will handle only the subset of LiveCode text attributes that 
are also supported by the RTF spec, which is good for most things but 
may miss a few elements unique to LiveCode (see the note in the 
Dictionary entry for rtfText).


HtmlText is designed to provide complete fidelity of all field 
contents and attributes in a plain-text format, making it the go-to 
solution for moving field contents, while RtfText is ideally suited 
for export for use in Word processors and the like.



Extra bonus points: if you ever need to create a thumbnail view of an 
object, see the new "at" options for specifying the width and height 
of the resulting snapshot.  MUCH faster than the scripted solutions we 
used to use, and very convenient.




If I'm write.. then perhaps we need to update the docs...(Richard/Dan...
is the framework for use contributions to the documentation in MarkDown
ready yet?)


I think this entry for the Dictionary may be fine - try the "from 
" option and see how it goes.  If you do find errors there 
please file a bug report and we'll catch them.


The Community Documentation Team is growing rapidly (thanks to all 
those who've written offering to help), and once Ben and I work out 
some scheduling challenges we've had we'll put together a work plan to 
get that started.



And as long as this is in your sigline:

Kauai's Hindu Monastery
www.HimalayanAcademy.com


If any of you are visiting Kauai you really should reserve time in 
your schedule to visit the monastery.  It's a beautiful place, 
breathtaking really, and the people who live and work there even 
better.  When I was there they had public tours scheduled each Friday; 
check their current schedule, and go.  You will leave with a deep 
admiration for the uncommonly wonderful work environment 
Brahmanathaswami gets to enjoy every day. :)





___
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: Move the clock hands with fingers

2015-03-26 Thread Michael Doub

Astghik,

Contact me off list and I will try to help you.  Please send a copy of 
your stack.


Regards,
Mike



On 3/26/15 7:59 AM, Astghik Salnazaryan wrote:

Hello :)
I am new here :)  i am learning livecode and I found clock code in
livecode,where you can move the clock hands with scrollbar, i tried to move
the minute clock hand with touch but something is wrong, i couldn't do it
in the right way. please can you look at the code? i wrote the code in
minute clock hand :)  thanks
P.S. sorry for my bad english :)
___
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: API

2015-03-23 Thread Michael Doub

Richmond,

This maybe the blind leading the blind, but here is my take. Hopefully 
someone will correct me.


Take a look at ~/livecode/libscript/src/foreign.mlc.   Here is where 
foreign types are defined.


Now take a look at ~/livecode/libscript/src/math.mlcNote that "use 
com.livecode.foreign" pulls in the type definitions


Just after the "use com.livecode.foreign" statement you can see where 
the foreign handlers are being defined and their arguments are being 
associated with data types.  I have not quite figured out the details of 
the bind directive, but I think it is providing direction to the 
compiler as to where to find the foreign code.


So line 38 sets up the arguments and data types for 
MCMathEvalSinNumber.  Now look at line 123.  This looks like where the 
sin operator  syntax is being defined for the LCB compiler. Line 129 
looks like where the _LCS_ interface for the sin function is being 
defined.   131 is where the native binding is happening between LCS and 
the native function MCMathEvalSinNumber.   Between all of these pieces 
is where the magic happen.


So if you assume that i am even remotely close to being correct, let's 
go look at ~/livecode/tests/lcb/_testrunner.lcb


line 20 is pulling in the type definitions
line 44 is defining the mapping of the parameter for the __system 
function.  Note that the binding is different.

line 46 is defining the Shell command for LCS
line 48 is where the magic is taking place.

I am still trying to figure out how the "bind to ... " works. Some where 
there has to be a linkage between this "bind" step and the OS level 
library,  So at run time, the library is loaded into memory and the 
final address resolution takes place.


I hope that someone will confirm/correct/ or otherwise educate.

Regards,
Mike




On 3/23/15 3:19 PM, Richmond wrote:

On 23/03/15 12:30, Peter TB Brett wrote:

On 2015-03-22 22:59, Peter W A Wood wrote:

Richmond

I believe that Richard’s “providing OS API access” is a
simplification, probably an over simplification, of “providing the
ability to access the OS API”. As I understand, LiveCode Builder will
allow us to write code which can directly call an OS API but, of
course, we will need to define the OS API function in LiveCode
Builder.

I had a quick scan of the LiveCode Builder files in Github but didn’t
see any examples so the facility may not even be in the current
release .


https://github.com/runrev/livecode/blob/develop/tests/lcb/_testrunner.lcb#L44 



It's in there.

  Peter



Obviously there is a socking great hole in my education as I cannot 
for the life of me

see how I can use that information:

"foreign handler __system(in Command as ZStringNative) returns CInt 
binds to "system"

handler Shell(in pCommand as String) returns Number
variable tExitStatus as Number
put __system(pCommand) into tExitStatus
if tExitStatus is in [0, -1] then
return tExitStatus
end if
if the operating system is "linux" then
-- Basically the WEXITSTATUS macro from C...
return tExitStatus shifted right by 8 bitwise
else
return tExitStatus
end if
end handler"

to hook onto an API . . .

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

A bit of a Mystery

2015-03-21 Thread Michael Doub
Yesterday, I ported a number of geo routines in to the MasterLibrary 
that contained greek characters.  I left them in place as I thought it 
improved readability of the code as it was a lot of math.   I had no 
problems at all during the port or testing.


Today, however I started up and noticed that all of the greek characters 
were showing up as "?".   This was now the case in both the code viewer 
and in the IDE editor tabs.


Can anyone explain this to me?  I am using livecode 7.0.4 (rc2).

I have now gone back into the library and replaced all of the greek 
characters with normal variable names and retested.   The new library is 
available. 
https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0


Thanks,
Mike

___
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-03-21 Thread Michael Doub

Richmond,

Check out the xyAD routine from the masterlibrary:  Calculate point 
x1,y1 that is distance dis and angle ang from point x,y

You will have to do the actual drawing.

-= Mike


On 3/21/15 11:12 AM, Richmond wrote:

On 21/03/15 17:09, Richmond wrote:

On 21/03/15 13:57, Jim Hurley wrote:

Message: 21
Date: Sat, 21 Mar 2015 09:02:23 +0200
From: Richmond >
To: How to use LiveCode >

Subject: Automated Drawing
Message-ID: <550d177f.10...@gmail.com 
>

Content-Type: text/plain; charset=utf-8; format=flowed

I set up a little stack with THIS in a button:

on mouseUp
   choose pencil tool
   drag from 100,100 to 200,200
end mouseUp

and it drew me a jolly diagonal line . . . super!

HOWEVER

I wonder if it is possible to do something like THIS:

drag for 100 pixels at 60 degrees

probably not, BUT ??

Richmond.



Of course:

on mouseUp
startTurtle
setHeading 60
forward 100
end mouseUp




You have in a matter of seconds made me feel totally stupid as my 
whole question is geared

towards an interface I am designing to control a USB-tethered turtle.

Thank you for the great help.

Richmond.


Possibly NOT as stupid as all that:

"button "Button": execution error at line 2 (Handler: can't find 
handler) near "startTurtle", char 1"


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: Long KML text file with no return chars

2015-03-19 Thread Michael Doub
The OS manages virtual memory and will move pages in and out of physical 
memory for you.  There is no need to worry about the system loosing 
data.  However you should be aware of this and try to control the way 
your code accesses memory.   if your code randomly accesses the data, 
you can cause the system to spend a lot time moving pages in and out of 
memory.   So processing in sections would help manage the performance.


-= Mike


On 3/19/15 3:07 AM, j...@souslelogo.com wrote:

Hi list,
SImilar question : how would you proceed if you
had to process a 16 Gb xml file (with no return chars)
with LC on a Mac with only 4 Gb of RAM ?
I managed to process the file in sections, but I always
fear the script would miss some nodes here and there...

Thanks in advance
jbv


___
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


Livecode's math precision

2015-03-17 Thread Michael Doub
Can anyone point me to a reference  that discusses the precision of 
livecode's math calculations?   Is it doing IEEE 754 64-bit floating 
point under the covers?


Thanks
   Mike

___
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: How to add a new item into the end of an existing line?

2015-03-16 Thread Michael Doub
   put "1,2,3,4,5,6,7,8,9" & cr & "11,22,33,44,55,66,77,88,99" & cr 
after tData

   set itemdel to comma
   put the itemdel & 10 after item -1 of line 1 of tData


On 3/16/15 1:45 PM, Keith Clarke wrote:

Folks,
Please can anyone clarify the syntax needed to add a new item A to the end of 
an existing line B of an existing variable C?

I can add to the end of the variable OK, as in

put foo after C

but if I try to put foo after B, after line B or after item -1 of line B, after 
Z (defined as item -1 of B) etc., and I get either no result or compilation 
errors.

I’m clearly missing the magic words.

Thanks in advance
Keith..





  
___

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: charWrap

2015-03-15 Thread Michael Doub

Richmond,

You might find the SoftLineBreaks function of the MasterLibrary of 
interest.   This function returns information about how the text within 
a field has been soft wrapped.


-= Mike



On 3/15/15 11:33 AM, Richmond wrote:
Crude stack that performs char wrapping here: 
http://forums.livecode.com/viewtopic.php?f=6&t=10810&start=30


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: Speaking of XML, what about KML?

2015-03-13 Thread Michael Doub
I had never heard of kml, so I poked around a bit and found some samples 
at https://developers.google.com/kml/documentation/kml_tut. It looks 
like it is a specific format of xml.


convertXMLToArray seems to work, but you are still going to have to look 
closely at the array structure that is specific to kml.   Hope this 
helps you get started.


-= Mike





On 3/13/15 2:58 PM, William Prothero wrote:

I’m about to build a parse to retrieve country outline data from a KML file. 
This seems straightforward, but just wondering if there is a handler posted 
someplace for this. Basically, I’ll parse out the lat/lon outlines, then render 
it onto a map using my own methods.

If there is none, then I’ll be glad to share what I come up with.

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



___
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: XML Tutorial

2015-03-13 Thread Michael Doub

These were contributed by Trever Devore.   Many thanks!

-= Mike



On 3/13/15 2:04 PM, Skip Kimpel wrote:

I HIGHLY recommend MasterLibrary!!  I have used these XML functions and they 
work like a charm.

SKIP




On Mar 13, 2015, at 1:59 PM, Michael Doub  wrote:

Graham,

ConvertArrayToXML and ConvertXMLToArray are both in the MasterLibrary under 
Misc.

https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Regards,
   Mike





On 3/13/15 1:47 PM, Graham Samuel wrote:
Not for the first time, I’m trying to get to grips with XML. I have to analyse 
some fairly trivial files (.gpx files, which show a geographical position, 
elevation and time). I find the explanation in the LC User Guide pretty tough, 
partly because they leave out elementary stuff about how legal XML is formed, 
partly because it’s got errors in it, and partly because the example they use 
isn’t rich enough. Oh and partly because I am slow and grumpy about this 
particular subject.

Long ago, I know Sarah Reichelt wrote some kind of tutorial but I can’t find 
it. Can anyone help with this or any other ‘XML for dummies’ type stuff? I just 
want to do simple things like put attributes into arrays.

TIA

Graham
___
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: XML Tutorial

2015-03-13 Thread Michael Doub

Graham,

ConvertArrayToXML and ConvertXMLToArray are both in the MasterLibrary 
under Misc.


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Regards,
   Mike




On 3/13/15 1:47 PM, Graham Samuel wrote:

Not for the first time, I’m trying to get to grips with XML. I have to analyse 
some fairly trivial files (.gpx files, which show a geographical position, 
elevation and time). I find the explanation in the LC User Guide pretty tough, 
partly because they leave out elementary stuff about how legal XML is formed, 
partly because it’s got errors in it, and partly because the example they use 
isn’t rich enough. Oh and partly because I am slow and grumpy about this 
particular subject.

Long ago, I know Sarah Reichelt wrote some kind of tutorial but I can’t find 
it. Can anyone help with this or any other ‘XML for dummies’ type stuff? I just 
want to do simple things like put attributes into arrays.

TIA

Graham
___
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

LiveCode 8.0.0 Widgets Themed?

2015-03-13 Thread Michael Doub
Can anyone comment on the intention for LiveCode Ltd supplied widgets... 
Is the intention that a single widget be themed to look appropriately on 
each platform?   This would seem logical, but I don't see any clues or 
direction in the 8.0.0 Guide.


This is really exciting stuff!

-= Mike


___
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: Spider Web chart?

2015-03-11 Thread Michael Doub

David,

What are the implications of getting a fractional part of a point? Does 
livecode just ignore the fraction or should the results be truncated or 
rounded?


Thanks
   Mike


On 3/10/15 10:27 PM, David Epstein wrote:

function yAD x,y,d,a,@xAD
   -- calculate point x1,y1 that is distance d and angle a from point x,y
   -- return y1, load x1 into param 5
   -- a is in degrees, positive is east of north
   put (90-a)*2*pi/360 into a
   put x + d*cos(a) into xAD
   return y + d*sin(a)
end yAD



___
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


[ANN] Rel 33 of MasterLibrary is available

2015-03-08 Thread Michael Doub

Release 33
* By popular demand all of the double quotes have been removed from 
handler names and functions.

* added displayHex, displayBinary, displayDump, FormatNumber
* updated caseSwitch, added PowerSource
* stripDupLines, removeDupLines (regexp implementations!)
* There is now an even faster parser!  Thierry Douez implemented a new 
parser in a very concise

   finite state machine.

https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=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


MasterLibrary Naming

2015-03-07 Thread Michael Doub
I wanted to start a separate thread so I can track the results. 
Elsewhere there was a discussion about the use of double underscore in 
the names.   So I would like feedback:


1) should I remove the double underscores from the function and handlers 
names?


and

2) should I remove the "get" from function names?

Please reply with your opinion and I will follow the majority.   A 
simple "yes,yes" will work.   I will assume the order is 1,2


Regards,
   Mike


___
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: RunRev 2015

2015-03-07 Thread Michael Doub

If it is on the east coast of the US, I will be there.   fingers crossed.

-= Mike



On 3/7/15 8:44 AM, Skip Kimpel wrote:

Throwing this out there... Any info on this years conference?  It would be 
great to be able to plan for this.

Then again, have it in Miami and I can attend anytime.

SKIP
___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-07 Thread Michael Doub

ok, a new day and another attempt.  I hope we have it this time. ;-)

on mouseup
  put __getPowerSource()
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") into 
zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a non-match.
   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace "," with "=" in tMatch
  if tCheckValue = empty and tMatch = empty then return tRetVal
  if tCheckValue is among the items of tMatch then return tRetVal
  if tMatch = "*" then
 if tRetVal = "*" then
put tCheckValue into tDefault
 else
put tRetVal into tDefault
 end if
  end if
   end repeat
   return tDefault
end __caseSwitch


function __getPowerSource
   /* __getPowerSource Under Test - System
   Syntax:
   __getPowerSource()
   Examples:
   __getPowerSource()
   Description:
   -- returns the current power source for a laptop
   --"AC" or "Battery"
   --or "no battery" if there is no battery (Unix)
   Source:
   Peter M. Brigham with help from Martin Koob, Bob Sneidar, Richard Gaskin
   __getPowerSource */
   /* Include
   __caseSwitch
   */

   switch the platform
  case "MacOS"
 -- thanks to Martin Koob, use-LC list
 put shell ("pmset -g batt") into tStatus
 -- returns something like:
 --Currently drawing from 'AC Power'
 -- -InternalBattery-099%; finishing charge; 0:00 remaining
 return char 2 to -1 of word -2 of line 1 of tStatus
 break
  case "Win32"
 -- thanks to Bob Sneidar, use-LC list
 put shell("WMIC Path Win32_Battery GetAvailability") into tStatus
 -- Line 3 will contain 2 if the battery is charging, 3 if 
running on battery

 put line 3 of tStatus into tStatus
 return __caseSwitch(tStatus,"3=Battery","*=AC")
 break
  default
 -- Unix, thanks to Mark Wieder
 constant kBatteryStatus0 = "/sys/class/power_supply/BAT0/status"
 constant kBatteryStatus1 = "/sys/class/power_supply/BAT0/status"
 if there is a file (kBatteryStatus0) then
open file (kBatteryStatus0) for read
read from file (kBatteryStatus0) until eof
put it into tStatus
close file  (kBatteryStatus0)
 else if there is a file (kBatteryStatus1) then
open file (kBatteryStatus1) for read
read from file (kBatteryStatus1) until eof
put it into tStatus
close file  (kBatteryStatus1)
 else
return "AC"
-- no battery, must be running off external power
 end if
 put word 1 of tStatus into tStatus
 if tStatus = empty then return empty
 return 
__caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")

 -- if tStatus = empty, returns empty --
 --Unix users please test: should this return some value??
 -- if tStatus is not in "discharging,charging,unknown,full" then
 --just returns whatever "/sys/class/power_supply/BATx" reports
   end switch
end __getPowerSource




___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-07 Thread Michael Doub
I originally did this because I thought it would avoid name space 
collisions.   I thought that I would receive feedback if folks thought 
it was a bad idea.   As you can see, it is extra work and it is easy for 
me to make a mistake.


I would be happy to remove them if folks would find it more useful. 
Please just let me know.


-= Mike




On 3/7/15 1:35 AM, Richard Gaskin wrote:

Mark Wieder wrote:
> If you're going to prefix the functions with "__" then you need to do
> it everywhere.

I think I missed something - why the underscores?

I've seen a fairly common convention of using a single underscore for 
private settings and such, but never two.


What value is being added to the library user with "__"?




___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-07 Thread Michael Doub
Thanks Mark.   I cut and pasted that last attempt and did not catch the 
caseSwitch.


-= Mike


On 3/7/15 1:27 AM, Mark Wieder wrote:

-- Unix, thanks to Richard Gaskin, use-LC list
  constant kBatteryStatus0 = "/sys/class/power_supply/BAT0/status"
  constant kBatteryStatus1 = "/sys/class/power_supply/BAT0/status"
  if there is a file (kBatteryStatus0) then
 open file (kBatteryStatus0) for read
 read from file (kBatteryStatus0) until eof
 put it into tStatus
 close file  (kBatteryStatus0)
  else if there is a file (kBatteryStatus1) then
 open file (kBatteryStatus1) for read
 read from file (kBatteryStatus1) until eof
 put it into tStatus
 close file  (kBatteryStatus1)
  else
 return "AC"
 -- no battery, must be running off external power
  end if
  put word 1 of tStatus into tStatus
  if tStatus = empty then return empty
  return



___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub
SMACK! ...  I just got swatted for wanting to go get another toy. My 
wife does not agree with the philosophy:  "He who has the most toys, 
wins!" and I have been told that I have enough.


Anyway since we are trying to see what the battery is doing, Do you 
think that a virtual system would go to that level?  I would be 
impressed, if it did.  To save some time I would still appreciate if 
some that already has a laptop can test this so I can publish another 
version of the MasterLibrary.


Thierry Douez, did some more optimization of the parser with a full 
blown state machine and selective regexp execution.   It is really 
fast!  The library is now 11,600 lines and there is a very visible lag 
trying to edit the library script, but parsing it is imperceptible.  I 
am thrilled to show off his optimizations. Thanks again Thierry!


-= Mike



On 3/6/15 4:43 PM, Richard Gaskin wrote:

Michael Doub wrote:

> Let hope this is the final kind makes me want to go get a linux
> laptop.  ;-)

Here ya' go:
https://system76.com/laptops

:)

While you're waiting for your new Gazelle to arrive, remember that 
VirtualBox is just as free as Linux, and runs just about all flavors 
excellently.


Step 1:
<https://www.virtualbox.org/wiki/Downloads>

Step 2:
<http://www.ubuntu.com/download>

Step 3:
Play, learn, have fun.





___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub
Let hope this is the final kind makes me want to go get a linux 
laptop.  ;-)


on mouseup
   put __getPowerSource()
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") into 
zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a non-match.
   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace "," with "=" in tMatch
  if tCheckValue = empty and tMatch = empty then return tRetVal
  if tCheckValue is among the items of tMatch then return tRetVal
  if tMatch = "*" then
 if tRetVal = "*" then
put tCheckValue into tDefault
 else
put tRetVal into tDefault
 end if
  end if
   end repeat
   return tDefault
end __caseSwitch


function __getPowerSource
   /* __getPowerSource Under Test - System
   Syntax:
   __getPowerSource()
   Examples:
   __getPowerSource()
   Description:
   -- returns the current power source for a laptop
   --"AC" or "Battery"
   --or "no battery" if there is no battery (Unix)
   Source:
   Peter M. Brigham with help from Martin Koob, Bob Sneidar, Richard Gaskin
   __getPowerSource */
   /* Include
   __caseSwitch
   */

   switch the platform
  case "MacOS"
 -- thanks to Martin Koob, use-LC list
 put shell ("pmset -g batt") into tStatus
 -- returns something like:
 --Currently drawing from 'AC Power'
 -- -InternalBattery-099%; finishing charge; 0:00 remaining
 return char 2 to -1 of word -2 of line 1 of tStatus
 break
  case "Win32"
 -- thanks to Bob Sneidar, use-LC list
 put shell("WMIC Path Win32_Battery GetAvailability") into tStatus
 -- Line 3 will contain 2 if the battery is charging, 3 if 
running on battery

 put line 3 of tStatus into tStatus
 return caseSwitch(tStatus,"3=Battery","*=AC")
 break
  default
 -- Unix, thanks to Richard Gaskin, use-LC list
 if there is a folder "/sys/class/power_supply/BAT0" then
put url "file:///sys/class/power_supply/BAT0/status" into 
tStatus

 else if there is a folder "/sys/class/power_supply/BAT1" then
put url "file:///sys/class/power_supply/BAT1/status" into 
tStatus

 else
return "AC"
-- no battery, must be running off external power
 end if
 put word 1 of tStatus into tStatus
 if tStatus = empty then return empty
 return 
caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")

 -- if tStatus = empty, returns empty --
 --Unix users please test: should this return some value??
 -- if tStatus is not in "discharging,charging,unknown,full" then
 --just returns whatever "/sys/class/power_supply/BATx" reports
   end switch
end __getPowerSource




On 3/6/15 4:24 PM, Mark Wieder wrote:

Michael Doub  writes:


Really,  3 slashes?

Yep. It's  followed by the URI.




___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub

Really,  3 slashes?

-= Mike

On 3/6/15 3:26 PM, Mark Wieder wrote:

Michael Doub  writes:


   if there is a folder "/sys/class/power_supply/BAT0" then
  put url "/sys/class/power_supply/BAT0/Status" into tStatus
   else if there is a folder "/sys/class/power_supply/BAT1" then
  put url "/sys/class/power_supply/BAT1/Status" into tStatus


Getting better. The "status" file should be lowercase though
And now that I'm looking at it again, I don't think that's the proper format
for the url command. It should be

put url "file:///sys/class/power_supply/BAT0/status" into tStatus





___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub

thanks Mark... take 2Once again paste into a button on a unix system.

-= Mike


on mouseup
   put __getPowerSource
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") into 
zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a non-match.
   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace "," with "=" in tMatch
  if tCheckValue = empty and tMatch = empty then return tRetVal
  if tCheckValue is among the items of tMatch then return tRetVal
  if tMatch = "*" then
 if tRetVal = "*" then
put tCheckValue into tDefault
 else
put tRetVal into tDefault
 end if
  end if
   end repeat
   return tDefault
end __caseSwitch


function __getPowerSource
   /* __getPowerSource System
   Syntax:
   __getPowerSource()
   Examples:
   __getPowerSource()
   Description:
   -- returns the current power source for a laptop
   --"AC" or "Battery"
   --or "no battery" if there is no battery (Unix)
   Source:
   Peter M. Brigham with help from Martin Koob, Bob Sneidar, Richard Gaskin
   __getPowerSource */
   /* Include
   __caseSwitch
   */

   switch the platform
  case "MacOS"
 -- thanks to Martin Koob, use-LC list
 put shell ("pmset -g batt") into tStatus
 -- returns something like:
 --Currently drawing from 'AC Power'
 -- -InternalBattery-099%; finishing charge; 0:00 remaining
 return char 2 to -1 of word -2 of line 1 of tStatus
 break
  case "Win32"
 -- thanks to Bob Sneidar, use-LC list
 put shell("WMIC Path Win32_Battery GetAvailability") into tStatus
 -- Line 3 will contain 2 if the battery is charging, 3 if 
running on battery

 put line 3 of tStatus into tStatus
 return caseSwitch(tStatus,"3=Battery","*=AC")
 break
  default
 -- Unix, thanks to Richard Gaskin, use-LC list
 if there is a folder "/sys/class/power_supply/BAT0" then
put url "/sys/class/power_supply/BAT0/Status" into tStatus
 else if there is a folder "/sys/class/power_supply/BAT1" then
put url "/sys/class/power_supply/BAT1/Status" into tStatus
 else
return "AC"
-- no battery, must be running off external power
 end if
 put word 1 of tStatus into tStatus
 if tStatus = empty then return empty
 return 
caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")

 -- if tStatus = empty, returns empty --
 --Unix users please test: should this return some value??
 -- if tStatus is not in "discharging,charging,unknown,full" then
 --just returns whatever "/sys/class/power_supply/BATx" reports
   end switch
end __getPowerSource




On 3/6/15 2:26 PM, Mark Wieder wrote:

Peter M. Brigham  writes:


So can a couple of Unix users out there test this part out?

  if there is a file "/sys/class/power_supply/BAT0" then
 put url "/sys/class/power_supply/BAT0" into tStatus
  else if there is a file "/sys/class/power_supply/BAT1" then
 put url "/sys/class/power_supply/BAT1" into tStatus

Once again, you're checking a directory, not a file.
So you either want "if there is a folder" instead of "if there is a file"
or you want 'if there is a file "/sys/class/power_supply/BAT0/status"'

and you need to grab the actual file contents:
put url "/sys/class/power_supply/BAT0/status" into tStatus




___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub
and of coarse I screwed it up too.   Peter, its catching.  ;) Please 
place into a button and help us test this on unix.


Thanks
   Mike


on mouseup
 put __getpowerSource()
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") into 
zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a non-match.
   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace "," with "=" in tMatch
  if tCheckValue = empty and tMatch = empty then return tRetVal
  if tCheckValue is among the items of tMatch then return tRetVal
  if tMatch = "*" then
 if tRetVal = "*" then
put tCheckValue into tDefault
 else
put tRetVal into tDefault
 end if
  end if
   end repeat
   return tDefault
end __caseSwitch


function __getPowerSource
   /* __getPowerSource System
   Syntax:
   __getPowerSource()
   Examples:
   __getPowerSource()
   Description:
   -- returns the current power source for a laptop
   --"AC" or "Battery"
   --or "no battery" if there is no battery (Unix)
   Source:
   Peter M. Brigham with help from Martin Koob, Bob Sneidar, Richard Gaskin
   __getPowerSource */
   /* Include
   __caseSwitch
   */

   switch the platform
  case "MacOS"
 -- thanks to Martin Koob, use-LC list
 put shell ("pmset -g batt") into tStatus
 -- returns something like:
 --Currently drawing from 'AC Power'
 -- -InternalBattery-099%; finishing charge; 0:00 remaining
 return char 2 to -1 of word -2 of line 1 of tStatus
 break
  case "Win32"
 -- thanks to Bob Sneidar, use-LC list
 put shell("WMIC Path Win32_Battery GetAvailability") into tStatus
 -- Line 3 will contain 2 if the battery is charging, 3 if 
running on battery

 put line 3 of tStatus into tStatus
 return caseSwitch(tStatus,"3=Battery","*=AC")
 break
  default
 -- Unix, thanks to Richard Gaskin, use-LC list
 if there is a file "/sys/class/power_supply/BAT0" then
put url "/sys/class/power_supply/BAT0" into tStatus
 else if there is a file "/sys/class/power_supply/BAT1" then
put url "/sys/class/power_supply/BAT1" into tStatus
 else
return "AC"
-- no battery, must be running off external power
 end if
 put word 1 of tStatus into tStatus
 if tStatus = empty then return empty
 return 
caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")

 -- if tStatus = empty, returns empty --
     --Unix users please test: should this return some value??
 -- if tStatus is not in "discharging,charging,unknown,full" then
 --just returns whatever "/sys/class/power_supply/BATx" reports
   end switch
end __getPowerSource



On 3/6/15 2:05 PM, Michael Doub wrote:
I will make it even easier for you to help test  ...  Paste all this 
code into a button script.


on mouseup
 put __powerSource()
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") 
into zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a 
non-match.

   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace ","

Re: Power Status (was Re: Because LC can't do two things at once.)

2015-03-06 Thread Michael Doub
I will make it even easier for you to help test  ...  Paste all this 
code into a button script.


on mouseup
 put __powerSource()
end mouseup

function __caseSwitch
   /* __caseSwitch Misc
   Syntax:
   __caseSwitch 
(var_to_Match,=,[=]...

   Examples:
   put caseSwitch(len(tZip),"5=zip","10=zip+4","*=not a zip code") into 
zipCodeType

   Description:
   Does a quick inline switch/case but supports a default for a non-match.
   .Also see __Switch

   param 1 is checkValue
   params 2+ are in the form matchValue(s)>=   .if the default is "*=*" then no match returns the original 


   .if no match and no default value specified, then returns empty

   Source:
   Peter M. Brigham   from Ken Ray, use-LC list, originally named 
stsSwitch()

   __caseSwitch */
put param(1) into tCheckValue
   set the itemDel to "="
   put "" into tDefault
   repeat with x = 2 to the paramCount
  put param(x) into tCheck
  put item 1 of tCheck into tMatch
  put item 2 of tCheck into tRetVal
  replace "," with "=" in tMatch
  if tCheckValue = empty and tMatch = empty then return tRetVal
  if tCheckValue is among the items of tMatch then return tRetVal
  if tMatch = "*" then
 if tRetVal = "*" then
put tCheckValue into tDefault
 else
put tRetVal into tDefault
 end if
  end if
   end repeat
   return tDefault
end __caseSwitch


function __getPowerSource
   /* __getPowerSource System
   Syntax:
   __getPowerSource()
   Examples:
   __getPowerSource()
   Description:
   -- returns the current power source for a laptop
   --"AC" or "Battery"
   --or "no battery" if there is no battery (Unix)
   Source:
   Peter M. Brigham with help from Martin Koob, Bob Sneidar, Richard Gaskin
   __getPowerSource */
   /* Include
   __caseSwitch
   */

   switch the platform
  case "MacOS"
 -- thanks to Martin Koob, use-LC list
 put shell ("pmset -g batt") into tStatus
 -- returns something like:
 --Currently drawing from 'AC Power'
 -- -InternalBattery-099%; finishing charge; 0:00 remaining
 return char 2 to -1 of word -2 of line 1 of tStatus
 break
  case "Win32"
 -- thanks to Bob Sneidar, use-LC list
 put shell("WMIC Path Win32_Battery GetAvailability") into tStatus
 -- Line 3 will contain 2 if the battery is charging, 3 if 
running on battery

 put line 3 of tStatus into tStatus
 return caseSwitch(tStatus,"3=Battery","*=AC")
 break
  default
 -- Unix, thanks to Richard Gaskin, use-LC list
 if there is a file "/sys/class/power_supply/BAT0" then
put url "/sys/class/power_supply/BAT0" into tStatus
 else if there is a file "/sys/class/power_supply/BAT1" then
put url "/sys/class/power_supply/BAT1" into tStatus
 else
return "AC"
-- no battery, must be running off external power
 end if
 put word 1 of tStatus into tStatus
 if tStatus = empty then return empty
 return 
caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")

 -- if tStatus = empty, returns empty --
 --Unix users please test: should this return some value??
 -- if tStatus is not in "discharging,charging,unknown,full" then
 --just returns whatever "/sys/class/power_supply/BATx" reports
   end switch
end __getPowerSource




On 3/6/15 10:53 AM, Peter M. Brigham wrote:

if there is a file "/sys/class/power_supply/BAT0" then
 put url "/sys/class/power_supply/BAT0" into tStatus
  else if there is a file "/sys/class/power_supply/BAT1" then
 put url "/sys/class/power_supply/BAT1" into tStatus
  else
 return "AC"
 -- no battery, must be running off external power
  end if
  put word 1 of tStatus into tStatus
  if tStatus = empty then return empty
  return 
caseSwitch(tStatus,"discharging=Battery","charging,unknown,full=AC","*=*")
  -- if tStatus = empty, returns empty --
  --Unix users please test: should this return some value??
  -- if tStatus is not in "discharging,charging,unknown,full" then
  --just returns whatever "/sys/class/power_supply/BATx" reports



___
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: Fwd: Quantum tunneling in LiveCode

2015-03-03 Thread Michael Doub
Richard,  Very nice explanation of this.   I always wondered about the 
relationship between this properties.


Thanks,
   Mike

On 3/3/15 10:13 AM, Richard Gaskin wrote:

Stephen Goldberg wrote:

> I think the bottom line is to be cautious about putting mouseUp
> scripts in background groups, or to put a disclaimer in the group
> at the beginning of the group handler the line (as mentioned in
> the User Manual (pg 131, 5.3.9):
>
> if the owner of the target is not me then pass mouseUp

The backgroundBehavior property is a tricky thing, implemented for 
compatibility with imported HyperCard stacks but given the differences 
between the HC and LC object models it's always going to be at least a 
little mind-bending.


In HC, there was always and only one background, which was placed 
below the card.


In LC, there is no "background" object pe se, but instead employs 
groups which can be shared across cards.  In LC we can have any number 
of groups, and they may even be nested.


In LC, in the absence of an always-present background object, all 
objects always reside on the card.


To maintain compatibility with HC, the backgroundBehavior was 
introduced in an attempt to account for those cases where the message 
handling order needed the background after the card, as it was in HC, 
rather than before the card as is natural in LC.


In older versions of LC setting the backgroundBehavior was the only 
way to share groups among multiple cards, which sometimes caused 
problems for developers expecting the natural order of messages to be 
in play, reflecting the visual order in which all controls, even 
groups, are on top of the card.


So a few versions back a new property was added:  the sharedBehavior. 
When true this allows us to share a group across multiple cards, and 
when creating a new card any groups with their sharedBehavior set are 
automatically placed on new cards.  It's related to the 
backgroundBehavior, but is not the same thing:


When the backgroundBehavior is set, the sharedBehavior is also set. 
This should trigger the change you're describing, in which messages 
are handled by as group with the backgroundBehavior set occur after 
the card receives them.


But the sharedBehavior can be set by itself, allowing sharing without 
altering LC's natural message order as reflected by what we see 
visually on screen:  objects on top of the card get messages before 
the card does.


So all that said, we might consider what you're seeing to be a bug.

But personally, with more than a decade separating me from the last 
time I had a machine even capable of running HC, it's been so long 
since I've thought about the HC-style message order that I never rely 
on it.  I was very glad when they introduced the sharedBehavior as a 
way of sharing groups while maintaining the natural, visible order of 
messages, and when I need messages to occur after the card I generally 
just put them in the stack or a library.


But there are those who may need the older HC-style message order, and 
if so that's what the backgroundBehavior is supposed to provide.


If you see a difference between LC and HC with message flow when the 
backgroundBehavior is set, it may be time to file a bug report.





___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-02 Thread Michael Doub

Looking around in /proc I found no acpi on the Pi.

-= Mike


On 3/2/15 10:30 AM, Richard Gaskin wrote:

Peter M. Brigham wrote:

> On Mar 1, 2015, at 3:16 PM, Richard Gaskin wrote:

>> Thanks to the beautiful simplicity of the Linux /proc directory
>> I was able to find:
>>
>>cat /proc/acpi/battery/BAT1/state
>>
>> The "charging state" field there will contain "charging" or
>> "discharging".
>
> Question: this looks like a file on disk. I didn't know what you
> meant by the "'charging state' field." What is the format of the
> file? Is this a text file, an XML file, or something else?

One of the guiding design principles of Unix is "everything is a 
file", which allows us to access not only those byte streams that are 
actual files, but also system and process info such as that commonly 
mounted at /proc, all with the same common tools (cd, ls, cat, grep, 
more, less, etc.) - this page explains it well:

<http://en.wikipedia.org/wiki/Everything_is_a_file>

Being a certified Unix OS X probably has a /proc, but some Unix 
flavors don't mount it; most Linux distros do.



> If you could give me a sample to look at I can parse it to get
> the info and complete the handler. I don't have a linux system
> to work with for this.

In my brief searching on this there were two files commonly noted, the 
one shown above and also /BAT0/state.  I'm not exactly sure why my 
laptop has a BAT1 but not a BAT0, and I'll see what I can turn up.


That said, given the increasing role of servers in our connected 
world, I can't say enough encouraging things about putting together a 
VM with Linux in it.  Tons of fun, very educational, and you can't 
beat the price.


And if you're a history buff, there's a version of Debian with 
OpenStep pre-installed so you can explore the look-and-feel of NeXT. :)



Michael Doub wrote:
> I don't know if this helps since the only linux system i have is a
> raspberryPi, but I get a file not found message when typing cat
> /proc/acpi/battery/BAT1/state in a terminal window.

Thanks for trying that, Michael.

It may be helpful to also check for BAT0, but it may also be that 
because the Pi doesn't ship with a battery that's not normally part of 
the info the system provides.


While battery packs are available for Pi*, the device itself doesn't 
distinguish it from running on a wall socket; it's not integrated with 
battery monitoring firmware like laptops are.


If that hunch is correct, the absence of a battery info element in 
/proc may be an accurate reflection of the system state.


I'll do some more digging and see what I can find



* I've been looking for a Pi case with an integrated battery pack.  
I've seen several battery packs as separate cases, but I'd really 
prefer everything in one box.  Anyone here seen one?





___
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: Power Status (was Re: Because LC can't do two things at once.)

2015-03-01 Thread Michael Doub
I don't know if this helps since the only linux system i have is a 
raspberryPi, but I get a file not found message when typing cat 
/proc/acpi/battery/BAT1/state in a terminal window.


-= Mike



On 3/1/15 8:01 PM, Peter M. Brigham wrote:

On Mar 1, 2015, at 3:16 PM, Richard Gaskin wrote:


Peter M. Brigham wrote:


Just closing the loop on this one (the power source of a laptop).
(Calling Richard Gaskin re the Linux case...)

Thanks, Peter.

I'd provided what I think might work some time ago, lost in the long thread as 
it's run across many topics (hence my taking the liberty of changing the thread 
title):


If anyone here running Linux could test that on their system to see if it works 
as well for you as it does for me we have have all three platforms now covered.

Thanks again for putting the handler together, Peter.

Yes, I did get that message:


Thanks to the beautiful simplicity of the Linux /proc directory I was
able to find:

cat /proc/acpi/battery/BAT1/state

The "charging state" field there will contain "charging" or "discharging".

Question: this looks like a file on disk. I didn't know what you meant by the 
"'charging state' field." What is the format of the file? Is this a text file, 
an XML file, or something else? If you could give me a sample to look at I can parse it 
to get the info and complete the handler. I don't have a linux system to work with for 
this.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


___
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: Notification of compilation

2015-02-28 Thread Michael Doub
Thanks guys.   I was successfully able to put in a check so when the 
script containing the library part of the MasterLibrary is successfully 
"applied" the index is automatically create.  No more need to remember 
to hit the refresh button.


Regards,
   Mike



On 2/28/15 5:12 PM, Mark Schonewille wrote:
Nice, Peter. I didn't know about this one. I guess it makes my answer 
redundant.


--
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 2/28/2015 22:52, Peter Haworth wrote:

Try seSetObjectState in a front script. It has two parameters, first is
the object being compiled and second will have a value of "applied" 
after a

successful compile.

On Sat Feb 28 2015 at 1:36:06 PM  wrote:


I am fond of saying that one of the best things about LC is that
everything is a stack.


But nothing shows up in the message watcher, with IDE messages 
permitted,

when you compile a script. Must be something deeper, or such things are
blocked. One would think, with perfect transparency, that at least the
mouse messages in the "Apply" button would register.


Craig Newman



-Original Message-
From: Michael Doub 
To: How To use LiveCode use LiveCode 
Sent: Sat, Feb 28, 2015 1:28 pm
Subject: Notification of compilation


Does anyone know if there is way to detect when a specific objects
script has be compiled?  I am thinking that there must be because the
script editor seems to know when a script has been changed outside the
editor.   I have been looking thru the IDE stack and have not found a
clue yet.

Any ideas or pointers as to where to look?

Thanks
Mike


___
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


Notification of compilation

2015-02-28 Thread Michael Doub
Does anyone know if there is way to detect when a specific objects 
script has be compiled?  I am thinking that there must be because the 
script editor seems to know when a script has been changed outside the 
editor.   I have been looking thru the IDE stack and have not found a 
clue yet.


Any ideas or pointers as to where to look?

Thanks
  Mike


___
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: matchText question

2015-02-28 Thread Michael Doub

Dick,

I my case.  The handlerList is not found.   I tried in 7.0.3.

-= Mike


On 2/27/15 9:39 PM, Dick Kriesel wrote:

On Feb 27, 2015, at 3:17 PM, Peter M. Brigham  wrote:

Is handlerList() a built-in LC function? Or a proprietary function? When I try 
it in LC 5.5.1 it can't find the function, so if it's a native function it's in 
a later version. I've built my own workaround, but using revAvailableHandlers 
would be a shortcut if it works reliably.

Yes.  No.  It works for me in 5.5.1.  What happens when you try it?

-- Dick
___
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: LiveCode 7.0.3: a new meme

2015-02-26 Thread Michael Doub
I must say that I agree with Eric on this one.   I never use Unicode and 
the size and performance penalties do not seem like a reasonable 
tradeoff.   I do understand your point about having to maintain multiple 
versions.  I would suggest that solving selectively removing the unicode 
dictionary is the highest priority (if that is in fact the cause of the 
bloat.).   If the size is perceived to be too big for use, then the 
issues of bugs and performance are indeed secondary.


I am a huge fan of livecode and I am anxiously awaiting widgets but I 
fear that is also going to have a significant impact on the size.


-= Mike


On 2/26/15 4:41 PM, Eric Corbett wrote:

Richard,

I’m wondering if the standalone engine size is a concern for anyone else. I 
have a standalone for iOS that is 3 times smaller when built with 6 over 7. I 
think I understand that the unicode dictionary is responsible, but until there 
is a way to selectively remove that, I would rather have the smaller footprint.

Eric

On Feb 26, 2015, at 12:45 PM, Richard Gaskin  wrote:


The road to enhanced support for Cocoa, Unicode, GTK, iOS, and all the other 
things that make up v7 has been a long one, and while it's not been without 
difficulty this third point release seems very promising.

But don't take my word for it.  I'm just a fanboy - you can safely ignore 
anything I write. :)

Instead, enjoy this post I came across in the forums today for a fresh take on 
v7 - excerpt:

So I got to try out LiveCode 7.0.3 today and I have to say I
am impressed, the engine is the fastest I've used since the
open source revamp began


His post is well worth reading, and in my thank you reply I also included some 
details about that performance boost in 7.0.3 and an earlier change with 
copy-on-write-only which may be of interest to those who've seen performance 
issues in the past.


Looking ahead:

Right now RunRev maintains three versions, 6.x, 7.x, and 8.x.  This is of 
course more expensive than maintaining two, so it's in everyone's interest to 
see a productive migration to v7 ASAP so we can have the team focusing on the 
things we truly need rather than just patching the past.

"Version 6, we loved ya', but we gotta move on to the present."

But of course this needs to be truly productive, and that's where you come in.

In the past we've discussed isolated benchmarks, but as Peter Brett explained 
here a few weeks ago, and Ben explained to me in more detail in our last 
meeting, the changes in v7's core are so deep and pervasive that isolated 
benchmarks are far less useful than we might think.

In some areas, given the larger amount of data and automatic encoding detection 
for Unicode, we know some aspects of v7 will be slower.

But in many other areas, with copy-on-write-only and other algorithmic changes 
under the hood, many other areas have become much faster.

So the real focus now is two-fold:

#1 Priority: Bugs
-
If you're seeing a bug in v7.0.3 that you do not see in v6.7.3, please report 
it ASAP.

Of course data-loss bugs will get priority, and bugs for which simple 
workarounds exist may get a lower priority.  But let's do make sure we catalog 
any issues unique to v7 so we can all move forward with confidence.


#2 Priority: Performance

Given the holistic nature of the changes in v7, the key here is to find 
applications that are noticeably slower.  If you have one, send it to support 
AT runrev.com with a note explaining where the performance difference can be 
found.

No need to worry about trade secrets and all that:  RunRev regularly works with 
very sensitive projects, and discards everything noted as such as soon as their 
analysis is complete.

The main thing is that they see it, so if you see a noticeable performance loss 
and are concerned about sensitivity of the materials, please at least write to 
them describing the issue and your concerns and let's find a way to take care 
of it.


I write this as an ardent fan of v6.7.x.  It's been good to me, and it's 
enjoyed a favored position in my Mac's Dock and my Ubuntu Launcher.

But as of today I'm migrating all new work to v7. I want 2D physics, GPU 
rendering, stack views, and more, and those only take longer as long as the 
core team is saddled with v6.x backports.

And for us Linux fanboys, much the enhanced GTK support we crave is already in 
v7 (thanks, Fraser!).

If you have any other concerns about migrating your work to v7, let me know.  
Probably best to discuss them here so we can all benefit, but if it's a 
sensitive issue you can send me an email if you prefer and I'll do my best to 
reply quickly.

--
Richard Gaskin
LiveCode Community Manager
rich...@livecode.org

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

Re: matchText question

2015-02-26 Thread Michael Doub

Thanks for the feedback.  I did not know about revAvailableHandlers.

Responding to Mark's comment about what I am trying to do.   I tried the 
MasterLibrary on 7.x and the performance was terrible.  I decided to 
change the implementation to create an index of pointers to the meta 
data around the start and end of each code block.   The previous method 
was to scan for the elements as needed.   Somehow I got it into my head 
that it was related to the way I was doing pattern matching when trying 
to parse the meta data.  I was using a series of matchText statements 
with fairly simple patterns.   I thought that I would try and reduce the 
number of matchTexts by using a more complicated regexp.   My post was a 
request for help regarding that regexp.   As it turns out, that this 
whole adventure could have been avoided if I had better understood the 
performance implications of the different repeat forms.


That all said.   Are you guys aware of any performance analysis tools 
for livecode developers?  I am wondering if it would be reasonable to 
create a development mode within the engine that would gather 
information that would help the developer better understand the behavior 
of the app.


Any thoughts?

Regards,
   Mike


On 2/25/15 10:14 PM, Richard Gaskin wrote:

Mark Wieder wrote:


Mike-

Wednesday, February 25, 2015, 11:45:21 AM, you wrote:


Am I doing something really crazy here?


Depends maybe on what you're trying to do. If you're looking for a
list of handlers in a script, here's what I use:

function getHandlersList pScript
  local tHandlers
  filter pScript with "end*"
  repeat for each line tLine in pScript
put word 2 of tLine & cr after tHandlers
  end repeat
  return tHandlers
end getHandlersList


One more way:

get the revAvailableHandlers of tSomeObject




___
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] New version of MasterLibrary

2015-02-26 Thread Michael Doub

Release 31 is available...

Wow!  I had heard of the difference in speed of using repeat with vs 
repeat for each but I had no idea the difference could be so profound.  
Sorry for releasing this the next day after making release 30 available, 
but the performance difference is so great I felt, I had to.


And Jim, you are very welcome.   I hope you find it useful.

-= Mike

https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0



On 2/25/15 6:37 PM, Jim Lambert wrote:

Michael,

thank you for this.

Jim Lambert

___
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: matchText question

2015-02-26 Thread Michael Doub
Here are the numbers for the 7.0.3 and 6.7.3.   Moving in the right 
direction.


7.0.3:
Original: 440
Latest: 485

6.7.3
Original: 117
Latest: 133

I am still blown away by the difference in using repeat for each and 
repeat with.   What a great lesson that will not be forgotten.


-= Mike


On 2/25/15 8:27 PM, Michael Doub wrote:

Whew, it is now:

Original: 449
Latest:487  on 7.0.2 ( rc2)

and
Original: 121
Latest:138  on 6.6.4

This is the difference between   repeat with i = 1 to whatever and 
repeat for each line i in whatever.  Wow!


-= Mike


On 2/25/15 7:38 PM, Mike Bonner wrote:

Wow, thats awful.

On Wed, Feb 25, 2015 at 5:27 PM, Michael Doub  
wrote:



Yuck... I just tried this on 7.0.2 (rc2)

Original:  11184
Latest: 11321


On 2/25/15 7:23 PM, Michael Doub wrote:

if any one is interested.   I did this hoping that it would speed 
up my

parsing.  As it turns out my original version was faster. The original
had 8 separate matchTexts with straight forward expresions, where 
the last

version had 2 matchtexts with expressions lots of alternatives.

Original:  1620 millisec
Latest: 1641 millisec

For the curious: https://www.dropbox.com/s/20j4iy4oomrr12c/Parser.
livecode?dl=0

Thanks again for everyone's help.

-= Mike



On 2/25/15 6:52 PM, Mike Bonner wrote:

"^\s*(/\*).*" \ works, if you're trying to match 
opening /*

comments.
If you're trying to match lines that start with * thats a different
story.
\* matches asterisk.  /\* matches /*
If you want to grab the whole comment line move the .* inside the 
parens.
Not sure what the "include" line you're trying to match should 
look like

either, something funky up there, but without seeing what you need to
match, its hard to figure out.

On Wed, Feb 25, 2015 at 4:31 PM, Mike Bonner  
wrote:


  Hey, correct me if i'm wrong, but \w+ is a geedy word grab 
right?  Which
should grab to the end if the line.. Seems like the .*+ wouldn't 
even be
necessary... Yep, just checked. Its not. The only part I can't 
get to

work
is the last line for /*.  Not sure what it is i'm not seeing.

On Wed, Feb 25, 2015 at 3:53 PM, Mike Bonner 
wrote:

  Yes, it was to me too. Though, I did end up breaking it down into

singles
and they all behaved the same, which made it easier to take a WAG.
Less
wild than it would have otherwise been. Find the thing that's 
the same

for
each part, and decide if its broke.

On Wed, Feb 25, 2015 at 2:50 PM, stephen barncard <
stephenrevoluti...@barncard.com> wrote:

  On Wed, Feb 25, 2015 at 12:29 PM, Mike Bonner 


wrote:

  Try this instead..

  put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
   "^\s*(on)\s+(\w+).*+|" & \
   "^\s*(function)\s+(\w+).*+|" & \
   "^\s*(command)\s+(\w+).*+|" & \
   "^\s*(private\s+function)\s+(\w+).*+|" & \
   "^\s*(private\s+command)\s+(\w+).*+|" & \
   "^\s*(\/\*\s+include).*+|" &  \
"^\s*(\*\/).*+" \
   into expr

  breaking down and displaying complex REGEX this way is very 
helpful.

*--*
*Stephen Barncard - San Francisco Ca. USA - Deeds Not Words*
___
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: matchText question

2015-02-25 Thread Michael Doub

Whew,   it is now:

Original: 449
Latest:487  on 7.0.2 ( rc2)

and
Original: 121
Latest:138  on 6.6.4

This is the difference between   repeat with i = 1 to whatever and 
repeat for each line i in whatever.  Wow!


-= Mike


On 2/25/15 7:38 PM, Mike Bonner wrote:

Wow, thats awful.

On Wed, Feb 25, 2015 at 5:27 PM, Michael Doub  wrote:


Yuck... I just tried this on 7.0.2 (rc2)

Original:  11184
Latest: 11321


On 2/25/15 7:23 PM, Michael Doub wrote:


if any one is interested.   I did this hoping that it would speed up my
parsing.  As it turns out my original version was faster.   The original
had 8 separate matchTexts with straight forward expresions, where the last
version had 2 matchtexts with expressions lots of alternatives.

Original:  1620 millisec
Latest: 1641 millisec

For the curious: https://www.dropbox.com/s/20j4iy4oomrr12c/Parser.
livecode?dl=0

Thanks again for everyone's help.

-= Mike



On 2/25/15 6:52 PM, Mike Bonner wrote:


"^\s*(/\*).*" \ works, if you're trying to match opening /*
comments.
If you're trying to match lines that start with * thats a different
story.
\* matches asterisk.  /\* matches /*
If you want to grab the whole comment line move the .* inside the parens.
Not sure what the "include" line you're trying to match should look like
either, something funky up there, but without seeing what you need to
match, its hard to figure out.

On Wed, Feb 25, 2015 at 4:31 PM, Mike Bonner  wrote:

  Hey, correct me if i'm wrong, but \w+ is a geedy word grab right?  Which

should grab to the end if the line.. Seems like the .*+ wouldn't even be
necessary... Yep, just checked. Its not. The only part I can't get to
work
is the last line for /*.  Not sure what it is i'm not seeing.

On Wed, Feb 25, 2015 at 3:53 PM, Mike Bonner 
wrote:

  Yes, it was to me too. Though, I did end up breaking it down into

singles
and they all behaved the same, which made it easier to take a WAG.
Less
wild than it would have otherwise been. Find the thing that's the same
for
each part, and decide if its broke.

On Wed, Feb 25, 2015 at 2:50 PM, stephen barncard <
stephenrevoluti...@barncard.com> wrote:

  On Wed, Feb 25, 2015 at 12:29 PM, Mike Bonner 

wrote:

  Try this instead..

  put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
   "^\s*(on)\s+(\w+).*+|" & \
   "^\s*(function)\s+(\w+).*+|" & \
   "^\s*(command)\s+(\w+).*+|" & \
   "^\s*(private\s+function)\s+(\w+).*+|" & \
   "^\s*(private\s+command)\s+(\w+).*+|" & \
   "^\s*(\/\*\s+include).*+|" &  \
"^\s*(\*\/).*+" \
   into expr

  breaking down and displaying complex REGEX this way is very helpful.

*--*
*Stephen Barncard - San Francisco Ca. USA - Deeds Not Words*
___
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: matchText question

2015-02-25 Thread Michael Doub

Yuck... I just tried this on 7.0.2 (rc2)

Original:  11184
Latest: 11321

On 2/25/15 7:23 PM, Michael Doub wrote:
if any one is interested.   I did this hoping that it would speed up 
my parsing.  As it turns out my original version was faster.   The 
original had 8 separate matchTexts with straight forward expresions, 
where the last version had 2 matchtexts with expressions lots of 
alternatives.


Original:  1620 millisec
Latest: 1641 millisec

For the curious: 
https://www.dropbox.com/s/20j4iy4oomrr12c/Parser.livecode?dl=0


Thanks again for everyone's help.

-= Mike



On 2/25/15 6:52 PM, Mike Bonner wrote:

   "^\s*(/\*).*" \ works, if you're trying to match opening /*
comments.
If you're trying to match lines that start with * thats a different 
story.

\* matches asterisk.  /\* matches /*
If you want to grab the whole comment line move the .* inside the 
parens.

Not sure what the "include" line you're trying to match should look like
either, something funky up there, but without seeing what you need to
match, its hard to figure out.

On Wed, Feb 25, 2015 at 4:31 PM, Mike Bonner  wrote:

Hey, correct me if i'm wrong, but \w+ is a geedy word grab right?  
Which
should grab to the end if the line.. Seems like the .*+ wouldn't 
even be
necessary... Yep, just checked. Its not. The only part I can't get 
to work

is the last line for /*.  Not sure what it is i'm not seeing.

On Wed, Feb 25, 2015 at 3:53 PM, Mike Bonner  
wrote:


Yes, it was to me too. Though, I did end up breaking it down into 
singles
and they all behaved the same, which made it easier to take a WAG.  
Less
wild than it would have otherwise been. Find the thing that's the 
same for

each part, and decide if its broke.

On Wed, Feb 25, 2015 at 2:50 PM, stephen barncard <
stephenrevoluti...@barncard.com> wrote:


On Wed, Feb 25, 2015 at 12:29 PM, Mike Bonner 
wrote:


Try this instead..
 put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
  "^\s*(on)\s+(\w+).*+|" & \
  "^\s*(function)\s+(\w+).*+|" & \
  "^\s*(command)\s+(\w+).*+|" & \
  "^\s*(private\s+function)\s+(\w+).*+|" & \
  "^\s*(private\s+command)\s+(\w+).*+|" & \
  "^\s*(\/\*\s+include).*+|" &  \
   "^\s*(\*\/).*+" \
  into expr


breaking down and displaying complex REGEX this way is very helpful.

*--*
*Stephen Barncard - San Francisco Ca. USA - Deeds Not Words*
___
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: matchText question

2015-02-25 Thread Michael Doub
if any one is interested.   I did this hoping that it would speed up my 
parsing.  As it turns out my original version was faster.   The original 
had 8 separate matchTexts with straight forward expresions, where the 
last version had 2 matchtexts with expressions lots of alternatives.


Original:  1620 millisec
Latest: 1641 millisec

For the curious: 
https://www.dropbox.com/s/20j4iy4oomrr12c/Parser.livecode?dl=0


Thanks again for everyone's help.

-= Mike



On 2/25/15 6:52 PM, Mike Bonner wrote:

   "^\s*(/\*).*" \ works, if you're trying to match opening /*
comments.
If you're trying to match lines that start with * thats a different story.
\* matches asterisk.  /\* matches /*
If you want to grab the whole comment line move the .* inside the parens.
Not sure what the "include" line you're trying to match should look like
either, something funky up there, but without seeing what you need to
match, its hard to figure out.

On Wed, Feb 25, 2015 at 4:31 PM, Mike Bonner  wrote:


Hey, correct me if i'm wrong, but \w+ is a geedy word grab right?  Which
should grab to the end if the line.. Seems like the .*+ wouldn't even be
necessary... Yep, just checked. Its not. The only part I can't get to work
is the last line for /*.  Not sure what it is i'm not seeing.

On Wed, Feb 25, 2015 at 3:53 PM, Mike Bonner  wrote:


Yes, it was to me too. Though, I did end up breaking it down into singles
and they all behaved the same, which made it easier to take a WAG.  Less
wild than it would have otherwise been. Find the thing that's the same for
each part, and decide if its broke.

On Wed, Feb 25, 2015 at 2:50 PM, stephen barncard <
stephenrevoluti...@barncard.com> wrote:


On Wed, Feb 25, 2015 at 12:29 PM, Mike Bonner 
wrote:


Try this instead..
 put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
  "^\s*(on)\s+(\w+).*+|" & \
  "^\s*(function)\s+(\w+).*+|" & \
  "^\s*(command)\s+(\w+).*+|" & \
  "^\s*(private\s+function)\s+(\w+).*+|" & \
  "^\s*(private\s+command)\s+(\w+).*+|" & \
  "^\s*(\/\*\s+include).*+|" &  \
   "^\s*(\*\/).*+" \
  into expr


breaking down and displaying complex REGEX this way is very helpful.

*--*
*Stephen Barncard - San Francisco Ca. USA - Deeds Not Words*
___
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: matchText question

2015-02-25 Thread Michael Doub

Thanks Mike and Peter.   This seems to have addressed the issue.

-= Mike


On 2/25/15 4:09 PM, Peter Haworth wrote:

Good catch.  I think the "*" in the original version referred to "\w+" so
that's probably what messed it up.

On Wed Feb 25 2015 at 12:30:15 PM Mike Bonner  wrote:


Try this instead..
 put "(?i)^\s*(\-\-\s+begin)\s+(\w+).*+|" & \
  "^\s*(on)\s+(\w+).*+|" & \
  "^\s*(function)\s+(\w+).*+|" & \
  "^\s*(command)\s+(\w+).*+|" & \
  "^\s*(private\s+function)\s+(\w+).*+|" & \
  "^\s*(private\s+command)\s+(\w+).*+|" & \
  "^\s*(\/\*\s+include).*+|" &  \
   "^\s*(\*\/).*+" \
  into expr

You are using an * to match anything, but for some reason it seems to be
messing things up.  If you add the . (period) before it to match any char,
then the asterisk knows what its matching any number of.  (impressive
sentence ending there)

Have tested a little, it seems to solve it, though i'm not sure why.

On Wed, Feb 25, 2015 at 12:45 PM, Michael Doub  wrote:


Am I doing something really crazy here?  There is no way that the result
will be true.   Replace the " hhh "  with "*/" and you still get true but
it is not doing the capture.   Replace the " hhh " with "function foo"

and

you get an expected response.

Should I even expect alternatives to be supported?

-= Mike


on mouseUp
 put "(?i)^\s*(\-\-\s+begin)\s+(\w+)*+|" & \
  "^\s*(on)\s+(\w+)*+|" & \
  "^\s*(function)\s+(\w+)*+|" & \
  "^\s*(command)\s+(\w+)*+|" & \
  "^\s*(private\s+function)\s+(\w+)*+|" & \
  "^\s*(private\s+command)\s+(\w+)*+|" & \
  "^\s*(\/\*\s+include)*+|" & \
   "^\s*(\*\/)*+" \
  into expr
 get MatchText(" hhh ",expr,r1,r2,r3,r4,r5,r6,r7,
r8,r9,r10,r11,r12,r13,r14)
answer it & cr & r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
end mouseUp

___
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


matchText question

2015-02-25 Thread Michael Doub
Am I doing something really crazy here?  There is no way that the result 
will be true.   Replace the " hhh "  with "*/" and you still get true 
but it is not doing the capture.   Replace the " hhh " with "function 
foo" and you get an expected response.


Should I even expect alternatives to be supported?

-= Mike


on mouseUp
put "(?i)^\s*(\-\-\s+begin)\s+(\w+)*+|" & \
 "^\s*(on)\s+(\w+)*+|" & \
 "^\s*(function)\s+(\w+)*+|" & \
 "^\s*(command)\s+(\w+)*+|" & \
 "^\s*(private\s+function)\s+(\w+)*+|" & \
 "^\s*(private\s+command)\s+(\w+)*+|" & \
 "^\s*(\/\*\s+include)*+|" & \
  "^\s*(\*\/)*+" \
 into expr
get MatchText(" hhh 
",expr,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14)

   answer it & cr & r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14
end mouseUp

___
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


[ANN] New version of MasterLibrary

2015-02-25 Thread Michael Doub
A new version of the MasterLibrary is available at the link below. Since 
the library has grown so much, it was feeling a bit sluggish, so I did 
some refactoring that greatly reduced the amount of parsing of the 
library and went to an index based approach.   I have no idea why I did 
not take this approach in the first place, as it is both faster and 
significantly less code.


I submitted the old version with a performance related bug submission, 
in hopes that it might help the development team identify performance 
issues in the 7.x series.  The same code on the 6.x and 7.x runs very 
differently.With the new version, you only experience a delay at 
startup and when the index is rebuilt. Unfortunately it is still slower 
on 7.0.


Enjoy...
   Mike


https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=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


Re: Because LC can't do two things at once.

2015-02-22 Thread Michael Doub
Thanks for pointing that out Kay.   I was curious to understand the 
differences and I found the following which might be of interest to 
folks.  I cut it from 
http://www.regular-expressions.info/javascript.html .  As a casual regex 
user I have never had a problem, but your point is still very valid.


-= Mike

-

JavaScript supports the following modifiers, a subset of those supported 
by Perl:


/g enables "global" matching. When using the replace() method, specify 
this modifier to replace all matches, rather than only the first one.

/i makes the regex match case insensitive.
/m enables "multi-line mode". In this mode, the caret and dollar match 
before and after newlines in the subject string.
You can combine multiple modifiers by stringing them together as in 
/regex/gim. Notably absent is an option to make the dot match line break 
characters.


Since forward slashes delimit the regular expression, any forward 
slashes that appear in the regex need to be escaped. E.g. the regex 1/2 
is written as /1\/2/ in JavaScript.


There is indeed no /s modifier to make the dot match all characters, 
including line breaks. To match absolutely any character, you can use 
character class that contains a shorthand class and its negated version, 
such as [\s\S].


JavaScript implements Perl-style regular expressions. However, it lacks 
quite a number of advanced features available in Perl and other modern 
regular expression flavors:


No \A or \Z anchors to match the start or end of the string. Use a caret 
or dollar instead.

Lookbehind is not supported at all. Lookahead is fully supported.
No atomic grouping or possessive quantifiers.
No Unicode support, except for matching single characters with \u.
No named capturing groups. Use numbered capturing groups instead.
No mode modifiers to set matching options within the regular expression.
No conditionals.
No regular expression comments. Describe your regular expression with 
JavaScript // comments instead, outside the regular expression string.



On 2/22/15 10:18 AM, Kay C Lan wrote:

On Sun, Feb 22, 2015 at 5:59 AM, Michael Doub  wrote:


http://www.regular-expressions.info/charclasssubtract.html  -- great
tutorials and lots of examples
https://regex101.com  -- my favorite testing engine, I love the way it
explains what is actually going on
http://www.regexr.com  -- a whole library of interesting examples in the
community area.

It should be noted that only regex101.com gives you the option to choose

the flavour of regex to test. Most online regex sites use JavaScript yet LC
uses the PCRE regex Library so it is possible on other sites that regex
examples may not give the same results within LC.

If planning to use regex within LC I strongly recommend using regex101.com
and selecting pcre(php) from the top left 3 options.
___
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: Because LC can't do two things at once.

2015-02-21 Thread Michael Doub
Here are three really good web sites that can help with regexp.   I 
don't consider myself an expert by any means but I feel like I am now 
getting the hang of it.  I give the credit to the creators of these 
sites.   Such a valuable asset.


-= Mike


http://www.regular-expressions.info/charclasssubtract.html  -- great 
tutorials and lots of examples
https://regex101.com  -- my favorite testing engine, I love the way it 
explains what is actually going on
http://www.regexr.com  -- a whole library of interesting examples in the 
community area.




On 2/21/15 2:24 PM, Peter Haworth wrote:

I like what you said about "not speaking Regex".  I think that's the
biggest problem people have with Regex: it's a language and if you don't
know the syntax rules of any language, it doesn't make sense.  Good analogy.

Here's the regex for extracting what you want from the Mac output:

'(\w*)

Translated into English, it means "Look for a ' character and return all
characters after it in the range A-Z, or a-z, or 0-9 until you come across
a character that is not in that range"

Armed with that, the single statement below gets you "AC" or "Battery"

matchText(tSource,"'(\w*)",tPowerSource)

I'd be happy to supply the regex for the other platforms if someone
supplies the format of the output.

On Sat Feb 21 2015 at 8:03:50 AM Peter M. Brigham  wrote:


On Feb 21, 2015, at 2:59 AM, Richard Gaskin wrote:


Peter M. Brigham wrote:


Just out of curiosity, how *would* you do this via shell call or
the equivalent on a Windows laptop?

Good question.

Thanks to the beautiful simplicity of the Linux /proc directory I was

able to find:

cat /proc/acpi/battery/BAT1/state

The "charging state" field there will contain "charging" or

"discharging".

Now if we can turn up a Win command line solution I'll write a handler

for this that'll make it convenient to get this info on all three platforms.

That was my thought too. I was waiting for more info, but I started with
the handler(s) below. I don't speak Regex so I converted that line to use a
native LC function instead, getNestedItem() -- from your function posted
here several months ago, Richard, called nDepth(). I use this so often that
its now an essential part of my library. It's much more comprehensible to
me than Regex, though it can't do everything Regex can. So the quantity of
code below is really mostly utility handlers and the basic
getMacPowerSource() is very compact, as was the original.

I'll leave the other platforms to you, Richard. (If you use Regex, I'll
translate it!   :-)  )


Martin, thanks for handling the Mac side - nice work.

Yes, thanks!

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

---

function getMacPowerSource
   -- returns the current power source for a Mac
   --"AC" or "Battery"
   -- requires getNestedItem() getItem(), getDelimiters()
   put shell ("pmset -g batt") into tSource
   -- returns something like:
   --Currently drawing from 'AC Power'
   ---InternalBattery-0  99%; finishing charge; 0:00 remaining
   return getNestedItem(tSource,2,"'",1,space)
end getMacPowerSource

function getNestedItem
   -- allows specifying different delimiters to extract nested chunks
   --getNestedItem(tData,index1,delim1,index2,delim2,...)
   -- eg, put "aaa,bbb,ccc*ddd*eee*fff,ggg,hhh" into tData
   -- put getNestedItem(tData,3,comma,2,"*") -> "ddd"
   --*-delim item 2 of comma-delim item 3
   -- specified delimiters can be strings, not just single characters,
   -- so the following extracts the top-level domain name from a URL:
   --put "http://www.nytimes.com/pages/science/index.html/"; into tURL
   --put getNestedItem(tURL,2,"://",1,"/") -> www.nytimes.com
   -- based on a function by Richard Gaskin, use-LC list, originally named
nDepth()
   --debugged by members of the use-LC list,
   --expanded by Peter M. Brigham, pmb...@gmail.com
   -- the result is a very versatile tool for extracting strings from any
text
   --with a known structure
   -- requires getItem(), getDelimiters()

   put paramcount() into prmCount
   if prmCount mod 2 <> 1 or prmCount = 1 then
  return "getNestedItem(): error in parameters."
   end if
   put param(1) into workingString
   repeat with i = 2 to prmCount-1 step 2
  if workingString = empty then return empty
  put param(i) into pItemNbr
  put param(i+1) into tDelim
  put getItem(workingString,pItemNbr,tDelim) into workingString
   end repeat
   return workingString
end getNestedItem

function getItem pList, pIndex, pDelim
   -- returns item # pIndex of pList, given itemdelimiter = pDelim
   -- could just "get item pIndex of pList" in the calling handler but
   --then have to set and restore the itemDelimiter, so this is less
hassle
   -- defaults to pDelim = tab
   -- allows pDelim to be a string of characters
   --so you could do this:
   --getItem("a//b//c//d//e//f",4,"//") -> d
   -- also allows pIndex to be a r

Re: Mobile cloud storage

2015-02-04 Thread Michael Doub

Richard,

The only one that I am aware of is phxDropboxLib for Dropbox.

I would not mind taking on this project if I could team up with someone 
for help understanding the authorization parts of each.   I still have 
not gotten my head wrapped around how this is supposed to work and all 
of the API docs that I have read seem assume you understand it...and I 
don't!   Upfront design collaboration would be helpful as well if the 
goal is to have a common interface.


Regards,
   Mike


On 2/3/15 6:03 PM, Richard Gaskin wrote:
So most folks have either iCloud, Goggle Drive, Dropbox, or OwnCloud, 
and using those sure beats building a complex storage backend for 
simple apps.


Does our community have yet a library for allowing the user to pick 
which common storage system they have and an API for reading/writing 
to it?





___
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] New version of the MasterLibrary is available

2015-02-01 Thread Michael Doub

Thanks for catching that bug.   It is now fixed in 25.

As far as the search, have you tried the filter option?  It may not be 
as obvious as it should be.  When you check the filter button, the 
selection tree turns into a filterable list of handler name and topics.  
You then have a character by character filtering of the list, rather 
than a search function.if you check "only selected" it will only 
display items that have been selected by double clicking.   This is 
helpful if you are adding something to an existing library stack.


If this does not meet your needs let me know off list and we can discuss 
a better way.


Regards,
   Mike



On 2/1/15 1:20 PM, Peter Haworth wrote:

Hi Michael,
Thanks for keeping this up to date.

One tiny cosmetic thing.  When you check for a new version, the heading in
the file dialog refers to "newver" instead of the actual new version number.

A suggestion for you (unless I missed it).  As the library gets bigger, it
might be useful to have a handler name search function.  It's not always
obvious which category a handler is in :-)

Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Sun, Feb 1, 2015 at 10:02 AM, Michael Doub  wrote:


Release 24
*added:
 __Zap - a function that returns only POSIX printable characters,
space, tab and return from a
string
 __GetRegexMatches - Finds all the matches of pregex in ptext and
returns a list of the
start,end char positions
 __deleteExtraTokens - This fuction witll remove sequences of the
specified token that are greater than
one.
__combinatorial - returns all possible subsets of a set, where n = #
of objects in the set
__nComb - Returns the # of combinations of n objects taken r at a time
__factorial - Returns x!
__latLongDist - Finds distances  between two points based on Latitude
and Longitude
__dd2dms - Converts a digital longitude or Latitude into degrees,
minutes, seconds, direction format.
__dms2dd - Converts a degrees, minutes, seconds, direction longitude or
latitude to digital format

https://www.dropbox.com/s/3wpwn3hfbmpl7sk/MasterLibrary.livecode?dl=0

Enjoy...

___
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


  1   2   3   4   >