我将一个SBT项目导入Intellij 13.1.
每当我更改build.sbt,plugins.sbt等时,Intellij都会重新运行SBT.
有时这很好,但是当我在控制台中做很多事情,经过频繁更改后,我必须等待,因为我的IDE锁定了SBT(并且SBT是sloooow).
无论如何,我可以关闭Intellij中的自动SBT运行.我更喜欢在提供的SBT窗口中自己做.
我刚刚了解了Access-Control-Allow-Methods
标题,例如
Access-Control-Allow-Methods: OPTIONS, HEAD, GET
Run Code Online (Sandbox Code Playgroud)
我从来没有使用过这个标题(只是Access-Control-Allow-Origin
),但过去我已经让CORS工作了.
是默认允许所有方法,还是我对未定义的行为感到幸运?
如何以编程方式在Google Chrome中获取我的网站的内存使用量(JS和总数)?
我看过使用未记录的HeapProfiler从Chrome扩展程序中执行此操作(请参阅此处),但我无法找到从中获取数据的方法.
我想测量每个版本的内存消耗,所以这需要编程.
编辑:我想出了如何使HeapProfiler方法工作.每个addHeapSnapshotChunk
事件都有一个JSON对象的块.
chrome.browserAction.onClicked.addListener(function(tab) {
var heapData,
debugId = {tabId:tab.id};
chrome.debugger.attach(debugId, '1.0', function() {
chrome.debugger.sendCommand(debugId, 'Debugger.enable', {}, function() {
function headerListener(source, name, data) {
if(source.tabId == tab.id && name == 'HeapProfiler.addProfileHeader') {
function chunkListener(source, name, data) {
if(name == 'HeapProfiler.addHeapSnapshotChunk') {
heapData += data.chunk;
} else if(name == 'HeapProfiler.finishHeapSnapshot') {
chrome.debugger.onEvent.removeListener(chunkListener);
chrome.debugger.detach(debugId);
//do something with data
console.log('Collected ' + heapData.length + ' bytes of JSON data');
}
}
chrome.debugger.onEvent.addListener(chunkListener);
chrome.debugger.sendCommand(debugId, 'HeapProfiler.getHeapSnapshot', {uid:data.header.uid, type:data.header.typeId});
} …
Run Code Online (Sandbox Code Playgroud) javascript performance google-chrome memory-profiling google-chrome-devtools
根据Chrome开发工具 - "大小"与"内容",我应该能够看到大小(线上的字节数)和内容(未压缩的大小).
我记得曾经见过这个.
但是现在(Chrome 38),我只看到一个测量,我不确定它是哪一个.
我可以使用Chrome开发工具查看压缩和未压缩的尺寸吗?
依赖性bar
取决于foo
1.2.3,但该版本foo
有一个错误,我需要使用版本1.2.2.
我可以这样做force()
.
libraryDependencies += "foo" %% "foo" % "1.2.2" force()
Run Code Online (Sandbox Code Playgroud)
文档不建议使用该方法:
强制修改(不推荐)
注意:强制可能会产生逻辑不一致,因此不再推荐使用它.
这是否意味着SBT force()
与使用特定版本的依赖关系有不同的更好的方法?如果是这样,什么?
或者我是否从文档中推断出整个问题是我建议不要有的问题?
当用户打印时,我的服务器生成PDF,我这样做是为了显示PDF的打印对话框.
$('<iframe type="application/pdf"></iframe>').attr('src', url).load(function() {
var iframe = this;
setTimeout(function() { //Chrome PDF viewer shows "Loading..." forever otherwise
iframe.contentWindow.print();
$(iframe).remove(); //gc
}, 50);
}).appendTo('body');
Run Code Online (Sandbox Code Playgroud)
但现在我在S3上托管PDF.我明白了
Uncaught SecurityError: Blocked a frame with origin "https://localhost" from
accessing a frame with origin "https://my-bucket.s3.amazonaws.com".
Protocols, domains, and ports must match.
Run Code Online (Sandbox Code Playgroud)
我认为我需要添加CORS头.
我有
Access-Control-Allow-Methods: GET, HEAD
Access-Control-Allow-Origin: *
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
我想做一个提交的还原,但仅限于某些文件.(不是结账;还原.如果您不熟悉差异,请继续阅读.)
我试过这个
git revert --no-commit abcdef123456 -- my/path/to/revert
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
fatal: ambiguous argument 'my/path/to/revert': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
Run Code Online (Sandbox Code Playgroud)
但这正是我所做的!(是的,my/path/to/revert
是在我工作的树上.)
我的工作理论是,不可能仅还原某些文件,并且Git错误消息具有误导性.
(Git 1.7.9.5)
这不是一个重复的还原一个文件到git的以前的版本.
这Writes
为case类创建了一个
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class A(a: String, b: String, c: String)
(JsPath.write[String] and
JsPath.write[String] and
JsPath.write[String])(unlift(A.unapply))
Run Code Online (Sandbox Code Playgroud)
这可以扩展为适用于2,3,4,5,6等参数......但不能用于1.
case class B(a: String)
(JsPath.write[String])(unlift(B.unapply))
Run Code Online (Sandbox Code Playgroud)
编译错误:
error: overloaded method value write with alternatives:
(t: String)(implicit w: play.api.libs.json.Writes[String])play.api.libs.json.OWrites[play.api.libs.json.JsValue] <and>
(implicit w: play.api.libs.json.Writes[String])play.api.libs.json.OWrites[String]
cannot be applied to (B => String)
(JsPath.write[String])(unlift(B.unapply))
^
Run Code Online (Sandbox Code Playgroud)
类似的问题也会发生Reads
.
我怎样才能获得Reads
与Writes
单参数的情况下clases?
我偶尔会在Chrome中获得"非法访问"例外(29和30).其他人也见过这个.它似乎发生在一个特定的行:
这this
是我定义的对象.它有一个属性end
是null
或数字.
有没有人知道任何可能导致Chrome中该邮件出错的内容?
编辑:我不希望任何人调试我的代码的数万行.什么可能导致该消息的错误,无论是跳月亮,唱蓝调等?
页面上的所有Javascript代码都不会出现"非法".
Chrome(31+)的更高版本中未发生此错误.
希望这是好消息.
javascript ×4
cors ×2
sbt ×2
cross-domain ×1
dependencies ×1
exception ×1
git ×1
git-revert ×1
header ×1
http ×1
iframe ×1
ivy ×1
json ×1
node.js ×1
performance ×1
scala ×1