小编Fab*_*urz的帖子

Selenium等待加载Ajax内容 - 通用方法

是否有一种通用的方法让Selenium等到所有ajax内容都加载完毕?(不依赖于特定的网站 - 所以它适用于每个ajax网站)

java selenium web-crawler selenium-webdriver

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

HikariCP连接太多了

我有一个Java Servlet,我想与jdbc(数据库:mysql)一起使用连接池.

所以这就是我在做的事情:

(这个类是公共最终类DBConnector)

private static final HikariDataSource dataSource = new HikariDataSource();
private static final HikariDataSource dataSource2 = new HikariDataSource();
private static final HikariDataSource dataSource3 = new HikariDataSource();

static {
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/contentdb");
    dataSource.setUsername("root2");
    dataSource.setPassword("password");
    dataSource.setMaximumPoolSize(400);
    dataSource.setMinimumIdle(5);
    dataSource.setLeakDetectionThreshold(15000);
    dataSource.setConnectionTestQuery("SELECT 1");
    dataSource.setConnectionTimeout(1000);

    dataSource2.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource2.setJdbcUrl("jdbc:mysql://localhost:3306/userdb");
    dataSource2.setUsername("root");
    dataSource2.setPassword("password");
    dataSource2.setMaximumPoolSize(300);
    dataSource2.setMinimumIdle(5);
    dataSource2.setLeakDetectionThreshold(15000);
    dataSource2.setConnectionTestQuery("SELECT 1");
    dataSource2.setConnectionTimeout(1000);

    dataSource3.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource3.setJdbcUrl("jdbc:mysql://localhost:3306/analysedb");
    dataSource3.setUsername("root2");
    dataSource3.setPassword("password");
    dataSource3.setMaximumPoolSize(200);
    dataSource3.setMinimumIdle(5);
    dataSource3.setLeakDetectionThreshold(15000);
    dataSource3.setConnectionTestQuery("SELECT 1");
    dataSource3.setConnectionTimeout(1000);

}

private DBConnector() {
    //
}

public static Connection getConnection(int dataBase) throws SQLException {
    if (dataBase == 0) {
        return …
Run Code Online (Sandbox Code Playgroud)

java mysql hikaricp

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

如何连接到AWS Elasticsearch?

我正在尝试连接到AWS Elasticsearch,但我总是收到以下错误:

Exception in thread "main" org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:278)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:197)
at org.elasticsearch.client.transport.support.InternalTransportClient.execute(InternalTransportClient.java:106)
at org.elasticsearch.client.support.AbstractClient.index(AbstractClient.java:98)
at org.elasticsearch.client.transport.TransportClient.index(TransportClient.java:334)
at org.elasticsearch.action.index.IndexRequestBuilder.doExecute(IndexRequestBuilder.java:313)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
at com.c_backendcrawler.utility.ElasticSearch.uploadObject(ElasticSearch.java:25)
at com.c_backendcrawler.Start.main(Start.java:34)
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

 //Create Client
    Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "zencubes-search").put("node.name","Darkhawk").build();
    TransportClient transportClient = new TransportClient(settings);
    transportClient.addTransportAddress(new InetSocketTransportAddress(
            "x.x.x.x",9300));
    return transportClient;
Run Code Online (Sandbox Code Playgroud)

