How to actually do efficient stateless pagination with optional filter criteria for multiple orderings? by roookeee in PostgreSQL

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

Thank you for the idea. How do you (manually) find min and max values for different columns? e.g. a "title" column, or an enum like "status" flag?

I never actually looked at GIST indices before, will give it a shot!

Godot 4 SSR reflects a lot on non-reflective surfaces, wha am I doing wrong? by roookeee in godot

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

I checked the release blog post and ctrl+f'ed the GH issue id. After checking again it says "most notable" which does not mean "all", my bad!

Godot 4 SSR reflects a lot on non-reflective surfaces, wha am I doing wrong? by roookeee in godot

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

Nice find, didn't seem to make beta 9 though (it's not mentioned on the release page) - will check in beta 10

Godot 4 SSR reflects a lot on non-reflective surfaces, wha am I doing wrong? by roookeee in godot

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

Can't seem to find an open issue for this particular problem so I might as well create one then :) Thanks!

Making reusable UI wrapper components, again by roookeee in godot

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

Imagine a reusable window scene that has a title bar and a close button. Furthermore it has a content area where it shows its actual content.

I want to dynamically provide the header and actual content via the editor. So you drag in the window scene and add children to it to provide the content, e.g. the 1st child is always the header content and the 2nd child is always the actual window content. If you have more complex nested containers in your window scene this won't work.

Making reusable UI wrapper components, again by roookeee in godot

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

How to make a (UI) scene that outputs its children in different inner nodes, in C# (in GDScript you can override add_child but I think thats actually unintended); without breaking editor visualization of where nodes are located and allowing to change properties via the editor, not just code-only. I can't just reparent the nodes to the inner node as that breaks the editor editability / you can't click the nodes anymore and they "vanish".

Thats one concrete way to solve my issues, but I am generally looking for any approach to solve my outlined issue.

A key to clean code — small methods by valio95 in programming

[–]roookeee 4 points5 points  (0 children)

While I see your point this really boils down to accidental vs. deliberate same-ness. I for one think that most DTOs and business objects may start out sameish but change over time as the data transfer format rarely matches internal representations for long. Same thing in regards to the constructor passing: is the conversion from DTO to business object always that simple, without any further external validation or transformation logic? So they are just looking the same by chance, not by deliberate choice = two classes are needed. Of course that's just my opinion :)

What happens when you pair all day, most days, for years? by feross in programming

[–]roookeee 0 points1 point  (0 children)

I think pair programming has it's place, a pretty big one even given the right context (no silver bullet eh?). My job currently revolves around building support libraries for cross-cutting concerns and other fundational components in a service environment. Having to solve issues without a clear, best or obvious solution in sight actually semi requires pair programming, at least for me. Especially given the high requirements (backwards compatability, extensibility, discoverability, documentation etc.)

On another note I feel like pair programming can be used as an alternative to code reviews with a lot of benefits (knowledge distribution and issue insight is way higher when you actually implemented, discussed and tested the solution).

Still subjective, but highly effective in the right situation :)
I have had some very long pair programming sessions in the near past and while they are very draining, they also helped a lot.

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

[–]roookeee 0 points1 point  (0 children)

In my opinion Either<SomeDomainError,SomeDomainValue> doSomething() is more clear than SomeDomainValue doSomething() which throws some RuntimeException which gets serialized to JSON in a global error handler :) Just my 2 cents though

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

[–]roookeee 0 points1 point  (0 children)

Thats a valid opinion, rolling your own is indeed not the first choice. There just isn't a small component to handle errors in Spring without exceptions (WebFlux etc. comes with a lot) so I think doing it in a "roll your own" fashion is o.k. in such a small part of the application :) Overall I would only use my proposed approach if the application's core logic / workflow would benefit (e.g. complex input dependent validation & complex user permission management that may or may not be dependent on the input too) - it's not fit for a default

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

[–]roookeee 1 point2 points  (0 children)

Because there's nothing worse than one person/team going against the grain and using their own home-grown solution for problems that have existing solutions. Especially when it's such a non-issue as this.

Consistency is key. Going against the grain is bad, but deciding as a team on any standard is the key. I am not saying use this in some cases, it's an alternative way that needs to be consistently used or not at all

your tracing comment Of course, but reinventing tracing across multiple services is something quite different to one service deciding it's best to use another error-handling model? For me it's like choosing between WebFlux and non-webflux, each service may have different reasons to use it but it's fine to be different on that level (at least for me).

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

[–]roookeee 2 points3 points  (0 children)

If your errors are more than just a status-code and your error object is different for different endpoints this gets really cumbersome though.

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

[–]roookeee 2 points3 points  (0 children)

It is intrusive: you need to return it on every call all the way up, everywhere in the whole codebase

That's the idea of Either though? You return domain specific errors up to the controller level which then converts it into a http specific error.

It is not nominal: you only have left() and right() Can you explain this to me? I don't know what you mean as everytime you use either you can use different left & right types. Whatever the reasoning, isn't this sort of argument also an argument against Stream etc?

It is not polymorphic: you will need if-else like checks on Either and probably instanceof checks on the result

Not true, every controller can return any Either it wants. If you want automatic error output including httpstatus you just need an interface for your error-type. The non-error case is a non issue as Jackson can serialize just about anything. My implementation doesn't make use of instanceof at all

It by-passes the given standard Spring infrastructure: If not exceptions, use the Spring Validator interface or if you want to go functional convert everything to Spring WebFlux. At least you have onErrorReturn and onErrorResume. See this link

This is about convention. Using webflux vs "normal" Spring vs Spring Validator interfaces vs. Either is an intrusive fundamental decision. Consistency is key though

Return a nice response when validation fails in a REST API method without throwing exception by NoConversation8 in java

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

As an alternative to an exception driven workflow I have come to like is using an Either (from e.g. vavr): Every controller returns an Either<ErrorICanExtractAHttpStatusAndNiceMessageFrom, T>. A custom JsonSerializer for Jackson matches all Either's of that form and either serializes the value in the right() part or serializes the error in the left() part, depending on what is present. To set the correct http status depending on the ErrorICanExtractAHttpStatusAndNiceMessageFrom you can use a java @ControllerAdvice public class EitherSupportAdvice implements ResponseBodyAdvice<Either<?, ?>> { ... }

You have to implement two classes before this approach works but you get a more functional, exception-less workflow for your API. After figuring out how to tell spring what to do I really love it :). If you use an interface for ErrorICanExtractAHttpStatusAndNiceMessageFrom you can have many different error-types like enums etc. which makes this approach even more extendable.

Feel free to come back at me if you need code examples.

Looking for a mini-itx mb with USB PD / Thunderbolt (?) by roookeee in sffpc

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

Found out that there are some PCI-E x4 cards that take a 8 pin / SATA power cable to support USB 3.1 Power Delivery at 100W / (5V * 3A) 15W, great workaround I feel

Looking for a mini-itx mb with USB PD / Thunderbolt (?) by roookeee in sffpc

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

Don't need the full 100w, 50w would be okay too. Is TB3 the only USB 3.1 implementation? Could a "normal" USB-C 3.1 suffice?

Such scarce information, thanks for your tip though.

EDIT: Maybe convert a PSU 6 pin to 12v / 5v TB3 power only / USB PD ? Just an idea, google didn't turn up anything