Search Results

Search found 7007 results on 281 pages for 'nested lists'.

Page 16/281 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • 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

  • 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

  • Does anybody have any tips for managing polymorphic nested resources in Rails 3?

    - by Ryan
    in config/routes.rb: resources posts do resources comments end resources pictures do resources comments end I would like to allow for more things to be commented on as well. I'm currently using mongoid (mongomapper isn't as compatible with rails3 yet as I would like), and comments are an embedded resource (mongoid can't yet handle polymorphic relational resources), which means that I do need the parent resource in order to find the comment. Are there any elegant ways to handle some of the following problems: in my controller, I need to find the parent before finding the comment. if params[:post_id] parent = Post.find(params[:post_id] else if params[:picture_id] parent = Picture.find(params[:picture_id] end which is going to get messy if I start adding more things to be commentable also url_for([comment.parent,comment]) doesn't work, so I'm going to have to define something in my Comment model, but I think I'm also going to need to define an index route in the Comment model as well as potentially an edit and new route definition. There might be more issues that I have to deal with as I get further. I can't imagine I'm the first person to try and solve this problem, are there any solutions out there to make this more manageable?

    Read the article

  • Custom Validation - Dependent Drop Down Lists

    - by Holysmoke
    Hi, I've two columns in a sheet that are interdependent and I want to use validation, drop-down lists, on both as follows: Column A (TYPE) | Column B (Sub-TYPE) ------------------------------------------| TypeA, TypeB | If TypeA SubTypeA1, | ... TypeN | SubTypeA2 ... SubTypeAN | ------------------------------------------| Creating the column A drop down is trivial. How do I create the Column B drop down, that in turn depends on what was chosen in Column A? TIA

    Read the article

  • Rails show view of one model with form for adding one child - nested attributes vs seperate controll

    - by SWR
    I have a basic two tiered model structure: Articles - Comments with one Article having many comments. What is the best way to add a "Add a comment" form to the bottom of the Articles show page? nested_attributes is overkill as I don't want to be able to edit all of the comments on the page, just to add one more. Is the best way even with Rails 2.3 still to make a separate controller and embed a form_for pointing to the other controller into the Articles show view? If so, how do I get validation errors to return to the article display page? I don't want to make a separate comment page/view... thanks

    Read the article

  • Moving distribution lists in Public Folders to Sharepoint Contacts?

    - by Mike
    Now I know that if I connect to contact list in Sharepoint and drag and drop everything from the Exchange Public Folder contact list to the Sharepoint Contact list (connected through Outlook) it will transfer everything in the contact list to the sharepoint contact list. What about distribution lists? Has anyone had a workaround for this? If a contact list is full of distribution lists the Contacts won't migrate over and the Sync Issues - Local Failures folder is populated with all the distribution lists that couldn't be migrated. Is there a way to migrate distribution lists? Any ideas how to set up the contact list like a contact list of distrubition lists? How would that contact list look on sharepoint? Should I just leave the contact lists that have distribution lists on public folders?

    Read the article

  • Moving distribution lists in Public Folders to Sharepoint Contacts?

    - by Mike
    Now I know that if I connect to contact list in Sharepoint and drag and drop everything from the Exchange Public Folder contact list to the Sharepoint Contact list (connected through Outlook) it will transfer everything in the contact list to the sharepoint contact list. What about distribution lists? Has anyone had a workaround for this? If a contact list is full of distribution lists the Contacts won't migrate over and the Sync Issues - Local Failures folder is populated with all the distribution lists that couldn't be migrated. Is there a way to migrate distribution lists? Any ideas how to set up the sharepoint contact list like a public folder contact list of distrubition lists? How would that contact list look on sharepoint? Should I just leave the contact lists that have distribution lists on public folders?

    Read the article

  • "Delivered-To" Header in Exchange

    - by Kaii
    In some SMTP server implementations (i.e. Postfix) you can enable Delivered-To and X-Original-To headers that will be added to your email. (or [X-]Envelope-To) This is very helpful with distribution lists to determine which e-mail address the mail has been redirected to. So, when the mail has been sent to [email protected], you can see in the Delivered-To or Envelope-To header that it has been redirected (distributed) to [email protected], which is one of many other e-mail addresses that are linked to a single mailbox. How do I find which address was used to deliver this mail to a specific mailbox on Microsoft Exchange 2010? Looking at the plain message (with all headers) i can not find any information that the mail arrived via address [email protected] I think I need the Delivered-To header (or a similar one) to be set on Microsoft Exchange when a mail is delivered via distribution lists. Is there any way to enable such header in Exchange 2010? I need it so that our Ticket system (OTRS) correctly recognizes where the ticket belongs to. Adding all the e-mail addresses of all distribution lists to the system configuration is not the right solution. And if there is a solution for Exchange 2010, is this possibly also applicable to Exchange 2007?

    Read the article

  • Java Compare Two Lists

    - by agazerboy
    Hi All, Thanks for stoping to help me :) I have a question, may be for some of you, it will be a basic question :) I have two lists ( not java lists, you can say two columns) For example **List 1** **Lists 2** milan hafil dingo iga elpha binga hafil mike meat dingo iga neeta.peeta What I want ! I want that it returns me that how many elements are same. For this example it should be 3 and it should return me similar values of both list and different values too. Should I use hashmap if yes then what method to get my result? Please help P.S: It is not a school assignment :) So if you just guide me it will be enough

    Read the article

  • Building big, immutable objects without constructors having long parameter lists

    - by Malax
    Hi StackOverflow! I have some big (more than 3 fields) Objects which can and should be immutable. Every time I run into that case i tend to create constructor abominations with long parameter lists. It doesn't feel right, is hard to use and readability suffers. It is even worse if the fields are some sort of collection type like lists. A simple addSibling(S s) would ease the object creation so much but renders the object mutable. What do you guys use in such cases? I'm on Scala and Java, but i think the problem is language agnostic as long as the language is object oriented. Solutions I can think of: "Constructor abominations with long parameter lists" The Builder Pattern Thanks for your input!

    Read the article

  • How are lists implemented in Haskell (GHC)?

    - by eman
    I was just curious about some exact implementation details of lists in Haskell (GHC-specific answers are fine)--are they naive linked lists, or do they have any special optimizations? More specifically: Do length and (!!) (for instance) have to iterate through the list? If so, are their values cached in any way (i.e., if I call length twice, will it have to iterate both times)? Does access to the back of the list involve iterating through the whole list? Are infinite lists and list comprehensions memoized? (i.e., for fib = 1:1:zipWith (+) fib (tail fib), will each value be computed recursively, or will it rely on the previous computed value?) Any other interesting implementation details would be much appreciated. Thanks in advance!

    Read the article

  • Building big, immutable objects without using constructors having long parameter lists

    - by Malax
    Hi StackOverflow! I have some big (more than 3 fields) Objects which can and should be immutable. Every time I run into that case i tend to create constructor abominations with long parameter lists. It doesn't feel right, is hard to use and readability suffers. It is even worse if the fields are some sort of collection type like lists. A simple addSibling(S s) would ease the object creation so much but renders the object mutable. What do you guys use in such cases? I'm on Scala and Java, but i think the problem is language agnostic as long as the language is object oriented. Solutions I can think of: "Constructor abominations with long parameter lists" The Builder Pattern Thanks for your input!

    Read the article

  • How to solve this problem with lists?

    - by osabri
    what i don't understand in my task here what kind of list i can use, and if it should have 2 attributes key and value ? or only value? with pointers to another node ofc the task: "design a function which create a list using input from the keyboard _ the prefered solution. Assume that some magic stops the input; so the length of a list is not known in advance.(alternative solution: a function which creates explicitly a fixed list. However, all other function can not assume any knowledge about the length of lists). Necessary utilities( additional functions to be created): a function which deallocates the memory used for lists and a function which prints the content of the list. let the element of lists contain a letter. Design a function which create a copy of such list. can't also understand the list line !!!!!???

    Read the article

  • Where are graphically pleasing examples of Lists

    - by slim
    Anyone know of good code examples of how to make lists look different than your everyday average black list or more graphically pleasing than you usually see in android apps. I've looked through google code but haven't found too many. I'm looking for different and eye catching lists. I hope this question isn't too generic. Also i'm open to anything, code, examples, blog posts, etc, you name it. I've really struggled with lists and making them look more snazzy. I'm talking more the code level not the graphics or icons used.

    Read the article

  • How should I synchronize lists in WCF?

    - by mafutrct
    I've got a WCF service that offers multiple lists of items of different types. The lists can be changed on the server. Every change has to be published to all clients to make sure every client has an up-to-date copy of each server list. Currently I'm using this strategy: On login, every client receives the current status of every list. On every change, the added or removed item is sent to all clients. The drawback is that I have to create a callback for every list, since the items are of different types. Is there a pattern I could apply? Or do I really have to duplicate code for each of the lists?

    Read the article

  • Join data from two Lists into one object

    - by Petr Mensik
    I ran into following situation and I am wondering about best solution. Let's say I have List<Object1> and List<Object2>, these lists are result of two separated queries. Both of them have the same size and there is relationship 1:1 between elements in the lists based on ID. I know that best solution would be fetching data in one DB query but that's possible right now. So my question is, what is the best way to join these lists into let's say List<Object3>?

    Read the article

  • Dynamic group membership to work around no nested security group support for Active Directory

    - by Bernie White
    My problem is that I have a number of network administration applications like SAN switches that do not support nested groups from Active Directory Domain Services (AD DS). These legacy administration applications use either LDAP or LDAPS. I am fairly sure I can use Active Directory Lightweight Directory Services (AD LDS) and possibly Windows Authorization Manager to work around this issue; however I am not really sure where to start. I want to end up with: A single group that can be queried over LDAP/LDAPS for all it’s direct members LDAP proxy for user name and password credentials to AD DS Easy way to admin the group, ideally the group would aggregate the nested membership in AD DS. a native solution using freely available components from the Windows stack. If you have any suggestions or solutions that you have previously used to solve this issue please let me know.

    Read the article

  • gnu screen - mouse does not work in nested screen session

    - by Matthew
    I started a screen session inside another screen session, both on my local machine. This is using cygwin, but I don't think it matters. I have tried via ssh to a real unix machine but the behaviour is the same. Mouse works great in the first screen session, I'm able to open vim with :set mouse=a and I can click to move the cursor or switch tabs, and the mouse wheel scrolls. But in the nested session it does not work, mouse is only useful for selecting terminal text that gets put in the clipboard, but is not able to interact with vim. I want this to work because I usually work with a local screen session, then ssh to a remote server and have a remote screen session running too (hence the nesting) and I like to scroll swiftly in vim by using the mouse wheel. Can anyone tell me why the mouse works in the first layer of screen but not in the second, nested screen session, and how I can make it work? Thanks in advance, Matthew

    Read the article

  • Word 2010 Style Sets and Multilevel Lists

    - by Stevia
    In Word 2010, how can you create quick style sets that include multilevel lists (include being the operative word)? As background, I have created a set of styles for a long agreement form and assigned them to levels in a certain custom multilevel list. I then also saved those styles as a quick style set called Long Agreement. I have saved those styles in my normal template. That all works fine for assigning styles to a Long Agreement. What I'd like to do next is create a second style set called Short Agreement. I will assign certain styles to that style set. The issue is that I don't see how to tie a different custom multilevel list to those Short Agreement styles. When I click on Change Styles, Short Agreement [style set], and I apply those styles, how can I get it to automatically use the multilevel list that I assign to short agreements?

    Read the article

  • Word 2010 Style Sets and Multilevel Lists

    - by Stevia
    In Word 2010, how can you create quick style sets that include multilevel lists (include being the operative word)? As background, I have created a set of styles for a long agreement form and assigned them to levels in a certain custom multilevel list. I then also saved those styles as a quick style set called Long Agreement. I have saved those styles in my normal template. That all works fine for assigning styles to a Long Agreement. What I'd like to do next is create a second style set called Short Agreement. I will assign certain styles to that style set. The issue is that I don't see how to tie a different custom multilevel list to those Short Agreement styles. When I click on Change Styles, Short Agreement [style set], and I apply those styles, how can I get it to automatically use the multilevel list that I assign to short agreements?

    Read the article

  • Vector addition of lists

    - by ntimes
    If I had a N lists each of length M, how could I write a nice clean function to return a single list of length M, where each element is the sum of the corresponding elements in the N lists? (starting to learn lisp - go easy!)

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >