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 Moving from programmer to entrepreneur
I get 500 Internal server error with some command-line HTTP fetchers, not wget(1). And http://www.rssboard.org/rss-validator/check.cgi?url=http%3A%... is unhappy.
ralph··on The Art of Computer Typography
If anyone's not sure of the advantages of a text processor, like TeX or troff, over a WYSIWYG (or WYSI-all-YG, as Kernighan said) application, then http://www.schaffter.ca/mom/mom-02.html may help.
ralph··on Cronic - A cure for Cron's chronic email problem
That always sends an email, even if the body is empty.
ralph··on Cronic - A cure for Cron's chronic email problem
Three columns here.
ralph··on Pipe Viewer
Note, a plain dd will report progress on stderr if sent a SIGUSR1. That can sometimes be enough to avoid the overhead of pv(1) and sending huge amounts of data through another pipe.
ralph··on Functional programming in sh
The shell gives this kind of behaviour already through pipes and commands like awk, sed, and dc. More natural translations of the calculations given might be

    $ seq 100 | awk '{s += $0} END {print s}'
    5050
    $ seq 20 | awk -v s=1 '{s *= $0} END {print s}'
    2432902008176640000
    $ seq 5 | awk -v s=1 '{s *= $0} END {print s}'
    120
    $ seq 3 |
    > awk -v s=1 '{s *= $0} END {print s}' |
    > xargs seq |
    > awk '{s += $0} END {print s}' |
    > md5sum
    fe9d26c3e620eeb69bd166c8be89fb8f  -
    $ seq 400 500 | awk '{s += $0} END {print s}'
    45450
    $
ralph··on State Machines
What do you prefer about TBB over CSP-style channels, as in #golang?
ralph··on Reducing bad signup emails with mailcheck.js
I'd be surprised if many users type it twice. I always copy from the first to the second and wonder why the form designer has bothered.
ralph··on Why Use Postgres - Part 2
I agree. Given count(star) is a common need you'd think there would be multiple count(star) results in the metadata for the table, each with a generation associated with it.
ralph··on Ask HN: Where do you get your news?
I visit HN once or twice a day to skim the top 30 headlines for anything that looks interesting; I may click on two or three.

More of the interesting content I read comes from RSS feeds of particular blogs built up over time and, these days, Google+. Now I've built up some circles that match my interests I get a stream that's not too noisy, mute those I never want to see again, and browse the rest. The quality of conversation seems generally high on the posts I like. (I only visit Twitter now to reply to a tweet picked up through RSS.)

My G+ profile is https://plus.google.com/115649437518703495227/about if anyone wants to see who's in my circles.

ralph··on Your Bash Prompt Needs This
I don't see it as a bug; the shell shouldn't get to see what was written to the terminal?

BTW, it's the readline library that handles the Ctrl-L key binding to clear the screen rather than bash per se.

    $ bind -p | grep '\\C-l'
    "\C-l": clear-screen
    $
ralph··on Your Bash Prompt Needs This
Sorry, I think it's a problem not worth solving; it's helpful to know this has occurred by the state the screen is in. If you want to solve it correctly then, since it's also common to have the cursor left bereft in the middle of a screen of text,

    PS1='\['"$(tput cr)$(tput ed)"'\]$ '
is better since it clears to the end of the screen, e.g. try

    seq 1000 | fmt; tput cup 10 20
with and without it.

But the thing is, with either that approach or the one in the article, you're wiping out what may be useful; that unfinished line causing PS1 to be pushed along may have vital data on it, data that's hard to re-create.

ralph··on Log Everything as JSON. Make Your Life Easier.
I don't like it, but you can do

    <foo grep bar | ...
if you really want L-to-R whilst avoiding the redundant cat and its overhead. That doesn't allow grep to do its speed-ups though, because it's still reading stdin, not a filename.
ralph··on 100x better approach to software?
I'd echo that view, also with twenty years of (Unix) programming behind me. The start of the slippery slope seemed to be object-orientation; yes, it can be ideal in some areas, helps re-use if done well, but since the majority of source is of average quality or worse it often seems to just add obfuscation, layers to wade through, contortions to fit the solution to the OO model the language provides, and poor names because so many need to be created that it becomes tedious. Contrast with Go's interfaces.

