How I Never Forget to Pack Stuff in My Backpack

I almost never forget to pack stuff for my regular trips to the gym, family visits, or shopping. Of course I sometimes do forget to pack something for a weekend trip, or I overpack books when I visit friends over the weekend and am afraid to run out of reading material during the train ride.

But for the daily leaves of my appartment, I do not forget to pack keys, phone, money, writing utensils, sketchbook, etc.

This wasn’t always the case. I attribute the immense improvement in reliability to my 2017 christmas read of Mari Kondo’s The Life-Changing Magic of Tidying Up.1 At first, I thought it was funny to give my backpack time to rest and relax. That’s how she frames emptying the bag completely. I still do think it’s funny, but the practice stuck. I tried a couple of her tips, no matter how they were explained or tied to a value system probably related to Shinto beliefs. And lo and behold, emptying the backpack completely helped to make sure I have everything packed when I leave.

I think this is because I would be so accustomed to having all necessities ready to go at any given point in time. If I ever took a piece out of the backpack and forgot to immediately re-insert it, I’d forget about it missing completely. Relying on an always-ready backpack made me more vulnerable to forgetting to pack e.g. my purse. It happened all the time, really. I almost never forgot my keys, though, because I always leave them next to the door for picking up whenever I leave. Packing my every-day carry backpack every time before I leave works in the same way.

Because my backpack is empty by default, I have to run through my mental checklist of things to pack just before I put on my shoes and leave. This actually makes me more resilient in practice: I have to fetch all the items I need everytime and I do notice when they are misplaced, actually making it less likely to misplace them in the future.

Here is another tip taken from Mari Kondo’s book: Optimize your storage for putting away, not for retrieval (see page 142 of the book). Chaos emerges from too high a threshold to put a thing where it belongs. Storing away should be the easiest part. When you need something, you will fetch it no matter the cost anyway. – But I do mind the cost of picking up, so I trained myself to put things into similar spots more reliably over time. I execute almost the exact same movements everytime I pack my bag now, it seems.

So as counter-intuitive as it may seem, emptying my backpack every time I get home helps me not to forget to bring anything when I leave.

In case you wonder: My beloved backpack is a Maxpedition Falcon III1, by the way. It’s a tactical backpack, and I love the form factor. I got the backpack last year as a thank-you from a good friend for being his best man when he wed his bride. It’s one of the very best gifts I ever received. I enjoy packing and unpacking it, it’s crazy. And I really dig that I can attach pouches using the Molle webbing. It’s a cool toy for grown-ups.


  1. This is an affiliate link. I get a small kickback from any purchase from amazon.com without any additional cost to you. 

Convert MS Word DOCX Files to Markdown with Images

I don’t know when was the last time I received a Microsoft Word .docx file. However long the streak may have been: it has been broken today.

The document contained links and embedded images. I was instantly taken aback by the prospect of all the manual labor of extracting the images and saving them to files, not even knowing how MS Word behaves nowadays.

But I have pandoc installed.

And it’s great. It even extracts images and saves them into a subfolder. I love it. Didn’t know about this feature until I scrolled through the output of pandoc -h.

This is the command I used:

$ pandoc -o output.md --extract-media=./ inputfile.docx

It puts all images into a media/ subfolder anyway, so I set extract-media to the current directory. Just lovely.

Lightweight CrashReporter Library for Mac Released

The wording here is 100% Brent’s achievement. Love the humble tone.

I compiled a crash reporter library with CocoaPods support. Check it out:
https://github.com/CleanCocoa/CrashReporter/

The past couple of days, I’ve been working on integration of an automatic crash reporter. Turns out that on some machines The Archive is crashing regularly during search, and I want to track this down. I need data by more than the most courageous users who can venture into the Console to track down crash report files and send them to me.

So I bit the bullet and began work on a server script that would accept crash report files and email them to me. I think that’s better than making users email me crash reports directly. Not everyone has Mail.app set up on her Mac, after all.

Fortunately, Brent Simmons open-sourced NetNewsWire 5 and blogged about his crash reporter. Brent has decades of experience on the Mac, so whenever he publishes a practical tip, I listen.

Just have a look at the code: Collecting .crash files and sending them over? Sounded simple enough! NetNewsWire even sports a very humble crash reporter UI, and automatically sending reports on the user’s behalf if the user choses to do so. The required Swift types are simple enough to integrate once you figure out where Brent put all the helper extensions :)

I cannot stress enough how amazing open source is. All this experience, assembled in publicly available code repositories for everyone to grab and use. This is crazy.

I am now rolling this out for my apps, starting with the WordCounter and The Archive on their respective “beta” update branches to see how it works in practice. The Swift code is simple and I trust it doing its job. But the server script, well, it needs to be battle-tested now!

I’m going to add public-key encryption of messages and/or some sort of authentication to prevent malicious attackers from spamming me with emails that, well … I send to myself.

Move! Work Break Timer v1.4.0 Released

I just released an update to Move!, the work break app I develop and use. It fixes a couple of user experience issues, like displaying a Dock icon when you view the preferences so you don’t lose the window.

Also, the app’s preferences didn’t display license details properly on Mojave and above. The app now uses Swift 5 and updated external libraries under the hood, is properly notarized (hello, Catalina!) – and a couple of MiB larger than before. I am looking forward to when we can depend on the Swift runtime being available on user devices.

Fixed Code Highlighting on the Blog

I manually edited about 400 occurences of code block markers from #!swift into \“swift`. I hope I didn’t break anything in the process. So far, things look good.

If you find oddly looking posts or broken code blocks, please tell me about them. There’s no way I can find problems on my own in 10 years worth of blog posts :)

Find Out if Xcode/LLDB Debugger Is Attached to Current App

This time, I don’t want to find out if the app is compiled as debug/release mode; I want to find out if the debugger is attached.

I found an Objective-C answer on StackOverflow which is based on HockeyApp-iOS.

Here’s my Swift translation, effectively using lazy evaluation of global variables instead of a dispatch_once_t:

let isDebuggerAttached: Bool = {
    var debuggerIsAttached = false

    var name: [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]
    var info: kinfo_proc = kinfo_proc()
    var info_size = MemoryLayout<kinfo_proc>.size

    let success = name.withUnsafeMutableBytes { (nameBytePtr: UnsafeMutableRawBufferPointer) -> Bool in
        guard let nameBytesBlindMemory = nameBytePtr.bindMemory(to: Int32.self).baseAddress else { return false }
        return -1 != sysctl(nameBytesBlindMemory, 4, &info, &info_size, nil, 0)
    }

    if !success {
        debuggerIsAttached = false
    }

    if !debuggerIsAttached && (info.kp_proc.p_flag & P_TRACED) != 0 {
        debuggerIsAttached = true
    }

    return debuggerIsAttached
}()

I posted my version to StackOverflow, too, of course. Find it here.

Fold Current Level-1 Heading in Emacs Org-Mode Outlines

There’s no standard shortcut to fold the current subtree of an org-mode outline.

When I work in org-mode outlines, I usually am 3 or more levels deep into a so-called “subtree” and want to get back to the root item, fold it to hide the details, then drill down into another item. I use that when I am working on an app and want to have a look at a planned milestone nested deep down at a different point in the outline.

Usually, I hit Shift-tab to fold the whole buffer and then get to the other item I want. But oftentimes I do want to close the current branch only and leave the others open, not fold everything. The vanilla Shift-tab shortcut configuration executes org-shifttab, which folds the whole buffer through org-global-cycle to put you in “overview mode” first, then “contents” if you hit it again, then “show all”. See the docs on global and local cycling.

Here’s a demo of my solution:

First I hit M-h to mark the line, then S-<tab> to fold the first subtree up to its root level, then hit the shortcut again to cycle through the global folding states twice (see the minibuffer at the bottom saying “OVERVIEW” etc.), then fold all subtrees except the middle one.

I came up with this function to figure out the root-level heading of wherever your cursor is at the moment, then hide the whole subtree:

(defun ct/org-foldup ()
  "Hide the entire subtree from root headline at point."
  (interactive)
  (while (ignore-errors (outline-up-heading 1)))
  (org-flag-subtree t))

The default behavior of org-shifttab is useful, too, though.

Have a look at the code from org.el as of now, to learn a bit elisp on the side:

(defun org-shifttab (&optional arg)
  "Global visibility cycling or move to previous table field.
Call `org-table-previous-field' within a table.
When ARG is nil, cycle globally through visibility states.
When ARG is a numeric prefix, show contents of this level."
  (interactive "P")
  (cond
   ((org-at-table-p) (call-interactively 'org-table-previous-field))
   ((integerp arg)
    (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg)))
      (message "Content view to level: %d" arg)
      (org-content (prefix-numeric-value arg2))
      (org-cycle-show-empty-lines t)
      (setq org-cycle-global-status 'overview)))
   (t (call-interactively 'org-global-cycle))))

The function

  • moves to fields within tables,
  • cycles through global visibility states,
  • or shows contents of the current level.

I don’t want to break at leas the first two effects. I still want to cycle through the global folding modes when I’m at the root level, and navigating around at the table is very useful, too.

From the default implementation, we can copy the org-at-table-p predicate and write conditions to fold up to the root level only outside tables.

The following function remaps “backtab” (Shift-tab) in emacs org-mode to fold the current outline item up to its root-level heading unless you are in a table or at the root level already. The conditions, explained:

  • (org-at-table-p) returns t (true) iff your current insertion point is inside a table
  • (org-at-heading-p) returns t (true) iff your current point is at a heading line
  • (= 1 (org-current-level)) checks if your point is somewhere inside a level-1 heading or its direct contents; combine with org-at-heading-p to limit to being at the heading line itself.
(defun ct/org-shifttab (&optional arg)
  (interactive "P")
  (if (or (null (org-current-level))     ; point is before 1st heading, or
          (and (= 1 (org-current-level)) ; at level-1 heading, or
               (org-at-heading-p))
          (org-at-table-p))              ; in a table (to preserve cell movement)
      ; perform org-shifttab at root level elements and inside tables
      (org-shifttab arg)
      ; try to fold up elsewhere 
      (ct/org-foldup)))
(org-defkey org-mode-map (kbd "S-<tab>") 'ct/org-shifttab)

There you go: backtab to fold the current subtree up to the root level!

Combine E-Book for Free

There is a free ebook out there that teaches you the basics of Combine, Apple’s reactive framework introduced at WWDC 2019. It is pretty long already, given the time author Joseph Heck (@heckj) had to learn about Combine and then write about it. From what I saw, I think it’s a good introduction to reactive programming in general.

Seriously, you should read it: https://heckj.github.io/swiftui-notes/

And the book’s source is available, too! https://github.com/heckj/swiftui-notes

From the repository’s name, swiftui-notes, and this description:

A collection of notes, project pieces, playgrounds and ideas on learning and using SwiftUI and Combine.

… I can only assume it gets expanded even more over time to include both SwiftUI and Combine!

Check it out and share it; Joe Heck deserves some internet love for his efforts.

Post Overview Updated

I don’t know what’s going on this week, but I have written a lot for the blog. I also carved out an hour and a half today to update the structured overview of articles on this website. I always wanted to make it a good entry point but didn’t update it during the transition to another blog platform, then back again, and now it’s 2 years later already. Phew!

Slides for the “More Money, More Control” Webinar on Selling Outside the Mac App Store

Today I noticed that I never followed up on my FastSpring webinar of 2017 called “Beyond the Mac App Store - A Practical Guide to Go From Code to Cash” with the slides! Sorry, folks!

I’ll also upload the checklist we served attendees.

You can find the slides on slideshare.net, because I have an account there and don’t know what else to do with PDFs: https://www.slideshare.net/DivineDominion/beyond-the-mac-app-store-a-practical-guide-to-go-from-code-to-cash


→ Blog Archive