小编Ash*_*tan的帖子

如何编写自定义例外?

如何创建Exception与预制类型不同的新特性?

public class InvalidBankFeeAmountException extends Exception{
    public InvalidBankFeeAmountException(String message){
        super(message);
    }
 }
Run Code Online (Sandbox Code Playgroud)

它将显示在第一行中写入的InvalidBankFeeAmountException的警告.

java exception

52
推荐指数
3
解决办法
5万
查看次数

检测到Angular 4 Circular依赖关系

将Angular Cli升级到1.3.1我现在有一些警告

WARNING in Circular dependency detected: src\app\work-sessions\work-session-list\work-session-list.routing.ts
-> src\app\work-sessions\work-session-list\index.ts -> src\app\work
-sessions\work-session-list\work-session-list.routing.ts
Run Code Online (Sandbox Code Playgroud)

每个类都有这样的结构:

在此输入图像描述

工作会话list.routing.ts

import { Route } from '@angular/router';
import { WorkSessionListComponent } from './index';

export const WorkSessionRoutes: Route[] = [
  {
    path: '',
    component: WorkSessionListComponent
  },
];
Run Code Online (Sandbox Code Playgroud)

Index.ts

export * from './work-session-list.component';
export * from './work-session-list.routing';
Run Code Online (Sandbox Code Playgroud)

工作会议,list.module.ts

import { WorkSessionListComponent } from './work-session-list.component';
import { WorkSessionRoutes } from './work-session-list.routing';
import { DataTableModule } from 'primeng/primeng';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core'; …
Run Code Online (Sandbox Code Playgroud)

typescript angular-routing angular

31
推荐指数
1
解决办法
6万
查看次数

更新JPA CriteriaUpdate中的现有列值

我有一个实体用户,我的用户数据库值是:

name     totalScore
--------------------
ABC        25
XYZ        30
Run Code Online (Sandbox Code Playgroud)

现在我想运行查询

update user set totalScore=totalScore+ (2*totalScore);
Run Code Online (Sandbox Code Playgroud)

我们怎样才能通过JPA 2.1 CriteriaUpdate实现它?

CriteriaBuilder criteriaBuilder = em().getCriteriaBuilder();
       //Updates the salary to 90,000 of all Employee's making more than 100,000.
        CriteriaUpdate update = criteriaBuilder.createCriteriaUpdate(User.class);
        Root user = update.from(User.class);
        Expression<Long> abc=user.get("totalScore");

        update.set("totalScore", ?? ); 
// what expression is here to be used to replace old value with new 
        Query query = em().createQuery(update);
        int rowCount = query.executeUpdate();
Run Code Online (Sandbox Code Playgroud)

orm eclipselink jpa-2.1

7
推荐指数
1
解决办法
5558
查看次数

为什么"激活器启动"会因"错误的应用程序路径"而失败?

我在Play Framework中创建了一个应用程序activator new.

activator start这个应用程序,它给了我以下错误:

Bad application path: -Dhttp.port=9000
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

如何解决这个问题?

java playframework typesafe-activator

6
推荐指数
1
解决办法
1371
查看次数

什么.NET Mime解析库可用?

我有一个项目利用javax.mail.internet.MimeMessage和其他相关的类,它们为我们收到的电子邮件进行mime解析.这需要移植到.NET.

我可以使用什么.Net第三方或内置库来替换我正在使用的Java类?

编辑:自从我问这个问题以来,过去9个月有什么变化吗?

.net mime

4
推荐指数
3
解决办法
5106
查看次数

Angular 2单向数据绑定HTML,就像我们在角度1中使用::

在角度2中是否有任何方法,以便我们可以像在角度1中那样实现单向数据绑定.

<!DOCTYPE html>
<html lang="en-US">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>

<div ng-app="">
<h4>please change the text box value to see the scenario</h4>
  <p>Name : <input type="text" ng-model="name" 
ng-init="name='change me '"></p>
  <h1>Hello {{name}}</h1>
<h2>One-way binding- </h2>
{{::name}}
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我们如何以Angular 2的方式实现这一目标.我们有什么替代品.

注意:我不想仅反映HTML上的更改.我需要更新的值@component end,但我不想仅在UI上显示更改

javascript angularjs angular2-template two-way-binding

3
推荐指数
1
解决办法
1006
查看次数

多线程访问中的ConcurrentModificationException

刚开始学习多线程,遇到并发修改的情况。

这是我的 Java 类

package ashish.demo.threading.basic;

import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.List;

/**
 * Created by ashishratan on 2/2/17.
 */
public class ItemTask implements Runnable {

    private volatile boolean shutdown;
    private List<Item> itemList = new ArrayList<Item>();
    private volatile Item item;
    private volatile boolean addItemEvent;
    private volatile boolean removeItemEvent;

    @Override
    public void run() {
        while (!this.shutdown) {
            try {
                synchronized (this) {
                    if (this.item != null) {
                        this.item.setProductName("Created By:: " + Thread.currentThread().getName());
                    }
                    if (this.addItemEvent) {
                        this.itemList.add(this.item);
                        this.item=null;
                        this.addItemEvent = false; …
Run Code Online (Sandbox Code Playgroud)

java collections multithreading

1
推荐指数
1
解决办法
758
查看次数

改变背景颜色并使用jquery提醒它

我开始学习jquery,我试图改变背景颜色并用回调警告它,它不起作用可能在我的语法中缺少了...

$("#b").click(function(){
  $("body").css("background-color,yellow",function(){
     alert("background-color has changed successfully");
  });
});
Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助!:)

html css jquery

-3
推荐指数
1
解决办法
1032
查看次数