list

Grails: How does that the UPDATE function work?

I got rid of the original UPDATE gsp Grails offers. I put it in the first row of my list.gsp table and change all the values of the table to g:textfield so they can be edited without going to the save.gsp But now I'm trying to make it work, and I can't. I added a update button in the last column of the row, of every row. When I chang...

C# list.Orderby descending

Hey, I want to make this return the result, but in descending order. Is that possible? var newList = list.OrderBy(x => x.Product.Name).toList(); I thought I could just add descending, like I do in other cases, but it is not accepting that. ...

Erlang BIF's to delete tuples in list

How can I delete a tuple with key from a list? Ex: TupleList = [ {apple, {0,0,0}}, {orange, {0,0,0}}, {bannana, {0,0,0}}] Then I need to delete the tuple whos key matches orange. So I should get back [ {apple, {0,0,0}}, {bannana, {0,0,0}}] Im looking for a BIF instead of a function as I am using right now. Thanks and Regards ...

Bug in Programming Interviews Exposed: Linked Lists

Hello, I was going through the Programming Interviews Exposed book. There's a code given for inserting an element at the front of linked lists. bool insertInFront( IntElement **head, int data ){ IntElement *newElem = new IntElement; if( !newElem ) return false; newElem->data = data; *head = newElem; return true; } ...

Python Check if all of the following items is in a list

I found, that there is related question, about how to find if at least one item exists in a list: http://stackoverflow.com/questions/740287/python-check-if-one-of-the-following-items-is-in-a-list But what is the best and pythonic way to find whether all items exists in a list? Searching througth the docs I found this solution: >>> l =...

c# getting current index of generic list

Hi, How can i get index of generic list from form page? For example; aspx.cs List<string> names = new List<string>(); names.Add("a"); names.Add("b"); names.Add("c"); repeaterNames.datasource = names; repeaterNames.DataBind(); aspx <form> <repeater> <itemtemplate> **<%# Eval(?)%>** </itemtemplate> </repeater> </form> ...

Getting the average order out of multiple lists

Assuming that I have multiple ordered lists like this: list_1 = ["apples", "oranges", "bananas"] list_2 = ["apples", "pineapple", "grapes"] list_3 = ["melons", "pineapples", "apples"] How would I calculate the average order? I could loop over all items and get the average position for all lists. However what would I do when an item is...

How do I concatenate strings from a subquery into a single row in mysql?

I have three tables: table "package" ----------------------------------------------------- package_id int(10) primary key, auto-increment package_name varchar(255) price decimal(10,2) table "zones" ------------------------------------------------------ zone_id varchar(32) primary key (ex of data: A1,...

I am trying to produce a 3 level deep nested list from a dreamweaver recordset

I have put a page up at http://abc-widgets.i-cre8.com/nested-recordset.php that shows all the records produced by this recordset code: SELECT manufacturer.manDesc, models.modelDesc, engine.engineSize FROM manufacturer INNER JOIN models ON (manufacturer.manID = models.manID) INNER JOIN model_engine ON (models.modelID = model_engine.model...

[python] get numbers from user & print maximum and minimum (w/o using built-in function)

I'm reviewing a python exercise which does the following : reads list of numbers til "done" gets entered. When "done" is inputted, print largest and smallest of the numbers. And it should be without directly using the built-in functions, max() and min(). Here is my source. Traceback says, "'float' object is not iterable" I think my...

Groovy: remove and object from a list within itself?

I'm trying to remove objects from a list when it finds that particular objects privacy is private to the current user books.eachWithIndex{ obj, i -> if((obj.book.private).equals(true)){ def status = bookService.getBookStatus(obj.book) if(!status){ books.remove(i) } } ...

Merging two lists in Haskell

Can't figure out how to merge two lists in the following way in Haskell: INPUT: [1,2,3,4,5] [11,12,13,14] OUTPUT: [1,11,2,12,3,13,4,14,5] This would work similar to shuffling a deck of cards. Thanks in advance. ...

Sharepoint 2010: best practice to migrate legacy data to sharepoint list

I have to migrate some legacy data from stand-alone sql server database to sharepoint list. I'm going to use programmatic approach and write a code that communicates with sharepoint list asmx web service. Are there some "data transformation wizards" to simplify such a task or a better approach to port legacy data from sql server databa...

How can I reverse a list in python?

How can i do this in python? array=[0,10,20,40] for (i = array.length() - 1 ;i >= 0; i--) I need to have the elements of an array but from the end to the beginning. ...

doubt in collections

what is the difference among list, queue and set? ...

Using map to process a list-of-objects in python

I want to calculate the center-of-mass using the map function. I don't want to use for loops. Help with bottom two lines? class Obj(): def __init__(self, mass = 0., x = 0., y = 0.): self.mass = mass self.x = x self.y = y # Create List of Objects objList = [] n = 0 for i in range(0...

Converting list to *args in Python

In Python, how do I convert a list to *args? I need to know because the function scikits.timeseries.lib.reportlib.Report.__init__(*args) wants several time_series objects passed as *args, whereas I have a list of timeseries objects. Any help is greatly appreciated :) ...

Freeze in Python?

I have programmed in Python for a while, and just recently started using Ruby at work. The languages are very similar. However, I just came across a Ruby feature that I don't know how to replicate in Python. It's Ruby's freeze method. irb(main):001:0> a = [1,2,3] => [1, 2, 3] irb(main):002:0> a[1] = 'chicken' => "chicken" irb(main):003:...

JAVA: Concurrency control for access to list in java

I have a multi-threaded application that has a centrlaised list that is updated (written to) only by the main thread. I then have several other threads that need to periodically retrieve the list in its current state. Is there a method that can allow me to do this? ...

How CompareTo method logic works in List sort function?

How CompareTo method logic works in List sort function. public class person : IComparable { string firstName; string lastName; public int CompareTo(object obj) { person otherPerson = (person)obj; if (this.lastName != otherPerson.lastName) return this.lastName.CompareTo(otherPerson.lastName); ...