小编Pra*_*any的帖子

如何使用 terraform 在 Google Compute Engine 上启用允许 HTTP 流量/允许 HTTP 流量

有没有其他方法可以直接使用 terraform 启用这些规则,而无需在 GCP 中创建单独的防火墙规则,然后将标签附加到计算引擎

在此输入图像描述

目前我正在这样做

resource "google_compute_firewall" "allow_http" {
  name    = "allow-http-rule"
  network = "default"
  allow {
    ports    = ["80"]
    protocol = "tcp"
  }
  target_tags = ["allow-http"]
  priority    = 1000

}
Run Code Online (Sandbox Code Playgroud)

然后使用这个标签

resource "google_compute_instance" "app" {
  ...
  tags = ["allow-http"]
}
Run Code Online (Sandbox Code Playgroud)

google-compute-engine google-cloud-platform terraform terraform-provider-gcp

11
推荐指数
1
解决办法
6212
查看次数

使用 Cypress 连接到 SQL DB

我正在尝试按照NPM 指南使用 cypress 连接 SQL db 。所有的依赖项都和前面提到的完全一样,但是在运行这个的时候

 cy.sqlServer('SELECT Email FROM [MyDB].[dbo].[User] WHERE Name ="test"')
Run Code Online (Sandbox Code Playgroud)

运行时出现如下错误。

CypressError: cy.task('sqlServer:execute') 失败,错误如下:

类型错误:未给出连接配置。

虽然我的 cypress.json 文件有我的数据库连接字符串。

Cypress.json

{
"baseUrl": "myurl",
"db": {
    "userName": "test",
    "password": "test",
    "server": "test\\test",
    "options": {
        "database": "test",
        "encrypt": true,
        "rowCollectionOnRequestCompletion" : true
    }
}    
}
Run Code Online (Sandbox Code Playgroud)

下面是我的 plugins/index.js 文件

  const sqlServer = require('cypress-sql-server');
module.exports = (on, config) => {
  // `on` is used to hook into various events Cypress emits
  // `config` is the resolved Cypress config
  tasks …
Run Code Online (Sandbox Code Playgroud)

javascript sql database-connection npm cypress

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

使用 iTextSharp 为 PDF 添加数字签名

背景

我已经使用 iTextSharp 一段时间了。我创建了一个带有两个可签名 PdfFormFields 的 pdf 文档。如果我打开 pdf 文档,我可以手动对每个字段进行签名。我希望这可以通过 iTextSharp 完成。

我目前正在从 X509Store 检索证书。到此为止,我可以想通了。

有人可以告诉我如何使用这个 X509Certificate2 来签署一个已经存在的签名 AcroField。

在此处输入图片说明

参考

访问了以下参考资料,但找不到我正在寻找的答案。 签署pdf文件

这个链接让我相信我是最接近的,但是使用的几行是无效的,我不知道我是否可以通过包含其他一些库来修复它。 https://www.dotnetportal.cz/blogy/15/Null-Reference-Exception/5250/Digitalni-podepisovani-PDF-souboru-vC-cast-2

c# pdf itext digital-signature x509certificate2

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

使用 r 抓取数据时处理 tripadvisor 中的“更多”按钮

我正在使用此代码从旅行顾问中提取数据。

install.packages("rvest")
library(rvest)
install.packages("xmlparsedata")
library(xmlparsedata)
install.packages("xml2")
library(xml2)
install.packages("XML")
library(XML)

url.1 <- "https://www.tripadvisor.ie/Restaurant_Review-g186605-d4046860- 
Reviews-The_Stage_Door_Cafe-Dublin_County_Dublin.html"

reviews <- url.1 %>%
read_html() %>%
html_nodes("#REVIEWS .innerBubble")

id <- reviews %>%
html_node(".quote a") %>%
html_attr("id")

quote <- reviews %>%
html_node(".quote span") %>%
html_text()

rating <- reviews %>%
html_node(".rating .rating.bubble") %>%
html_attr("alt") %>%
gsub(" of 5 stars", "", .) %>%
as.integer()

date <- reviews %>%
html_node(".ratingDate .relativeDate") %>%
html_attr("title") %>%
strptime("%b %d, %Y") %>%
as.POSIXct()

review <- reviews %>%
html_node(".entry .partial_entry" ) %>%
html_text()

a.1 <- data.frame(id, …
Run Code Online (Sandbox Code Playgroud)

r

5
推荐指数
0
解决办法
439
查看次数

错误:1407742E:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报协议版本

我正在使用旧的Macbook运行Osx Lion 10.7.5,这是它支持的最高升级.在运行git clone时出现此错误.

Veers-Macbook:~ Veer$ git clone https://github.com/heroku/python-getting-started.git
Cloning into 'python-getting-started'...
fatal: unable to access 'https://github.com/heroku/python-getting-started.git/': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Run Code Online (Sandbox Code Playgroud)

根据其他类似问题,我的系统详情如下:

Veers-Macbook:~ Veer$ which git
/usr/local/git/bin/git

Veers-Macbook:~ Veer$ git --version
git version 2.3.5

Veers-Macbook:~ Veer$ git config http.sslVersion
tlsv1.2
Run Code Online (Sandbox Code Playgroud)

我跑了这两个命令

    git config --global --unset http.sslVersion
    git config --global --add http.sslVersion tlsv1.2
Run Code Online (Sandbox Code Playgroud)

验证我运行配置文件

 Veers-Macbook:~ Veer$ git config --global --list
 user.name=Gurupratap Matharu
 user.email=gurupratap.matharu@gmail.com
 credential.helper=osxkeychain
 core.excludesfile=/Users/admin/.gitignore
 mergetool.sublime.cmd=subl -w $MERGED
 mergetool.sublime.trustexitcode=false
 merge.tool=sublime
 alias.gui=!sh -c '/usr/local/git/libexec/git-core/git-gui'
 http.sslversion=tlsv1.2
Run Code Online (Sandbox Code Playgroud)

看起来配置文件有http tlsv1.2,但错误仍然存​​在.

你能指导我怎么解决这个问题.我唯一的目标是通过命令行使用github.

macos openssl

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

找不到类型为“ org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder”的bean

我想通过创建一个简单的登录屏幕在我的项目中使用Spring Boot Security,但是即使为BCryptPassworrdEncoder定义了bean,也遇到了这些错误。完整的错误是

com.mahmut.demoemployee.application.dao.Imp.UserDaoImp中的字段bCryptPasswordEncoder需要找不到类型为'org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder'的bean。

这是我的代码。

package com.mahmut.demoemployee.application.dao.Imp;
    //Some imports

            @Component
        public class UserDaoImp implements UserDao {

            @Autowired
            UserRepository userRepository;

            @Qualifier("roleRepository")
            @Autowired
            RoleRepository roleRepository;

            @Autowired
            private BCryptPasswordEncoder bCryptPasswordEncoder;

            @Override
            public User save(User user) {
                user.setPassword(bCryptPasswordEncoder.encode(user.getPassword()));
                user.setActive(1);
                Role userRole = roleRepository.findByRole("ADMIN");
                user.setRoles(new HashSet<Role>(Arrays.asList(userRole)));
                return userRepository.save(user);
            }

            @Override
            public User findUserByEmail(String email) {
                return userRepository.findByEmail(email);
            }

            @Override
            public List<User> findAll() {
                return (List<User>) userRepository.findAll();
            }
        }
Run Code Online (Sandbox Code Playgroud)

这是我的配置类。

    package com.mahmut.demoemployee.application.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;


@Configuration
public class WebMvcConfig extends WebSecurityConfigurerAdapter …
Run Code Online (Sandbox Code Playgroud)

java spring-security spring-boot

4
推荐指数
1
解决办法
9030
查看次数