https://kotlinlang.org
Join Slack
what is the most efficient way to round `Double` up to certain decimal points, there is `round()` ...
d

Danish Ansari

about 4 years ago
what is the most efficient way to round
Double
up to certain decimal points, there is
round()
function in Kotlin but it always completely rounds up to 0 decimals? I want something like
round(1.4999,decimalPrecision = 2) // 1.50
d
j
+2
  • 4
  • 29
  • 1175
Is there a way to simulate activity's `back pressed` state for compose-navigation? `popBackStack` do...
a

Adib Faramarzi

over 4 years ago
Is there a way to simulate activity's
back pressed
state for compose-navigation?
popBackStack
does not finish navigation (and instead just removes the destination) but pressing the back key always works perfectly. This becomes a problem when you have nested navigation as the inner navigation stacks can never pop themselves
a
n
+2
  • 4
  • 26
  • 1175
(I know it's more a Jackson than a Kotlin question, but I hope someone might have an answer anyway)....
n

nkiesel

over 3 years ago
(I know it's more a Jackson than a Kotlin question, but I hope someone might have an answer anyway). I have a line `val jackson: YAMLMapper = YAMLMapper.builder().addModule(KotlinModule()).build()`in my code to create a Jackson YAML mapper with Kotlin extensions. This tells me "Kotlin: 'constructor KotlinModule(Int = ..., Boolean = ..., Boolean = ..., Boolean = ..., SingletonSupport = ..., Boolean = ...)' is deprecated. Use KotlinModule.Builder instead of named constructor parameters". Does that really mean I should use `val jackson: YAMLMapper = YAMLMapper.builder().addModule(KotlinModule.Builder().build()).build()`instead? That's an awful amount of build...
n
e
m
  • 3
  • 7
  • 1172
Is there a way to disable webpack's auto reloading?? It really doesn't help while doing compose 4 We...
a

andylamax

almost 3 years ago
Is there a way to disable webpack's auto reloading?? It really doesn't help while doing compose 4 Web at all. I am trying to see if disabling it might give me more iteration speed
👀 1
a
a
  • 2
  • 4
  • 1171
Trying out Kotlin 2.0.0-RC1 and getting `Caused by: java.lang.ExceptionInInitializerError: Exception...
j

John O'Reilly

over 1 year ago
Trying out Kotlin 2.0.0-RC1 and getting
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.ArrayStoreException: org.jetbrains.kotlin.konan.target.KonanTarget$IOS_ARM32 [in thread "Daemon worker"]
error when syncing.....this is in KMP project so maybe known issue? Full stack in thread. Tried latest AS canary so far
youtrack 1
✅ 1
j
d
+5
  • 7
  • 43
  • 1168
I'm trying to map enum to int values: ```@Serializable enum class ItemType { @SerialName("0") Ze...
p

Philip Dukhov

over 3 years ago
I'm trying to map enum to int values:
@Serializable
enum class ItemType {
    @SerialName("0") Zero,
    @SerialName("1") First,
}
But it fails with the following exception:
JsonDecodingException: Unexpected JSON token at offset 194: Expected quotation mark '"', but had '1' instead
    JSON input: ....."type":1,.....
It doesn't seem to work because
SerialName
is expecting a string and json has an int. I can think of two ways to solve this: 1. Enabling lenient mode - I don't like this solution as it also removes restrictions from other fields, which I prefer to keep 2. Implementing a custom serializer - seems like too much of boilerplate code for such a simple task Am I missing something?
p
a
  • 2
  • 7
  • 1168
How to get screen width and height for Ios and Android in common module in compose Multiplatform? s...
s

Shoaib khalid

about 2 years ago
How to get screen width and height for Ios and Android in common module in compose Multiplatform? see more detail here: https://github.com/JetBrains/compose-multiplatform/discussions/3225
s
a
+2
  • 4
  • 3
  • 1167
Whats the preferred way to use native File chooser dialog on Compose desktop applications. `java.awt...
s

suresh

about 5 years ago
Whats the preferred way to use native File chooser dialog on Compose desktop applications.
java.awt.FileDialog
seems to be working fine. Is that the recommended way?
👀 5
s
i
m
  • 3
  • 6
  • 1159
is there a way to globally exclude a directory? we have some generated code checked in (yes… we know...
e

Eric

over 3 years ago
is there a way to globally exclude a directory? we have some generated code checked in (yes… we know). And want to exclude that directory from contributing to score and from being formatted automatically.
e
e
+2
  • 4
  • 6
  • 1158
I'm trying to configure a ktor application using the configuration file, as described here: <https:/...
s

Serafeim Papastefanos

almost 3 years ago
I'm trying to configure a ktor application using the configuration file, as described here: https://ktor.io/docs/configurations.html#configuration-file ... I've put a file on my
src/main/resources/application.conf
and works great. However, to deploy the app I create a fat jar. Is there a way to override some configuration options when I deploy that fat jar ? I know that I can use env vars but there are too many options that would need overriding. is it possible to pass another configuration file to the fatjar that would be used to override configuration options ? i.e run it like
java -jar ktor-fat.jar -c local.conf
; when trying to read a configuration value, it will first check
local.conf
, if not found then go to
resources/application.conf
inside the jar
s
a
l
  • 3
  • 7
  • 1157
Previous333435Next

kotlinlang

A modern programming language that makes developers happier.

Powered by