power-management

How can I hibernate a Google Compute Engine server?

本小妞迷上赌 提交于 2019-12-22 05:07:06
问题 I'd like to use a GCE server and VNC to run some desktop programs I've written. However, I'd like to not have the GCE server running all the time (to save money) and I'd like to have the setup of my VNC desktop persisted (to save time). It seems like the easiest way to accomplish this is to somehow hibernate the GCE instance. Is there a way to do this either from a script or from the command line? 回答1: The only currently supported technique that I'm aware of would be to use a bootable

Creating a ChargeInhibit Assertion (OS X 10.6.8)

一世执手 提交于 2019-12-21 22:04:05
问题 Platform (OS X 10.6.8) - [Macbook Pro - this is important as I want to deal with the battery handling - not applicable for a desktop] Forgive me if I've made a basic mistake that I don't see, as I haven't written any C/C++ in five years or more, and I'm not fully following the way apple APIs want you to deal with them, so this is what my question regards. Basically, I want to be able to inhibit charging from the AC adaptor at my command, so that I can choose whether to charge my laptop or not

Is it possible to detect Power Nap / DarkWake mode in OSX

孤街浪徒 提交于 2019-12-21 12:39:25
问题 I have a daemon process started via launchd. This will be running even during DarkWake and has no time to finish before OS X goes back to sleep again. I can think of the following solutions, but didn't find a way to achieve this. Don't make this daemon process run during DarkWake. I went through Apple documentation and forums but didn't find any reference for this. During DarkWake via daemon process make the OS wait until its done. Tried with calling pmset noidle and caffeinate in daemon

Simulating low battery for iPhones

时间秒杀一切 提交于 2019-12-21 07:03:26
问题 I am working on a mobile game, which appearantly crashes when the Low Battery alert is displayed. It works fine on low memory, incoming calls and other messages. Its a pain to test and debug this, since I can find no terminal or iPhone simulator way of simulating this situation, so I have to charge my phone up a little bit, launch the app, wait for it to drain its power, and start all over again. Does anyone know of a way to produce this error in a realistic way? Hopefully something that isn

Android accelerometer, sensor usage and power consumption

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:27:12
问题 I have a quick question about the accelerometer in Android devices. Is it always on/active? Given that accelerometer is used to detect the orientation of the device, either landscape or portrait. In the official documentation ( SensorManager ) it states that sensors should be turned off to save power. But I wonder if this only applies to others sensors like magnetic field sensors, gyroscope, light sensor and so on. I need to make a case for power conservation and I don't want to make the

How can I programmatically stop a notebook battery from charging

穿精又带淫゛_ 提交于 2019-12-21 04:04:23
问题 There is some easily available information on finding the status of a battery, or weather it's charging or not. (GetSystemPowerStatus API or System.Windows.Forms.SystemInformation.PowerStatus). I want to be able to stop a battery from charging based on some criteria, e.g. battery power > 20%. Is there an API to do this? 回答1: I think it's impossible, because you have need some API for battery or battery charger. And this API can provide to you manufacturer of notebook and battery or battery

how to hook to events / messages in windows using python

爷,独闯天下 提交于 2019-12-20 10:24:30
问题 in short: i want to intercept suspend/standby messages on my laptop, but my program doesn't receives all relevant messages. background: there's a bug in ms-excel on windows xp/2k, which prevents system suspend if a file is opened on a network/usb drive. i'm trying to work-around it programmatically (my toolbox include python, vb6, or command line tools). i know nothing about windows instrumentation :-) i have a sysinternals utility that suspends the system anyhow. i want to hook it to the

How to keep android device from sleeping while plugged in

久未见 提交于 2019-12-20 01:34:51
问题 I'd like to keep the screen on whenever one of my Activities are running and the phone is plugged in to a power source. I know that Wakelocks are tricky, so I'm looking for an example or some documentation on how to accomplish this specific goal. 回答1: Don't use wake locks for this -- just set and clear the window flag WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON based on whether the device is currently plugged in. You can set the flag with Activity.getWindow().addFlags() . So the code would

OS Reboot, Shutdown, Hibernate, Sleep, Wakeup (Windows Python)

一个人想着一个人 提交于 2019-12-19 18:48:07
问题 I'm looking for an automatize way of doing Windows Power Management functions: - Reboot - Shutdown - Hibernate - Sleep - Wakeup Is there a Python module to cover this functionality? Of course any other solutions are also appreciated... 回答1: I also went with the command line: import os os.system(r'%windir%\system32\rundll32.exe powrprof.dll,SetSuspendState Hibernate') 回答2: See win32api.ExitWindowsEx() ActiveState documentation. for flags: http://msdn.microsoft.com/en-us/library/aa376868%28v=vs

Launching NFC when screen is Locked in Android

放肆的年华 提交于 2019-12-18 12:52:58
问题 I want to launch My Application when we taps on NFC tag even Phone is Locked same as did in Google Wallet Application . I tried in following ways : 1) Tap NFC tag to launch my application after pressing Power button - Error : 05-23 22:00:22.949: D/NfcService(32443): EnableDisableDiscoveryTask: enable = false 05-23 22:00:22.964: D/NfcService(32443): NFC-C polling OFF 05-23 22:00:22.996: D/PhoneStatusBar(273): disable: < EXPAND icons alerts TICKER system_info BACK* HOME* RECENT CLOCK* > 05-23