• 0 Posts
  • 134 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle







  • I once developed an electronic program guide for a cable TV company in New Zealand and I’d lose my mind if I had to use timezones. The basic rule of thumb was:

    a) Internally you use UTC religiously. UTC is the same everywhere on Earth, time always goes forward, most languages have classes that represent instants, durations etc. In addition you make damned sure your server time is correct and UTC.

    b) You only deal with timezones when presenting something to a user or taking input from a user

    Prior to that I had worked for a US trading company that set all their servers to EST and was receiving trades through the system which expressed time & date ambiguously. Just had to assume everywhere that EST was the default but it was just dumb programming and I bet to this day every piece of code they develop has time bugs.


  • arc@lemm.eetoMemes@lemmy.mlEven paper glows
    link
    fedilink
    arrow-up
    61
    arrow-down
    1
    ·
    3 months ago

    The EFF has some info about the practice - https://www.eff.org/pages/list-printers-which-do-or-do-not-display-tracking-dots.

    I imagine there are ways and means of obfuscating / anonymizing the dots such as blocking the printer from emitting them (e.g. an empty yellow cartridge that the printer perceives as full), modifying the firmware, using a burner printer, or using a mono laser jet.

    As a side issue, most modern bank notes have a bunch of yellow circles integrated into the design on each side. They look random but they’re in a recognisable pattern called a constellation that enables devices like copiers / scanners to recognize when people are trying to copy money or other financial instruments like checks.


  • I’ve had multiple airfryers, not against them per se. There are some things they cook better IMO. Cocktail sausages come out well. Whole chickens too. Anything you can fit the relatively small dimensions and either lays flat on the bottom or can withstand agitation/stirring AND has good heat dispersion / circulation. Small portions work better. Generally they’re easy to clean although steel baskets and plastic fixtures on tend to be very flimsy and they don’t last more than a year or two of regular use. I even had an airfryer which had this stirring mechanism in it which supposedly negated the need to turn stuff over but often it just caused some foods to disintegrate into starchy crumbs.

    As for consumer ovens, can’t say I’ve had any major issues ever with them, be they electric or gas. They’re less efficient and slower to warm which is their downside. Once they’re up and cooking I think they work fine and are obviously more versatile.

    Pick the best tool for the job at hand basically. I think also, that something like an instant pot (or similar) is a better and more versatile device to buy before an airfryer.


  • arc@lemm.eetoGreentext@sh.itjust.worksAnon buys an air fryer
    link
    fedilink
    arrow-up
    28
    arrow-down
    4
    ·
    3 months ago

    Air fryers are basically just small convection ovens. If you have an oven then an air fryer does nothing you can’t already do. That said, it does cook some things slightly faster due to the confined space. I’ve found mine will cook a chicken in just over an hour saving maybe 20 or 30 minutes on a regular oven. I guess it also saves energy / money but whether it ever pays for itself is another question.


  • Rust isn’t really OOP like C#, Java or C++ - it has structs with functions that you could consider an “object” but there is no inheritance. Instead Rust uses traits which are a little bit like interfaces in some languages.

    The way the kernel is using Rust at the moment is to produce safe bindings for modules to be written in Rust, i.e. you can create a module in Rust source which will be correctly loaded up, the code is safe by default and will have access to kernel services via bindings. I expect over time that more of the kernel will become Rust, but the biggest impediment right now is Rust relies on LLVM and LLVM only supports a subset of targets that a kernel could potentially support with another compiler like gcc.



  • arc@lemm.eetoProgrammer Humor@programming.devIs this a Nut?
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    4 months ago

    The only reason people use JS is because it’s the defacto language of browsers. As a language it’s dogshit filled with all kinds of unpleasant traps.

    Here is a fun one I discovered the other day:

    new Date('2022-10-9').toUTCString() === 'Sat, 08 Oct 2022 23:00:00 GMT'
    new Date('2022-10-09').toUTCString() === 'Sun, 09 Oct 2022 00:00:00 GMT'
    

    So padding a day of the month with a 0 or not changes the result by 1 hour. Every browser does the same so I assume this is a legacy thing. It’s supposed to be padded but any sane language would throw an exception if it was malformed. Not JavaScript.



  • Concerning logs:

    1. You can still log to text if you want by configuration (e.g. forward stuff to syslog) and you can use any tools you like to read those files you want. So if you like text logs you can get them. You can even invoke journalctl to output logs on an ad hoc / scheduled basis in a variety of text formats and delimited fields.
    2. Binary allows structured logging (i.e. each log message is comprised of fields in a record), indexing and searching options that makes searches & queries faster. Just like in a database. e.g. if you want to search by date range, or a particular user then it’s easy and fast.
    3. Binary also allows the log to be signed & immutable to prevent tampering, allow auditing, intrusion detection etc… e.g. if someone broke into a system they could not delete records without it being obvious.
    4. You can also use splunk with systemd.

    So people object to systemd writing binary logs and yet they can get text, or throw it into splunk or do whatever they like. The purpose of the binary is make security, auditing and forensics better than it is for text.

    As for scripts, the point I’m making is systemd didn’t supplant sysvinit, it supplanted upstart. Upstart recognized that writing massive scripts to start/stop/restart a process was stupid and chose an event driven model for running stuff in a more declarative way. Basically upstart used a job system that was triggered by an event, e.g. the runlevel changes, so execute a job that might be to kick off a process. Systemd chose a dependency based model for starting stuff. It seems like dists preferred the latter and moved over to it. Solaris has smf which serves a similar purpose as systemd.

    So systemd is declarative - you describe a unit in a .service file - the process to start, the user id to run it with, what other units it depends on etc. and allow the system to figure out how to launch it and take care of other issues. It means stuff happens in the right order and in parallel if it can be. It’s fairly simple to write a unit file as opposed to a script. But if you needed to invoke a script you could do that too - write a unit file that invokes the script. You could even take a pre-existing init script and write a .service file that kicks it off.


  • arc@lemm.eetolinuxmemes@lemmy.worldSystemd controversy be like
    link
    fedilink
    arrow-up
    27
    arrow-down
    1
    ·
    edit-2
    4 months ago

    Kind of sad there are still people raging over systemd. When it flares up in discussions there is the usual debunked nonsense:

    • it only logs information to binary and this is somehow bad. Except it it can be configured to log to text as well and it uses binary so it can forward secure sign records to prevent tampering as well as offering database style query operations.
    • it’s insecure because the repo has millions of lines of code. Except that they compile into hundreds of small binaries running with least privilege, and often replacing the task of far more dangerous processes (e.g. there is an NTP client in systemd which sets the time and nothing else).
    • various rants about the primary author

    What is more bizarre is the nostalgia and hearkening back to sysvinit scripts when systemd didn’t replace sysvinit! Systemd replaced upstart which replaced sysvinit. Because writing 100s of lines of script to stop/start/restart a process sucked - insecure, slow, didn’t scale, didn’t capture dependencies and everyone knew it. Upstart was the first attempt to solve the issue and was used in Debian / Ubuntu, Fedora / Red Hat, openSUSE and others until systemd came along.


  • The problem is, that most languages have no native support other than 32 or 64 bit floats and some representations on the wire don’t either. And most underlying processors don’t have arbitrary precision support either.

    So either you choose speed and sacrifice precision, or you choose precision and sacrifice speed. The architecture might not support arbitrary precision but most languages have a bignum/bigdecimal library that will do it more slowly. It might be necessary to marshal or store those values in databases or over the wire in whatever hacky way necessary (e.g. encapsulating values in a string).


  • We had tens of thousands of lines in our rake files to build a bunch of targets, none of which were even Ruby. I think if I needed to build another complex build system that was a directed acyclic graph I think I’d use Gradle, for a several reasons - we had some Java targets so we save on an additional developer runtime, it would run faster & Gradle is more mainstream and easy to get various plugins & documentation for.


  • It probably wasn’t a big deal when it was a niche project until Twitter imploded. Then all the public instances got overloaded with new users and the limits became obvious.

    A better design is Lemmy which is written in Rust so it has far more scalability. It’s compiled and because it’s tokio / actix based, it can also do a lot more stuff asynchronously so it’s not spawning thousands of threads to cope with concurrent requests.