teaching machines

4-pin Buttons on Arduino

At the early stages of learning, we tend to mimic without understanding. That’s how I learned to code, and that’s how I’m learning electronics. A book presents a circuit diagram, and I copy it faithfully. And lo, it works! That small thrill carries me to the next step of understanding. Here’s a circuit that I […]

TransportException with Eclipse and EGit

Students in my introductory programming class were getting TransportExceptions when trying to pull from a remote Git repository with the EGit plugin in Eclipse. The issue was a missing line in their .git/config. The file should have looked like this: … [remote “origin”] … fetch = +refs/heads/*:refs/remotes/origin/* The definition of fetch was absent. I think […]

Weighted Distribution in Unity UI

Suppose you have a Horizontal Layout Group in a Canvas-based UI in Unity, and some elements in the group should expand but not others. Or some should expand at different rates than others. Checking the Width option of Child Force Expand on the group seems like it might do what you want, but you are […]

Capturing High-resolution Screenshots in Unity

A student and I were collaborating on a poster. We needed an image of a Unity scene that for a 4-foot-by-4-foot poster. Capturing our screens at their normal resolutions resulted in images that got fuzzy when scaled. So, we worked up a quick method for taking screenshots at higher resolutions with a render texture. Perhaps […]

Multicolumn Layouts in Unity

Unity’s RectTransform can be used to achieve a couple of common multi-column UI patterns. I describe here how to achieve these using only anchors, offsets, and pivots—and not any layout groups. Percentage-based N-column Layout If your layout requires multiple columns and each column is apportioned a percentage of the total display, set each column’s X […]

Toward Understanding Unity’s RectTransform

Unity’s RectTransform layout system has confused me for a very long time. Not that there’s anything wrong with it. Confusion is what naturally happens when you approach a sophisticated system and just start pressing buttons. But in order to move past this stage, I’m documenting what I’ve learned after many hours of pressing. Properties Each […]

Eclipse Shortcuts

Eclipse has a lot of keyboard shortcuts and I know hardly any of them. But my students still think I’m an ace. These are the ones I do use on a regular basis, shared so that my students can be aces: Automatically add import statements to classes that live in faraway packages with Control-Shift-O or […]

Formatting Java in Eclipse

The style that the Eclipse auto-formatter imposes on my Java code is 99% excellent. However, whenever I set up a new workspace, that 1% of style I disagree with eats away at my soul. I document the few things that I do change here because it’s easier to set them anew then try to migrate […]

Checking Slack Participation with Ruby and OAuth2

A couple of years ago, a student asked me if I thought MOOCs were going to make universities obsolete. I said no, because in my experience of taking MOOCs, one thing that didn’t scale was the number of people answering questions in the forums. No matter the class size, there seemed to be about 5-10 […]

Fitting by Rotating

Last spring I was talking about media queries with some students, and we joked around about just rotating any structures that were too wide to fit in the viewport. As silly as this idea is, I wondered how easy it would be to do with just CSS. First, here’s a div with some text that […]

1 2 3