set

Question about gets and sets and when to use super classes

Hi, I have the following get method: public List<PersonalMessage> getMessagesList() { List<PersonalMessage> newList = new ArrayList<PersonalMessage>(); for(PersonalMessage pMessage : this.listMessages) { newList.add(pMessage.clone()); } return newList; } And you can see that if I need to change the implement...

Merging Bit, Enum and Set fields in MySql

I know up to eight Bit fields are merged into one byte to save space, but what if I have a couple of Bit fields and an Enum or a Set field? Are they internally merged too? I'm asking because I'm going to have a lot of rows in my table and I want to avoid overhead as much as possible. ...

How to expose a Delphi set type via Soap

I'm currently creating soap wrappers for some Delphi functions so that we can easily use them from PHP, C# and Delphi. I wonder what's the best way to expose sets. type TCountry = (countryUnknown,countryNL,countryD,countryB,countryS,countryFIN,countryF,countryE,countryP,countryPl,countryL); TCountrySet = set of TCountry; func...

How can I combine pairs of elements from a std::set?

I have a set<string> from "one", "two", and "three". How can I get all pairs from it? one - two one - three two - three ...

Help With LINQ: Mixed Joins and Specifying Default Values

I am trying to figure out how to do a mixed-join in LINQ with specific access to 2 LINQ objects. Here is an example of how the actual TSQL query might look: SELECT * FROM [User] AS [a] INNER JOIN [GroupUser] AS [b] ON [a].[UserID] = [b].[UserID] INNER JOIN [Group] AS [c] ON [b].[GroupID] = [c].[GroupID] LEFT JOIN [GroupEn...

set / line intersection solution

I have two lists in python and I want to know if they intersect at the same index. Is there a mathematical way of solving this? For example if I have [9,8,7,6,5] and [3,4,5,6,7] I'd like a simple and efficient formula/algorithm that finds that at index 3 they intersect. I know I could do a search just wondering if there is a better wa...

Efficient way to find node set having relationships to given nodes using neo4j

Is there an efficient way with given two nodes to find a set of their common nodes (with defined relationships). For example, having nodes A1, B1, C1-C4 connected with relationships x and y: A1 --x--> C1 A1 --x--> C2 A1 --x--> C3 B1 --y--> C2 B1 --y--> C3 B1 --y--> C4 a common node set for A1(x) and B1(y) would be [C2, C3]. ...

Java - Make an object collection friendly

If an object holds a unique primary key, what interfaces does it need to implement in order to be collection friendly especially in terms of being efficiently sortable, hashable, etc...? If the primary key is a string, how are these interfaces best implemented? Thanks! ...

Java - Is Set.contains() broken on OpenJDK 6?

Hey, I've come across a really strange problem. I have written a simple Deck class which represents a standard 52 card deck of playing cards. The class has a method missingCards() which returns the set of all cards which have been drawn from the deck. If I try and compare two identical sets of missing cards using .equals() I'm told they...

how to set the name of the node using userobjects

How to set the node text.Here is the code am using public TreeCreation(final ArrayList houseList){ Apartment= new DefaultMutableTreeNode("Apartment"); for(int i=0;i by passing the userObject the name of the object is being displayed on the node ,how do i change the code to display h.HouseName when am using userObjects node.getUserO...

Datatype equivalent to SET in a database?

I want to use a SET datatype for my databse. So that a field of that type can contain one or more values from that data type. But I have following two questions: Q1. Is SET is correct to use as a datatype in a database? I think that its not supported by all the databases. Q2. If SET is not a good option, then what can I use in place o...

Is an iteration on a F# map or set in-order traversal?

AFAIK, F# Map and set are implemented as red-black trees, so I guess that an iteration on these would be in-order traversal. I did some test and the iteration results are always sorted. But I want to make it sure. Is it in-order traversal? ...

Java - Why does Map.put() overwrite while Set.add() does not?

I am wondering what the rationale is behind having Java's Map.put(key, value) method overwrite equivalently key'd values that are already in the collection, while Set.add(value) does not overwrite a pre-existing equivalent value that is already in the collection? Edit: It looks like majority viewpoint is that objects in a set that eval...

Set value of hidden field in a form using jQuery's ".val()" doesn't work !

I've been trying to set the value of a hidden field in a form using jQuery, but without success. Here is a sample code that explains the problem. If I keep the input type to "text", it works without any trouble. But, changing the input type to "hidden", doesn't work ! <html> <head> <script type="text/javascript" src="jquery.js"></scri...

Generate set/get methods for a c++ class

Is there any tool that generates set and get methods for a class automatically. Just I create classes very frequently and would like to have a tool which for each class-member wil generate the following functions automatically: Member_Type getMemberName() const; //in header file Member_Type getMemberName() const //in source file { ...

alternative to check, whether a value is in a set

Hi All, I have the following code. It looks ugly, if the value equals to one of the following value then do something. var Value: Word; begin Value := 30000; if (Value = 30000) or (Value = 40000) or (Value = 1) then do_something; end; I want to refactor the code as follows: var Value: Word; begin Value := 30000; if (...

Java: change an element in a prepopulated List of string array.

I have a List of string array already populated in storeInv. How do i change a specific element in the string array? For example the code below... Thanks =] List <String[]> storeInv ; //assume already populated with elements String[] store = storeInv.get(5); store[1] = 123; store.set(5, store[1]); //this gives me an error. ...

Compare List/set elements

I'm looking to compare two sets and display the missing elements in second set by iterating over the first set. I've done using lists but it seems like an overhead iterating over the unordered list to find the elements. #include <iostream> #include <list> using std::list; bool isExist(list <int> &original, int i) { list <int>::iterat...

java: retrieving the "canonical value" from a Set<T> where T has a custom equals()

I have a class Foo which overrides equals() and hashCode() properly. I would like to also would like to use a HashSet<Foo> to keep track of "canonical values" e.g. I have a class that I would like to write like this, so that if I have two separate objects that are equivalent I can coalesce them into references to the same object: class...

Tkinter Spinbox Widget

How do I do a command that will set the default value on a Tkinter spinbox widget? For some reason they didn't give it the attribute .set() ...