HNHacker News
TopNewBestAskShowJobs

Pete_D

1,119 karma · joined November 22, 2013

submissionscomments
Pete_D··on How I Recovered Millions of Transactions Using Tcl (2016)
With select/poll, you have to write your own dispatcher, which means you have to care about details like whether you need round-robin to prevent early things in your fdset stopping later things being processed, etc. Also, many of the things you'd like to wait on aren't file descriptors, so you have to do extra work to make them fit. My bugbear for this is pthread condition variables, but it's also true of most GUI toolkits, which expect you to use some variation of while(Toolkit_GetEvent(&event)). You can work around these, of course, it's just mildly annoying extra work.
Pete_D··on Seaweed could be scrubbing more carbon from the atmosphere than expected (2017)
Even then, it's worse by weight over most timescales.

https://en.wikipedia.org/wiki/Global_warming_potential: "In the Fifth Assessment Report of the Intergovernmental Panel on Climate Change, methane has a lifetime of 12.4 years and with climate-carbon feedbacks a global warming potential of 86 over 20 years and 34 over 100 years in response to emissions."

(CO2, being the baseline, has a GWP of 1.)

Pete_D··on Where Vim Came From
I like mapping jk to ESC for vim/evil-mode, then swapping caps lock and CTRL for the comfy tmux and readline ergonomics. (I've tried readline's vi mode, but I didn't like it.)
Pete_D··on How to explain infinity to kids
Another approach is taken in the comic "Life on the Infinite Farm" (pdf: https://www.math.brown.edu/~res/farm.pdf). I'm not sure it's entirely appropriate for children though.
Pete_D··on Fastcat – A Faster `cat` Implementation Using Splice
You don't have to put the redirection at the end, you can write

    < input.txt filter1 args # ... rest of pipeline
(But I agree that the cat version is more readable.)
Pete_D··on The Bullshit Web
Sounds a bit like tedunangst's miniwebproxy[0]. I've been wondering about writing either something like it or a youtube-dl-like "article-dl" for my own use, but haven't quite been annoyed enough into doing it yet.

[0] https://www.tedunangst.com/flak/post/miniwebproxy (self-signed cert)

Pete_D··on The Bullshit Web
Maybe you'd prefer comparing the code of a website to the amount of useful content on the website, which OP also did. Taking "I'm downloading 100mb worth of stuff (83 Moby-Dicks) to read 72kb worth of plaintext" at face value, we could also say that 0.072% of the data transferred is useful, or, equivalently, that 99.928% of it is crap.
Pete_D··on Refresh: concept for a new kind of web browser
What's an SBU? (I tried to search but only found results for Stony Brook University)
Pete_D··on What Makes a McMansion Bad Architecture? (2016)
This feels like the architectural equivalent of linguistic prescriptivism. If "basic architectural concepts" declare buildings to be "especially hideous", but people are seemingly happy to buy and live in them, what grounds do we have to decide that the people are wrong and not the concepts?
Pete_D··on In Unix Everything Is a File
Consider trying rsync instead of scp - I've found it to be faster for multiple small files.
Pete_D··on In Unix Everything Is a File
"Everything is a file" is a nice idea not taken far enough. The execution is full of frustrating omissions and holes at the edges, e.g.:

- unless you are using Plan 9 or gpm, reading mouse events is almost certainly going to be a lot more involved than opening /dev/mouse

- you can't portably use select() to wait on pthread conditions

- lots of useful things (like POSIX shared memory objects) are file descriptors, but aren't filesystem namespaced

Sometimes I wonder what the world would look like if Plan 9 had won.

Pete_D··on In Unix Everything Is a File
I certainly remember being surprised when I accidentally cat'd a directory on AIX and it worked. I can't remember exactly what you get back; I think it's a NUL-separated list of the files in it.
Pete_D··on Timeline of the far future
John Michael Greer - The Next Ten Billion Years

https://www.resilience.org/stories/2013-09-05/the-next-ten-b...

Pete_D··on Why Gov.uk content should be published in HTML and not PDF
> I'd love to have a format that is just HTML + whatever zipped up that browsers and operating systems happily just open in a browser.

Does HTML with data URIs meet these criteria?

Pete_D··on 'Free but Not Free': Zimbabwe's Amateur Filmmakers Turn a Lens on Their Country
This is why anonymous speech, and institutions and social norms that support it, are an indispensable part of free speech.
Pete_D··on A Look Back at Why Blockbuster Really Failed and Why It Didn't Have To (2014)
Reminds me of a promotion I saw a few years ago where some pizza chain had paired up with a video rental place. You ordered a DVD with your pizza and they were delivered together.
Pete_D··on Version Control Before Git with CVS
> When people talk about Git being a “distributed” system, this is primarily the difference they mean. In CVS, you can’t make commits locally. A commit is a submission of code to the central repository, so it’s not something you can do without a connection.

Not just commits - log, diff, status, almost everything I can remember needed to go off to the remote repository for information. Not only was this annoying when you didn't have connectivity, it was slow when you did.

I do occasionally miss the ability to version files individually though.

Pete_D··on The Surprising Power of Virtue Labeling
Nit: I would be astonished to hear that any recent clinical trial involving placebos had taken place without all participants knowing that they might be given one. FDA guidelines on informed consent[0]: "Procedures related solely to research (for example, protocol-driven versus individualized dosing, randomized assignment to treatment, blinding of subject and investigator, and receipt of placebo if the study is placebo-controlled) must be explained. ... The description should also provide relevant information about any control used in the study. For example, whether the control is a medically recognized standard of care or is a placebo (including an explanation of what a placebo is)." Searching the web for "placebo IRB" turns up more detailed institutional guidelines; UCI's is one of the most in-depth[1].

I believe this is relevant because the author's comparison of placebos and virtue labelling hinges on whether or not the practices are deceptive. But the norms around informed consent mean that using placebos in clinical trials does not, IMO, involve deception. I'm not sure if there's a comparable mitigation to make virtue labelling not deceptive (can you imagine handing someone a consent form saying "I will sometimes lie to you about whether or not I think you are a good person, for your own good"?)

[0] https://www.fda.gov/RegulatoryInformation/Guidances/ucm40497...

[1] https://www.research.uci.edu/compliance/human-research-prote...

Pete_D··on Rules of optimization
I always remember this write-up from the original author of GNU grep: https://lists.freebsd.org/pipermail/freebsd-current/2010-Aug.... "The key to making programs fast is to make them do practically nothing. ;-)"
Pete_D··on Why We Should Say Yes to Drugs
Workaround: https://archive.is/xVmHC
Pete_D··on Ask HN: What is one Vim trick most people don't know?

    :nnoremap <C-z> :term<Return>
works for me (tmux in urxvt).

Ctrl-Z only gets converted to SIGTSTP if the terminal has ISIG set. For example, try `stty -isig; sleep 5` and try to suspend or interrupt the sleep command.

Pete_D··on Ask HN: What is one Vim trick most people don't know?
Also fun: macros can call themselves. So if you want to repeat something across a whole file, it's sometimes easiest to write an infinitely recursive macro and let it error when it bumps up against the bottom of the file.
Pete_D··on Ask HN: What is one Vim trick most people don't know?
If you like these, it's worth skimming `:help index` and `:help option-summary` occasionally. You're likely to find at least one interesting new keybinding or setting.
Pete_D··on Around the World, People Have Surprisingly Modest Notions of the ‘Ideal’ Life
On the IQ question, from the paper (http://journals.sagepub.com/doi/full/10.1177/095679761876805...):

> Intelligence was assessed by asking, “If you could choose your level of intelligence, what level would you choose?” and referring participants to an IQ diagram, with labels for “moderate disability” (40), “below average intelligence” (70), “average intelligence” (100), “above average intelligence” (130), and “exceptionally gifted” (160). Participants were told, “We would like you to indicate your desired intelligence level using an IQ score. NOTE: although IQ has no ‘maximum’ score, a score of 100 indicates an average level of intelligence.” Participants were then asked to write their preferred IQ level in an open-ended box.

Later, from the results section:

> In terms of intelligence, the mean ideal IQ score was distorted by the fact that a small group of participants recorded very high ideal IQ scores (> 1,000), creating positive skew. To adjust for this, we placed an artificial ceiling on scores that corresponded to the highest IQ score ever recorded: 228. After winsorizing the 0.3% of participant responses greater than 228, the mean IQ score was 122.52 (SD = 25.23).

Pete_D··on Unix Wildcards Gone Wild (2014)
I didn't see this mentioned in the article, but you can protect against this in your own scripts by including a -- before user-supplied parameters, which prevents them from being treated as flags.

    $ rm -- -rf
    rm: cannot remove '-rf': No such file or directory
(see Guideline 10, http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_...)
Pete_D··on IRC.com Bought by London Trust Media, Pledges an IRC Revival
Times have certainly changed drastically. I remember when Google Talk was announced and the tech crowd of the day embraced it precisely because it didn't have emoticons (or custom fonts and colors, or games, or a host of other features MSN/AIM/etc. had and were beginning to be considered tacky). Maybe it's cyclical, and in a few years we'll be back to minimalism.
Pete_D··on Canada legalises recreational cannabis use
Ontario, Canada is similar: state-run shops have a monopoly on the sale of alcohol (https://en.wikipedia.org/wiki/Liquor_Control_Board_of_Ontari...). They're about to do the same with weed ("in September 2017 the Government of Ontario announced that the LCBO would be the sole vendor of recreational marijuana to the public in that province").
Pete_D··on The Diabetes Cure That Most Insurance Companies Won't Pay For
There could be more to it. There's a hypothesis that microbiome changes could be a contributing factor[0].

Restricting food intake is similar in that it reduces stomach capacity[1], though almost certainly not as drastically as surgery. Lots of people have already mentioned fasting in this thread; I'll add an anecdote that for a few days after a fast, I get full much more quickly.

[0] https://biodesign.asu.edu/news/dramatic-shift-gut-microbes-a...

[1] https://www.ncbi.nlm.nih.gov/pubmed/8561056?itool=EntrezSyst...

Pete_D··on California moves to declare coffee safe from cancer risk
I believe the concern here is most likely goitrogens rather than phytoestrogens. https://en.wikipedia.org/wiki/Goitrogen
Pete_D··on Ask HN: Your favorite syntactic sugar from any language?
I love Python comprehensions. I want to dislike Python - significant whitespace, weak lambdas, other trivial complaints - but the comprehensions are so nice, especially combined with yield and the iteration protocol, that it's usually the first language I turn to. There's syntax for sets, dicts, and generators too:

    >>> { char.upper() for char in "hello" }
    set(['H', 'E', 'L', 'O'])
    >>> { char: ord(char) for char in "world" }
    {'d': 100, 'r': 114, 'o': 111, 'w': 119, 'l': 108}
    >>> (char for char in "foobar").next()
    'f'
← PreviousPage 5 of 8Next →