1. 1

    for the sorting question I assumed the answer was going to be counting sort, which also runs in O(n) time and is more general in the sense that it can handle duplicates and arbitrary objects with small integer keys. It is strictly slower in this specific case though as it requires three passes and some arithmetic

    1. 3

      You saw the part where it said they were trick questions, right? An array A of length N containing the integers 1 to N inclusive can be “sorted” like this in C:

      for (i=0; i<N; i++)
          A[i] = i+1;

      Update: Oops, just finished reading the post and found the site also has the answers, so I assume you knew this by now and just reported your experience. Thank you for doing that :-)

      1. 1

        For the record why did you code it like that instead of making it much more readable?

        for(i=1; i<=N; i++) 
         A[i] = i;

        It’s just more natural to read, in my opinion.

        1. 5

          It’s been a while since I wrote in C, so I was as defensive as I could in the example. I may I have internalised over time to take more notice of the array positions written to than the values.

          I agree that counting from 1 to N feels more natural, but the two versions are not equivalent. Your version will likely segmentation fault, because it will attempt to write to A[N], which is beyond the bounds of an array of length N. It also doesn’t write to A[0], the first position in the array.

          1. 1

            ops, you are right. Forgot i - 1

          2. 2

            If the array has N elements, your code will fail to compile, fail to run, or be nondeterministic depending on the language.

            1. 1

              Yeah, I made a mistake on A[i-1] and now I can’t fix it. Only thing I can do is to own up to my mistake 😅

      1. 1

        wonder about the bias of using github for this. I’d assume it’s biased towards both english-speaking countries and countries with a strong open source culture.

        Also find it suspicious that the GDP chart seems to be absolute rather than per capita? I’d assume GDP (total) and number of developers both mainly correlate with a country’s population

        1. 2

          …and also a huge bias against properly self-hosting projects, against closed software, sole non-sharing hackers and countless other things. github makes hardly even slightly close to representative data for studies titled “.* of the world”

        1. 5

          LoRA on this device is super interesting. From what I tested on another SX1276 device, you can control things within ~0.5 km without internet in an urban area, or ~10km if there’s line of sight. No gateway required.

          1. 5

            Can you run Secure Scuttlebutt on that?

            1. 2

              Can’t see any reason why not.

              1. 1

                From what I understand is that LoRA is extremely low bandwidth and SSB is kinda chatty (also from what I understand)

                1. 2

                  I found someone [1] running … something … over LoRA (with the same LoRA chip as this computer too). It looks like it interfaces with SSB somehow but I’m not sure how.

                2. 1

                  LoRa has a very low data rate - from 100bps to 27 kbps depending on spreading factor (i.e. faster rates give you shorter range) - and there are duty cycle regulations (what percentage of time you can occupy the network), which vary by region but it’s usually 1%. Worst case your average throughput will be about a bit per second (over a 5 to 10km range), which is about 10kB per day. And that’s if you run your own private LoRa network, shared LoRaWAN networks often have fair use restrictions going as low as 30 seconds of airtime per 24 hours. So I’d say it’s definitely not suited for real time messaging.

                  The main intended use-case for LoRa is transmitting sensor readings from sensors running on a small primary battery and intended to live for decades, so a lot of the trade-offs are made in favor of low energy. If you want to run SSB on a device with the power of a smartphone, you probably just want to use a commercial cellular network. If you want something like a disaster proof, censorship proof, community-owned network, LoRa is a pretty bad choice anyway as it’s really easy to jam (a neat example of selective jamming in LoRaWAN is explained in this paper, it would be harder in a LoRa mesh, but non-selective DOS attacks against any LoRa network are trivial).

              1. 5

                I am not ignorant to the fact that there’s very little rich user data on the Fediverse to capture. Facebook is an extremely rich trove of user data so the risks are much higher when that data is shared than the risk of my relatively meagre Fediverse data being shared. However, the richness of Fediverse user data is not inherently restrained in the protocol so there’s room for that pool of data to get richer over time and privacy controls may not develop at the same rate.

                this point is somewhat understated imo. The fediverse simply has a different privacy model than profit-driven social media. The way data on the fedi is structured makes less usefull for targetted advertising, as they’re not specifically engineered to be, and the vast majority of instances aren’t driven by profit motive, making it unlikely that the protocol will evolve to support easier processing of data for advertising purposes any time soon. Although you can collect as much data as you can from the fediverse, there’s little incentive and no way to recoup the cost of collecting and storing that data.

                Fedi’s main privacy issue, imo, is that private messages can be leaked. The main threat model would be something like a group like kiwifarms trying to collect such data to harass people. This is essentially the same issue as jack twitter/zuckerberg/whoever owns the platform being able to read your dms except everybody owns the platform, and the only failsafe solution is to make users aware of this and push them to use end-to-end encrypted protocols when they need that kind of privacy

                1. 1

                  I wonder how hard it would be to train an AI that can tell generated faces from real ones. I’ve heard concerns from people suggesting that e.g. twitter bots could use these generated faces as profile pics to be harder to detect (they often reuse a number of stolen pictures right now and that makes them somewhat easier to detect) but I feel it’s probably feasible to train an AI to detect these generated faces with high enough confidence that you’d get a better fingerprint for bots than with stolen pictures.

                  1. 6

                    What are key differences between ActivityPub and RSS+WebSub/pubsubhubbub? Its spec is long and verbose, I can’t tell at a glance what does it represent. I see that it supports likes and subscription lists, but what are other differences to RSS? Does it support comments? Is it just for twitter-like websites, or suitable for blogs and reddit-like websites too?

                    What I like in ActivityPub is that it’s RDF-based. It’s cool technology based on romantic ideas of expert systems, Prolog, rule-based AI, etc.

                    1. 7

                      Besides mastodon and pleroma which are twitter clones using ActivityPub, there’s also peertube for videos, PixelFed for images and Plume for blogging. Those projects are all pretty new though, so it’s too early to say whether ActivityPub works well for this kind of stuff, but it looks promising imo

                      1. 1

                        RSS+Webmention can be used to realize a very rudamentary version of federation (I’m currently developing a platform and testing simple federation using RSS+WM).

                        However, ActivityPub allows much more versatility and provides the endpoint with a low-overhead, machine-readable version of actions (AP is not like RSS in that stuff operates as feeds, rather, it’s actors doing actions on other actors or objects)