Hey all,
This is a two-part question:
First, I am interested to know what the best way to remove repeating elements from a collection is. The way I have been doing it up until now is to simply convert the collection into a set. I know sets cannot have repeating elements so it just handles it for me.
Is this an efficient solution? Wou...
I would like to create a java List based on another java Collection eg. Set in Scala.
Why is this not possible? I get a required: scala.this.Int error.
val in: java.util.Set[String] = new java.util.HashSet()
val out : java.util.List[String] = new java.util.ArrayList(in)
This worked however, but doesn't feel right:
val in: java.util....
I'm kind of a javascript noob, and I'm trying to use the new geolocation API in Firefox 3.5 to get an estimation of the user's coordinates and put that into a text box in a form. What I have doesn't seem to be working; it seems like the boxes are filled before the location is actually retreived. Here's what I have so far:
<html>
<head>
...
Hello,
I have a Java Set in my session and a variable also in the session. I need to be able to tell if that variable exists in the set.
I want to use the contains ( Object ) method that Java has for Lists and Sets to test whether that object exists in the set.
Is that possible to do in JSTL? If so, how? :)
Thanks,
Alex
...
Is the order of the elements in the jQuery wrapped set guaranteed to match the order the elements appear in the markup?
I ask because I need to perform an operation on a set of nested elements, and I need to always do the operation in order of the nesting.
Can I just run the operation using .each iterator on the matched set and I'll ...
If I have a list object I know that I can bind class property fields to form using the code below.
<c:forEach items="${items}" var="i" varStatus="itemsRow">
<input name="items[${itemsRow.index}].fieldName" type="text"/>
</c:forEach> <form:errors path="items" />
What do I do if the property is a Set object. I have read about initBin...
From cplusplus.com:
template < class Key, class Compare = less<Key>,
class Allocator = allocator<Key> > class set;
"Compare: Comparison class: A class that takes two arguments of the same type as the container elements and returns a bool. The expression comp(a,b), where comp is an object of this comparison class and a and b are...
I'm having a bit of an issue solving a problem I'm looking at. I have a specialized set of functions which are going to be in use across a program, which are basically dynamic callables which can replace functions and methods. Due to the need to have them work properly to emulate the functionality of methods, these functions override _...
I'm building a simple Ruby on Rails plugin and I'm considering using the Set class. I don't see the Set class used all too often in other people's code.
Is there a reason why people choose to use (subclasses of) Array rather than a set? Would using a set introduce dependecy problems for some people?
...
Question about Batch/Windows/CMD:
I would like that my batch file can search for a line (which I already achieved, but what comes next not), it looks like this:
<name>MyName</name>
It needs to find the text in between <name> and </name>. After that it needs to set that as a variable (%name%).
Does anyone have any idea?
EDIT: if som...
Hi,
I have a javascript page which I am looking at localising. I have the translation handled, however one thing I am having difficulty with is the best way to handle which text to set.
Obviously, for a button I should set the title / value. For a span probably the innerHTML / innerTEXT and for an image the alt.
I was wondering if ...
I have tried this on the python interpreter:
>>> a=set('abcde')
>>> a
set(['a', 'c', 'b', 'e', 'd'])
>>> l=['f','g']
>>> l
['f', 'g']
>>> a.add(l)
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
a.add(l)
TypeError: list objects are unhashable
I think that I can't add the list to the set because there'...
I have a set of lots of big long strings that I want to do existence lookups for. I don't need the whole string ever to be saved. As far as i can tell, the set() actually stored the string which is eating up a lot of my memory.
Does such a data structure exist?
done = hash_only_set()
while len(queue) > 0 :
item = queue.pop()
if i...
I want to mimic a Python functionality in Java.
In Python if I want unique characters in a string I can do just,
text = "i am a string"
print set(text) # o/p is set(['a', ' ', 'g', 'i', 'm', 'n', 's', 'r', 't'])
How can I do this in Java trivially or directly?
...
with the flickr API i want to find out all tags used in one particular set of photos.
i know it's easy to find out all my tags (via flickr.tags.getListUserPopular), but i don't know an easy way to limit the tags to the ones used in a particular set. checking every tag against teh photos in the set is too very slow.
...
I'm looking for something similar to the CopyOnWriteSet in Java, a set that supports add, remove and some type of iterators from multiple threads.
...
I have looked this up on the net but I am asking this to make sure I haven't missed out on something. Is there a built-in function to convert HashSets to Lists in C#? I need to avoid duplicity of elements but I need to return a List.
...
Hi,
I am new to Perl and have been asked to incorporate a perl site into an existing Ajax site. The existing site already has session management and a cookie. What I want is to be able to set the session key (from the first login) as the session to be used by the CGI:session. that way both sessions can use the same cookie and the sam...
If I have a set of values (which I'll call x), and a number of subsets of x:
What is the best way to work out all possible combinations of subsets whose union is equal to x, but none of whom intersect with each other.
An example might be:
if x is the set of the numbers 1 to 100, and I have four subsets:
a = 0-49
b = 50-100
c = 50-75...
I want to use OCaml to generates sets of data and make comparisons between them. I have seen the documentation for Module types like Set.OrderType, Set.Make, etc, but I can't figure out how to initialize a set or otherwise use them.
...