我期待从我的help-button指令中获得孤立范围的东西.
it('should contain proper scope, depending on attributes', function() {
var el = compile('<help-button context-id="1"></help-button>')(scope);
scope.$digest();
console.log("el: " + el);
console.log('Isolated scope: ' + el.isolateScope());
..
});
Run Code Online (Sandbox Code Playgroud)
- 在每次测试之前
beforeEach(inject(function($compile, $rootScope, $injector) {
compile = $compile;
scope = $rootScope.$new(); ...
Run Code Online (Sandbox Code Playgroud)
它打印:
'el: [Object Object]'
'Isolated scope: undefined'
Run Code Online (Sandbox Code Playgroud)
问题是:为什么我要回来未定义?即使在隔离范围内没有任何内容,它仍然应该是空的{}对象.但无论如何 - 测试是错误的 - 它没有显示那里(实际上)包含数据的孤立范围.
如果:
scala> val l = List() // List() same as List[Nothing]()
l: List[Nothing] = List()
scala> 1 :: l
res0: List[Int] = List(1)
Run Code Online (Sandbox Code Playgroud)
要么:
scala> 1 :: List[Nothing]()
res6: List[Int] = List(1)
Run Code Online (Sandbox Code Playgroud)
为什么然后这没有成功:
scala> List(1,2,3). foldLeft( List() ) ((acc,x) => x :: acc)
Run Code Online (Sandbox Code Playgroud)
所以我必须明确键入List[Int]():
scala> List(1,2,3). foldLeft( List[Int]() ) ((acc,x) => x :: acc)
res3: List[Int] = List(3, 2, 1)
Run Code Online (Sandbox Code Playgroud)
?
虽然它在Haskell中确实存在,例如:
foldl (\acc x -> x:acc) [] [1,2,3]
Run Code Online (Sandbox Code Playgroud) 假设我需要并行处理给定文件夹中的文件.在Java中,我将创建一个FolderReader线程来读取文件夹和FileProcessor线程池中的文件名.FolderReader读取文件名并将文件处理函数(Runnable)提交给池执行程序.
在Scala中,我看到两个选项:
FileProcessoractor 池并安排一个文件处理函数Actors.Scheduler.是否有意义?什么是最好的选择?
我从playframework2的示例文件夹中获得了计算机数据库应用程序:
得到:所有测试都通过了.(什么是好的)
但是当尝试在IntelliJ IDEA中启动这些测试时:
问题是:如何从IDEA启动这些测试?
这是有效的代码.它向Actor(Greeter)发送消息并等待回复.但它阻止了当前的线程.
public class Future1Blocking {
public static void main(String[] args) throws Exception {
ActorSystem system = ActorSystem.create("system");
final ActorRef actorRef = system.actorOf(Props.create(Greeter.class), "greeter");
Timeout timeout = new Timeout(Duration.create(5, "seconds"));
Future<Object> future = Patterns.ask(actorRef, Greeter.Msg.GREET, timeout);
// this blocks current running thread
Greeter.Msg result = (Greeter.Msg) Await.result(future, timeout.duration());
System.out.println(result);
}
}
Run Code Online (Sandbox Code Playgroud)
我的示例使用什么方法future.onSuccess来获取结果而不阻塞当前调用线程?
我想感受copyOf()番石榴方法的"神奇力量" guava-libraries.
有一个小应用程序,我用来检查它.
这是文档:
JDK提供了
Collections.unmodifiableXXX方法,但在我们看来,这些方法可以
- 笨拙而冗长; 在你想要制作防御性副本的任何地方使用都是不愉快的
- unsafe:如果没有人拥有对原始集合的引用,则返回的集合只是真正不可变的
所以,我尝试在哪里建立一个模型"someone holds a reference to the original collection".因此,使用集合的副本我不应该担心改变副本的价值.但魔法到目前为止还不起作用(有两次尝试:1.copyOf(collection),2.copyOf(iterator)):
import com.google.common.collect.ImmutableList;
import java.util.LinkedList;
import java.util.List;
class MyObject {
String name;
public MyObject(String name) {this.name = name;}
@Override
public String toString() {
return name;
}
}
public class ListUnsafe {
List<MyObject> list = new LinkedList<MyObject>();
{
list.add(new MyObject("a"));
list.add(new MyObject("b"));
list.add(new MyObject("c"));
}
public List<MyObject> getList() {
return ImmutableList.copyOf(list);
}
public …Run Code Online (Sandbox Code Playgroud) 有一个关于整合的方式链接AKKA和Spring.或者更好地说:"如何Akka在spring环境中使用演员".
http://doc.akka.io/docs/akka-modules/1.3.1/modules/spring.html
实际上只存在版本的modules文件夹http://doc.akka.io/docs/akka-modules/1.3.1.
Does it mean that there is no integration for different than `1.3.1` version
with spring?
Or it means that we should not use it (spring integration I mean)?
Or we should do it in the same way as we do it for `1.3.1` version?
Run Code Online (Sandbox Code Playgroud) 有我的路线.第二个是评论.
GET /assets/*file controllers.Assets.at(path="/public", file)
#GET /partials/*file controllers.Assets.at(path="/public/partials", file)
Run Code Online (Sandbox Code Playgroud)
(我想要的是: 使我位于"/public/partials"文件夹内的html文件可以通过网络获得,与其制作方式相同assets)
一旦我取消注释第二行 - 它将因此行(来自我index.scala.html)而出错:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
Run Code Online (Sandbox Code Playgroud)
错误就像这里:
方法的参数不足:(path:String,file:String)play.api.mvc.Call.未指定的值参数文件.
问:怎么了?
更新:
换句话说:我想通过提供映射来缩短我的网址.否则,我要使用这个网址:'assets/partials/welcome.html'而不是一个(我想用)'partials/welcome.html'.
还有一个映射可以缩短我的网址.
当我需要从JS部分到达那些时,它就有意义了,就像在一个中有两个应用程序(1.play one,2.js one),还有两个路由器,两个根.对于JS,我假设我已经在/ public(或在资产中) - 这是js应用程序的根目录.
我想知道为什么它不起作用.
我注意到当我编译时,安装一些模块,haskell编译器只使用一个处理器(蓝色图表1/4)?我的笔记本电脑上的1/4.
我听说Haskell编译器很聪明,所以它可以安全地利用我所有的时间.
有没有办法让它更快?有些配置可能.
图片处理器图是蓝色的.黄色 - 网络.红色 - 硬盘.
在制作屏幕截图的那一刻,它可以使用所有处理器时间,因为它不使用硬盘驱动器或网络.

我在 Ubuntu 上作为主机操作系统。
docker --version
Run Code Online (Sandbox Code Playgroud)
Docker 版本 18.09.6,构建 481bc77
microk8s 1.14/beta
Run Code Online (Sandbox Code Playgroud)
启用本地注册表microk2s:
microk8s.enable registry
Run Code Online (Sandbox Code Playgroud)
检查:
watch microk8s.kubectl get all --all-namespaces
Run Code Online (Sandbox Code Playgroud)
容器注册表 pod/registry-577986746b-v8xqc 1/1 运行 0 36m
然后:
编辑:
sudo vim /etc/docker/daemon.json
Run Code Online (Sandbox Code Playgroud)
添加此内容:
{
"insecure-registries" : ["127.0.0.1:32000"]
}
Run Code Online (Sandbox Code Playgroud)
重新开始:
sudo systemctl restart docker
Run Code Online (Sandbox Code Playgroud)
仔细检查,看看是否应用了不安全:
docker info | grep -A 2 Insecure
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)Insecure Registries: 127.0.0.1:32000 127.0.0.0/8 WARNING: No swap limit support
标签:
docker tag my-registry/my-services/my-service:0.0.1-SNAPSHOT 127.0.0.1:32000/my-service
Run Code Online (Sandbox Code Playgroud)
检查:
docker images
Run Code Online (Sandbox Code Playgroud)
127.0.0.1:32000/my-service 最新 e68f8a7e4675 19 小时前 540MB …
akka ×3
java ×3
scala ×3
haskell ×2
actor ×1
angularjs ×1
collections ×1
docker ×1
generics ×1
guava ×1
integration ×1
jasmine ×1
javascript ×1
kubernetes ×1
microk8s ×1
routes ×1
scope ×1
spring ×1