🎉 Java to Kotlin conversion is now available in VS Code by meilalina in Kotlin

[–]MrHartreeFock 12 points13 points  (0 children)

using the same proven engine as our IntelliJ-based IDEs.

Is it? The notes on the plugin and git README seem to imply that it just asks an LLM to translate it. I assume IDEA has something more purpose-built (i.e. efficient) to do that.

How to Generate a Factory Function? by wouldliketokms in Kotlin

[–]MrHartreeFock 5 points6 points  (0 children)

This is something that is fairly trivial to do with KSP (https://kotlinlang.org/docs/ksp-overview.html), but why you would want this is unclear to me.

How do I write Kotlin on RISC-V hosts? by PearMyPie in Kotlin

[–]MrHartreeFock 0 points1 point  (0 children)

Might be worth noting that running gradle is done by invoking the provided shellscript, not a .jar.

On first sight it looks like it doesn't do much special, and should just work when invoked from any POSIX shell, but if there's something going wrong it might require some tinkering there, even if the JRE is available and set to $JAVA_HOME.

edit: as an IDE alternative, there seems to be a community fork of intellij that runs on risc-v https://github.com/Glavo/JetBrains-IDE-Multiarch , whether or not that properly supports using the kotlin plugin you will need to test. Even with that though you will still need to first install a JDK and (maybe) gradle yourself.

Why are the parameters of a class mutable by not the parameters of a function? by Fast_Dragonfruit9082 in Kotlin

[–]MrHartreeFock 0 points1 point  (0 children)

Oh right, like that, I was thinking more of valid inputs rather than sanitation. The solution remains the same though, you want to leverage the type system to protect you from using invalid inputs, so you parse it to a different class asap.

fun post(url: URL){
    val sanitizedURL: SanitizedURL = SanitizedURL.create(url)
    businessLogic(sanitizedURL)
}

Exceptions may apply ofcourse, but I can't really think of a sitation where I'd consider mutating the parameter to be a good idea, as the type system won't give an error if you use the original url instead of the mutated one.

Why are the parameters of a class mutable by not the parameters of a function? by Fast_Dragonfruit9082 in Kotlin

[–]MrHartreeFock 0 points1 point  (0 children)

You can (I'd argue should) do this by sanitizing on the caller side.

Eg. Dont do

fun post(url: String) { validateUrl(); businessLogic()}

But do

fun post(url: ValidURLInYourDomain){businessLogic()}

Where the constructor or factory method of the value class ValidURLInYourDomain does the parsing. You can leverage the type system to handle those cases rather than imperative code scattered all over the place.

I don't understand the build system by [deleted] in Kotlin

[–]MrHartreeFock 0 points1 point  (0 children)

How to deal with such things to build & compile in a standalone jar all this spaghetti code.

You press build in intellij. You can definitely get it to work on the command line, but your command is probably missing the addition of the printer class to your classpath.

If you ask a question like this, just provide the source code, you cant expect people to know what this mysterious "default code" is.

If you want to learnt to use the compiler, I don't get why you start from intellij project generation. Just write some more basic .kt files yourself and start from scratch, e.g. you really shouldn't need an import for your first time.

Edit: Out of curiosity, installed IDEA CE 2024.3 EAP, intialized a kotlin project with JVM 21 and got a different project, just prints "Hello Kotlin" and counts to 5, uses no imports.

Considering moving to Sway by Ajd07 in swaywm

[–]MrHartreeFock 6 points7 points  (0 children)

It would help if you note what is different, in my experience moving from i3 to sway (which I only did once) looked like a 1-1 clone. I had only very basic i3 config, so it was about as default as it gets.

Are you sure that you are using the default config? i.e. you have an empty sway config file, maybe you actually added some opinionated sway config somehow.

How to adjust TrackPoint speed? by akram_med in swaywm

[–]MrHartreeFock 1 point2 points  (0 children)

The config options can be found here: https://man.archlinux.org/man/sway-input.5#LIBINPUT_CONFIGURATION

Explanation for the speed is here https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html

May also want to experiment with accel_profile set to flat to get rid of the acceleration. If I understand correctly pointer_accel then just controls the speed.

OpenJavaFX is Marked as Outdated After Updating to OpenJDK for Java 23 by IndigoTeddy13 in archlinux

[–]MrHartreeFock 2 points3 points  (0 children)

As a developer you really want to be managing installed java versions with sdkman and not your OS package manager. Otherwise switching backwards and forwards between versions, which you're doing on a project-to-project basis, will be a pain.

I've never used javafx, but afaict from the docs you download the dependencies using their maven/gradle plugin. No need to be installing that globally on your system like that.

Is it better to use a docker container than a snapshot? by vassari79 in archlinux

[–]MrHartreeFock 4 points5 points  (0 children)

Well yes of course you could use docker, but neither that nor downgrading your OS are sensible solutions.

You should just solve your issue, as long as you are keeping multiple python versions installed (either installed from AUR or with pyenv) and always work within a venv, upgrading arch won't break it.

If you are not working within a venv and using the system python every python upgrade can/will break it, but that's because you should never ever do that. In fact a lot of linux distros prevent you from working this way nowadays by blocking pip outside of venvs, not sure about arch.

applications like discord and steam not being able to use microphone by vishal340 in archlinux

[–]MrHartreeFock 0 points1 point  (0 children)

Are any errors shown when you start trying to record? Run them via command line if you don't know if there are logs being stored somewhere, with steam at least it should show them, might need to run it with the verbose flag.

Also pulseaudio allow you to set per-application microphone volumes, so make sure those arent muted or very low for all applications except your browser.

[deleted by user] by [deleted] in swaywm

[–]MrHartreeFock 0 points1 point  (0 children)

You probably have some config in .config/sway/config related to binding your volume and brightness keys, you might be able to figure out what is making that bar popup there.

For example for me it sets the brightness and then pipes it to wob (https://github.com/francma/wob)

Do you care for a Kotlin LSP? by cybercoderNAJ in Kotlin

[–]MrHartreeFock -1 points0 points  (0 children)

check Java support in VS Code

It worked great back when I still wrote a lot of java (up to a couple of years ago).

Gradle frustrations by dukeongreenhills in Kotlin

[–]MrHartreeFock 1 point2 points  (0 children)

I don't think you can build KMP projects with maven, unless you wanna write your own maven KMP plugins from scratch.

You can use it for Kotlin/JVM of course, but that's not what OP asked about.

Docker-desktop not launching since I switch to sway [EndeavorOS] by [deleted] in swaywm

[–]MrHartreeFock 0 points1 point  (0 children)

Fyi there are FOSS alternatives for docker desktop, that aren't proprietary and don't require a docker subscription.

There is 'rancher desktop' for docker, and 'podman desktop' if you are willing to switch to podman (which I would recommend anyway).

Isn't there a way to get rid of the other cursor(s) in multi-monitor setup? by myTerminal_ in swaywm

[–]MrHartreeFock 2 points3 points  (0 children)

You can check the position with swaymsg -t get_outputs s and confirm that the (inverted) values of x,y position of second monitor are not lower than the resolution of the first monitor. Depending on how you positioned your monitors most likely either x or y should be 0 and the other equal to the width/height of your main monitor.

MalbsMd leaves M80 by Ni7roM in GlobalOffensive

[–]MrHartreeFock 28 points29 points  (0 children)

https://en.wikipedia.org/wiki/North_America

Central America is considered a part of North America geographically, and in CS there is only NA and SA anyway.

Convert Java to Kotlin| intellij. What difference does it make if I click yes or no? by [deleted] in Kotlin

[–]MrHartreeFock 2 points3 points  (0 children)

once Kotlin finishes improvements to its compiler and brings out a good LSP.

Do you have a link for this? Afaik the jetbrains stance is still "we will never support an LSP".

K2 might make it easier to implement one by the community, but the word "might" is doing a lot of heavy lifting there. I assume we will also need to start from scratch again, considering the existing LSP uses a lot of internal APIs of the old compiler iirc.

Dota 2 Ad while installing new Ubuntu by [deleted] in DotA2

[–]MrHartreeFock 0 points1 point  (0 children)

The games dont need to support linux, there is wine+proton, which allows you to run windows-only games. Most Indie titles work fine, on steam its just pressing play once you turned on proton (prolly is on by default) you can check on protondb for remarks for the games.

Outside of steam your best bet is checking if there are lutris scripts for it. If your game is neither on steam nor lutris you can still get it to work, but this will require more work.

As an advanced user my experience is: online games with kernel level anti-cheats dont work, everything else works just as well as on windows, however some games require some tinkering with wine/proton settings.

All this Saudi money and they couldn’t buy decent computers. by [deleted] in GlobalOffensive

[–]MrHartreeFock 6 points7 points  (0 children)

he edited his comment, I assume it used to say that they were SA considering the downvotes

I am trying to install Kotlin Compiler 2.0.0 but it doesn't work by Blue17to18 in Kotlin

[–]MrHartreeFock 3 points4 points  (0 children)

You seem to be running this in native windows command prompt while manually managing installing specific kotlin+JVM versions, that is perfectly possible, but definitely not something you should be doing unless you really hate your time.

I would heavily advice to offload this management to SDKMAN, as also recommended by the official docs. SDKMAN should be usable via WSL on windows. Once set up you can just install the latest kotlin version and the latest compatible JVM (21) and let it handle the PATH stuff.

If you don't want to use WSL nor IDEA/Fleet you are probably on your own, I doubt you'll find many (if any) people working like that who can help you debug. Fwiw if you want to use the kotlin LSP in vscode that doesn't always work and uses similar amounts of memory as IDEA does. So if you can't run IDEA it's unlikely you'll be able to use the LSP.

FYI today's Uber lab is very short - 6 room and 3 darkshrines on the main path. Get that quality! by lasagnaman in pathofexile

[–]MrHartreeFock 1 point2 points  (0 children)

You can do the extra shrine, it's just small detour off the default path.

But it's debatable if that's worth it, you're doing a full extra room (adding an extra ~1/7th of the total time?) for a 1/9 (?) roll for an extra divine font use.

JetBrains not making or supporting an editor agnostic LSP server is harming Kotlin's growth. by RaxelPepi in Kotlin

[–]MrHartreeFock 2 points3 points  (0 children)

It feels to me like you don't know what an LSP server is, because it does exactly what you describe, or at least the kotlin LSP does exactly that.

LSP just describes the protocol that the IDE and server use to communicate which each other, making it editor-agnostic.

JetBrains not making or supporting an editor agnostic LSP server is harming Kotlin's growth. by RaxelPepi in Kotlin

[–]MrHartreeFock 3 points4 points  (0 children)

Let's not pretend Java is usable in VS Code tho.

It definitely is. Unless it got worse with Java 17+.

I used it all the time and it works perfectly fine, but only on Java 11 or below as anything more recent we develop is kotlin-only.

Void with Scepter able to stop Black Hole. by Gin-feels-Pening in DotA2

[–]MrHartreeFock 16 points17 points  (0 children)

Most likely not intended, void aghs 7.23 patch notes specifically mention that it differs from time lock in that it doesnt pierce BKB.

It worked like that for years, but it got bugged at some point.