AWS Elasticsearch的输出:

    {
status: 200,
name: "Darkhawk",
cluster_name: "817880037706:zencubes-search",
version: {
number: "1.5.2",
build_hash: "62ff9868b4c8a0c45860bebb259e21980778ab1c",
build_timestamp: "2015-04-27T09:21:06Z",
build_snapshot: false,
lucene_version: "4.10.4"
},
tagline: "You Know, for Search" …
Run Code Online (Sandbox Code Playgroud)

java amazon-web-services elasticsearch amazon-elasticsearch

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

如何使用SKU:基本与谷歌的地方api?

谷歌表示,SKU:Basic with google places是免费的:https: //developers.google.com/places/web-service/usage-and-billing#new-pricing-for-the-places-api

我正在使用谷歌地图javascript API并使用自动完成(与反应).

如何激活SKU:Basic?(对不起,定价模型对我来说是个巨大的?????)

javascript google-maps google-places-api

6
推荐指数
1
解决办法
2553
查看次数

使用 Google 日历 API 发送邀请

我有一个 Java Spring API,我想在其中集成 Google 日历。

任务:

  • 基本上为两名与会者(用户)创建一个活动并向他们发送邀请,并可选择接受/拒绝(标准 GCalendar 邀请)

我在这里尝试了这个示例: https ://developers.google.com/google-apps/calendar/quickstart/java

但我认为这不是正确的,因为我作为用户进行身份验证 - 或者我是否需要它通过电子邮件向他们发送邀请?

有人能指出我正确的方向吗?

java spring calendar google-calendar-api

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

Spring MVC 文件上传 - 验证

我有一个从哪里上传文件到我的 Spring API。

控制器:

@RequestMapping(value = "/upload", method = RequestMethod.POST)
public JSONObject handleCVUpload(@RequestParam("file") MultipartFile file,HttpServletRequest request) {
    User user=userService.findUserByAccessToken(new AccessTokenFromRequest().getAccessToken(request));
    JSONObject messageJson = new JSONObject();
    messageJson.put("success", userService.uploadCV(user, file));
    return messageJson;
}
Run Code Online (Sandbox Code Playgroud)

存储库:

@Override
public boolean uploadCV(User user, MultipartFile file) {
    boolean uploadsuccess = false;
    String fileName = user.getUserId() + "_" + user.getName();
    if (!file.isEmpty()) {
        try {
            String type = file.getOriginalFilename().split("\\.")[1];
            BufferedOutputStream stream = new BufferedOutputStream(
                    new FileOutputStream(new File("/data/" + fileName + "." + type)));
            FileCopyUtils.copy(file.getInputStream(), stream);
            stream.close();               
            uploadsuccess = …
Run Code Online (Sandbox Code Playgroud)

java spring file-upload spring-mvc

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

HybridAuth无法与Ajax一起使用

我正在尝试用ajax实现HybridAuth。

码:

PHP :(将由Ajax调用)

<?php
header('Content-type: application/json');
$provider = $_GET["provider"];
$config = '../libaries/hybridauth/config.php';
require_once( "../libaries/hybridauth/Hybrid/Auth.php" );
try {
    $hybridAuth = new Hybrid_Auth($config);

    $adapter = $hybridAuth->authenticate($provider);    
    $userProfile = json_encode($adapter->getUserProfile());
    echo $_GET['callback'] . '(' . "{$userProfile}" . ')';
} catch (Exception $e) {
    echo "Ooophs, we got an error: " . $e;
}
?>
Run Code Online (Sandbox Code Playgroud)

Javascript:

socialRegister: function () {
    var self = this;
    var val = 'provider=' + self.get("provider");
    return $.ajax({
        type: "GET",
        url: path.urlRoot + 'ext/socialRegisterAndAuthentication.inc.php',
        dataType: "jsonp",
        data: val
    }); …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery hybridauth

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

Docker 撰写 mysql 可在端口 3306 上访问

如何使 docker-compose 中的 mysql 数据库可以从“外部”访问 - 这意味着我可以连接数据库管理工具,例如在端口 3306 上:

wordpress:
 build: /Users/FabianL/wp-docker/
 container_name: "kr-wp-container"
 links:
   - db:mysql
 ports:
   - 8080:80
   - 3306:3306
db:
 image: mysql
 environment:
   MYSQL_ROOT_PASSWORD: biersaufen
Run Code Online (Sandbox Code Playgroud)

mysql docker docker-compose

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


哪里放电子饼干?

这里它基本上说:在你的应用程序的渲染器代码中,只需要这个包....

我不知道放在哪里.当我把它放在main.js时,我的应用程序就不会再启动了.我正确安装它,因为它在我的node_modules文件夹中.有任何想法吗?

我的main.js:

'use strict';

const electron = require('electron');
// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;

function createWindow () {

  require('electron-cookies');
  // Create the browser window.
  mainWindow = new BrowserWindow({width: 800, height: 600,nodeIntegration:false});

  // and load the …
Run Code Online (Sandbox Code Playgroud)

cookies electron

0
推荐指数
1
解决办法
2179
查看次数