list

How do I check if a given value is a generic list?

public bool IsList(object value) { Type type = value.GetType(); // Check if type is a generic list of any type } What's the best way to check if the given object is a list, or can be cast to a list? ...

Question inheriting from List(of T) class

I want to implement a priority queue class. When an item is added at a higher priority it is pushed to the front of the queue instead adding to the end of queue. Simple few lines of code Public Class PriorityQueue(Of T) Inherits List(Of T) Private _list As New List(Of T) Public Sub Enque(ByVal item As T, Optional ByVal pu...

Context Sensitive Menus - Java ME

Hello, I'm trying to build a context sensitive based command list. I set the command.ITEM option for all my command buttons. But I couldn't find a way how to provide the following functionality: I have a list of values say A, B,C For A, my command menu should contain 2,4 When I move the selection (cursor) to B, my commands menu should h...

delete list item

hi, i have a contact list that i use in a issue list(lookup). When i delete the contact in the contact list is also gone in my already created issue. Someone? thx ...

How to access to the elements properties inside a Repeater?

Hi, I have a Repeater control who has its dataSource setted with a typed object list and in the inline code I want to access to its elements properties inside the ItemTemplate tag. I tried this with the eval expression but it does not work: <ItemTemplate> <tr> <td><%# Eval("code") %></td> <td><%# Eval("description") %></td> ...

How to programatically list Installed video codecs?

Do you know how to programatically obtain a list of video codecs installed on computer, from windows forms ? Thank you. ...

Are there any practical limitations to only using std::string instead of char arrays and std::vector/list instead of arrays in c++?

I use vectors, lists, strings and wstrings obsessively in my code. Are there any catch 22s involved that should make me more interested in using arrays from time to time, chars and wchars instead? Basically, if working in an environment which supports the standard template library is there any case using the primitive types is actually ...

SharePoint: Filtering a List that has Folders

I have a SharePoint document library that has a folder structure used for organizing the documents (but also for controlling access, via permissions on the folders). The documents in the library are updated every month, and we store every month's version of the document in the same folder; there's a "month" column used for filtering tha...

Extension Method to Sort a List within a parent object

public class Person { public string name { get; set; } public Email email { get; set; } } public class Email { public string desc { get; set; } } public static IEnumerable<T> Sort<T>(this IEnumerable<T> source, string sortExpression, bool desc) { var param = Expression.Parameter(typeof(T), string.Empty); ...

Merge two lists of lists - Python

This is a great primer but doesn't answer what I need: http://stackoverflow.com/questions/464342/combining-two-sorted-lists-in-python I have two Python lists, each is a list of datetime,value pairs: list_a = [['1241000884000', 3], ['1241004212000', 4], ['1241006473000', 11]] And: list_x = [['1241000884000', 16], ['1241000992000', 16...

SandCastle Help File Builder and MAML, how to have an ordered list with a different starting index?

I'm using SandCastle Help File Builder 1.8.0.1 with its MAML content editor. I want an ordered list starting from a value other than the default of 1. 10. Some data 11. Other data I even tried the following and it does not work as it is from HTML for the OL element: <list class="ordered"> <listItem value="10">some data<...

How to exit a Generic list ForEach with delegate ?

How do i exit a Generic list ForEach with a delegate? Break or return doesn't work. Example: Peoples.ForEach(delegate(People someone) { if(someone.Name == "foo") ???? What to do to exit immediatly ? }); ...

Haskell: looking up the second value of a tuple in a list based on the first value

I've got a function here that is meant to look through a list of tuples and find the second value in the tuple by taking in the first value. Here's the function so far: lookup :: String -> [(String,String)] -> String lookup _ _ [] = "Not found" lookup x y zs = if (notFound x zs) then "Not found" else (head [b | (a,b) <- zs, (a==...

How do I get a list of installed updates and hotfixes?

A list of every update and hotfix that has been installed on my computer, coming from either Microsoft Windows Update or from the knowledge base. I need the ID of each in the form of KBxxxxxx or some similar representation... Currently I have: const string query = "SELECT HotFixID FROM Win32_QuickFixEngineering"; var search = new Manag...

returning IList<T> vs Array in C#?

I was recently asking someone why he preferred to return a strongly-typed array over an IList. I had always thought that programming against an interface was the most flexible and best way program when faced with a project having a long life. So it struck me as odd when he replied: We typically prefer immutable types over mutable o...

Implementing GetEnumerator in C++

In C# i have the following class and it compiles just fine: class CustomItem { } class CustomList : IList<CustomItem> { public CustomItem this[int index] { get { return null; } set { throw new NotImplementedException(); } } public void CopyTo(CustomItem[] array, int arrayIndex) { } ...

Multiply two lists element by element in Haskell

How can I multiply the elements of two lists in Haskell, two by two? Basically if I have [1,2,3] and [2,3,4] I want to get [2,6,12]. ...

Make all LI elements a Droppable using Prototype

How could I possibly make every LI element of a list a droppable and apply the onDrop function to use it's ID? ...

MFC Library - adding elements to a fixed-size CList

I'm using fixed-size CList and I was wondering what the implementation does when the list is full and I make a call to add another element. Does it fail to add? Does it replace the oldest element? ...

How can I iterate over multiple lists at the same time in Perl?

I need to create a text file (aptest.s) that Ican use to read into another program. I am using Perl because I have a large list to work from. My code is as follows (which does not give the desired output - shown after code and actual output). Any help would be appreciated. #!/usr/bin/perl -w chdir("D://projects//SW Model ODME"); @link =...