ASTDan Posted July 12, 2008 Report Share Posted July 12, 2008 Hello, I am a big fan of open G but something has been has peeked my curiostity. What does Open G Dictionary pallette do? I have been trying to find some documentation on this, but have failed. Can anyone point me to some documentation on what these curious set of tools do? Does anybody else use Open G Dictionary? Do you like it? Is it a form of GOOP? If so how does it compare? Thanks Dan Quote Link to comment
gb119 Posted July 12, 2008 Report Share Posted July 12, 2008 QUOTE (ASTDan @ Jul 11 2008, 09:10 PM) What does Open G Dictionary pallette do? I have been trying to find some documentation on this, but have failed. Can anyone point me to some documentation on what these curious set of tools do?Does anybody else use Open G Dictionary? Do you like it? Is it a form of GOOP? If so how does it compare? The term dictionary is borrowed from Python. Other languages would call these data structures hashes or associative arrays or maps. Basically it's an array that stores data indexed by a non-integer key. Typically one would use a string, so rather than having surname[1]="Smith" you would have surname["James"]="Smith". This can make it very easy to construct data storage where items of data naturally have names rather than positional indices. I tend to use a dictionary structure to store experimental metadata eg. sample temperature, applied magnetic field, instrument settings like ranges, heater powers etc. The OpenG dictionaries are far from the only implementation - in recent versions of LabVIEW the variant attributes can be used to make a reasonably efficient dictionary, as can implementations using single element queues. There's been several discussions in recent months over the most efficient implementation. Here, for example. Quote Link to comment
Jim Kring Posted July 12, 2008 Report Share Posted July 12, 2008 Gavin: Thanks for the great description of dictionaries. Dan: You can find some documentation here. Also, take a look here: Examples <LabVIEW>\examples\OpenG\dictionary\ Help Docs <LabVIEW>\help\OpenG\dictionary\Dictionary.htm Cheers, Quote Link to comment
ASTDan Posted July 13, 2008 Author Report Share Posted July 13, 2008 Wow thanks for the explanaiton. This opens more questions for me. In my projects currently I store all my data in a type def cluster within a FGV (i.e. file paths, channel names, etc). I store this data in an .ini file using Open G's tools. What I like about this I can eaisly find my data in the cluster using the unbundle by Name function. It is also very east to add data values later. Is there a better way to do this? What I am looking for is a good method for a data repository. I want to save the values to file, load them into memory, and access them easily. I am happy with my current method but as always there is probably a better way to do this. Dictionaries look interesting. What would be the advantage/disadvantage of using a dictionary over this method? Thanks Dan Quote Link to comment
crelf Posted July 13, 2008 Report Share Posted July 13, 2008 QUOTE (ASTDan @ Jul 12 2008, 11:16 AM) What I am looking for is a good method for a data repository. I want to save the values to file, load them into memory, and access them easily. We often use a current value table (CVT) that's based on the attributes of a variant (with polymorphic write and read methods). I haven't written a method that writes/reads the repository items to/from file, but that would be pretty trivial. Sorry I can't upload the toolkit (it's part of our internal reuse library), but here's a screen shot that give you an idea of the process: http://lavag.org/old_files/monthly_07_2008/post-181-1215876907.gif' target="_blank"> Quote Link to comment
crelf Posted July 13, 2008 Report Share Posted July 13, 2008 QUOTE (crelf @ Jul 12 2008, 11:36 AM) I haven't written a method that writes/reads the repository items to/from file, but that would be pretty trivial. Done! Thanks for the inspiration :thumbup: http://lavag.org/old_files/monthly_07_2008/post-181-1215889423.gif' target="_blank"> Quote Link to comment
ASTDan Posted July 14, 2008 Author Report Share Posted July 14, 2008 So to translate to what I think you are doing. The varient could be thought of as my big cluster. Each attribute of that variant could be thought of as an element in my big cluster? Is that close or am I way off. Dan Quote Link to comment
crelf Posted July 14, 2008 Report Share Posted July 14, 2008 QUOTE (ASTDan @ Jul 12 2008, 07:31 PM) The varient could be thought of as my big cluster. Each attribute of that variant could be thought of as an element in my big cluster? Is that close or am I way off. You're spot-on. This pattern isn't for every situtation, as it's loosely-typed. That said, it's the looseness that makes it so powerful. We use it in one of our standard architectures to apss data between asynchronous nodes using user events, and it's amazingly fast. Quote Link to comment
ASTDan Posted September 30, 2008 Author Report Share Posted September 30, 2008 I have been thinking about the CVT lately and I keep coming back to this problem. When you define a name for something to put in your CVT how do you remember it? Do you create a type def of string combos? How do you document/comunicate the names of the variables in your CVT to yourself and other people? Thanks Dan Quote Link to comment
crelf Posted September 30, 2008 Report Share Posted September 30, 2008 QUOTE (ASTDan @ Sep 29 2008, 10:33 AM) When you define a name for something to put in your CVT how do you remember it? How do you document/comunicate the names of the variables in your CVT to yourself and other people? That's a really important point for any loosley-defined datatype. We do two things: Document every key-value pair in the SDD, including where it is spawned and where it is destroyed (if anywhere) We also have a probe VI that watches all messages in the CVT, and can log to disk (this is vital when debugging) Quote Link to comment
ASTDan Posted September 30, 2008 Author Report Share Posted September 30, 2008 Would a string combo Type def be a good idea to avoid spelling mistakes? Is a string combo type def containing all the variable names a good or bad idea? You could have what each variable documented in the custom control and you could put it under SCC. Also 2 developers are working on the same program. Developer A addes a variable lets say Sample Rate today. Developer B addes a variable named Sample Time the next day. These are 2 variables that do essentialy the same thing. How do you manage this situation? Quote Link to comment
crelf Posted September 30, 2008 Report Share Posted September 30, 2008 QUOTE (ASTDan @ Sep 29 2008, 11:09 AM) Would a string combo Type def be a good idea to avoid spelling mistakes? That would work if you didn't want the CVT to grow or contract dynamically (which is, btw, a valid usecase). You're basically defining all the allowable keys up front. QUOTE (ASTDan @ Sep 29 2008, 11:09 AM) Also 2 developers are working on the same program. Developer A addes a variable lets say Sample Rate today. Developer B addes a variable named Sample Time the next day. These are 2 variables that do essentialy the same thing. How do you manage this situation? Two steps: Developer A documents his variable and Developer B talks to Developer A. We also try to define as many of the variables at the SDD stage as possible, then developers become responsible for the group of variables specific to their module and are the person to go to if you want to get a variable or create one. Network the synergies and spread the knowledge! Quote Link to comment
ASTDan Posted September 30, 2008 Author Report Share Posted September 30, 2008 Thanks for stimulating my rotting brain. :beer: And answering my dumb questions :beer: Quote Link to comment
crelf Posted September 30, 2008 Report Share Posted September 30, 2008 QUOTE (ASTDan @ Sep 29 2008, 03:35 PM) Thanks for stimulating my rotting brain. Anytime. Maybe it's time you moved into a more http://www.viengineering.com/' rel='nofollow' target="_blank">mentally stimulating environment... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.