从输入中,Stream<Map<String,Float>我试图找到具有最大值的独特分析物。我尝试了以下但没有得到预期的结果。我在收集价值时犯了一些错误。
样本输入数据: List<Map<String,Float>
{HNO3=2.005}
{HNO3=2.009}
{HCl=10.2}
{F-=0.0, HNO3=50.0}
Actual result : {HCl=Optional[HCl=10.2], F-=Optional[F-=0.0], HNO3=Optional[HNO3=50.0]}
Expected result : {HCl=10.2, F-=0.0, HNO3=50.0}
Run Code Online (Sandbox Code Playgroud)
我试过的Java代码:-
finalResponse.getChosenStartingMaterials()
.stream()
.map(Analyte::getMatrixUtilisationMap) // Stream<Map<String,Float>>
.flatMap(it -> it.entrySet().stream())
.collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.maxBy((m1, m2) -> m1.getValue().compareTo(m2.getValue()))))
Run Code Online (Sandbox Code Playgroud) 我试图在Windows 10上为Nodejs安装mongodb驱动程序,并获得有关Python的以下错误.
Python是预先评估的吗?而且它也只期望Python版本2.5到3.0.在Python之上它一直要求其他MS Visual Studio 2008或MS SDK/.Net安装?是否需要所有这些作为预先评估.
C:\Jay\M101JS>npm install mongodb
-
> kerberos@0.0.14 install C:\Jay\M101JS\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos
> (node-gyp rebuild) || (exit 0)
C:\Jay\M101JS\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! …Run Code Online (Sandbox Code Playgroud) 我试图使用$ http.get在AngularJS中读取一个json文件,并在浏览器控制台中获取一些错误.
Plunker:http://plnkr.co/edit/SDRpu1MmrTPpgpdb6Kyk?p = preview
这是我的代码
使用Javascript: -
var jayApp = angular.module('jayApp', []);
jayApp.controller('jayController', function($scope, $http){
$scope.entities = {};
$http.get("test.json").success(
function(data, status, headers, config) {
$scope.entities = data;
}
);
})
Run Code Online (Sandbox Code Playgroud)
HTML
<!DOCTYPE html>
<html>
<head>
<link data-require="bootstrap@3.3.5" data-semver="3.3.5" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link data-require="bootstrap@3.3.5" data-semver="3.3.5" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/cosmo/bootstrap.min.css" />
<link data-require="bootstrap@3.3.5" data-semver="3.3.5" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" />
<script data-require="jquery@1.11.3" data-semver="1.11.3" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script data-require="bootstrap@3.3.5" data-semver="3.3.5" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script data-require="angular.js@1.4.7" data-semver="1.4.7" src="https://code.angularjs.org/1.4.7/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app='jayApp' ng-controller='jayController'>
<h1>Read Json …Run Code Online (Sandbox Code Playgroud) 我正在控制器中将范围变量初始化为false
$scope.created=false;
Run Code Online (Sandbox Code Playgroud)
然而,当页面加载第一次仍然下面的消息闪烁一次然后隐藏.有没有办法阻止这种闪烁,并在第一次加载页面时完全隐藏它.
<div class="alert alert-success" ng-show="created">A new Entity created successfully.</div>
Run Code Online (Sandbox Code Playgroud) 在 Spring boot / spring security / Angular JS 应用程序中..
仅当用户具有指定角色时,我才尝试允许以下页面。
.antMatchers("/1_reportingEntities/*.html").hasAnyRole(roles)
Run Code Online (Sandbox Code Playgroud)
但是即使没有为用户设置该角色,它也允许页面。我错过了什么?
Java代码
@Override
protected void configure(HttpSecurity http) throws Exception {
String roles [] = new String[] {"ROLE_EDITOR", "ROLE_AUTHORISER" };
http.httpBasic()
.and()
.authorizeRequests()
// Permit these resources
.antMatchers("/login", "/4_security/login.html", "/bower_components/**", "/0_common/*.html", "/1_reportingEntities/*.js",
"/2_dataCollections/*.js", "/3_calendar/*.js", "/4_security/*.js", "/")
.permitAll()
// All other requests needs authentication
.anyRequest().authenticated()
// Allow only if has certain roles
.antMatchers("/1_reportingEntities/*.html").hasAnyRole(roles)
.and()
// CSRF protection
.csrf().csrfTokenRepository(csrfTokenRepository()).and().addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
// Enable https
http.requiresChannel().anyRequest().requiresSecure();
}
Run Code Online (Sandbox Code Playgroud) Angular 7 - primeng - 确认对话框不起作用
HTML
<p>confirm-dialog</p>
<button type="button" (click)="confirm()" pButton icon="pi pi-check" label="Confirm"></button>
Run Code Online (Sandbox Code Playgroud)
打字稿
confirm() {
console.log('confirm called...')
this.confirmationService.confirm({
message: 'Are you sure that you want to proceed?',
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
accept: () => {
this.msgs = [{ severity: 'info', summary: 'Confirmed', detail: 'You have accepted' }];
console.log('accept...')
},
reject: () => {
this.msgs = [{ severity: 'info', summary: 'Rejected', detail: 'You have rejected' }];
}
});
Run Code Online (Sandbox Code Playgroud)
Stackblitz 上的完整代码
https://stackblitz.com/edit/jjay-angular-primeng-gaiizg?file=src%2Fapp%2Fapp.module.ts
angularjs ×3
java ×2
angular ×1
angular7 ×1
installation ×1
java-8 ×1
java-stream ×1
javascript ×1
json ×1
mongodb ×1
node.js ×1
primeng ×1
python ×1
spring ×1
spring-boot ×1