我试图在其中找到一个两位数的行.Eg:
的test.txt
uuLinuxxx
Linux 2011
2011 Linux RedHat
Linux RedHat
2011
2013 2014
2010
/usr/bin
2
Ubuntu 20 world
Run Code Online (Sandbox Code Playgroud)
期望OP:Ubuntu 20世界
我在用
sed -n '/[0-9]\{2\}/p' test.txt
Run Code Online (Sandbox Code Playgroud)
但问题是它正在打印所有具有2位或更多位数的行.
我正在尝试在每天创建目录的目录中创建日志,但是fileHandler没有创建目录,而是其抛出异常无法获取C:\ dir_date \ Logging.txt的锁(此处dir_date不存在,我正在尝试创建登录到该目录)。我可以通过“ fileHandler”创建目录吗?
FileHandler fileTxt;
fileTxt = new FileHandler("C:\\ff\\Logging.txt");
Run Code Online (Sandbox Code Playgroud)
log4J甚至可以创建目录(如果不存在),这是否可以通过fileHandler进行?
当我运行此命令 ng serve 时,出现此错误有人可以告诉我为什么
无法读取 null 的属性 'config' 类型错误:无法读取 Class.run 处的 null 属性 'config' (C:\wamp64\www\back_front\front_end\node_modules\@angular\cli\tasks\serve.js:51:63 ) 在 check_port_1.checkPort.then.port (C:\wamp64\www\back_front\front_end\node_modules\@angular\cli\commands\serve.js:123:26) 在 process._tickCallback (internal/process/next_tick.js :109:7)
我面临一个与角度应用程序相关的问题,在我的应用程序中使用组件,然后当我使用单页面时,页面加载成功,但当我在新选项卡中打开该 URL 或重新加载它时,给出错误“未找到”。
我为此使用 AWS apache 服务器,并且仅在我的 Godaddy 服务器页面重新加载正常工作时遇到此问题。
在这里我附上错误的屏幕截图。[![错误}[1]](https://i.stack.imgur.com/uOhUO.png)
提前致谢
我是 Angular 5 的新手。我目前正在研究 Angular Reactive 表单。我有一个下面的 JSON 结构,从 FORM 获取值后需要将其发回 REST API。
JSON 结构:
{
"empDesg": "Sr Developer",
"empID": 123,
"empName": "Sam",
"empSkills": [
"Java",
"Devops"
]
}
Run Code Online (Sandbox Code Playgroud)
我设法将 empID、empName 和 empDesg 映射到 formcontrols;它们都将成为输入文本元素。我想使用 formcontrols 或 formarray 将 empSkills 映射到复选框(但不确定使用哪一个)-只有我被困住了。
我的 HTML 和组件类:
addEmp.component.html
<form class="form-emp" [formGroup]="empForm">
<div class="form-group row ">
<label for="empID" class="col-sm-2 col-form-label">EmpID</label>
<div class="col-sm-10">
<input type="text" formControlName="empID" name="empID" class="form-control" id="empID" placeholder="Employee ID">
<div *ngIf="empForm.controls.empID.invalid && empForm.controls.empID.touched">
<ngb-alert type="danger" [dismissible]="false">Employee ID is must</ngb-alert>
</div>
</div>
</div>
<div …Run Code Online (Sandbox Code Playgroud) 如你看到的
<div *ngFor="let number of numbers;let i = index">
<div *ngIf="(number%2 !== 0);else even">
<ul odd>{{number}}</ul>
</div>
<ng-template #even>
<ul even>{{number}}</ul>
</ng-template>
</div>
Run Code Online (Sandbox Code Playgroud)
我试图使用ng-content选择器渲染值,但它不在*ngFor循环内工作.为什么这样 ?如何使它工作?更喜欢这个img
我不想要两个ngFor循环,我希望它能与ng-content一起使用.
要为我的每个请求添加拦截器标头,但它会给我以下错误.
未捕获错误:[$ injector:cdep]找到循环依赖项:$ http < - Auth < - httpRequestInterceptor < - $ http < - $ templateRequest < - $ route
app.js
var app= angular.module('myDemoApp',['ngRoute'])
app.factory('httpRequestInterceptor', ['Auth', function (Auth) {
return {
request: function (config) {
config.headers['x-access-token'] = Auth.getToken();
return config;
}
};
}]);
app.config(function ($httpProvider) {
$httpProvider.interceptors.push('httpRequestInterceptor');
});
Run Code Online (Sandbox Code Playgroud)
验证服务
(function () {
'use strict';
myDemoApp.factory('Auth', ['$http', '$window', Auth]);
/******Auth function start*****/
function Auth($http, $window) {
var authFactory = {};
authFactory.setToken = setToken;
authFactory.getToken = getToken;
return authFactory;
/*setToken …Run Code Online (Sandbox Code Playgroud) 如何在 SonarQube 分析中排除 ts.files 以获得更好的代码覆盖率。
我尝试使用以下代码
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"codeCoverageExclude": [
"src/app/user/about-report/about-report.component.ts"
],
}
}
Run Code Online (Sandbox Code Playgroud)
但不幸的是,它在声纳中得到了分析。你能帮我吗。我正在使用 Angular 7。
我按照此处的 Angular 文档https://angular.io/api/common/NgIf在我的材质表上创建 NgIf else 条件。它正在将远程 JSON 文件读取为 API。
API 是 Twitter 数据,我想要运行条件的字段之一是“回复”。如果没有回复,我想用“-”代替“0”。
我收到错误
一个元素上不能有多个模板绑定。仅使用一个以 * 为前缀的属性 (" Replies ]*ngIf="hashtags.replies<1; else noReplies"> {{hashtags.replies}} "):`
所以看来我无法运行 NgIf 并在同一个元素中插入我的数据,我已经尝试了 HTML 中的各种组合,但我真的被卡住了。
超文本标记语言
<ng-container matColumnDef="replies">
<th mat-header-cell *matHeaderCellDef> Replies </th>
<td mat-cell *matCellDef="let hashtags" *ngIf="hashtags.replies<1; else noReplies"> {{hashtags.replies}} </td>
<ng-template #noReplies>-</ng-template>
</ng-container>
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建 Web 应用程序 Spring Boot 作为后端,并构建 Angular 作为前端,但我面临着一些有关会话和获取所有组件数据的问题。
当用户登录时,我使用 sessionStorage.setItem() 但是当我尝试在我的家中获取用户数据时,我使用 sessionStorage.getItem()。问题是我必须刷新页面才能填充数据。
您能否帮助我了解在不刷新所有页面的情况下填充数据的最佳实践?
angular ×5
typescript ×2
amazon-ec2 ×1
angular5 ×1
angular6 ×1
angularjs ×1
apache ×1
filehandler ×1
html ×1
jasmine ×1
java ×1
javascript ×1
logging ×1
sed ×1
sonarqube ×1
unix ×1