miko: Photo of me by the river (Default)
2014-06-19 05:08 pm

Troubleshooting: Google Drive Spreadsheets - Sort Script

I figure if this took me more than 2 minutes to find the answers, I should write it up.

Background: After seeing a link to http://unfuckyourhabitat.tumblr.com/ , I was reminded that I was trying to set up a maintenance schedule for myself at home... I like lists, but the physical list I have just hasn't been working for me - too many different timelines for doing tasks and not enough randomness: I'd just always end up skipping the same things in favour of tasks I enjoy doing more. So, I thought I'd try making myself a spreadsheet to give me a bit more flexibility in timing & also a randomizer that would put something to the top of my list.

I was going to just set it up on one of my computers, but then I thought it'd be useful if I could grab it easily from the tablet as well... so why not try Google Drive's spreadsheet function? Yeah, it'll go down when the internet is down, which sucks, but I still thought I'd try it. Frankly, none of my computers even have the same version of open/libre office on them, so portability of scripts would have been tough if I didn't do it this way.

So, I set up my spreadsheet to do what I wanted it to do... and then realized that the click throughs for sorting were a bit of a pain. I'd have to select the right range, Data > Sort Range, select that it has headers, select the right column, select descending, select a second column. Not the end of the world, but certainly not what I'd like it to be. First search, can I set up a different default sort? Survey says... no. Alright then. What about something like recording a macro in Excel, can I do that since I know exactly what the manual steps are? Google help says... no. Fine, so I need to write a script in their language.

The script: This script should have been the simplest example in the world, but it was bloody hard to find anything in the google help. My frustration perhaps shows in the comments.

// For actually useful help files, start here: 
//    https://developers.google.com/apps-script/reference/spreadsheet/

function sortMaintenanceList() { 
  // Note: to call from a spreadsheet, use the function name "sortMaintenanceList()" 
  // without any reference to the file name.  To clip this to a button, make a
  // shape (Insert -> Drawing ...) - I like to use a textbox with a background
  // colour - and then right click, select the drop down arrow and Assign Script.
  //
  // I don't cotton to these "write everything in one line" ideas. Write readable 
  // code, it makes it more accessible *and* you don't hate yourself later.
  
  // This is how you select your current sheet, so that you can actually run sheet 
  // functions. You'll need to give the app permissions to access your google drive 
  // the first time.
  
  currentSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
  
  // Here I'm selecting the range I want.  In this case, I'm starting at cell(2,2) 
  // in order to not select my row 1 headers or my column 1 numbers. Most times,
  // you'll probably want to start at 2,1 (ie, row 2, column 1) because normal
  // people don't want to skip column 1.
  //
  // The second half is to select to the last row and the last column, so that even
  // if I expand the sheet to add more, it'll still grab it all.  There are also
  // range versions of this sheet function.  Note: for some reason, it wanted the
  // extra brackets.  It still seemed to work, but threw an error without them.
  
  usefulRange = currentSheet.getRange(2,2,(currentSheet.getLastRow()),(currentSheet.getLastColumn()))
  
  // Now sort it.  The sort function from range works differently than the sort
  // from sheet, because apparently consistency is for chumps. Here I'm sorting
  // first by column 7 (note: this is absolute in the sheet, even though I have
  // a smaller range selected), decending, secondarily by column 8, ascending.
  
  usefulRange.sort([{column: 7, ascending: false}, {column: 8, ascending: true}])
}

This is simple enough (and yes, could all be one line of code if I hated future-me), but geez, it was not easy to find quickly via searches. -1 useability, google... the first help pages you sent me to were completely unhelpful. It wasn't even clear where to go to get the class/function definitions, let alone having any useful examples to get me situated. I would think I'd be part of the target audience (familiar with Excel macros and ready to try switching over), but it was cringe-worthy trying to get to this.

If you're curious about my document, I'm totally willing to send it along - I just didn't feel like cleaning it up for public consumption right now.
miko: Photo of me by the river (Default)
2014-06-14 09:11 pm

Troubleshooting: Wii Fit U freezing and buzzing

I bought a Wii U a while back and eventually decided to add on the Wii Fit U package with the balance board and all, because you know I love movement games. But it's been the biggest pain of the games, because it has a really bad freezing problem. I looked online and got past my first issue, but when it recurred (no idea why) I called Nintendo to see if they had an answer. Nope, they told me to send the game & console back for repair, which I didn't particularly want to do. Thankfully, I found a work around right after, so I'm writing up my experiences in hopes that this might help someone else.

First issue: Freezing when attempting to sync the Fit Meter (pedometer)

I booted and played the game for the first time, no troubles... this included syncing my Fit Meter to my profile. However, the very next time that I tried to run the game, it froze going in when it tried to sync again ("Transmitting!" *dies*).

Frustrating. Internet searches told me I might have a problem with my Mii (user profile) if I had moved it from the Wii and I had previous Wii Fit data associated to it... which I didn't, but I did move it from my 3DS, so I thought maybe there was some issue. They suggested deleting my game data on the Wii U and trying with a different Mii - in the end, I deleted my game data which let me load the game normally, but I didn't delete that Mii, I used her again. It's unclear to me as to whether this eventually caused my later problem, so if I was doing it all again, I'd probably have just recreated my Mii on the Wii U rather than transferring her.

So, game data deleted, went back in (and irritatingly had to do the opening tests again, which I wasn't much in the mood for while troubleshooting the game). This time, when I connected up the Fit Meter, I told it *not* to try to sync on start up. You have to do this before you power down the game that first time. I haven't had a problem syncing since, though, so this was the solution for me.

Second issue: Freezing and buzzing on loading screen

A month or so later, after no troubles at all, I went to load up the game and it froze on the loading screen. It would bring up the "Wii Fit U" logo and play its little tune, and then when it got to a certain point in the fade-down, it froze and made a buzzing sound. It was reproducible: I tried a lot of things, some suggested by the internet and some basic troubleshooting. Here's the things I tried, none of which helped the game load.

- Shut it down and restarted (the basic "turn it off and on again")
- Checked the physical disk (no damage)
- Unplugged the system from the wall for 30 seconds
- Updated the console (it did need an update, but it didn't help)
- Tried another game (New Super Mario Bros U, worked fine)
- Set my Miiverse language settings to English only (suggested by the internet)
- Removed my internet connection entirely in case it was trying and failing to phone home for some reason (suggested by the internet)
- Checked the fans were running (suggested by tech support)
- Deleted the game update data and reinstalled it (suggested by tech support)

I was pretty frustrated at this point. Nothing had changed at all, and the game simply stopped working. Eventually (the next day, perhaps), I guess I remembered my previous Mii problem, so I tried starting up the console under M's profile. It worked no problem, and I could switch to my profile in game.

What the hell.

If you are having freezing problems, try a second profile - a local profile with no Nintendo network account was the one that worked for me. It turns out my problem is also inconsistent: I booted the game today (twice, actually) while writing this post and had no problem loading it directly under my profile. I'm suspicious that it is a Nintendo network issue, but I have no proof as such... just that the day it wouldn't load, there was a heavy traffic issue because of the Mario Kart launch & second game redemption. And that the second profile that couldn't even try to connect was the one that worked.

For all my frustration, I'm loving the game. I'll try to write up a quick review soon, but it's a really solid choice for if you want a movement/fitness game but don't really have the space to play Kinect games. I don't have to rearrange my living room for this one, and I can play with it while watching TV if I want because of the gamepad, so I can feel like I'm being sort of productive by doing step routines or boxing.