The Bay Window Wall

The last wall I constructed is the one that holds the bay window.  Since this wall has a large span with no structural supports, it has to be super reinforced so it can hold the weight of the roof (plus any snow there might be).  The two main sources of reinforcement are extra large beams made out of a synthetic wood called Parallam, and a steel rod which keeps the posts from spreading apart.  There are also extra-large screws, double boards for the window sill, and metal straps at the top.

Tightening the threaded rod
Tightening the threaded rod

I left this wall for last because the Parallam boards are special-order and I didn’t want to make any mistakes.  I nearly did, though.  I didn’t do a great job of drilling the holes for the rod, and there was a good 15 minutes where the 5/8″ drill bit was trapped in the post.  I eventually used a socket wrench to get it moving again, so it turned out all right.  Sometimes I like working with other people so we can get more done, but sometimes I like to work alone so no one sees how close I come to disaster.

IMG_20140810_162404
Checking the strapping

We moved the heavy thing

Thanks to Char, Nicolle, and Mike for helping me move the trailer into position! Because they got in on the ground floor they get top priority in the Tiny Time Share queue.

2014-05-07 08.40.10

Linux Tip: Reinstalling Ubuntu

Sometimes if a system has been around a long time, upgraded a bunch, perhaps restored from backup, it will start to act up in weird ways. This is the dreaded “cruftiness” that Windows was famous for. You could treat a Windows XP system delicately, and there would still come the day when it was performing so badly it was easier to reinstall the OS than try to fix it.

Well, it can happen to linux, too. I was seeing odd behavior with suspend and resume, and very slow wifi reconnect times, and after dutifully filing a bug I eventually determined the problem was some crufty junk on my system related to a hard drive transfer I’d done.

I thought I was in for a class Linux Weekend — install the new OS, copy my home folder, and then painstakingly reinstall all the programs and packages I use that aren’t in the default installation.

No need! Ubuntu now has a special installation mode called “Reinstall”. It preserves all your user files while cleaning out the system folders completely. Then it installs a fresh OS and tries to install as many of your programs as it can find.

After I rebooted, there were a tiny number of custom-installed programs that the system couldn’t reinstall, but otherwise everything was where I left it and suspend and resume now work perfectly. Ah yes, and all of my wifi access points have been forgotten. For something I just let run over night, this was relatively painless and worked great! 5 stars.

Test Post From Android

I bought a record, and the label is all puffed up so it doesn’t sit flat on the b side.

wpid-wp-1397665300693.jpeg

edit: My buddy Nick points out this happens when the plant accidentally attaches two labels to one side of the record. I carefully cut away the label, and sure enough, there’s a second one hiding underneath. Thanks Nick!

Streaming audio over the network in linux

I’ve been trying for a long time to find a simple (for me) way to get sound from my laptop to my TV. I’ve tried mpd, mediatomb, pulseaudio… basically everything short of spending actual money. Finally I found a low-overhead system that does what I need thanks to our friends ssh and alsa: Linux Network Sound on the Very Cheap. Thanks so much to Aristotle Pagaltzis for this recipe.

I’ll reproduce the instructions with my edits:

  1. On the source machine (my laptop in this case), load the loopback ALSA driver:

    modprobe snd-aloop index=1 pcm_substreams=1

    The driver provides a card with two sound devices, and when sound is output onto a stream on one device then the driver loops that back that as an input available on the same stream on the other device. You’ll need to pick an index that’s not already taken by a sound card on your machine or you’ll get an error.

  2. Add this to your ~/.asoundrc:

    pcm.loop {
      type plug
      slave.pcm "hw:Loopback,1,0"
    }

    The original instructions also tell you to change your default soundcard to the loopback device. In this case I don’t want all my sound to go over the wire. Instead, use pulseaudio to select an application and have its sound sent to the loopback device. Yes, I know, pulseaudio. Actually it works pretty well these days! The loopback driver will then make that audio available on its other stream.

  3. On the machine with speakers you can then do this:

    ssh -C user@hostname sox -q -t alsa loop -t wav -b 16 -r 48k - | play -q -

    This command causes a simple dump to be made of the “loop” device on the source machine. That audio data is then piped into the “play” command which causes the sound to play on the machine connected to my TV. This also sets up ssh with compression which helps keep the bandwidth usage down (about 200K/s for me).

  4. All you need to do then is play something from the laptop, open the pulseaudio volume control, and tell the output to go to the loopback device. Very quickly the audio pops out the other side.

Obviously this is no solution for people wanting multiple client control, tablet support, playlists, or anything fancy like that. But as a way of just getting audio from point A to B, this is all I need.

Git Cheatsheet

Git has a steep learning curve but persistence pays off. Now that I’ve got the hang of it I can slosh code changes between multiple branches like a motherfucking wizard. Here is a cheatsheet I’ve developed for myself that has helped a lot. This isn’t a complete git HOWTO, it’s more of a list of things that I kept doing wrong as I was learning the system. The tips start relatively basic and get more and more complex. I was coming from svn and bzr so a lot of my tips have to do with confusion that results in coming from those systems.

