Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A useful program, 0 bytes long (peetm.com)
389 points by lelf on June 21, 2013 | hide | past | favorite | 75 comments


Interestingly, this is the second useful empty program I have seen. The other is /bin/true, as discussed at http://trillian.mit.edu/~jc/humor/ATT_Copyright_true.html . That file is not quite empty, due to trying to comment and copyright an empty file!


I love how Sun bumped the version number up to 1.6 in 1989 from the original AT&T code.


I remember that two bugs were filed in Debian for this implementation of /bin/true (one for the slow execution and one for the memory use IIRC) but I cannot find them.

Two bugs for 0 lines of code...


That would be GNU coreutils true, which is a little more complex.

Some discussion of that over here : http://forums.thedailywtf.com/forums/t/3779.aspx


A great example of how important it is for us as developers to recognize the value we provide to businesses/users instead of measuring it all solely in terms of algorithmic complexity and LOC.

Side note: Tatung makes some pretty amazing rice cookers. My family has used the same one for over 40 years now, and it still cooks as well as ever.


It looks like they've switched to some less reliable technology based on Amazon reviews:

http://www.amazon.com/Tatung-Tac-11kn-Stainless-Steel-Cooker...

I grew up with Tatung rice cookers. They used to last forever - only get replaced when owners get tired of looking at them or they become too dirty. I replaced mine with this stainless steel rice cooker about 1.5 years ago thinking it will really last forever since it's stainless steel (the old ones were made out of aluminum). Unfortunately, it stopped working a few days ago.

I just couldn't believe it, I opened it up (I am a hand-on electrical engineer) and found the heating element to be the culprit. Tatung no longer uses solid metal heating element, instead, Tatung uses a much inferior heating element made out of a sandwich of 3 to 4 layers of thin circular heat-resistant cardboard. With metal wires (the heating element) looped around these circular cardboard. After probing a bit, I found where the metal wire broke.

Called Tatung customer support and was told that they can't sell heating element because of liability issue. It'll cost $40 for them the repair it but I will need to ship it to them.

Side note: curse Wade and Giles for making everyone mispronounce this company's name.


Pinyin: "Datong".


Further derail: for those who aren't familiar, datong (大同, "great harmony"), is a idealized state of society in traditional Chinese philosophy that been re-appropriated by just every school of thought or "-ism" from before Confucious to Mao and beyond.

http://en.wikipedia.org/wiki/Great_unity

There's some lengthy (English) discussion on the term in this book:

http://www.amazon.com/The-Chinese-Revolution-Historical-Pers...


We bought one of their electric pressure cookers, an "instant pot", and love the crap out of it. It's especially nice for cooking on hot days since it doesn't heat up the kitchen much at all.


This is a perfect example of selling something for what it's worth, rather than for what it costs to build.


Except not ... the cost to build was substantial. He had to educate himself how the machine and the OS work in detail. That is time and opportunity cost.


I found it amusing that customers were annoyed with the author for charging for "nothing". If the author didn't solve your problem, or if you could have done it yourself with no help, why did you buy it?


I think an interesting implication of this is that people may feel satisfied having purchased something useless that seems to have enough "stuff" in it.


Also the same old argument used to justify piracy, that it costs next to nothing to copy bytes. And that the product is so not worth the price that those who pirates "wouldn't have bought it anyway", yet there they are using the pirated product, movie and music.


It's because people mainly perceive marginal costs in the goods they buy, and they don't consider fixed costs. In extreme cases like software, news, etc, they think "this extra copy didn't cost anything to produce, therefore it should be free", even though the initial fixed cost was substantial.

This leads to some things like perceiving less competent workers' time to be worth more than more competent ones' (because they take longer to do a task, therefore they should be paid more), etc.


I don't agree this was the case here. They were perfectly happy to pay for a copy of the software, even though making another copy - as you rightly point out - costs nothing.

They were annoyed because nothing had actually been copied. It's like paying for a product and getting an empty shipping box in the mail.


Sure, if the product you're paying for is an empty box.


But they didn't know it was, which is why they felt cheated. It's not because of the marginal costs.


Well, an inode was "copied".


This reminded me of the old story about the engineer who fixed a complicated machine:

