我有一个带有一些标记的字符串,如下所示:
The quick brown <a href="www.fox.org">fox</a> jumped over the lazy <a href="entry://id=6000009">dog</a> <img src="dog.png" />.
我试图剥离除了锚点元素之外的所有内容,其中包含"entry:// id =".因此,上述示例的所需输出将是:
The quick brown fox jumped over the lazy <a href="entry://id=6000009">dog</a>.
写这场比赛,我到目前为止最接近的是:
<.*?>!<a href=\"entry://id=\\d+\">.*?<\\/a>
但我无法弄清楚为什么这不起作用.任何帮助(除了"为什么你不使用解析器":)将不胜感激!
我正在尝试将UITapGestureRecognizer添加到我的应用程序中,以便我可以检测并对所有两个手指点击进行操作,但是通过任何其他用户输入.听起来微不足道,但我无法让它发挥作用.这是我的代码到目前为止,在我的主视图控制器中:
- (void) viewDidLoad {
// other init stuff
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[tapRecognizer setNumberOfTouchesRequired:2];
[tapRecognizer setNumberOfTapsRequired:1];
[tapRecognizer setCancelsTouchesInView:NO];
UIView *tapHolderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[tapHolderView setMultipleTouchEnabled:YES];
[tapHolderView addGestureRecognizer:tapRecognizer];
[self.view addSubview:tapHolderView];
[tapRecognizer release];
}
- (void) handleTap:(UITapGestureRecognizer *) sender {
if (sender.state == UIGestureRecognizerStateEnded) {
// do something
}
}
Run Code Online (Sandbox Code Playgroud)
会发生什么:双指点按将触发handleTap方法.任何其他用户输入,无论是滑动,捏合,单指点击等,都不会被任何其他视图(UIToolbar,UIWebView等)拾取.
我非常感谢您对此有任何见解,如果我对这个问题不够具体,请告诉我.
multi-touch uiviewcontroller uiview ios uitapgesturerecognizer
我已经检查了有关如何执行此操作的文档,但没有找到答案。
基本上,当创建/发布文档时,我想createdDate为文档设置一个(作为只读/隐藏字段)。
我正在尝试使用以下命令在我的系统上安装pg gem(macbook pro运行10.10,Postgresql 9.3.5_1,Ruby 1.9.3p547,Xcode v6.1(6A1052c)):
ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
Run Code Online (Sandbox Code Playgroud)
返回此:
Building native extensions with: '--with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/Users/thomas/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
Using config values from /usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include …Run Code Online (Sandbox Code Playgroud) 我无法理解如何从理智中获取数据。我已经阅读了文档,但我仍然很困惑。
我尝试将数据记录到控制台,但它给了我一个错误,例如“请求的资源上不存在‘Access-Control-Allow-Origin’标头。”
import React from "react";
import sanityClient from "@sanity/client";
const Post = () => {
const client = sanityClient({
projectId: "6sf5fafo",
dataset: "production",
useCdn: true
});
// fetching the data
client
.fetch('*[__type == "post"][0]{title, "name": author->name}', {})
.then(res => {
console.log("Post info: ", res); // Here is when i tried to log the data but gets an error message.
})
.catch(err => {
console.log(err);
});
return (
<div>
<h1>Hello</h1>
</div>
);
};
export default Post;
Run Code Online (Sandbox Code Playgroud)
有人可以对我的代码进行一些编辑,以正确地从理智中获取数据,我们将非常感激。