HNHacker News
TopNewBestAskShowJobs

sersnth

39 karma · joined March 13, 2018

Feel free to email me at hn+snth@snthhacks.com
submissionscomments
sersnth··on FindMyCat – Open-Source Pet Tracker
I imported the BOM for the tracker to Mouser and it looks like it's around $100 in components for one board. It looks like the boards with ENIG finish and filled and capped vias would be ~$40 for five boards + ~$17 shipping to the US from jlcpcb. ~$15 of the board cost comes from the via covering.

The most expensive component, the DWM3001CTR13 Ultra-WideBand module, is $37.77 in single quantities. I don't know much about about UWB, but I wonder if instead putting a BLE beacon on the tracker and using a chip supporting Bluetooth direction finding on the home station could allow the tracker to be a bit smaller and cheaper at the cost of some localization performance for the indoor mode (actually I just saw someone already brought this up in the project Slack).

This isn't including the Home Station part which doesn't seem fully documented yet.It looks like there is more discussion on the project Slack.

sersnth··on Electronics Lab Bench Setup Guide
In a power supply you can sense your output voltage with a differential amplifier between the positive and negative outputs that way the voltage drop across your current sense resistor is not included in the measured differential voltage. Alternatively you can use high-side current sensing where your current sense resistor is before your positive output. You can also use a differential amplifier for that, but there are purpose made current sense amplifiers which are probably best.
sersnth··on Sudo: Heap-based overflow with small passwords
sudoedit runs the editor as the original non-privileged user, which is nice if you're using a configurable text editor like vim/emacs so you're not suddenly using whatever (lack of) configuration the root user has setup. It can also be nice to know any other stuff a complex editor can do like running other programs won't happen in the privileged context.
sersnth··on Prenatal cannabis exposure associated with mental disorders in children
That describes both partially and fully hydrogenated fats, but only the partially hydrogenated fats contain trans fat. As far as I know fully hydrogenated fats are not any more unhealthy than other saturated fats.
sersnth··on Why do arrays start at 0?
Unsigned integer underflow and overflow are both guaranteed to wrap by the C standard.
sersnth··on Twitter confirms Twitter Blue
Your comment reminds me of this comic https://www.smbc-comics.com/comic/mind-3

Perhaps with social media it applies as much to younger people as well.

sersnth··on Sending SPF and DMARC passing mail as any Gmail or G Suite customer
I can see why Google would not require G Suite customers to set up DKIM, but why do they not have it set up for google.com? It seems like it would have added another barrier of defense in the case of this bug.
sersnth··on Treating children for worms yields long-term benefits, says new study
In that first paper, it does not seem to indicate that there was a difference in the level of cognitive improvement in the albendazole + fortified biscuits group versus the placebo + fortified biscuits group.
sersnth··on The 5.7 kernel is out
The rule was already written there. The patch just reformatted things a bit.
sersnth··on The economics of cheaper batteries
I am pretty sure you can end up in the sort of situation where ordering 3000 costs less than ordering 2500 on Digikey, and in my experience the same goes for other major component distributors like Mouser.

It seems to me like it kind of promotes waste since one ends up ordering components that they may have no use for, but maybe it is not that big of a deal since it is common to want to have some amount of spare components when doing a production run. Personally, even if I only need a single unit of some little surface mount resistor or ceramic capacitor I usually buy 100 since the price tends to be like $0.10 each for <10 versus $0.50 for 100, and I can just add the excess to my spare parts collection.

sersnth··on Show HN: libcodr7 – fundamental collections in the spirit of C
Why have comparison callbacks return this enum

  enum c7_order {C7_LT, C7_EQ, C7_GT};
instead of a signed int which seems to be the idiomatic way in C?
sersnth··on Modular C: Reusable and Maintainable Code Using the C Language (1994) [pdf]
I agree that intrusive data structures are often a better choice and do not have the issues GP mentions (by using something like a container_of() macro, so the data structure member does not need to be the first member, and the object can be in multiple data structures at once). But of course many other "pointer-based" data structures such as singly-linked lists, separate chaining hash tables, etc can also be implemented with them.
sersnth··on Modern C, Second Edition
Your grep result of Linux is because the regex is bad. `\t` does not seem to be available in the grep basic syntax. It is available with Perl Compatible Regular Expressions, but then you can't use `\>`.

Changing it to

  $ git grep -P '^[\t ].*[a-z].*\*[ ]*const\W' v4.9
returns 1,779 matches. Here are some from kernel/

  v4.9:kernel/time/posix-cpu-timers.c:    struct signal_struct *const sig = tsk->signal;
  v4.9:kernel/tracepoint.c:               struct tracepoint * const *end)
  v4.9:kernel/tracepoint.c:       struct tracepoint * const *iter;
  v4.9:kernel/tracepoint.c:               struct tracepoint * const *end,
  v4.9:kernel/tracepoint.c:       struct tracepoint * const *iter;
Many of the matches are the same as your "array of string constants" example, but just defined at local scope. And many are just constant local variables which some may not consider worth making const. The ones from tracepoint.c above are probably walking an array of const pointers by pointer instead of by index for example though, which is a common case where pointers to const pointers are used, which are legitimately useful.
sersnth··on EINTR and PC Loser-Ing: The “Worse Is Better” Case Study (2011)
I think they are referring to the fact that the signal could be triggered before the system call is executed, in which case you will miss the signal and the system call will never time out. For example:

  alarm(1);
  // alarm could theoretically be triggered here before read() syscall is executed
  read(...);
This sort of problem is what the self pipe trick https://cr.yp.to/docs/selfpipe.html is made to solve. I believe it is not really necessary anymore because there are functions like pselect() which solve this by accepting a sigmask parameter.

Anyway, most system calls that one would want to have a timeout for have alternatives that accept a timeout parameter.

sersnth··on All Chromebooks will also be Linux laptops going forward
> I replaced the battery on it ~6 months ago.

Where did you purchase the battery from, and how is the performance, if you do not mind me asking?

I also use a mid 2009 Core 2 duo, but lately I have struggled to find a source for a battery that will last more that 1.5 hours in typical usage. I assume the issue is that any authentic Apple battery must have been manufactured so long ago that its capacity is severely degraded after having been stored (at non-ideal temperature) for so long, and it seems like even many third party batteries available are old and had inferior capacity to begin with.

sersnth··on Ask HN: How to self-learn electronics?
That comment is from the series' author, just doing a bit of his signature trolling for which he is so beloved on Hackaday.

I know he (Brian) has expressed that those articles generated underwhelming metrics for the amount of work they take, but they really are a useful resource for people looking to get an overview of their options. And I'm sure the Whalebait fiasco will blow over soon enough.