Questions tagged [set]

-1

votes
2

answer
21

Views

How to fix HashSet that allows duplicates?

I'm using a java.util.Set interface with a java.util.HashSet implementation and storing it in a Map. I add an object to a Set then retrieve the Set object again and am able to add another object that is equal to the first. When adding the seemingly equal objects, Set.add returns true and two equal...
Silo2017
1

votes
2

answer
2.4k

Views

Python sets: difference() vs symmetric_difference()

What is the difference between difference() and symmetric_difference() methods in python sets?
Anja
1

votes
1

answer
77

Views

How to check if a subset is included into a set? [duplicate]

This question already has an answer here: How to compare sets of enumerated types 2 answers I have two set type variables and I need to check if the first is a subset of the second one. type TMyValue = (mvOne, mvTwo, mvThree); TMyValues = set of TMyValue; ... var V1 : TMyValues; V2 : TMyValues; beg...
Fabrizio
1

votes
4

answer
60

Views

How to create a dictionary to reverse lookup list items that each have sets?

I have test names in a list like this in Python v2.7: all_tests = ['test1', 'test2', 'test3', ..., 'testN'] And for each test name, I can lookup a set of properties that the test has: series['test'] = {'prop1', 'prop2', 'prop3', ..., 'propN'} E.g., series['test1'] = {'yellow', 'blue', 'orange'} seri...
WilliamKF
1

votes
2

answer
85

Views

Cannot compile unordered_set contains function from cppreference.com

I feel like this would only happen to me but here is an oddity I found when I was looking up the contains function for unordered_set. Here is the link where I tried to run the example below here This seems quite odd to me that contains() does not exist yet it does? I get the same error on my compile...
Wolfy
1

votes
2

answer
39

Views

SQL query: how to check existence of *multiple* rows and columns with one query

Given the following table: SET VAL1 VAL2 ----------------- 1 a a1 1 b b1 1 c c1 2 d d2 2 e e2 Is it possible to create a query which identifies a subset of rows with particular values for columns VAL1 and VAL2 and identical values in column S...
Macilias
1

votes
2

answer
62

Views

How can I remove an item from a set in C++ without deleting it?

Using std::set in C++, the only way I can find to remove an item from a set is to use the erase method. This deletes the item in question, which I don't want to happen. The only way I can think of to remove an item from a set without deleting it would be to create a new set and add all the items of...
skrooms
1

votes
3

answer
39

Views

How to make a function that takes two sets with strings that returns the equivalent values? (Javascript)

//EDIT: I'm using Codehs for this problem and it doesn't use filter or has' function start(){ var gifts = ['book','car']; var presents = ['game','book']; var tim = new Set(); var sally = new Set(); tim.add(gifts); sally.add(presents); var ans = compare(tim,sally); println(ans); //should print in...
Harry
1

votes
1

answer
64

Views

Algorithm to aggregate key-value pairs where keys contain numbers

I will try my best to give a complete problem definition. To illustrate the problem I will give an example later on in my question. You might want to jump to the example first and read my problem definition afterwards. The problem I have got a map representing key value pairs. The keys may end with...
Anticom
1

votes
2

answer
20

Views

How to Convert Dictionary Values to sets of Dictionaries

I am trying to solve some graph problems but i am stuck halfway. I have a python dictionary of sets, but i will like to convert the original dictionary values (which are sets) into a dictionary such that each value in the set becomes a key which would have another value of 1. I think this is what is...
vic
-1

votes
3

answer
43

Views

Finding the intersection of two circles

I'm trying to find the intersections between two circles in Python(using Matplotlib) but can't get any values back. I'm doing this by creating lists of X's and Y's for each individual circle(Matplotlib takes the first argument as X values and the second one as Y values when drawing a circle), and t...
dawed1999
1

votes
1

answer
270

Views

How to get item count of a CharacterSet in Swift

When I use the following Swift code in Xcode's 9.4 playground: let charSet = CharacterSet(charactersIn: 'woord') print('charSet=\(charSet)') I can see that charSet contains 4 unique items from the Xcode-playground output: charSet= Does anybody know how I can use something like charSet.count to give...
iOS-Coder
1

votes
2

answer
557

Views

BGE Instruction ARM

This test asks to branch under the condition 'BGE' branch to a label. The values stored in my registers being compared are: LDR r0,=0X3 LDR r1,=0X8F CMP r0,r1 BGE a_label SUBS r1,r1, #0XC9 I expected it to branch but somehow 0X8F isn't greater than 0X3. Emulating my code on Keil proves this. Im wond...
MangoKitty
1

votes
2

answer
55

Views

Python hash with if cases

I have a question regarding the hash(self) function of Python. So in my method I have the following code pieces def __init__(self, upper1, lower1, upper2, lower2): self.phase = 1 self.gammas = frozenset() self.gammabars = frozenset() def __hash__(self): if self.gammas: return hash(self.gammas) elif...
Armani42
1

votes
2

answer
56

Views

ArrayList: How to arraylist.set when you have multiple setters

I currently have 2 classes. My bot: public class Bot { private int X; private int Y; private int degress; public int getX() { return X; } public int getY() { return Y; } public int getDegress() { return degress; } public void setX(int X) { this.X = X; } public void setY(int Y) { this.Y = Y; } } and...
Kappa Coder
1

votes
1

answer
36

Views

Is here simple way to convert Set into Array? [duplicate]

This question already has an answer here: How to convert Set to Array? 7 answers I tried: const state = new Set( [5, 10, 15, 20, 30, 45, 60] ); let preset = Object.assign( {}, state ); console.log(preset) // {} and got empty object. Also I tried to convert state to string and also failed: state.va...
Max Kurtz
1

votes
1

answer
74

Views

Why does dictionary take less time than set in python?

Both dictionary and sets are implemented as hash tables in Python and have an insertion time and lookup time of O(1). I am writing a program to count if the string consists of all unique characters and I am using a set to keep a track of all the characters seen so far. What I observe is if I use a d...
siddharth
1

votes
1

answer
78

Views

How to get the complementary values for a Delphi sets type variable?

Starting from a set type variable like TAnchors: TAnchorKind = (akLeft, akTop, akRight, akBottom); TAnchors = set of TAnchorKind; I'm trying to get the complementary values. var Tmp : TAnchors; begin Tmp := [akLeft]; ... end; I'm expecting to get all values of TAnchors which are not in the Tmp varia...
Fabrizio
1

votes
4

answer
97

Views

How to perform case insensitive lookup in javascript set?

How to perform case-insensitve lookup in javascript's set? I have a situation where I have a set of allowed strings which doesn't ensure what case they would be in. I need to validate a user input against that set. How can I achieve this? const countries = new Set(); countries.add('USA'); countries....
NoSaidTheCompiler
1

votes
2

answer
33

Views

Why does my Union procedure of set A and set B return set A and nothing else?

I am working on SICP exercise 2.59, which asks the reader to 'implement the union-set operation for the unordered-list representation of sets'. The union of two sets - denoted by A∪B - is the set of elements which are in A, in B, or in both A and B. Here is the code I wrote to perform this oper...
Jodast
1

votes
2

answer
68

Views

When to check if item already exists in C++ set/map?

I have a general question regarding set, unordered_set, map, unordered_map in C++ STL. I often see code that checks if an item is already in a set/map before attempting to alter its value. I was wondering, when is it advisable to manually check if an item already exists in the set/map before attempt...
Timothy Huang
1

votes
2

answer
2.4k

Views

Convert a sequence of dictionary keys to a set

The following code lists the set of keys found in a dictionary sequence (each dict is basically a row from a database). (I want to convert the keys to a set so I can compare 2 db tables) for seqitem in tblseq do let keyset = seqitem.Keys |> Set.ofSeq // works correctly printfn '>>> List: %A; Ite...
BrendanC
1

votes
2

answer
297

Views

Set process title in visual studio attach to process c#

I want to set the process title of my console application in the attach to process dialog of visual studio. I tried to set the assembly name, process description, etc.. but it didn't work. How can I achieve this in C#?
Antoine Lafarge
1

votes
0

answer
47

Views

yii2 doesnt set cookies when calling render method

I try to set cookie with this action in a yii2 controller: public function actionContact() { $cookie = new Cookie([ 'name' => 'test_name', 'value' => 'test_value' ]); Yii::$app->getResponse()->getCookies()->add($cookie); return $this->render('contact'); } But it doesnt work like this. Meanwhile if I...
varpet
1

votes
1

answer
83

Views

Is it possible to create a project documentset using graph API?

So far I haven't been able to find any information on how to create project documentsets on my Sharepoint environment using the Graph API. I've tried both Sharepoint's 'Create item' and OneDrive's 'Create Folder'. The Sharepoint API says: 'Files and folders should only be added to a DocumentLibrary...
Willem van Zantvoort
1

votes
2

answer
237

Views

Azure VMSS with Powershell DSC disabled TLS 1.0 cannot download script

I have a DSC script that configures a VMSS on Azure. Part of the script disables TLS1.0 and TLS1.1 client and server roles. After disabling, the VMSS cannot download the DSC script in the zip file anymore. Says it timed out after 29 attempts. If I enable the TLS protocols, it works again. Is the...
MPavlak
1

votes
0

answer
43

Views

How to calculate set intersection of items between large number of users in a NoSQL database?

I am facing an efficiency problem trying to calculate set intersection of items between different users. Let's say that a user, called Bob, owns different items he would like to trade with other items other users own. Bob has an inventory and a wishlist. Now if Bob wants to obtain an item, say item...
Badie
1

