Chris Cunningham
11/12/2018, 12:04 AMShawn
11/12/2018, 4:04 PMJukka Siivonen
11/13/2018, 7:59 AMRuckus
11/13/2018, 4:59 PMdG
11/14/2018, 1:08 PMSergey Shnifer
11/15/2018, 9:31 AMSergey Shnifer
11/15/2018, 9:41 AM<http://handler.post|handler.post>(object: Runnable{
...
})
and this works. Thanks a lot!CodeRed
11/16/2018, 3:42 PMfun writeSoundToSharedStorage(context: Context, sound: ISound): Boolean {
var inputStream: InputStream? = null
var outputStream: OutputStream? = null
val targetFile = getTargetFileFromSoundName(sound.soundName()) ?: return false
try {
inputStream = context.assets.open(getAssetPathFromSound(sound))
outputStream = FileOutputStream(targetFile)
inputStream.copyTo(outputStream)
} catch (ex: IOException) {
Log.e(LOG_TAG, "Failed to save file: ${ex.message}")
return false
} finally {
try {
inputStream?.close()
outputStream?.close()
} catch (ex: IOException) {
ex.printStackTrace()
}
}
return true
}
What I'm thinking about is to migrate the try-catch-finally-block to a use()-block. But from the docs of use() I'm not sure if exceptions are handled or not. I took a look into the implementation and for me it looks like an exception is thrown, so my guess would be that my app would crash as long as I don't handle it somehow. Also my function depends on returning false if something went wrong. It would be nice if someone could bring some more clarity to me 🙂dimkoss11
11/16/2018, 6:15 PMclass MapBuilder<T,U> {
operator fun invoke(arg: T): MapBuilder<T, U> {
return this
}
operator fun invoke(arg: U): MapBuilder<T, U> {
return this
}
}
of course it's don't work due to JVM limitations.
Platform declaration clash: The following declarations have the same JVM signature (invoke(Ljava/lang/Object;)Lcom/test/tests/MapBuilder;):
operator fun invoke(arg: T): MapBuilder<T, U> defined in com.test.tests.MapBuilder
operator fun invoke(arg: U): MapBuilder<T, U> defined in com.test.tests.MapBuilder
Any ideas how can I realize this?karelpeeters
11/16/2018, 6:17 PMMapBuilder<String, String>
?gabin
11/16/2018, 7:35 PMgabin
11/16/2018, 7:36 PMgabin
11/16/2018, 7:39 PMkarelpeeters
11/16/2018, 9:19 PMSlava Glushenkov
11/17/2018, 7:57 AMgabin
11/17/2018, 2:09 PMPat
11/17/2018, 5:44 PMChris Cunningham
11/17/2018, 8:08 PMgabin
11/17/2018, 9:15 PMaarjav
11/17/2018, 11:10 PMthis
can == null in the body of the lambda?
fun foo(block: String?.() -> Unit)
vs
fun foo(block: String.() -> Unit)
I noticed that with the second I cannot call .block()
on a String?
but the lambda body (for block param where foo is used) stays the same.alex
11/18/2018, 11:21 AMValV
11/18/2018, 12:56 PMCmd+...
shortcutsgabin
11/19/2018, 11:56 AMjurajsolarml
11/19/2018, 1:19 PMjurajsolarml
11/19/2018, 1:19 PMgabin
11/19/2018, 1:48 PMClaudiuB
11/19/2018, 2:33 PMoshai
11/20/2018, 5:22 PMval connectionUri = "jdbc:postgresql://$host:$port/$database?user=$username&password=$password"
val connection = PostgreSQLConnectionBuilder.createConnectionPool(connectionUri) { it.copy(
connectionCreateTimeout = 1
)}
I am writing a lib and I want to configure a connection. Configuration is a data class and all are vals.
Can I avoid the it.copy
in the code above (call the copy somehow in the lib), or is there an apply method?Mark
11/21/2018, 4:42 AMhashSetOf<X>()
or HashSet<X>()
for when we want a mutable hash set?Jieyi
11/21/2018, 4:49 AMimplement org.kodein.di:kodein-di-generic-jvm:6.0.0
this library, there's no kodein-di-core-common
and kodein-di-core-jvm
library. Did I miss somethin?Jieyi
11/21/2018, 4:49 AMimplement org.kodein.di:kodein-di-generic-jvm:6.0.0
this library, there's no kodein-di-core-common
and kodein-di-core-jvm
library. Did I miss somethin?rnpy
11/21/2018, 5:42 AMOleg Yukhnevich
11/21/2018, 7:09 AM