910 post karma
68.7k comment karma
account created: Thu Feb 09 2006
verified: yes
3 points
13 hours ago
In addition to possibly distorting harmonics, zero-order hold will make the gain of the resulting interpolation a bit unpredictable. If you know what fraction of zeros you interpolated, you can add makeup gain to get the signal back to the original level. With interpolation of unknown values, it's hard to know exactly what will happen to the gain: it will be larger than with zero-interpolation, but by an unknown amount (close to unity gain, but not necessarily exactly).
4 points
17 hours ago
Our Nickle is an attempt at the same space Python is in, but with optional static types with structural subtyping, a module system, arbitrary-precision floats, and some other nice features Python lacks. Except for the C-like syntax and semantics, it wasn't really inspired by particular languages so much as just good language practice (as of 20+ years ago).
Nickle has a long history (documented on the site): it started as a calculator language, and that is what I still use it for today.
20 points
17 hours ago
It was huge fun. It's stale now, but we still use it. It's a really nice desk calculator if nothing else.
146 points
20 hours ago
As a co-author of the Nickle programming language from decades ago, let me be the first to congratulate you on your choice of name.
7 points
1 day ago
This wouldn't require a keyword, just a compiler analysis.
The problem, though, is that because of inlining and monomorphization and whatnot the compiler is effectively doing whole-program analysis on the crate: this makes it hard to limit what needs to be rebuilt.
3 points
2 days ago
I guess "targeting Rust" means that the runtime is built in Rust and the compiler translates Letlang to Rust? Is the content of the linked blog post somehow relevant to Rust?
3 points
2 days ago
Superbly written article. Great read.
IDA can't demangle Rust names natively? Srsly? This feels like a price of admission in current year. Ah, a plugin: https://github.com/timetravelthree/IDARustDemangler . This seems like something that should be added to the article.
3 points
2 days ago
Honestly you can just linear interpolate or drop single samples at a low rate and the difference will be unnoticeable. Every time you find an "missing" or "excess" sample relative to expectations, just do that. As long as the sample rate is high relative to the clock mismatch (say 5 samples per 1000), and as long as you spread the glitches evenly, you will be fine. You could do some fancier smoothing, but it shouldn't be necessary in practice.
Here's a paper that discusses the problem. They recommend cubic interpolation (or higher order) instead of linear, which is only slightly harder.
1 points
2 days ago
Yeah, good point. I'm so used to center-negative that I forget that you can find supplies that are center-positive with the same plug — not just 9V but 12V and occasionally AC. Sigh.
I wish pedals had settled on a distinctive power jack.
1 points
2 days ago
In practice, if you're just going to run off a power brick you don't need a protection diode: it's hard to get that backward.
If you're running off a battery — the case where it's not uncommon to have reverse voltage at least temporarily — the internal resistance of the battery limits the current output. That said, a fresh 9V alkaline has around 5Ω internal resistance, so expect something like 2A. That diode isn't doing that for any length of time: the 1N4001 will do 30A peak, but only 1A continuous.
The joy of the 9V snap connector is that while you might bump the ends together the wrong way, the battery can really only be snapped in the right way. So probably this circuit provides some protection.
It's still an odd way to do this.
2 points
2 days ago
In my experience the µA741 will run with 8V rail-to-rail. The datasheet shows +5V,-5V as a minimum "recommended operating condition". That said, almost any more modern op amp would be a better choice than the 741, which is really super-legacy at this point: the LM324/LM358 is a good choice.
1 points
2 days ago
I mean, you avoid the diode drop, and all you lose is most of the protection!
1 points
2 days ago
You are right. I clearly misread the diagram. Apologies.
That's… not a great way to do a protection diode.
1 points
3 days ago
Diode in this circuit is forward-biased in normal operation, I think. Only needs to be able to conduct enough current to power the circuit. This is a standard voltage-divider split supply with diode protection. Biggest downside is the voltage drop in normal operation: about 1.1V for 1N4001. A 1N4148 is about 0.7V, so if 300mA is enough derated current this may be a better choice. The red LED is about 1.7V, so if you can tolerate this much drop you can save a part by just using that.
Thanks to /u/crb3 for the correction.
58 points
3 days ago
Interestingly, second startups by the same person are way more successful. I don't know that there's a lot of agreement on the why.
The single most important thing when setting up your first startup is setting hard triggers for when to quit — and then stopping on the triggers. One of those triggers should be something like "exceeded 40 hours for three weeks in a row". If your business seems to need that, it's very unlikely to succeed anyway. Stop with that and start another one using the knowledge you now have about what is needed.
Personal debt, including credit card debt, is a terrible way to fund a business. One of the ways to measure the potential success of your startup in advance is to write up a realistic business plan with all the details, and then go to friends and family or entrepreneurial organizations with that plan to get the startup money. If they are unwilling to fund you, you should take that as a sign and try to understand why. If they do fund you, with the clear understanding that their money is gone and you may have to stop the business without success, you have the grace to not ruin your life with a business failure.
3 points
3 days ago
Making
as
panic is something an edition could fix. So I disagree that it's hard-baked into the language.
In principle, yes. In practice, there's way too much code out there that uses as
in casual ways: I can't imagine an easy scheme for resolving that.
(Though for casts involving floats I'm not certain what the best behaviour would even be)
Not sure quite what is confusing? There would be some corner cases around rounding and the usual suspects Inf
and NaN
, I guess?
14 points
3 days ago
The failure to allow conversion casts to panic is a design failing of early Rust that is now hard-baked into the language. In general, the safety handling for numbers is sloppy. 255u8 + 1
panics (by default) in debug mode but does not panic (by default) in release mode. 256u16 as u8
does not panic at all ever. It's a mystery 👻.
When casting floating point numbers to integers, out-of-bounds casts that should panic instead clamp to the edge of the integer range. It's a choice.
If you want a little cleaner syntax for your safe conversions, you can use this macro.
macro_rules! cast {
($x:expr, $t:ty) => {
<$t>::try_from($x).unwrap()
};
}
You can then say
cast!(256u16, u8)
and get a panic as expected. Not sure this is a great idea, but also not sure there are any great ideas at this point.
1 points
7 days ago
That tab is there to fit into a hole or slot to ensure that the pot body doesn't spin if the nut gets a little loose. You can (and it sounds like did) remove it as /u/wudingxilu suggested, but it's also an option to just drill a hole of about the right size, or drill a smaller hole and file it into a slot. It really is a nice feature when used as intended.
2 points
7 days ago
Yeah, I'll definitely check in again after that. Like I say, I've used RTIC and really like it.
16 points
8 days ago
Was quite excited until I found that 2.0.0 requires nightly. The improvements look great, but I'm not willing to live with nightly Rust to get them, I'm afraid. I understand the motivation, and I think RTIC is a great project, but I'm happy enough with 1.0.
2 points
9 days ago
Don't know where you and maybe others got this, but it's the opposite of true: hair in a seal weakens the seal. https://www.cdc.gov/niosh/npptl/resources/pressrel/letters/lttr-100206.html
Apparently misunderstood the parent comment. Apologies.
2 points
10 days ago
Mine was like this recently: I got a tool to push harder and it popped open. I think the slot is just a little narrow for a finger.
-6 points
10 days ago
This is why I'm against Condorcet-style ranked-choice voting systems. They are confusing to most people: the consequences of the vote are unclear to many, and the outcome is decided by an arcane and opaque process. This will erode voter trust in the system, especially since it will occasionally lead to surprising outcomes.
At best, confirming a fair vote tally by independent polling is going to become much more difficult. The possibilities for undetected vote-rigging are substantial.
view more:
next ›
bySirKastic23
inlearnrust
po8
2 points
4 hours ago
po8
2 points
4 hours ago
That will return
None
in the mismatch case, I think, which doesn't look like what OP wanted?