问题标签 [inverse]

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.

0 投票
1 回答
2938 浏览

c# - 如何在 C# 中得到数字的反义词?

我不确定我正在尝试的操作的名称是什么,但我想“翻转”给定范围内的数字值。

我有一个 C# 程序,它接收一个从 1 到 1023 的任何值不等的数字。我将如何“翻转”这个数字,以便如果我收到 1023 那么它将是 1,750 将是 274,而 512 仍然是 512因为它正好是一半?

我正在考虑使用某种类型的循环,但我从来没有做过这样的事情。例如,我的研究提出了希望将 40 变成 04 的人,但这不是我想要的。

0 投票
3 回答
47057 浏览

regex - 是否有正则表达式来匹配包含 A 但不包含 B 的字符串

我的问题是我想用纯正则表达式检查浏览器字符串。

-> 应该匹配

不应该匹配

我尝试过的解决方案是:/?((?<=Android)(?:[^])*?(?=Mobile))/i 但它完全匹配错误。

0 投票
2 回答
23856 浏览

regex - notepad++ 逆正则表达式替换(除了字符串)

我基本上希望匹配包含此字符串“Hello”的每一行

例子:

我尝试了这个正则表达式模式:^((?!hello).)*$

未找到匹配项。

基本上我想使用记事本++删除包含字符串“hello”的每一行

0 投票
3 回答
21625 浏览

java - 创建java正则表达式以获取href链接

抱歉,如果以前有人问过这个问题,但我在网上找不到任何答案。我很难弄清楚这个正则表达式的逆:

"\"[^>]*\">"

我想使用 replaceAll 来替换除链接之外的所有内容。所以如果我有一个类似这样的标签:

<p><a href="http://www.google.com">Google</a></p>

我需要一个满足这一点的正则表达式:

s.replaceAll(正则表达式,“”);

给我这个输出:

http://www.google.com

我知道有更好的方法可以做到这一点,但我必须使用正则表达式。非常感谢任何帮助,谢谢!

0 投票
3 回答
191 浏览

algorithm - 离散函数函数的求逆。

我有一张关于逆伽马校正的表格,这些是从 0 到 256 对应的值。我需要一种方法来计算这个函数的倒数-> 像 0, 2, 6, 9, ...

如果有人能告诉我一个可以做到这一点的免费软件工具或我可以用 C 编写的算法,我将不胜感激。

0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 43, 43, 44, 44, 45, 45, 46, 47, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 61, 61, 62, 63, 64, 64, 65, 66, 67, 67, 68, 69, 70, 71, 71, 72, 73, 74, 75, 76, 77, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 108, 109, 110, 111, 113, 114, 115, 116, 118, 119, 121, 122, 123, 125, 126, 128、129、131、132、134、135、137、138、140、142、143、145、147、148、150, 152, 154, 156, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 178, 180, 182, 184, 187, 189, 191, 194, 196, 199, 201, 204、207、209、212、215、218、221、224、227、230、233、236、239、243、246、249、253、

0 投票
2 回答
1124 浏览

javascript - 用javascript编写一个与另一个相反的函数

我正在尝试编写一个与下面的函数相反的函数。

这样我就可以从函数 foo 获取输出并生成它的输入参数。

我不完全确定这是否可能。

0 投票
1 回答
2000 浏览

.net - 实体框架中的第二个自我关系

假设我们有一个领域类

为简单起见,省略了其他属性。

当我刚刚ParentIncident到位时,一切正常。现在我已经添加ClaimIncident到课程中了。我正在尝试使用 Entity Framework 4.3 (PreRelease)Migrations选项更新我的数据库,但我收到一个错误,即 EF 不知道如何将事件映射到事件。

为什么每个类都允许引用同一个类实例一次,而当我介绍第二个时,它突然不知道如何引用它?我怎样才能纠正模型类?

0 投票
1 回答
3273 浏览

javascript - jQuery a solution between children() and find(): anything that looks like closest()?

Based on the different answers received, the only solution using jQuery without implementing our own selector function is a basic selector with ":first" or followed by ".eq(0)" for jQuery.

I wanted to know if their were any kind of max depth option or a function like "get only the first result then return it" but it seems it's not available in jQuery since even :first in the selector does not seem to be faster that a call to .eq(0) Thanks for all the comments.


Original post:

I'm wondering if a function like "closest" is available for the children elements.

Let's say I have an html structure like that:

div.container > [* some elements, I can't use children()] > div.sub1 > div.sub2 > div.sub1 > [other various children elements]

If I want the first div.sub1 I'm doing something like:

The problem is that we cannot specify a "max depth" so it will be searched in ALL the children. I see it as a performance issue.

I'm talking about "max depth" because I could list the possibles selectors cases but it would be a long list, about 6-10 items depending on the case.

Anyone has a solution for this?

Thank you

0 投票
1 回答
2821 浏览

hibernate - Hibernate Cascade 和 Inverse 属性之间的区别

可能重复:
休眠中的级联和反向有什么区别,它们有什么用?

Hibernate Cascade 和 Inverse 属性有什么区别?

0 投票
0 回答
4535 浏览

symfony - Symfony2:使用标准 crud 从反面保持多对多关系

我想知道生成的多对多关系的默认行为:虽然在保持关系的拥有方时关系正确地存储在关联表中,但反转方的持久化不会更新数据库中的关系表.

我通过 simfony2 生成了 2 个 CRUD,到目前为止至少在这个“问题”上运行良好。我阅读了一些线程和教义 2 文档,但没有进一步了解。

还尝试在一侧和两侧使用 cascade={"persist"} 但仍然没有运气。

任何帮助都会很棒:

这是我的用户实体:

和我的角色实体:

控制器类尚未修改,因为我确信它可以使用默认行为!我错了吗?

请帮帮我!