1. 3

    I smelled that the author is pushing his own, so I went to see what’s going on.

    This is actually post-rationalization because although it gives a good rational, this is not really what’s going on. What is actually going on is that the modulus and division are connected.

    The way how they are connected can be described as: a = (a / b) * b + a % b.

    Division gives a different result depending on rounding. C99 spec says that the rounding goes toward to zero, but we have also had floor division implementations and systems where you can decide on the rounding mode.

    If you have floor division, the 19 / -12 gives you -2. That is correct when the modulo operator gives you -5. If you do a round-towards-zero-division, the 19 mod -12 must give you 7.

    On positive numbers, the rounding to zero and floor rounding give the same results.

    Also checked on x86 spec. It’s super confusing about this. If the online debugger I tried was correct, then the x86 idiv instruction is doing floor division.

    1. 1

      Forgive my extreme mathematical naivety, but a = (a / b) * b + a % b doesn’t make much sense to me. Given (a / b) * b will always equal a, doesn’t this imply that a % b is always 0?

      1. 4

        / in this context is integer division, not rational division, so e.g. 7 / 3 = 2.

        1. 1

          The division operator in this case is not division in the algebraic sense, and it does not cancel with the multiplication such that (a / b * b = a) {b != 0}. Otherwise your reasoning would be correct.

          To still make this super clear, lets look at 19 / -12. The real number division of this would give you -1.58... But we actually have division rounded toward negative (floor division) or division rounded toward zero, and it’s not necessarily clear which one is it. Floor division returns -2 and division rounding toward zero returns -1.

          The modulus is connected by the rule that I gave earlier. Therefore 19 = q*-12 + (19 % -12). If you plug in -2 here, you’ll get -5 = 19 % -12, but if you plug in -1 then you get 7 = 19 % -12.

          Whatever intuition here was is lost due to constraints to stick into integers or approximate numbers, therefore it’s preferable to always treat it as if modulus was connected with floor division because the floor division modulus contains more information than remainder. But this is not true on every system because hardware and language designers are fallible just like everybody else.

      1. 2

        Does anyone here use Bitwarden? I didn’t know about it, but it looks really attractive.

        1. 3

          Yes, it’s awesome. It’s also the only password manager that has a Firefox for Android extension (to my knowledge).

          1. 3

            Yes. It has some rough edges – I wish syncing was better – but it’s working great.

            My syncing issue has to do with the fact that everything has its own copy the data: desktop app, mobile app, browser plugins, etc. When you make a change they do not sync between them all immediately. You can have a Bitwarden app or plugin that is days behind so you have to go to settings and do a manual sync. Very annoying, but not a deal breaker.

            1. 2

              I use the venerable pass. It has none of this mobile mumbojumbo or autosync frills the kids today are talking about.

              It’s so simple and lean, I never thought pass git pull would be annoying.

              I would appreciate a mobile UI sometimes, though. A Sailfish client. But that’s not a dealbreaker either.

              Maybe I could hook the missus up with Rubywarden, though. Pass would be too much for her.

              Addendum: There appears to be a QML frontend on OpenRepos. Found through storeman. Not a complete client but have to give it a spin :)

              1. 1

                There is definitely a pass app for android. I’m not sure about iOS.

                1. 1

                  As someone who uses a mobile and two desktops, having passwords being synced across devices is a must-have. It’s just too much of a pain to remember to copy new passwords from my phone to machine A, then B, and vice-versa.

                  1. 1

                    Home desktop, work desktop, work laptop, work macOS laptop and hopefully soon two Sailfish mobiles running pass.

                    Made git pull a habit, not a chore, but ymmv.

              2. 2

                yeah, it’s open source and possible to run self-hosted as well.

                check out the discussion from a topic from a few days ago, id just be copying from there:

              1. 2

                I usually have one ‘fun’ fiction and a couple of heavier things going on at once, but I’ve run out of fun at the moment:

                • Beyond Good and Evil - Nietzsche
                • The Souls of Black Folk - Du Bois
                • Nausea - Sartre
                • The Gulag Archipelago - Solzhenitsyn
                1. 2

                  On the same note as The Gulag Archipelago, have you looked at Escape From Camp 14? I haven’t read it, but it’s been highly recommended to me. It’s about the labour camps in North Korea from the perspective of a defector. Probably not as reliable as a source as Solzhenitsyn is, but the excepts I’ve read seem to make it a “lighter” read (quotes because we’re talking about the life history of a man who claims he didn’t know that the outside world existed).

                1. 17

                  I’m often amused to remember that there are developers who want “bleeding edge” and rolling release and consider that to be “developer friendly”.

                  What I want more than anything else is to have my computer work the same day-to-day without fear of it breaking. When I do an update, I want to be to easy rollback if something breaks. When I do an update, I want it update the smallest possible number of components to get the change that I needed.

                  I’d be far more appreciative of articles like this if it was “why I like Arch” rather than “its developer friendly”. Its not “developer friendly”, its “you friendly”. I used Arch for a bit. Its a nightmare for someone like me, and… I’m a developer. That’s fine though. I don’t use it. For my Linux systems, I prefer point releases + long term support.

                  1. 7

                    I’m a developer too. At my workplace, the Arch users just upgrade their packages, and have a stable system for a decade, with a small risk of having to configure or force-install a package every N years. The Ubuntu/Mint people do a distro-upgrade or reinstall the system every N years.

                    I’m not sure which is worse, but there is more cursing and complaints from the Ubuntu/Mint camp.

                    1. 2

                      Maybe it’s just me (I like occasionally hacking on drivers and such), but I consider “developer friendly OS” to mean “friendly to developing the OS itself” (which is why I run FreeBSD -CURRENT).

                      Developing apps is not that special and doesn’t require much “friendliness”, IMO. Just having not-ancient versions of all common libraries/runtimes/etc. is enough.

                      That said, mainstream Linux distros like Debian/Ubuntu/Fedora do have an “unfriendliness” in terms of splitting headers into separate -dev / -devel packages. What are they trying to do, save 10kb of disk space per shared library?! Artificially inflate package counts? This is infuriating: “What do you MEAN pkg-config can’t find this lib– OH DAMMIT I need the dev package! What, why is libwhatever-dev not found, oh I need to search because it’s called whatever01despacito-dev-69420.0.0002 WHO EVER THOUGHT THIS IS A GOOD IDEA”

                      1. 2

                        I haven’t used Arch but I have the same intuition. I run debian stable on my desktop and servers and have very rarely found myself wanting anything more cutting edge.

                      1. 4

                        Something I like to use to set up a VPN in a hurry is the OpenVPN install script by nyr https://github.com/Nyr/openvpn-install It takes very little time to setup and is easy to use, but I could totally see how someone would want to avoid that script (youre blindly trusting some shell script, curl | sh style) in favour of a solution like the one presented in this post.

                        1. 2

                          I use that script too - spin up a lowendspirit box, run the script and you have a cheap VPN set up in a few minutes.

                        1. 4

                          I have a VPS with

                          • nginx
                          • a few instances of my blog engine
                          • wordpress (for a legacy blog that I haven’t migrated)
                          • git (various dev projects, content for the blogs, pass etc)
                          • couchdb (sync for a quantified self Android app that I use)

                          I used to run btsync, but have since switched to mega.nz. At some stage I’ll look at another self-hosted option.

                          I also have a lowendspirit VPS or two that I use for VPN.

                          1. 4

                            It’s interesting history is kind of repeating itself with Sony starting to grab market share from Canon, starting with high end full frame prosumer A7* series and eventually trying to sneak pro’s away with the A9.

                            Mirrorless as a thing is still something I’m skeptical on, mostly because of battery life, but you have to hand it to Sony that they’re making progress and the results are pretty impressive.

                            1. 6

                              It’s interesting history is kind of repeating itself

                              It goes even deeper. Canon is pulling a Nikon now, by releasing near-insulting refreshes of their top-tier cameras the 5Dmk4 and 6Dmk2, both worse than older (!) Nikon equipment, whereas the recent Nikon releases have been received very well. One might suspect Canon themselves have given up on DSLRs. They seem to be stuck in eternally rereleasing the same 24 megapixel sensor all the time.

                              I think in the long-term mirrorless is inevitable and it looks like Canon has finally gotten its shit together to produce EOS M cameras which are starting to get competitive with their EOS bodies. Nikon is also expected to release some mirrorless camera this year. I’m sure the first models will be terrible to begin with but in a few years I can definitely see me switching from a D750 to a Nikon mirrorless. Or Sony mirrorless.

                              1. 2

                                It’s kind of sad though that newer Nikon pro gear (everything on the NPS list) is built to lower and lower standards, with production offshored to China or Thailand, while Canon pro equipment is built to better and better standards in Japan, and it’s cheaper than Nikon!

                                I much prefer the Nikon ergonomics and the features of Nikon cameras, but the lenses produced today, while of great optical quality, feel cheap and awful. Canon lenses on the other hand are made of metal (the good ones), and feel like a tank.

                                1. 1

                                  There is some truth to the quality issues and I think everyone, even the most ardent fans, have to agree. The cameras are still what they have always been. But the core lenses continue to increase the plasticy feel which I think just bothers a lot of people. Canon’s core pro L lenses feel very much like Nikon’s Ai-S and first generation AF-D lenses when there was still an aperture ring. I am hardly one to beat up gear but my 70-200 has stopped working twice which really bugs me.

                                2. 1

                                  I don’t feel like Canon is in a rush to move to mirrorless (IMHO, the benefits are minimal for protogs).

                                  What they are getting beaten on is sensor quality; no BSI in 2018 is a sign they’re not investing in their in house sensors enough.

                                  All it would really take is bringing the sensors up to speed, and adding some better 4k video handling in the 5d series (you can now at least get c-log output) and they’d be competitive again.

                                3. 1

                                  I’ve switched to mirrorless. Thing almost fits in my jacket pocket - if I saved up for a non kit lens it would, actually, fit in my jacket pocket. I’m a casual shooter. Batteries are not an issue - I carry two spares with me, just like one would carry film in the old days. The auto focus is on par with my consumer level Nikon DSLR, the low light performance is phenomenal. For casual shooters, can’t think of a reason the SLR format should survive.

                                  1. 6

                                    I mostly shoot slide film. I have a Nikon F4, a Nikon FM3a, and a Nikon FA, and a bunch of old, manual focus AI-s lenses. However, I want to shoot digitally too, so a bought a Fuji X-T10. I have been using this camera for about two years now, and have taken many great pictures with it, but I hate it so much, so much. I can’t wait to get rid of it and buy a Nikon DSLR.

                                    Let’s start with the good stuff. The good Fuji cameras and lenses are built to the highest mechanical standard. I wish new Nikon lenses were this good.

                                    That’s all the good stuff I can think of, now the bad stuff:

                                    The camera is small, but the lenses are just as big as modern DSLR lenses. This means the camera is too small for proper hand-holding technique. When assembling a system, the total weight is little bit lower than a DSLR kit, but the bulk is not significantly smaller at all, and I am constrained by bulk, rather than weight.

                                    Focus by wire works poorly. In fact I would say it’s impossible to use. Never again. But even if where were lenses which didn’t focus by wire, you still could not manually focus because the resolution of the EVF is too low for critical manual focus. On a tripod you can zoom to 100%, but handheld, no way. On the other hand I use a split prism focusing screen on my SLRs, so this is never a problem.

                                    The ergonomics of the camera are bad. I can’t use it with gloves. I can use a (D)SLR with gloves.

                                    The software on the camera is terrifyingly bad.

                                    The flash system is weak.

                                    In low light, or for sports, autofocus is useless. There are some mirrorless cameras out there that do better AF than even DSLR, but only the top-of-line stuff.

                                    The colors I get from this cameras are not great. This is not a problem with the camera, but with the color profiles used by desktop software. However, it is what it is. I can’t really do anything about it. You can make custom profiles, but it’s much harder than most people realize, and if you do it you’ll get a metrologically correct profile, which is not what I want. Nikon and Canon profiles are non-flat in a way that I like, and I can’t really emulate that.

                                    Speaking of color profiles, Nikon allows you to load custom profiles in-camera. This is huge, because even if I shoot RAW, I need to make decision in the field based on the JPG preview, so it’d better be what profile I’m going to use anyway.

                                    All lenses use different filter thread sizes. This drives me nuts.

                                    Battery life is poor, and extremely poor in cold weather. A pro DSLR can take Lithium primary AA batteries that work at -40C.

                                    Again, not a problem with the camera, but with Adobe software, but Adobe does a very poor job on Fuji raw files. I use Iridient Developer to convert Fuji raw files in DNG, but that makes the workflow slower and uses twice the amount of space (assuming I want to keep the originals, which I do).

                                    Oh yeah, camera takes too long to boot.

                                    I would like a mirrorless camera, but it would have to work differently than they work now.

                                    Personally, I want a APS-C/FF camera (micro 4/3 is too small) that has small lenses. I want a 16-35/f8 and a 70-300/f8-f11 (35mm equivalent). When doing landscapes, I shoot at those small apertures anyway, so i’d like small lenses. You couldn’t make such slow lenses for DSLRs, because they would be too dark in the viewfinder, but with mirrorless you could. With small lenses, the camera can be small too, as it won’t feel unbalanced. The lenses must of course use the same filter thread size, and it should be possible to operate the camera with gloves. The camera should boot instantly. The camera should close the shutter when changing lenses (why don’t mirrorless cameras do this??).

                                    If you can’t make small zooms, I’d be happy with small primes. 20mm, 85mm, and 200mm are all I need. If you kake them f/4 you should be able to make them, really, really, really small.

                                    Oh yeah, and I’d like some tilt-shift lenses too.

                                    1. 1

                                      If you haven’t got one already, I can recommend a Nikon D700 as the almost perfect “digital FE2” camera.

                                    2. 2

                                      In our household we solved the problem of size and weight by me carrying all photo equipment and playing assistant to my wife, who has the talent and skills. Not for everyone but I am happy with results :)

                                      1. 1

                                        I’ve switched mostly to an X100 for the past few years. However the DSLR is still ‘needed’ for two things - kids sport and product/portrait shots for my wife’s seamstress business. The second could be mitigated by switching to a interchangeable lens mirrorless, but then I lose a lot of what I love about the X100.