问题标签 [nul]
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-server - 导入表时从字符串转换为唯一标识符时转换失败?
我正在尝试使用 Navicat for SQL Server 导入表,但我收到此错误:
[Err] [Row1] [Imp] 42000 - [SQL Server] 从字符串转换为唯一标识符时转换失败。
[错误] [Row1] [Imp]
[Err] [Row1] [Imp] 42000 - [SQL Server] 从字符串转换为唯一标识符时转换失败。
倒数第三列是ID
,它是带有 ( newid()
) 的 NOT NULL 唯一标识符。我想自动生成这些 ID,因此它们在 csv 文件中为空。
bash - 如何在 bash 中使用 AWK 添加 NUL 字符分隔符?
我有一个输出一些文件路径的函数,我需要这些路径由 NUL 字符而不是换行符分隔\n
。我尝试了以下代码:
但是,如果我将其输出通过管道传输到hexdump
or hd
,则不会显示 NUL 字符。输出中似乎不包含 NUL 字符awk
:
将打印:
我的awk
版本是:
对于我来说,任何带有其他命令的解决方案sed
也可以接受。
注意:我的问题与enter link description here不重复,因为它要求提供一种适用于具有不同awk
s 的不同机器的解决方案。但我只需要一个可以在我自己的机器上运行的解决方案,所以我可以使用任何awk
可以安装在 Ubuntu 14.04 上的版本。
shell - Is skipping/ignoring NUL bytes on process substitution standardized?
Executive Summary
Is it standard behavior that shells skip over NUL bytes when doing process substitution?
For example, executing
will yield abc
. The NUL value is skipped, even though the hexdump of the printf
output shows it's clearly being output.
My first thought was "word splitting". However, when using an actual process substitution
the results are similar and =
does not perform word splitting.
Long Story
While searching for the proper answer for this question, I realized that at least three of the shell implementation (ash, zsh, and bash) I am reasonably familiar with will ignore a NUL character when reading the value from process substitution into a variable.
The exact point in the pipeline when this happens seems to be different, but the result is consistently that a NUL byte gets dropped as if it was never there in the first place.
I have checked with some of the implementations, and well, this seems to be normal behavior.
ash
will skip over '\0'
on input, but it is not clear from the code if this is pure coincidence or intended behavior:
The bash
source code contains an explicit, albeit #ifdef
'd warning telling us that it skipped a NUL value on process substitution:
I'm not so sure about zsh
's behaviour. It recognizes '\0'
as a meta character (as defined by the internal imeta()
function) and prepends a special Meta
surrogate character and sets bit #5 on the input character, essentially unmetaing it, which makes also makes '\0'
into a space ' '
)
This seems to get stripped later because there is no evidence that value
in the above printf
command contains a meta character. Take this with a large helping of salt, since I'm not to familiar with zsh
's internals. Also note the side effect free statements.
Note that zsh
also allows you to include NUL (meta-escaped) in IFS
(making it possible to e.g. word-split find -print0
without xargs -0
). Thus printf '\0abc' | read value
and value=$(printf '\0abc')
should yield different results depending on the value of IFS
(read
does field splitting).
mysql - 更新 MySQL 中的多个列,但仅当值不为空时
我有一个包含多列 A、B 和 C 的 MySQL 表。
我想只使用一个 SQL 语句来更新这些列。但是,有时某些列可能为空。
因此,如果 A 为空,则仅更新 B 和 C。
如果 A 和 B 为空,则只更新 C。
依此类推,与所有其他组合。
我怎样才能在一个声明中做到这一点?
谢谢。
c - Specific Value to a NULL Pointer
I was referring to NULL Pointer in What's the difference between a null pointer and a void pointer? According to the post reply by @AnT, "Formally, each specific pointer type (int *, char * etc.) has its own dedicated null-pointer value"
I wrote simple program. But the pointer value is not fixed for integer or character. It changes sometimes. So how can we conclude that NULL pointer to int has a fixed value? Also the value of pointer is never 0.
html - 为什么 HTML 不能包含 NUL 字符?(转换为 0xFFFD / "%EF%BF%BD")
对于特殊值,我尝试了 HTML <option value="�">unspecified</option>
,但似乎 NUL 字符没有在 HTML 中解释。我得到了…</a>。我想知道原因,以及除了NUL
我可能需要注意的其他不寻常的 UTF-8 字符。
正如你在上面看到的,下拉列表设置了 NUL 值,但是当 JavaScript 检查结果时它们被转换为 �。
JavaScript 可以专门设置value
和label
设置\u0000
并且它可以工作,但由于某种原因,这无法在 HTML 中呈现。
您能否解释原因和/或指向相关文档?是否有其他 UTF-8 字符将以类似方式替换?
c - 通过“printf”中的格式说明符传递空字节
printf
当我使用 ASCII 表中的 NULL 字符时,为什么打印一个空格而不是停止?这就是我的意思:
只有当我将转义字符放入字符串本身时printf
才会停止字符串:
我在 Windows 8、Windows 10(使用 cygwin、MinGW、Netbeans、Code::Blocks)、XUbuntu 上试过这个,都是一样的。
问题出在哪里?我问了我的一位朋友,但他说他没有这样的问题,所有三个示例都以相同的方式执行。
r - 删除“NUL”字符(在 R 中)
我有一个奇怪的文本文件,里面有一堆NUL
字符(实际上大约有 10 个这样的文件),我想在 R 中以编程方式替换它们。这是其中一个文件的链接。在这个问题的帮助下,我终于找到了一种比临时更好的 方法来进入每个文件并查找和替换讨厌的字符。事实证明,它们中的每一对都应该对应一个空格 ( [NUL][NUL]
-> ) 以保持文件的预期线宽(这对于在以后将它们作为固定宽度读取至关重要)。
但是,为了健壮性,我更喜欢一种更自动化的解决方案方法,理想情况下(为了组织的缘故)我可以在我正在编写的 R 脚本的开头添加一些东西来清理文件。这个问题看起来很有希望,但接受的答案是不够的 -readLines
每当我尝试在这些文件上使用它时都会引发错误(除非我激活skipNul
)。
有什么方法可以将此文件的行放入 R 中,以便我可以使用gsub
或其他任何方法来解决此问题,而无需借助外部程序?
c - argc / argv 影响数组中的空字节?
为什么是以下内容:
按预期产生1238À§Wˇ
(“123”+一些随机字符),而相同的代码具有:
int main(void)
而不是argc
,argv
产生: 123
(尽管空字节没有空间)。
没有空字节空间array
似乎void
无关紧要怎么办?
java - XML(SwipeView) 布局属性返回为 null
我的 XML 中有一个SwipeView项,当我尝试从我的 java 类中访问它时,sometimes it returns null
. 在昨天的某个时候,虽然有一个断点来调试一切都工作正常,但这只是几次。我已经尝试清理我的项目。
自定义 ListView XML 布局:
Java 类- 这会调用包含 CustomAdapter 的 ListView 和自定义 xml 视图的 XML 布局
错误日志
- 与我的构造函数有什么关系?
- 我试图访问 XML 属性的点(在 CustomAdapter 初始化之前)?在被调用后尝试过,
CustomAdapter
但输出仍然相同
提前感谢任何愿意帮助我提出建议的人