1. 2

    may still be missing some edge cases in which a float typed variable can lead to UB

    There’s no UB in Python. UB is defined in the C and C++ standards as behaviour that compiler authors do not have to write diagnostics for nor give a definite result for. A few other C-like languages also have UB, but UB is standardese. No standard and no definition means no UB.

    The only reason I’m harping on about this is because floats are not unpredictable, and it pains me when people think of floats as weird, unknowable entities that can do all sorts of wacky unpredictable things. Floats can and should be understood.

    1. 2

      I agree with your second half, but Python does have a definition (in the form of the python.org site documentation), and it points out things like “the ordering of X is not defined” (C/++ legalese would rather describe this as “implementation-dependent”). There is also a lot of “currently this returns like this but in the future this might break, so don’t rely on it”. And “This works like this in CPython, but only in CPython!”.

      Python as a language is more fleshed out than people give it credit for, imo.

      1. 1

        I still disagree that Python has a definition. Pypy for example has to implement “whatever cpython does” and can’t rely on a published Python standard to decide what is “correct” Python. It doesn’t matter if there’s documentation for it or not: people want their cpython code to produce exactly the same results on pypy and will consider any divergence a bug.

        1. 1

          The Python Language reference is written in an implementation agnostic angle and describes the behaviors that Python implementations should follow. It does have some “CPython implementation notes” but those are mostly things that don’t matter in the grand scheme of things.

    1. 1

      Also see TaskWarrior, which I have been using for several years now.

      1. 1

        This is explicitly referenced in the README. Looks like this is intended to be better than TaskWarrior.

        1. 1

          Huh, I have not used their sync service. I use git to manage the files in the data directory.

          1. 3

            I started with taskwartrior, indeed using git to sync the data directory at one point. I gave up doing that after the merge conflicts (caused by the data format, and syncing across computers) were too frequent and difficult.

            I did like taskwarrior, and it’s what inspired me to write dstask after a found several things I wanted to do differently.

            1. 2

              Thanks for the history!

      1. 5
        • Lexical-binding is used by default

        I know many packages out there enable lexical binding for all their stuff, but I’m curious if packages I use will break with this turned on by default

        time to find out!

        1. 4

          I’ve been using Emacs 27 for about as long as it’s been cut from the master branch and haven’t had any breakage. Using doom so I couldn’t even tell you how many packages I have installed.

          1. 3

            Maybe this statement should be moderated somewhat. I see in NEWS only that:

            ** Lexical binding is now used by default when evaluating interactive Elisp.

            https://lists.gnu.org/archive/html/emacs-devel/2020-08/msg00240.html

            1. 1

              Yeah that seems like a big change. I thought Emacs Lisp was famous for weird dynamic scoping issues

              1. 4

                You can still use dynamic scoping when lexical-binding is activated, you just have to declare a variable as special (using defvar). This just means that

                (defun foo () bar)
                (defun baz () (let ((bar 23)) (foo))
                

                won’t work, without a preceding

                (defvar bar)
                

                but as this has been a style recommendation for years now, most scripts have been adapted.

            1. 5

              Python is an interpreted language, i.e., a scripting language.

              So that’s what a scripting language is, eh? One that has an interpreter?

              Behold, the C++ scripting language:

              https://root.cern/cling/

              1. 3

                Excuse me, but python is compiled to VM byte code like Java. Therefore it is a serious programming language, unlike those silly scripting languages like C++.

              1. 4

                I tried the C++ code with and without sorting and both versions ran in about 1.8s on my machine.

                Has something changed in compilers or hardware since 2012 when this was first posted?

                1. 6

                  I have a CPU from that era (Intel i7 2600K, still going strong and I’m very happy with it) and I could reproduce it. With sort about 6.3 seconds, without sort about 16.0 seconds. My g++ version is 7.5.0. My only guess is that yes, they must have improved something about the branch prediction (in hardware or microcode?) for this effect to disappear.

                  Also, wow, your machine is so much faster than mine. I didn’t know I could expect such a big single core speedup from upgrading my CPU. Maybe I should buy a new CPU after all. However, having an old CPU is really beneficial for development because if it performs well on my machine, it will perform even better on other people’s.

                  1. 7

                    Using old hardware for the benefit of your users. You, sir, are a hero. ∠(・`_´・ )

                    I thought maybe -O2 optimisation was doing something fancy, but no, doesn’t seem to matter without -O2 either. I’m on an i7-7600U CPU @ 2.80GHz with gcc 8.3.0, which doesn’t seem that newer. I wonder if I’m doing something wrong in my test.

                  2. 2

                    Your compiler is almost certainly using cmov (conditional move) or adc (add with carry), if it hasn’t gone vectorization crazy (e.g. some versions of clang, depending on the flags). These instructions have the same timing regardless of the value being compared, since there is no branch involved.

                    If you use objdump, you’ll probably find something along these lines in your binary:

                    cmp word ptr [rax], 128
                    adc rdx, 0
                    

                    In my experience, an unrolled loop using adc is hard to beat in this context.

                    1. 2

                      Here’s the disassembly of gcc 8.3.0’s output up until the clock call at the end.

                      00000000000011a5 <main>:
                          11a5:	41 55                	push   %r13
                          11a7:	41 54                	push   %r12
                          11a9:	55                   	push   %rbp
                          11aa:	53                   	push   %rbx
                          11ab:	48 81 ec 08 00 02 00 	sub    $0x20008,%rsp
                          11b2:	49 89 e4             	mov    %rsp,%r12
                          11b5:	48 8d ac 24 00 00 02 	lea    0x20000(%rsp),%rbp
                          11bc:	00 
                          11bd:	4c 89 e3             	mov    %r12,%rbx
                          11c0:	e8 6b fe ff ff       	callq  1030 <rand@plt>
                          11c5:	99                   	cltd   
                          11c6:	c1 ea 18             	shr    $0x18,%edx
                          11c9:	01 d0                	add    %edx,%eax
                          11cb:	0f b6 c0             	movzbl %al,%eax
                          11ce:	29 d0                	sub    %edx,%eax
                          11d0:	89 03                	mov    %eax,(%rbx)
                          11d2:	48 83 c3 04          	add    $0x4,%rbx
                          11d6:	48 39 eb             	cmp    %rbp,%rbx
                          11d9:	75 e5                	jne    11c0 <main+0x1b>
                          11db:	e8 80 fe ff ff       	callq  1060 <clock@plt>
                          11e0:	49 89 c5             	mov    %rax,%r13
                          11e3:	be a0 86 01 00       	mov    $0x186a0,%esi
                          11e8:	bb 00 00 00 00       	mov    $0x0,%ebx
                          11ed:	eb 05                	jmp    11f4 <main+0x4f>
                          11ef:	83 ee 01             	sub    $0x1,%esi
                          11f2:	74 1d                	je     1211 <main+0x6c>
                          11f4:	4c 89 e0             	mov    %r12,%rax
                          11f7:	8b 08                	mov    (%rax),%ecx
                          11f9:	48 63 d1             	movslq %ecx,%rdx
                          11fc:	48 01 da             	add    %rbx,%rdx
                          11ff:	83 f9 7f             	cmp    $0x7f,%ecx
                          1202:	48 0f 4f da          	cmovg  %rdx,%rbx
                          1206:	48 83 c0 04          	add    $0x4,%rax
                          120a:	48 39 e8             	cmp    %rbp,%rax
                          120d:	75 e8                	jne    11f7 <main+0x52>
                          120f:	eb de                	jmp    11ef <main+0x4a>
                          1211:	e8 4a fe ff ff       	callq  1060 <clock@plt>
                      

                      So you’re saying cmovg is what’s removing the branching?

                      1. 4

                        (Butting in)

                        Yes, that’s right! The inner loop runs from 11f7 to 120d. It performs the addition every time, but only moves the result into the sum register if the condition is true.

                  1. 12

                    The hardware and software freedom issues all seem legitimate, but the ‘questionable politics’ appears to be a dedication to freedom of speech: they apparently purport not to censor legal speech on their platform. I share raymii’s abhorrence for racism and neo-Naziism, but like the ACLU of old I believe everyone deserves liberty, even abhorrent people.

                    1. 15

                      I really never understood this point of view. The slopes are not that slippery. You don’t need to allow people to say that other people should be killed, contained, or otherwise genocided in order to have a free society. You certainly are not obligated to give them a platform to amplify their voice. Hate speech is not equivalent to every other debate that a free society should be allowed to have.

                      You won’t lose your rights if you take away the right to say that entire societal groups should be harmed. Canada and most of Europe are not dystopian hell holes just because they have stronger laws against hate speech.

                      1. 8

                        One thing to add is that purisms platform is a private offer and is not a basic service, so they are perfectly within their right to say “go talk somewhere else”.

                        1. 9

                          I think the platform point is the real valid one, here. “Freedom of speech” is a pretty intellectually dishonest claim here - it matters for the government because the government’s authority is wide-ranging and governs behavior that’s not otherwise involved with the government. The government can arrest you in your home for crimes you committed there. All those First Amendment freedoms are there for the basic purpose of stopping thoughtcrime from being a thing, not because we’re all obligated to support all ideas being shared everywhere at all times.

                          Purism has nothing like a government’s reach; I’d be skeptical you could claim even major social media platforms are so critical to communication that banning certain kinds of speech there is equivalent to banning the ideas themselves. This is the basic premise of all forum moderation.

                          When a private group refuses to moderate its own platform, it’s not a principled stand in defense of freedom of speech because freedom of speech was never at risk. Most likely, it’s a principled stand in defense of laziness, because they don’t want the responsibility. Rarely (I think), it’s a principled stand in defense of whatever unpopular idea they’re being criticized for allowing to stay on their platform. I’d appreciate some honesty either way.

                          To be clear, I think the laziness argument is actually a valid one in some cases. But it’s important to admit that you’re declining that responsibility because it’s more investment than you’re willing to put in, and not try and cast it as a noble goal. In principle it’s not much different from choosing security policies - sometimes it’s not worth putting the effort in for the benefit you get out of it, and if you’re honest about that you and everyone who uses the thing will be better off.

                          1. 1

                            I really never understood this point of view. The slopes are not that slippery. You don’t need to allow people to say that other people should be killed, contained, or otherwise genocided in order to have a free society. You certainly are not obligated to give them a platform to amplify their voice. Hate speech is not equivalent to every other debate that a free society should be allowed to have.

                            Which one of “Black Lives Matter”, “All Lives Matter”, “Blue Lives Matter”, “White Lives Matter” is hate speech that can be legitimately banned in a free society? Which one of these slogans, if any, is shorthand for a set of political claims that imply that other people should be killed, contained or otherwise genocided? This isn’t an abstract hypothetical - this is an active political debate happening in the US right now that has a material affect on functions of the state such as policing policy and anti-discrimination law.

                            Calls like that made in the article for institutions like Purism who would like to run a social network to “take a stand against racism and nazis on their servers”, are necessarily calls that social network providers should make political judgments about exactly what speech is racist - and moreover, to make those political judgments in exactly the same way as the person calling for the censorship. There’s no reason why you should trust a social network that operates according to that principle - whether run by Purism or any other party - not to decide that something you think is important to say is a Nazi statement that can be legitimately banned.

                            1. 7

                              Which one of “Black Lives Matter”, “All Lives Matter”, “Blue Lives Matter”, “White Lives Matter” is hate speech that can be legitimately banned in a free society?

                              They are all a reaction to BLM in an attempt to drown it out: ALM is about “shut up, you’re not relatively important”, Blue LM is about “shut up, cops are awesome” and WLM is about “shut up, slavery wasn’t that bad”, or something like that. All of them are saying, “shut up black people, cops aren’t killing you that much or your deaths aren’t that important compared to our own problems”. The four slogans are not equivalent nor comparable.

                              I’m not sure any of these slogans on their own are legitimately hate speech, but they tend to accompany some other ideas that are more easily classified as hate speech.

                              It would go a long way if the government of the US more directly addressed the evident problems with the police. Doing so would clarify which one of those slogans is addressing a valid concern and which aren’t, and which associated ideas really do not need to be protected as free speech.

                              1. -1

                                You don’t get to re-write other people’s speech and then punish them for it.

                              2. 6

                                Which one of [these] is hate speech that can be legitimately banned in a free society? […] this is an active political debate happening in the US right now that has a material affect on functions of the state such as policing policy and anti-discrimination law.

                                It’s really not - I, at least, haven’t seen anyone saying that people should not be legally permitted to say any variation of “X Lives Matter”. Instead, there’s a lot of conversation about whether, when C ⊂ S, saying “C matters” implies “(S - C) does not matter”, which is clearly not the case.

                            2. 6

                              The issue with a simplistic approach to free speech is that a great deal of speech is extremely effective at silencing other speech. In practice, there is no such thing as absolute free speech, and one cannot claim that free speech for all must be an absolute good when people use speech specifically to stifle others. Fascists have understood this for decades, which is why they so vociferously demand free speech for themselves when they are out of power but deny it the moment they are in power. The alt-right has taken this lesson to heart in recent years, which is why all of modern social media – built with a naive belief in “absolute free speech” – has become such an effective tool for them.

                            1. 1

                              Although most of the dose was directed at the feet, a substantial amount would scatter or leak in all directions. Shielding materials were sometimes displaced to improve image quality, to make the machine lighter, or out of carelessness, and this aggravated the leakage.

                              Holy crap, this was a lot worse than I thought. For 50 years we had untrained people doing the work of radio technicians. All the way into the 1970s!

                              1. 1

                                Just imagine what they’ll be saying about us in 50 years.

                              1. 6

                                The only-linking or only-describing “technically correct” argument against copyright infringement has been eroded quite a bit. Courts have deemed links to be as infringing as the content they link to. Instructions on how to produce unauthorised derivative works have been considered abetting copyright infringement. Nintendo has already been aggressively taking down discussions and videos and whatever they can about this feat you blogged. They might order you to remove the repo and the blog post too.

                                I would be careful with what you have posted here.

                                1. 11

                                  Like I said in DM, if I get C&D’d, I’ll comply with the C&D. If I don’t, I won’t need to do anything. I have been keeping off-internet backups just in case.

                                  1. 3

                                    I read C&D as Conquer and Destroy.

                                  2. 3

                                    Courts have deemed links to be as infringing as the content they link to.

                                    They might order you to remove the repo and the blog post too.

                                    It would seem that in the face of clearly bogus laws, a legitimate recourse is to massively disobey them. I’m not really interested in sn64 emulators, but I’m going to clone this stuff just in case.

                                  1. 2

                                    I think that the idea of having branch-based conversations, visually, makes sense, as that’s what ends up happening in Twitter or Mastodon, and following threads is equally as hard on both of the platforms.

                                    Sadly, this specific implementation has a terrible UX. I would like to see this idea poured into a Mastodon frontend, for example.

                                    1. 1

                                      Yeah, I agree, it’s a an idea worth exploring even if the execution needs improvement.

                                      On the other hand, how is this different from normal chronologically-ordered and indented comment threads like Reddit or here?

                                      1. 2

                                        I think it can scale better with the conversation. It’s hard to follow conversations in both Reddit and here when it grows too much. The indentation becomes not-so-clear when a thread is longer than the screen’s height.

                                      2. 1

                                        There is no way forward.

                                        It needs a skilled Front-End developer … without that, the idea is dead.

                                        I have neither the time nor the interest to become one, and I don’t have the money to pay people. Also, I see no way to make money from it.

                                        There is no way forward.

                                      1. 26

                                        Don’t forget to read the ‘All That Said…’ at the end. It’s likely the most important advice in this whole list.

                                        1. 11

                                          Yeah, I wish this article had a better title since it was a good read and clearly written by someone with experience. The article (+ the medium.com domain) made me think it was going to be clickbait though.

                                          1. 4

                                            I thought it was going to be like the titular list in “10 Things I Hate About You” and the final point would be something like “I hate that I love you so much” or something like that.

                                            I guess it’s pretty close, though.

                                          2. 1

                                            This. I really wish that had been at the top, because some of these are pretty deep dives/issues at scale, and many people may not get to the end (especially if there’s an Oracle salesperson calling frequently).

                                          1. 2

                                            Sadly, I ran into a bug:

                                            https://github.com/larsmagne/meme/issues/5

                                            It’s probably related to how convert(1) handles svg. I’ll try to see later if I can find a fix or a workaround.

                                            Oh, and it has an unstated dependency on another package by the same author:

                                            https://github.com/larsmagne/imgur.el

                                            1. 4

                                              The P-value is the probability that you would have seen the same result if the hypothesis wasn’t true, purely due to other factors.

                                              It’s kind of subtle and a big reason why Bayesians don’t like frequentist stats, but this is not what a p-value is.

                                              A p-value is the probability that you would observe a result more extreme than the one you observed under the assumption that the null hypothesis is true. So you observed something with a p-value of 0.02. That means that under your current assumptions, you would only observe something more extreme 2% of the time in the long run.

                                              There is no probability statement associated to the actual result you saw. And you haven’t calculated anything under the assumption the null hypothesis was false. Your calculations and resulting numbers all assumed your null hypothesis was true. And there’s no probability statement associated with whether the null hypothesis is true or not. It’s either true or false, with probability 1 or 0.

                                              This difficulty of interpretation of the p-value is why Bayesians don’t like frequentist stats. Everyone always wants to be allowed to make probability statements about uncertain statements, but the frequentist framework just doesn’t allow that.

                                              1. 4

                                                Out of curiosity, does anybody call themselves a frequentist or defend frequentism? I’ve seen a lot of people identify as Bayesians but not the converse, and I’d really love to see a steelman of “frequentism”.

                                                1. 5

                                                  It used to be more common to be against Bayesian stats because they require more calculations and the choice of priors was questionable. Now that we have big computers and more consensus on priors, Bayesian stats have become feasible. There’s also the subjectivity of Bayesian stats, but I don’t think that’s as strong of a deterrent.

                                                  Anyway, yes, John Venn of the diagrams, for example, was the originator of the frequentist interpretation. And the whole framework of probability that we still teach to undergrads in math and science is almost completely frequentist too, again, because it’s what you can do when observations are difficult to obtain and calculating power is scarce. So perhaps only accidentally, a lot of mathematicians and scientists are supporting frequentism by teaching it so much.

                                                  Feller who wrote a very influential series of probability texts in the 1950s is probably a more modern anti-Bayesian. You can read about that here:

                                                  http://www.stat.columbia.edu/~gelman/research/published/feller8.pdf

                                                  1. 1

                                                    Possibly relevant article by Cosma Shalizi and Andrew Gelman, but I’m way out of my depth here: https://datajobs.com/data-science-repo/Bayesian-Statistics-%5bGelman-and-Shalizi%5d.pdf.

                                                  2. 1

                                                    Is it “more extreme (>)” or “at least as extreme (>=)”, please? My intuition is that > vs >= should not matter because we’re talking about real numbers so the boundary is infinitely thin anyway.

                                                    1. 1

                                                      In most cases yeah, > and >= are the same. It’s rare for hypothesis testing/confidence intervals on discrete distributions. I’m not quite sure what would be done there. Probably stick to >

                                                      1. 1

                                                        Thank you

                                                  1. 1

                                                    This appears to be US-only… Any chance there exists an EU service like that, giving out European phone numbers?

                                                    1. 2

                                                      You can view the current research that has been done on this for JMP at https://wiki.soprani.ca/EuropeanNumberProviders - perhaps the biggest issue is that carriers providing an SMS/phone API charge quite a bit more for numbers in Europe so it is much harder to make European JMP numbers price-competitive. Also, it is very hard (impossible?) to get short code and MMS (picture messaging) support.

                                                      If you know of other carriers not in the list on the above page, please add directly to that wiki page and/or let the JMP people know.

                                                      1. 1

                                                        Well, Canada too.

                                                        It appears they’re working on it, trying to make deals with, uh, “carriers”? Whoever needs to be made a deal with so other numbers are available. That’s what they told me in their support chat yesterday.

                                                      1. 2

                                                        Awesome!

                                                        I’ve been wanting something akin to this for a bit.

                                                        1. 2

                                                          What’s the reason you wanted this? I’ve just had a need for this because a lot of websites are using non-optional SMS 2FA, including my bank (which works with this!) and because I simply do not want a phone.

                                                          I’m used to being the only deviant without a phone, so why would anyone else want this service?

                                                          1. 2

                                                            I’ve been meaning to research the most “painless” way to send txts using a FreeBSD box. This seems like a solution for that. Also, anything that helps me avoid using my actual smartphone is a plus. Lastly, it’s nice to see Jabber is still around and there’s cool stuff to read up on.

                                                        1. 2

                                                          I just discovered that I can use this for SMS via XMPP. I can now send and receive texts from my Debian laptop. This is pretty convenient for the low, low price of 3 USD per month!

                                                          They say they’re about to raise their prices, but I assume it won’t be a drastic increase.

                                                          1. 2

                                                            D has had contracts for a long time, and Walter considers it a failure:

                                                            https://youtu.be/p22MM1wc7xQ?t=5669

                                                            (Audio isn’t great, but you can hear him).

                                                            He implemented them in his C++ compiler in the 1980s/1990s, nobody liked them, he added them to D, a few people liked them, now he’s thinking of removing them from D while C++ is thinking of adding them.

                                                            He says the idea looks good but almost nobody uses it. The problem is that nobody really seems to know what they’re for. You aren’t supposed to verify the data in the post/preconditions, which confuses people to the point of leaving the feature unused. It just seems like extra sugar on top of asserts.

                                                            1. 2

                                                              What are the security/privacy benefits of snap and flatpak?

                                                              1. 4

                                                                I’m not sure about flatpak, but I’ve done a little snap packaging. A snap package, roughly speaking, runs inside a container. The packager has to explicitly grant the package every right to break out of that container. Those rights include things like writing to the file system, using the GPU, or listening on network ports. The idea is that snap makes it more difficult for a package to “accidentally” overstep the boundaries set by the packager.

                                                                1. 2

                                                                  Read this https://www.ctrl.blog/entry/firefox-linux-flatpak-snap.html

                                                                  Containerized applications can prevent the discord client from doing various things with its read access to violate your privacy, among other things.

                                                                1. 18

                                                                  The hell is going on here?

                                                                  The web article is written VERY amateurishly. I am very annoyed each time they use the word “complex” (six hits in the article) when they mean complicated (complex means real and imaginary parts; any mathematical writing avoids the word with other meanings). The pdf paper even says that sqrt(-2) is an invalid expression! Moreover, 2nd degree ODEs are not that complicated, especially when they chose them to have elementary solutions! It looks like they consider a Bessel function (to cite one special function) to be an invalid solution. They sound awfully proud of themselves for “discovering” that some algebraic expressions (or “equations”, as they call them, even when there’s no equals sign) have a parse tree? wtf? Every CAS uses a parse tree for expressions, so why are you going on about this remedial stuff? And natural language processing often also does parse trees, so why are they saying that this doesn’t look like normal language?

                                                                  And then there’s their whole “accuracy” bit. Looks like they consider a solution to be innacurate if it involved a special function or if one of the Mas timed out. I mean, okay, so you trained a NN on a specific set hoping for elementary solutions and didn’t get them, and if the solution you got took too long or wasn’t of the right shape, you rejected it. That part of the paper is kind of interesting. But it’s also weird to claim superiority of their model when they handpicked the problems to make sure they had elementary solutions. Sure, the Mas could be improved to give elementary solutions, but this seems to be hyperspecialising and narrowly optimising for one case that doesn’t really arise that often in practice. “Most” ODEs do not have elementary solutions.

                                                                  1. 3

                                                                    This seems to be the impression I’m getting from other people too: the picked problem looks important if you don’t know the field, but if you do, isn’t actually that interesting.

                                                                    1. 1

                                                                      It’s facebook, it’s AI. The article is probably meant for people without specific knowledge of differential equations. Still, you make some good points.

                                                                    1. 2

                                                                      I am not a fan of ‘ads’ in my OS either. At least they don’t include telemetry/analytics and they can be disabled, I suppose. If you happen to use puppet/chef/ansible or other provisioning methods, these can be disabled from the get go.

                                                                      Beyond that, use Debian! It is Ubuntu without the dodgy inclusions (Amzn search, MOTD ads, who knows what else).

                                                                      1. 3

                                                                        Well, you send quite a bit of information to the Canonical servers:

                                                                        https://git.launchpad.net/ubuntu/+source/base-files/tree/motd/50-motd-news#n73

                                                                        This seems like telemetry/analytics to me.

                                                                        1. 1

                                                                          Isn’t this just for server version and not the desktop?

                                                                          1. 1

                                                                            Yep, it sure does! Thanks for the link, i had no idea…