小编Wil*_*lly的帖子

如何在Java中转换Youtube API V3持续时间

Youtube V3 API使用ISO8601时间格式来描述视频的持续时间.有点像"PT1M13S".现在我想将字符串转换为秒数(例如在这种情况下为73).

是否有任何Java库可以帮助我轻松完成Java 6下的任务?或者我必须自己做正则表达式的任务?

编辑

最后,我接受@Joachim Sauer的回答

示例代码Joda如下.

PeriodFormatter formatter = ISOPeriodFormat.standard();
Period p = formatter.parsePeriod("PT1H1M13S");
Seconds s = p.toStandardSeconds();

System.out.println(s.getSeconds());
Run Code Online (Sandbox Code Playgroud)

java youtube-api time-format

18
推荐指数
3
解决办法
7084
查看次数

与Jersey和Spring集成Grizzly2.2.X

我已经成功地Grizzly v2.1.9使用JerseySpring.但是在尝试迁移Grizzly到版本时无法使其工作2.2.19.

原始代码Grizzly v2.1.9如下.

HttpServer server = new HttpServer();
NetworkListener listener = new NetworkListener("grizzly2", "localhost", 3388);
server.addListener(listener);

ServletHandler sa = new ServletHandler();       
sa.setContextPath("/");     
sa.setServletInstance(new SpringServlet());
sa.addContextParameter("contextConfigLocation", "classpath:spring-context.xml");                
sa.addServletListener("org.springframework.web.context.ContextLoaderListener");
sa.addServletListener("org.springframework.web.context.request.RequestContextListener");                

ServerConfiguration config = server.getServerConfiguration();
config.addHttpHandler(sa, new String[] {"/"});
server.start();
Run Code Online (Sandbox Code Playgroud)

新代码Grizzly v2.2.19如下

HttpServer server = new HttpServer();
NetworkListener listener = new NetworkListener("grizzly2", "localhost", 3388);
WebappContext ctx = new WebappContext("ctx","/");       
final ServletRegistration reg = ctx.addServlet("spring", new SpringServlet());
reg.addMapping("/*");
ctx.addContextInitParameter("contextConfigLocation", …
Run Code Online (Sandbox Code Playgroud)

java spring jersey grizzly web

5
推荐指数
1
解决办法
1721
查看次数

是否有像jQuery .is()的谷歌闭包功能

我对Jquery比较熟悉,但我正在使用Google Closure.我想知道在Google Closure中是否有任何函数或库,比如jQuery中的.is(),所以我可以检查目标元素是否与css选择器匹配.我找到了一个插件goog.dom.query,但这不是我需要的,因为它用于查找元素.

jquery google-closure

5
推荐指数
1
解决办法
421
查看次数

在C++ Builder XE2中使用TDictionary

目前我想TDitionary在C++ Buillder XE2中使用

在我阅读文档后,我认为应该很容易,但我甚至无法创建TDictionary对象......

我的代码:

#include <vcl.h>
#pragma hdrstop
#include <Generics.collections.hpp>
#include "TDictionaryTest.h"

#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;

void __fastcall TForm2::FormCreate(TObject *Sender)
{
    TDictionary__2 <String, String> *Dir = new  TDictionary__2<String, String>(0);
    delete Dir;
}
Run Code Online (Sandbox Code Playgroud)

错误消息:

[ILINK32 Error] Error: Unresolved external '__fastcall           System::Generics::Collections::TDictionary__2<System::UnicodeString,   System::UnicodeString>::~TDictionary__2<System::UnicodeString, System::UnicodeString>()'  referenced from ...\PRACTICE\C++\WIN32\DEBUG\TDICTIONARYTEST.OBJ
[ILINK32 Error] Error: Unresolved external '__fastcall System::Generics::Collections::TEnumerable__1<System::Generics::Collections::TPair__2<System::UnicodeString, System::UnicodeString> >::~TEnumerable__1<System::Generics::Collections::TPair__2<System::UnicodeString, System::UnicodeString> >()' referenced from ...\PRACTICE\C++\WIN32\DEBUG\TDICTIONARYTEST.OBJ
[ILINK32 Error] Error: Unresolved external 'System::Generics::Collections::TDictionary__2<System::UnicodeString, System::UnicodeString>::' referenced from ...\PRACTICE\C++\WIN32\DEBUG\TDICTIONARYTEST.OBJ
[ILINK32 …
Run Code Online (Sandbox Code Playgroud)

c++ dictionary c++builder c++builder-xe2

3
推荐指数
1
解决办法
2793
查看次数

SVG ClipPath 不适用于 wkhtmltopdf

最近我创建了一个与纽约时代相似的图表。它运作良好。我尝试通过 wkhtmltopdf 将页面导出为 pdf。我发现是否带有clipPath的svg是由JS在运行时生成的。我可以成功导出pdf。 在此处输入图片说明 但是,如果带有 clipPath 的 svg 最初在 html 中(我从上一个复制了 html 文本)。clipPath 部分不再起作用(如附件)。我猜它与带有剪辑路径的绝对路径有关。但仍然没有运气。对我的下一步有什么建议吗?

以下是我示例中的相关 svg,可以在浏览器中查看,但不适用于 wkhtmltopdf。(参考纽约时报) 本地文件

在此处输入图片说明

javascript svg wkhtmltopdf

3
推荐指数
1
解决办法
682
查看次数

小小 | 链接插件 | 如何禁用 URL 菜单?

目前,当我使用 TinyMce4.5.1 和 Link 插件时。即使我将属性 link_list 设置为 false,我也找不到隐藏默认 URL 选项(#​​top、#bottom)的方法。除了破解原始源代码之外,还有其他正确的方法可以做到这一点吗?

tinymce tinymce-4

3
推荐指数
1
解决办法
884
查看次数

Youtube V3 API:知道该视频是否可在Android移动设备上使用

最近,我使用Youtbe V3 API检索应在Android应用上播放的视频信息.问题是它们中的一些在移动设备上是不可用的.根据该文件,我没有找到相关的财产.我可以过滤掉那些视频吗?或者我应该在http请求中添加任何标头?

android youtube-api

2
推荐指数
1
解决办法
2644
查看次数