Better HN
topnewbestaskshowjobs
Log inSign up

kortex

8,487 karma · joined Feb 1, 2017 (9y ago) · 2,549 submissions

Submissions

comment 4y ago · link · parent

Nope. ADHD is a distinct neurological condition that we can pick up on with PET scans and the like. It sure as hell can be kryptonite for ADHDers - basically limitless novelty on tap - but it cannot cause ADHD.

Source: had adhd long before smartphones. Still do.

- written on my smartphone

comment 4y ago · link · parent

I love the performance of blake3 but my understanding is it's still a bit of the new kid on the block. Blake2 is a SHA-3 finalist so should be perfectly sufficient, plus it has variable digest sizes, reasonably fast, and other nice features.

Either way, anything relying on hashes for data integrity should at least be flexible to the option of multiple hash algos. But with git, it's going to be hard enough as is to change to SHA-256, and I don't know how parametric it'll be.

comment 4y ago · link · parent

That sounds frustrating, however easy_install hasn't been relevant for years, and obviously 2.x is EoL. Anaconda is generally better for beginners since it manages basically everything for you. Hardly a disaster.

You basically need NPM if you want to work with any kind of libraries, and I'd say the Anaconda system comes with way more ergonomics out of the box, so that's more or less a wash.

comment 4y ago · link · parent

Have you looked at dvc www.dvc.org? Takes a little bit to figure out how you want to handle the backing store (usually s3) but then it's very straightforward. You could do a similar pattern: have a data repository and simply move the git HEAD to the desired spot and dvc automatically adds/removes the data files based on what's in the commit. You can even version binaries, without blowing up your .git tree.

comment 4y ago · link · parent

That ship has long sailed. As soon as you have JS, you have the ability to transpile to JS from any language with the appropriate tooling, to say nothing of WASM.

comment 4y ago · link · parent

This is pretty sparse on citations/evidence compared to the usual HN trending fare. Some commenters are suggesting TFA is equating declining birth rate to declining sex. I don't particularly see it, they seem to be suggesting both are declining (it doesn't typically take much unprotected sex to procreate, modulo fertility issues), but either way, that's still a veridical statement that deserves data.

comment 4y ago · link · parent

I think the point isn't that a contraction is bad in general, it's that too fast of a contraction leaves an inverted demographic pyramid, which has all kinds of very bad implications.

You need a certain tax base to keep services funded. Then at some point on the curve, you start running out of service workers for the care industry.

I think automation will help to a degree but healthcare services is right at that sweet spot of both physically intricate and nonroutine that is so hard to automate.

comment 4y ago · link · parent

> Top ten lists

I couldn't find any "listicle" style top N list, the closest was "top players in quantum computing"

> awful generic CGI backgrounds

That's pretty par for the course for this tier of channel. Arguably the "quirky room with nerd tchatckies backdrop" is more authentic, but both are just filler behind a talking head.

> give me your opinion in the comments

Necessary evil to drive engagement to appease The Algo.

Imho her work is a step above the lion's share of science reporting, but I can see how she might be polarizing.

comment 4y ago · link · parent

Nix has some serious ergonomics issues that need to be addressed. This is dead simple by comparison. Wheels are just zip archives with some specific semantics. Like, I wanted to get into Nix but it's super daunting and there's no real way to gradually migrate a project into it - it's very all-or-nothing.

comment 4y ago · link · parent

> numpy already has, like, 99% of that functionality built in in the form of structured arrays and records

Respectfully, this is pretty wrong. Pandas does vastly more out of the box than numpy. Off the top of my head: I/O from over a dozen of data formats, joins/merges, sql queries directly to dataframes, sql-like queries on dataframes, index slicing by time, multi-indexes, much more ergonomic grouping/aggregation functions, ergonomic wrappers around common graphing use-cases, rolling windows.

I'm not even really a power user of it, so there's probably a zillion more things it does that numpy can't out of the box, and I don't wanna spend time writing time and validating if an implementation exists.

comment 4y ago · link · parent

The original impetus seems to be from this tweet:

https://mobile.twitter.com/AaronBergman18/status/15273336157...

> 12oz Diet Coke contains 100mg phenylalanine, which is an indirect precursor to dopamine and norepinephrine in the brain.

If "leads to dopamine eventually via some pathway" were sufficient for dopamine, hoo boy, the field of psychopharmacology would look radically different. Would certainly make treating ADHD and Parkinson's way easier (and schizophrenia and mania way harder).

Or, y'know, it's the caffeine. Especially since it doesn't cause the sugar spike/crash like regular soft drinks.

comment 4y ago · link · parent

Why? This is just what language does - it's like a constantly evolving entropy code. Jargon emerges to concisely describe unique concepts. Hydration is a great example: it's important in the process, so it gets talked about a lot, but it's distinct from rendering, so it gets its own term.

Likewise, ingress/egress is not quite the same as read/write. It gets its own terminology because it's distinct.

comment 4y ago · link · parent

> It's much easier to remember/recognize an integer based PK when troubleshooting a data problem.

