teaching machines

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

CS 330: Final

See the PDF.

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

CS 330: Lecture 39 – Exit(0)

Dear students, Today we close out our formal exploration of the stuff of programming languages. This is what we said we’d look into in the syllabus: Recognize and exploit the strengths of three major programming paradigms: imperative, functional, and object-oriented. Reason about the strengths and weaknesses of various type systems. Weigh the costs and benefits […]

CS 330: Lecture 38 – Automatic Test Running Via Metaprogramming

Dear students, Last time we saw how we could add a hook in Ruby so that when a non-existent method is called on a object, we can still execute the desired action. method_missing lets us write really virtual methods—ones that don’t even exist. Our code effectively used information about the method that would have been […]

CS 330: Lecture 37 – Object-relational Mapping Via Metaprogramming

Dear students, Metaprogramming is our theme for this last week of the semester. What is metaprogramming? It’s when code generates code. It’s when user input is used to generate new classes, methods, and so on. You’ll probably all felt at certain points that the code you are writing probably didn’t need to be written by […]

CS 318: Final Presentations

Dear students, This week we close out the semester with client project presentations. During each presentation, each audience member will write down feedback for the presenter on a quarter-sheet of paper. Here are some topics to address: How effectively did the speaker communicate about the client and purpose of the site? How was time used […]

CS 330: Lecture 36 – Taming Recursion

Dear students, We’ve seen that Haskell does some pretty crazy things: it infers types, it supports this crazy pattern matching stuff, it disallows side effects, and it computes things lazily. Let’s look at one last crazy thing it does: it uses recursion for everything! There are no loop control structures. Normally, when you think of […]

CS 330: Lecture 35 – Call-by-need

Dear students, Last time we introduced a different way of passing parameters. Instead of eagerly evaluating them, we delayed evaluation until they were referenced inside the function. We looked at two examples of delaying evaluation: C preprocessor macros and writing our own control structures. I want to discuss the first of these a little bit […]

1 2