Join Kotlin Heroes: Episode 8! Practice Round to Be Streamed by tourist

Kotlin Heroes is our Kotlin-only quarterly coding contest hosted by the Codeforces competitive programming platform. This contest is a great way to play around with the powerful Kotlin features and practice the language by solving fun tasks. It is great for programmers of any level and there is a chance for anyone to win one of our cool prizes: exclusive Kotlin Heroes t-shirts, stickers, and even money.

Stream by tourist

This round is a very special one. The Kotlin Heroes: Episode 8 practice round will take place during the world’s “programming Olympics” – the ICPC World Finals. The most exciting part is that Gennady Korotkevich, aka tourist, the most awarded competitive programmer in the world and a repeat winner of Kotlin Heroes, will solve the practice round tasks during the event opening on October 2, 2021.

And we are thrilled to be livestreaming it to you!


Here’s the suggested timeline for you to join in with Kotlin Heroes: Episode 8:

Contest rules

  • The contest features a set of up to 10 problems that range from simple ones, designed to be solvable by anyone, to hard ones, to make it more interesting.
  • You are only allowed to use Kotlin to solve these problems.
  • You have 2 hours and 30 minutes to complete the tasks. 
  • You move up the leaderboard by finding the most efficient solutions to the problems in the shortest time possible.


  • The top three winners will receive prizes of $512, $256, and $128, respectively. 
  • The top 50 contestants will win an exclusive Kotlin Heroes T-shirt and Kotlin stickers. 
  • Every competitor who solves at least one problem is entered into a drawing for one of the 50 exclusive Kotlin Heroes T-shirts.

The tasks of this episode were designed to suit programmers of all levels, so everyone has a chance to win prizes. Even if you’ve never competed before, Kotlin Heroes: Episode 8 is a great chance to hone your Kotlin skills and discover the joys of competitive programming!

Good luck!

Continue ReadingJoin Kotlin Heroes: Episode 8! Practice Round to Be Streamed by tourist

I need to share, my first stack overflow in Kotlin and I’m happy :D

Hi, I have 14 years of my career as professional developer behind me. This was in C # and Microsoft dotnet and dotnet core. Now I’m starting with Kotlin via JetBrains academy. Just now I have my first stack overflow error. That’s good, because I’m feeling like back on horse if you get what I mean.

submitted by /u/brut4r
[link] [comments]

Continue ReadingI need to share, my first stack overflow in Kotlin and I’m happy :D

Kotlin articles & Kotlin Coroutines workshop from Kt. Academy

Kt. Academy here 👋

This time we have prepared 4 articles for Kotlin-lovers!

*️⃣ We’d love to hear your thoughts and suggestions for this newsletter. Please share them with us by replying to this email 📩

Here is a brief summary of today’s content 👇

👉 Job and children awaiting in Kotlin coroutines
👉 Cancellation in Kotlin Coroutines
👉 Effective Kotlin Item 51: Prefer Sequence for big collections with more than one processing step
👉 Effective Kotlin Item 52: Consider associating elements to a map

Kotlin Coroutines open workshop happening soon 🥳

Enjoy! ⏬

What is Job and how it is the most important context responsible for structured concurrency?

Job and children awaiting in Kotlin Coroutines by Marcin Moskala 👇

Kotlin articles & Kotlin Coroutines workshop from Kt. Academy was originally published in Kt. Academy on Medium, where people are continuing the conversation by highlighting and responding to this story.

Continue ReadingKotlin articles & Kotlin Coroutines workshop from Kt. Academy

How to debug generated API in kotlin – responseBody supports only JSON body error

So my issue is that I am trying to send a text snippet to my app and I used the OpenApi generated library, here is the function where it goes awry:

protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? { if(body == null) { return null } println("INSIDE responseBODY $body") val bodyContent = body.string() println("bodyContent $bodyContent") if (bodyContent.isEmpty()) { return null } println("mediaType $mediaType") val jsonBodyContent = JSONObject(bodyContent) println("JSON BodyConent $jsonBodyContent") return when(mediaType) { JsonMediaType -> { println("Serializer ") println(Serializer.moshi.adapter( Serializer.moshi.adapter( } else -> throw UnsupportedOperationException("responseBody currently only supports JSON body.") } }

The console logs:

bodyContent {"os":"7c8092ef-74cd-4fda-b24e-804d975788a3","application":{"id":"4f789733-eef7-465b-a5d3-680329fb5f80","name":"JETBRAINS","version":"1.0.0","platform":"MACOS","onboarded":false}} mediaType text/plain JSON BodyConent {"os":"7c8092ef-74cd-4fda-b24e-804d975788a3","application":{"onboarded":false,"name":"JETBRAINS","id":"4f789733-eef7-465b-a5d3-680329fb5f80","version":"1.0.0","platform":"MACOS"}} 2021-09-27 15:09:55,971 [ 108564] ERROR - llij.ide.plugins.PluginManager - responseBody currently only supports JSON body.

I am not sure how to transform the bodyContent ( and if I should?) into json since it does look like a json, but the mediaType is text/plain. Any tips? Thank you.

submitted by /u/SopotSPA
[link] [comments]

Continue ReadingHow to debug generated API in kotlin – responseBody supports only JSON body error

I wrote an API in Kotlin + Flow to make Android Contacts straightforward to use (no ContentProviders)

I am the author of ContactStore for Android.

Historically, using the Contacts API has been a pain. Developers need to use ContentProviders which can be tedious to work with. The lack of a type-safe API leads to repeated errors, developer frustration, along with a waste of time and resources for the developer and the team.

As a result, ContactStore was born. Contact Store is a modern contacts Android API written in Kotlin. It utilises Coroutine’s Flow to notify the developer for updates happening to the Contacts database.

Source code on Github

Your feedback is greatly appreciated 🙏 Follow me on Twitter for further updates

submitted by /u/alexstyl
[link] [comments]

Continue ReadingI wrote an API in Kotlin + Flow to make Android Contacts straightforward to use (no ContentProviders)

Stupid Question: Public vs Private vs Unmarked variables/properties?

I’ve got a viewData object I put together (not a class, because I only need one) and has properties set by some methods in my interaction handler, and the properties get used by a bunch of different drawing methods for my UI. However, as I set it up, I was finding that I couldn’t access the properties as expected. They’d turn red and return ‘unresolved reference’ errors.

After some trial and error, I put ‘private’ in front of my viewData declaration:

private var viewData = object {

and suddenly everything worked as expected. I know that




have something to do with how stuff is stored in memory, but it seems counterintuitive to me that the


declaration made properties accessible from elsewhere while


didn’t. Also have no idea how those two differ from just declaring with



I should add that I’m just using the object to contain the variables because it seems like it will help with organization. There’s clearly some ‘programming best practices’ on how to put stuff together, but unfortunately I have neither the time nor attention span for a ground-up education on it. I only seem to learn and absorb by building and breaking stuff then ducking back to foundational references as needed. Unfortunately this type of stuff seems like it’s so foundational that it’s either not documented, or glossed over because I should have learned it in a 101 class.

submitted by /u/dealingwitholddata
[link] [comments]

Continue ReadingStupid Question: Public vs Private vs Unmarked variables/properties?

End of content

No more pages to load