Hacker News new | past | comments | ask | show | jobs | submit | more the-alchemist's comments login

I would give the jextract tool a try. I believe it uses LLVM to parse the header files, so the generated bindings might actually be pretty good.


I did use jextract for java 19+20, but it looked very messy.

Tried it again yesterday on java 22, and the helpers from jextract are waaaay better. I actually completed a MVP implementation this time in a couple of hours. This could perhaps be released as library if I find the effort to wrap it in a meaningful way!

We currently wrap this in java by calling the binary with subprocesses, which has been working great at some latency overhead. The big bonus of this though, is that we can kill the process from java when it misbehaves. Putting this C code inside Java again, means we likely lose that control.


Java's FFI is currently a very low-level. As the article points you, you don't actually have to do this: the jextract tool will generate the bindings for you from header files.

I'm sure someone will come along and write annotations to do exactly as you describe there. The Java language folks tend to be very conservative about putting stuff in the official API, cuz they know it'll have to stay there for 30+ years. They prefer to let the community write something like annotations over low-level APIs.

Anyway, the GraalVM folks don't have quite the same limitations as Java, so they have annotations already (https://yyhh.org/blog/2021/02/writing-c-code-in-javaclojure-...):

    @CStruct("MDB_val")
    public interface MDB_val extends PointerBase {

        @CField("mv_size")
        long get_mv_size();

        @CField("mv_size")
        void set_mv_size(long value);

        @CField("mv_data")
        VoidPointer get_mv_data();

        @CField("mv_data")
        void set_mv_data(VoidPointer value);
    }


I wasn't aware of it, great! One more point to the GraalVM folks.


What a crappy article. One can't complain NYT is too pro-EV.

This problem is a combination of growing pains, uneducated EV drivers, old EVs with crappy batteries, some bad infrastructure, and EV manufacturers that don't put enough diagnostics.

1. Ask anyone who has lived in these kinds of cold temperatures. Cold starts in ICEs are always a problem. in upstate NY, you always need a pair of jumper cables ready. you might get to where you're going, and then can't make it back.

2. Different battery chemistries have different cold vs. warm characteristics. Surprise, surprise, the newer, better, more expensive battery packs don't suffer in the cold as much. The loss can be as low as 3% (Jaguar I-Pace) to 30% (Ford Mustang Mach-E, VW ID.4). See https://www.recurrentauto.com/research/how-temperature-affec...

3. EVs have two battery packs: a small 12V one, like a regular car battery, and the BIG one. If the 12V one dies, you can't start the car, even if the BIG one is good. (EV manufacturers should install better 12V batteries and provide better diagnostics for this kind of problem.)

4. EVs also have a "pre-conditioning" charge, where (massively simplified) battery warms itself to prevent damaging itself when it's too cold. This can drain the battery, but if the car is plugged in, it's not a problem, it'll just pull the charge from the plug (even if the battery doesn't need charging).

5. Sounds like a few chargers "froze" up. Just like gas pumps, but obviously it's a much bigger issue because there's always another gas station down the road, unlike EV chargers.

6. Most EV owners charge at home, and we just plug in all the time because it's easy, convenient, and we can pre-heat the car with a button on our remotes, saving on battery.

7. Some EVs use resistive heat instead of a heat pump for heat gen, which can eat a lot of juice, but it's not a big deal anymore because the battery packs are so big.

So, really, my takeaway is that Tesla and the other EV manufacturers need to:

- cold proof their charging stations (probably a simple "growing pain")

- educate their users a bit. (if the car won't make it overnight because it'll have to do a conditioning charge based on the weather forecast, WARN the driver!)

- use better batteries. this issue will fix itself as the better manufacturing techniques spread throughout the industry


>educate their users a bit.

This is something they could do immediately. Send a push notification showing how tomorrow's bitter cold forecast will reduce their vehicle's range by XX%.


LFP is considered to "new" and "better" Li-ion battery in affordable BEV world, but isn't it weak for cold climate?


"MY" == "Model Y"?


Yes


Cannot keep up with these tesla people acronyms.


This.

We would all benefit from more cause and effect analysis in our media.

- Let's say we increase prices that we pay cocoa farmers, even double the price

- Is this extra enough to send the girl to school an hour away, pay for her books, etc.? If you pay the family more, how do you know they would spend it on the girl's education? Maybe fixing the water well or building a sturdier house is more important. Or paying off debt.

- The school is an hour away, the girl might not feel safe being away from home for so long without any adults. She might prefer being with her family. So... boarding school? Are the teachers qualified? (Go read about absentee teachers in Indian schools.)

