Andrew Que Sites list Photos
Projects Contact

February 28, 2016

VirtualBox Configuration Loss

I use VirtualBox on my main machine to effectively run 2 operating systems. Today I was installing some new software and filled my program drive. This is a 128 GB sold-state drive and I hadn't been playing attention to how much free space was available. I store the main hard drives for VirtualBox on an other drive, but it turns out VirtualBox was saving snapshots on this drive, and had consumed 40 GB of that space. So when I went to install Android Studio for an upcoming project, I filled the disk. That usually isn't an issue—move stuff around and try again. Not today.

I had an instance of VirtualBox open when I ran out of space. What I discovered is that when you close VirtualBox, it saves its configuration. But when there is no space, it simply creates a file of 0 size. Then when you try and start VirtualBox it complains the configuration is corrupt—which it now is. You have now also lost all virtual configurations.

Many of my virtual machines were easy to get back. But the one that I run primarily as my second OS had a snapshot. Because of the snapshot I couldn't simply restore the VM. It took a lot of trial and error before I figured out something that worked.

The VirtualBox configuration file is XML. It assigns virtual drives UUIDs. When I lost the configuration file, I lost the association between the virtual drive file name and its UUID. Lucky for me, I happened to have an old configuration file with some of the associations. But that didn't help me restore the VM I needed. The problem was this VM had a snapshot. I had the virtual drive, and the snapshot, but I needed to link them somehow.

  <HardDisk uuid="{ff89a8e5-aeba-49bf-a37b-1c784270913b}" location="root.vdi" format="VDI" type="Normal">
    <HardDisk uuid="{8f4500a5-cb4a-4528-a3d7-d2d0fe9226a9}" location="{8f4500a5-cb4a-4528-a3d7-d2d0fe9226a9}.vdi" format="VDI"/>


After some playing around, I understood the above format. What we have is a drive called root.vdi that has been assigned the UUID ff89a8e5-aeba-49bf-a37b-1c784270913b. It has a single snapshot called 8f4500a5-cb4a-4528-a3d7-d2d0fe9226a9}.vdi with the UUID of the same value. When I figured this out I thought I was good to go. But it turns out that in my playing around I messed up the snapshot and it no longer was assigned the correct UUID. Somehow the UUID was reassigned to all zero.

More searching around I came across the program VboxManage. This comes with VirtualBox and allows the UUID of a drive to be set/changed.

VBoxManage internalcommands setvdiuuid <disk.vdi>

That seemed to set the UUID of the root drive alright, but the snapshot was still complaining. After looking at the command I saw this was changing the UUID of the drive, but said nothing about the parent of the drive. I found an other internal command, sethdparentuuid. This is what I was looking for.

VBoxManage internalcommands sethdparentuuid <snapshot.vdi>

After I did this, my snapshot booted up and I was back in buisness. Only took about 2 hours.

In hindsite I see I made a mistake. VirtualBox creates a file called VirtualBox.xml-prev when it closes. That would have contained my old configuration. Unfortunately I didn't know this when I removed the corrupt version and tried to start the program. That file would have contained my entire configuration, but was overwritten after VirtualBox closed a second time.

   An other good night of skating.  Like last time my heart monitor decided to quit during the session.  This time it stopped when I was skating my hardest.  I was hoping to look down and see a high heart rate and instead I found it was reading nothing.  I know I had to at least be in the upper 180s and probably 190 BPM or higher.  The floor was fairly free most of the night starting right from the beginning.  I pushed hard and in the beginning was feeling a little winded.  The reality was I was able to obtain higher speeds and the lack of restrictions to my speed meant I was traveling faster while trying to keep in step to the music.  I found that on nights when I can't go fast the footwork required to dance works the heart just as hard.  But when I can open up, I physically can't keep both speed and the footwork.  So I feel like I'm not doing as well despite my high performance.  I found it an interesting observation.
   I missed my 1,000 Calorie check for time, but know I burned 1,100 Calories in one hour 11 minutes.  This extrapolates to one hour 5 minutes for the first 1,000 Calories which is about as good as I've done.  For the night I logged a total of 2,593 Calories over 2 hours and 54 minutes.  I'm pretty sure I lost 5 minutes so can say I easily obtained 2,600 Calories for the evening.  The rink allowed adults one last song, and naturally they gave us a fast song.  I was pretty winded but as I tried to open up for the last song my body rebelled with leg cramps.  This was the most tired I have been at the end of a session for a long time, and that was nice.
   Pictured is Liz at our post-skating night cap at a truck stop along the route back home.  Of all the people that say they want to skate with me, Liz is the only one who actually does.
   This is a project for a few days ago.  I've been thinking the African masks on either side of the entry to the Wyvern's Haunt should be lite, and some kind of lantern looking light might be cool.  I found some inexpensive LED foot path lantern-esk lights and after some thought decided to try them out.  They have a 1/2" metal pipe to hold them up.  The pipe is threaded and came off easily.  So I put a 60 degree bend in the pipe, the lantern back on it, and hung them just above my masks.  I am pleased with the results.

February 23, 2016

Breaking My Bike

   Today being the warmest forecast day of the week I decided to bike into work.  The ride was pretty uneventful until just before I reached highway 51.  I ride down Femrite Drive until it T-bones into Copps Ave.  If one continues forward in the direction of Femrite Drive there is a flat grassy field between that leads to highway 51.  I usually bike on this strip and cross the highway rather than go south to the stop light between 51 and Broardway.  The glassy field was covered in snow, but I have a mountain bike.  As I approached I downshifted in anticipation of the rough terrain.  As I did my chain did this number were it jams itself between the front sprocket and the frame of the bike.  This is irritating but usually all you have to do is back peddle a quarter turn.  I did that but the chain was not re-engaging.  Thinking I slipped off the sprocket I shifted up and tried to peddle.  However, the chain wasn't catching.  By this point I was out of momentum.  When I stopped and looked down, I was one end of my chain dangling off the rear cassette—I had broken my chain in half.
   This is a new way to have broken my bike and I've never had to do chain repair before.  I knew I still had around a mile to work and I really didn't want to walk it.  Inspecting the chain I could see the pin was still present.  Using a cheap multitool with a pliers I always keep on my key chain I tried to re-seat the pin.  It held for a couple revolutions before breaking again.  At this point I was still on packed snow, but there was a parking lot a dozen feet away.  I moved there and tried again with the chain.  After getting the pin centered I pushed hard with my pliers to get it to stay.  It broke my pliers but I felt like I had a better connection.  I decided to try and limp the rest of the way to work, careful not to put much torque on the peddles as to not break the chain again.
   My efforts paid off.  I slowly made it the addition 1.5 miles without incident—slower than my normal pace but not a lot faster than walking.  At work I looked for bicycle shops that would be close by thinking I could limp my way there on the ride home and pick up a replacement chain.  There wasn't anything closer than State Street which is about 7 miles away.  I wanted a better solution then having to limp that far. 
   The company I work for has a machine shop and I thought I'd see if they had something I could replace the pin in my chain with.  I rigged up something I was going to do the trick, but didn't anticipate what would happen if my chain became wider.  As soon as I tried to peddle the chain got stuck in my rear derailleur.  This caused the the spring loaded derailleur to move forward and catch on the spokes, which in turn pulled it more forward breaking the derailleur off the frame.  Now I had a broken chain and a broken derailleur. 
   It was clear I wasn't cycling home.  I called my roommate Zach to see if he could pick me up after he got off work.  For his rescue service I bought him sushi.  The moral of this story: Que knows he sucks at mechanical things, and should remember to leave them to qualified people.  It could have been worse though—I didn't have to walk the last one and half miles to work.
Window Like New

Window Like New

   Sometime in January when tearing down from a party something large fell into the window on the front door and broke the pane of glass.  I've replaced many windows, but this one was large enough I couldn't pick up a sheet of glass from my favorite home improvement store.  After searching around I found the hardware store just down the street cuts glass to size.  So I picked that up this evening after work and installed it.  The old pane was caulked as to prevent air from drafting in, so it took some effort (i.e. my hammer) to convince the old glass to come out.  After finessing the trim and cleaning up the old caulk with a putty knife the window cavity was ready for the new glass.  A patient roommate held the glass in place as I caulk the edges and then reinstalled the trim.  Hammering in the trim nails was a delicate process but taking it slow resulted in a near flawless installation.  Near flawless because one piece of trim did slit.  However it re-seated nicely and it's noticeable.
   Spent part of the evening soldering together DMX512 cables for the lights in the living room.  I had borrowed some of Xiphos' cables until my connectors arrived.  Rather than buy expensive DMX512 cable, I used CAT5 cable.  DMX512 is a serial protocol based on differential EIA-485 differential signaling and clocked at 250 kbits/sec.  By spec, CAT5 is good to 100 MHz or 100 Mbits/sec.  So I figured this should work fine.  In fact, I found that Electronic Theater Control agrees with me in an article on using CAT5 for DMX.  If it's good enough for the pros, it's good enough for me.  And we just happen to have much of a 1000 foot reel of CAT5.
   So after spending part of my evening soldering connectors and watching Star Trek, I now have a set of 10 DMX cables ready to install.

The evenings skating session started off like the last couple of week. When I arrived the parking lot of close to full, and I was pretty sure I wasn't going to be get my speeds up. But this time at the 7:30 mark when the afternoon session ends the rink cleared out enough that I could skate at my standard speeds. I found I was holding a heart rate of 190 BPM (103.8% max) and while this clearly took effort, I felt good. Managed to push my heart rate up to 193 BPM (105.4% max) which ties my previous record. Most of the night I was able to hold heart rates of 180 BPM or more (98%), even for the last couple songs of the session. I burned through the first 1,000 Calories in about an hour and 10 minutes. My heart rate monitor stopped at some point and I lost around 10 minutes of data. Like that last time it lost the signal, it required me to stop the session and start a new one. When I did everything worked fine. The total floor time: 3 hours and 1 minute logged with 2,674 Calories burned. Average heart rate was 163.5 BPM. The Calories burned and average heart rate are new records, and the maximum heart rate ties for record. It wasn't until I tried to take my skates off I realized I was fairly sore.

All of this makes me want more data about my skating sessions. I'm looking into methods for monitoring rotational speed of my skate wheels. The Digispark is a tiny microcontroller board, and this with an IR sensor should allow me to wheel speed. What to do with this information is the question. I found a real-time clock that contains non-volatile memory. So I could timestamp the data and log it. I could also investigate using a Bluetooth board and transmitting the data to my phone. The nice thing about using my phone is I have plenty of storage and tons of horsepower for number crunching. At some point I am going to have to try my heart rate monitor again because ultimately I want to correlate speed and heart rate. I also want much more detail from my heart information such as heart rate over the entire session time, and a chart denoting how much time was spent at various rates. To be able to match heart rate and wheel speed I can also check the delay between when I begin to push hard and how long it takes me heart to respond. And the reverse information is even more important: after I stop pushing hard, how long does it take my heart to slow down. This is easy to do once I have the data, and I need to build a better device to get that data.