Custom md chips on basis of condition - angular-material

I am using md-chips in my application but I am not able to customize chips on basis of certain condition. Lets suppose I have two chips and one of them I want readonly ans other one as removable. But when I tried readonly it is making both the chips as readonly. Any suggestions?

This is not apparently possible with a single instance in ng-material. However there is a workaround depending on what you are trying to accomplish that can allow you to have the same set of chips displayed in different positions with different conditions.
What you can do is have two different <md-chips> instances on your page with the same ng-model so that they both match each other.
One md-chips can have readonly set to true and the other can be set to writable and removable. This can be useful if you are trying to display perhaps a "Selected Chips" or "current chips" in one place and the same chips somewhere else in an editing area.

Related

Does it make sense to create both a label and a node with same name?

For example, if iPhone is a brand, and iPhone 8 Plus is product, does it make sense to create two labels label 'iPhone' & 'SmartPhone', but at the same time to create iPhone alone as node, since iPhone as a brand has a few properties of its own:
create (p:iPhone:SmartPhone {name:"iPhone 8 Plus"}),
(b:Brand {name:"iPhone", developer:"Apple", release:"2007"}),
(p)-[:brand]->(b)
Does this sound redundant? Because "iPhone" is used both as a label and a node name. To find all iPhones, I can have:
Match (n:iPhone) return n
or
Match (p:SmartPhone)-[:brand]->(b:Brand {name:"iPhone"}) return p;
Is this a good design? Thanks.
You should name them with common property like "Smartphone", So that you can query for a smartphone with name as iphone. It will actually depend on the schema and the type of data you have.
For example :
If you have a wide range of smartphones of different brands and different levels then it would be easy to search for a node labeled smartphone rather than particular brand.
Hope this helps!
You should avoid redundancy unless it is absolutely necessary. Redundancy requires more data storage, and can make it more difficult to maintain your data model because you have to make sure redundantly stored data is always consistent.
Besides, if you add an index on :Brand(name), your last Cypher example will be fast.

How to hide a TCheckListBox Item?

I have a quite long list of (string) values in a TCheckListBox.
I want to allow the user to do some simple filtering of this list by checking some external CheckBoxes, indicating the filters.
In order to save some coding, I'm looking for a solution that simply hides filtered items in the TCheckListBox.
Question is, is this even possible?
I have found that there are ways to set individual items 'state' and enabled properties, but can't find a 'visible' property.
You cannot "hide" list box items. You must physically remove them from the list. So during your filtering process, you will have to re-populate the list box to display only the relevant items that match the current filter.
Otherwise, switch to something like a Virtual TreeView instead (despite its name, it can also be used to simulate lists and grids as well as trees). Its nodes can be hidden without actually removing them.

Rails: To normalize or not to normalize for few values

Assuming in a Rails app connected to a Postgres database, you have a table called 'Party', which can have less than 5 well-defined party_types such as 'Person' or 'Organization'.
Would you store the party_type in the Party table (e.g. party.party_type = 'Person') or normalize it (e.g. party.party_type = 1 and party_type.id = 1 / party_type.name = 'Person')? And why?
If party type can be defined in code, I'll definitely go with the names "Person" etc.
If you expect such types will be dynamically added by admin/user, and have such GUI for it, then modelling it and set it like party.party_type = 1
Of course there will be a db storage/performance consideration between "1" VS "Person", but that's too minor to considerate when the app is not that big.
There are two issues here:
Are you treating these types generically or not?1
Do you display the type to the user?
If the answer to (1) is "yes", then just adding a row in the table is clearly preferable to changing a constraint and/or your application code.
If the answer to (2) is "yes", then storing a human-readable label in the database may be preferable to translating to human-readable text in the application code.
So in a nutshell, you'd probably want to have a separate table. On the other hand, if all types are known in advance and you just use them to drive specific paths of your application logic without directly displaying to user, then separate table may be superfluous - just define the appropriate CHECK to restrict the field to valid values and clearly document each value.
1 In other words, can you add a new type and the logic of your application will continue to work, or you also need to change the application logic?

Translating choice lists in LightSwitch

Is it possible to translate the display name of choice list items defined for LightSwitch entity properties?
I would like to be able to show different users translated display names in their language when they are viewing the SAME record, and also show translated names in the autocomplete combo box when they are editing a record.
Not really, no. The values are stored in the LSML file & aren't able to be modified at runtime. If you need to translate the values, then you'll need to use a lookup table (possibly by using a custom RIA service) instead of a Choice List.
The advantage of a Choice List is that it's very quick & easy to set one up.
The down side of a Choice List is the lack of flexibility, or even reusability (you have to define the values for the list every time you want to use it somewhere).

Creating new items to put in a list (like the phonebook) iPhone SDK?

Let's say I want to create an app that lets add people to a list (like the phone book). And within this app I'm able to put how many cars this person has and what color it is.
Coming from a C++ background, the logical thing to do is create a linked list with all of of this info. If I wanted to know how many blue cars my friends have, I could use an iterator to count how many blue cars there are.
Would I use the same concept in objective-c? I want to be able to have the little 'plus' sign at the top, right-hand corner of the screen so that I could keep adding people to my list. So my first issue is making this happen. I created a storyboard to make the basics happen. My follow-up issue would be to iterate through the list and count how many 'blue' cars there are.
I'm not asking for code here... I'm asking for concepts. How would you go about doing this?
Use an NSMutableArray which is kindof like a vector in c++. It's not neccessary with a linked list. If you want it twodimensional simply use a NSMutableDictionary which works like a map in c++.
yes here if you can handle global NSMutableArray with its key then it is possible here.....
now as a example if you have people name with name key and also another key with car then when you click on plus sign you add the record in your another error and at last you commit your data with final array....
hope,help it.....
:)

Resources