Glassware?

2013-05-21 Thread Sumner, Walt
Do we expect Livecode to be able to make glassware at some point? Just another 
android-linux system? Stack=timeline, card=card?

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


Weighted Random Number

2013-03-04 Thread Sumner, Walt
This seems to work:

Make a stack with a button having this script, then click the button. It will 
bounce around in a normal distribution in H and V coordinates.


on mouseUp

   local tSD,tMean,tPoint,tStartPoint

   put the loc of me into tStartPoint

   put the width of this window div 6 & comma &  the height of this window div 
6 into tSD

   put the width of this window div 2 & comma &  the height of this window div 
2 into tMean

   put BoxMullerDist(tMean,tSD) into tPoint

   set the loc of me to tPoint

   wait 1 second

   set the loc of me to tStartPoint

end mouseUp


function BoxMullerDist pMean,pStdDev

   local tU,tV,tX,tY

   put random(100)/100 into tU

   put random(100)/100 into tV

   put sqrt(-2*ln(tU))*cos(2*pi*tV) into tX

   put sqrt(-2*ln(tU))*sin(2*pi*tV) into tY

   return item 1 of pMean + tX*item 1 of pStdDev & comma & item 2 of pMean + 
tY*item 2 of pStdDev

end BoxMullerDist

You can tweak the range by setting tSD to div 4 to hit the edges more often. 
You can tweak the center point by shifting the mean, but you will go off the 
edges sometimes if you shift too far.

Ref: 
http://en.wikipedia.org/wiki/Normal_distribution#Generating_values_from_normal_distribution

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


Apology for 'Challenging new property inspector'

2013-01-27 Thread Sumner, Walt
Hi, folks, I clearly posted a message to the wrong list last week, starting a 
bit of a storm. I'd like to follow up with a public word of thanks to Richard 
Gaskin for gentle, private redirection; also to Richmond Mathewson and Bob 
Sneider for similar corrections, and to Jacqueline for trying to calm the 
storm. It is a friendly and helpful community, which is nice if you're having a 
particularly clumsy week.

I'll slink back under my rock now and try to avoid causing any more trouble.

Thanks,

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


Challenging new property inspector in LC6 dp4

2013-01-23 Thread Sumner, Walt
Rather than get any real work done this evening, I've been dutifully trying to 
describe a bunch of issues with the property inspector in LC6.0 dp4 through the 
quality control center. However, the last straw was the QCC demanding in bold 
letters on a blood red background that "A value must be set for the 'Desktop 
OS' field." when there was no such field on the preceding form, try as I might 
to find it. And if that data is missing, why can't it ask, "What is your 
desktop OS?" It's not like there are that many required fields. And I had 
already recorded that info in my report. If anyone knows where to enter my 
desktop OS, please let me know. I looked in a lot of places in the QCC, didn't 
see it.

So, here's my list of problems with the PI. If anyone knows how to circumvent 
them, please share. Anyone who can get this to RunRev's attention please feel 
free, I need to invest my time elsewhere at this point. And please, RunRev, can 
the feedback loop be a little more gracious?


The LC 6.0 dp4 new property inspector is practically unusable for me in 
multiple regards:

1. Any object selected with the pointer tool changes content of the new 
property inspector, but I cannot use the pointer tool to browse or adjust 
anything in the new property inspector, I just wind up selecting objects in the 
inspector. So I try switching to the browse tool, and the new property 
inspector immediately changes focus to inspect itself: stack 
"idePropertyInspector". It seems to work to pointer-click an object in my 
stack, pointer-click a field in the inspector, and then choose the browse tool. 
The inspector then displays information about the last selected object in my 
stack (even though that object is now deselected), and it is possible to browse.

2. If it is closed, the new property inspector pops up with every object 
selection using the pointer tool, and gets in front of the stack I am trying to 
edit. In fact, if I point at an object in my stack so that the new property 
inspector comes to the fore, and then go to the tools palette and double click 
on a button, the newly created button will appear in the property inspector, 
not my stack. This is extremely unexpected and disconcerting, especially given 
how hard it is to get the inspector out of the way for any length of time. 
Shouldn't it be acting more like a palette and less like a stack in development?

3. I have not found a way to suppress the new property inspector: it appears, 
in front of my stack, with any double click of the pointer tool, and with any 
single click of the pointer tool if the inspector has been closed. If this is 
going to be released, opting for the old property inspector needs to be an 
setting, IMO.

4. On one occasion that I cannot reproduce yet, turning on suppress messages 
and then clicking on an object caused a function call to ideMessagesSuppress() 
to hang with an effective freeze of Livecode - unresponsive to command-period, 
quit, escape, etc. I had to force-quit LiveCode, although it was still 
"responsive" in the opinion of the Activity Monitor. I often have freezes that 
appear related to browsing the documentation or manipulating the new property 
inspector but that can be escaped with control-period to abort some script. 
This was different.

5. A lot of the text settings in the new prop inspector change the settings of 
all of the fields in the prop inspector, which is very effective visual 
feedback, but I don't know that I want all of the labels and contents in the 
new PI struck through just because I want the field in my stack to display 
struck through text, for instance.

These behaviors were not an issue for me with LC 6 dp1, the version I had been 
using until today.

There are still issues with forcing custom property saves after manual edits of 
the old property inspector.

Computer:
  Model Name: MacBook Pro
  Model Identifier: MacBookPro4,1
  Processor Name: Intel Core 2 Duo
  Processor Speed: 2.4 GHz
  Number Of Processors: 1
  Total Number Of Cores: 2
  L2 Cache: 3 MB
  Memory: 2 GB
  Bus Speed: 800 MHz
  Boot ROM Version: MBP41.00C1.B03
  SMC Version (system): 1.27f3
  Serial Number (system): W8823.
  Hardware UUID: E39105FB-..
  Sudden Motion Sensor:
  State: Enabled

OSX 10.5.8




Thanks,

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


Voice recognition in Livecode

2012-06-28 Thread Sumner, Walt
Has anyone tried using voice recognition on a Livecode mobile application? I 
would like to use voice recognition to identify concepts that are then 
manipulated with gestures on a mobile device. The ability to swap dictionaries 
used by listening algorithms would be a huge plus.

Thanks,

Walton Sumner
___
use-livecode mailing list
use-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: Get number of occurrences of one string in another

2012-02-23 Thread Sumner, Walt
Here's a small speed increment, still no repeat loops except for 3 or 4 hidden 
within Livecode. Counts "pp" as 3 "pp", not 5.

on mouseUp
   local timer1, timer2,pChunk, tCount1, tCount2
   put 
"asdfewoaevewppaafaeppaeafpntsrnpspsppsrhbsbppsbsargaregppsbrahargagbafpp" into 
pChunk
   put the ticks into timer1
   repeat 10
 put substringCount1("pp",pChunk) into tCount1
   end repeat
  put the ticks - timer1 into timer1
   put the ticks into timer2
   repeat 10
 put substringCount2("pp",pChunk) into tCount2
   end repeat
  put the ticks - timer2 into timer2
   put "dividing:" && timer1 & CR & "filtering:" && timer2 & CR & tCount1 &&  
tCount2 && (tCount1=tCount2)
end mouseUp

function substringCount1 pString, pChunk
   local tLengthBefore
   put length(pChunk) into tLengthBefore
   replace pString with empty in pChunk
   return (tLengthBefore-length(pChunk)) div length(pString)
end substringCount1

function substringCount2 pString, pChunk
  replace pString with cr & pString & cr in pChunk
  filter pChunk with pString
  return the number of lines of pChunk
end substringCount2

OUTPUT
dividing: 35
filtering: 56
6 6 true

Walt


On Wed, Feb 22, 2012 at 8:47 PM, Bob Sneidar  wrote:


Message: 22
Date: Wed, 22 Feb 2012 19:46:23 -0800
From: Bob Sneidar 
To: How to use LiveCode 
Subject: Re: Get number of occurrences of one string in another
Message-ID: <00eedc47-b386-4bec-9bcc-0e51671dc...@twft.com>
Content-Type: text/plain; charset=us-ascii

