可以使用标准外壳工具。在这种情况下> ripgrep )。
建议的命令是:
git status | grep <state> | awk -F ':' '{print $2}' | xargs git add
# or
git status | grep <state> | awk -F ':' '{print $2}' | xargs git commit -m "<msg>"
# for deleted files only:
git status | grep deleted | awk -F ':' '{print $2}' | git commit -m "<msg>"
如果您知道每个工具,则命令大多是自我解释的。如果您不这样做,请学习它们,它们很有用。简而言之:GREP找到具有指定状态的行。 “删除”。尴尬过滤第二列。 Xargs将其转换为参数格式。
为此/这些管道制造一个别名使它成为一项琐碎的任务。
您错过了代码中的某些内容,需要检查输入值,并增加 streakcount
,未经测试的示例代码:
while (it.hasNext()) {
String val = it.next();
if (val.equals("true")) {
streakcount++;
if (streakcount >= 10) {
streak = true;
System.out.println ("Streak is found! ");
break;
}
}
else if (val.equals("false")) {
streak = false;
System.out.println ("Streak is broken! ");
break;
}
}
还有更多的操作,检查不同的输入值,或者您需要查找条纹,如果这不是从开始数组...
您可以在第一个词典上使用嵌套循环执行遍历,并将所有值附加到结果 out
变量,内部
“ filtered_data”
:
d = {'2020-04-20': [('EUR', 34.02), ('USD', 30.18), ('AWG', 24.44), ('GPB', 20.68)],
'2020-04-25': [('EUR', 16.88), ('USD', 15.06), ('AWG', 12.17), ('GPB', 10.4)]}
out = {"filtered_data": []}
for i in d:
for j in d[i]:
out["filtered_data"].append({"data": i, "currency": j[0], "value": j[1]})
print(out)
output: >
{'filtered_data': [{'data': '2020-04-20', 'currency': 'EUR', 'value': 34.02}, {'data': '2020-04-20', 'currency': 'USD', 'value': 30.18}, {'data': '2020-04-20', 'currency': 'AWG', 'value': 24.44}, {'data': '2020-04-20', 'currency': 'GPB', 'value': 20.68}, {'data': '2020-04-25', 'currency': 'EUR', 'value': 16.88}, {'data': '2020-04-25', 'currency': 'USD', 'value': 15.06}, {'data': '2020-04-25', 'currency': 'AWG', 'value': 12.17}, {'data': '2020-04-25', 'currency': 'GPB', 'value': 10.4}]}
从历史上看,Unix系统认为时间是时间单元(秒,毫里,纳米等),因为绝对起源即将被称为“时代”:1970年1月1日00:00:00:00 UTC。这是
因此,“ Unix时间”是该系统中的计算系统和“ Epoch Timestamps”是该系统的时间点。
现在,在我看来,您似乎正在使用时空时间戳。
对于您的“短”时间戳,12600000 秒,由于时期的时间点与自时代以来的时间点不同于12600000 milliseconds 。这就是为什么您会看到它们解决一天中不同的时间,因为您的转换器正在以不同的方式解释它们。如果您在输出中加入了日期,那么您将看到两个时间点相隔六个月。
尝试以下操作:
Private Sub ComboBox1_Change()
Dim txt
txt = ComboBox1.Text
With Me 'assuming this is in the worksheet code module
.Shapes("group_1").Visible = txt = "2021-2022"
.Shapes("group_2").Visible = txt = "2022-2023"
.Shapes("group_3").Visible = Len(txt) > 0 'any option selected
End With
End Sub
在循环的第一个中,您将对象传递给构造函数。像这样:
listOfTranslationContent.append(ContentTranslation(contentTranslation))
而是将第一个循环的主体更改为:
for j in range(1,noOfSessions):
aContentList.append("a")
# create object
contentTranslation = ContentTranslation(language)
contentTranslation.addContentTranslation(aContentList)
# append to list
listOfTranslationContent.append(contentTranslation)
我不知道只有最后一次打开的确切答案,但我宁愿用道具做到这一点。在父模板中:
<a @click="expandAll">View All</a>
<CollapsiblePanel :open="openAll">
...
</CollapsiblePanel>
<CollapsiblePanel :open="openAll">
...
</CollapsiblePanel>
父母中的按钮的函数:
const openAll = ref(false);
function expandAll() {
openAll.value = !openAll.value;
}
而不是在Coldapsible Panel脚本设置中:
const props = defineProps({openAll: Boolean});
const currentOpen = ref(false);
/// Call with click on child:
const toggleIndividual = () => {
currentOpen.value = !currentOpen.value;
}
/// If prop changes (expand all button is clicked) open child
watch(props.openAll) {
currentOpen.value = true;
}
以及在Coldapsible Panel模板中。您可以将要单击的元素放在要扩展的元素上。
现在,如果您切换所有内容,所有孩子将扩展。如果您单击一个孩子,它将崩溃。
希望这会有所帮助。
尝试将其更改为
geraete: List<RDevice>.from((json["geraete"] as List<Map<String, dynamic>>).map((x) => RDevice.fromJson(x))),
第1部分:发出 ./ slap
作为命令时的函数调用的参数
,在此部分中有两个问题:
con = input("Would you like to continue y/n - ")
def con_p(cmds, con):
if con == "y":
return slap()
elif con == "n":
return cmds
con_p()
在此块的最后一行中,新创建的函数 con_p
被调用,但没有任何参数( cmds
, con
)。由于它们也没有默认值,因此脚本崩溃了。
为了解决这个问题,我们只需要提供所需的论点即可;将最后一行更改为:
con_p(cmds, con)
您可能认为这有点不必要,因为您已经在行中使用了这些名称 def con_p(cmds,con):
,但这就是提供的参数将被称为内部函数 con_p()
,而不是从何处撤离。
当 con_p()
使用 con =“ y”
:然后 con_p()
调用 slap()<时,就会发生第二个问题。 /代码>再次没有参数。我们需要用
返回slap()
返回slap(cmds)
。
旁注:我不知道代码块我在上面复制/粘贴是否有进一步的意图,但是可以删除con_p()函数。整个块可以替换为:
con = input("Would you like to continue y/n - ")
if con == "y":
return slap(cmds)
cmds
在 slap()
中也没有使用,因此我们也可以将其定义为 def slap():< /code>而不是
def slap(cmds):
。
第2部分:无限循环,
由于代码是从第一行到最后一行执行的,因此,除非 cmds
等于 br
,否则代码的以下块将始终保持循环。
while True:
if cmds == "br":
break
由于我们无法在循环期间调整 cmds
,而且只要求一次,我们根据 cmds
的值有三种情况
- 。 > ./ slap ,以便我们可以拍打人,然后退出拍打后(
con ==“ n”
),我们将进入无限循环 br
so so so我们不会陷入循环中,没有执行其他命令,并且程序退出而无需- 为
cmds
进行任何其他值,而该值未得到评估,因为我们最终会永远进入循环。
我不确定此循环的预期目的,但是我认为您想在整个代码周围放一个循环,要求命令输入并执行它们,因此:
def slap(cmds):
[...]
def about_rb():
[...]
while True:
cmds = input("Say any command you would like :) - ")
if cmds == "./slap":
slap(cmds)
if cmds == "./about_rb":
about_rb()
if cmds == "br":
break
在这里,我们首先定义了所有功能。然后,在一个无尽的循环中,我们一直向用户询问新命令,然后运行该命令。只有当命令为“ BR”时,我们会破坏循环,并且计算机在循环后使用代码继续(如果有)。
将所有这些放在一起
# imports
import time
# define functions
def slap(cmds):
slap_p = input("Who do you want to slap: ")
caption_for_slap = input("Caption for slapping: ")
print("Loading...")
time.sleep(3)
print(caption_for_slap, "
直接答案如已经指出的附加
,但是您可以通过使用stdlib String
and andar.sample
来简化代码。
unordered_letters = random.sample(string.ascii_letters, nr_letters)
您会遇到该错误,因为您使用的是 doc()
,该错误应用于在返回集合redReference实例的路径上获取DocumentReference实例。
const colRef = doc(db, 'user_data', user, "run");
上面的代码尝试将“ db/user_data/user/run run collectionReference实例分配给colref,使用 doc()
方法。子策略文档等。这意味着 db
应该是您的数据库根参考, user_data
应该是根集合, user
user_data
user 代码>集合。
将代码更改为与该模式相对应的,例如:
const docReference = doc(db, "aRootCollection", "documentId"); // Get the document reference.
const docSnapshot = await getDoc(docReference); // Get a snapshot of the document.
const documentData = docSnapshot.data(); // Get the data of the snapshot. In your case, this would return the "run" array.
无需使用查询来实现目标。
确保您熟悉 Promises
和/或等待
并正确处理所有可能的异常。
确保您阅读官方的firestore文档。它写得很好,有例子。
PS尝试与您的报价保持一致,以提高可读性。
看看这种数据结构。
const aDocmentId = "hH8FfavuIKCwaSQPKmFY"; // The document Id you wish to reference.
const docReference = doc(firestore, `users/${aDocmentId}`); // Getting the Document Reference.
const docReference2 = doc(firestore, "users", "hH8FfavuIKCwaSQPKmFY"); // Same thing but static, with different syntax.
const docSnapShot = await getDoc(docReference); // Get the Document Snapshot.
const docData = docSnapShot.data(); // This will be { name: 'myName', age: 25, rentedMovies: [ 'Burn After Reading', 'Interstellar' ] }
for(const field in docData) { // Loop through all key-value pairs in docData.
console.log(`${field}: ${docData[field]}`); // Log "Field: value", for every key-value pair.
}
上面的代码将记录以下内容:
name: 'myName'
age: 25
rentedMovies: Burn After Reading,Interstellar
我还遇到了这个问题,并将“@abacritt/angularx-Social-login”用于社交媒体登录。此问题发生在所有新创建的Google客户端ID中。如果您使用的是Angular应用程序,则可以通过在提供商中添加“ plugin_name”来解决这。
在app.module.ts中,创建一个保存“ plugin_name”的对象。
const googleLoginOptions = {
scope: 'profile email',
plugin_name:'login' //you can use any name here
};
在提供商中,将“ GoogleLoginOptions”对象与Google客户端ID一起传递。
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgbModule,
AppRoutingModule,
CommonModule,
HttpClientModule,
SocialLoginModule
],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
providers: [
{
provide: 'SocialAuthServiceConfig',
useValue: {
autoLogin: false,
providers: [
{
id: GoogleLoginProvider.PROVIDER_ID,
provider: new GoogleLoginProvider(
'YOUR GOOGLE CLIENT_ID',
googleLoginOptions
)
}
],
onError: (err) => {
console.error(err);
}
} as SocialAuthServiceConfig,
}
],
bootstrap: [AppComponent]
})
现在,清除浏览器缓存,应该可以正常工作。
有关app.component.ts的更改,您可以参考
此解决方案对我有用。希望这会有所帮助。
我能够通过将其添加到我的作曲家。
i was able to fix it by adding this to my composer.json .. somehow i never needed it until today.
Google Cloud App引擎引擎标准部署具有PHP 7.4 / 8.1 MongoDB扩展