我需要选择字符串中的前 X 个单词,其中 x 可以是 0-100 之间的任何数字。是否有捷径可寻?我找到了以下示例来从字符串中选择前 2 个单词:
select regexp_replace('Hello world this is a test', '(\w+ \w+).*$','\1') as first_two
from dual
Run Code Online (Sandbox Code Playgroud)
如何从字符串中选择前 X 个单词,其中 X 可以是 0-100 之间的数字?
使用OpenLayers 3修改特征,如何获取修改后的特征?
var features = new ol.Collection(editableLayer.getSource().getFeatures());
var modifyInteraction = new ol.interaction.Modify({
features: features
})
map.addInteraction(modifyInteraction);
modifyInteraction.on("modifyend", modifyFeature, this);
Run Code Online (Sandbox Code Playgroud)
当我去获取该功能时:
function modifyFeature(event)
{
var feature1 = event.features.getArray()[0]; //this brings back all features
//I want to know which specific
//features was modified
var feature2 = modifyInteraction.getFeatures(); //this did not work at all
}
Run Code Online (Sandbox Code Playgroud)
我的问题是如何获得已修改的实际功能的参考?
目前,如果您通过 iis 添加 MIME 类型,如下所示:
打开 Internet 信息服务 (IIS) 管理器
在“连接”窗格中,转到要为其添加 MIME 类型的站点、应用程序或目录。在主页窗格中,双击 MIME 类型。
在 MIME 类型窗格中,单击操作窗格中的添加...。
在“添加 MIME 类型”对话框中,添加文件扩展名和 MIME 类型,然后单击“确定”。
当您执行 IISRESET 时,IIS 将删除该条目。有一些开发人员在执行 IISRESET 并清除用户创建的 mime 类型。我的问题是,如何永久添加 MIME 类型,以便即使开发人员执行 IISRESET,它也不会被清除并保留其他默认 MIME 类型。谢谢。
我正在使用以下代码在 openlayers 3 上尝试 wfs-t:
var formatWFS = new ol.format.WFS();
var formatGML = new ol.format.GML({
featureNS: 'http://argeomatica.com',
featureType: 'playa_sample',
srsName: 'EPSG:3857'
});
var transactWFS = function(p,f) {
switch(p) {
case 'insert':
node = formatWFS.writeTransaction([f],null,null,formatGML);
break;
case 'update':
node = formatWFS.writeTransaction(null,[f],null,formatGML);
break;
case 'delete':
node = formatWFS.writeTransaction(null,null,[f],formatGML);
break;
}
s = new XMLSerializer();
str = s.serializeToString(node);
$.ajax('https://gsx.geolytix.net/geoserver/geolytix_wfs',{
type: 'POST',
dataType: 'xml',
processData: false,
contentType: 'text/xml',
data: str
}).done();
}
Run Code Online (Sandbox Code Playgroud)
但是,当我运行更新事务(ajax 调用)时,它将几何列作为“几何”发送。我需要将其更改为大写“GEOM”:
...
<Property>
<Name>geometry</Name>
Run Code Online (Sandbox Code Playgroud)
...
应该: ...
<Property>
<Name>GEOM</Name>
Run Code Online (Sandbox Code Playgroud)
...
我尝试使用我发现的隐藏属性(geometryName_)设置该功能: …
我试图找到正确的RegEx模式,允许一个或两个字母后跟3到5个数字,最后可选一个字母.最后应该允许非字母数字包装字符串:
Allowed
M394
,MP4245)
TD493!
X4958A
V49534@
U394U
A5909.
Not Allowed
TED492
R32
R4!3
U394UU
A5909AA
5349A
Run Code Online (Sandbox Code Playgroud)
我找到了一个例子,但它不太有效:
谢谢你的帮助
我试图从我的视图控制器(在类内部但在函数外部)创建全局变量,如下所示:
var modelData: CustomTabBarController.model // THE ERROR IS HERE
Run Code Online (Sandbox Code Playgroud)
这是该类的定义方式:
CustomTabBarController.swift:
import UIKit
// This class holds the data for my model.
class ModelData {
var name = "Fred"
var age = 50
}
class CustomTabBarController: UITabBarController {
// Instantiate the one copy of the model data that will be accessed
// by all of the tabs.
var model = ModelData()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
"'model' is …
Run Code Online (Sandbox Code Playgroud)