list

ERLANG - Splitting Lists into sub list

Hi this is my first post here hope you all are well. So Im just starting erlang and I ran into a problem im not sure how to tackle yet. So I have a binary I am recieving in the form of <<56, 23, 67, 34, 45, 78, 01, 54, 67, 87, 45, 53, 01, 34, 56, 78>> My goal is to split it into a sub list (or binary if more efficient) based on t...

ERlANG - Splitting Lists into sub list

Hi Everyone, So this I just had one problem solved very quickly by a nice guy on my other post. http://stackoverflow.com/questions/3464207/erlang-splitting-lists-into-sub-list Now I am a beginner at Erlang and need a little help with the syntax of another function that does work on the result from my previous post. For example, I now...

Get Max value from List<myType>

I have List List<MyType>, my type contains Age and RandomID Now i want to find the maximum age from this list. What is the simplest and most efficient way??? Thanks ...

simplest way to return a new list by remove index/value from another list? (order required)

All, o1 = ["a","b","c","d","e","f","g","h"] index = [3,4] value = ["c","d"] [x for x in o1 if x not in value] [x for x in o1 if x not in [o1[y] for y in index]] any simpler solution for above lc? Thanks ...

python generate SQL statement keywords by given lists

Hi ALL, I have below variables try to make an auto generating SQL statement in python _SQL_fields = ("ID", "NAME", "BIRTH", "SEX", "AGE") _add_SQL_desc_type = ("PRIMARY KEY AUTOINCREASEMENT",) _SQL_type = ("INT",'TEXT') _Value = (1,'TOM',19700101,'M',40) bop = ["AND"] * (len(_SQL_fields) - 1) m...

How can Python lists within objects be freed?

I have a Python class containing a list, to which I append() values. If I delete an object of this class then create a second object later on in the same script, the second object's list is the same as the first's was at the time of deletion. For example: class myObj: a = [] b = False o = myObj() o.a.append("I'm still here!")...

LINQ, Lists and Add items question

I have the following which is an array package.Resources If I use package.Resources.ToList().Add(resouce); package.Resources doesn't actually contain the new item. I have to use var packageList = package.Resources.ToList(); packageList.Add(resource); package.Resources = packageList.ToArray(); Why is that? ...

Can you use dynamic finders or grouping tables via scaffold in Grails?

I'm working on a very, very quick and dirty application using almost entirely scaffold to do it. This is only for internal use, and it's just to replace a spreadsheet, so while I know that I shouldn't rely on scaffolds for real production use, I still intend to use them where I can for efficiency (...just wanted to make sure we aren't ta...

Jquery - select immediate li text without selecting children ul's text

Hi, I'm trying to take a structure of nested html unordered lists as a database for some information a need to organize and analyze. I'm trying to filter, count and present the information using jQuery. I'm striving for the lists not to have any class or id attribute, so that they are very clean. Only the root would have a class or id li...

Query a list for only duplicates

I have a List of type string in a .NET 3.5 project. The list has thousands of strings in it, but for the sake of brevity we're going to say that it just has 5 strings in it. List<string> lstStr = new List<string>() { "Apple", "Banana", "Coconut", "Coconut", "Orange"}; Assume that the list is sorted (as you can tell above)....

Auto Increment While Building list in Python

Here is what I have so far. Is there anyway, I can auto increment the list while it is being built? So instead of having all ones, I'd have 1,2,3,4.... possible = [] possible = [1] * 100 print possible Thanks, Noah ...

s:List display the items in reverse order.

Is there a way to get a s:List to display it's items in reverse order? Not having to make a copy of the dataProvider would be ideal. Thanks. ...

Create x lists in python dynamically

(First, I chose to do this in Python because I never programmed in it and it would be good practice.) Someone asked me to implement a little "combination" program that basically outputs all possible combinations of a set of group of numbers. Example, if you have: (1,2,3) as the first set, (4,5,6) as the second, and (7,8,9) as the th...

Constructing generic lists of anonymous types and nested loops.

I wish to construct a list of anonymous types constructed by iterating through two other lists in a nested loop. var myList = new List<???>(); foreach (object x in GetAllX()) { if (Process(x)) { foreach (object y in GetAllY(x)) { myList.Add(new { X = x, Y = y ...

LINQ and how to return a list of a specific type

Hi, I have 2 tables (Document and DocumentClass) that have the following columns: DocumentClass: DocClassID, Name, ParentID Document: DocID, Name, DocClassID The DocumentClass table contains parent and child records and the relationship between a parent and a child is the ParentID column. A Document record is linked with a child rec...

How to process n items in a collection concurrently

Hi, i am building a class that inherits from List. Items are going to be added to this collection at runtime and what i want is to have this class automatically do something with each block of n items after they have been added. So here is the scenario. 1] Create new class that inherits from List - CollectionX 2] At runtime we will be...

deleting a unique record from List

i have a list of employees.My employee class is as follows public class Employee{ int empid; String name; ... } now i want to remove a employee from list whose empid is 5.One way to do is to iterate the list and check if empid == 5.Is there any other way by which i can do it? Also is want my list to contain employees with uniq...

Unpack a list in Python?

I think 'unpack' might be the wrong vocabulary here - apologies because I'm sure this is a duplicate question. My question is pretty simple: in a function that expects a list of items, how can I pass a Python list item without getting an error? my_list = ['red', 'blue', 'orange'] function_that_needs_strings('red', 'blue', 'orange') # w...

C++ Vector/list of priority queues?

Why wouldn't C++ allow something like that ? I need to have multiple priority queues, the number of which would be determined at run time. This fails to compile std::vector<std::priorityqueue<Class A>>. Is there a better approach ? ...

.NET List best approach

I have a list which is declared below, at the start I default the list items to { -1, - }. please note that throughout the program the list size is fixed at 2. List<int> list = new List<int>(new int[] {-1, -1}); My question is regarding, what would be the best approach if I need to overwrite the two values in the list. int x = GetXVa...