如何在 Ruby 中为 Google Calendar API 授权服务帐户?我尝试了快速入门指南,但它崩溃了。
https://developers.google.com/calendar/quickstart/ruby#step_3_set_up_the_sample
quickstart.rb
require 'google/apis/calendar_v3'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'.freeze
APPLICATION_NAME = 'Google Calendar API Ruby Quickstart'.freeze
CLIENT_SECRETS_PATH = 'client_secrets.json'.freeze
CREDENTIALS_PATH = 'token.yaml'.freeze
SCOPE = Google::Apis::CalendarV3::AUTH_CALENDAR_READONLY
##
# Ensure valid credentials, either by restoring from the saved credentials
# files or intitiating an OAuth2 authorization. If authorization is required,
# the user's default browser will be launched to approve the request.
#
# @return [Google::Auth::UserRefreshCredentials] OAuth2 credentials
def authorize
client_id …Run Code Online (Sandbox Code Playgroud) 我尝试按照“键盘绑定”设置中的指示进行操作,但是没有用。
我复制了默认条目,打开了键盘映射文件,粘贴,更改为“ all”,然后保存。
'body':
'ctrl-shift-S': 'core:save-all'
Run Code Online (Sandbox Code Playgroud)
我更改了两个文件,然后按CTRL-SHIFT-S,但它们仍然具有蓝色的修改标记。
我用CTRL-。尝试了注释中提到的“键绑定解析器”,它似乎可以识别我创建的内容,但是并没有保存所有文件。
原子1.27.2
我补充道
"require": {
"ext-opcache": "*",
Run Code Online (Sandbox Code Playgroud)
到composer.json一个eDirectory的Symfony的2.8应用程序,但它给了我一个错误:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested PHP extension ext-opcache * is missing from your system. Install or enable PHP's opcache extension.
Run Code Online (Sandbox Code Playgroud)
但是,我确实安装了OPcache!
$ php -r "phpinfo();" | grep OPcache -a3
Zend OPcache
Opcode Caching => Up and Running
Optimization => Enabled
Run Code Online (Sandbox Code Playgroud)
它没有抱怨"ext-gd": "*"或"ext-mbstring": …
来自此文档:https://mariadb.com/kb/en/library/select-into-outfile/
我跑了
MariaDB []> select ... into outfile 'leads_ny.csv';
Query OK, 6674 rows affected (0.47 sec)
Run Code Online (Sandbox Code Playgroud)
现在我找不到该文件了。我查看了当前的工作目录、我启动的目录mysql、我的主目录,我什至find在每个目录上运行过,但我找不到它。我目前正在跑步$ find / -name leads_ny.csv。
mysql 版本 15.1 Distrib 10.1.30-MariaDB
使用新迁移运行 Spring Boot 应用程序时出现此错误。到目前为止,它已经成功进行了 10 次迁移。该字段确实没有默认值。不需要默认值,因为 Flyway 应该在该字段中插入值 11。
Caused by: org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to insert row for version '11' in Schema History table `app`.`schema_version`
--------------------------------------------------------------------------------------------
SQL State : HY000
Error Code : 1364
Message : Field 'version_rank' doesn't have a default value
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.doAddAppliedMigration(JdbcTableSchemaHistory.java:174) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.schemahistory.SchemaHistory.addAppliedMigration(SchemaHistory.java:170) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:299) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:53) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:163) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:160) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:60) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.database.mysql.MySQLConnection.lock(MySQLConnection.java:80) ~[flyway-core-5.1.4.jar:na]
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:150) ~[flyway-core-5.1.4.jar:na]
Run Code Online (Sandbox Code Playgroud)
pom.xml
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.1.4</version><!--$NO-MVN-MAN-VER$-->
</dependency>
Run Code Online (Sandbox Code Playgroud)
application.properties
# …Run Code Online (Sandbox Code Playgroud) 我有以下 Java 代码
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
public class AESEncryption
{
public static final String AES_TRANSFORMATION = "AES/ECB/PKCS5Padding";
public static final String AES_ALGORITHM = "AES";
public static final int ENC_BITS = 256;
public static final String CHARACTER_ENCODING = "UTF-8";
private static Cipher ENCRYPT_CIPHER;
private static Cipher DECRYPT_CIPHER;
private static KeyGenerator KEYGEN;
static
{
try
{
ENCRYPT_CIPHER = Cipher.getInstance(AES_TRANSFORMATION);
DECRYPT_CIPHER = Cipher.getInstance(AES_TRANSFORMATION);
KEYGEN …Run Code Online (Sandbox Code Playgroud) 如果在 JSON 请求中指定了额外的参数,我该如何抛出错误?例如,“xxx”不是有效参数或在@RequestBody对象中。
$ curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN" -d '{"apiKey": "'$APIKEY'", "email": "name@example.com ", "xxx": "yyy" }' 本地主机:8080/api/v2/stats
我尝试添加@Validated到界面,但没有帮助。
@RequestMapping(value = "/api/v2/stats", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<DataResponse> stats(Principal principal, @Validated @RequestBody ApiParams apiParams) throws ApiException;
Run Code Online (Sandbox Code Playgroud)
我想启用“严格”模式,以便在请求中存在额外的虚假参数时会出错。我找不到办法做到这一点。我找到了确保有效参数确实存在的方法,但无法确保没有额外的参数。
public class ApiParams extends Keyable {
@ApiModelProperty(notes = "email of user", required = true)
String email;
Run Code Online (Sandbox Code Playgroud)
public abstract class Keyable {
@ApiModelProperty(notes = "API key", required = true)
@NotNull
String apiKey; …Run Code Online (Sandbox Code Playgroud) 即使它出现在Eclipse图形编辑器中,我的TabWidget也不会显示.我找不到任何理由.为什么我的标签栏没有显示?
日食

模拟器

活动的XML源:http://pastebin.com/Au9XFXPa
从活动中提取:
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
Run Code Online (Sandbox Code Playgroud)
Android lint的结果:
$ lint.bat res/layout/activity_calculator.xml
Scanning Catalyst: .
No issues found.
Run Code Online (Sandbox Code Playgroud) 如何编写在多个集成测试中使用的集成测试助手?我尝试了以下错误.我正在考虑创建一个基类并扩展它,但我不明白'test_helper'是如何工作的!我不能把帮助方法放在test_helper中,因为它们使用特殊的集成助手post_with_redirect.
$ ls test/integration
integration_helper_test.rb post_integration_test.rb user_flows_test.rb
Run Code Online (Sandbox Code Playgroud)
class IntegrationHelperTest < ActionDispatch::IntegrationTest
def login(user)
...
Run Code Online (Sandbox Code Playgroud)
require 'test_helper'
require 'integration_helper_test'
# require 'integration/integration_helper_test'
class PostIntegrationTest < ActionDispatch::IntegrationTest
# include IntegrationHelperTest
Run Code Online (Sandbox Code Playgroud)
$ rake
rake aborted!
cannot load such file -- integration_helper_test
C:/Users/Chloe/workspace/SeenIt/test/integration/post_integration_test.rb:2:in `<top (required)>'
Tasks: TOP => test:run => test:integration
Run Code Online (Sandbox Code Playgroud)
require 'test_helper'
# require 'integration_helper_test'
require 'integration/integration_helper_test'
class PostIntegrationTest < ActionDispatch::IntegrationTest
Run Code Online (Sandbox Code Playgroud)
1) Error:
PostIntegrationTest#test_should_create_post:
NoMethodError: undefined method `login' for #<PostIntegrationTest:0x3da81d0>
test/integration/post_integration_test.rb:20:in `block in <class:PostIntegrationTest>'
Run Code Online (Sandbox Code Playgroud)
当我定义STATUS时,它默认为0.然而所有其他常量都有效.
define('LOCATION',07);
define('STATUS',08);
echo 'x'.STATUS."x\n";exit;
define('TERM_DATE',09);
$ php synchronize.php
x0x
Run Code Online (Sandbox Code Playgroud) php ×3
java ×2
mysql ×2
spring-boot ×2
aes ×1
android ×1
atom-editor ×1
composer-php ×1
constants ×1
electron ×1
encryption ×1
flyway ×1
into-outfile ×1
jackson ×1
key-bindings ×1
layout ×1
mariadb ×1
maven ×1
opcache ×1
rest ×1
ruby ×1
spring ×1