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

I don't see it as "LOC-worship". It's about the most objective measure of codebase complexity/scope as could exist. It doesn't equate to features, but it certainly correlates to it, more business logic means more code.

> Sometimes conciseness is better than cleverness.

Isn't concise and clever on the same side of the balance? Cleverness and abstraction is how you cut down on LOC.

Abstraction has its own cost, so while you can trade LOC for cleverness/abstraction, there's limits/costs to that as well.

Also also, python/mypy still lacks support for higher-kinded types, which really puts a soft-ceiling on the amount of abstraction you can type-safely utilize.

Aaaanyways, I think the whole original point is, "we have a large codebase, and mypy helps keep the wheels on at speed".

+1 on black and precommit. That has done wonders for codebase consistency. I'd run flake8 too but the maintainer is weirdly opposed to supporting pyproject.toml for config.

comment 4y ago · link · parent

Python specific:

- `pytz.timezone(timezone_name)` will give you the current offset for that timezone - well, it will at least be some consistent offset - surely, every timezone has the same reference starting point?

What `pytz.timezone(name)` actually does is initialize a timezone object at the point in time of the first entry in the tz database for that zone. For example, New York had an offset of 4:56:02 prior to 1883 November 18, 12:03:58 [1]. That is the "starting point" for America/New_York and US/Eastern (which I think is an alias of New_York before a certain date). Which is why you get

    >>> pytz.timezone('America/New_York')
    <DstTzInfo 'America/New_York' LMT-1 day, 19:04:00 STD> 
Ish. Not sure where those 2 seconds went. But that explains why you see that strange 19:04 (-3:56) offset. The real way to use it is

    >>> pytz.timezone('America/New_York').localize(your_specific_datetime)
Timezones without a reference time are deceptive.

[1] https://en.wikipedia.org/wiki/Tz_database#Example_zone_and_r...

comment 4y ago · link · parent

Simple: a "real" photo is one in which a light field from the real world impinges on a photosensitive media (CCD, film), and directly encodes that information, with some allowance for global light levels, gain, ISO, and speed. Anything else is a modification therein. HDR, multi-exposure compositing, etc, aren't truly "real". They may be 99% real, but aren't 100% real. If you crop it, it's 99.9% real (we have models which can detect cropping and even from which region it originated, obviously it can't reconstruct the missing data).

Yes, by that definition, most photographs already aren't real.

comment 4y ago · link · parent

In the grand scheme of molecules, they look nothing alike.

DDT is what we call a "greasy brick", while sucralose is a highly water soluble sugar.

comment 4y ago · link · parent

Chlorine-carbon (or halocarbons in general) bonds are somewhat rare in nature. That is not to say they don't exist, but they are a bit unusual. The problem with halocarbons (aside from fluorine, which has its own issues) is they are generally not very reactive, so they can bioaccumulate. But when they do react with biological systems, it tends to be in unwanted and toxic ways.

That said, as a former chemist, I consume sucralose, and I am not worried by it. Unlike most halocarbons, It's very water soluble, so it does not react in the ways the bad halocarbons do.

comment 4y ago · link · parent

> Computer calculations by colleagues at the University of California, Los Angeles, revealed DMSO knocks off the carboxylic acid group. “Once that happens it causes the entire molecule to fall apart in a cascade of reactions,” Dichtel says.

Big if true. I'm slightly skeptical that just decarboxylating PFAS causes the rest of the backbone to "fall apart" - I would expect it to form CF3[CF2]· (carbon radical) which would readily react with water to form -H or -OH, which is basically back to square one. But maybe it can eliminate HF in the presence of UV, forming CF3[CH2]CF=CFOH, which gets hydrolyzed, oxidized, then cleaved, but boy is that an unfavorable process.

(edit: skimmed the paper, I was pretty close. Forms CF3[CF2]- which goes to CF3[CH2]CF=CF2 which then gets hydrolyzed, but...DMSO/NaOH at 80-120°C ...yikes. This is the ochem equivalent of "nuke the site from orbit", very few compounds survive these conditions)

I've been out of the chemistry game for a few years now so I'm a bit rusty but gut instinct is that this is far from a slam dunk. But anything to reduce FC's is a boon to the world, so I'm hopeful this is a breakthrough.

Edit2:

> This high fluoride recovery indicates that most of the perfluoroalkyl fluorines were defluorinated and mineralized rather than being transformed to smaller-chain PFAS or being lost as volatile fluorocarbons.

So the surprising thing isn't the decarboxylation, it's that NaOH encourages the perflourylalkenes to cleave at sites away from the alpha (splitting, rather than carbon-by-carbon), which is neat. Still doesn't touch PFOS, unfortunately.

comment 4y ago · link · parent

Gorgeous. I love the bold choices. Website really pops. Clearly a lot of care went into this whole operation. Kudos on having two different layouts. Aluminum chassis is great. I don't travel with a keyboard often, but if I did, I'd be all over this.

Being in the peanut gallery is fun, so I'm going to echo a few common points.

- I love the dished keys. Would be a neat feel I think to do all keys like that

- staggered is the past, ortho is the present and future

- separate delete/backspace key is great (maybe fn-bksp can do this?)

- I would give my left toe for a trackpoint on a low profile portable keyb.

- I love the novelty/utility of the rotary encoder, but the high profile of the knob kind of defeats the low-profile. A jog wheel or knurled knob would be perfect

- I like all of the font choices - in isolation. Yes even the numbers, which are getting some heat. What irks me is the inconsistency of the fonts. I count 3-5 distinct typefaces. It would be very iconic if you used the number font on all keys. It screams ART and makes it stand out from bog standard keycaps.

- I know split is hard to engineer, but it's worth mentioning, because that would really knock this out of the atmosphere.

comment 4y ago · link · parent

Arrow keys worked for me, but sadly back-arrow did go to the previous animation (Firefox, mac).

comment 4y ago · link · parent

I'm not sure Raft is the best distributed consensus algorithm for the situation of a global, unstable, frequently-partitioning network. I think it is in its niche when leaders are running on fairly stable networks (>1-2 nines), and the main source of node failures are due to task cycles / rolling deploys.

I've played around with Hashicorp Consul on "edge boxes" - long-haul, wirelessly-connected embedded computers, with unreliable power supplies. Allowing edge boxes be Consul leaders results in all kinds of mayhem: split brain situations, corrupted state, stale DNS resolutions (Consul handles DNS as well), cats and dogs living together, mass hysteria. A much better topology is to have 3 server nodes on a LAN as the "head cluster" and letting all the edge boxes be clients of the head.

I haven't used it but Consul has a multi-datacenter mode, which I believe is designed to better handle such a situation, which I believe has a dedicated raft cluster per datacenter.

https://learn.hashicorp.com/tutorials/consul/federation-goss...

comment 4y ago · link · parent

In the majority of cases: Absolutely. That is basically the direction things have gone with "just docker build the image and redeploy".

The amount of frustration dynamic linking causes is just not worth it in today's day.

I think that calculus looks very different 20, 10, maybe even 5 years ago, when getting packages rebuilt and distributed from a zillion different vendors was much harder.

comment 4y ago · link · parent

> while those Marvel effects are, well, boring by now. They have no wow effect (we see them in almost every single modern day movie), the convey no emotion (difficult to properly act, I think, when you are in front of a green screen and everything just plays out in your imagination) not do those effects actually drive the "story" forward.

I think this is the crux of it, moreso than the CGI Orgy (great term btw). You can have movies with visibly apparent CGI, or even straight up animated movies, but the action is great and still drives the plot and pulls on your heart strings. I know every beat of The Matrix by heart, but there's still a ton of suspense in every action shot, because each encounter adds some new angle to the power scaling. At the start, squad of mooks > 1 freedom fighter > several mooks, but even 1 agent is better than several FFs. Then that balance shifts.

Contrast that with the Smiths fight in the later films, and it's totally Conservation of Ninjutsu at play. Adding more baddies just divides the power of a single baddie, because we already know the outcome, so we know 1 Neo = N Smiths.

Watched Aquaman recently, same thing. Completely unprincipled power scaling. No reference frame, and it just scales up and up until it's CGI Army 1 vs CGI Army 2. That spectacle might work if I had more reference for the power levels, plus emotional investment, but I don't.

comment 4y ago · link · parent