Rule #1: When in doubt, checkout!

set username:

git config --global user.email user@domain
git config --global user.name 'Owen Williams'

set merge tool:

git config --global merge.tool meld

checking out:

git clone [url]

update changes from remote branch:

git pull (does git fetch and then merges in the changes)

revert a file:

Don’t use “reset”!
git checkout [file]

show a single diff:

git show [sha]

create a branch:

(Don’t actually use this, because the next command is better)
git branch [newbranch]

create a branch and switch to it:

git checkout -b [newbranch]
(-b runs git branch first to create the branch. You could also git branch [newbranch] and then git checkout [newbranch].)
This works even if you’ve started working! The changes will be moved over to the new branch 🙂

list branches:

git branch -a

switching branches:

git checkout [branch name]

merge all changes from another branch:

git merge [branch]

merge single commit from another branch:

(Only use this as a last resort, you lose wondering commit-tracking this way)
git cherry-pick [sha]

merge individual files from another branch:

git checkout source_branch [files]

fixing conflicts:

git mergetool
This uses the configured diff tool, or -t [toolname].
Note that with meld, the file called “BASE” (in the center) is the one that is used for the final commit. This is handy because you can pick which edits from the local you want, and which ones from the remote you want. Or just edit the <<< >>> file like you usually do. I find a good way to work is to blindly merge everything from the REMOTE to BASE first. Then I can see what’s different between the REMOTE and LOCAL which is usually what I want to do.

undo a merge in progress:

git merge --abort

reverting a commit:

You’re in trouble now, but this can be done. Examine git reflog which lists all commits for all branches. You want to rewind to before the bad commit.
git reset HEAD@{2} (or whatever label)
Default reset is –mixed, which seems to be ok. don’t do a –hard, like, ever.
When you do a reset, you’ll still be in a weird place with a lot of weird commits, but at least you saved your log. Examine the files and do a commit right away.
DO NOT DO git reset --soft [SHA] from trunk if you’re in a branch! — this will BLOW AWAY your original log of changes, ie how you got to this point in your branch. You’ll have all those changes, but none of the intermediate work.

create a new branch from current that tracks a remote branch other than master:

need to create a local branch that tracks the remote branch
don’t include “remotes/”
git checkout --track -b mybranch origin/branch

tell git that the current branch should always inherit changes from another branch

git branch -u [parent branch]
git pull is familiar for pulling from a remote repo, but it also works between branches. This is great for hierarchical featuresets, ie:

feature1
feature1-feature2

So let’s say feature1 is in code review, I can keep that clean but keep working on the next feature. I can tell feature1 to pull from master, and feature1-feature2 to pull from feature1. (I name my branches like that so I don’t get lost in the tree.) After doing this to every branch, I can run git pull no matter where I am and everything will be in sync.

copy one repository to another:

Ok so this is trickier, but possible.

first, clone the new repo.
Add the other repo as a remote. here “other-repo” is the name of the new remote branch.
git remote add other-repo [other branch location]
git fetch other-repo
git checkout other-repo/master

Since you can’t actually check out a remote branch, you’re in limbo. Give it a name, creating a place where the other master branch will reside. This is where you’re doing the merge from the old into the new repo.
git checkout -b other_master
git merge master

resolve any conflicts between the two repos. Trust the LOCAL changes, not remote! you want the new master to be in charge, yes?

Now for every branch on the other repo you care about:
check it out
git checkout other-repo/branchname
copy that to local
git checkout -b branchname
merge in the changes that bring it in line with current master:
git merge other_master

then to check your work, compare against new master
git diff master

also notice that all your commits are preserved!
git log

Shifting Ground

The VFX world is rumbling. After years of enduring impossible deadlines, hours, and too often blatant nonpayment, Life of Pi’s VFX Oscar win was the final irony: the studio responsible for the award-winning effects is in bankruptcy.

And if it wasn’t bad enough, the barest mention of the situation got the winner played off in the cheapest style.

And if that wasn’t enough, the director didn’t make a single mention of the VFX responsible for so much of his movie:

Of course you know this means war!

ang_lee_vfx

And others decided to bring the point home in a more generalized way.

But twitter-snark aside, there is starting to be talk of a strike. Will it go anywhere? Desperate workers are often not desperate enough to risk being blackballed, but I think we might have reached the point where they feel they have nothing left to lose.

HOWTO: Change the terminal title when commands are running

In the work I do I often have a lot of terminals open, and some of those terminals have a lot of tabs. Sometimes I start a process that’s going to take a long time and I’d like to quickly see if that process is still running or if it has finished. While this is tricky, it’s possible! This HOWTO is bash-specific and is designed for Ubuntu, but it should work on other distributions with minimal changes. Thanks to this url for getting me started: http://superuser.com/questions/42362/gnome-terminal-process-name-in-tab-title.

Step one is to make sure that your current settings do not change the title of the terminal. On Ubuntu there’s a block of code in the ~/.bashrc file that says “If this is an xterm set the title to user@host:dir“. Just comment out that whole block by putting # characters at the beginning of each line to disable the functionality.

