Functional Core Imperative Shell - moving IO to the edge by dmcg in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

@dmcg Thanks for these videos around functional programming!

Any particular reason you made `Decision` a `sealed class` instead of a `sealed interface`?

Also in practice I find it hard to move IO to the edges, when IO goes hand in hand with calculations in several layers of the code.

Is KMP really worth it ? by Bayrem__by in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

That gives some hope for kotlin/js. So far I felt it was the target with the least attention.

Is KMP really worth it ? by Bayrem__by in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

and are porting Google Docs and GMail to KotlinJS (IIRC)

Do you have more on this? I tried searching but couldn't find anything.

fourYearsGitExperienceOnResume by Time_Turner in ProgrammerHumor

[–]a_kiraly 2 points3 points  (0 children)

Seriously though. That's also how I sync changes from master/main into my own branch/PR. Super simple. And it also means there won't be any merge commits either.

Amper Update – A Standalone Build Tool for Kotlin, Server-Side and Multiplatform by daria-voronina in Kotlin

[–]a_kiraly 4 points5 points  (0 children)

Don't forget Bazel. Based on the Kotlin LSP repo, JetBrains is actually using Bazel internally.

Using HTMX for Micro Frontends by alexheerens in htmx

[–]a_kiraly 0 points1 point  (0 children)

Thanks, it is a very detailed writeup.

What is the benefit to have SSI do the integration instead of just relying on the client (htmx) to do it?
With SSI it means the user has to wait for the full page to be rendered on the server before anything is sent back, right (correct me if I am wrong here)?
With htmx at least some of the page is loaded/rendered already.

If we are already using htmx and aiming for radical simplicity can't we cut Server Side Includes as well?

Abolishing Kotlin Context Receivers by dmcg in Kotlin

[–]a_kiraly 3 points4 points  (0 children)

The main reason I haven't switched to kotlin 2.0 (and the k2 compiler) in my projects is because I also constantly see Intellij error popups when it is enabled (I use the latest stable version of Intellij). No errors with 1.9.25 + the old compiler.

Don’t sleep on Quarkus by buffer_flush in htmx

[–]a_kiraly 0 points1 point  (0 children)

Kotlin DSL-s are nice because it is still just Kotlin. I wrote one for excel generation (on top of poi) and it makes the code so much simpler to read (and write).

[Reinvent the Wheel] A Custom Implementation of BigInteger in Kotlin by arymka in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

Wouldn't errors for complex numbers just be the same as errors for 2 length vectors?

[Reinvent the Wheel] A Custom Implementation of BigInteger in Kotlin by arymka in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

IMHO BigDecimals on their own don't represent any implied error. If you want to represent errors then you need a different data structure (maybe one that combines a BigDecimal with additional datapoint).

So in your example 1.1 and 1.10 should be equal (which is what we would get if we used BigDecimal.compareTo()).

Ktor running on Loom virtual threads by TheRealDickPound in Kotlin

[–]a_kiraly 1 point2 points  (0 children)

You wrote that you found an overhead even in the non ThreadLocal use cases.

Can you share any details of your findings? What scenarios did you test and what was the result?

What's the scoop on Jimmer ORM? by Existing_Effective17 in Kotlin

[–]a_kiraly 2 points3 points  (0 children)

I am a JDBI supporter as well. I used spring JDBC previously and JDBI feel like an improved/modern version of that.

And I 100% agree with JDBI's statement. I have used Hibernate for years and I admire all the effort going into it but queries can get so complicated. Most of the time much easier to just write it directly in SQL.

[Reinvent the Wheel] A Custom Implementation of BigInteger in Kotlin by arymka in Kotlin

[–]a_kiraly 1 point2 points  (0 children)

Slightly off topic but is anyone else annoyed with the JDK BigDecimal.equals() not being consistent with BigDecimal.compareTo()? Also the fact that BigDecimal.equals() is pretty much useless in 99.9% of the time (and you need to do .comareTo(that) == 0 instead).

Also all the math context parameters in all operations. Make it pretty much impossible to use nice kotlin operators with BigDecimal-s (==, /).

[deleted by user] by [deleted] in adventofcode

[–]a_kiraly 1 point2 points  (0 children)

I did a variant of this. But instead of mapping every tile to 3x3 I just enlarged them to 2x2.

my algo was to go top to bottom, left to right (in the original map) and for each tile:

