News for hackers. Stuff that matters.

jacobmartin

Re:The friendship between Haskell and C on Friday March 17, 2023 @10:10AM (#35197300)
fascinating! Does vendor cc link to a different libc? I wonder if that is the problem and the docs are for glibc.

And testing just now, I can't even trigger SIGFPE with division by zero (integer or float). I guess all of these exceptions are "caught" now.

Re:The friendship between Haskell and C on Friday March 17, 2023 @09:32AM (#35196836)
You should be able to see the floating point exception by testing fetestexcept(FE_INVALID) (if it returns nonzero/true then you have a domain error). errno is also set as a side effect.

(edit), for instance this gives me output of "1":

  #include <math.h>
  #include <fenv.h>
  #include <stdio.h>

  int main(void)
  {
    double a = sin(INFINITY);
  
    printf("%d\n", fetestexcept(FE_INVALID));
    return 0;
  }
Re:How Did Dennis Ritchie Produce His PhD Thesis? [pdf] on Thursday March 16, 2023 @09:38AM (#35181797)
> I guess it's useful sometimes to know how to engage the 40wpm "actually get every character exactly right without even looking at the cursor" mode to transcribe documents.

Just thinking about this makes my spine straighten and my fingers "get ready" to go to the home row :p

We must have used the same application at my school. Though I think I eventually got to 75wpm with no mistakes (or whatever was allowed by the program--three mistakes a minute sticks in my mind but who can remember). It served me well. I live-LaTeXed my lecture notes and homework in college.

I unlearned the habit of backspacing to my mistake, correcting, and retyping. That has served me well.

I wish we had spent more time on accurately typing \ | ( ) , [ ] { } etc.† It would help me now as I still make simple mistakes with that. On the other hand, it only would've been useful to a handful of us.

† In fact, thinking about this brought up the very nostalgic memory of buying C++ for Dummies and the first program listing in it having a vertical pipe character. I had never seen it, and thought it was an ell at first. Well, that didn't compile, so maybe it was a 1? I didn't know! And the listing in the book had an unbroken pipe but my keyboard had a split one, so I couldn't tell these were the same character.

Eventually, I hit every key on the keyboard and then went back through them pressing shift until I found the right character! That was a feeling of enlightenment!

Re:Ask HN: Are a lot of books just... useless? on Thursday March 09, 2023 @02:49PM (#35085710)
Books are frequently useless. I only buy used (thrift books, local book stores) or get them from the library. If I dont have a compelling reason to finish it after about 20-50pages, I just re-sell/give away/throw it in the nearest gutter.
Re:The Quest for Netflix on Asahi Linux on Thursday March 09, 2023 @01:43PM (#35084943)
> Or rather, that was all true at the time when I first investigated Widevine-on-Asahi, several months ago. A few weeks ago, Google decided to enter the 21st century and started shipping aarch64 userspaces on certain Chromebook models. This means that "Widevine-in-Chrome-on-Linux-on-aarch64" does exist. The ChromeOS blob extraction process works as before, and the Pi Foundation conveniently packages it as a .deb for Pi users.

Not the point of the article but this is great news that I learned just now. I can finally upgrade to aarch64 chrome on my Raspberry Pis.

For sure. In this specific case, I'd add that because of Catholic belief on martyrdom (directly to heaven, no purgatory, no baptism required even), the standards are a lot lower to canonize a martyr. For instance they can (but don't always) skip directly to "blessed" status, skipping over the declaration that they were "heroic in virtue." Which makes sense--historically speaking the first saints that were involved in worship were martyrs. And many of those "converted" right before they were killed, not having led lives that were Christian at all. There is a sense one gets that martyrs are the ur-Saints and that other saints were only canonized "by popular demand."

(Former Catholic but not a theologian or anything. See discussion here on how canonization is not a declaration of virtue: https://www.newadvent.org/cathen/02364b.htm)

Re:The Blunders of a 16th-Century Physician-Astrologer on Wednesday March 08, 2023 @08:37AM (#35068803)
I would agree, but as DoreenMichele pointed out, they were treated the same in ancient Greece. And it's not like the Greeks had extremely sophisticated climate models able to predict the harvest seasons in advance. As far as I know, even today these sorts of models are hit-and-miss. I think we should call it astrology in English in this circumstance.
Re:The Blunders of a 16th-Century Physician-Astrologer on Tuesday March 07, 2023 @09:30PM (#35064455)
Tangentially related but one of my favorite stories is that the earliest derivatives contract we have recorded was based on astrology:

> A story, with different versions, recounts how Thales achieved riches from an olive harvest by prediction of the weather. In one version, he bought all the olive presses in Miletus after predicting the weather and a good harvest for a particular year. Another version of the story has Aristotle explain that Thales had reserved presses in advance, at a discount, and could rent them out at a high price when demand peaked, following his prediction of a particularly good harvest. This first version of the story would constitute the first historically known creation and use of futures, whereas the second version would be the first historically known creation and use of options.

https://en.m.wikipedia.org/wiki/Thales_of_Miletus

Aristotle clarifies that Thales supposedly predicted the weather by using astrology:

> Thales, so the story goes, because of his poverty was taunted with the uselessness of philosophy; but from his knowledge of astronomy he had observed while it was still winter that there was going to be a large crop of olives....

https://www.perseus.tufts.edu/hopper/text?doc=Perseus:text:1...

Re:Ethically Sourced Lena Picture on Friday March 03, 2023 @11:20AM (#35011569)
Meh I don't find the man unattractive personally. But I also wouldn't say he's attractive. Different strokes, may a hundred flowers blossom, etc. I certainly don't think it's ethically wrong to show this to people, or at least not for this reason. I do question if it's appropriate for the workplace though. I guess it depends?

But I think it's fairly clear that the point wasn't to be attractive.

Re:What is Chess? What to think and how long for on Wednesday March 01, 2023 @10:14AM (#34983244)
Considering that we don't have any history of chess until more than 500 years after Seneca's death, in India no less, I think it's fair to say that this is yet another example of "ye olde translationes" editorializing and using too much dynamic equivalence. latrunculi, the word he uses in this sentence at the beginning of chapter XIII, must have referred to a different game.

Plus, I doubt most people would really agree with de brevitate vitae. It's the equivalent of "grind culture" but from the first century. Amusing and interesting but probably not congruent with now most people want to spend their lives. (No shame from me if you do want to live your life that way, but it should just be known that this is far from a neutral perspective.) For a more balanced view of otium (pleasure, relaxation, opposite of negotium, business), I'd recommend the letters of Pliny the Younger.

Re:Proposal to Merge Pyston with Cpython on Tuesday February 28, 2023 @12:30PM (#34972144)
I'm no expert, but you might be interested in: https://llvm.org/docs/tutorial/

There's also a Haskell version if you'd prefer: https://www.stephendiehl.com/llvm/

Idk how to do this in python as I'm not really good with it, but in C, to make your compiler a JIT, you would `mmap` a region as writeable, write the machine code to it that you already know how to generate, `mprotect` it as PROT_EXEC instead of PROC_WRITE, cast the pointer to the region to a function pointer, and then call it. These functions may be available in the python sys package but I don't really know.

I've implemented a "JIT" that takes machine code as hex and does this. Warning: it's complete garbage with no error checking but is a good proof of concept. https://gist.github.com/martinjacobd/3ee56f3c7b7ce621034ec3e...

Re:Forth: The programming language that writes itself on Saturday February 25, 2023 @07:10PM (#34941787)
For sure. Additionally, the syntax of lisp also makes these AST macros ergonomic and, in many cases, beautiful. Rust has AST-transforming macros, but they're harder to use because the syntax is more complex. They're also quite ugly.
Re:Why does 0.1 and 0.2 = 0.30000000000000004? on Thursday February 09, 2023 @10:20AM (#34725301)
I didn't downvote you. (In fact, I don't have access to the downvote button lol, but I wouldn't have used it here in any case.) But a comment above yours already discussed this possibility, and there were replies as to why this is not the problem here. C and Python are giving the same fp result just printed to different precisions. Ftr I was using the defaults, whatever those may be:

  gcc fp.c -o fp
Re:Why does 0.1 and 0.2 = 0.30000000000000004? on Wednesday February 08, 2023 @12:00PM (#34710976)
Yes, thank you for this. I just ran it with the floor() function actually called and it did give 56.000000. I didn't think to check the precision. Rookie mistake!
Re:Why does 0.1 and 0.2 = 0.30000000000000004? on Wednesday February 08, 2023 @11:08AM (#34710050)
Thank you!
Re:Why does 0.1 and 0.2 = 0.30000000000000004? on Wednesday February 08, 2023 @10:59AM (#34709892)
This is great!

There was a post on /r/softwaregore recently where someone showed a progress bar on Steam that said "57/100 achievements! Game 56% complete" or something like that. I snarkily commented something about naively using floor() on floating point and then moved on.

But then I thought that that may not have been the problem, fired up emacs and wrote a C program basically just saying

  printf("%f\n", 57.0 / 100.0 * 100.0);
To my surprise this correctly gave 57.000000, but in python,

  57 / 100 * 100
Gave 56.999... anybody know what was up here? Different algorithms for printing fp?
Re:Want anonymity? Make a persona not a mystery on Friday February 03, 2023 @06:52PM (#34649572)
Yes, precisely. Sorry I wasn't clear about that.
Re:Want anonymity? Make a persona not a mystery on Friday February 03, 2023 @03:21PM (#34647188)
The deontologist believes lying is against the universal maxim. If everybody lied all the time, we wouldn't have a functioning society.

The virtue ethicist believes it is bad to be in a habit to lie because being predisposed to lying is opposed to the virtue of the truth. We've all known people who lie by habit and they are unpleasant and vicious to be around. I don't know if most virtue ethicists (who don't also fall into the natural lawyer camp, below) would say it is per se bad to lie, but most would say it is vicious.

The natural lawyer believes that speech has as its natural end telling the truth and therefore it is contra naturam to lie. See the almost-impossibly-extended discussion here, for that: https://www.newadvent.org/cathen/09469a.htm

For all of these groups, there has variously been admitted something like an "equivocal statement"---a statement which has some interpretation that is technically true, but not the interpretation that the speaker knows will be taken by the listener as a falsehood. For example, my friend invites me out on Friday and rather than saying I'd rather be at home, I say, "I have something going on that night." He takes it to mean that I have other plans, but I don't. But technically, breathing is "something going on" so I haven't lied. (Whether your social relationships will stand your doing this is another matter ;))

I'm personally fall in something like the virtue ethicist camp, but I do believe sometimes, in justice, a lie must be said, and not all of those situations can be covered by an equivocation.

Re:Japanese Explained to Programmers on Tuesday January 31, 2023 @03:33PM (#34601531)
The rhetorical device here is called polyptoton.

It have noticed it usually sounds clunky in English, though it was a favorite of Latin and Greek authors. For instance, "Et lux perpetua luceat eis," is usually translated, "And may perpetual light shine upon them." But in Latin, the same root is in the subject and the verb. "And may perpetual light light them," is grammatical and (mostly) semantically equivalent in English. But it sounds clunky and looks like a typo :P

My uninformed supposition would be that it sounds clunky in English because English has less variation in word morphology, so the words are too similar when they have the same root.

Re:Visualizing “The Art of Fugue” on Sunday January 29, 2023 @07:10AM (#34567359)
Found this guy's YouTube channel when I was a kid learning to play the piano, googling my pieces to hear how they sounded. He introduced me to Bach, and I've loved him ever since :)
Re:An intutive counterexample to the axiom of choice on Monday January 23, 2023 @09:39AM (#34489251)
This is an interesting question that gets to the heart of the constructivism debate, which I won't touch on here.

As for the integer example, the integers are all easily (finitely) constructed (successors to 0 and their additive opposites), so it isn't a consistent concept to say "This is an unconstructable integer." Sets, on the other hand, are not necessarily always constructable, unless you only take the constructivist axioms.

Re:An intutive counterexample to the axiom of choice on Monday January 23, 2023 @09:28AM (#34489115)
No, usually the cardinalities of infinite sets are represented by things called aleph numbers: https://en.m.wikipedia.org/wiki/Aleph_number.

But it isn't, in any case, an integer.

Re:An intutive counterexample to the axiom of choice on Monday January 23, 2023 @09:15AM (#34488945)
> If I can accept that there are more reals than reals with finite descriptions, why can't there be integers without finite descriptions/positions?

Because the integers are defined as the finite successors to the number 0 and their additive opposites. See, for instance, the construction section of: https://en.m.wikipedia.org/wiki/Integer

You can start talking about numbers that can't be constructed in this way, but then you've ceased to be talking about the integers.

Re:An intutive counterexample to the axiom of choice on Monday January 23, 2023 @09:03AM (#34488800)
Where is 1⁄3? Is it before or after (pi - 3)?
Re:Sudo Replacement on Friday January 20, 2023 @08:34PM (#34462835)
Yeah, I always read this as "bottom emoji" in my internal monologue, and that is how I search for it if I need to copy & paste it on a laptop or desktop lol.
Re:Eggs are 60% more expensive than last year in the US on Thursday January 12, 2023 @12:19PM (#34357088)
Here is a less anecdotal source to support what you are saying: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6024687/

There is about 10x more unesterified (absorbable) cholesterol secreted into bile than one typically eats in a normal day.

> Eating cholesterol has very little impact on the cholesterol levels in your body. This is a fact, not my opinion. Anyone who tells you different is, at best, ignorant of this topic. At worst, they are a deliberate charlatan. Years ago the Canadian Guidelines removed the limitation of dietary cholesterol. The rest of the world, especially the United States, needs to catch up.

https://peterattiamd.com/the-straight-dope-on-cholesterol-pa...

The only caveat I would is that there is weak evidence for a "dietary cholesterol hyperresponder" phenotype that is more sensitive to dietary cholesterol than the general population.

I probably have (heterozygous) familial hypercholesterolemia, so my diet (even saturated fat) unfortunately doesn't influence the (very high) levels I have anyways. I'm envious of people like you, for sure.

Re:The Organ as a Wind Instrument on Monday January 09, 2023 @04:00PM (#34315986)
Triply so if the choir is a professional choir. It's a job. They don't ask you the Creed before you audition.
Re:The Organ as a Wind Instrument on Monday January 09, 2023 @03:25PM (#34315495)
If you're in the US, you may want to try to find an episcopal church. They seem to be liturgically conservative enough to still have organs but are generally socially liberal enough to be more accepting. Ymmv, obviously.

But I will say that personally in years of playing the organ and asking random churches (including conservative ones) if I could borrow their organs on a quiet weekday, my bisexuality has never come up. And I didn't have to be friends with the choir director either. Once, I attended one Mass and just went up to him afterwards to thank him for playing (it was beautiful) and ask if I could ever practice with it.

I know it's different from many places as I'm in a big city, but at least four organists whom I've known personally are gay. Many churches don't even require you to be religious even to be employed to play the organ there. Randomly on an airplane, I spoke with an atheist music professor who was choir director/organist at a congregationalist church. They didn't seem to care. So I doubt it'd be a big deal if you just want to practice. The choir director at my current (liberal) parish never takes Communion--I don't know if he is personally religious one way or the other, but it seems to be little more than a job to him.

Also, you should try to find some churches where there is more than just "drab church hymns." 20th and even 21st century voluntaries, anthems, and choral preludes are alive and well in certain segments of Christendom. See for instance the churches that Bálint Karosi plays in. I doubt you'd describe his music as "drab." My parish runs the gamut from Palestrina to something from the 20th century at least every Sunday. Just my 2 cents.

Re:Tail Call Optimization: The Musical on Sunday January 08, 2023 @12:08PM (#34300845)
I appreciate your nit, but I have one myself: Can you curse the throne itself? Afaik you can only curse items, not dungeon features, and the NethackWiki doesn't list anything about a throne having B/U/C status. I don't see any way to capture it as an item. So I don't think recursing can happen to a throne in nethack.
I have two kids, am self-employed (tutoring) in my community, and have many friends and acquaintances are over 40 (from church, for instance). Sending unknown numbers to voicemail has been completely fine in every case. I've never missed an urgent call that I couldn't call right back after I read the voicemail transcription.

Older »