list

Which games include coding in gameplay?

One title per answer. ...

How can I create Exchange distribution list inside the GAL using .NET?

We need to remotely create an Exchange 2007 distribution list from Asp.Net. Near as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list remotely? There are some third party components that allow...

HashSet vs. List performance

It's clear that a search performance of the generic HashSet<T> class is higher than of the generic List<T> class. Just compare the hash-based key with the linear approach in the List<T> class. However calculating a hash key may itself take some CPU cycles, so for a small amount of items the linear search can be a real alternative to the...

Best algorithm for synchronizing two IList in C# 2.0

Imagine the following type: public struct Account { public int Id; public double Amount; } What is the best algorithm to synchronize two IList<Account> in C# 2.0 ? (No linq) ? The first list (L1) is the reference list, the second (L2) is the one to synchronize according to the first: All accounts in L2 that are no longer pr...

Using Generic lists on serviced component

Hello, I'm trying to use a generic List as a property on a ServicedComponent class... public class MyCOM : ServicedComponent { public enum MyEnumType { Value1, Value2, Value3 } public List<MyEnumType> MyList { private set; get; } public MyCOM() { MyList = new List<MyEnumType>(); } } The code co...

How can I convert List<object> to Hashtable in C#?

I have a list of objects, each containing an Id, Code and Description. I need to convert this list into a Hashtable, using Description as the key and Id as the value. This is so the Hashtable can then be serialised to JSON. Is there a way to convert from List<Object> to Hashtable without writing a loop to go through each item in the l...

Clearing a list

I find it annoying that I can't clear a list. In this example: a = [] a.append(1) a.append(2) a = [] The second time I initialize a to a blank list, it creates a new instance of a list, which is in a different place in memory, so I can't use it to reference the first, not to mention it's inefficient. The only way I can see of retain...

Removing a subset of a dict from within a list

This is really only easy to explain with an example, so to remove the intersection of a list from within a dict I usually do something like this: a = {1:'', 2:'', 3:'', 4:''} exclusion = [3, 4, 5] # have to build up a new list or the iteration breaks toRemove = [] for var in a.iterkeys(): if var in exclusion: toRemove.appen...

Is it faster to sort a list after inserting items or adding them to a sorted list.

If I have a sorted list (say quicksort to sort), if I have a lot of values to add, is it better to suspend sorting, and add them to the end, then sort, or use binary chop to place the items correctly while adding them. Does it make a difference if the items are random, or already more or less in order? ...

Replace an item in a list in Common Lisp?

I have a list of things (I'll call it L), an index(N) and a new thing(T). If I want to replace the thing in L at N with T, what is the best way to do this? Should I get the sublist up to N and from N to the end of the list and then glue together a new list from the first part, T, and the last part using list? Or is there a better way to ...

Sorting a list into multiple vertical columns

Does anyone have a good algorithm for re-sorting an array of values (already pre-sorted) so that they can be displayed in multiple (N) columns and be read vertically? This would be implemented in .Net but I'd prefer something portable and not some magic function. A good example of it working is the ASP.Net CheckBoxList control rendering...

How can I combine multiple rows into a comma-delimited list in SQL Server 2005?

Right now, I have a SQL Query like this one: SELECT X, Y FROM POINTS It returns results like so: X Y ---------- 12 3 15 2 18 12 20 29 I'd like to return results all in one row, like this (suitable for using in an HTML <AREA> tag): XYLIST ---------- 12,3,15,2,18,12,20,29 Is there a way to do this using just SQL? ...

SharePoint Lists vs Database Tables performance...

Hi, We are looking to store transactional data in SharePoint lists. The lists will easily grow to 100,000+ items. How would the query performance be compared with queries on a database table with these columns? Queries: Select by Id Select Where ColumnValue = X Group By OrderId Group By Date The SP List will be 6 columns wide: Id, D...

Can I list the resources in a given package?

Lets assume my classes are loaded from a compressed .war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there a library out there that does something like that? Googling...

C# List<> OrderBy Alphabetical Order

I'm using C# on Framework 3.5. I'm looking to quickly sort a Generic List<>. For the sake of this example lets say I have a List of a Person type with a property of lastname. How would I sort this List using a lambda expression? List<Person> people = PopulateList(); people.OrderBy(???? => ?????) ...

How do you iterate backwards through an STL list ?

I'm writing some cross-platform code between Windows and Mac. If list::end() "returns an iterator that addresses the location succeeding the last element in a list" and can be checked when traversing a list forward, what is the best way to traverse backwards? This code workson the Mac but not on Windows (can't decrement beyond first e...

How do I join two lists in Java?

Conditions: do not modifiy the original lists; JDK only, no external libraries. Bonus points for a one-liner or a JDK 1.3 version. Is there a simpler way than: List<String> newList = new ArrayList<String>(); newList.addAll(listOne); newList.addAll(listTwo); ...

list iterator not incrementable

I have an old project that was built using visual studio 2003 and I recompiled it with vs2005 recently. However, during runtime, I get the following error: list iterator not incrementable I traced the program to this function: void InputQueue::update() { list<PCB>::iterator iter; list<PCB>::iterator iterTemp; for(iter = b...

Data Access Layer: Exposing List<>: bad idea?

Hi everyone, I am currently coding a simple Data Access Layer, and I was wondering which type I should expose to the other layers. I am going to internally implement the Data as a List<>, but I remember reading something about not exposing the List type to the consumers if not needed. public List<User> GetAllUsers() // non C# users: t...

Directory of APIs/WebServices - where do I find one?

Where do I find a directory where a lot of APIs or Webservices are collected? I'd like to generate a Web Site getting its content from different services, but I assume that spidering together the content is not legal (e.g. getting the latest financial data from finance.yahoo.com). So I would like to have a list of APIs and WebServices (...