list

HTML list margin

Hello guys, I'm trying to make a numbered list but I'm getting a margin on the top and the bottom between the list and some text (I'm using Firefox). When I try get rid of it with CSS, I loose the numbers and the indentation. Is it possible to get rid of the margin without loosing the numbers and list indentation? If you use the follow...

ArrayList without the copying overhead?

Does anyone know of a List implementation that has a constant time get(int index) (I.e. implements RandomAccess) but doesn't have to copy the whole list when it grows as ArrayList does? I'm thinking the implementation may well be in terms of other lists e.g. public class ChunkedList<T> implements List<T>, RandomAccess { private Linke...

OCaml: How does List.fold_left work?

I'm trying to find the average of a list of floats. let avg l = List.fold_left ( +. ) 0 l /. List.length l;; How does List.fold_left work? (Applies the first argument to a list (the third arg)... but then what is the second argument?) Toplevel returns this error: Characters 43-44: List.fold_left ( +. ) 0 l /. List.length...

(re)Using dictionaries in django views

Hello I have this dictionary in my apps model file: TYPE_DICT = ( ("1", "Shopping list"), ("2", "Gift Wishlist"), ("3", "test list type"), ) model, which uses this dict is this: class List(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=200) type = models.PositiveIntegerFi...

Correct implementation of an indexer on a derived class

I have a class, say DerivedBindingList<T>, which is derived from BindingList<T>. I would like to use an indexer with the derived class, and have coded it as: public T this[int index] { get { // Getter code } set { // Setter code ...

What is the most efficent way of updating an "order" column in MySQL via PHP.

I'm currently creating a Flash CMS via Flex and the Zend Framework. In the Flex interface, I have a list of drag-able items pulled from a MySQL database via the Zend Framework. The user can rearrange the items by dragging and dropping them which will change their order in the mapped Flex array. Back on the server I have a column in my ...

Getting all unique Items in a C# list

Hey all, What is the fasters / most efficient way of getting all the unique items out of a C# list? I have List that possiably has multiple repeating items in it and only want the unique values within the list. Thanks ...

How can I compare two lists in python and return matches.

I want to take two lists and find the values that appear in both. a = [1, 2, 3, 4, 5] b = [9, 8, 7, 6, 5] returnMatches(a, b) would return [5], for instance. ...

A List of varying types?

Id' like to create a list of data that will be passed from method to method, however I can't use a struct because the data that will be contained in this list will vary depending on the input. For example if (x == 1) { a = 1 b = true c = 42 d = "hello" } if (x == 2) { a = 2 b = 'g' c = "sup" } I believe my o...

How do you use the Find method with a generic List class to find a specific instance by name

Hello, I have a system.collections.generic.list(of ListBox) I would like to use the collection classes built-in Find method to find a particular ListBox by the Name of the Listbox I found the following MSDN article http://msdn.microsoft.com/en-us/library/x0b5b5bc.aspx This does not work for me because it does not show how to find a...

How can I get a list from a Ruby enumerable?

I know of Python's list method that can consume all elements from a generator. Is there something like that available in Ruby? I know of : elements = [] enumerable.each {|i| elements << i} I also know of the inject alternative. Is there some ready available method? ...

C# - elegant way of partitioning a list?

Hi, I'd like to partition a list into a list of lists, by specifying the number of elements in each partition. For instance, suppose I have the list {1, 2, ... 11}, and would like to partition it such that each set has 4 elements, with the last set filling as many elements as it can. The resulting partition would look like {{1..4}, {5...

Implementing std::list item read/write events.

I'm new to c++ but have set my mind on a specific task that needs me to enable adding a specific chunk of code to be execute whenever any list item is attempted to be changed or read. The resulting list should behave and look as much as as possible to std::list except for this small exception that would enable me to execute a specific t...

How expensive is gluing binaries (list_to_binary)?

One process listen to server on async socket and on each message {tcp, Socket, Bin} takes it's buffer and: Data = list_to_binary([Buffer, Bin]), {next_state, 'READY', State#state{buffer = Data}}. On some events it flushes buffer: 'READY'({flush}, #state{buffer = Buffer} = State) -> {reply, {Buffer}, 'READY', State#state{buffer = <<>...

C# List<> Order by/Group by/Remove

Phew where do I begin... OK, I have a list that I have to ,,cut up'' into smaller list depending on two properties. When I have finished working with the small list I want it's items removed from the original list :) f.ex. I have a List<> CustomerProducts, that contains two values CustomerID and ProductID. I begin by ordering the list: ...

Updating List from Outlook VBA via MS Access Offline dBase - VIsta/Office 2007

I have some VBA code, which is attached to a click event of a form, running in MS Outlook 2007. The code is dsigned to update a record in an MS Acces 2007 table, which in turn is linked offline to a SharePoint List. It works fine for the all the list columns except for two of them. These are: a. A List column of Date / Time type ("S...

how to filter list items by user/group column in sharepoint?

i have a list that have a user/group column that i want to filter by (the column name is: USERS). how do i get only the items in the list where the current user exists in the USERS column? ...

How to empty a list in Python?

It seems so "dirty" emptying a list in this way: while len(alist) > 0 : alist.pop() Does a clear way exist to do that? ...

Problem with list of strings in python

Why on Earth doesn't the interpreter raise SyntaxError everytime I do this: my_abc = ['a', 'b', 'c' 'd',] I just wanted to add 'c' to the list of strings, and forgot to append the comma. I would expect this to cause some kind of error, as it's cleary incorrect. Instead, what I got: >>> my_abc ['a', 'b...

Why is there no list.clear() method in python?

Inspired by this question. Why is there no list.clear() method in python? I've found several questions here that say the correct way to do it is one of the following, but no one has said why there isn't just a method for it. del lst[:] lst[:] = [] While it may go against the "zen of python" to have more than one way of doing somethin...