What does the __default__ prefix mean in ng-inspector? - angularjs

What exactly does the __default__ prefix mean in ng-inspector as shown below?
I am trying to access this value and I'm not quite sure how.
Thanks!

The extension certainly didn't add that prefix, if it shows up in ng-inspector, something else added that to your model.

Related

peewee get_or_create and then save: error binding

Is there an easy way to update a field on a get of a get_or_create?
I have a class ItemCategory and I want to either create a new entry or get the already created entry and update a field (update_date).
What I do is:
item,created= ItemCategory.get_or_create(cat=cat_id,item=item_id)
if created == True:
print "created"
else:
item.update_date = datetime.now
item.somethingelse = 'aaa'
item.save()
This works for a while in my loop. But after 50-100 get/create it crashes:
peewee.InterfaceError: Error binding parameter 4 - probably unsupported type.
Maybe I should use upsert(), I tried but wasn't able to get anything working. Also it's not probably the best solution, since it makes a replace of the whole row instead of just a field.
I like peewee, it's very easy and fast to use, but I can't find many full examples and that's a pity
Newbie mistake
item.update_date = datetime.now()
I am not 100% sure this is the only answer though. I modified my code so many times that it might be also something else.
Regarding my question about create_or_update , I've done this:
try:
Item.create(...)
except IntegrityError:
Item.update(...)
peewee is really great, I wonder why no one ever asked for a create_or_update.

Angular NgTagsInputs - RegEx - Allow all values expect Strings

I'm using ngTagsInput where I want to allow all tags expect a few strings.
In their documentation it appears I can specify allowed tags through a regex but I can seem to work it out - been trying http://regexr.com/ for last hour with no luck.
So for example the strings I dont want to be accepted are:
story and global.
How do i go about to say everything is allowed expect those 2?
So for example storyBreaking is allowed but story is not.
Thanks.
try something like that:
(?<![\w\d])abc(?![\w\d]) where abc is your string to match!

Should we put an S in the name of array of things?

It is more an English question than a Coding question, but both are related :
Should we put an S in the name of array of things ? I want to know if it is just an opinion question or if there is a real English rule.
How to name an array of that array ?
Example 1
I have an object named Constraint. I want to create an array of that object. How should I name it ? ConstraintsArray or ConstraintArray ?
Answer
Do not use Hungarian Notation. Call it Constraints.
Example 2
How to name an array of that array ?
Thank you for your answers.
IMO, you should just call it "constraints", without the "array" prefix (referring the Clean code.. :) )
ConstraintsArray seems redundant in meaning.
You can use ConstraintArray or just Constraints.
I think it really depends on the coder himself. No real rules on variable on Grammar. :) . for me I like using singular form eg. ConstraintArray...
That is very much up to your personal style. I would not do it. A personArray is already a list of more than one person. You should know that.
But if the array objects are lists too it's a very different situation. Names like itemsDictionariesList, or repositoriesArray is something I used in my project.

Linq Querying for user search

I am trying to query from search box using list of data and the linq I used is:
data = (From k As BSPLib.ContactLib.Contact In data_org.Values Where k.stringdata Like "%" & Searchtxtbox.Text & "%" Select k.prime).ToList
But this is not working, I am getting no data at all. Data_org is a dictionary so I used the values; k.stringdata contains all the data that need to be searched. Searchtxtbox.text contains the user defined search item.
I Tried with sqlmethods through linq, but sqlmethods does not exist for me, I tried with with Imported namespace yet the code is not showing sql methods, could you please provide a workable query or just tell me where I have gone wrong. Thank you.
My Visual Basic is a bit rusty so forgive me if I have the syntax wrong:
One thing you could use is Contains which will be similar to "%Searchtxtbox.Text%"
and exactly the same if it is used with a DatabaseContext.
I know it is not the same as Like but if that doesn't work than likely something else is wrong and than I would like more code.
data = (From k As BSPLib.ContactLib.Contact In data_org.Values Where k.stringdata.Contains(Searchtxtbox.Text) Select k.prime).ToList
You can additionally use StartsWith and EndsWith for "Searchtxtbox.Text%" and "%Searchtxtbox.Text"
Also would I like to suggest to puth "%" & Searchtxtbox.Text & "%" between Parentheses for clarification, but that's all up to you.
The % wildcard character won't work here, remember this is .NET code, not SQL. You need something like this instead:
data = (
From k As BSPLib.ContactLib.Contact In data_org.Values
Where k.stringdata.Contains(Searchtxtbox.Text) Select k.prime).ToList

Microsoft Surface: "Read" the tag value of an IdentityTag

is it possible to read the value of an IdentityTag if you place it on the TagVisualizer, without having initalized it before?
I would like to use the tags for registering a new object on the Surface but having all the "free" IdentityTags in a Collection for initalizing them all... There must be a better way to do in I think.
But the TagVisualizer doesn't seem to do anything when you put a tag on it that it doesn't know.
If I understand correctly, you'll need to start by setting up your TagVisualizer with a TagVisualizationDefinition with a Matches method that always returns true.

Resources