Re: IP Calculator Final Version

2015-01-26 Thread Bob Sneidar
Hi Mike. May have spoke too soon. Apparently I need to check for empty octets 
because apparently this will only sometimes get caught in the error checking. 
Now I am going to have to *really* go through this. However, if proper values 
are provided the function works as expected so I would let it stand for now and 
I can provide an updated version for the next revision if there is one.

Bob S


On Jan 26, 2015, at 09:50 , Michael Doub 
mailto:miked...@gmail.com>> wrote:

Here is the version of the MasterLibrary (version 22) with Bob's IP Calculator 
integrated.

___
use-livecode mailing list
use-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: IP Calculator Final Version

2015-01-26 Thread Bob Sneidar
So now I modify the condition to look like this:

   set the itemdelimiter to "."
   repeat for each item theOctet in theIPAddress
  if theOctet is empty or theOctet < 0 or theOctet > 255 then
 return "ERROR: Each IP Address octet must be a number between 0 and 
255. " & \
   "(ipaddress = " & theIPAddress & ")"
  end if
   end repeat

Note the check for the octet being empty. NOW it fails the condition every 
time. What this means is that sometimes the engine thinks empty is less than 0 
and sometimes it does not. Otherwise it means that sometimes an item which 
ought to be empty is not, and sometimes it is. Is this scaring anyone besides 
me? I am calling the function containing this code from the message box. I 
could go through the process of running it from a button but frankly having 
been able to force the engine to check for empty, I have solved the problem for 
now. But if anyone comes across something similar, it isn’t a gremlin. Or is 
it…???

Using version 6.7.0 build 5012

Bob S


On Jan 26, 2015, at 16:53 , Bob Sneidar 
mailto:bobsnei...@iotecdigital.com>> wrote:

OK I think I have another script compilation. Given an IP address of 192.168..1

  set the itemDelimiter to “.”

  repeat for each item theOctet in theIPAddress
 if theOctet <0 or theOctet >255 then
return "ERROR: Each IP Address octet must be a number between 0 and 
255. " & \
  "(ipaddress = " & theIPAddress & ")"
 end if
  end repeat

Should return an error on the third pass. It does not. Even though empty is in 
fact less than 0, it passes the condition! Oh but wait, it gets better.

I stepped through the code, and at first it passed, but then I put in a 
statement just before the condition:

 put theOctet is empty

On the third pass it put true into the message box then FAILED THE TEST! 
Subsequent calls to the function continued to fail! Then I stopped stepping and 
recompiled the script and saved it. IT STARTED PASSING AGAIN!

This is some crazy crap! The same code should not be behaving differently 
depending on whether or not I am stepping or not.

Bob S

___
use-livecode mailing list
use-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: IP Calculator Final Version

2015-01-26 Thread Bob Sneidar
OK I think I have another script compilation. Given an IP address of 192.168..1

   set the itemDelimiter to “.”

   repeat for each item theOctet in theIPAddress
  if theOctet <0 or theOctet >255 then
 return "ERROR: Each IP Address octet must be a number between 0 and 
255. " & \
   "(ipaddress = " & theIPAddress & ")"
  end if
   end repeat

Should return an error on the third pass. It does not. Even though empty is in 
fact less than 0, it passes the condition! Oh but wait, it gets better. 

I stepped through the code, and at first it passed, but then I put in a 
statement just before the condition:

  put theOctet is empty

On the third pass it put true into the message box then FAILED THE TEST! 
Subsequent calls to the function continued to fail! Then I stopped stepping and 
recompiled the script and saved it. IT STARTED PASSING AGAIN!

This is some crazy crap! The same code should not be behaving differently 
depending on whether or not I am stepping or not. 

Bob S
___
use-livecode mailing list
use-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: Unicode

2015-01-26 Thread Peter Haworth
Well I guess I spoke too soon :-)  When I said I had things working, I
meant I could successfully get data from a UTF8 database and display it
correctly.

I'm now trying to get input from field controls and get it into the
database.  I found a lorem ipsum generator that would create text in
various languages to I got some Russian text from it and pasted it into an
LC field.

In my handler, I need to put the contents of the field into a variable and
then hand it off from there to an INSERT statement. I've tried every
combination of unicodeText, uniencode, unidecode, or none of the above to
get the correct value into the variable but it either ends up as question
marks or something that looks nothing like the characters in the field.

This is all with pre 7.0.  I think I'm beginning to understand why 7.0 is a
lot better to use than pre 7.0 when heavy unicode handling is needed!

But in the meantime, how should I be handling the above situation in pre
7.0?

Pete
lcSQL Software 
Home of lcStackBrowser  and
SQLiteAdmin 

