我在服务器上的ssl vhost中设置了这一行.我正在运行Apache 2.x.
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
Run Code Online (Sandbox Code Playgroud)
这是一个重大错误,因为现在我想删除它并迫使用户http有时回到页面.它没有启用很长时间,但我不想失去任何人.如果我现在尝试强制用户回到http页面,他们最终会进入重定向循环.
如何使用服务器上的设置取消设置或使HSTS失效,以便当用户访问该站点并点击该站点的https版本时,Strict-Transport-Security设置将从其浏览器中删除,并且可以将它们重定向到http?
我已经知道我犯了一个愚蠢的错误.我吸取了教训,现在只需要清理它.
我想从我的mysql.general_log表中删除旧行但遇到此错误:
#1556 - You can't use locks with log tables.
Run Code Online (Sandbox Code Playgroud)
这是我跑的查询:
DELETE FROM `general_log` WHERE `event_time` < "2014-01-25 14:05"
Run Code Online (Sandbox Code Playgroud) 我有一个bash shell脚本,可以像这样调用一些PHP脚本.
#!/bin/bash
php -f somescript.php
php -f anotherscript.php
Run Code Online (Sandbox Code Playgroud)
我想根据这些脚本的结果撰写错误日志和/或活动报告.
有什么办法可以在shell脚本中获取php脚本的退出状态吗?
我可以使用整数退出状态或字符串消息.
我有一个这样的课:
class someClass {
public static function getBy($method,$value) {
// returns collection of objects of this class based on search criteria
$return_array = array();
$sql = // get some data "WHERE `$method` = '$value'
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)) {
$new_obj = new $this($a,$b);
$return_array[] = $new_obj;
}
return $return_array;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:我可以按照上面的方式使用$ this吗?
代替:
$new_obj = new $this($a,$b);
Run Code Online (Sandbox Code Playgroud)
我可以写:
$new_obj = new someClass($a,$b);
Run Code Online (Sandbox Code Playgroud)
但是当我扩展类时,我将不得不重写该方法.如果第一个选项有效,我将不必这样做.
更新解决方案:
这两个都在基类中工作:
1.)
$new_obj = new static($a,$b);
Run Code Online (Sandbox Code Playgroud)
2.)
$this_class = get_class();
$new_obj = new …Run Code Online (Sandbox Code Playgroud) 当我在页面上只有一个表时,插件工作正常.
但有两个,我得到一个错误:
未捕获的TypeError:无法设置未定义的属性'count'
这是因为sortList下面的选项设置.我把它设置为在第4列排序,并且aux_table首先显示,只有3列.但它有效,main_table但没有.我如何让他们工作,或者只是第二,更重要main_table?
两个表都是类tablesorter,它们具有不同的ID(main_table和aux_table).
页面上的第一个表可用,第二个表没有.这是我的<head>标签中的JS :
$(document).ready(function() {
// call the tablesorter plugin
$("table").tablesorter({
// sort on the 4th column (index 3) column, DESC (1). ASC is (0).
sortList: [[3,1]]
});
});
Run Code Online (Sandbox Code Playgroud) 在 Windows bash 中,它似乎git config --list显示了多个范围的设置,但没有告诉您每个范围的设置。
我试图通过将core.autocrlf所有内容设置为 false 来确保我再也不会遇到 CRLF 问题。
git config --list 给我这样的东西:
$ git config --list
core.symlinks=false
core.autocrlf=input // <-- HERE
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
gui.recentrepo=C:/Users/Buttle/PhpstormProjects/stuffs
gui.recentrepo=C:/Users/Buttle/PhpstormProjects/lolcatz
user.name=buttletime
user.email=Buttle@example.com
core.autocrlf=false // <-- AND HERE
credential.helper=cache --timeout=3600
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=https://github.com/buttletime/lolcatz.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
gui.wmstate=normal
gui.geometry=1385x655+182+182 420 192
branch.master.remote=origin
branch.master.merge=refs/heads/master
Run Code Online (Sandbox Code Playgroud)
似乎第二个可能是我的lolcatz项目的本地项目。但是当我检查它时,我的全局设置也是“假”。
在UBUNTU和CENTOS.
我有一些我想基于其内容tar的文件.
$ grep -rl "123.45" .
Run Code Online (Sandbox Code Playgroud)
以这种格式返回大约10个文件的列表:
./somefolder/someotherfolder/somefile.txt
./anotherfolder/anotherfile.txt
Run Code Online (Sandbox Code Playgroud)
等等...
我想tar.gz所有这些.
我试过了:
$ grep -rl "123.45" . | tar -czf files.tar.gz
Run Code Online (Sandbox Code Playgroud)
不行.这就是我在这里的原因.有任何想法吗?谢谢.
只是尝试这样做,它在Ubuntu的工作,但在CentOS的我得到"焦油:02:无法统计:没有这样的文件或目录".
$ tar -czf test.tar.gz `grep -rl "123.45" .`
Run Code Online (Sandbox Code Playgroud)
如果其他人有更好的方式,请告诉我.至少在Ubuntu上面这个很好用.
我从jQuery UI站点复制了一些代码并将其附加到我自己的代码中:
$('.field_values') // class that all input fields are a member of in my html
// here I am skipping .autocomplete, which works
// next comes the copied code
.data( 'ui-autocomplete' )._renderItem = function( ul, item ) {
return $( '<li>' )
.append( '<a>' + item.label + '<br>' + item.value + '</a>' )
.appendTo( ul );
}
;
Run Code Online (Sandbox Code Playgroud)
我在这个_renderItem函数上找不到任何文档.另一个stackoverflow问题/答案表明问题可能是一个类而不是一个id.但我必须上课,因为有很多领域.
我怎样才能让这个与我的班级一起工作?
MySQL 5.5
父表: 编号 | 事实
子表: 父 ID | 外键 | 事实
现在,我想找到拥有特定一组孩子的父母,不多也不少。就像是:
SELECT t1.`id`
from `parent_table` t1
LEFT JOIN `child_table` t2 ON t1.id=t2.parent_id
WHERE t2.`fk` = 1
AND t2.`fk` = 3
AND t2.`fk` = 5
AND t2.`fk` = 7
AND t2.`fk` = 9
Run Code Online (Sandbox Code Playgroud)
但这也会得到这组孩子的父记录:1,2,3,5,7,9。我只想要那些拥有完全相同的孩子的父母:1,3,5,7,9。
有办法吗?
编辑:child.parent_id 和 child.fk都不是唯一的。child.fk 是链接到另一个表的外键。(“多对多关系”)因此,父母很可能有孩子 1,2,3,5,7,9。我执行此查询的全部原因是尝试避免为 1,3,5,7,9 创建新的父级(如果此类父级已存在)。
是的,我知道这可能与航路点无关.对不起.
我遵循这个例子:http://imakewebthings.com/jquery-waypoints/#get-started
这是我非常简单的javascript:
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="/includes/js/waypoints/waypoints.min.js"></script>
<script type="text/javascript">
$(document).ready(function(direction) {
$('#example-basic').waypoint(function() {
notify('Basic example callback triggered.');
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
脚本已加载.jQuery代码几乎是从示例中逐字逐句复制的.
每当我滚动过去id为'example-basic'的元素时,我都会收到错误.
我找不到任何此类"通知"方法的信息.
有任何想法吗?