问题标签 [negation]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sql - 双重否定sql查询
我被要求使用双重否定在 sql 中进行查询。问题本身是询问所有“sigla”和“disciplina”,其中 semestre_id 为 21 并且至少有 1 个属性“resposta”=5
桌子
询问
现在,尽管发布了所有这些,但我的问题主要是我不太确定这是否是在 sql 中进行正确双重否定的方法,因为我得到的答案是表中所有错误的行。由于我很难在网上搜索示例,任何人都可以澄清一下吗?
javascript - Javascript中否定后的空格
这是一个 javascript 编码风格问题。是否有任何理由在否定运算符之后放置一个空格?我已经在 angularjs 的源代码中看到了这一点,但我不知道这是否有任何好处。示例:写作!myVar
vs! myVar1
c# - 补/否定不能正常工作
你好我写了一个小程序来演示我面临的问题
输出是这样的:
据我所知〜符号应该给出相同的负数,但是根据以下链接,我得到的数字总是比原始数字多一,我必须得到的答案应该是相同的,如果我加上否定到原始数字我应该得到 0 而不是另一个数字 http://visualcsharptutorials.com/reference/converting-negative-numbers-to-binary
谁能告诉我有什么问题?我正在使用 .net 4.5,c#5.0,vs 2012
negation - 在内联查询中排除某些属性值
我对属性使用三个值 (=pages) A
, B
, 。C
is of type
有些页面只有一个值is of type
,有些页面有所有三个值。
我想为没有类型和#ask
类型的页面。A
B
C
我尝试了以下内联查询:
但它并没有按预期工作:它列出了所有类型的页面A
,包括那些类型为B
/C
的页面。
javascript - What is the difference between Boolean(foo.bar) and !!foo.bar?
In javascript
I have seen the usage of
What is the performance and other differences between this and
?
Is there any overhead for the use of constructor typecasting over negation?
Another (better) example is:
logic - 形式逻辑的否定
什么是域U
,什么是P(x)
这个陈述是错误的?
我不认为这是可能的,但我希望有人能弄清楚如何使这个陈述成为错误。
negation - 在 Java 中使用正则表达式排除子字符串
我想取一个字符串src=' blah src='' blah
并忽略第一个src='
预期结果应该是:blah src='' blah
我试过了:blah(?!:(src\\s*?=\\s*?))
我在这里看到其他帖子提到 ^(...).*$ 但我真的不明白如何应用它或真正如何使用否定。java教程提到了[^abc],但是它也可以用于正则表达式而不仅仅是字符吗?例如 [^src\\s=]
prolog - 为什么双重否定在 Prolog 中不绑定
假设我有以下理论:
它只是说真的,这当然a(X)
是正确的,因为不存在b(X)
(否定作为有限失败)是真的。因为只有 ab(X)
如果没有c(X)
,而我们有c(a)
,所以可以说这是真的。但是我想知道为什么 Prolog 不提供答案X = a
?比如说我介绍了一些语义:
当然,如果我查询noOrphan(michael)
,这将导致true
and noOrphan(david)
in false
(因为我没有为 定义父david
级)。但是我想知道为什么没有主动方法来检测哪些人(michael
,david
,...)属于该noOrphan/1
关系?
这可能是 Prolog 的回溯机制的结果,但 Prolog 可以保持一种状态,该状态可以验证一个人是在以积极的方式(0,2,4,...)深度否定,还是以消极的方式(1,3 ,5,...) 深度否定。
collections - Drools Constraint object other than P is found in collection
I have been trying to figure this out on and off for a really long time. I can imagine a lot of very verbose and non-droolsy ways to go about accomplishing this. However, I would like to know the best practice for dealing with a situation like this. I would like to know how to write the constraint I describe below in the drools dialect.
I wish to write a constraint that deals with a collection. Let's say we have CustomType which has a field Collection. The constraint should express we want to find facts of CustomType who have any object in the collection other than the specified object(P). Critically, it does not matter if the specified object is present. It only matters if there is at least one other object in the collection.
The collection in question is not a set. It is possible there are multiple instances of P in the same collection.
In pseudo Java I might write a method like:
How would this be expressed in the when clause of a drool? The closest I could come is specifying there is not a P, but that isn't what I want. I want to know that there is a not P.
operators - 不存在其成员字段包含 P 以外的值的 Drools 约束对象
我意识到标题很疯狂,但它确实是我能想到的最好的。如果有人有更好的建议,请在评论中留下,我会编辑。
这个问题是对这里提出的问题的跟进:Drools Constraint object other than P is found in collection
对于那些不想点击的人,该帖子描述了您想知道是否存在CustomType事实的情况的解决方案,该事实具有包含P以外的值的成员字段。该问题的解决方案结束了如下:
上面的代码效果很好。我的问题是我想知道何时不存在具有此属性的 CustomType 类型的对象。现在,由于第 2 行依赖于第 1 行中给出的绑定变量,我们不能简单地用 not 运算符否定第 1 行。这样做会引发运行时异常。以下是我直观地想要编写代码的方式,但请记住它不起作用:
我不能简单地否定第 2 行,因为这样规则将要求存在至少一个 CustomType 对象。我想知道第一个代码示例何时不是这种情况。
我内心的流口水告诉我原来的解决方案可能有缺陷。理想情况下,我们希望在 CustomType 的括号()中表示第 2 行。这将更多地表达“有一个带有属性的自定义类型”而不是“有一个自定义类型,并且有一个带有属性的对象”。前者我们可以用 not 运算符否定,但我不确定如何处理后者。