Search Results

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

Page 25/174 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • How to get child nodes after store load

    - by Azincourt
    Version: ExtJs 4.1 To change the child items I use this function: TreeStore (Ext.data.TreeStore) storeId : 'treeStore', ... constructor: function( oConfig ) { ... this.on( 'expand', function( oObj ) { oObj.eachChild(function(oNode) { switch(oNode.data.type) { case "report": oNode.set('icon', strIconReport); break; case "view": oNode.set('icon', strIconView); break; } }); }); Reload After removing or adding items in the tree, I reload the tree somewhere else with: var oStore = Ext.getStore('treeStore'); oStore.load({ node : oNode, params : { newpath : oNode.data.path, overwrite : true } }); Although it is the same store treeStore, after loading and expanding to the correct path, the icons are not changed since the .on( 'expand') function is not called. Why? Question How can I change the icons of this newly loaded store before it expands to the node path? What I tried Before calling .load() I tried to edit the children with oNode.eachChild(function(oChild) {} but no success.

    Read the article

  • wpf treeview does not show child objects

    - by gangt
    I have an object with child object(s) and I load it using linq. And I assign it to a treeView's itemssource. treeView.DisplayMemberPath = "Name"; treeView.ItemsSource = tasks; It shows only the parent nodes (task.name), I couldn't figure out how to add children (TaskItems.name). All the examples show HierarchicalData in xaml. I need to do it in code-behind, just like the above code. Is it possible? public class Task { public int Id; public string Name; public bool IsActive; public List<TaskItem> TaskItems = new List<TaskItem>(); } public class TaskItem { public int TaskId; public string Name; public string Value; } -------------- var tasks1 = from t in xd.Descendants("taskheader") select new Task { Id = (int)t.Element("id"), Name = t.Element("name").Value, IsActive = t.Element("isactive").Value == "1", TaskItems = t.Elements("taskdetail").Select(e => new TaskItem { TaskId = (int)e.Element("taskid"), Name = (string)e.Element("name"), Value = (string)e.Element("value"), }).ToList() }; -------------- List<Task> tasks = new List<Task>(); tasks = tasks1;

    Read the article

  • JPA: persisting object, parent is ok but child not updated

    - by James.Elsey
    Hello, I have my domain object, Client, I've got a form on my JSP that is pre-populated with its data, I can take in amended values, and persist the object. Client has an abstract entity called MarketResearch, which is then extended by one of three more concrete sub-classes. I have a form to pre-populate some MarketResearch data, but when I make changes and try to persist the Client, it doesn't get saved, can someone give me some pointers on where I've gone wrong? My 3 domain classes are as follows (removed accessors etc) public class Client extends NamedEntity { @OneToOne @JoinColumn(name = "MARKET_RESEARCH_ID") private MarketResearch marketResearch; ... } @Inheritance(strategy = InheritanceType.JOINED) public abstract class MarketResearch extends AbstractEntity { ... } @Entity(name="MARKETRESEARCHLG") public class MarketResearchLocalGovernment extends MarketResearch { @Column(name = "CURRENT_HR_SYSTEM") private String currentHRSystem; ... } This is how I'm persisting public void persistClient(Client client) { if (client.getId() != null) { getJpaTemplate().merge(client); getJpaTemplate().flush(); } else { getJpaTemplate().persist(client); } } To summarize, if I change something on the parent object, it persists, but if I change something on the child object it doesn't. Have I missed something blatantly obvious? Thanks

    Read the article

  • cycle through spans on jquery click, removing the first-child

    - by jacob
    Basically, this advances to the next hidden span when clicked. The markup: <div id="facts"> <span>click to cycle</span> <span>fact 1</span> <span>fact 2</span> <span>fact 3</span> <span>fact 4</span> </div> The js: $(document).ready(function() { var current = 1; $('#facts span').click(function() { // Hide all of them $('#facts span').hide(); // Unhide the current one: $('#facts span:eq(' + (current % $('#facts span').length) + ')').show(); // Increment the variable console.log(current % 4); current++; }); // Unhide the first one on load $('#facts span:first-child').show(); });? What I'm trying to do now is remove the first span after it's been clicked, because it is not necessary for the user to see the 'click to cycle' instruction again.

    Read the article

  • Need help getting parent reference to child view controller

    - by Andy
    I've got the following code in one of my view controllers: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { switch (indexPath.section) { case 0: // "days" section tapped { DayPicker *dayPicker = [[DayPicker alloc] initWithStyle:UITableViewStylePlain]; dayPicker.rowLabel = self.activeDaysLabel; dayPicker.selectedDays = self.newRule.activeDays; [self.navigationController pushViewController:dayPicker animated:YES]; [dayPicker release]; break; ... Then, in the DayPicker controller, I do some stuff to the dayPicker.rowLabel property. Now, when the dayPicker is dismissed, I want the value in dayPicker.rowLabel to be used as the cell.textLabel.text property in the cell that called the controller in the first place (i.e., the cell label becomes the option that was selected within the DayPicker controller). I thought that by using the assignment operator to set dayPicker.rowLabel = self.activeDaysLabel, the two pointed to the same object in memory, and that upon dismissing the DayPicker, my first view controller, which uses self.activeDaysLabel as the cell.textLabel.text property for the cell in question, would automagically pick up the new value of the object. But no such luck. Have I missed something basic here, or am I going about this the wrong way? I originally passed a reference to the calling view controller to the child view controller, but several here told me that was likely to cause problems, being a circular reference. That setup worked, though; now I'm not sure how to accomplish the same thing "the right way." As usual, thanks in advance for your help.

    Read the article

  • Form.Show() is not showing it's child controls

    - by Refracted Paladin
    I have a form, frmPleaseWait, that has a MarqueeProgressBar and a Label that I want to use when the UI is loading the data in a poorly structured app we have. The problem is that frmPleaseWait.Show() shows the form but not the controls in it. It is just a white rectangle. Now frmPleaseWait.ShowDialog() shows the child controls but doesn't let the UI load it's data. What am I missing? Below is a code snippet from where I am trying this. PleaseWait = new frmPleaseWait(); PleaseWait.Show(this); // Set all available HUD values in HUD Object HUD.LastName = GetCurrentRowVal("LastName").Trim(); HUD.FirstName = GetCurrentRowVal("FirstName").Trim(); HUD.PersonId = Convert.ToInt32(GetCurrentRowVal("PersonID").Trim()); HUD.SSn = GetCurrentRowVal("SSN").Trim(); HUD.MiddleName = GetCurrentRowVal("MiddleName").Trim(); HUD.MasterID = ConnectBLL.BLL.DriInterface.CheckForDriId(HUD.PersonId).ToString(); // This loads numerous UserControls with data shellForm.FormPaint(HUD.PersonId); PleaseWait.Close();

    Read the article

  • parsing multiple child with sax parser in Android

    - by Ahmad Naqibul Arefin
    I can parse xml file with sax parser, but when I need to add child attribute under a attribute then how I can get the value? my xml file is here: <?xml version="1.0" encoding="UTF-8"?> <marketlist> <market> <name restricted="yes">boss</name> <motorway>M6</motorway> <junction>J3</junction> <petrol_hour> <mon>7am - 8pm</mon> <tues>7am - 8pm</tues> </petrol_hour> </market> I want to parse and get mon and tues values. Any suggesstion? My android code for parsing is here: public void endElement(String uri, String localName, String qName) throws SAXException { elementOn = false; /** * Sets the values after retrieving the values from the XML tags * */ if (localName.equalsIgnoreCase("name")) data.setMarketName(elementValue); else if (localName.equalsIgnoreCase("motorway")) data.setMotorway(elementValue); else if (localName.equalsIgnoreCase("junction")) data.setJunction(elementValue);

    Read the article

  • Performing an action on Parent/Child elements independently.

    - by Matt Weldon
    I have HTML similar to the following in my page <div id="someDiv"> <img src="foo.gif" class="someImg" /> </div> The wrapper div is set up such that when it is clicked, it's background-color changes using the following jQuery code. $("div").click(function(event){ $(this).css("background-color", "blue"); }); I also have some jQuery associated with my img that will do some other function (for the sake of argument I am going to display and alert box) like so: $("img[class=someImg]").click(function(event){ alert("Image clicked"); }); The issue I have come across is that when I click on the img, the event associated with the div is also triggered. I'm pretty sure that this is due to the way that jQuery (or indeed JavaScript) is handling the two DOM elements - clicking the img would require you to also technically click the div, thus triggering both events. Two questions then really: Is my understanding of the DOM/JavaScript flawed in some way or is this actually how things are occurring? Are there any jQuery methods that would allow me to perform actions on a child element without invoking those associated with its parent?

    Read the article

  • Child selector problem in IE7, IE8

    - by Raj
    Hi, I have a CSS style using child selectors in an HTML page as follows: <html> <head> <title>MSO Bug</title> <style type="text/css" media="screen,print"> ol{list-style-type:decimal;} ol > ol {list-style-type:lower-alpha;} ol > ol >ol {list-style-type:lower-roman;} </style> </head> <body> <div> <ol> <li><div>level1</div></li> <ol> <li><div>level2</div></li> <ol> <li><div>level3</div></li> </ol> </ol> </ol> </div> </body> </html> In Firefox, the CSS works properly - the first list level starts with '1', the second with 'a', and the third with 'i' as expected. But this doesn't work in IE7/8! (I'm aware of descendent selectors - for some reason I can't use that here)

    Read the article

  • How to check if a child-object is populated

    - by TheQ
    How can i check if a child-object of a linq-object is populated or not? Example code below. My model have two methods, one joins data, and the other does not: public static Member GetMemberWithPhoto(Guid memberId) { using (DataContext db = new DataContext()) { DataLoadOptions dataLoadOptions = new DataLoadOptions(); dataLoadOptions.LoadWith<Member>(x => x.UserPhoto); db.LoadOptions = dataLoadOptions; var query = from x in db.Members where x.MemberId == memberId select x; return query.FirstOrDefault(); } } public static Member GetMember(Guid memberId) { using (DataContext db = new DataContext()) { var query = from x in db.Members where x.MemberId == memberId select x; return query.FirstOrDefault(); } } Then my control have the following code: Member member1 = Member.GetMemberWithPhoto(memberId); Member member2 = Member.GetMember(memberId); Debug.WriteLine(member1.UserPhoto.ToString()); Debug.WriteLine(member2.UserPhoto.ToString()); The last line will generate a "Cannot access a disposed object" exception. I know that i can get rid of that exception just by not disposing the datacontext, but then the last line will generate a new query to the database, and i don't want that. What i would like is something like: Debug.WriteLine((member1.UserPhoto.IsPopulated()) ? member1.UserPhoto.ToString() : "none"); Debug.WriteLine((member2.UserPhoto.IsPopulated()) ? member2.UserPhoto.ToString() : "none"); Is it possible?

    Read the article

  • Prevent event from parent element to child element in jquery

    - by sonam
    I have binded event as below: $(document).delegate('.budget', 'click', function(e){ if ($(this).hasClass('collapsed')) { $(this).removeClass('collapsed'); $(this).addClass('expanded'); } else if ($(this).hasClass('expanded')) { $(this).removeClass('expanded'); $(this).addClass('collapsed'); } }); Basically this toggles between expand and collapse. I have another event binded as below: $('[id^="tree"]').delegate('.collapsed', 'click', function(e){ var elementId = $(this).attr('id'); hideChildElement(elementId); }); The elements binded by the second event binding are parents of elements binded by first event binding. What happens is that on clicking on the element from the first binding event method also triggers the event binded by second event binding. I want to prevent any events from binding from second event binding to 1st event binding method. If element A is binded to click event from first event binding and B is binded to second event binding (A is inside B or A is child of B), I dont want any event of B to propagate to A. Note I tried e.stopImmediatePropagation(); but did not worked

    Read the article

  • Dynamic Tree control in Flex 3

    - by nimmyliji
    I am looking for sample code to create a dynamic Tree control in Flex using a Collection of objects obtained from the backend(Perl cgi). So, initially the Tree will display the root nodes. Clicking root node, will invoke the data for populating the child nodes (basically adding child nodes on demand). Clicking child nodes will pull another collection add child nodes of child node. So, lets assume Initially the Tree will display - Root1 Root2 Root3 Clicking Root1 will display something like this - Root1 Child 1 Child 2 Root2 Root3 And Clicking Child1 will display - Root1 Child 1 Child1 of Child 1 Child2 of Child 1 Child 2 Root2 Root3 Is it possible? Thanks in advance...

    Read the article

  • C++ Why is the converter constructor implicitly called?

    - by ShaChris23
    Why is the Child class's converter constructor called in the code below? I mean, it automatically converts Base to Child via the Child converter constructor. The code below compiles, but shouldn't it not compile since I haven't provided bool Child::operator!=(Base const&)? class Base { }; class Child : public Base { public: Child() {} Child(Base const& base_) : Base(base_) { std::cout <<"should never called!"; } bool operator!=(Child const&) { return true; } }; void main() { Base base; Child child; if(child != base) std::cout << "not equal"; else std::cout << "equal"; }

    Read the article

  • Why is my new ID always "1"

    - by normalocity
    I have a parent-child relationship between two objects. Parent :has_many :children Child :belongs_to :parent When creating a new parent, in the same controller, I'm creating the child. @mom = Parent.new @child = Child.new @mom.children << @child That all seems to go okay, but this parent has one more attribute - this parent has a favorite child @mom.favorite_child = @child Seems like this should work, except let's say that this is the 61st child in the database, so it gets an ID of 61 (and I know this is happening, because when I check the database, the child record has an ID of 61). For some reason, when I assign the @child to the parent's "favorite_child" attribute, "favorite_child" gets set to "1" - when I need it to be set to "61". Clues?

    Read the article

  • C++ Why is the copy constructor implicitly called?

    - by ShaChris23
    Why is the Child class's copy constructor called in the code below? I mean, it automatically converts Base to Child via the Child copy constructor. The code below compiles, but shouldn't it not compile since I haven't provided bool Child::operator!=(Base const&)? class Base { }; class Child : public Base { public: Child() {} Child(Base const& base_) : Base(base_) { std::cout <<"should never called!"; } bool operator!=(Child const&) { return true; } }; void main() { Base base; Child child; if(child != base) std::cout << "not equal"; else std::cout << "equal"; }

    Read the article

  • Local SSL connections are causing redirect loop (after Ubuntu update)

    - by codeinthehole
    Following a recent Ubuntu update, my local websites are no longer serving their pages over SSL. For example, my .htaccess file attempts to ensure /sign-in is always served over HTTPS: RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /sign-in RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,R=301] However when I make a request to /sign-in on the domain site2-local , I get the error "The page isn't redirecting properly" with the following in /var/log/apache2/error.log [Tue Jun 08 12:20:57 2010] [info] [client 127.0.1.1] Connection to child 0 established (server site1-local:443) [Tue Jun 08 12:20:57 2010] [info] Seeding PRNG with 656 bytes of entropy [Tue Jun 08 12:20:57 2010] [info] Initial (No.1) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.2) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.3) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.4) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.5) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.6) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.7) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.8) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.9) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.10) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] (70007)The timeout specified has expired: SSL input filter read failed. [Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] Connection closed to child 0 with standard shutdown (server site2-local:443) There is a connection to site1-local (another site on my machine which shares the certificate), which I don't understand. Anyone know what is causing this issue?

    Read the article

  • Local SSL connections are causing redirect loop (after Ubuntu update)

    - by codeinthehole
    Following a recent Ubuntu update, my local websites are no longer serving their pages over SSL. For example, my .htaccess file attempts to ensure /sign-in is always served over HTTPS: RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} /sign-in RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,QSA,R=301] However when I make a request to /sign-in on the domain site2-local , I get the error "The page isn't redirecting properly" with the following in /var/log/apache2/error.log [Tue Jun 08 12:20:57 2010] [info] [client 127.0.1.1] Connection to child 0 established (server site1-local:443) [Tue Jun 08 12:20:57 2010] [info] Seeding PRNG with 656 bytes of entropy [Tue Jun 08 12:20:57 2010] [info] Initial (No.1) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.2) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.3) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.4) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.5) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.6) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.7) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.8) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.9) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:20:57 2010] [info] Subsequent (No.10) HTTPS request received for child 0 (server site2-local:443) [Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] (70007)The timeout specified has expired: SSL input filter read failed. [Tue Jun 08 12:21:12 2010] [info] [client 127.0.1.1] Connection closed to child 0 with standard shutdown (server site2-local:443) There is a connection to site1-local (another site on my machine which shares the certificate), which I don't understand. Anyone know what is causing this issue?

    Read the article

  • Silverlight child windows in MVVM pattern

    - by rrejc
    Hello, I am trying to find the right way to get the data from a ChildWindow/popup using a MVVM pattern in Silverlight (3). For example: I have a main page with a data entry form and I want to open a popup with a list of customers. When user selects a customer I want to transfer selected customer into the main page. This is what the (example) code which I am using at the moment: Main page public partial class MainPage : UserControl { public MainPageViewModel ViewModel { get; private set; } public MainPage() { InitializeComponent(); ViewModel = new MainPageViewModel(); DataContext = ViewModel; } private void SearchCustomer_Click(object sender, RoutedEventArgs e) { ViewModel.SearchCustomer(); } } public class MainPageViewModel: ViewModel { private string customer; public string Customer { get { return customer; } set { customer = value; RaisePropertyChanged("Customer"); } } public void SearchCustomer() { // Called from a view SearchWindow searchWindow = new SearchWindow(); searchWindow.Closed += (sender, e) => { if ((bool)searchWindow.DialogResult) { Customer = searchWindow.ViewModel.SelectedCustomer.ToString(); } }; searchWindow.Show(); } } Child window public partial class SearchWindow : ChildWindow { public SearchWindowViewModel ViewModel { get; private set; } public SearchWindow() { InitializeComponent(); ViewModel = new SearchWindowViewModel(); DataContext = ViewModel; } private void OKButton_Click(object sender, RoutedEventArgs e) { DialogResult = ViewModel.OkButtonClick(); } private void CancelButton_Click(object sender, RoutedEventArgs e) { DialogResult = ViewModel.CancelButtonClick(); } } public class SearchWindowViewModel: ViewModel { private Customer selectedCustomer; private ObservableCollection<Customer> customers; public ObservableCollection<Customer> Customers { get { return customers; } set {customers = value; RaisePropertyChanged("Customers"); } } public Customer SelectedCustomer { get { return selectedCustomer; } set { selectedCustomer = value; RaisePropertyChanged("SelectedCustomer"); } } public SearchWindowViewModel() { Customers = new ObservableCollection<Customer>(); ISearchService searchService = new FakeSearchService(); foreach (Customer customer in searchService.FindCustomers("dummy")) Customers.Add(customer); } public bool? OkButtonClick() { if (SelectedCustomer != null) return true; else return null; // show some error message before that } public bool? CancelButtonClick() { return false; } } Is this the right way or is there anything more "simple"? Cheers, Rok

    Read the article

  • Best practice to handle Parent Form Child Form relation using Presentation Model

    - by Rajarshi
    According to Presentation Model notes by Martin Fowler and also on MSDN documentation about Presentation Model, it is explained that the Presentation Model Class should be unaware of the UI class and similarly Business Model Class should be unaware of the Presentation Model class. The UI should databind extensively to the Presentation Model, the Presentation Model in turn will co-ordinate with one or more Domain/Business Model objects to get the job done. The Presentation Model basically presents the Domain Model data in a way to facilitate maximum data binding in UI, allowing the UI take as less decisions as possible and thus increase testability of Presentation behaviours. This also makes the presentation model class generic, i.e. agnostic of any particular UI technology. Now, consider there is a List form (say CustomerList) and there is another Root form (say Customer) and there is a Use Case of allowing to Edit a Customer from the CustomerList form on a button click. For simplicity of discussion, consider that some actions took place when Customer List is opened from menu (i.e. Customer menu clicked) and the Customer List has been shown from the Menu click event. Now as per the above Use Case, I need to open the Customer Root UI (single Customer) from the Customer List. How do I do that? Build necessary objects (BusinessModel, PresentationModel, UI) in click event of Edit button and call CustomerEdit UI from there? Build the CustomerEdit UI from Presentation Model Class and show UI from presentation model? this can be done in any of the two ways below - a. Create objects in the following sequence DomainModel-PresentationModel-UIForm b. Use Unity.Resolve(); Either ways, Presentation Model is violated as the P model now has to the refer the concrete UI assembly, where CustomerEdit is located. Also the P Model has to refer and use a WinForm directly making it less UI technology agnostic. Even though the violations are in theory and can be ignored, I would still seek the community's opinion about whether I am going wrong direction. Please suggest if there's a better way to call the Child Form from the List (Parent) Form. Rajarshi

    Read the article

  • Running XPath on child node.

    - by Jeeyoung Kim
    Hi. I'm trying to do a xpath lookup on nodes returned by xpath lookup, but it doesn't seem to work as I expected.XPaths executed on the child nodes of a document seem to be executd against hthe root node of the document (in the example, the inventory tag.), instead of the root of the provided node. Am I missing something here? I'm new to XPath. Also, please don't answer "just do //book[author='Neal Stephenson'/title". I have a legitimate use case, and this is a simplified example. Code snippet DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse("src/main/java/books.xml"); XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); Node book = (Node) xpath.evaluate("//book[author='Neal Stephenson']", doc, XPathConstants.NODE); Node title = (Node) xpath.evaluate("/title", book, XPathConstants.NODE); // I get null here. Node inventory = (Node) xpath.evaluate("/inventory", book, XPathConstants.NODE); // this returns a node. book.xml <inventory> <book year="2000"> <title>Snow Crash</title> <author>Neal Stephenson</author> <publisher>Spectra</publisher> <isbn>0553380958</isbn> <price>14.95</price> </book> <book year="2005"> <title>Burning Tower</title> <author>Larry Niven</author> <author>Jerry Pournelle</author> <publisher>Pocket</publisher> <isbn>0743416910</isbn> <price>5.99</price> </book> <book year="1995"> <title>Zodiac</title> <author>Neal Stephenson</author> <publisher>Spectra</publisher> <isbn>0553573862</isbn> <price>7.50</price> </book> <!-- more books... --> </inventory>

    Read the article

  • Nhibernate One-to-one mapping issue with child object insert error

    - by TalkDotNet
    Hi, i've being banging my head against the desk all day with the following Nhibernate problem. Each bank account has one (and only one) set of rates associated with it. The primary key of the bank account table, BankAccountID is also a foreign key and the primary key in the rates table. public class BankAccount { public virtual int BankAccountId { get; set; } public virtual string AccountName { get; set;} public virtual AccountRate AccountRate {get;set;} } public class AccountRate { public virtual int BankAccountId { get; set; } public virtual decimal Rate1 { get; set; } public virtual decimal Rate2 { get; set; } } I have the following HBM mappings for BankAccount: <class name="BankAccount" table="BankAccount"> <id name ="BankAccountId" column="BankAccountId"> <generator class="foreign"> <param name="property"> AccountRate </param> </generator> </id> <property name ="AccountName" column="AccountName" /> <one-to-one name="AccountRate" class="AccountRate" constrained="true" cascade="save-update"/> </class> and the following for AccountRate: <class name="AccountRate" table="AccountRate"> <id name ="BankAccountId" column="BankAccountId"> <generator class="native" /> </id> <property name ="Rate1" column="Rate1" /> <property name ="Rate2" column="Rate2" /> </class> An existing BankAccount object can be read from the database with no problem. However, when a new BankAccount is created , the insert statement fails with; Cannot insert the value NULL into column 'BankAccountId' The issue appears to be that the child object , AccountRate is created first and since it hasn't yet got an identifier from its uncreated parent , the insert fails. I think i'm correct in saying that if the AccountRate property on BankAccount was a collection i could use the following ? Inverse=True in order to force the parent to be inserted first. Can anyone help me with this? i Really dont want to use a collection as there is only a unidirectional one to one relationship between these tables. Thanks Paul

    Read the article

  • Hibernate annotated many-to-one not adding child to parent Collection

    - by Rob Hruska
    I have the following annotated Hibernate entity classes: @Entity public class Cat { @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) @Id private Long id; @OneToMany(mappedBy = "cat", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set<Kitten> kittens = new HashSet<Kitten>(); public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setKittens(Set<Kitten> kittens) { this.kittens = kittens; } public Set<Kitten> getKittens() { return kittens; } } @Entity public class Kitten { @Column(name = "ID") @GeneratedValue(strategy = GenerationType.AUTO) @Id private Long id; @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Cat cat; public void setId(Long id) { this.id = id; } public Long getId() { return id; } public void setCat(Cat cat) { this.cat = cat; } public Cat getCat() { return cat; } } My intention here is a bidirectional one-to-many/many-to-one relationship between Cat and Kitten, with Kitten being the "owning side". What I want to happen is when I create a new Cat, followed by a new Kitten referencing the Cat, the Set of kittens on my Cat should contain the new Kitten. However, this does not happen in the following test: @Test public void testAssociations() { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); Transaction tx = session.beginTransaction(); Cat cat = new Cat(); session.save(cat); Kitten kitten = new Kitten(); kitten.setCat(cat); session.save(kitten); tx.commit(); assertNotNull(kitten.getCat()); assertEquals(cat.getId(), kitten.getCat().getId()); assertTrue(cat.getKittens().size() == 1); // <-- ASSERTION FAILS assertEquals(kitten, new ArrayList<Kitten>(cat.getKittens()).get(0)); } Even after re-querying the Cat, the Set is still empty: // added before tx.commit() and assertions cat = (Cat)session.get(Cat.class, cat.getId()); Am I expecting too much from Hibernate here? Or is the burden on me to manage the Collection myself? The (Annotations) documentation doesn't make any indication that I need to create convenience addTo*/removeFrom* methods on my parent object. Can someone please enlighten me on what my expectations should be from Hibernate with this relationship? Or if nothing else, point me to the correct Hibernate documentation that tells me what I should be expecting to happen here. What do I need to do to make the parent Collection automatically contain the child Entity?

    Read the article

  • CSS Child selectors in IE7 tables

    - by John
    I'm trying to use the CSS child selector in IE7, and it doesn't seem to work. I have nested tables. My outer table has a class name "mytable", and I want the td's of the outer table to show borders. I don't want the inner table td's to have borders. I think I should be able to have CSS that looks like this: .mytable { border-style: solid } .mytable>tr>td { border-style: solid } But the second line seems to have no effect. If I change the second line to make it less specific, it applies to all the td's - I see too many borders. td { border-style: solid } So I think it really is just an issue with the selectors. Pages like this suggest that IE7 should be able to do what I want. Am I doing something silly? Here's the whole HTML file: <html> <head> <style type="text/css"> .mytable { border-style: solid; border-collapse: collapse;} td { border-style: solid; } </style> </head> <body> <table class="mytable"> <tr> <td>Outer top-left</td> <td>Outer top-right</td> </tr> <tr> <td>Outer bottom-left</td> <td> <table> <tr> <td>Inner top-left</td> <td>Inner top-right</td> </tr> <tr> <td>Inner bottom-left</td> <td>Inner bottom-right</td> </tr> <table> </td> </tr> <table> </body> </html>

    Read the article

  • adding child nodes to a treeview control in wpf,c#

    - by ebhakt
    Hi , i have implemented a treeview control on a buttonclick event like this: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Collections.ObjectModel; namespace TaxonomyTreeview { /// /// Interaction logic for Window1.xaml /// public partial class Window1 : Window { ObservableCollection _TaxonomyCollection = new ObservableCollection(); public Window1() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { } public ObservableCollection<TaxonomyData> TaxonomyCollection { get { return _TaxonomyCollection; } } private void SelectedTaxonomyChanged(object sender, RoutedPropertyChangedEventArgs<Object> e) { TaxonomyData taxo = taxonomytree.SelectedItem as TaxonomyData; if (taxo != null) { MessageBox.Show("" + taxo.Tid); } } public class TaxonomyData { private string _name; private string _tid; public string Tid { get { return _tid; } set { _tid = value; } } public string Name { get { return _name; } set { _name = value; } } public TaxonomyData(string name, string tid) { Name = name; Tid = tid; } } private void populate_Click(object sender, RoutedEventArgs e) { taxonomytree.Items.Clear(); TaxonomyCollection.Add(new TaxonomyData("Taxonomy1", "1")); taxonomytree.Items.Add(TaxonomyCollection[0]); } } } The xaml code is : <TextBox Height="23" Margin="20,9,0,0" Name="startvid" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" /> <TextBox Height="23" Margin="165,9,151,0" Name="endvid" VerticalAlignment="Top" /> <Button Height="23.78" HorizontalAlignment="Right" Margin="0,8.22,11,0" Name="populate" VerticalAlignment="Top" Width="115" Click="populate_Click">Populate</Button> <TreeView HorizontalAlignment="Left" Margin="20,53,0,144" Width="120" Name="taxonomytree" ItemsSource="{Binding Window1.TaxonomyCollection}" SelectedItemChanged="SelectedTaxonomyChanged"> <TreeView.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Path=Name}" /> </DataTemplate> </TreeView.ItemTemplate> </TreeView> </Grid> As i want to display, the structure in a hierarchy , i want to know what is the best method to add a child node to this Please help

    Read the article

  • XML and XSLT: need it to sort only certain child nodes

    - by MT
    Hello, I need to have my XSLT stylesheet sort my XML file's child nodes, but only certain ones. Here's an example of what the XML is like: <?xml version="1.0"?> <xmltop> <child1 num="1"> <data>12345</data> </child1> <child1 num="2"> <data>12345</data> </child1> <child2 num="3"> <data>12345</data> </child2> <child2 num="2"> <data>12345</data> </child2> <child2 num="1"> <data>12345</data> </child2> </xmltop> And this is the XSL file I'm using: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/xmltop"> <xsl:copy> <xsl:apply-templates> <xsl:sort select="@num"/> </xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="child2"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet> This creates problems for me because the nodes are stripped of their tags, and their contents remain, making my XML invalid. I'm not really an expert at XSL so pardon me if this is a dumb question. The <child2>'s are sorted properly. Thank you.

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >