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...
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...
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) {
...
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...
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...
Which is more efficient? What is the typical use of each?
...
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...
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 on sharepoint 2010
...
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...
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...
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.
...
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...
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...
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...
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> ...
<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?
...
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 ...
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...
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...