Questions tagged [negate]
84 questions
0
votes
3 answers
negating levels for fct_collapse
I have a smaller list of levels that should not be collapsed ("Alberta", "British Columbia", "Ontario", "Quebec") than the ones that should (all else). I haven't been able to negate the levels (code as example of the goal) for fct_collapse (all but…

ibm
- 744
- 7
- 14
0
votes
1 answer
Shell alias input search syntax for a negated find search
Mac OSX Bash Shell
I want to use find to identify anything (directories or files) which do not follow an input pattern.
This works fine:
find . -path /Users/Me/Library -prune -o \! \( -path '*.jpg' \)
However I want to have a general ability to…

Richard L
- 99
- 1
- 6
0
votes
0 answers
TextPad regular expression negation with a min/max
In TextPad I am trying to find any line that does not start with a 6 or 7 digit number. So it should find all lines that do not look like:
"123456" or "1234567"
I wrote this expression:
^[^(\d{6,7})]
It is not finding lines that start with only 2…

Sam Brown
- 3
- 4
0
votes
1 answer
PHP - nagate callback result
Is there any way to negate result of callback?
$this->myInjectedService->doSomething([$this, 'myCallback']);
I need to nagate result of myCallback method. I know I can do it by nested function, but is there any more clean way (exclamation…

MakoBuk
- 622
- 1
- 10
- 19
0
votes
2 answers
How to replace values in df that are NOT fulfilling condition
I am trying to clean my data and can't find a way to replace values that are not according to my conditions like in the following example:
df1<- data.frame(
A=c("a","b","c"),
Ch=c("c1","xyz","c2"),
val=paste0("x",1:3), stringsAsFactors =…

antonina
- 109
- 8
0
votes
1 answer
Assembly negation in msp430
I have the following versions of negating some integer value (in R12) in assembly in msp430 :
inv R12
inc R12
this is according to the manual and I think this will work the same?
inv R12
add #1, R12
But will this work and why not? :
sub #1,…

user8756425
- 31
- 5
0
votes
0 answers
Scheme altering tree values
I receive a tree and suppose to output the same tree with the values negated: 1 becomes -1, -2 becomes 2, #t becomes #f and the opposite way.
The tree is flexible - each can have multiple sons, one or none.
I'm not allowed to add user-defined helper…

Adam Morad
- 167
- 1
- 7
0
votes
0 answers
How to use negate function with balanced ternary numbers?
I've been trying to convert balanced ternary numbers through the negate function in python
def convert_to_balanced_ternary(n):
if n == 0:
return '0'
negative = n < 0
bt = ''
while n > 0:
r = n % 3
if r == 0:
bt = '0' + bt
…

Mr Mister
- 1
- 1
0
votes
1 answer
Regex to remove all except XML
I need help with a Regex for notepad++ to match all but XML
The regex I'm using:
(!?\<.*\>) <-- I want the opposite of this (in first three lines)
The example code:
[20173003] This text is what I want to delete…

ScaZ
- 41
- 8
0
votes
1 answer
bitwise negate and bitwise XOR 1 not equivalent?
My discrete math tells me that negate every bit of a binary number is equivalent to XOR it with 1. That is:
~1010 === 0101
1010 XOR 111 = 0101
But this doesn't hold in javascript:
~123 === -124
123 ^ 1 === 122
Why?

Boyang
- 2,520
- 5
- 31
- 49
0
votes
2 answers
Automating process to multiply values in tab delimited file by -1 to negate them
I've been manually processing a large amount of files in Excel. I've done some searching but haven't found a definitive best practice as to how I can achieve this process in an automated fashion.
My manual process is as follows:
I have a .tab…

UnladenSwallow
- 23
- 3
0
votes
4 answers
Is there a difference between -x vs x * -1.0f?
In java, is there a difference between negating a variable vs multiplying a variable by a float minus one, if the variable is also a float?

Marek Krzeminski
- 1,308
- 3
- 15
- 40
0
votes
2 answers
Turn on leftmost bit of a Short
Original question changed.
I want to bitwise turn off the left most bit of a Short value (&H8000) and leave the other bits as they are.
Dim x = BitConverter.GetBytes(Short.MaxValue Or &H8000)
Dim z = BitConverter.ToInt16(x, 0)
Isn't there any…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
0
votes
2 answers
Python text search library
I am looking for a library that would let me do something like the following:
matches(
user_input="hello world how are you what are you doing",
keywords='+world -tigers "how are" -"bye bye"'
)
Basically I want it to match strings based on…

ipartola
- 1,612
- 3
- 15
- 25
0
votes
1 answer
Regex and jquery validate. Negate expression
I'm working on a addition method for the jquery validate plugin which must detect if 3 or more consecutive identical characters are entered, and prompt a message.
To do so I need to negate a regex expression. This is my…

Adorablepolak
- 157
- 4
- 16