我用{ provide: LocationStrategy, useClass: HashLocationStrategy },我的app.module.ts。但是,当我给this.route.url它总是包含/不管我在/home或/dashboard或/profile
我需要获取特定的路线值
constructor(public router:Router) {} alert(this.router.url);
我想results根据存储在过滤器中的值过滤我的数组。我试过下面的代码。但它不适用。
let filters = {
name: ["Krishna", "Naveen"],
city : ["London"]
};
results = [
{
"name": "Krishna#Surname",
"city": "London",
"age": 23
},
{
"name": "Naveen#Surname",
"city": "London",
"age": 23
},
{
"name": "Krishna#Surname",
"city": "NewYork",
"age": 23
},
{
"name": "Praveen#Surname",
"city": "Washington",
"age": 23
}
]
this.results1 = this.multiFilter(results,filters);
multiFilter(array:any=[], filters:Object) {
const filterKeys = Object.keys(filters);
return array.filter((item) => {
return filterKeys.every(key => {
let filters1= filters[key];
return filters1.every(key1 => {
return !!~ item[key].indexOf(key1)
});
}); …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用pyspark连接到MongoDB.下面是我正在使用的代码
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext
sparkConf = SparkConf().setAppName("App")
sparkConf.set("spark.mongodb.input.uri", "mongodb://127.0.0.1/mydb.test")
sc = SparkContext(conf = sparkConf)
sqlContext =SQLContext(sc)
df = sqlContext.read.format("com.mongodb.spark.sql.DefaultSource").load()
df.printSchema()
Run Code Online (Sandbox Code Playgroud)
我面临以下错误
py4j.protocol.Py4JJavaError: An error occurred while calling o25.load.
java.lang.ClassNotFoundException: Failed to find data source: com.mongodb.spark.sql.DefaultSource.
Run Code Online (Sandbox Code Playgroud) 我的数据框看起来像
+-------------------------+-----+
| Title| Status|Suite|ID |Time |
+------+-------+-----+----+-----+
|KIM | Passed|ABC |123 |20 |
|KJT | Passed|ABC |123 |10 |
|ZXD | Passed|CDF |123 |15 |
|XCV | Passed|GHY |113 |36 |
|KJM | Passed|RTH |456 |45 |
|KIM | Passed|ABC |115 |47 |
|JY | Passed|JHJK |8963|74 |
|KJH | Passed|SNMP |256 |47 |
|KJH | Passed|ABC |123 |78 |
|LOK | Passed|GHY |456 |96 |
|LIM | Passed|RTH |113 |78 |
|MKN | Passed|ABC |115 |74 |
|KJM …Run Code Online (Sandbox Code Playgroud) 下面的代码在Mozilla和Chrome中运行正常。但是在Safari中无法播放视频。
<video id="v-control" width="100%" autoplay="autoplay" loop>
<source src="assets/img/web home page banner.mp4" type="video/mp4"
media="all and (max-width: 480px)">
<source src="video-small.webm" type="video/webm" media="all and
(max-width: 480px)">
<source src="assets/img/web home page banner.mp4" type="video/mp4">
<source src="video.webm" type="video/webm">
</video>
Run Code Online (Sandbox Code Playgroud)
我已经尝试preload过使用视频标签,如果要添加controls,则应单击“播放”按钮。我不需要视频的任何控件,因此我删除了控件。
我编写了一些代码,它将根据浏览器本地存储中存储的标志向我显示一个确认对话框。
if(localStorage.getItem('visitedPage') == 'true') {
this.alertService.confirmThis("Are you sure?",function(){
console.log("Yes");
},function(){
console.log("No");
})
} else {
localStorage.setItem('visitedPage','true');
}
Run Code Online (Sandbox Code Playgroud)
But I can see that dialog only after the page refresh (the entire content goes off, the page loads & the dialog opens). But I need that dialog immediately on hitting refresh.
Any suggestions or examples please!!
typescript ×3
angular ×2
pyspark ×2
ant ×1
apache-spark ×1
html5 ×1
javascript ×1
mongodb ×1
python ×1
sonarqube ×1
types ×1
vue.js ×1