On Mon, Jan 26, 2015 at 9:01 AM, Devin Asay  wrote:

>
> On Jan 26, 2015, at 4:42 AM, Fraser Gordon 
> wrote:
>
> >
> > On 26 Jan 2015, at 02:15, Peter Haworth  wrote:
> >
> >> Thanks Peter.  If that's the case, I'm not seeing much in the way of a
> >> coding advantage over pre 7.0.  Sounds like using textEncode/textDecode
> >> instaed of uniencode/unidecode?
> >
> > Assuming you have UTF-8 encoded data from a source outside LiveCode:
> >
> > local tUTF8Data   — This is binary data
> > local tString — This is a textual string
> > put textDecode(tUTF8Data, “UTF-8”) into tString
> >
> > The important difference is that uniEncode becomes textDecode - because
> you are decoding some binary data to text.
> >
> > The big difference between 7.0 and previous versions is that Unicode
> text works everywhere - you don’t need to use special Unicode properties or
> commands any more.
> >
> >>
> >> That does answer another question I had though which is what is needed
> if
> >> the database is UTF-16 encoded.  Sounds like nothing needs to be done.
> I
> >> guess I'll have to set up some tests.
> >
> > If your external data is UTF-16 you still need to textDecode it - if you
> don’t, it will treat the data as 8-bit text and you’ll get corrupted text
> back. This 8-bit default is necessary from a backwards compatibility point
> of view - if we changed it to accept UTF-16 by default, anyone who gets
> text from an external source and doesn’t textDecode it will suddenly find
> that their stacks don’t work.
> >
> > One way of looking at things is that all external interfaces (files,
> processes, etc) return binary data and you need to do something to turn
> that into text (textDecode) and you need to turn your text into binary data
> when writing to them (textEncode). By using something like UTF-8 as an
> encoding, it also avoids the problems that occur because the “native”
> encoding differs between our platforms - it is MacRoman on OSX, CP1252 on
> Windows and ISO-8859-1 on Linux.
> >
> > Regards,
> > Fraser
>
>
> It would be great if there were a stack property we could set that would
> specify what format outputted text would be. The default could be “native”;
> i.e., the native encoding for the platform, but then we could set it to
> things like “utf8” or “utf16” or “ISO”. It would essentially do the
> textEncode/decode for us.
>
> Is this an idea that appeals to folks here?
>
> 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

Re: IP Calculator Final Version

2015-01-26 Thread Bob Sneidar
Oh thanks Alex I will check for those. I though they would be covered in the 
part that checks that each octet is a number between 0 and 255.

As far as the CIDR depth, it is true that technically you can have a CIDR of 
32, but it is not a network that can be used. That would leave no usable 
addresses, and the subnet and broadcast addresses would not be assignable. A 
CIDR of 31 has 2 addresses, neither of them usable by a node, as they would 
have to be the subnet address and the broadcast address.

The highest CIDR that has any node assignable addresses is 30. That has only 2 
usable addresses, and is typically used as the WAN subnet for a single IP 
router, the other being the gateway address.

A CIDR of 0 has no subnet mask, and therefore cannot be used except for a 
multicast network where everything is a node, there is no universal broadcast 
address and no routing is possible.

For the sake of accuracy, I will expand the range to 0 to 32. It will be up to 
the calling function to then determine if their subnet is usable.

Bob S


On Jan 26, 2015, at 12:14 , Alex Tweedly 
mailto:a...@tweedly.net>> wrote:

A couple of error cases that aren't caught gracefully

192.168.1/24.1
192.168..1/24

One that is accepted and shouldn't be
192.168.1.1/24.(note the trailing ".")

Also, not sure why you limit CIDRDepth to between 1 and 30. RFC 4632 
specifically says between 0 and 3 - and indeed host routes (/32s) are common 
enough, as is default route.

Thanks again for contributing this Bob.

-- Alex.

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


Offset and Binary Data

2015-01-26 Thread Alejandro Tejada
Hi Mike,

After running your script, using Livecode 7.0.1
under Windows my result is 4,10

Maybe, this could help.
Add this line before getting offset:
set the casesensitive to true

to read in this way:

on mouseUp
put numtochar(255) & numtochar(216) into tStart
-- in Hexadecimal: FFD8 = SOI(Start of jpeg image)
put numtochar(255) & numtochar(217) into tEnd
-- in Hexadecimal: FFD9 = EOI(End of jpeg image)

put "AAA" & tStart & "DATA"& tEnd & "BBB" into temp1

set the casesensitive to true

put offset(tStart,temp1) into tThumbstart
put offset(tEnd,temp1) into tThumbEnd
answer "Start:" && tThumbstart & cr & "End:" && tThumbEnd
end mouseUp

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


