在使用firebase admin SDK创建用户后,如何发送验证电子邮件?我想要结合起来createUser function,sendEmailVerification function
有人可以指出一个暗示或答案吗?谢谢
用户创建由已在应用程序中登录的管理员用户完成,因此管理员用户只是在仪表板上创建用户.这与注册方法完全不同.
我试图按照bojeil的回答,我仍然坚持用户使用自定义令牌登录的步骤.它与我当前的管理员用户会话发生冲突,管理员用户被踢出,而新用户已登录,即使我退出新用户,管理员用户仍然不在,需要登录才能重新登录该应用程序.
获取自定义令牌后,这是我在应用程序中的代码:
$http.post('/.custom-token', {uid: $scope.data.data.uid})
.then(function (response) {
console.log("custom token here:", response.data.token);
firebase.auth().signInWithCustomToken(response.data.token)
.then(function (firebaseUser) {
firebaseUser.sendEmailVerification();
firebase.auth().signOut().then(function() {
// Sign-out successful.
console.log("signed out success");
}, function(error) {
// An error happened.
});
})
.catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
});
Run Code Online (Sandbox Code Playgroud)
所以,我获得令牌,登录新用户,发送电子邮件验证链接,然后注销新用户.但我正在执行此操作的管理员用户也会退出.我在这里想念的是什么?
我在Python中进行核密度估计并获得如下所示的轮廓和路径.(这是我的示例数据:https://pastebin.com/193PUhQf).
from numpy import *
from math import *
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
x_2d = []
y_2d = []
data = {}
data['nodes'] = []
# here is the sample data:
# https://pastebin.com/193PUhQf
X = [.....]
for Picker in xrange(0, len(X)):
x_2d.append(X[Picker][0])
y_2d.append(X[Picker][1])
# convert to arrays
m1 = np.array([x_2d])
m2 = np.array([y_2d])
x_min = m1.min() - 30
x_max = m1.max() + 30
y_min = m2.min() - 30 …Run Code Online (Sandbox Code Playgroud) 我有使用初始计数的 bash while 循环。我想%03d在计数中添加三位数,以便输出如下:
folder001
folder002
Run Code Online (Sandbox Code Playgroud)
我的代码是:
#!/bin/bash
input_file=$1
csv_file=$2
count=1
while IFS= read -r line || [[ -n "$line" ]]; do
input_dir="./res/folder"%03d"$count/input"
output_dir="./res/folder"%03d"$count/output"
results_dir="./res/all_results_png/png"
mkdir -p "$input_dir" "$output_dir"
printf '%s\n' "$line" > "$input_dir/myline.csv"
find $output_dir -name image_"folder$count*".png -exec cp {} $results_dir \;
((count++))
done < "$csv_file"
Run Code Online (Sandbox Code Playgroud)
%03d如您所见,我添加到上面的代码中,但它是按字面意思打印的。我在这里错过了什么?谢谢
添加了一个更新,即:尝试find使用该模式执行文件
image_"folder$count*".png
Run Code Online (Sandbox Code Playgroud)
我如何才能反映 find 命令中的三位数变化?
我有一个数字的例子,数字之间有空格,但我想返回没有空格的整数:
mynumber = parseInt("120 000", 10);
console.log(mynumber); // 120
Run Code Online (Sandbox Code Playgroud)
我希望它回来120000.有人可以帮我这个吗?谢谢
问题是我在代码的开头声明了我的变量:
var mynumber = Number.MIN_SAFE_INTEGER;
Run Code Online (Sandbox Code Playgroud)
显然这会导致您提供的解决方案出现问题.
我正在使用此处的示例对文本数据执行LDA :我的问题是:
我如何知道哪些文档对应于哪个主题?
换句话说,例如,谈论主题1的文件是什么?
这是我的步骤:
n_features = 1000
n_topics = 8
n_top_words = 20
Run Code Online (Sandbox Code Playgroud)
我逐行阅读我的文本文件:
with open('dataset.txt', 'r') as data_file:
input_lines = [line.strip() for line in data_file.readlines()]
mydata = [line for line in input_lines]
Run Code Online (Sandbox Code Playgroud)
打印主题的功能:
def print_top_words(model, feature_names, n_top_words):
for topic_idx, topic in enumerate(model.components_):
print("Topic #%d:" % topic_idx)
print(" ".join([feature_names[i]
for i in topic.argsort()[:-n_top_words - 1:-1]]))
print()
Run Code Online (Sandbox Code Playgroud)
对数据进行矢量化:
tf_vectorizer = CountVectorizer(max_df=0.95, min_df=2, token_pattern='\\b\\w{2,}\\w+\\b',
max_features=n_features,
stop_words='english')
tf = tf_vectorizer.fit_transform(mydata)
Run Code Online (Sandbox Code Playgroud)
初始化LDA:
lda = LatentDirichletAllocation(n_topics=3, max_iter=5,
learning_method='online',
learning_offset=50.,
random_state=0)
Run Code Online (Sandbox Code Playgroud)
在tf数据上运行LDA:
lda.fit(tf) …Run Code Online (Sandbox Code Playgroud) 这是我的表:
ID State
---------
0 A
1 A
2 C
3 C
2 A
3 A
2 D
0 D
2 E
3 F
Run Code Online (Sandbox Code Playgroud)
这是结果:
ID1 ID2 N_State
---------
0 1 1
2 3 2
2 0 1
Run Code Online (Sandbox Code Playgroud)
问题是: 计算两个ID共有的状态数并输出为上述格式?
我有以下字典:
dictA = {
'a' : ['duck','duck','goose'],
'b' : ['goose','goose'],
'c' : ['duck','duck','duck'],
'd' : ['goose'],
'e' : ['duck','goose']
}
Run Code Online (Sandbox Code Playgroud)
我想得到以下结果:
{
'duck': {'countALL':3, 'countDoc': {'a': 2, 'b': 0, 'c': 3, 'd': 0, 'e':1}},
'goose': {'countALL':4, 'countDoc': {'a': 1, 'b': 2, 'c': 0, 'd': 1, 'e':1}},
}
Run Code Online (Sandbox Code Playgroud) 我有以下清单:
[[50.954818803035948, 55.49664787231189, 8007927.0, 0.0],
[50.630482185654436, 55.133473852776916, 8547795.0, 0.0],
[51.32738085400576, 55.118344981379266, 6600841.0, 0.0],
[49.425931642638567, 55.312890225131163, 7400096.0, 0.0],
[48.593467836476407, 55.073137270550006, 6001334.0, 0.0]]
Run Code Online (Sandbox Code Playgroud)
我想打印每个列表中的第三个元素。想要的结果是:
8007927.0
8547795.0
6600841.0
7400096.0
6001334.0
Run Code Online (Sandbox Code Playgroud)
我试过:
print data[:][2]
Run Code Online (Sandbox Code Playgroud)
但它没有输出所需的结果。
我试图将我的文本放在字体真棒图标的正下方,我想让我的两个按钮在彼此等距的页面上居中。当前,图标显示在文本旁边,按钮是一个接连不断。
<ul id="mylist">
<li><a class="btn btn-warning btn-outline btn-lg sharp" href="http://google.com" target="_blank"> My text below icon <i class="fa fa-address-card fa-5x"></i></a>
</li>
<li><a class="btn btn-info btn-lg sharp" href="http://www.google.com" target="_blank">My text below icon <i class="fa fa-address-book fa-5x"></i></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
这是我的 css 位:
ul#mylist li {
display:inline;
}
Run Code Online (Sandbox Code Playgroud) 我有以下字符串:
st = "../dir1/dir2/dirN/thisiswhatiwantonlyfirstsevencharacters"
Run Code Online (Sandbox Code Playgroud)
我试图从右边的第一个斜线开始得到前七个字符.目前我手动完成:
st[18:-32]
Run Code Online (Sandbox Code Playgroud)
我如何通过从右边查找第一个斜线然后获得前七个字符来做到这一点?