• 0 Posts
  • 18 Comments
Joined 2 years ago
cake
Cake day: January 7th, 2024

help-circle
  • I think you are talking about website hosting, which has nothing to do with my offline images. I have nothing to do with websites.

    But if you are talking about using it for publishing, some time ago I published a mobile app that shows an offline map for some mountain trails. All the map tiles were originally PNG and took 900MB, but I got them to 50MB as WebP tiles. That’s quite a reduction, nobody would download a 900MB app!



  • Not going to shill for Samsung, it has it’s problems, but to answer your question I happen to use one and I don’t have a Facebook app. I don’t remember if it was not preinstalled or if it was able to be uninstalled and I did when I got the phone, but I don’t have the app. Either way there is definitely no unremovable third-party bloat. But there is a bunch of first-party bloat though, like Samsung Cloud, Samsung Checkout, Samsung Keyboard, etc, and it can’t be completely uninstalled. I haven’t seen any apps being downloaded to my phone automatically, but I’m not logged in to a Samsung account so maybe that’s why.





  • what if somewhere else in the code

    Then you’d need to do something else.

    the semantical and resourcewise equivalent would be a third variable

    So you are advocating for:

    data class Filters(
        val isAdmin: Boolean = false,
        val filterByAdmin: Boolean = false,
        val isConfirmed: Boolean = false,
        val filterByConfirmed: Boolean = false,
    )
    
    fun filterUsers(users: List<User>, filters: Filters): List<User> {
        return users
            .filter { !filters.filterByAdmin || it.isAdmin == filters.isAdmin }
            .filter { !filters.filterByConfirmed || it.isConfirmed == filters.isConfirmed }
    }
    
    fun getAdmins() {
        val users = getUsers()
        val filters = Filters(isAdmin = true, filterByAdmin = true)
        val admins = filterUsers(users, filters)
        println("Admins: $admins")
    }
    

    Over:

    data class Filters(
        val isAdmin: Boolean? = null,
        val isConfirmed: Boolean? = null,
    )
    
    fun filterUsers(users: List<User>, filters: Filters): List<User> {
        return users
            .filter { filters.isAdmin == null || it.isAdmin == filters.isAdmin }
            .filter { filters.isConfirmed == null || it.isConfirmed == filters.isConfirmed }
    }
    
    fun getAdmins() {
        val users = getUsers()
        val filters = Filters(isAdmin = true)
        val admins = filterUsers(users, filters)
        println("Admins: $admins")
    }
    

    To me, Filters(isAdmin = true) is a very easy to use API, where Filters(isAdmin = true, filterByAdmin = true), with the additional variable to avoid nullable booleans, is more verbose, for not much benefit and brings ambiguity. What if someone writes Filters(isAdmin = true), but forgets they need to set filterByAdmin = true for it to actually work? Easy mistake to make. We can prevent these mistakes by removing default values so they have to be specified on the call site, but then you need Filters(isAdmin = true, filterByAdmin = true, isConfirmed = false, filterByConfirmed = false), which is very verbose. Having two variables also allows your systems to get into invalid states:

    isAdmin = true, adminRightsHaveBeenValidated = false isAdmin = true, filterByAdmin = false

    What do these mean? It’s better for invalid states to be unrepresentable. Since these states are mutually exclusive, we should have only 3 states, not 4 which you get with 2 booleans. Which you could achieve with an enum True, False, None, but then you are just reinventing the wheel of nulls. You also get the issue that now you have to remember to always update both variables together.

    It all comes back to your point:

    it’d be idiomatic and reasonable to assume it to be false if we have no data

    You want to have ambiguous states, where a single value represents both “we have no data” and “we have the data, the answer is no”.


  • It is not more accurate nor less wasteful. If you default it to false and you have 100 admin requests in the session where that variable is stored, you would have to check with the database 100 times. Because you are conflating false to mean two things: “the user is not an admin” and “we don’t know if the user is an admin”. Where if you set it to true or false the first time we need the information, then subsequent requests don’t need to check anymore.

    does not have to worry about nulls

    I am used to null safe languages where there is no such thing as worrying about nulls, because not checking for null on a nullable type is a compile error, and so it’s impossible to forget about the null case. Maybe it’s why I don’t see any issue with using them.


  • Let’s say you have a website receiving 1 million requests per day. 0.01% of those are admin requests that need to know if your are an admin to execute them. It would be wasteful to check with the database if you are an admin for every request, when only a tiny minority of then needs to know that. So for 999.900 of the requests isAdmin will be null. We don’t know if the user is an admin and we don’t need to know.


  • Depends on your requirements.

    If the admin status needs to be checked in a database, but most actions don’t require authentication at all, it’s pointless to waste resources checking and it would be left null until the first action that needs the information checks it and fills it in as true or false.


  • So in a language with nullable types, are you against a boolean ever being nullable? Null means “empty, missing info”. Let’s say we have role variable with a enum type of possible roles. It could still reasonably be nullable, because in some scenarios you don’t know the role yet, like before log in.

    In any use case where we need to store some boolean, it’s a common occurrence that we don’t have the data and it’s null. It would be overkill to use an enum with True, False, NoData for these cases, where there is already a language feature made just for that, nullable values.

    I’ve never used TypeScript, just writing from experience in other languages.






  • No, they never did. Yes, it was all over the news, but they literally didn’t. Go be angry at media for making stuff up. You don’t have to believe me, go ahead and find that announcement yourself. You won’t because there was never such an announcement.

    Notice how even the article you linked doesn’t give a full quote? It just quotes someone saying “last version” without any context of the sentence it was used in? I will give you the full quote where that comes form. Someone asked a Microsoft developer what they are currently working on, and the answer was:

    ”Right now we’re releasing Windows 10, and because Windows 10 is the last version of Windows, we’re all still working on Windows 10.”

    It is obvious from context “last version” meant “latest version” here. And that misreading of a quote, conveniently not included in most articles, is the only source for all these news. No announcement. No journalist actually asking Microsoft about it. Just a fleeting comment by one Microsoft employee that obviously meant something else, in an answer about something else, but why let that get in the way of a good story.

    And this was an answer to an audience question in a "Tiles, Notifications, and Action Center” presentation by a single Microsoft developer, on a developer conference. The absolute last place to look for a ground-breaking announcement about Microsoft’s future.

    The company said it had yet to decide on what to call the operating system beyond Windows 10.

    And the exact same article you linked confirms Microsoft is still deciding on the name for the next Windows? Which would make no sense if there was no next Windows?

    “There will be no Windows 11,” warned Steve Kleynhans, a research vice-president at analyst firm Gartner.

    There will be no Windows 11, says some guy who doesn’t work at Microsoft.

    And then a bunch of cherry picked quotes about continous updates being a good thing. Yep, continous updates, just like we got in Windows Vista, and that have nothing to do with there not being new Windows versions.

    Modern journalism is useless. Someone made up a thing, everyone else copied it. And not a single media outlet actually asked Microsoft about it. No one. Or maybe they did, but the answer meant there is no news, so let’s ignore it.