extracting the thumbnail from digital photos?

2015-01-26 Thread Alejandro Tejada
Hi,

This script works in LiveCode 7.0.1
under Windows:

(Notice that I am using byte instead of char
as recommended in release notes and,
unlike Ubuntu, I have to set the casesensitive
to true to make it work)

First, download this 8 MB image that contains
two thumbnails (320x240 and 160x120):
(this link should be in a single line)

http://216.18.212.226/PRODS/fuji-x100t/FULLRES/X100ThSLI00100NR2D.JPG

Create a stack and put this script
in a button:

on mouseUp
   local temp
   answer file "Select JPEG image with EXIF thumbnail data"
   put it into temp
   open file temp for binary read
   read from file temp for 10
   put it into temp1
   close file temp

   put numtobyte(255) & numtobyte(216) into tStart
   -- in Hexadecimal: FFD8 = SOI(Start of jpeg image)
   put numtobyte(255) & numtobyte(217) into tEnd
   -- in Hexadecimal: FFD9 = EOI(End of jpeg image)

   delete byte 1 to 2 of temp1
   -- delete JPEG SOI (Start of jpeg image)
   if byte -2 to -1 of temp1 = tEnd then delete byte -2 to -1 of temp1
   -- delete JPEG EOI(End of jpeg image)

   set the casesensitive to true


repeat until offset(tEnd,temp1) = 0

  -- repeat until offset(tStart,temp1) = 0

   put offset(tStart,temp1) into tThumbstart
   put offset(tEnd,temp1) into tThumbEnd

   put byte tThumbstart to (tThumbEnd + 1) of temp1 into tJPGThumb

   delete byte 1 to (tThumbEnd + 1) of temp1

   if tJPGThumb is not empty
   then
  create img
  set the text of it to tJPGThumb
   else
  answer "No JPEG Thumbnails in this image"
   end if

   end repeat
end mouseUp

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


Re: semi-OT: TestFlight.com beta testing closing

2015-01-26 Thread Mike Kerner
There is also hockeyApp, but I'm not aware of anyone trying to make it work
with LC

On Mon, Jan 26, 2015 at 3:38 PM, Chris Sheffield 
wrote:

> Thanks, Colin. This may help.
>
> In the Runtime folder of the LiveCode application bundle, if you drill
> down into iOS -> Device-[whatever], there is an Entitlements.xcent file.
> I’m assuming this is where that same key could be added. However, there’s
> also a StoreEntitlements.xcent, with the same contents as
> Entitlements.xcent. So I’m not sure which one to make the change in. Maybe
> both? Does anyone know?
>
> At some point RunRev will need to update LC to support his, but in the
> meantime, this may be a viable workaround.
>
> Thanks again.
>
>
> > On Jan 26, 2015, at 12:33 PM, Colin Holgate  wrote:
> >
> > With Adobe AIR you have added this to the app descriptor XML:
> >
> >
> 
> >
> > That then ends up in the embedded provisioning profile. Not sure of the
> steps for LiveCode.
> >
> > Test Flight’s URL is https://www.testflightapp.com/ <
> https://www.testflightapp.com/>, but as you say, it closes on Feb 26th.
> If you have an HTTPS site you can post builds for your testers, but those
> would just be from your list of 100, not from the Test Flight 1000 external
> testers.
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



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

Re: Server performance issues: Dreamhost only?

2015-01-26 Thread Warren Samples

On 01/26/2015 03:28 PM, Warren Samples wrote:

Have any of you seen order-of-magnitude speed loss when running LiveCode
Server on any host other than Dreamhost?





Not at webfaction



It may be relevant to note that all LC Server versions I have installed 
are 32bit, including LC 7. webfaction is still running CentOS 32bit.


Warren



___
use-livecode mailing list
use-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 performance issues: Dreamhost only?

2015-01-26 Thread Warren Samples

On 01/26/2015 01:08 PM, Richard Gaskin wrote:

We've seen reports of serious performance issues with running LiveCode
Server 7.x on Dreamhost.

I'm working with Peter Brett at RunRev to try to resolve these, and
there's one detail that would be very useful to know:

While we see relatively minor speed differences on the desktop, running
LiveCode Serve on Dreamhost has resulted in requests taking as long as
several seconds, far beyond anything we can account for in the engine
itself.

Have any of you seen order-of-magnitude speed loss when running LiveCode
Server on any host other than Dreamhost?

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web



Not at webfaction where I have various versions of LC Server running as 
as cgi via a Caudium server which in turn runs behind nginx (and maybe 
Apache, I'm not sure if they've left the Apache layer in for the 
deployment of webapps, since putting nginx up front, and am too lazy to 
look it up because it still works so why should I care :D). Request 
handling is fractionally slower since LC 6.5 but the discernable delay 
doesn't seem to have increased here for LC 7. I've already reported that 
script handling is 3 to 4 times slower in LC 7, but that's a different 
issue.


