set

Correct use of C# properties

private List<Date> _dates; public List<Date> Dates { get { return _dates; } set { _dates = value; } } OR public List<Date> Dates { get; set; } I have always used the former, is that incorrect or bad practice? It never occurred to me that I could just use the second option. I do like having my encapsulate...

Algorithm for number of transitions between pair of set (graph) partitions

Say I have a set (or graph) which is partitioned into groups. I am interested to find the number of transitions between two partitions, where a transition involves taking an element out of one partition and moving it into another (or singleton partition by itself) For example there is one transition between partitions 1 2 | 3 and 1 |...

Independent set in a graph

As you know finding maximum independent set is NP. Is there an algorithm to find out whether a given graph has an Independent set of at least k vertices? Note that we don't want to find it. We just want to find out if such thing exists. ...

STL set of map iterators

I have an stl unordered_map and I would like to store references to elements in that map. I would like there to be no duplicate references. I thought I could create an set of iterators which pointed to elements. For one I wasn't sure that it would recognise , but even so I got some long template errors which I think boiled down to the...

Can't insert element into nested stl set of ints

I have a nested set of ints but I cannot insert elements into the nested sets. std::set<std::set<int> > centre_as_set = bitset_to_set(centre->second->bit_partitions); std::set<std::set<int> >::iterator set_itr; for ( set_itr = centre_as_set.begin(); set_itr != centre_as_set.end(); ++set_itr ) { set_itr->insert(4); std::set<int>:...

AS3 get/set vs. reassigning the value

What's the purpose of getting/setting values when you can just reassign the value? Is it just because you can get/set private variables? ...

How to add an object into another Object set.

I have two classes. One(Person) for getters and setters, and another(People) for compute the data. What is my situation is, I get the data from the DB using ResultSet, then created a person Object to store the row data. Then i created people Object to store all persons. Each Object created as SET. while(rs.next()) { Set<People> p...

Js : Set field items for each items I create

I would like to set manually each items when I create them. I'm a newbie in Js but I search for a long time and no find the answer : I need some help please. When I make a new annonce, how reach each field ? function annonce() { return { // scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Annonce', ...

ORA-12704: Unable to convert character data

I am trying to perform SET operations in Oracle across remote databases. I am using the MINUS operator. My query looks something like this. SELECT NAME FROM localdb MINUS SELECT NAME from remotedb@dblink This is throwing up a ORA-12704 error. I understand this warrants some kind of conversion or a NLS Setting. What should I try nex...

how can I maintain sequence of my list using set?

In [1]: l1 = ['a',2,3,0,9.0,0,2,6,'b','a'] In [2]: l2 = list(set(l1)) In [3]: l2 Out[3]: ['a', 0, 2, 3, 6, 9.0, 'b'] Here you can see the the list l2 is falling with different sequence then the original l1, I need to remove the duplicate elements from my list without changing the sequence/order of the list elements.... ...

MySQL BIT vs SET

Does anyone know where in the MySQL literature the reference is made to merging BIT fields? I am having a hard time locating any documentation that distinguishes SET from BIT. ...

Set comprehensions don't work on Pydev (Python)

{x for x in range(10)} works perfectly on IDLE, but when I try this in eclipse (with Pydev plugin) I get a syntax error: Undefined variable: x Is it because Pydev doesn't support set comprehensions or something? What can I do to make this work? (This was just one example that doesn't work. All set comprehensions don't work for me...

Why are sets bigger than lists in python?

Why is the size of sets in Python noticeably larger than that of lists with same elements? a = set(range(10000)) b = list(range(10000)) print('set size = ', a.__sizeof__()) print('list size = ', b.__sizeof__()) output: set size = 524488 list size = 90088 ...

Fluent Nhibernate - How do I set the name attribute of a set or bag collection?

This is a set collection: <set access="field.camelcase-underscore" cascade="save-update" inverse="true" lazy="true" name="employees" table="TeamEmployee" mutable="true"> How do I set the name attribute? ...

how to select most frequent item from the table using mysql query?

i create a table for transaction table using mysql... i need to retrieve the frequent transaction data from that table... how find the frequent data from the table help me! ...

CKEditor read contents + set uiColor dynamically

Hello! I want to validate a form where I use CKEditor for one of the inputs. When an input is wrong, I set its border and background to colors of red. Using JavaScript, how can I read the contents of the CKEditor? Also, how can I make the editing textarea red background and red border? Thank you. ...

std::inserter with set - insert to begin() or end()?

I have some code that looks like this: std::set<int> s1, s2, out; // ... s1 and s2 are populated ... std::set_intersection(s1.begin(), s1.end(), s2.begin(), s2.end(), std::inserter(out, out.end())); I've read inserts can be done in amortized constant time if the value being inserted to the...

How to get unique pairs of values from a stl set

I have a stl set of integers and I would like to iterate through all unique pairs of integer values, where by uniqueness I consider val1,val2 and val2,val1 to be the same and I should only see that combination once. I have written this in python where I use the index of a list (clusters): for i in range(len(clusters) - 1): for j in...

Fast hash for std::set<int> of two values?

I am using a std::set<int> for the key of a std map (std::unordered_map<std::Set<int>,float>). I need a hash for this set. The set will always be only two integers, whose values could be up to 2 million. Any ideas on a good and fast hash for such a key as performance is critical? ...

Jstree set_type

I'm binding a set_type method to my jstree instance, and then calling the set_type method when clicking a button. Here's my code: $("#treeDiv").jstree({..}).bind("set_type.jstree", function(e, data) { $.post( "./classes/jstree/_demo/server.php", { "operation" : "set_type",...