teaching machines

Infield Form Labels

I’ve done enough web development now and taught enough web development courses that I am starting to develop opinions. Or maybe I’ve had opinions since the start, but now I feel qualified enough to air them publicly. Today’s opinion is on labels for form elements. Let’s all agree that we need them. But where do […]

Block vs. Inline-block vs. Inline

If I were to rank the most important things about making a website, I’d write down the following: The content The display property Everything else The display property dictates how the content appears in relation to other content, and it silently cancels out other properties that don’t make sense for one its settings. I find […]

Un-safelinks

Several months ago Microsoft started wrapping all URLs in my university email. Now, when I click on a URL, I first go to a web service that checks to see if the page has malicious intent or unsafe content. The problem with this safety feature is that I can no longer read the destination URL. […]

Fittin’ Image

How do you fit an image inside a frame such that every pixel is visible and the image isn’t distorted? In CSS, we write object-fit: contain. In an Android ImageView, we use centerInside. But what if you are alone in the wild lands of custom drawing? We must determine the scale factors ourselves. I’ve solved […]

Resize and Pad Images

I was recently given the task of converting a massive corpus of images (10) to a fixed resolution with a fixed amount of padding. In the past, I’ve used ImageMagick to make quick work of problems like this, but I can never remember its commands. Maybe I should write down my solutions as an investment […]

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 […]

1 2 3 4