- Also, if cocoa farming becomes more profitable, it might encourage _more_ child labor as parents pull their kids from school to work "on the family farm".

- If cocoa farming is profitable enough, it might invite a protection racket. Go Google for Mexican cartels and avocados.

Ironically, here in the U.S., we kinda glorify "working on the family farm", expecting kids to help on their parents' farms. Isn't that family doing something similar?

I am in no way glorifying child labor. I think it's sad and I wish I could adopt all these children and give them the quality of life I enjoy.

But complex problems require complex solutions. Unfortunately, we--humanity as a whole--have not found a universal solution to end human suffering as a whole, even the small subset of misery like child labor.

Historically, almost every country that has "developed" into an "industrialized" nation has had a very difficult, dangerous, violent learning curve. Kids in coal mines in the U.S., 18th century Dickensian English was a hellhole...


> - If cocoa farming is profitable enough, it might invite a protection racket. Go Google for Mexican cartels and avocados.

Ah yes, then also:

https://www.npr.org/2020/11/19/936567302/planet-money-the-le...

https://news.ycombinator.com/item?id=36900201

https://news.ycombinator.com/item?id=16148110


> Historically, almost every country that has "developed" into an "industrialized" nation has had a very difficult, dangerous, violent learning curve.

Historically, countries that industrialized didn't have an extensive history of examples to learn from and they had to figure it out for themselves. Every currently developing country doesn't get their own turn at being horrible to people or the environment.

The developed world should expect developing nations to learn from history and avoid the errors made in the past just as we'd expect them to take advantage of the advances in science and technology that have been reached.


Are you saying rich countries should force poor countries to adopt to their ethical and moral codes? Should they adopt all of them, like our stringent building codes? What about minimum wages? Vehicle safety standards?

I'm being supercilious, but hopefully you can see the problem.


I'm saying that rich countries shouldn't enable or accept poor countries exploiting child slaves and polluting the planet we all share because "it's their turn now". That's flawed logic.

We certainly shouldn't force other countries to follow our morals, but we shouldn't give them our money and support or make excuses for them while they act like monsters either. We should encourage them to do better, help them when we can, and lead by example. At a minimum we should be holding our own nation's corporations accountable when they're knowingly profiting from children being trafficked and enslaved.


Ok, but the article this discussion is about didn't show examples of child slavery, but of child labour, with a coverup being performed by locals, and suggestions of a large corp not doing enough to verify things independently.

Rich countries should help poorer countries lift themselves out of poverty, but let's not pretend everything is clear cut and simple. How do you deal with corruption? What is an acceptable level of violations is acceptable? How do you measure the good you do vs the harm you're causing?


This not.

> - Also, if cocoa farming becomes more profitable, it might encourage _more_ child labor as parents pull their kids from school to work "on the family farm".

Wtf. No? Do you pull your kids from school so they can help you at work?


> Wtf. No? Do you pull your kids from school so they can help you at work?

If I were in a position of "family eats or family doesn't eat" I would be sorely tempted to tap my kids as extra income earners. This isn't a particularly new problem in the world. The West has only gotten stringent on child labor in the last century, and you're seeing other countries coming up that are also struggling with the issue at hand: enough money to feed the family.

We're rather privileged in the West in that we don't really struggle for necessities. Even our impoverished have clothing, shelter, and food. We don't really understand what it means to be truly impoverished. Nor do we understand the kinds of decisions a father or mother must make in order to ensure their survival and the survival of their children.


Many of the child slaves in Ghana are trafficked. They're not working on the family farm to help grow food for their next family dinner, they're being forced into slavery and made to work for farms that sell their product to billion dollar multinational corporations.

The solution to ending slavery is to make laws which ban the practice and then strictly enforcing those laws. Once that's done it won't matter how profitable farming is because anyone who uses child slaves will suffer instead of profiting. Exceptions can be made for people farming their own food for their own tables which would still prevent the trafficking of children just so that Mars Incorporated and The Hershey Company can stuff their pockets with more money.


The countries that have "developed" have increased pressures on less developed nations, and caused or exacerbated problemsin the areas they have exploited in order to develop.


> Knocking on a friend's door (though he knows a same-age kid two doors away) would be considered out of bounds nowadays.

Yeah, the social dynamics of this kind of thing baffles me. I'm sure it's very neighborhood-dependent, but neighbors don't "check" up on each other either.

I think this is more U.S.-wide: it's not socially acceptable to knock on someone's door or ring their doorbell even if they're waiting for me. You're supposed to text that you're waiting outside. Doorbells are only for deliveries and unknown strangers (like selling something, politics, religious missionaries).

