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

This is alarming yet accurate. One simply has to look at things like automobile recalls, the 737-max debacle, or the Camp fire, to see actual examples of the above heuristic in action.

comment 4y ago · link · parent

I found myself following a heuristic that is basically Asimov's laws:

- whenever possible, do no harm

- do not let harm occur due to inaction

- when given a choice, preserve the most amount of healthy lifespan in aggregate

- higher lifeforms are more valuable than lower ones (cat vs lobsters)

- deferred consequence is better than immediate (since it opens the door to other later interventions)

It kind of really brings to bear how much of a thematic device the 3 laws are. There's no way to make them congruent with actual, messy, real-world situations. Also why the whole "self-driving car trolly problem" is a non-issue - there will never be a situation where the "AI" has nice neat consequences and a binary choice laid out in front of it. It's always going to be some collection of "preserve life as best as possible" heuristics.

comment 4y ago · link · parent

Hardly. There's 7 continents (~3 bits of entropy), but dozens/hundreds of camera models this technique (6-8 bits). And it's hardly the only media forensic technique out there. There's ways of extracting the time of day without metadata, manipulation software chain, the lens used (sometimes down to make and model), and tons more. Before you know it, you've put a big dent in the ~33 bits needed to pinpoint a specific person.

comment 4y ago · link · parent

Nice work! Looks super interesting and rewarding to work on.

Is the namesake "tao" meaning "the way"? Or perchance a nod to Terry Tao?

comment 4y ago · link · parent

Question for the peanut gallery: Suppose I have a legacy ipv4 host which simply cannot do ipv6. Why couldn't I put some black box on my network connection in between my host and my uplink, which translates my host's IPv4 into a 4-over-6 IPv6 address? The black box can accept either v6 traffic and translate it for my host, or v4 and pass it straight through. The host only ever sees v4 traffic. V6-only clients can resolve an AAAA record against my host, and V4 clients can still resolve an A record.

As long as there is sufficient penetration of these black boxes, virtually everything should be able to talk to everything over v6, and the v4 shim can be removed.

I imagine this black box could be a relatively inexpensive ASIC or FPGA that could be a stand-alone widget, baked into hardware network adapters, or just built into routers, middleboxes, etc.

comment 4y ago · link · parent

But why couldn't we just put a middlebox in front of the host which translates a 4-over-6 address to a plain ipv4? The host box still sees only v4 but v6-only devices can still connect to it.

Like I could envision a simple router-like device doing this.

comment 4y ago · link · parent

What do you mean? You just add a custom handler. It's like a few lines to write a handler that does some action on specific levels.

comment 4y ago · link · parent

You should try the loguru library. I was able to roll a rolling-upload-to-s3 adapter in under an hour. Switching to json logs is one bool flag away. Plus it's gorgeous

https://github.com/Delgan/loguru

Also iirc s3's "file-like interface" does not actually obey the file protocol, which is obnoxious.

comment 4y ago · link · parent

I'm so spoiled by pydantic/fastapi spelling out exactly where my payload schema is wrong. I was interfacing with some google calendar API and it was constantly giving me a super vague "Bad Request" and I'm messing with the fields until finally I figure out I need a strict datetime string with four-digit timezone, no Z allowed. Like, it's delicious to be told exactly what you need to tweak to get it to accept.

comment 4y ago · link · parent

FastAPI has a lot of straight-up low-effort, borderline spammy questions. I think it's a community /communication thing. Somehow flask keeps the riff-raff down, or at least in the discussion and out of issues. So however they do that, FastApi needs to do as well.

On top of that it definitely is in need of more top-down organization, delegation, and coordination.

comment 4y ago · link · parent

It's frustrating that innovators are constantly having to justify "why yet another". Folks should just be able to freely innovate without fear of getting spammed with xkcd#927. You wanna make yet another programming language, compiler, JSON-alternative, container format, or trivial FTP+SVN killer, go for it! This is how we innovate.

comment 4y ago · link · parent

> My question is why hasn't anyone come along and fixed it?

There's been dozens of "replacements"/frontends/guis for git, off the top of my head: gitless, magit, tortoise git, gitkraken. Heres a whole mess of em: https://git.wiki.kernel.org/index.php/Interfaces,_frontends,...

> My second question is, if the underlying model is so f*cking elegant, how did it lead to such a confusing interface?

I think this is 66% because the operations are on the tree/nodes themselves, and not like, on "versions", branches, or some other skeumorphic abstraction. It's very bare metal. If you know how the command operates on the tree, you know how to conduct the actual action desired. I think the rest is due to cruft/familiarity - once you build that mental model, it works extremely well. So it's vi-like with a steep learning curve and arcane interface, but once you "git good", it's phenomenally productive.

comment 4y ago · link · parent

I'm in fact super acclimated with that file in particular. I've had zero problem jumping in and hacking around with it (been trying to cook up a FastAPI-like endpoint interface for async jobs/tasks a la Celery). Not a single line is surprising if you slow down and actually read the code - and I consider myself less-than-great at actually reading other people's code. It took me all of ... 15 minutes to find my way around, figure out the machinery I needed to hijack, and maybe another 45 to get a crude MVP of my concept working.

