Threads for agundy

  1. 5

    This obscure little feature in Ecto/Elixir is something we’ve been using at Slab.com for about a year. While the blog post only covers the feature itself, I wanted to give a better overview of WHY we’re using it.

    Slab is a multi-tenant Phoenix app where all tables in our database, including pivot tables, have an org_id foreign key that references the team the data belongs to. Using association defaults enforces that the correct org_id value is automatically set for all resources.

    We combine this with an OrgRepo module that wraps around our default Repo, which can only write or read other resources with the same org_id, ensuring that data for one team has no possibility of accidentally leaking to another team (using Repo is forbidden in our codebase).

    An added bonus is; when we eventually have to scale our databases via something like sharding and have to vertically partition the data based on org_id, we would already have this system in place to support us.

    1. 3

      This is a good blog post. Thanks for writing up how you do this. It’s important for the community to have some of these more advanced use cases documented!

    1. 8

      Just out of curiosity since I remember there used to be a lot of hate towards those guys but now people do upvote posts about Elementary a lot, do people no longer remember about the past drama, have the developers changed, have people decided to give them a pass? All of those?

      https://funnelfiasco.com/blog/2015/02/13/elementary-misses-the-point/

      1. 10

        I wasn’t paying attention to this “controversy”. For me I use and enjoy elementary and pay for apps and the OS where and when I can. We need teams focusing on making Linux integrated and thoughtfully designed. In my opinion they do great work.

        I’d give them a charitable pass on the verbiage, my interpretation is software is expensive and requires money for people to work on it full time. A near requirement to pull off something as ambitious as an operating system.

      1. 1

        This is pretty cool. Low power electronics are getting more powerful as solar and portable batteries have gotten lighter and cheaper. Last summer I took my Pinebook Pro, a large battery pack and a solar charger and biked to different parks and determined I could last a long time. I’m still working on the ergonomics but I quite enjoyed the change of scenery and setup. Uses even less power!

        1. 8

          So cool!

          I have a related problem. I’ve got a 1.3kW solar array at our cabin. When we’re not there, it generates way more power than the HVAC needs to keep the building at a healthy humidity - say 4-8kWh a day. There’s no grid to sell it back to, but I do have an LTE internet connection.

          What to do with all that curtailed power? Crypto obviously, but it’s so dumb I’d rather dump the power into my ground rods.

          If you had 8kWh of free power a day and an LTE modem, what would you do?

          1. 7

            Maybe donate some processing time to a project like BOINC https://boinc.berkeley.edu/

            1. 5

              Run one of those inefficient water-from-air gadgets. It’s power you were gonna waste anyway, might as well build up your stock of the wet stuff, or even send it to a small trough for the wildlife.

              1. 4

                Maybe add a small greenhouse or hydroponic system? Might be fun to have a semi automated remote food system.

                1. 2

                  I know you ruled it out, but by mining crypto with your surplus clean energy you deprive other (potentially dirtier) miners of that same profit. It’s a pretty green choice to make.

                1. 2

                  I’m reading the deployment story: https://amattn.com/p/deploying_elixir_phoenix_webapps_to_the_cloud_with_releases.html

                  So there is no “ready-to-use executable”? How can one ship a software to another person? Thanks.

                  ps: @amattn You mentioned Lisp once. Are you able to compare SBCL’s compile-time type inference (which I enjoy a lot) we get during development with Elixir’s? thanks.

                  1. 3

                    Elixir is built on Erlang and hasn’t historically been in a space where deployment is via executable. Primary use cases are servers, embedded devices, network hardware etc. Shipping binaries is a different use case. Check out Bakeware which is doing some work in this area.

                    1. 2

                      Think of it like Java, you need the JVM installed on the system, then you deploy a .war file.

                      It’s kinda like that.

                      A mix release is basically the Erlang VM (BEAM) and your applications code and resources (css, images, js files, dependent libs, etc) all in one big directory.

                      so you just copy or rsync that directory to your cloud instances. alternatively, you can build a docker image and deploy that image.

                      1. 1

                        I’m not super familiar with SBCL’s implementation of type inference, but with respect to compile time type inference in general, elixir doesn’t have a direct equivalent across the board of all variables and all types. (like say Go does it)

                        What you normally do is make heavy use of pattern matching, guards, and what not, to get some safegaurds that get you really close to that kind of safety tho.

                        The Dialyzer (static analysis tool) can tell you if a set of pattern matching or guards will never work or clearly have errors. It’s pretty effective and similar to compile-time type inference, helps push errors earlier in the dev process.

                      1. 1

                        ~/Dropbox/Notes/, filled with .txt and .md files. Works well on the desktop, but haven’t figured out a good solution on my iPhone yet. (the Dropbox app is ok for viewing, less so for editing)

                        1. 2

                          I have a similar setup and use 1Writer for editing plaintext files inside of my Dropbox folder.

                        1. 13

                          I think we should also consider the new user experience here. If you join a small instance:

                          • there is very little activity
                          • searches for hashtags return almost 0 results
                          • it’s difficult to find interesting people via the federated timeline (because of its low volume)

                          Relays can fix this issue but they still require an instance with a high volume of traffic in order to be useful. Given this, it’s no surprise that users flock to mastodon.social, people are joining mastodon to talk to people, not necessarily to further any FLOSS ideologies.

                          1. 9

                            Given this, it’s no surprise that users flock to mastodon.social, people are joining mastodon to talk to people, not necessarily to further any FLOSS ideologies.

                            Moreover, most non-techies, would ask why one would have to choose an instance at all. While it is ideologically good to have federation to avoid centralization, and it makes it easier to find a stream of toots for like-minded people, for most folks having users across different instances will only be utterly confusing.

                            (I don’t know the solution to this usability problem.)

                            1. 10

                              Even as a techy I’ve struggled with this same problem. I’ve considered trying out Mastodon a few times and whenever I get to the choose a server they lose me. The line “One server will be hosting your account and part of your identity.” is scary. Can I migrate an identity or am I stuck? Why is an Italian server and a French server featured. Does that matter? Which server has people I’d be interested in? When you join Twitter you don’t get forced to decide your interests, you figure that out later. This is a huge barrier to entry.

                              1. 5

                                I think you’re misunderstanding something in that it’s not meant to be just a straight up twitter replacement that happen to have servers.

                                It’s like joining a forum, you’re picking a community to join. Not just a server.

                                There’s more effort that goes into it, but that’s the point.

                                1. 10

                                  But what if you want to change communities? What if you have no idea what you’re interested in and just want to see what’s out there? I’ve had the same problem with these distributed networks, I never feel I have enough information to effectively choose an instance, so I just choose the instance hosted by the project itself. If there isn’t one, I usually just don’t bother.

                                  1. 4

                                    Mastodon has built in tools for account migration. When you migrate, your follows and followers come with and your old account shows a link to your new one saying you migrated.

                                    It’s really easy. Folks do it quite often.

                                    1. 2

                                      This needs to be emphasized better I think. Being able to exit your current mastodon host if you don’t like them for whatever reason is a big advantage of the fediverse over twitter, if only this was made clear to people.

                                      1. 2

                                        That’s fine unless your reason for changing communities is that the old one got sold to someone who is trying to extract maximum profit out of it (in which case they are going to turn that feature off early).

                                        I’ve raised this with the mastodon folks (supporting multiple domains pointed at the same host would entirely mitigate this problem) - they agree it’s a problem, but not a priority.

                                        I’d be happy to use another host as long as I owned the domain name.

                                        1. 1

                                          That’s fine unless your reason for changing communities is that the old one got sold to someone who is trying to extract maximum profit out of it

                                          There is no precedent for this ever happening. If you’re so worried about that being the case, just be sure to join a small community in the first place with admins you trust not to do something like that.

                                          1. 6

                                            no precedent

                                            That’s fair. It’s previously only happened to email providers, blog hosts, wikis, forums, subreddits and newsgroups. I’m sure mastodon hosts will never be affected.

                                            1. 1

                                              You say this, but you clearly have never interacted with a large majority of the Mastodon userbase who would sooner chop off their own right leg before selling out.

                                              It’s crazy what happens when folks are committed to their values, as much of the Mastodon community certainly is.

                                              1. 4

                                                It doesn’t matter what the userbase wants; what matters is what the owners of the domain names want.

                                                Perhaps these ones have better principles than those who came before, perhaps not. It’s ultimately irrelevant because people and principles change given time.

                                                Plenty of gmail accounts are 15 years old. “Don’t be evil” was coined at google 20 years ago. Lots of things that make sense on a month-to-month scale break down when you think about decades.

                                                1. 1

                                                  Yes it does? If the users of a community instance (which, again, ideally won’t be too huge) all leave then what does it matter what the admin wants?

                                                  This sort of thing has happened quite a bit. Users of an instance get angry at the decisions of an admin so they ditch.

                                                  1. 3

                                                    If the users of a community instance (which, again, ideally won’t be too huge) all leave then what does it matter what the admin wants?

                                                    Mutually assured destruction is an option, but it’s not a desirable outcome. Much that is good gets destroyed in the process - starting with the social fabric which is the reason for the whole thing existing.

                                    2. 8

                                      It’s like joining a forum, you’re picking a community to join. Not just a server.

                                      I disagree, and I think that this has been a big mistake. Most people don’t have special identities for communities, and even if they do, there’s no point for these people to all be one one instance. After all, if federated, there should be no practical difference (expect maybe for technical details such as speed) what server who is on.

                                      Instances should be more transparent than they are now. The only relevant things are how well the administration team can manage the server, and how much you trust them.

                                  2. 13

                                    I tried to join Mastodon.social a few weeks ago; someone linked one of their messages (or “toot”, if you will) here and I felt I had something useful to add.

                                    I failed. I signed up on Mastodon.social (I think? the entire sign-up process was confusing) and could kind-of-but-not-quite login, but I couldn’t really reply to the message. I tried to figure it out for 15 minutes and eventually just gave up, as I don’t really care enough to try more.

                                    If you really care about decentralisation, I think you need to think very long and hard not so much about the technology of it, but how to pull it off while remaining usable. I think some sense of pragmatism instead of “perfectly decentral” solution would help as well.

                                    1. -2

                                      I’ve never had nor had anyone ever express to me that they’ve had these kinds of issues, and I’ve run a couple of instances.

                                      I think this rests solely as a “you problem” if I’m entirely honest.

                                      1. 3

                                        To build on mdszy’s reply, some think of “Random person can join the network just to post an off-the-cuff reply”[0] as a feature rather than a bug since it limits drive-by disruptions and eases the moderation burden.

                                        Anyone who wants to build a community instead of sell growth numbers to VCs needs sign-up friction if they’re going to filter for other people invested in the community.

                                        [0] I assume that arp242 had a well-reasoned and thought-out reply but that would be the exception.

                                        1. 4

                                          I guess it depends on what your goals are; if you want to create a relatively small high-quality community then having a higher barrier to signups is probably a good thing – this is what Lobsters does with the invite system.

                                          But if you want to make inroads in creating a more decentralised internet, and I believe this is what many want with Mastodon, then it’s important – vital even – to make sure the experience is as frictionless as possible.

                                          Perhaps the nice thing about Mastodon is that as I understand it you can do both, at least in principle.

                                          1. 2

                                            Agreed. Decentralization may depend more on social/interpersonal solutions than technical/UX ones, though.

                                            Early adopters can handle a few hurdles to joining. We may need an easy invite system to reach the early majority, one where the early adopters make it super-simple to get started by pre-filling information for them. Early Gmail invites had you choose the username for the invitee, for example, and goodness knows Discord has made that easy.

                                            Maybe some research into ideal userbase numbers for instances with 1-3 moderators, so that we can figure out when and where proactive new server creation would help (instead of waiting until server splits are forced by discord/burnout).

                                          2. 1

                                            some think of “Random person can join the network just to post an off-the-cuff reply”[0] as a feature rather than a bug since it limits drive-by disruptions and eases the moderation burden.

                                            I most certainly agree. Thanks for this.

                                            Also to add, many instances use signups by approval only, where once you sign up, a moderator has to approve your application. This is basically the best solution we have to the spam problem - since I often get applications from literal spam accounts, it’s clear that it’s working.

                                            But yes, part of the benefit of the friction is kind of requiring folks to actually care a little bit rather than just see something, make an account, comment on it and never look again.

                                    2. 2

                                      I have exactly this problem. I’m considering server hopping yet again.

                                    1. 2

                                      Not a super computer by any means but the company I work for has a 72 core Xeon server with 256GB of ram and four Titan RTX’s. We use it as a mixed use host with developers given shell access, it also runs CI and other miscellaneous jobs like training or notebooks or local services for robots.

                                      Definitely fun and useful to be able to remote into a computer that can put any laptop to shame and do build tasks in drastically shorter time frames.