Note that there are some explanatory texts on larger screens.

plurals
  1. USHandcraftsman
    primarykey
    data
    text
    plurals
    1. COFetching just the ChildId and ParentRecordId to do the join on the client side might be less expensive. Follow this up with queries for the Child details of the matched records and/or break it up into chunks less than 2100, perhaps using an InSetsOf implementation http://stackoverflow.com/questions/1034429/how-to-prevent-memory-overflow-when-using-an-ienumerablet-and-linq-to-sql/1035039#1035039 . Finally, it appears SQL Server 2008, if that is an option Clint, added Table-Valued Parameters http://msdn.microsoft.com/en-us/library/bb675163.aspx as a way around the 2100 parameter limit.
      singulars
    2. COClearing the list instead of creating a new one has the side effect of unexpectedly changing the result that was previously returned, a problem if it had not yet been consumed by the caller. For example: Enumerable.Range(1, 100).InSetsOf(5).InSetsOf(5).ToList().ForEach(x => Console.WriteLine(x.First().First() + "-" + x.Last().Last())); gets 1-25 26-50 51-75 76-100 as coded, but 21-25 46-50 71-75 96-100 if the list is only cleared. Also, since GroupBy is not used it can lazily return results instead of consuming the entire input first.
      singulars
    3. COThe for loop creates the initial population, the while loop updates the population while expanding the terrains until there are no unassigned points in the grid. See https://gist.github.com/1067469 for a C# implementation. Takes about 8 seconds (on my box) to populate a 1000x1000 grid with 300 regions using 14 terrain types.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload