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 Glances - an easy CLI overview of your system (CPU, mem, I/O)
dstat(1) is another of this ilk, also Python. I prefer it because new results are printed under old, giving history in scrollback. If on a machine where these aren't available, `vmstat 1' is the standard historical fallback.
ralph··on My intro to LESS - If you're not using it, you should be.
That's missing some quotes; it's trying to set an environment variable called -g, which is an invalid identifier. Mine is

    export PAGER=less LESS='-wiXz-2$j15' LESSBINFMT=.
ralph··on Kindle edition of Effective Programming by Jeff Atwood (Coding Horror) for $0.00
I too would favour Steve McConnell's _Code Complete_ over Jeff's blog-post collection but having read the book when it came out, i.e. not recently, I wasn't too keen overall, perhaps it was McConnell's Microsoft background.

My preference is Kernighan and Pike's _The Practice of Programming_, TPoP, that's Kernighan as in the `k' in awk and K&R, and Pike as in Blit, sam, and now #golang. The book's home page has a sample chapter and a war story that didn't make it into the book. http://amazon.com/exec/obidos/ASIN/020161586X/mqq-20 http://cm.bell-labs.com/cm/cs/tpop/

ralph··on Why Did I Choose Perl When Building Crowdtilt?
Not sure why it got all the down votes. Since Visual BASIC faded away there's been two mainstream languages that have come in for much complaint; C++ and PHP. All languages suffer some valid criticism as none are perfect but the weight of criticism for these two suggest much is deserved, it is in my opinion. Consequently, that the author/facilitator of C++ has a fun quote to dismiss the large-scale criticism is fun but "counts for little" as he's biased.
ralph··on Why Did I Choose Perl When Building Crowdtilt?
He was very biased; it counts for little.
ralph··on Why Did I Choose Perl When Building Crowdtilt?
Regardless of the structure of modern usage its syntax is still very noisy for the reader. It seems the majority prefer the cleaner syntax that doesn't use punctuation to define the type of access a la BASIC.
ralph··on Linux Commands for Developers
They could drift. Better to do a one-ping ping and run iwconfig once in a loop.
ralph··on Linux Commands for Developers
I can understand liking the regularity but in production code or web examples it shouldn't be done because of the overhead. However, your example doesn't make sense.

If sort, tai64nlocal, and ffmpeg are all happy to read stdin so you can do

    cat foo | sort ...
    cat foo | tai64nlocal ...
    cat foo | ffmpeg ...
then they can all have their stdin redirected instead by the shell:

    <foo sort ...
Similarly with stdout:

    ... | sort | cat >foo
becomes

    ... | sort >foo
In both cases regularity of having the filename at the start and end is preserved.
ralph··on Linux Commands for Developers
Who said the GiBs need to be fetched from disk; they could already be in RAM. Even if not, it's still adding many system calls and context switches when the CPU could be doing other things; the machine isn't running just this one thing.
ralph··on Linux Commands for Developers
If you really prefer to see things in order then

    <foo sort | ...
is an alternative to

    cat foo | sort | ...
though I wouldn't particularly recommend it. Instead the overhead of cat(1) should be omitted and it written in the normally accepted form of

    sort foo | ...
Providing a filename rather than re-directing stdin allows the program more choice over its method of access.
ralph··on Linux Commands for Developers
Perhaps because sending GiBs through read(2) and write(2) unnecessarily isn't a NOP?
ralph··on Damn Cool Algorithms: Homomorphic Hashing
I'm also self-taught but find not all comp. sci. books are dry, particularly those with a Bell Labs background. Something about their writing style perhaps.

You may want to peruse Aho and Ullman's excellent C edition of Foundations of Computer Science. (That's Aho as in awk.) What you need for a good grounding all in one place. You can still pick up a paper edition if you want but they've also made it available as PDFs.

http://amazon.com/exec/obidos/ASIN/0716782847/mqq-20 http://i.stanford.edu/~ullman/focs.html

ralph··on Go's unique approach to OO
This post by rsc should answer your questions and more. http://research.swtch.com/interfaces
ralph··on [dead]
Dupe of http://news.ycombinator.com/item?id=4431154
ralph··on How statically linked programs run on Linux
I'd recommend it too. I used to hang out on comp.compilers back when John was drafting it so, thanks to vetting the AIX bits, I got my name in the final book's acknowledgements (alongside dozens of others). Small thing, I know, but still pleases me when I think of it. :-)
ralph··on Bash Initialisation Files
Also sudo.

    $ sudo -i
    # tr \\0 \\n </proc/$$/cmdline
    -bash
    #
ralph··on Source Code Makeover: Square Shooter, Part 1

    def wrap_around(self):
        """Change the position of the bubble to toroidally
            "wrap around" if it goes off one edge of the
            map."""
        if self.pos.x < 0: self.pos.x += 1
        if self.pos.y < 0: self.pos.y += 1
        if self.pos.x > 1: self.pos.x -= 1
        if self.pos.y > 1: self.pos.y -= 1
Why isn't else used? In addition to efficiency it tells the reader that the author expects at most one of x++ or x-- to happen.
ralph··on The Launch Pad: Inside Y Combinator
No, Amazon dishes out -20 to all amazon.com IDs. Other countries have other numbers, e.g. -21 is amazon.co.uk.
ralph··on The Launch Pad: Inside Y Combinator
Given the http://www.amazon.com/gp/product/1591845297/?tag=referly-20 URL how does referly know which of its users to pass Amazon's commission onto? Several could turn up to refer on the same product.
ralph··on The Beauty of Bresenham's Algorithm
If y and slope are floating point in the first block then might not y end at other than the desired endpoint because of accumulative error?
ralph··on Please turn on two-factor authentication
Did you know it can provide a one-time pad of ten verification codes to print out and store and it will provide another batch on request?
ralph··on Managing Work-In-Progress Folders with “ls -ltr”
find(1) has an -ls built-in, thought the format is slightly different. You can also use -printf to suit. Also, later GNU finds make some uses of xargs unnecessary.

    find -type f -exec ls -ltr {} +
ralph··on Sorting improvements in PostgreSQL 9.2: the case for micro-optimisation
Dupe of http://news.ycombinator.com/item?id=4327654 (thanks to non-canonical URL).
ralph··on Ask PG: What caused the downtime?
What were the most common activities done by the IPs that were "new" in the last twelve hours? New compared to the history of IPs available. Just wondering if it was orchestrated or whether it would give a clue as to the resource that was consumed.
ralph··on Raspberry Pi Myths and Truths
I looked through the BASIC manual of the ZX81; it had no thick section of memory addresses?
ralph··on Raspberry Pi Myths and Truths
The Foundation have recently released a new distro, based on Raspbian, that gives better performance and is now their recommendation. Hardware floating point and better use of the ARM's instructions. X11 graphics performance still to be improved. http://www.raspberrypi.org/archives/1605
ralph··on Seven Days With a Nexus 7
Do people find it's happy with an ad hoc wifi hotspot, e.g. as set up in Ubuntu 12.04. http://www.howtogeek.com/116409/how-to-turn-your-ubuntu-lapt...

It doesn't work for me, the hotspot isn't listed on the Nexus among the many local networks, and without other wifi equipment I'm unsure where the fault may lie; so many possibilities.

ralph··on Command line tools for the novice
My normal way of running grep is ~/bin/g.

    #! /bin/sh

    exec egrep --color "$@"
(Not a bash, my shell, alias because they're unavailable in many contexts.)

egrep is AKA grep -e. I don't use GREP_OPTIONS because it pollutes those that don't expect it, as you pointed out.

At the top of a particular source tree I may have a ./g that knows more about what's interesting.

    #! /bin/bash

    find \( -name .svn -o -name tags \) -prune -o -type f -exec egrep "$@" {} +
It checks -name before -type because the latter needs a stat(2).

For other things I do ad hoc queries using grep, find, xargs, etc.

ralph··on Command line tools for the novice
You might want to consider using single quotes to protect your globs and regexps more rather than backslashes. \✳.[ch] will match the ./✳.c that may have been accidentally created by an earlier error, then find will only look for a file called precisely ✳.c and nothing else. '✳.[ch]' or \✳.\[ch] is what's meant.

(Edited to use ✳ to workaround unescapable mark-up.)

ralph··on The Word Count Problem
Your bug fix is broken; it makes no sense to place it there. I suggest increasing the number of test inputs to first show the problem.
← PreviousPage 6 of 26Next →