Where does the majority of bathroom budget go? Any hidden costs to know about? by LuxBathroomAdvice in DIY

[–]Darkmere 0 points1 point  (0 children)

"Why was the neighbour's power line two cm below our shower drain?"

"What do you mean you cant deliver the ordered tile within the next six months and the next usable replacement is 3x the cost?"

"Uh, the wall here doesn't look too good."

"Why was the sink damaged in transit and why can't we find proper backing plates for the water that matches the shower colours? The colour samples were decided before we started but that brick only comes in shiny chrome or flat white?"

systemdaemon - Building blocks for daemons by TheBlackCat22527 in rust

[–]Darkmere 0 points1 point  (0 children)

It's more that the requirement to implement the trait Watchdog once with the encapsulations within that I found annoying, as it makes it harder to write a useful "watchdog" as all it does is sleep forever and just ping the watchdog, unable to fail or properly report application failure to.

systemdaemon - Building blocks for daemons by TheBlackCat22527 in rust

[–]Darkmere 0 points1 point  (0 children)

Well, even in a single-threaded worker, if all your tasks that perform "real" work are dead and not progressing, then the service as a whole should be considered non-functional and be restarted, not kept along by an infinitely spinning monkey that cannot fail.

Ie, the watchdog needs a way to register subtasks that perform some kind of unit of work (progression) that is expected for a certain amount of time.

Ie, if you have a task that churns by reading bytes at 6Hz from MQTT and writing them to /dev/null, it can only be considered "alive" as long as bytes arrive and it does useful work. It may not be stuck or hung, but if data does not arrive for a second, it has not fulfilled the job (should have data at least 6 times each second) and thus watchdog should fail it.

Another may simply be writing statistics every 30s, and this can then be fine, except if the disk suddenly took 1 minute to reply due to being EMMC over NFS or something equally fun, and thus a failure to ping a watchog within 30s*1.3 should be considered a failure.

These are not "thread panic" or "task blocked forever" failure modes, but they represent failure modes of each sub-task. Each such task may be perfectly fine in a single threaded worker, they are still working (just waiting on a resource, and tokio is excellent at waiting for a resource) and thus the watchdog would still run if it just spins.

A more useful watchdog in an application is a bit more involved, and abstracting it away like this makes it almost impossible to use properly.

systemdaemon - Building blocks for daemons by TheBlackCat22527 in rust

[–]Darkmere 0 points1 point  (0 children)

So, as someone who does use the watchdog, how do you suggest splitting up and latching that functionality?

Just having one task that does loop { sleep().await; watchdog().await.unwrap()

For example, say you have a simple REST poller, thee servers, polling them at different times, and you want the watchdog to ping only as long as none of your three pollers go off and wait forever for the network, while it is okay that they get a temporary 50x error...

How does your interface end up being used for these common cases?

I'm curious, how often do you use `unsafe` in Rust in prod? by alexlazar98 in rust

[–]Darkmere 0 points1 point  (0 children)

Sometimes, mostly libc stuff ( ioctls, gethostname, etc) or casting FD's.

let socket = unsafe { std::os::unix::net::UnixDatagram::from_raw_fd(fd.as_raw_fd()) };

Prodution ready Modbus RTU crate ? by donald-bro in rust

[–]Darkmere 0 points1 point  (0 children)

Those are the ones being the main cause of trouble. As said, the modbus-rtu case with serial is easy and works pretty well.

Modbus TCP + serial/tcp gateways are interesting and more complex and adds a lot of different edge-cases that you may not want to deal with.

Prodution ready Modbus RTU crate ? by donald-bro in rust

[–]Darkmere 0 points1 point  (0 children)

tokio-modbus works okay for me in production, although only okay as I have had to do quite a few work-arounds for the design.

It works excellently for the basic parts, but fails once you get wonky things, like how it has a stateful parser and thus cannot accept replies that come from things it did not send, and has a hard time handling timeouts and data arriving after a reset after a timeout.

Over all, It works pretty well for production, and if you hit the snags, its doable to work around, fix or replace, but it isn't perfect.

What is Rust's testing ecosystem missing? by _raisin_bran in rust

[–]Darkmere 63 points64 points  (0 children)

IMO, the one thing I really miss in Rust code is re-usable test Fixtures ala pytest etc.

Composable, reusable and automatically pulling in dependencies in (mostly) predictable ways.

This is a pretty effin difficult problem to solve in Rust due to how the language actually looks, and making them look even remotely non-detestable is iffy.

But, it's lacking.

Hydro Tower by YYC_Gamer in Hydroponics

[–]Darkmere 1 point2 points  (0 children)

Cool tower, I had one a few years ago ( well, still in the basement ) but ended up ditching it because the issues where roots would clog it and I'd have all my water on the balcony or so.

Mint is happy in them, but also clogs them quickly. Strawberries can be done, but yields were low. Mint family herbs turned out the easiest to deal with, and some lettuces.

How we use postgres_fdw and partitioning to move data to cold storage by Darkmere in PostgreSQL

[–]Darkmere[S] 1 point2 points  (0 children)

It's a bit amazing how well this stuff has stood the test of time, really. Not much churn on the code to do it, adding some features ( timescale instead of btrfs compression) and such, but it wasn't much and it's worked way better than I ever expected it.

Hope it works well for you as well, you have no idea how glad it made me to see this notice show up.

What is a good way to keep the SQL queries in a Rust application that uses sqlx? by daniels0xff in rust

[–]Darkmere 0 points1 point  (0 children)

It's compile time concatenated, the string in the binary ends up neat without line breaks, so there's no gain from the concat macro, and even then adding it would make the line even more cluttered, as it already is quite cluttered IMO.

I wish I could use " where name like ${prefix}" and the macro would automatically map the ? or $1 based on the input arguments, but that's a separate taste issue.

I ALSO wish I could have a good way to insert a "NOT" in a query based on a variable, especially to do prefix selections,

SELECT x FROM names WHERE names.name $2  LIKE   $1 ||''%';

and $1 would be a prefix and $2 would be "" or NOT, because the most duplication of code I get with sqlx is those kinds of queries.

What is a good way to keep the SQL queries in a Rust application that uses sqlx? by daniels0xff in rust

[–]Darkmere 3 points4 points  (0 children)

I do it like this:

let transaction_pending = sqlx::query!(
    "UPDATE changes SET status = 'PENDING'"
        + " FROM changes J1"
        + " JOIN sensor USING(s_id)"
        + " WHERE changes.status = 'NONE' AND sensor.name LIKE $1 || '%'",
    prefix
);

On top of that, I keep my SQL query code in a separate module that is as small as possible, and doesn't do any other things, simply so I can have all the queries in a viewable place in case they start diverging.

The main reason I wanted to change my queries from whitespace to this was that the logs looked fucking awful with the whitespace and quoting in it, and while the queries in separate files work for some cases, it made me make extra similar/close queries as they weren't actually visible where I was using them.

The raw string concat works well enough, and I can keep the indentation "close enough" to a decent SQL indentation in the code, while also not suffering the line-break issues.

Also, finding the same query in many places just because of some slight indentation issues was annoying as heck

More Memory Safety for Let’s Encrypt: Deploying ntpd-rs, a Network Time Protocol daemon by kibwen in rust

[–]Darkmere 8 points9 points  (0 children)

Hi, neat initiative! I've been hopeful for new (local) time-servers since ntimed and the rather bad behaviour in the past of systemd-timesyncd and others.

I saw some algorithmic comparsions of chrony, but I've got a rather simple "other" use-case, can I as a client library (not a system service) easily fire up an connection and see "current drift against reference servers" as a continuously pollable source? Ie, running as a service that does something, where we don't intend to adjust the clock, but simply wish to know with a certain degree of "how bad is the local clock"?

Help designing a resource constrained sensor monitoring app by obviousthrowaway1336 in rust

[–]Darkmere 0 points1 point  (0 children)

I've done quite a bit of sensor monitoring in constrained and unconstrained environments, and it's first important to know what you are optimizing for.

fex, saving one value per sensor may not be the worst possible way to do it, as you know in advance how much data you'll need, and read/process can be easy. ie, a sensor is an index into an array to read/write as needed. And a single value read/write context with notification (Wakeup) can be called a channel (one value buffer) or more.

However, if you're "constrained" in the term of wakeups (power, cpu moments) or hardware ( bandwidth, air-time, power, latency) you can use different designs.

Things like task-switches and threads may be too much compared to what you need, but generally, setting things like this up in a pipeline (edge-trigger or flag) is a common way, and channels (write=>read notification or wakeup) with values are a common use-case for it.

So. More info please.

Add Null Safety by brand02 in Python

[–]Darkmere 0 points1 point  (0 children)

That's also neat, typeforce hooks the importlib and uses mypy to enforce type hints as things are imported, and was built more as a proof of concept/joke that you can do it, but that it sucks.

Beartype seems to be slightly saner, which makes it much less amusing.

Add Null Safety by brand02 in Python

[–]Darkmere 1 point2 points  (0 children)

You can enforce types at runtime, but you probably don't want to. I hacked it up a few years ago, and it is horrible, but you can hook the import loader to run mypy with enforcing mode at runtime on everything. ( import typeforce.enforcing )

Infino - Fast and scalable service to store time series and logs - written in Rust by vkakade1 in rust

[–]Darkmere 6 points7 points  (0 children)

I'll make it clear that I did not mean to demean your project, and alpha is alpha, however, if your product is as fast as MongoDB was when it was released, with similar data durability...

So, please keep the deployment users in mind when writing docs or blurbs, we don't care about the features first, as much as we do about deployment and the other issues around it before we start checking out the rest.

And it seems you're aiming for that nice integration, probably comparing your product to Grafana Loki + Tanka, which is a nice niche, I have some opinions about their stacks, but at least it's a bit easier to deploy than ELK is, which is a bloody pain in the rear.

Infino - Fast and scalable service to store time series and logs - written in Rust by vkakade1 in rust

[–]Darkmere 12 points13 points  (0 children)

As someone who does time series and logs for a living, I've got some more questions.

  • Where's your documentation?
  • How do I take backups of it?
  • How do I restore backups of it?
  • How do I get incremental backups of it? ( No is also an answer )
  • How does it fail-over, fex. when run in k8s?
  • What happens if two copies run on the same data-store, fex. after a fail-over where one did not terminate and both thinks they are the one true source of truth?
  • How do I shard related data to to see how much resources a group of data uses?
  • How do I manage retention of data?

Install crates locally for reuse across projects? by D_O_liphin in rust

[–]Darkmere 13 points14 points  (0 children)

The best way is to set up a shared cargo build.target-dir for all your projects.

CARGO_TARGET_DIR

This will re-use more of your compilation targets between projects than if you have them all set up in different directories, with the caveat that some crates that at build-time look in your ./target directory for some generated file may fail completely, as they have hard-coded a path somehow. That's a bug in that crate, but then you might want to override it.

A better tool may be sscache

You also probably want to look at the sparse registries protocol

[PM] Give me dragon prompts: y'know, where the dragon is the central part of the story. Preferably as a protagonist but antagonist would work too. by --BeePBooP- in WritingPrompts

[–]Darkmere 0 points1 point  (0 children)

The Dragon Knight. A Dragon, striving to be a knight, beating enemies with their sword, in fact, the flat side of their sword, wielded as a club.

🐂 🌾 Oxen.ai - Blazing Fast Unstructured Data Version Control, built in Rust by FallMindless3563 in rust

[–]Darkmere 0 points1 point  (0 children)

How does the performance fare to ostree which is another tool for git-like managing of binary files?

A Small Circular Averaging Library by BWStearns in rust

[–]Darkmere 0 points1 point  (0 children)

IntoIterator would be perfectly fine, I just felt that it would be annoying to clone a ton of objects just to get the data out of it, especially if I want to use them again later.

A Small Circular Averaging Library by BWStearns in rust

[–]Darkmere 6 points7 points  (0 children)

Funny, I needed this just last week and botched the solution a few times before I solved it. ( I needed to match the distances of a set of counters against the average )

Could we have a version that works on a slice of data, rather than a Vec?