list

Filtering lists using LINQ

I've got a list of People that are return from an external app and I'm creating an exculsion lists in my local app to give me the option of manually removing people from the list. I have a composite key which I have created that is common to both and I want to find an efficient way of removing people from my List using my List e.g ...

PHP: Apply a function to multiple variables without using an array.

I have a function (for ease, I'll just use count()) that I want to apply to maybe 4-5 different variables. Right now, I am doing this: $a = count($a); $b = count($b); $c = count($c); $d = count($d); Is there a better way? I know arrays can use the array_map function, but I want the values to remain as separate values, instead of value...

matching items from two lists (or arrays)

I'm having a problem with my work that hopefully reduces to the following: I have two List<int>s, and I want to see if any of the ints in ListA are equal to any int in ListB. (They can be arrays if that makes life easier, but I think List<> has some built-in magic that might help.) And I'm sure this is a LINQ-friendly problem, but I'm ...

when to use Collection<T> vs List<T>

What is the best practice for when to use one vs the other? Both implement IList<T> and hold the data in an ordered fashion, but only List expose the sorting semantics.... (edit: duplicate from here) ...

List ordering from SQL call

i have a List being returned from a daoTemplate.query() call, using a rowMapper. the sql does an order by on a column, happens to be a date column, order by asc when i use the List, am i always guaranteed that the list will be in the order dictated by the sql. can i depend that the first element (theList.get(0)), will ALWAYS be the earli...

date insertion algorithm

i have a List, it has Foo objects, and each Foo has a start date, and an end date. I want to insert a new Foo object, which has its own start and end date. I want the elements in the list to update their start and end dates accordingly, when the new Foo object is inserted, and for the new Foo object to find its correct place in the List....

std::list with std::map properties?

Basically, I want to have a std::list but with std::map properties such as find(), do I really need to loop through every single list entry to find what I need? ...

Grouping List by the last Char

Hi, As you can see on the picture above i have a List "keys" filled with Request.Form.AllKeys which a key starts with "txt". I want to group them by their last id, for example [0] "txtTitle:2" "txtDescription:2" [1] "txtTitle:3" "txtDescription:3" How can i achive this with lambda expression. Thank you very much ...

LISP very simple list question

Im learning lisp and im pretty new at this so i was wondering... if i do this: (defparameter *list-1* (list 1 2)) (defparameter *list-2* (list 2 3)) (defparameter *list-3* (append *list-1* *list-2*)) And then (setf (first *list-2*) 1) *list-3* I will get (1 2 1 4) I know this is because the append is going to "save resources" and...

Alternatives to illegal <br> or <p> within <li> tags> on a hover?

Hi folks, does anyone have a suggestion for creating paragraph-type line spaces within a <li> tag that includes a hovered pop-up pseudo-class? I have a <span> that pops up on a:hover and I want the text that pops up to be broken into 2 paragraphs. It works with <br> in FF but I want to do the right thing (now that I've discovered it's ...

Ocaml List: Implement append and map functions

Hi! I'm currently trying to extend a friend's OCaml program. It's a huge collection of functions needed for some data analysis.. Since I'm not really an OCaml crack I'm currently stuck on a (for me) strange List implementation: type 'a cell = Nil | Cons of ('a * 'a llist) and 'a llist = (unit -> 'a cell);; I've figured out that t...

What is the most "pythonic" way to iterate over a list in chunks?

I have a Python script which takes as input a list of integers, which I need to work with four integers at a time. Unfortunately, I don't have control of the input, or I'd have it passed in as a list of four-element tuples. Currently, I'm iterating over it this way: for i in xrange(0, len(ints), 4): # dummy op for example code ...

Array versus List<T>: When to use which?

MyClass[] array; List<MyClass> list; What are the scenarios when one is preferable over the other? And why? ...

How do we verify elements existence by id in SharePoint lists?

I want to get a item from a list without loading all the items of the list. I know I can do it by calling SPList.getElementbyId(myID), but if I don't know if this myID exists in the list, how do I verify it? Yes I could use SPListItem myItem = myList.Items[myID]; if (myItem == null) { // log that we don't have this item } However, ...

Getting rid of disc in list item

Hi, I'm developing a site using jQuery, and jQuery UI tabs. For some reason, my tabs (unordered list) are showing their bullets in all browsers (tested thus far) except Firefox 3 on OS X. It displays them in Safari OS X, FF 3 Windows, and Google Chrome Windows (IE displays all the divs in a big stack in the corner... but that's anot...

How do you create a list like PHP's in Python?

This is an incredibly simple question (I'm new to Python). I basically want a data structure like a PHP array -- i.e., I want to initialise it and then just add values into it. As far as I can tell, this is not possible with Python, so I've got the maximum value I might want to use as an index, but I can't figure out how to create an e...

SharePoint List Pre-Population

I have two lists, each on different tabs (sub-sites) of the site. I would like users enter data on the first tab and somehow copy a portion of that data over to the second list automatically (like a pre-population of several of the fields on the second list). What would be involved in making this happen? Of the ideas I have come up with,...

Serialize an inline List of Objects

This is bothersome and seemingly rare to figure out. But what I have is the need to serialize a list of objects into XML without the containing list element. For instance: public class Book { public string Name { get; set; } } public class Library { public List<Book> Books { get; set; } } I need to write it like so: <Librar...

python, sorting a list by a key that's a substring of each element

Part of a programme builds this list, [u'1 x Affinity for war', u'1 x Intellect', u'2 x Charisma', u'2 x Perception', u'3 x Population growth', u'4 x Affinity for the land', u'5 x Morale'] I'm currently trying to sort it alphabetically by the name of the evolution rather than by the number. Is there any way I can do this without just ...

Best way to check that a list of items exists in an SQL database column?

If I have a list of items, say apples pairs pomegranites and I want to identify any that don't exist in the 'fruit' column in an SQL DB table. Fast performance is the main concern. Needs to be portable over different SQL implementations. The input list could contain an arbitrary number of entries. I can think of a few ways to do i...