only works for single characters.

function substringCount pString, pChunk
  replace pString with cr & pString & cr in pChunk
  filter pChunk with pString
  return the number of lines of pChunk
end substringCount

Bob

> On Feb 22, 2012, at 7:44 PM, Jerry Jensen wrote:
>
> > The offset() function has a third parameter: chars to skip. So if you
> call offset in a loop with the third param set to the previous result, and
> count loops until it returns 0, Bob's your uncle.
> >
> > On Feb 22, 2012, at 7:37 PM, Andrew Kluthe wrote:
> >
> >> function substringCount pChar, pString
> >>put 0 into theCount
> >>repeat for each char theChar in pString
> >> if theChar is pChar then
> >>  add 1 to theCount
> >> end if
> >>end repeat
> >>return theCount
> >> end substringCount
> >>
> >>
> >> Would work out nicely if there is not built in function for this.
> >>
___
use-livecode mailing list
use-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: Determine 180 degree turn using compass

2012-01-16 Thread Sumner, Walt
Tim, 

Does a lap potentially include a figure 8? You will be on the same heading 
twice per lap in a figure 8, but you could monitor the sweep of headings to 
capture that possibility. Maybe a lap requires a reasonable progression through 
southern, eastern, northern, and western headings.

--WS

Message: 3
Date: Sun, 15 Jan 2012 13:08:18 -0500
From: Thomas McGrath III 
To: How to use LiveCode 
Subject: Determine 180 degree turn using compass
Message-ID: <3b55c011-6a6a-4529-9d17-e218155e2...@mac.com>
Content-Type: text/plain; CHARSET=US-ASCII

OK, this is for the math experts here.

Using a working Compass app I would like to determine when the phone is turned 
around from an initial starting point. So I am working out the best ways to do 
this.
1. Start by capturing the start heading
2. Store that in a global
3. Store that the start heading has been set
4. Using headingChanged capture the currentHeading at intervals
5. Check the new currentHeading against the start heading
6. If enough of a difference is detected then count that as a lap
7. Set the new currentHeading as the global heading
8. Using headingChanged capture the currentHeading at intervals
9. Repeat until stopped
10. return total lap count

So this seems straight forward (if I haven't missed anything)
And if I start at 10 degrees and turn right 170 now I am at 180. Good. I just 
subtract 10 from 180 and I know I have turned at least 170 degrees and can 
count that as a lap (give or take)

BUT then the new starting point may not be right since I might be mid turn when 
the interval fires.

And if the starting point is say 10 and I turn left 170 degrees and now I am at 
200 and 10 - 200 is -190 but I have not really turned -190 but only 170 and 
again this may be incorrect based on when the sample interval was fired.

So, It looks to me like I need to come up with a better way to estimate the 
general direction I am starting from and a better  way to set the intervals. As 
well as figuring out the right way to handle the compass degrees when they pass 
0/360.

I have never had to do this before and would like some advice and feedback on 
what/how to get there.

So far I started with this code after starting the compass heading capture:

global  myLapCountNumber

on headingChanged
   put iphoneCurrentHeading() into tHeading
   lapCount tHeading["heading"]
end headingChanged

on lapCount pNum
   if pNum is not "" then
  if myLapCountNumber is not "" then
 if pNum > myLapCountNumber then
if pNum - myLapCountNumber > 150 then
   answer pNum && "-" && myLapCountNumber && "= Lap Right +"
   put pNum into myLapCountNumber
end if
 else -- pNum is less than myLapCountNumber
if myLapCountNumber - pNum > 150 then
   answer myLapCountNumber && "-" && pNum && "= Lap Left -"
   put pNum into myLapCountNumber
end if
 end if
  else
 put 0 into myLapCountNumber -- Needs changed to a sampling of the 
general direction
  end if
   end if
end lapCount

-- Tom McGrath III
http://lazyriver.on-rev.com
3mcgr...@comcast.net


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