Better HN
topnewbestaskshowjobs
Log inSign up

shortrounddev2

2,427 karma · joined Jun 15, 2023 (3y ago) · 1,641 submissions

Submissions

comment 1y ago · link · parent

Halliburton gave Cheney $34mil when he left the company to go be Vice President

comment 1y ago · link · parent

My main gripe with ML variants is the poor syntax around async (F#). For networked (web) applications, you begin to find that many or most of your functions are async, and wrapping them in computation blocks which come with their own internal syntax that eliminates a lot of the elegance of ML and makes your code look more imperative often feels like it defeats the purpose of the language.

In F#

    let Foo =
        async {
            let! data = getData() |> Async.AwaitTask
            return data.value
        }
Is this the best they can do? C# just has

    async Task<Data> Foo() =>
        (await getData()).value;
Ive always wanted ML syntax like this:

    let async Foo =
        let data = await getData
        data.value
I just dont write a ton of pure functions which have no I/O dependencies

comment 1y ago · link · parent

You're correct. They're assuming that they might be served with a subpoena or warrant or something, but US Customs officials can and will demand the passwords to your personal devices or coerce you into giving your biometrics

https://www.eff.org/issues/border-searches

comment 1y ago · link · parent

AI is a bubble and will pop soon, theres no way even 80% of the spending has yielded the returns they were looking for. Nvidia cards will lower in demand though probably the bubble will be a net gain for nvidia over the preceding 4 or 5 years, though it will take them a while to regain their peak market cap

comment 1y ago · link · parent

I remember being told in school that we shouldn't use Wikipedia (not just for citations, but at all) because anyone can edit it. We were told to use other websites directly, or better yet: paper books.

I would get in trouble for "talking back" when I pointed out that anyone can make a website or write a book, too.

comment 1y ago · link · parent

I've always found it odd that most databases don't expose a kind of query bytecode API that SQL can be converted to. It would allow more kinds of languages, different SQL dialects, compile-time optimizations, and perhaps ORM could be compiled directly into your target database spec. Would reduce the amount of string operations by client code, at least

comment 1y ago · link · parent

It also invites exceptions as error handling instead of a monadic (result) pattern. I usually do something more like

    Result<Users> userRes = getExpiredUsers(db);
    if(isError(userRes)) {
        return userRes.error;
    }

    /* This probably wouldn't actually need to return a Result IRL */
    Result<Email> emailRes = generateExpireyEmails(userRes.value);
    if(isError(emailRes)) {
        return emailRes.error;
    }

    Result<SendResult> sendRes = sendEmails(emailRes.value);
    if(isError(sendRes)) {
        return sendRes.error;
    }
    
    return sendRes; // successful value, or just return a Unit type.
This is in my "functional C++" style, but you can write pipe helpers which sort of do the same thing:

    Result<SendResult> result = pipe(getExpiredUsers(db))
        .then(generateExpireyEmails)
        .then(sendEmails)
        .result();

    if(isError(result)) {
        return result.error;
    }
If an error result is returned by any of the functions, it terminates immediately and returns the error there. You can write this in most languages, even imperative/oop languages. In java, they have a built in class called Optional with options to treat null returns as empty:

    Optional.ofNullable(getExpiredUsers(db))
        .map(EmailService::generateExpireyEmails)
        .map(EmailService::sendEmails)
        .orElse(null);
or something close to that, I haven't used java in a couple years.

C++ also added a std::expected type in C++23:

    auto result = some_expected()
        .and_then(another_expected)
        .and_then(third_expected)
        .transform(/* ... some function here, I'm not familiar with the syntax*/);

comment 1y ago · link · parent

In linq (C#)

    IEnumerable<User> getExpiredUsers(DbSet<User> users)
        => users.Where(u => u.ExpiresAt < DateTime.UtcNow);
Such simple logical expressions (called expression trees) get converted to SQL queries

comment 1y ago · link · parent

Americans accept pedestrian deaths caused by huge monster truck F350s every single day. Not that an AI powered car running people over is nothing, but nobody in the US gives a shit about pedestrian deaths

comment 1y ago · link · parent

Whenever a PM at work "writes" me a 4 paragraph ticket with AI, I make AI read it for me

comment 1y ago · link · parent

I think the majority of people celebrating christmas are not doing so for religious reasons

comment 1y ago · link · parent

I thought the purpose was to be a fun thing we used to kill time over the holidays

comment 1y ago · link · parent

Ive worked on both ends of the spectrum and id prefer too much process to too little

With too little process, people release bugs that I then have to scramble to fix. The CEO who pushed to skip QA and unit testing and everything in the name of release never has to deal with the consequences of their impatience

comment 1y ago · link · parent

The federal government wipes its ass with the constitution every day, why shouldn't states do the same?

comment 1y ago · link · parent

The sick man of Europe gets sicker

comment 1y ago · link · parent

If you ever go outside of the US it is shocking how much other countries do with so little. Countires with a tenth of our population and an even smaller fraction of our GDP have cheap, efficient, high quality health care systems and clean, convenient public transportation. They have well equipped classrooms with teachers who don't have to work two jobs to get by. They have highly skilled police forces whose training is measured in years, not weeks. These countries are not perfect, but they seem to govern far nore effectively than the richest country on that planet. I'm not even talking about an idealized Europe; some southeast asian countries are like this too.

So yeah, where is the money going? When you combine state, local, and federal, the US spend nearly a trillion dollars a year on education (more than our military!) but where does it go? We regularly churn out illiterate graduates and teachers have to commute from another state away in order to find somewhere affordable to live. We spend more money per capita on healthcare than anyone else in the world for worse coverage and worse outcomes.

I hypothesize that the dollar's status as the world reserve currency is actually a bad thing. It makes it cheap for us to borrow money and as a result encourages all kinds of social pathologies associated with ZIRP

comment 1y ago · link · parent

> Why prioritise node instead of jq?

In powershell I just do

    > echo '{"foo": "bar"} | ConvertFrom-Json | ConvertTo-Json
    {
        "foo": "bar"
    }
But as a function

comment 1y ago · link · parent

Depends on your note-taking strategy. I would just transcribe what the professor was saying and ended up not paying attention. I turned my brain into a transcription machine and didn't take any time to grok anything I heard, then I had to re-read the textbook later. Nobody ever "taught" me how to study, so I was bad at it. Failed my way through high school and dropped out of college

comment 1y ago · link · parent

Something is more profitable than nothing, always

comment 1y ago · link · parent

Manual labor was replaced with factory labor, factory labor replaced with knowledge work. If knowledge work is replaced with AI, what do we go to then? Not to mention that the efficiency gains of the modern tech industry are not even remotely distributed fairly. The logical extreme conclusion of an AI company would be where the CEO, Founder, 100% owner, and sole employee coordinates some underling AIs to run the entire company for him while he collects the entire profit and shares it with no one, because American government is an oligarchy

comment 1y ago · link · parent

Land value tax would fix this

comment 1y ago · link · parent

I believe the corporation for public broadcasting should provide funding for local member stations who run their own nodes on fediverse sites, and then federate those nodes together

comment 1y ago · link · parent

God we can only hope so

comment 1y ago · link · parent

This is cool - I often wish java had some of the nice features of C# without having to go all the way into Kotlin.

In your post, you say:

>Compile to standard Java bytecode and run anywhere the JVM runs

But in github, the readme says that it transpiles to Java. Does this compile to bytecode, or transpile to java?

comment 1y ago · link · parent

I'm a fan of Gitlab. Moved all my repos over there and shut down my github account

comment 1y ago · link · parent

Yes, my wife uses it all the time

comment 1y ago · link · parent

Side effects of the vaccine basically. I guess technically headaches or fatigue would be a vaccine injury

But I use the phrase "thought to" intentionally: I don't know what the science says now, but at the time there were reported cases of myocarditis in people who took the JnJ vaccine. This was like May of 2021, so I don't know if the science ever panned out on that, but it definitely drove discussions around health equity with the vaccine

comment 1y ago · link · parent

I like to return IEnumerable instead of List<>:

    IEnumerable<Product> GetExclusiveProducts(List<Product> source) =>
        source
            .Where(p => p.ProductTitle == "iPhone")
            .OrderBy(p => p.TypeOfPhone);
That way the user can decide if they want a List or Array or Set or whatever, and you can also add additional queries to this

Also better to pass IEnumerable to the function instead of List, for the same reasons

Also I forget the syntax but you can use an extension method to add it to linq I think

comment 1y ago · link · parent

For some reason reminds me of making stop motion animation with Garry's mod
12345
55