Search Results

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

Page 40/174 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Moving items from one tableView to another tableView with extra's

    - by Totumus Maximus
    Let's say I have 2 UITableViews next to eachother on an ipad in landscape-mode. Now I want to move multiple items from one tableView to the other. They are allowed to be inserted on the bottom of the other tableView. Both have multiSelection activated. Now the movement itself is no problem with normal cells. But in my program each cell has an object which contains the consolidationState of the cell. There are 4 states a cell can have: Basic, Holding, Parent, Child. Basic = an ordinary cell. Holding = a cell which contains multiple childs but which wont be shown in this state. Parent = a cell which contains multiple childs and are shown directly below this cell. Child = a cell created by the Parent cell. The object in each cell also has some array which contains its children. The object also holds a quantityValue, which is displayed on the cell itself. Now the movement gets tricky. Holding and Parent cells can't move at all. Basic cells can move freely. Child cells can move freely but based on how many Child cells are left in the Parent. The parent will change or be deleted all together. If a Parent cell has more then 1 Child cell left it will stay a Parent cell. Else the Parent has no or 1 Child cell left and is useless. It will then be deleted. The items that are moved will always be of the same state. They will all be Basic cells. This is how I programmed the movement: *First I determine which of the tableViews is the sender and which is the receiver. *Second I ask all indexPathsForSelectedRows and sort them from highest row to lowest. *Then I build the data to be transferred. This I do by looping through the selectedRows and ask their object from the sender's listOfItems. *When I saved all the data I need I delete all the items from the sender TableView. This is why I sorted the selectedRows so I can start at the highest indexPath.row and delete without screwing up the other indexPaths. *When I loop through the selectedRows I check whether I found a cell with state Basic or Child. *If its a Basic cell I do nothing and just delete the cell. (this works fine with all Basic Cells) *If its a Child cell I go and check it's Parent cell immidiately. Since all Child cells are directly below the Parent cell and no other the the Parent's Childs are below that Parent I can safely get the path of the selected Childcell and move upwards and find it's Parent cell. When this Parent cell is found (this will always happen, no exceptions) it has to change accordingly. *The Parent cell will either be deleted or the object inside will have its quantity and children reduced. *After the Parent cell has changed accordingly the Child cell is deleted similarly like the Basic cells *After the deletion of the cells the receiver tableView will build new indexPaths so the movedObjects will have a place to go. *I then insert the objects into the listOfItems of the receiver TableView. The code works in the following ways: Only Basic cells are moved. Basic cells and just 1 child for each parent is moved. A single Basic/Child cell is moved. The code doesn't work when: I select more then 1 or all childs of some parent cell. The problem happens somewhere into updating the parent cells. I'm staring blindly at the code now so maybe a fresh look will help fix things. Any help will be appreciated. Here is the method that should do the movement: -(void)moveSelectedItems { UITableView *senderTableView = //retrieves the table with the data here. UITableView *receiverTableView = //retrieves the table which gets the data here. NSArray *selectedRows = senderTableView.indexPathsForSelectedRows; //sort selected rows from lowest indexPath.row to highest selectedRows = [selectedRows sortedArrayUsingSelector:@selector(compare:)]; //build up target rows (all objects to be moved) NSMutableArray *targetRows = [[NSMutableArray alloc] init]; for (int i = 0; i<selectedRows.count; i++) { NSIndexPath *path = [selectedRows objectAtIndex:i]; [targetRows addObject:[senderTableView.listOfItems objectAtIndex:path.row]]; } //delete rows at active for (int i = selectedRows.count-1; i >= 0; i--) { NSIndexPath *path = [selectedRows objectAtIndex:i]; //check what item you are deleting. act upon the status. Parent- and HoldingCells cant be selected so only check for basic and childs MyCellObject *item = [senderTableView.listOfItems objectAtIndex:path.row]; if (item.consolidatedState == ConsolidationTypeChild) { for (int j = path.row; j >= 0; j--) { MyCellObject *consolidatedItem = [senderTableView.listOfItems objectAtIndex:j]; if (consolidatedItem.consolidatedState == ConsolidationTypeParent) { //copy the consolidated item but with 1 less quantity MyCellObject *newItem = [consolidatedItem copyWithOneLessQuantity]; //creates a copy of the object with 1 less quantity. if (newItem.quantity > 1) { newItem.consolidatedState = ConsolidationTypeParent; [senderTableView.listOfItems replaceObjectAtIndex:j withObject:newItem]; } else if (newItem.quantity == 1) { newItem.consolidatedState = ConsolidationTypeBasic; [senderTableView.listOfItems removeObjectAtIndex:j]; MyCellObject *child = [senderTableView.listOfItems objectAtIndex:j+1]; child.consolidatedState = ConsolidationTypeBasic; [senderTableView.listOfItems replaceObjectAtIndex:j+1 withObject:child]; } else { [senderTableView.listOfItems removeObject:consolidatedItem]; } [senderTableView reloadData]; } } } [senderTableView.listOfItems removeObjectAtIndex:path.row]; } [senderTableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationTop]; //make new indexpaths for row animation NSMutableArray *newRows = [[NSMutableArray alloc] init]; for (int i = 0; i < targetRows.count; i++) { NSIndexPath *newPath = [NSIndexPath indexPathForRow:i+receiverTableView.listOfItems.count inSection:0]; [newRows addObject:newPath]; DLog(@"%i", i); //scroll to newest items [receiverTableView setContentOffset:CGPointMake(0, fmaxf(receiverTableView.contentSize.height - recieverTableView.frame.size.height, 0.0)) animated:YES]; } //add rows at target for (int i = 0; i < targetRows.count; i++) { MyCellObject *insertedItem = [targetRows objectAtIndex:i]; //all moved items will be brought into the standard (basic) consolidationType insertedItem.consolidatedState = ConsolidationTypeBasic; [receiverTableView.ListOfItems insertObject:insertedItem atIndex:receiverTableView.ListOfItems.count]; } [receiverTableView insertRowsAtIndexPaths:newRows withRowAnimation:UITableViewRowAnimationNone]; } If anyone has some fresh ideas of why the movement is bugging out let me know. If you feel like you need some extra information I'll be happy to add it. Again the problem is in the movement of ChildCells and updating the ParentCells properly. I could use some fresh looks and outsider ideas on this. Thanks in advance. *updated based on comments

    Read the article

  • Calling "Base-Getter" in Overriding Getter of Property

    - by scherand
    I have a base class "Parent" like this: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Parent { private int parentVirtualInt = -1; public virtual int VirtualProperty { get { return parentVirtualInt; } set { if(parentVirtualInt != value) { parentVirtualInt = value; } } } } } and a child class like this: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Child : Parent { public override int VirtualProperty { get { if(base.VirtualProperty > 0) { throw new ApplicationException("Dummy Ex"); } return base.VirtualProperty; } set { if(base.VirtualProperty != value) { base.VirtualProperty = value; } } } } } Note that the getter in Child is calling the getter of Parent (or at least this is what I intend). I now use the "Child" class by instantiating it, assigning a value (let's say 4) to its VirtualProperty and then reading the property again. Child c = new Child(); c.VirtualProperty = 4; Console.Out.WriteLine("Child.VirtualProperty: " + c.VirtualProperty); When I run this, I obviously get an ApplicationException saying "Dummy Ex". But if I set a breakpoint on the line if(base.VirtualProperty > 0) in Child and check the value of base.VirtualProperty (by hovering the mouse over it) before the exception can be thrown (I assume(d)), I already get the Exception. From this I convey that the statement base.VirtualProperty in the "Child-Getter calls itself"; kind of. What I would like to achieve is the same behavior I get when I change the definition of parentVirutalInt (in Parent) to protected and use base.parentVirtualInt in the Getter of Child instead of base.VirtualProperty. And I don't yet see why this is not working. Can anybody shed some light on this? I feel that overridden properties behave differently than overridden methods? By the way: I am doing something very similar with subclassing a class I do not have any control over (this is the main reason why my "workaround" is not an option). Kind regards

    Read the article

  • Nested Model binding in ASP.NET MVC2. fields_for from rails equivalent

    - by dagda1
    Hi, I am looking for some examples of how to do model binding in ASP.NET MVC2 for COMPLEX objects. All the exmples I can find are of simple objects with no child collections or child objects. If I have an Expense object with a child ExpensePayment object. In rails, child objects are rendered with the HTML name attributes like this: expense[expense_payment][net] Rails uses fields_for to render child objects. How can I accomplish something similar in ASP.NET MVC2? Cheers Paul

    Read the article

  • Doctrine2 update both sides of association

    - by orourkedd
    I'm using this to update both sides of an association but want to know if there is a more efficient way to do this. In this case, it is a self-referencing OneToMany parent/child association: public function setParent(Node $parent, $inverse = true) { $this->parent = $parent; if($inverse) $parent->addChild($this, false); } public function addChild(Node $child, $inverse = true) { if(!$this->children->contains($child)) { $this->children[] = $child; if($inverse) $child->setParent($this, false); } }

    Read the article

  • Working with processes in C

    - by Gary
    Hi, just a quick question regarding C and processes. In my program, I create another child process and use a two-directional pipe to communicate between the child and parent. The child calls execl() to run yet another program. My question is: I want the parent to wait n amount of seconds and then check if the program that the child has run has exited (and with what status). Something like waitpid() but if the child doesn't exit in n seconds, I'd like to do something different.

    Read the article

  • Sequential numbering from recursive function? e.g. 2, 2.1, 2.1.1, 2.2, 2.2.1

    - by Pete
    I have a recursive function reading a "table of contents" of documents from a database. I would like to print numbering with the document that reflects where the item is in the tree, e.g. First item, 1.1 Child of first item, 1.1.1 Child of child of first item, 1.2 Child of first item, Second item, 2.1 Child of second item, etc. Rather stumped about this at the moment - help please?

    Read the article

  • How to preserve sibling element position when one sibling is absolutely positioned?

    - by Casey
    In the snippet below, the child div is normally positioned until it is :hovered , when it becomes absolutely positioned. The reasoning behind this markup is to simulate a popup style in a limited environment where I can't use a <select> (among other limitations). When child is hovered, the sibling elements jump around, which is expected, as the contents of the block have changed. But how can I preserve their positioning? That is, what CSS can I add to prevent the siblings from jumping around when child is hovered. Javascript is also not allowed, so please no answers using JS. HTML: <div class="container"> <div class="child"> <span class="d4"></span> <label><input type="radio" name="radio" value="1"/>One</label> <label><input type="radio" name="radio" value="2"/>Two</label> </div> <input type="text" name="sibling"/> <button name="sibling2">Button</button> </div> CSS: .container, .child, button { display:inline-block; } .child { vertical-align: middle; width: 35px; height: 35px; } .child:hover { background: gray; position:absolute; width: 100px; height: auto; } .child:hover > .d4 { display: none; } .child label { display:none; } .child:hover label { display: inline-block; } .d4 { background-position: -411px -1px; width: 35px; height: 35px; background-image: url("https://i.imgur.com/zkgyBOi.png"); background-repeat: no-repeat; color: transparent; display: inline-block; } Here's a fiddle: http://jsfiddle.net/cpctZ/1/

    Read the article

  • Javascript inherance and use of super: is this possible?

    - by Totty
    var Parent = function(value){ this.value = value; this.value1 = 3; this.hello = function(text){ alert(this.value1 + text); } } var Child = extends(Parent, function(value){ this.value1 = 1; this.hello = function(text){ this.super.hello(text); alert('Child' + this.value1 + this.value); } }) var child = new Child(2); child.hello('ola'); // this must output 2 alerts: // 1: "1ola" // 2: "Child1ola"

    Read the article

  • "The server closed the connection without sending any data"

    - by Toby
    Server setup The problem Diagnostic information What I've tried Specific Help needed 1. I have the following server setup: Debian Squeeze Linux 2.6.32-5-amd64 Apache2-mpm-prefork 2.2.16-6+squeeze10 PHP 5.3.3-7+squeeze14 This server is protected with the Suhosin Patch 0.9.9.1 Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100 Timeouts Connection: 300 - Keep-Alive: 15 Loaded Modules core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_auth_digest mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_reqtimeout mod_rewrite mod_setenvif mod_ssl mod_status Wordpress 3.4.2 (Upgrading to 3.5 soon :) 2. The problem When I restart the server (sudo shutdown -r now), going to any website page results in the following error from the web browser (in this case, Google Chrome, but other browsers also show the same error). This error can also occur an hour or so after all is working ok, seemingly randomly, which is my biggest concern as it means my server is not reliable: No data received Unable to load the web page because the server sent no data. Here are some suggestions: Reload this web page later. Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. 3. Diagnostic information The apache error log contains the folowing entries: [Fri Dec 14 22:23:27 2012] [notice] child pid 1955 exit signal Floating point exception (8) [Fri Dec 14 22:23:27 2012] [notice] child pid 1956 exit signal Floating point exception (8) [Fri Dec 14 22:23:29 2012] [notice] child pid 1957 exit signal Floating point exception (8) [Fri Dec 14 22:23:30 2012] [notice] child pid 1958 exit signal Floating point exception (8) [Fri Dec 14 22:23:32 2012] [notice] child pid 1959 exit signal Floating point exception (8) [Fri Dec 14 22:23:32 2012] [notice] child pid 1960 exit signal Floating point exception (8) [Fri Dec 14 22:23:34 2012] [notice] child pid 1961 exit signal Floating point exception (8) [Fri Dec 14 22:23:34 2012] [notice] child pid 1962 exit signal Floating point exception (8) 4. What I've tried a) I can 'fix' the website temporarily by resetting the server twice (resetting it once does not work) using the following commands. NB: the 'reload' option does not work, I have to use restart twice. However, the error can reoccur sometime later. sudo /etc/init.d/apache2 restart sudo /etc/init.d/apache2 restart b) I have tried disabling suhosin by uninstalling php5-suhosin, but a php info page still shows "This server is protected with the Suhosin Patch 0.9.9.1". I have tried putting Suhosin into simulation mode by creating a file /etc/php5/apache2/conf.d/suhosin.ini containing: [suhosin] suhosin.simulation = On The php info page shows the suhosin.ini file in the list of "Additional .ini files parsed" but the php info page still shows "This server is protected with the Suhosin Patch 0.9.9.1" c) Increasing the PHP memory limit In /etc/php5/apache2/ : ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 512M d) Disabling all Wordpress plugins, and going back to the default theme. 5. Specific help needed I would very much like help in debugging what is going on here. I am not sure how to determine what processes are in the Apache error log which are exiting "[notice] child pid 1955 exit signal Floating point exception (8)", or what is causing them to exit. And whether suhosin is part of the problem (and how to disable it if it is). Thank you in advance for any advice or tips you can offer in helping me debug this.

    Read the article

  • Shouldn’t Bind() pass child control’s values to GridView before Page.PreRender?

    - by SourceC
    hello, For controls such as the GridView, DetailsView, and FormView controls, data-binding expressions are resolved automatically during the control's PreRender event But doesn’t data source control perform updates prior to Page.PreRender event? Meaning, shouldn’t Bind() pass child control’s values to GridView ( so they can be passed to data source control as parameters ) before data source control updates the data source, thus before Page.PreRender event? thanx

    Read the article

  • Optimize date query for large child tables: GiST or GIN?

    - by Dave Jarvis
    Problem 72 child tables, each having a year index and a station index, are defined as follows: CREATE TABLE climate.measurement_12_013 ( -- Inherited from table climate.measurement_12_013: id bigint NOT NULL DEFAULT nextval('climate.measurement_id_seq'::regclass), -- Inherited from table climate.measurement_12_013: station_id integer NOT NULL, -- Inherited from table climate.measurement_12_013: taken date NOT NULL, -- Inherited from table climate.measurement_12_013: amount numeric(8,2) NOT NULL, -- Inherited from table climate.measurement_12_013: category_id smallint NOT NULL, -- Inherited from table climate.measurement_12_013: flag character varying(1) NOT NULL DEFAULT ' '::character varying, CONSTRAINT measurement_12_013_category_id_check CHECK (category_id = 7), CONSTRAINT measurement_12_013_taken_check CHECK (date_part('month'::text, taken)::integer = 12) ) INHERITS (climate.measurement) CREATE INDEX measurement_12_013_s_idx ON climate.measurement_12_013 USING btree (station_id); CREATE INDEX measurement_12_013_y_idx ON climate.measurement_12_013 USING btree (date_part('year'::text, taken)); (Foreign key constraints to be added later.) The following query runs abysmally slow due to a full table scan: SELECT count(1) AS measurements, avg(m.amount) AS amount FROM climate.measurement m WHERE m.station_id IN ( SELECT s.id FROM climate.station s, climate.city c WHERE -- For one city ... -- c.id = 5182 AND -- Where stations are within an elevation range ... -- s.elevation BETWEEN 0 AND 3000 AND 6371.009 * SQRT( POW(RADIANS(c.latitude_decimal - s.latitude_decimal), 2) + (COS(RADIANS(c.latitude_decimal + s.latitude_decimal) / 2) * POW(RADIANS(c.longitude_decimal - s.longitude_decimal), 2)) ) <= 50 ) AND -- -- Begin extracting the data from the database. -- -- The data before 1900 is shaky; insufficient after 2009. -- extract( YEAR FROM m.taken ) BETWEEN 1900 AND 2009 AND -- Whittled down by category ... -- m.category_id = 1 AND m.taken BETWEEN -- Start date. (extract( YEAR FROM m.taken )||'-01-01')::date AND -- End date. Calculated by checking to see if the end date wraps -- into the next year. If it does, then add 1 to the current year. -- (cast(extract( YEAR FROM m.taken ) + greatest( -1 * sign( (extract( YEAR FROM m.taken )||'-12-31')::date - (extract( YEAR FROM m.taken )||'-01-01')::date ), 0 ) AS text)||'-12-31')::date GROUP BY extract( YEAR FROM m.taken ) The sluggishness comes from this part of the query: m.taken BETWEEN /* Start date. */ (extract( YEAR FROM m.taken )||'-01-01')::date AND /* End date. Calculated by checking to see if the end date wraps into the next year. If it does, then add 1 to the current year. */ (cast(extract( YEAR FROM m.taken ) + greatest( -1 * sign( (extract( YEAR FROM m.taken )||'-12-31')::date - (extract( YEAR FROM m.taken )||'-01-01')::date ), 0 ) AS text)||'-12-31')::date The HashAggregate from the plan shows a cost of 10006220141.11, which is, I suspect, on the astronomically huge side. There is a full table scan on the measurement table (itself having neither data nor indexes) being performed. The table aggregates 237 million rows from its child tables. Question What is the proper way to index the dates to avoid full table scans? Options I have considered: GIN GiST Rewrite the WHERE clause Separate year_taken, month_taken, and day_taken columns to the tables What are your thoughts? Thank you!

    Read the article

  • Can I create an ASP.NET MVC 2 project with multiple areas without referencing each Child in the pare

    - by No Refunds No Returns
    This is a follow-up question to my original query: http://stackoverflow.com/questions/1791605/how-can-i-use-multiple-projects-to-separate-a-large-asp-net-mvc-site-into-departm Now that I have this working, is there a way to still have multiple project but not have to reference each child area from the parent project? Ideally I'd like to be able to have multiple, separate and distinct projects that only come together on the production/test machines. I should be able to build and test each "area" separately.

    Read the article

  • How to select parent row only if has at least one child?

    - by Matt McCormick
    I have a simple one-to-many relationship. I would like to select rows from the parent only when they have at least one child. So, if there are no children, then the parent row is not returned in the result set. Eg. Parent: +--+---------+ |id| text | +--+---------+ | 1| Blah | | 2| Blah2 | | 3| Blah3 | +--+---------+ Children +--+------+-------+ |id|parent| other | +--+------+-------+ | 1| 1 | blah | | 2| 1 | blah2 | | 3| 2 | blah3 | +--+------+-------+ I want the results to be: +----+------+ |p.id|p.text| +----+------+ | 1 | Blah | | 2 | Blah2| +----+------+

    Read the article

  • How to use Linq to select and group complex child object from a parents list.

    - by Daoming Yang
    How to use Linq to select and group complex child object from a parents list. I have an OrderList each of order object has a OrderProductVariantList(OrderLineList), and each of OrderProductVariant object has ProductVariant, and then the ProductVariant object will have a Product object which contains product information. My goal is to select and group the most popular products from the order list. Can anyone help me with this? Many thanks.

    Read the article

  • How can I trigger a transition effect when a child control is added or removed in flex?

    - by Jason Towne
    I've got a custom component that has children components dynamically added and removed to it depending on what button the user clicks. What I would like to do is trigger a transition effect that moves the child component onto the stage when it's added and then moves it off when it's removed. Does anyone have a good example on how to accomplish this? Edit: I figured it out and left my solution below. I hope it helps someone else!

    Read the article

  • How do I select the last child of a div with only a certain name using only CSS?

    - by Jared
    Hello, I have been using the following CSS to apply an effect at the bottom of elements in a menu: .leftMenuProductWrapper div:last-child{margin-bottom:20px;} This works fine initially, however after adding more elements in the menu, I realized it was a problem. I really only want to select the last div with .leftMenuProductButton within .leftMenuProductWrapper Anyway to do this without using Jquery, just pure CSS?

    Read the article

  • how to close a child browser in c# or WatiN?

    - by user177060
    I want to close the child window which is of "Browser" type. Have a look at the below code. WatiN.Core.Browser openBrowser = BrowserType.getBrowserObject().attachChildBrowser(document_name + Constants.open_document_title); I want to close the "openBrowser". Close()(available in WatiN) can only be used for the type "IE" of "Firefox" only. So, I cant use Close() method also. Is there any method to close the browser in C# or WatiN?

    Read the article

  • How to read expected child nodes of a given node from schema in PHP?

    - by MartyIX
    I was wondering if there's an implementation of a XML schema reader that for an arbitrary node in XML schema provides list of nodes which are supposed to be present as child nodes of given node, restrictions on nodes and so on. I'm planning to program it for my purposes but I would like to know if it isn't solved somewhere. I really need only a small subset what I described above. Thanks for tips!

    Read the article

  • Using CONNECT BY to get all parents and one child in Hierarchy through SQL query in Oracle

    - by s khan
    I was going through some previous posts on CONNECT BY usage. What I need to find is that what to do if I want to get all the parents (i.e, up to root) and just one child for a node, say 4. It seems Like I will have to use union of the following two:- SELECT * FROM hierarchy START WITH id = 4 CONNECT BY id = PRIOR parent union SELECT * FROM hierarchy WHERE LEVEL =<2 START WITH id = 4 CONNECT BY parent = PRIOR id Is there a better way to do this, some workaround that is more optimized?

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >