what is the inverse of set? - dart

I was trying to jump around documents on line, and i see the set function for when i do set("myString", "hello"); or set("myMap.test", "world"); but i was curious as to what the inverse is? I figured unset but when looking online at the Properties sections of Polymer 1.0 Dart code, i wasnt quite getting the information I wanted.
What is the inverse of set, to remove an attribute? My particular use case is to remove a key from a map, unset("myMap.testKey");
Since set is defined in Polymer_base.dart, i thought it would rest somewhere within that file, but i did not see any "unset" or similar.

I don't know if it works but I would remove the element from the map and then call
notifyPath('myMap.testKey, null);
If the values was null already then this probably won't work.

Related

How to be able to use System Entity, in fulfillment, in Dialogflow?

I am getting undefined, when using agent.parameters.geo-country while using the System entity #Sys.geo-country.
This is the error I am getting.
https://drive.google.com/file/d/1-rP9rkvOB3Wm0KyGn846iFbMBFb2Iu9c/view?usp=drivesdk
JSON property syntax (x.y.z) doesn't like the dash. In order to get around that, you can use the alternative bracket syntax (x['y']['z'])
In your case, you could use agent.parameter['geo-country'].
Another thing you can do instead is look at the name of the paramter, and change it if you want.
For example, in the case below, the entity type is #sys.any, but I've named it to search. This means I could instead use agent.parameter.search which may be more useful to me.

How to update value in angular ui typeahead directive if no matching option is found

I've an array of objects containing title and salary which is used in typeahead directive.
I display department name and get entire object as value.
If none of the options match, I want user entered string to be converted to object still. Is there any way to update that?
This answer is pretty late, but I would just use ng-blur (to trap the end of the users input) along with a variable bound to typeahead-no-results. Then test if the variable is true in the method bound to ng-blur, and, if so, make an object out of the String supplied by the user and push it to your data source. Simple example found here.

Return Filtered Module in DXL

I need to make a filter in certain Module and get the filtered items and loop over them and do some kind of operation.
problem is filtering isn't done , something is wrong as follows :
Filter SwTest = includes(attribute "aVerificationStrategy" ,"SwTest")
Filter Implemented = (attribute "aObjectStatus" < "inReview")
Filter SwTestReqsCASTLE = SwTest && Implemented
Module m = srs_doc
set(m, SwTestReqsCASTLE, accepted , rejected)
filtering on OR ApplyFiltering(m) , i tried each as don't know difference !
so what is wrong ?
Before I answer your main question, first allow me to answer your implied question about the difference between "filtering on" and "ApplyFiltering(m)". The difference is that "filtering on" displays the current filter in the module window, meaning that objects are either shown or hidden depending on the filter. "ApplyFiltering(m)" applies the current filter settings to the module explorer (the area to the left of your objects that shows the hierarchy). "filtering on" shows and hides objects and "ApplyFiltering(m)" reflects the status of those objects in the module explorer.
As for why your filters are not being applied, there could be several reasons:
It is good practice to turn filtering off before you start setting filters. Add the line "filtering off" before the rest of your code.
Your "Implemented" filter is not defined properly. DOORS will see "inReview" as a string, and it will perform a direct comparison with the string value of your "aObjectStatus" attribute in order to determine if an object is accepted or rejected. Is this what you intended?
What type of variable is srs_doc? If it's a string then you need to
call read(), share(), or edit() in order to actually open the
module. If it is a module variable then that line is correct.
I am assuming that "accepted" and "rejected" are integers, but if they are not previously declared then they need to be.
Based on the first paragraph in my comment, your last line should read "filtering on"
Is the module you want to filter being displayed? I realize this is probably obvious, but I have made this mistake before so I thought I should mention it. A filter cannot be applied on a module that is not currently being displayed.
As a side note, you can compound your SwTest and Implemented filters without creating extra Filter variables as follows:
Filter SwTestReqsCASTLE = includes(attribute "aVerificationStrategy", "SwTest") && (attribute "aObjectStatus" < "inReview")
I hope some of that helps! Good luck, and let me know if none of the above solves your problem.

Grails findById( null ) returning "random" result

I found a very strange behavior in our grails application today that i want to share with you.
We are using grails 2.3.11 on mysql 5.1.48.
We had a DomainObject.findById( id ) in one of your Controller actions.
We failed to check the id for a null value so DomainObject.findById( null )
would be called when no id is passed as an argument.
Normally DomainObject.findById( null )
will return null but there is a special condition that will yield other results!
If the controller action called before that inserted a new record in the database (lets call it Object B), regardless of the domain object stored, the DomainObject.findById( null ) will find the DomainObject with the same Id the Object B got on insert.
So when the controller action called before saved anything the findById(null) will return a row. And that row will have the same id the last inserted element got.
I am totally aware that using findById(null) is not the desired way to do it but I was quite shocked about the results it yielded. But returning any seemingly "random" result seems very strange to me.
I also want to note that DomainObject.get(null) will not suffer from this problem.
Anybody else witnessed this?
There is an active Jira pointing in this direction: https://jira.grails.org/browse/GRAILS-9628 but its not really describing this issue.
We don't really support passing null as an argument to a dynamic finder like that. Dynamic finders have explicit support for querying by null. Instead of DomainClass.findByName(null) you would call DomainClass.findByNameIsNull(). If you have a reference that may or may not be null, instead of passing that as an argument to a dynamic finder, the code can almost always be made cleaner by writing a criteria query or a "where" query that has a conditional in it.
I hope that helps.
Thx for your information scot.
I have further details. This behaviour is also altered by the underlying database.
While mysql suffers from this, maria-db (a mysql clone) does not!
So what happens is bound to the underlying database system.
That should not happen to an abstraction layer ....

Using OGNL to return data from a Map<String,Object>

Using Struts 2.1.6, xwork 2.1.2 and ognl 2.6.11
In my struts action I have a Map that I am fetching elements from using OGNL. If the key I am using to fetch with does not exist in the map then OGNL returns an empty object array, that OGNL converts to a string and I get the object reference java.lang.Object#6.... This occurs in several places and seems to be the the map having the value generic specified as an Object. This is not something I can change.
I have traced the problem for a while, but when I ended up deep into the guts of the OGNL code and I did not see a light at the end of the tunnel. Currently I am going to go with an ugly hack of checking the string return to see if it starts with "java.lang.Object#" and if so return an empty string. I don't like the solution but thats what time permits.
Has anyone encountered a similar problem?
Also, where did OpenSymphony go? updates to their webiste appear to have dried up, the user forums say they are being converted to Google Groups no later than Nov-12-09
This is a problem with null values: if value is null, default behavior is to create a value using default constructor. Since the value type of your map is Object, new Objects are created where null is.
In order to stop this behavior:
use #CreateIfNull( value = false )
use mapName_CreateIfNull=false in classname-convertion.properties file.

Resources