小编nbu*_*n42的帖子

Beta Firebase Firestore不适用于使用应用引擎的项目

当我尝试将beta firestore添加到我的Google云平台项目时,我收到以下消息.

无法为此项目启用Firestore 目前,在已使用Cloud Datastore或App Engine的项目中无法启用Firestore

这会永远持续下去吗?
我想我想用firestore替换一些但不是全部的数据存储区来获得实时更新.

也许firestore在其后端使用数据存储和appengine?

我应该使用两个GCP项目来解决这个问题吗?

谢谢,内森

google-app-engine firebase google-cloud-datastore google-cloud-platform google-cloud-firestore

14
推荐指数
1
解决办法
2724
查看次数

Polymer 1.0 iron-flex-layout仅适用于某些标签

更新:聚合物文档现已更新,以反映下面的答案

我正在做一个聚合物1.0应用程序.

我正在尝试在屏幕的一部分水平布局一些纸质工具栏.
看来我可以使用iron-flex-layout的@apply( - layout-horizo​​ntal)来处理某些元素而不是其他元素.

我在下面放了一个小测试来显示最新情况.
有趣的是,如果我将--layout-horizo​​ntal风格的内容复制到chrome dev工具中的标签中,它就可以工作.如果我只是将--layout-horizo​​ntal的内容复制到新样式中,它也可以工作.

这是最近发生的例子.

第一个div是0.5到1.0迁移指南中的示例.
第二个div是示例,而是尝试布局一个部分而不是跨度.
第三行是我明确复制并应用--layout-horizo​​ntal风格的地方.

在此输入图像描述

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">

<dom-module id="layout-test">

    <style>
        /* Example from migration guide */
        .header {
            @apply(--layout-horizontal --layout-center);
        }

        /* A hack that makes it work */
        .hack {
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;

            -ms-flex-direction: row;
            -webkit-flex-direction: row;
            flex-direction: row;
        }
    </style>

    <template>

        <!-- Working example from migration guide  -->
        <div class="header">
            <img src="https://www.polymer-project.org/images/logos/lockup.svg">
            <span class="name">name</span>
        </div>

        <!-- This example does not work …
Run Code Online (Sandbox Code Playgroud)

css flexbox polymer polymer-1.0

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

在Android的警报频道上播放声音

我做了很多谷歌搜索,但是其他人的解决方案对我来说却行不通。

我的目标是在报警通道上按需播放声音。
(因此,音量是通过警报音量设置来调整的)

从这个线程,我建立以下代码

mediaPlayerScan = MediaPlayer.create(getContext(), R.raw.scan_beep);

if (Build.VERSION.SDK_INT >= 21) {
  mediaPlayerScan.setAudioAttributes(new AudioAttributes.Builder()
          .setUsage(AudioAttributes.USAGE_ALARM)
          .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
          .build());
} else {
  mediaPlayerScan.setAudioStreamType(AudioManager.STREAM_ALARM);
}
Run Code Online (Sandbox Code Playgroud)

它仍然在音乐频道上播放。(在音乐设置中调整IE音量不会发出警报)

我的直觉是我缺少权限之类的东西,但是我没有找到这样的权限。

我正在Google Pixel 1上进行测试

谢谢,
内森

编辑:

感谢@ jeffery-blattman,以下代码对我有用

mediaPlayerScan = new MediaPlayer();
try {
  mediaPlayerScan.setDataSource(getContext(),
          Uri.parse(getString(R.string.res_path) + R.raw.scan_beep));

  if (Build.VERSION.SDK_INT >= 21) {
    mediaPlayerScan.setAudioAttributes(new AudioAttributes.Builder()
            .setUsage(AudioAttributes.USAGE_ALARM)
            .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
            .build());
  } else {
    mediaPlayerScan.setAudioStreamType(AudioManager.STREAM_ALARM);
  }
  mediaPlayerScan.prepare();
} catch (IOException e) {
  e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

android

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

Apache Beam Google Datastore ReadFromDatastore entity protobuf

I am trying to use apache beam's google datastore api to ReadFromDatastore

p = beam.Pipeline(options=options)
(p
 | 'Read from Datastore' >> ReadFromDatastore(gcloud_options.project, query)
 | 'reformat'            >> beam.Map(reformat)
 | 'Write To Datastore'  >> WriteToDatastore(gcloud_options.project))
Run Code Online (Sandbox Code Playgroud)

The object that gets passed to my reformat function is type

google.cloud.proto.datastore.v1.entity_pb2.Entity

It is in protobuf format which is hard to modify or read.

I think I can convert a entity_pb2.Entity to a dict with

entity= dict(google.cloud.datastore.helpers._property_tuples(entity_pb))
Run Code Online (Sandbox Code Playgroud)

But for some reason trying to import the following two …

python protocol-buffers google-cloud-datastore google-cloud-dataflow apache-beam

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