Search Results

Search found 4616 results on 185 pages for 'lists'.

Page 20/185 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Python - alternative to list.remove(x)?

    - by Seafoid
    Hi, I wish to compare two lists. Generally this is not a problem as I usually use a nested for loop and append the intersection to a new list. In this case, I need to delete the intersection of A and B from A. A = [['ab', 'cd', 'ef', '0', '567'], ['ghy5'], ['pop', 'eye']] B = [['ab'], ['hi'], ['op'], ['ej']] My objective is to compare A and B and delete A intersection B from A, i.e., delete A[0][0] in this case. I tried: def match(): for i in A: for j in i: for k in B: for v in k: if j == v: A.remove(j) list.remove(x) throws a ValueError.

    Read the article

  • How do I export Outlook 2003 distribution lists to Gmail?

    - by Nick T
    I have several distribution lists in Outlook 2003 that I need to move to Gmail. While transferring contacts in the main folder is fairly easy—all one does is export to CSV and import—it's not as easy with the distribution lists. I can't (don't know how to) copy the contacts from the lists to the main contact folder so they can be "normal", and the "save as" options don't include a CSV. There are several of these to do, containing maybe ~100-200 contacts altogether, so I'd like something that's not very tedious.

    Read the article

  • Utility of List<T>.Sort() versus List<T>.OrderBy() for a member of a custom container class

    - by ccomet
    I've found myself running back through some old 3.5 framework legacy code, and found some points where there are a whole bunch of lists and dictionaries that must be updated in a synchronized fashion. I've determined that I can make this process infinitely easier to both utilize and understand by converging these into custom container classes of new custom classes. There are some points, however, where I came to concerns with organizing the contents of these new container classes by a specific inner property. For example, sorting by the ID number property of one class. As the container classes are primarily based around a generic List object, my first instinct was to write the inner classes with IComparable, and write the CompareTo method that compares the properties. This way, I can just call items.Sort() when I want to invoke the sorting. However, I've been thinking instead about using items = items.OrderBy(Func) instead. This way it is more flexible if I need to sort by any other property. Readability is better as well, since the property used for sorting will be listed in-line with the sort call rather than having to look up the IComparable code. The overall implementation feels cleaner as a result. I don't care for premature or micro optimization, but I like consistency. I find it best to stick with one kind of implementation for as many cases as it is appropriate, and use different implementations where it is necessary. Is it worth it to convert my code to use the LINQ OrderBy instead of using List.Sort? Is it a better practice to stick with the IComparable implementation for these custom containers? Are there any significant mechanical advantages offered by either path that I should be weighing the decision on? Or is their end-functionality equivalent to the point that it just becomes coder's preference?

    Read the article

  • How to generate lots of redundant ajax elements like checkboxes and pulldowns in Django?

    - by iJames
    Hello folks. I've been getting lots of answers from stackoverflow now that I'm in Django just be searching. Now I hope my question will also create some value for everybody. In choosing Django, I was hoping there was some similar mechanism to the way you can do partials in ROR. This was going to help me in two ways. One was in generating repeating indexed forms or form elements, and also in rendering only a piece of the page on the round trip. I've done a little bit of that by using taconite with a simple URL click but now I'm trying to get more advanced. This will focus on the form issue which boils down to how to iterate over a secondary object. If I have a list of photo instances, each of which has a couple of parameters, let's say a size and a quantity. I want to generate form elements for each photo instance separately. But then I have two lists I want to iterate on at the same time. Context: photos : Photo.objects.all() and forms = {} for photo in photos: forms[photo.id] = PhotoForm() In other words we've got a list of photo objects and a dict of forms based on the photo.id. Here's an abstraction of the template: {% for photo in photos %} {% include "photoview.html" %} {% comment %} So here I want to use the photo.id as an index to get the correct form. So that each photo has its own form. I would want to have a different action and each form field would be unique. Is that possible? How can I iterate on that? Thanks! {% endcomment %} Quantity: {{ oi.quantity }} {{ form.quantity }} Dimensions: {{ oi.size }} {{ form.size }} {% endfor %} What can I do about this simple case. And how can I make it where every control is automatically updating the server instead of using a form at all? Thanks! James

    Read the article

  • Removing empty space with jQuery after deleting Selectable item

    - by Tx3
    I have two ordered lists and user can move items between them. I am using jQuery UI's Selectable for both of them. Problem is that when I move item from the middle of the list it leaves an empty space behind. How can I make list shrink according to the how many items is actually in the list? HTML <ol id="allUnits"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> </ol> <input id="arrowRight" type="image" alt="Move item to right" src="<%= Url.Content("~/Content/Images/arrowRight.png")%>" /> <input id="arrowLeft" type="image" alt="Move item to left" src="<%= Url.Content("~/Content/Images/arrowLeft.png")%>" /> <ol id="productUnits"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> </ol> jQuery $().ready(function () { $("#allUnits").selectable(); $("#productUnits").selectable(); $('#arrowRight').click(function () { return !$('#allUnits .ui-selected').remove().appendTo('#productUnits').removeClass(".ui-selected"); }); $('#arrowLeft').click(function () { return !$('#productUnits .ui-selected').remove().appendTo('#allUnits').removeClass(".ui-selected"); }); });

    Read the article

  • O(log n) algorithm for computing rank of union of two sorted lists?

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • O(log n) algorithm to find the element having rank i in union of pre-sorted lists

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • O(log n) algorithm for merging lists and computing rank?

    - by Eternal Learner
    Given two sorted lists, each containing n real numbers, is there a O(log?n) time algorithm to compute the element of rank i (where i coresponds to index in increasing order) in the union of the two lists, assuming the elements of the two lists are distinct? I can think of using a Merge procedure to merge the 2 lists and then find the A[i] element in constant time. But the Merge would take O(n) time. How do we solve it in O(log n) time?

    Read the article

  • Implementing Skip List in C++

    - by trikker
    [SOLVED] So I decided to try and create a sorted doubly linked skip list... I'm pretty sure I have a good grasp of how it works. When you insert x the program searches the base list for the appropriate place to put x (since it is sorted), (conceptually) flips a coin, and if the "coin" lands on a then that element is added to the list above it(or a new list is created with element in it), linked to the element below it, and the coin is flipped again, etc. If the "coin" lands on b at anytime then the insertion is over. You must also have a -infinite stored in every list as the starting point so that it isn't possible to insert a value that is less than the starting point (meaning that it could never be found.) To search for x, you start at the "top-left" (highest list lowest value) and "move right" to the next element. If the value is less than x than you continue to the next element, etc. until you have "gone too far" and the value is greater than x. In this case you go back to the last element and move down a level, continuing this chain until you either find x or x is never found. To delete x you simply search x and delete it every time it comes up in the lists. For now, I'm simply going to make a skip list that stores numbers. I don't think there is anything in the STL that can assist me, so I will need to create a class List that holds an integer value and has member functions, search, delete, and insert. The problem I'm having is dealing with links. I'm pretty sure I could create a class to handle the "horizontal" links with a pointer to the previous element and the element in front, but I'm not sure how to deal with the "vertical" links (point to corresponding element in other list?) If any of my logic is flawed please tell me, but my main questions are: How to deal with vertical links and whether my link idea is correct Now that I read my class List idea I'm thinking that a List should hold a vector of integers rather than a single integer. In fact I'm pretty positive, but would just like some validation. I'm assuming the coin flip would simply call int function where rand()%2 returns a value of 0 or 1 and if it's 0 then a the value "levels up" and if it's 0 then the insert is over. Is this incorrect? How to store a value similar to -infinite? Edit: I've started writing some code and am considering how to handle the List constructor....I'm guessing that on its construction, the "-infinite" value should be stored in the vectorname[0] element and I can just call insert on it after its creation to put the x in the appropriate place.

    Read the article

  • How can I generate a list of words made up of combinations of three word lists in Perl?

    - by Chris Denman
    I have three lists of words. I would like to generate a single list of all the combinations of words from the three lists. List 1: red green blue List 2: one two List 3: apple banana The final list would like like so: red one apple red two apple red one banana red two banana ... and so on Ideally I'd like to pass in three arrays and the routine return one array. I have done a simple loop like so: foreach $word1 (@list1){ foreach $word2 (@list2){ foreach $word3 (@list3){ print "$word1 $word2 $word3\n"; } } } However, this doesn't work if there's nothing in the second or third list (I may only want to iterate between one, two or three lists at a time - in other words, if I only supply two lists it should iterate between those two lists).

    Read the article

  • Missing Package: header, Problem with MergeList, The package lists or status file could not be parsed or opened

    - by Inbar Rose
    THIS IS NOT A DUPLICATE OF SIMILAR QUESTIONS (like this) I just had to write that first, there are tons of questions similar to this, all of them have the same redirect to an answer that does not solve my problem, because I don't have the same problem, just the same symptom. I write tests for my companies application. One of these tests tries to upgrade the application from a previous version to a new version to make sure nothing breaks. When I am installing an old version of the application, some weird stuff starts to happen. Sometimes everything goes Okay, and nothing is wrong, other times when trying to install I get this message (company app name censored): E: Encountered a section with no Package: header E: Problem with MergeList /var/lib/apt/lists/XXX-amd64_Packages E: The package lists or status file could not be parsed or opened. Using the solutions provided in the questions similar to this one (like this). Do not help, and the problem keeps repeating itself once it happens the first time. This has led me to believe something is wrong on the apt server where the package is being created, but searching these errors yields no information on anything beyond the "fix" suggested in the question I linked, the only other source of information I could find also did not help (here): So I am asking for information; What is the actual problem? What causes the problem? What can fix the problem? I hope this question is in good format, if there is a problem, or missing information I can move to chat.

    Read the article

  • Trying to make a game with C++, using lists to store bullets and enemies, but they are not erased

    - by XD_dued
    I've been trying to make a pretty simple space shooter game with C++, and I have been having a lot of trouble trying to use lists to store enemies and bullets. Basically I followed the post here almost exactly to store my bullets: SDL Bullet Movement I've done something similar to store my enemies. However, when I call bullets.erase(it++), for some reason the bullet is not erased. When the bullet movement is run for the next frame, it tries to re delete the bullet and segfaults the program. When I comment out the erase line, it runs fine, but the bullets are then never erased from the list... Is there any reason why the elements of the list aren't being deleted? I also set it up to print the number of elements in the list for every iteration, and it does not go down after deleting. Thanks! EDIT: Here's the specific code I'm using to store my enemies and having them act: std::list<Grunt*> doGrunts(std::list<Grunt*> grunts) { for(std::list<Grunt*>::iterator it = grunts.begin(); it != grunts.end();) { if((*it)->getHull() == 0) { delete * it; grunts.erase(it++); } else { (**it).doUnit(grunts, it); ++it; } } } Grunt is my enemy class, and the list grunts is a global variable. Is that my problem? When I pass the global into the function it becomes local? I assumed lists would be a reference type so thought this wouldn't be a problem. Sorry if this was a dumb question, I'm very new to C++, this is the first major thing I'm working on.

    Read the article

  • jquery nested sortable list

    - by Y.G.J
    i have this code $(document).ready(function() { $("#test-list").sortable({ items: "> li", handle : '.handle', axis: 'y', opacity: 0.6, update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); $("#test-sub").sortable({ containment: "ul", items: "li", handle : '.handle', axis: 'y', opacity: 0.6, update : function () { var order = $('#test-list').sortable('serialize'); $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats"); } }); }); for this kind of UL <ul id="test-list"> <li></li> <li> <ul id="test-sub"> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </li> <li></li> <li></li> <li></li> <li></li> </ul> but it can be changed dynamiclly... when i drag and drop the main li it is working when i do it with the childs it will drag the main one what is wrong?

    Read the article

  • MOSS query the SiteUserInfoList list

    - by nav
    Hi, I want to know how I can connect to the SiteUserInfoList using U2U CAML Builder tool, I know I can do it in code. But want to be able to quickly query it through the tool so I can bring back the values it holds. Many Thanks, Nav

    Read the article

  • Sharepoint list fields stored in content database?

    - by nav
    Hi, I am trying to find out where data for Sharepoint list fields are stored in the content database. For example from the AllLists table filtering on the listid i am intrested in I can derive the following from the tp_ContentTypes column on the field I'm interested in: <Field Type="CascadingDropDownListFieldWithFilter" DisplayName="Secondary Subject" Required="FALSE" ID="{b4143ff9-d5a4-468f-8793-7bb2f06b02a0}" SourceID="{6c1e9bbf-4f02-49fd-8e6c-87dd9f26158a}" StaticName="Secondary_x0020_Subject" Name="Secondary_x0020_Subject" ColName="nvarchar13" RowOrdinal="0" Version="1"><Customization><ArrayOfProperty><Property><Name>SiteUrl</Name><Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">http://lvis.amberlnk.net/knowhow</Value></Property><Property><Name>CddlName</Name><Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">SS</Value></Property><Property><Name>CddlParentName</Name><Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">PS</Value></Property><Property><Name>CddlChildName</Name><Value xmlns:q4="http://www.w3.org/2001/XMLSchema" p4:type="q4:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"/></Property><Property><Name>ListName</Name><Value xmlns:q5="http://www.w3.org/2001/XMLSchema" p4:type="q5:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Secondary</Value></Property><Property><Name>ListTextField</Name><Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Title</Value></Property><Property><Name>ListValueField</Name><Value xmlns:q7="http://www.w3.org/2001/XMLSchema" p4:type="q7:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Title</Value></Property><Property><Name>JoinField</Name><Value xmlns:q8="http://www.w3.org/2001/XMLSchema" p4:type="q8:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Primary</Value></Property><Property><Name>FilterField</Name><Value xmlns:q9="http://www.w3.org/2001/XMLSchema" p4:type="q9:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Content Type ID</Value></Property><Property><Name>FilterOperator</Name><Value xmlns:q10="http://www.w3.org/2001/XMLSchema" p4:type="q10:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Show All</Value></Property><Property><Name>FilterValue</Name><Value xmlns:q11="http://www.w3.org/2001/XMLSchema" p4:type="q11:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"/></Property></ArrayOfProperty></Customization></Field> Which table do I need to query to find the data held on this field? Many Thanks Nav

    Read the article

  • Scheme: Detecting duplicate elements in a list

    - by Kyle Krull
    Does R6RS or Chez Scheme v7.9.4 have a library function to check if a list contains duplicate elements? Alternatively, do either have any built in functionality for sets (which dis-allow duplicate elements)? So far, I've only been able to find an example here. The problem with that is that it doesn't appear to actually be part of the Chez Scheme library. Although I could write my own version of this, I'd much rather use a well known, tested, and maintained library function - especially given how basic an operation this is. So a simple "use these built-in functions" or a "no built-in library implements this" will suffice. Thanks!

    Read the article

  • HashSet vs. List performance

    - by Michael Damatov
    It's clear that a search performance of the generic HashSet<T> class is higher than of the generic List<T> class. Just compare the hash-based key with the linear approach in the List<T> class. However calculating a hash key may itself take some CPU cycles, so for a small amount of items the linear search can be a real alternative to the HashSet<T>. My question: where is the break-even? To simplify the scenario (and to be fair) let's assume that the List<T> class uses the element's Equals() method to identify an item.

    Read the article

  • Python - Check if numbers in list are factors of a number

    - by Zach
    Hey, I have a list of numbers (integers) (say, from 1 to 10). They're not necessarily consecutive, but they are in ascending order. I've prompted the user multiple times to enter a choice of the available numbers. When that number is entered, it is removed from the list along with any of its factors that may be there. I've prevented the user from selecting prime numbers. However, at some point in time, there may be non-prime numbers there, which have no factors remaining. I'm relatively new to Python, so I'm having trouble implementing: Checking if the number selected has no factors remaining (even if it is not prime). Checking if only prime numbers remain, or numbers without factors. I'm thinking of using for statements, but I'm not sure exactly how to implement them. Can anyone offer advice, or code? Thanks in advance... PS. In case anyone's wondering, I'm doing an implementation of the game of Taxman in Python.

    Read the article

  • Scrollable list items in jQuery

    - by Giles B
    Hi Guys, I have a list of 4 items and the ul has a background image that makes the second item look as though it has an arrow behind it. I want to be able to scroll the items up or down when they are clicked to the second items position so for example when I click the fourth item the whole list scrolls up so the fourth item is then postioned over the top of the background image and all the other items will be sitting in the same order above it. I have tried using jQuery Tools with the circular option selected but it clones the first an last item and i end up with a gap when i get to the bottom and I also cant make each item selectable to scroll the list up or down. Here is the code for the list <div id="priceGuide"> <ul id="priceRegion"> <li><a href="#">North & Midlands</a></li> <li><a href="#">London, north of the river</a></li> <li><a href="#">London, south of the river</a></li> <li><a href="#">South & South East</a></li> </ul><!-- /priceRegion --> </div><!-- /priceGuide --> Any help is most appreciated. Thanks Giles

    Read the article

  • Can't access a map member from a pointer

    - by fjfnaranjo
    Hi. That's my first question :) I'm storing the configuration of my program in a Group->Key->Value form, like the old INIs. I'm storing the information in a pair of structures. First one, I'm using a std::map with string+ptr for the groups info (the group name in the string key). The second std::map value is a pointer to the sencond structure, a std::list of std::maps, with the finish Key->Value pairs. The Key-Value pairs structure is created dynamically, so the config structure is: std::map< std::string , std::list< std::map<std::string,std::string> >* > lv1; Well, I'm trying to implement two methods to check the existence of data in the internal config. The first one, check the existence of a group in the structure: bool isConfigLv1(std::string); bool ConfigManager::isConfigLv1(std::string s) { return !(lv1.find(s)==lv1.end()); } The second method, is making me crazy... It check the existence for a key inside a group. bool isConfigLv2(std::string,std::string); bool ConfigManager::isConfigLv2(std::string s,std::string d) { if(!isConfigLv1(s)) return false; std::map< std::string , std::list< std::map<std::string,std::string> >* >::iterator it; std::list< std::map<std::string,std::string> >* keyValue; std::list< std::map<std::string,std::string> >::iterator keyValueIt; it = lv1.find(s); keyValue = (*it).second; for ( keyValueIt = keyValue->begin() ; keyValueIt != keyValue->end() ; keyValueIt++ ) if(!((*keyValueIt).second.find(d)==(*keyValueIt).second.end())) return true; return false; } I don't understand what is wrong. The compiler says: ConfigManager.cpp||In member function ‘bool ConfigManager::isConfigLv2(std::string, std::string)’:| ConfigManager.cpp|(line over return true)|error: ‘class std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >’ has no member named ‘second’| But it has to have the second member, because it's a map iterator... Any suggestion about what's happening? Sorry for my English :P, and consider I'm doing it as a exercise, I know there are a lot of cool configuration managers.

    Read the article

  • garbled items in a horizontal list with css

    - by Pradyut Bhattacharya
    Hi I have made a page in which i m using a list to display the items horizontally Now i can see the result in the page here But when i drag and make the browser window short i get a garbled list as in the scrren-shot here http://pradyut.dyndns.org/WebApplicationSecurity/people_ss.JPG I m using a css in the list as : - #navlist li { padding: 1em; float: left; list-style-type: none; } at the end of the list i m using a clearing div #clear-both { clear: both; } Any help Thanks Pradyut

    Read the article

  • Combining List<>'s in .NET

    - by Maxim Z.
    I have a few List< objects that hold many objects of one specific type. My goal is to combine these List<'s into one List<. Of course, I could just loop through each List's contents and add them into one final List, but is there a more efficient way?

    Read the article

  • How to populate List<string> with Datarow values from single columns...

    - by James
    Hi, I'm still learning (baby steps). Messing about with a function and hoping to find a tidier way to deal with my datatables. For the more commonly used tables throughout the life of the program, I'll dump them to datatables and query those instead. What I'm hoping to do is query the datatables for say column x = "this", and convert the values of column "y" directly to a List to return to the caller: private List<string> LookupColumnY(string hex) { List<string> stringlist = new List<string>(); DataRow[] rows = tblDataTable.Select("Columnx = '" + hex + "'", "Columny ASC"); foreach (DataRow row in rows) { stringlist.Add(row["Columny"].ToString()); } return stringlist; } Anyone know a slightly simpler method? I guess this is easy enough, but I'm wondering if I do enough of these if iterating via foreach loop won't be a performance hit. TIA!

    Read the article

  • List of resources to learn cassandra

    - by Alfred
    Hi all, Lately I have been reading a lot of blog topics about big sites(facebook, twitter, digg, reddit to name a few) using cassandra as their datastore instead of MysqL. I would like to gather a list of resources to learn using cassandra. Hopefully some videos or podcasts explaining how to use cassandra. My list Twissandra - Twissandra is an example project, created to learn and demonstrate how to use Cassandra. Running the project will present a website that has similar functionality to Twitter WTF is a supercolumn - WTF is a SuperColumn? An Intro to the Cassandra Data Model I hope there are resources to watch howto use cassandra. Many thanks, Alfred

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >