list

Help with array in android

i get NullPointerException at the start of the for where am i going wrong? public void checkzone(Location loc) { X = new List<float[]>() { }; Y = new List<float[]>() { }; X.clear(); Y.clear(); float x = (float) loc.getLatitude(); float y = (float) loc.getLongitude(); float A1...

Grouping an ordered dataset into minimal number of clusters

I have an ordered list of weighted items, weight of each is less-or-equal than N. I need to convert it into a list of clusters. Each cluster should span several consecutive items, and total weight of a cluster has to be less-or-equal than N. Is there an algorithm which does it while minimizing the total number of clusters and keeping th...

C# List or TextReader limit?

Hi, I'm trying to make a dictionary game, and I have a text file with about 100,000 words each on their own line. I have this code: words = new List<Word>(); Console.WriteLine("Please wait, compiling words list..."); TextReader tr = new StreamReader(DICT); string line = tr.ReadLine(); while (line != "" && line != null) { ...

python: complicated loop through list

import csv import collections def do_work(): (data,counter)=get_file('thefile.csv') b=samples_subset1(data,counter,'/pythonwork/samples_subset4.csv',500) medications_subset2(b,['HYDROCODONE','MORPHINE','OXYCODONE']) def get_file(start_file): with open(start_file,'rb') as f: data=list(csv.reader(f)) counter=collections.d...

python: iterating through array

i have a list like this: brand_names={'MORPHINE':['ASTRAMORPH','AVINZA','CONTIN','DURAMORPH','INFUMORPH', 'KADIAN','MS CONTIN','MSER','MSIR','ORAMORPH', 'ORAMORPH SR','ROXANOL','ROXANOL 100'], 'OXYCODONE':['COMBUNOX','DIHYDRONE','DINARCON','ENDOCET','ENDODAN', 'E...

What is the difference between lists and tuples in Python?

Which is more efficient? What is the typical use of each? ...

Problem with Sharepoint 2010 quick launch

I am creating a site in Sharepoint 2010, and then packaging it into a wsp. things are working fine, but there is one problem when i deploy the wsp to a new site. There is a list in the quick launch, which does not get called correctly when the wsp is deployed. Is there some way to tell the quick launch to dynamically pick the list id whe...

Align Images used in <ol>

Hi, all. I have an ordered list for my horizontal navbar, but I'm using sprite images (for a, active & hover) instead of letting any text show. I'm trying to let the image appear on a row using float: left, but it's not happening. I think the next image appears behind the first. Here's my code: HTML: <div id="navbar"> <ol id="...

How to display the site name and site list,library available in the site collection using sharepoint client object model

How to display the site name and site list, library available in the site collection using sharepoint client object model on sharepoint 2010 ...

Automatic three-level list numbering with Javascript? IE7 doesn't support CSS counters :(

Hey! The website I'm currently developing has a three-level menu and each item in the menu must have a number before the title: 1. and 1.1. and 1.1.1. for example. Currently I am using CSS to generate the numbers: #menu ol { counter-reset: item; } #menu li a { counter-increment: item; } #menu li a:before { content: coun...

Is LinkedList thread-safe when I'm accessing it with offer and poll exclusively?

Hi, I have a linked list samples: protected LinkedList<RawDataset> samples = new LinkedList<RawDataset>(); I'm appending elements to the list in thread 1 like this: this.samples.offer(data); And I'm retrieving elements from it in a second thread like so: public RawDataset retrieveSample() { return this.samples.poll(); } Wou...

Remove item from string array

I have a database field with data such as this: 76,60,12 If I want to remove, for example, 60, what do I have to do? The number to be removed could be any place. I also need to remove the comma, if needed. I'm using .NET 2.0. ...

Fill List<int> with default values?

Possible Duplicate: Auto-Initializing C# Lists I have a list of integers that has a certain capacity that I would like to automatically fill when declared. List<int> x = new List<int>(10); Is there an easier way to fill this list with 10 ints that have the default value for an int rather than looping through and adding the...

How to convert list of strings to doubles?

EDIT : I had tried these two ways before - List doubleList = stringList.ConvertAll(x => (double)x); List doubleList = stringList.Select(x => (double)x).ToList(); and got this error- Cannot convert type 'string' to 'double' I read about something similiar that convert ints to doubles...but I have List of st...

Displaying a listbox of viewboxes

Hi, I have a list box that I'm trying to populate with a list of viewboxes. The listbox takes in the list without a problem. However, when my function reaches its end, I receive the error: "Must disconnect specified child from current parent Visual before attaching to new parent Visual." The viewboxes are created from the same initial...

Is it possible to get the item count of a List<T> when T is different?

Hello SO: I have a subroutine that changes its operation slightly to include either one list or the other then perform the same operation. Since it is just counting the number of items in the list, I figure there is probably an easy way to get the item count regardless of the list type. Thanks in advance! EDIT: private List<Message> ...

jquery find by index in a list

<ul> <li>No</li> <li>Yes</li> <li>No</li> </ul> //demostration purpose $('ul').get(2).text(); //output = Yes What's the best way to access a specific item in a list? and use it as a selector? ...

Call int() function on every list element in Python

I have a list with numeric strings, like so: numbers = ['1', '5', '10', '8']; I would like to convert every list element to integer, so it would look like this: numbers = [1, 5, 10, 8]; I could do it using a loop, like so: new_numbers = []; for n in numbers: new_numbers.append(int(n)); numbers = new_numbers; Does it have to ...

How to select distinct List<T>'s from a List<List<T>>?

HI, I am working on a simple class to combine items of any type... this is for a poker game, this is how it looks: public static List<List<T>> combinar<T>(List<T> items, int take) { List<List<T>> combs = new List<List<T>>(); var stuff = permutar<T>(items, take); var all = from s in stuff select new Tuple<Lis...

How to add to a list not yet created. Please help!

I am trying to program a simple employee registry and I want to use a generic List to "save" the persons I am creating. The manager class got one constructor and one method (see below). The constructor creates the List and the method adds to it, or should be adding to it. The problem is that I cannot do it like below because Visual Stud...