Live data from Hacker News

How to programmatically find out if computer is on

haiku-os.org

111–120 of 197 posts

Re: How to programmatically find out if computer is on

#111
post #48
post #32

Earlier quoted context omitted.

there's a convenient npm package to handle that for you

And a separate package by the same prolific author for not_on that depends on the first package.

You really should use onoff.js, which is a wrapper that is more actively maintained and has a typescript support

Re: How to programmatically find out if computer is on

#112

Although many people are laughing, I believe the function works ok. The only complicated part is to find a way to call it when the computer is not on.

If you take the memory unit, and attach it to another computer, does >interpretingI suppose it would.

So perhaps a biocomputer of sorts could be offline and return undefined behavior by spec. Guess we'll keep looking for that perfect OS code.

Re: How to programmatically find out if computer is on

#113

> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...

I admire for how you nerdsniped several other comments without anyone noticing the platform, or how "halt" would drop you into console monitor on said platform. My standing ovation to you :D

(The platform is Alpha, right? Given the prompt and name for the console, though it was SRM, not SRE) :)

Re: How to programmatically find out if computer is on

#114

I'm curious if there's any significance in number 0.63739 in this implementation double is_computer_on_fire(void) { return 0.63739; } https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181...

Doesn’t seem to be a date or notable postal code

Re: How to programmatically find out if computer is on

#116

Earlier quoted context omitted.

There's an elegant FP solution that involves searching an infinite data structure using only a finite amount of computation -- actually, with precisely zero computation, because the machine isn't on. It's like lazy evaluation, only more lazy.

Wait. When the machine isn't on, P=NP! So our security systems are (useless | perfect)! I think there might even be other implications...

Hum... Both P and NP are within the set of algorithms you can run when the computer is on. When it's off it's a different set, so it proves that OP=NOP (where O is for "off").

Re: How to programmatically find out if computer is on

#117

I'm curious if there's any significance in number 0.63739 in this implementation double is_computer_on_fire(void) { return 0.63739; } https://github.com/haiku/haiku/blob/8f16317a5b6db5c672f33181...

My first thought is that it looked close to 1-e^-1, but that doesn't seem to be it.

Re: How to programmatically find out if computer is on

#119

> is_computer_on() How does this relate to computer being in Halt state, which is quite valid state for servers (there could be even a dedicated Halt button)? Technically computer hardware is ON. I remember that in such state it shows a "carrot" prompt (>>>) from the SRE console. By the way, there is also HCF instruction (Halt and Catch Fire). https://en.wikipedia.org/wiki/Halt_and_Catch_Fire_(computing...

> By the way, there is also HCF instruction (Halt and Catch Fire). I was somewhat recently scarred for life by this instruction, having just discovered that if you execute HCF on the MIPS-based integrated circuits in Stationeers, the simulated IC... explodes in your face.

Works as advertised. ;-)

Re: How to programmatically find out if computer is on

#120
post #4

Where does the code run when the computer is off? Edit: I see the downvotes, yet i still don't know if it's a joke. I was genuinely asking the question.

Genuine answer: the code cant run when the computer is off, thus the joke. The question is worth asking (all are) but then soliciting "quantum computing" as an answer makes it a doubly worthy set up line, so thanks twice.

Both thanks and not thanks you mean
Post reply on HN