Warren

___
use-livecode mailing list
use-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: semi-OT: TestFlight.com beta testing closing

2015-01-26 Thread Chris Sheffield
Thanks, Colin. This may help.

In the Runtime folder of the LiveCode application bundle, if you drill down 
into iOS -> Device-[whatever], there is an Entitlements.xcent file. I’m 
assuming this is where that same key could be added. However, there’s also a 
StoreEntitlements.xcent, with the same contents as Entitlements.xcent. So I’m 
not sure which one to make the change in. Maybe both? Does anyone know?

At some point RunRev will need to update LC to support his, but in the 
meantime, this may be a viable workaround.

Thanks again.


> On Jan 26, 2015, at 12:33 PM, Colin Holgate  wrote:
> 
> With Adobe AIR you have added this to the app descriptor XML:
> 
> 
> 
> That then ends up in the embedded provisioning profile. Not sure of the steps 
> for LiveCode.
> 
> Test Flight’s URL is https://www.testflightapp.com/ 
> , but as you say, it closes on Feb 26th. If 
> you have an HTTPS site you can post builds for your testers, but those would 
> just be from your list of 100, not from the Test Flight 1000 external testers.
> ___
> use-livecode mailing list
> use-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: IP Calculator Final Version

2015-01-26 Thread Alex Tweedly

On 26/01/2015 15:47, Bob Sneidar wrote:

Hi all.

Mike Doub has offered to include this in the MasterLibrary, so I went through 
and added what I think is fairly comprehensive error checking to make sure that 
bogus input values return a descriptive error message. If any of you feel so 
inclined, please try to make it fail using incorrect input values. Also make 
sure that it returns the correct values for correct input values.

I have already done this but as you are well aware, developers can easily miss 
things others can see.

Bob S


A couple of error cases that aren't caught gracefully

192.168.1/24.1
192.168..1/24

One that is accepted and shouldn't be
192.168.1.1/24.(note the trailing ".")

Also, not sure why you limit CIDRDepth to between 1 and 30. RFC 4632 
specifically says between 0 and 3 - and indeed host routes (/32s) are 
common enough, as is default route.


Thanks again for contributing this Bob.

-- Alex.


___
use-livecode mailing list
use-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: semi-OT: TestFlight.com beta testing closing

2015-01-26 Thread Colin Holgate
With Adobe AIR you have added this to the app descriptor XML:



That then ends up in the embedded provisioning profile. Not sure of the steps 
for LiveCode.

Test Flight’s URL is https://www.testflightapp.com/ 
, but as you say, it closes on Feb 26th. If you 
have an HTTPS site you can post builds for your testers, but those would just 
be from your list of 100, not from the Test Flight 1000 external testers.
___
use-livecode mailing list
use-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 performance issues: Dreamhost only?

2015-01-26 Thread Richard Gaskin
We've seen reports of serious performance issues with running LiveCode 
Server 7.x on Dreamhost.


I'm working with Peter Brett at RunRev to try to resolve these, and 
there's one detail that would be very useful to know:


While we see relatively minor speed differences on the desktop, running 
LiveCode Serve on Dreamhost has resulted in requests taking as long as 
several seconds, far beyond anything we can account for in the engine 
itself.


Have any of you seen order-of-magnitude speed loss when running LiveCode 
Server on any host other than Dreamhost?


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


Re: changing layer within a group by script/ speed of "start editing"

2015-01-26 Thread Geoff Canyon
set relayergroupedcontrols to true
set the layer of  to 

On Sun, Jan 25, 2015 at 7:30 PM, Scott Rossi  wrote:

> Try locking the screen before doing any object relayering.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
> On Jan 25, 2015, at 5:19 PM, Dr. Hawkins  wrote:
>
> > I have a group with four overlapping graphics.
> >
> > Depending upon what happens, different ones want to be brought to the top
> > and change the overlap.
> >
> > I'm currently using start editing/set the layer of zzz to top/stop
> > editing.  I think it also changes the size.
> >
> > I can actually see the order in which this is handled on an iphone 6+.
> > Fast, but visible.
> >
> > Is start editing "expensive"?  Is there a better way to do this?
> >
> >
> > I suppose I could skip the group and catch their handlers in the card or
> > stack instead of the group, but . . .
> > --
> > Dr. Richard E. Hawkins, Esq.
> > (702) 508-8462
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-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: 7.0.2 RC1 Crashes and Corrupts Stack Files

