我经常需要在页面元素中存储少量引用,大多数时候是a <div>.我找不到太多关于创建自己的属性的有效性的文档.你有什么建议是最有效的方法,甚至可以做到这一点?如果是这样,我可以使用jQuery的attr()调用来获取引用吗?
例如: <div class="sample" dataref="Sample Data Reference"></div>
如何使用WebClient.DownloadFile摘要式身份验证和查询字符串?
当我尝试使用它时,我得到401响应.
这是Apache错误日志:
[Tue Jun 24 17:31:49 2014] [error] [client x.x.x.x] Digest: uri mismatch - </file-1.php> does not match request-uri </file-1.php?since=1403587422>
Run Code Online (Sandbox Code Playgroud)
以下是我尝试下载文件的方法:
Uri uri = new Uri("http://example.com/file-1.php?since=1403587422");
WebClient webClient = new WebClient();
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(
new Uri(uri.GetLeftPart(UriPartial.Authority)),
"Digest",
new NetworkCredential("username", "password")
);
webClient.Credentials = credentialCache;
webClient.DownloadFile(uri, file.OutputFile);
Run Code Online (Sandbox Code Playgroud) 如何调试没有错误消息的错误?
加载PHP页面时,我在Firefox中收到此错误.
The connection to the server was reset while the page was loading.
Run Code Online (Sandbox Code Playgroud)
它没有说明除了它似乎是Apache崩溃之外的原因.
Apache错误日志显示:
[Wed Nov 03 10:23:04 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Wed Nov 03 10:23:06 2010] [notice] Digest: generating secret for digest authentication ...
[Wed Nov 03 10:23:06 2010] [notice] Digest: done
[Wed Nov 03 10:23:06 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Wed Nov 03 10:23:06 2010] [notice] Server built: Nov …Run Code Online (Sandbox Code Playgroud) 我有一个联系消息系统的查询,我做的连接越多,指数越来越慢.
表结构基本上是联系表和联系人字段表.
查询多次加入联系人字段表,对于每次加入,它需要两倍的时间.
这是查询.
SELECT SQL_CALC_FOUND_ROWS
`contact_data`.`id`,
`contact_data`.`name`,
`fields0`.`value` AS `fields0`,
`fields1`.`value` AS `fields1`,
`fields2`.`value` AS `fields2`,
...etc...
CONTACT_DATA_TAGS(
GROUP_CONCAT(DISTINCT `contact_data_tags`.`name`),
GROUP_CONCAT(DISTINCT `contact_data_assignment`.`user`),
GROUP_CONCAT(DISTINCT `contact_data_read`.`user`)
) AS `tags`,
GROUP_CONCAT(DISTINCT `contact_data_assignment`.`user`) AS `assignments`,
`contact_data`.`updated`,
`contact_data`.`created`
FROM
`contact_data`
LEFT JOIN contact_data_tags ON contact_data.`id` = contact_data_tags.`data`
LEFT JOIN contact_data_assignment ON contact_data.`id` = contact_data_assignment.`data`
LEFT JOIN contact_data_read ON contact_data.`id` = contact_data_read.`data`
LEFT JOIN contact_data_fields AS fields0 ON contact_data.`id` = fields0.`contact_data_id` AND fields0.`key` = :field1
LEFT JOIN contact_data_fields AS fields1 ON contact_data.`id` = fields1.`contact_data_id` AND …Run Code Online (Sandbox Code Playgroud) 如何在Web应用程序的客户端解密某些加密数据?
例如
可能我可以将私钥传递给浏览器并使用Javascript来解密数据.
如何从PHPUnit的代码覆盖范围中排除基目录?
这是我的phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="include.php"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<testsuite name="MyProject">
<directory>classes/*</directory>
</testsuite>
<logging>
<log type="coverage-html" target="../reports/coverage" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-xml" target="../reports/coverage.xml"/>
<log type="test-xml" target="../reports/logfile.xml" logIncompleteSkipped="false"/>
<log type="testdox-html" target="../reports/testdox.html"/>
<log type="testdox-text" target="../reports/testdox.txt"/>
</logging>
</phpunit>
Run Code Online (Sandbox Code Playgroud)
输出时,它包括所有基本目录,如:
c:\work\some\path\MyProject
Run Code Online (Sandbox Code Playgroud)
如何使其仅包括...\MyProject\*代码覆盖率输出?
如何使用Respect Validation获得多个自定义错误消息.
我有一些输入,我想针对多个验证器进行验证.我希望每次验证都有自定义错误消息.
这是我试过的:
try {
Respect\Validation\Validator::create()
->key('foo',
v::length(20)->setName('bar')->setTemplate('Custom length message.')
->alnum()->setName('baz')->setTemplate('Custom alnum message.')
)
->assert([
'foo' => 'Hello, world!',
]);
} catch (Respect\Validation\Exceptions\ValidationException $exception) {
$errors = $exception->findMessages([
'bar',
'baz',
]);
var_dump($errors);
}
Run Code Online (Sandbox Code Playgroud)
输出是:
array (size=2)
'bar' => string '' (length=0)
'baz' => string 'Custom alnum message.' (length=21)
Run Code Online (Sandbox Code Playgroud)
我希望它输出两个自定义错误消息.
Idealy我可以获得1个输入的消息数组,如:
var_dump($exception->findMessages(['foo']));
Run Code Online (Sandbox Code Playgroud)
会给我:
array (size=1)
'foo' =>
array (size=2)
0 => string 'Custom length message.' (length=22)
1 => string 'Custom alnum message.' (length=21)
Run Code Online (Sandbox Code Playgroud)
这个问题看起来像是杂草.
这个错误在IE10/11中意味着什么:
Error: Could not complete the operation due to error 800a025e.
Run Code Online (Sandbox Code Playgroud)
我该如何调试它?
它说它的这一行:
this.nativeSelection.removeAllRanges();
Run Code Online (Sandbox Code Playgroud)
https://code.google.com/p/rangy/source/browse/trunk/src/js/core/wrappedselection.js#416
请在此处查看:http://panmedia.github.io/raptor-editor/tests/cases/selection/selection-expand.html
javascript internet-explorer rangy internet-explorer-10 internet-explorer-11
有没有办法嵌套jQuery sortables?与嵌套容器一样,不是嵌套列表.
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="container">
<div class="item"></div>
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<div class="item"></div>
</div>
$('.container').sortable({
connectWith: '.container'
});
Run Code Online (Sandbox Code Playgroud)
这个例子非常有效,但是当我删除嵌套容器时,我收到一个错误:
Uncaught HierarchyRequestError: A Node was inserted somewhere it doesn't belong.
Run Code Online (Sandbox Code Playgroud)
我认为这是因为当拖动container它时,它位于鼠标下方,所以当我放下它时,它会尝试将它放在自身内部.
我有一个工作,虽然不理想所以问题仍然存在.
$('.container').sortable({
connectWith: '.container:not(.ui-sortable-helper)',
tolerance: "pointer",
cursorAt: { left: -50 }
});
Run Code Online (Sandbox Code Playgroud)
javascript jquery jquery-ui jquery-ui-sortable nested-sortable
是否有纯粹的JS等同于jQuery .is()(仅限现代浏览器).
我知道有querySelector,但我想检查节点本身,而不是找到子节点.
javascript ×4
jquery ×3
php ×3
apache ×2
mysql ×2
.net ×1
c# ×1
debugging ×1
encryption ×1
equivalent ×1
gnupg ×1
html ×1
jquery-ui ×1
performance ×1
pgp ×1
phpunit ×1
rangy ×1
sql ×1
unit-testing ×1
validation ×1
webclient ×1
xdebug ×1