How to *really* disable Roots activation

So I thought I disabled Roots activation. I was wrong. Activation still caused trouble, and digging deeper I eventually found a way to completely disable it. Ironically, the correct way that I eventually found was my initial gut instinct that I had before I made the fateful mistake of deleting the file instead of doing this correct thing. And what is this “correct thing”? Just replace activation.php with a blank file. (That is, a file with a length of zero bytes if I’m not clear enough.) Yes really. Astonishingly, even with activation completely disabled WordPress is still acting strange. Apparently it gets wonky if you are using more than one menu. Since I need eight to pull off this project, I’m sort of doomed to failure. I’m going to resurrect activation.php to automatically reassign the menus. It’s ridiculous I have to do this but it looks like this is the only way out.

How to completely disable Roots activation

[The information written in this article has proved to be wrong. See the follow-up to this article instead.] Roots is pretty cool, but a major problem is the “activation” page. I’ve lost work more than once because I pressed the “Save” button by mistake, and my latest mistake involves having to ask someone to fix things up by FTP. It seriously provides no benefits at all and it has the potential and is very likely to do a whole lot of harm. So why is this dangerous page in there, and why is there no official way to completely take it out? After breaking a site (by removing activation.php — bad idea), I poked around safely in my dev environment and found out that patching Roots in the following way will completely disable this dangerous “feature”. From WordPress’s point of view the activation page doesn’t even exist any more, even the activation link is gone, so this is perfect:
diff --git a/lib/activation.php b/lib/activation.php
index 4b677d6..a1b7c34 100644
--- a/lib/activation.php
+++ b/lib/activation.php
@@ -2,10 +2,12 @@
 /**
  * Theme activation
  */
