background preloader

The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing
The introduction to Reactive Programming you've been missing (by @andrestaltz) This tutorial as a series of videos If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming. So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others. Learning it is hard, even harder by the lack of good material. Rx.Observable.prototype.flatMapLatest(selector, [thisArg]) Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence. Holy cow. I've read two books, one just painted the big picture, while the other dived into how to use the Reactive library. Request and response Yes. Related:  RxKotlin RxJava

Introducción a Angular 2 - Módulos, Componentes, Templates y más Si quieres leer la versión más actualizada de este artículo, sigue este enlace Angular 2 es un framework completo para construir aplicaciones en cliente con HTML y Javascript, es decir, con el objetivo de que el peso de la lógica y el renderizado lo lleve el propio navegador, en lugar del servidor. A groso modo, para crear apps: Componemos plantillas HTML (templates) con el markup de Angular 2Escribimos Componentes para gestionar esas plantillasEncapsulamos la lógica de la aplicación en ServiciosEntregamos el componente raíz de la app al sistema de arranque de Angular 2 (bootstrap). El mecanismo de bootstrap de Angular 2 sirve para cargar la aplicación y el ejemplo más básico sería así: //app/main.tsimport {bootstrap} from '@angular/platform-browser-dynamic';import {AppComponent} from '. En ese momento, Angular se hace cargo de la app, presentando nuestro contenido en el navegador, y respondiendo a las interacciones del usuario en base a las instrucciones que le hemos dado. Módulo Componente

Introduction à RxJava - Tutos Android France Une des grandes problématiques des développeurs Android est le traitement des taches longues, dites asynchrones. Les petites mains de Google nous avaient pour cela fourni des AsyncTask, qui ont un comportement très limité et une utilisation très austère. En 2015 ce mot est à bannir du dictionnaire « Androidophone » Oubliez la définitivement, passez à RxJava ! Asynchrone La plupart des tâches « lourdes » sous Android sont à effectuer dans un Thread différent de l’affichage graphique. Parmi ces tâches nous avons principalement des appels réseau, de la lecture de fichiers, ou encore des algorithmes assez lourds comme un tri, une recherche, etc. Si vous avez l’habitude d’utiliser Retrofit ou toute autre librairie, vous cachez vos traitements derrière des Listener ou Callbacks : Cette méthode fonctionne très bien, le seul reproche qu’on peut lui faire est l’enchaînement des appels, qui va s’avérer un peu lourd. Reactive Programming / Observer Pattern Opérations longues / Observable Par exemple :

Adobe Photoshop Source Code Software Gems: The Computer History Museum Historical Source Code Series pho·to·shop, transitive verb, often capitalized \ˈfō-(ˌ)tō-ˌshäp\ to alter (a digital image) with Photoshop software or other image-editing software especially in a way that distorts reality (as for deliberately deceptive purposes)Merriam-Webster online dictionary, 2012 When brothers Thomas and John Knoll began designing and writing an image editing program in the late 1980s, they could not have imagined that they would be adding a word to the dictionary. Thomas Knoll John Knoll Thomas Knoll, a PhD student in computer vision at the University of Michigan, had written a program in 1987 to display and modify digital images. Gradually the program, called “Display”, became more sophisticated. The fate of Photoshop was sealed when Adobe, encouraged by its art director Russell Brown, decided to buy a license to distribute an enhanced version of Photoshop. Download Photoshop version 1.0.1 Source Code

Handling API Errors  |  Drive REST API  |  Google Developers The Drive API returns two levels of error information: HTTP error codes and messages in the headerA JSON object in the response body with additional details that can help you determine how to handle the error. The rest of this page provides a reference of Drive errors, with some guidance on how to handle them in your app. Errors and suggested actions In this section, you'll find the complete JSON representation of each listed error and a suggested actions you might take to handle it. 400: Bad Request User error. This error can be thrown when trying to add a duplicate parent to a Drive item. 401: Invalid Credentials Invalid authorization header. Suggested action: Refresh the access token using the long-lived refresh token. 403: Daily Limit Exceeded The Courtesy API limit for your project has been reached. Suggested action: Request additional quota. 403: User Rate Limit Exceeded The per-user limit from the Developer Console has been reached. Suggested actions: 403: Rate Limit Exceeded