Honestly I prefer it over reading documentation and then having to mentally map to the codebase. I wish I could write this code well.

You sure you've actually read any of it, or did you just skim, see no docstrings, and decide it's crap?

comment 4y ago · link · parent

What do you use for type-generated CLIs? I've been using Pydantic for config parsing and Cleo for CLI, but I don't yet have a good solution for hoisting/injection of CLI arguments alongside env/file configs.

I really want a declarative solution like Rust's Clap library, but I haven't yet found anything like it out there.

comment 4y ago · link · parent

I dunno. I've read a lot of GPT output. It lacks a certain consistency over medium scales. The big picture checks out, and the word-by-word grammar checks out, but the sentence-by-sentence information often isn't cohesive, or certain entity references change over time.

Text-to-image algos did the same thing for a while, but you look at the latest full-size DALL-E and it's pretty much flawless.

https://openai.com/dall-e-2/

If I were considering art school, I'd certainly be reconsidering my options. Maybe there are some defects in the output, but nothing photoshop can't fix.

I think where humans win out (for now) is where a high degree of specificity/precision is needed (e.g. graphic design). Or certain legal requirements are present - AI art can't be copyrighted at this time - such as logo design.

comment 4y ago · link · parent

Yeah, actually, I'm super well acquainted with it, are you? Normally I hate the "self-documenting code" trope, but in this case, actually think the vast majority of these parameters are actually self-documenting, and also, everything is type-annotated. Let's take a snippet from the Dependant class:

    class Dependant:
        def __init__(
            self,
            *,
            path_params: Optional[List[ModelField]] = None,
            query_params: Optional[List[ModelField]] = None,
            header_params: Optional[List[ModelField]] = None,
What are path_params? They're params parsed from the URL path. What are query params? The same, from URL query component. Header params? Params pulled from the request headers. Shocking. If you actually sit down and read through FastAPI it's remarkably easy to get your bearings and start hacking around, despite the "no actual documentation" (I think type annotations count as documentation).

Compare that to code bases like Django, Celery, Matplotlib, where it's kwargs, kwargs, everywhere and nary a type hint to speak of.

The number of open issues is due to the massive popularity of the library (46K stars) compared to the number of actual maintainers. Some actual questions on the Issues tab right now:

- How to add admin page? - Is safe to remove value from list in asyncio - Best practice to run FastAPI on Cloud Run with server port as $PORT

These are all n00b questions that could readily be answered with general-purpose resources, but this is the blight that super popular FOSS libs and their maintainers have to deal with.

comment 4y ago · link · parent

Sounds like you need type aliases, or simpler abstractions.

comment 4y ago · link · parent

> as long as Tiangolo doesn’t bother allowing the community to improve it.

I don't see it that way. I see a rapidly growing library still in pre-1.0 and a BDFL trying to wade through a mountain of "contributions", a lot of them garbage, trying to keep code quality high in one of the most pristine and readable source code repos I've ever seen.

Also they have crowdsourced 17 languages for documentation translation. And it's up to date. That's bonkers. You're lucky if english documentation is accurate and up to date in many open source codebases.

comment 4y ago · link · parent

> A pythonic C++ that doesn’t smell bad.

Obligatory...try Rust?

But actually, try python with mypy and mypyc. It's still a little experimental, but if you stick to simple constructs it works well, and you can compile straight python to fast, static libraries, without using goofy cython syntax.

comment 4y ago · link · parent

> The point of duck typing was that you don't have to write all that boilerplate and stuff just works as long as the right functions are there.

As long as your definition of "just works" is "run, crash, fix something, run, repeat". I remember the pre-type-annotation days, and still live it with some libraries. I find it quite unpleasant, but hey I guess some folks like the "freedom".

> So it's very easy to create code that passes the type checker, but fails at runtime or vice versa.

In theory, yes, in practice, not as much as you might think. If you actually use mypy with strict, which is actually really hard to do, you will find very, very few surprises.

comment 4y ago · link · parent

> And it's pretty half baked on top (e.g. `a: int = "foo"` goes through the python interpreter without even a warning).

Well, yeah, because that's a compile-time check, not a runtime check. Use Pydantic if you want runtime validations.

> The new type system goes pretty much against the idea of duck typing,

It's very much orthogonal, due to the aforementioned distinction. Type annotations are compile-time. Duck-typing is run-time. You can still type-hint something and then call an attribute that isn't on the interface, and you can suppress the type error with `# type: ignore`. But also, if you know you are using quack(), you probably want foo(duck: Duck).

comment 4y ago · link · parent

> Conceptually, though, it can be treated as an error monad.

Exceptions are very much not a monad, that's one of the biggest pain points about them. You can't map over exceptions. They are a control flow statement.

comment 4y ago · link · parent

Rust absolutely nails the error handling department.

Python style exceptions, pros:

- rapidly drop through layers when needed to get to a stable entry point - easy to add errors deep in the stack

Cons:

- basically a limited GOTO, therefore side-effect, therefore not composable - no way to know if what you are calling is gonna throw on you

Java pros:

- have to declare exception types, so at least you know what you are dealing with

Cons:

- you have to always declare exception types, which can be tedious - same non-composable GOTO-lite behavior - adding an exception deep in the stack is tricky

Go pros:

- errors are values, therefore typed and technically composable - no surprises

Cons:

- tedious, verbose - can't rapidly unwind unless you panic - rarely composable in practice, requires manual unwrapping in most cases - adding an exception deep in the stack is tricky

Rust Result pros:

- strongly, statically typed - no surprises - higly composable - can map over it - rapidly unwind in a composable way with ? operator

Cons:

- adding an exception deep in the stack is tricky (but often amenable to programmatic refactoring)

It's no wonder Rust is the SO most loved language 7 years running.

Python actually has a Result type library which I really like, but it's been hard selling my team, and you really need buy in. But I'd give it a swing.

https://pypi.org/project/result/

comment 4y ago · link · parent

Configuration hoisting and library layout to avoid circulars is tricky. The way I structure my libs, lets say ./foo is my main lib, I'll have ./foo/types/.py with most of my primary schema models (I use Pydantic heavily). Then ./foo/config/.py manages application config. Basically everything is pulled in with env vars / config files - I rarely use CLI flags for application-level global configuration - the rest are passed in to entry point functions.

What this means is I can import my AppConfig class anywhere (except types and config submodules) without circular imports, construct them, and they will be initialized with the configs from the env.

Occasionally I have to bust out ForwardRef annotations and model.update_forward_refs() but that's pretty rare. Basically, the imports are structured so that it's as close to a DAG as possible.

Definitely check out pydantic, it makes it really easy to do 12-factor style application config.

I haven't done a lot with CLI-flag global config, but if I had to, I'd use something like dependency-injectors to wire it all together.

comment 4y ago · link · parent

For me, type annotations has been the single biggest ergonomics improvement to come to python. It's a very simple type system compared to many other languages (definitely simpler than rust, haskell, scala, java, and c++, I find it easier than go's generics but I am not practiced). I don't see how they add complexity to the language. In fact I find it limiting if anything.

Walrus is...fine. I don't use it much, but I defo see how it's one more thing.

Python's biggest complexity, imho, is its almost unrivaled dynamicism. There's just too many degrees of freedom at times.

The import system continues to be a nuclear footgun. I consider myself a python expert with 15 years under my belt and today I was still fighting with imports in a pytest suite. Like wtf.

comment 4y ago · link · parent

> Well, no. Boredom comes from within. When you have too many thoughts, or too few, to focus, boredom happens.

> TL;DR: Lay off virtual sugar, digitally detox, open the mind…

    - appreciate interestingness
    - hang out with geeks
    - enjoy quietude
    - get out of a rut
    - read long form
    - try three things you’d never, three times each
    - regain a sense of wonder
> And remember, “Boring is as boring does!”

This is all rather patronizing and has some major wowthanksimcured vibes. Yes, I can overcome the nonlinearity of the response of my dopamine receptors by simply laying off "virtual sugar" and doing a "digital detox".

Bottom line: different people have different neurotypes, and folks are allowed to be bored or stimulated to various degrees by whatever media, without attaching value to how easily one is entertained, or not.

comment 4y ago · link · parent

Excellent comment. Makes me feel "less guilty" for being bored to bits by Blade Runner (and 2001, similarly). I "feel guilty" because I consider myself a big sci fi fan, and while they are visually brilliant movies, they just drag ass. I have see why they are widely acclaimed in concept, but also felt like I was not not "getting" something.

The new Dune is long, dense, cerebral, visually brilliant, but is paced way better in my opinion. There's a continuous forward drive.

De-emphasizing pacing is just as bad as de-emphasizing any other important facet of cinema. But we have this dichotomy that action is "cheap" and not as "smart", because it has wider appeal.

I think neurotype plays a lot into this. I have ADHD, and the snobby cousin comment about "digital detox" is exactly the elitist garbage that rubs me the wrong way. It attaches value to "not being bored" as if that's something I have control over.

comment 4y ago · link · parent

Those master cylinders are of specific dimensions, variable length and probably mass as well. I wonder if one could analyze the audio frequency spectrum, and/or mechanical impulse response, to deduce the length of the master and work out the bitting.

comment 4y ago · link · parent

Drilling is tamper-evident though. The big win of picking/shimming is that it is stealthy and leaves no sign of entry.

Otherwise, just "pick" it with a Ramset, sledgehammer, c4...

comment 4y ago · link · parent

There's no one gene, but aside from very specific things, there's hardly one gene for any condition, but ADHD is highly heritable, and we already know several strong candidates. DRD4-R7, COMT Val158Met, TPH2, a couple others have been identified recently. Also, PET scans and in some cases high-density EEG can pick it up, the thing is, those are quite expensive and don't really even tell you that much, whereas psychological evaluation tells you much more qualitatively.
1
303132
85