HNHacker News
TopNewBestAskShowJobs

ralph

1,089 karma · joined March 1, 2007

Ralph Corderoy, https://plus.google.com/#115649437518703495227/about

C, Unix system and shell, Python, X Windows, ARM, ...

submissionscomments
ralph··on Unix Text Processing (1987)
Yes, sure I would. Doesn't sound like a glossy DTP kind of document. The document size wouldn't be a problem. Ask on the groff list with more of a description of the kind of content and what you might be worried about. Books like _The C Programming Language_, W. Richards Stevens' _Unix Network Programming_, and others are examples of what can be done. http://troff.org/pubs.html
ralph··on Unix Text Processing (1987)
Scanning his submissions, I think http://www.dreamincode.net/forums/blog/48/entry-4298-lessons... is relevant.
ralph··on Unix Text Processing (1987)
You'd do well to ask these on the https://lists.gnu.org/mailman/listinfo/groff list for a wider set of opinions. It depends on the style and complexity of the document. -ms is simple enough that people like W. Richard Stevens would tweak it for their books. I understand the relative newcomer, -mom, is comprehensive, modern, and well supported by its author on the above list. I don't recognise the Pascal, etc., analogies. :-)

I do write my own macros. They can be just short-hands for a combination of others in the same way my ~/bin/l is exec ls -l "$@", or sometimes for a simple document I start with just troff and have some macros on top of that. Yes, any distinction over semantics is purely convention.

You may wish to read Kernighan's _Nroff/Troff User's Manual_, http://troff.org/54.pdf, otherwise known as CSTR #54. It's original troff, not groff, but as a succinct reference with elegant prose we often refer back to it. At the end is a tutorial introducing simple macros.

Integrating troff and friends in pipelines and scripts is easy. They take line-based text as input and produce it as output, only switching to binary for some output formats at the last hop. You can also run system(3) from within troff documents, e.g. to include the output of a command, but often that's not the easiest fit.

I recommend again the groff@gnu.org list; they're friendly, patient with newcomers, and interested in showing how they tackle the task at hand.

ralph··on Unix Text Processing (1987)
I've read _The TexBook_ and other material but just find the TeX mark-up so noisy to parse compared with the troff style of `.cmd' at the start of the line, cmd is often short, with the odd bit of \s+2 embedded within the line, depending on personal preference.

troff and friends were developed on Unix in its early days by the originators of Unix and it shows in what a good fit they are to the environment and in their elegance; they are Unix programs. TeX was born outside of Unix; it runs on Unix.

ralph··on Unix Text Processing (1987)
I think TrueType fonts with groff is fairly painless; the topic comes up on the groff@gnu.org list now and again but I don't pay much attention. The list is low volume and very friendly, with some real old Unix hands on there; feel free to ask, say I sent you if you like. https://lists.gnu.org/mailman/listinfo/groff

Gunnar's Heirloom troff has TrueType support. "troff can access PostScript Type 1, OpenType, and TrueType fonts directly, that is, it can read font metrics from AFM, OpenType, or TrueType files, and can instruct its dpost post-processor to include glyph data from PFB, PFA, OpenType, and TrueType files into the output it generates". http://heirloom.sourceforge.net/doctools.html

ralph··on Unix Text Processing (1987)
That's a good point. Back when it was created, doing that with the toolchain wasn't so straightforward as I understand it is now; I'll raise it on the groff@gnu.org list.
ralph··on Unix Text Processing (1987)
The sed and dc combo are perhaps not as readable, but there was a time before the dawn of the One True Awk. :-)

    sed '1s/.*/0/; s/;[^;]*$//; s///; s/.*;//
        s/00$//; s/:..$/+1++/; s/:$/++/; s/:/ 60*/; $s/$/p/' |
    dc
ralph··on Unix Text Processing (1987)
It's awkward to embed Python in a pipeline and the awk can be quicker to write if the problem suits its domain. Execution speed may be slower than Python, depends on the work needed and the awk used; gawk, mawk, Kernighan's One True awk, ...

    awk 'NR > 3 && !/foo/ {s += $(NF - 2)} END {print NR, s + 0}'
ralph··on Unix Text Processing (1987)
Another way would be all awk.

    awk -F\; '
        $7 != "Duration" {
            split($7, t, ":")
            s += t[1] * 60 + t[2] + (t[3] != 0)
        }
        END {print s + 0}
    '
Note the handling of s == "" in END.
ralph··on Unix Text Processing (1987)
I still regularly use groff; letters, invoices, ad hoc formatting of one-off tasks. tbl(1) is nice and the overall speed makes it handy for producing PDF in the back-end.
ralph··on Unix Text Processing (1987)
groff does it with the help of its preconv(1), also invoked with groff's -k option.

    $ printf 'Hello ①②③\n' | preconv
    .lf 1 -
    Hello \[u2460]\[u2461]\[u2462]
    $ printf 'Hello ①②③\n' | groff -k -Tutf8 | grep .
    Hello ①②③
    $
ralph··on Unix Text Processing (1987)
The book has been re-typed, as troff, just like the original. See my comment elsewhere on this post.
ralph··on Unix Text Processing (1987)
I sought permission from Tim O'Reilly, he co-wrote this back when he was an author, to re-enter the text of the book as troff source, the original being lost. He kindly gave it and volunteers from the groff@gnu.org mailing list split the chapters amongst themselves; it was quite fun. http://home.windstream.net/kollar/utp/ is the result.
ralph··on Dropbox Hires Guido Van Rossum
"couldn't let" is odd. Do you mean "get", IOW persuade Google to add Python.
ralph··on Ask HN: Please stop using TL;DR
How does one flag the comment as spam or the user as a spammer?
ralph··on Explorations in Unix
I'm complaining his example doesn't work in the more general case and that he should warn of this or give a better more general solution. I'm aware of why it doesn't work.
ralph··on Explorations in Unix
He writes

    (head -5; tail -5) <data
but that's a bit misleading. These don't work.

    seq 20 | (head -5; tail -5)
    (head -5; tail -5) < <(seq 20)
Both giving just the first five lines.
ralph··on The greatest Google Mail feature you may not be using
I'd like Gmail to do better as an email client confirming to standards. If someone sends me an email with the Resent-{From,To,...} headers then I want them shown to me. How can I forward an email as a message/rfc822 MIME content-type rather than a poor rough text approximation in the main body?
ralph··on Elite: Dangerous
Your memory's going, I'm afraid. The original version, the BBC Model B one, used a novel split-screen technique. The upper larger portion showing space was Mode 4, 1bpp at 320 × 256 if it was the whole screen, the bottom flight-deck portion was Mode 5, 2bpp at 160 × 256. Here's a screenshot, http://upload.wikimedia.org/wikipedia/en/c/c4/BBC_Micro_Elit...
ralph··on RISC OS for the Raspberry Pi released
If you used the OS-provided SWIs to get the base address of the screen memory, OS_ReadVduVariables for 148 IIRC, and similarly use SWIs to wait for the VSync and switch buffers then I'd have thought it works just fine.

The Archimedes had ARM 2 BTW, ARM 1 was just in the Tube co-processor for the BBC B. Some instructions are different with the RasPi, mainly to do with the PC register no longer having bits spare for Negative, Carry, etc. http://www.heyrick.co.uk/assembler/32bit.html has more details. There are external programs that detect and trap old 26-bit instructions when on 32-bit RO and allow old games to run but I know little about them; my last Acorn ARM machine was their R140 running RISC iX (a BSD port).

ralph··on RISC OS for the Raspberry Pi released
I didn't read the grandparent as meaning "the past ten years" but "ten years at some point in the past".
ralph··on Rob Pike: Go at Google
Oh, we do, e.g. Plan 9, but that doesn't mean the better ways can overcome the popularity of the incumbent that's "good enough".
ralph··on UsesThis: Rob Pike
Plan 9 did leave Bell Labs, http://www.york.ac.uk/ used it for one, and it was released under a more free licence in time.
ralph··on Race-condition-free deployment with the "symlink replacement" trick
Telling the server of the new root instead, which needs the relevant permissions as the author points out, would remove the symlink traversal on every access?
ralph··on Dart is ready for the real world
#golang had Limbo in its ancestry, another CSP language, this time for the Inferno register-based VM from Bell Labs. Target Go at a browser VM?
ralph··on Sticky Headers with Pure JavaScript and CSS
And with my browser, Firefox, they break Page Up/Down, and therefore Space (also pages down). Instead of the slight overlap for context that Firefox normally gives, there's now a gap so it's Space, cursor-up a bit to continue reading, Space, ... http://catb.org/jargon/html/B/brain-damaged.html
ralph··on In Europe, Speed Cameras Meet Their Technological Match
I've lived somewhere like that. It works well but then the streets were designed with that in mind; often narrow with lots of bends and poor visibility far ahead, a car driver has no choice but to go relatively slowly.
ralph··on ShowHN: GetURL - A CLI tool to get a public link for any file
You can ignore the bit about Emacs if you wish. http://www.jwz.org/doc/x-cut-and-paste.html
ralph··on Python 3.3.0 released
Gamers? Why are they heavy users of the decimal module?
ralph··on $99 Raspberry Pi-sized “supercomputer” touted in Kickstarter project
See also http://news.ycombinator.com/item?id=4583263 for comments though it links straight to Kickstarter, and not Ars Technica.
← PreviousPage 4 of 26Next →