Search Results

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

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

  • Is it possible to apply inheritance to a Singleton class?

    - by Bragaadeesh
    Hi, Today I faced one question in interview. Is it possible to apply inheritance concept on Singleton Classes. I said since the constructor is private, we cannot extend that Singleton class (can someone please validate this). Next thing he asked me is to apply inheritance on that Singleton class. So, I made the Singleton's constructor as protected thinking that child's constructor also has be protected. But I was wrong the child can have a modifier either equal to or higher than that. So, I asked him to give a real world example on such a case. He was not able to give me one and said that I cant ask questions and wanted me to tell whether this scenario is possible or not. I went kind of blank. My question here is, Is this possible? Even if its possible, what is the use of it? What real world scenario would demand such a use. Thanks

    Read the article

  • Overriding setter on domain class in grails 1.1.2

    - by Pavel P
    I have following two domain classes in Grails 1.1.2: class A implements Serializable { MyEnumType myField Date fieldChanged void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() } } } class B extends A { List children void setMyField(MyEnumType val) { if (myField != null && myField != val) { myField = val fieldChanged = new Date() children.each { child -> child.myField = val } } } When I set B instance's myField, I get the setter into the cycle... myField = val line calls setter again instead of assiging the new value. Any hint how to override the setter correctly? Thanks

    Read the article

  • Why I am not getting Row value on click using this?

    - by rockers
    $("#grid td:first-child").click(function() { var value = $(this).closest('tr').find('td:eq(2)').text(); // for third column alert(value); var value = $(this).closest('tr').find('td:eq(3)').text(); // for fourth column alert(value); var AccountName = accountid; var x = function() { $(this).click($("#showregiongrid").load('/analyst/ror/regionspeexc/?a=' + AccountName)); } clickTimer = window.setTimeout(x, 300); }); Why i am not getting the row values of eq(2) and eq(3).. is there anyting I am doing wrong? if I delete td:first-child from my click event I am getting null vallues on popup? thanks

    Read the article

  • MVP pattern. Presenter requires new view instance. Best practice

    - by Andrew Florko
    I try to apply MVP pattern for win.forms application. I have 2 forms: main & child. Main has a button and when you click it - child form should appear. There are 2 views interfaces that forms implement IMainView { event OnClick; ... } IChildView { ... } There are two presenters MainPresenter(IMainView) & ChildPresenter(IChildView) MainPresenter listens to OnClick event and then should create IChildView implementation. MainPresenter { ... MainClicked() { // it's required to create IChildView instance here } } How would you implement such creation typically? Shall IMainView has factory method for IChildView or may be it should be separate Views factory. What would you advise? Or maybe there is some misunderstanding of MVP here? Thank you in advance!

    Read the article

  • How do I return the ancestors of an object with LINQ?

    - by Chris
    I have a District class that looks like this: public class District { public int Id { get; set; } public string Name { get; set; } public District Parent { get; set; } public IEnumerable<District> Ancestors { get { /* what goes here? */ } } } I would like to be able to get a list of each District's ancestors. So if District "1.1.1" is a child of District "1.1", which is a child of District "1", getting Ancestors on District "1.1.1" would return a list that contains the District objects whose names are "1.1" and "1". Does this involve the yield return statement (I never totally understood that)? Can it be done in one line?

    Read the article

  • Programmers : Would it help us make better software if we treated our creations as our children?

    - by mcnemesis
    Sometime back, while working on some project, I found a lot of challenges in developing my ideas into a viable and really useful solution. But along the way, I developed more passion for seeing the system work - actually, I wrote in my eDiary "...I want to see this child of mine grow...". The work did mature indeed, and is now a successful system employed in analysis of academic progress in my client's schools. What am really wondering is whether it might help me more (or even other programmers) if this notion of approaching software development as if it were a task of raising one's child could help deliver better software and probably more lovable software :)

    Read the article

  • form submit not working in firefox but works fine in IE

    - by jestges
    Hi, I want to submit my parent page when I click on submit button of the child page. In my child page I've written my code as string scriptString = "<script language=JavaScript> window.opener.document.forms(0).submit(); </script>"; // ASP.NET 2.0 if (!Page.ClientScript.IsClientScriptBlockRegistered(scriptString)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "script", scriptString); } it is working fine in IE but not working in Firefox. What could be the alternate method for this? Thank in advance

    Read the article

  • Is there a way to refactor this javascript/jquery?

    - by whyzee
    switch (options.effect) { case 'h-blinds-fadein': $('.child').each(function (i) { $(this).stop().css({opacity:0}).delay(100 * i).animate({ 'opacity': 1 }, { duration: options.speed, complete: (i !== r * c - 1) || function () { $(this).parent().replaceWith(prev); options.cp.bind('click',{effect: options.effect},options.ch); } }); }); break; case 'h-blinds-fadein-reverse': $('.child').each(function (i) { $(this).stop().css({opacity:0}).delay(100 * (r * c - i)).animate({ 'opacity': 1 }, { duration: options.speed, complete: (i !== 0) || function () { $(this).parent().replaceWith(prev); options.cp.bind('click',{effect: options.effect},options.ch); } }); }); break; ....more cases } I have alot of similiar other cases. One way i could think of is to write functions ? i'm not sure i'm still fairly new to the language

    Read the article

  • How to add exception in this jquery code?

    - by metal-gear-solid
    How to add exception in this jquery code? $(function() { $("table tr:nth-child(even)").addClass("striped"); }); this code is applying on all tables. but for specfic pages i don't want strip effect. I've differnt body id on each page. I want to know how to add exception for a id. $(function() { $("table tr:nth-child(even)").addClass("striped"); //I want to add exception to not to add striped class to only to page with <body id="nostrip"> });

    Read the article

  • Help with output generated by this C code using fork()

    - by Seephor
    I am trying to figure out the output for a block of C code using fork() and I am having some problems understanding why it comes out the way it does. I understand that when using fork() it starts another instance of the program in parallel and that the child instance will return 0. Could someone explain step by step the output to the block of code below? Thank you. main() { int status, i; for (i=0; i<2; ++i){ printf("At the top of pass %d\n", i); if (fork() == 0){ printf("this is a child, i=%d\n", i); } else { wait(&status); printf("This is a parent, i=%d\n", i); } } }

    Read the article

  • Is it weird or strange to make multiple WCF Calls to build a ViewModel before presenting it?

    - by Nate Bross
    Am I doing something wrong if I need code like this in a Controller? Should I be doing something differently? public ActionResult Details(int id) { var svc = new ServiceClient(); var model = new MyViewModel(); model.ObjectA = svc.GetObjectA(id); model.ObjectB = svc.GetObjectB(id); model.ObjectC = svc.GetObjectC(id); return View(model); } The reason I ask, is because I've got Linq-To-Sql on the back end and a WCF Service which exposes functionality through a set of DTOs which are NOT the Linq-To-Sql generated classes and thus do not have the parent/child properties; but in the detail view, I would like to see some of the parent/child data.

    Read the article

  • Get class of caller's method (via inspect) in Python

    - by Slava Vishnyakov
    Is it possible to get reference to class B in this example? class A(object): pass class B(A): def test(self): test2() class C(B): pass import inspect def test2(): frame = inspect.currentframe().f_back cls = frame.[?something here?] # cls here should == B (class) c = C() c.test() Basically, C is child of B, B is child of A. Then we create c of type C. Then the call to c.test() actually calls B.test() (via inheritance), which calls to test2(). test2() can get the parent frame frame; code reference to method via frame.f_code; self via frame.f_locals['self']; but type(frame.f_locals['self']) is C (of course), but not B, where method is defined. Any way to get B?

    Read the article

  • Database design: How should I add an information which can apply to several tables

    - by Stefan
    I am constructing a database System using Mysql, this will be an application of about 20 tables. The system contains information on farmers, we work with organic certification and need to record a lot of info for that. In my system, there are related parent-child tables for farmers, producing years and fields/areas - it's a simple representation of the real world in which farmers farm crops on their fields. I now need to add several status flags for each one of these levels: a farmer can be certified, or his field can be, or the specific year can be; each of these flags has several states and can occur a number of times. The obvious solution to this would be to add a child table to every one of these tables, and define the states there. What I wonder if there is an easier way to do this to avoid getting to many tables? Where/how would be best practise to keep that data?

    Read the article

  • Entity Framework This property descriptor does not support the SetValue

    - by Gayan
    Hello guys, below are my entities which i have created using entity frame work. retailer id name childs(navigation) generated database schema [Id] [int] IDENTITY(1,1) NOT NULL, [Name] nvarchar NOT NULL childern id name RETAILER(navigation) generated database schema [Id] [int] IDENTITY(1,1) NOT NULL, [name] nvarchar NOT NULL [Retailer_Id] [int] NOT NULL, As you can see in the above model the relationship is 1 retailer can have 0 or 1 child. my problem is when i create a new child and set the retailer navigation property of it to a retailer entity it throws the following exception.how do i solve it Error while setting property 'retailer': 'This property descriptor does not support the SetValue method.'.

    Read the article

  • d3 tree - parents having same children

    - by Larry Anderson
    I've been transitioning my code from JIT to D3, and working with the tree layout. I've replicated http://mbostock.github.com/d3/talk/20111018/tree.html with my tree data, but I wanted to do a little more. In my case I will need to create child nodes that merge back to form a parent at a lower level, which I realize is more of a directed graph structure, but would like the tree to accomodate (i.e. notice that common id's between child nodes should merge). So basically a tree that divides like normal on the way from parents to children, but then also has the ability to bring those children nodes together to be parents (sort of an incestual relationship or something :)). Asks something similar - How to layout a non-tree hierarchy with D3 It sounds like I might be able to use hierarchical edge bundling in conjunction with the tree hierarchy layout, but I haven't seen that done. I might be a little off with that though.

    Read the article

  • Best practice for passing configuration to each GUI object

    - by Laimoncijus
    Hi, I am writing an application, where I do have few different windows implemented, where each window is a separate class. Now I need somehow to pass a single configuration object to all of them. My GUI is designed in way, where I have one main window, which may create some child windows of its own, and these child windows can have their own childs (so there is no possibility to create all windows in initialization part and feed the config object to all of them from the very beginning)... What would be best practice for sharing this configuration object between them? Always passing via constructor or maybe making it somewhere as final public static and let each window object to access it when needed? Thanks

    Read the article

  • How to scroll the content without scrolling the image in the background using UIScrollView ?

    - by Raymond Choong
    I am trying to scroll the content without scrolling the image in the background using UIScrollView. I am using IB and setting the FileOwner View to point to the Scroll View (Image View is a child of the Scroll view). I have made the image height to be 960 pixels. I have also set scrolling content size in the vierController that owns this UIView (void)viewDidLoad { UIScrollView *tempScrollView = (UIScrollView *)self.view; tempScrollView.contentSize=CGSizeMake(320, 960); } My problem is that the Image only appears moves along with the content. I have tried taking out the settings in viewDidLoad, but the scrolling cease to function. I have also tried changing the location of the image and have it placed under VIEW instead of Scoll View (by the way Scroll View is a child of VIEW), but that resulted in the app breaking (termination error). Any advice would be appreciated.

    Read the article

  • Storing object into cache using Linq classes and velocity

    - by Arun
    I careated couple of linq classes & marked the datacontext as unidirectional. Out of four classes; one is main class while other three are having the one to many relationship with first one; When I load the object of main class & put into the memory OR serialize it into an XML file; I never get the child class data while it is maked as DataContractAttribute. How can I force object to put the child class data into XML file or into cache ?

    Read the article

  • Simple XML parsing error

    - by phpeffedup
    I'm trying to iterate through a Twitter XML File, where the container tag is , and each user is . I need to create a variable $id based on the XML attribute for each user. Username is already instantiated. $url = "http://api.twitter.com/1/statuses/friends/$username.xml"; $xmlpure = file_get_contents($url); $listxml = simplexml_load_string($xmlpure); foreach($listxml->users->children() as $child) { $id = $child->{"id"}; //Do another action } But I'm getting this error: Warning: main() [function.main]: Node no longer exists in /home/.../bonus.php on line 32 Line 32 is the foreach statement, and I don't actually USE the main() method. What am I doing wrong?

    Read the article

  • iphone/ipad with 2 side by side tables

    - by jesse001
    I want to create a view with 2 tables side by side, where selecting the row on 1 table effects the content of the other and vice versa (not parent child). My problem is how to send the request. I started with a utility app using core data, and added 2 table view controllers. I added these to the main view nib and moved the tables to the view. One table controls a list from Core Data, then on selecting a row I want it to move to the other table which is based on a mutable array. On didselectrow I want to tell the other table to update, however I can only find samples that are parent/child so involves initializing. Does anyone know of a way to do this for an active view? Thanks heaps for your help.

    Read the article

  • C++ linked list based tree structure. Sanely move nodes between lists.

    - by krunk
    The requirements: Each Node in the list must contain a reference to its previous sibling Each Node in the list must contain a reference to its next sibling Each Node may have a list of child nodes Each child Node must have a reference to its parent node Basically what we have is a tree structure of arbitrary depth and length. Something like: -root(NULL) --Node1 ----ChildNode1 ------ChildOfChild --------AnotherChild ----ChildNode2 --Node2 ----ChildNode1 ------ChildOfChild ----ChildNode2 ------ChildOfChild --Node3 ----ChildNode1 ----ChildNode2 Given any individual node, you need to be able to either traverse its siblings. the children, or up the tree to the root node. A Node ends up looking something like this: class Node { Node* previoius; Node* next; Node* child; Node* parent; } I have a container class that stores these and provides STL iterators. It performs your typical linked list accessors. So insertAfter looks like: void insertAfter(Node* after, Node* newNode) { Node* next = after->next; after->next = newNode; newNode->previous = after; next->previous = newNode; newNode->next = next; newNode->parent = after->parent; } That's the setup, now for the question. How would one move a node (and its children etc) to another list without leaving the previous list dangling? For example, if Node* myNode exists in ListOne and I want to append it to listTwo. Using pointers, listOne is left with a hole in its list since the next and previous pointers are changed. One solution is pass by value of the appended Node. So our insertAfter method would become: void insertAfter(Node* after, Node newNode); This seems like an awkward syntax. Another option is doing the copying internally, so you'd have: void insertAfter(Node* after, const Node* newNode) { Node *new_node = new Node(*newNode); Node* next = after->next; after->next = new_node; new_node->previous = after; next->previous = new_node; new_node->next = next; new_node->parent = after->parent; } Finally, you might create a moveNode method for moving and prevent raw insertion or appending of a node that already has been assigned siblings and parents. // default pointer value is 0 in constructor and a operator bool(..) // is defined for the Node bool isInList(const Node* node) const { return (node->previous || node->next || node->parent); } // then in insertAfter and friends if(isInList(newNode) // throw some error and bail I thought I'd toss this out there and see what folks came up with.

    Read the article

  • jquery: if ul has li with certain classname?

    - by mathiregister
    hi guys, i wonder how i can query if a ul has a first-child li with a certain classname? like… <ul> <li>list element 1</li> <li>list element 2</li> </ul> <ul> <li class="whatever">list element 1</li> <li>list element 2</li> </ul> i want to query if ul has a child with classname whatever - do something! is that even possible? thank you

    Read the article

  • C++ function-pointer and inheritance

    - by pingvinus
    In parent class I have function, that operates under an array of functions, declared in child-class, number of functions for every child-class may vary. But since every function uses some object-variables, I can't declare them as static. I've try to do something like this: class A { public: typedef int (A::*func)(); func * fs; void f() { /*call functions from this->fs*/ } }; class B : public A { public: int smth; B(int smth) { this->smth = smth; this->fs = new func[1]; fs[0] = &B::f; } int f() { return smth + 1; } }; But, obviously it doesn't work. Any suggestions?

    Read the article

  • tablerows hover with table even/odd styled via CSS

    - by root
    even/odd styles set on tablerows but hovering of table rows don't work . CSS style : #table_even tr:hover { background-color:#fffbae!important; } /* hovering */ #table_even tr:nth-child(odd) td { background-color:#fbfbfb } /*odd*/ #table_even tr:nth-child(even) td { background-color:#e8ecee } /* even*/ HTML Codes: <table id="table_even" style="width: 100%"> <tr> <td>##</td> <td>##</td> </tr> <tr> <td>##</td> <td>##</td> </tr> <tr> <td>##</td> <td>##</td> </tr> </table> how can be solve ?

    Read the article

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