votes
0

answer
394

Views

C++ error: request for member … which is of non-class type

I've tried looking at other similar questions, but they all seem to contain answers regarding a feature of c11 I'm using. When running the following code I get the error: error: request for member 'current' in '((mtm::MtmSet)this)->mtm::MtmSet::it.mtm::MtmSet::iterator::operator->()', which is of no...
Osmosis Johns
1

votes
1

answer
51

Views

Can you have SLA on an azure worker role with one instance?

From what I know MS Azure guarantees SLA 99.95% for worker role when there is more than one instance (https://azure.microsoft.com/en-us/support/legal/sla/cloud-services/v1_5/). However I also do know that SLA 99.9% is guaranteed for a single VM in case it uses premium storage (https://azure.microsof...
csg
1

votes
2

answer
87

Views

Assigning a std::set to a 2D std::vector of ints

I'm trying to make a integer Matrix with no numbers repeated and its elements sorted so I was making it with a std::vector but then, searching on internet and Stackoverflow, I've found something called std:set which I see is a container and it has just the 2 properties I'm looking for: no repeated e...
Megasa3
1

votes
1

answer
28

Views

Wierd problems when insert Chines characters into MySQL via Windows cmd

My Envirionment System: Windows 7 64-bit Database: MySQL 5.7.20 64-bit Locale: Chinese cmd code page: CP936 MySQL setting system variables: enter image description here table info: enter image description here My Problem Under the environment and db setting described above, I tried to insert an reco...
shawnwinder
1

votes
0

answer
243

Views

VBA Set Workbook does not assign correctly when workbook is already open

This might turn out to be a beginners question, I think I am missing something basic here. The user selects different Excel-files, which names are stored in the String array fileNames. The macro is then meant to crawl through the selected files and translate a specific worksheet to XML. Application....
cr44sh
1

votes
1

answer
233

Views

MongoDB replica set on windows facing some basic issues

I am on Windows 10 Environment. I would like to Implement Replica Set on MongoDB. I am facing some issues.. For that, I cover almost many tutorials to implement the things on Windows Machine. I want to create a replica set consisting of a primary node and another node, which will be replicating the...
Abhay
1

votes
0

answer
160

Views

C++ set wants an initializer_list when I try to add a single number

I have a problem that would seem not a lot of people run into. I'm not sure if it's blatantly obvious what to do and I'm not getting it, or I am writing something wrong. I'm using Windows 10, Android Studio. my code segment looks like this. vector vpLatSortedNodes; vector vpLonSortedNodes; //The ab...
Johnk
1

votes
1

answer
35

Views

Python 3.5 For loop Set help return method

I am new to python and I need some help. I have experience with C/C++ but not python. I just need some help. I do not understand what this lines are doing. S = {-4 , 4 ,-3 , 3, -2 , 2, -1, 1, 0}; {x for x in S if x >= 0} I know S is a set. I know we are looping through set S but what I dont undersat...
lauro199471
1

votes
1

answer
89

Views

Efficiently storing & querying integer arrays in SQLite

I have a hybrid Cordova Android mobile app which records user activity in a SQLite database. Each row entry has columns that help characterize the nature of the activity. One such column records three sub-activities on different days of the week which I represent as an integer array [0..6,7..13,14...
DroidOS
1

votes
0

answer
113

Views

Pushing imm32 ends up in pushing imm64? [duplicate]

This question already has an answer here: How many bytes does the push instruction push onto the stack when I don't specify the operand size? 2 answers push on 64bit intel osx 4 answers From the intel instruction reference: 68 id PUSH imm32 It means pushing dword-sized immediates is valid in 64-bi...
St.Antario
1

votes
1

answer
67

Views

Migrating mongodb cluster - reelections

Consider you have to move your mongo cluster from one environment to another, with minimal downtime during the process. Let's say you have environment 1 (i.e AWS), with the following mongo nodes: mongo_aws_1 mongo_aws_2 mongo_aws_3 Your application is configured to talk to mongo_aws_1, 2, 3, with h...
slnowak
1

votes
1

answer
61

Views

How to lambdify an Intersection

I am inverting a function with the invert_real from sympy.solvers.solveset, because neither solve nor solveset can do it for some reason. The result is an Intersection and seems to be correct. I now want to use it for numeric calculations. When I try it with .subs it works fine, but when I try to l...
Noldi
1

votes
0

answer
218

Views

inserting text inside a node katalon

I am trying to insert a text inside a P tag dynamically. WebUI.waitForElementPresent(findTestObject('Page_Mthode Swing - EidosMedia QA_m (1)/span_Insert Headline Here'), 10) WebUI.setText(findTestObject('Page_Mthode Swing - EidosMedia QA_m (1)/span_Insert Headline Here'), 'Testing Katalon') span_Ins...
user3096670

View additional questions