小编Key*_*ume的帖子

在Centos7上更改mysql root密码

我在Centos7虚拟机上安装了mySQL,但是我在使用root登录时遇到了问题.我尝试登录没有密码或尝试任何默认的(如mysql,管理员等)我查看my.cnf文件,没有密码.我尝试通过停止服务并重新启动它来更改密码,mysqld_safe --skip-grant-tables &但我知道mysqld_safe:command not found 我不知道还能做什么.任何提示/想法将不胜感激!

mysql centos

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

找不到变量:React

我刚刚开始学习反应所以我提前道歉,如果这听起来像是一个愚蠢的问题.我正在尝试创建一个简单的iOS页面,其中包含一个触发操作的按钮.我已经按照如何入门的教程,这是我的索引代码:

'use strict';
var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  TouchableHighlight,
  Component,
  AlertIOS // Thanks Kent!
} = React;

class myProj extends Component {
 render() {
    return (
      <View style={styles.container}>
        <Text>
          Welcome to React Native!
        </Text>
        <TouchableHighlight style={styles.button}
            onPress={this.showAlert}>
            <Text style={styles.buttonText}>Go</Text>
          </TouchableHighlight>
      </View>
    );
  }

  showAlert() {
    AlertIOS.alert('Awesome Alert', 'This is my first React Native alert.', [{text: 'Thanks'}] )
  }
}

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#FFFFFF'
  },
  buttonText: …
Run Code Online (Sandbox Code Playgroud)

javascript ios react-native

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

.NET Core Cookie身份验证SignInAsync无法正常工作

我有一个使用AspNetCore.Authentication.Cookies的基于cookie身份验证的核心项目,但我似乎无法让用户进行身份验证.我已经阅读了类似的线程,但提供的解决方案似乎都没有用.

[HttpPost]
public async Task<IActionResult> CookieAuth(ITwitterCredentials userCreds)
{
    var claims = new[] {
        new Claim("AccessToken" , userCreds.AccessToken),
        new Claim("AccessTokenSecret", userCreds.AccessTokenSecret)
    };

    var principal = new ClaimsPrincipal(new ClaimsIdentity(claims, "CookieAuthentication"));

    await HttpContext.Authentication.SignInAsync("CookieAuthentication", principal);

    return Ok();
}
Run Code Online (Sandbox Code Playgroud)

和startup.cs配置方法

app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
    AuthenticationScheme = "CookieAuthentication",
    LoginPath = new PathString("/"),
    AccessDeniedPath = new PathString("/"),
    AutomaticAuthenticate = true,
    AutomaticChallenge = true
});
Run Code Online (Sandbox Code Playgroud)

用户似乎没有进行身份验证,因为HttpContext.User.Identity.IsAuthenticated始终返回false.

知道为什么这可能不起作用吗?

c# asp.net-core

9
推荐指数
2
解决办法
4171
查看次数

GCP Cloud SQL 未能删除实例,因为 `deletion_protection` 设置为 true

我有一个用于配置 Cloud SQL 实例的 tf 脚本,以及几个数据库和一个管理员用户。我已重命名该实例,因此创建了一个新实例,但 terraform 在删除旧实例时遇到了问题。

Error: Error, failed to delete instance because deletion_protection is set to true. Set it to false to proceed with instance deletion
Run Code Online (Sandbox Code Playgroud)

我试过将 设置为deletion_protectionfalse但我不断收到相同的错误。有没有办法检查哪些资源需要deletion_protection设置为 false 才能被删除?我只将它添加到google_sql_database_instance资源中。

我的 tf 脚本:

