在我的应用程序中,我需要检查firebase上我的数据库的给定元素是否具有给定名称的子项.我希望可以通过以下方式使用以下内容来完成:
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
if (rootRef.childExists("name")) {
//run some code
}
Run Code Online (Sandbox Code Playgroud)
我搜索过,但找不到任何有用的东西.
我正在尝试在运行Ubuntu服务器17.04的系统上安装gitlab-ce软件包.我跟着官方的安装说明这里.
首先我跑了:
sudo apt-get install curl openssh-server ca-certificates postfix
Run Code Online (Sandbox Code Playgroud)
我已经安装了所有这些.然后我跑了:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Run Code Online (Sandbox Code Playgroud)
这也很好.但是当我试着奔跑的时候
sudo apt-get install gitlab-ce
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gitlab-ce
Run Code Online (Sandbox Code Playgroud)
我知道可以在Ubuntu服务器17.04上安装gitlab,因为我之前的安装已经完成了它.不幸的是我从头开始重新安装操作系统,我不记得我是如何安装gitlab的.
在此先感谢您的帮助!
因此,我希望通过在比较之前不将变量的值复制到另一个变量中来提高程序性能的程度(这将在示例中更好地解释),并且我注意到一些奇怪的东西.我有这两个代码段:
string a = "";
for (int i = 0; i < 1000000; i++) a += 'a';
for (int i = 0; i < 1000000; i++) {
if ('b' == a.at(i));//compare the two chars directly
}
Run Code Online (Sandbox Code Playgroud)
和
string a = "";
for (int i = 0; i < 100000000; i++) a += 'a';
for (int i = 0; i < 100000000; i++) {
char c = a.at(i);//declare a new variable
if ('b' == c);//compare the char with the newly created …Run Code Online (Sandbox Code Playgroud) 我使用以下svg绘图作为按钮:
<svg id="button-more-people" style="width: 60px; height: 60px;">
<circle cx="30" cy="30" r="30" fill="#F44336" id="circle-button-more-people"/>
<text fill="#ffffff" font-size="45" x="11" y="44" font-family="Verdana">+</text>
</svg>
Run Code Online (Sandbox Code Playgroud)
当鼠标悬停在圆圈上时,我通过css按下按钮:
#button {
transition: 0.3s ease;
}
#button:hover {
transform: scale(1.2);
}
Run Code Online (Sandbox Code Playgroud)
我似乎无法实现的是在点击时更改按钮颜色.我试过以下,但无济于事:
#button:active ~ circle {
fill: #D50000;
}
Run Code Online (Sandbox Code Playgroud)
我希望如果有一个没有javascript的解决方案我可以使用.
在此先感谢您的帮助!
我试图获取快照的关键
dataSnapshot.key()
Run Code Online (Sandbox Code Playgroud)
方法,但它似乎没有工作.这是相关的代码:
index.html的:
...
<select id="resList" size="20"></select>
...
Run Code Online (Sandbox Code Playgroud)
index.js:
function addChild(name, id) {
var list = document.getElementById("resList");
var item = document.createElement("option");
item.text = "Resolution " + id + ": " + name;
list.add(item);
}
function changeChild(name, index) {
var list = document.getElementById("resList");
var item = document.createElement("option");
item.text = "Resolution " + (index+1) + ": " + name;
list.remove(index);
list.add(item, index);
}
function removeChild(index) {
var list = document.getElementById("resList");
list.remove(index);
}
function init() {
const resolutionRef = firebase.database().ref().child('resolutions');
resolutionRef.on('child_added', function(childSnapshot, …Run Code Online (Sandbox Code Playgroud) firebase ×2
android ×1
c++ ×1
css ×1
gitlab ×1
html ×1
if-statement ×1
java ×1
javascript ×1
linux ×1
svg ×1
ubuntu ×1
ubuntu-17.04 ×1
web ×1