http://www.deoluakinyemi.com/knowing-where-to-tap


"(a TSR; if the reader knows what such a thing is!)"

Oh dear, I can't imagine not knowing what a TSR is. Feel old.

The wikipedia page is pretty good http://en.wikipedia.org/wiki/Terminate_and_Stay_Resident


I've mentioned before something like "Yeah, I feel old, cause I know what a TSR is (was?)" and some younger kid in the room said "oh, my uncle used to have a TRS80, yeah, those were crap.".

The LOL was strong with that one, but not for the reasons he thought.


One of my favorite TSR programs was Qedit, by SemWare. I have yet to find another editor that I like better, and wish that I could find something similar which runs on unix-like operating systems. Qedit had the ability to drop to a command prompt to execute external commands and then return to the editor just as "GO.COM" does and I wonder if any of the author's code found its way into the SemWare editor.

I also got a kick out of the .com filename extension reference and wondered how many HN readers remember that .com used to stand for "COMMAND" instead of today's "Commercial." Judging by the amount of comments here the number is fairly small.

Thanks for the trip down memory lane!


Could you get what you want with Unix job control? From inside e.g. emacs, hit control-z, and it should suspend the emacs process and you'll be back at the shell you started emacs from. When youre ready for more emacs (woo!), tell bash to "fg" and you'll be back in emacs.


Unix? Job control? Emacs? Suspend? Shell? fg? What version of DOS are you using?


The features of Qedit that I liked had more to do with editing functions and keybindings than suspending any processes, and running concurrent applications is sort of a non issue in BSD/Linux.

The default Qedit settings made columnar editing as easy as linear editing... You could copy/paste in a vertical manner, as well as the more normally seen horizontal method. This facilitates ease of copying/pasting/deleting blocks of code without picking up, or affecting, other portions of code, whereas horizontal oriented block editing does not allow multi-line editing within set columns. You get every column within a set of copied lines even though you only want a smaller block of text.

Perhaps emacs can do column based edits, or some other editor?


Both Emacs and Vim can do column and arbitrary rectangular area manipulations. Another old and popular editor in the DOS days was Brief, which could also do them.


Alt+Shift select in Sublime Text (and Esc to cancel).


Suspend, leave emacs!?! Blasphemy and apostasy!


I picked emacs because I couldn't remember offhand if vim traps ^Z

My .emacs has

    (global-unset-key "\C-z")
because I haven't figured out how to make xmonad handle iconified windows nicely / I prefer M-x ansi-term over suspending my precious, and

    (global-unset-key "\C-x\C-c")
because I boot my emacs ~exactly as often as I boot my workstation (and I got angry at accidentally mashing a C-c after hitting C-x) :)


^Z sends a SIGSTOP no? I believe it can't be trapped (like SIGKILL). Actually i think the result of trying to trap it, is undefined (by posix)


Vim puts the terminal in raw mode, so ^Z sends ^Z instead of SIGSTOP. When Vim receives a ^Z, it shuts down ncurses, returns the terminal to a sensible state, and sends itself SIGSTOP. When it gets SIGCONT, it sets up ncurses and reconfigures the terminal the way it wants again.


I believe ^Z sends SIGTSTP, which can be trapped.


.exe was 'executable', but somehow a .com(mand) wasn't... executable? :)


".exe" and ".com" files are basically two different file formats for executable code. Note that DOS selects the file format not based on file name extension but rather by looking at the first 2 bytes in the file. If the first two bytes are "MZ" it will select "EXE mode" otherwise "COM mode".

COM files contain a single segment of code+data. The DOS authors directly reused the format from CP/M. The loader allocates a single segment of memory, then loads the com file at address 0x100, and transfers control there. So the first byte of the file contains the first instruction.

EXE files in contrast have a header that define multiple segments worth of code + data, and some environment variables. DOS allocates memory for each segment, possibly in a different order and positions on every system, loads the segment's contents from the EXE file, and then modifies each code segment to adapt to the actual locations of the other segments (that process is called relocation).


thanks! i knew there was a diff, and possibly even knew about 20% of what you just wrote back 20 years ago. :)


Drop to a command prompt? Vim does that, just try this.

:!echo hi

