Search Results

Search found 5987 results on 240 pages for 'nested sets'.

Page 13/240 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Using a nested group by statement or sub query to filter this result sets

    - by vivid-colours
    This question is a continuation of Changing this query to group rows and filter out all rows apart from the one with smallest value but with an extra bit at the end.... I have the following results set: 275 72.87368055555555555555555555555555555556 foo 70 275 72.87390046296296296296296296296296296296 foo 90 113 77.06431712962962962962962962962962962963 foo 80 113 77.07185185185185185185185185185185185185 foo 60 that I got from this query: SELECT id, (tbl2.date_modified - tbl1.date_submitted)/86400, some_value FROM tbl1, tbl2, tbl3 WHERE tbl1.id = tbl2.fid AND tbl1.id = tbl3.fid Notice there are 4 rows with 2 ids. I wanted to filter the rows to get only the minimum number in the second column. This fixed it: SELECT id, min((tbl2.date_modified - tbl1.date_submitted)/86400), max(some_value) FROM tbl1, tbl2, tbl3 WHERE tbl1.id = tbl2.fid AND tbl1.id = tbl3.fid GROUP BY tbl1.id so I got: 275 72.87368055555555555555555555555555555556 foo 70 113 77.06431712962962962962962962962962962963 foo 80 How can I change it to do the same but not include rows where the are other rows with some_value=90 ? I.e. 113 77.06431712962962962962962962962962962963 foo 80 I think I need some nested group or nested query ?! Many thanks :).

    Read the article

  • nested updatepanels

    - by Elenor
    When I put nested updatepanels in outer updatepanel, then in code, it shows that outer panel is around the code of all nested panels while design mode shows outer updatepanel is drawn like one row on top of page and nested updatepanels are drawn below that outside of outer updatepanel. Is this normal behavior or there is some problem in my implementation?

    Read the article

  • Disable nested sorting in dojo enhancedGrid

    - by JJ
    I'm currently trying to disable the nested sorting, as it does not pass the parameters for the nested sort to the store url (only the first sorted column gets passed over). I tried to set "nestedSorting: false" in the grid setup (programmatically), but the sorting is still being showed in the grid headers. Isn't it possible to disable the nested sort?

    Read the article

  • Best way to implement nested loops in a view in asp.net mvc 2

    - by Junior Ewing
    Hi, Trying to implement some nested loops that are spitting out good old nested html table data. So the question is; What is the best way to loop through lists and nested lists in order to produce easily maintainable code. It can get quite narly quite fast when working with multiple nested tables or lists. Should I make use of a HTML helper, or make something with the ViewModel to simplify this? A requirement is if there are no children at a node there should be an empty row on that spot with some links for creation and into other parts of the system.

    Read the article

  • Nested languages code smell

    - by l0b0
    Many projects combine languages, for example on the web with the ubiquitous SQL + server-side language + markup du jour + JavaScript + CSS mix (often in a single function). Bash and other shell code is mixed with Perl and Python on the server side, evaled and sometimes even passed through sed before execution. Many languages support runtime execution of arbitrary code strings, and in some it seems to be fairly common practice. In addition to advice about security and separation of concerns, what other issues are there with this type of programming, what can be done to minimize it, and is it ever defensible (except in the "PHB on the shoulder" situation)?

    Read the article

  • Nested Entities and calculation on leaf entity property - SQL or NoSQL approach

    - by Chandu
    I am working on a hobby project called Menu/Recipe Management. This is how my entities and their relations look like. A Nutrient has properties Code and Value An Ingredient has a collection of Nutrients A Recipe has a Collection of Ingredients and occasionally can have a collection of other recipes A Meal has a Collection of Recipes and Ingredients A Menu has a Collection of Meals The relations can be depicted as In one of the pages, for a selected menu I need to display the effective nutrients information calculated based on its constituents (Meals, Recipes, Ingredients and the corresponding nutrients). As of now am using SQL Server to store the data and I am navigating the chain from my C# code, starting from each meal of the menu and then aggregating the nutrient values. I think this is not an efficient way as this calculation is being done every time the page is requested and the constituents change occasionally. I was thinking about a having a background service that maintains a table called MenuNutrients ({MenuId, NutrientId, Value}) and will populate/update this table with the effective nutrients when any of the component (Meal, Recipe, Ingredient) changes. I feel that a GraphDB would be a good fit for this requirement, but my exposure to NoSQL is limited. I want to know what are the alternative solutions/approaches to this requirement of displaying the nutrients of a given menu. Hope my description of the scenario is clear.

    Read the article

  • IIS 6 nested virtual directory redirection

    - by threedaysatsea
    We're running IIS 6 on a WinServer2k3 box and we're having some trouble with the following problem: E-mails were sent out to users asking them to go to the following URL: alias.contoso.com/directory2/view.aspx?queryparam1=no&queryparam2=blue However, the URLS are actually supposed to be: server.contoso.com/directory2/view.aspx?queryparam1=no&queryparam2=blue It's too late to recall all of the e-mails, and we'd like to redirect traffic to make this as seamless as possible for our users. The real problem here is that the server (server.contoso.com) is hosting the alias (alias.contoso.com) as a redirect thusly, and the existing redirect we need to keep functional: Default Web Site (server.contoso.com) --Directory1 --Directory2 --Directory3 Redirection to Directory3 (alias.contoso.com) --Essentially alias.contoso.com will take the user to server.contoso.com/Directory3 Is there any way to host a separate redirect inside of the existing redirect? We need to keep alias.contoso.com taking the user to server.contoso.com/Directory3 but also make alias.contoso.com/directory2/view.aspx?queryparam1=no&queryparam2=blue point to server.contoso.com/directory2/view.aspx?queryparam1=no&queryparam2=blue Any tips? Is this even possible?

    Read the article

  • Expected time for lazy evaluation with nested functions?

    - by Matt_JD
    A colleague and I are doing a free R course, although I believe this is a more general lazy evaluation issue, and have found a scenario that we have discussed briefly and I'd like to find out the answer from a wider community. The scenario is as follows (pseudo code): wrapper => function(thing) { print => function() { write(thing) } } v = createThing(1, 2, 3) w = wrapper(v) v = createThing(4, 5, 6) w.print() // Will print 4, 5, 6 thing. v = create(7, 8, 9) w.print() // Will print 4, 5, 6 because "thing" has now been evaluated. Another similar situation is as follows: // Using the same function as above v = createThing(1, 2, 3) v = wrapper(v) w.print() // The wrapper function incestuously includes itself. Now I understand why this happens but where my colleague and I differ is on what should happen. My colleague's view is that this is a bug and the evaluation of the passed in argument should be forced at the point it is passed in so that the returned "w" function is fixed. My view is that I would prefer his option myself, but that I realise that the situation we are encountering is down to lazy evaluation and this is just how it works and is more a quirk than a bug. I am not actually sure of what would be expected, hence the reason I am asking this question. I think that function comments could express what will happen, or leave it to be very lazy, and if the coder using the function wants the argument evaluated then they can force it before passing it in. So, when working with lazy evaulation, what is the practice for the time to evaluate an argument passed, and stored, inside a function?

    Read the article

  • libgdx - #iterator() cannot be used nested

    - by TimSim
    I'm getting this error when I try to check if any of the targets overlap each other: iterTargets = targets.iterator(); while (iterTargets.hasNext()) { Target target = iterTargets.next(); for (Target otherTarget:targets) { if (target.rectangle.overlaps(otherTarget.rectangle)) { // do something } } } So I can't do that? How am I supposed to check each member of an array to see if it overlaps any other member?

    Read the article

  • Matlab - plot multiple data sets on a scatter plot

    - by Mark
    Hey all, I have 2 sets of data (Ax, Ay; Bx, By) - I'd like to plot both of these data sets on a scatter plot with different colors, but can't seem to get it to work because it seems scatter() does not work like plot(). Is it possible to do this? I've tried... scatter(Ax, Ay, 'g', Bx, By, 'b') And scatter(Ax, Ay, 'g') scatter(Bx, By, 'b') The first way returns an error. The latter only plots the Bx/By data. Many thanks!

    Read the article

  • HTML/CSS - How can I position these nested unordered lists correctly?

    - by Samuroid
    I am looking for some help resolving an issue im having with positioning the following unordered list elements that are contained in a div which has relative positioning: The html structure of the UL: <div id="accountBox" class="account_settings_box"> <ul> <ul> <li class="profileImage"><img src="images/profileimage.jpg" alt="Profile Image" /></li> <li class="profileName">Your name</li> <li class="profileEmail">Your email</li> </ul> <li><a href="">Messages</a></li> <li><a href="">Settings</a></li> <li><a href="">Password</a></li> <li><a href="">Sign out</a></li> </ul> </div> and the CSS for this list: .account_settings_box ul ul { display: inline-block; margin: 0; padding: 0; width: 100%; height: 150px; outline: 1px solid blue; } .account_settings_box ul ul li { display: inline-block; border: none; /* Reset the border */ } .profileImage { float: right; display: block; width: 150px; height: 150px; outline: 1px solid purple; } .profileName, .profileEmail { width: auto; height: auto; width: 150px; height: 150px; } .account_settings_box ul ul li:hover { outline: 1px solid red; } .profileImage img { width: 150px; height: 150px; } I am having difficultly with the embedded ul, i.e, .account_settings_box ul ul element. The image below shows what it currently looks like. I am trying to achieve the follow: Have the image floating to the right, and have the "your name" and "your email" positioned to the left of the image (basically where they are currently). Thanks for your help in advance. Sam :)

    Read the article

  • Can nested attributes be used in combination with inheritance?

    - by FoxDemon
    I have the following classes: Project Person Person Developer Person Manager In the Project model I have added the following statements: has_and_belongs_to_many :people accepts_nested_attributes_for :people And of course the appropriate statements in the class Person. How can I add an Developer to a Project through the nested_attributes method? The following does not work: @p.people_attributes = [{:name => "Epic Beard Man", :type => "Developer"}] @p.people => [#<Person id: nil, name: "Epic Beard Man", type: nil>] As you can see the type attributes is set to nil instead of Developer.

    Read the article

  • Custom iterator for a class based on two sets

    - by Dan Hook
    I have a class that contains two sets. They both contain the same key type but have different compare operations. I would like to provide an iterator for the class that iterates through the elements of both sets. I want to start with one set, then when I increment an iterator pointing to the last element of the first set, I want to go to the first element of the second set. How do I do this? I would like to preserve the bidirectional iterator semantics of std::set, but if it turns out that implementing a forward iterator is much easier, so be it. I'm willing to use the Boost Iterator library if that would help.

    Read the article

  • In PHP... best way to turn string representation of a folder structure into nested array

    - by Greg Frommer
    Hi everyone, I looked through the related questions for a similar question but I wasn't seeing quite what I need, pardon if this has already been answered already. In my database I have a list of records that I want represented to the user as files inside of a folder structure. So for each record I have a VARCHAR column called "FolderStructure" that I want to identify that records place in to the folder structure. The series of those flat FolderStructure string columns will create my tree structure with the folders being seperated by backslashes (naturally). I didn't want to add another table just to represent a folder structure... The 'file' name is stored in a separate column so that if the FolderStructure column is empty, the file is assumed to be at the root folder. What is the best way to turn a collection of these records into a series of HTML UL/LI tags... where each LI represents a file and each folder structure being an UL embedded inside it's parent?? So for example: file - folderStructure foo - bar - firstDir blue - firstDir/subdir would produce the following HTML: <ul> <li>foo</li> <ul> <li> bar </li> <ul> <li> blue </li> </ul> </ul> </ul> Thanks

    Read the article

  • MySQL query cache vs caching result-sets in the application layer

    - by GetFree
    I'm running a php/mysql-driven website with a lot of visits and I'm considering the possibility of caching result-sets in shared memory in order to reduce database load. However, right now MySQL's query cache is enabled and it seems to be doing a pretty good job since if I disable query caching, the use of CPU jumps to 100% immediately. Given that situation, I dont know if caching result-sets (or even the generated HTML code) locally in shared memory with PHP will result in any noticeable performace improvement. Does anyone out there have any experience on this matter? PS: Please avoid suggesting heavy-artillery solutions like memcached. Right now I'm looking for simple solutions that dont require too much time to implement, deploy and maintain.

    Read the article

  • Changing the innerHTML of elements in a nested div tag..

    - by PoorCoder
    -- Representative code only - I need to know how to change the innerhtml of the tablerow -- <html> <head> <script> //full javascript declaration - function call after page loads.. function () { document.getElementById('tr1').innerHTML='<td>Test</td>'; // does not work.. document.getElementByTagNames('tr')[0].innerHTML='<td>Test</td>'; // does not work.. document.getElementById('div2').getElementsByTagNames('tr')[0].innerHTML='<td>Test</td>'; //does not work.. document.getElementById('div1').div2.tr1.innerHTML='<td>Test</td>'; //nope } </script> </head> <body> <div id='div1'> <div id='div2'> <table> <tr id='tr1'></tr> </table> </div> </div> </body> </html> Thanks for the help

    Read the article

  • How do you store sets in Cassandra?

    - by Ben W
    I'd like to convert this JSON to a data model in Cassandra, where each of the arrays is a set with no duplicates: var data = { "data1": { "100": [1, 2, 3], "200": [3, 4] }, "data2": { "k1", [1], "k2", [4, 5] } } I'd like to query like this: data["data1"]["100"] to retrieve the sets. Anyone know how you might model this in Cassandra? (The only thing I came up with was columns whose name was a set value and the value of the column was an empty string, but that felt wrong.) It's not OK to serialize the sets as JSON or some other string, which would make this much easier. Also, I should note that it's OK to split data1 and data2 into separate ColumnFamilies, it's not necessary that they're keys in the same one.

    Read the article

  • How do I make this nested for loop, testing sums of cubes, more efficient?

    - by Brian J. Fink
    I'm trying to iterate through all the combinations of pairs of positive long integers in Java and testing the sum of their cubes to discover if it's a Fibonacci number. I'm currently doing this by using the value of the outer loop variable as the inner loop's upper limit, with the effect being that the outer loop runs a little slower each time. Initially it appeared to run very quickly--I was up to 10 digits within minutes. But now after 2 full days of continuous execution, I'm only somewhere in the middle range of 15 digits. At this rate it may end up taking a whole year just to finish running this program. The code for the program is below: import java.lang.*; import java.math.*; public class FindFib { public static void main(String args[]) { long uLimit=9223372036854775807L; //long maximum value BigDecimal PHI=new BigDecimal(1D+Math.sqrt(5D)/2D); //Golden Ratio for(long a=1;a<=uLimit;a++) //Outer Loop, 1 to maximum for(long b=1;b<=a;b++) //Inner Loop, 1 to current outer { //Cube the numbers and add BigDecimal c=BigDecimal.valueOf(a).pow(3).add(BigDecimal.valueOf(b).pow(3)); System.out.print(c+" "); //Output result //Upper and lower limits of interval for Mobius test: [c*PHI-1/c,c*PHI+1/c] BigDecimal d=c.multiply(PHI).subtract(BigDecimal.ONE.divide(c,BigDecimal.ROUND_HALF_UP)), e=c.multiply(PHI).add(BigDecimal.ONE.divide(c,BigDecimal.ROUND_HALF_UP)); //Mobius test: if integer in interval (floor values unequal) Fibonacci number! if (d.toBigInteger().compareTo(e.toBigInteger())!=0) System.out.println(); //Line feed else System.out.print("\r"); //Carriage return instead } //Display final message System.out.println("\rDone. "); } } Now the use of BigDecimal and BigInteger was delibrate; I need them to get the necessary precision. Is there anything other than my variable types that I could change to gain better efficiency?

    Read the article

  • Need help on nested loop of queries in php and mysql?

    - by mysqllearner
    Hi, I am trying to get do this: <?php $good_customer = 0; $q = mysql_query("SELECT user FROM users WHERE activated = '1'"); // this gives me about 40k users while($r = mysql_fetch_assoc($q)){ $money_spent = 0; $user = $r['user']; // Do queries on another 20 tables for($i = 1; $i<=20 ; $i++){ $tbl_name = 'data' . $i; $q2 = mysql_query("SELECT money_spent FROM $tbl_name WHERE user = '{$user}'"); while($r2 = mysql_fetch_assoc($q2)){ $money_spend += $r2['money_spent']; } if($money_spend > 1000000){ $good_customer += 1; } } } This is just an example. I am testing on localhost, for single user, it returns very fast. But when I try 1000, it takes forever, not even mentioned 40k users. Anyway to optimise/improve this code? EDIT: By the way, each of the others 20 tables has ~20 - 40k records

    Read the article

  • jQuery AJAX & Multiple sp Result Sets

    - by Kevin
    Is it possible to use a stored procedure that returns multiple result sets in json format and process them as part of one request using ajax calls in jquery? In other words, I have a stored procedure that returns several result sets that are to be used with a series of select boxes that are all being filtered by the same criteria. If any of the select boxes is chosen that value is then passed to the stored procedure and all the subsequent select box updates reflect only results that match the filtered criteria. I don't want to have to call the same sp multiple times to process the results and was trying not to create multiple queries, so I'm wondering if it's possible to store more than one json result in a single request and then store and process them on the client side.

    Read the article

  • Can I write functors using a private nested struct?

    - by Kristo
    Given this class: class C { private: struct Foo { int key1, key2, value; }; std::vector<Foo> fooList; }; The idea here is that fooList can be indexed by either key1 or key2 of the Foo struct. I'm trying to write functors to pass to std::find so I can look up items in fooList by each key. But I can't get them to compile because Foo is private within the class (it's not part of C's interface). Is there a way to do this without exposing Foo to the rest of the world? (note: I've got to run to a meeting. I'll be able to post more sample code in about a half hour.)

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >