小编Ced*_*Ced的帖子

removeif()不在jpa返回的列表上工作

我有一些问题理解为什么我不能在jpa返回的集合上使用removeIf()但是我可以使用迭代器来实现.

@PersistenceContext(unitName = "my-pu")
private EntityManager em;
@Override
public void removeUserFromGroup(String username, Group group) {
    Query query = em.createNamedQuery("Group.getByName", Group.class);
    query.setParameter("name", group.getGroupName());
    Group qGroup = (Group) query.getSingleResult();
    // this works
    // Iterator<User> i = qGroup.getUsers().iterator();
    // while (i.hasNext()) {
    // User o = i.next();
    // if (o.getUsername().equals(username)) {
    // System.out.println("eqqq");
    // i.remove();
    // }
    // }
    System.out.println("class: " + qGroup.getUsers().getClass().getName());
    // org.eclipse.persistence.indirection.IndirectList
    qGroup.getUsers().removeIf(u -> u.getUsername().equals(username));// doesn't work
}
Run Code Online (Sandbox Code Playgroud)

java jpa jpql

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

如何使用离子2创建组件scss

我无法使用标准角度2将我的scss链接到离子2中的组件:

styleUrls: ['form.component.scss']
Run Code Online (Sandbox Code Playgroud)

怎么做?

ionic-framework ionic2

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

循环导入在 Dart 中是否不好?

Dart 允许循环导入。

我的总体理解是循环导入(文件a导入文件b,文件b导入文件a)是一种不好的做法,一般是为了释放资源,以及垃圾回收。然而,dart 中甚至没有警告,所以我想知道它是否会导致不良行为。

对垃圾收集有影响吗?它会导致问题吗?

dart

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

添加依赖项时:CDI部署失败,类型为Set <Service>且具有限定符@Default的不满意依赖项

当我将twitter hbc依赖项添加到我的pom.xml时,我收到了一个错误.我按照这里的说明进行操作.我不明白,如果它是一个依赖性问题我应该在网上找到一个修复,但如果我注释掉那个依赖,我的服务器正在启动..

这是我添加到我的pom.xml中的内容:

   <dependency>
      <groupId>com.twitter</groupId>
      <artifactId>hbc-core</artifactId> <!-- or hbc-twitter4j -->
      <version>2.2.0</version> <!-- or whatever the latest version is -->
    </dependency>
Run Code Online (Sandbox Code Playgroud)

这是错误:

2015-06-20T18:13:52.877+0200|Severe: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type Set<Service> with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)
  at com.google.common.util.concurrent.ServiceManager.<init>(ServiceManager.java:0)
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Set<Service> with qualifiers @Default
  at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)
  at com.google.common.util.concurrent.ServiceManager.<init>(ServiceManager.java:0)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:370)
    at …
Run Code Online (Sandbox Code Playgroud)

twitter glassfish maven twitter4j twitter-hbc

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

org.jboss.weld.exceptions.DeploymentException:WELD-001409:带有限定符的类型Bean的不明确依赖关系@Default

我的项目昨天工作正常.我唯一做的就是将结构从单个战争改为多个模块.如果我理解正确的堆栈跟踪,焊接和omnifaces websocket lib之间存在模糊性.但是,似乎没有对stacktrace上的任何方法进行任何调用.也许这是omnifaces的问题?我甚至不使用omnifaces websockets,我使用javax.websocket.不过我过去在这个项目中尝试过,我搜索了"org.omnifaces.cdi"并从子包中注释掉了一些东西,@Param但问题仍然存在.另外我不明白为什么模糊性似乎来自两个完全相同的类:

  • 具有限定符[@Any @Default]的Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager],
  • 具有限定符的托管Bean [class org.omnifaces.cdi.push.SocketSessionManager] [@Any @Default]
