Need Help: Integrating Python with Kotlin Multiplatform

I’m currently working on a Kotlin Multiplatform project and I’m exploring ways to integrate Python code into it. I came across Chaquopy (https://chaquo.com/chaquopy/), which is an SDK that allows Python code to run on Android. However, my project needs support across multiple platforms, not just Android.

does anyone have Any recommendations for tools or libraries that support this?

submitted by /u/Vegetable-Practice85
[link] [comments]

Continue ReadingNeed Help: Integrating Python with Kotlin Multiplatform

[Livestream] ICPC World Finals: Kotlin Heroes Blind Coding Challenge

Join us for an exciting livestream event broadcast directly from the ICPC World Finals: Kotlin Heroes Blind Coding Challenge. This is going to be a very special event featuring world-level competitive programmers: Gennady “tourist” Korotkevich, Andrew “ecnerwala” He, Pavel “pashka” Mavrin, and Egor “Egor” Kulikov.

Save the date: April 16, 2024, at 10:00 am CET.

JetBrains is a proud sponsor of the 46th and 47th ICPC World Finals, set to take place in Luxor, Egypt. As part of this event, we’re excited to showcase the incredible capabilities of Kotlin in algorithmic problem-solving.

See the talent of top-tier competitive programmers as they tackle Kotlin challenges in a unique blind coding challenge format. They’ll showcase the art of problem-solving under pressure and the power of Kotlin in action in a format where one participant has only a keyboard, and the other has only a monitor. It’s an unparalleled test of skill and adaptability!

Participants

Gennady 'tourist' Korotkevich

Gennady ‘tourist’ Korotkevich

Renowned as the most decorated sports coder in the world, Gennady has dominated competitions like the Facebook Hacker Cup, Google Code Jam, and ICPC World Finals.

Andrew 'ecnerwala' He

Andrew ‘ecnerwala’ He

A distinguished competitive programmer with numerous accolades in competitions like the Facebook Hacker Cup, Google Code Jam, and more.

Pavel Mavrin

Pavel ‘pashka’ Mavrin

An ICPC World Champion, Pavel brings years of experience and academic expertise to the table.

Egor 'Egor' Kulikov

Egor ‘Egor’ Kulikov

A Google Code Jam and TopCoder Open champion, Egor is a force to be reckoned with in the world of competitive programming.

We have two consecutive presentations lined up, each featuring a thrilling blind programming challenge and insightful commentary from JetBrains Developer Advocate Garth Gilmour.

Watch the Livestream

Tune in to our YouTube channel to catch all the action live. To prepare for the event and brush up on Kotlin and competitive programming, explore our competitive programming tutorial and Competitive Programming YouTube playlist.

Don’t miss this opportunity to witness top programmers in action and discover the power of Kotlin in competitive coding. Mark your calendars and join us on April 16 for an unforgettable experience!

Mark our words, this livestream is a must-watch!

Continue Reading[Livestream] ICPC World Finals: Kotlin Heroes Blind Coding Challenge

Kotlin Coroutines and Loom

Loyal viewer David had a lot of questions in the comments to the last episode (https://youtu.be/ACk2HkvVKnA), where we learned to compose higher order functions to create http4k request handlers. He liked the idea, but was worried about the performance of calling business logic that used Kotlin coroutines from the non-suspend handlers.

This got me wondering whether project Loom and Java virtual threads make this a non-issue. So today I’ll start by looking at why operating system threads limit the throughput of our servers, and how virtual threads solve that problem. Once we have that working, then we can use more virtual threads to invoke suspend functions from plain-old functions like http4k handlers.

With project Loom I think we really can have the best of both worlds, and that I have the benchmarks to prove it.

In this episode

  • 00:00:55 Create an http4k server and make actual HTTP requests to it
  • 00:05:14 Now use an executor to make the requests
  • 00:07:42 Now submit 1000 simultaneousish requests
  • 00:08:25 Measure just the time to process the requests
  • 00:10:42 Shift the checking of the Responses out of the executor code
  • 00:12:43 Separate setup from the measurement
  • 00:15:00 Calling a slower function is much slower because we exhaust the server thread pool
  • 00:16:42 We can use Loom virtual threads to “not have” a thread pool
  • 00:19:30 The results are in
  • 00:20:15 Some connection reset errors?
  • 00:21:25 Rationalised code to record performance and errors
  • 00:23:08 More throughput results
  • 00:23:45 More on those connection resets
  • 00:27:36 Now what about calling suspend funs?
  • 00:32:59 Review

There is a playlist of http4k content https://www.youtube.com/playlist?list=PL1ssMPpyqocg5TKqmiGWlvi3O5L8XPe8Q

If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (http://java-to-kotlin.dev). It’s about far more than just the syntax differences between the languages – it shows how to upgrade your thinking to a more functional style.

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

Continue ReadingKotlin Coroutines and Loom

Free Review Copies of “Kotlin Design Patterns and Best Practices- Third Edition” against your unbiased review.

Hi everyone,
Packt is about to release the third edition of ” Kotlin Design Patterns and Best Practices ” by Alexey Soshin.

As part of our marketing activities, we are offering free digital copies of the book in return for unbiased feedback in the form of a reader review.

Key Features of the book

  • Start from basic Kotlin syntax and go all the way to advanced topics like Coroutines and structural concurrency
  • Learn how to select and implement the right design pattern for your next Kotlin project
  • Get to grips with concurrent and reactive microservices with Ktor and Vert.x

If you feel you might be interested in this opportunity please comment below on or before 15th April.

https://preview.redd.it/2548xow5jntc1.png?width=690&format=png&auto=webp&s=c618c6fdd3363160495d7335ba5aa1db04d0901d

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

Continue ReadingFree Review Copies of “Kotlin Design Patterns and Best Practices- Third Edition” against your unbiased review.

How can I build C++ code into .framework with cinterop?

I’m doing a Multiplatform project, and want build a .framework for iOS platform.

I have to use C++ code in the project.

My project structure:

src/commain/cpp/cinterop.def

src/iosMain/cpp/NativeIF.cpp

src/iosMain/cpp/NativeIF.h

src/iosMain/cpp/CppImplement.cpp

src/iosMain/cpp/CppImplement.h

…other cpp source code

The code in src/commain/cpp/cinterop.def:

headers = NativeIF.h package = my.package.name 

The code in src/iosMain/cpp/NativeIF.h

#ifdef __cplusplus extern "C" { #endif void NativeInterface_1(); void NativeInterface_2(); #ifdef __cplusplus } #endif 

The code in src/iosMain/cpp/NativeIF.cpp

#include "NativeIF.h" #ifdef __cplusplus extern "C" { #endif void NativeInterface_1() { // some code of calling CppImplement.cpp } void NativeInterface_2() { // some code of calling CppImplement.cpp } #ifdef __cplusplus } #endif 

In my build.gradle.kts, I config the ios platform

val xcf = XCFramework(sdkName)

listOf( iosX64(), iosArm64(), iosSimulatorArm64(), ).forEach { it.binaries.framework { baseName = "mylibname" binaryOption("bundleId", "$bundleIdCommon.ios") binaryOption("bundleShortVersionString", sdkVersion) xcf.add(this) isStatic = true } it.compilations.getByName("main") { cinterops { val infomatchingNativeLib by cinterops.creating { defFile(project.file("src/commonMain/cpp/cinterop.def")) compilerOpts("-I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/v1") compilerOpts("-Isrc/iosMain/cpp") compilerOpts("-Isrc/commonMain/cpp/") ...other cpp files path } } } } 

The current situation is, the .framework file can be build successfully, and I can find the klib file in path of build/classes/kotlin/iosXXX/main/cinterop.

But when I import this .framework into my xcode project, and build, there will be errors:

ld: Undefined symbols: _NativeInterface_1, referenced from: _my_package_name_NativeInterface_1_wrapper0 in mylibname[arm64][2](mylibname.framework.o) _NativeInterface_2, referenced from: _my_package_name_NativeInterface_2_wrapper0 in mylibname[arm64][2](mylibname.framework.o) clang: error: linker command failed with exit code 1 (use -v to see invocation) 

I tried to write the implement of interface in cinterop.def directly, and wrap C++ implement with C.

But this way leads another link error in Xcode building, the C wrapper function of C++ can not be found.

  1. I use the .framework in a Swift project.
  2. I tried to use nm command to find the “NativeInterface_1” and “NativeInterface_2” in the .framework file, the result is:

U _NativeInterface_1 U _NativeInterface_2 

What should I do to resove this problem?

Andbody can give me some advices?

Thanks very much.

submitted by /u/Silver-End6488
[link] [comments]

Continue ReadingHow can I build C++ code into .framework with cinterop?

Choosing Between Kotlin and JavaScript/TypeScript for Backend Development. Career Paths, Project Suitability, and Long-term Sustainability: Seeking Advice and Experiences

Hello everyone,

I’m at a crossroads in terms of advancing my backend development skills and am torn between deepening my expertise in Kotlin or shifting towards JavaScript/TypeScript. With a strong background in Java and Spring, and a basic understanding of JavaScript, I’m trying to figure out which path might offer the best opportunities for future projects and career growth.

Here are some specific areas where I could really use your advice:

  1. Career Opportunities: In my region, there seems to be a higher demand for Node.js roles, but roughly 80-90% of these are for full-stack positions. I’m hesitant to dive into front-end development as I feel there are many aspects of backend development I have yet to master. Between Kotlin and JavaScript/TypeScript, which do you think would open more doors career-wise?
  2. Project Suitability: For those who have experience with both Kotlin and JavaScript/TypeScript, how do you choose between them for your projects? What are the deciding factors that influence your choice of language and technology stack?
  3. Long-term Benefits: From a sustainability standpoint, which language do you believe is more viable for backend development in the long run? Is there a distinct advantage in focusing on one over the other?
  4. Language Investment: Sticking with Kotlin allows me to remain within the JVM ecosystem and leverage its robust libraries and frameworks. Conversely, I’m contemplating learning TypeScript as a segue to potentially ease into front-end frameworks in the future. However, I’m not entirely convinced I want to head in that direction. Any insights or advice would be incredibly helpful.

I appreciate any thoughts or experiences you can share, as they will significantly aid me in making a more informed decision.

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

Continue ReadingChoosing Between Kotlin and JavaScript/TypeScript for Backend Development. Career Paths, Project Suitability, and Long-term Sustainability: Seeking Advice and Experiences

End of content

No more pages to load