But while we're at it, my favourite way to log out of a shell in a silly way is this:

exec echo Hasta la vista!


:!program executes an external program, but you can also open a shell with :sh


I've been using Vim for years and this was the useful TIL of the day, thank you.


"Feel old." Me too.

And the Kermit protocol...


Tangent: just to give an idea how popular WordStar was, my Apple ][ had a CP/M coprocessor card [1] just so we could run WordStar.

[1] manufactured by Microsoft - http://en.wikipedia.org/wiki/Z-80_SoftCard


Me too, the other CP/M programs I ran a lot on my (knockoff) Z80 card were TurboPascal and f80, the Microsoft Fortan compiler. It always felt like a tiny betrayal running Z80 code, though, I was a 6502 man through and through.


Wow, not only was this program infinitely profitable, it could also be transmitted over the network infinitely fast, and even without a network connection.


"Installation instructions:

- No download necessary

- Create a file called GO.COM

- Done!"


Ha! That's hilarious! I'm sure a lot of people remember the old joke:

-can you assume that any program out there can be reduce by one line?

-can you assume that any program out there has a least one bug?

If yes, it means that, by mathematical induction, every program can be reduce to one zero byte, and it's buggy!


Which means that the first two assumptions are wrong, leading us to conclude that there exist minimal perfect programs for every specification.


There's a bug in this zero-byte program: the other program might not leave its memory in a correctly runnable state when it shuts down.


Q.E.D.!!!


The issue is whether "any program out there" is taken to mean "any existing" or "any possible". It may be true that no programs actually exist that couldn't be shorter or more correct (though I doubt it), but one would reach a minimum length and bugginess eventually.


No. If we negative dorfsmay's premises, it still does not lead to your conclusion.


IEFBR14 was a one-byte program from IBM that had a bug. The history of the program makes for some cool reading: http://en.wikipedia.org/wiki/IEFBR14


Please note, this is a joke, don't argue with it too seriously. Also it's not my joke, it was floating around in usenet days.



It's not down, it's Cloudflare. I used to get tons of false positives from that service. Junk.


Cloudflare is starting to get annoying. So often they want me to solve captchas to open a site -.-


Best hack ever! Infinitely better than any other hack.


It's not really infinitely profitable, because cost isn't measured in bytes. His cost was the time to conceive of, test, and implement the idea as a product. I can't say I've ever thought about the value of a program how much storage space it takes up.


That is kind of genius.


I love this story. It gives a strong impression of having interesting philosophical implications, but I have no idea what they are.

I hope I can offer a little advice without being too annoying: if you are going to use justified text, especially with narrow columns, you need to implement some kind of hyphenation. There are JS libraries that do this now, I think.


Better yet, just use soft hyphens! http://en.wikipedia.org/wiki/Soft_hyphen


I suggested the JS library approach as an alternative to manually inserting soft hyphens. Do you know of an automated way to do this?


Perl and a hyphenation dictionary?


The old "SAVE 0 X.COM" trick... Brings back good memories.



I thought he was going to say a Flashlight app.


x/0 is not equal to infinity in ordinary arithmetic (which is what author attempts here) :).

http://en.wikipedia.org/wiki/Division_by_zero


division by zero is undefined. c/x as x approaches 0 from the right is infinity.


Just for fun, what is 0/0?

Mathematicians often assign definitions to things that are undefined in other contexts to make things more self-consistent. The fact there is a good case to be made that c/0 is undefined for all c doesn't mean it must always be so in every possible instance.


You could look at it as `limit of x/x as x approaches 0`, which would be 1.

Or you could look at it as `limit of -x/x as x approaches 0`, which would be -1.

Or you could look at it as `limit of x/0 as x approaches 0`, which would be +/- infinity, depending on which side you approach 0 from.

Or you could look at it as `limit of 0/x as x approaches 0`, which would be 0.


I think the third case is `limit of c/x as x approaches 0`. It can only approach 0, c/0 is still undefined.


Not exactly, as c also has to approach 0. So you have two limits, and their order matters.


Python's __init__.py files are useful and can be zero bytes long.


They're hardly "programs" though, just components of a larger one.


Marvellous idea ! :)


cooool!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: