Menu

I love quantifiable data and had been using the Zeo Mobile sleep monitor to track sleep quality. I had worked on some projects of my own to use this data too. After I finished the most basic functionality for these projects I lost interest, but planned to come back to them eventually. Unfortunately, my Zeo hardware started having more and more trouble and eventually I stopped using it. I still really enjoyed the concept and thought I would come back eventually.

At some point later I checked back and found they had gone out of business! More frustrating, that meant all the sleep data I had on their systems was gone. I had since removed the app thus removing local data, so the only bit of data I still had was the CSV file I exported during development. This ended up being about 2 months out of at least 7 that I tracked. I can at least say that I feel like it helped me improve my sleep. which is the real value. Fun data is just a bonus.

However this does seal the deal that I will not come back to these projects. I decided I should release what I have in case it benefits the people out there who still have function Zeo products. I’m actually surprised that I haven’t been able to find anything out there really built on their Android API. Most of the projects I could find seem to be centered around the Zeo Bedside unit because in some ways it gives you access to more data.

My projects contained two components which work with Zeo sleep data. One is a reimplmentation of the SmartWake adaptive alarm feature for Android. SmarkWake was the feature that was supposed to wake you at the optimum time such as when you are entering or leaving REM sleep. i never saw the feature work, so I built my own. The other is PHP code to display CSV sleep data in progress graph form.

ALSO:
One of the prominent places Zeo was talked about was at the Quantified Self forums, so I mentioned this code in the Zeo shutdown thread in case anyone finds a use for it:Zeo shutting down: export your data!

I use virtual machines for testing at work. The way I go about this is to create a base VM with whatever general purpose tools and configuration I’d like to have available. I run updates on it occasionally and then make a copy whenever I need a new test VM. I had bad experiences with VM cloning in the past, but that’s probably something I should look into again at some point.

I’m installing a new base VM of Windows Server 2012, so I thought for future reference I’d list the changes I make. A lot of the changes I make are strictly personal preference.

Server Roles

As a starting place, after Windows is installed, I add the IIS Role and the Remote Desktop Services Role (RD Session Host). Though I haven’t actually tried it yet, I’d like to try the Citrix style RemoteApp functionality so I can run individual apps from VMs remotely on my primary desktop.

Features

In addition to the .NET Framework options, I add the “Desktop Experience” feature listed under “User Interfaces and Infrastructure”. You wouldn’t think from the description that this would add much value, but I’ve run into a few places where there are seemingly random dependencies on this feature. I test server and client applications on the same systems, so it isn’t a bad idea anyway.

After all roles and features are installed run Windows Update to get everything totally updated.

First!

As long as the VM is network accessible, it’s easier to remote in to do everything. So enable Remote Desktop in the System Properties on the Remote tab. Second, disable Internet Explorer Enhanced Security Configuration so you can more easily use it to get any utilities you need. Remember, this is an internal VM for testing things and is only even running as needed, so security features are lower priority than VMs for production purposes.

Ninite

Keep the installer, because rerunning it will update the applications if needed.

Folders

C:Apps – The way I prefer to do things I create a folder called Apps for small single exe utilities. SpaceSniffer is the first thing I add here because it helps clean up if I end up needing to trim the size of the VM.

C:Sysinternals – for the whole SysInternals Suite. I add this to the system PATH variable so I can quickly run anything. I also want this to always be up to date, so I use a scheduled task to run one of the following at logon

As long as you are 2008+ (so you have robocopy) and you have Desktop Experience feature added (so you can use WebClient), you can run this simple script with Admin privliges.

If you cannot meet those requirements, such as when you are using XP/2003, or cannot install the Desktop Experience feature, use SysInternalsUpdater with the /auto parameter

C:Downloads – Not that I’m frequently downloading anything on these systems after initial install, but it bugs me that downloads go into the user folder. After creating this folder, I go to C:Users[username] and right-click on Downloads, then on the Location tab change it to C:Downloads. Now Chrome, IE, etc will know to use this as default.

C:NirSoft – I don’t use NirSoft tools nearly as much as Sysinternals, but they can be nice to have available.

Mapped Drives – Because these VMs are not on the domain, I map a consistent drive letter to a common fileshare so it is easy to move files between VMs and my desktop. Longer ago I had problems with just telling Windows to remember the mapped drive, so I use a script like this at startup. The user is specifically for these shares.

I use amBX Gaming Lights and while I like them, there are some rough edges. If my computer would go to sleep, the driver/services wouldn’t work correctly unless they were restarted. And applications like amBX Illuminate would hang as a result, so that needed to be restarted too.

So I wrote a batch script to do this. Then I used a scheduled task to check the event log for the Power event that meant the system was waking up. The batch scripts need to run as Administrator, but scheduled tasks have an option for this. Cool, now the lights work properly after the computer wakes.

But then I decided I wanted shortcut keys to manually stop and start the lights. So I bound the batch scripts to the extra keys on my Logitech G710+ Mechanical Gaming Keyboard. But the batch script needs to run as Administrator and there wasn’t a built-in way to do that with the keyboard configuration, so I had to find ways to make that happen. Now the scripts auto elevate which is seemless if UAC is off. With UAC on this will trigger a prompt, but at least it will work.

Then there was the minor problem that killing Illuminate would leave orphaned icons in the system tray. This too could be solved with a bit of work.

Included is:

A script to (re)start the amBX services and amBX Illuminate

A script to kill amBX Illuminate

RefreshNotificationArea, which is called from the scripts to clear orphan icons in the system tray after killing processes

XML export of a scheduled task to run the restart script when the system wakes from sleep.

XML export of a keyboard profile for Logitech’s Gaming Software, which binds G1 to (re)start the lights, and G2 to turn them off.

The scheduled task and keyboard profile assume the scripts are in C:AppsamBX. Be sure to update the path if needed.

Though the scripts are stopping and starting amBX Illuminate, the same principle should apply if the scripts are changed to reference an alternative program like Aurora Synesthesia or glOW.

But the information is from 2008. The name of the window used in XP has changed in Windows 7 (actually probably in Vista). In addition to this, the code only works on visible icons, not on those that are currently hiding. The following code is updated to clear both visible and hidden icons.

I am seeing a difference between elevated batch scripts in Windows 7 and Windows 8. If you copy the following in the a batch script and run in either version, you get the current directory. However if you right-click Run As Administrator, you see the current directory in Windows 7 and “C:Windowssystem32” in Windows 8:

@echo off
echo Current path is %cd
%pause

Fortunately there is an easy workaround by changing the current directory to the path of the current script (parameter zero):

@echo off
echo Current path is %cd%
echo Changing directory to the path of the current script
cd %~dp0
echo Current path is %cd%
pause

Fun game, but I wanted to play with a gamepad. It is designed for keyboard and mouse but since time/fallspeed slows when you hold down the key to create a clone, you really don’t need the fast control of a mouse. It does not natively support gamepads, but here is the JoyToKey profile I setup to use the XBox 360 control:JoyToKey-TheSwapper.cfg

I’ve used Zeo for Android for the last seven months. I really like having quantifiable data to make sense of how I feel after I slept. Though I only used it more toward the beginning, their website has some pretty good tools to visualize the data and to track variables and their effect on your sleep (such as caffeine, alcohol, times you woke for the bathroom, etc). The headband is comfortable, so no worries there.