我安装了Xdebug 2.1,并运行PHP 5.2.13.它可以成功连接到多个DBGP客户端(即xdebug.remote_log显示来回通信,客户端本身也显示传入连接),但它不会在断点处停止.我尝试过NetBeans,MacGDBp以及debugclient与Xdebug捆绑在一起的命令行.
典型的交易所看起来像:
Log opened at 2010-07-20 09:33:17
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/hgfs/htdocs/mycompany/index.php" language="PHP" protocol_version="1.0" appid="14371" idekey="macgdbp"><engine version="2.1.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2010 by Derick Rethans]]></copyright></init>
<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="starting" reason="ok"></response>
<- step_into -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="macgdbp" status="stopping" reason="ok"></response>
<- status -i macgdbp
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="macgdbp" status="stopping" reason="ok"></response>
Log closed at 2010-07-20 09:33:18
Run Code Online (Sandbox Code Playgroud)
NetBeans尝试设置断点,Xdebug承认这些断点:
<- breakpoint_set -i 7 …Run Code Online (Sandbox Code Playgroud) 是否可以更改Response对象的标题,如返回的fetch()?
假设我想通过resFn以下方式转换响应:
self.addEventListener('fetch', function (event) {
event.respondWith(fetch(event.request).then(resFn));
});
Run Code Online (Sandbox Code Playgroud)
应该是什么resFn()样子?一种尝试:
function resFn(res) {
res = res.clone();
res.headers.set("foo", "bar");
return res;
}
Run Code Online (Sandbox Code Playgroud)
失败TypeError: Failed to execute 'set' on 'Headers': Headers are immutable。
(一个单独的问题和答案解释了如何更改请求的标头。鉴于 theRequest和Response对象惊人地不同(不同的属性,它们的构造函数采用不同的参数),是否适用相同的解决方案?)
我该如何解决这个错误?我chef-solo使用非常简单的node.json配置文件运行时得到它,即使我不使用Windows.
$ chef-solo -c solo.rb -j node.json
...
[Sun, 06 Nov 2011 13:21:03 +0000] FATAL: LoadError: no such file to load -- win32/open3
Run Code Online (Sandbox Code Playgroud)
solo.rb 是:
file_cache_path "/usr/local/var/chef-solo"
cookbook_path "/home/mjs/workspace/cookbooks"
Run Code Online (Sandbox Code Playgroud)
node.json 是:
{ "run_list": [ "recipe[greeting]" ] }
Run Code Online (Sandbox Code Playgroud) 是否有RESTful方法来确定POST(或任何其他非幂等动词)是否会成功?在您基本上需要针对不同服务执行多个幂等请求的情况下,这似乎很有用,其中任何服务都可能失败.如果这些请求可以在"事务"中完成(即支持回滚)会很好,但由于这是不可能的,另一种方法是在实际执行它们之前检查每个请求是否成功.
例如,假设我正在建立一个电子商务系统,允许人们购买印有自定义文字的T恤,而这个系统需要整合两种不同的服务:T恤打印服务和支付服务.其中每个都有一个RESTful API,可能会失败.(例如,印刷公司可能拒绝在T恤上打印某些字样,如果信用卡已经过期,银行可能会抱怨.)有没有办法推测性地执行这两个请求,所以我的系统只会继续如果两个请求都显示有效?
如果没有,这个问题可以用不同的方式解决吗?通过POSTwith 创建资源status = pending,status = complete如果所有请求都成功,则将其更改为?(DELETE更棘手......)
如何暂时禁用browsersync,以便它不会注入/修改HTML页面?(用于测试和调试.)
根据规范,pushsubscriptionchange事件表明“推送订阅已失效,或即将失效”。处理此事件的最佳做法是什么?
使用Puppeteer,在执行页内JS之前,如何在页面上下文中运行完整DOM的脚本?
例如,在运行任何页面JS之前,如何运行以下脚本alt从img元素中删除属性?
document.querySelectorAll('img[alt]').forEach(
e => e.removeAttribute('alt')
)
Run Code Online (Sandbox Code Playgroud)
(page.evaluateOnNewDocument看起来它会很有用,但它似乎是在页面内容可用之前执行的 - 在它运行的时候,页面是空白的.)
硬重新加载或硬刷新(例如,Chrome中的移位重新加载)似乎绕过服务工作者.
例如,加载服务工作者控制的页面,例如https://airhorner.com/或https://wiki-offline.jakearchibald.com/,在devtools中将网络设置为"脱机",然后重新加载页面导致破碎的"没有互联网连接"页面.(正常重新加载显示缓存页面,如预期的那样.)
有没有办法防止这种情况,或者在设备脱机时使用服务工作者作为后备?
默认情况下,Capistrano酒店的deploy任务从创建符号连接shared/log,shared/system和shared/pids目录到版本目录.我怎么能阻止这个?
假设我提供了不同网站使用的推送通知服务。此服务需要在我客户的站点上安装 Service Worker。我希望架构具有一些属性:
满足这两个约束是很困难的,因为浏览器只有在 Service Worker 脚本本身的内容发生变化时才会安装新版本的 Service Worker。(也就是说,不考虑通过importScripts().指定的依赖项。)
如何将UTF-8字符串(即8位字符串)转换为XML兼容的7位字符串(即带有数字实体的可打印ASCII)?
即一个encode()功能:
encode("“£”") -> "“£”"
Run Code Online (Sandbox Code Playgroud)
decode() 也很有用:
decode("“£”") -> "“£”"
Run Code Online (Sandbox Code Playgroud)
PHP的htmlenties()/ html_entity_decode()对不是正确的事情:
htmlentities(html_entity_decode("“£”")) ->
"&#8220;£&#8221;"
Run Code Online (Sandbox Code Playgroud)
费力地指定类型会有所帮助,但仍会返回与XML不兼容的命名实体,而不是数字实体:
htmlentities(html_entity_decode("“£”", ENT_QUOTES, "UTF-8"), ENT_QUOTES, "UTF-8") ->
"“£”"
Run Code Online (Sandbox Code Playgroud) 服务工作者缓存是否支持缓存控制头?例如,如果缓存中的条目具有标题cache-control: no-store或者cache-control: max-age=60这些条目是否受到尊重match()?
CACHE HIT尽管cache-control: no-store响应中出现标题,但以下代码仍会输出.(我认为同样的问题适用于max-age.)
function warm(c) {
var req = new Request("/foo.txt");
var res = new Response("hello", {
status: 200,
statusText: "OK",
headers: new Headers({
"cache-control": "no-store",
"content-type": "text/plain"
})
});
return c.put(req, res).then(function () { return c; });
}
function lookup(c) {
return c.match(new Request("/foo.txt")).then(function (r) {
return r ? "CACHE HIT" : "CACHE MISS";
});
}
function deleteAllCaches() {
return caches.keys().then(function (cacheNames) {
return Promise.all( …Run Code Online (Sandbox Code Playgroud) 以下代码是否保证输出HERE?
var p = new Promise(() => console.log("HERE"))
Run Code Online (Sandbox Code Playgroud)
(也就是说,如果永远不会被调用来对结果做某事,那么var p = new Promise(fn)总会执行吗?)fnp.then(…)
更具体地说,在服务工作者的上下文中,如果我调用Cache.delete()但从不调用.then()返回值(或者我扔掉返回值),是否保证缓存条目被删除?
javascript ×5
php ×2
breakpoints ×1
browser-sync ×1
capistrano ×1
chef-infra ×1
debugging ×1
deployment ×1
html ×1
livereload ×1
netbeans ×1
promise ×1
puppeteer ×1
rest ×1
rollback ×1
shared ×1
transactions ×1
unicode ×1
utf-8 ×1
validation ×1
web-push ×1
xdebug ×1
xml ×1