Android - Oubliez définitivement les AsyncTask avec RxJava - Publicis Sapient Engineering - Engineering Done Right En tant que développeur Android, vous avez sûrement déjà été confronté aux limitations des AsyncTasks. Peut-être avez-vous eu l’occasion de saisir dans votre moteur de recherche préféré les mots-clés "Orientation Change", "Memory Leak", "Error Handling" ou même "Running Parallel" suivis du célèbre "AsyncTask" ? Si c’est le cas, lisez ce qui suit puisque nous allons vous montrer une nouvelle façon d’exécuter des traitements (par exemple des appels réseau) sur un thread séparé, tout en récupérant les résultats dans le thread principal, le tout sans parler de Thread, de Service, de Fragment, d’EventBus ou d’AsyncTask. À la place, nous allons vous présenter RxJava. Introduction à RxJava RxJava est une implémentation réalisée par Netflix du projet Rx (Reactive Extensions) initialement conçu par Microsoft, et libéré en novembre 2012. Rx est basé sur le paradigme de la programmation réactive fonctionnelle (Functional Reactive Programming) …Et concrètement… ? https: Il renvoie un résultat de ce type :

RESTful API Design: what about errors? In the previous posts in this series about Pragmatic REST API design, I talked about simplyfing associations, using the HTTP ? to hide complexities and optional parameters, choosing plural nouns and concrete names, and more. Check out the full series. What about errors in the context of RESTful API best practices? Why is good error design especially important for API designers? Bottom line, it's about making your APIs intuitive and making developers successful. First, developers learn to write code through errors. From the perspective of the developer consuming your Web API, everything at the other side of that interface is a black box. Secondly, in addition to when they're developing their applications, developers depend on well-designed errors at the critical times when they are troubleshooting and resolving issues after the applications they've built using your APIs are in the hands of their users. How to think about errors in a pragmatic way with REST? A couple of best practices

RxFlux Android Architecture. This is the first article about the new… | by Marcel Pintó | The Startup | Medium This is the first article about the new RxFlux framework. Is small light-weight framework that makes it easy to follow the Flux pattern with RxJava functionalities. I will not get into the details on how Flux works, in order to understand more how to use Flux pattern in Android, @lgvalle created a nice example and explanation. I would recommend to read it before. In this article I will explain how to create an app from scratch using RxFlux. Please take the sample app in the repo as a reference. In any normal app development the first step is to think what do you want to do. Let’s imagine that we want to create a simple app that uses the Github API. First thing we must think is which “Stores” do we need. RepositoriesStore: will contain the list of GitHubRepos.UsersStore: will contain the list of users we request for each repo. According to the diagram below, now we need to think what interface shall we define in order that the view gets the needed information. GitUser getUser(String id);

notes: RX Java with Kotlin in Baby Steps w/ Annyce Davis | by Ataul Munim | ProAndroidDev (2:40) RX is about programming with asynchronous data streams. These streams can come from anywhere: user click events, push notifications and GPS updates for example. (4:45) You can use RX in many places. Even if there’s only one event (e.g. a response from a network request), many events (e.g. user typing in a text field), or an error (such that you get zero data events) — they can all be modelled as asynchronous data streams. (6:15) RX is a tool that facilitates lots of things, including: chaining — start operations based on the result of an earlier operationthreading — schedule work and delivery of events on different threads without much effortcomposition & data transformation — combine smaller functions together to achieve goals (8:45) It’s similar to code you’ll see in Kotlin. This example in Kotlin demonstrates some standard operators. Conversely, RX waits until there’s a subscriber, and applies operations on each emission as and when they come (“lazy”). You have available to you:

proandroiddev When RxJava came to the world the Event bus pattern implementation becomes much easier, but we still need to write abstraction on top of the RxJava to make type safety API for our EventBus. First of all, create an EventBus interface. EventBus A class implements the BusEvent interface to indicate EventBus event. Queue For each type of event, we need to create Queue . The consumeReplayQueue method fire cached event and clear stream by publishing internal IdleEvent that will be filtered. Stream To get stream we need to call queue the method of EventBus interface and passe one of the queues that we created earlier. And finally a quick example of how to use out EventBus: with replay stream Thanks for the reading, all code you can find here.

Completo artículo sobre Programación Reactiva, desde sus conceptos básicos, empleando RxJS. Resumen del videocurso publicado en Egghead.io, titulado "Introduction to Reactive Programming". by alce65 Jan 19

Related: