The summary provides an overview of the key points about Guice 2.0 covered in the document:
Guice 2.0 was released in May 2009 and introduced several new features such as provider methods, binding overrides, multi-bindings, map-bindings, and private modules. It also supports third party modules for testing and other languages.
This document provides an overview and introduction to Guice and guice-servlet. It discusses:
- What Guice is and its key features like describing all DI settings in Java code and easy injection and scope settings.
- What guice-servlet is and how it allows servlets and filters to benefit from constructor injection, type-safe configuration, modularity, and Guice AOP.
- How to get started with guice-servlet by adding the GuiceFilter to web.xml and installing the ServletModule.
Yonex is a tool that makes it easy to perform integration testing of web applications using Selenium. It allows testing of interfaces, Flex applications, and more through a simple framework. Yonex uses SeleniumRC to remotely control browsers for testing, and supports running tests on common application servers through Cargo. Sample code is provided to demonstrate how to capture screenshots and test Flex applications.
The document discusses S2Flex2, which allows Flex2 applications to connect to Java EE applications running on Seasar2 via HTTP and AMF. S2Flex2 includes components that provide connectivity on the client and server sides, and an AMF gateway that translates between AMF formats and allows access to Seasar2 services from Flex2. Examples are provided of using S2Flex2 services via remoting calls from Flex2 to retrieve and display results on the client.
14. Hack Features
Nullable
null を許容するかどうかを?で指定可能
function nullable_arg_func(?string $name) : string {
if ($name === null) return "name is null";
return "Hello " . $name;
}
function null_ng_arg_func(string $name) : string {
return "Hello " . $name;
}
nullable_arg_func(null);
null_ng_arg_func(null); // エラー発生
実行結果
$ hhvm examples.php
Fatal error: Argument 1 passed to null_ng_arg_func() must be an instance of string,
null given in /home/yone098/examples.php on line 10
15. Hack Features
Generics
C++, Java, C# のようなGenrics が利用可能
class Dog<T> {
private ?T $name;
public function __construct(T $name) {
$this->name = $name;
}
public function get_name() : T {
return $this->name;
}
}
$dog = new Dog("garsue");
echo("dog->get_name()=" . $dog->get_name() . "n");
$map = Map<string, int> { "a" => 1, "b" => 2 };
var_dump($map);
実行結果
dog->get_name=garsue
object(HHMap)#2 (2) {
["a"]=> int(1)
["b"]=>int(2)}
24. Tool
hh_client
不正な箇所がある場合に行番号と内容を表示
bad.php
<?hh
function bad_func() : int {
return "Hello, BpStudy#81";
}
bad_func();
実行結果
$ hh_client
/home/yone098/bad.php:3:10,28: Invalid return type
/home/yone098/bad.php:2:23,25: This is an int
/home/yone098/bad.php:3:10,28: It is incompatible with a string
プロジェクトのルートフォルダに.hhconfig ファイルを設置
しチェックを行うのがベスト
34. Performance
wordpress ab
wordpress nginx + php-fpm
Requests per second: 19.53 [#/sec] (mean)
Time per request: 2560.771 [ms] (mean)
Time per request: 51.215 [ms] (mean, across all concurrent requests)
Transfer rate: 154.85 [Kbytes/sec] received
wordpress nginx + fastcgi + hhvm
Requests per second: 42.97 [#/sec] (mean)
Time per request: 1163.692 [ms] (mean)
Time per request: 23.274 [ms] (mean, across all concurrent requests)
Transfer rate: 340.33 [Kbytes/sec] received