// Provision the Cloud SQL Instance
resource "google_sql_database_instance" "instance-master" {
  name             = "instance-db-${random_id.random_suffix_id.hex}"
  region           = var.region
  database_version = "POSTGRES_12"

  project = var.project_id

  settings {
    availability_type = "REGIONAL"
    tier              = "db-f1-micro"
    activation_policy = "ALWAYS"
    disk_type         = "PD_SSD" …
Run Code Online (Sandbox Code Playgroud)

google-cloud-sql google-cloud-platform terraform

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

将django app部署到heroku - 无法找到文件

我在heroku上运行我的django应用程序时遇到问题.它已成功部署,但在查找各种文件时遇到一些问题.

news.py中

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
url_path = BASE_DIR + '/marketdata/news/'
Run Code Online (Sandbox Code Playgroud)

它在本地工作,但当我在heroku上部署时,它说它无法找到该文件

例外值:[Errno 2]没有这样的文件或目录:'/ app /artemis/static/marketdata/news/bloomom_news.csv'异常位置:/app/artemis/static/marketdata/news.py in save_to_csv,第16行

这是我的项目结构

在此输入图像描述

知道如何解决这个问题吗?任何提示将不胜感激!

编辑:如果我在heroku上检查我的项目结构,那么新闻文件夹就不存在了.这是否与它只有.csv文件的事实有关?

django heroku

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

时间数据与格式 YYYY-MM-DD 不匹配

我在获取 python 中两个日期之间的天数差异时遇到问题。

我有以下代码块:

    last_used = models.DateTimeField(default=datetime.now().date(), editable=False)
    date_format = "%y-%m-%d"
    a = datetime.strptime(str(datetime.now().date()), date_format)
    b = datetime.strptime(str(last_used), date_format)
    days_since_use = models.IntegerField(default=(b-a).days, editable=False)
Run Code Online (Sandbox Code Playgroud)

我尝试过 %y-%m-%d 和 YYYY-MM-DD 格式,但都不起作用。

ValueError: time data '2018-09-16' does not match format '%y-%m-%d'

有任何想法吗?

django django-rest-framework

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

数据流无法使用自定义模板解析模板文件

我正在尝试在数据流中运行一个简单的管道

import apache_beam as beam


options = beam.options.pipeline_options.PipelineOptions()

gcloud_options = options.view_as(beam.options.pipeline_options.GoogleCloudOptions)
gcloud_options.job_name = 'dataflow-tutorial1'
gcloud_options.project = 'xxxx'
gcloud_options.staging_location = 'gs://xxxx/staging'
gcloud_options.temp_location = 'gs://xxxx/temp'
gcloud_options.service_account_email = 'dataflow@xxxx.iam.gserviceaccount.com'


worker_options = options.view_as(beam.options.pipeline_options.WorkerOptions)
worker_options.disk_size_gb = 20
worker_options.max_num_workers = 2


options.view_as(beam.options.pipeline_options.StandardOptions).runner = 'DataflowRunner'


p1 = beam.Pipeline(options=options)

(p1 | 'Hello World' >> beam.Create(['Hello World']))

p1.run()
Run Code Online (Sandbox Code Playgroud)

当我从数据流 UI 创建作业并尝试运行它时,我不断收到

Unable to parse template file 'gs://dataflow-sm/pipeline-files/read-write-to-gsc-file.py'.
Run Code Online (Sandbox Code Playgroud)

如果我从终端运行它,我会得到

ERROR: (gcloud.dataflow.jobs.run) FAILED_PRECONDITION: Unable to parse template file 'gs://dataflow-sm/pipeline-files/read-write-to-gsc-file.py'.
- '@type': type.googleapis.com/google.rpc.PreconditionFailure
  violations:
  - description: "Unexpected end of stream : expected …
Run Code Online (Sandbox Code Playgroud)

python google-cloud-dataflow

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

HKQuantity 翻倍 - 从 Healthkit 获取活跃能量值

我正在研究一种从健康套件中读取活性能量(千卡)的方法,但我在从 HKQuantity 获取双倍值时遇到问题。我的代码如下所示:

func getActiveEnergy () {
    let endDate = NSDate()
    let startDate = NSCalendar.currentCalendar().dateByAddingUnit(.Month, value: -1, toDate: endDate, options: [])

    let energySampleType = HKSampleType.quantityTypeForIdentifier(HKQuantityTypeIdentifierActiveEnergyBurned)
    let predicate = HKQuery.predicateForSamplesWithStartDate(startDate, endDate: endDate, options: .None)

    print ("start date: ", startDate)
    print ("end date: ", endDate)

    let query = HKSampleQuery(sampleType: energySampleType!, predicate: predicate, limit: 0, sortDescriptors: nil, resultsHandler: {
        (query, results, error) in
        if results == nil {
            print("There was an error running the query: \(error)")
        }

        dispatch_async(dispatch_get_main_queue()) {

            for activity in results …
Run Code Online (Sandbox Code Playgroud)

swift healthkit

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

安装旧版本的tensorflow

我正在尝试使用以下设置安装tensorflow 1.3.0:

python 3.6.3
pip 9.0.1
Windows 10 on x64
Run Code Online (Sandbox Code Playgroud)

我试过跑步

pip install https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow_jni-cpu-windows-x86_64-1.3.0-rc2.zip
Run Code Online (Sandbox Code Playgroud)

但我明白了

Command "python setup.py egg_info" failed with error code 1 in C:\Users\__\AppData\Local\Temp\pip-0dabbj1v-build\
Run Code Online (Sandbox Code Playgroud)

如果我试试

pip install tensorflow-1.3.0
Run Code Online (Sandbox Code Playgroud)

我明白了

  Could not find a version that satisfies the requirement tensorflow-1.3.0 (from versions: )
No matching distribution found for tensorflow-1.3.0
Run Code Online (Sandbox Code Playgroud)

知道如何让这个工作吗?任何想法/提示将不胜感激!

tensorflow

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

VS2017 无法启动调试。无法加载文件或程序集

使用 xamarin 表单,我最近将我的 android 版本从 7.1 更新到 8.1(尽管我不明白为什么这可能会搞砸任何事情)但我无法再在调试模式下运行该应用程序(它编译并完美运行在发布)。

这是我得到的错误:

无法开始调试。无法加载文件或程序集“libadb,版本=14.0.0.0,文化=中性,PublicKeyToken=___”或其依赖项之一。该系统找不到指定的文件。

知道为什么会发生这种情况吗?我曾尝试寻找在线解决方案,但找不到适合我的问题的任何解决方案。任何帮助将不胜感激!

c# android visual-studio

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

Flutter 将 TextFormField 与 DropdownButton 对齐

我有以下代码呈现ListTileaTextFormFieldListTitlea DropdownButton

           Row(
              mainAxisSize: MainAxisSize.max,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                new Expanded(
                    child: ListTile(
                      dense: true,
                      title: Text(
                        "Property Name",
                        style: TextStyle(fontWeight: FontWeight.bold),
                      ),
                      subtitle: TextFormField(
                        decoration: InputDecoration(
                            labelText: 'Enter the property name'
                        ),
                      ),
                      isThreeLine: true,
                    )
                ),
                new Expanded(
                    child: ListTile(
                      dense: true,
                      title: Text(
                        "Contact Name",
                        style: TextStyle(fontWeight: FontWeight.bold),
                      ),
                      subtitle: DropdownButton<int>(
                        items: [
                          DropdownMenuItem<int>(
                            value: 1,
                            child: Text(
                              "John Smith",
                            ),
                          ),
                          DropdownMenuItem<int>(
                            value: 2,
                            child: Text(
                              "Jon …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-web

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