Threads for rpc

  1. 2

    I might be wrong, but if GPIO.input() does not block, that script will be basically an infinite read loop pegging a core to 100% all the time? Not even the usual time.sleep(0.1). Can’t an interrupt be used to block?

    1. 2

      I would think it could be an especially good fit for e-ink readers with a working web browser (does the reMarkable e-ink tablet[1] that seems to have become relatively popular recently on the interwebs have one?) — though given the poor refresh rate of current e-ink screens, it too would probably depend on inventing some alternative to the scroll & zoom workflow. If you find a way, you may like to let e-reader and reMarkable users know via reddit and/or some other kinds of forums; they might love it! :)

      1. 2

        I’m going to replace scrolling with truncating the text, and having links to a single article page view. Hopefully i’ll get that done this evening

        1. 2

          It would be nice to set the text of the link to “Continues on page 42”. xD

          1. 1

            That was my plan!

      1. 4

        One with octopi and a camera as a 3D-printer print server. I have my “lab” in the attic so I can monitor print jobs from anywhere.

        1. 2

          I have a pi ‘clone’ that I use for the exact same purpose. It’s low power, and very capable of running octoprint & streaming 720p video for spying on prints from across the house.

          1. 2

            Which pi clone?

            1. 4

              Orange Pi Lite. I called it a clone mainly because it supports the same 40pin header as the rpi, but it is armhf (not aarch64) and it includes Wifi. Since it’s headless (I don’t need 3D accel) I can (and do) run the latest mainline kernel on Arch Linux ARM on it.

        1. 1

          I created my own shell script for that, and then use homebrew’s choose (macos) to jump to memorized paths, and also navigate inside (Used fzf before).

          1. 2
            1. The Non Designers Design Book. Robin Williams
            2. Don’t Make Me Think. Steve Krug
            3. The Design of Everyday Things. Donald E. Norman.
            1. 38

              It boggles the mind to see how many browser features web developers re-create poorly within the browser. Why do they fight the platform so much?

              1. 18

                Why do they fight the platform so much?

                Probably a lot of bad reasons, judging by some of the sites I’ve been forced to use. However, in some cases there are good reasons.

                For example, my employer makes a document editing app specialized for certain types of accounting workflows. We can’t use the browser scroll because the browsers cap the number of pixels “tall” that a page can be, and some of the documents our customers create would blow past the cap and break scrolling. Hence, we have our own “viewport” implementation that doesn’t work quite as well as native scrolling, but also doesn’t have that limitation.

                Ultimately, I blame the fact that we’re creating “apps” on a platform that was designed for mostly-static documents. We can hate it all we want, but it’s not going away because the benefits are enormous (cross-architecture, cross-OS, cross-device, no “updates”, and so on). So until the browsers provide a platform that is actually designed for building “apps” rather than having those features awkwardly bolted on, things are going to continue to kind of suck.

                1. 3

                  We can’t use the browser scroll because the browsers cap the number of pixels “tall” that a page can be

                  Wait, what? I’ve never seen browsers cap page length. Are you experiencing a hard cap, or a soft cap where perf gets bad when there’s too much to render?

                  1. 8

                    It’s effectively a hard cap. The cap is very, very large, but we have customers that use our software to produce 30,000 page documents, so we would hit it. Based on a very quick search, this seems to be a reasonable place to start if you’re looking for more information: https://stackoverflow.com/questions/34931732/height-limitations-for-browser-vertical-scroll-bar

                    1. 4

                      Just curious, what sector does produce a 30k page document? I hope they don’t print it at least!

                      1. 5

                        I don’t know much about this sort of thing (I don’t work directly with our customers) but from what I understand it’s mostly large financial institutions (banks, insurance companies) that build these huge documents that basically spell out their exposure to risk. I assume they’re never printed, my employer’s original product was for filing SEC reports without printing anything, so… hopefully? :-)

                        1. 1

                          I wonder if they’re even read! Maybe just queried for individual pieces of information.

                      2. 1

                        Wow, super interesting. Thanks for the link!

                  2. 2

                    Full ACK. There are some edge cases where you can’t really do much else. One of these I’ve encountered while building https://xkcd.wtf (yeah, that’s a domain): I don’t want to proxy all those API calls for you.

                    In the end, I learned a lot about Javascript (and it did change my mind a little bit in the positive direction (keyword: promises)), but never got it even close to the speed my Perl/CGI prototype (that just used qx{curl -s ...}).

                    1. 1

                      Out of interest, what was the assignment? was it necessary to build a frontend in javascript or perform client side rendering?

                      Visiting the site gives me the message that you don’t like it either. Is that just appealing to your audience, or is there a reason you didn’t stick wit Perl/CGI?

                      1. 2

                        what was the assignment?

                        None—the course was dropped from the curriculum just before the start of the semester. (original ass.: build anything that uses any webdev-platform (spring, django, whatever) and calls 3 different apis). I had the domain purchased in anticipation of the course.

                        is there a reason you didn’t stick wit Perl/CGI?

                        Perl/CGI is my go-to for everything (like my teletext-server). But for hosting it elsewhere, I didn’t want to proxy all the API calls (don’t ask me exactly why, though, it’s been a while since I thought about it).

                        Visiting the site gives me the message that you don’t like it either.

                        The <noscript> message? I’m one of those people™ who browses without javascript or cookies (few sites whitelisted).

                        your audience

                        The audience of this site is probably just me and a few friends; I haven’t really publicised its existence.

                        1. 2

                          I had the domain purchased in anticipation of the course.

                          Good catch, it’s a cool domain.

                          I’m one of those people™ who browses without javascript or cookies

                          I get you, I’m the same.

                          probably just me and a few friends

                          You can add me to the list now, it’s a pretty nice site :)

                          Out of interest, how many of your friends using it are the kind of people who browse without javascript?

                          1. 2

                            Thanks! In my circle of friends, I’m the only one browsing without Javascript.

                  1. 18

                    Maybe we’re approaching this wrong. I’m not sure tabs (which are meant for tabular data) are the right tool, because, as others have pointed out, if you do something like

                    pthread_create(&thread_pool->manager->threads[0],
                                   &thread_pool->manager->attrs[0],
                                   &thread_pool->manager->func,
                                   &context);
                    

                    You kinda want those arguments to line up. We kinda abuse the space as a formatting character here, which is also kind of a hack that works because we use mono-spaced fonts. Some assumptions start to break down when you start to use ‘wide character’ (as in, chinese or emojis) in code, which take up two ‘spaces’. Ideally, we want to separate the indentation concerns from the representation of the code.

                    What I’m suggesting would be something where there is no indentation in the code at all, and rather the editor you use parses the code (which it does anyways, kinda, for syntax highlighting) and it indents it based on grammar rules (which you can customise). That way, you can do away with code formatting tools, because the code is only formatted as it is rendered. That way, a visually-impaired person can set their indent side to anything they like. It would end all debates on how to format code.

                    Having this kind of a syntax parser in editors also means that editors could prevent you from writing syntactically incorrect code. Remember the Apple goto fail bug (article here)? That would have been prevented if the editor wouldn’t have let them indent a goto statement that is not part of an if statement.

                    1. 34

                      You could put the first parameter on its own line and use indentation for alignment.

                      pthread_create(
                          &thread_pool->manager->threads[0],
                          &thread_pool->manager->attrs[0],
                          &thread_pool->manager->func,
                          &context);
                      
                      1. 12

                        Now put the final ); on its own line and you have a format that’s both balanced and easily machine-generated. :)

                        1. 7

                          Touché.

                        2. 7

                          What you are looking for is called “structured editing”, where the source code isn’t really text, but the AST. The main problem with that is interaction with external tools such as version control: tools that don’t know what they are dealing with will just use the binary representation of the AST (which might be some form of text like you just described, but will still lack indentation).

                          An alternative would be to canonicalise the source code: use structured editing, let users have their own preferred settings for alignment, indentation width, character width… and save the canonical form to disk. That way, when opening the source code with a regular text editor, or viewing a git diff of it, we should not be too confused about what this code is all about.

                          But now some people will want to edit the source code directly, so it may not be canon any more. (Maintaining canon may be especially difficult if the canonical line width is limited.) You’d need an auto-formatter, either as a stand alone program, or integrated with the compiler.

                          1. 2

                            I think the OP has an interesting point. It reminds me of one of Brett Victor’s talks, The Future of Programming, were he plays the role of a 70’s engineer and remarks “it would be a shame if in 40 years time we are still coding procedures in sequential text files”).

                            So maybe we should be using some kind of database or programmer-independent format for code, and do the layout separately (a la Smalltalk) and tailored to taste. Anyway, the computer does not care about formats.

                            1. 2

                              Lisp IDEs allow doing structural editing directly on s-expressions. You can even create visual editors on top of that. Fructure is a great example. None of this affects source control because you’re working directly on the source.

                            2. 4

                              It would also be nice if the entire toolchain were aware of the language, so for instance changes that are transient wouldn’t trigger diffs with source control.

                            1. 2

                              I’m actually surprised that a mostly static website requires 18 Pi 4s.

                              1. 2

                                We’ve set up 14 Pi 4s for PHP processing

                                Not really static, if the Pi’s are running the forum, blog, etc.

                                1. 1

                                  I think that it mentioned that the most intensive thing is the blog (which can be fairly static, even more so as raspberry pi’s blog doesn’t have a reply feature) I don’t see a mention of forum on the post, even.

                                  We used the main blog, which hosts the www.raspberrypi.org blog, and has historically been the most CPU-intensive site to provide.

                                  edit: nvm, I see that they do have comments on the blog. It makes more sense now. Still makes me wonder how much the software could be optimized though.

                                2. 1

                                  The site is currently running on Pi 3’s the Pi 4’s currently don’t netboot which is a hard requirement for Mythic-Beasts.

                                  Hopefully that will be resolved shortly and then the site will be hosted off the Pi 4.

                                  1. 2

                                    This tweet (2 days later than the article) contradicts you: https://mobile.twitter.com/Mythic_Beasts/status/1143045366675312641

                                    1. 2

                                      true - they’ve obviously solved the netboot issue :~)

                                1. 6

                                  I wish ruby would follow python’s approach of providing syntactic support for inline type annotations. e.g. in python you can say

                                  def f(x: int, y: int) -> List[int]:
                                    ...
                                  

                                  and the language itself will treat the annotations as pure comments, but type checkers can use them to verify the types, or infer other types.

                                  1. 7

                                    I think one of the main reasons why inline annotations wouldn’t work is that Ruby’s grammar is complicated and ambiguous enough as it is. To work signatures into it you’d have to come up with some really weird syntax that would add a lot of noise on top of the weird syntax that already exists.

                                    Also, Matz doesn’t like type signatures.

                                    1. 5

                                      Here’s the part where Matz suggests syntax for type hints (similar to PHP7,Python3) then says “NO” :) https://www.youtube.com/watch?v=cmOt9HhszCI&t=29m32s

                                    2. 3

                                      Yea I really like Python type hints. They also help you in your editing tools for code lookup and completion.

                                      1. 3

                                        I don’t do ruby, but I’ll like to see them taking a separate-header-file approach. When I prototype something in python, I’d rather not have types, but then as the code base grows, autocompletion et.al. start failing due to lack of it. It would be great to be able to run the code and generate a separate header based on the run-time resolved types. That would be easier using a separate file approach.

                                        1. 2

                                          check out pytype, it can generate python header files for you (by static analysis of the code, not run-time type collection)

                                      1. 3

                                        Great writeup. Having survived two episodes of burnout, that should be in the mandatory training for many workers. If your company works on an ASAP culture, you should quit ASAP. :)

                                        1. 2

                                          Small type and lack of contrast. Light grey on white is evilness. Also, some affordances for buttons could be used. The “faux-tab” interface looses state when changing tabs back and forth. I’d rather not suggest a tabbed interface if it’s not.

                                          1. 1

                                            My current desktop at home. A second hand 2012 MBP on a 3d-printed stand, a cleaned-up and adapted IBM Model M over USB, a Logitech MX Pro I recently resoldered a failing switch. Standard IKEA table&chair.

                                            1. 2

                                              I recently converted an IBM-122 terminal keyboard which I’m typing on macos. Karabiner-Elements is an indispensable tool for me!

                                              PS: If you use Karabiner, show some appreciation by “registering” (really a donation) to tekezo!

                                              1. 3

                                                You too can have this faux-nostalgic[1] experience: https://github.com/Swordfish90/cool-retro-term

                                                (300 bps is pretty annoying, but 1200 isn’t really that bad; about like newish e-ink)

                                                [1] Apologies to any ancient wizards here whose nostalgia may be genuine

                                                1. 1

                                                  If doing it on macos, build from source. The 1.0.1 dmg and/or brew cask are quite old.

                                                1. 8

                                                  We use Hipchat and it’s completely awful. Web version silently logs out every few days, after that I stop to receive messages and can’t notice that it’s logged out until switching to its tab. Desktop client (based on Electron and having huge size) stopped receiving messages after sleep mode in older versions. In newer versions it uses http polling to receive messages (not long polling, just regular periodic requests, like in 90s web chats). When pasting blocks of code, it replaces multiple spaces with non-breaking spaces, so if you copy it back, you’ll get invisible surprise.

                                                  Still better than Skype, though, and is cheaper than Slack.

                                                  But I fear that if it will be replaced with Slack, our team will use chat more (instead of Github and Basecamp comments), and chat notifications make me nervous.

                                                  1. 3

                                                    Welcome to my hell… Slack is an awful channel to coordinate teams.

                                                    Things get lost in a hundred unrelated conversations. People assume everyone knows once they’ve dumped their minds into a chat.

                                                    It degrades communication quality. The pace of a chat conversation is short-term memory based. On a medium/long written form, you can consider previous context. Review your explanations.

                                                    Don’t really like it. :/

                                                  1. 2

                                                    DELL AT102W. Grey Alps. I modified it with an Adafruit Bluefruit plus battery and TMK modified firmware so now I use it over Bluetooth.

                                                    1. 2

                                                      Now, this is a useful submission compared to the n-th rant about Linus swearing. :)

                                                      1. 11

                                                        Both are important. On a typical team project, effective communication is probably more important than understanding the minutiae of aliasing and type punning. Mr. Bernhardt’s post is also more than the nth- rant about Linus swearing, because it includes a complete revision of the email.

                                                      1. 5

                                                        So developing for a job isn’t as fun as developing for fun, who would have thought?

                                                        1. 4

                                                          “It’s only work if somebody makes you do it” (Calvin & Hobbes)

                                                        1. 1

                                                          It’s sort of what Bret Victor is trying to put forwards: Engaging the whole body in the design process, wether is code or cars. See the @Dynamicland1 twitter feed, it’s quite fun to watch.

                                                          1. 2

                                                            Article conflates OS with UI. They can perfectly keep iterating Darwin behind both. The point is if they might port UIKit (internally seems they already have) to be the basis for MacOS desktop apps.