我正在阅读关于CORS请求的规范,我发现了有关预检请求的内容:
这些是对具有除GET之外的HTTP请求方法的非同一原始URL的请求,首先需要使用预检结果缓存条目或预检请求进行授权.
我曾经认为预检请求的目的是在创建请求之前检查是否允许请求,以防它(非法)更改服务器状态.
但是HEAD和OPTIONS不会修改服务器状态.我必须误解预检检查的原因.
为HEAD和OPTIONS进行预检检查但不是GET的目的(也就是原因,动机或理由)是什么?GET有什么特别之处?
在Chrome和Firefox中
typeof foo
Run Code Online (Sandbox Code Playgroud)
评估为'undefined'
.
但
typeof (function() { return foo; })()
Run Code Online (Sandbox Code Playgroud)
抛出错误:
ReferenceError: foo is not defined
Run Code Online (Sandbox Code Playgroud)
这破坏了我对表达式可疑性的概念!到现在为止,我知道没有条件,这foo
和(function() { return foo; })()
是不一样的.
这是标准行为吗?如果是这样,引用ECMAScript标准的相关部分会很有帮助.
编辑:
另一个例子:
typeof (foo)
typeof (foo + 0)
Run Code Online (Sandbox Code Playgroud)
我希望(foo)
并(foo + 0)
抛出一个错误.
但第一个没有错误; 第二个.
此问题适用于使用一种语言("源")编写的任何语言,例如C或Java,并使用动态链接分布在另一种语言("二进制")中,例如机器代码或Java字节代码.
假设用户已在使用我的库的版本A. 我发布了更新的版本B.
如果他可以在不改变B的情况下编译他的代码并且正确地使用B运行,则从A到B的改变被认为是源兼容的.
如果他可以针对A编译他的代码并且正确地使用B运行,则从A到B的改变被认为是二进制兼容的.当使用没有隔离模块加载的传递依赖图(例如OSGI)时,这种情况很常见.X是根据某些版本的Y和Z编译的,Y是针对不同的某个版本的Z编译的.在运行时,Y对Z的调用可能不正确并且可能会崩溃.
变更可能与源兼容,但二进制不兼容.变更也可能是源不兼容和二进制兼容的.
我使用哪种兼容性进行语义版本控制?我是否使用源兼容性来区分主要和次要/补丁更新,还是使用二进制兼容性来区分主要和次要/补丁更新?
我目前的动机是Scala库.Scala二进制兼容性可能非常难以分析,需要很好地理解编译器细节.源兼容性和二进制不兼容是很常见的.
这不是一些奇怪的边缘情况; 这个问题可以出现在大多数编译的动态链接语言中.
我升级了我的Play版本和其他库,我现在看到了:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/paul/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.helpers.NOPLoggerFactory]
Run Code Online (Sandbox Code Playgroud)
我试图追踪这些来自哪里,但是当我跑步时show managed-classpath
,唯一的slf4j罐子就是
/home/paul/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.6.jar
/home/paul/.ivy2/cache/org.slf4j/jul-to-slf4j/jars/jul-to-slf4j-1.7.6.ja
/home/paul/.ivy2/cache/org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.6.jar
Run Code Online (Sandbox Code Playgroud)
我从来没有见过slf4j-nop-1.7.7.jar
或slf4j-jdk14-1.7.7.jar
或slf4j-simple-1.7.7.jar
.
这些在classpath上怎么样?
截至SBT 0.13.6,驱逐现在是警告.
[warn] Scala version was updated by one of library dependencies:
[warn] * org.scala-lang:scala-library:(2.10.4, 2.10.1, 2.10.3, 2.10.0) -> 2.10.2
[warn] * org.scala-lang:scala-compiler:2.10.0 -> 2.10.4
[warn] To force scalaVersion, add the following:
[warn] ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
[warn] There may be incompatibilities among your library dependencies.
[warn] Here are some of the libraries that were evicted:
[warn] * org.apache.httpcomponents:httpclient:(4.1.3, [4.1, 4.2)) -> 4.0.1
[warn] * org.specs2:specs2_2.10:(1.12.3, 2.3.13) -> 2.4.2
[warn] Run 'evicted' to see detailed …
Run Code Online (Sandbox Code Playgroud) version suppress-warnings dependency-management sbt sbt-0.13
MySQL(Percona 5.6)无法启动.
这个错误发生在我身上好几次.每次,我都必须删除MySQL数据目录并重新安装MySQL.
还有另一种修复MySQL的方法吗?(特别是没有吹走数据的那个?)
/var/log/mysql/error.log
150214 16:36:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2015-02-14 16:36:40 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-02-14 16:36:40 0 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.
2015-02-14 16:36:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-02-14 …
Run Code Online (Sandbox Code Playgroud) 自从我从IntelliJ 14升级到14.1后,菜单等文本的底部被切断了.
与外观相反,我不是编辑DaqUtil或DaoUtil,而是编辑DagUtil.
如何修复文件树,选项卡和文本框没有底部切断?
我正在使用Ubuntu 14.04.看起来默认的系统字体是Cantarell 11.
编辑:我发现并尝试了tuxjdk.它修复了问题,但字体显示为不同的默认大小.这不是一个真正的问题 - 它更容易调整.真正的交易破坏者是它使IntelliJ 爬行超出了所有可用性.:(
for {
a <- Some(1)
b <- Some(2)
} yield (a, b)
Run Code Online (Sandbox Code Playgroud)
回报 Some((1, 2))
for {
a <- Right(1).right
b <- Left(2).left
} yield (a, b)
Run Code Online (Sandbox Code Playgroud)
回报 Left((1, 2))
现在我想在理解中分解元组.
for {
(a, b) <- Some((1, 2))
(c, d) <- Some((3, 4))
} yield (a, b, c, d)
Run Code Online (Sandbox Code Playgroud)
回报 Some((1, 2, 3, 4))
for {
(a, b) <- Right((1, 2)).right
(c, d) <- Left((3, 4)).left
} yield (a, b, c, d)
Run Code Online (Sandbox Code Playgroud)
无法编译:
error: constructor cannot be instantiated to expected …
Run Code Online (Sandbox Code Playgroud) 我似乎无法让这个工作.
响应点击,窗口A打开窗口B(然后具有焦点).然后,响应第B点击,窗口电话window.opener.focus()
,但重点不不回A.
我发现Chrome有一个奇怪的,奇怪的解决方法(29,可能还有其他).如果我跑:
window.opener.name = 'somename';
window.open(window.opener.location.href, window.opener.name);
window.opener.focus();
Run Code Online (Sandbox Code Playgroud)
它确实有效(并且没有重新加载窗口A).但这对Firefox不起作用,无论如何它可能都是侥幸.
在我看来,非常清楚opener
和focus
被认为做的,但window.opener.focus()
不起作用.我错过了什么?
例如,
with open("foo") as f:
f.read()
Run Code Online (Sandbox Code Playgroud)
(但它可能是文件写入、DNS 查找、任意数量的其他 I/O 操作。)
如果我在读取 (SIGINT) 时中断该程序,则 I/O 操作将停止并被KeyboardInterrupt
抛出,并且终结器会运行。
但是,如果这发生在主线程以外的线程上,则 I/O 操作不会中断。
那么...如何中断另一个线程上的 I/O 操作(类似于它在主线程上的中断方式)?