[2016-06-25 03:13:59,430] Artifact core:war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"core-0.0.1-SNAPSHOT.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 4 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type SocketSessionManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions
  at org.omnifaces.cdi.push.SocketPushContextProducer.socketSessions(SocketPushContextProducer.java:0)
  Possible dependencies: 
  - Managed Bean [class org.omnifaces.cdi.push.SocketSessionManager] with qualifiers [@Any @Default],
  - Managed Bean [class …
Run Code Online (Sandbox Code Playgroud)

jsf dependencies maven cdi omnifaces

3
推荐指数
2
解决办法
5739
查看次数

Keycloak棱角分明2

我正在尝试使用角度为2的keycloak.我正在我们做的服务,就像他们在他们的文档中所做的那样.但是,not authenticated即使我在连接到我的帐户keycloak url(auth/realms/wb/account)时已连接,它也会一直返回.

declare var Keycloak: any;

@Injectable()
export class UserMockService {

    constructor() {
        let keycloak: any = new Keycloak('assets/keycloak.json');

         keycloak.init().success(function(authenticated) {
            alert(authenticated ? 'authenticated' : 'not authenticated');
        }).error(function() {
            alert('failed to initialize');
        });
     }
}
Run Code Online (Sandbox Code Playgroud)

是的确找到了json.

{
  "realm": "wb",
  "auth-server-url": "http://192.168.99.100/auth",
  "ssl-required": "external",
  "resource": "wb",
  "public-client": true
}
Run Code Online (Sandbox Code Playgroud)

哦,是的,在我忘记之前:重定向用户连接到我的应用程序的URL到底是什么?好像它应该是容易找到的东西,但他们的文档是如此分散..目前连接我使用/ auth/realms/wb /帐户,但这是连接到帐户设置的URL ..

所以流程是这样的:

  • 用户访问http://192.168.99.100
  • 用户单击登录按钮
  • 在我使用的那一刻,用户被重定向到登录URL http://192.168.99.100/auth/realms/wb/account.
  • 用户返回应用程序,角度服务告诉我用户是否已登录.

keycloak angular

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

vertx获取一个简单的职位要求

他们在vertx网站上文档尚不清楚如何接收请求的正文

var vertx = Vertx.vertx();
var server = vertx.createHttpServer();
var Router = require("vertx-web-js/router");
var BodyHandler = require("vertx-web-js/body_handler");


var router = Router.router(vertx);


router.route().handler(BodyHandler.create().handle);

router.route('POST', "/a").handler(function (routingContext) {
  var response = routingContext.response();
  response.setChunked(true);
  response.write("a json received");
  var str = routingContext.getBodyAsJson()
  console.log(str);
  // Now end the response
  routingContext.response().end();
});
Run Code Online (Sandbox Code Playgroud)

我得到错误:

 vertx-js/util/console.js:9 ReferenceError: "inspect" is not defined
Run Code Online (Sandbox Code Playgroud)

如果他们甚至不将其放入文档中,我应该怎么知道该怎么称呼。

vert.x

3
推荐指数
2
解决办法
7401
查看次数

图标和manifest.json

关于manifest.json中的图标如何处理的建议是什么?

我发现这个生成图标的webpack插件。它生成了37个图标和相应的html标签。

<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#fff">
<meta name="application-name" content="graff">
<link rel="apple-touch-icon" sizes="57x57" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-icon-180x180.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="@dasnoo/graffity-inferno">
<link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 1)" href="icons-ce3ab881bd31f1efc59c9c227d8f6b7f/apple-touch-startup-image-320x460.png">
<link rel="apple-touch-startup-image" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: …
Run Code Online (Sandbox Code Playgroud)

html javascript browser service-worker manifest.json

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

制作梯形标签形状

我正在尝试复制这种菜单的感觉,但在制作不同选项卡的梯形形状时遇到了一些麻烦。我浏览了源代码,还在开发工具中一一删除了每个 css 属性,但我仍然没有弄清楚。我也尝试过

我做了一个JSFiddle试图复制它(目前没有梯形形状)。

<nav>
        <ul>
           <li class=" active"><a href="#">NEWS</a></li>
           <li><a href="#">FORUM</a></li>
           <li><a href="#"><span>TRUC</span></a></li>
           <li><a href="#"><span>OTHERS</span></a></li>
        </ul>
</nav>


nav{
    background:white;
    border-bottom: 2px solid #50bfff;
}
nav ul{
    margin:0;
}
nav ul li{
    display:inline-block;
}
nav a{
    padding: 1rem;
    color:#505050;
    display:block;
    text-decoration:none;
}
nav ul .active{
    background:#50bfff;
}
Run Code Online (Sandbox Code Playgroud)

css

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

网络音频api计时是否比setTimeout更精确

在网络音频 api 中推送声音时,您可以设置声音以 开始的时间source.start(startTime);。不过我想知道这有多精确。我知道setTimeout()只需将要执行的代码放在事件队列中即可。我认为 Web 音频 api 也是这样做的,但这只是一个猜测。这样一来,他们两个之间就不会有什么区别了。

我尝试在播放声音之前运行一些长时间运行的进程,并且声音确实有延迟。

  //...
  source.start(startTime + 0.2);
  //....
 let i = 0;
 while( i < 100000){
   console.log("p" + i);
   i++;
 }
Run Code Online (Sandbox Code Playgroud)

网络音频 API 的setTimeout底层使用也是如此。如果是这样,我可以通过使用网络工作者让事情变得更加敏感吗?我知道网络工作者可以访问 setTimeout,但我不确定它是否可以访问网络音频 api。

来自文档:

音频工作人员提供了在网络工作人员上下文中进行直接脚本化音频处理的能力,并由几个接口定义(自 2014 年 8 月 29 日起新)。这些尚未在任何浏览器中实现

这仅解决了音频处理的问题,我不确定是否包括仅播放音频。

javascript audio web-audio-api

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