# If this is an xterm set the title to user@host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
#    ;;
#*)
#    ;;
#esac

On other systems you will have to look around for where the value of PS1 is set. Look for “\e” — this is the code that tells bash what title you want to use. We want to override this, so delete everything from \e to \a.

Step two is to insert new code into ~/.bashrc (or wherever your system prefers). I put this code right after the existing PS1 code that Ubuntu shipped.

# Custom title-setting code that adds a triangle play-arrow
# if the terminal is not waiting on the prompt
case "$TERM" in
xterm*|rxvt*)
    # This tells bash: before showing the prompt, run this
    PROMPT_COMMAND='echo -ne "\033]0;${THIS_TERMINAL_TITLE}\007"'

    # Edit the title if a command is running:
    # http://www.davidpashley.com/articles/xterm-titles-with-bash.html
    show_command_in_title_bar()
    {
        case "$BASH_COMMAND" in
            *\033]0*)
                # The command is trying to set the title bar as well;
                # this is most likely the execution of $PROMPT_COMMAND.
                # In any case nested escapes confuse the terminal, so don't
                # output them.
                ;;
            *)
                echo -ne "\033]0;▶ ${THIS_TERMINAL_TITLE}\007"
                ;;
        esac
    }
    # The DEBUG signal simply announces the last-run command
    trap show_command_in_title_bar DEBUG
    ;;
*)
    ;;
esac

# Now we can set the title of the terminal with terminal_title my title
function terminal_title ()
{
    export THIS_TERMINAL_TITLE="$@"
}
# Here's a good default
export THIS_TERMINAL_TITLE="$USER@$HOSTNAME"

This code works because of a few obscure features in the bash shell. The first is the existence of $BASH_COMMAND — a variable that holds the value of the currently-running command. Second, the trap command which allows us to take action when commands are executed, and third, the $PROMPT_COMMAND variable which tells bash to execute a command before showing the command prompt. With these features, we can change the title when commands are executed and change the title back when the commands are done executing.

In my case all I do is take the current terminal title and add a play-like triangle character to the beginning while commands are running. When the commands are complete the old title is restored and the triangle disappears. One could extend this feature by taking the value of $BASH_COMMAND and adding it to the title. By default the terminal title is just $USER@$HOSTNAME but I’ve added a function which allows me to change the title to anything I want.

Step three requires you to either log out and log back in for the changes to take effect, or to run source ~/.bashrc in order to execute the commands. Note that some terminals have to be set up properly to allow their titles to be changed. In gnome-terminal, go to Edit / Profile Preferences / Title and Command and make sure “When terminal commands set their own titles” is set to anything except “Keep initial title.” Also, if you have set a custom title in gnome-terminal itself by right clicking a tab and selecting “Set Title…”, you’ll need to erase that custom title by selecting “Set Title…” and erasing the text inside there. This can be a little tricky, and logging out may be the simplest solution. If you’re still not seeing the terminal title change, check echo $PS1 and make sure there is no \e visible.

Now when I run a long compile or test command, I see a ▶ in the titlebar and tab of my terminal. When the triangle disappears I know my command has completed. Please share your favorite extensions to this feature in the comments!

Tracklist from Make It New, December 27th

On December 27th I opened for Perc at Make It New — it was an awesome experience, and having people come up to me afterwards and compliment me on my taste in music is something my 16-year-old self would never have imagined :). I was worried going in because Mixxx had been crashing earlier in the week as a result of me being dumb and using the bleeding-edge development version. But I worked with RJ to fix the problem, and Mixxx worked without a hitch.

There’s a fan recording of the set on youtube:

Actually there was a lot of trainwrecking, for some reason the Cue/Master control on the mixer was broken so it was a little hard to line things up. I’ll see if I can get a full recording from the Mmmmaven guys.

Tracklisting:

  1. Alan Fitzpatrick – Always Something For Nothing (Original Mix)
  2. Cassegrain & Tin Man – Athletic
  3. Paul Mac, Mark Broom – Remember When (Original Mix)
  4. Function, Jerome Sydenham – Computer Madness Re-Vision (Function vs Jerome Sydenham remix)
  5. Macromism, DJ Kool Dek – Shifted
  6. DETTMANN, Marcel – Push
  7. Blawan – And Both His Sons
  8. Slam – Crowded Room (Original Mix)
  9. BAS MOOY – Desolaat (Xhin remix)
  10. ANGELIS, Dimi/JEROEN SEARCH – Rhetorica (Jonas Kopp remix)
  11. Monoloc, Daniel Wilde – When I Get Older
  12. Jeff Derringer – Passenger (Original Mix)
  13. Dadub – Unlawful Assembly (Al Bielek Takeover)
  14. Mike Parker – Moisture (Treatment 3)
  15. Lodbrok – Oil (AnD Remix)
  16. Hizatron, Bashley – Discharge (Original Mix)

(edit: replaced broken ustream link with youtube link)