Threads for Caio

  1. 2

    Excuse my newbieness, but what’s IDL? There’s just so many acronyms being thrown around here, it’s barely readable.

    1. 3

      An IDL is, as @fstamour says, and interface definition language. These are used to define interfaces in a way that is agnostic to the implementation language. Most ’80s object broker systems (COM, CORBA, and so on) had quite rich ones that allowed you to automatically map the abstractions that they provided into different languages. Many lightweight RPC mechanisms that evolved in the ‘90s in response to the perceived complexity of things like DCOM and CORBA also had them, though not all. As I recall, the W3C maintains one as well, for all of the DOM APIs, to provide the option for non-JavaScript languages in the browser to be able to take advantage of the same APIs (though since IE died, taking VBScript with it, and WebAssembly avoided direct access to JavaScript APIs, this hasn’t been very important).

      The idea behind an IDL is to provide a language-agnostic description of an interface. If your underlying RPC mechanism uses JSON then you implicitly have two languages that you need to support: JSON for the wire transport and whatever language you use to implement the endpoints and you want to be able to translate from foo(42) to something that generates some JSON that looks a bit like { method: "foo", args: [ 42 ] } (or, hopefully, something more sensible) and have the foo that’s exposed to the implementation language’s type checker (does foo always take one argument and does it have to be an integer?).

      Part of the problem with JSON here is that it doesn’t have a particularly rich set of primitive types. Everything is encoded as text, which has representations problems for binary floating point numbers, and JSON doesn’t have any mechanism for defining things like 32-bit integers other than as numbers. Worse, it can’t represent the entire range fo 64-bit integers at all.

      JSON Schema lets you represent integers by defining that they must be a multiple of 1 and fixed-width integers by expressing the minimum and maximum values, but that’s a validation constraint rather than something that’s expressed in the wire format. This means that, if you’re using JSON, you actually want to get three things out of your IDL:

      • A mapping into your implementation language(s).
      • A projection into JSON for your wire format.
      • A validator for the JSON that ensure that the values are all within the required ranges.

      OpenAPI is an IDL for web services. AutoRest can generate Java, C#, Python, and TypeScript definitions from OpenAPI definitions. There are other tools that will generate the IDL from annotations in the server-side implementation.

      1. 1

        Worse, it can’t represent the entire range fo 64-bit integers at all.

        Do not confuse JavaScript with JSON. There is no such limitation in JSON since it’s numbers are just strings.

        1. 2

          The JSON spec doesn’t define limits on the number type, but it does advise that

          Note that when such software is used, numbers that are integers and
          are in the range [-(2**53)+1, (2**53)-1] are interoperable in the
          sense that implementations will agree exactly on their numeric
          values.
          
      2. 1

        Interface Definition Language

      1. 6

        This version is excellent! Great job, Mozilla! I particularly like the new PiP features and the Mac-specific improvements.

        1. 3

          I’m trying to cover all the questions that come up for my Ruby installation guide. This one comes up a lot when people install Ruby with Homebrew (for example, following the Jekyll installation instructions). Let me know if I missed anything or anything’s unclear.

          1. 1

            Great article! One question though, why did you decide to omit the global configuration for Ruby when using a version manager? E.g.: asdf global ruby 2.7.0

            1. 1

              Thanks for the kind words! You had me worried for a second as I thought maybe I overlooked it. But asdf global ruby 2.7.0 is there under Set Ruby version with asdf on Mac. A bit buried as the article is dense, yea.

              What were you using before asdf? Been happy with it?

              1. 1

                Apologies, Daniel! I think I skipped that section of the article. I see it now! I’ve been using asdf for years now. It’s one of those things I can’t do without anymore. :)

          1. 1

            This is fantastic! Easy to see how it will eventually become a default setting as we move towards a more privacy-centric approach to applications.

            1. 2

              I’m really excited for this release! Ruby 3 will be a huge improvement over 2.7 in every single way. RBS, Ractor etc…

              1. -1

                Being it a lot simpler than vim, most people (including myself) use vim.

                1. 8

                  I like how the commands are listed at the bottom. I always use it on servers.

                  1. 6

                    I disagree with the notion that most people use vim. Even among sysadmins I know, few of them prefer vim.

                    1. 4

                      Being a programmer that works with sysadmins on a daily basis, I can confirm that almost none of them use vim.

                      EDIT: Not that, that’s a problem. I could care less. Just an interesting tidbit.

                      1. 2

                        In your experience what editor is the most used?

                        1. 6

                          notepad.exe

                          :(

                          1. 1

                            Don’t take it the wrong way, but perhaps you need to widen your connections. The vast majority of sysadmins/devops folks I know are vim enthusiasts.

                            1. 1

                              Huh, that’s very different from my experience. I definitely wouldn’t say that the sysadmins that I’ve worked with are vim enthusiasts, but they all use vi since they can trust that it’ll be installed on a system. Many have had familiarity with ed as well.

                              1. 1

                                I would say a bit under half know how to use vi/vim. Most probably know the very basics (insert mode, :wq), but in general I don’t know many people who use vim as their editor of choice. There’s a couple emacs guys, but the most common editor I see used on Linux servers is Nano. Most of my current and former coworkers are <30, which might have something to do with it.

                          1. 1

                            Isn’t that Ruby’s equivalent to Elixir’s pattern matching?

                            1. 3

                              This is exciting. I was looking for something like this just last week.

                              1. 2

                                The Razr design is still so fresh. Possibly the best looking phone of all time.

                                1. 3

                                  Can any lobsters using HTTPie explain what drew them away from curl or what about curl pushed them to HTTPie?

                                  1. 8

                                    I haven’t been using it for long but for me the nicest thing so far is being able to see the whole response: headers, body, and all of it syntax-highlighted by default. The command-line UI is a little nicer as well, more clear and intuitive.

                                    It will probably not replace my use of curl in scripts for automation, nor will it replace my use of wget to fetch files.

                                    Now if someone took this and built an insomnia-like HTTP client usable from a terminal window, then we’d really have something cool.

                                    1. 1

                                      I’m guessing you mean this Insomnia. Looks cool. Good example of an OSS product, too, given most features people would want are in free one.

                                    2. 4

                                      I use both depending on circumstance (more complex use cases are better suited for curl IMO), but the significantly simpler, shortened syntax for HTTPie as well as the pretty printing + colorization by default for JSON APIs is pretty nice.

                                      1. 3

                                        I wouldn’t say I’d been ‘pushed away’ from curl, I still use curl and wget regularly, but httpie’s simpler syntax for request data and automatic coloring and formatting of JSON responses makes it a great way to make quick API calls.

                                        1. 3

                                          I like short :8080 for local host syntax.

                                          1. 3

                                            It’s all in how you like to work. Personally I enjoy having an interactive CLI with help and the like, and the ability to build complex queries piecemeal in the interactive environment.

                                            1. 3

                                              Sensible defaults and configurability.

                                              1. 2

                                                I need a command line HTTP client rarely enough that I never managed to learn curl command line flags. I always have to check the manual page, and it always takes me a while to find what I want there. I can do basic operations with HTTPie without thinking twice and the bits I need a refresher on — usually the syntaxes for specifying query parameters, form fields or JSON object fields — are super fast to locate in http --help.

                                                1. 1

                                                  curl is the gold standard for displaying almost anything including tls and cert negotiation. i use bat mostly now though for coloured output and reasonable json support. https://github.com/astaxie/bat

                                                1. 15

                                                  As a Safari user, sometimes I feel like the only reason I’m still able to use Google services on Safari is because of iOS, even though Safari supports all of the features their services require.

                                                  1. 28

                                                    Years ago I was a Windows Phone user but heavily relied on Google services. Until they blocked Windows Phone’s browser from visiting Google Maps, forcing the phone to the WAP version even though the browser was more than capable of handling the full site. And after they turned down Microsoft’s invitation to build a Youtube app, MS built one of their own that was promptly blocked by Google.

                                                    It was at that point that I realized Google cared more about petty fights with other tech companies than they cared about their users. That was when I started switching away from every Google service I could. That was almost a decade ago, and nothing has changed.

                                                    1. 2

                                                      More likely because Apple does not allow other browser engines than the one of Safari and also iOS had a bigger market share than Konquerror.

                                                    1. 2

                                                      I’m excited for multiple database support. Finally! However, I’m still frustrated that many of the chronic issues with ActiveStorage still haven’t been solved, nor even looked at seriously. There have been PRs waiting for review for months!

                                                      1. 1

                                                        I agree it’s frustrating - to me, in particular, because there were several mature community-maintained projects solving the same problem, and 37s rolled their own buggier version and made it the rails default.

                                                        That said, I’m very grateful to have a standard to build on; the fragmentation is a real source of trouble if you’re a library maintainer.

                                                        1. 1

                                                          There are quite a few good features in this update (Somewhat pleasantly surprised if I’m honest 😅). But yes, they definitely need to sort out ActiveStorage 😒

                                                          1. 1

                                                            Is the a NFL version somewhere in the wild?

                                                            1. 7

                                                              Alfred, iTerm

                                                              I can never get a concrete reason why to use these over Spotlight/Terminal.app. There used to be a significant difference, but today I can’t think of a compelling reason.

                                                              Edit: Ditto for flu.x

                                                              1. 4

                                                                Personally, I couldn’t let go of having shortcuts to switch to the nth tab. Thus, iTerm beat Terminal for me.

                                                                1. 3

                                                                  I use Alfred primarily for various workflows that I have set up. That’s not something that can replicated with spotlight.

                                                                  https://www.alfredapp.com/workflows/

                                                                  I have a few smaller ones that I’ve designed myself.

                                                                  I use the Github Repos Workflow constantly: http://www.packal.org/workflow/github-repos

                                                                  1. 2

                                                                    I happily used Spotlight for years. Then, a couple OSX updates back, it stopped properly indexing applications. I never was able to fully figure out what the problem was, as there was seemingly no pattern to which applications would be excluded. At one point it stopped including Chrome in the index, and that was the straw that broke the camel’s back for me. (More specifically, I believe it still included them in the index based on testing the command line interface, but Spotlight simply stopped showing them.)

                                                                    I switched to Alfred, and it immediately worked “perfectly” - which is to say it performed identically to how Spotlight did before the updates. It’s been a few months now, and I have no complaints with Alfred, it does everything Spotlight did, and is much faster.

                                                                    1. 1

                                                                      Weird! In your position I think I would have done the same thing.

                                                                      1. 1

                                                                        I have the same problem and switched to Alfred for the same reason.

                                                                      2. 1

                                                                        iTerm is waaaaaaaay ahead of Terminal.app.

                                                                        1. 6

                                                                          I keep getting replies like this, but still no concrete reason.

                                                                          1. 8

                                                                            I think it’s because there aren’t great reasons anymore. Yes, you’ve got some tmux integration and similar I guess, but e.g. tmux support requires (or at least used to require) custom-built versions of tmux that kept it from being as useful in practice as you might think. Meanwhile, Terminal itself has added tons of features that used to be iTerm-only and added some of its own (e.g. window groups), and while there’s some comments below that iTerm has smoother scroll, I have noticed that using Terminal can actually speed up programs I run if I’ve got them dumping directly to stdout (because it can get stuff on the screen faster).

                                                                            I used iTerm for many years, but I’m also back to Terminal. Ditto for Alfred, similar reasons.

                                                                            1. 6

                                                                              Terminal.app has added

                                                                              • Mouse Reporting
                                                                              • Ligatures (which is still in beta for iterm)
                                                                              • Vertical and horizontal character spacing
                                                                              • Key macros
                                                                              • Tabs
                                                                              • Window groups
                                                                              • Custom entry commands
                                                                              • STDout Search.

                                                                              The difference between iTerm and Terminal.app is becoming more superficial. At this point the largest difference is the degree of customization, and people who care about this seem to be more evangelical about it.

                                                                              That being said I still use iTerm for two reasons.

                                                                              1. Hotkey Quake like drop down terminal window.
                                                                              2. Its what I’ve been using.
                                                                              1. 1

                                                                                Only things missing from Terminal.app are:

                                                                                • True Color support
                                                                                • Hotkey dropdown
                                                                            2. 7

                                                                              smoother scroll, true color support, greater tmux integration, splits.

                                                                              On the other hand I think Terminal.app has the edge with better font rendering and slightly smoother performance (latest Beta version of iTerm2 is much much better in that regard, but Terminal.app has still edge on that front, but it’s locked on 30fps, so it’s not that much greater in the end).

                                                                              1. 5

                                                                                Btw I’m still using Terminal.app because I found it much more stable, and I’ve stopped using tmux for terminal splitting and tiling. Now I use Tmux mostly for attaching and detaching and security reasons, as tmux increases input latency which I cannot stand!

                                                                                And most important of all is that I didn’t want to become addicted/attached to my personal dev environment. I have been through customization hell with Emacs and Vim, now I am back to really minimal 200 Loc configs in both, using mostly stock stuff on macOS, and some universal UNIX programs. I have around 10 applications installed on my macOS, rest is stock Apple stuff and it works really well!

                                                                                1. 2

                                                                                  What phl said :-) also, better splitting. Better full screen mode.

                                                                                2. 1

                                                                                  I recently tried switching back to Terminal.app, but couldn’t get the colour schemes to show correctly. Terminal does something to the colours to add more contrast, and I couldn’t figure out how to fix it. https://apple.stackexchange.com/questions/29487/is-it-possible-to-disable-terminals-automatic-tweaking-of-colors-in-lion

                                                                              2. 1

                                                                                To be fair to flu.x, that’s a relatively recent addition, and still allows a lot more control (at least on macOS) over the timing, degree, and transition curve to red-shifted light. The rest, I’m with you.

                                                                                1. 2

                                                                                  To be even fairer, it’s “f.lux”, not “flu.x” ;)

                                                                              1. 2

                                                                                Fantastic walkthrough. I fell in love with Nix the moment I started using it. Neat tool, but it needs a better UI for sure.

                                                                                1. 1

                                                                                  Elm still looks completely foreign to me, no matter how many articles I read about it :(

                                                                                  1. 2

                                                                                    You just gotta start writing code.