2015-01-26 Thread Ray
Exactly - this is actually under two different bug reports now, #14437 
and #14449.  I realized after adding to the 2nd report that I'm also not 
able to 'see' Quicktime movies, even in 6.5.2, when assigning a new 
Source to a player.  Hopefully all these things will be addressed when 
the team at Livecode looks into these bugs.


Thanks...

On 1/26/2015 2:38 PM, Peter Haworth wrote:

Seems like most of the problems with the player control have been in LC 7
but I'm seeing issues in 6.7.

Hard hang in circumstances I haven't quite nailed down yet. Command-period
doesn't work and have to force quit.



Pete
lcSQL Software 
Home of lcStackBrowser  and
SQLiteAdmin 

On Sat, Jan 24, 2015 at 12:14 PM, Richmond 
wrote:


On 24/01/15 02:29, Ray wrote:


On my Windows 8.1 system I do the following:

1)  create a new main stack
2)  drag a player object onto it
3)  remove the default fileName (source)
4)  save the stack file

At this point I get "Livecode has stopped working".  With no other
options I close the program and find my entire stack file has been
corrupted and will not re-open.

Anybody know anything about this?



I just tried this (sorry, late to the party) with 7.0.2 rc1 on Ubuntu
Studio 14.10
and it crashed the IDE . . .

I looked here: /home/richmond/.runrev/crashlogs but the directory was
empty

as was: /home/richmond/.runrev/logs

Richmond.


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


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



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


Re: IP Calculator Final Version

2015-01-26 Thread Michael Doub
Here is the version of the MasterLibrary (version 22) with Bob's IP 
Calculator integrated.


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

Enjoy...
   Mike


On 1/26/15 10:47 AM, Bob Sneidar wrote:

Hi all.

Mike Doub has offered to include this in the MasterLibrary, so I went through 
and added what I think is fairly comprehensive error checking to make sure that 
bogus input values return a descriptive error message. If any of you feel so 
inclined, please try to make it fail using incorrect input values. Also make 
sure that it returns the correct values for correct input values.

I have already done this but as you are well aware, developers can easily miss 
things others can see.

Bob S




Begin forwarded message:

function IPCalc theIPAddress, theSubnetMask
/* IPCalc yyy
   Syntax:
   IPCalc theIPAddress, [theSubnetMask]
   Examples:
   
   Description:

   Derive Internet values from either CIDR notation in the IPAddress
   or a standard IP and subnet mask

   Input:

   .theIPAddress -  the IP address in CIDR notation
or
   .theIPAddress - a standard IP address and
  . theSubNetMask - a standard subNetMask

   Returns an array of the following values:

   .   bcastaddr
   .   cidraddr
   .   cidrdepth
   .   firstaddr
   .   ipaddress
   .   lastaddr
   .   subnetaddr
   .   subnetmask
   .   usablecount
   Returns a string beginning with ERROR: if the parameters are out of range
   Check that the returned value is an array to see if there was an error

Source:

Bob Sneidar,  slylab...@icloud.com
IPCalc */

set the itemdelimiter to "."

-- check parameters

-- the IP address must be 4 octets of numbers
if the last char of theIPAddress is "." then
   delete the last char of theIPAddress
end if

if the number of items of theIPAddress <>4 then

   return "ERROR: The IP Address must contain 4 octets. (ipaddress = " & theIPAddress 
& ")"
end if

-- initial setup

set the numberFormat to ""

-- detemine format

if theIPAddress contains "/" then
   put offset("/", theIPAddress) into theCIDRDelim
   put char theCIDRDelim +1 to -1 of theIPAddress into theCIDRDepth
   
   -- CIDR depth must be a number

   if theCIDRDepth is not a number then
  return "ERROR: The CIDR Depth must be a number between 1 and 30. " & \
"(CIDRDepth = " & theCIDRDepth & ")"
   end if
   
   put charx("1", theCIDRDepth) & charx("0", 32-theCIDRDepth) into theBinSubnetMask

   put baseconvert(char 1 to 8 of theBinSubnetMask, 2, 10) into item 1 of 
theSubnetMask
   put baseconvert(char 9 to 16 of theBinSubnetMask, 2, 10) into item 2 of 
theSubnetMask
   put baseconvert(char 17 to 24 of theBinSubnetMask, 2, 10) into item 3 of 
theSubnetMask
   put baseconvert(char 25 to 32 of theBinSubnetMask, 2, 10) into item 4 of 
theSubnetMask
   put char 1 to theCIDRDelim -1 of theIPAddress into theIPAddress
else
   -- subnet mask octets must be 4 numbers between 0 and 255
   -- and all octets after the first octet less than 255 must be 0
   
   if the last char of theSubnetMask is "." then

  delete the last char of theSubnetMask
   end if
   
   if the number of items of theSubnetMask <>4 then

  return "ERROR: The Subnet Mask must contain 4 numbers between 0 and 255 " 
