null 相关问题

Null表示*没有*或* unknown *,具体取决于上下文。对于SQL特定问题,请使用“sql-null”标记。

如何从 Scala 中的泛型函数返回 null?

我正在编写自己的简单 javax.sql.DataSource 实现,我需要工作的唯一方法是 getConnection: Connection,但是该接口继承了许多其他方法(我不需要)...

回答 4 投票 0

将本机 null 转换为字符串“null”

php可以将null转为字符串吗? 例如, $字符串=空; 到 $string = "null";

回答 6 投票 0

HTML 上的 document.getElementById 出现 Null 错误

函数 myFunction() { 变量名称=“”; var 密码 = ""; name = document.getElementById('name');...</desc> <question vote="-1"> <pre><code>&lt;body&gt; &lt;script lang=&#34;javascript&#34;&gt; function myFunction() { var name = &#34;&#34;; var password = &#34;&#34;; name = document.getElementById(&#39;name&#39;); password = document.getElementById(&#39;password&#39;); alert(name) alert(password) } &lt;/script&gt; &lt;h1 id=&#34;Center&#34;&gt;Log in&lt;/h1&gt; &lt;input type=&#34;text&#34; id=&#34;Center&#34; id=&#34;name&#34; style=&#34;background-color: rgb(255, 255, 255); border-radius: 0px;&#34;&gt; &lt;input type=&#34;text&#34; id=&#34;Center&#34; id=&#34;password&#34; style=&#34;background-color: rgb(255, 255, 255); border-radius: 0px;&#34;&gt; &lt;input type=&#34;button&#34; id=&#34;Center&#34; style=&#34;width: 170px;&#34; onclick=&#34;myFunction()&#34; value=&#34;Submit&#34;&gt; &lt;/body&gt; </code></pre> <p><pre><code>I want to make the input text to alert and I get data of text using a document.getElementById and there has a two text and one button and id center is the code that the object can go to the center place on the screen.</code></pre></p> <p>我试着把它串起来或者再写一次,但没有办法做得好。</p> </question> <answer tick="false" vote="0"> <p>尝试这样:</p> <p></p><div data-babel="false" data-lang="js" data-hide="false" data-console="true"> <div> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; #Center { display: block; margin: auto; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;script lang=&#34;javascript&#34;&gt; function myFunction() { var name = &#34;&#34;; var password = &#34;&#34;; name = document.getElementById(&#39;name&#39;).value; password = document.getElementById(&#39;password&#39;).value; alert(&#34;Name: &#34; + name + &#34;\nPassword: &#34; + password); } &lt;/script&gt; &lt;h1 id=&#34;Center&#34;&gt;Log in&lt;/h1&gt; &lt;input type=&#34;text&#34; id=&#34;name&#34; style=&#34;background-color: rgb(255, 255, 255); border-radius: 0px;&#34; placeholder=&#34;Enter your name&#34;&gt; &lt;input type=&#34;password&#34; id=&#34;password&#34; style=&#34;background-color: rgb(255, 255, 255); border-radius: 0px;&#34; placeholder=&#34;Enter your password&#34;&gt; &lt;input type=&#34;button&#34; id=&#34;Center&#34; style=&#34;width: 170px;&#34; onclick=&#34;myFunction()&#34; value=&#34;Submit&#34;&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> <p></p> </answer> </body></html>

回答 0 投票 0

使用java检查器框架,为什么NonNull值不被接受到Nullable值位置?

使用java检查器框架,为什么Map NonNull值不被接受到Map Nullable值位置? 通过此代码调用: 模式.验证( MapMaker.makeMap( ...

回答 1 投票 0

如何使用 .fillna 根据按另一列分组的平均值列表进行填充?

我有一个名为 df 的数据框,其中 Bandwidth_GB_Year 的值为空。 我试图根据另一列 InternetService 分组的方式填充空值。 当我使用 fillna 时...

回答 1 投票 0

可编写脚本的对象事件无法在 Unity 中注册侦听器(记录类型不匹配)

我正在尝试按照在 Youtube 上找到的可编写脚本的对象处理事件的教程进行操作,该教程位于此处:https://www.youtube.com/watch?v=7_dyDmF0Ktw 结果,我有两个sc...

回答 1 投票 0

使用java检查器框架,为什么非空键不被接受到可空键位置?

使用java检查器框架,为什么Map NonNull键不被接受到Map Nullable键位置? 通过此代码调用: 模式.验证( MapMaker.makeMap( ...

回答 1 投票 0

PHP API? CURL 获取空

$curl=curl_init(); curl_setopt_array($curl , [ CURLOPT_RETURNTRANSFER =>真, CURLOPT_URL => 'https://ortam.etu.edu.tr/Services/get_user_card_information/?apikey=XXXXXX...

回答 1 投票 0

为什么在javascript中null+null = 0

我在做一些有趣的测试时发现 null+null 在 javascript 中等于 0。 有什么理由吗?

回答 1 投票 0

为什么当值存在时会给出 null 错误

我在flutter App中的代码中,虽然Jason有值且不为空,但是却给出了null错误。这是什么原因呢? 错误: _TypeError(类型“Null”不是类型“String”的子类型)

回答 1 投票 0

Js 数组给出 null数组

为什么 Array 在 htm5 中的脚本 onclick 事件之外给出 null?其他变量工作正常。 数组 ...</desc> <question vote="0"> <p>为什么 Array 在 htm5 中的脚本 onclick 事件之外给出 null?其他变量工作正常。</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Array&lt;/title&gt; &lt;script&gt; var list = new Array(&#34;andrea&#34;, &#34;matteo&#34;, &#34;marco&#34;); var x = &#34;andrea&#34;; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type=&#34;button&#34; value=&#34;click&#34; onclick=&#34;alert(list[0]);&#34;&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> </question> <answer tick="false" vote="0"> <p>这是因为 <pre><code>list</code></pre> 不在您的 <pre><code>onclick</code></pre> 属性范围内。您可以在其前面加上 <pre><code>window</code></pre> 来直接定位它:</p> <p></p><div data-babel="false" data-lang="js" data-hide="false" data-console="true"> <div> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Array&lt;/title&gt; &lt;script&gt; var list = new Array(&#34;andrea&#34;, &#34;matteo&#34;, &#34;marco&#34;); var x = &#34;andrea&#34;; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type=&#34;button&#34; value=&#34;click&#34; onclick=&#34;alert(window.list[0]);&#34;&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> <p></p> </answer> </body></html>

回答 0 投票 0

UPDATE ON CONFLICT 查询时违反 NOT NULL 约束

我有一个具有以下 DDL 的桌面玩家。我只更改了列名称和顺序: 如果玩家不存在则创建表( id varchar 主键, col1 布尔值不为 null 默认 false,...

回答 1 投票 0

如何在 Elixir 中返回空字节两侧的 3 个字符?

如果我有一个字符串,例如,hello this isa<<0>>string.,如何返回空字节两侧的三个字符,包括空字节,例如isa<<0>>str? 我...

回答 3 投票 0

未捕获的错误异常:htmlspecialchars():将 null 传递给字符串类型的参数 #1 ($string) 已被弃用,即使我正在检查 nulll

我在代码的第 42 行收到以下错误。但奇怪的是我已经在检查 null 并且实际错误似乎发生在第 44 行。如何解决这个问题? 错误 未被捕获

回答 1 投票 0

学说2 OneToMany Cascade SET NULL

错误 无法删除或更新父行:外键约束失败。 课程 班主任 { /** *@ORM\OneToMany(targetEntity =“出版物”,mappedBy =“教师”) */ ...

回答 3 投票 0

Python 从列表中删除空项目

我在 python 中为 DynamoBIM 创建了以下列表: a = [[“f”,“o”,“c”],[空,“o”,空],[空,“o”,空]] 我想从此列表中删除空项目以创建此列表: a = [["f", "...

回答 6 投票 0

检查 null 不会抑制 Visual Studio 2002 中的 null 取消引用警告

我有一个简单的方法可以从包装的数据表中获取值: 公共字符串 GetValue(int 节点 ID, 字符串属性名称) { DataRow 行 = this.dataTable.Rows[nodeID]; var 结果 = row.Fie...

回答 1 投票 0

snapshot.data 在 Flutter 中返回 null。在 Translator 包中使用

我正在使用翻译器包自动翻译文本小部件中的字符串值,但我的代码不起作用..只是返回 null。 代码: Future翻译(字符串输入,

回答 1 投票 0

在 Vue v-for 中跳过空项目和空子项目

我在 Vue.js 中有一个嵌套的 for ... in 循环。我想做的是如果元素的值为空则跳过元素。这是Vue模板代码: 我在 Vue.js 中有一个嵌套的 for ... in 循环。我想做的是如果元素的值为 null 则跳过元素。这是 Vue 模板代码: <ul> <li v-for="item in items" track-by="id"> <ol> <li v-for="child in item.children" track-by="id"></li> </ol> </li> </ul> null 元素可能同时存在于 item 和 item.children 对象中。 例如: var data = { 1: { id: 1, title: "This should be rendered", children: { 100: { id: 100, subtitle: "I am a child" }, 101: null } }, 2: null, 3: { id: 3, title: "Should should be rendered as well", children: {} } }; 使用此数据,data[1].children[101]不应被渲染,如果data[1].children[100]稍后变为空,则应将其从列表中省略。 我无法控制这些数据的结构,所以我必须以这种形式处理它。 一个简单的v-if可能会起作用: <li v-for="item in items" v-if="item !== null" track-by="id"> 尝试一下。如果没有,请执行以下操作: 您可以为此添加一个过滤器(在应用程序实例之前的 main.js 中): Vue.filter('removeNullProps', function(object) { return _.reject(object, (value) => value === null) }) 然后在模板中: <li v-for="item in items | removeNullProps" track-by="id"> <ol> <li v-for="child in item.children | removeNullProps" track-by="id"></li> </ol> </li> 在 Vue 2 中,过滤器已在 v-for 中被弃用。 现在您应该使用计算属性。下面是演示。 new Vue({ el: '#app', data: { items: [ 'item 1', 'item 2', null, 'item 4', null, 'item 6' ] }, computed: { nonNullItems: function() { return this.items.filter(function(item) { return item !== null; }); } } }) <script src="https://unpkg.com/vue@2"></script> <div id="app"> Using a computed property: <ul> <li v-for="item in nonNullItems"> {{ item }} </li> </ul> <hr> Using v-if: <ul> <li v-for="item in items" v-if="item !== null"> {{ item }} </li> </ul> </div> 只需使用 v-if 即可。但首先,不要使用 track-by="id",因为有 null 项和 null 子项。您可以在此处查看演示https://jsfiddle.net/13mtm5zo/1/。 也许更好的方法是在渲染之前先处理数据。 我建议您不要在同一元素中使用 v-if 和 v-for。我发现有效且不影响性能的是: <li v-for="(value, key) in row.item.filter(x => x !== null)" :key="key"{{value}}</li> 您只需对正在遍历的数组运行过滤函数即可。这是 C# 中的常见用法,发现在 JavaScript 中也没有什么不同。这基本上会在迭代时跳过空值。 希望这会有所帮助(3年后)。 Vue.Js 风格指南告诉我们: “切勿在与 v-for 相同的元素上使用 v-if。” 如何根据Vue风格指南正确处理v-if和v-for: <ul v-if="shouldShowUsers"> <li v-for="user in users" :key="user.id" > {{ user.name }} </li> </ul> 在此处查看有关如何使用 v-if 处理 v-for 的更多信息:https://v2.vuejs.org/v2/style-guide/#Avoid-v-if-with-v-for-essential 首先,让我们从一般准则开始,因为其他答案中已经建议了:永远不要在同一元素上使用 v-if 和 v-for。 由于这两个指令都控制是否渲染元素,因此将它们一起使用会令人困惑且容易出错。 在 Vue 2 中,v-for 优先于 v-if,但 在 Vue 3 中,反之亦然– 始终避免将它们一起使用。 对于您的问题,如果您有一个列表列表,您实际上希望处理两种空值:空列表和这些列表中的空项。 我们可以通过将多个 v-if 和 v-for 编织在一起来处理这两个问题,两个列表各一对,第三个 v-if 以避免渲染空子列表:<ul> <template v-for="item in Object.values(items)"> <li v-if="item != null" :key="item.id"> {{ `Parent #${item.id}: ${item.title}` }} <ol v-if="item.children != null && Object.values(item.children).length > 0"> <template v-for="child in Object.values(item.children)"> <li v-if="child != null" :key="child.id"> {{ `Child #${child.id}: ${child.subtitle}` }} </li> </template> </ol> </li> </template> </ul> 乍一看这可能有点复杂,但核心是:我们可以解决这个问题,同时避免 v-if 和 v-for 限制,并使用 <template> 元素 作为包装器。 通过在父列表和子列表中使用 <template> 作为列表项的包装,我们可以: 使用 v-for 渲染父列表和子列表中的项目 选择是否使用 v-if 单独渲染每个项目,而不沿途创建一堆空的 <li> 可运行代码片段示例: new Vue({ el: '#app', data() { return { items: { 1: { id: 1, title: "This should be rendered", children: { 100: { id: 100, subtitle: "I am a child" }, 101: null, 102: { id: 102, subtitle: "I am a second child" }, } }, 2: null, // No parent #2 to render 3: { id: 3, title: "Should be rendered as well", children: { 300: { id: 300, subtitle: "I am a child under a different parent" }, } }, 4: { id: 4, title: "Should also be rendered (without children)", children: null }, } } }, }); <script src="https://unpkg.com/vue@2/dist/vue.min.js"></script> <div id="app"> <ul> <template v-for="item in Object.values(items)"> <li v-if="item != null" :key="item.id"> {{ `Parent ${item.id}: ${item.title}` }} <ol v-if="item.children != null && Object.values(item.children).length > 0"> <template v-for="child in Object.values(item.children)"> <li v-if="child != null" :key="child.id"> {{ `Child ${child.id}: ${child.subtitle}` }} </li> </template> </ol> </li> </template> </ul> </div> 使用分层 v-if 和 v-for 与 <template> 来渲染列表是一种很好的方法,可以让您最大限度地控制渲染的内容,同时还有助于避免在同一元素上使用这两个指令的陷阱。

回答 6 投票 0

Birt 报告 - 返回请求的数据和空值

我目前正在构建一份报告,其中包含一些参数,其中一个参数我遇到了问题。 CAST(c.scheduledvisitdatetime AS DATE) >= (ISNULL(?, CAST('1900-01-01' AS DATE)) 或 c.scheduledvisitdatetime...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.