If it's not socially acceptable to knock on a friend's door when they're waiting for you to get there, then it's definitely not gonna be socially acceptable to just knock, see if they're home, say hi, and that's it.


I'm not sure where this is coming from, maybe it's a generational thing?

In my case, (36M living in Texas) it's totally normal for people to knock or ring the doorbell. Neighbors drop by to talk about what's happening in the neighborhood, friends come to visit, etc.


The invention of "anxiety" as a condition afflicting everyone under 40 means it's a faux pas to knock on a door, call a phone, or otherwise interact with anybody unless you warn them ahead of time.


I agree in principle, but I'm pretty sure the anxiety pandemic is real, not invented. Ask a middle- or high-schooler what percent of their class is on medication for anxiety, the answer will surprise you. In my grandma's day, that number would have been zero.

Whatever's going on there, it's serious. I bet in 50 years we discover that some chemical in our food/water/air was responsible, analogous to the leaded gasoline issue.


Or maybe doctors are happy prescribing pills to paper over mundane life issues.

It’s also a nasty feedback loop where all of this “mental health awareness” is blasted at kids all day and they start to assume there is a 50/50 chance they have anxiety and start to… get anxious about it.


Kids are suffering from increased anxiety due to social media in less pill happy places than the US.


The weird thing is that nobody seems interested in _not_ being anxious.


I don't know how you would justify such an observation, I suppose you could also quietly observe a bunch of disabled people in wheelchairs and say to yourself "they don't seem interested in not using wheelchairs" but I'm pretty sure they're very interested in not using wheelchairs.


That's fair, my comment wasn't helpful. I have had a few situations where I had to fix my coworkers' mess and they chalked up their inability to help to having anxiety or feeling vulnerable and I was a bit salty about it.


No I don’t think it’s generational. I see it across the age spectrum and I am in Texas too. Lots of neighborhoods just don’t interact. The gems are the neighborhoods where people live there because they really want to live in that house within that neighborhood.


Oh, benchmarking.

Great work, but maybe I'm missing something: I'm more interested in "performance per MB", i.e., per dollar USD, versus "how much memory does it use?"

I feel like that's not fair to systems that will trade performance and memory usage if given the chance. If you give Linux 10GB of memory and only use 2GB, it'll use the rest as a page cache, or memory cache, or anything. Unused RAM is wasted RAM.

Same for the JVM. Maybe it's deep in the weeds, but I don't see any setting of max memory (-Xmx, or -mx in the Java world). Same as any operation system, if you give it more memory, it'll use it.

Also, just like you'd want to generate and pre-warm your caches, you'd want to use the same for a JIT, a cache of sorts.

I'd also like to see these benchmarks using GraalVM native image, which tends to use a lot less memory and reach peak speeds much much faster (seconds, instead of minutes).


I thought I just wasn't using it correctly. This explains a lot, thank you.