This is exactly the sort of thing I've been looking for. Not sure how production-grade it is* but definitely gonna use it for some scripts and data processing. I love python, most of all its ecosystem, and use types extensively, but it still misses some things I wish it had better support for. Namely: immutability, and explicit side effects, which are both prominent features of Erg. So this is super exciting.

Does anyone know if Erg code can be (ergonomically) called from python? I think that'd be the real killer feature, being able to write erg modules and pull it into the greater python ecosystem as easily as native python.

* looks like the project is nary a few weeks old? Can't really dig into the git history on mobile, it freezes my browser

comment 4y ago · link · parent

We have a 50kloc all-python backend, with very high (>90%) type integration (that last mile is hard). I've done pretty big (thousands of loc) refactors and it's pretty painless. Night and day compared to the pre-typed python days.

comment 4y ago · link · parent

Use pydandic for serde/IO validation, and mypy --strict. And minimize cheating e.g. Any. I think you'll find it extremely stable and a totally different beast than usual python.

comment 4y ago · link · parent

We had that, it was called Windows 95 and you got viruses by merely connecting the computer to the net.

comment 4y ago · link · parent

It does, but diesel is more expensive in most places (even accounting for better energy density), due to the structure of US refining industry. This sets the stage, and familiarity continues the trend.

More people drive gas, so more gas vehicles continue to be available.

Biodiesel along with moving more of these passenger trucks to diesel would go a long way toward reducing overall carbon, but cost is the main issue there.

comment 4y ago · link · parent

How is that any different? Sounds like "dark matter was introduced because, previously, all other matter interaction was pulling on something". It walks invisibly but quacks like matter (lensing, galaxy geometry, etc) so we call it dark matter.

It's all the ways in which it doesn't act like matter which make it interesting.

comment 4y ago · link · parent

It doesn't, which is exactly the problem. Ontologies inevitably have mistakes. When your reasoning is based on these "strong" graph links, even small mistakes can cascade into absolute garbage. Plus manual taxonomic classification is super time consuming (ergo expensive). Additionally, that assumes that there is very little in the way of nebulosity, which means you don't even have a solid grasp of correct/incorrect. Then you have perspectives - there is no monopoly on truth.

It's just not a good model of the world. Soft features and belief-based links are a far better way to describe observations.

Basically, every edge needs a weight, ideally a log-likelihood ratio. 0 means "I have no idea whether this relation is true or false", positive indicates truthiness and negative means the edge is more likely to be false than true.

Really, the whole graph needs to be learnable. It doesn't really matter if NMR is a chromatographic method. Why do you care what kind of instrument it is? Then apply attributes based on behaviors ("it analyses chemicals", "it generates n-dim frequency-domain data")

comment 4y ago · link · parent

> The point here is that in semantic web there're supposed to be lots and lots of different ontologies/schemas by design, often describing the same data.

This is incredibly problematic for many reasons. Not the least of which is the inevitable promulgation of bad data/schemas. I remember one ontology for scientific instruments and I, a former chemist, identified multiple catastrophically incorrect classifications (I forget the details, but something like classifying NMR as a kind of chromatography. Clear indicators the owl author didn't know the domain).

The only thing worse than a bad schema is multiple bad schemas of varying badness, and not knowing which to pick. Especially if there is disjoint aspects of each which are (in)correct.

There may have been advancements in the few years since I was in the space, but as of then, any kind of probabilistic/doxastic ontology was unviable.

comment 4y ago · link · parent

Yeah, the boilerplate is rough, but python's import system is magic. There's no reason why you couldn't just do

    from example.jl import mat_mul
and have it just work. (With the right libraries and import functionality of course.)

comment 4y ago · link · parent

No, I'm getting it from wikipedia. It has nothing (directly) to do with Cloudflare or any other commercial interests - bittorrent is a content delivery network. You could run a private CDN. The whole purpose is moving the data to be consumed away from some centralized primary host, to nodes which are more proximal to the data consumer (either spatially, or solely in terms of bandwidth, torrent bandwidth is decoupled from the primary server). Bittorrent sort of automatically works out "proximity" by pulling from the highest bandwidth seeders. Also it's geographically distributed, providing redundancy and availability, which is arguably the more important part than proximity.

I think the criteria are that it a) delivers/distributes content b) is a network, implying multiple nodes c) lowers the latency and/or bandwidth cost of data consumption, by d) leveraging geographically distributed redundancy and/or proximity. I think the key feature is geographically distributed redundancy which differentiates it from a regular cache.

https://en.wikipedia.org/wiki/Content_delivery_network

comment 4y ago · link · parent

Nope, that's just a proxy/cache.

> A content delivery network, or content distribution network, is a geographically distributed network of proxy servers and their data centers. The goal is to provide high availability and performance by distributing the service spatially relative to end users.

Emphasis mine. CDN implies some sort of edge-hosting topology (or at least more-proximal than the main servers).

comment 4y ago · link · parent

It's a constant cat-and-mouse game. When I worked in this space (2019-2021), the best defense against deep fakes was looking at the microfacial behavior/kinematics of the "puppetmaster" and comparing against known standards of the deepfake subject. Works even if the fake is pixel-perfect (since it looks at the facial "wireframe" rather than the image itself). The obvious downside is you need sample data of the subject (and usually tons of it). I wonder if that general approach can be optimized. E.g. Deep fakes tend to struggle with certain fine movement/detail, if you had a reflection of the subject, the algorithm would have to not just replicate the main face and the mirror, but also be completely optically consistent.

Was a fun project, but the cat-and-mouse feeling was inescapable. For those curious, look up the DARPA MediFor project. Siwei Lyu (in the article) did a bunch of work in this space. Also see Hany Farid and Shruti Agarwal. They've worked specifically with deep fake detection.

https://arxiv.org/abs/2004.14491

comment 4y ago · link · parent

Media forensics algorithms do work on various forms of rebroadcast, transmission, and compression, so yes this should be possible (for now). look up darpa medifor project. Siwei Lyu (in the article) did a bunch of work in this space. Also see Hany Farid and Shruti Agarwal. They've worked specifically with deep fake detection.

https://arxiv.org/abs/2004.14491

comment 4y ago · link · parent

What about reflections? When I worked on media forensics, the reflection discrepancy detector worked extremely well, but was very situational, as pictures were not guaranteed to have enough of a reflection to analyze.

Asking the subject to hold up a mirror and move it around pushes the matte and inpainting problems to a whole nother level (though it may require automated analysis to detect the discrepancies).

I think that too might be spoofable given enough time and data. Maybe we could have complex optical trains (reflection, distortion, chromatic aberration), possibly even one that modulates in real time...this kind of just devolves into a Byzantine generals problem. Data coming from an untrusted pipe just fundamentally isn't trustable.

comment 4y ago · link · parent

Wow, this is exactly the comment I needed right now! I've long connected the source of procrastination with some kind of avoidance/learned helplessness behavior, but haven't been able to make much progress towards actually doing anything about it. "Just start doing it, even if it's only a tiny bit or done poorly" doesn't work when the stimulus of "start it" is exactly what is causing feelings of distress.

I really like the idea of "practicing in order to devote less consciousness to it". I think this works well for a lot of low-thought tasks that aren't very mentally stimulating. Not sure about those where it requires conscious effort (paying taxes) but it's certainly a new avenue I haven't tried before.

comment 4y ago · link · parent

I believe by batching they mean operating on collections of entities instead of single ones. So you may have POST /pets to create a single pet from a json object, but what if you want to add a hundred pets at once? Even with multiplexing, this is often way less efficient. Often the solution is to have POST /pets/bulk which takes a list of objects.

comment 4y ago · link · parent

Lack of strong evidence is not strong evidence of lack. Subtle effects like "well-being, creativity, and cognitive function" can be quite hard to track, and there are confounders galore.

comment 4y ago · link · parent

Java and C are neither simpler nor easier than Python where the rubber meets the road: making the computer do something you want it to do. Not even close. Java requires a fair amount of arcana just to get started (relative to python) and C is a simple language which pushes all the complexity onto the programmer. Java, like python, has some really deep rabbit holes when you dig into internals, and C has so much complexity in the necessary tooling.

I think Go is possibly simpler than Python. The syntax is smaller, no method overriding, and does not really have internals to the same depth as a VM language.

1
272829
85