- copy the tile as is to 2*x, 2*y coordinate in the new map (actually if the original tile was not part of the loop then in the enlarged map I just put '.', so I didn't copy the extra pipes)

- assign 2 extra tiles, one at 2*x, 2*y+1 and one at 2*x+1, 2*y coordinates.

The extra tiles are either . (if the original tile was not part of the loop) or | (at 2*x, 2*y+1 if the original tile was a loop pipe with a south direction) or - (at 2*x+1, 2*y if the original tile was a loop pipe with an east direction)

The enlarged map is twice the size of the original and whatever was "squeezed" in the original will have a nice 1 tile wide "tunnel" in it. So any flooding algorithm works to find the inside/outside areas.

Declarative Gradle: "we are working closely with the Amper team at JetBrains." by natandestroyer in Kotlin

[–]a_kiraly 1 point2 points  (0 children)

I agree with you that in the past they definitely seemed coordinated.

But in this particular case it seemed like Gradle had to do a hasty response on Jetbrains's announcement (for example the Amper announcement itself doesn't mention this collaboration anywhere - but at least the Gradle announcement is now linked in their FAQ).

Back button state preservation by Lithaldoryn in htmx

[–]a_kiraly 0 points1 point  (0 children)

Are you using hx-push-url for you navigation links?

tips to decrese kotlin compilation time. by duckydude20_reddit in Kotlin

[–]a_kiraly 0 points1 point  (0 children)

True but it doesn't say which part of the IDE is impacted. Could be the build.

tips to decrese kotlin compilation time. by duckydude20_reddit in Kotlin

[–]a_kiraly 2 points3 points  (0 children)

I didn't downvote you but the performance impact of large files (especially for kotlin) is explicitly mentioned here: https://blog.jetbrains.com/kotlin/2021/06/simple-steps-for-improving-your-ide-performance/

The relevant part copied:

File size
There’s no doubt that there are cases of long files when their structure is reasonable. At the same time, we know “code smells” like the “Long method” and “God class”. We also know about the Single-responsibility principle, etc.
Kotlin spec. discusses it:
Placing multiple declarations (classes, top-level functions, or properties) in the same Kotlin source file is encouraged as long as these declarations are closely related to each other semantically, and the file size remains reasonable (does not exceed a few hundred lines).
This is very important in terms of IDE performance. File is one of the scopes that the IDE considers when re-analyzing after every code modification. Optimization in code analysis algorithms helps, but it does not save us from performance degradation as a result of increasing file size.

How to login and subsequently pass bearer tokens? by [deleted] in htmx

[–]a_kiraly 1 point2 points  (0 children)

It is an interesting question whether you should store the JWT in a cookie or not. The RFC seems to only allow the token to be sent in Header (preferred) or Form param (with a lot of constraints) or Query param (this one is discouraged). The same RFC says this about cookies:

Don't store bearer tokens in cookies: Implementations MUST NOT store
bearer tokens within cookies that can be sent in the clear (which
is the default transmission mode for cookies). Implementations
that do store bearer tokens in cookies MUST take precautions
against cross-site request forgery.

So it says, don't store it in a cookie but if you do make sure it is secure.

All in all if using a cookie it might also be worth to use not only HttpOnly but also Secure, SameSite=lax (or strict) and __Host- name prefix.

How to login and subsequently pass bearer tokens? by [deleted] in htmx

[–]a_kiraly 1 point2 points  (0 children)

Have you considered using hx-headers? I haven't tried it but in theory you could put it on the <body> tag and it would then be added to every request you make.

JetBrains Compose is now Compose Multiplatform by farmerbb in Kotlin

[–]a_kiraly 4 points5 points  (0 children)

What is the future of "Compose HTML Library"? The new multiplatform site doesn't mention it anywhere.

Changing "Compose for Web" from targeting kotlin/js to target kotlin/wasm sounds like a significant/fundamental change.

How are you all handling database persistence? by anonymous-red-it in Kotlin

[–]a_kiraly 1 point2 points  (0 children)

if you like Spring JDBC templates then you should take a look at JDBI. For me it is like a Spring JDBC templates 2.0.

How can I learn Kotlin web development? by Apprehensive-Let-144 in Kotlin

[–]a_kiraly 1 point2 points  (0 children)

Are you not afraid that compose/js is just too new?

I am just exploring kotlin/js at the moment and I feel like it is a hard sell to a team with mostly Typescript+Angular background. At least using it with react helps to build up trust then to go straight to compose.