Skip Navigation
Posts
6
Comments
6
Joined
2 yr. ago
  • Update: The original dev does not remember exactly. However they have said that clientId was originally a VARCHAR, so this may have been checking for both '0' or ''

    So an over-engineered workaround to a bad datatype perhaps?

  • I forgot to mention this is in SQL Server, so SIN operates on radians. So I THINK this can only ever cast to a 0 when clientId is also 0

    It certainly doesn't for any of the 100,000 existing rows

  • The client table has around 100,000 rows each with a unique clientId, none of which are returned from the CAST / ABS / SIN

    I think you are right and this is a 'fix' for something lost to time. I am going to talk to the original dev tomorrow to see if they remember what it was for

  • SQL @programming.dev
    Threen @aussie.zone

    Guess the intent

    I am one of the developers on a very small team and have just found the following query

    I would love to hear your ideas for what you think was being attempted here!

    SELECT ... FROM client WHERE CAST(ABS(SIN(clientId)) AS BIT) = 0

  • Thank you so much, I'll check it out!

  • Absolutely, it's a great read. Could you link the video you watched?

  • Programming @programming.dev
    Threen @aussie.zone

    Paged Out! is a free experimental technical magazine

    I hope some people here enjoy reading these as much as I have

    If you know of anything similar, I would love to hear them

    Technology @beehaw.org
    Threen @aussie.zone
    1. Soft Skills Engineering - Software engineering advice podcast
    2. If Books Could Kill - Criticising reviews of bestselling books
    3. CoRecursive - Stories about software
  • Programming @programming.dev
    Threen @aussie.zone

    Programming Music

    I am a big fan of listening to Drone Zone on SomeFM while programming

    Hit me with your favourite streams, albums or artists

    Cyberpunk @lemmy.villa-straylight.social
    Threen @aussie.zone

    2039 - Tom Mauritzon

    I fell in love with this album many years ago, I hope someone here will enjoy it too

    Java™ Community @lemmy.ml
    Threen @aussie.zone

    Eclipse compiler issue

    I am wondering if anyone can help me.

    I have an issue with compiling some code in Eclipse but not with IntelliJ or javac.

    I am using sneakyThrow to bubble a checked exception up through 2 streams.

    Here is the smallest reproducible code I can make:

     undefined
        
    import java.io.IOException;
    import java.util.List;
    import java.util.function.Predicate;
    import java.util.stream.Collectors;
    
    public class Example {
        public static void main(String[] args)
        throws IOException {
            List<List<Integer>> input = List.of(List.of(1, 2), List.of(2, 4));
    
            // Should return any List whose elements are all even.
            List<List<Integer>> output = input.stream()
                .filter(bubblePredicate(o -> o.stream()
                    .allMatch(bubblePredicate(i -> {
                        if (i > 10) {
                            throw new IOException("Number too large.");
                        }
                        return i % 2 == 0;
                    }))))
                .collect(Collectors.toList());
    
            System.out.println(output);
        }
    
        private interface ThrowingPredicate<S, E extend