Tutorial by Examples: al

RxJava is handy when making serial request. If you want to use the result from one request to make another you can use the flatMap operator: api.getRepo(repoId).flatMap(repo -> api.getUser(repo.getOwnerId()) .subscribe(/*do something with the result*/);
You can use the zip operator to make request in parallel and combine the results eg: Observable.zip(api.getRepo(repoId1), api.getRepo(repoId2), (repo1, repo2) -> { //here you can combine the results }).subscribe(/*do something with the result*/);
In the following example a 2 by 3 tensor is multiplied by a scalar value (2). # Build a graph graph = tf.Graph() with graph.as_default(): # A 2x3 matrix a = tf.constant(np.array([[ 1, 2, 3], [10,20,30]]), dtype=tf.float32) ...
Variable tensors are used when the values require updating within a session. It is the type of tensor that would be used for the weights matrix when creating neural networks, since these values will be updated as the model is being trained. Declaring a variable tensor can be done using the tf.Varia...
When you create a function in TypeScript you can specify the data type of the function's arguments and the data type for the return value Example: function sum(x: number, y: number): number { return x + y; } Here the syntax x: number, y: number means that the function can accept two argum...
Example: function hello(name: string): string { return `Hello ${name}!`; } Here the syntax name: string means that the function can accept one name argument and this argument can only be string and (...): string { means that the return value can only be a string Usage: hello('StackOverfl...
Dart has a robust async library, with Future, Stream, and more. However, sometimes you might run into an asynchronous API that uses callbacks instead of Futures. To bridge the gap between callbacks and Futures, Dart offers the Completer class. You can use a Completer to convert a callback into a Fut...
GNU gettext is an extension within PHP that must be included at the php.ini: extension=php_gettext.dll #Windows extension=gettext.so #Linux The gettext functions implement an NLS (Native Language Support) API which can be used to internationalize your PHP applications. Translating strings ...
If you want to access a workbook that's already open, then getting the assignment from the Workbooks collection is straightforward: dim myWB as Workbook Set myWB = Workbooks("UsuallyFullPathnameOfWorkbook.xlsx") If you want to create a new workbook, then use the Workbooks collection o...
Mac OSX Using Homebrew: brew install haskell-stack
The following example shows how to merge two arrays into one associative array, where the key values will be the items of the first array, and the values will be from the second: $array_one = ['key1', 'key2', 'key3']; $array_two = ['value1', 'value2', 'value3']; $array_three = array_combine($ar...
Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "ubuntu/trusty64" config.vm.provision "ansible" do |ansible| ansible.playbook = "vagrant-playbook.yml" end end vagrant-playbook.yml --- - hosts: default tasks: - name: ...
from struct import pack print(pack('I3c', 123, b'a', b'b', b'c')) # b'{\x00\x00\x00abc'
HTTP requests are made through the WSClient class, which you can use as an injected parameter into your own classes. import javax.inject.Inject import play.api.libs.ws.WSClient import scala.concurrent.{ExecutionContext, Future} class MyClass @Inject() ( wsClient: WSClient )(implicit ...
The following examples show 3 main methods for installing Erlang/OTP on FreeBSD. Method 1 - Pre-built Binary Package Use pkg to install the pre-built binary package: $ pkg install erlang Test your new installation: $ erl Erlang/OTP 18 [erts-7.3.1] [source] [64-bit] [smp:2:2] [async-threads:1...
You can build a JSON object tree (a JsValue) manually import play.api.libs.json._ val json = JsObject(Map( "name" -> JsString("Jsony McJsonface"), "age" -> JsNumber(18), "hobbies" -> JsArray(Seq( JsString("Fishing"), ...
If you already have sbt installed I find it easier to create a minimal Play project without activator. Here's how. # create a new folder mkdir myNewProject # launch sbt sbt When previous steps are completed, edit build.sbt and add the following lines name := """myProjectName&q...
C++11 Basic example: template<typename T> using pointer = T*; This definition makes pointer<T> an alias of T*. For example: pointer<int> p = new int; // equivalent to: int* p = new int; Alias templates cannot be specialized. However, that functionality can be obtained indi...
Giving your list a type To create a list you need a type (any class, e.g. String). This is the type of your List. The List will only store objects of the specified type. For example: List<String> strings; Can store "string1", "hello world!", "goodbye", etc, b...
The List API has eight methods for positional access operations: add(T type) add(int index, T type) remove(Object o) remove(int index) get(int index) set(int index, E element) int indexOf(Object o) int lastIndexOf(Object o) So, if we have a List: List<String> strings = new ArrayL...

Page 78 of 269