And with PostGIS:

    select company, city, location
    from walmarts
    where st_dwithin(
        'SRID=4326;POINT(40.94 -74.05)'::geography,
    1. 2

      Is someone aware of an efficient shuffling algorithm that is biased for something like shuffling playlists? I basically want to put tracks into nested buckets (artist -> album) then shuffle each bucket and distribute each track as far as possible. It should then distribute the tracks from the same artist as far as possible and also distribute tracks from the same album as far as possible.

      There are implementations, but I would like to know if there is something better.

      Spotify used to do Fisher-Yates shuffle but switched to an algorithm like this.

      http://keyj.emphy.de/balanced-shuffle/ https://labs.spotify.com/2014/02/28/how-to-shuffle-songs/ https://cjohansen.no/a-better-playlist-shuffle-with-golang/


        Spontaneous thought: Fisher–Yates picks the next element uniformity in the range [i,n] – why could you not pick using another distribution defined by similarity to the previously locked song? With dynamic programming you should be able to get a reasonably efficient and optimal solution.


          I think that’s pretty much state of the art. You can get better results in some cases by starting with a larger target array. Say 4x the number of inputs. This reduces the number of collisions.

          I didn’t fully follow the last example, but I think it’s possible to do better than trying to pile the first track into index 0 every time.

        1. 4

          Something that has been annoying me for a while now: I feel like there is this intuitive connection between Fisher–Yates and reservoir sampling, but I haven’t been able to see it yet.

          To sample k items from a finite, known, sequence, you can very efficiently just do the first k iterations of a Fisher–Yates shuffle and take the k first elements.

          If you want to sample from a (potentially infinite) stream, you can do reservoir sampling, where you in principle, for the ith element observed, randomly select a location j in an imaginary sequence of size i, and place that element there. Then once the stream is consumed to a satisfactory degree, you return the first k elements from this imaginary i-sized sequence. (Obviously in practice you just throw away any element that lands on a position j > k, since you’ll never see it anyway.)

          Maybe I’m looking for a similarity when in fact there’s some sort of duality going on? I’m not sure.

          1. 1

            I’m not sure if there is some kind of equality or duality going on. I recently learned about reservoir sampling (with a reservoir of size 1, so essentially randomly selecting an element from a stream) from Jeremy Kun’s site, and noticed some parallels as well. Here’s my naive analysis (naive, because I don’t have any particularly interesting observations).

            Both methods work inductively: first they work on an array/stream of size 1. That is, Fisher-Yates randomly permutes the elements (of the complete array) over an array of size 1. Reservoir sampling picks a uniformly random element from the stream of size 1. Further, both methods use uniform sampling, where each element has a probability of 1/n to be picked.

            Of course, the most notable difference is that Fisher-Yates operates on a stream of known size, and reservoir sampling on a stream of unknown size.

            1. 2

              Of course, the most notable difference is that Fisher-Yates operates on a stream of known size, and reservoir sampling on a stream of unknown size.

              Or, in other words,

              • Fisher–Yates iterates deterministically through all positions of the k samples returned, and selects elements for them by randomly selecting among the items not yet included in the sample.

              • Reservoir sampling deterministically iterates through all items not included in the sample and selects the position for them by random selection.

              So in that sense, they are doing opposite things in a way…

          1. 1

            I have used phabricator now for a while, where all “pull requests” count as drafts and the system has strong support for it. I really, really like that workflow, so I’m glad at last github will get some of it.

            1. 12

              The only issue I have with Irrsi which WeeChat handles perfectly is a lack of proper documentation for API and commands - for example, there’s no list of built in statubar items with their descriptions. Themes are also a work of continuous trial and error.

              It’s really weird, regarding the fact that irssi is 25 years old right now, more or less, so it had enough time to be documented like a boss. But this might just a spark of wild 90s where no one cared about docs, but people learnt irssi from each other’s and knowing it was somehow the “common knowledge”, keeping the details away from users would be also a way to prevent “lamers” from doing anything beyond average use unless they can read the source code, which isn’t a piece of art either.

              Yes, I had to read an irssi source to understand how to configure it in the way I needed to. And no, this is not a “self documenting code”.

              1. 4

                thanks for checking out the changelogs ever now and then.

                sometimes even complete documentation still leaves me confused…

                however I do not believe there was any intention to fight off lamers ;) rather simply no one has the time or passion to contribute good docs

                1. 1

                  If you don’t mind me asking: Why are you using Irssi and not Weechat, then? I switched from Irssi to weechat years ago (when it seemed like Irssi had nothing to offer over weechat anymore) and may be out of the loop in terms of new Irssi developments I’m missing.

                  1. 1

                    I didn’t say that I use irssi anymore… :) Switched to WeeChat in ~2010-2012 (that 0.4.x version branch which lasted quite too long), but I’m occasionally checking out irssi changelogs and the program itself.

                    (and I’m quite missing it, especially the formats system)

                    1. 1

                      Same here, made the switch around 2014. Even Irssi seems have lower memory footprint on start, it randomly run into memory leaks after running for a while. Weechat is on the opposite, consuming lots of ram on start and didn’t quite increase after couple of months.

                      1. 3

                        Wow – I have run Irssi for literally years at a time without leaking. My setup is barely customized though.

                        1. 2

                          My friends and I have a running joke where our reaction to beefy computers are, “What, are you gonna run ${MUTUAL_FRIEND}s Irssi or something on it?” Thanks for reminding me about how that joke originated!

                          1. 2

                            I think you haven’t used plugins and their scripts too much :)

                            The memory footprint stability is quite new, I remember when WeeChat had memleaks and really choked up one of my machines (which wasn’t that weak), mostly because it couldn’t keep up with buffers.pl. At the end, FlashCode decided to rewrite that de facto standard script as a WC builtin. Same foriset and fset.

                            1. 1

                              we are not aware of any leaks and if there are some we want them fixed

                      1. 0

                        This is interesting, but also unsurprising, as writing correct C or C++ may as well be impossible for anything but trivial programs.

                        I don’t see why this post is tagged with rust, considering Ada is a much better language and, unlike rust, has actually been used in critical software with real repercussions, along with having real standards that don’t constantly change. Ada has an ’‘always safe unless you explicitly use a subprogram that can violate the rules’’ attitude, whereas rust has an attitude of ’‘you can do whatever you want in the strait jacket and if that’s too restrictive you’re on your own’’.

                        It’s possible to write a large and featureful Ada program without using anything unsafe, whereas it’s my understanding this isn’t practical at all with rust.

                        Ada is used in rockets and automobiles and other situations where people die unintentionally if things go wrong. Rust is used in Firefox. That says it all, really.

                        1. 12

                          Are there stats on how widely Ada’s used? My understanding was the people who use it really like it, but most automobile code is still in C.

                          Rust is used in Firefox. That says it all, really.

                          Rust is much younger than Ada, so we can’t infer much from this.

                          A more interesting question: how much Ada code in the wild is Ada12 vs an older version?

                          1. 8

                            I agree it is irrelevant to tag it rust, I’ve removed the tag.

                            Some notes:

                            whereas it’s my understanding this isn’t practical at all with rust

                            that isn’t true, you can write large and featureful programs without it.

                            Ada is used in rockets and automobiles and other situations where people die unintentionally if things go wrong. Rust is used in Firefox. That says it all, really.

                            that feels fairly dishonest to me. Also, the browser is a security-critical component deployed on essentially every user-facing computer manufactured. I can’t think of a more important place to have very safe tools. Reminds me of that (possibly apocryphal) story about memory leaks and cruise missiles.

                            1. 7

                              It’s definitely possible to write large Rust programs with very few or no uses of the unsafe keyword. It is the case though that the Rust standard library sometimes uses unsafe-marked code with safe abstractions wrapped around it. Ideally these safe abstractions should actually be safe, but it’s possible in principle that there’s a bug in one of those abstractions that lets the memory-unsafe behavior leak in certain circumstances.

                              I’m curious if this is the case for Ada as well - does Ada also wrap unsafe abstractions in ostensibly-safe ones that might prove unsafe because of a bug, or does it have some way of guaranteeing the safety of those safe abstractions themselves?

                              1. 4

                                I think it’s mostly that Ada puts safety at the top, and will add checks to code, whereas the Rust devs have convinced themselves that they can get C++ programmers to switch if and only if there’s never any runtime penalty for safety.

                                1. 11

                                  Yes, Rust aims slightly different as Ada. If Ada checks all your boxes and the runtime properties are fine with you, by all means, use it.

                                  I also heard from some Adacore people that they enjoy having Rust as a competitor, as it brings their topics on the table again and raises awareness.

                                  1. 1

                                    I was thinking AdaCore should become a supplier of Rust IDE’s, a second compiler, a provable subset like SPARK, and corporate libraries. They might even help improve Rust language with their experience.

                                    They can continue supporting Ada for legacy customers while simultaneously having a lucrative transition path to Rust. Maybe even automated tooling they make some consulting revenue on, too.

                                    1. 1

                                      I’m not trying to badmouth Rust, I’m a big fan. I’d be using it right now if there was any sort of stable UI solution that was made within Rust (not bindings to things like QT and friends). For now it seems there’s a lot of churn in that space, with too many projects too young.

                                      1. 2

                                        All good, I didn’t understand it as such. I just wanted to make the point that we see Ada as a competition we can grow with.

                                    2. 1

                                      Do existing Ada implementations have moderately-quick compile times?

                                    3. 1

                                      it’s possible in principle that there’s a bug in one of those abstractions that lets the memory-unsafe behavior leak in certain circumstance

                                      No, it actually happened, not long ago, in the standard library.

                                      1. 14

                                        Yes, and we’re quite upfront about that. I hate it when some people paint it in another way. There is a point where you need to take a fundamentally unsafe thing (memory and processors) and start building a base of a safe system.

                                        There are advantages in Rust, e.g. being able to fix that abstraction in one go and and update, by people sharing it, but the danger is there.

                                        That’s also the reason why there is a large ongoing project that formalizes lifetime, borrowing and multiple types that we consider as important as primitives (e.g. Mutex). They regularly find subtle bugs. Not day-by-day, but like, every quarter.

                                2. 1

                                  This is an unfair comparison as Ada is what 40 years old whereas Rust is 10 years old.

                                  1. 13

                                    Rust, in a fashion that can be adopted, is ~4 years old. Before that, it can be considered a research language.

                                    Also, for that reason, I have no problem with it currently not being used in high-safety-critical places, this is a thing that has to build over time. And I want people to take that time.

                                    1. 3

                                      I applaud your honesty in saying that.

                                    2. 6

                                      I see that only as a point in Adas favor in this context, where”tried and true” Actually means something.

                                      I’m not neophobic; I love exciting new technology as much as the next guy. I even like seeing new developments in the “safer alternatives to C” category, which is something that sorely needs constant research and new inventions. I just think that all else being equal, the older tech has a leg up simply for being older, in this area.

                                      Rust is a fantastic breeding ground for ideas, and I’m convinced that at some point, Rust (or something like it) will be so obviously superior to the Ada dinosaur that it will be better dispute its age difference. We’re just not there yet.

                                      1. 1

                                        Isn’t that “leg up” the reason why Adam said it wasn’t a fair comparison?

                                    3. 0

                                      I don’t agree with either language in this context. I like Rust well enough, and Ada might be cool though I don’t know much about it, but there’s zero chance of Microsoft moving any of their critical codebases to either. Getting them to stop active development and get serious about static analysis, fuzzing, etc might be possible. Gradually converting some things over to a safe subset of C++ might be possible. A total rewrite of their major products in an unproven language is a non-starter.

                                    1. 3

                                      Ahh, estimates… The favourite toy of idiotic bosses that think they can increase a team’s productivity via passive aggression.

                                      If you’re working in an environment where your estimates are used against you as deadlines, you’re playing a game with no winning condition. If you estimate honestly and perfectly, you’ll be late 50% of the time. If you overestimate you’ll be blamed for overestimating, especially since the juniors around you will keep estimating a fraction of the time (and overshoot the deadline that much worse, but that’s irrelevant).

                                      Some people don’t deserve to have programmers working for them…

                                      1. 3

                                        If you estimate honestly and perfectly, you’ll be late 50% of the time.

                                        This was very well put. I even had reason to quote it just a few minutes later, in relation to something completely different. It’s applicable to any situation where there is non-zero variance and it’s bad to land both over and under the mean.

                                      1. 10

                                        On this topic, Richard Gabriel’s ‘The End of History and the Last Programming Language’ is a great read from the past. It goes into why so many languages look like C and what it takes for a language to be successful. It’s funny that elsewhere around the same time he predicted that if C was ever replaced, the replacement language would look like C and be more dynamic. This was before Java. Javascript took it even further.

                                        (essay begins on p13 of the PDF)


                                        1. 4

                                          Thanks for the pointer – I have this book! I bought it maybe 10 years ago after enjoying a lot of Richard Gabriel’s writings.

                                          I didn’t remember the essay but went back and read it. What really struck me is how much the world changed since he wrote it.

                                          The last line is Right now the history of programming languages is at an end, and the last programming language is C. That line doesn’t appear to have aged well, but I would say that he’s correct in the sense that C turned out to be a great language for writing other languages, and it has almost no competitors in that regard. Python/Ruby/JS/JVM/etc. are all written in C or C++.

                                          He was also wrong about C++ – he predicted it would fail because the performance model was too complex, and that it required too much mathematical sophistication.

                                          Instead it was a fantastic success in terms of adoption, with every browser being written in C++, and languages like Rust and Go being specifically designed to replace C++. Even if you discount all existing C++ code, I’m sure there’s more of it written every day than Rust and Go combined, maybe even 10x more.

                                          I would say that C++ succeeded because of compatibility with C. That’s pretty much it. Every other reason is dwarfed. Parts of it require an incredible degree of “mathematical sophisitication” (his term), and it’s often not straightforward to reason about its performance from the source text, but that doesn’t matter. Compatibility wins.

                                          I feel a little bad for Gabriel, because RIGHT after he wrote that essay, there was a huge change in the landscape of programming languages.

                                          I would say what really dictated the change in languages was the platforms – the Web, and then mobile phones. The Web gave us Perl, Python, PHP, Ruby, JS, etc. He mentions this, but it isn’t the core of the essay.

                                          The four points to his theory are:

                                          1. Language are accepted and and evolve by a social process
                                          2. Successful languages must have modest or minimal resource requirements
                                          3. Successful languages must have a simple performance model
                                          4. Successful languages must not require users to have mathematical sophistication

                                          I would say that #2-#4 were true in the 1990’s for competitors to C, but they are no longer true, because the environment changed. Computers got bigger and server computing became more important. Python and Ruby are FAR from the most efficient languages, even for interpreted languages. They have tons of bells and whistles and hidden indirection that even Lisp didn’t have.

                                          #1 is of course true. It feels obvious at this point, but that’s not a knock on Gabriel writing in the 1990’s.

                                          I would say the most important consideration now is compatibility with existing code, and a smooth transition path from legacy code.

                                          This theory predicts TypeScript over other JS alternatives, because it appears to be the one with the smoothest transition path.

                                          Another example is that (obviously) ANY systems language needs some kind of C interop to be adopted. It can’t start the world from scratch again. C++ interop is even better, although that is a very difficult problem.

                                          Anyway thanks again for the pointer… It was a good read, but it did remind me of how much the world changed. He talked about “local wizards” porting languages too, but this is in an era when people learned programming from printed books (as I did) rather than the web, and before git, Github, etc. I hope Gabriel is happy with the language diversity we now have!

                                          EDIT: In retrospect I contradicted myself – there are 2 important factors: compatibility, and drastic changes in the computing environment, and the second is probably more important. Maybe AI or quantum computing will change everything. I don’t think that will happen in the next 20 years, but it’s possible.

                                          Then again, Unix has not only survived, but thrived, throughout the Web and mobile era, with perhaps a dip in the PC era. So despite drastic changes, we’ll likely still have much of the same code and languages around. It seems like what happens is that systems get added to, rather than replaced. It’s rare that anything gets replaced.

                                          C will still be there, and Python will still be there, but maybe they’ll be sitting below something else, like magic intentional AI code :)

                                          1. 2

                                            I would say that he’s correct in the sense that C turned out to be a great language for writing other languages, and it has almost no competitors in that regard. Python/Ruby/JS/JVM/etc. are all written in C or C++.

                                            Does that make it so, though? I hold a healty dose of skepticism toward any language that is not implemented in itself. And, perhaps surprisingly, many languages are fortunately made with that kind of obvious dogfooding in mind. So maybe it’s not that C and C++ are particularly great at the task, but that they are the most popular languages so you’d expect them to be used for more of everything – including compiler construction.

                                            1. 2

                                              Yeah I should say I don’t think C is a great language for writing other languages, from the viewpoint of 2019. My own language Oil is not written in C :) I’m explicitly trying to avoid too much low-level detail in the implementation.

                                              But it is absolutely great compared to assembly! Language designers don’t worry about portability nearly as much as they used to, largely due to C. And LLVM, which is written in C++.

                                              C really is portable assembler. And that was a huge advance for the field of programming. It used to be that programs were obsolete when the hardware they ran on became obsolete!

                                          2. 1

                                            Nit pick: I’m seeing the essay on page 122 of the PDF (or 111 by the numbers at the bottom of the page).

                                          1. 10

                                            This is what I posted to a similar topic over on reddit r/selfhosted recently:

                                            Data Center

                                            Dedicated FreeBSD 11 server on a ZFS mirror, from OVH. The host is very slim and really just runs ezjail, and unbound as a local resolver. All the action happens inside jails.

                                            • MySQL jail - provides database in a “container” for the other jails
                                            • PowerDNS jail - Authoritative DNS server, backed by MySQL
                                            • LAMP stack jail - a place to host web pages with apache and PHP, for the most part. Using PHP-FPM with per-vhost chroots and UIDs. Containers within containers! Very happy with this setup. Notably hosts:
                                              • Ampache - which the whole family uses for mobile-friendly music streaming.
                                              • Chevereto - image hosting
                                              • NSEdit - Web app for managing our DNS server.
                                              • WP Ultimate Recipe - recipe database built on wordpress
                                              • Wallabag - read-it-later article saver like Pocket
                                              • Lots of WordPress sites for friends and family and assorted custom scratch-built things and experiments
                                            • NextCloud jail - NextCloud on nginx + php-fpm. In it’s own jail to keep it completely separated. The whole family uses it for files, calendars and contacts.
                                            • Minecraft server jail
                                            • Email jail - Custom email hosting setup built on Postfix, Courier-IMAP, Maildrop, MySQL, Apache, PHP. I’ve been hosting my own email since the 90s.
                                            • Legacy jail - Really just the old server, that went P2V two or three server moves ago - so easy to do when everything lives in ZFS jails. This is deprecated and I have been moving things off it (very slowly).

                                            Home Network

                                            PoS old FreeBSD 11 server with a ragtag collection of hard drives on ZFS. It’s mainly our home NAS, storing our media, but also hosts:

                                            • Nagios jail - Network monitoring and notification
                                            • Asterisk jail - Home and office VoIP
                                            • Assorted experiments and goofs

                                            Raspberry Pi 3A - Kodi in the livingroom, playing media from the NAS

                                            Raspberry Pi 2A - Custom dashboard app showing server/network status and weather and stuff.

                                            Raspberry Pi 1A - Running sprinklers_pi to control our lawn sprinklers.

                                            Remaining Pain Points

                                            Still getting a decent KeePass workflow established

                                            Need to setup a VPN at home

                                            Still don’t have Ampache sharing working. It should be easy for me to tell a friend to, “listen to this song” or “this album”. Need to get a good beets workflow going to clean things up.

                                            Need to pick a wiki for a family knowledge base.

                                            Asterisk is crusty and no one is developing personal-scale VoIP managers, because everyone just uses cell phones these days.

                                            Need more hard drives.

                                            1. 4

                                              Would you be willing to move off KeePass to Bitwarden? Did it myself a while back using bitwarden_rs. Super easy to host and everything Just Works™. Also would allow groups for shared passwords between the family.

                                              1. 2

                                                What kind of KeePass workflow are you looking for? I have personal and shared key databases in KeePassXC, and share the shared ones with SyncThing – I assume NextCloud could do that level of file sharing for you. I’m very happy with it so far, but it’s also so trivial I suspect you’re looking for something beyond that, no?

                                                1. 1

                                                  So, I have KeyWeb on OSX, and pair it with ChromelPass in Chrome. I save my DB inside a NextCloud folder so that it is available on my other devices/platforms. I like it generally, but it always seems to be locked when I want to add something to it, so I have to type in a high-entropy password and select the key file, and by that time ChromelPass has forgotten that I was trying to save a password and given up. So like I log out and back in, and save the password, “now that I’m ready”. It’s not as integrated or smooth in chrome as the built-in password db, so it’s easy to forget it, and I always have a sense of, “but do I really have it saved?” on new additions.

                                                  I don’t actually have an Android app yet. What do people use there?

                                                2. 1


                                                  Yep, personal-scale VOIP doesn’t quite make sense when most folks having unlimited call and internet calls. I’ve only seen personal VIOP on my friend family. He has parents living abroad and it’s easier to deploy VOIP rather than teaching them how to use APPs.

                                                  1. 1

                                                    How’s your experience with Kodi? My annual Plex sub has just renewed so I’ve got plenty of time to look up a replacement, but they’re adding a bunch of crap I don’t want, and don’t seem to be fixing things that annoy me so I’d like this to be my last year at that particular teat.

                                                    1. 4

                                                      Kodi, like Plex, has garbage UI full of extremely frustrating UX quirks. But, in my house, it’s still my main way of consuming my library (with an nvidia shield as the client). But they also serve different audiences: Kodi is hard to serve externally and is mostly just a client, while Plex is good at remote, shared access and solving the server side.

                                                      1. 2

                                                        It works well. It’s not a great UI. The family is comfortable with the Roku UI even though it is terrible and they complain about it. If there’s something on both, they’ll play the one on the Roku first every time. Searching is meh. Playlist building is straight-up user-surly. Indexing is hit-or-miss and needs a lot of interventions. Actual video playing is great. Playing music through it is not fun.

                                                        1. 2

                                                          I’ve looked into plex alternatives as well. Emby was kind of interesting, but they recently closed some of the source, and then there was a fork of it by some members of the community. Going to wait and see how that shakes out.

                                                          Universal media server (UMS) paired with Infuse (appletv/ios) is kind of interesting – the main drawback is how large the local storage usage in infuse gets, and how slowly it builds the first time. If only it pulled more metadata from the server at runtime. I tried pairing infuse with plex (recent supportly configuration), and it had the same issue with local storage size and slow initial build time. It’s unfortunate, because otherwise I found it fairly decent (UI/UX).

                                                        2. 1

                                                          What’s your experience been like with Chevereto? I’m in the market for something very much like it, and I see it mentioned a fair bit, but I don’t run any other PHP/MySQL things so I’m a bit wary.

                                                          1. 2

                                                            Minimal, honestly. I set it up and it runs nicely, but I haven’t really used it heavily.

                                                          2. 1

                                                            Nice list. Have you considered to run a database in each jail instead of having a dedicated MySQL jail? I have been looking for a discussion of the pros and cons of both approaches.

                                                            1. 2

                                                              Yes. I mean, 15 years ago I had one server with no jails/containers/etc and everything was just stacked in one big messy pile, and we all know what happens with that over time and upgrades. I moved that whole thing into its own jail, just to draw a line around the mess, and started a new server layout, with pieces in separate jails. I love having stuff compartmentalized into its own container so that upgrades are never an issue. I never have to, “upgrade PHP because upgrading MySQL upgraded gettext which now conflicts with, bah! no!” If anything, I am moving (carefully) towards further containerization right now. For instance, I’d like to have PHP in it’s own jail separate from the web server, so that I can run several versions and just pick which socket to connect a site to in the config. But as you guessed, it is a balance. I never want to get into installing simple docker web apps that each install a web server and a db server and duplicate each other in stupid and wasteful ways. On the other hand, for somethings, it is nice to have a self-contained “package”, where if something got busy enough to need it’s own server, I could just move it to bigger hardware in one shot.

                                                          1. 9


                                                            In two intervention-based field studies of corporate headquarters transitioning to more open office spaces, we empirically examined—using digital data from advanced wearable devices and from electronic communication servers—the effect of open office architectures on employees’ face-to-face, email and instant messaging (IM) interaction patterns. Contrary to common belief, the volume of face-to-face interaction decreased significantly (approx. 70%) in both cases, with an associated increase in electronic interaction. In short, rather than prompting increasingly vibrant face-to-face collaboration, open architecture appeared to trigger a natural human response to socially withdraw from officemates and interact instead over email and IM.

                                                            1. 3

                                                              Open plan offices were always about saving cost on space and not about making people more productive. It’s another instance of short term thinking and cargo culting. The irony is that the best way to save money is to not have an office at all and just buy into being entirely remote with an occasional biweekly or monthly “office” gathering. This idea is for some reason more radical than packing people into an open space with no affordances for blocking off noise and distractions other than buying them headphones.

                                                              1. 3

                                                                I think the motivation for open plan over remote is the (IMO correct) assumption that in-person communication is more effective that electronic in most situations. But it doesn’t cater for the fact that everyone essentially becomes “remote” in a tightly packed open plan office.

                                                                1. 2

                                                                  I think a lot of people already know the cost of open plan offices outweigh the savings on square meterage. One of the arguments that I actually believe is the flexibility of rearranging furniture as opposed to walls. E.g. a company that experiences a growth spurt can much more easily cram a couple of extra desks in as a temporary measure while looking for larger offices. It’s a tragedy the temporary solution becomes permanent.

                                                              1. 2

                                                                Looks nice! The landing page would be a bit more readable if it didn’t have the animated gif on the side, it is very distracting.

                                                                Though I wonder if it is not a solution looking for a problem, why would someone want to read my notes as a presentation? I usually just want to convert my own notes into a presentation so that I can present them. But then I typically want a different granularity than presenting per sentence. I have good experiences with the following tools doing that:

                                                                • org-mode: does everything from simple notes to Jupyter-like notebooks with in-line code execution. Supports export to LaTeX beamer, S5, reveal.js, etc.
                                                                • pandoc: converts between various formats, including Markdown to LaTeX beamer, S5, reveal.js, etc.
                                                                • Deckset: native Mac app that allows you to present Markdown files, with PDF export. Has great support for source code listings, highlighting in steps, etc. I don’t like the formatting as much as LaTeX beamer, but it is particularly useful when I am in a hurry.

                                                                My favorite among these org-mode, since I can generate graphs and such directly from the document.

                                                                Of course, I might just not be in the target audience.

                                                                1. 3

                                                                  Thank you for the feedback! Yes, the gif is distracting. I’ll see how to give the crux of the app without the gif.

                                                                  This largely came out of my own itch. Just like you, I organise my thoughts into notes because that works better than slides, titles and content. Eventually I want to convert it into a rough presentation with absolutely zero effort, re-organising. And that’s how I ended up building one.

                                                                  The tools you’ve mentioned look good. There’s no reason why Writango is better than those if you are looking for serious re-organization of notes into presentations. I guess Writango is for the not-so-serious, rough ones :)

                                                                  1. 2

                                                                    Sounds fair. It definitely has a less steep learning curve than org-mode or pandoc.

                                                                    Keep up the good work!

                                                                  2. 1

                                                                    How do you generate graphs in org mode?

                                                                      1. 1

                                                                        My personal favorite is ggplot through R. I suspect for interactivity that Python/bokeh might be an option that works well.

                                                                    1. 1

                                                                      One of my first suggestions would be to set Firefox as your default browser, and in the Firefox preferences set DuckDuckGo as your default search provider. I believe we leak so much about ourselves through our web searches. Stuff we would never write in an email or show in terms of social media presence.

                                                                      1. 1

                                                                        I strongly like the simplicity in rsync to do full tree mirrors, and then rsync with hard links for incremental updates. No other tool needed. Of course, you may have reason to avoid this.

                                                                        1. 2

                                                                          .NET Core: After so long being a generalist and knowing a wide variety of things and not getting far enough, I want to become an expert in all things .NET Core.

                                                                          React: Finally started learning React this year. I will continue to do so next year.

                                                                          Anger management: Started it this year and will continue to do so next year.

                                                                          Thinking fast and slow: Both the book and in action.

                                                                          1. 2

                                                                            As a full time open sourcer and Linux user, I’ve been pleasantly surprised by the dotnet core environment. Both in terms of its own design and how well it actually works on non-Windows platforms. (It’s not fantastic, just surprisingly good.)

                                                                            1. 1

                                                                              Absolutely. It is a breath of fresh air. I longed for something similar for a long time as a fellow Linux user and. NET dev.

                                                                          1. 4

                                                                            I’d like to know more statistics. What are the methods, why do they work, when should they be used. I’d like to learn how to be more rational. Become better at identifying falsehood or at least information based on shaky foundations.

                                                                            1. 1

                                                                              This is practically my list too. Statistics is on there, for better solving problems computationally, and also as a vehicle to making decisions more strongly linked to facts.

                                                                              This is an ongoing effort of mine to become a better engineer and take full control over my work situation. I want to get to a place where I set my own schedule and ideally people don’t question me. It’s a stretch goal but I’m certain achievable, given that I’ve already reached some autonomy.

                                                                              (This might only be achievable by changing employers, one way or another, but my current employer has given an impression of being supportive of this.)

                                                                            1. 8

                                                                              Great writeup! Thanks for posting this. Reading about puzzle solving in Prolog makes me want to get more into that language.

                                                                              I’m quite new to Prolog, but just being vaguely familiar with the language often makes me think that would be so much easier in Prolog on real life problems. For example, a friend of mine spent 3 full weeks putting together a time plan for a festival using spreadsheets trying to account for people’s availability and the different tents, yet I’m fairly confident that problem could be solved in less than 100 lines of Prolog (which I intend to do before the next festival).

                                                                              That said, the definition of uniq_ppl looks rather clumsy, with its fixed number of arguments and all. Why not just use all_distinct?

                                                                              (Also, can we have a Prolog tag here on Lobsters, please?)

                                                                              1. 4

                                                                                I agree with a Prolog tag. I think the formal methods tag is very misleading.

                                                                                1. 3

                                                                                  One common failstate I’ve heard for ‘computer assigned seating’ is that it doesn’t know enough about the more social elements, like that Alice and Bob are in a blood feud going back 10 generations, or that So-and-so is part of a group of friends that would be upset if they got split up. Probably you’d want to keep people near to who they were near last year, since it presumably worked out well enough.

                                                                                  I didn’t get much further than “Hello, World” like a month ago; can Prolog rank & sort its output?

                                                                                  (Also, hello lobste.rs!)

                                                                                  1. 3

                                                                                    I don’t remember if Prolog can rank solutions, but I know you can impose constraints like “person A should not be seated beside person B”. The map region colouring example in the article is a demonstration of this.

                                                                                    1. 3

                                                                                      There are definitely ways to rank output. One way would be to generate potential solutions as a list where each element is a pair of a potential solution and a score for that solution, and select for the maximum.

                                                                                      (Caveat: I’m pretty bad at prolog, but I’m relatively confident that works).

                                                                                      1. 1

                                                                                        One common failstate I’ve heard for ‘computer assigned seating’ is that it doesn’t know enough about the more social elements

                                                                                        Totally agree! I think however that that type of failing is more the fault of the programmer than the language, because there’s nothing preventing you from adding a hates(alice, bob). fact.

                                                                                        1. 2

                                                                                          That requires one of Alice or Bob to actually tell the guy behind the desk that they don’t want to sit together. Mining all the needed information is the hardest part of computer-assigned anything.

                                                                                          1. 2

                                                                                            That requires one of Alice or Bob to actually tell the guy behind the desk that they don’t want to sit together.

                                                                                            Well, yes, that is correct, but that is an issue with a seating plan even when done on paper (although an issue like this is easier to tell to a human being than a GUI that doesn’t have an input for that).

                                                                                            1. 2

                                                                                              It’s also something a human may not “remember” up front, but be reminded of just before attempting that solution.

                                                                                        2. 1

                                                                                          Hello and welcome to Lobsters! Hope you enjoy it! :)

                                                                                        3. 2

                                                                                          I thought of all_distinct/1 there as well, but that’s actually a clp(fd) predicate that only works on integers. It would probably be nicer to use dif(A, B) instead of \+ A = B though.

                                                                                          1. 3

                                                                                            Here’s a general implementation of “these variables are unique”:

                                                                                            pairs(Xs, Pairs) :-
                                                                                                      Other^(select(X, Xs, Other),
                                                                                                             member(Y, Other),
                                                                                                             X @< Y),
                                                                                            uniq(Vs) :-
                                                                                                pairs(Vs, Pairs),
                                                                                                maplist([A-B]>>dif(A, B), Pairs).

                                                                                            Example use:

                                                                                            ?- uniq([A, B, C]), maplist([X]>>member(X, [1, 2, 3]), [A, B, C]), A = 1.
                                                                                            A = 1,
                                                                                            B = 2,
                                                                                            C = 3 ;
                                                                                            A = 1,
                                                                                            B = 3,
                                                                                            C = 2 ;
                                                                                            1. 1

                                                                                              Oops, yes, I missed that all_distinct is only for integers.

                                                                                              Regardless, I think it a recursive definition is simpler and more general, for example like this unique relation.

                                                                                          1. 1

                                                                                            What would be a scenario in which one needs a billion IDs per minute?

                                                                                            1. 1

                                                                                              For example when running off of a battery which you want to last as long as possible. Remember: speed is efficiency, efficiency is battery life, temperature and noise.

                                                                                            1. 3

                                                                                              One of the big questions I have for myself, which I have yet to feel comfortable answering, is where should I be doing my splits and terminals, in NeoVim or in Tmux?

                                                                                              Both vim and tmux will split windows, and switch between processes. NeoVim even has a terminal built-in if I wanted to use it. I used to open a new file in nvim in each tmux window, but recently I’ve been using one running nvim instance and switching between buffers when I need to change files.

                                                                                              What is your workflow experiences with switching windows and managing splits with vim and tmux?

                                                                                              1. 3

                                                                                                Not quite the same, but perhaps related: in Emacs, there are both the concepts of “frames” (which are actual windows in your window manager) and “windows” (which are panes within the Emacs frame). They are all part of one Emacs instance, so I can still copy/paste between them, run commands in one that affects the other, and so on.

                                                                                                I have long debated whether to let my window manager do the window managing (which is philosophically pleasing) or do it in Emacs (which is more convenient from an initial configuration perspective as well as on various OSes).

                                                                                                Currently, I use both. What generally decides it is some sort of vague notion of “context”, i.e. “if I move window A from this monitor to the other, do I also want B to move with it and them to retain the same relative configuration?” If the answer is yes, then I let Emacs manage those windows. If no, I tear B off as a separate frame.

                                                                                                That said, if you also use window manager windows as a third layer to the hierarchy, then all of this is probably already obvious to you.

                                                                                                1. 2

                                                                                                  Fair question :) I’m by no means a master of this workflows. I don’t do any advanced things.

                                                                                                  Here is my setup: I’ve multiple machines where I share same .vimrc and I check in vim sessions (mks) to git repo. So I try to emulate same environment for each machine. Mostly sessions fail to regenerate though. I have one tmux session per project. Within that session I have 2-3 windows. I don’t use splits of tmux for the reasons you have listed. One window is for vim for sure One window for backend server logs (optional) One window for frontend server logs - I don’t really develop be+fe at the same time. Too much distraction (optional) One window for pyconsole/git/random trials etc. (optional) One window for README.md notes about the project.

                                                                                                  tmux does a lot if you have a low power machine while vim struggles to render depending on the terminal emulator. eg. My travel laptop is a $140 chromebook. It has really hard time if I have multiple vim splits on the same buffer and try to scroll. So I utilize vim tabs (gt gT), after editing, ctrl+b+n to my tmux window where I can see the outcome of the code.

                                                                                                  1. 2

                                                                                                    Thanks for the reply. I did not know about vim sessions. I write a little shell script of tmux commands on a per project basis. It sets my env vars, creates tmux windows, and renames windows to be useful.

                                                                                                    1. 1

                                                                                                      nice; could you share the shell script if it’s ok :) I was looking for a simple solution for this rather than black box plugins.

                                                                                                  2. 1

                                                                                                    Can you yank and paste lines between nvim buffers in different tmux panes?

                                                                                                    1. 1

                                                                                                      Sort of. I setup nvim to yank to macOS’s system buffer, which I can then paste into another nvim instance in a different tmux window. So it is not two nvims sharing a clipboard, but it works for me.

                                                                                                      vnoremap <Leader>y "*y

                                                                                                      1. 1

                                                                                                        Collapsing the number of registers I can save to to 1 has always felt like giving up too much power.

                                                                                                        What I do instead is maintain tmux panes for other windows but otherwise keep Vim windows within a single pane – and then use a single keyboard shortcut to navigate transparently between them all.