Using kotlinx.coroutines in IntelliJ IDEA project

runBlocking and other high-level coroutine utilities are not in the Kotlin standard library, but instead are a part of the library kotlinx.coroutines. To use this library in your project you must download its binaries and add a dependency on them to the project. Usually declaring a library dependency is a line or couple of lines … Read more

How to launch a Kotlin coroutine in a `suspend fun` that uses the current parent Scope?

You should make the function go an extension function of CoroutineScope: fun main() = runBlocking { go() go() go() println(“End”) } fun CoroutineScope.go() = launch { println(“go!”) } Read this article to understand why it is not a good idea to start in a suspend functions other coroutines without creating a new coroutineScope{}. The convention … Read more

Kotlin Android debounce

I’ve created a gist with three debounce operators inspired by this elegant solution from Patrick where I added two more similar cases: throttleFirst and throttleLatest. Both of these are very similar to their RxJava analogues (throttleFirst, throttleLatest). throttleLatest works similar to debounce but it operates on time intervals and returns the latest data for each … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)