There's a lot of Protege tutorials out there, but here's what an ontology (in the OWL sense of the word, let's you do). The "pizza ontology" is the Hello World of the ontology world.

* imagine a graph of things you wanna organize ("model"), say world religions, or the plant and animal kingdom * you can tell the system that anything that's a plant can never be an animal. or viruses can't be bacteria * or lions and zebras are both mammals * you can define what mammals are, vertebra, heart, brain, etc.

The interesting part is ontology _validation_ or querying.

Is it internally consistent? Maybe you specified viruses and bacteria and said they are never the same thing, but the way you modeled it, they are identical! Hmm, you'll have to update your definition of bacteria, or viruses, or both.

Next, you try to put fungi in the system, but there's an error because fungi do not belong to the plant or animal kingdom: they are their own thing.

So this is a fairly simplistic use case, but scale this up to hundreds if not thousands of entities and you can start to see the value.

Imagine sticking the human genome in there, and which drugs act on which chromosomes, etc.

It's a niche, for sure, if you need something like reasoning it's the way to go.


The main issue with ontologies, and the reason why they're not popular besides a few niche cases, is that they try to solve a fundamentally unsolvable problem: getting (a large amount of) humans to agree on a "correct" modelling of something non-trivial.

When you narrow down the domain to something where a consensus on representation can be reached, then sure, reasoning is a plausible use case... except for the fact that it scales very poorly, and making it work on a set of data large enough to be interesting requires a disproportionate amount of computing power.


Yes, consensus in ontology building has traditionally been a huge drag for the adoption of ontologies. While it's not necessarily required, having consensus about ontology can obviously increase their utility. At the same time I think it's important to have explicit dissent (differing world views) and give both a room to grow, rather than trying to create the "one true" view on the world.

However, I don't think the core issue is consensus itself, but instead that the prevalent form of consensus in the ontology authoring space is consensus by committee rather than consensus by usage (as is usual in the open source software space).

That's why I've in the past been involved in creating Plow[0], a package manager for ontologies, with the aim of bringing the same "grassroots" nature and network effects that you find in other open source ecosystem to ontology engineering.

[0]: https://plow.pm/


Do "stochastic ontologies" exist? You define probabilities for certain attributes and category assignments, then you do some max likelihood estimate over all unknowns, which yields the most likely, internally consistent world model.


Yes, you'll find something under the keywords Probabilistic Ontologies and Bayesian Ontology Reasoner.


Isn't an LLM essentially a stochastic ontology? Maybe that's why LLM's generalize so well to problems you wouldn't think would be amenable to next word prediction based on text analysis.


> At the same time I think it's important to have explicit dissent (differing world views) and give both a room to grow, rather than trying to create the "one true" view on the world.

you can embed this into ontology itself, e.g. create classes/entities: InPeterView, InMaryView etc.


Yes, I am very aware of that. However, realistically, Party1 with WorlView1 will be in charge of maintaining WorldView1 in their ontology document, and it is better to leave Party2 to maintain their WorldView2 in their own separate ontology document.

Of course sometimes there is a need to reconcile both world views, and there have been swaths of literature being written about ontology alignment. Optimally the parties would also share the things that they agree on and co-maintain them in separate ontology documents, though in practice this doesn't happen nowadays due to lack in ontology engineering tooling.


> co-maintain them in separate ontology documents, though in practice this doesn't happen nowadays due to lack in ontology engineering tooling.

there are multiple efforts to build some core standard ontologies (e.g. schema.org) which then can be used as common vocabulary.


And for good reason they don't gain widespread adoption. E.g. schema.org is barely used outside of making your website better scrapeable for Google - it is an (indirect) Google project after all.

The only "core" ontologies that have really found adoption over the decades are the ones that everyone is forced to use as they are baked into the standards (RDF/RDFS), and Dublin Core for metadata (where only 5 of the ~100 terms are commonly used).


it could be because all that rdf stuff didn't get strong adaptation, so no interest to build common core ontologies outside specific niches.


Why does it have to be something non-trivial? Why do a lot of humans need to agree?

You can have an ontology that is used only by you. Maybe a 1000 people need to agree, and they would probably be on your payroll. It could be something trivial and already kind of decided, like movies metadata, etc. It's there just to power your internal systems, not for humanity to agree upon.

For popular use, it really comes down to the tooling. If I take this knowledge that I already have and write an ontology for it, what do I have to gain? Sadly, with the current state of tooling, you gain nothing.


Ontologies are behind some of the systems that help mapping between different models used by different groups for things in the same space (for example, mapping between different ways of interpreting and communicating medical data through HL7 messages).

An Ontology doesn't mean it has to decide on single correct model - in fact, I'd say such ontology is particularly poor and a technology that limits to that is too limited to be used in ontology field.


But wikidata is trying


Those who say it can't be done should not interrupt the people doing it, I suppose!


You're right that it comes down to just domain modeling, but institutions that don't require some kind of democratic consensus (say, inventory systems for individual companies) do not always need that unless you plan on exposing the data to others. This is the distinction between "linked data" and "semantic web".


It's generally more interesting to apply validation to data than ontologies themselves. OWL makes this harder, because it rejects two assumptions that are commonly used in real-world modeling: (1) Unique Name Assumption; every object in the domain is described by a single entry in your data model. By contrast, OWL will always try to conflate different entries in order to solve logical consistency issues that arise from your model; (2) Closed-World assumption on relations. OWL rejects this and assumes that your data about the relations or properties in any given model is always incomplete. Its reaction to issues that crop up with your modeling is to enforce logical consistency by adding "inferred" property instances to your data, as opposed to simply flagging the issue for validation. Real-world technologies like SHACL and ShEx work on very similar logical principles, such as description logic https://news.ycombinator.com/item?id=31890041 but avoid these pitfalls.


It's usually not referring to as a plugin, but as a standalone utility, i.e., `docker-compose` not `docker compose`.

If you put the binary in that magic Docker plugins directory, it'll treat the binary as a plugin and let you do `docker compose`.


Note that these are two different implementations, the standalone docker-compose has different cli arguments and is deprecated for the plugin (which is also a binary executable as you pointed out)


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: