Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
92 views

In Postgres, you can set current_user by: set session_authorization = 'new_user'; and set role 'new_user'; While I like the shorter syntax, I'm asking if there is a difference in functionality ...
Code4R7's user avatar
  • 3,156
0 votes
4 answers
179 views

How can I create objects from a Set? const dupObj = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }, { id: 1, value: 'c' }]; const uniKeys = [...(new Set(dupObj.map(({ id }) => id)))]; // [ '1', '2' ]...
Run's user avatar
  • 57.7k
3 votes
2 answers
279 views

According to the Python documentation, set is a mutable unordered collection. Usually, it's implemented as a hash table that stores references to objects as its keys. Comparing to dict (which is also ...
SLebedev777's user avatar
8 votes
3 answers
1k views

I am trying to solve the problem posed in this question. Here the OP asks that given a 15 element set, its 2^15 element power set be generated in a manner such that the elements of the power set are ...
uran42's user avatar
  • 469
4 votes
2 answers
182 views

Let's say I have a box and there is a bunch of balls in that box. I can label each ball with a character while making sure no two balls get the same character as labels. I get a string this way. Let's ...
uran42's user avatar
  • 469
0 votes
3 answers
94 views

I'm learning Python coming from some beginner-level experience with Java. It all makes sense for the most part, but one of the exercises kind of made me wonder what actually happens within Python. ...
Lucas Durrant's user avatar
0 votes
2 answers
59 views

I'm working with the GAMSPy Python API and using Set objects to define sets in a GAMS model. I can define a set like this: from gamspy import Container, Set m = Container() regions = Set(m, name=&...
user30451554's user avatar
2 votes
3 answers
207 views

I want to write a computer programme that will do the following things : 1a. It will make an array 3 characters long. £££ 2a. It will then initialize the array with the string "{_}" and ...
uran42's user avatar
  • 469
1 vote
2 answers
75 views

Why the following code caused dead loop? const s = new Set([1]); s.forEach(e => { s.delete(e) s.add(e) }) I tried to change the order about delete and add operation,the dead loop ...
Turbo Zhang's user avatar
0 votes
2 answers
107 views

to clarify, it would be used like any(set()). I am asking for efficiency sake. Example: if any(fnmatch(a,b) for a in set) where a would be an item in a set and b would be a string.
arnoldpalmer's user avatar
5 votes
3 answers
289 views

Say I have a dictionary of sets like this: d = {'a': {1,2,8}, 'b': {3,1,2,6}, 'c': {0,4,1,2}, 'd': {9}, 'e': {2,5}, 'f': {4,8}, 'g': {0,9}, 'h': {7,2,3}, 'i': {5,6,3}, 'j': {4,6,8}} Each set ...
Shaun Han's user avatar
  • 2,965
0 votes
1 answer
55 views

I have a serious problem with an app. I have a selection box with types of services and other below with student names. Once selected the service, the students will be filtered to the ones that are ...
machsantos's user avatar
0 votes
0 answers
56 views

I'm looking for a way to extend the tFieldType with my own custom types. I've tried type pSetExtendedFieldTypes = (ftAlpha, ftAlphaNumeric, ftNumeric); pSetNativeFieldTypes = tFieldType; pSetDataTypes ...
user2383818's user avatar
0 votes
1 answer
142 views

in this code I think I have to write set /a counter=%counter%+1 but I just tried write it without %% and interestingly it works I don't how?! can anyone explain it @echo off setlocal ...
Mikel91's user avatar
  • 33
2 votes
3 answers
141 views

The C++ reference has this example for printing the intersection of two sets (or sorted containers): #include <algorithm> #include <iostream> #include <iterator> #include <vector&...
Michaël's user avatar
  • 579
-1 votes
1 answer
47 views

I am trying to set sublist value on suietelet in a client script. Getting error as: cannot read properties of undefined reading 0. Please advise Thank You! Below is client script sample. function ...
Maira S's user avatar
  • 121
1 vote
1 answer
58 views

Me and my colleagues have created around 14.000 copies of a certain workbook in the last 8 years or so. Pretty simple lightweight workbook, few userforms, some code, 2 sheets with a variable amount of ...
BenVenNL's user avatar
2 votes
4 answers
158 views

I've got a data type that consists of actual data and an id: struct Data { int value; int DataId; }; I've got a collection of these data from which I have to frequently get an element based ...
Oersted's user avatar
  • 3,904
2 votes
1 answer
139 views

I am trying to create a set having different values along with True, False, 1, 0. I am aware that Python treats 1 as True and 0 as False. Imperatively, since the set keeps only the unique values, my ...
Venkata's user avatar
  • 311
0 votes
0 answers
66 views

For my application, I need to track the number of duplicate transactions. Transactions are represented by a struct. type Transaction struct { items map[string]int date int } The struct ...
Alex A's user avatar
  • 376
2 votes
2 answers
113 views

I have two maps. One (A) is maps unique identifiers to allocated resources. The other (B) maps unique identifiers to resource prototypes. I would like to take the two maps and find the items that are ...
Steven's user avatar
  • 732
-5 votes
1 answer
120 views

What is this declaration? lists are declared using [ but these contain key-value pairs as seen with the use of {}. It's confusing. list with {} brackets with a pair of two items forming one. players = ...
MEHUL_PATEL's user avatar
1 vote
1 answer
69 views

I'm designing an ontology for app users in Protégé, and I need advice on how to properly model intermediate "container". Suppose you have an User with multiple contact details (e.g., ...
Adelina Vivaldo's user avatar
1 vote
1 answer
101 views

I'm debugging a program I'm not at all familiar with in Visual Studio 2022. I am trying to see the value which goes into the NumeroProjet property. In order to do this, I have put the set; on a new ...
Dominique's user avatar
  • 17.7k
1 vote
0 answers
693 views

I'm building a new server, and thought, its 2025 and probably good time to migrate from iptables, ipset... to nftables. earlier or later it has to happen any way, right? # uname -a Linux starnet 6.12....
Vaidas M's user avatar
0 votes
0 answers
56 views

The value defined by c:set refers to a var (name of the iterator variable used to refer each data), but the column values are not displayed. How should it be defined to be displayed correctly? <c:...
Andrew Churchill's user avatar
-1 votes
2 answers
86 views

I have been using batch for a while but not an expert of it. I recently wrote a piece of code to do the following thing: Get a date input from the command line. If its format is like 20200102, it is ...
DBZHOU's user avatar
  • 195
-1 votes
2 answers
155 views

You can insert an item into std::set but if there already exists an equivalent item, it won't override. You can also first remove the equivalent item from std::set and then insert the item you want to ...
Leon's user avatar
  • 1
0 votes
0 answers
40 views

I have a class like this class Point { private: int x; int y; public: Point() = default; Point(int x_arg, int y_arg):x(x_arg), y(y_arg) {}; bool operator<(const Point& ...
Baron Yugovich's user avatar
5 votes
5 answers
326 views

I marked my answer as the answer because it is the one that is doing what I was wanting and anyone wanting to do the same thing should start there. But I would love to see a better answer (order of ...
smichr's user avatar
  • 19.6k
4 votes
1 answer
115 views

Stream<String> stream = Stream.of("w", "o", "l", "f").parallel(); Set<String> set = stream.collect(TreeSet::new, Set::add, Set::...
sjk's user avatar
  • 41
4 votes
1 answer
177 views

I have a string like such: {a="foo", b="bar", c=12345} (imported & read from a file) How do I convert this into a table/set with those contents? Or how can I save tables/sets ...
Larix Duk's user avatar
-4 votes
1 answer
92 views

So I am currently making a word game, and I want to have it so that the user cannot enter a word that is wholly contained within another word (e.g. 'set' in 'subset'), however my current code: noWord =...
Daniel's user avatar
  • 1
0 votes
0 answers
70 views

I am trying to verify the following lemma in dafny: ghost predicate noD(s: seq<nat>) { forall i :: 0<=i <|s| ==> !(exists j :: 0<=j< |s| && i!=j && s[i]==s[j]) ...
Markel Barrena's user avatar
3 votes
1 answer
211 views

There are many similar questions about this, but usages have been changing; this is the only question I've found that talks specifically about MutableSets, MutableStateFlows, and collectAsState(). The ...
SMBiggs's user avatar
  • 11.8k
0 votes
1 answer
48 views

I'm trying to remap primary keys between versioned data and code releases with as small a diff as possible. I have a list of elements, e.g. [a,b,c,...,j], and some deterministic process that assigns ...
molsonite's user avatar
0 votes
0 answers
56 views

So I'm working XML files and am not quite sure if what I'm doing is 'Pythonic' enough. The XML file has tagged text and I want to get all paragraphs that contain countries and rivers. So each ...
Yuirike's user avatar
  • 41
-2 votes
1 answer
88 views

I have a Class B defined as below --> Class B { private List<String> obj1; private List<A> obj2; // Need to implement hashcode() and equals() methods } In my code, I am using ...
rishi007bansod's user avatar
0 votes
1 answer
100 views

Determining a combination of selections from a list of sets that would yield the maximum number of unique numbers Consider an array of sets, with each set containing an arbitrary number of integers. A ...
C Ho's user avatar
  • 1
2 votes
3 answers
160 views

I want to compare sets in a match expression in Python. So imagine you want to compare multiple variables but they do not have any order. They only have to include the same values as a whole. In this ...
Ichwerdennauchsonst's user avatar
0 votes
0 answers
72 views

Our sample set is given as {-1,1.5,2,2.5}. b = from "outcome" value to outcome(index100) value. There is a problem that outcome(1) cannot be equal to a matrix value. Hence I set "...
Peiman Ghasemi's user avatar
3 votes
3 answers
176 views

I have a list of (lots of) coordinates. coordinateList = [[1,2], [2,1], [3,5]]; These coordinates are unique and since I have a lot of them I want to be able to quickly check if a new coordinate is ...
Cincinnatus's user avatar
-1 votes
1 answer
87 views

Compare $string and "$string": string="xx yy zz" if [[ $string == "$string" ]]; then echo "Strings are equal." else echo "Strings are not equal.&...
showkey's user avatar
  • 381
0 votes
5 answers
155 views

The issue in question relates to human readability and data organization. I would like to assign getters and setters as children of class field properties, however I can't get this to reference the ...
Unchained Light's user avatar
0 votes
1 answer
90 views

I am checking to see if a tuple of unordered values is already in another list. I am new to Python, and so have not used sets much, but am a heavy pandas user and so was thrilled to find this question ...
plotmaster473's user avatar
0 votes
1 answer
100 views

I'm working on a little math-based programming language (written in Rust) that uses sets instead of types. In it, a variable or value belongs to a set of values (eg. x : {1, 2, 3} or msg : Str). The ...
Apuji's user avatar
  • 5
1 vote
0 answers
51 views

I have an application where I (heuristically) create a large set of test candidates, which are themselves large sets of elements in no particular order. In order to not use the same test candidate ...
cero's user avatar
  • 170
-1 votes
1 answer
37 views

how to create a Joi validation to check a Set type? my object does contains a field with a new Set([]) type, but using Joi.array().unique throws an error when validating. const data = { name: "...
Amiel Hussien Dagadas's user avatar
0 votes
0 answers
70 views

I'm attempting to add an indexed set to a constraint, and Pyomo returns Cannot apply a Set operator to an indexed Set component (td) import pyomo.environ as pyo from pyomo.opt import SolverFactory td ...
dschon's user avatar
  • 1
-3 votes
3 answers
2k views

Given an integer array nums sorted in non-decreasing order, remove the duplicates in-place such that each unique element appears only once. The relative order of the elements should be kept the same. ...
Yash Kumar Roy's user avatar

1
2 3 4 5
243