Threads for the-kenny

  1. 1

    Yes, please. nrepl is rock-solid when it’s working, but really finicky to set up in all but the most standard setups.

    As for parallel-eval, there are two things to keep in mind: Clients need to be able to (reliably) cancel computations as well as specify timeouts after which a computation is cancelled by the server. Both are important to break out of accidental (while true nil).

    1. 4

      One thing the author seemingly hasn’t tried is using a manufacturer-independent gateway for Zigbee like https://www.zigbee2mqtt.io. This approach uses a USB-to-Zigbee adapter and makes all Zigbee devices from all vendors talk to each other. Run on a Raspberry Pi together with HomeAssistant (general-purpose home automation) or Homebridge (to bridge to Apple HomeKit), this setup provides a great user experience (for me).

      It also opens two common and documented APIs for interfacing with the devices: HomeAssistant (high-level) and MQTT (lower-level, still easy).

      I personally run Zigbee2mqtt with HomeBridge and control everything from the Apple ecosystem. It works flawlessly for me and my family. From the nerd-side, I stream all MQTT messages as JSON to a Postgres database and use Grafana to plot various metrics from sensors and devices.

      1. 1

        Personally, I don’t like zigbee2mqtt. However, it is the best solution for vendor-independent gateway. I’m looking on zigbee-lua that uses Lua instead of Javascript and other alternatives.

        1. 1

          I agree - the amount of code and complexity of the Javascript in zigbee2mqtt is staggering. Thanks for pointing me to zigbee-lua - looks great.

          In an ideal world, there would be a standardised mqtt protocol definition with zigbee2mqtt and others implementing that protocol. From a short look it’s not entirely clear if zigbee-lua tries to be wire-compatible with zigbee2mqtt.

          1. 1

            In an ideal world, there would be a standardised mqtt protocol definition with zigbee2mqtt and others implementing that protocol.

            Absolutely agree.

            1. 1

              As far as I get it right, the main complexity of zigbee2mqtt are quirks for different Zigbee devices that doesn’t conform to Zigbee specification. For interaction with Zigbee devices, z2m uses zigbee-herdsman-converters to parse messages to and from devices. Adding support of a new Zigbee device to z2m is actually an implementation of a new converter that understands and processes messages from the new device.

              There is alternative of zigbee-herdsman-converters written in Python - zha-device-handlers. It uses zigpy for access to Zigbee messages, and it is used by Zigbee plugin for Home Assistant. zha-device-handlers contains a huge number of quirks for Zigbee devices, see subdirectories in the zhaquirks directory. zha-device-handlers has a great explanation of quirks for Zigbee devices and it is worth to read it - https://github.com/zigpy/zha-device-handlers#what-the-heck-is-a-quirk

            2. 1

              I’d never heard of zigbee-lua, but it looks pretty stale compared to zigbee2mqtt. I don’t find the implementation language anything more than a implementation detail, especially not when typically running in a container.

              I’ve used z2m on a raspberry pi and homeassistant on another. I moved to ZHA (the native Home assistant implementation) only by accident and was too lazy to start over again. But I’ll go back to z2m again after moving houses soon.

            3. 1

              I have tried using a USB-to-zigbee adapter, but with custom software and not zigbee2mqtt.

              Maybe the experience would have been better with zigbee2mqtt, but I generally like building my own stuff. From that perspective, the zigbee stack is not great, and my USB-to-zigbee interfered with the IKEA tradfri gateway pairing process.

              I hope more modern smart home standards result in better ecosystems, but I’ll stick to the vendor gateways for now :)

              1. 1

                The software mine came with was absolutely horrendous - which is usually the case for such systems. I updated the stick’s software and then uninstalled it :-)

                The great thing is, that Zigbee2mqtt makes building your own stuff incredibly nice - you just start at a different level - MQTT instead of the stick’s serial interface. Zigbee2mqtt is the gateway and provides an API (via MQTT) to control devices in your Zigbee network.

                That it will interfere with other gateway’s when both are open for devices to join is expected - but that’s expected. Multiple separate zigbee networks in the same house work fine. Devices just get confused which network to join when multiple gateways are in pairing mode.

                In my use case the only gateway used is the usb stick used by zigbee2mqtt, which removes the need for all other Gateways, thus freeing you from having to use a different gateway for each vendor, and putting you much more in control of the stack.

                1. 1

                  Well, there’s always Matter which should come out sometime this year. I’ll keep on using Home Assistant until Matter makes sense to switch to - and then maybe. Home Assistant is pretty nice, not having to care what ecosystem my stuff is in and just interact with all of them instead.

              1. 1

                I agree with most people here - just use with.

                However, in some situations, I also found another pattern ergonomic:

                def step1({:ok, data}), do: {:ok, data+1}
                def step1(fallthrough), do: fallthrough
                
                def step2({:ok, data}), do: {:ok, data*42}
                def step2(fallthrough), do: fallthrough
                
                def step3({:ok, data}), do: {:ok, to_string(data)}
                def step3(fallthrough), do: fallthrough
                
                def process(data) do
                  data
                  |> step1()
                  |> step2()
                  |> step3()
                end
                
                1. 9

                  I’m not into keeping up, but I do like to make stuff occasionally, and stay away from web because it’s too painful finding out how to do anything without being immersed in it day to day.

                  I’ve used Phoenix LiveView (for Elixir) recently, however, to make a Wordl-alike. It was a great experience and I didn’t have to write any JavaScript! I still had to write some CSS but it has variables now (you can see how little I keep up) and that made life a lot easier.

                  1. 5

                    I just want to highlight how great the LiveView concept is. As a gist: HTML is generated on the server and synced with the browser via diffing. The server is the authority, and all events are sent to the server for processing.

                    That approach solves a great deal of issues: No need to write REST API endpoint for every feature, no need to serialise data structures, no need to introduce a separate build for the frontend, easy testing (no need to spawn browsers), …

                    1. 2

                      Those are indeed substantial advantages. What about offline SPAs? Is there any way to keep the app running if there’s no network connection?

                      1. 2

                        No because it’s all requests to the server. I’ve seen some attempts to get a BEAM implementation to run in the browser, however (I think via web assembly) and if this becomes possible and feasible (small download, fast startup, low memory overhead) then I look forward to server side rendering from client side code!

                      2. 1

                        I have definitely found that it’s not working as snappily as I’d hoped when accessed by mobile phone. Not being a web developer I have no idea how to diagnose this. I thought I might see lag due to latency, but all is well on a laptop (on the same network) so I’m guessing it could be grunt required in the browser, which is a little disappointing.

                        Game here: https://fivelettrs.fly.dev/

                        1. 4

                          It’s pretty snappy on my iPhone, but it’s a recent model.

                          Looking at the client-server communication it seems like your template sends all “dynamic” strings on every model change. Clicking on a character gets this response from the server:

                          ["4","6","lv:phx-FtAFezJXYPUlsRqR","phx_reply",{"response":{"diff":{"1":{"d":[["guess-row ",{"d":[["guess pending","r"],["guess pending current"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}],["guess-row",{"d":[["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}],["guess-row",{"d":[["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}],["guess-row",{"d":[["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}],["guess-row",{"d":[["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}],["guess-row",{"d":[["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "],["guess pending"," "]],"s":0}]],"p":{"0":["\n            <span class=\"","\">","</span>\n"]}},"2":{"0":{"d":[[" id=\"q\"","key pending"," phx-value-key=\"q\"","q"],[" id=\"w\"","key pending"," phx-value-key=\"w\"","w"],[" id=\"e\"","key pending"," phx-value-key=\"e\"","e"],[" id=\"r\"","key pending"," phx-value-key=\"r\"","r"],[" id=\"t\"","key pending"," phx-value-key=\"t\"","t"],[" id=\"y\"","key pending"," phx-value-key=\"y\"","y"],[" id=\"u\"","key pending"," phx-value-key=\"u\"","u"],[" id=\"i\"","key pending"," phx-value-key=\"i\"","i"],[" id=\"o\"","key pending"," phx-value-key=\"o\"","o"],[" id=\"p\"","key pending"," phx-value-key=\"p\"","p"]]},"1":{"d":[[" id=\"a\"","key pending"," phx-value-key=\"a\"","a"],[" id=\"s\"","key pending"," phx-value-key=\"s\"","s"],[" id=\"d\"","key pending"," phx-value-key=\"d\"","d"],[" id=\"f\"","key pending"," phx-value-key=\"f\"","f"],[" id=\"g\"","key pending"," phx-value-key=\"g\"","g"],[" id=\"h\"","key pending"," phx-value-key=\"h\"","h"],[" id=\"j\"","key pending"," phx-value-key=\"j\"","j"],[" id=\"k\"","key pending"," phx-value-key=\"k\"","k"],[" id=\"l\"","key pending"," phx-value-key=\"l\"","l"]]},"2":"key backspace","3":{"d":[[" id=\"z\"","key pending"," phx-value-key=\"z\"","z"],[" id=\"x\"","key pending"," phx-value-key=\"x\"","x"],[" id=\"c\"","key pending"," phx-value-key=\"c\"","c"],[" id=\"v\"","key pending"," phx-value-key=\"v\"","v"],[" id=\"b\"","key pending"," phx-value-key=\"b\"","b"],[" id=\"n\"","key pending"," phx-value-key=\"n\"","n"],[" id=\"m\"","key pending"," phx-value-key=\"m\"","m"]]},"4":"key enter disabled"}}},"status":"ok"}]	1643819914.7385468
                          

                          …which is way too much data for a single-cell change. I’m guessing that slower JS engines may feel sluggish when consolidating the Virtual-DOM in the browser with the changes from the server (LiveView doesn’t directly updates the Dom but uses a virtual-dom library internally as an optimization).

                          Thankfully, that shouldn’t be too hard to fix (as all these Dom patches are unnecessary). My guess is that your #guesses div is re-rendered fully for every change because the change-tracking of the HEEx template isn’t working correctly. Without the code one can only guess why. A first start is looking at Change Tracking Pitfalls.

                          1. 1

                            I’ll have a look, thanks. It improved somewhat after I took some advice on how to render the (dynamic) grid and keyboard in a way that was HEEx-friendly, but looking at the size of that diff I don’t think it’s quite right yet!

                            In case you’re interested in seeing my rather fumbling first attempt at liveview: here’s the repo and here’s a direct link to the the heex, liveview and the game struct/code

                            1. 1

                              After some pain, I’ve concluded that LiveView can’t do the change tracking needed if I am using a single ‘game’ struct, and therefore I’m doing what I feared necessary: an ‘assign’ for every visible grid ‘tile’ and keyboard ‘key’.

                              Small diffs but nasty HEEx and code!

                              1. 1

                                If I remember correctly HEEx can track inside structs. So the culprit may be the calls to functions that get passed the whole @game assign. I think you can rewrite your Game struct to contain the required data without having to go through struct members you should get good performance too. You could also introduce a GameStateView (or similar) struct which contains the data in a format ready for use in the template.

                      1. 12

                        Today I was being polite and held the door for someone, but they looked like they wouldn’t be paying me for doing that, so I slammed the door at them and broke their fucking face. I can’t believe anybody is endorsing this behavior.

                        1. 6

                          Exactly. There are two very different scenarios:

                          I hold the door open for you but my hand slips and it shuts on you and you get hurt. This is the kind of scenario where the disclaimer of warranty in most open source licenses covers: you made a best-effort attempt to do the nice thing, you failed, and someone got hurt.

                          I hold the door open for you and then slam it in your face as you get here. This is actively malicious behaviour that causes actual harm. In the metaphor, this would likely be covered by something like actual bodily harm. In the scenario in the article, this is likely covered by computer misuse laws. No disclaimer of warranty protects you.

                          1. 3

                            Can you un-publish a library on npm, and what happens if you do? If so, a third scenario would appear:

                            I stop opening the door for you and you run into it because you expected me to open it.

                            1. 1

                              Un-publish in NPM has rules. If the door is not used that much (or just built in yesterday), you can leave it closed as you want.

                              1. 1

                                It is in fact what happened back in 2016 with the infamous left-pad incident.

                          1. 15

                            Note that Rust does this automatically for you since Rust 1.18, released in 2017. By coincidence, the example case used, (u8, u16, u8), is exactly same in the Rust release note.

                            1. 2

                              Does anyone know if Go could do this? And was it ever considered?

                              1. 4

                                As far as I know, there is nothing in the spec that guarantees struct order layout, and the only way to really observe it is to use the unsafe package which is not covered by the Go 1 compatibility promise. So technically it could.

                                That said, changing it now would break too much code that uses structs with cgo/assembly/syscalls, so I doubt it will happen any time soon. If it ever does, I’d expect it will come with a similar annotation to Rust’s #[repr(C)], at the very least.

                                Here’s an issue where these things have been considered: https://github.com/golang/go/issues/36606

                              2. 1

                                That seems rather brutal for binary compatibility or when interacting with C. I assume it can be turned off on a struct by struct basis?

                                1. 12

                                  Yes, #[repr(C)], it’s right there in the linked release notes :-)

                                  1. 3

                                    And all the details (and other representations) are documented: https://doc.rust-lang.org/reference/type-layout.html#representations

                              1. 5

                                For hardware or artificial-scarcity fetishists I guess this is really exciting. For everyone else, I don’t know why anyone would waste donate money for something which we can perfectly emulate on about every platform and architecture you can imagine. These emulators also have the benefit of allowing you to use digital copies of the games instead of increasingly rare and limited cartridges.

                                1. 4

                                  I don’t think the “rare and limited” argument holds. There are things like the Everdrive which emulate NES cartridges.

                                  This debate is also held for pretty much anything that’s old and collectable: After restoring an old motorcycle, should you ride it or put it in a display case to look at?

                                  1. 1

                                    It should be possible to make novel hardware cartridges too, although perhaps more difficult to legally sell them for copyright reasons (but you could imagine selling a generic NES cartridge that reads data from a SD card, leaving it to the end user to be the one to violate Nintendo’s copyright by downloading the NES roms and putting them on the SD card).

                                    1. 1

                                      Krikzz (https://krikzz.com) has made an industry out of this very idea.

                                  1. 17

                                    SQLite is my go-to for small to medium size webapps that could reasonably run on a single server. It is zero effort to set up. If you need a higher performance DB, you probably need to scale past a single server anyway, and then you have a whole bunch of other scaling issues, where you need a web cache and other stuff anyway.

                                    1. 5

                                      Reasons not to do that are handling backup at a different place than the application, good inspection tools while your app runs, perf optimization things (also “shared” memory usage with one big dbms instance) you can’t do in sqlite and the easier path for migrating to a multi-machine setup. Lastly you’ll also get separation of concerns, allowing you to split up some parts of your up into different permission levels.

                                      1. 5

                                        Regarding backups: what’s wrong with the .backup command

                                        1. 1

                                          If I’m reading that right you’ll have to implement that into your application. postgres/mariadb can be backed up (and restored) without any application interaction. Thus it can also be performed by a specialized backup user (making it also a little bit more secure).

                                          1. 12

                                            As far as I know, you can use the sqlite3 CLI tool to run .backup while your application is still running. I think it’s fine if you have multiple readers while one process is writing to the DB.

                                            1. 5

                                              Yes, provided you use WAL mode, which you should probably do anyway.

                                            2. 7

                                              You could use litestream to stream your SQLite changes to local and offsite backups. Works pretty well.

                                              1. 7

                                                Ok but instead of adding another dependency that solves the shortcomings of not using a DBMS (and I’ll also have to care about) I could instead use a DBMS.

                                                1. 6

                                                  OK, but then you need to administer a DBMS server, with security, performance, testing, and other implications. The point is that there are tradeoffs and that SQLite offers a simple one for many applications.

                                                  1. 3

                                                    Not just that, but what exactly are the problems that make someone need a DBMS server? Sqlite3 is thread safe and for remote replication you can just use something like https://www.symmetricds.org/, right? Even then, you can safely store data up to a couple of terabytes in a single Sqlite3 server, too, and it’s pretty fault tolerant by itself. Am I missing something here?

                                                    1. 2

                                                      What does a “single sqlite3 server” mean in the context of an embedded database?

                                                      How do you run N copies of your application for HA/operational purposes when the database is “glued with only one instance of the application”?

                                                      It’s far from easy in my experience.

                                                      1. 2

                                                        My experience has been that managing Postgres replication is also far from easy (though to be fair, Amazon will now do this for you if you’re willing to pay for it).

                                                      2. 1

                                                        SymmetricDS supports many databases and can replicate across different databases, including Oracle, MySQL, MariaDB, PostgreSQL, MS SQL Server (including Azure), IBM DB2 (UDB, iSeries, and zSeries), H2, HSQLDB, Derby, Firebird, Interbase, Informix, Greenplum, SQLite, Sybase ASE, Sybase ASA (SQL Anywhere), Amazon Redshift, MongoDB, and VoltDB databases.

                                                        This seems quite remarkable - any experience with it?

                                                    2. 3

                                                      Where do you see the difference between litestream and a tool to backup Postgres/MariaDB? Last time I checked my self-hosted Postgres instance didn’t backup itself.

                                                      1. 1

                                                        You have a point but nearly every dbms hoster has automatic backups and I know many backup solutions that automate this. I am running stuff only by myself though (no SaaS)

                                                  2. 6

                                                    No, it’s fine to open a SQLite database in another process, such as the CLI. And as long as you use WAL mode, a writer doesn’t interrupt a reader, and a reader can use a RO transaction to operate on a consistent snapshot of the database.

                                            1. 1

                                              I wonder how the applicants had to submit/present their solution. I’m not sure if I’d manage to write a syntactically correct & compiling FizzBuzz in C or so on a whiteboard. Is a missing ; already a reason to fail the test?

                                              1. 2

                                                I think the whole procedure is to filter out people who aren’t able to think like a programmer. I wouldn’t sort someone out who’d make syntax errors, but otherwise has the right logic applied to their solution, because this is where you can’t get help. The compiler will tell you a syntactical or semantical error, but never logic one

                                                1. 4

                                                  I did have one interview where I literally said something like “I don’t remember if it was .strip() or .trim() or whatever” and it was marked down as an error, so I guess the spectrum allows for “you missed a ; here”

                                                  1. 9

                                                    That sounds like a great interview. You learned that the company valued memorising details that are trivial to look up over thinking skills.

                                                    Interviews are a bidirectional communication channel. I don’t know what information was transferred towards them but they efficiently communicated that they’re not the kind of place you’d want to work.

                                                    1. 3

                                                      I had an interview where someone asked about inner vs. outer join and I said, “Oh, I just google that every time.” Didn’t get the job. :-)

                                                      1. 4

                                                        That’s a good way of telling someone who writes a little bit of sql from someone who writes it regularly. Whether or not that’s relevant information is another question.

                                                        1. 2

                                                          Yeah, or someone who uses an ORM or someone who avoids creating tables that require JOINS or …

                                                          I think part of what throws me off about the question is that I never use either by that name. I use LEFT JOIN (which is one kind of inner join) pretty much exclusively, although I did have cause for a CROSS JOIN the other day.

                                                1. 40

                                                  Looks like the employee is based in the UK. As you might expect, most of the responses to his announcement are Bad Legal Advice. This comment is also going to be Bad Legal Advice (IANAL!) but I have some experience and a little background knowledge so I hope I can comment more wisely…

                                                  The way FOSS (and indeed all private-time) software development works here for employees is that according to your contract your employer will own everything you create, even in your private time. Opinions I’ve heard from solicitors and employment law experts suggest that this practice might constitute an over-broad, “unfair”, contract term under UK law. That means you might be able to get it overturned if you really tried, but you’d have to litigate to resolve it. At any rate the de facto status is: they own it by default.

                                                  What employees typically do is seek an IP waiver from their employer where the employer disclaims ownership of the side-project. The employer can refuse. If you’ve already started they could take ownership, as apparently is happening in this case. Probably in that scenario what you should not do is try to pre-emptively fork under some idea that your project is FOSS and that you have that right. The employer will likely take the view that because you aren’t the legal holder of the IP that you aren’t entitled to release either the original nor the fork as FOSS - so you’ve improperly releasing corporate source code. Pushing that subject is an speedy route to dismissal for “gross misconduct” - which a sufficient reason for summary dismissal, no process except appeal to tribunal after the fact.

                                                  My personal experience seeking IP waivers, before I turned contractor (after which none of the above applies), was mixed. One startup refused it and even reprimanded me for asking - the management took the view that any side project was a “distraction from the main goal”. Conversely ThoughtWorks granted IP waivers pretty much blanket - you entered your project name and description in a shared spreadsheet and they sent you a notice when the solicitor saw the new entry. They took professional pride in never refusing unless it conflicted with the client you were currently working with.

                                                  My guess is that legal rules and practices on this are similar in most common law countries (UK, Australia, Canada, America, NZ).

                                                  1. 27

                                                    The way FOSS (and indeed all private-time) software development works here for employees is that according to your contract your employer will own everything you create, even in your private time.

                                                    This seems absurd. If I’m a chef, do things I cook in my kitchen at home belong to my employer? If I’m a writer do my kids’ book reports that I help with become privileged? If I’m a mechanic can I no longer change my in-laws’ oil?

                                                    Why is software singled out like this and, moreover, why do people think it’s okay?

                                                    1. 10

                                                      There have been cases of employees claiming to have written some essential piece of software their employer relied on in their spare time. Sometimes that was even plausible, but still it’s essentially taking your employer hostage. There have been cases of people starting competitors to their employer in their spare time; what is or is not competition is often subject to differences of opinion and are often a matter of degree. These are shadow areas that are threatening to business owners that they want to blanket prevent by such contractual stipulations.

                                                      Software isn’t singled out. It’s exactly the same in all kinds of research, design and other creative activities.

                                                      1. 12

                                                        There have been cases of people starting competitors to their employer in their spare time;

                                                        Sounds fine to me, what’s the problem? Should it be illegal for an employer to look for a way to lay off employees or otherwise reduce its workforce?

                                                        1. 4

                                                          what’s the problem?

                                                          I think it’s a pretty large problem if someone can become a colleague, quickly hoover up all the hard won knowledge we’ve together accumulated over the past decade, then start a direct competitor to my employer, possibly putting me out of work.

                                                          You’re thinking of large faceless companies that you have no allegiance to. I’m thinking of the two founders of the company that employs me and my two dozen colleagues, whom I feel loyal towards.

                                                          This kind of thing protects smaller companies more than larger ones.

                                                          1. 2

                                                            …start a direct competitor to my employer, possibly putting me out of work.

                                                            Go work for the competitor! Also, people can already do pretty much what you describe in much of the US where non-competes are unenforceable. To be clear, I think this kind of hyper competitiveness is gross, and I would much rather collaborate with people to solve problems than stab them in the back (I’m a terrible capitalist). But I’m absolutely opposed to giving companies this kind of legal control over (and “protection” from) their employees.

                                                            1. 3

                                                              Go work for the competitor!

                                                              Who says they want me? Also I care for my colleagues: who says they want them as well?

                                                              where non-competes are unenforceable

                                                              Overly broad non-competes are unenforceable when used to attempt to enforce against something not clearly competition. They are perfectly enforceable if you start working for, or start, a direct competitor, profiting from very specific relevant knowledge.

                                                              opposed to giving companies this kind of legal control

                                                              As I see it we don’t give “the company” legal control: we effectively give humans, me and my colleagues, legal control over what new colleagues are allowed to do, in the short run, with the knowledge and experience they gain from working with us. We’re not protecting some nameless company: we’re protecting our livelihood.

                                                              And please note that my employer does waive rights to unrelated side projects if you ask them, waives rights to contributions to OSS, etc. Also note that non-compete restrictions are only for a year anyway.

                                                              1. 1

                                                                Who says they want me? Also I care for my colleagues: who says they want them as well?

                                                                Well then get a different job, get over it, someone produced a better product than your company, that’s the whole point of capitalism!

                                                                They are perfectly enforceable if you start working for, or start, a direct competitor, profiting from very specific relevant knowledge.

                                                                Not in California, at least, it’s trivially easy to Google this.

                                                                As I see it we don’t give “the company” legal control: we effectively give humans, me and my colleagues, legal control over what new colleagues are allowed to do, in the short run, with the knowledge and experience they gain from working with us.

                                                                Are you a legal party to the contract? If not, then no, it’s a contract with your employer and if it suits your employer to use it to screw you over, they probably will.

                                                                I truly hope that you work for amazing people, but you need to recognize that almost no one else does.

                                                                Even small startups routinely screw over their employees, so unless I’ve got a crazy amount of vested equity, I have literally zero loyalty, and that’s exactly how capitalism is supposed to work: the company doesn’t have to care about me, and I don’t have to care about the company, we help each other out only as long as it benefits us.

                                                              2. 1

                                                                Go work for the competitor?

                                                                Why would the competitor want/need the person they formerly worked with/for?

                                                                1. 1

                                                                  Why did the original company need the person who started the competitor? Companies need workers and if the competitor puts the original company out of business (I was responding to the “putting me out of work” bit) then presumably it has taken on the original company’s customers and will need more workers, and who better than people already familiar with the industry!

                                                            2. 1

                                                              Laying off and reducing the workforce can be regulated (and is in my non-US country). The issue with having employees starting competitor products is that they benefit from an unfair advantage and create a huge conflict of interest.

                                                              1. 2

                                                                Modern Silicon Valley began with employees starting competitor products: https://en.wikipedia.org/wiki/Traitorous_eight

                                                                If California enforced non-compete agreements, Silicon Valley might well not have ended up existing. Non-enforcement of noncompetes is believed to be one of the major factors that resulted in Silicon Valley overtaking Boston’s Route 128 corridor, formerly a competitive center of technology development: https://hbr.org/2016/11/the-reason-silicon-valley-beat-out-boston-for-vc-dominance

                                                                1. 1

                                                                  I don’t think we are talking about the same thing. While I agree that any restriction on post-employment should be banned, I don’t think it is unfair for an organization to ask their employees to not work on competing products while being under their payroll. These are two very different situations.

                                                                2. 2

                                                                  If the employee uses company IP in their product then sure, sue them, that’s totally fair. But if the employee wants to use their deep knowledge of an industry to build a better product in their free time, then it sucks for their employer, but that’s capitalism. Maybe the employer should have made a better product so it would be harder for the employee to build something to compete with it. In fact, it seems like encouraging employees to compete with their employers would actually be good for consumers and the economy / society at large.

                                                                  1. 1

                                                                    An employee working on competing products on its free time creates an unfair advantage because the employees have access to an organization IP to build its new product while the organization does not have access to the competing product IP. So what’s the difference between industrial espionage and employees working on competing products on their free time?

                                                                    1. 1

                                                                      If the employee uses company IP in their product then sure, sue them, that’s totally fair.

                                                                      That was literally in the comment you responded to.

                                                            3. 4

                                                              Joel Spolsky wrote a piece that frames it well, I think. I don’t personally find it especially persuasive, but I think it does answer the question of why software falls into a different bucket than cooking at home or working on a car under your shade tree, and why many people think it’s OK.

                                                              1. 3

                                                                Does this article suggest the employers view contracts as paying for an employee’s time, rather than just paying for their work?

                                                                Could a contract just be “in exchange for this salary, we’d like $some_metric of work”, with working hours just being something to help with management? It seems irrelevant when you came up with something, as long as you ultimately give your employer the amount of work they paid you for.

                                                                Why should an employer care about extra work being released as FOSS if they’ve already received the amount they paid an employee for?

                                                                EDIT: I realise now that $some_metric is probably very hard to define in terms of anything except number of hours worked, which ends up being the same problem

                                                                1. 2

                                                                  Does this article suggest the employers view contracts as paying for an employee’s time, rather than just paying for their work?

                                                                  I didn’t read it that way. It’s short, though. I’d suggest reading it and forming your own impression.

                                                                  Could a contract just be “in exchange for this salary, we’d like $some_metric of work”, with working hours just being something to help with management? It seems irrelevant when you came up with something, as long as you ultimately give your employer the amount of work they paid you for.

                                                                  I’d certainly think that one of many possible reasonable work arrangements. I didn’t link the article intending to advocate for any particular one, and I don’t think its author intended to with this piece, either.

                                                                  I only linked it as an answer to the question that I read in /u/lorddimwit’s comment as “why is this even a thing?” because I think it’s a plausible and cogent explanation of how these agreements might come to be as widespread as they are.

                                                                  Why should an employer care about extra work being released as FOSS if they’ve already received the amount they paid an employee for?

                                                                  As a general matter, I don’t believe they should. One reason I’ve heard given for why they might is that they’re afraid it will help their competition. I, once again, do not find that persuasive personally. But it is one perceived interest in the matter that might lead an employer to negotiate an agreement that precludes releasing side work without concurrence from management.

                                                                  1. 1

                                                                    I only linked it as an answer to the question that I read in /u/lorddimwit’s comment as “why is this even a thing?” because I think it’s a plausible and cogent explanation of how these agreements might come to be as widespread as they are.

                                                                    I think so too, and hope I didn’t come across as assuming you (or the article) were advocating anything that needs to be argued!

                                                                    I didn’t read it that way. It’s short, though. I’d suggest reading it and forming your own impression.

                                                                    I’d definitely gotten confused because I completely ignored that the author is saying that the thinking can become “I don’t just want to buy your 9:00-5:00 inventions. I want them all, and I’m going to pay you a nice salary to get them all”. Sorry!

                                                              2. 3

                                                                There is a huge difference: We’re talking about creativity and invention. The company isn’t hiring your for changing some oil or swapping some server hardware. They’re hiring you to solve their problems, to be creative and think of solutions. (Which is also why I don’t think it’s relevant how many hours you actually coded, the result and time you thought about it matters.) Your company doesn’t exist because it’s changing oil, the value is in the code (hopefully) and thus their IP.

                                                                So yes, that’s why this stuff is actually different. Obviously you want to have exemptions from this kind of stuff when you do FOSS things.

                                                                1. 2

                                                                  I think the chef and mechanic examples are a bit different since they’re not creating intellectual property, and a book report is probably not interesting to an employer.

                                                                  Maybe a closer example would be a chef employed to write recipes for a book/site. Their employer might have a problem with them creating and publishing their own recipes for free in their own time. Similarly, maybe a writer could get in trouble for independently publishing things written in their own time while employed to write for a company. I can see it happening for other IP that isn’t software, although I don’t know if it happens in reality.

                                                                  1. 3

                                                                    I think the “not interesting” bit is a key point here. I have no idea what Bumble is or the scope of the company, and I speak out of frustration of these overarching “legal” restrictions, but its sounds like they are an immature organization trying to hold on to anything interesting their employees do, core to the current business, or not, in case they need to pivot or find a new revenue stream.

                                                                    Frankly if a company is so fearful that a couple of technologies will make make or break their company, their business model sucks. Technology != product.

                                                                    1. 2

                                                                      Similarly, maybe a writer could get in trouble for independently publishing things written in their own time while employed to write for a company

                                                                      I know of at least one online magazine’s contracts which forbid exactly this. If you write for them, you publicly only write for them.

                                                                  2. 10

                                                                    This is pretty much my (non-lawyer) understanding and a good summary, thanks.

                                                                    If you find yourself in this situation, talk to a lawyer. However I suspect that unless you have deep pockets and a willingness to litigate “is this clause enforceable” through several courts, your best chance is likely to be reaching some agreement with the company that gives them what they want whilst letting you retain control of the project or at least a fork.

                                                                    One startup refused it and even reprimanded me for asking - the management took the view that any side project was a “distraction from the main goal”

                                                                    I think the legal term for this is “bunch of arsehats”. I’m curious to know whether you worked for them after they started out like this?

                                                                    1. 6

                                                                      I think the legal term for this is “bunch of arsehats”.

                                                                      https://www.youtube.com/watch?v=Oz8RjPAD2Jk

                                                                      I’m curious to know whether you worked for them after they started out like this?

                                                                      I left shortly after for other reasons

                                                                    2. 2

                                                                      The way FOSS (and indeed all private-time) software development works here for employees is that according to your contract your employer will own everything you create, even in your private time

                                                                      Is it really that widespread? It’s a question that we get asked by candidates but our contract is pretty clear that personal-time open source comes under the moonlighting clause (i.e. don’t directly compete with your employer). If it is, we should make a bigger deal about it in recruiting.

                                                                      1. 1

                                                                        I would think the solution is to quit, then start a new project without re-using any line of code of the old project - but I guess the lawyers thought of this too and added clauses giving them ownership of the new project too…

                                                                      1. 13

                                                                        It’s interesting the SMART Health Card standard implemented here is entirely incompatible with the Digital COVID Certificate standard (Interoperable 2D Code, pdf) being rolled out in the EU (and currently used for the digital NHS England COVID Pass).

                                                                        Perhaps the IATA Travel Pass will be more successful as a unifying standard.

                                                                        1. 5

                                                                          Just for fun, the contents of the EU covid cert have a much more concise-looking schema than the US one (less XML-y deep structure and magic URLs). And the European container seems to be CBOR + Base45 vs. the US one JSON base64’d then run through a transform that doubles byte count turning everything into decimal digits. Both use gzip. (Ed: turns out QR codes have a numeric encoding that makes three decimal digits only take ten bits, so the US way is transmitting 6 bits in 6 and 2/3 bits on average, ~90% efficient. And Base45 gets 16 bits in three 5.5-bit chars, ~97% efficient. Now it all makes more sense!)

                                                                          Interesting that both versions seem to fit in that size QR code (must just be able to hold a lot); I’d’ve thought even with gzip, everything in the US structure would be a tight fit.

                                                                          1. 3

                                                                            Note that what the US one is using is a standardised interoperable healthcare format called FHIR. The json representation looks pretty verbose, but handles many things you’d forget when coming up with your own format to represent healthcare data.

                                                                            Just look at the FHIR R4 definition for HumanName in context of Patient

                                                                            • name HumanName 0..*: A person may have 0, 1, or more names
                                                                            • For each HumanName:
                                                                              • use {usual, temporary, official, nickname, maiden, ...}: The context of this HumanName; does this person use it as a nickname, is it the person’s maiden name, …
                                                                              • family string 0..1: May or may not have a family name
                                                                              • given string 0..*: 0 or more given names (usually surname)
                                                                              • period: 0..1 Period: The time period this name was/is/will be used

                                                                            And this is just a small extract from just the HumanName data type. FHIR also has a system to manage logical IDs as well as external IDs (i.e. if a Patient is tracked in different databases in a hospital), support for various code systems used in healthcare (ICD-10, CPT, …), the most complex/complete system to handle temporal information I’ve seen, a super-integrated extension mechanism, …

                                                                            The whole documentation, data schema definition and basically everything is also completely machine-readable.

                                                                            It’s very complex, but I recommend everyone who does some sort of data modelling to take a look at some of the concepts. It’s a great inspiration.

                                                                            Source: I’ve been working with FHIR for a few years now :-)

                                                                        1. 7

                                                                          The big question: How? A simple printf inject sounds unlikely, or else it would somehow break for other escape sequences too.

                                                                          Edit: Nevermind, see https://lobste.rs/s/yklnww/quick_analysis_for_ssid_format_string_bug for an analysis

                                                                          1. 6

                                                                            How is this not an advertisement?

                                                                            1. 10

                                                                              I don’t work for, nor am I in any way affiliated with System76. I’m sharing this, because the hardware and software is open source, it a beautiful mechanical keyboard, and I thought there would be interest here.

                                                                              1. 2

                                                                                So, you’re advertising for them for free.

                                                                                1. 4

                                                                                  Isn’t that an oxymoron?

                                                                                  1. 5

                                                                                    The blunter way of putting it.

                                                                                    A spot on the Lobsters front page is worth a lot of money.

                                                                                    By posting product pages, we’re reinforcing to marketers/growth hackers “hey, come peddle your wares over here!”, and further we’re normalizing discussion of what are ultimately consumer product choices.

                                                                                    Neither of these has good long-term effects on the community.

                                                                                    1. 1

                                                                                      Sounds good. Thanks.

                                                                                      1. 1

                                                                                        No problem!

                                                                                        (Sorry if I came across a little short…it seems like an uptick for me, and I’ve been trying to fight this for years now.)

                                                                              2. 6

                                                                                This way, any service that has a paid plan couldn’t be mentioned here. I think this is a valuable information, because it’s about open source hardware.

                                                                                1. 3

                                                                                  A product which can only be bought is different than something which has also a paid plan. This is product placement directly to their target audience and not many people seem to care, while at the same time running all sorts of adblockers

                                                                                2. 1

                                                                                  It is but people can’t seem to be able to admit that they too are prone of advertising products.

                                                                                  I think this is why we will never have any way to flag them as such, just flag as “spam” and move on.

                                                                                1. 11

                                                                                  The class names are long because they do a lot of things.

                                                                                  “With Tailwind, you’re forced to interpret semantics on the fly”

                                                                                  With css, you’re forced to flip to through some other file to get it. If you don’t see the tailwind code as obviously better, I would still say try it, and if you’re not convinced, don’t use it I guess, but nothing written there at all convinces me otherwise.

                                                                                  Point 3 is absurd, the docs immediately explain how to set up purging so that unused class names. My purged css is like 4.5kb and my unpurged css is like 8MB.

                                                                                  1. 4

                                                                                    Yep, I thought that was a pretty disingenuous point. Purging excess CSS is talked about so much, even on the homepage:

                                                                                    It’s tiny in production.

                                                                                    Tailwind automatically removes all unused CSS when building for production, which means your final CSS bundle is the smallest it could possibly be. In fact, most Tailwind projects ship less than 10KB of CSS to the client.

                                                                                    1. 8

                                                                                      One problem with the “we don’t care about the size because our custom minifier will make it small” is that it adds yet another part to the ridiculously fragile rube-goldberg machine that is npm.

                                                                                      1. 3

                                                                                        Also, may I introduce you to Windi CSS, that doesn’t even generate unused tailwind classes in the first place :) ! https://github.com/windicss/windicss

                                                                                        1. 1

                                                                                          Or twind, which doesn’t even require you to generate a CSS file in the first place. :-)

                                                                                          If you use the shim that is: https://twind.dev/docs/modules/twind_shim.html

                                                                                    1. 4

                                                                                      I got checkmated by a glorious pawn-to-queen promotion where the original queen controlled the seventh and the promoted controlled the last rank.

                                                                                      1. 10

                                                                                        Is it just or it is really annoying to see informational stuff like this on ProtoSchool? Just let me scroll through a document with (sub-)headlines instead of asking me to answer questions before getting to the next part of the document.

                                                                                        1. 3

                                                                                          I didn’t like it either. And when there was not a line of code by the end of the second part, I closed the tab.

                                                                                          1. 2

                                                                                            It’s not just you, and I closed the tab after the first screen.

                                                                                          1. 29

                                                                                            Web developers really are a parody of themselves. Everything they create must be a Rube Goldberg machine.

                                                                                            1. 33

                                                                                              Those of you who really can’t stand web development can always filter. Unsupported categorical statements like this don’t reflect well on the lobsters community. I ask that people who upvoted it reconsider. The author may have left themselves open to misinterpretation by not providing context in the article. However, looking at their other blog posts, it seems they’re working on some non-trivial graphics, which might warrant some of the technical choices they describe.

                                                                                              1. 16

                                                                                                Web developers are the only category of programmer who have to endure this level of condescension frequently. I feel like I’m seeing posts shaming developers for their supposedly bloated JS or mocking users of JS/frameworks/electron on a daily basis on the lobste.rs front page nowadays.

                                                                                                1. 18

                                                                                                  This may be because the ecosystem is deeply fucked, many developers are complicit in this, and all of us are victims of the previous two points to one degree or another.

                                                                                                2. 9

                                                                                                  I’ve been doing web development, front-end and back-end, for a while now, and I agree with the root comment. That said, the author probably has a reason for tackling things this way, and we got to see some neat notes on using <template>.

                                                                                                3. 12

                                                                                                  I stopped reading when I reached

                                                                                                  No lib is going to be used for routing. Routing is going to consist of simple manipulations of the browser history with popstate and pushstate. The basic approach is: [four increasingly complex steps that don’t even do error handling]

                                                                                                  …if only there was some sort of semantic element that allowed us to tell the browser to do the navigation for us…

                                                                                                  1. 8

                                                                                                    I’m assuming your sarcasm is aimed at what you presume to be overlooked anchor tags. Depending on what the author is building, it may be necessary to support in-app transitions without loading a whole new page. However, the article’s lack of context make it difficult to assess the appropriateness of their technology choices.

                                                                                                    1. 2

                                                                                                      But you could still do <a href=”#some_id”> to transition on the same page, right? And use CSS to dictate what section is visible to make it “app-like” rather than just one long page. But yeah, it’s hard to tell if the author is against this for some reason.

                                                                                                      1. 3

                                                                                                        That’s an interesting idea, but it assumes the routing is directly related to DOM content. If the routing is in relation to canvas content, some kind of JS-based routing will be necessary. But again, I don’t think any meaningful assessments can be made without more context.

                                                                                                    2. 3

                                                                                                      So you stopped right before the recommendation not to use that technique for the most part, because ordinarily you just need a link and no JS.

                                                                                                    3. 5

                                                                                                      I recently had a taste of this on my own site; I vented about it a bit in the commit log. Even standards for seemingly simple things like icons have grown to include way too many things.

                                                                                                      This also goes beyond standards. The growth of huge frameworks and prioritization of developer speed and convenience over the quality of the software itself has been awful for progressive enhancement. CSS, images, JS, etc. all may or may not load; they are optional enhancements that pages should work well without. Exceptions exist, but they shouldn’t be common.

                                                                                                      Most sites don’t even need to be complex enough to warrant advanced cross-browser testing; they just need to be marked-up text documents. I posted a blog post to lobsters a few weeks ago that summarized my views.

                                                                                                      1. 4

                                                                                                        what are you, a non-web developer making desktop applications using non-web protocols or what?

                                                                                                      1. 23

                                                                                                        Spoiler: the article never directly answers the clickbait question in the title. The article starts with an overview of the problems with Zig’s competitors, then describes various features of Zig. The conclusion of the article is just (paraphrasing) “this article is getting long so I’ll write more about Zig later.”

                                                                                                        1. 31

                                                                                                          That’s technically true, but I would say that this is one of the best articles about programming languages I’ve seen on lobste.rs in a few weeks or months.

                                                                                                          The author demonstrably has experience with C, C++, Swift, Objective C, and Julia, and the ZIg content is quite clearly explained. Better than I’ve seen elsewhere.

                                                                                                          So yes the title has the style of clickbait , but the content is actually good.

                                                                                                          1. 6

                                                                                                            I agree. Was really nice to see a comparison of all those languages in one place and it generally resonates with me.

                                                                                                            I’d love to see some more examples of what the author finds doesn’t “click” with him in Swift though. I really enjoy the language and find it a pity Apple just focused on iOS development.

                                                                                                          2. 12

                                                                                                            I once read somewhere that every headline on articles in print and the internet can be answered with “no” and then you’ve saved yourself a click and a clickbaity article. Applies here as well, next to being on stupid medium.com it’s also not saying much. Lots of words though, not much content.

                                                                                                            1. 17
                                                                                                              1. 3

                                                                                                                Would I have ever remembered that law’s name if you didn’t tell me? ;)

                                                                                                                Anyway, I find it hard to take an article about a C replacement seriously when half the “replacements” it mentions use mandatory garbage collection, and the article doesn’t mention Ada, which is actually used in production, in roles where C is otherwise uncontested, i.e. OS kernels and embedded.

                                                                                                              2. 9

                                                                                                                The question you want to ask yourself is, “Is Betteridge’s Law of Headlines universally correct?” The answer may shock you! Sensitive readers are advised to turn away now.

                                                                                                                Answer is “not quite”. If nothing else because sometimes ad copy starts with a heading like “Is there anything better than Coldbutt™️ branded butt flavoured toothpaste? Our toothpaste flavor exists weigh in.”

                                                                                                              3. 7

                                                                                                                Compared to a lot of the recent thinly-veiled Rust promotional posts, I think this has equal if not more substance.

                                                                                                                1. 4

                                                                                                                  Ugh. I wish Lobsters had a flag-topic for clickbait.

                                                                                                                  1. 14

                                                                                                                    The title is clickbait-ish, but the content is good… I wouldn’t flag this one.

                                                                                                                    1. 4

                                                                                                                      Spam is probably the closest flag option

                                                                                                                      1. 13

                                                                                                                        The article is very clearly not spam, so that would be misusing it.

                                                                                                                        1. 1

                                                                                                                          spam being misused for this article is implied by virtue of it being the “closest flag option” and not actually the flag they want to use (because clickbait isn’t an option)

                                                                                                                    2. 1

                                                                                                                      I was about to say, can this article’s title be any more clickbaity? Will Zig also increase my girth my 2 inches??

                                                                                                                    1. 2

                                                                                                                      Since transducers are often returned from special forms of functions, like those used in threading, I guess that’s why I never understood why I might bother with them.

                                                                                                                      Do they only save time if you set them up before use and then use the same definition over and over again? Because that sounds like a function on its own.

                                                                                                                      1. 3

                                                                                                                        Do they only save time if you set them up before use and then use the same definition over and over again?

                                                                                                                        If you do

                                                                                                                        (->> seq
                                                                                                                          (map inc)
                                                                                                                          (map inc)
                                                                                                                          (filter even?))
                                                                                                                        

                                                                                                                        it will create two intermediate sequences (one for each inc stage) and finally return a third sequence from the even? step. Granted it won’t allocate & compute the whole sequence for each stage because they use ChunkedSeq, it still will do allocations which are thrown away or replaced in the next stage.

                                                                                                                        Transducers skip the intermediate sequences. It’s a performance optimization. Using transducers for the above pipeline is equal to (map+filter #(let [x (inc (inc %))] (if (even? x) x nil)) seq). The biggest benefit is that transducers compose just as nicely as sequence-operations + ->> do.

                                                                                                                        Since transducers are often returned from special forms of functions, like those used in threading, I guess that’s why I never understood why I might bother with them.

                                                                                                                        The functions used with the threading operator ->> are the “normal” forms and not some special implementation:

                                                                                                                        ->> just rewrites (->> seq (map inc) (map dec) (filter even?)) to (filter even? (map inc (map inc seq))). Nothing special is needed from map or filter.

                                                                                                                        The functions with arities n-1 (skipping the seq arg) return the transducer-versions.

                                                                                                                        1. 1

                                                                                                                          So by dropping that initial argument,the array, that could end up with threading to compose a transducer.

                                                                                                                          1. 1

                                                                                                                            Sadly not:

                                                                                                                            (->> 
                                                                                                                              (filter even?)
                                                                                                                              (map inc))
                                                                                                                            

                                                                                                                            will expand to

                                                                                                                            (map inc (filter even?))
                                                                                                                            

                                                                                                                            which invokes the arity-2 version of map which expects a seq as its second argument. However, the value returned by (filter even?) is a transducer and map will throw an error.

                                                                                                                            1. 3

                                                                                                                              Clojure seems to repeat all the mistakes Scala made in this regard, just without types and 10 years later…

                                                                                                                              1. 2

                                                                                                                                At least all of it is easier to write, and the language at least is extensible without obsoleting old code…

                                                                                                                                1. 6

                                                                                                                                  Agreed, having no types makes it easier due to not having to deal with HKTs, variance etc.

                                                                                                                                  But “extensible without obsoleting old code” isn’t really a selling point here:

                                                                                                                                  In both cases it’s library functionality that is so core to the language’s usage experience that defaults really matter – nobody is going to use “the better way” if “the obsolete way” is taking up the language’s prime real estate.

                                                                                                                                  What you really want to do is to “upgrade” the semantics from the worse model to the better model, and most languages/tooling have no solution for that.

                                                                                                                              2. 1

                                                                                                                                So part of the problem I see is transduce not composing like the other transducers might. Is that right?

                                                                                                                                I love threading. It makes so much code so much easier to read. It would be a shame to give it up just because it’s somewhat less efficient.

                                                                                                                        1. 37

                                                                                                                          How would you find a new and interesting blog post when all communities ban this?

                                                                                                                          1. 2

                                                                                                                            Huh? First of all, I’m not asking for a blanket ban across the entire internet, I’m talking specifically about this site. Second, plenty of ways: social media, Twitter, RSS, word of mouth…

                                                                                                                            1. 23
                                                                                                                              • Social Media: this site is social media. If you meant Facebook, no thanks.
                                                                                                                              • Twitter: Maybe, but for me it would be rare.
                                                                                                                              • RSS: not for discover new blogs
                                                                                                                              • Word of mouth: This site is that for me. I don’t share links with friends all day long.