list

Adding a property to an interface that's a List

This compiles: public interface IBookCatalogueView { Book[] Books { get; set; } } This doesn't, giving the error "Interfaces cannot contain fields" public interface IBookCatalogueView { List<Book> Books { get; set; } } > Why? How can I define a property that's a list in...

Create unordered list of dynamically loaded objects using jQuery so that I can use 'sortable' of jQueryUI

Hi, I am loading dynamic objects in the DOM. How do I keep adding them dynamically to an unordered list using jQuery ?? ...

Customize List's cells in DashCode

Hi, I have my site created with Dashcode and I am using the List object but I don't like the default blue background when a cell is selected. How can I customize this? For example change it to grey or white, etc. (As far as i know, everything is customizable in Dashcode, is just sometimes you have to do it using code and not Dashcode ...

proper indenting for ordered lists in html

I cannot get an ordered list to show proper indenting. The numbers are all aligned to the right. So the browser (Chrome) shows a space before the single digit numbers and only aligns the double digit numbers correctly to the left. How can I output a nice ordered list where the numbers are all aligned to the left and the list items all s...

JTree from List<File>

Hi there, I need a way to create a JTree from a list of Files. How could I create the Nodes, wich classes and methods should I use? Thanks in advance, JBeginner ...

Python: What does the use of [] mean here?

What is the difference in these two statements in python? var = foo.bar and var = [foo.bar] I think it is making var into a list containing foo.bar but I am unsure. Also if this is the behavior and foo.bar is already a list what do you get in each case? For example: if foo.bar = [1, 2] would I get this? var = foo.bar #[1, 2] a...

Python Array with String Indices

Is it possible to use strings as indices in an array in python? For example: myArray = [] myArray["john"] = "johns value" myArray["jeff"] = "jeffs value" print myArray["john"] ...

Python - Speed up generation of permutations of a list (and process of checking if permuations in Dict)

I need a faster way to generate all permutations of a list, then check if each one is in a dictionary. for x in range (max_combo_len, 0, -1): possible_combos = [] permutations = list(itertools.permutations(bag,x)) for item in permutations: possible_combos.append(" ".join(item))...

changing the font to bold on a HTML unsorted list when clicked

I have a HTML unsorted list which I capture its “on click” event. When a list item is clicked on I want to change that items font setting to bold so that the user gets a visual indicator that it’s been selected. Is this possible? ...

returning the max of a list

I am trying to return the max of a list. I have the following code list_max([]) -> []; list_max([H|T]) -> list_max(H, T). list_max(Temp, []) -> Temp; list_max(Temp, [H|T]) when H > Temp -> Temp = H; list_max(Temp, T). But am struggling to relate to Erlang. How do I assign something to temp and replace it to the hig...

Python lists and list item matches - can my code/reasoning be improved?

Hi query level: beginner as part of a learning exercise i have written code that must check if a string (as it is build up through raw_input) matches the beginning of any list item and if it equals any list item. wordlist = ['hello', 'bye'] handlist = [] letter = raw_input('enter letter: ') handlist.append(letter) hand = "".joi...

List vs Map in Java

Hi there, I didnt get the sense of Maps in Java. When is it recommended to use a Map instead of a List? thanks in advance, nohereman ...

Java Collections automatic reallocation when size is reached.

I'm not sure if I'm using the correct terms, but I am curious how it's determined how much to increase the size of a Collection in Java when it gets full? I've tried searching but I'm not really coming up with anything useful. So, if I have something like List l = new ArrayList(1); l.add("1"); l.add("2"); How does it determine how mu...

SQL - Joining tables where one of the columns is a list

Hi Experts, I'm tryin to join two tables. The problem i'm having is that one of the columns i'm trying to join on is a list. So is it possible to join two tables using "IN" rather than "=". Along the lines of SELECT ID FROM tableA INNER JOIN tableB ON tableB.misc IN tableA.misc WHERE tableB.miscTitle = 'help me please' table...

Split list at marker elements with LINQ?

I have a List<T> that is a mixture of 'regular' elements and 'marker' elements. I want to split it into a List<List<T>>, broken at the markers. e.g. given an input of {a, b, M, c, d, e, f, M, g}, where 'M' is a marker element, I want to get {{a, b},{c, d, e, f}, {g}} It is easy to do the job with a loop, but it seems like it should be ...

Write conditions based on a list

I'm writing an if statement in Python with a lot of OR conditions. Is there an elegant way to do this with a list, within in the condition rather than looping through the list? In other words, what would be prettier than the following: if foo == 'a' or foo == 'b' or foo == 'c' or foo == 'd': I've just taken up Python, and the languag...

With this .NET event, is it OK to pass in this IList instance?

Hi folks, i've got the following code :- while (....) { var foo = DoTheFooShakeShakeShake(..); foos.Add(foo); // foos is an IList<Foo>, btw and is new'd, above. if (foos.Count % 100 == 0) { var e = new CustomFooEventArgs { UserId = whatever, Foos = foos }; OnFooPewPew(this, e); foos.Clear(); ...

mix list<string> in c#

i have a 4 list in c# how i can make a list from them. means to say make a list from the result of 4 list. ...

Python: Sum string lengths

Is there a more idiomatic way to sum strings in Python than by using a loop? length = 0 for string in strings: length += len(string) I tried sum(), but it only works for integers: >>> sum('abc', 'de') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sum() can't sum strings [use ''.join(seq) inst...

Is there a better way to sort my IList-bound GridView?

I have an asp.net web application that has a page with a GridView. The GridView is bound to an IList object. As you may know, the .net framework does not provide for sorting of such a GridView; the sorting must be handled in code. Here's the code I was able to draft. As you can see, the issue is that the name of the field to sort by ...