Ich verwende die Echtzeitdatenbank von Firebase in JavaScript für die Fristzeit und versuche, meine Daten mit Object.Entriies (Snapshot.val ()) durchzuschlafen. Mir ist aufgefallen, dass ich, wenn ich auf Geschäfte [0] zugreift, den Feuerwehrschlüssel für jeden Artikel gibt. Ich bin mir nicht sicher, warum das funktioniert. < /P>
Hier ist mein Code: < /p>
onValue(lists, function(snapshot) {
if (!snapshot.exists()) {
console.log("No data found");
return;
}
let shops = Object.entries(snapshot.val());
for (let i = 0; i < shops.length; i++) {
let del = shops[i][0]; // This gives the Firebase key
console.log(del); // Why does this work?
}
});
< /code>
Was ich verstehe:
Object.entries(snapshot.val())< /code> wandelt meine FireBase-Daten in ein Array von Schlüsselwertpaaren um.
Shops [i] ist eines dieser Paare. Ich verstehe nicht vollständig, wie ich in diesem Fall arbeite.
Wenn Sie hier den vollständigen Code wollen, und mir sagen, wie ich ihn neu aufstellen kann < /p>
//ooo
const tr = document.getElementById("tr")
const trs = document.getElementById("clear")
const show = document.getElementById("show")
const text = document.getElementById("text")
const sub = document.getElementById("sub")
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/11.3.0/firebase-app.js";
import { getDatabase,ref,push,onValue,remove } from "https://www.gstatic.com/firebasejs/11.3.0/firebase-database.js";
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyC9ebhCO9FdQrF2GCnE0vTwYrmik4rvaT8",
authDomain: "shop-1847a.firebaseapp.com",
databaseURL: "https://shop-1847a-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "shop-1847a",
storageBucket: "shop-1847a.firebasestorage.app",
messagingSenderId: "965005392074",
appId: "1:965005392074:web:63c1d5058bfdd25ff99c33"
}
const app = initializeApp(firebaseConfig);
const idk = getDatabase(app)
const lists = ref(idk,"shop")
console.log(idk)
function comes(){
let value = text.value
push(lists,value )
}
addEventListener("load",function(snapshot){
if(!snapshot){
console.log("not found")
}
else{
onValue(lists,function(snapshot){
show.innerHTML=''
let shop = Object.values(snapshot.val())
let shops = Object.entries(snapshot.val())
for(let i =0; i < shop.length;i++){
console.log(shop[i])
console.log(shops[i])
const ba = document.createElement('label');
const va = document.createElement('button');
const b = document.createElement('br')
va.textContent=shop[i]
va.id = "te"
va.addEventListener("click",function(){
let del = shops[i][0]
console.log(del)
let delp = ref(idk,`shop/${del}`)
remove(delp)
})
ba.htmlFor="tr"
va.textContent=shop[i]
show.appendChild(va);
show.appendChild(b)
show.appendChild(ba)
}
})
}
})
sub.addEventListener("click",function(){
comes()
onValue(lists,function(snapshot){
show.innerHTML=''
let shops = Object.entries(snapshot.val())
let shop = Object.values(snapshot.val())
for(let i =0; i < shop.length;i++){
console.log(shop[i])
const ba = document.createElement('label');
const va = document.createElement('button');
const b = document.createElement('br')
va.id = "tr"
va.addEventListener("click",function(){
let del = shops[i][0]
let delp = ref(idk,`shop/${del}`)
remove(delp)
})
ba.htmlFor="tr"
va.textContent=shop[i]
show.appendChild(ba)
show.appendChild(va);
show.appendChild(b)
}
})
})
Ich verwende die Echtzeitdatenbank von Firebase in JavaScript für die Fristzeit und versuche, meine Daten mit Object.Entriies (Snapshot.val ()) durchzuschlafen. Mir ist aufgefallen, dass ich, wenn ich auf Geschäfte [i] [0] zugreift, den Feuerwehrschlüssel für jeden Artikel gibt. Ich bin mir nicht sicher, warum das funktioniert. < /P> Hier ist mein Code: < /p> [code]onValue(lists, function(snapshot) { if (!snapshot.exists()) { console.log("No data found"); return; }
let shops = Object.entries(snapshot.val());
for (let i = 0; i < shops.length; i++) { let del = shops[i][0]; // This gives the Firebase key console.log(del); // Why does this work? } }); < /code> Was ich verstehe: Object.entries(snapshot.val())< /code> wandelt meine FireBase-Daten in ein Array von Schlüsselwertpaaren um. Shops [i] ist eines dieser Paare. Ich verstehe nicht vollständig, wie ich in diesem Fall arbeite. Wenn Sie hier den vollständigen Code wollen, und mir sagen, wie ich ihn neu aufstellen kann < /p> //ooo const tr = document.getElementById("tr") const trs = document.getElementById("clear") const show = document.getElementById("show") const text = document.getElementById("text") const sub = document.getElementById("sub") // Import the functions you need from the SDKs you need import { initializeApp } from "https://www.gstatic.com/firebasejs/11.3.0/firebase-app.js"; import { getDatabase,ref,push,onValue,remove } from "https://www.gstatic.com/firebasejs/11.3.0/firebase-database.js"; // https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration const firebaseConfig = { apiKey: "AIzaSyC9ebhCO9FdQrF2GCnE0vTwYrmik4rvaT8", authDomain: "shop-1847a.firebaseapp.com", databaseURL: "https://shop-1847a-default-rtdb.asia-southeast1.firebasedatabase.app", projectId: "shop-1847a", storageBucket: "shop-1847a.firebasestorage.app", messagingSenderId: "965005392074", appId: "1:965005392074:web:63c1d5058bfdd25ff99c33" } const app = initializeApp(firebaseConfig); const idk = getDatabase(app) const lists = ref(idk,"shop") console.log(idk) function comes(){ let value = text.value push(lists,value ) } addEventListener("load",function(snapshot){ if(!snapshot){ console.log("not found") } else{ onValue(lists,function(snapshot){ show.innerHTML='' let shop = Object.values(snapshot.val()) let shops = Object.entries(snapshot.val()) for(let i =0; i < shop.length;i++){ console.log(shop[i]) console.log(shops[i]) const ba = document.createElement('label'); const va = document.createElement('button'); const b = document.createElement('br') va.textContent=shop[i] va.id = "te" va.addEventListener("click",function(){ let del = shops[i][0] console.log(del) let delp = ref(idk,`shop/${del}`) remove(delp) }) ba.htmlFor="tr" va.textContent=shop[i] show.appendChild(va); show.appendChild(b) show.appendChild(ba)
} }) } }) sub.addEventListener("click",function(){ comes() onValue(lists,function(snapshot){ show.innerHTML='' let shops = Object.entries(snapshot.val()) let shop = Object.values(snapshot.val()) for(let i =0; i < shop.length;i++){ console.log(shop[i]) const ba = document.createElement('label'); const va = document.createElement('button'); const b = document.createElement('br') va.id = "tr" va.addEventListener("click",function(){ let del = shops[i][0] let delp = ref(idk,`shop/${del}`) remove(delp) }) ba.htmlFor="tr" va.textContent=shop[i] show.appendChild(ba) show.appendChild(va); show.appendChild(b) } }) })
Ich versuche, mit Selenium etwas Einfaches zu bauen, schaffe es aber überhaupt nicht
Ich habe den folgenden Code:
from selenium import webdriver
from selenium.webdriver.chrome.service import...
Above is the Dokumentation für die Spring.AI für strukturierte Ausgänge mit offener KI. Wenn ich jedoch versuche, eine Anfrage zu stellen, erhalte ich immer wieder
Ich versuche, die Funktionsfunktionalität von Prozess -Snapshots in C ++ unter Windows X64 zu implementieren, um den Laufzeitzustand eines Prozesses zu speichern und ihn nach einem bestimmten...