Database: INSERTS, speed and primary keys
I've spent the weekend refreshing on databases. I'm using LiveCode and also Trevor's fabulous sqlYoga, and beginning to realise how little I know about databases! The question I've got is about the database schema design and optimising it for the speed of adding records. * Exporting Handlers* I think I may be missing some basic things, as it seems to me that the only easy way to force an update to be unique is to use primary keys. You can use triggers but this seems like this would be slower. However if I uses a surrogate primary key (ie the usual auto-incremented numeric id field), for each updated record I need to check first whether it is already in the database before adding it - this is a lot of overhead in terms of finding the ids based on other fields. However I ran in to problems using composite primary keys, as the queries got a too complicated for me to track down the bugs in them easily. To elaborate on the example - in LiveCode each and every handler in the LiveCode environment can be uniquely identified by the following fields: 1. handler_name 2. handler_type (ie one of c,f,g,s standing for command, function, getprop, setprop) 3. location (the rugged id of the LiveCode control - ie control id 1387 of card id 1002 of stack Test) 4. hander_num (not usually useful - but there can be more than one identical handler in a script, only 1 is ever called) 5. handler_scope (p for private for example) From these elements you can define a unique reference to a given handler in script with the following type of key - test_Command,c,stack Test,1,p Which would refer to (the firsts instance of) a private command test_Command in script of the the stack Test. I've been using this way to refer to handlers for years and have a large library of code that manipulates references to handlers, ie: - hkey_EditScript hKey - put hkey_GetHandler (hKey ) into somehandler - put hkey_ExtractHandlerCalls (hKey ) into hKey s Therefore in database terminology hKey is a composite primary key, and you can make this a composite primary key. This has the advantage of enforcing that addition of keys to the database is normalized - that is adding an hKey that already exists fails to add a duplicate entry. The problem I am having is that while using a composite primary key is great for making the updates fast and simple - it is giving me headaches with the more complex joins and queries, I'm building in LiveCode / sqlYoga. However I do need these updates to be as fast as possible - a few ticks for adding several hundred records, as I want to automatically add them to the database every time a script is compiled. These are the options I can think of: 1. Stick to composite primary keys for the handler table, and battle through all the bugs / issues with using complex joins based on composite keys. 2. Use triggers - and unknown to me, not tested with regard to speed, and looks like it may be difficult to keep sqlite and online db in sync, as they may not share the same way of implementing triggers. 3. Use a staging table of some sort - use composite primary keys on this temporary table, and then at a later date (perhaps when the stack is saved) process this temporary table, moving the data into the db proper. 4. Asynchronously update the db - perhaps using a slave process, to maintain GUI responsiveness. 5. Something else? At the moment I am going for 3, as it seems to offer the best in terms of keeping the db design as conventional as possible, and speed in terms of GUI response. Any advice from the db experts out there? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
Hi David However if I uses a surrogate primary key (ie the usual auto-incremented numeric id field), for each updated record I need to check first whether it is already in the database before adding it - this is a lot of overhead in terms of finding the ids based on other fields. I haven't yet used SQLYoga but I'm sure Trevor has this all worked out. SQLite will handle the auto increment of integer primary keys when you INSERT without an ID field and then you query put revDataFromQuery(,,sDB,select last_insert_rowid()) into tID Cheers -- Monte Goulding M E R Goulding Software Development Bespoke application development for vertical markets InstallGadget - How to create an installer in 10 seconds revObjective - Making behavior scripts behave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
HI Monte - hows down-under :) On 27 September 2010 11:31, Monte Goulding mo...@sweattechnologies.comwrote: I haven't yet used SQLYoga but I'm sure Trevor has this all worked out. SQLite will handle the auto increment of integer primary keys when you INSERT without an ID field and then you query put revDataFromQuery(,,sDB,select last_insert_rowid()) into tID The issue is not the automatic creation on surrogate keys - and retrieving of the value (as above). The issue is preventing adding of duplicate records. I want to prevent adding the same hKey, say: test_Command | c | stack Test | 1 to the database. Using INSERT with the primary key set to the autoincrement id field, you would get records like this: *id | name | type | location | hnum* 1 | test_Command| c | stack Test | 1 2 | test_Command| c | stack Test | 1 3 | another_Command | c | stack Test | 1 4 | another_Command | c | stack Test | 1 Only by making the primary key = name,type,location,hnum instead of id woudl you get a fast normalisation of the data inserted. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
HI Monte - hows down-under :) Getting better all the time ;-) Only by making the primary key = name,type,location,hnum instead of id woudl you get a fast normalisation of the data inserted. You can create an secondary key for those fields and still use your primary key auto-increment field for a foreign key in other tables. Cheers -- Monte Goulding M E R Goulding Software Development Bespoke application development for vertical markets InstallGadget - How to create an installer in 10 seconds revObjective - Making behavior scripts behave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
OK - not getting very far with that - Google is not my friend :) Can you give me an idea of what the CREATE statement would look like? CREATE TABLE 'handler' ( 'name' VARCHAR(255) NOT NULL, 'type' VARCHAR(255) NOT NULL, 'location' VARCHAR(255) NOT NULL, 'handler_num' INTEGER NOT NULL, PRIMARY KEY ('name', 'type', 'location', 'handler_num') ); With a surrogate key: CREATE TABLE 'handler' ( 'id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'name' VARCHAR(255) NOT NULL, 'type' VARCHAR(255) NOT NULL, 'location' VARCHAR(255) NOT NULL, 'handler_num' INTEGER NOT NULL, ); So how do I create a secondary key from name,type,location,handler_num and make sure that these combined columns are unique? On 27 September 2010 12:50, Monte Goulding mo...@sweattechnologies.comwrote: HI Monte - hows down-under :) Getting better all the time ;-) Only by making the primary key = name,type,location,hnum instead of id woudl you get a fast normalisation of the data inserted. You can create an secondary key for those fields and still use your primary key auto-increment field for a foreign key in other tables. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
Try: -- - -- Table `handler` -- - CREATE TABLE IF NOT EXISTS `handler` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `type` VARCHAR(255) NOT NULL , `location` VARCHAR(255) NOT NULL , `handler_num` INT NOT NULL , PRIMARY KEY (`id`) , UNIQUE INDEX `mykey` (`name`, `type`, `location`, `handler_num`) ); Or you can use a separate Create Unique Index statement. PS MYSQL Workbench is free, cross platform and make nice diagrams ;-) Cheers Monte On 27/09/2010, at 10:18 PM, David Bovill wrote: OK - not getting very far with that - Google is not my friend :) Can you give me an idea of what the CREATE statement would look like? CREATE TABLE 'handler' ( 'name' VARCHAR(255) NOT NULL, 'type' VARCHAR(255) NOT NULL, 'location' VARCHAR(255) NOT NULL, 'handler_num' INTEGER NOT NULL, PRIMARY KEY ('name', 'type', 'location', 'handler_num') ); With a surrogate key: CREATE TABLE 'handler' ( 'id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'name' VARCHAR(255) NOT NULL, 'type' VARCHAR(255) NOT NULL, 'location' VARCHAR(255) NOT NULL, 'handler_num' INTEGER NOT NULL, ); So how do I create a secondary key from name,type,location,handler_num and make sure that these combined columns are unique? On 27 September 2010 12:50, Monte Goulding mo...@sweattechnologies.comwrote: HI Monte - hows down-under :) Getting better all the time ;-) Only by making the primary key = name,type,location,hnum instead of id woudl you get a fast normalisation of the data inserted. You can create an secondary key for those fields and still use your primary key auto-increment field for a foreign key in other tables. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Monte Goulding M E R Goulding Software Development Bespoke application development for vertical markets InstallGadget - How to create an installer in 10 seconds revObjective - Making behavior scripts behave ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Line Wrapping and Margins
On Sep 24, 2010, at 1:57 PM, Michael D Mays wrote: Thanks Mark and Craig, That's what I need. Unfortunately that property doesn't show up in the dictionary as a property of a field (only a button) so it makes it a little hard to find. :( And the syntax example for formatedWidth some punctuation. Michael I added a user comment on this to the dictionary entry for formattedWidth. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 24, 2010, at 12:26 PM, Mark Schonewille wrote: Michael, That should be something like this: if the formattedWidth of word 1 to x of line y of fld z the width of fld z - item 1 of the margins of fld z - item 3 of the margins of fld z then put cr after word x of line y of fld z end if On 24 sep 2010, at 19:05, Michael D Mays wrote: Hi, How can I tell where (at what position or character) a line wraps in a field? If I have a word which has a length greater than the width of the field it is contained in, how can I get it to wrap anywhere other than at the end of the word? ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Database: INSERTS, speed and primary keys
Thanks for that Monte, On 27 September 2010 13:44, Monte Goulding mo...@sweattechnologies.comwrote: UNIQUE INDEX `mykey` (`name`, `type`, `location`, `handler_num`) ); Or you can use a separate Create Unique Index statement. OK - will have to read up more on Indexes - I thought they were just for speeding up searches - looks like they have some relationship to constraints as well. PS MYSQL Workbench is free, cross platform and make nice diagrams ;-) Yes - started using it after your earlier post. Also started using the Lua scritping - there si a script for exporting the schema as sqlite create sql that I am using. Trouble is it is easy to start making really big schema's :) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
SelectedChunk
Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Stability in LC 4.5?
I found I could crash 4.5 reliably by clicking on a certain button in my rather complex clinical management stack. The button sets up an enhanced find function then lists the cards on which a textstring is found in a given field. I have not been able to track down at which point in my script it fails. I sent in a bug report to supp...@runvrev.com , with a crash log. Have not heard anything back. Meanwhile I'm back to using 4.0, as I cannot afford unexpected crashes in something I use daily. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 24, 2010, at 8:12 PM, J. Landman Gay wrote: On 9/24/10 2:21 PM, dunb...@aol.com wrote: I have had a few problems with rev 4.0. In the last few days I have had a handful of freezes with LC 4.5. Anyone else noticing this? I was hoping for more stability, not less. On G5, OS 10.4.11 It's been pretty solid for me, but I just gave up my only Leopard machine so I'm on a different configuration now. This is the kind of stuff that should go into a bug report though. Crashes/freezes are alway high priority items. Include a crash log if there's an entry for it in there. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
ANN: Installer Maker Plugin 1.4
Dear RunRev/LiveCode users, I am pleased to announce that Economy-x-Talk has just released a new version of the Installer Maker Plugin for Runtime Revolution/LiveCode. The Installer Maker Plugin is a tool to quickly wrap your RR/LC standalones in an installer for Mac OS X or Windows. This new version provides improved 64 bit compatibility (currently being tested) and compatibility with LiveCode 4.5. For more information, including downloads, please visit http://qurl.tk/ce . -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
I'm positive this can be shortened, but as is should do what you want. It could be simplified greatly of course if you are forcing only whole word selections, but this will account for partial word selects, and also just an insertion point. * on mouseUp -- Determine if there is actually a selection of more than 1 char if word 2 of the selectedchunk - word 4 of the selectedchunk 0 then put word 2 of the selectedchunk into tChar else put word 4 of the selectedchunk into tChar end if -- Determine if the selection is already on a word boundary. --if so determine which word the break is at. if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp putWord: the number of words in tTmp + 1 into tWord end if -- if a match hasn't been found yet, and we're not at the field start -- nudge 1 char left and check for word break. Repeat until top of field or match repeat while tChar 1 and tCharMatch is empty subtract 1 from tChar if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp put Word: the number of words in tTmp + 1 into tWord else if tChar = 0 then --if we reach the start of the field, must be the first word put Word: 1 into tWord end if end repeat answer information tWord end mouseUp* On Mon, Sep 27, 2010 at 7:17 AM, Warren Kuhl warrenk...@gmail.com wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
Mike, Thank you very much for this. I really appreciate it. Looks exactly like what I was looking for. You mentioned forcing only whole words. Is this a command? Or something I would need to program? Thanks again! Warren On Mon, Sep 27, 2010 at 9:21 AM, Mike Bonner bonnm...@gmail.com wrote: I'm positive this can be shortened, but as is should do what you want. It could be simplified greatly of course if you are forcing only whole word selections, but this will account for partial word selects, and also just an insertion point. * on mouseUp -- Determine if there is actually a selection of more than 1 char if word 2 of the selectedchunk - word 4 of the selectedchunk 0 then put word 2 of the selectedchunk into tChar else put word 4 of the selectedchunk into tChar end if -- Determine if the selection is already on a word boundary. --if so determine which word the break is at. if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp putWord: the number of words in tTmp + 1 into tWord end if -- if a match hasn't been found yet, and we're not at the field start -- nudge 1 char left and check for word break. Repeat until top of field or match repeat while tChar 1 and tCharMatch is empty subtract 1 from tChar if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp put Word: the number of words in tTmp + 1 into tWord else if tChar = 0 then --if we reach the start of the field, must be the first word put Word: 1 into tWord end if end repeat answer information tWord end mouseUp* On Mon, Sep 27, 2010 at 7:17 AM, Warren Kuhl warrenk...@gmail.com wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
Would have to program it, and now that i'm more awake, not sure you need to go through all the convoluted stuff I did. This is probably closer to what you can end up with. on mouseUp put word 2 of the selectedchunk into tChar put char 1 to tChar of field 1 into tTmp put the number of words in tTmp end mouseUp This will work with the exception that if your selection includes a space at the left the wordcount will be off by 1, so you'd have to test and decide how you want it to behave in that situation. Will also have to test for a simple insertion point rather than a selection also and adjust accordingly. To force full word selections, I believe one of the Marks posted something a not too long ago that would do this... The gist of the script (If I recall correctly) was that when a selection is made, you check for word boundaries to the right and left and adjust the selection accordingly. Once you have your char positions you can set the selection. select char 5 to 12 of field yourfield I haven't actually tried the forced selection part. G'luck with all this. If I can locate the script I'm trying to remember, i'll post a link. On Mon, Sep 27, 2010 at 8:40 AM, Warren Kuhl warrenk...@gmail.com wrote: Mike, Thank you very much for this. I really appreciate it. Looks exactly like what I was looking for. You mentioned forcing only whole words. Is this a command? Or something I would need to program? Thanks again! Warren On Mon, Sep 27, 2010 at 9:21 AM, Mike Bonner bonnm...@gmail.com wrote: I'm positive this can be shortened, but as is should do what you want. It could be simplified greatly of course if you are forcing only whole word selections, but this will account for partial word selects, and also just an insertion point. * on mouseUp -- Determine if there is actually a selection of more than 1 char if word 2 of the selectedchunk - word 4 of the selectedchunk 0 then put word 2 of the selectedchunk into tChar else put word 4 of the selectedchunk into tChar end if -- Determine if the selection is already on a word boundary. --if so determine which word the break is at. if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp putWord: the number of words in tTmp + 1 into tWord end if -- if a match hasn't been found yet, and we're not at the field start -- nudge 1 char left and check for word break. Repeat until top of field or match repeat while tChar 1 and tCharMatch is empty subtract 1 from tChar if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp put Word: the number of words in tTmp + 1 into tWord else if tChar = 0 then --if we reach the start of the field, must be the first word put Word: 1 into tWord end if end repeat answer information tWord end mouseUp* On Mon, Sep 27, 2010 at 7:17 AM, Warren Kuhl warrenk...@gmail.com wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
Mike, Thank you very much. You have been most helpful! All the best! Warren On Mon, Sep 27, 2010 at 10:03 AM, Mike Bonner bonnm...@gmail.com wrote: Would have to program it, and now that i'm more awake, not sure you need to go through all the convoluted stuff I did. This is probably closer to what you can end up with. on mouseUp put word 2 of the selectedchunk into tChar put char 1 to tChar of field 1 into tTmp put the number of words in tTmp end mouseUp This will work with the exception that if your selection includes a space at the left the wordcount will be off by 1, so you'd have to test and decide how you want it to behave in that situation. Will also have to test for a simple insertion point rather than a selection also and adjust accordingly. To force full word selections, I believe one of the Marks posted something a not too long ago that would do this... The gist of the script (If I recall correctly) was that when a selection is made, you check for word boundaries to the right and left and adjust the selection accordingly. Once you have your char positions you can set the selection. select char 5 to 12 of field yourfield I haven't actually tried the forced selection part. G'luck with all this. If I can locate the script I'm trying to remember, i'll post a link. On Mon, Sep 27, 2010 at 8:40 AM, Warren Kuhl warrenk...@gmail.com wrote: Mike, Thank you very much for this. I really appreciate it. Looks exactly like what I was looking for. You mentioned forcing only whole words. Is this a command? Or something I would need to program? Thanks again! Warren On Mon, Sep 27, 2010 at 9:21 AM, Mike Bonner bonnm...@gmail.com wrote: I'm positive this can be shortened, but as is should do what you want. It could be simplified greatly of course if you are forcing only whole word selections, but this will account for partial word selects, and also just an insertion point. * on mouseUp -- Determine if there is actually a selection of more than 1 char if word 2 of the selectedchunk - word 4 of the selectedchunk 0 then put word 2 of the selectedchunk into tChar else put word 4 of the selectedchunk into tChar end if -- Determine if the selection is already on a word boundary. --if so determine which word the break is at. if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp putWord: the number of words in tTmp + 1 into tWord end if -- if a match hasn't been found yet, and we're not at the field start -- nudge 1 char left and check for word break. Repeat until top of field or match repeat while tChar 1 and tCharMatch is empty subtract 1 from tChar if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp put Word: the number of words in tTmp + 1 into tWord else if tChar = 0 then --if we reach the start of the field, must be the first word put Word: 1 into tWord end if end repeat answer information tWord end mouseUp* On Mon, Sep 27, 2010 at 7:17 AM, Warren Kuhl warrenk...@gmail.com wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
http://forums.runrev.com/phpBB2/viewtopic.php?f=7t=3199 Not the post I was thinking of, but some really useful stuff in that forum thread about whole word selections. On Mon, Sep 27, 2010 at 9:05 AM, Warren Kuhl warrenk...@gmail.com wrote: Mike, Thank you very much. You have been most helpful! All the best! Warren On Mon, Sep 27, 2010 at 10:03 AM, Mike Bonner bonnm...@gmail.com wrote: Would have to program it, and now that i'm more awake, not sure you need to go through all the convoluted stuff I did. This is probably closer to what you can end up with. on mouseUp put word 2 of the selectedchunk into tChar put char 1 to tChar of field 1 into tTmp put the number of words in tTmp end mouseUp This will work with the exception that if your selection includes a space at the left the wordcount will be off by 1, so you'd have to test and decide how you want it to behave in that situation. Will also have to test for a simple insertion point rather than a selection also and adjust accordingly. To force full word selections, I believe one of the Marks posted something a not too long ago that would do this... The gist of the script (If I recall correctly) was that when a selection is made, you check for word boundaries to the right and left and adjust the selection accordingly. Once you have your char positions you can set the selection. select char 5 to 12 of field yourfield I haven't actually tried the forced selection part. G'luck with all this. If I can locate the script I'm trying to remember, i'll post a link. On Mon, Sep 27, 2010 at 8:40 AM, Warren Kuhl warrenk...@gmail.com wrote: Mike, Thank you very much for this. I really appreciate it. Looks exactly like what I was looking for. You mentioned forcing only whole words. Is this a command? Or something I would need to program? Thanks again! Warren On Mon, Sep 27, 2010 at 9:21 AM, Mike Bonner bonnm...@gmail.com wrote: I'm positive this can be shortened, but as is should do what you want. It could be simplified greatly of course if you are forcing only whole word selections, but this will account for partial word selects, and also just an insertion point. * on mouseUp -- Determine if there is actually a selection of more than 1 char if word 2 of the selectedchunk - word 4 of the selectedchunk 0 then put word 2 of the selectedchunk into tChar else put word 4 of the selectedchunk into tChar end if -- Determine if the selection is already on a word boundary. --if so determine which word the break is at. if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp putWord: the number of words in tTmp + 1 into tWord end if -- if a match hasn't been found yet, and we're not at the field start -- nudge 1 char left and check for word break. Repeat until top of field or match repeat while tChar 1 and tCharMatch is empty subtract 1 from tChar if char tChar of field 1 is space then put true into tCharMatch put char 1 to tChar of field 1 into tTmp put Word: the number of words in tTmp + 1 into tWord else if tChar = 0 then --if we reach the start of the field, must be the first word put Word: 1 into tWord end if end repeat answer information tWord end mouseUp* On Mon, Sep 27, 2010 at 7:17 AM, Warren Kuhl warrenk...@gmail.com wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please
Re: use-revolution Digest, Vol 84, Issue 56
On 27 Sep 2010, at 2:12 pm, Richmond Mathewson wrote: [ they cannot be that other-worldly ] Oh but they are! (or at least, too alien for my abilities) And yes, the point is not to have any set up panel run separately from the LiveCard standalone. Best Wishes, David Glasgow Carlton Glasgow Partnership i-psych.co.uk ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
What have I done?
Rev 4.0 is in revolt. (LiveCode is fine.) I write in script: put 3 into x and when I try to compile I get a message Can't create a variable by that name. Or any other name for that matter. I think I may have messed up the global variables. They are the same as before except for the global Each. Formerly it had the values: each,global but is now they are msg,global I can't find a way to reset it and I don't really know that that is the source of my problem. Any suggestion, short of reinstalling? Jim ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
What have I done?
P.S. I can run preexisting scripts, I just can't make any changes. It is as if I have lost privileges. Jim Rev 4.0 is in revolt. (LiveCode is fine.) I write in script: put 3 into x and when I try to compile I get a message Can't create a variable by that name. Or any other name for that matter. I think I may have messed up the global variables. They are the same as before except for the global Each. Formerly it had the values: each,global but is now they are msg,global I can't find a way to reset it and I don't really know that that is the source of my problem. Any suggestion, short of reinstalling? Jim ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
Did you change your preferences, checking strict compilation mode? This would require that you declare your variables, and not be able to load them on the fly. Craig Newman ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
James- Monday, September 27, 2010, 9:01:54 AM, you wrote: Rev 4.0 is in revolt. (LiveCode is fine.) I write in script: put 3 into x and when I try to compile I get a message Can't create a variable by that name. You have turned on the explicitVariables failsafe mechanism, which ensures that you can't accidentally get yourself into trouble. Try one of these two things: local x put 3 into x or open Rev's preferences, select Script Editor and deselect strict compilation mode -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
What have I done?
Craig and Mark, That was the problem. I have a vague recollection of changing that in the preference dialog box just to see what would happen, and then the phone rang. By the time I got of the phone my short term memory bank had been reprogrammed. I used to have about 68 K short term memory. It has dwindled to about 8 k. Thanks, Jim P.S. I can run preexisting scripts, I just can't make any changes. It is as if I have lost privileges. Jim Rev 4.0 is in revolt. (LiveCode is fine.) I write in script: put 3 into x and when I try to compile I get a message Can't create a variable by that name. Or any other name for that matter. I think I may have messed up the global variables. They are the same as before except for the global Each. Formerly it had the values: each,global but is now they are msg,global I can't find a way to reset it and I don't really know that that is the source of my problem. Any suggestion, short of reinstalling? Jim ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
at least you got 8k... all I have are a couple registers and a very short stack... On Mon, Sep 27, 2010 at 1:28 PM, James Hurley jhurley0...@sbcglobal.netwrote: Craig and Mark, That was the problem. I have a vague recollection of changing that in the preference dialog box just to see what would happen, and then the phone rang. By the time I got of the phone my short term memory bank had been reprogrammed. I used to have about 68 K short term memory. It has dwindled to about 8 k. Thanks, Jim P.S. I can run preexisting scripts, I just can't make any changes. It is as if I have lost privileges. Jim Rev 4.0 is in revolt. (LiveCode is fine.) I write in script: put 3 into x and when I try to compile I get a message Can't create a variable by that name. Or any other name for that matter. I think I may have messed up the global variables. They are the same as before except for the global Each. Formerly it had the values: each,global but is now they are msg,global I can't find a way to reset it and I don't really know that that is the source of my problem. Any suggestion, short of reinstalling? Jim ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- http://www.andregarzia.com All We Do Is Code. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
You may want to back that up off site. Craig In a message dated 9/27/10 12:28:40 PM, jhurley0...@sbcglobal.net writes: I used to have about 68 K short term memory. It has dwindled to about 8 k. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
Luxury! I dream about having a register! All I have is the bottom of a rusty soup tin, and I have to scratch tick marks on it with a broken stick! On Sep 27, 2010, at 10:40 AM, Andre Garzia wrote: at least you got 8k... all I have are a couple registers and a very short stack... On Mon, Sep 27, 2010 at 1:28 PM, James Hurley jhurley0...@sbcglobal.netwrote: Craig and Mark, That was the problem. I have a vague recollection of changing that in the preference dialog box just to see what would happen, and then the phone rang. By the time I got of the phone my short term memory bank had been reprogrammed. I used to have about 68 K short term memory. It has dwindled to about 8 k. Devin Asay Humanities Technology and Research Support Center Brigham Young University ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
Devin- Monday, September 27, 2010, 9:47:13 AM, you wrote: Luxury! I dream about having a register! All I have is the bottom of a rusty soup tin, and I have to scratch tick marks on it with a broken stick! Wow! A soup tin... all I have is... aw, I forget what I have... -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: use-revolution Digest, Vol 84, Issue 56
On 09/27/2010 06:22 PM, David Glasgow wrote: On 27 Sep 2010, at 2:12 pm, Richmond Mathewson wrote: [ they cannot be that other-worldly ] Oh but they are! (or at least, too alien for my abilities) And yes, the point is not to have any set up panel run separately from the LiveCard standalone. Well; I worked that bit out . . . Back to Richmond's bl**dy Nostromo: If it is connected sans the set-up panel RunRev/Livecode ca pick up some signals from it; once the set-up panel is installed it can only pick up signals that have been 'moderated' by the set-up panel. This made me wonder if RunRev/Livecode couldn't possibly pick up all 'raw' USB device signals ?? Best Wishes, David Glasgow Carlton Glasgow Partnership This weekend I might just treat myself to a crappy USB joystick . . . :) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
Message: 18 Date: Mon, 27 Sep 2010 09:59:01 -0700 From: Mark Wieder mwie...@ahsoftware.net Subject: Re: What have I done? To: How to use Revolution use-revolution@lists.runrev.com Message-ID: 28318156578.20100927095...@ahsoftware.net Content-Type: text/plain; charset=us-ascii Devin- Monday, September 27, 2010, 9:47:13 AM, you wrote: Luxury! I dream about having a register! All I have is the bottom of a rusty soup tin, and I have to scratch tick marks on it with a broken stick! Wow! A soup tin... all I have is... aw, I forget what I have... Does that make you forget full? Jim ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
The selectedChunk gives the segment of text selected, in the form char chartPosition to endPosition of field n If the selection is empty (insertion point only), the result is something like char 5 to 4 of field 9 -- in this case to get the number of the word containing the insertion point, use: the number of words of char 1 to (word 4 of the selectedchunk) of field 9 If a run of text is selected then the above will get the number of the word containing the end of the selection. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Sep 27, 2010, at 9:17 AM, Warren Kuhl wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
Ok thats cool. So if its NOT just an insertion point then the number of words of char 1 to (word 2 of the selectedchunk) of field yourfield will give the number of words preceeding the selection? So this whole thing could boil down to on mouseUp if word 4 of the selectedchunk word 2 of the selectedchunk then put the number of words of (char 1 to (word 4 of the selectedchunk) of field 1) else put the number of words of (char 1 to (word 2 of the selectedchunk) of field 1) end if end mouseUp I knew I was making my solution WAY too difficult. Thanks for this. On Mon, Sep 27, 2010 at 11:39 AM, Peter Brigham MD pmb...@gmail.com wrote: The selectedChunk gives the segment of text selected, in the form char chartPosition to endPosition of field n If the selection is empty (insertion point only), the result is something like char 5 to 4 of field 9 -- in this case to get the number of the word containing the insertion point, use: the number of words of char 1 to (word 4 of the selectedchunk) of field 9 If a run of text is selected then the above will get the number of the word containing the end of the selection. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig http://home.comcast.net/%7Epmbrig On Sep 27, 2010, at 9:17 AM, Warren Kuhl wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
Nevermind. *sigh* Number of words prior to selection or insertion point is put the number of words of (char 1 to (word 2 of the selectedchunk) of field 1) Rev is far more amazing than I can make it be. So is Livecode! On Mon, Sep 27, 2010 at 11:50 AM, Mike Bonner bonnm...@gmail.com wrote: Ok thats cool. So if its NOT just an insertion point then the number of words of char 1 to (word 2 of the selectedchunk) of field yourfield will give the number of words preceeding the selection? So this whole thing could boil down to on mouseUp if word 4 of the selectedchunk word 2 of the selectedchunk then put the number of words of (char 1 to (word 4 of the selectedchunk) of field 1) else put the number of words of (char 1 to (word 2 of the selectedchunk) of field 1) end if end mouseUp I knew I was making my solution WAY too difficult. Thanks for this. On Mon, Sep 27, 2010 at 11:39 AM, Peter Brigham MD pmb...@gmail.comwrote: The selectedChunk gives the segment of text selected, in the form char chartPosition to endPosition of field n If the selection is empty (insertion point only), the result is something like char 5 to 4 of field 9 -- in this case to get the number of the word containing the insertion point, use: the number of words of char 1 to (word 4 of the selectedchunk) of field 9 If a run of text is selected then the above will get the number of the word containing the end of the selection. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig http://home.comcast.net/%7Epmbrig On Sep 27, 2010, at 9:17 AM, Warren Kuhl wrote: Is there an easy way to retrieve the word # of a field based on the SelectedChunk? The SelectedChunk contains the start/end position of a word of a field. Just am trying to determine which word without to much coding...if possible. Thanks for any help! Warren ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: SelectedChunk
You can work out exactly what you want if you realize that the result of the selectedChunk is always char chartPosition to endPosition of field n, and this will be as you would expect if the selection is not empty: ie, in this is a sample string of text in field 1, selecting the characters is a sample would result in a selectedchunk of char 6 to 16 of field 1 in which case the number of words of char 1 to (word 2 of the selectedchunk) of field 1 would be: the number of words of char 1 to 6 of field 1, ie, the number of words of this i which is 2 and if the selection is empty then indeed the selectedchunk is always of the form char n to n-1 of field 1: So putting the insertion point before is in the above example would result in a selectedchunk of char 6 to 5 of field 1 and therefore the number of words of char 1 to (word 2 of the selectedchunk) of field 1 would be the number of words of char 1 to 5 of field 1, ie, the number of words of this which is 1 On Sep 27, 2010, at 1:53 PM, Mike Bonner wrote: Nevermind. *sigh* Number of words prior to selection or insertion point is put the number of words of (char 1 to (word 2 of the selectedchunk) of field 1) Rev is far more amazing than I can make it be. So is Livecode! Yes indeed. Once you get the hang of chunk expressions you can do *lots* of things -- auto-format phone numbers, insert boilerplate at particular points in a field, extract specific information from a field or other container, etc. I have a little function to get the zip code for an address by sending the address to google maps, fetching the htmltext of the resulting URL, parsing it to get the zip code from the middle of the htmltext, and returning the zip -- all behind the scenes without displaying the webpage. Takes less than a second with a fast internet connection, the zip code is inserted after the address, and the user never needs to know what goes on behind the scenes. On Mon, Sep 27, 2010 at 11:50 AM, Mike Bonner bonnm...@gmail.com wrote: Ok thats cool. So if its NOT just an insertion point then the number of words of char 1 to (word 2 of the selectedchunk) of field yourfield will give the number of words preceeding the selection? Yes, but see above -- it would include the word that starts the selection. So this whole thing could boil down to on mouseUp if word 4 of the selectedchunk word 2 of the selectedchunk then put the number of words of (char 1 to (word 4 of the selectedchunk) of field 1) else put the number of words of (char 1 to (word 2 of the selectedchunk) of field 1) end if end mouseUp Pretty much. I knew I was making my solution WAY too difficult. Thanks for this. No problem. Check out the dictionary entries for not only selectedchunk but also offset, wordoffset, itemoffset, and related terms, then do some experimentation. Text parsing in Rev, er, LiveCode, is very powerful. -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: What have I done?
That reminds me of the chorus of a song that takes me well back to the mid 80s and being a schoolkid: Hey, hey 16k What does that get you today? It's not enough even for a letter Old school RAM packs were much better! Steve -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/What-have-I-done-tp2715718p2716147.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RunRev, er, LiveCode on MacNN
Posted an hour ago apparently: http://www.macnn.com Judy ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: RunRev, er, LiveCode on MacNN
Here's the direct link: http://www.macnn.com/articles/10/09/27/revamp.offers.new.ios.development.environment/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution