list

C# List<> how to find last element

Hi, following is an extract from a code: public class AllIntegerIDs { public AllIntegerIDs() { m_MessageID = 0; m_MessageType = 0; m_ClassID = 0; m_CategoryID = 0; m_MessageText = null; } ~AllIntegerIDs() { } public void SetIntegerValues (int messageID...

is it good semantic to give a dt more than one dd in the dl?

so i'm thinking something like: <dl> <dt>job title</dt> <dd>job duration</dd> <dd>job description</dd> <dd>company link</dd> </dl> the example is purely make up, so it might not be the best example. but i've come across couple times when there is need for using 2 dd for 1 dt. so do you guys this is good semantic or bad...

MOSS WCM - Best way to customise a list item view

I am createing an external facing SharePoint site which contains a number of custom lists. Some of these are extremely complicated. I generally avoid using the SharePoint Designer like the plague, preferring to stick to Visual Studio. To display a list item to users should I really try and get my head around making a custom DispForm.as...

Checking if same object is already present in a list

Here is the story: Im trying to make a list of different clusters... I only want to have the necessary clusters... And Clusters can be the same. How can I add this to a list by checking if the list contains the object (I know objects cant be passed here) This is my sample quote: foreach (Cluster cluster in clustersByProgramme) { ...

Why can't I access the class internals of List<T> when I derive from it?

class NewList<T> : List<T> Why can't I access it's internals like T[] _items, etc? Why aren't they protected, but private? Should I use composition for this? ...

Iterate over pairs in a list (circular fashion) in Python

The problem is easy, I want to iterate over each element of the list and the next one in pairs (wrapping the last one with the first). I've thought about two unpythonic ways of doing it: def pairs(lst): n = len(lst) for i in range(n): yield lst[i],lst[(i+1)%n] and: def pairs(lst): return zip(lst,lst[1:]+[lst[0]])...

Store List to session

is it possible to store list to session variable in Asp.net C# ? ...

ASP.NET C# Lists Which and When?

In C# There seem to be quite a few different lists. Off the top of my head I was able to come up with a couple, however I'm sure there are many more. List<String> Types = new List<String>(); ArrayList Types2 = new ArrayList(); LinkedList<String> Types4 = new LinkedList<String>(); My question is when is it beneficial to use one over th...

Pythonic way of searching for a substring in a list

I have a list of strings - something like mytext = ['This is some text','this is yet more text','This is text that contains the substring foobar123','yet more text'] I want to find the first occurrence of anything that starts with foobar. If I was grepping then I would do search for foobar*. My current solution looks like this for...

Is there a constraint, interface or class that envelops IEnumerable or array?

I'd like to take the following if possible and combine them: public static T[] ForEach<T>(this T[] TArray, Action<T> doWhat) { foreach (var item in TArray) { doWhat(item); } return TArray; } The above handles array, below handles lists public static IEnumerable<T> ForEach<T>(this IEnumerable<T> TList, Action<T> action) ...

Using jQuery to add list titles

I have an unordered list like this: <div class="blueBoxMid"> <ul> <li>First item <em>This is the hover text</em></li> <li>Second item <em>This is the hover text</em></li> </ul> </div> I want to use jQuery to generate this: <div class="blueBoxMid"> <ul> <li title="This is the hover text">First item</li> <li title...

Databind ASP.NET List of ListItem to DropDownList issue

I've just come across this bizarre thing that I was expecting to work in a different (logical) way, but it doesn't. Is it a bug or a "feature"? So there's a DropDownList that I'm populating in the codebehind with a List of ListItem. Each new ListItem gets 2 arguments that, according to the intellisense-provided documentation, correspond...

C# Casting a List<ObjBase> as List<Obj>

Hi Why can I not cast a List<ObjBase> as List<Obj>? Why does the following not work: internal class ObjBase { } internal class Obj : ObjBase { } internal class ObjManager { internal List<Obj> returnStuff() { return getSomeStuff() as List<Obj>; } private List<ObjBase> getSomeStuff() { ...

How to clone an Item in a SharePoint list?

I need to be able to create a different item from an existing one, but still keep most of the details and only change some information. Thanks, ...

Renaming Title Column in SharePoint List Definition

I am defining a custom list content type for SharePoint (using VSeWSS 1.3 and schema.xml). I want to change the display name of the default title field ('Title') to 'Serial Number': <Fields> <Field Name="Title" DisplayName="Serial Number" Type="Text" /> </Fields> I am using the LinkTitle column in my definition of the default view ...

Select Rows from a DataSet using LINQ, where the list of RowsID's are in a List<T>

First I have to say, that I am a newby using LINQ. Actually I never used before, but I am having a task where I need to filter a DataTable, using values that will come from a List. So I will like to know if it's possible in LINQ to query on a Datatable using values in the List as Filter values. Some one can give me some hint's Thank you...

Most concise way to check whether a list is empty or [None]?

Most concise way to check whether a list is empty or [None]? I understand that I can test: if MyList: pass and: if not MyList: pass but what if the list has an item (or multiple items), but those item/s are None: MyList = [None, None, None] if ???: pass ...

Hide options in a select list using jQuery

I have an object with key/value pairs of options I want to hide/remove from a select list. Neither of the following option selectors work. What am I missing? $.each(results['hide'], function(name, title) { $("#edit-field-service-sub-cat-value option[value=title]").hide(); $("#edit-field-service-sub-cat-value option[@valu...

Flex sorting of XMLListCollection subelements

In a Flex webapp, is there an easy way to go about applying a sort to the children of an XML element, based on the children's attributes? Example follows below: XMLListCollection: <a anotherProp="ABCDE">   <e prop="AB">1</element>   <e prop="BC">2</element> </a> <a anotherProp="FGEH">   <e prop="HF">3</element> ...

How to get the list of key in dictionary c#

I never gotten any code I tried to work?. I want to key and not value(yet). Using another array prove to be much work as I use remove also. ...