list

CSS: UL's/OL's vs. Div floating left in IE

The scenario is that the client wants a floating div (the gray box) with text that wraps around it. However some of that text includes ul's and ol's, which hide behind the floating div in IE6. I tried wrapping the ul's/ol's in a div to see if that would help, but have been unsuccessful. Has anyone experienced this problem before and f...

Override .NET Generic List<MyType>.Contains(MyTypeInstance)?

Is it possible, and if so how do I override the Contains method of an otherwise normal List<T>, where T is my own, custom type? ...

C#: How to add subitems in ListView

Creating an item(Under the key) is easy,but how to add subitems(Value)? listView1.Columns.Add("Key"); listView1.Columns.Add("Value"); listView1.Items.Add("sdasdasdasd"); //How to add "asdasdasd" under value? ...

Creating an event that triggers when a List is updated

I've got a static class (DataFormSubject) that holds a generic List object, as follows: private static List<DataForm> dataForms = new List<DataForm>(); Other classes that rely on this list need to be told when the list is updated, so I created a custom event, and associated methods that could trigger when an item is added or removed, ...

Standard delegates in C#

There are some Delegates predefined in C# I know these: EventHandler // Default event callbacks EventHandler<T> // Default event callbacks with custom parameter (inheriting from EventArgs) Action // Function without return value and without parameter Action<T1, T2, T3, T4> // Function without return value and 1-4 parameters Func<T1, T2...

How to remove the element from List in C#?

Hi, I got a liiitle problem. There is List<List<UInt32>> temp = new List<List<UInt32>>(); For example, there are two List<UInt32> records within the List temp however, when i try to do something like temp.removeAt(0); it doesn't remove the first row (List<UInt32>) .. Why is that? Do i do something wrong? Update Here is the code th...

Is it possible to let List collapse after I do removeAt certain times?

Let's say there is a list of List<UInt32> Thus, : 12|12 23|33 33|22 11|22 I need to remove 0th and 2nd element (List<UInt32>). However, when I try to foreach this list and first remove 0th, the List collapses its elements and 1st becomes 0th now.. so I don't want to delete the wrong element, because my another List<int> includes the ...

Java - list of objects to list of single property attributes

I have the ViewValue class defined as follows: class ViewValue { private Long id; private Integer value; private String description; private View view; private Double defaultFeeRate; // getters and setters for all properties } Somewhere in my code i need to convert a list of ViewValue instances to a list containing values of id fiel...

Build dynamic list c#

This code works correctely to make a web service call int numberOfGuests = Convert.ToInt32(search.Guest); var list = new List<Guest>(); Guest adult = new Guest(); adult.Id = 1; adult.Title = "Mr"; adult.Firstname = "Test"; adult.Surname = "Test"; list.Add(adult); Guest adu...

Why does enumerating through a collection throw an exception but looping through its items does not

I was testing out some synchronization constructs and I noticed something that confused me. When I was enumerating through a collection while writing to it at the same time, it threw an exception (this was expected), but when I looped through the collection using a for loop, it did not. Can someone explain this? I thought that a List ...

C# Data Structures Question (Which collection to use?)

I need to implement a large collection of Widget objects, each of which contain a unique file path string ("FilePath"). I need to be able to do the following: Retrieve a Widget object quickly given the file path Change the file path of a Widget without creating a new object (multiple other objects may contain references to a single Wi...

Python strange behavior in for loop or lists

Hi, I'm currently developing a program in python and I just noticed that something was wrong with the foreach loop in the language, or maybe the list structure. I'll just give a generic example of my problem to simplify, since I get the same erroneous behavior on both my program and my generic example: x = [1,2,2,2,2] for i in x: x...

Something wrong with output from list in python

I want python to import a list of words from a text file and print out the content of the text file as two lists. The data in the text file is on this form: A Alfa B Betta C Charlie I want python to print out one lists with A,B,C and one with Alfa, Betta, Charlie This is what i've written: english2german = open('english2german.txt'...

Best way to handle a email lists in .Net

In our project there will be a 5-6 groups of mail list that we will need to send notifications(100k-200k emails). What is the best way to do this in .Net? Use custom classes, and custom smtp server? Or use some third party service(I don't find anything like that). PS:We have 2 dedicated servers with win 2003 on them. ...

Split string into a list in Python

I want my python function to split a sentence (input) and store each word in a list. The code that I've written so far splits the sentence, but does not store the words as a list. How do I do that? def split_line(text): # split the text words = text.split() # for each word in the line: for word in words: # pri...

Why is List<T>.ForEach faster than standard foreach?

Consider this: Requisite: //The alphabet from a-z List<char> letterRange = Enumerable.Range('a', 'z' - 'a' + 1) .Select(i => (Char)i).ToList(); //97 - 122 + 1 = 26 letters/iterations Standard foreach: foreach (var range in letterRange) { Console.Write(range + ","); } Console.Write("\n"); Inbuilt foreach: letterRange.ForEach(r...

Finding best position for element in list

Hello, I have List collection that is populated in specific order (the requirement is that, this order can not be changed). This list contains entity type objects. After initial population of the list, I need to insert few more object, that are coming from another data source. These objects need to be inserted at specific position, so...

find missing numeric from ALPHANUMERIC - Python

How would I write a function in Python to determine if a list of filenames matches a given pattern and which files are missing from that pattern? For example: Input -> KUMAR.3.txt KUMAR.4.txt KUMAR.6.txt KUMAR.7.txt KUMAR.9.txt KUMAR.10.txt KUMAR.11.txt KUMAR.13.txt KUMAR.15.txt KUMAR.16.txt Desired Output--> KUMAR.5.txt KUMAR.8.txt KU...

How can i get List items to stay together using CSS?

The skeleton of the HTML is this <div class="TwoCol"> <img src="imgurl"/> <h1>A headline</h1> <p>Some exciting text</p> <ul> <li>Item A</li> <li>Item B</li> <li>Item C</li> </ul> <p>More riveting text </p> </div> The CSS is .TwoCol img{ float:left; padding-right:5px; border:none; } .TwoCol ul{ list-style-type:none; } T...

Adding generic object to generic list in C#

I have class where the relevant part looks like class C { void Method<T>(SomeClass<T> obj) { list.Add(obj); } List<?> list = new List<?>(); } How should I define the list so that the class compiles? I want a list of type List<SomeClass<?>>, that is a list of objects of SomeClass where each object can have any type...