我想在 vi 中实现以下目标:
对于上述要求,我有以下命令
:%s/new page //g
删除前两列。
:g/abc/d
, :g/xyz/d
,:g/ddd/d
删除以特定单词开头的行。
:%s/ .*//g
删除第一个单词之后的所有内容。
总的来说,我想运行以下命令:
:%s/new page //g
:g/abc/d
:g/xyz/d
:g/ddd/d
:%s/ .*//g
如何在一个命令中执行所有上述命令。
我已经尝试过|
,但没有成功。
:g/abc/d|:g/xyz/d|:g/ddd/d
我收到以下错误:
E147: Cannot do :global recursive
我怎样才能做到这一点。我想在一个命令中执行所有命令。
谢谢
我正在尝试使用Spring Boot Rest API提供存储在S3上的一个PDF.
以下是我的代码:
byte[] targetArray = null;
InputStream is = null;
S3Object object = s3Client
.getObject(new GetObjectRequest("S3_BUCKET_NAME", "prefixUrl"));
InputStream objectData = object.getObjectContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(objectData));
char[] charArray = new char[8 * 1024];
StringBuilder builder = new StringBuilder();
int numCharsRead;
while ((numCharsRead = reader.read(charArray, 0, charArray.length)) != -1) {
builder.append(charArray, 0, numCharsRead);
}
reader.close();
objectData.close();
object.close();
targetArray = builder.toString().getBytes();
is = new ByteArrayInputStream(targetArray);
return ResponseEntity.ok().contentLength(targetArray.length).contentType(MediaType.APPLICATION_PDF)
.cacheControl(CacheControl.noCache()).header("Content-Disposition", "attachment; filename=" + "testing.pdf")
.body(new InputStreamResource(is));
Run Code Online (Sandbox Code Playgroud)
当我使用邮递员点击我的API时,我能够下载PDF文件,但问题是它完全是空白的.可能是什么问题?
S3流数据并不保留缓冲区,数据是二进制(PDF),因此如何使用Rest API将这些数据服务器.
怎么解决这个?
我有一个简单的问题.我的代码中有一些内存泄漏,因为我认为这是因为PreparedStatement和ResultSet我想知道什么是释放资源及其内存的最佳,安全和正确的方法.
PreparedStatement.close()
还是PreparedStatement = null
?
ResultSet.close()
还是ResultSet = null
?
谢谢
以下是我用于创建 RDS 实例的 CFD 脚本。我正在尝试创建与 PostgreSQL 兼容的 Amazon Aurora,但我面临:Invalid Storage Type : gp2
错误。
SnapshotRDSDBInstance:
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: 20
DBInstanceClass: 'db.t3.medium'
DBName: mydatabase
StorageType: gp2
Engine: aurora-postgresql
PubliclyAccessible: true
MultiAZ: false
DBSubnetGroupName: !Ref SnapshotRDSDBSubnetGroup
VPCSecurityGroups:
- !Ref SnapshotRDSDBSG
MasterUsername: 'test'
MasterUserPassword: 'Demo@123'
BackupRetentionPeriod: 15
DBInstanceIdentifier: 'myrds'
Run Code Online (Sandbox Code Playgroud)
我还尝试删除StorageType
上面脚本中的参数,但随后我遇到Invalid storage type: standard
错误。我无法理解根本原因。我正在使用ap-south-1
(孟买)区域来启动此脚本。
以下是我的日志
# Time: 2017-11-02T07:41:22.631956Z# User@Host: root[root] @ localhost [] Id:
Run Code Online (Sandbox Code Playgroud)
我无法为这个词写下grok模式root[root]
.我想将此值作为单个列.示例:host = root[root]
.
我想要[
我的价值.
这该怎么做 ?
我是 ElasticsearchTemplate 的新手。我想根据我的查询从 Elasticsearch 获取 1000 个文档。我已经使用 QueryBuilder 创建了我的查询,它运行良好。我浏览了以下链接,其中指出可以使用扫描和滚动来实现大数据集。
链接一
链接二
我正在尝试在以下代码部分中实现此功能,我从上面提到的链接之一复制粘贴了这些代码。但我收到以下错误:
The type ResultsMapper is not generic; it cannot be parameterized with arguments <myInputDto>.
MyInputDto
是@Document
我项目中带有注释的类。一天结束,我只想从 Elasticsearch 检索 1000 个文档。我试图找到size
参数,但我认为它不受支持。
String scrollId = esTemplate.scan(searchQuery, 1000, false);
List<MyInputDto> sampleEntities = new ArrayList<MyInputDto>();
boolean hasRecords = true;
while (hasRecords) {
Page<MyInputDto> page = esTemplate.scroll(scrollId, 5000L,
new ResultsMapper<MyInputDto>() {
@Override
public Page<MyInputDto> mapResults(SearchResponse response) {
List<MyInputDto> chunk = new ArrayList<MyInputDto>();
for (SearchHit searchHit : response.getHits()) {
if (response.getHits().getHits().length …
Run Code Online (Sandbox Code Playgroud) amazon-rds ×1
amazon-s3 ×1
aws-java-sdk ×1
aws-sdk ×1
java ×1
logstash ×1
spring ×1
vi ×1
vim ×1