How to define a list in Inform7 - inform7

I am trying to define a list in Inform7 but it won't work.
Contacts is a list {"Melissa", "Paul"};
That does not work. Can you tell me how to define a list to which elements can be added?

You'll need to first define what kind of values the list holds before you can define what actual values it holds.
Contacts is a list of text that varies. Contacts is {"Melissa", "Paul"}.
This creates a global list that's accessible from anywhere. In rules and phrases you can create a list of constants (text, in this case) with a shorthand:
Instead of examining the phone book:
let contacts be {"Melissa", "Paul"};
...
(See also Writing with Inform ยง21.2.)

Related

Riak: searchable list of maps (with CRDTs)

I have a use-case which consist in storing several maps under an attribute. It's the equivalent JSON list:
[
{"tel": "+33123456789", "type": "work"},
{"tel": "+33600000000", "type": "mobile"},
{"tel": "+79001234567", "type": "mobile"}
]
Also, I'd like to have it searchable at the object level. For instance:
- search entries that have a mobile number
- search entries that have a mobile number and whose number starts with the string "+7"
Since Riak doesn't support sets of maps (but only sets of registers), I was wondering if there is a trick to achieve it. So far I've had 2 ideas
Map of maps
The idea is to generate (randomly?) keys for the objects, and store each object of the list in a parent map whose keys are the ones generated for this only purpose to have a key.
It seems to me that it doesn't allow to search the object (maps inside the parent map) because Riak Solr search requires the full path to the attribute. One cannot simply write the following Solr query: phone_numbers.*.tel:+7*. Also composed search (eg. search entries that have a mobile number and whose number starts with the string "+7") seem hard to achieve.
Sets with simulated multi-valued attributes
This solution consists in using a set and insert all the values of the object as a single string, with separators between them. Yes, it's a hack. An attribute value would look like: $tel:+79001234567$type:mobile$ with : as the attribute name-value separator and $ as the attribute separator.
Search could be feasible using the * wildcard (ugly, but still), except the problem with escaping the separators: what if the type attribute includes a :? Are they some separators that are accepted by Riak and would not be acceptable in a string (I'm thinking of control characters)?
In a nutshell
I'm looking for a solution whatever the hackiness of it, as long as it works. Any idea is welcome.

Defining OpenFOAM fields as functions of space

I have some initial conditions that are specified by functions of (x,y,z).
I would like to programmatically define a field whose values are a function of (x,y,z). Can this be done as part of field construction, rather than looping over cells/faces and setting each value individually?
Further, can I set the internal field and boundary values in a straightforward manner?
You might want to use #codeStream directive to enter the generating code directly in the field defining dictionary, see official documentation.
Also you might want to look at extensions such as groovyBC, funkySetFields or swak4Foam.

Child Content Type (Drupal)

I need to create two content types (Call List and Call Announcements), in Call Announcements there are 5 fields, in Call List there are 12 fields but 5 of them are mutual with Call Announcements, I do not want to create 2 different content types (Call List, Call Announcements) because when the user create a node, he should be able to choose where the node is shown (in Call List, in Call Announcements, Both).
(Call List and Call Announcements should be in the same database table)
How can I do these?
http://i.stack.imgur.com/LAgXM.png
You can create a single content type containing all the fields.
After that add a field with checkboxes with the options like, "show on call list" and "show on call announcements), This extra field can be used to decide how the create/edit/view behaves.
When Creating/Updating content.
Now you may go ahead and install conditional fields, if you want to conditionally show some field based on the values of checkboxes selected.
When viewing content
Use views to display the list. Here you can decide what is shown in the list by filtering the list by the checkbox values. As a bonus extra views would help you decide what fields need to be shown to the user.

Drupal: Creating a view that retrieves related nodes based on terms

I'm trying to wrap my head around getting nodes that share the same taxonomy terms, but I have some questions.
Essentially, I want to display a view at the bottom of my event node that shows related events. I have tags for each event and will be using those to create the match.
In views, when I create a taxonomy argument and add multiple "tags" it searches for nodes with all the specified arguments. What I want is not to search just for nodes that contain all of the arguments, but nodes that contain either or. So far I haven't figured any solutions.
Edit:
Would it be easier to create a simple block module that queries the database for nodes that contain the terms?
I am using a Taxonomy Term ID as argument and then I selected the checkbox that allows Multiple Terms per argument. Notice the help text that says, "If selected, users can enter multiple arguments in the form of 1+2+3 (for OR) or 1,2,3 (for AND)." By using the + sign you will OR the arguments together, but if you use the , then they will be AND together thus forcing nodes to have all terms. For this specific view I am providing the default argument via php and I am using the plus sign to wrap the term ID arguments together. This will give me all the nodes that are tagged with any of the terms supplied as arguments.
edit: I might want to also add that I have the checkbox selected for "Let Multiple arguments work together." That may or may not be needed for your use case, but I needed it for mine.

Find Duplicates from tree list in Dev-Ex

I have a Dev-Ex Tree List which has two columns, List contains elements inside it, Now My question is if i want to add any new item in the list then logic should search existing items in the tree, if no match found then it should allow to add that item in the list,otherwise not.
can i make a method which keep on checking recursively new item with the other item in the list.
Such tasks are usually solved by using TreeList Iterator. I think that the How to Implement an Iterator for the XtraTreeList (FindNode Example) knowledge base article contains the code you are looking for.

Resources