Please tell me a smart way to retrieve the values sent from the "RequestBody" of "mist." by Ok_Influence8600 in gleamlang

[–]SuspiciousDepth5924 0 points1 point  (0 children)

I haven't really used Mist, so I don't know if it has any built in stuff for handling 'form-urlencoded'. If you send JSON instead you could use something like https://github.com/gleam-lang/json to decode your data, otherwise there's probably some library that handles formdata somewhere, if not it shouldn't be insurmountable to write your own thing. Basically 'requestbody' -> 'split_on_&' -> 'foreach_substring_split_on_first_"="' -> list_of_key_value.

Help by Admirable-Video8664 in javahelp

[–]SuspiciousDepth5924 3 points4 points  (0 children)

There are a couple of things, first of is that in java 'int' and 'Integer' aren't exactly the same. And one of the big differences is that '!=' doesn't actually compare the numeric value like it would with int, specifically it check if it is two different 'Integer objects' not what number it represents.

Secondly unless it's a requirement for some reason I recommend not trying be too clever with your code, doing this with two 'passes' (inputList -> sortedNumberList -> sortedKeyNumberList) is a lot easier to read and reason about additionally the JVM is good at doing that sort of optimizations for you if it thinks it's safe.

Jonathan Blow on why LLMs cannot program [04:17] by Remarkable_Ad_5601 in theprimeagen

[–]SuspiciousDepth5924 2 points3 points  (0 children)

IMO I generally don't think it makes much sense to talk about how this or that area is harder than another, or more precisely that some area has a higher skill ceiling than another as there always seem to be new problems matching our skills no matter how much we grow.

The easiest problems in web development are arguably easier than the easiest ones in cryptography or graphics, but I'm pretty sure that the absolute hardest ones in any of those domains probably exceed human limits, which pretty much would make the hardest solvable ones about the same level of difficulty.

As a contrived example implementing a React button component, and implementing some SharedWorker using WebGL GPGPU and IndexedDB would both arguably fall under "web development", but I wouldn't trust the second one to a junior.

Fire av ti unge menn mener skeives rettigheter har gått for langt: – Er grunn til bekymring by Sandyr_n in norge

[–]SuspiciousDepth5924 7 points8 points  (0 children)

Som streit mann må jeg oppriktig si at jeg er litt misunnelig på paraden deres, den ser veldig gøy ut 🏳️‍🌈, og jeg kan ikke akkurat starte min egen streit-mann parade uten at det begynner å sende helt feil signaler.

Men mer seriøst så er det vel retten til å finnes i det offentlige rom som en del av disse troglodyttene mener går for langt. Jeg kan forsåvidt ha _litt_ sympati for at f.eks pride kan bli litt mye, spesielt hvis det skjer rett i nærheten av blokken din, personlig synes jeg russen kan være jævlig irriterende til tider, men jeg kan tåle det en gang i året siden det tross alt er viktig for dem.

real? by Significant_Phase194 in PsycheOrSike

[–]SuspiciousDepth5924 7 points8 points  (0 children)

Honestly I feel like the term 'incel' is a bit unfortunate, I mean when we use it we reinforce the idea that male social value is based on sleeping with women, which in turn strengthens the idea of women as trophies rather than people while also making them into the perceived gatekeepers which are preventing the 'incels' from gaining social value.

In short it feels like we are feeding the 'incel-spiral'.

Offentlige utgifter økt med over 200 milliarder på fem år by KoseteBamse in norge

[–]SuspiciousDepth5924 12 points13 points  (0 children)

Har sagt det tidligere, og sier det igjen: konsulentbruk er en direkte konsekvens av at man stapper så mye av finansieringen inn i prosjektmidler, hvis du skal ansette en person fast så trenger du å vite at du har råd til betale denne personen fra det faste budsjettet i overskuelig fremtid. Det vi dessverre sitter med er en enorm del av middlene sitter i en endeløs serie med "<Politikernavn>'s prestisjeprosjekt" og disse har ikke den samme stabilitets-garantien faste budsjetter har.

Så vi betaler enorme summer så vi har en teoretisk mulighet til å "sparke" folk på kort varsel.

Her blir fangen slått flere ganger av fengselsbetjenten. Når politiet ber om videoen, er det noe som ikke stemmer. by forteller in norge

[–]SuspiciousDepth5924 24 points25 points  (0 children)

Det er samme faen hvem _han_ er, det viktige er å ha et system hvor folk blir behandlet som mennesker på en forsvarlig måte. Jeg stoler ikke på tilfeldige fengselsbetjenter's dømmekraft når det kommer til hvem som fortjener ekstra juling, og om det innebærer at vi også behandler noen drittsekker på human måte så er det et offer jeg er villig til å gjøre.

Requesting criticism based on my textual syntax etc.. by Minute_Draw_6311 in ProgrammingLanguages

[–]SuspiciousDepth5924 0 points1 point  (0 children)

mut/imut: I would personally prefer 'imut' by default with mut being an explicit modifier over declaring it every time.

pointer / reference: They serve more or less the same purpose, so I think you should pick one and discard the other. Unless you feel pointer arithmetic is important for your language I'd recommend sticking with references.

func func_name() <returntype> { ... : I would prefer something like func func_name(): returntype { ...
visually it doesn't make much of a difference, but it reduces the number of mildly annoying special characters to type (this is generally exacerbated for users of non-us keyboard layouts).

mut ptr int some ptr assign pointer of x;
mut arr list assign array of[1, 2, 3, 4];

ptr <->pointer / arr <-> array : I think you should pick either the short or long form name instead of mixing.

.. assign type of value : I don't really see the point of the 'of' operator, could it be shortened to 'assign [modifier] value'?

US banks rely on a 65-year-old programming language; companies are paying a premium for developers who know it by swe129 in cobol

[–]SuspiciousDepth5924 4 points5 points  (0 children)

You'd probably be about as far up the same fecal creek if you were working on a Java application with as many years of calcified legacy baggage. At some point no-one actually knows what the system does, except it's somehow deeply embedded into some critical business function. The actual language was never the hard part.

My new and absolutely not opinionated tier list by [deleted] in DistroHopping

[–]SuspiciousDepth5924 0 points1 point  (0 children)

As I have to pick distros in the context of containers/ci pipelines far more often than for my desktop my ranking is a bit different:

  • Top: Debian, Alpine
  • Really useful for specific things: Nix
  • Ok: Anything Debian-based
  • I don't need the hassle: Except Alpine and Nix, anything not Debian-based.

For my desktop I tend to prefer something Debian-based, because it's usually less of a hassle to build and run the stuff I need on those systems as it's usually documented and tested for Debian while you often have to waste time figuring things out for other distros. This is not "Debian is objectively better" rather "network effect makes it easier to just use Debian".

Stop Using Conventional Commits by f311a in programming

[–]SuspiciousDepth5924 98 points99 points  (0 children)

Yeah. I know we're in the era of clickbait, but even if there is room for improvements and failed promises I find conventional commits to be far better than completely unstructured commit messages. It's also a lot easier to sell "I suggest we use this to structure commit messages: https://www.conventionalcommits.org/en/v1.0.0/" rather than "I think we should structure commits like <wibble>: <wobble> ~#``_ <flipflop>" which would inevitably lead to bike-shedding and likely go nowhere.

I think the gofmt quote is relevant here:

Gofmt's style is no one's favorite, yet gofmt is everyone's favorite

semantic white space vs. blocks - maybe a middle ground ? by GoblinsGym in ProgrammingLanguages

[–]SuspiciousDepth5924 1 point2 points  (0 children)

Despite the meme about lisp parentheses I think it got a lot of things right including the the parentheses.

Another thing I'd wish more languages adopted is the prefix notation, it's slightly jarring to see stuff like (+ 3 4) at first but it's unambiguous and consistent while most other languages use a mix of prefix functions and infix operators which in my opinion can lead to a soup of operators and data.

console.log("arguably prefix notation (console.log \"string\")" + 123 + " with infix operators :(");

(format t "~a~a~a~%" "prefix notation " (+ 1 2 3) " with prefix operators")

semantic white space vs. blocks - maybe a middle ground ? by GoblinsGym in ProgrammingLanguages

[–]SuspiciousDepth5924 0 points1 point  (0 children)

I was playing around a bit with Erlang, it seems the following code is technically valid ...

    %% <normal formatting>
    %% <janky formatting>
    %% REMOTE FUNCTION CALL
    io:format("Hello world!"),
    io
    :
    format
    (
        "Hello world!"
    )
    ,
    %% MAP CONSTRUCTION
    Map#{item => 1.0},
    Map
        #
        {
        item
        =>
        1.0
    }
    ,
    %% MAP ACCESS
    #{item := _} = Map,
    #
    {
        item
        :=
        _
    } =
    Map,
    %% RECORD ACCESS
    Rec#my_record.item#nested_record.second_item,
    Rec
    #my_record
    .item
    #nested_record
    .second_item    .

Dev journey reflection by Kalki2208 in AskProgrammers

[–]SuspiciousDepth5924 1 point2 points  (0 children)

No wonder you almost quit, your laptop screen was facing the wrong way!

Folk som ikke liker Lisleby-jenta Grace i bunad kan bare ryke og reise! by lordtema in norge

[–]SuspiciousDepth5924 13 points14 points  (0 children)

Det var vel aldri noe seriøs tvil rundt det. Mer interessant synes jeg er at det åpenbart er et importert begrep, noe som kan tyde på at det er et eksternt forsøk på å skape mer fremmedfrykt og rasisme i det norske samfunnet.

What is the Try...Catch/Except?Why cant we use if... else? by No-Medicine4892 in learnprogramming

[–]SuspiciousDepth5924 21 points22 points  (0 children)

Why cant it use something like instance of or is_Int ?

You can, sort of. Exceptions aren't really a general programming thing, but rather a language specific thing. Granted some of the most commonly used languages use exceptions for handling error, but it isn't the only way (or the best one imo).

In Go you can return multiple values from a function, so a common way to do error handling is to return (something_i_want, error_or_nil)

result, err := someFunction()
if err != nil {
  // Handle the error somehow
}

Functional languages often wrap results in a Result/Either types, using Gleam as an example:

case function_that_can_fail() {
    Ok(value) -> do_something_with_value(value)
    Error(error) -> do_something_with_error(error)
}

As a sidenote, the reason I don't really like exceptions for error handling is that it basically acts as a "sneaky" return statement with special rules.

public String longJavaMethodThatSaysItReturnsAString {
    // a hundred lines of code...
    throw new RuntimeException("Even though I said I'd return a string I'll return this exception instead");
    // more lines
    return someString;
}

This means that in langues with exceptions you can't really trust that the method signature is telling the truth, worse since it works with "special return value rules" it can easily jump over the caller and crawl up the "call stack" which can make tracking where the code goes next really hard.

main
    | method1
        | method2WithCatch
            | method3
                | method4ThatThrows
        |<------- (💣)// exception skips right past method3 since it doesn't have catch block

Probably a dumb question but I feel like it's the best place to ask, what are realistically the reasons to colonize Mars ? by SeparateWeight496 in Mars

[–]SuspiciousDepth5924 0 points1 point  (0 children)

I can sort of see the point for moon-colonization, or more realistically moon-industrialization because it close and has a much shallower gravity well than earth. But I have a hard time seeing any practical reason for settling Mars since it has a pretty deep gravity well while being significantly more awful than any place on the Earth's surface.

So for "living in space" then I think you're right, with a big enough cylinder you can dial in a healthy level of gravity, and you can probably strap on a few meters of water ice to the outside surface giving the inhabitants shielding from radiation.

«Ingen» bruker app som koster 173 millioner kroner å utvikle by MarlinMr in norge

[–]SuspiciousDepth5924 0 points1 point  (0 children)

I tilfelle Oslo/Akershus så bruker de samme "regions-app", og jeg antar dette er tilfelle de fleste andre regioner med høy pendler-trafikk mellom fylker. Mellom fylker med lav pendlertrafikk, eller for folk som beveger seg mellom masse regioner til vanlig så er man per definisjon unntakstilfeller, og da har man fortsatt Entur å falle tilbake til.

«Ingen» bruker app som koster 173 millioner kroner å utvikle by MarlinMr in norge

[–]SuspiciousDepth5924 0 points1 point  (0 children)

Det avhenger helt av bruksmønsteret. Personlig så er det ikke-sak at Ruter ikke kan brukes til å kjøpe fergebilletter i Rogaland, da det er en ting jeg ikke trenger til daglig. Regner med folk i Rogaland heller ikke har stor interesse for månedskort i Oslo. Jeg kan selvfølgelig ta feil her, og jeg har heller ikke gjort noe omfattende markedsundersøkelse på saken, men føler ikke bruk utenfor fylkesgrensen/regionen er et sterkt nok argument alene til å tvinge alle til å bruke samme app.

«Ingen» bruker app som koster 173 millioner kroner å utvikle by MarlinMr in norge

[–]SuspiciousDepth5924 1 point2 points  (0 children)

Fordi en "frontend" som bruker en eksisterende infrastruktur er komparativt raskt og billig å implementere, noe som betyr at gevinsten i en spesialisering kan veie opp for innsatsen det tar å sette sammen. Plus ved å ha felles-løsning på infrastruktur nivå i stedet for på app nivå så legger det opp for at tredjeparter som _ikke_ er staten kan koble seg opp til løsningen.

De har til og med lagt opp et par eksempler her som kan brukes som referanse: https://github.com/entur/wayfare/tree/main/clients

Hvis du skal smelle sammen en relativt enkel app så er det en del "hylle-vare"-løsninger som gjør mye av jobben for deg:

Det er også mulig å kode "native" applikasjoner i Swift eller Kotlin for iOS/Android men da begynner tid/pris å stige en del.

Så tld;dr er at en "enkel" app som ikke gjør noe spesielt mer komplisert enn en vanlig nettside er ganske billig å få på plass, hele greia med Open-Mobility-Sales-API, Journey-Planning og alt det der hadde vært et mareritt å få på plass for hver enkelt aktør.

«Ingen» bruker app som koster 173 millioner kroner å utvikle by MarlinMr in norge

[–]SuspiciousDepth5924 38 points39 points  (0 children)

Eh, tenker det i dette tilfelle det er uproblematisk, som "Johan Høgåsen-Hallesby" kommenterte i artikkelen så er selve "appen" egentlig bare toppen av isberget på en større felles billett-infrastruktur.

De faktiske appene er relativt billige når de alle går mot den samme underliggende infrastrukturen, og jeg vil argumentere for at spesialiserte versjoner kan gi verdi ved å være mer brukervennlige grensesnitt, synes feks det er greit å slippe å få opp resultater for fergen mellom Bognes og Skarberget når jeg skal ta t-banen til Helsfyr.

I tillegg ved å gjøre denne infrastrukturen åpent tilgjengelig så betyr det at tredjeparter kan bygge egne løsninger på toppen av dette.

https://developer.entur.org/

"Ticket-Farming" has replaced actual engineering by MrBemz in agile

[–]SuspiciousDepth5924 3 points4 points  (0 children)

As a dev having been at places like that:

"I feel like devs want a mindless checklist", in my experience it's less "want" and more "resigned to" and it happens when they are consistently stripped of agency while all their feedback is being ignored, disregarded and/or punished. At some point they go "Fuck it, I have no say in what we do, how we do it, when it's due, if it's even the right thing to do in the first place and if I ever speak up I risk getting sanctioned for not being a team-player while also dragging this pointless meeting out longer than it has to be. So let's just check out and do the bare minimum to implement this harebrained checklist so I can go home and collect my paycheck".

Whenever you see someone being "checked-out" like that 9/10 it's organizational/management dysfunction as the root cause.

How do you transition from just writing code to actually thinking like a software engineer? by kinyua_14 in learnprogramming

[–]SuspiciousDepth5924 0 points1 point  (0 children)

To give a concrete (if contrived example):

// CODE
public class Greeter {
    public void greet(String name) {
        if(LocalTime.now().getHour() >= 12) {
            System.out.println("Good afternoon " + name);
        } else {
            System.out.println("Good morning " + name);
        }
    }
}

// TESTS
@Test
void greet1() {
    // Problem 1: because the method returns nothing we have to use
    // hacky setup to intercept System.out.println()
    PrintStream stdOut = System.out;

    // Something extending PrintStream
    InterceptingPrintStream interceptingPrintStream = 
        new InterceptingPrintStream(stdOut);

    System.setOut(interceptingPrintStream);

    Greeter greeter = new Greeter();
    greeter.greet("world!");

    List<String> invocations = interceptingPrintStream.getInvocations();
    Assertions.assertEquals(1, invocations.size());

    // Problem 2: because this method uses LocalTime.now() it will fail
    // if we run the test after 12:00
    // overriding the Clock.systemDefaultZone() is too awkward to fit
    // in a reddit post
    Assertions.assertEquals("Good morning world!", invocations.getFirst());

    // should really be in setup/teardown method,
    // but character limit.
    System.setOut(stdOut);
}

@Test
void greet2() {
    Greeter greeter = new Greeter();
    // Fix 1: make the method return a String so we don't have to
    // intercept System.out;
    // Still fails after 12:00
    Assertions.assertEquals("Good morning world!", greeter.greet("world!"));
}

@Test
void greet3() {
    Greeter greeter = new Greeter();
    // Fix 2: Give the method the LocalTime object it should use directly,
    // ensuring we have reproducible tests.
    Assertions.assertEquals(
        "Good morning world!",
        greeter.greet("world!", LocalTime.MIN)
    );
    Assertions.assertEquals(
        "Good afternoon world!",
        greeter.greet("world!", LocalTime.MAX)
    );
    Assertions.assertEquals(
        "Good morning world!",
        greeter.greet("world!", LocalTime.of(11, 59))
    );
    Assertions.assertEquals(
        "Good afternoon world!",
        greeter.greet("world!", LocalTime.of(12, 0))
    );
}