How often are you actually relying on memory of an ID to troubleshoot a problem? I mean sure, if you are scanning visually, it's good to recognize the same ID over and over again, but my ability to do so caps around 4-6 characters. So I just look at the last 4 chars regardless when fast scanning.

I use copy-paste for any time I need to transport IDs between contexts (that isn't just scripted, which is best). Having a copy-paste stack (Alfred, Raycast and others have this feature) is a huge game changer here.

comment 4y ago · link · parent

I've bee using ULIDs in python for about a year now and so far have been super happy with them, so a) thank you for maintaining this! b) I always felt a bit uneasy about the way the spec describes the monotonicity component. Personally I just rely on the random aspect as I am fortunate enough to say that two events in the same millisecond are effectively simultaneous.

At that point, it's basically just UUID7 with Crockford base32 encoding, more or less.

IMHO the in-process monotonically increasing feature of ULID is misguided. As you mention, distributed ids are a pain. The instant you start talking distributed, monotonic counters or orderable events (two threads count as distributed in this case), you need to talk things like Lamport clocks or other hybrid clock strategies. It's better to reach for the right tools in this case, vs half-baked monotonic-only-in-this-process vague guarantee.

comment 4y ago · link · parent

I wish we had a layer 6-ish security protocol that "just worked" the way HTTP just works. Something analogous to an ssh tunnel, where once you establish the correct keys (via a single, simple operation), clients and servers can just talk with no extra application-level configuration.

Currently if I want to use HTTP2/3, I have to fuss with openssl, self-signed certs (which never seems to work reliably for me), messing with /etc/hosts... it's always just painful for me for some reason.

comment 4y ago · link · parent

A for loop is easy: everyone can conceptualize doing a process N times.

A map is not as easy of a concept in some ways (it's more abstract, you are taking N elements of X to N elements of Y). But a map is simpler than a for loop, because there is no state between steps: it's completely symmetrical.

The for-loop "complects" each iteration together, even if it's as little as incrementing an integer. It's a side effect, however trivial.

To kick it up a notch, now imagine a 2-D loop. Now we have 2 counters. If it's a 2-D array, each addressing operation interacts with 2 counters. But map just needs a second map chained on, and each map is completely "unaware" of the other map. You could map over N dimensions and each map is symmetrical, while the for loop needs an ever increasing number of counters. This slight difference in complexity shows how complexity compounds with other complexity.

comment 4y ago · link · parent

You are still talking about dozens/hundreds of hours of work. Better way would be to embarrassingly parallelize the problem. Get large groups of people to flip coins and collimate the result.

comment 4y ago · link · parent

The keyword to look for is usually Auto-NUC (non-uniformity correction) or just auto-calibrate. Usually in terms of minimum time and/or temp change.

comment 4y ago · link · parent

Thanks, but it actually has to be a logical data stream. It's not actually drone GPS, but it's analogous.

It's definitely a thing that exists, I've seen stackoverflow issues talking about working with containers that have these sorts of streams, but for some reason, I've scoured the net and haven't found almost anything about actually writing those streams.

comment 4y ago · link · parent

A TUI FFMPEG builder would be delicious. Just a terminal powered graphical interface that lets me manipulate options, and feedback validation, would make it so much easier to work with complex graphs.

comment 4y ago · link · parent

Many thanks!

> if you telemetry isn't already packetized, you'll need to do that yourself. Converting your drone's telemetry into something that ffmpeg likes is generally non-trivial.

Yes, this is exactly the non-trivial step I'm struggling with. Let's say I have every time step a msgpack-encoded binary blob with a timestamp. I want to packetize it and pack it into a data stream of some timestamped/sequenced packet/page/atom structures. I might be able to build those packets myself manually if I can find a viable format (mkv and ogg seem the easiest to reason about).

And ultimately I do want to do this with real-time streams, but I'll definitely look at this Video Multiplexer to start with! That at least scratches the itch of archiving this data.

comment 4y ago · link · parent

The data has temporal component, yes. But how would I packetize it in the first place? I have the high-level concept that I need to take each of my data chunks and put them into some kind of timestamped container/page/atom and feed them into the stream, but I have no idea how to actually emit those packets. Like let's say each time step I emit a binary blob of msgpack-encoded data. How do I wrap that with a timestamp/sequence number container?

comment 4y ago · link · parent

The dry-python lambda soup is awful, I totally agree there. That's just there mostly for demonstration purposes though. Generally you'd actually use the flow construct (monads) to compose methods.

But `obj and obj.method()` really is not the same thing as `obj.map(method)`. "virtual Maybe container/box" is a nice idea, and does actually type-check with mypy (mostly), but you cannot actually compose it with other functions. The problem is, each time you do `obj and obj.method()`, you end up union-ing type(obj) and type(obj.method).

https://mypy-play.net/?gist=5b03d81a64453997984e448df9b889e7

    main.py:40: note: Revealed type is "Union[__main__.User, None]"
    main.py:41: note: Revealed type is "Union[__main__.User, None, builtins.float]"
    main.py:42: note: Revealed type is "Union[__main__.User, None, builtins.float]"
    main.py:43: note: Revealed type is "Union[__main__.User, None, builtins.float, builtins.str]"
True Maybe types are more precise. Maybe if the Mypy engine could be retooled to recognise the `obj and obj.method()` idiom as tantamount to `obj.map(method)`, this could be avoided.

comment 4y ago · link · parent

My understanding is that Borgs can be subclassed, you can modify the behavior, use descriptors (setters/getters), etc. You also avoid the `global` keyword.

It's really not the most compelling reason. I recently found a cleaner way that actually achieves identity-equality, which I think is a much better way of going about things. Not actually using it anywhere at the moment, but I think it's neat.

    class Singleton(type):
        def __init__(cls, name, bases, dict):
            super(Singleton, cls).__init__(name, bases, dict)
            cls.instance = None

        def __call__(cls, *args, **kw):
            if cls.instance is None:
                cls.instance = super(Singleton, cls).__call__(*args, **kw)

            return cls.instance

    class MyClass(metaclass=Singleton):
        ...

    class MySubclass(MyClass):
        ...

    >>> MyClass() is MyClass()
    True
    
    >>> MySubclass() is MySubclass()
    True
    
    >>> MySubclass() is MyClass()
    False

comment 4y ago · link · parent

Question for the peanut gallery, because it's vaguely topical and I've spent hours researching problem to no avail.

How can I mux arbitrary data streams into a container? Let's say I have a drone and I want to stream audio, video, and some avionics telemetry.

I know FFMPEG can pass through data encoded, and it lists a few binary stream formats:

     ffmpeg -codecs | grep '^ ..D'  # shows all -c=d codecs

    ..D... bin_data             binary data
    ..D... dvd_nav_packet       DVD Nav packet
    ..D... epg                  Electronic Program Guide
    ..D... klv                  SMPTE 336M Key-Length-Value (KLV) metadata
    ..D... mpegts               raw MPEG-TS stream
    ..D... otf                  OpenType font
    ..D... scte_35              SCTE 35 Message Queue
    ..D... timed_id3            timed ID3 metadata
    ..D... ttf                  TrueType font
But I have no idea how to pack some new data stream into the filtergraph.

comment 4y ago · link · parent

Dependency injection and lazy_property are excellent, I use those all the time. I've used visitor on occasion. The rest? Mostly meh, some are straight up bad.

comment 4y ago · link · parent

It's basically a global / hoist with a more ergonomic way of accessing the state. Instead of a get_global_state() style function, you just have the Borg constructor.

Personally I'm a fan of dependency injection whenever possible. But borg pattern has gotten me out of a pinch (exactly) once.

comment 4y ago · link · parent

Nullable (Optional[Foo] / Union[Foo, None]) and Maybe[Foo] are similar but not quite the same thing. The difference is quite subtle.

Optional[Foo] is same as Foo | None, meaning you can operate on foo with Foo's methods, except that if it's None, you get NoneType errors.

Maybe[Foo] is an actual container. You have to map over or unwrap it to operate on Foo.

The big difference is ergonomics/opinion. You can't actually map over Optional, so every time you wanna use it, you have to manually check if foo is not None. Whereas Maybe, you can operate generically over it. Some folks think "is not None" is better. Personally I hate NoneType errors in prod and find that much more painful than a bit of indirection.

comment 4y ago · link · parent

I was in the same spot when I met this brilliant hardware hacker at this hackerspace who had no formal EE degree but could design circuits in his sleep.

"How do you do it?"

"I read data sheets and a lot of wikipedia".

I already spend tons of time on wiki, so I started reading data sheets. And he was absolutely right, datasheets for components are often chock full of information on how to use them, often with recipe books for circuits that use them.

It's kinda bland and tedious but highly informative.

I think there is a bit more that goes into that (in particular a willingness to fry stuff, that's unavoidable in hardware, and MOUNTAINS of patience), but like software, it's pretty easy in today's day and age to teach yourself hardware stuff.

comment 4y ago · link · parent

> sometimes the fastest code deliberately introduces coupling, hardware specific cache shenanigans or unreadable hand written asm and/or inlined SIMD.

>> this is a perfect example of how simpler code should be preferred _by default_ over complex code.

Extra emphasis on *by default*.

You are both on the same side of the coin. This is the essence of "premature optimization is the root of all evil". Simplicity should be the default. Once you know your implementation is solid, then you can go back and optimize.

TFA is quite contrived, but imagine a much more complex process. You see some code:

    for i in loop: 
        foo[i] = myfunc(foo[i], bar[i])
You have to go in and dig into why exactly foo is being fed back in at every step. But if instead you saw:

    for i in loop:
        foo[i] = myfunc(bar[i])
You immediately know you have more options at your disposal to optimize that loop. Further, the compiler immediately knows it has more options. Maybe this is a good option for automatic unrolling or Duff's device. Maybe you wanna send this to a gpu shader, or use a macro to parallelize the loop. But it's a lot harder to get to that point if your starting point is the complected, stateful one.
1
313233
85