上传到Amazon S3的小于5GB的文件有一个ETag,它只是文件的MD5哈希,这使您可以轻松检查本地文件是否与您在S3上的文件相同.
但是如果你的文件大于5GB,那么亚马逊会以不同的方式计算ETag.
例如,我在380个零件中进行了5,970,150,664字节文件的分段上传.现在S3显示它有一个ETag 6bcf86bed8807b8e78f0fc6e0a53079d-380
.我的本地文件有一个md5哈希值702242d3703818ddefe6bf7da2bed757
.我认为短划线后面的数字是分段上传中的部件数量.
我还怀疑新的ETag(在破折号之前)仍然是MD5哈希,但是在某种程度上从分段上传中包含了一些元数据.
有谁知道如何使用与Amazon S3相同的算法计算ETag?
如何在JavaScript中检查字符串是否是正确编译的正则表达式?
例如,当您执行以下javascript时,会产生错误.
var regex = new RegExp('abc ([a-z]+) ([a-z]+))');
// produces:
// Uncaught SyntaxError: Invalid regular expression: /abc ([a-z]+) ([a-z]+))/: Unmatched ')'
Run Code Online (Sandbox Code Playgroud)
如何确定字符串是否是有效的正则表达式?
通常我用命令运行我的Spring Boot应用程序:
mvn spring-boot:run -Drun.arguments=--server.port=9090 \
-Dpath.to.config.dir=/var/data/my/config/dir
Run Code Online (Sandbox Code Playgroud)
我想设置自定义端口进行调试,所以我可以从eclipse连接.当我从示例http://docs.spring.io/spring-boot/docs/1.1.2.BUILD-SNAPSHOT/maven-plugin/examples/run-debug.html添加参数时
mvn spring-boot:run -Drun.arguments=--server.port=9090 \
-Dpath.to.config.dir=/var/data/my/config/dir \
-Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787"
Run Code Online (Sandbox Code Playgroud)
它有效,但其他论点喜欢server.port
或path.to.config.dir
不再被认可,我得到例外:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to parse configuration class [com.my.app.Controller]; nested exception
is java.lang.IllegalArgumentException: Could not resolve placeholder
'path.to.config.dir' in string value
file:///${path.to.config.dir}/some.properties"
Run Code Online (Sandbox Code Playgroud)
问题:如何运行所有参数?
我已经阅读了fb文档和编写代码以将消息发布到facebook"页面",但是我收到的错误是我不希望看到的:
(#200) The user hasn't authorized the application to perform this action
Run Code Online (Sandbox Code Playgroud)
这就是我所做的:
APP_ID
和
APP_SECRET
.PAGE_ID
.USER_ACCESS_TOKEN
范围"publish_actions,manage_pages".我在重定向到facebook auth页面时接受了我的应用程序请求的权限.https://graph.facebook.com/me/accounts
使用了GET USER_ACCESS_TOKEN
,我收到了一份我管理的页面列表,包括我要发布的页面.我的页面的这个数据块看起来像:
{
"data": [
{
"category": "Community",
"name": "My Generic Test Page",
"access_token": PAGE_ACCESS_TOKEN,
"id": PAGE_ID,
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
},
....
]
}
Run Code Online (Sandbox Code Playgroud)
然后我用它PAGE_ACCESS_TOKEN
向页面发帖子:
https://graph.facebook.com/PAGE_ID/feed
用message
等于的字段进行了POSTThis is a test post.
Facebook回归:
{
"error": {
"message": "(#200) The …
Run Code Online (Sandbox Code Playgroud) 我使用mod_proxy_balancer来管理后端服务器的故障转移.后端服务器可能会返回错误代码,而不是在某些其他后端服务失败时(例如NFS)超时,我们希望此类服务器也被标记为失败的节点.因此我们使用failonstatus指令.
<Proxy balancer://avatar>
ProxySet failonstatus=503
BalancerMember http://active/ retry=30
# the hot standby
BalancerMember http://standby/ status=+H retry=0
</Proxy>
Run Code Online (Sandbox Code Playgroud)
目前,故障转移与一个故障完美配合.当活动节点发生故障时,用户会收到503错误,并且从下一个请求中,备用服务器将接管.
我甚至不希望一个请求失败.无法将mod_proxy故障转移到客户端并返回错误?如果活动节点出现故障,我希望mod_proxy为同一个请求尝试待机,而不仅仅是后续请求!
我想在MyBatis中为Select语句使用String参数.我的mapper.xml:
<select id="selectAll" parameterType="String" resultMap="fastXMLResultMap">
SELECT CREATIONDATE, DOCUMENTID, TITEL, REGTITEL, INFORCEDATE, DOCTYPE
FROM #{databBaseTable}
</select>
Run Code Online (Sandbox Code Playgroud)
和调用功能:
public List<FastXMLObject> selectAll(String databBaseTable) {
SqlSession session = sqlSessionFactory.openSession();
System.out.println("Table: "+databBaseTable);
try {
List<FastXMLObject> list = session.selectList("FastXMLObject.selectAll",databBaseTable);
return list;
} finally {
session.close();
}
}
Run Code Online (Sandbox Code Playgroud)
字符串dataBaseTable是我的数据库的表的名称(谁会想到)因为我想从verious表中动态获取数据.
但不幸的是,这不起作用:错误:ORA-00903:UngültigerTabellenname(表名无效)但它不是.当我打印出"databBaseTable"的值时,它就是表的确切名称.当我将表的名称写入我的mapper.xml而没有变量时,它可以工作.我做错了什么?
如果我在将来设置一个带有setMaxAge()的cookie,当我在后续请求中将cookie读回内存时,getMaxAge()会给我一个-1.我已经通过Chrome的设置和检查员检查了实际的Cookie,并且我可以验证到期日期确实设置为60天.
static public void setHttpCookie(HttpServletResponse response, String payload) {
Cookie c = new Cookie(COOKIE_NAME, payload);
c.setMaxAge(60*86400); // expire sixty days in the future
c.setPath("/"); // this cookie is good everywhere on the site
response.addCookie(c);
}
static public String checkForCookie(HttpServletRequest req) {
Cookie[] cookies = req.getCookies();
if ( cookies != null ) {
for ( Cookie c : cookies ) {
if ( COOKIE_NAME.equals(c.getName()) ) {
int maxAge = c.getMaxAge();
logger.debug("Read back cookie and it had maxAge of {}.", maxAge);
String …
Run Code Online (Sandbox Code Playgroud) 在Jersey文档中,示例16.2显示了将SecurityContext注入Jersey资源单例的示例.
当然,文档是正确的,给出的例子确实是线程安全的.
我怀疑SecurityContext的注入只发生一次,并且在getUserPrincipal()
调用时,它可能会从附加到线程本身的某个结构(可能是ThreadLocal对象?)中获取用户数据.这是我可以看到当有大量线程竞争时向最终用户提供正确的用户信息的唯一方式.
任何人都可以确认此行为,或以其他方式解释Jersey示例的线程安全性吗?
我知道这是有史以来最简单的问题,但我似乎无法找到答案而且我在黑暗中寻找,所以我会感激一点帮助.我正在尝试在class ='song_artist'的节点中获取文本.我有一个父节点的引用,但只是无法找到我正在寻找的文本.我的HTML看起来像这样:
<tr id='0000moe2008-05-23d01t01_vbr' class='row-even'><td class='song_name'>Captain America<h3> (00:00)</h3></td><td class='song_artist'>moe.</td><td class='song_date'>2008-05-23</td><td class='song_location'>Jones Beach, VA</td></td><td class='song_extras'></td></tr>
<tr id='00011-01_Rock_And_Roll_Part_2' class='row-odd'><td class='song_name'>Rock and Roll part 2<h3> (00:00)</h3></td><td class='song_artist'>Phish</td><td class='song_date'>1998-11-20</td><td class='song_location'>Jones Beach, VA</td></td><td class='song_extras'></td></tr>
<tr id='00021-03_Quinn_The_Eskimo' class='row-even'><td class='song_name'>Quinn the Eskimo<h3> (00:00)</h3></td><td class='song_artist'>Phish</td><td class='song_date'>1998-11-20</td><td class='song_location'>Jones Beach, VA</td></td><td class='song_extras'></td></tr>
Run Code Online (Sandbox Code Playgroud)
就像我说的,我有一个参考,<tr>
但不能成为<td>
我正在寻找的.我假设完整的参考文献看起来像:parent.firstChild.nextSibling.data
但我不断得到各种各样的死胡同.这里有任何javascript大师吗?