& \
"separated by periods. (subnetmask = " & theSubnetMask & ")"
   end if
   
   put false into mustBeZero

   repeat for each item theOctet in theSubnetMask
  
  if theOctet <0 or theOctet >255 then

 return "Each octet in the subnet mask must be a number between 0 and 255. 
" & \
   "(subnetmask = " & theSubnetMask & ")"
  end if
  
  if mustBeZero and theOctet >0 then

 return "ERROR: All octets after an octet less than 255 must be 0. " 
& \
   "(subnetmask = " & theSubnetMask & ")"
  end if
  
  if theOctet <255 then

 put true into mustBeZero
  end if
   end repeat
   
   -- convert the subnet mask to binary

   put 0 into whichOctet
   repeat for each item theOctet in theSubnetMask
  add 1 to whichOctet
  
  -- subnet mask must contain only 4 octets

  if whichOctet >4 then
 return "ERROR: The Subnet Mask must contain 4 numbers between 0 and 255 
" & \
   "separated by periods. (subnetmask = " & theSubnetMask & ")"
  end if
  
  put value(baseConvert(theOctet, 10, 2)) after theBinSubnetMask

   end repeat
   put offset("0", theBinSubnetMask) -1 into theCIDRDepth
end if

-- CIDR depth must be between 1 and 30

if 

Re: 7.0.2 RC1 Crashes and Corrupts Stack Files

2015-01-26 Thread Peter Haworth
Seems like most of the problems with the player control have been in LC 7
but I'm seeing issues in 6.7.

Hard hang in circumstances I haven't quite nailed down yet. Command-period
doesn't work and have to force quit.



Pete
lcSQL Software 
Home of lcStackBrowser  and
SQLiteAdmin 

On Sat, Jan 24, 2015 at 12:14 PM, Richmond 
wrote:

> On 24/01/15 02:29, Ray wrote:
>
>> On my Windows 8.1 system I do the following:
>>
>>1)  create a new main stack
>>2)  drag a player object onto it
>>3)  remove the default fileName (source)
>>4)  save the stack file
>>
>> At this point I get "Livecode has stopped working".  With no other
>> options I close the program and find my entire stack file has been
>> corrupted and will not re-open.
>>
>> Anybody know anything about this?
>>
>>
> I just tried this (sorry, late to the party) with 7.0.2 rc1 on Ubuntu
> Studio 14.10
> and it crashed the IDE . . .
>
> I looked here: /home/richmond/.runrev/crashlogs but the directory was
> empty
>
> as was: /home/richmond/.runrev/logs
>
> 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: Unicode

2015-01-26 Thread Peter Haworth
On Mon, Jan 26, 2015 at 3:42 AM, Fraser Gordon 
wrote:

> One way of looking at things is that all external interfaces (files,
> processes, etc) return binary data and you need to do something to turn
> that into text (textDecode) and you need to turn your text into binary data
> when writing to them (textEncode). By using something like UTF-8 as an
> encoding, it also avoids the problems that occur because the “native”
> encoding differs between our platforms - it is MacRoman on OSX, CP1252 on
> Windows and ISO-8859-1 on Linux.


Thanks Fraser, I like that explanation, plus it answers the next question I
had regarding ISOToMac/MacToISO.

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

semi-OT: TestFlight.com beta testing closing

2015-01-26 Thread Chris Sheffield
Just thought I’d throw this out there. Sounds like Apple is killing the 
TestFlight.com  beta testing site in favor of their 
newer TestFlight service.  
http://www.idownloadblog.com/2015/01/26/apple-closing-old-beta-testing-test-flight/
 


Kind of cruddy, imo. Especially because Apple’s new version of the service only 
supports devices running iOS 8+, which means no more testing apps on older 
devices, or even on newer devices running older versions of iOS. Their 
TestFlight app won’t even install unless iOS 8 is installed on the device. In 
the education market, we need to be able to test different configurations. I 
was kind of hoping they would leave this service running a bit longer. We may 
have to look for something else.

Does anyone know of other beta testing services that work similar to TestFlight?

Also, the last time I checked into using TestFlight in iTunes Connect, I could 
not get a LiveCode-built app to work correctly. I kept getting a warning about 
missing entitlements. Does anyone know if this is fixed yet? I haven’t tried it 
recently.

Thanks,
Chris

--
Chris Sheffield
Read Naturally, Inc.
www.readnaturally.com

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

Re: Unicode

2015-01-26 Thread Devin Asay

On Jan 26, 2015, at 4:42 AM, Fraser Gordon  wrote:

