因此,我试图显示此窗口。这给我关于未为Button类型定义的方法的错误。我不确定为什么,因为此代码是直接从教程中复制的。在他的IDE上工作,但不在我的工作中。他正在使用intellij,而我正在使用Eclipse。
closeButton.setOnAction(e -> window.close());
Run Code Online (Sandbox Code Playgroud)
该
setOnAction((<no type> e) -> {})类型的方法未定义Button
layout.getChildren().addAll(label, closeButton);
Run Code Online (Sandbox Code Playgroud)
addAll(int, Collection<? extends Node>)类型中的方法List<Node>不适用于参数(Label, Button)“
import java.awt.Button;
...
public static void display(String title, String message) {
Stage window = new Stage();
//Block events to other windows
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle(title);
window.setMinWidth(250);
Label label = new Label();
label.setText(message);
Button closeButton = new Button("Close this window");
closeButton.setOnAction(e -> window.close());
VBox layout = new VBox(10);
layout.getChildren().addAll(label, closeButton);
layout.setAlignment(Pos.CENTER);
//Display window and wait for it to …Run Code Online (Sandbox Code Playgroud) 有人可以帮助我理解为什么我的环境变量没有在travis.ci的phpunit测试中读取吗?
所以我正在尝试使用travis为我正在研究的php/javascript应用程序编写一些自动测试.然而,当我编写一个测试来检查从travis读取到phpunit的环境变量时,它们会失败.这意味着(据我所知),环境变量无法被phpunit读取,或者它们没有被正确地传递给travis测试.
.travis.yml
language: php
php:
- '7.0'
- '7.1'
before_install:
- echo "extension=ldap.so" >>php --ini | grep "Loaded Configuration" | sed -e "s|.:\s||"``
install:
- cd test
- npm install
- cd ..
script:
- echo $API_BASE_URL
- phpunit test/build_tests.php
notifications:
on_success: never
on_failure: never
Run Code Online (Sandbox Code Playgroud)
phpunit测试文件
<?php
use PHPUnit\Framework\TestCase;
class build_tests extends TestCase
{
public function testForEnv()
{
$this->assertEquals(isset($_ENV['API_BASE_URL']), true);
$this->assertEquals(isset($_ENV['DRINK_SERVER_URL']), true);
$this->assertEquals(isset($_ENV['LOCAL_DRINK_SERVER_URL']), true);
$this->assertEquals(isset($_ENV['RATE_LIMIT_DROPS_DROP']), true);
$this->assertEquals(isset($_ENV['DEBUG']), true);
$this->assertEquals(isset($_ENV['DEBUG_USER_UID']), true);
$this->assertEquals(isset($_ENV['DEBUG_USER_CN']), true);
$this->assertEquals(isset($_ENV['USE_LOCAL_DRINK_SERVER']), true);
}
}
?>
Run Code Online (Sandbox Code Playgroud)
travis出口环境变量
$ …Run Code Online (Sandbox Code Playgroud) 所以我正在尝试使用数据库和烧瓶动态构建站点。该网站现在以我希望的方式工作,但只持续了大约一分钟,然后我收到一条错误消息:
sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query')
Run Code Online (Sandbox Code Playgroud)
数据库包含我想为每一页抓取的 4 个条目,以及一个主页,我只从数据库中的每个条目抓取 2 个条目。沿着这条线的某个地方,它遇到了一个错误,它无法再访问数据库,因此不允许加载更多使用数据库的页面。
谁能帮我弄清楚为什么会发生这种情况?我对烧瓶和 sqlalchemy 很陌生
下面是我的代码:
from flask import Flask
from flask import render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://databaseaddress'
db = SQLAlchemy(app)
class Kitchen(db.Model):
__tablename__ = 'kitchens'
id = db.Column('id', db.Integer, primary_key=True)
description = db.Column('description')
galleryId = db.Column('galleryId')
cpo = db.Column('cpo')
def __init__(self, description, galleryId, cpo):
self.description = description
self.galleryId = galleryId
self.cpo = cpo
def __repr__(self):
return '<Gallery %r>' …Run Code Online (Sandbox Code Playgroud)