+if (false) { // disable the dangerous "activation" page
 if (is_admin() && isset($_GET['activated']) && 'themes.php' == $GLOBALS['pagenow']) {
   wp_redirect(admin_url('themes.php?page=theme_activation_options'));
   exit;
 }
+} // disable the dangerous "activation" page
 
 function roots_theme_activation_options_init() {
   register_setting(
@@ -21,6 +23,7 @@ function roots_activation_options_page_capability($capability) {
 add_filter('option_page_capability_roots_activation_options', 'roots_activation_options_page_capability');
 
 function roots_theme_activation_options_add_page() {
+  return; // disable the dangerous "activation" page
   $roots_activation_options = roots_get_theme_activation_options();
 
   if (!$roots_activation_options) {

Building w3m on MacOSX

This is, of course, not really a piece of adaptive technology, but it’s a reasonable first approximation and this still is, in a sense, perhaps, a segment whose needs should be addressed. (Ok, I didn’t say it. Someone in an AIGA webinar said this a year and a half ago or so.) The easiest way to build w3m on MacOSX is to use the original version of w3m, which has been modified to use GNU configure. The w3mmee package does not compile (without some investigation and fixing, which would take time). Before building the package, one line needs to be patched. The patch for main.c can be found at Qi Hardware’s site. Boehm GC also needs to be installed before building the package. Unfortunately HP has removed Boehm GC’s page. So I grabbed the package from Debian. (You need the .orig package.) (Screen dump of OCAD’s web site as viewed in w3m) So far the browser seems to work.

Finalist :)

Two days ago I received an email from the RGD which told me that while I didn’t win any award in this year’s RGD Student Awards, I was among the finalists in the “Placemaking” category. Which made me happy: I have never been trained in EGD, my experience was not exactly EGD experience, and my attempt to somehow steer my INCD studies in the direction of EGD didn’t work out; yet it was my EGD entry that got into the finalist round. So what should I do next? I wonder. Or am I daydreaming?

“school sucks in the summer”

It is true that working on campus is way better than working at home. At home I have to remember to put my headphones on (which is recent discovery) and I don’t always remember to do that. But I’ve been much more productive on campus either in the studio or in the Great Hall (but not in the bistro area), even when compared with when I work with headphones on, or even compared to when I work at Robarts. The fact that campus closes early and isn’t open on weekends really is making me very unhappy. Yes, I’m still unhappy.

a good model thesis?

So I dropped into the grad office again today to look for theses to read, and I noticed that there were a few new ones that I’d never seen before and that didn’t look like anything I had ever seen. In fact they looked so different I thought maybe they were not theses. They I pulled them out and they were theses. Must be the new “bespoke” formats… So took out a few and the first one I tried to read was Spooky Action at a Distance: Fragments of Presence in Remote Objects : A Master of Design Thesis by Jackson McConnell (yes, that’s a title with a subtitle with a sub-subtitle). Less than halfway through scanning it I realized that I virtually did exactly the same thing as he did (except, very possibly, worse), and how I wrote my draft is virtually exactly the same as how he wrote his final thesis (again, except, very possibly, worse). So have I finally found a possible model to follow? I sure hope so…

Still don’t know what to do at openings…

I went to both of Jay’s openings today—not a feat by any means, as the two galleries were really close by. The artist was not there. I went, looked at all the artworks, took some pictures, and left. I still had no idea what else to do. I knew no one, and I felt awkward to talk to people I didn’t know. I was not one of the artists.

How to data merge QR codes with InDesign

So how did I end up mail merging my QR codes? My solution turned out to be typographic after all, but it did not involve contextual glyph substitutions. The key to mail merging QR codes is to realize that while we cannot control formatting in InDesign’s data merge, square shapes exist in Unicode, so if there is a programmatic way to generate the dot patterns, we can pick a monospaced font, vary the glyphs used, and end up with a scannable QR code. One way to generate the dot patterns is to use the qrencode tool by Kentarō Fukuchi. Its “-t ASCII” option is especially useful, as this means we don’t need to interface with the C library; the ASCII output can easily be parsed using a Perl script or similar and turned into a simple pattern of zeroes and ones. So two things came out of this exercise: First, InDesign cannot handle ideographic spaces (U+3000) in data files, so CJK fonts are out; and second, qrencode -t ASCII doubles up the ASCII characters so that the dots come out visually more or less correct, so to convert this output into a dot pattern we need to deduplicate the ASCII characters. The key portion of my code looks is this:

sub get_qrcode ($$) {
    # Note that qrencode uses ## for a dot (and 2 spaces for no dot), not just #, so we need to deduplicate first
    my($s, $quality) = @_;
    my $h = open(INPUT, '-|');
    die "$0: exec: fork: $!\n" unless defined $h;
    my @qr = ();
    if (!$h) {
        my @cmdline = ('qrencode', '-o', '-', '-s', '1', '-l', $quality, '-m', ' 0',  '-t', 'ASCII', $s);
        exec { $cmdline[0] } @cmdline;
        die "$0: exec: $!\n";
    } else {
        for (;;) {
            my $s = scalar <INPUT>;
        last unless defined $s;
            chomp $s;
            $s =~ s/([# ])\1/\1/g; # deduplicate
            my @spec = map { ($_ eq '#') + 0 } split('', $s);
            push @qr, [@spec];
        }
    }
    return @qr;
}
Provided that qrencode is installed, this code will convert the input string into a QR code bit pattern with the specified quality. To form the dots it is necessary to choose a perfectly square glyph. Since I was dealing with print, I can also pick a rectangular glyph and scale it horizontally to make it square. One obvious candidate is U+2588, which fills up the entire glyph space and is naturally square in most CJK fonts. Unfortunately if we use a CJK font we will need to use the CJK space, and it turned out that putting CJK spaces in the data file will cause InDesign to not recognize a UCS-2 file as UCS-2. So there are two options: Use U+2588 with a normal monospaced font and scale the glyphs horizontally, or use something else such as U+25A0, which is a smaller square dot. It turns out that if we use U+2588, we will need to typeset the dots in a really small point size, like 2pt. If we then generate a PDF and view it in Apple’s Preview tool, the QR code will get greeked, so this is undesirable. Using U+25A0 allows a larger point size to be used which decreases the probability of the QR code being greeked; the only problem is that with U+25A0 spacing cannot be as exact. It’s also worth noting that InDesign turns out to be incapable of handling UTF-8 in data files. Although you can specify Unicode, Macintosh platform (and Unicode on the Macintosh platform invariably means UTF-8), InDesign will silently ignore the file. You have to use little-endian UCS-2, which InDesign will interpret as “Unicode, PC platform” even if you don’t specify any options. Lastly, with a programmatic way to generate QR codes, we also don’t need to worry about choosing a quality. We can just let our code search for an optimal quality. For example, my code (clearly not the best code as I noted in the comments) currently has the following:

sub qrcode ($) {
    # Compute the best QR code by sucessively going from the highest to lowest quality.
    # Stop when we get something of the correct size.
    # Don't bother returning an error value because only 1 line uses this function and that line uses its own error checking.
    my($s) = @_;
    my @qr = ();
    for my $quality (qw(H Q M L)) {
        @qr = get_qrcode($s, $quality);
    last if @qr == $qr_code_size;
    }
    return @qr;
}
Just define some constraints (such as a fixed size for the dot pattern, $qr_code_size in my case) and let your code search for a quality that is adequate for your requirements.
Syndicate content