Search Results

Search found 2536 results on 102 pages for 'nested'.

Page 9/102 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • How to keep a trace of a record inside a nested repeater?

    - by Amokrane
    Hi, I have the following implementation: As you can see I have a repeater (listing the Machines) and a nested repeater (listing the WindowsServices inside each Machine). For each Windows Service I can perform an action using a button. However, to perform this action I need to know which Machine and which WindowsService are concerned. This is my code: protected void Page_Init(object sender, EventArgs e) { rptMachine.ItemDataBound += new RepeaterItemEventHandler(rptMachine_ItemDataBound); } protected void Page_Load(object sender, EventArgs e) { // bind the Machine repeater rptMachine.DataSource = _monitoringService.Machines; rptMachine.DataBind(); } protected void rptMachine_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Repeater nestedRepeater = (Repeater) e.Item.FindControl("rptWindowsService"); nestedRepeater.DataSource = ((IMachine) e.Item.DataItem).WindowsServices; nestedRepeater.DataBind(); Button btnActionInner = null; // bind the action button situated inside the nested repeater foreach(RepeaterItem ri in nestedRepeater.Items) { if((Button)ri.FindControl("btnAction") != null) { btnActionInner = (Button) ri.FindControl("btnAction"); btnActionInner.CommandName = "ActionState"; btnActionInner.CommandArgument = strWindowsService; } } } } protected void rptWindowsService_ItemCommand(object source, RepeaterCommandEventArgs e) { // do the specific action stop/run for the windows service if (e.CommandName == "ActionState") { if(((Button)(e.CommandSource)).Text.Equals("Stop")) { } else if(((Button)(e.CommandSource)).Text.Equals("Run")) { } } } } } So basically I need to know (inside rptWindowsService_ItemCommand) what is the pair that is concerned by the operation. What's the best way to do that? Don't hesitate to ask for more clarifications! Thanks

    Read the article

  • Is There a More Efficient Way to Write Nested While Loops?

    - by Ryan
    The code below shows nested while loops, but it's not the very efficient. Suppose I wanted to extend the code to include 100 nested while loops. Is there a better way to accomplish this task? <?php $count = 1; $num = 1; $options=3; while ( $num <=$options ) { echo "(".$num . ") "; $num1 = 1; $options1=3; while ( $num1 <=$options1 ) { echo "*".$num1 . "* "; $num2 = 1; $options2=3; while ( $num2 <=$options2 ) { echo "@".$num2 . "@ "; $num3 = 1; $options3=3; while ( $num3 <=$options3 ) { echo $num3 . " "; $num3++; $count++; } echo "<br />"; $num2++; } echo "<br />"; $num1++; } echo "<br />"; $num++; } echo $count; ?>

    Read the article

  • Nested Class member function can't access function of enclosing class. Why?

    - by Rahul
    Please see the example code below: class A { private: class B { public: foobar(); }; public: foo(); bar(); }; Within class A & B implementation: A::foo() { //do something } A::bar() { //some code foo(); //more code } A::B::foobar() { //some code foo(); //<<compiler doesn't like this } The compiler flags the call to foo() within the method foobar(). Earlier, I had foo() as private member function of class A but changed to public assuming that B's function can't see it. Of course, it didn't help. I am trying to re-use the functionality provided by A's method. Why doesn't the compiler allow this function call? As I see it, they are part of same enclosing class (A). I thought the accessibility issue for nested class meebers for enclosing class in C++ standards was resolved. How can I achieve what I am trying to do without re-writing the same method (foo()) for B, which keeping B nested within A? I am using VC++ compiler ver-9 (Visual Studio 2008). Thank you for your help.

    Read the article

  • CouchDB: accessing nested structutes in map function

    - by Vegar
    I have a document based on a xml structure that I have stored in a CouchDB database. Some of the keys contains namespaces and are on the form "namespace:key": {"mykey":{nested:key":"nested value"}} In the map function, I want to emit the nested value as a key, but the colon inside the name makes it hard... emit(doc.mykey.nested:key, doc) <-- will not work. Does anyone know how this can be solved?

    Read the article

  • What is the best way to add and order to Doctrine Nested Set Trees?

    - by murze
    What is the best way to add a sense of order in Doctrine Nested Sets? The documention contains several examples of how to get al the childeren of a specific node $category->getNode()->getSiblings() But how can I for example: change the position of the fourth sibling to the second position get only the second sibling add a sibling between the second and third child etc... Do I have to manually add and ordercolumn to the model to do these operations?

    Read the article

  • When did C++ get nested classes?

    - by Parappa
    Somehow I never noticed until today that C++ supports nested classes. This surprised me because when I was learning C++ back in the '90s, I specifically remember nested classes being something that Object Pascal and Java had, but which C++ did not. I asked an old programmer friend about it and he concurred that he recalls C++ not having nested classes. Is my recollection of C++ not having nested classes mistaken, or were they actually added to the standard at some point in the past fifteen years? I tried searching Google for information on this topic and I haven't come up with anything helpful yet. It could also be that I'm thinking of nested functions, which Pascal certainly supports but C does not.

    Read the article

  • How would you refactor nested IF Statements?

    - by saunderl
    I was cruising around the programming blogosphere when I happened upon this post about GOTO's: http://giuliozambon.blogspot.com/2010/12/programmers-tabu.html Here the writer talks about how "one must come to the conclusion that there are situations where GOTOs make for more readable and more maintainable code" and then goes on to show an example similar to this: if (Check#1) { CodeBlock#1 if (Check#2) { CodeBlock#2 if (Check#3) { CodeBlock#3 if (Check#4) { CodeBlock#4 if (Check#5) { CodeBlock#5 if (Check#6) { CodeBlock#6 if (Check#7) { CodeBlock#7 } else { rest - of - the - program } } } } } } } The writer then proposes that using GOTO's would make this code much easier to read and maintain. I personally can think of at least 3 different ways to flatten it out and make this code more readable without resorting to flow-breaking GOTO's. Here are my two favorites. 1 - Nested Small Functions. Take each if and its code block and turn it into a function. If the boolean check fails, just return. If it passes, then call the next function in the chain. (Boy, that sounds a lot like recursion, could you do it in a single loop with function pointers?) 2 - Sentinal Variable. To me this is the easyest. Just use a blnContinueProcessing variable and check to see if it is still true in your if check. Then if the check fails, set the variable to false. How many different ways can this type of coding problem be refactored to reduce nesting and increase maintainability?

    Read the article

  • Alternate method to dependent, nested if statements to check multiple states

    - by octopusgrabbus
    Is there an easier way to process multiple true/false states than using nested if statements? I think there is, and it would be to create a sequence of states, and then use a function like when to determine if all states were true, and drop out if not. I am asking the question to make sure there is not a preferred Clojure way to do this. Here is the background of my problem: I have an application that depends on quite a few input files. The application depends on .csv data reports; column headers for each report (.csv files also), so each sequence in the sequence of sequences can be zipped together with its columns for the purposes of creating a smaller sequence; and column files for output data. I use the following functions to find out if a file is present: (defn kind [filename] (let [f (File. filename)] (cond (.isFile f) "file" (.isDirectory f) "directory" (.exists f) "other" :else "(cannot be found)" ))) (defn look-for [filename expected-type] (let [find-status (kind-stat filename expected-type)] find-status)) And here are the first few lines of a multiple if which looks ugly and is hard to maintain: (defn extract-re-values "Plain old-fashioned sub-routine to process real-estate values / 3rd Q re bills extract." [opts] (if (= (utl/look-for (:ifm1 opts) "f") 0) ; got re columns? (if (= (utl/look-for (:ifn1 opts) "f") 0) ; got re data? (if (= (utl/look-for (:ifm3 opts) "f") 0) ; got re values output columns? (if (= (utl/look-for (:ifm4 opts) "f") 0) ; got re_mixed_use_ratio columns? (let [re-in-col-nams (first (utl/fetch-csv-data (:ifm1 opts))) re-in-data (utl/fetch-csv-data (:ifn1 opts)) re-val-cols-out (first (utl/fetch-csv-data (:ifm3 opts))) mu-val-cols-out (first (utl/fetch-csv-data (:ifm4 opts))) chk-results (utl/chk-seq-len re-in-col-nams (first re-in-data) re-rec-count)] I am not looking for a discussion of the best way, but what is in Clojure that facilitates solving a problem like this.

    Read the article

  • Ping Access to a Nested VM !! Plz Help

    - by Shivaramakrishnan
    I have a problem in communication between the host and the nested VM.This is my layout. I have installed KVM on host machine having a single nic interface (public ip) running Ubuntu.On top of this,I have VM running Ubuntu.I have installed KVM in this VM too.I then have a VM inside this running a web server. I am able to ping the host from this web server VM and ssh into it.But from host to VM ,ping is being unsuccessful. The VM (named L1hyp) on host was created using libvirt-manager and has IP of 192.168.122.8. The vswitch interface created at host is in default config (NAT-ed). Its IP is 192.168.122.1. Now this VM is also having a vswitch interface which is in default config (NAT-ed).Its IP is 192.168.100.1. The Web server VM is created on top of this L1hyp VM, is having an IP of 192.168.100.186. The Webserver VM uses 192.168.100.1 as its default gw. The L1hyp uses 192.168.122.1 as its default gw. From Host: ping 192.168.122.8 - SUCCEEDS ping 192.168.122.1 - SUCCEEDS ping 192.168.100.1 - SUCCEEDS ping 192.168.100.186 - FAILS Comes up with Destination Host Unreachable From 192.168.122.1. But there is route to 192.168.100.0/24 subnet from host.Ping to 192.168.100.1 succeeds. From Webserver VM: ping 192.168.100.1 - SUCCEEDS ping 192.168.122.1 - SUCCEEDS SSH from web server VM to host succeeds. Can anyone help me out what needs to be modified to have two way communication between the host and Webserver VM at the earliest? I am pondering over this problem for over a week now.

    Read the article

  • Using nested public classes to organize constants

    - by FrustratedWithFormsDesigner
    I'm working on an application with many constants. At the last code review it came up that the constants are too scattered and should all be organized into a single "master" constants file. The disagreement is about how to organize them. The majority feel that using the constant name should be good enough, but this will lead to code that looks like this: public static final String CREDITCARD_ACTION_SUBMITDATA = "6767"; public static final String CREDITCARD_UIFIELDID_CARDHOLDER_NAME = "3959854"; public static final String CREDITCARD_UIFIELDID_EXPIRY_MONTH = "3524"; public static final String CREDITCARD_UIFIELDID_ACCOUNT_ID = "3524"; ... public static final String BANKPAYMENT_UIFIELDID_ACCOUNT_ID = "9987"; I find this type of naming convention to be cumbersome. I thought it might be easier to use public nested class, and have something like this: public class IntegrationSystemConstants { public class CreditCard { public static final String UI_EXPIRY_MONTH = "3524"; public static final String UI_ACCOUNT_ID = "3524"; ... } public class BankAccount { public static final String UI_ACCOUNT_ID = "9987"; ... } } This idea wasn't well received because it was "too complicated" (I didn't get much detail as to why this might be too complicated). I think this creates a better division between groups of related constants and the auto-complete makes it easier to find these as well. I've never seen this done though, so I'm wondering if this is an accepted practice or if there's better reasons that it shouldn't be done.

    Read the article

  • python: what are efficient techniques to deal with deeply nested data in a flexible manner?

    - by AlexandreS
    My question is not about a specific code snippet but more general, so please bear with me: How should I organize the data I'm analyzing, and which tools should I use to manage it? I'm using python and numpy to analyse data. Because the python documentation indicates that dictionaries are very optimized in python, and also due to the fact that the data itself is very structured, I stored it in a deeply nested dictionary. Here is a skeleton of the dictionary: the position in the hierarchy defines the nature of the element, and each new line defines the contents of a key in the precedent level: [AS091209M02] [AS091209M01] [AS090901M06] ... [100113] [100211] [100128] [100121] [R16] [R17] [R03] [R15] [R05] [R04] [R07] ... [1263399103] ... [ImageSize] [FilePath] [Trials] [Depth] [Frames] [Responses] ... [N01] [N04] ... [Sequential] [Randomized] [Ch1] [Ch2] Edit: To explain a bit better my data set: [individual] ex: [AS091209M02] [imaging session (date string)] ex: [100113] [Region imaged] ex: [R16] [timestamp of file] ex [1263399103] [properties of file] ex: [Responses] [regions of interest in image ] ex [N01] [format of data] ex [Sequential] [channel of acquisition: this key indexes an array of values] ex [Ch1] The type of operations I perform is for instance to compute properties of the arrays (listed under Ch1, Ch2), pick up arrays to make a new collection, for instance analyze responses of N01 from region 16 (R16) of a given individual at different time points, etc. This structure works well for me and is very fast, as promised. I can analyze the full data set pretty quickly (and the dictionary is far too small to fill up my computer's ram : half a gig). My problem comes from the cumbersome manner in which I need to program the operations of the dictionary. I often have stretches of code that go like this: for mk in dic.keys(): for rgk in dic[mk].keys(): for nk in dic[mk][rgk].keys(): for ik in dic[mk][rgk][nk].keys(): for ek in dic[mk][rgk][nk][ik].keys(): #do something which is ugly, cumbersome, non reusable, and brittle (need to recode it for any variant of the dictionary). I tried using recursive functions, but apart from the simplest applications, I ran into some very nasty bugs and bizarre behaviors that caused a big waste of time (it does not help that I don't manage to debug with pdb in ipython when I'm dealing with deeply nested recursive functions). In the end the only recursive function I use regularly is the following: def dicExplorer(dic, depth = -1, stp = 0): '''prints the hierarchy of a dictionary. if depth not specified, will explore all the dictionary ''' if depth - stp == 0: return try : list_keys = dic.keys() except AttributeError: return stp += 1 for key in list_keys: else: print '+%s> [\'%s\']' %(stp * '---', key) dicExplorer(dic[key], depth, stp) I know I'm doing this wrong, because my code is long, noodly and non-reusable. I need to either use better techniques to flexibly manipulate the dictionaries, or to put the data in some database format (sqlite?). My problem is that since I'm (badly) self-taught in regards to programming, I lack practical experience and background knowledge to appreciate the options available. I'm ready to learn new tools (SQL, object oriented programming), whatever it takes to get the job done, but I am reluctant to invest my time and efforts into something that will be a dead end for my needs. So what are your suggestions to tackle this issue, and be able to code my tools in a more brief, flexible and re-usable manner?

    Read the article

  • How do I draw a scene with 2 nested frames

    - by Guido Granobles
    I have been trying for long time to figure out this: I have loaded a model from a directx file (I am using opengl and Java) the model have a hierarchical system of nested reference frames (there are not bones). There are just 2 frames, one of them is called x3ds_Torso and it has a child frame called x3ds_Arm_01. Each one of them has a mesh. The thing is that I can't draw the arm connected to the body. Sometimes the body is in the center of the screen and the arm is at the top. Sometimes they are both in the center. I know that I have to multiply the matrix transformation of every frame by its parent frame starting from the top to the bottom and after that I have to multiply every vertex of every mesh by its final transformation matrix. So I have this: public void calculeFinalMatrixPosition(Bone boneParent, Bone bone) { System.out.println("-->" + bone.name); if (boneParent != null) { bone.matrixCombined = bone.matrixTransform.multiply(boneParent.matrixCombined); } else { bone.matrixCombined = bone.matrixTransform; } bone.matrixFinal = bone.matrixCombined; for (Bone childBone : bone.boneChilds) { calculeFinalMatrixPosition(bone, childBone); } } Then I have to multiply every vertex of the mesh: public void transformVertex(Bone bone) { for (Iterator<Mesh> iterator = meshes.iterator(); iterator.hasNext();) { Mesh mesh = iterator.next(); if (mesh.boneName.equals(bone.name)) { float[] vertex = new float[4]; double[] newVertex = new double[3]; if (mesh.skinnedVertexBuffer == null) { mesh.skinnedVertexBuffer = new FloatDataBuffer( mesh.numVertices, 3); } mesh.vertexBuffer.buffer.rewind(); while (mesh.vertexBuffer.buffer.hasRemaining()) { vertex[0] = mesh.vertexBuffer.buffer.get(); vertex[1] = mesh.vertexBuffer.buffer.get(); vertex[2] = mesh.vertexBuffer.buffer.get(); vertex[3] = 1; newVertex = bone.matrixFinal.transpose().multiply(vertex); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[0])); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[1])); mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[2])); } mesh.vertexBuffer = new FloatDataBuffer( mesh.numVertices, 3); mesh.skinnedVertexBuffer.buffer.rewind(); mesh.vertexBuffer.buffer.put(mesh.skinnedVertexBuffer.buffer); } } for (Bone childBone : bone.boneChilds) { transformVertex(childBone); } } I know this is not the more efficient code but by now I just want to understand exactly how a hierarchical model is organized and how I can draw it on the screen. Thanks in advance for your help.

    Read the article

  • Organizing Git repositories with common nested sub-modules

    - by André Caron
    I'm a big fan of Git sub-modules. I like to be able to track a dependency along with its version, so that you can roll-back to a previous version of your project and have the corresponding version of the dependency to build safely and cleanly. Moreover, it's easier to release our libraries as open source projects as the history for libraries is separate from that of the applications that depend on them (and which are not going to be open sourced). I'm setting up workflow for multiple projects at work, and I was wondering how it would be if we took this approach a bit of an extreme instead of having a single monolithic project. I quickly realized there is a potential can of worms in really using sub-modules. Supposing a pair of applications: studio and player, and dependent libraries core, graph and network, where dependencies are as follows: core is standalone graph depends on core (sub-module at ./libs/core) network depdends on core (sub-module at ./libs/core) studio depends on graph and network (sub-modules at ./libs/graph and ./libs/network) player depends on graph and network (sub-modules at ./libs/graph and ./libs/network) Suppose that we're using CMake and that each of these projects has unit tests and all the works. Each project (including studio and player) must be able to be compiled standalone to perform code metrics, unit testing, etc. The thing is, a recursive git submodule fetch, then you get the following directory structure: studio/ studio/libs/ (sub-module depth: 1) studio/libs/graph/ studio/libs/graph/libs/ (sub-module depth: 2) studio/libs/graph/libs/core/ studio/libs/network/ studio/libs/network/libs/ (sub-module depth: 2) studio/libs/network/libs/core/ Notice that core is cloned twice in the studio project. Aside from this wasting disk space, I have a build system problem because I'm building core twice and I potentially get two different versions of core. Question How do I organize sub-modules so that I get the versioned dependency and standalone build without getting multiple copies of common nested sub-modules? Possible solution If the the library dependency is somewhat of a suggestion (i.e. in a "known to work with version X" or "only version X is officially supported" fashion) and potential dependent applications or libraries are responsible for building with whatever version they like, then I could imagine the following scenario: Have the build system for graph and network tell them where to find core (e.g. via a compiler include path). Define two build targets, "standalone" and "dependency", where "standalone" is based on "dependency" and adds the include path to point to the local core sub-module. Introduce an extra dependency: studio on core. Then, studio builds core, sets the include path to its own copy of the core sub-module, then builds graph and network in "dependency" mode. The resulting folder structure looks like: studio/ studio/libs/ (sub-module depth: 1) studio/libs/core/ studio/libs/graph/ studio/libs/graph/libs/ (empty folder, sub-modules not fetched) studio/libs/network/ studio/libs/network/libs/ (empty folder, sub-modules not fetched) However, this requires some build system magic (I'm pretty confident this can be done with CMake) and a bit of manual work on the part of version updates (updating graph might also require updating core and network to get a compatible version of core in all projects). Any thoughts on this?

    Read the article

  • jQuery open and close nested ul nav depending on location

    - by firefusion
    I'm making a sub nav in wordpress and have a nested list style menu. An example of the HTML is below. Whichever is the current item has the li class "current_page_item". I need all child menus collapsed unless there is a current_page_item class on the parent or one of the children. <ul> <li class="current_page_item"><a href="#">Parent Item</a> <ul class="children"> <li><a href="#">Child page</a></li> <li><a href="#">Child page</a></li> <li><a href="#">Child page</a></li> <li><a href="#">Child page</a></li> </ul> </li> <li><a href="#">Parent Item</a> <ul class="children"> <li><a href="#">Child page</a></li> <li><a href="#">Child page</a></li> </ul> </li> <li><a href="#">Parent Item</a> <ul class="children"> <li><a href="#">Child page</a></li> <li><a href="#">Child page</a></li> </ul> </li> <li><a href="#">Parent Item</a></li> <li><a href="#">Parent Item</a></li> </ul> This so far, which works but i wonder if it can be improved as there is some flashing open and then closed again.... jQuery('ul.children').slideUp(); jQuery('li.current_page_item ul.children').slideDown('medium'); jQuery('li.current_page_item').parent().slideDown('medium');

    Read the article

  • Dsquery nested groups

    - by Doctor Trout
    Hi there, How would I write a dsquery to get a list of all the members of a d-list, expanding any nested groups to get the members of those groups? I've written this: dsquery * -filter "(&(memberOf=cn=...))" -r -limit 0 -attr CUSTOMFIELD sAMAccountName displayName > export.txt but returns nested d-lists and I want to expand these. I then tried this: dsquery group -samid "NAME | dsget group -members -expand > export.txt But this just lists the OU of each member and I want to get the Account Name and a custom field returned. Is there any way, either of chosing which fields to return from dsget or to epxand dsquery to show nested group membership? Thanks.

    Read the article

  • How can I use nested Async (WCF) calls within foreach loops in Silverlight ?

    - by Peter St Angelo
    The following code contains a few nested async calls within some foreach loops. I know the silverlight/wcf calls are called asyncrously -but how can I ensure that my wcfPhotographers, wcfCategories and wcfCategories objects are ready before the foreach loop start? I'm sure I am going about this all the wrong way -and would appreciate an help you could give. private void PopulateControl() { List<CustomPhotographer> PhotographerList = new List<CustomPhotographer>(); proxy.GetPhotographerNamesCompleted += proxy_GetPhotographerNamesCompleted; proxy.GetPhotographerNamesAsync(); //for each photographer foreach (var eachPhotographer in wcfPhotographers) { CustomPhotographer thisPhotographer = new CustomPhotographer(); thisPhotographer.PhotographerName = eachPhotographer.ContactName; thisPhotographer.PhotographerId = eachPhotographer.PhotographerID; thisPhotographer.Categories = new List<CustomCategory>(); proxy.GetCategoryNamesFilteredByPhotographerCompleted += proxy_GetCategoryNamesFilteredByPhotographerCompleted; proxy.GetCategoryNamesFilteredByPhotographerAsync(thisPhotographer.PhotographerId); // for each category foreach (var eachCatergory in wcfCategories) { CustomCategory thisCategory = new CustomCategory(); thisCategory.CategoryName = eachCatergory.CategoryName; thisCategory.CategoryId = eachCatergory.CategoryID; thisCategory.SubCategories = new List<CustomSubCategory>(); proxy.GetSubCategoryNamesFilteredByCategoryCompleted += proxy_GetSubCategoryNamesFilteredByCategoryCompleted; proxy.GetSubCategoryNamesFilteredByCategoryAsync(thisPhotographer.PhotographerId,thisCategory.CategoryId); // for each subcategory foreach(var eachSubCatergory in wcfSubCategories) { CustomSubCategory thisSubCatergory = new CustomSubCategory(); thisSubCatergory.SubCategoryName = eachSubCatergory.SubCategoryName; thisSubCatergory.SubCategoryId = eachSubCatergory.SubCategoryID; } thisPhotographer.Categories.Add(thisCategory); } PhotographerList.Add(thisPhotographer); } PhotographerNames.ItemsSource = PhotographerList; } void proxy_GetPhotographerNamesCompleted(object sender, GetPhotographerNamesCompletedEventArgs e) { wcfPhotographers = e.Result.ToList(); } void proxy_GetCategoryNamesFilteredByPhotographerCompleted(object sender, GetCategoryNamesFilteredByPhotographerCompletedEventArgs e) { wcfCategories = e.Result.ToList(); } void proxy_GetSubCategoryNamesFilteredByCategoryCompleted(object sender, GetSubCategoryNamesFilteredByCategoryCompletedEventArgs e) { wcfSubCategories = e.Result.ToList(); }

    Read the article

  • How do I get a ComboBox SelectionChanged event to fire from a nested ListBoxItem?

    - by Stephen McCusker
    This is a rather complex problem that has me really confused right now. Any help would be greatly appreciated. The Setup: ListBox of Type A UserControls -ListBoxItem of Type A UserControl --ListBox of Type B UserControls ---ListBoxItem of Type B UserControl ----ListBox of Type C UserControls -----ListBoxItem of Type C UserControl (contains the ComboBox) In other words, the Type A control has a ListBox of Type B controls that has a ListBox of Type C controls. All of the controls are hierarchical in nature. Type A contains the data that's needed to load the Type B controls and the Type B contains the data that's needed to load the Type C controls. The Type C control has a standard ComboBox in it for changing the values of the present items. In addition to the above structure, I have drag and dropping tied to the PreviewMouseLeftButtonDown event on both the Type A and Type B UserControl levels to handle reordering/deleting/etc commands in the GUI. All of this is working as intended. The Problem: When I attempt to change the value in the ComboBox, the SelectionChanged event never fires on the Type C "level" unless I'm careful enough to click on the borders/spacing in between any Type A or B controls. This happens when my ComboBox popout menu overlaps on either a Type A or B control located below itself. The selection events for Type A or B are firing instead of the Type C events, so the ComboBox is never changing its value reliably. In the debugger, the code for handling the drag and drop is triggering on the next ListBoxItem that's located underneath the ComboBox. Thoughts: Is there a way I can make my ComboBox popup take prevalence over the items behind it while double-nested in a ListBox (ie, ignore anything behind it while it's open)? Is there some way to reroute the incorrectly firing SelectionChanged events down to the ComboBox that's supposed to be triggering them?

    Read the article

  • How do I go about link web content in a database with a nested set model?

    - by wb
    My nested set table is as follows. create table depts ( id int identity(0, 1) primary key , lft int , rgt int , name nvarchar(60) , abbrv nvarchar(20) ); Test departments. insert into depts (lft, rgt, name, abbrv) values (1, 14, 'root', 'r'); insert into depts (lft, rgt, name, abbrv) values (2, 3, 'department 1', 'd1'); insert into depts (lft, rgt, name, abbrv) values (4, 5, 'department 2', 'd2'); insert into depts (lft, rgt, name, abbrv) values (6, 13, 'department 3', 'd3'); insert into depts (lft, rgt, name, abbrv) values (7, 8, 'sub department 3.1', 'd3.1'); insert into depts (lft, rgt, name, abbrv) values (9, 12, 'sub department 3.2', 'd3.2'); insert into depts (lft, rgt, name, abbrv) values (10, 11, 'sub sub department 3.2.1', 'd3.2.1'); My web content table is as follows. create table content ( id int identity(0, 1) , dept_id int , page_name nvarchar(60) , content ntext ); Test content. insert into content (dept_id, page_name, content) values (3, 'index', '<h2>welcome to department 3!</h2>'); insert into content (dept_id, page_name, content) values (4, 'index', '<h2>welcome to department 3.1!</h2>'); insert into content (dept_id, page_name, content) values (6, 'index', '<h2>welcome to department 3.2.1!</h2>'); insert into content (dept_id, page_name, content) values (2, 'what-doing', '<h2>what is department 2 doing?/h2>'); I'm trying to query the correct page content (from the content table) based on the url given. I can easily accomplish this task with a root department. However, querying a department with multiple depths is proving to be a little harder. For example: http://localhost/departments.asp?d3/ (Should return <h2>welcome to department 3!</h2>) http://localhost/departments.asp?d2/what-doing (Should return <h2>what is department 2 doing?</h2>) I'm not sure if this can be create in one query or if there will need to be a recursive function of some sort. Also, if there is nothing after the last / then assume we want the index page. How can this be accomplished? Thank you.

    Read the article

  • How to use jQuery to generate 2 new associated objects in a nested form?

    - by mind.blank
    I have a model called Pair, which has_many :questions, and each Question has_one :answer. I've been following this railscast on creating nested forms, however I want to generate both a Question field and it's Answer field when clicking on an "Add Question" link. After following the railscast this is what I have: ..javascripts/common.js.coffee: window.remove_fields = (link)-> $(link).closest(".question_remove").remove() window.add_fields = (link, association, content)-> new_id = new Date().getTime() regexp = new RegExp("new_" + association, "g") $(link).before(content.replace(regexp, new_id)) application_helper.rb: def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.simple_fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, "window.add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")", class: "btn btn-inverse") end views/pairs/_form.html.erb: <%= simple_form_for(@pair) do |f| %> <div class="row"> <div class="well span4"> <%= f.input :sys_heading, label: "System Heading", placeholder: "required", input_html: { class: "span4" } %> <%= f.input :heading, label: "User Heading", input_html: { class: "span4" } %> <%= f.input :instructions, as: :text, input_html: { class: "span4 input_text" } %> </div> </div> <%= f.simple_fields_for :questions do |builder| %> <%= render 'question_fields', f: builder %> <% end %> <%= link_to_add_fields "<i class='icon-plus icon-white'></i> Add Another Question".html_safe, f, :questions %> <%= f.button :submit, "Save Pair", class: "btn btn-success" %> <% end %> _question_fields.html.erb partial: <div class="question_remove"> <div class="row"> <div class="well span4"> <%= f.input :text, label: "Question", input_html: { class: "span4" }, placeholder: "your question...?" %> <%= f.simple_fields_for :answer do |builder| %> <%= render 'answer_fields', f: builder %> <% end %> </div> </div> </div> _answer_fields.html.erb partial: <%= f.input :text, label: "Answer", input_html: { class: "span4" }, placeholder: "your answer" %> <%= link_to_function "remove", "remove_fields(this)", class: "float-right" %> I'm especially confused by the reflect_on_association part, for example how does calling .new there create an association? I usually need to use .build Also for a has_one I use .build_answer rather than answers.build - so what does this mean for the jQuery part?

    Read the article

  • Alternative to nesting for loops in Python

    - by davenz
    I've read that one of the key beliefs of Python is that flat nested. However, if I have several variables counting up, what is the alternative to multiple for loops? My code is for counting grid sums and goes as follows: def horizontal(): for x in range(20): for y in range(17): temp = grid[x][y: y + 4] sum = 1 for n in temp: sum += int(n) return sum This seems to me like it is too heavily nested. Firstly, what is considered to many nested loops in Python ( I have certainly seen 2 nested loops before). Secondly, if this is too heavily nested, what is an alternative way to write this code?

    Read the article

  • Access variables between nested JSP tags

    - by user308053
    I would like to exchange information between two nested JSP tagx artifacts. To give an example: list.jspx <myNs:table data="${myTableData}"> <myNs:column property="firstName" label="First Name"/> <myNs:column property="lastName" label="Last Name"/> </myNs:table> Now, the table.tagx is supposed to display the data columns as defined in the nested column tags. The question is how do I get access to the values of the property and label attributes of the nested column tags from the table tag. I tried jsp:directive.variable but that seems only to work to exchange information between a jsp and a tag, but not between nested tags. Note, I would like to avoid using java backing objects for both the table and the column tags at all. I would also like to know how I can access an attribute defined by a parent tag (in this example I would like to access the contents of the data attribute in table.tagx from column.tagx). So it boils down to how can I access variables between nested JSP tags which are purely implemented through the tag definitions themselves (no Java TagHandler implementation desired)?

    Read the article

  • telerik nested grid issue

    - by Jeff
    1.Here I am having a grid within a parent grid and there is a link button within the nested grid. 2.For the link button I need to use the item command event of the nested grid or I can use the item command of parent grid as well. 3.The issue is when I click on the link button within nested grid then item command event doesn’t get fired for the nestedgrid.But in case of parent grid its working fine. 4.I have tried handlers and item created event also to use handlers in code behind or in aspx.But nothing helped in getting me item command event hit for the nested grid. 5.Previously in case of repeaters there was one item command which was handling all the grids. I have tried different item command event for child and parent but it also didn’t work.

    Read the article

  • Nested SELECT clause in SQL Compact 3.5

    - by Sasha
    In this post "select with nested select" I read that SQL Compact 3.5 (SP1) support nested SELECT clause. But my request not work: t1 - table 1 t2 - table 2 c1, c2 = columns select t1.c1, t1.c2, (select count(t2.c1) from t2 where t2.id = t1.id) as count_t from t1 Does SQL Compact 3.5 SP1 support nested SELECT clause in this case? Update: SQL Compact 3.5 SP1 work with this type of nested request: SELECT ... from ... where .. IN (SELECT ...) SELECT ... from (SELECT ...)

    Read the article

  • python: how to convert list of lists into a single nested list

    - by Bhuski
    I have a python list of lists as shown below: mylist=[ [['orphan1', ['some value1']]], [['parent1', ['child1', ['child', ['some value2']]]]], [['parent1', ['child2', ['child', ['some value3']]]]] ] I need to convert the above list to some thing like this: result=[ ['orphan1', ['some value1']], ['parent1', ['child1', ['child', ['some value2']]], ['child2', ['child', ['some value3']]]] ] Kindly help me approach this problem. I have given only simple list. In actual scenario here, in my list, even grand parents/grand childs are there. How much ever deep the input nested list is, I need to convert it to a single nested list, with common list elements (parents and grand parents) appearing only once. (but the next to innermost list element('child' in above example) should appear as many times it occurs in the input list. I have been trying to do this last two days, but did not end up with working solution :(. I need to use the output in django template filter: unordered_list so that the resultant nested list appears as a nested unordered list in my html page ..

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >