Author Archives: Johnny Lin

Unison 2.48.4 Ubuntu 20.04 Linux to Mac OS 10.15.7 Transfer Error

For some strange reason, I was having issues with transferring select files using Unison from my Linux machine to my Mac after I upgraded from Ubuntu 18.04 to 20.04. My Unison version was the same on both, and nearly all files transferred as before, but I kept getting errors like:

failed: files/dining.doc

on a subset of files. (The path and filenames above are fake and illustrative.) It turned out the problem was there was a hidden file in files named ._dining.doc that was causing the failure. Once I deleted these hidden files, everything worked!

(Last updated August 24, 2021.)

Copying Code Into a Canvas Essay Quiz Question

The Canvas essay quiz question response box enables test-takers to provide a free-response answer to a quiz question. This works fine most of the time, but if a test-taker uses an interactive development environment (e.g., BlueJ, Spyder, Jupyter) to write code and then tries to copy and paste the code into the response box, often times the indentation will not copy over. Continue reading

Recipe for Feeding Rolly Pollies

I had the privilege this week of being part of a group who received a tour of some of the collections at the Natural History Museum of Utah in Salt Lake City. Great museum!

One of our tour guides was Christy Bills, Invertebrate Zoology Collections Manager. We learned so much from her! Among which is two things about how to feed rolly pollies:

  • Do not feed them grass.
  • Instead, feed them the following mix: damp soil, carrot, pine cone, dried oak leaves.

If you have kids interested in bugs and nature, rolly pollies are fun and interesting to watch and learn about! Hope this helps you keep them alive! 🙂

Simple Conversions from Python 2.7 to Python 3.x

Moving from Python 2.7 to 3.x is covered in much more detail here. This list is just a list of items I’m checking as I make the switch. It’s somewhat reflective of my own coding style and is meant more as a checklist for myself than anything, but if it helps you, great!

  • Change print to print().
  • Change xrange to range.
  • Change raise, Execption "Message" to raise Exception("Message").
  • Change from module import x to from .module import x, if module is a relative import and not on the PYTHONPATH. If I’m importing the entire module, it’s now from . import module.
  • Anywhere there is integer division being used, change it from / to //.
  • If I use the result of range(...) as a list, explicitly convert it to a list, e.g., list(range(...)).

Two Must-Have Career-Advice Books

Of course, no book is perfect (and so I have my quibbles with the two books below), but here are the two career-advice books I’m telling my students and anyone else they need to read!

Designing Your Life, by Bill Burnett and Dave Evans (Knopf, 2016): Ostensibly, this book is about utilizing product design principles such as brainstorming, prototyping, etc. to help you plan your life. And it is. But, in my mind, the two greatest things about this book is (1) it tells you how to get unstuck, if you don’t know what to do for a career, and (2) it tells you how to do networking that enables you to figure out what to do and to find a position to enable you to do that kind of work. And, perhaps best of all, it tells you exactly how to go about getting unstuck, do networking, and the other tasks that Burnett and Evans describe. Unlike other books where the advice is so general as to be anodyne—”reach out to your network,” “come up with a list of options”—the authors tell you what kind of table or chart to create, what to write in one kind of email versus another, etc.

The Two-Hour Job Search, by Steve Dalton (Ten Speed Press, 2012): Simple, step-by-step, and specific advice on how to use informational interviewing to efficiently and effectively find a job, including the vast majority of jobs which are never advertised. The “Two-Hour” in the title is no gimmick. Dalton shows you how to focus your job search so it’s productive rather than random shots in the dark. And, like the Burnett and Evans book, Dalton tells you exactly what to do: what emails to write, when to write the follow-up, etc. (H/T to Michael Kimball-Bryant for the recommendation!)

In short, I wish I had read these two books when I started my career! Whether you’re just starting out on your career or are an old hand, you’ll gain skills and a system to come up with and find the career for you!

(Btw, no one gave me a copy of these books to read. I borrowed either the paper or audiobook I read/listened to from my local library. The cover images are from Amazon, with cropping. Last update of the post: December 1, 2017.)

Advice to Beginning Programmers Who Are Being Required to Write Comments

Students in introductory programming courses sometimes feel, “What’s the use in commenting? The important part is getting the program to run.” Some students also feel, “Adding too many comments clutters the code.” As a result, there’s a tendency to avoid commenting or to do the minimum required.

Commenting, however, is a vital part of programming, as commenting is what makes your code useful to others (including yourself a month later). If you don’t comment your code, no one else can pick up your code and understand it. Think of it this way. If a company hires you to write some code and you leave the company after writing it, if you didn’t comment your code, how will your replacement understand what you did? And if your replacement has to rewrite your code because no one can understand it, didn’t your company just waste its money on your salary? As a result, no software development company will let someone contribute code that is poorly documented.

That being said, I admit you can overcomment. Especially when we’re first learning how to comment, we will tend to provide more details than are necessary. Still, if you’re just starting to learn how to program, I’d encourage you to overcomment rather than undercomment. At this stage, you need to get into the habit of writing comments. At this stage, the only way to do so is to write more than less. As you gain more experience in programming, you’ll get a better sense of what needs to be included and what doesn’t. But you can’t get to that stage if you scrimp on commenting now.

It’s like learning to write essays. As a second-grader, when your teacher asked you to write about your favorite pet or what you did over Spring Break, they didn’t say, “make sure you only use active voice and be as concise as possible.” No, they just wanted you to write as much as you could. Only later in school did your teachers say, “be concise, etc.” The same thing is true with comments. At this point, you need to create the habit of commenting, even if you don’t want to and feel it’s a waste of time. Describe what goes into a method, what comes out, the state of the program going in, the state coming out, and what gets changed and how. If you feel you’re saying too much, that’s okay. Later on, you’ll learn about what to leave out.

Why Librarians are So Much Fun to be With

I was a guest last night at the 2017 UW Literary Voices event, an evening of food, socializing, plugging my environmental ethics book, and fundraising for the UW Libraries. After the event, I was thinking about why is it that of all the academic units in a university, it seems to me that it’s the librarians that are the most fun to be around?

Don’t get me wrong, I have a lot of fun with my colleagues from every discipline, but there’s something about the librarians that’s special. Here’s my hypothesis: Contrary to conventional wisdom, librarians do not focus only on storing and preserving books (which they do do) but also on enabling access to books (and other resources). Thus, their discipline is focused on engaging with the other disciplines to help those disciplines do research and teaching. By its nature, librarianship as a discipline is outward facing whereas the other academic disciplines are generally inward facing (e.g., focused on their own research questions). And, in today’s world where disciplinary silos are ever more rigid, libraries play a critical role in bringing together the ultimate knowledge resource to help us solve common problems: people.

Debugging Advice to New Programmers

In this post, I’m going to give you advice that I am nearly sure you will ignore. The reason I know this is because most people I’ve given this advice to, I’m nearly sure, ignored it. I doubly know this because it took me years—nay, maybe over a decade—for me to start listening to this advice. So, believe me, I won’t be offended if you ignore this advice. Continue reading