> 
> On 26 Jan 2015, at 02:15, Peter Haworth  wrote:
> 
>> Thanks Peter.  If that's the case, I'm not seeing much in the way of a
>> coding advantage over pre 7.0.  Sounds like using textEncode/textDecode
>> instaed of uniencode/unidecode?
> 
> Assuming you have UTF-8 encoded data from a source outside LiveCode:
> 
> local tUTF8Data   — This is binary data
> local tString — This is a textual string
> put textDecode(tUTF8Data, “UTF-8”) into tString
> 
> The important difference is that uniEncode becomes textDecode - because you 
> are decoding some binary data to text. 
> 
> The big difference between 7.0 and previous versions is that Unicode text 
> works everywhere - you don’t need to use special Unicode properties or 
> commands any more.
> 
>> 
>> That does answer another question I had though which is what is needed if
>> the database is UTF-16 encoded.  Sounds like nothing needs to be done.  I
>> guess I'll have to set up some tests.
> 
> If your external data is UTF-16 you still need to textDecode it - if you 
> don’t, it will treat the data as 8-bit text and you’ll get corrupted text 
> back. This 8-bit default is necessary from a backwards compatibility point of 
> view - if we changed it to accept UTF-16 by default, anyone who gets text 
> from an external source and doesn’t textDecode it will suddenly find that 
> their stacks don’t work.
> 
> One way of looking at things is that all external interfaces (files, 
> processes, etc) return binary data and you need to do something to turn that 
> into text (textDecode) and you need to turn your text into binary data when 
> writing to them (textEncode). By using something like UTF-8 as an encoding, 
> it also avoids the problems that occur because the “native” encoding differs 
> between our platforms - it is MacRoman on OSX, CP1252 on Windows and 
> ISO-8859-1 on Linux.
> 
> Regards,
> Fraser


It would be great if there were a stack property we could set that would 
specify what format outputted text would be. The default could be “native”; 
i.e., the native encoding for the platform, but then we could set it to things 
like “utf8” or “utf16” or “ISO”. It would essentially do the textEncode/decode 
for us.

Is this an idea that appeals to folks here?

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


Re: Getting the scroll and clickloc of a browser object

2015-01-26 Thread Bob Sneidar
Except replace the question mark with the correct quote mark. I think Scott’s 
email app is replacing standard quotes with smart quotes which are getting lost 
in the translation.

Bob S


On Jan 24, 2015, at 13:00 , Michael Julian Lew 
mailto:micha...@unimelb.edu.au>> wrote:

If you?re using a browser object, I believe this is what you want:

