list

How to convert list type in Java hibernate

Hello there. In java application I use hibernate criteria queries, for example: Criteria criteria = session.createCriteria(Any.class); ... List<?> list = criteria.list(); and I definetly know that result list contains only objects of type Any but I don't know if it's possible to get list of type defined above? In this case, if I ...

Does .NET have a way to check if List a contains all items in List b?

I have the following method: namespace ListHelper { public class ListHelper<T> { public static bool ContainsAllItems(List<T> a, List<T> b) { return b.TrueForAll(delegate(T t) { return a.Contains(t); }); } } } The purpose of which is to determine if...

Approach For Syncing One SharePoint List With One or More SharePoint Lists

What would be the best approach or strategy for configuring, customizing or developing in SharePoint a solution that allows me to keep one or more SharePoint lists in sync with a SharePoint list I have designated as a master or parent list. I would like to be able to create a master/parent list of some information that can be extended ...

Cost of list functions in Python

Based on this older thread, it looks like the cost of list functions in Python is: Random access: O(1) Insertion/deletion to front: O(n) Insertion/deletion to back: O(1) Can anyone confirm whether this is still true in Python 2.6/3.x? ...

phpmyadmin - list files in directory

Hello, I have apache+mysql+phpmyadmnin under Gentoo. phpmyadmin-3.2.2 It worked fine before, but now, when I'm loading http://localhost/phpmyadmin I get a list of flies in phpmyadmin-directory, and when I chose index.php, I get it's own code. What I did wrong? ...

how to apply "catch-all" exception clause to complex python web-scraping script?

Hi, I've got a list of 100 websites in CSV format. All of the sites have the same general format, including a large table with 7 columns. I wrote this script to extract the data from the 7th column of each of the websites and then write this data to file. The script below partially works, however: opening the output file (after running ...

Prolog list difference routine.

I am trying to implement a list difference routine in prolog. For some reason the following fails: difference(Xs,Ys,D) :- difference(Xs,Ys,[],D). difference([],_,A,D) :- D is A, !. difference([X|Xs],Ys,A,D) :- not(member(X,Ys)), A1 is [X|A], difference(Xs,Ys,A1,D). When trying: ?- difference([1,2],[],D). I get this error: ER...

simplified boundary checking for Java List

Is there an easy way/library to check and adjust parameters to stay inside the lists boundaries? Here a long sample: if (fromIndex < 0) { fromIndex = 0; } if (fromIndex > list.size() - 1) { fromIndex = list.size() - 1; } if (toIndex < 0) { toIndex = 0; } if (toIndex > list.size() - 1) { toIndex = list.size() - 1; } list.subLi...

How to expand a resulting list in SWI-Prolog?

?- length(L,25). L = [_G245, _G248, _G251, _G254, _G257, _G260, _G263, _G266, _G 269|...]. If I use write(L) following the length predicate then the interpreter prints the list twice, one expanded and the other not. ...

How to make SharePoint accept attachments with special characters in the file name?

Hi, I noticed that every time I try to attach a file to a SharePoint list, if the file name contains any special characters (#, &, @, ...) it will not go through. Will not be attached and will cause an error. Is there any way around that? Thanks, ...

how to point to back of generic list c#

Is there a way to point to the last item added to a generic list in c# ? Like the back() for a vector in c++ ...

db column is a comma seperated list, how to best lazy load a public List property?

My db column is a comma seperated list of category ID's. I have a public property in my class that is: List<int> CategoryIDs {get;set;} I want to somehow lazy load this property, that when it is used, it will split the db column by its comma (its a comma seperated list of ids like: 1,2,343,2342). It will then initialize a List. ...

searching a List<>

I have a List<Order> public int OrderID { get; set; } public string CustID { get; set; } public string Details { get; set; } I want to write a method that accepts a ID, then searches this List for matching records that have same CustID and returns ORderID and Details in a List<> ...

C# List.Find method - how can I pass a value into the predicate??

Hi, I can't work out how to do a "find" on a List I have based on use of a value that I'll pass in at run time. If you see my below code, I want to be able to find the CustomClass in the List for which it's Path parameter is equal to X, where X will be defined at run time. Any ideas how to do such a find on a List? Or is this not po...

TreeModel backed by Lists

I want to build a TreeModel from some Lists that contain the source data. Now, there's an utility class called DynamicUtilTreeNode that can be used to build trees from arrays, Vectors and Hashtables, but... not from Lists?! Of course I could use the List's toArray() method, but it gives a clone array of the List's state at the moment, so...

Cannot shuffle list in Python.

This is my list: biglist = [ {'title':'U2','link':'u2.com'}, {'title':'beatles','link':'beatles.com'} ] print random.shuffle(biglist) that doesn't work! It returns none. ...

How can I wait for one event out of a list of events in specman?

I have a struct in specman: struct foo_s { event foo_ev; // some code that will emit foo_ev sometimes }; And a list: var foo_l: list of foo_s; // later code will manage the list And now I want to sync on any of the foo_ev events in the list: first of { sync @foo_l[0].foo_ev; sync @foo_l[1].foo_ev; sync @foo_l...

How to restrict to add an item to List<T> ?

I have Class called Person containing to properties, Father and List of Children. I want every one to use only AddChild Method to add children, not the List.Add method , so how do I restrict use of it? public class Person { private List<Person> _children = new List<Person>(); public string Name { get; set; } public Person Father ...

How to count the elements of a list in a list in a list using LINQ?

Imagine the following list: List<List<List<String>>> listRoot = new List<List<List<String>>>(); I want to count the elements of the first and the second list and return the accumulated value: int iFirstListCounter = 0; int iSecondListCounter = 0; foreach (List<List<String>> listFirst in listRoot) { iFirstLis...

(x)html/css: list items distributed in columns

Hi all, Is there a way, with the help of CSS, to let a single list (ul or ol) behave like this: 1. 4. 7. 2. 5. 8. 3. 6. 9. In other words, have their subsquent elements be distributed in columns? ...