How to Parent multiples objects or nodes selected to a specific group name ? (maya script) - maya

Could someone know how to Parent multiples objects or nodes selected to a specific group name ?
By a useful script :D
Or only for object have Crowd in the name automaticaly move to the correct goup name.
Thanks all

// grab list of selected objects
$sl = `ls -sl`;
// the group we want to parent to
$group_name = "group1";
// now parent to the group name specified
parent -a $items $group_name;

Related

How do I use the last value in an array as a path for .child() when retrieving a snapshot?

I'm new to Firebase and have a function that writes all of my event ID's to an array. I want to use the last value in that array (the last event ID) to lookup the children of that specific eventID.
I know how to get the last item in the array but how do I put that into my .child() path?
I tried the code below, but it doesn't seem to work. I'm guessing that because .child("(lastEvent)") isn't a valid path.
let lastEvent = eventIDArray.last
refHandle = ref.child("Bouts").child("\(lastEvent)")
How do I plug the lastEvent value in as my path? Or is that even possible? Again, total newbie- alternatives welcome.
Sorting and filtering data
you can use sorting and filtering function to get the item.
To get the last item you can write the query like this.**
let recentBoutsQuery = (ref?.child("Bouts").queryLimited(toLast: 1))!
This will return 1 entry from last of your database which the last entry.
You can learn more from the firebase documentation. Work with Lists of Data

How do you get the assigned group for a ListViewItem in a Coded UI Test?

I'm filtering a list of objects and sorting them based upon certain criteria of their properties into various groups in a ListView. For the Coded UI tests, I generate test data with very specific values. I need to assert that the test data has been sorted into the correct groups. I do not see how to get the group object, group name, or anything else that is remotely close.
Thank you in advance.
Hmmm... After browsing the Locals window, I have found the base object "[Microsoft.VisualStudio.TestTools.UITesting.WinControls.WinListItem]", which seems to have the correct value in the property "HelpText":
foreach (UITestControl item in uIMedSlipListList.Items)
{
WinListItem listItem = item as WinListItem;
if(listItem != null)
{
Console.WriteLine(listItem.HelpText);
}
}
Well, it has the text displayed for the group, not the group name, but I can build a working test off of that.

How to search an element by its name in a web page using selenium webdriver

I am creating groups randomly. Then i need to check whether that group has been created or not. is there any way to search the group by its given name.
or element in a webpage by its name. i am trying it by using By.name locator, but not able to do that.
I just want to get an element in webpage by its name which is given by me/user.
For Ex: i have created a group "gr907", So how i can search or verify whether group having name "gr907" has been created or not.
Kindly Suggest
Given the example element you gave in the comment for your initial post - <span class="grpName">Gr9006</span> - and assuming that other relevant elements share the same class attribute, you could use the following example to retrieve a list of suitable WebElements:
List<WebElement> elements = driver.findElements(By.className("grpName"));
If this doesn't work, then your next course of action could be to make an XPath expression that identifies span tags whose inner text starts with "Gr", such as:
List<WebElement> elements = driver.findElements(By.xpath("//span[contains(text(),'gr')]"));
To find a single element containing the group name created at run time as its exact text content, you can simply pass it in to an XPath like so;
WebElement element = driver.findElement(By.xpath("//span[.='" + group name + "']");

Finding Descendant Item Sets

Let's say I have these Models:
class Category(MP_Node):
name = models.CharField(max_length=30)
class Item(models.Model):
category = models.ForeignKey(Category)
and I would like to find all Items belonging to any descendant of a given Category.
Usually I would write category.item_set but this is just Items belonging to the given level of the hierarchy.
Using the example tree in the treebeard tutorial, if an Item belongs to "Laptop Memory", how would I find all Items belonging to descendants "Computer Hardware" where "Laptop Memory" is one of those descendants?
I just had the same problem and figured out how to do it (consider it inside the function get_queryset of a ListView):
category = Category.objects.filter(slug=self.kwargs['category']).get()
descendants = list(category.get_descendants().all())
return self.model.objects.select_related('category').filter(category__in=descendants+[category, ])
Another option that I came up with was using a filter with 'OR':
from django.db.models import Q
category = Category.objects.filter(slug=self.kwargs['category']).get()
descendants = list(category.get_descendants().all())
return self.model.objects.select_related('category').filter(Q(category__in=category.get_descendants()) | Q(category=category))
I looked at the treebeard code to see how it gets descendants of a node. We can apply the same filters as a related field lookup.
paramcat = Category.objects.get(id=1) # how you actually get the category will depend on your application
#all items associated with this category OR its descendants:
items = Item.objects.filter(category__tree_id=paramcat.tree_id, category__lft__range=(paramcat.lft,paramcat.rgt-1))
I think using intermediate calls like get_descendants will result in one query per descendant, plus load all descendants into memory. It defeats the purpose of using treebeard in the first place
I'd be interested in seeing a custom lookup based on this code, I'm not sure how to do it...

ExtJS Find Node within Tree Branch

I'm trying to check whether a certain node exists beneath a branch of an ExtJS tree. Knowing the ID of the parent node, is there a library function to check whether a node exists beneath the parent (by its ID)?
I've checked the API numerous times over, and can only seem to accomplish this by iterating through the entire branch of the tree.
Is there a library function which allows me to check if a child exists (by its ID) if the parent node ID is known?
Thanks!
PS, to find the parent ID, I'm using the following:
tree.getNodeById('myID');
Ext.tree.TreeNode "contains" function does exactly what you want:
var parent = tree.getNodeById('myID');
parent.contains(tree.getNodeById('childId'));
Have you looked at DomQuery? The API defines the method jsSelect: selects a group of elements.
jsSelect( String selector, [Node/String root] ) : Array
Parameters:
selector : String
The selector/xpath query (can be a comma separated list of selectors)
root : Node/String
(optional) The start of the query (defaults to document).
Returns an Array of DOM elements which match the selector. If there are no matches, and empty Array is returned.

Resources