put revBrowserGet(theBrowserId, ?vscroll") into theVScrollAmount

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

IP Calculator Final Version

2015-01-26 Thread Bob Sneidar
Hi all. 

Mike Doub has offered to include this in the MasterLibrary, so I went through 
and added what I think is fairly comprehensive error checking to make sure that 
bogus input values return a descriptive error message. If any of you feel so 
inclined, please try to make it fail using incorrect input values. Also make 
sure that it returns the correct values for correct input values. 

I have already done this but as you are well aware, developers can easily miss 
things others can see. 

Bob S



> Begin forwarded message:
> 
> function IPCalc theIPAddress, theSubnetMask
>/* IPCalc yyy
>   Syntax:
>   IPCalc theIPAddress, [theSubnetMask]
>   Examples:
>   
>   Description:
>   Derive Internet values from either CIDR notation in the IPAddress
>   or a standard IP and subnet mask
>
>   Input: 
>   .theIPAddress -  the IP address in CIDR notation
>or
>   .theIPAddress - a standard IP address and
>  . theSubNetMask - a standard subNetMask
>
>   Returns an array of the following values:
>   .   bcastaddr
>   .   cidraddr
>   .   cidrdepth
>   .   firstaddr
>   .   ipaddress
>   .   lastaddr
>   .   subnetaddr
>   .   subnetmask
>   .   usablecount
>   Returns a string beginning with ERROR: if the parameters are out of 
> range
>   Check that the returned value is an array to see if there was an error
>
>Source:
>Bob Sneidar,  slylab...@icloud.com
>IPCalc */
>
>set the itemdelimiter to "."
>
>-- check parameters
>-- the IP address must be 4 octets of numbers
>if the last char of theIPAddress is "." then
>   delete the last char of theIPAddress
>end if 
>
>if the number of items of theIPAddress <>4 then
>   return "ERROR: The IP Address must contain 4 octets. (ipaddress = " & 
> theIPAddress & ")"
>end if
>
>-- initial setup
>set the numberFormat to ""
>
>-- detemine format
>if theIPAddress contains "/" then
>   put offset("/", theIPAddress) into theCIDRDelim
>   put char theCIDRDelim +1 to -1 of theIPAddress into theCIDRDepth
>   
>   -- CIDR depth must be a number
>   if theCIDRDepth is not a number then
>  return "ERROR: The CIDR Depth must be a number between 1 and 30. " & 
> \
>"(CIDRDepth = " & theCIDRDepth & ")"
>   end if
>   
>   put charx("1", theCIDRDepth) & charx("0", 32-theCIDRDepth) into 
> theBinSubnetMask
>   put baseconvert(char 1 to 8 of theBinSubnetMask, 2, 10) into item 1 of 
> theSubnetMask
>   put baseconvert(char 9 to 16 of theBinSubnetMask, 2, 10) into item 2 of 
> theSubnetMask
>   put baseconvert(char 17 to 24 of theBinSubnetMask, 2, 10) into item 3 
> of theSubnetMask
>   put baseconvert(char 25 to 32 of theBinSubnetMask, 2, 10) into item 4 
> of theSubnetMask
>   put char 1 to theCIDRDelim -1 of theIPAddress into theIPAddress
>else
>   -- subnet mask octets must be 4 numbers between 0 and 255
>   -- and all octets after the first octet less than 255 must be 0
>   
>   if the last char of theSubnetMask is "." then
>  delete the last char of theSubnetMask
>   end if
>   
>   if the number of items of theSubnetMask <>4 then
>  return "ERROR: The Subnet Mask must contain 4 numbers between 0 and 
> 255 " & \
>"separated by periods. (subnetmask = " & theSubnetMask & ")"
>   end if
>   
>   put false into mustBeZero
>   repeat for each item theOctet in theSubnetMask
>  
>  if theOctet <0 or theOctet >255 then
> return "Each octet in the subnet mask must be a number between 0 
> and 255. " & \
>   "(subnetmask = " & theSubnetMask & ")"
>  end if
>  
>  if mustBeZero and theOctet >0 then
> return "ERROR: All octets after an octet less than 255 must be 0. 
> " & \
>   "(subnetmask = " & theSubnetMask & ")"
>  end if
>  
>  if theOctet <255 then
> put true into mustBeZero
>  end if
>   end repeat
>   
>   -- convert the subnet mask to binary
>   put 0 into whichOctet
>   repeat for each item theOctet in theSubnetMask
>  add 1 to whichOctet
>  
>  -- subnet mask must contain only 4 octets
>  if whichOctet >4 then
> return "ERROR: The Subnet Mask must contain 4 numbers between 0 
> and 255 " & \
>   "separated by periods. (subnetmask = " & theSubnetMask & ")"
>  end if
>  
>  put value(baseConvert(theOctet, 10, 2)) after theBinSubnetMask
>   end repeat
>   put offset("0", theBinSubnetMask) -1 into theCIDRDepth
>end if
>
>-- CIDR depth must be between 1 and 30
>if theCIDRDepth <1 or theCIDRDepth >30 then
>   return "ERROR: The CIDR Depth must be between 

Re: Unicode

2015-01-26 Thread Fraser Gordon

On 26 Jan 2015, at 02:15, Peter Haworth  wrote:

> Thanks Peter.  If that's the case, I'm not seeing much in the way of a
> coding advantage over pre 7.0.  Sounds like using textEncode/textDecode
> instaed of uniencode/unidecode?

Assuming you have UTF-8 encoded data from a source outside LiveCode:

local tUTF8Data — This is binary data
local tString   — This is a textual string
put textDecode(tUTF8Data, “UTF-8”) into tString

The important difference is that uniEncode becomes textDecode - because you are 
decoding some binary data to text. 

The big difference between 7.0 and previous versions is that Unicode text works 
everywhere - you don’t need to use special Unicode properties or commands any 
more.

> 
> That does answer another question I had though which is what is needed if
> the database is UTF-16 encoded.  Sounds like nothing needs to be done.  I
> guess I'll have to set up some tests.

If your external data is UTF-16 you still need to textDecode it - if you don’t, 
it will treat the data as 8-bit text and you’ll get corrupted text back. This 
8-bit default is necessary from a backwards compatibility point of view - if we 
changed it to accept UTF-16 by default, anyone who gets text from an external 
source and doesn’t textDecode it will suddenly find that their stacks don’t 
work.

One way of looking at things is that all external interfaces (files, processes, 
etc) return binary data and you need to do something to turn that into text 
(textDecode) and you need to turn your text into binary data when writing to 
them (textEncode). By using something like UTF-8 as an encoding, it also avoids 
the problems that occur because the “native” encoding differs between our 
platforms - it is MacRoman on OSX, CP1252 on Windows and ISO-8859-1 on Linux.

Regards,
Fraser


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