小编Yun*_*Han的帖子

将项添加到Firebase数据库的列表中

我有以下Firebase数据库结构.uIds是一种类型List<String>.我正在尝试uIds使用递增的索引添加另一个uId .setValue()updateChildren()要求我检索现有数据,push()并将添加一个项目,其中随机生成的字符串作为键而不是递增的索引.是否有一种更简单的方法不需要检索现有数据?谢谢!

  "requests" : {
    "request001" : {
      "interests" : [ "x" ],
      "live" : true,
      "uIds" : [ "user1" ]  // <---- from this
    },
    "request002" : {
      "interests" : [ "y" ],
      "live" : true,
      "uIds" : [ "user2" ]
    }
  }
Run Code Online (Sandbox Code Playgroud)

--------------------------------

编辑:

对不起,对不起.让我详细说明一下.假设我有上述数据库,并希望将其更新为以下内容.

  "requests" : {
    "-KSVYZwUQPfyosiyRVdr" : {
      "interests" : [ "x" ],
      "live" : true,
      "uIds" : [ "user1", "user2" ]   // …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-realtime-database

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

两个HTML选择框相互链接

Hellloooooo ......我有两个<select>像这样的输入

<select id="sel1">
  <option value="a">a</option>
  <option value="b">b</option>
</select>

<select id="sel2">
  //if 'a' is selected above,
  //<option>apple</option>, <option>airplane</option>
  //if 'b' is selected above,
  //<option>banana</option>, <option>book</option>
</select>
Run Code Online (Sandbox Code Playgroud)

我想根据选择列出不同的选项集sel1.我可以使用onchange属性获取所选值,如下所示:

<select id="sel1" onchange="giveSelection(this)">
<script type="text/javascript">
  function giveSelection(sel) {
    var selected = sel.value;
  }
</script>
Run Code Online (Sandbox Code Playgroud)

但是我无法想出一种方法来使用这个值来输出不同的选择选项sel2.请帮忙!

html forms html-select

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

在php中,获取节点js中的值

我有一个在节点中运行的js文件.这个js文件读取来自蓝牙设备的数据.我还有一个在apache服务器上运行的php文件.这会显示一个网站界面.

现在,在php文件中,我想使用js文件中的数据.有哪些方法可以实现这一目标?

javascript php node.js

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

获取字符串模板中所有标识符列表的函数(Python)

对于Python中的标准库string template,是否有一个函数可以获取所有标识符的列表?

例如,使用以下 xml 文件:

<Text>Question ${PrimaryKey}:</Text>
<Text>Cheat: ${orientation}</Text>
Run Code Online (Sandbox Code Playgroud)

该函数将返回类似的内容PrimaryKey, orientation

python stringtemplate

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