list

Sharepoint 2010 List, calculated value

Hello everybody With a sharepoint list, is it possible to calculate a column value basing on other columns of the list value using a C# Method ? My list contains start and end dates and i want to show business days of these dates intervals by using an home made c# method. I would prefer to do that in real time when showing the list, bu...

What's the fastest way to check List<String> contains a unique String?

It's in Java. Basically I have about 1,000,000 strings, for each request I have to check a String is belonged to the list or not. I'm worried about the performance, so what's the best method? ArrayList? Hash? Thanks. ...

How to extract the n-th elements from a list of tuples in python?

Hello, I'm trying to obtain the n-th elements from a list of tuples. I have something like elements = [(1,1,1),(2,3,7),(3,5,10)] and I want to extract only the second elements of each tuple into an array: seconds = [1, 3, 5] I know that it could be done with a for but I wanted to know if there's another way since I have thousands o...

Deleting through Datasheet view of SharePoint List

I have an event handler set up to handle ItemAdded, ItemUpdated and ItemDeleting on a list. I know 2 of the 3 above are async events and these are causing no end of bother. When I add 7 items through the datasheet, the event handler copies each item to another list in a subsite. If I then go to the datasheet view of the Master list ...

Inheritance, Calling base class ctors

class Base{ public: Base(int val):_id(val){}; int _id; }; class Derived : Base { public: Derived(int val):Base(_id+val){}; }; int main(){ Derived d(60); } why doesn't this give an error? Base class is still not constructed but I'm able to use '_id'? thanks ...

C#.NET :How to Sort a List <T> by a property in the object

I have a class called Order which has properties as OrderId,OrderDate,Quantity,Total. I have a List of this "Order" class. List<Order> objListOrder=new List<Order> (); objListOrder=GetOrderList(); // method to fill list of orders Now i want to sort the list based on one property of the Order object(Ex :i need to sort by the order dat...

What's the fastest way to generate a random sequence from a list of data?

Let's say that I have a list of data: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} where n = 10 elements I'd like to randomly choose k elements of this set to form a sublist, say k = 5. In that case, I could end up with a sublist that looks like {9, 3, 5, 2, 7} I could accomplish this by: Randomly determining an offset within the list, between 0 a...

How to get information from a list that is on another site collection, on SharePoint 2010?

Using SharePoint 2010, how can I get the information on a list that is on another site collection? ...

Check for presence of a sublist in Python

I want to write a function that determines if a sublist exists in a larger list. list1 = [1,0,1,1,1,0,0] list2 = [1,0,1,0,1,0,1] #Should return true sublistExists(list1, [1,1,1]) #Should return false sublistExists(list2, [1,1,1]) Is there a Python function that can do this? ...

c++ member initialization list completeness

must class member initialization lists in c++ be complete? or can they simply initialize one or two of the member data in a class? thanks in advance! ...

replace elements in a list with another

how do i replace elements in a list with another? for example i want all "two" to become "one"? ...

Best way to split several heads from a list with Erlang?

So, Erlang is a real joy to work with, but there's one problem I run into occasionally, that I'm wondering if there is a nicer way to solve. Often, I find myself needing to split several items from a list. The syntax for splitting a list into a Head and Tail is straight forward enough, but what about when there are multiple items. 1> Li...

Python list remove method: how's the implementation?

In java, I have my client class that have the "code" attr, and the equals method. Method equals receives another client and compares with itself's code attr. In python, I just read that we have the __cmp__ method, to do the same as java method equals. Ok, I did that. I created my class client, with "code" attr and the method comp that v...

Suppose I had a list in Python. What's the most pythonic and efficient way to randomize it by sections?

I have a list of X items. I want the first 10 to be randomized. Then, the 2nd 10 items to be randomized. Then the 3rd. What's the most efficient way to do this? ...

Get all textbox values from list (jQuery Sortable)?

I have an unordered list, each list item has an id (id="6~OriginalName") - when I do a toArray on this list, I get a nice array and each item looks like "6~OriginalName" that I can parse later on. $("#roleList").sortable('toArray') The problem is that now I've embedded a TextBox in each list, which its value that of the OriginalName, ...

Merging a list of lists in python

Possible Duplicate: join list of lists in python Is there in Python a built-in or a particular syntax to accomplish the following on the fly? def merge(listOfLists): result = [] for l in listOfLists: result.extend(l) return result print merge( [[1,2,3,4], [5,6], [7,8,9]] ) # [1, 2, 3, 4, 5, 6, 7, 8, 9] ...

Python: An empty element remains after the list comprehension

Hi here's my code: keywords_list = """ cow dog cat """ keywords_list = [i.strip() for i in keywords_list.split("\n") if i] I'm still getting an empty element(last element) and I'm wondering why. Also suggestions to improve my code would be appreciated. Thanks in advance! edit: solved it myself by stripping the string first but I'm ...

How to cast list of X to list of Y in C#?

I have 2 base classes FirstBase and SecondBase. I also have 2 class derive from them, DerivedFirst and DerivedSecode and both of them has almost of same property. Source code is like below. public abstract class FirstBase { //some method } public abstract class SecondBase { //some method } public class DerivedFirst : FirstBase...

CSS How to display a single icon out of a matrix for a list item.

Hi, I would like to use a single icon out of an icon matrix (with around 16 x 16 icons) as the bullet image for a list. I can position the background image with background-position, and repeat: norepeat. But this will display the whole line of the remainder of the matrix, so I'm looking for a way to crop the background image. (By using ...

How to compare custom generic List<> in C#?

I've 2 lists of class A, A has implemented Equals(object obj) and GetHashCode() this 2 methods working correctly, code is below. class A { public string TEST { get; set; } public override bool Equals(object obj) { return ((A)obj).TEST == this.TEST; } public override int GetHashCode(...