Design patterns have also had an overall negative effect IMHO. Useful as a lingua franca for theoretical discussion they've again been over-adopted and the vocabulary has become so large, and sometimes imprecise, lessening their usefulness, that it sometimes seems like a geek version of the management-speak for which we criticise the pointy-haired.

"Controlling complexity is the essence of computer programming" — Brian Kernighan. I often find the above add more complexity than they're worth.

ralph··on Lthread is a multicore/multithread coroutine library written in C
Out of interest, what implementation of libc was that?
ralph··on Show HN: Tasskr. Re-written for the 5th time.
A deletion done in error is normally realised pretty instantly; leave an `Undo delete' at a single specific location for them to get it back.

http://paulbuchheit.blogspot.co.uk/2007/06/quick-all-actions...

ralph··on Digital Design Principles from the UK Gov
Thanks, done.
ralph··on Concurrency is not Parallelism (it's better) - A talk by Rob Pike
No, he didn't. It's not a typo. :-)
ralph··on Concurrency is not Parallelism (it's better) - A talk by Rob Pike
The post you're replying to is wrong, it's not a typo; see my reply to it.

For a background in the CSP languages have a browse of Russ Cox's http://swtch.com/~rsc/thread/ The reference [4] to Squeak is broken, it's now at http://research.microsoft.com/pubs/67508/squeak.pdf and well worth a read.

For the general case, not Go specific, there's a scheduler that tracks what processes (in the CSP sense, e.g. goroutine) are waiting on what channels. Whenever a channel becomes ready, e.g. something is available to read from it, one of the processes waiting to read from it is non-deterministically (that's important) chosen and control (the CPU's program counter, still in user-space) jumps to where it returns from the `read'. It then has the CPU all to itself until it gives control back to the scheduler by needing another particular channel-state. I'm omitting sleeping, etc., for simplicity. The switching of control is all in user-space so quite lightweight.

ralph··on Concurrency is not Parallelism (it's better) - A talk by Rob Pike
No, that is not a typo. A goroutine that blocks by making the thread it's currently running in block in the kernel is blocking that thread too; it must since the kernel needs some context for the on-going operation. What he's saying is that the pool of other threads used by the scheduler can continue to run other goroutines, just not the one that's blocked. No typo.
ralph··on Experiment: Living Without A Home Internet Connection
Well put. IIRC pg has two computers, one on the Internet for surfing and stuff, and the other off the Internet and physically distant from the first that's used for work.
ralph··on Digital Design Principles from the UK Gov
I shouldn't have to re-size my window; I like my browser maximised.
ralph··on Digital Design Principles from the UK Gov
Thanks, I'm also F11 on Linux and wondered why no one else seemed to shudder at the huge text.
ralph··on Histogrem: The Histogram Font
Unicode does have one-eighth blocks, which can be handy when a special font isn't convenient. ▁▂▃▄▅▆▇█
ralph··on Python-based implementation of Notch's DCPU-16
Though looking at the code now it seems registers have been memory-mapped at 0x10000 and above?
ralph··on Speed Hashing
It's very common; the norm even. My point was that "A hash (function) is any function that maps a big variable-length data structure to a smaller (fixed-length) data structure." is incorrect; the source size isn't relevant.
ralph··on Speed Hashing
I have hash functions that work on less bytes than the length of the hash they produce.
ralph··on Python-based implementation of Notch's DCPU-16
I haven't read the spec. or followed the topic in general, but from a quick glance at it: the size of the registers isn't given, and the registers aren't memory-mapped.

Why not use an integer instead of Cell? 42 is memory address 42, -3 is register R, including for SP, PC, etc. Or addresses >= 0x10000 are registers, then you can just have

    def ife(self, a, b):
        m = self.mem
        self.skip = m[a] != m[b]
with Python's native indexing of the mem[] list, which could be an array().
ralph··on In praise of... text files and protocols
Text files are great, especially if one's the Unix shell skills to quickly manipulate and query them without having to write a program. But XML is often overkill compared to a simpler text format.
ralph··on Douglas Crockford on Fat Arrow Functions in JavaScript
The problem is we're mainly conditioned to expect the condition up front, notwithstanding Perl's initial slide down this slippery slope. Ugly syntax seems an argument for improving the syntax, not changing the grammar.

    if mum.birthday.isToday(): call(mum)
← PreviousPage 10 of 26Next →