negate

Automating process to multiply values in tab delimited file by -1 to negate them

淺唱寂寞╮ 提交于 2019-12-04 06:03:13
问题 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 (Tab-delimited) file. There are a total of 8 "columns" for each row. I need to negate the numerical values in the last 5 columns of every row. What I've been doing Open the file in Excel Type a -1 in any blank cell. Copy it Highlight the data in the last

Prolog implying a negative predicate

旧时模样 提交于 2019-12-02 20:58:08
How can I write the following rule in PROLOG: if P then not Q I understand that you can easily write if P then Q the predicates like q(X) :- p(X) , but how can you negate the q/1 predicate? I don't want to define new predicates with other semantics like non_q/1 . hardmath The clause "if P then not Q" is logically equivalent to the negative clause "not P OR not Q". As such it is a Horn clause without a positive literal, and as an application of the correspondence of SLD theorem proving and Horn clauses, can be represented in Prolog programming as a goal clause or "query": ?- P, Q. Let's come

Automating process to multiply values in tab delimited file by -1 to negate them

为君一笑 提交于 2019-12-02 07:44:39
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 (Tab-delimited) file. There are a total of 8 "columns" for each row. I need to negate the numerical values in the last 5 columns of every row. What I've been doing Open the file in Excel Type a -1 in any blank cell. Copy it Highlight the data in the last 5 columns → right-click → Paste Special → Multiply → Enter Then save the file. I'm not sure if the

Javascript regexp - only if first character is not an asterisk

≯℡__Kan透↙ 提交于 2019-11-30 23:46:08
问题 I am using a javascript validator which will let me build custom validation based on regexp From their website: regexp=^[A-Za-z]{1,20}$ allow up to 20 alphabetic characters. This will return an error if the entered data in the input field is outside this scope. What I need is the string that will trigger an error for the inputfield if the value has an asterix as the first character. I can make it trigger the opposite (an error if the first character is NOT an asterix) with: regexp=[\u002A]

python how to “negate” value : if true return false, if false return true

拜拜、爱过 提交于 2019-11-29 05:24:40
if myval == 0: nyval=1 if myval == 1: nyval=0 Is there a better way to do a toggle in python, like a nyvalue = not myval ? Use the not boolean operator : nyval = not myval not returns a boolean value ( True or False ): >>> not 1 False >>> not 0 True If you must have an integer, cast it back: nyval = int(not myval) However, the python bool type is a subclass of int , so this may not be needed: >>> int(not 0) 1 >>> int(not 1) 0 >>> not 0 == 1 True >>> not 1 == 0 True In python, not is a boolean operator which gets the opposite of a value: >>> myval = 0 >>> nyvalue = not myval >>> nyvalue True >>

SQL WHERE condition, not equal to?

陌路散爱 提交于 2019-11-28 17:21:14
Is it possible to negate a where clause? e.g. DELETE * FROM table WHERE id != 2; You can do like this DELETE FROM table WHERE id NOT IN ( 2 ) OR DELETE FROM table WHERE id <> 2 As @Frank Schmitt noted, you might want to be careful about the NULL values too. If you want to delete everything which is not 2 (including the NULLs) then add OR id IS NULL to the WHERE clause. Your question was already answered by the other posters, I'd just like to point out that delete from table where id <> 2 (or variants thereof, not id = 2 etc) will not delete rows where id is NULL. If you also want to delete

How do I negate a test with regular expressions in a bash script?

微笑、不失礼 提交于 2019-11-28 16:16:02
Using GNU bash (version 4.0.35(1)-release (x86_64-suse-linux-gnu), I would like to negate a test with Regular Expressions. For example, I would like to conditionally add a path to the PATH variable, if the path is not already there, as in: TEMP=/mnt/silo/bin if [[ ${PATH} =~ ${TEMP} ]] ; then PATH=$PATH; else PATH=$PATH:$TEMP; fi TEMP=/mnt/silo/Scripts: if [[ ${PATH} =~ ${TEMP} ]] ; then PATH=$PATH; else PATH=$PATH:$TEMP; fi TEMP=/mnt/silo/local/bin if [[ ${PATH} =~ ${TEMP} ]] ; then PATH=$PATH; else PATH=$PATH:$TEMP; fi export PATH I'm sure there are a million ways to do this, but what I

python how to “negate” value : if true return false, if false return true

廉价感情. 提交于 2019-11-27 15:28:15
问题 if myval == 0: nyval=1 if myval == 1: nyval=0 Is there a better way to do a toggle in python, like a nyvalue = not myval ? 回答1: Use the not boolean operator: nyval = not myval not returns a boolean value ( True or False ): >>> not 1 False >>> not 0 True If you must have an integer, cast it back: nyval = int(not myval) However, the python bool type is a subclass of int , so this may not be needed: >>> int(not 0) 1 >>> int(not 1) 0 >>> not 0 == 1 True >>> not 1 == 0 True 回答2: In python, not is

How can I negate the return-value of a process?

梦想的初衷 提交于 2019-11-27 12:58:02
I'm looking for a simple, but cross-platform negate -process that negates the value a process returns. It should map 0 to some value != 0 and any value != 0 to 0, i.e. the following command should return "yes, nonexistingpath doesn't exist": ls nonexistingpath | negate && echo "yes, nonexistingpath doesn't exist." The ! - operator is great but unfortunately not shell-independent. Jonathan Leffler Previously, the answer was presented with what's now the first section as the last section. POSIX Shell includes a ! operator Poking around the shell specification for other issues, I recently

Negate if condition in bash script

两盒软妹~` 提交于 2019-11-27 11:23:55
I'm new to bash and I'm stuck at trying to negate the following command: wget -q --tries=10 --timeout=20 --spider http://google.com if [[ $? -eq 0 ]]; then echo "Sorry you are Offline" exit 1 This if condition returns true if I'm connected to the internet. I want it to happen the other way around but putting ! anywhere doesn't seem to work. You can choose: if [[ $? -ne 0 ]]; then # -ne: not equal if ! [[ $? -eq 0 ]]; then # -eq: equal if [[ ! $? -eq 0 ]]; then ! inverts the return of the following expression, respectively. Better if ! wget -q --spider --tries=10 --timeout=20 google.com then