list

How to find out if there are any duplicates in one list versus another?

I have a List where MyClass has a property 'Name'. I want to know if there are duplicate MyClass with the same Name in the list. Also, I have a different List and I want to know if there are any duplicates compared to List A. ...

Python: How to check if a nested list is essentially empty?

Is there a Pythonic way to check if a list (a nested list with elements & lists) is essentially empty? What I mean by empty here is that the list might have elements, but those are also empty lists. The Pythonic way to check an empty list works only on a flat list: alist = [] if not alist: print("Empty list!") For example, all th...

Lists in scheme

Hi, I'm trying to write a function in scheme that takes a list and squares every item on the list, then returns the list in the form (list x y z). However, I'm not sure how to write a code that will do that. So far, I have (define (square=list list) (cond [(empty? list) false] [else (list (sqr (first a-list))(square-list (res...

Create a dropdown list in Sharepoint containing List Documents with links to them

I am looking to create a dropdown list on my default.aspx page which i want it to contain List documents/pages and when the document/page is selected the page should redirect to the selected document/page. Any suggestions of how this can be done please? any examples/samples would be grealy appreciated? Thank you :) ...

filtering lists in python

hello, I want to filter repeated elements in my list for instance foo = ['a','b','c','a','b','d','a','d'] I am only interested with: ['a','b','c','d'] What would be the efficient way to do achieve this ? Cheers ...

Multi-dimensional arraylist or list in C#?

Is is possible to create a multidimensional list in C#. I can create an multidimensional array like so: string[,] results = new string[20, 2]; but I would like to be able to use some of the features in a list or arraylist like being able to add and delete elements. ...

Passing list to Tcl procedure

What is the canonical way to pass a list to a Tcl procedure? I'd really like it if I could get it so that a list is automatically expanded into a variable number of arguments. So that something like: set a {b c} myprocedure option1 option2 $a and myprocedure option1 option2 b c are equivalent. I am sure I saw this before, but I ...

Difference Between int[] and list<int>

What is the difference between: int[] myIntArray and list<int> myIntArray ? In web services I read that I should pick one or the other and not mix the two, why? ...

New to programming and having a problem with List<T>

PAW.Btrieve oBtrieve = new PAW.Btrieve(); PAW.CustomerClass oCustomer = new PAW.CustomerClass(); int Status = oBtrieve.Connect("Z:\\payinc"); if (Status == 0) { GC.Collect(); Status = oCustomer.OpenFile(); if (Status == 0) { Status = oCustomer.GetFirst(); int cn...

arrays of structs need advice

I made an array of structs to represent map data that gets drawn; however I didn't double check it till it was too late: when I load in a new map I get either an "out of memory exception" (if i try to make a new array struct first) or I get a screwed up map that would require a lot of recodeing to get it to work right (if i just initiali...

Button component affecting the parent Panel in Delphi

I'm writing a program consisting of dynamically created panels that each have a few components in, including a delete and add panel buttons. Each panel displays 20 pixels times the panel number below each other, OnClick for add must add another panel to the end of the set and OnClick for delete must destroy its parent and then move all t...

Python: How to make a completely unshared copy of a complicated list? (Deep copy is not enough)

Have a look at this Python code: a = [1, 2, 3] b = [4, 5, 6] c = [[a, b], [b, a]] # [[[1, 2, 3], [4, 5, 6]], [[4, 5, 6], [1, 2, 3]]] c[0][0].append(99) # [[[1, 2, 3, 99], [4, 5, 6]], [[4, 5, 6], [1, 2, 3, 99]]] Notice how modifying one element of c modifies that everywhere. That is, if 99 is appended to c[0][0], it is also appended ...

Cannot Convert from 'List<T>' to 'T[]'

Hi. I am trying to pass a list object of type List<UploadQueue> to a WCF SOAP method of the same parameter type and I am getting the error: Cannot Convert from 'System.Collections.Generic.List' to 'WebAPI.Upload.UploadQueue[]' I don't understand this because my WCF method's (below) parameter type is List<UploadQueue>: ISe...

Issue with passing parameters by reference into public shared methods

I have a List(Of AddlInfo) with AddlInfo being an object. I'm trying to pass addlInfoList by reference into a function of another class: Public Shared Sub SortAddlInfo(ByRef addlInfoList As List(Of AddlInfo)) addlInfoList.Sort(AddressOf Comparer) End Sub Private Function Comparer(ByVal x As AddlInfo, ByVal y As AddlInfo) As Intege...

Why is this simple python class not working?

Hi, I'm trying to make a class that will get a list of numbers then print them out when I need. I need to be able to make 2 objects from the class to get two different lists. Here's what I have so far class getlist: def newlist(self,*number): lst=[] self.number=number lst.append(number) def printlis...

Is it possible to change the default value of a primitive data type?

I recently created a generic Matrix<T> class that acts as a wrapper around a List<List<T>> collection. As far as I can tell, this class is working perfectly. I am running into a slight problem though regarding the default values of the T's. I create an instance of Matrix<int>(3, 3), which creates a 3x3 matrix of ints, all defaulted to 0...

Verify Text of item in Listbox is the same one in List<string> C#

I'm trying to get it to verify that it has the same item in the List as the one that's currently selected in the listbox Why does this code not work, It should work unconditionally because the text generated from the listbox is taken from the List choicetitle if (RemovePackages_Listbox.Text == choicetitle[RemovePackages_Listbox.Selecte...

Python - Using the Multiply Operator to Create Copies of Objects in Lists

In Python, if I multiply of list of objects by an integer, I get a list of references to that object, e.g.: >>> a = [[]] * 3 >>> a [[], [], []] >>> a[0].append(1) >>> a [[1], [1], [1]] If my desired behavior is to create a list of copies of the original object (e.g. copies created by the "copy.copy()" method or something sort of stand...

.NET - multi-threaded iteration over a single List (Of T) - What do I need to watch out for?

I'm using VB.NET. I want to build a large List (Of MyClassOrStructure) that becomes static after its initial population. I'm going to have multiple threads that need to iterate through this list to read data (no writing, inserting, or deleting) Are there any very bad things that I need to keep an eye out for? Thanks. ...

f# tail.Head + lists question

I am trying to write some f# code for manipulating polynomials, as part of that I want to combine duplicate elements of a list into a single element here is the relevant code type PolynomialElem(Coeff : double, Power : int) = member x.Coeff = Coeff member x.Power = Power let rec removeDuplicates (inlist:list<PolynomialElem>) (outlis...