Search Results

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

Page 80/174 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • why this jquery code doesn't work if i add class to <P>

    - by metal-gear-solid
    It works var tip = "<p>Most computers will open PDF documents automatically, but you may need to download <a title='Link to Adobe website-opens in a new window'"; tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html' target='_blank'>Adobe Reader</a>.</p>"; if($("div#maincontent a[href*='.pdf']").length>0){ $("div#maincontent").children(":last-child").after(tip); but it not var tip = "<p class="adobe-reader-download">Most computers will open PDF documents automatically, but you may need to download <a title='Link to Adobe website-opens in a new window'"; tip +=" href='http://www.adobe.com/products/acrobat/readstep2.html' target='_blank'>Adobe Reader</a>.</p>"; if($("div#maincontent a[href*='.pdf']").length>0){ $("div#maincontent").children(":last-child").after(tip);

    Read the article

  • Python - Is there a better/efficient way to find a node in tree?

    - by Sej P
    I have a node data structure defined as below and was not sure the find_matching_node method is pythonic or efficient. I am not well versed with generators but think there might be better solution using them. Any ideas? class HierarchyNode(): def __init__(self, nodeId): self.nodeId = nodeId self.children = {} # opted for dictionary to help reduce lookup time def addOrGetChild(self, childNode): return self.children.setdefault(childNode.nodeId,childNode) def find_matching_node(self, node): ''' look for the node in the immediate children of the current node. if not found recursively look for it in the children nodes until gone through all nodes ''' matching_node = self.children.get(node.nodeId) if matching_node: return matching_node else: for child in self.children.itervalues(): matching_node = child.find_matching_node(node) if matching_node: return matching_node return None

    Read the article

  • Condor job using DAG with some jobs needing to run the same host

    - by gurney alex
    I have a computation task which is split in several individual program executions, with dependencies. I'm using Condor 7 as task scheduler (with the Vanilla Universe, due do constraints on the programs beyond my reach, so no checkpointing is involved), so DAG looks like a natural solution. However some of the programs need to run on the same host. I could not find a reference on how to do this in the Condor manuals. Example DAG file: JOB A A.condor JOB B B.condor JOB C C.condor JOB D D.condor PARENT A CHILD B C PARENT B C CHILD D I need to express that B and D need to be run on the same computer node, without breaking the parallel execution of B and C. Thanks for your help.

    Read the article

  • MinMax Heap implementation without an array

    - by user576531
    Hi. I found lots of MinMax Heap implementations, that were storing data in an array. It is realy easy to implement, that is way I am looking for something different. I want to create a MinMax Heap using only elements of the Heap with pointers to left child and right child (and afcourse a key to compare). So the Heap have only pointer to the root object (min level), and a root object have a pointer to his children (max level) and so on. I know how to insert a new object (finding a proper path by using binary represenation of int depending on Heap size), but I don't know how to implement the rest (push up (down) the element, find parent or grandparent). Thx for help

    Read the article

  • Virtual methods as Comp function to sort

    - by wilsongoncalo.mp
    Hello everyone! I'm new to C++ and i'm trying to use std::sort function to sort a vector of Solutions. The code is something like this (solution list is a *vector): void SolutionSet::sort(Comparator &comparator) { std::sort(solutionsList_->begin(), solutionsList_->end(), &comparator::compare); } The comparator param is a Comparator´s child class instance , and the compare method is virtual at Comparator class and implemented by all Comparator's child classes. And i want to use that function as a comparator function at std:sort(). Is this possible? If it is, can someone tell me how? Because with the previous code, it doesn't work. If i've not made myself clear, please just ask! Thank you guys!

    Read the article

  • Need Java Swing equivalent of "scrollIntoView" from Browser DOM

    - by bgould
    I have a JPanel with several levels of child components, also with a JScrollPane. I'm placing a focus listener on some of the child components to add some behavior to those components, but I would also like to have that component scroll into the JPanel's viewport when focus is gained. My question is, does anyone have a general purpose function to do this, similar to the browser DOM function "scrollIntoView"? I've tried muddling through this with various inputs to JComponent.scrollRectToVisible but I guess I haven't figured out the magic word. Thanks in advance.

    Read the article

  • Sorting a meta-list by first element of children lists in Python

    - by thismachinechills
    I have a list, root, of lists, root[child0], root[child1], etc. I want to sort the children of the root list by the first value in the child list, root[child0][0], which is an int. Example: import random children = 10 root = [[random.randint(0, children), "some value"] for child in children] I want to sort root from greatest to least by the first element of each of it's children. I've taken a look at some previous entries that used sorted() and a lamda function I'm entirely unfamiliar with, so I'm unsure of how to apply that to my problem. Appreciate any direction that can by given Thanks

    Read the article

  • Best way to parse XMPP-like XML streams?

    - by codethief
    I am working on a server application which receives data over a TCP socket in an XMPP-like XML format, i.e. every child of the <root> element essentially represents one separate request (stanza). The connection is closed as soon as </root> is received. I do know that I must use a stream parser like SAX, somehow. Though, for convenience, I'd prefer to have a tree-like interface to access each stanza's child elements. (The data sent with every request is not large so I think it makes sense to read each stanza as a whole.) What's the best way to realize that in Python (preferably v3)? This is the code I'd like to build it in. Feel free to point me in a totally different direction to solve this issue. import socketserver import settings class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer): pass class MyRequestHandler(socketserver.StreamRequestHandler): def handle(self): pass if __name__ == '__main__': server = MyServer((settings.host, settings.port), MyRequestHandler) server.serve_forever()

    Read the article

  • Database normalization and duplicate values

    - by bretddog
    Consider a Parent / Child / GrandChild structure in a database table schema, or even a deeper hierarchy. These being in the same aggregate. One table DAYS keeps a single row per day, and has a "Date" field. This is the root table, or maybe a child of the root. No row can ever be deleted in this table. In this case, however complex my table schema looks like, however far away in the hierarchy any other table is, is there any reason why any other table would hold a Date value? Can't it instead just have a FK to the DAYS table. I obviously assume that the creation of these date fields happen not before such datefield exist in the DAYS table. I'm now thinking just about the date part to be relevant, not the time part. Not sure if all databases can store these individually. That's maybe relevant, but not really the focus of the question.

    Read the article

  • specify parent window in Windows Resource Script file(*.rc)

    - by welemon
    Hi, I'm looking for a method to specify parent window in *.rc file. In *.rc file, it contains the layout and controls of a dialog. Any new control added into it, will automatically become a child window of Dialog itself. But I want to add a custom draw window into dialog, and some other controls which has that "custom draw window" as parent window, not dialog itself. I know I can use ::CreateWindow(...) API to dynamic create a window in code, and specify the custom draw window as parent HWND. But we already has child controls layout in *.rc file, I just want to reuse them, without create HWND again. Thanks, William L.

    Read the article

  • Parameter to swf loaded with loader class

    - by alejandrobog
    Hi im loading a child swf into my parent swf and I want to pass some parameters to the child swf. Any idea on how to do this. Here is my code: var req:URLRequest = new URLRequest( "test.swf" ); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener( Event.COMPLETE, loadComplete ); loader.load(req); function loadComplete(e:Event){ var childSwf:DisplayObject = e.target.content as DisplayObject; //Im guessing here I need to set the parameter VideoContainer.addChild(childSwf); }

    Read the article

  • What to do if exec() fails?

    - by Grigory
    Let's suppose we have a code doing something like this: int pipes[2]; pipe(pipes); pid_t p = fork(); if(0 == p) { dup2(pipes[1], STDOUT_FILENO); execv("/path/to/my/program", NULL); ... } else { //... parent process stuff } As you can see, it's creating a pipe, forking and using the pipe to read the child's output (I can't use popen here, because I also need the PID of the child process for other purposes). Question is, what should happen if in the above code, execv fails? Should I call exit() or abort()? As far as I know, those functions close the open file descriptors. Since fork-ed process inherits the parent's file descriptors, does it mean that the file descriptors used by the parent process will become unusable?

    Read the article

  • Getting HIERARCHY_REQUEST_ERR when using Javascript to recursively generate a nested list

    - by Mark
    I have a method that is trying to take in a list. This list can contain data and other lists. The end goal is to try to convert something like this ["a", "b", ["c", "d"]] into <ol> <li> <b>a</a> </li> <li> <b>b</a> </li> <ol> <li> <b>c</a> </li> <li> <b>d</a> </li> </ol> </ol> The code is: function $(tagName) { return document.createElement(tagName); } //returns an html element representing data //data should be an array or some sort of value function tagMaker(data) { tag = null; if(data instanceof Array) { //data is an array, represent using <ol> tag = $("ol"); for(i=0; i<data.length; i++) { //construct one <li> for each item in the array listItem = $("li"); //get the html element representing this particular item in the array child = tagMaker(data[i]); //<li>*html for child*</li> listItem.appendChild(child); //add this item to the list tag.appendChild(listItem); } } else { //data is not an array, represent using <b>data</b> tag = $("b"); tag.innerHTML = data.toString(); } return tag; } Calling tagMaker throws HIERARCHY_REQUEST_ERR: DOM Exception 3, rather than generating a helpful HTML element object which I was planning to append to document.body.

    Read the article

  • c# 4.0 - best way to refactor a block of "If (something is Type) {}" statements?

    - by Andrew Johns
    I've got some code that looks like this, public void ResetControls(Control controlOnPage) { if (controlOnPage is TextBox) { ResetTextBoxControl(controlOnPage); } if (controlOnPage is MediaPicker) { ((MediaPicker)controlOnPage).Media = null; } if (controlOnPage is RelatedContentPicker) { ((RelatedContentPicker)controlOnPage).RelatedContentCollection = null; } ... ... foreach (Control child in controlOnPage.Controls) { ResetControls(child); } } The idea behind it is that I can pass a page to the method and it'll recursively reset all the controls on it to their default states - in the case of MediaPicker and RelatedContentPicker, these are user controls that I've created. FXCop warns me "Do Not Cast Unnecessarily" for this code - but I'm unsure how to rewrite it to make it better. Any ideas?

    Read the article

  • How to update content of one ArrayController from the selected value of another ArrayController in Ember.js

    - by CodeHugger
    I have the following problem in ember.js. A child controller depends on a selected value in a parent controller in order to determine its content. In the database a child has a parent_id reference. App.parentsController = Em.ArrayController.create({ content: [], selected: null }); App.sonsController = Em.ArrayController.create({ // the value of content depends on the id of // the selected item in the parentsController content: [], selected: null }); App.daughtersController = Em.ArrayController.create({ // the value of content depends on the id of // the selected item in the parentsController content: [], selected: null }); I would prefer to solve this without the parentsController having to know anything about the other controllers. This should be possible with observers, bindings or even through calculations but I have no clue where to start. Any help would be well appreciated.

    Read the article

  • .focus() doesn't work on an input while orher attributes works

    - by Sirber
    I have a classic table / thead / tbody structure, which I add a line at the end of the tbody. The line contains only an input element. The code works in Firefox 3.6 but not in Chrome v5 or IE8. I'm using jQuery 1.4.1. Does not work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').focus(); Does work: $("#" + AJAX_ID).parent().find('tr:last > td:nth-child(2) > input').css('background-color', 'red'); even setting an ID on the input, and using document.getElementBuId('id').focus() doesn't work. Thank you!

    Read the article

  • Dragging on Different Levels

    - by Fahim Akhter
    Hi, I have a flash project with three non overlapping panels (visual spaces) each of which contains different movie-clips. Each movie-clip in a particular panel is the child of that panel. Now, I want to drag one of the movie-clips from one panel to another (remove it as a child from the first panel and add it to the other) without a jitter and proper drag. What is the appropriate way to handle the drag architecturally. Should the drag be handled in all panels parent. In the panels, or the items themselves? Thanks.

    Read the article

  • FLEX: why the event is only listened by the dispatcher component ?

    - by Patrick
    hi, I've a parent (Canvas) with many children (LinkButtons) The linkButtons trigger an event to communicate between them: dispatchEvent(new SameBookmarkEvent("SameBookmarkEvent", bookmark.name)); and all linkButtons have a listener this.addEventListener("SameBookmarkEvent", highlightMe); ... private function highlightMe(e:SameBookmarkEvent):void { //do something } Now, the issue is that the event is only listened by the dispatcher child. In other words, only the child triggering the event, is receiving it. I was wondering what's wrong with it, and if I should add a listener to the parent (Canvas)... I basically need the children (LinkButton) communicate between them

    Read the article

  • Show a django relationship in a template

    - by kevin_82
    I have a django model as follows: class Person(models.Model): name = models.CharField(max_length=255) class Relationship(models.Model): parent = models.ForeignKey(Person) child = models.ForeignKey(Person) description = models.TextField(blank=True) In my view, I pass a certain person, and the relationships in which he/she is parent: person = Person.objects.filter(name ='some name') descendant_relationships = Relationship.objects.filter(parent = person) An I want to show this person's descendants in a list in a template: <ul> {% for item in descendant_relationships%} <li> {{item.child.name}} - {{item.description}} </li> {% endfor %} </ul> But this template code will not show the children of children (i.e. grandchildren, great-grandchildren etc.). How can I get these lower level descendants to show up? I imagine recursion is necessary somewhere, but where?

    Read the article

  • Are browsers permitted to render <li>s in any order?

    - by ctford
    As I understand the XML spec, the significance of the order of child elements is not guaranteed. XML parsers tend to keep child elements in the same order as they occur in the XML document, but they are under no obligation to do so. If that's so, then are browsers free to render the <li>s in an <ol> or an <ul> in a different order than they occur in the XHTML? Or is it specified in the XHTML spec somewhere that order has to be preserved? I realise that all major browsers will respect the order of my <li>s. I'm just interested in the academic question of whether or not they are technically obliged to.

    Read the article

  • UIButton does not respond to touch events after changing its position using setFrame

    - by Pranathi
    I have a view controller class (child) which extends from view controller class (parent). In the parent class's loadView() method I create a sub-view (named myButtonView) with two buttons (buttons are horizontally laid out in the subview) and add it to the main view. In the subclass I need to shift these two buttons up by 50pixels. So, I am shifting the buttonView by calling the setFrame method. This makes the buttons shift and render properly but they do not respond to touch events after this. Buttons work properly in the views of Parent class type. In the child class type view also, if I comment out the setFrame() call the buttons work properly. How can I shift the buttons and still make them respond to touch events? Any help is appreciated. Following is snippets of the code. In the parent class: - (void)loadView { // Some code... CGRect buttonFrameRect = CGRectMake(0,yOffset+1,screenRect.size.width,KButtonViewHeight); myButtonView = [[UIView alloc]initWithFrame:buttonFrameRect]; myButtonView.backgroundColor = [UIColor clearColor]; [self.view addSubview:myButtonView]; // some code... CGRect nxtButtonRect = CGRectMake(screenRect.size.width - 110, 5, 100, 40); myNxtButton = [UIButton buttonWithType:UIButtonTypeCustom]; [myNxtButton setTitle:@"Submit" forState:UIControlStateNormal]; myNxtButton.frame = nxtButtonRect; myNxtButton.backgroundColor = [UIColor clearColor]; [myNxtButton addTarget:self action:@selector(nextButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; [myButtonView addSubview:myNxtButton]; CGRect backButtonRect = CGRectMake(10, 5, 100, 40); myBackButton = [UIButton buttonWithType:UIButtonTypeCustom]; [myBackButton setTitle:@"Back" forState:UIControlStateNormal]; myBackButton.frame = backButtonRect; myBackButton.backgroundColor = [UIColor clearColor]; [myBackButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; [myButtonView addSubview:myBackButton]; // Some code... } In the child class: - (void)loadView { [super loadView]; //Some code .. CGRect buttonViewRect = myButtonView.frame; buttonViewRect.origin.y = yOffset; // This is basically original yOffset + 50 [myButtonView setFrame:buttonViewRect]; yOffset += KButtonViewHeight; // Add some other view below myButtonView .. }

    Read the article

  • Navigating between 2 ViewControllers

    - by Kobe.o4
    Im using Navigation Controller for my ViewControllers,I set my importantViewController as something like this to be its RootView: UINavigationController *navControl = [[UINavigationController alloc] initWithRootViewController: vc]; [self presentModalViewController: navControl animated: YES]; Then, I pushView anotherView the FrontViewController like this: [self.navigationController pushViewController:vc animated:YES]; After a button is pressed in FrontViewController another view will be pushed ViewA but it is connected with another ViewController ViewB the same way as this AGAIN: [self.navigationController pushViewController:vc animated:YES]; (Which I think Im doing wrong when dismissing either of them with [self.navigationController popViewControllerAnimated:YES];) This is an illustration: My problem is, I need to navigate between View A and View B then when I dismiss either of them it will got back to FrontViewController. Like a child of a child View. Thanks.

    Read the article

  • Adding the text area input to a list with jquery

    - by amylynn83
    I am making a shopping list app. When an item is added to the text input, it should be converted into a list item with a class of "tile" and added to the beginning of the list with a class of ".shopping_item_list". Here is my HTML: <section> <h1 class="outline">Shopping List Items</h1> <ul class="shopping_item_list"> <li class="tile">Flowers<span class="delete">Delete</span></li> </ul> </section> My jQuery: $("input[name='shopping_item']").change(function() { var item = $(this).val(); $("<li class='tile'>+ item +</li>").prependTo(".shopping_item_list"); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); This isn't working, and I can't figure out why. I'm new to jQuery. Also, I need to add the "delete" span to the list item and am not sure how. Thanks for any help you can offer! Edited to add: Thanks to the feedback here, I was able to make it work with: $("input[name='shopping_item']").change(function() { var item = $(this).val(); $("<li class='tile'>" + item + "<span class='delete'>Delete</span>" + " </li>").prependTo(".shopping_item_list"); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); However, in my jquery, I have functions for the classes "tile" and "delete" that are not working for newly added items. // hide delete button $(".delete").hide(); // delete square $(".tile").hover(function() { $(this).find(".delete").toggle(); }); $(".tile").on("click", ".delete", function() { $(this).closest("li.tile").remove(); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); // cross off list $(".tile").click(function() { $(this).toggleClass("deleteAction"); }); The new items, which have these classes applied aren't using these functions at all. Do I need to add the functions below the add item? Does the order in which they appear in my js file matter? Do I need to add some kind of function?

    Read the article

  • C++ inheritance question

    - by user233973
    Hi guys, I have a C++ inheritance related question. I have a set of classes like this (I have not given the complete class structure coz I am lazy :) ). I want to access chiComponent class public methods using com pointer. How should I go about it? Note that I am having to change the object which "com" is pointing to in a lot of places. So I do not think I can have another chiComponent *ccom = <some_cast> com; ccom.chiComponentMethod() How should I go about it? class Component{ }; class chiComponent : public Component { public: void chiComponentMethod() { cout << "Hi! Chi component function called!!"; } } class parent { protected: Component *com; }; class child : public parent{ public: child() { com = new chiComponent(); } } Regards Arun

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >