# Recent Content

Cool futuristic Art
posted on 2016-08-01 13:15:00

>Sarah showed me the Work of Simon Stalenhag, who seems to do work of a futuristic/crumbling relics of consumerism/world-controlling technology nature. I'd suggest taking a look! It reminds me of the War of the Worlds movie around the middle of the page.

Finally fixed my phone
posted on 2016-05-15 14:32:00

I like to tinker with things, I own. An important part of deciding to buy any given device is that I can tinker with it, take it apart, install whatever hobby OS on it I like, &c. I'v generally been delighted by my Nexus 4 phone, which I've had for perhaps two and a half years and is my favorite smartphone so far!

Recently, though, Google stopped providing android updates for it (well, I think they'll still security patch Lollipop for a while) when Marshmallow, the sixth food-version, came out. I always like to poke at the new things in life, so I started looking around at my options and saw that there was a Cyanogenmod 13 image for my phone. CM goes by their own numbering system, and 13 corresponds to 6 in the official android versions, which is the latest. I had played with Cyanogenmod a few times over the last few years and so I felt pretty comfortable trusting them with my phone.

On top of trying the new version of android, which seems fine, but hasn't really blown me away with anything new, I also tried unlocking my phone's LTE modem. It seems the n4 shipped with an LTE modem which isn't turned on by default because maybe Google never got it properly tested. Some people got it turned on, though, so it's possible to upgrade your data connection considerably! It was like getting a new phone!

Unfortunately, I also had to seek out and install some Google apps. I'm finding Google increasingly irritating, recently, both in their apps and that they called me for an interview, screwed up the scheduling, then the programming language they were interviewing me about, then let me try again in the right language, and finished up by never responding. Mostly, I would seriously suggest the F-Driod repository of FOSS apps, but I need to install the Google Play Store for my banking app, many things I need for work, and I also make heavy use of the Maps app. So, I bit the bullet and installed Google Play using the Open Gapps project.

For a couple weeks, I tolerated the nightmare of continual modal popups from Google Play Services that informed me that it had stopped. Over and over again, it stopped. In the middle of typing words, it stopped and interrupted me. While trying to get directions, it stopped and never figured out where I was. While trying to find emails, it stopped and got confused. It was really annoying, but it tended to happen in terrible, agonizing bursts, so I could still function. I was busy adopting a dog and being an adult human, so I tolerated it.

BUT THAT ENDED TODAY

I finally sat down and got it fixed.

I tried a billion forum posts that suggested combinations of wiping partitions and dances around blood-spattered stone circles, but that wasn't really useful. I know that most of those things are essentially Skinner boxes, and so I try to avoid them, but desperation makes fools of us all.

I had avoided hitting the 'Report' button on the error dialog, because, on the stock android version, this brings up a wall of legal text about how Google is going to pack up as much data as it wants and ship it off to their servers when you submit the bug report (disclaimer: I never read that and have no idea what it really says, I'm just tired of accepting legal agreements). On cyanogenmod, though, the data will be shipped off to a bunch of friendly hackers (in the best sense of the word) who I don't know, but trust to care more about my privacy than Google, for some reason. I didn't submit the report, but being made by hacker-friendly people, the CM report dialog shows the Java backtrace of the problem. This was the most helpful information I'd gotten so far, and it informed me that the problem was
com.google.android.gms missing android.permission.ACCESS_FINE_LOCATION

Eventually, I found an issue that seemed to address it on the Open GApps issue tracker, that contained these commands:

pm grant com.google.android.gms android.permission.ACCESS_FINE_LOCATIONpm grant com.google.android.gms android.permission.ACCESS_COARSE_LOCATION

and that was it. No problems, yet.

I hope that this saves someone all the hours it cost me!

Clack Static Asset Middleware
posted on 2016-05-12 02:01:00

As part of my glacial march to get Knttl running the way I'd like, I wrote a middleware for the clack web framework to help me out!

When you're serving javascript and css files for a website, you want to inform the browser to keep a local copy as long as possible, because then it won't bother your webserver to download it again and the page will render faster for your users, too. There's a popular quote about programming

There are only two hard things in Computer Science: cache invalidation and naming things.
It seems this was said by a Phil Karlton.

So, like many things related to the it-was-never-meant-to-be-used-this-way world of web technology, there are some interesting best practices that evolved around this idea that, ideally, only one copy of a static file should ever need to be sent to a user, if their browser works well.

There are ways to tell a browser how long to hold onto a file before checking if there's a new version of it, but that only gets you so far. Presumably, your javascript is going to change, some day, and then you'll feel silly when all of your users are still running a three week old version of it that's still cached by their browsers.

The next bit is the hack that makes it all shine.

"Why not just change the filename when the file's contents change?" asked some bright engineer, somewhere. So, we do. We just attach a hash of the file to the filename and serve that. When the file changes, the filename we show the web browser changes, and we can tell the browser to just cache the file forever, or as close to forever as we can!

It's kind of a pain to generate a copy of all of your files with hashes attached, so what clack-static-asset-middleware does is store calculate some hashes of your files and just pretends those files exist and serves up whatever you tell it about.

I also wrote some helpers you can load to use this stuff easily with Djula, like so:

<a href="/" class="logo u-pull-left" title="Home">  <img src="{% asset-path "small-logo.png" %}"       width="54" height="60"       alt="Knttl" /></a>
So, to summarize:
1. Have style.css
2. Template asks for hashed filename, gets something like style_2867f3f83a6a91ad4a19a6cd45536152.css
3. Browser asks for style_2867f3f83a6a91ad4a19a6cd45536152.css
4. Server says "Aha! I have fooled you! Here's style.css! Keep it as long as you like!"
5. Browser says "Golly gee! I will, mister Server! I'll never ask for style_2867f3f83a6a91ad4a19a6cd45536152.css again!"
6. Hooray!
So check out clack-static-asset-middleware, which will hopefully be in quicklisp soon!

We Can Has Doggle
posted on 2016-05-10 01:41:00

I have been a bad blogger lately, as always, but there's something worth throwing a few words onto the internet about.

We've adopted a dog! A little over a week ago, we took a trip out to the North Shore Animal League America and adopted a very mixed breed dog who we've named Wedge after the legendary starfighter pilot from the Battle of Yavin (and the X-Wing series of books that I loved in my teens). It only took us eight hours after the staff lost our application for a while and left us sitting in the dog meeting area hungry and uncertain.

Wedge came from a pupply mill, which means he was probably brought up in a situation where he was kept in a cage all the time and probably wasn't treated like he was a sentient being all that often. If you look around online, you'll find that adopting a mill dog can mean signing yourself up for a fair bit of doggy rehab (figuratively speaking).

For the first week we had him, Wedge was afraid of just about anything at just about any time. You couldn't even give him a treat, half the time! He would walk up to take it and then it was as if the realization of how close he'd come to me hit him about two feet out from my hand. Then he'd turn so fast that his butt and head were going different directions for a moment. It was cute and sad all at the same time!

I'd never really expected to get a dog - the one we had growing up didn't like to do much but steal food and be ornery - so I wasn't really looking for another dog experience. After our trip to Portland, OR, though (which I'm now realizing I didn't write about here! More soon!), we were left with feelings about things that were missing from our lives. Things like really good coffee, vegan donuts, and maybe having a cute dog to stop us from being all depressive a lot of the time (therapist recommended!). Naturally we picked a dog with it's own emotional problem.

Now, Wedge is calming down and doesn't run away from me when I move around the rooms of our tiny apartment anymore. I haven't really had to train a dog before, though I grew up with one, so this is a bit of a challenge. Hopefully, he'll come out of his shell in the next few months and we can take him camping over the summer.

This was kind of fun to write!
posted on 2016-01-16 20:43:00

(defun zip (&rest sequences)  (apply #'map 'list (lambda (&rest args) (,@args)) sequences))

(zip '(1 2 3) '(2 3 4));; => ((1 2) (2 3) (3 4))
Literate .emacs with org mode!
posted on 2016-01-03 17:56:00
For a while now, I'd been meaning to convert my .emacs to the exciting, new style using org mode's literate programming capabilities.

I'd been impressed by the clarity of Sacha Chua's and, while I haven't quite hit that level of cleanliness, yet, I feel much better about how mine looks, now. I also started using John Wiegley's use-package, which I don't completely understand, yet, but it seems to be a real boon for cleaning up loading and configuring packages.

Even setting up slime, which I use through the quicklisp setup, is easy to load:

(use-package slime      :load-path "~/quicklisp/slime-helper.el")

First wikipedia edit!
posted on 2016-01-03 17:45:00
I was working on my typing practice, today, learning the Colemak layout, and came across a small typo in the Wikipedia article on Morris Engines!

It was a simple typo (form -> from), but I decided that was a level I was comfortable contributing at. I didn't notice there was a checkbox for minor edits like typos on the submission page, so I fully expect someone to crawl out of the internet and point it out to me.
Blog Walk Roundup 2015-12-10
posted on 2015-12-10 13:34:00
I spent a bunch of time collecting things around the web today. I think some of these are worth a read, so I'll link a bunch here.

Additionally, I participated in my first Massdrop and got my Code WASD Clears keyboard, yesterday. It's really nice to type on! If you're interested in playing that game, consider using my referral thing (https://www.massdrop.com/r/D2EFXE), because I like what they've done and I'd like a goodie box!

## Neat blog comment policies

From Tim Chevalier's Blog:
If you comment, I have a few requests:

1. Refrain from phobic or discriminatory speech, or speech that (in the words of s.e. smith) suggests that "people don't deserve autonomy, dignity, and a place in society."

2. Refrain from comments that have the effect of silencing or derailing (see Derailing for Dummies for additional examples).

3. As a corollary, refrain from questioning the existence of privilege or systematic oppression. There are many resources available online and offline for learning about these issues.

4. Provide a name or pseudonym that reflects a consistent online presence (as opposed to so-called "throwaway" or "sockpuppet" identities).

Apparently, this is stolen from Christie Koehler's.

## Rust stuff

At work, we've been looking at using Go for a rewrite of a major project. I keep trying to dig into it and have been annoyed by a bunch of things. I still think it could be a nice idea, there, but I have this problem where I get strong affinities for things pretty quickly and I've gotten pretty interested in Rust as, perhaps, and alternative to Go.

I've barely used it yet, but it seems to have nice easy package management, immutable data, a helpful compiler, a type system I can get behind, and whose documentation I can find! For some reason, I feel like it's been difficult to find good explanation of Go.

In any event, I've started working through Rust's book, after using the emacs setup shared here. This has been a long time coming, because I've been hearing about Rust over the years and keep meaning to try it. Reading the blogs above, it turned out that Tim Chevalier worked on Rust, so there was a handy link to a presentation to remind me to check it out!

Both languages are current better than the python 2.7 we use at work, because they both use unicode! Something that should just be standard at this point!

extern crate rand;use std::io;use rand::Rng;use std::cmp::Ordering;fn main() {    println!("Guess the number!");    let secret_number = rand::thread_rng().gen_range(1, 101);    println!("Please input your guess:");    loop {        let mut guess = String::new();        io::stdin().read_line(&mut guess)            .ok()            .expect("Failed to read line");        let guess: u32 = match guess.trim().parse() {            Ok(num) => num,            Err(_) => continue,        };        println!("You guessed: {}", guess);        match guess.cmp(&secret_number) {            Ordering::Less => println!("Too small!"),            Ordering::Greater => println!("Too big!"),            Ordering::Equal => {                println!("Correct!");                break;            }        }    }}

Using Emacs to Study Japanese
posted on 2015-12-06 03:02:00
Tonight, I took my first steps into the world of emacs lisp!

Last January, when I had more time and energy to devote to studying Japanese, I started wondering about using org mode to help me. I was reading articles from the NHK News Easy website and spending a lot of time going back and forth between that, jisho.org, and emacs (where I was keeping my notes).

If you haven't used it, already, jisho is a wonderful site that is the best of what you could hope for in an online dictionary. It's fast, clean, and usually returns the most helpful results without having to fight it too much. I've also spent a bunch of time using LEO and, while I appreciate it, it suffers a bit from over design that hurts usability.

Anyway.

I really wanted to find a way to work in emacs with org mode. Maybe just copy articles from the NHK into a study log and then look up words and insert them under the sentence they were from. Last January, I wrote to the makers of jisho and Kim Ahlstrom was nice enough to write back and let me poke around with an API he'd been working on. Today, I spent a few hours learning my first emacs lisp and making a few functions to query it and format some nice defintions for me!

Starting with a background in Common Lisp was probably pretty helpful, because I was ready to understand the plist's and the like that were involved. Some of the json handling was nicer than in Common Lisp, since emacs seems to let keywords be lowercase by default, as are most of the json key names that they're decoded from. In CL, you need to do a lot of :|property-name| because the reader upcases everything. I also learned that you can modify that behavior and that it is terrifying. I recently had an experience like this, trying to make json access easier for myself:

CL-USER> (readtable-case *readtable*):UPCASECL-USER> (setf (readtable-case *readtable*) :preserve):PRESERVECL-USER> :thing:thingCL-USER> (print "Hello, world!"); Evaluation aborted on #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {1004729173}>.CL-USER> (PRINT "Hello, world!")"Hello, world!""Hello, world!";; ABORT! ABORT!CL-USER> (SETF (READTABLE-CASE *READTABLE*) :UPCASE):UPCASECL-USER> (cl:print "Hello, world!")"Hello, world!""Hello, world!"CL-USER>

Hopefully, I'll be able to share this emacs-jsiho integration work, soon, because I think people would like it. I was asked not to make the API public, so I will wait until I have permission to share. I'm excited to have finally dipped a toe into elisp and, hopefully, I'll have time to refine my code and make it even more useful (like selecting from a list of possible results after searching!) in the meantime, anyway. I was pretty impressed with how easy it was to do API call, parse the JSON and then crawl through it. I have the impression that some parts of elisp are even moldier than CL, but maybe people are making a good effort to modernize it and lower bars.
Emacs for Writers and Notmuch
posted on 2015-11-29 17:03:00
Bored on a Sunday morning and ended up watching Emacs For Writers – a presentation by Jay Dixit, who I'm going to have to look into more, since he seemed like a cool person. It was about how he learned to use org mode to do the work that several word processing programs didn't quite do. He had a lot of fun customizations in his emacs and I might have to watch it again when I'm bored to work out somee other neat things to change. I think it might also finally be time to put my ~/.emacs.d into git so I can get at it on multiple computers and share the things I find at work/home with myself.

One of the things that flashed by in the video was notmuch, the emacs mail browser. Email is more of a pain in the butt than anything useful, these days, as family and friends use phones to contact me and work primarily uses a chat system, but what the hell, I thought, let's try doing email in emacs again (I'd previously tried gnus).

I primarily used the guide here, with some tweaks from here. Ended up modifying the latter a bit to gel with the GObject Introspection that might have come into existence after the wiki-page/python module were written. Works fine with it, though.

import gigi.require_version('GnomeKeyring', '1.0')import keyringdef get_password(account):    return keyring.get_password('offlineimap', account)

It turns out that setting up offlineimap is the bulk of the work and doesn't run automatically, so I basically would need to automate running it or check my mail manually in a two-step offlineimap -> notmuch` workflow? I probably won't actually continue using it, but we'll see!

Unless otherwise credited all material by Matt Novenstern