Thursday, July 7, 2016

One-liner to check when your Windows computer shuts down or goes to sleep

Once in a while you want to know when your computer shuts down or goes to sleep whithout watching him all the time. For example when you want to measure how long the batteries of your laptop or still hold.

A simple solution is to log the current timestamp in a file. The last timestamp is the one when the computer shut down. This is a simple PowerShell one-liner to do that:
echo "Start" > test; while (1) { date >> test ; sleep 60 }

It writes a timestamp to the file test (in the current folder) every minute until the program is stopped. If you don't stop it, then the OS does when it shuts down.

Wednesday, June 29, 2016

JW Library App: Easy Backup and Restore of Publications, Bookmarks and Highlights

Ever replaced your computer and started over with your studies in JW Library?

There is currently no official way to sync the bookmarks and highlights across devices.

It is however possible to manually backup and restore the JW Library. And it is really simple!

Please note that the following procedure only works if the user name is the same on the source and destination computer. 

Backing up the JW Library App

  1. Make sure that the JW Library App is closed.
  2. In Windows Explorer make sure that the option to show hidden items is enabled: on the View menu check Hidden items.
  3. Then browse to folder C:\Users\<your user name>\AppData\Local\Packages\WatchtowerBibleandTractSo.45909CDBADF3C_5rz59y55nfz3e
  4. Create a copy of the sub folder LocalState, e.g. to an USB stick.

Restoring the JW Library App

  1. Make sure that the JW Library App is installed but closed.
  2. In Windows Explorer make sure that the option to show hidden items is enabled (see above).
  3. Then browse to folder C:\Users\<your user name>\AppData\Local\Packages\WatchtowerBibleandTractSo.45909CDBADF3C_5rz59y55nfz3e
  4. Create a temporary backup of your current LocalState sub folder.
  5. Delete the content of the LocalState subfolder (Attention: do not delete the folder as it has special permissions assigned to it –  just delete its content)
  6. Copy the content of the LocalState folder from the source computer to the LocalState folder of the destination computer.
That's it. You are done. Start JW Library and enjoy all your publications, bookmarks and highlights. If anything goes wrong, you can easily restore your previous content on the destination computer from the temporary backup.