Search Results

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

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

  • Chrome extension - Localstorage not working

    - by Bjarki Jonasson
    I'm writing a Chrome extension that uses a content script to modify certain parts of a website. The content script worked fine until I tried to add an options page to my extension. Right now I'm using an options.html file to save user preferences to localstorage, as you can see here: <html> <head><title>Options</title></head> <script type="text/javascript"> function save_options() { var select = document.getElementById("width"); var width = select.children[select.selectedIndex].value; localStorage["site_width"] = width; } function restore_options() { var fwidth = localStorage["site_width"]; if (!fwidth) { return; } var select = document.getElementById("width"); for (var i = 0; i < select.children.length; i++) { var child = select.children[i]; if (child.value == fwidth) { child.selected = "true"; break; } } } </script> <body onload="restore_options()"> Width: <select id="width"> <option value="100%">100%</option> <option value="90%">90%</option> <option value="80%">80%</option> <option value="70%">70%</option> </select> <br> <button onclick="save_options()">Save</button> </body> </html> I also have a background.html file to handle the communication between the content script and the localstorage: <html> <script type="text/javascript"> chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "siteWidth") sendResponse({status: localStorage["site_width"]}); else sendResponse({}); }); </script> </html> Then there's the actual content script that looks like this: var Width; chrome.extension.sendRequest({method: "siteWidth"}, function(response) { width = response.status; }); None of that code actually works. It looks solid enough to me but I'm not a very experienced programmer so I might be wrong. Could someone explain localstorage to me in layman's terms?

    Read the article

  • How would I design this table in SQL?

    - by RSharma
    I have a parent master table that is generic enough to hold the common information of the children. Since the children were substantially different, we created separate tables for them. So I have something like this: tblMaster -------- MasterID int Name varchar(50) --Common to all children and there are a bunch of fields like this ChildType int -- Type of Child either ChildOne or ChildTwo ChildID int -- need to store ChildOneID or ChildTwoID depending on type of Child, so that i can refer to children tblChild1 -------- ChildOneID int IDENTITY tblChild2 --------- ChildTwoID int IDENTITY Should I have a ChildID in the master that is either ChildOneID or ChildTwoID based on the ChildType column? I have a number of children and I have simplified it for this question. The other way is to add ChildOneID and ChildTwoID as columns in the master, but since i have a number of columns, I will have a lot of null columns EDIT: Any help is appreciated

    Read the article

  • C++ initializing constants and inheritance

    - by pingvinus
    I want to initialize constant in child-class, instead of base class. And use it to get rid of dynamic memory allocation (I know array sizes already, and there will be a few child-classes with different constants). So I try: class A { public: const int x; A() : x(0) {} A(int x) : x(x) {} void f() { double y[this->x]; } }; class B : A { B() : A(2) {} }; Pretty simple, but compiler says: error C2057: expected constant expression How can I say to compiler, that it is really a constant?

    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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

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