Search Results

Search found 4350 results on 174 pages for 'chilly child'.

Page 36/174 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • generate parent child relation from the array to print a multi-level menu?

    - by Karthick Selvam
    How to get parent child relation from this array to print a multi-level menu $menus = array ( 0 => array ( 'id'=>0, 'check' => 1, 'display' =>'Arete Home', 'ordering' => -10, 'parent' => none, ), 1 => array ( 'id'=>1, 'check' => 1, 'display' => 'Submit Paper', 'ordering' => -10, 'parent' => 2, 'subordering' => -10, ), 2 => array ( 'id'=>2, 'check' => 1, 'display' => 'Buy Now', 'ordering' => -10, 'parent' => 1, 'subordering' => -10, ), 1461 => array ( 'id'=>1461, 'check' => 1, 'display' => 'Where are We?', 'ordering' => -10, 'parent' => 2, 'subordering' => -10, ), 1463 => array ( 'id'=>1463, 'check' => 1, 'display' =>' About Me?', 'ordering' => -10, 'parent' => 2, 'subordering' => -10, ), 1464 => array ( 'id'=>1464, 'check' => 1, 'display' => 'About You?', 'ordering' => -10, 'parent' => 2, 'subordering' => -10, ), 1465 => array ( 'id'=>1465, 'check' => 1, 'display' => 'About who?', 'ordering' => -10, 'parent' => 1, 'subordering' => -10, ), ); code sample: foreach($menus as $id=>$values) { $values['parent']=isset($values['parent']) ? $values['parent'] : 0; $menus[$values['parent']]['childs'][$id]=$values; unset($menus[$id]); } foreach($menus as $id1=>$value2) { $value2['parent']=isset($value2['parent']) ? $value2['parent'] : 0; $menus[$value2['parent']]['childs'][$id1]=$value2; unset($menus[$id1]); }

    Read the article

  • How can I get a Windows 2008 print server to deploy to child domains?

    - by Tyler Benson
    I am setting up a print server for our company that has a parent domain and 2 child domains. The print server is on the parent domain and I have no problems getting the print server to deploy printers through group policy to users on its own domain. The problem I am having is that it isn't deploying the printers to users that are in it's child domains. Some other info that may help: I am not sharing or listing printers in the directory I have added pushprinterconnections.exe to the group policy login script Does anything come to mind?

    Read the article

  • How to run a command in a process that is not a child of the current process?

    - by amicitas
    I am having a library conflict issue with calling an external program from within a interpreted programming environment (IDL). The issue seems to be that since the program I am calling ends up as a child of IDL, libraries are not being reloaded. From within IDL I can launch sub-processes either directly or using a shell. Is there a good way that I can cause my program to be run without ending up as a child process? The only solution I have found so far is to use ssh localhost my_program. This works perfectly but I would like a more direct solution.

    Read the article

  • Is there a way to get x-mouse-type scrolling under the cursor for child windows within one program window?

    - by eigor40
    I've been messing with X-mouse setups, to enable scrolling for whatever is under the cursor, regardless of whether it has the focus or not. I've found several ways to get this to work between various 'parent' windows (Win7's built-in mouse options, WizMouse, etc), but I've found nothing that will do the same thing with (for example) several child windows with spreadsheets, open at the same time in one parent Excel window. I have the spreadsheets set up so that two are visible in the window at the same time, but I always have to click on either one to scroll it up and down. I'd love to be able to scroll these just by moving the mouse and doing the scroll, without the extra focus-change-click. I am not a big fan of running separate parent windows for each spreadsheet, which I realize would be something of a workaround. I'd rather keep the single parent Excel window, but still have X-mouse functionality within it. Anyone know of any way to achieve this? I'd call it "XMouse for Child Windows".

    Read the article

  • What is a robust method for capturing screen of child window in Windows 7?

    - by Dogan Demir
    Pardon my frustration. I've asked about this in many places and I seriously don't think that there wouldn't be a way in Windows 7 SDK to accomplish this. All I want, is to capture part of a 'child window' ( setParent() ) created by a parent. I used to do this with bitblt() but the catch is that the child window can be any type of application, and in my case has OpenGL running in a section of it. If I bitblt() that, then the OGL part comes blank, doesn't get written to the BMP. DWM, particularly dwmRegisterThumbnail() doesn't allow thumbnail generation of child windows. So please give me a direction. Thanks.

    Read the article

  • How to specify a child element in XML schema with a name but any content?

    - by mackenir
    I am trying to write some XML schema code to specify that a particular element 'abc' may have a child element with name 'xyz', and that element may have any attributes, and any child elements. At the moment I have this: <xs:element name="abc"> <xs:complexType> <xs:sequence> <xs:element name="xyz"> <xs:complexType> <xs:sequence> <xs:any/> </xs:sequence> <xs:anyAttribute/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> But when I validate my XML against the schema, I get validation failures complaining about the child elements of the xyz element.

    Read the article

  • PHP: How do I access child properties from a method in a base object?

    - by Nick
    I'd like for all of my objects to be able to return a JSON string of themselves. So I created a base class for all of my objects to extend, with an AsJSON() method: class BaseObject { public function AsJSON() { $JSON=array(); foreach ($this as $key = $value) { if(is_null($value)) continue; $JSON[$key] = $value; } return json_encode($JSON); } } And then extend my child classes from that: class Package extends BaseObject { ... } So in my code, I expect to do this: $Box = new Package; $Box-SetID('123'); $Box-SetName('12x8x6'); $Box-SetBoxX('12'); $Box-SetBoxY('8'); $Box-SetBoxZ('6'); echo $Box-AsJSON(); But the JSON string it returns only contains the BaseClass's properties, not the child properties. How do I modify my AsJSON() function so that $this refers to the child's properties, not the parent's?

    Read the article

  • C# windows application, how to save & restore positions of child forms.

    - by Manish Gupta
    I have a windows application with an MDI form and some child forms. I need to save the position of the child forms and then restore when it is opened again. How to do that in C#? Also, I need to check if the child form's title bar is not hidden under the mdi form (e.g title bar might get hidden because of mdi form's menus). If this is the case, then I need to set the position smartly. Thanks in advance...

    Read the article

  • Grouping parent node based on child elements values and sequence number.

    - by Mahir
    Hi, I need to transform XML using xslt. Logic: Split the parent if the parent having different child address and append the sequence number with parent name. Also need line number for the child. Here we may have number of parent nodes and each parent node may have more number of child nodes. I have tried numerous ways to achieve this and I am stuck with generating sequence number in the foreach. So can any one try and give a solution for this. Source XML as below: P1 CName1 Address1 CName2 Address2 CName3 Address1 P2 CName1 Address1 The target XML should as below: P1_1 CName1 Address1 1 CName2 Address2 2 CName3 Address1 P1_2 1 CName2 Address2 P2_1 1 CName1 Address1

    Read the article

  • Easiest way to keep SSRS child elements in the same relative position when the parent is re-positioned?

    - by Mac
    I am trying to revise the layout of an SSRS report where I have several textboxes that are child elements of a rectangle. When I reposition the parent rectangle down by x, all of the child textboxes maintain the same absolute position. Their "Location" (defined relative to the parent) decreases by x. I then need to reposition the child textboxes. Additionally, if any of these ever has a negative "Location" then the parent rectangle is then repositioned back up by x. What is the easiest way to move everything in unison? I can Control-click everything and then drag them or use the arrow keys, but I want to position everything with precision and the "Location" field in the Properties window disappears when selecting more than one item. Is there a way I can avoid individually computing and typing in every "Location" value every time I have a small layout change? I am using SSRS (11.0.3360.12) within the Visual Studio 2012 Shell. Thanks!

    Read the article

  • Entity Framework 4 Code First and the new() Operator

    - by Eric J.
    I have a rather deep hierarchy of objects that I'm trying to persist with Entity Framework 4, POCO, PI (Persistence Ignorance) and Code First. Suddenly things started working pretty well when it dawned on me to not use the new() operator. As originally written, the objects frequently use new() to create child objects. Instead I'm using my take on the Repository Pattern to create all child objects as needed. For example, given: class Adam { List<Child> children; void AddChildGivenInput(string input) { children.Add(new Child(...)); } } class Child { List<GrandChild> grandchildren; void AddGrandChildGivenInput(string input) { grandchildren.Add(new GrandChild(...)); } } class GrandChild { } ("GivenInput" implies some processing not shown here) I define an AdamRepository like: class AdamRepository { Adam Add() { return objectContext.Create<Adam>(); } Child AddChildGivenInput(Adam adam, string input) { return adam.children.Add(new Child(...)); } GrandChild AddGrandchildGivenInput(Child child, string input) { return child.grandchildren.Add(new GrandChild(...)); } } Now, this works well enough. However, I'm no longer "ignorant" of my persistence mechanism as I have abandoned the new() operator. Additionally, I'm at risk of an anemic domain model since so much logic ends up in the repository rather than in the domain objects. After much adieu, a question: Or rather several questions... Is this pattern required to work with EF 4 Code First? Is there a way to retain use of new() and still work with EF 4 / POCO / Code First? Is there another pattern that would leave logic in the domain object and still work with EF 4 / POCO / Code First? Will this restriction be lifted in later versions of Code First support? Sometimes trying to go the POCO / Persistence Ignorance route feels like swimming upstream, other times it feels like swimming up Niagra Falls.

    Read the article

  • nhibernate will not cascade delete childs

    - by marn
    The scenario is as follows, I have 3 objects (i simplified the names) named Parent, parent's child & child's child parent's child is a set in parent, and child's child is a set in child. mapping is as follows (relevant parts) parent <set name="parentset" table="pc-table" lazy="false" fetch="subselect" cascade="all-delete-orphan" inverse="true"> <key column=FK_ID_PC" on-delete="cascade"/> <one-to-many class="parentchild,parentchild-ns"/> </set> parent's child <set name="childset" table="cc-table" lazy="false" fetch="subselect" cascade="all-delete-orphan" inverse="true"> <key column="FK_ID_CC" on-delete="cascade"/> <one-to-many class="childschild,childschild-ns"/> </set> What i want to achieve is that when i delete the parent, there would be a cascade delete all the way trough to child's child. But what currently happens is this. (this is purely for mapping test purposes) getting a parent entity (works fine) IQuery query = session.CreateQuery("from Parent where ID =" + ID); IParent doc = query.UniqueResult<Parent>(); now the delete part session.Delete(doc); transaction.Commit(); After having solved the 'cannot insert null value' error with cascading and inverse i hopes this would now delete everything with this code, but only the parent is being deleted. Did i miss something in my mapping which is likely to be missed? Any hint in the right direction is more than welcome!

    Read the article

  • treeview loses data when page is being refreshed in asp.net

    - by Greg
    Hi, I have a treeview and I written a code for his "treeNodePopulate" event: protected void ycActiveTree_TreeNodePopulate(object sender, TreeNodeEventArgs e) { if (Application["idList"] != null && e.Node.Depth == 0) { string[] words = ((String)Application["idList"]).Split(' '); // Yellow Card details TreeNode child = new TreeNode(""); // Go over all the yellow card details and populate the treeview for (int i = 1; i < words.Length; i++) { child.SelectAction = TreeNodeSelectAction.None; // Same yellow card if (words[i] != "*") { // End of details and start of point ip's if (words[i] == "$") { // Add the yellow card node TreeNode yellowCardNode = new TreeNode(child.Text); yellowCardNode.SelectAction = TreeNodeSelectAction.Expand; e.Node.ChildNodes.Add(yellowCardNode); child.Text = ""; } // yellow card details else { child.Text = child.Text + words[i] + " "; } } // End of yellow card else { child.PopulateOnDemand = false; child.SelectAction = TreeNodeSelectAction.None; // Populate the yellow card node e.Node.ChildNodes[e.Node.ChildNodes.Count - 1].ChildNodes.Add(child); TreeNode moveChild = new TreeNode("Move To Reviewed"); moveChild.PopulateOnDemand = false; moveChild.SelectAction = TreeNodeSelectAction.Select; e.Node.ChildNodes[e.Node.ChildNodes.Count - 1].ChildNodes.Add(moveChild); child = new TreeNode(""); } } Application["idList"] = null; } } I want the treenode to get the data from the Application variable and then nullify the Application variable so that the tree will take data from Applcation only if there is something in it (I put data into the application from another page and then redirect to this page) But when I refresh this page the data in the treenode isnt being saved. I mean after the refresh the Application is null so he isnt doing anything. The question is why is the data that I put in the treenode earlier isnt being saved? The "enableViewState" property is set to "true".. Thanks in advance, Greg

    Read the article

  • JSF Managed Property question

    - by kidvid
    I have a search page that I'll called "Parent." The search page references a country lookup page that I'll call "Child." When the user selects a country on Child's page and clicks on OK, I set the country back into the parent page. I do this by calling a method on the Parent page called "UpdateCountryCodeWithLookupValue(Child child)" When the user clicks on OK on the Child page, that method gets called in the parent, wherein it'll get the selected country code out of the Child page and set it into a text entry field. My question has to do with the proper way to set up this relationship in the faces config file. The way I have it now is that the child has a managed property for the parent. I.e., in my Child page I defined a method called "SetParent(Parent parent)". Is there any drawback to doing it this way? Would it be preferable to set the managed property so that the Child page class is a property of the parent instead of vice-versa? Let's say that I could have two Parent (search) pages open at the same time, and each of these was able to open the Child page (country code lookup). What would be the ramification for that circumstance in terms of the managed property in the faces config file? Thanks, Adrian

    Read the article

  • Generics and collections ... struggling with an implementation

    - by mattruma
    I am trying to figure out a way to leverage generics so I can make the property Value be an actual type that initialized (not sure if this is the correct way of saying it) when my collection class is created. I would like to have the syntax be something like: var list = new ListItemCollection<Guid>(parameters would go here); I have the following class: [Serializable] public class ListItem { public object Value { get; set; } public string Text { get; set; } public object DataContext { get; set; } public Nullable<bool> Checked { get; set; } public ListItem() { this.Checked = false; } } I have the following collection: [Serializable] public class ListItemCollection : List<ListItem> { public ListItem this[object value] { get { foreach (var child in this) { if (child.Value.Equals(value)) return child; } return null; } } public bool Contains(object value) { foreach (var child in this) { if (child.Value.Equals(value)) return true; } return false; } public void Add(object value, string text) { this.Add(value, text, null); } public void Add(object value, string text, object dataContext) { var child = new ListItem(); child.Value = value; child.Text = text; child.DataContext = dataContext; this.Add(child); } public ListItemCollection() { } public ListItemCollection(IEnumerable items, string displayMember, string valueMember, bool showEmptyItem, string emptyItemText, object emptyItemValue) { if (showEmptyItem) { this.Add(emptyItemValue, emptyItemText); } foreach (object item in items) { object text = null; object value = null; text = item.GetType().GetProperty(displayMember).GetValue(item, null); value = item.GetType().GetProperty(valueMember).GetValue(item, null); // Add the item this.Add(value, text.ToString(), item); } } }

    Read the article

  • compiler warning at C++ template base class

    - by eike
    I get a compiler warning, that I don't understand in that context, when I compile the "Child.cpp" from the following code. (Don't wonder: I stripped off my class declarations to the bare minuum, so the content will not make much sense, but you will see the problem quicker). I get the warning with VS2003 and VS2008 on the highest warning level. The code AbstractClass.h : #include <iostream> template<typename T> class AbstractClass { public: virtual void Cancel(); // { std::cout << "Abstract Cancel" << std::endl; }; virtual void Process() = 0; }; //outside definition. if I comment out this and take the inline //definition like above (currently commented out), I don't get //a compiler warning template<typename T> void AbstractClass<T>::Cancel() { std::cout << "Abstract Cancel" << std::endl; } Child.h : #include "AbstractClass.h" class Child : public AbstractClass<int> { public: virtual void Process(); }; Child.cpp : #include "Child.h" #include <iostream> void Child::Process() { std::cout << "Process" << std::endl; } The warning The class "Child" is derived from "AbstractClass". In "AbstractClass" there's the public method "AbstractClass::Cancel()". If I define the method outside of the class body (like in the code you see), I get the compiler warning... AbstractClass.h(7) : warning C4505: 'AbstractClass::Cancel' : unreferenced local function has been removed with [T=int] ...when I compile "Child.cpp". I do not understand this, because this is a public function and the compiler can't know if I later reference this method or not. And, in the end, I reference this method, because I call it in main.cpp and despite this compiler warning, this method works if I compile and link all files and execute the program: //main.cpp #include <iostream> #include "Child.h" int main() { Child child; child.Cancel(); //works, despite the warning } If I do define the Cancel() function as inline (you see it as out commented code in AbstractClass.h), then I don't get the compiler warning. Of course my program works, but I want to understand this warning or is this just a compiler mistake? Furthermore, if do not implement AbsctractClass as a template class (just for a test purpose in this case) I also don't get the compiler warning...?

    Read the article

  • Conversion of pointer-to-pointer between derived and base classes?

    - by Mike Mueller
    Regarding the following C++ program: class Base { }; class Child : public Base { }; int main() { // Normal: using child as base is allowed Child *c = new Child(); Base *b = c; // Double pointers: apparently can't use Child** as Base** Child **cc = &c; Base **bb = cc; return 0; } GCC produces the following error on the last assignment statement: error: invalid conversion from ‘Child**’ to ‘Base**’ My question is in two parts: Why is there no implicit conversion from Child** to Base**? I can make this example work with a C-style cast or a reinterpret_cast. Using these casts means throwing away all type safety. Is there anything I can add to the class definitions to make these pointers cast implicitly, or at least phrase the conversion in a way that allows me to use static_cast instead?

    Read the article

  • Java method overloading + double dispatch

    - by Max
    Can anybody explain in detail the reason the overloaded method print(Parent parent) is invoked when working with Child instance in my test piece of code? Any pecularities of virtual methods or methods overloading/resolution in Java involved here? Any direct reference to Java Lang Spec? Which term describes this behaviour? Thanks a lot. public class InheritancePlay { public static class Parent { public void doJob(Worker worker) { System.out.println("this is " + this.getClass().getName()); worker.print(this); } } public static class Child extends Parent { } public static class Worker { public void print(Parent parent) { System.out.println("Why this method resolution happens?"); } public void print(Child child) { System.out.println("This is not called"); } } public static void main(String[] args) { Child child = new Child(); Worker worker = new Worker(); child.doJob(worker); } }

    Read the article

  • add the same qtreewidgetitems into the second column

    - by srinu
    hello i am using the following program to display the qtreewidget. main.cpp include include "qdomsimple.h" include include "qdomsimple.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QStringList filelist; filelist.push_back("C:\department1.xml"); filelist.push_back("C:\department2.xml"); filelist.push_back("C:\department3.xml"); QDOMSimple w(filelist); w.resize(260,200); w.show(); return a.exec(); } qdomsimple.cpp include "qdomsimple.h" include include QDOMSimple::QDOMSimple(QStringList strlst,QWidget *parent) : QWidget(parent) { k=0; // DOM document QDomDocument doc("title"); QStringList headerlabels; headerlabels.push_back("Chemistry"); headerlabels.push_back("Mechanical"); headerlabels.push_back("IT"); m_tree = new QTreeWidget( this ); m_tree->setColumnCount(3); m_tree->setHeaderLabels(headerlabels); QStringList::iterator it; for(it=strlst.begin();it<strlst.end();it++) { QFile file(*it); if ( file.open( QIODevice::ReadOnly | QIODevice::Text )) { // The tree view to be filled with xml data // (m_tree is a class member variable) // Creating the DOM tree doc.setContent( &file ); file.close(); // Root of the document QDomElement root = doc.documentElement(); // Taking the first child node of the root QDomNode child = root.firstChild(); // Setting the root as the header of the tree //QTreeWidgetItem* header = new QTreeWidgetItem; //header->setText(k,root.nodeName()); //m_tree->setHeaderItem(header); // Parse until the end of document while (!child.isNull()) { //Convert a DOM node to DOM element QDomElement element = child.toElement(); //Parse only if the node is a really an element if (!element.isNull()) { //Parse the element recursively parseElement( element,0); //Go to the next sibling child = child.nextSiblingElement(); } } //m_tree->setGeometry( QApplication::desktop()->availableGeometry() ); //setGeometry( QApplication::desktop()->availableGeometry() ); } k++; } } void QDOMSimple::parseElement( QDomElement& aElement, QTreeWidgetItem *aParentItem ) { // A map of all attributes of an element QDomNamedNodeMap attrMap = aElement.attributes(); // List all attributes QStringList attrList; for ( int i = 0; i < attrMap.count(); i++ ) { // Attribute name //QString attr = attrMap.item( i ).nodeName(); //attr.append( "-" ); /* Attribute value QString attr; attr.append( attrMap.item( i ).nodeValue() );*/ //attrList.append( attr ); attrList.append(attrMap.item( i).nodeValue()); } QTreeWidgetItem* item; // Create a new view item for elements having child nodes if (aParentItem) { item = new QTreeWidgetItem(aParentItem); } // Create a new view item for elements without child nodes else { item = new QTreeWidgetItem( m_tree ); } //Set tag name and the text QString tagNText; tagNText.append( aElement.tagName() ); //tagNText.append( "------" ); //tagNText.append( aElement.text() ); item->setText(0, tagNText ); // Append attributes to the element node of the tree for ( int i = 0; i < attrList.count(); i++ ) { QTreeWidgetItem* attrItem = new QTreeWidgetItem( item ); attrItem->setText(0, attrList[i] ); } // Repeat the process recursively for child elements QDomElement child = aElement.firstChildElement(); while (!child.isNull()) { parseElement( child, item ); child = child.nextSiblingElement(); } } QDOMSimple::~QDOMSimple() { } for this i got the qtreewidget like this +file1 +file2 +file3 but actual wanted output is +file1 +file2 +file3 i don't know how to do it.Thanks in advance

    Read the article

  • counting twice in a query, once using restrictions

    - by Andrew Heath
    Given the following tables: Table1 [class] [child] math boy1 math boy2 math boy3 art boy1 Table2 [child] [glasses] boy1 yes boy2 yes boy3 no If I want to query for number of children per class, I'd do this: SELECT class, COUNT(child) FROM Table1 GROUP BY class and if I wanted to query for number of children per class wearing glasses, I'd do this: SELECT Table1.class, COUNT(table1.child) FROM Table1 LEFT JOIN Table2 ON Table1.child=Table2.child WHERE Table2.glasses='yes' GROUP BY Table1.class but what I really want to do is: SELECT class, COUNT(child), COUNT(child wearing glasses) and frankly I have no idea how to do that in only one query. help?

    Read the article

  • MSSQL 2005: Update rows in a specified order (like ORDER BY)?

    - by JMTyler
    I want to update rows of a table in a specific order, like one would expect if including an ORDER BY clause, but MS SQL does not support the ORDER BY clause in UPDATE queries. I have checked out this question which supplied a nice solution, but my query is a bit more complicated than the one specified there. UPDATE TableA AS Parent SET Parent.ColA = Parent.ColA + (SELECT TOP 1 Child.ColA FROM TableA AS Child WHERE Child.ParentColB = Parent.ColB ORDER BY Child.Priority) ORDER BY Parent.Depth DESC; So, what I'm hoping that you'll notice is that a single table (TableA) contains a hierarchy of rows, wherein one row can be the parent or child of any other row. The rows need to be updated in order from the deepest child up to the root parent. This is because TableA.ColA must contain an up-to-date concatenation of its own current value with the values of its children (I realize this query only concats with one child, but that is for the sake of simplicity - the purpose of the example in this question does not necessitate any more verbosity), therefore the query must update from the bottom up. The solution suggested in the question I noted above is as follows: UPDATE messages SET status=10 WHERE ID in (SELECT TOP (10) Id FROM Table WHERE status=0 ORDER BY priority DESC ); The reason that I don't think I can use this solution is because I am referencing column values from the parent table inside my subquery (see WHERE Child.ParentColB = Parent.ColB), and I don't think two sibling subqueries would have access to each others' data. So far I have only determined one way to merge that suggested solution with my current problem, and I don't think it works. UPDATE TableA AS Parent SET Parent.ColA = Parent.ColA + (SELECT TOP 1 Child.ColA FROM TableA AS Child WHERE Child.ParentColB = Parent.ColB ORDER BY Child.Priority) WHERE Parent.Id IN (SELECT Id FROM TableA ORDER BY Parent.Depth DESC); The WHERE..IN subquery will not actually return a subset of the rows, it will just return the full list of IDs in the order that I want. However (I don't know for sure - please tell me if I'm wrong) I think that the WHERE..IN clause will not care about the order of IDs within the parentheses - it will just check the ID of the row it currently wants to update to see if it's in that list (which, they all are) in whatever order it is already trying to update... Which would just be a total waste of cycles, because it wouldn't change anything. So, in conclusion, I have looked around and can't seem to figure out a way to update in a specified order (and included the reason I need to update in that order, because I am sure I would otherwise get the ever-so-useful "why?" answers) and I am now hitting up Stack Overflow to see if any of you gurus out there who know more about SQL than I do (which isn't saying much) know of an efficient way to do this. It's particularly important that I only use a single query to complete this action. A long question, but I wanted to cover my bases and give you guys as much info to feed off of as possible. :) Any thoughts?

    Read the article

  • SQL Server 2005: Update rows in a specified order (like ORDER BY)?

    - by JMTyler
    I want to update rows of a table in a specific order, like one would expect if including an ORDER BY clause, but SQL Server does not support the ORDER BY clause in UPDATE queries. I have checked out this question which supplied a nice solution, but my query is a bit more complicated than the one specified there. UPDATE TableA AS Parent SET Parent.ColA = Parent.ColA + (SELECT TOP 1 Child.ColA FROM TableA AS Child WHERE Child.ParentColB = Parent.ColB ORDER BY Child.Priority) ORDER BY Parent.Depth DESC; So, what I'm hoping that you'll notice is that a single table (TableA) contains a hierarchy of rows, wherein one row can be the parent or child of any other row. The rows need to be updated in order from the deepest child up to the root parent. This is because TableA.ColA must contain an up-to-date concatenation of its own current value with the values of its children (I realize this query only concats with one child, but that is for the sake of simplicity - the purpose of the example in this question does not necessitate any more verbosity), therefore the query must update from the bottom up. The solution suggested in the question I noted above is as follows: UPDATE messages SET status=10 WHERE ID in (SELECT TOP (10) Id FROM Table WHERE status=0 ORDER BY priority DESC ); The reason that I don't think I can use this solution is because I am referencing column values from the parent table inside my subquery (see WHERE Child.ParentColB = Parent.ColB), and I don't think two sibling subqueries would have access to each others' data. So far I have only determined one way to merge that suggested solution with my current problem, and I don't think it works. UPDATE TableA AS Parent SET Parent.ColA = Parent.ColA + (SELECT TOP 1 Child.ColA FROM TableA AS Child WHERE Child.ParentColB = Parent.ColB ORDER BY Child.Priority) WHERE Parent.Id IN (SELECT Id FROM TableA ORDER BY Parent.Depth DESC); The WHERE..IN subquery will not actually return a subset of the rows, it will just return the full list of IDs in the order that I want. However (I don't know for sure - please tell me if I'm wrong) I think that the WHERE..IN clause will not care about the order of IDs within the parentheses - it will just check the ID of the row it currently wants to update to see if it's in that list (which, they all are) in whatever order it is already trying to update... Which would just be a total waste of cycles, because it wouldn't change anything. So, in conclusion, I have looked around and can't seem to figure out a way to update in a specified order (and included the reason I need to update in that order, because I am sure I would otherwise get the ever-so-useful "why?" answers) and I am now hitting up Stack Overflow to see if any of you gurus out there who know more about SQL than I do (which isn't saying much) know of an efficient way to do this. It's particularly important that I only use a single query to complete this action. A long question, but I wanted to cover my bases and give you guys as much info to feed off of as possible. :) Any thoughts?

    Read the article

  • Workaround for stopping propagation with live()?

    - by bobsoap
    I've run into the problem that has been addressed here without a workaround: I can't use stopPropagation() on dynamically spawned elements. I've tried creating a condition to exclude a click within the dimensions of the spawned element, but that doesn't seem to work at all. Here is what I got: 1) a large background element ("canvas") that is activated to be "sensitive to clicks on it" by a button 2) the canvas, if activated, catches all clicks on it and spawns a small child form ("child") within it 3) the child is positioned relative to the mouse click position. If the mouse click was on the right half of the canvas, the child will be positioned 200 pixels to the left of that spot. (On the right if the click was in the left half) 4) every new click on the canvas removes the existing child (if any) and spawns a new child at the new position (relative to the click) The problem: Since the spawned child element is on top of the canvas, a click on it counts as a click on the canvas. Even if the child is outside of the boundaries of the canvas, clicking on it will trigger the action as described in 4) again . This shouldn't happen. =========== CODE: The button to activate the canvas: $('a#activate').click(function(event){ event.preventDefault(); canvasActive(); }); I referenced the above to show you that the canvas click-catching is happening in a function. Not sure if this is relevant... This is the function that catches clicks on the canvas: function canvasActive() { $('#canvas').click(function(e){ e.preventDefault(); //get click position relative to canvas posClick = { x : Math.round(e.pageX - $(this).offset().left), y : Math.round(e.pageY - $(this).offset().top) }; //calculate child position if(posClick.x <= $canvas.outerWidth(false)/2) { posChild = { x: posClick.x + 200, //if dot is on the left side of canvas y: posClick.y }; } else { posChild = { x: posClick.x - 600, //if dot is on the right y: posClick.y }; } $(this).append(markup); //markup is just the HTML for the child }); } I left out the unimportant stuff. The question is: How can I prevent a click inside of a spawned child from executing the function? I tried getting the child's dimensions and doing something like "if posClick is within this range, don't do anything" - but I can't seem to get it right. Perhaps someone has come across this dilemma before. Any help is appreciated.

    Read the article

  • scala: defining a tratit and referencing the corresponding companion object

    - by opensas
    I'm trying to define a trait that uses the corresponding companion object, that is, the componion object of the class using the trait. for example, I have: :paste class Parent { def callMyCompanion = print(Parent.salute) } object Parent { def salute = "Hello from Parent companion object" } class Child extends Parent { } object Child { def salute = "Hello from Child companion object" } And then I create a parent object: scala> val p = new Parent() p: Parent = Parent@1ecf669 scala> p.callMyCompanion Hello from Parent companion object But with a child: scala> val c = new Child() c: Child = Child@4fd986 scala> c.callMyCompanion Hello from Parent companion object I'd like to get: Hello from Child companion object How can I achieve it???

    Read the article

  • How to get attributes from parent?

    - by bribon
    Hi all, Let's say we have these classes: class Foo(object): _bar = "" def __init__(self): self.bar = "hello" def getBar(self): return self._bar def setBar(self, bar): self._bar = bar def getAttributes(self): for attr in self.__dict__: print attr bar = property(getBar, setBar) class Child(Foo): def __init__(self): super(Child, self).__init__() self.a = "" self.b = "" if I do something like: child = Child() child.getAttributes() I get all the attributes from parent and child. How could I get the attributes only from the parent? Thanks in advance!

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >