FAQ Database Discussion Community


python splitting string twice

python,string,split,pair
i'm trying to split a string twice with the goal of converting a>b where b contains numbers and is split into multiple x/y pairs a = '{1;5}{2;7}{3;9}{4;8}' b = [[1,5],[2,7],[3,9],[4,8]] my code is currently this... b = a.split('}{') for item in b: item.replace('{','') item.replace('}','') item.split(';') the first split works correctly...

using vector of pairs with user-defined class objects

c++,class,vector,pair,user-defined-types
I'm trying to write a board game playing program (in C++). I have 2 classes called Move and Board. In my Board constructor, I am using a pair<char, Move>. It seems like it is not recognizing the class Move, even though I #include it in the header file. I get...

Setting array key value pair JavaScript

javascript,arrays,key,value,pair
So, I am having an issue and for the life of me I cannot seem to resolve it. It seems very basic, but I just cannot understand for the life of me why this code is not working. My issue is, I am assigning a key value pair to an...

How to pair rows by status (someone entered and then exited) in mysql

mysql,rows,procedure,pair
I have a table user_status, where I insert rows: who, status (Entered/Exited), what time. Table looks like this: id user_id status status_date 94 5 Entered 2015-03-30 10:43:44 95 5 Exited 2015-03-30 10:47:38 96 5 Entered 2015-03-30 10:49:12 97 3 Entered 2015-03-30 10:51:14 98 3 Exited 2015-03-30 11:04:12 99 5 Exited...

list file key-pair sorted by time

linux,bash,sorting,ls,pair
I need to sort a filename pair sorted by time. Every file starts with AUSZUG or UMSATZ (and some numbers after). But the problem is that I cannot sort it by just time because some files can be uploaded (created) not as pair. For example, default sort: ls -ltr --time-style...

filtering based on the last two current values in java rx

java,filter,reactive-programming,pair
I'm trying to build a simple application using java reactive extensions. I have two streams that emits temperature values continuously, I want to detect and filter out spikes of sensed temperature that could be errors, for doing so I need to take account of the precedent value too so that...

Java Cannot implement a function in Map ADT interface that takes Pair class as its generic parameter

java,generics,dictionary,interface,pair
I created a map interface that has the generic function entries(). // return iterable collection of all the key-value entries in the map public ArrayList<Pair<KeyType, ValueType>> entries(); The problem is, when I try to implement the interface I get this error in the interface file at the entries() function: Bound...