Search Results

Search found 4347 results on 174 pages for 'devils child'.

Page 28/174 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • LinqToSql - ChangeConflictException. when submiting child and parent

    - by ari
    This problem drives me crazy. Here's the code using (BizNetDB db = new BizNetDB()) { var dbServiceCall = db.ServiceCalls.SingleOrDefault(x => x.ServiceCallID == serviceCallDetail.ServiceCallID); var dbServiceCallDetail = dbServiceCall.ServiceCallDetaills.SingleOrDefault(x=> x.ServiceCallDetailID == serviceCallDetail.ServiceCallDetailID); if (dbServiceCallDetail == null) { dbServiceCallDetail = new Data.ServiceCallDetaill(); dbServiceCall.ServiceCallDetaills.Add(dbServiceCallDetail); } dbServiceCallDetail.EndSession = serviceCallDetail.EndSession; dbServiceCallDetail.ExitTime = serviceCallDetail.ExitTime; dbServiceCallDetail.Solution = serviceCallDetail.Solution; dbServiceCallDetail.StartSession = serviceCallDetail.StartSession; serviceCallDetail.SessionMinutes = (serviceCallDetail.EndSession - serviceCallDetail.StartSession).Minutes; serviceCallDetail.DriveMinutes = serviceCallDetail.ExitTime.HasValue ? (serviceCallDetail.StartSession - serviceCallDetail.ExitTime.Value).Minutes : 0; var totalMinutes = (from d in db.ServiceCallDetaills .Where(x => x.ServiceCallID == serviceCallDetail.ServiceCallID && x.ServiceCallDetailID != dbServiceCallDetail.ServiceCallDetailID) group d by d.ServiceCallID into g select new { SessionMinutes = g.Sum(x => x.SessionMinutes), DriveMinutes = g.Sum(x => x.DriveMinutes) }).First(); dbServiceCall.SessionMinutes = totalMinutes.SessionMinutes + serviceCallDetail.SessionMinutes; dbServiceCall.DriveMinutes = totalMinutes.DriveMinutes + serviceCallDetail.DriveMinutes; try { db.SubmitChanges(); } catch (ChangeConflictException ex) { db.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues); db.SubmitChanges(); } The second Submit did solve the problem.. but I want to solve it from the root! when I disabled this lines (The parent changes): dbServiceCall.SessionMinutes = totalMinutes.SessionMinutes + serviceCallDetail.SessionMinutes; dbServiceCall.DriveMinutes = totalMinutes.DriveMinutes + serviceCallDetail.DriveMinutes; everithing is Ok. please help...

    Read the article

  • How to move child element from one parent to another using jQuery

    - by Kapslok
    I am using the jQuery DataTables plugin. I would like to move the search box (.dataTables_filter) and number of records to display dropdown (.dataTables_length) from their parent element (.dataTables_wrapper) to another div on my page without losing any registered javascript behavior. For instance the search box has a function attached to the 'keyup' event and I want to keep that intact. The DOM looks like this: <body> <div id="parent1"> <div class="dataTables_wrapper" id="table1_wrapper"> <div class="dataTables_length" id="table1_length"> <select size="1" name="table1_length"> <option value="10">10</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </div> <div class="dataTables_filter" id="table1_filter"> <input type="text" class="search"> </div> <table id="table1"> ... </table> </div> </div> <div id="parent2"> <ul> <li><a href="#">Link A</a></li> <li><a href="#">Link B</a></li> <li><a href="#">Link C</a></li> </ul> </div> </body> This is what I would like the DOM to look like after the move: <body> <div id="parent1"> <div class="dataTables_wrapper" id="table1_wrapper"> <table id="table1"> ... </table> </div> </div> <div id="parent2"> <div class="dataTables_filter" id="table1_filter"> <input type="text" class="search"> </div> <div class="dataTables_length" id="table1_length"> <select size="1" name="table1_length"> <option value="10">10</option> <option value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </div> <ul> <li><a href="#">Link A</a></li> <li><a href="#">Link B</a></li> <li><a href="#">Link C</a></li> </ul> </div> </body> I've been looking at the .append(), .appendTo(), .prepend() and .prependTo() functions but haven't had any luck with these in practice. I've also looked at the .parent() and .parents() functions, but can't seem to code a workable solution. I have also considered changing the CSS so that the elements are absolutely positioned - but to be frank the page is setup with fluid elements all over, and I really want these elements to be floated in their new parents. Any help with this is much appreciated.

    Read the article

  • Update last child id in parent table using mysql

    - by Sam Saffron
    Given the following tables: Topic id, last_updated_child_id Response id, topic_id, updated_at How do I update the Topic table so the last_updated_child_id is equal to the latest response id (based on date). So for example given: Topic id last_updated_child_id -- ----------------------- 1 null 2 null 3 null Response id topic_id updated_at -- ---- ---- 1 1 2010 2 1 2012 3 1 2011 4 2 2000 I would like to execute an UPDATE statement that would result in the Topic table being: id last_updated_child_id -- ----------------------- 1 2 2 4 3 null Note: I would like to avoid temp tables if possible and am happy for a MySQL specific solution.

    Read the article

  • JPA Cascading Delete: Setting child FK to NULL on a NOT NULL column

    - by JBristow
    I have two tables: t_promo_program and t_promo_program_param. They are represented by the following JPA entities: @Entity @Table(name = "t_promo_program") public class PromoProgram { @Id @Column(name = "promo_program_id") private Long id; @OneToMany(cascade = {CascadeType.REMOVE}) @JoinColumn(name = "promo_program_id") private List<PromoProgramParam> params; } @Entity @Table(name = "t_promo_program_param") public class PromoProgramParam { @Id @Column(name = "promo_program_param_id") private Long id; //@NotNull // This is a Hibernate annotation so that my test db gets created with the NOT NULL attribute, I'm not married to this annotation. @ManyToOne @JoinColumn(name = "PROMO_PROGRAM_ID", referencedColumnName = "promo_program_id") private PromoProgram promoProgram; } When I delete a PromoProgram, Hibernate hits my database with: update T_PROMO_PROGRAM_PARAM set promo_program_id=null where promo_program_id=? delete from t_promo_program where promo_program_id=? and last_change=? I'm at a loss for where to start looking for the source of the problem.

    Read the article

  • Create window as child in third party application.

    - by Nathan W
    I'm trying to get my C# form to be parented correctly in a third party app, I have the handle to the control that I would like my form parented to but just can't seem to get it to work. I would like to create my form so that it is part of the MDIClient, handle 005E0ED6. Just like Window 01D7157D. Is this possible? If so can it be done in C#?

    Read the article

  • Create window as child in third party application.

    - by Nathan W
    I'm trying to get my C# form to be parented correctly in a third party app, I have the handle to the control that I would like my form parented to but just can't seem to get it to work. I would like to create my form so that it is part of the MDIClient, handle 005E0ED6. Just like Window 01D7157D. Is this possible? If so can it be done in C#?

    Read the article

  • Set attribute to all child elements via xsl:choose

    - by Camal
    Hi, assuming I got following XML file : <?xml version="1.0" encoding="ISO-8859-1" ?> <MyCarShop> <Car gender="Boy"> <Door>Lamborghini</Door> <Key>Skull</Key> </Car> <Car gender="Girl"> <Door>Normal</Door> <Key>Princess</Key> </Car> </MyCarShop> I want to perform a transformation so the xml looks like this : <?xml version="1.0" encoding="ISO-8859-1" ?> <MyCarShop> <Car gender="Boy"> <Door color="blue">Lamborghini</Door> <Key color="blue">Skull</Key> </Car> <Car gender="Girl"> <Door color="red">Normal</Door> <Key color="red">Princess</Key> </Car> </MyCarShop> So I want to add a color attribut to each subelement of Car depending on the gender information. I came up with this XSLT but it doesnt work : <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="xml" indent="yes"/> <!--<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>--> <xsl:template match="/"> <xsl:element name="MyCarShop"> <xsl:attribute name="version">1.0</xsl:attribute> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="Car"> <xsl:element name="Car"> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="Door"> <xsl:element name="Door"> <xsl:attribute name="ViewSideIndicator"> <xsl:choose> <xsl:when test="gender = 'Boy' ">Front</xsl:when> <xsl:when test="gender = 'Girl ">Front</xsl:when> </xsl:choose> </xsl:attribute> </xsl:element> </xsl:template> <xsl:template match="Key"> <xsl:element name="Key"> <xsl:apply-templates/> </xsl:element> </xsl:template> </xsl:stylesheet> Does anybody know what might be wrong ? Thanks again!

    Read the article

  • Ruby on Rails - nested attributes: How do I access the parent model from child model

    - by TMaYaD
    I have a couple of models like so class Bill < ActiveRecord::Base has_many :bill_items belongs_to :store accepts_nested_attributes_for :bill_items end class BillItem <ActiveRecord::Base belongs_to :product belongs_to :bill validate :has_enough_stock def has_enough_stock stock_available = Inventory.product_is(self.product).store_is(self.bill.store).one.quantity errors.add(:quantity, "only #{stock_available} is available") if stock_available < self.quantity end end The above validation so obviously doesn't work because when I'm reading the bill_items from nested attributes inside the bill form, the attributes bill_item.bill_id or bill_item.bill are not available before being saved. So how do I go about doing something like that?

    Read the article

  • Rails: Passing new child object placeholder (build) to parent view

    - by Meltemi
    I've got 2 classes of objects... Magician has_many Rabbits and Rabbit belongs_to Magician. When viewing a Magician (show.html) I'd like to list all the associated Rabbits and then have some blank fields with a submit button to add a new Rabbit. To do so I build a new rabbit (associated to the current magician) in the Magician's show method (below). Edit2: found way to make it work but not sure if it's the "Rails way"? see comments inline (below): If I build the rabbit in Magician's show method then when show is rendered an empty (and invalid) rabbit ends the list before the new rabbit form fields are then shown. If I build it in the view itself then everything works & renders correctly. I was led to believe that we should not be doing this type of stuff in the view...if so, what's the proper way to address this? #/app/controllers/magicians_controller.rb class MagiciansController < ApplicationController respond_to :html, :json def show @magician = Magician.find(params[:id]) @rabbit = @magician.rabbits.build # <=== build here and empty rabbit gets # included in @magician.rabbits when they're rendered... # but is NOT included in @magician.rabbits.count for some reason?!?!? respond_with(@magician) end ... end #view/magicians/show.html.haml %p %b Name: = @magician.name %h2 Rabbits = "There are #{pluralize(@magician.rabbits.count, "rabbit")}" = render @magician.rabbits, :target => @magician %h2 Add a rabbit: - @rabbit = @clown.rabbits.build -# <=== build here and everything SEEMS to work = render :partial =>"rabbits/form", :locals => { :parent => @magician, :foreign_key => :magician_id, :flash => flash } Edit1: Adding generated html from partial as per request: <p> <b>Rabbit:</b> <b>Color:</b> | <b>ID:</b> <a href="/magicians/2/rabbits" data-confirm="Sure? A bunny will die" data-method="delete" rel="nofollow">Kill Rabbit</a> </p> And I suppose you probably want to see the partial that generates this: %p %b Rabbit: = rabbit.name %b Color: = rabbit.color | %b ID: = rabbit.id = link_to("Kill Rabbit", [target, rabbit], :method => :delete, :confirm => "Sure? A bunny will die")

    Read the article

  • Trouble cross-referencing two XML child nodes in AS3

    - by Dwayne
    I am building a mini language translator out of XML nodes and Actionscript 3. I have my XML ready. It contains a series of nodes with two children in them. Here is a sample: <translations> <entry> <english>man</english> <cockney>geeza</cockney> </entry> <entry> <english>woman</english> <cockney>lily</cockney> </entry> </translations> The AS3 part consist of one input box named "textfield_txt" where the English word will be typed in. An output text field for the translation called "cockney_txt". Finally, one button to execute the translation called "generate_mc". The idea is to have actionscript look through the XML for key English words after the user types it in the "textfield", cross-freferences the children then returns the Cockney translation as a value. The trouble is, when I test it I get no response or error messages- it's completely silent. I'm not sure what I'm doing wrong. At present, I have setup a conditional statement to tell me whether the function works or not. The result is, no it's not! Here's the code below. I hope someone can help. Cheers! generate_mc.buttonMode=true; var English:String; var myXML:XML; var myLoader:URLLoader = new URLLoader(); myLoader.load(new URLRequest("Language.xml")); myLoader.addEventListener(Event.COMPLETE, processXML); function processXML(e:Event):void { myXML = new XML(e.target.data); } generate_mc.addEventListener(MouseEvent.CLICK, onClick); function onClick(event:MouseEvent) { English = textfield.text; cockney_txt.text = myXML.translations.entry.cockney; if(textfield.text.toLowerCase() == myXML.translations.entry.english.toLowerCase){ //return myXML.translations.entry.cockney; trace("success"); }else{ trace("try again!"); // ***I get this as a result } }

    Read the article

  • Rails: unable to set any attribute of child model

    - by Bryan Roth
    I'm having a problem instantiating a ListItem object with specified attributes. For some reason all attributes are set to nil even if I specify values. However, if I specify attributes for a List, they retain their values. Attributes for a List retain their values: >> list = List.new(:id => 20, :name => "Test List") => #<List id: 20, name: "Test List"> Attributes for a ListItem don't retain their values: >> list_item = ListItem.new(:id => 17, :list_id => 20, :name => "Test Item") => #<ListItem id: nil, list_id: nil, name: nil> UPDATE #1: I thought the id was the only attribute not retaining its value but realized that setting any attribute for a ListItem gets set to nil. list.rb: class List < ActiveRecord::Base has_many :list_items, :dependent => :destroy accepts_nested_attributes_for :list_items, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true end list_item.rb: class ListItem < ActiveRecord::Base belongs_to :list validates_presence_of :name end schema.rb ActiveRecord::Schema.define(:version => 20100506144717) do create_table "list_items", :force => true do |t| t.integer "list_id" t.string "name" t.datetime "created_at" t.datetime "updated_at" end create_table "lists", :force => true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" end end

    Read the article

  • Load parent and child table in one query linq to entitiy

    - by parminder
    Hi Experts, I have a following tables/classes structure in Linq to entities. ` Books { bookId, Title } Tags { TagId Tag } BooksTags { BookId TagId } ' Now I need to write a query which gives me result like this Class Result { bookId, Title Tags } Tags should be comma separated text from the tags table by joining all three tables. How to get it done. Thanks Parminder

    Read the article

  • using document.createDocumentFragment() child dom elements that contain jQuery.data

    - by taber
    I want to use document.createDocumentFragment() to create an optimized collection of HTML elements that contain ".data" coming from jQuery (v 1.4.2), but I'm kind of stuck on how to get the data to surface from the HTML elements. Here's my code: var genres_html = document.createDocumentFragment(); $(xmlData).find('genres').each(function(i, node) { var genre = document.createElement('a'); $(genre).addClass('button') .attr('href', 'javascript:void(0)') .html( $(node).find('genreName:first').text() ) .data('genreData', { id: $(node).find('genreID:first').text() }); genres_html.appendChild( genre.cloneNode(true) ); }); $('#list').html(genres_html); // error: $('#list a:first').data('genreData') is null alert($('#list a:first').data('genreData').id); What am I doing wrong here? I suspect it's probably something with .cloneNode() not carrying over the data when the element is appended to the documentFragment. Sometimes there are tons of rows so I want to keep things pretty optimized, speed-wise. Thanks!

    Read the article

  • PHP get overridden methods from child class

    - by Joseph Mastey
    Given the following case: <?php class ParentClass { public $attrA; public $attrB; public $attrC; public function methodA() {} public function methodB() {} public function methodC() {} } class ChildClass { public $attrB; public function methodA() {} } How can I get a list of methods (and preferably class vars) that are overridden in ChildClass? Thanks, Joe

    Read the article

  • cross domain access in iframe from parent to child

    - by Aparna
    Hi, Could someone please help me with this- I've 2 applications AAA and BBB. The homepage of AAA contains an iFrame which displays the application BBB. When I login to AAA, the same login details should be used to login to BBB(single signon) and on pageload of the homepage of AAA, homepage of BBB should also be loaded in the iFrame. I tried to use javascript to access the form elements of login page of BBB to enter the login data and submit. But the browser gives me a 'Access is denied' error. I did a little reading and came to know that cross- domain communication is not allowed by the browser. Could someone tell me how i can go about achieving this?

    Read the article

  • Simple MySQL Query taking 45 seconds (Gets a record and its "latest" child record)

    - by Brian Lacy
    I have a query which gets a customer and the latest transaction for that customer. Currently this query takes over 45 seconds for 1000 records. This is especially problematic because the script itself may need to be executed as frequently as once per minute! I believe using subqueries may be the answer, but I've had trouble constructing it to actually give me the results I need. SELECT customer.CustID, customer.leadid, customer.Email, customer.FirstName, customer.LastName, transaction.*, MAX(transaction.TransDate) AS LastTransDate FROM customer INNER JOIN transaction ON transaction.CustID = customer.CustID WHERE customer.Email = '".$email."' GROUP BY customer.CustID ORDER BY LastTransDate LIMIT 1000 I really need to get this figured out ASAP. Any help would be greatly appreciated!

    Read the article

  • Android ScrollView jumps around when setting child visibility to View.GONE

    - by Mike
    I have a ScrollView that contains an number of other views (TextViews, ImageViews, etc.). The ScrollView is taller than the screen. I have an AsyncTask that updates the children of the ScrollView based on an http response. I've discovered an interesting behavior that I can't figure out how to work around. If I set any of the children's visibilities to View.INVISIBLE as part of the AsyncTask.onPostExecute(), everything works fine. However, if I set any of the children's visibilities to View.GONE, the ScrollView jumps down from the top when onPostExecute() is called. Exactly how far seems to vary. I'm guessing that re-laying out the ScrollView is causing it to scroll away from the top for some reason. So the question is: is there a way to either prevent or work around this behavior? PS. Using ScrollView.jump(FOCUS_UP) as a workaround isn't ideal since that'll force the user to the top even if they had intended to scroll down.

    Read the article

  • Dreamweaver - template not recognising child files until they are opened

    - by Chris
    Hi I've got a new section for a website which I have generated for a data source and it has markup for using a Dreamweaver template. When I add the new files and folders to the site , then update my template , it doesn't find the new files to update. If I open one of the new files , make a change in the template , then it recognises the new file is using the template. So it's almost like I have to touch all the files with Dreamweaver first. I've tried to open all the new files which need to use the template but then Dreamweaver CS4 crashes, I presume because of the number of files it's opening. Anyway, does anyone know if there is a way to make Dreamweaver recognise that a block of new files belong to the template , it doesn't seem to just work automatically Thanks Chris

    Read the article

  • Appending a child in Cake

    - by pg
    I'm using cake & have a web form for entering URLs to go into my db. There will be one input space (url1) and below that a link that says "add another URL" which, when clicked, generates a new form (url2) and reuses the "add another URL". So it would be like: echo $form->input('name'); echo $form->input('id'); echo $form->input('url1'); echo $form->input('weight1'); echo '<a href="XXX">add another URL</a>'; and then, if XXX is clicked it would be like this: echo $form->input('name'); echo $form->input('id'); echo $form->input('url1'); echo $form->input('weight1'); echo $form->input('url2'); echo $form->input('weight2'); echo '<a href="XXX">add another URL</a>'; Is there a jquery script I can use to do this or does cake have something built in?

    Read the article

  • forcing a child component to resize itself larger than its container

    - by Josh
    I am creating a component that displays a variable amount of "gauges" (square tiles of content if you will), that is laid out like so: <HDividedBox id="container"> <VBox id="myComponent"> <HBox id="header"> ...header content... </HBox> <Tile id="body"> ...gauges are added to the body... </Tile> </Vbox> </HDividedBox> The body Tile has a horizontal direction. When I drag the HDividedBox to make myComponent smaller, the body component will get smaller as well, and eventually if there are too many gauges to fit horizontally, they will be bumped to the next row, and thus the smaller I make myComponent, the number of vertically stacked gauges grows. This is all well and good. The problem is, no matter what combination of settings I use, I absolutely cannot get the body (a Tile) to size itself beyond the size of myComponent, which would ideally cause myComponent to scroll vertically. Even setting the maxHeight of the body to some huge value, it will never size itself larger than it's container. Any ideas on how to accomplish this? Thanks

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >