Recent submissions

Comment · 3 years ago
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.

Comment · 3 years ago
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.
Comment · 4 years ago
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.
Comment · 4 years ago
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.
Comment · 4 years ago
Unsigned integer underflow and overflow are both guaranteed to wrap by the C standard.
Comment · 5 years ago
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.

Comment · 6 years ago
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.
Comment · 6 years ago
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.
Comment · 6 years ago
The rule was already written there. The patch just reformatted things a bit.
Comment · 6 years ago
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.

Comment · 6 years ago
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?
Comment · 6 years ago
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.
Comment · 7 years ago
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.
Comment · 7 years ago
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.

Comment · 7 years ago
> 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.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton