Search found 172 matches

by Mark Smith
Wed Oct 28, 2009 3:58 pm
Forum: Talking LiveCode
Topic: faster treatments in UDP connecion
Replies: 10
Views: 6326

Bernd, you're absolutely correct. These differences are very small, but can really accumulate. In my Sha functions, even quite small inputs can result in millions of iterations in the inner loops. I found it made a worthwhile difference to use literals instead of constants, and to put functions 'inl...
by Mark Smith
Wed Oct 28, 2009 3:54 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Ramdom
Replies: 4
Views: 3116

I could tell you, but then I'd have to kill you :)

Efficiency, maybe?
by Mark Smith
Wed Oct 28, 2009 1:04 pm
Forum: Talking LiveCode
Topic: faster treatments in UDP connecion
Replies: 10
Views: 6326

As the author of libBinConvert I just benchmarked the getFloatBE() function. For 1000 calls it took 20 - 25 millisecs on my two year old intel mac, so shouldn't be causing a problem in a 250 millisecond window... Also, the library was written before we had private functions, but I doubt the speed di...
by Mark Smith
Wed Oct 28, 2009 12:37 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Ramdom
Replies: 4
Views: 3116

I think it's simply that for some functions like random(), baseconvert() and the bitwise operators, the engine converts values to 4 byte unsigned integers.

Best,

Mark Smith
by Mark Smith
Wed Oct 21, 2009 11:56 am
Forum: Converting to LiveCode
Topic: Perl/PHP Hash array
Replies: 2
Views: 6568

Phil, I don't think it's all that different: put "value1" into tArray[key1] put "value2" into tArray[key2] ...etc which isn't all that much more verbose than the perl example you give. On the other hand, if you already have, lets say, a comma and return delimited list, you can use the "split" comman...
by Mark Smith
Thu Oct 15, 2009 10:52 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: "Recognition" of upper or lower case in a field
Replies: 4
Views: 3565

To test for uppercase ASCII chars:

Code: Select all

function isUpper pChar
  get charToNum(pChar)
  return it >= 65 and it <= 90
end isUpper
Best,

Mark Smith
by Mark Smith
Thu Oct 15, 2009 10:48 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Putting values into globals via a repeat loop
Replies: 4
Views: 3087

You could also have a global array:

Code: Select all

global tw

on mouseUp 
  repeat with tWords = 1 to gWordCount 
    put tWords into tw["gw" & tWords]
  end repeat 
end mouseUp
Best,

Mark Smith
by Mark Smith
Mon Oct 12, 2009 11:12 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Numbers or text only in a field?
Replies: 4
Views: 4038

If you put this in the script of your field: on keyDown pKey if pKey is in "0123456789." then pass keydown end keyDown The user will be restricted to entering only the characters listed. Of course it gets more complex if you want to avoid a leading decimal point, or multiple decimal points, but you ...
by Mark Smith
Mon Oct 12, 2009 11:07 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: unidecode(uniencode()) removes characters??
Replies: 4
Views: 3607

I think you need to move the "utf8" declaration into the unidecode call:

Code: Select all

unidecode(uniencode("åäö are som swedish characters"),"UTF8")
The way you had it will translate a string from utf8 to whatever your system's encoding is.

Best,

Mark Smith
by Mark Smith
Mon Oct 05, 2009 12:08 am
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Files in folder with stand alone program?
Replies: 2
Views: 2441

When you fill in the field with the list of files, you could store the path to the folder as a custom property of the field, and then prepend it to the file name when it is clicked. assume that this is in the script of the field: on ShowFiles pFolder set the directory to pFolder put the files into m...
by Mark Smith
Sat Oct 03, 2009 12:25 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: Avoiding identical numbers in random number sequence
Replies: 12
Views: 7474

Here's a shorter (though not necessarily more efficient) way:

on mouseUp
put empty into tArray
repeat until the number of lines in keys(tArray) = 6
put 0 into tArray[random(49)]
end repeat
put keys(tArray)
end mouseUp

Best,

Mark
by Mark Smith
Mon Sep 28, 2009 10:48 pm
Forum: Getting Started with LiveCode - Experienced Developers
Topic: How to generate a unique machine ID Crossplatform
Replies: 6
Views: 6109

Ken Ray has a great cross-platform handler for getting the MAC address here: http://www.sonsothunder.com/devres/revolution/tips/env001.htm For UUIDs, I'll plug my own pure revolution stack (that uses Ken Ray's handler) for generating type 1,3 and 4 UUIDs, here: http://futsoft.futilism.com/revolution...
by Mark Smith
Fri Sep 25, 2009 2:25 pm
Forum: Announcements
Topic: libRevFreeDB
Replies: 2
Views: 3299

You're quite right - I've actually just uploaded a new version (1.0.1b) in which this is fixed, but more importantly, it now works on Windows with the limitation that it can only see CDs in drive D, and can't cope with "mixed mode" CDs that have non-audio content. I need to see about getting around ...
by Mark Smith
Fri Sep 25, 2009 2:06 am
Forum: Announcements
Topic: libRevFreeDB
Replies: 2
Views: 3299

libRevFreeDB

I've made a library to get CD track data from FreeDB. It currently uses the pList that OS X builds for each inserted CD to get the info it needs to query FreeDB, so it's OS X only until I figure out how to get the info on Windows and Linux. It's here: http://maspub.s3.amazonaws.com/libRevFreeDb.zip ...
by Mark Smith
Sat Sep 12, 2009 1:10 am
Forum: Talking LiveCode
Topic: Faster than what I have going here?
Replies: 25
Views: 14889

Another possible optimisation would be around this part: if the number of lines of varIndexData is 1000 then put quote & "file:" & varIndexFile & quote into varSaveIndexFile put varIndexData after URL "file:WikipediaIndex.dat" put empty into varIndexData wait for 5 milliseconds Two things - for each...

Go to advanced search