Blog

  • Recovering my old Scape files

    My original iPad finally bit the dust in August, just before I could get a final good backup of it. Most of the stuff on it was already backed up elsewhere (GMail, Dropbox, iCloud), but Scape was the exception.

    Scape is (at least not yet) able to back up its files to the cloud, so there wasn’t anyplace else to restore from — except I had take advantage of the fact that under iOS5, the files in the app were still directly readable using Macroplant’s iExplorer, so I had actually grabbed all the raw Scape files and even the Scape internal resources. Sometime I’ll write up what I’ve figured out about Scape from those files…

    The Scape files themselves are just text files that tell Scape what to put on the screen and play, so the files themselves were no problem; they don’t include checksums or anything that would make them hard to work with.


    Version:0.20
    Mood:7
    Date:20121113025954
    Separation:0.50
    HarmonicComplexity:0.50
    Mystery:0.50
    Title:Scape 117
    Steam Factory,0.50,0.50,1.0000
    Spirit Sine Dry,0.23,0.31,3.1529
    Spirit Sine Dry,0.40,0.36,3.4062
    Spirit Sine Dry,0.64,0.19,3.9375
    Spirit Sine Dry,0.55,0.49,1.0065
    Spirit Sine Dry,0.26,0.67,3.5039
    Spirit Sine Dry,0.76,0.54,3.1211
    Spirit Sine Dry,0.49,0.79,3.8789
    Spirit Sine Dry,0.46,0.17,3.9766
    Spirit Sine Dry,0.85,0.27,2.0732
    Spirit Sine Dry,0.90,0.53,1.5154
    Spirit Sine Dry,0.66,0.72,3.6680
    Spirit Sine Dry,0.15,0.55,2.2527
    Spirit Sine Dry,0.11,0.80,1.9320
    Spirit Sine Dry,0.32,0.88,4.1289
    Spirit Sine Dry,0.18,0.14,3.2779
    Spirit Sine Dry,0.81,0.11,3.0752
    Spirit Sine Dry,0.49,0.56,1.7528
    Spirit Sine Dry,0.82,0.80,3.3783
    Bass Pum,0.53,0.46,1.8761
    Thirds Organ Pulsar Rhythm,0.50,0.50,1.0000
    End

    I wrote to Peter Chilvers, who is a mensch, and asked if there was any way to just import these text files. He replied that there unfortunately wasn’t, but suggested that if I still had access to a device that had the scapes on it, I could use the share feature and mail them one by one to my new iPad, where I could tap them in Mail to open them in Scape and then save them.

    At first I thought I was seriously out of luck, but then I figured, why not share one from the new iPad and see what was in the mail? I did, and found it was just an attachment of the text file, with a few hints to iOS as to what app wanted to consume them:


    Content-Type: application/scape; name="Scape 10";x-apple-part-url=Scape 10ar; name="Scape 10ar.scape"
    Content-Disposition: inline; filename="Scape 10ar.scape"
    Content-Transfer-Encoding: base64

    Fab, so all I have to do is look through five or six folder containing bunches of scape files that may or may not be duplicates, build emails, and…this sounds like work. Time to write some scripts. First, I used this script to ferret through the directories, find the scapes, and bring them together.


    use strict;
    use warnings;
    use File::Find::Rule;

    my $finder = File::Find::Rule->new;
    my $scapes = $finder->or(
    $finder->new
    ->directory
    ->name(‘Scape.app’)
    ->prune
    ->discard,
    $finder->new
    ->name(‘*_scape.txt’)
    );
    my $seq=”a”;
    for my $scape ($scapes->in(‘.’)) {
    (my $base = $scape) =~ s/_scape.txt//;

    my $title;
    open my $fh, “<“, $scape or die “can’t open $scape: $!”;
    while(<$fh>){
    chomp;
    next unless /Title:(.*)$/;
    $title = $1;
    last;
    }
    $title =~ s[/][\\/]g;
    if (-e “$title.scape”) {
    $title = “$title$seq”;
    $seq++;
    die if $seq gt “z”;
    }
    system qq(mv “$scape” “$title.scape”);
    system qq(mv “$base.jpg” “$title.jpg”)
    }

    I decided it was easier to do a visual sort using the .jpg thumbnails to spot the duplicates and filter them out; I probably could have more easily done it by checksumming the files and eliminating all the duplicates, but I wanted to cull a bit as well.

    So now I’ve got these, and I need to get them to my iPad. Time for another script to build me the mail I need:

    #!/usr/bin/env perl

    =head1 NAME

    bulk_scapes.pl – recover scape files in bulk

    =head1 SYNOPSIS

    MAIL_USER=gmail.sendername@gmail.com \
    MAIL_PASSWORD=’seekrit’ \
    RECIPENT=’icloud_user@me.com’ \
    bulk_scapes

    =head1 DESCRIPTION

    C will collect up all the C<.scape> files in a directory
    and mail them to an iCloud user. That user can then open the mail on their
    iPad and tap the attachments to restore them to Scape.

    This script assumes you’ll be using GMail to send the files; create an app
    password in your Google account to use this script to send the mail.

    =cut

    use strict;
    use warnings;
    use Email::Sender::Simple qw(sendmail);
    use Email::Sender::Transport::SMTP;
    use MIME::Entity;

    my $top = MIME::Entity->build(Type => “multipart/mixed”,
    From => $ENV{MAIL_USER},
    To => $ENV{RECIPIENT},
    Subject => “recovered scapes”);

    # Loop over files and attach. MIME type is ‘application/scape’.
    my $n = 1;
    for my $file (`ls -1 *.{scape,playlist}`) {
    chomp $file;
    my($part, undef) = split /\./, $file;
    open my $fh, “<“, $file or die “Can’t open $file: $!\n”;
    my $name;
    while(<$fh>){
    next unless /Title/;
    (undef, $name) = split /:/;
    last;
    }
    unless ($name) {
    $name = “Untitled $n”;
    $n++;
    }
    close $fh;
    $top->attach(Path => $file,
    Type => “application/scape; name=\”$name\”;x-apple-part-url=$part”,
    );
    }

    my $transport = Email::Sender::Transport::SMTP->new(
    host => ‘smtp.gmail.com’,
    port => 587,
    ssl => ‘starttls’,
    sasl_username => $ENV{MAIL_USER},
    sasl_password => $ENV{MAIL_PASSWORD},
    );

    sendmail($top, { transport => $transport });

    I was able to receive this on my iPad, tap on the attachments, and have them open in Scape. Since there were a lot of these, it took several sessions over a week to get them all loaded, listened to, saved, and renamed using Scape’s edit function (the titles did not transfer, unfortunately).

    So now I have all my Scapes back, and I’m working through the program, trying to get to the point where I have all the objects enabled again. I haven’t played with it in a while, and I’m glad to be rediscovering what a gem this app is.

  • New album released: Radio Free Krakatau

    Radio Free Krakatau
    Composed and performed entirely in VCVRack.

    Based on a picture of a VCVRack setup I saw on Facebook; I was able to figure some of the connections and setup, but not all of it; this is a record of my explorations of that set of modules, as I increased the complexity of the interconnections.

    Sadly, the VCVRack savefiles were lost, so this is the only record of this performance.

  • Replacement O-ring size for Select Comfort cell

    3/8″ OD x 1/4″ ID x 1/16″ will fit the cell’s nozzle and provide the needed seal to prevent slow overnight deflation. See my post on QA for a Select Comfort bed – if I’d spotted the missing O-ring first, it would have cost me 79 cents to fix the problem instead of $300.79.

    I do have a nice portable full-size air mattress that fits into a standard Rubbermaid storage bin now, so it wasn’t a complete waste, but better to save someone else the money!

  • iTunes Ringtone UI Surprise

    You cannot drag and drop .m3r files into the Tones tab in iTunes. They must be pasted.

    Find your .m3r files in the Finder, select them all, File > Copy, click on the Tones tab in the iTunes sidebar, and File > Paste.

    No, it does not make any sense that drag and drop does not work. But it absolutely does not.

  • High Sierra Wifi Poor Performance Fix for 2010 MacBook Pro

    I’ve been working remotely at an AirBNB this week and was having a really frustrating time of it. The 2010-vintage MacBook Pro I have would connect to the Wifi, go for awhile — sometimes a half-hour, sometimes not more than a minute, — and then drop the connection. Shutting off wireless and reinstating it would restart the connection, but it would be unstable and drop again. The length of time it would stay connected was completely unpredictable, and whether or not it would reconnect, and how long it would take was also completely random.

    I was getting speed test results of 0.15 MB/s up and 0.18 down. This was unusable, and I fell back on my hotspot for any sustained connection. Weirdly, I could connect fine with the Amazon Dot I’d brought along – flawlessly, in fact. What was going on?

    Late Friday evening, after a particularly frustrating session attempting to get Netflix to work (I really wanted to see Disenchantment — great show, by the way!), I started doing some research and came across an article that recommended reducing the MTU for the wireless device to 1453 (from the default somewhere in the 1500’s). Really? Okay…

    Magic. It has now been solid for several hours, including streaming video. If you’re having any trouble at all, I’d recommend at least trying it. The article shows you how to set up a separate “location” with the different MTU, so it’s simple to switch it on or off as you choose.

    Update: 12 hours later, I’m getting terrible performance again. A little more searching turned up a tutorial on readjusting the MTU to optimum with ping. Reset your MTU size to default, then starting at your 1500, try the following commad (replacing mtusize with the actual number!):

    ping -D -s mtusize -c 2 google.com

    If you get “message too long” in the ping output, drop the MTU size a bit a try again. If you have no idea what MTU size is good, start at 1500, which will be too big, and go down by 100s until you start seeing “xxxx bytes from google.com:…” messages, which let you know your ping is getting through. You can then go up by tens until you get “message too long” again, then back down by 1’s until you find the maximum MTU size that doesn’t get “message too long”.

    I had to reduce my MTU size further to 1425, and I’m near 10 megabits/second again.

  • Necessary steps to get the GitLab Rails template app running on OS X

    The GitLab template is a great way to get started on a new Rails app – it sets up most of what you need simply by checking out the code, but there are a few things you need to do if you’re starting fresh on a
    new Mac.

    The template app assumes you’ll be using Postgres for your database. I recommend sticking with this; if you grow your app past the proof-of-concept step, you’re going to want it configured for a robust and responsive  database. I love SQlite, but it’s not that much harder to go ahead and get Postgres running, so let’s do that instead of downgrading the template.

    If you have Homebrew installed, skip down to the brew install postgres section. If you don’t, run the following command:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    Wait for a while for that to finish, and Homebrew will be installed. Once that’s done you can move on to installing and configuring Postgres:

    brew update
    brew install postgres
    initdb /usr/local/var/postgres -E utf8

    Now you need to configure your databases. The initdb above sets up your user ID as a root user to start, so you can now add the application’s user and databases. (Substitute an appropriate username for yourappdev).

    psql postgres
    create role yourappdev with login password '...some password here...';
    alter user yourappdev createdb;

    Now exit psql (^D will do) and log back in again as the yourappdev user to create the development and test databases for your Rails app. If you set a password, psql will prompt you for it. (If you forgot it, your root-level user created when you installed Postgres can still log in without a password at the moment.)

    psql postgres -U yourappdev
    create database yourapp_development;
    create database yourapp_test;

    Securing the production database

    You now need to create the database that you’ll run in production. Remember this is the one with the important user data in it that you don’t want to lose, so we want to create a whole separate username that will be the creator of the database and give it a good strong password that you record in your password manager. (If you don’t have a password manager, get one! It’s way safer than writing it down on a sticky and putting it in an envelope.)

    psql postgres
    create role yourapp with login password 'a very strong password please';
    alter user yourapp createdb;
    ^D
    psql postgres -U yourapp
    create database yourapp

    You’re now ready to work on your Rails app. When you want to run the production version, you’ll need to set the DATABASE_URL environment variable like this:

    DATABASE_URL=”postgres://yourapp:strongpassword@localhost/yourapp”

    Further deployment issues are beyond the scope of this post.

  • HTTPS upgrade completed

    That was actually pretty painless.

    Hostgator (love y’all!) now provides a per-site HTTPS cert for free, so I didn’t have to use Let’sEncrypt for it; I just needed to install the Really Simple SSL plugin, back up my database, and turn it on to get SSL working.

    Highly recommended if your site isn’t a complicated one.

  • VCVRack NotStraightLines plugin for Rack 0.6.0

    This zip file (NotStraightLines-0.6.0-mac) is a Mac version of the NotStraightLines plugin. To make it super clear, this is all Andrew Belt’s work; I just built a binary!

  • Not black and white

    This photo was taken on a heavily overcast day, and is straight out of camera. A wonderful interaction of the day and the sensor in my iPhone.

  • Followup on Go dependency Jenga

    I was finally able to build a working version of the glide.yaml file for my project and convert it to dep. The items of note:

    • To get openzipkin to work, I needed to specify
      [[constraint]]
        branch = "master"
        name = "github.com/opentracing/opentracing-go"
      
      [[override]]
        name = "github.com/openzipkin/zipkin-go-opentracing"
      
      
    • To get logrus to work, I had to change it to github.com/sirupsen/logrus in all my code and specify
      [[constraint]]
        name = "github.com/sirupsen/logrus"
        version = "^1.0.5"