https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
server
  • f

    Fred Bowker

    01/27/2022, 3:42 PM
    is anyone using SQLDelight server side to connect to postgresql that has a working gradle file
    :thread-please: 2
    s
    h
    • 3
    • 33
  • r

    Rob Elliot

    01/28/2022, 10:25 AM
    Slightly unusual question - I've been using Kotlin on the server side for 3 years now, and I love it. I'm working for a smallish startup and I'd like to work in Kotlin, but while they also like Kotlin they are worried about it from two perspectives: • ability to hire, for the foreseeable future (so now and in 3 years) • long term prospects for the language - will it still be alive and well on the server side in 3 years time? Basically there's a "Java may not be as good but in 5 years' time it'll still have a massive recruiting pool and still be evolving" feeling. Does anyone have any good stats on the adoption of server side Kotlin that might help with this decision?
    👍 2
    e
    c
    +6
    • 9
    • 15
  • n

    Nayeem Zen

    01/28/2022, 4:03 PM
    Hey folks 👋 new to the community but currently kicking off development at a venture-backed startup and we’re exploring using Go vs Kotlin on the server-side. I have experience running kotlin with spring before but definitely want to move away from that into something more lightweight. Ktor has been awesome to play around with, but I feel there’s a couple of concerns I have would be great to get some opinions: • Kotlin is more feature-rich as a language but that means there’s higher developer onboarding time • Frameworks such as Ktor leverage DSLs and extension functions very heavily, and more often than not you’ll pull in java/kotlin dependencies that might not use those patterns but stick to more traditional OO design patterns. With this mix of paradigms, could it lead to higher onboarding times (as devs have to decide between multiple approaches within their own code) and style/pattern inconsistency? • The lack of functional, stable modern ORM in Kotlin - do most folks use exposed/ktorm or stick to Java ORMs? Looking for something lightweight, typesafe like https://entgo.io/ but can’t find much other than JOOQ which isn’t really great for dealing with object graphs
    d
    a
    +2
    • 5
    • 5
  • f

    Fred Bowker

    01/28/2022, 4:13 PM
    Hey Nayeem, I’m using spring for rest functionality and have just started using SQLDelight for the ORM seems really light weight, it won’t be as feature rich as something like Hibernate but then it’s definitely much simpler
    :thread-please: 2
    👀 2
    n
    • 2
    • 4
  • l

    Lucas Milotich

    02/02/2022, 8:20 PM
    Hello guys, maybe someone already went through this: I was looking for a rate limiter with a smooth warm up. I found a Guava Ratelimiter version which is what I want, but it seems to be blocking in some way. I uses a
    synchronized
    and a mutex inside therefore I think it won’t be the best solution in a coroutines world (with ktor). I implemented anyways and I’m not finding any blocking or decrease of response time, but I’m getting some errs without load with the reate limiter (under low stress I have false results in
    tryAcquire
    method). I also found resilience4j limiter but it doesn’t have a smooth warm up. Thanks!
    a
    n
    • 3
    • 2
  • r

    Robert Jaros

    02/07/2022, 7:41 PM
    I've just accidentally found this impressive project, I've never even heard about before - https://github.com/komapper/komapper. Definitely worth checking when someone is looking for a Kotlin ORM.
    👍🏻 1
    👍 10
    t
    • 2
    • 4
  • s

    seetha

    02/08/2022, 7:18 PM
    HI Team, Our codebase is in Kotlin and we are using OpenTracing library for distributed tracing. We have implemented our custom
    ThreadContextElement
    as described in the documentation. The problem is we are having memory leak [heap dump shows that opentracing lib objects being leaked] when we use different dispatchers in the flow. For example, in the beginning of the process Step 1 ->
    rxCompletable() // default dispatcher
    Step 2 -> Use another dispatcher for a network call
    withContext(<http://Dispatchers.IO|Dispatchers.IO> + CustomThreadContextElement())
    ^^ when we switch dispatcher like this we always get memory leak. As long as the entire flow is on one dispatcher we don't get memory leak. Any thoughts here? I am also seeing this CopyableThreadContextElement - should we be using this ? I am not clear on the example provided in the documentation especially the line
    return CopyForChildCoroutineElement(traceThreadLocal.get())
    Where is this
    CopyForChildCoroutineElement
    class is from?
    o
    • 2
    • 4
  • s

    sakis

    02/09/2022, 1:44 PM
    For anyone interested, I wrote a blogspot about our experience building a REST API using Kotlin + Micronaut + AWS Lambda + Graal VM: https://medium.com/@skaliakoudas/serverless-on-aws-lambda-with-micronaut-kotlin-7aac485f066e Kotlin worked wonders for us! 😄
    👍 3
    👏 7
    👏🏾 1
    c
    • 2
    • 1
  • g

    Gavin Ray

    02/18/2022, 11:38 PM
    I don't suppose there is any way to do Next.js-style SSR rendering with
    kotlinx.html
    that also embeds interactivity/scripts, right? Something like:
    router.get("/").handler { context ->
        val text = createHTML().html {
            div {
                onClickFunction = { event ->
                    window.alert("Kotlin!")
                }
            }
        }
        context.response().end(text)
    }
    🇳🇴 2
    c
    • 2
    • 2
  • m

    mplain

    02/19/2022, 12:02 PM
    hello! question about subroutines i have this code:
    object LoggingAsyncRunner {
    
        private val log: Logger = LoggerFactory.getLogger(this.javaClass)
    
        fun launch(job: () -> Unit) {
            CoroutineScope(Dispatchers.Default).launch {
                runHandlingErrors(job)
            }
        }
    
        private fun runHandlingErrors(job: () -> Unit) =
            try {
                job()
            } catch (e: IllegalArgumentException) {
                log.warn("Async job exception", e)
            } catch (e: Exception) {
                log.error("Async job exception", e)
            }
    }
    this cannot handle
    delay
    , so I change
    job: () -> Unit
    to
    job: suspend CoroutineScope.() -> Unit
    , and also add
    suspend
    to
    fun runHandlingErrors
    object LoggingAsyncRunner {
    
        private val log: Logger = LoggerFactory.getLogger(this.javaClass)
    
        fun launch(job: suspend CoroutineScope.() -> Unit) {
            CoroutineScope(Dispatchers.Default).launch {
                runHandlingErrors(job)
            }
        }
    
        private suspend fun runHandlingErrors(job: suspend CoroutineScope.() -> Unit) =
            try {
                job(~)
            } catch (e: IllegalArgumentException) {
                log.warn("Async job exception", e)
            } catch (e: Exception) {
                log.error("Async job exception", e)
            }
    }
    now I get an error in fun runHandlingErrors inside try block (marked with ~) saying:
    no value passed for parameter p1
    I then add CoroutineScope receiver to fun runHandlingErrors, and I get this warning:
    s
    • 2
    • 23
  • a

    Agustin Magne

    02/19/2022, 11:42 PM
    Sorry for the overflow of messages. It seems to be an issue with Android Studio. Running ./gradlew test I have no issues at all.
    • 1
    • 1
  • c

    carrot

    02/20/2022, 1:18 PM
    Hello 👋 I wrote an “end to end” technical post about building and shipping a fun little feature for my website, using Kotlin + Ktor on the backend. Hope you enjoy and find it interesting 🙂 https://www.carrot.blog/posts/2022/02/building-live-updating-list-patreon-sponsors/
    👍 1
    🔥 1
    a
    • 2
    • 1
  • h

    Henrik Johansson

    02/22/2022, 3:04 PM
    Is there an example how to apply OAuth authorization scopes such as READ or WRITE in KTor?
    a
    • 2
    • 1
  • y

    Yevhen Railian

    03/01/2022, 9:22 AM
    I already wrote to the android channel. I know that maybe you will ban me here, but i can not keep silence. I am an android dev more than 9 years and i am in Ukraine. I want people from all over the world including Russia know about the crimes the Russian government and the Russian army commit in the Ukraine. On this video you can see a huge city Harkiv these days. they are civilians in the center of the city. Russians, stop this war. in this war you are not heroes.

    https://youtu.be/fbhDjN0jy8s▾

    https://youtu.be/P_RDqI_hX8Y▾

    NO WAR!!!
    VID_20220301_093215_408.mp4
    🇺🇦 20
    • 1
    • 1
  • j

    janvladimirmostert

    03/01/2022, 10:11 PM
    on the JVM, is there any performance penalty for using UInt or UByte over Int and Byte?
    s
    e
    +2
    • 5
    • 13
  • a

    Alfy

    03/02/2022, 3:47 PM
    anyone know how to fix the following CVE kotlinx-serialization-core-jvm-1.3.2.jar: CVE-2020-29582, CVE-2019-10102, CVE-2019-10101, CVE-2019-10103?
    s
    r
    • 3
    • 15
  • a

    Arun

    03/03/2022, 7:27 AM
    Hi Folks, does anyone know the advantages of using coroutines over project reactor? Are they mutually exclusive or do they compliment each other or do they do the same thing in different ways? Also is there a facility/library solution in Kotlin similar to what BlockHound offers in Java or should we just stick to BlockHound to panic the blocking calls?
    c
    m
    • 3
    • 8
  • c

    carrot

    03/09/2022, 8:33 PM
    I wrote about building “structured logging” from scratch in a Kotlin-first web framework I’m working on, using
    kotlinx.serialization
    - hope you enjoy reading 🙂 https://www.carrot.blog/posts/2022/03/building-pellet-structured-logging/
    🆒 2
    p
    • 2
    • 2
  • t

    Toshihiro Nakamura

    03/11/2022, 1:59 AM
    Hi All! I am developing Komapper, Kotlin ORM library for JDBC and R2DBC. English documentation is available from the just released v0.30.0. Please try it out. https://github.com/komapper/komapper
    👍🏼 1
    :kotlin-intensifies: 13
    👍 9
    d
    g
    +2
    • 5
    • 26
  • a

    Abhi

    03/22/2022, 8:26 AM
    Just released Kreds 0.7, a pure Kotlin redis client which uses Coroutines at its heart, and Netty under the hood. This version supports Transactions. You can find documentation here https://crackthecodeabhi.github.io/kreds https://github.com/crackthecodeabhi/kreds
    👍🏽 1
    👍 5
    h
    • 2
    • 3
  • a

    andodeki

    03/24/2022, 9:59 PM
    fun main() {
        var newList1 = listOf(listOf(1, "a", "b"), listOf(1, "a", "b"), listOf(1, "a", "b"))
        var newList = listOf(1, "b", "C" to newList1)
        var defaultList = listOf(1, "a", 'B' to newList)
    
        var a = defaultList[2]
    
    	print(a::class.java.typeName)  //kotlin.Pair
    }
    I need to access "newList1" but i cant since "defaultList" is a Pair
    how can i access via index or how can i construct to get this behaviour
    n
    r
    m
    • 4
    • 10
  • p

    Paulien van Alst

    03/25/2022, 9:01 AM
    Hey guys, I have an odd question so to say. A colleague of mine is trying to run/compile Junit5 tests using JDK 16 on a linux system. The file system is encrypted, the Kotlin files do have the correct permissions. However, when the function names (using back ticks) are becoming too long, the compiler fails as the generated class file is becoming too long. Has anyone encountered this? Is there a compile flag to set this to avoid this problem?
    k
    e
    n
    • 4
    • 7
  • s

    Sam Stone

    03/25/2022, 10:50 PM
    I want to learn backend, and just learned about headers and codes and response/request. What is the easiest framework to get into backend dev?
    s
    r
    n
    • 4
    • 4
  • a

    alon shoshani.86

    04/07/2022, 3:12 PM
    Hi all, any suggestion how to run this kind of query in postgresql with expose?
    UPDATE events_affecting_transit 
    SET estimated_affect_end_time = estimated_affect_end_time + interval '5 hour'
    WHERE current_timestamp > estimated_affect_end_time
    t
    • 2
    • 4
  • s

    Sangmin Lee

    04/12/2022, 2:51 AM
    I’m wondering why Jvm Setter is not used in the code
    @RestController
    class TestController {
        @GetMapping("/test")
        fun test() {
            val data = TestData(bar = "first")
            data.bar = "second"
            data.setBar("third")
        }
    }
    
    data class TestData(
        @JvmField
        var bar: String
    ) {
        fun getBar() = bar
        fun setBar(value: String) {
            print("\nSetter is called! - value: $value\n")
            bar = value
        }
    }
    output:
    Setter is called! - value: third
    why
    data.bar = "second"
    doesn’t call setBar?
    r
    d
    • 3
    • 6
  • a

    alon shoshani.86

    04/12/2022, 8:37 AM
    Anyone?
    k
    j
    • 3
    • 9
  • a

    alon shoshani.86

    04/12/2022, 11:58 AM
    Hi all, Does Expose has an sql method that accept params a safe query string (with question marks as place holders for values) and varargs to populate the query string
    d
    • 2
    • 3
  • j

    Jens Stegemann

    04/21/2022, 9:44 AM
    Hi all, I wonder if kotless is still the way to go developing and deploying code for azure functions. There is not much traffic on the github-repo and the web-page is quite outdated. So I am unsure if this effort will be continued...
    :yes: 1
    b
    h
    • 3
    • 3
  • j

    James Black

    04/24/2022, 10:52 PM
    I want to make a simple database for my backend server but I don't need something the size of mongo. I basically just want to track if the weather for a city has recently been sent to a client and cache it for a short time. I don't expect high traffic initially, and I may just store the json data in files and look at the timestamp, but would prefer an embedded database, since I will just have one server. I don't want to use H2 as I want the data saved. Kodein-DB states it shouldn't be used on the server. What else would work well?
    i
    a
    +2
    • 5
    • 4
  • o

    Okan Yıldırım

    04/26/2022, 2:41 PM
    Hello friends, I was using Spring Boot for a while, then I saw there is Ktor and I really enjoy using it but sadly I did not find enough database support for that
    r
    a
    +2
    • 5
    • 17
Powered by Linen
Title
o

Okan Yıldırım

04/26/2022, 2:41 PM
Hello friends, I was using Spring Boot for a while, then I saw there is Ktor and I really enjoy using it but sadly I did not find enough database support for that
Is there anything you can recommend me like JPA?
I tried Exposed but it was like more work to do, always doing schemaToModel etc. or while creating doing it[Todos.title] = "" was a little bit exhausting, moreover, while doing it, I was able to skip any field and I do not get any warning
r

Robert Jaros

04/26/2022, 2:44 PM
https://www.komapper.org/
👍 1
https://www.ktorm.org/
☝️ 1
👍 1
o

Okan Yıldırım

04/26/2022, 2:46 PM
I never heard of these, let me check it, thank you!
a

asad.awadia

04/26/2022, 2:59 PM
Ktorm and jdbi would be my recommendations
o

Okan Yıldırım

04/26/2022, 3:03 PM
They does not look like as full as spring data jpa but they look good
Ktorm especially
j

Jacob

04/26/2022, 3:05 PM
ktorm hasn't been updated in a year. It looks like an abandoned project to me https://github.com/kotlin-orm/ktorm/branches/active
👍 1
o

Okan Yıldırım

04/26/2022, 3:08 PM
Yeah, it looks like so, maybe they focus on Exposed?
j

Jacob

04/26/2022, 3:16 PM
unlike ktor, ktorm is not a jetbrains project. exposed is a jetbrains project. I doubt the developers of ktorm have any connection to ktor and exposed
o

Okan Yıldırım

04/26/2022, 3:27 PM
ahh, I thought Ktorm is related with Ktor, thank you
r

Robert Jaros

04/26/2022, 3:36 PM
both Ktorm and Exposed are blocking frameworks, which imho makes non-blocking komapper (with r2dbc) a better fit for Ktor
o

Okan Yıldırım

04/26/2022, 6:16 PM
Thanks everybody for the suggestions
I will try each one by one and decide
Have a great day 🙂
h

hfhbd

04/26/2022, 6:33 PM
Or use sqldelight
View count: 5