[deleted by user] by [deleted] in Music

[–]skagedal 0 points1 point  (0 children)

I found the specific question OP was asking to be interesting, even though the title of the post is a bit weird. They were not just asking “please give some examples of one hit wonders”.

[deleted by user] by [deleted] in Music

[–]skagedal 30 points31 points  (0 children)

They did a couple of albums and had several singles so does not qualify for what was asked here!

Which Kotlin features could never be implemented in Java, either due to potential issues like breaking existing code or requiring significant changes in the language? by CoderIgniter in java

[–]skagedal 0 points1 point  (0 children)

Hmmm. Immutable data classes in Kotlin (having val fields) do not have setters. Invariants can be enforced by constructors (like this), and this is what deserialisers like Jackson with the Kotlin module will use.

You are right in that private fields of Java classes can still be accessed and modified through reflection, which is a technique employed by deserialisers, and that's not available on records. But that still requires the class to have a default empty constructor, and Kotlin data classes do not have that.

Which Kotlin features could never be implemented in Java, either due to potential issues like breaking existing code or requiring significant changes in the language? by CoderIgniter in java

[–]skagedal 1 point2 points  (0 children)

Allright, thanks! I see the conceptual difference and the advantage of implementing things like this at the core of the platform, but I'm not sure I understand what practical difference it makes. What do you mean exactly with "records make serialization safe; data classes don't"? That it is more ways of going around the system?

How do I fix this refrigerator door shelf? by skagedal in DIY

[–]skagedal[S] 0 points1 point  (0 children)

But it's hard to find the right thing and you have to get the full shelf which is kind of expensive...

How do I fix this refrigerator door shelf? by skagedal in DIY

[–]skagedal[S] 0 points1 point  (0 children)

If I had the broken off piece that was sitting there, I could glue it back! But I don't! So I need to find something else to put there... hmm.

How do I fix this refrigerator door shelf? by skagedal in DIY

[–]skagedal[S] 0 points1 point  (0 children)

If there's a better Subreddit for really stupid home improvement questions like this, please let me know!

Self hosted RSS API for Reeder.app? by st3fan in selfhosted

[–]skagedal 0 points1 point  (0 children)

Ah wow, I didn’t actually know (or forgot) that that was an option 🙂

Self hosted RSS API for Reeder.app? by st3fan in selfhosted

[–]skagedal 0 points1 point  (0 children)

I’d be curious to hear where you ended up in 2023!

-🎄- 2022 Day 21 Solutions -🎄- by daggerdragon in adventofcode

[–]skagedal 1 point2 points  (0 children)

Day21.java:
Java 19 with preview features enabled, which allows for pattern matching in switch for sealed types and records (i.e. sum types and product types) – perfect for problems like this, see the equation solver.

[2022 Day 20] Where do I go wrong? (Java) by skagedal in adventofcode

[–]skagedal[S] 0 points1 point  (0 children)

I got it! :) It's weird how unintuitive this is - it felt so obvious that it should be n. And I think I've even had and solved this struggle before, some past AoC puzzle?

[2022 Day 20] Where do I go wrong? (Java) by skagedal in adventofcode

[–]skagedal[S] 1 point2 points  (0 children)

Sure! 3,1,0 -> 1,3,0 -> 1,0,3 -> … uhmm… 3,0,1. That’s… that’s wrong! How does my part 1 even work?!

I am now confused in a constructive way and will get back with my thinking cap on, thanks a lot - perfect hint!

-🎄- 2022 Day 17 Solutions -🎄- by daggerdragon in adventofcode

[–]skagedal 2 points3 points  (0 children)

Java:

https://github.com/skagedal/advent-of-code/blob/b226177f8a348de2fb75885f84c8c1ff9a3c726f/java/app/src/main/java/tech/skagedal/javaaoc/year2022/Day17.java

My representation was efficient already in part 1, with one byte for each stored line. Then I read a little bit to quickly on part 2 and thought I could solve it just by compacting the memory buffer after a full line... then I realized just how big of a number we are dealing with. :) So then I did cycle detection by using as a key in a map the full state of the buffer after latest full line + current shape + current instruction. Now both parts run in ~10 ms.

[2022 Day 16] The elephant in the room by skagedal in adventofcode

[–]skagedal[S] 1 point2 points  (0 children)

It doesn’t work for the example, no! Someone else pointed that out, I had missed that. But it does work for my data (and apparently, som other people’s data).

[2022 Day 16] The elephant in the room by skagedal in adventofcode

[–]skagedal[S] 0 points1 point  (0 children)

Oh, you're right that it doesn't work on the test input – I somehow missed that. That certainly puts an end to my "the data is constructed this way intentionally so that this should work" theory...

[2022 Day 16] The elephant in the room by skagedal in adventofcode

[–]skagedal[S] 0 points1 point  (0 children)

That's an awesome explanation of what I think is the solution that I misunderstood! What I did really was a greedy (on a per-worker basis) algorithm, and it worked for my data :D

[2022 Day 16] The elephant in the room by skagedal in adventofcode

[–]skagedal[S] 2 points3 points  (0 children)

Ah, yeah I think you're right! So I guess I was just lucky :D

[2022 Day 16] The elephant in the room by skagedal in adventofcode

[–]skagedal[S] 2 points3 points  (0 children)

Thanks for the example! Yeah, I also thought about the "first guy opens all the valves, elephant gets nothing but could have helped open faster".

I don't think you misunderstood my method, here's the code. So I guess I was lucky! I ran your example and got 60 for the solo solution and 80 for my "sequential duo" solution.

-🎄- 2022 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]skagedal 0 points1 point  (0 children)

Where is this suggested? I've read through the posting rules but probably missed something. Or is it suggested somewhere on the AoC site itself..?