Monthly Archives: July 2009

Munki and watchedinstall

[watchedinstall][watchedinstall] by [Preston Holmes][ptone] is a tool to monitor what files an installer actually installs. It works for pkg formats and most interestingly it works for custom install applications (i.e. InstallerVise reactionaries).

[Munki][munki] is [Greg Neagle][neagle]’s suite for keeping a bunch of Macs up-to-date with a centrally managed software manifest. I literally *dream* about this kind of problem and how best to cover all the various things one wants to do when managing software on a Mac network.

Somewhat bitter-sweet dreams. I think Macintosh management is interesting, but why couldn’t I have dreamt about girls?

[watchedinstall]: http://ptone.com/dablog/2009/07/watchedinstall/
[ptone]: http://ptone.com/dablog/
[munki]: http://code.google.com/p/munki
[neagle]: http://managingosx.wordpress.com/

Me and Adobe hates you

It’s not true, I don’t hate you, but the [Adobe CS4][cs4] installer does.

I was installing Adobe Creative Suite 4 today on a Macintosh. I had the amazing Adobe CS4 Master Collection media to install from, but all I needed was the Illustrator, InDesign, Photoshop and Bridge. So in the installation process I choose a custom install and de-select most everything except those applications. I un-ticked After Effects because I didn’t want to install After Effects. I un-ticked Soundbooth, I un-ticked Dreamweaver, I un-ticked all them other applications.

The installation process begins. Finally it finishes. Afterwards I had Illustrator CS4, InDesign CS4, Photoshop CS4 and Bridge CS4 installed on my Mac’s hard drive. They all worked a treat.

I also had a dog’s dinner of all the other flipping applications installed, all the applications I did not want to install, I had little vomit stains of Adobe installations that didn’t quite actually install, but installed.

So for example I had a new folder in the Applications folder called “Adobe After Effects CS4” and inside there was an application named “Adobe After Effects CS4.app”. Except it isn’t an actual flipping application. It has a great big no entry icon on it because it isn’t an actual executable application.

CS4 installation mistake

In one sense the installer did what I expected: it did not install a usable After Effects CS4. In another sense it effing ignored what I expected by creating an installation folder for After Effects CS4 and then created an incomplete stub of the After Effects CS4 application.

I wish the Adobe CS4 installer had just done what I asked for. [The Adobe installation and licensing blog is here][oobe].

[oobe]: http://blogs.adobe.com/OOBE/
[cs4]: http://www.adobe.com/products/creativesuite/

Grep template tag for Django

Nice and easy couple of [Django template tags][tagsandfilters] that filter lines of text using a regular expression. I had a block of text where I wanted to remove some of the lines but not others.

You can use `grep` to remove any lines that do not match your pattern:

>>> s = ‘The quick brown fox’
>>> grep(s, ‘quick’)
u’The quick brown fox’

And its converse `grepv` to remove any lines that do match your pattern:

>>> s = ‘The quick brown fox’
>>> grepv(s, ‘quick’)

>>> s2 = s + ‘\nJumps over the lazy dog’
>>> grepv(s2, ‘quick’)
u’Jumps over the lazy dog’

Stick it in a module in your Django application ([documentation][customtags]), then load it up at the top of a template.

from django import template
from django.template.defaultfilters import stringfilter
import re

register = template.Library()

@register.filter
@stringfilter
def grep(value, arg):
“””Lines that do not match the regular expression are removed.”””
pattern = re.compile(arg)
lines = [line for line in re.split(r'[\r\n]’, value) if pattern.search(line)]
return ‘\n’.join(lines)

@register.filter
@stringfilter
def grepv(value, arg):
“””Lines that match the regular expression are removed.”””
pattern = re.compile(arg)
lines = [line for line in re.split(r'[\r\n]’, value) if not pattern.search(line)]
return ‘\n’.join(lines)

[tagsandfilters]: http://docs.djangoproject.com/en/dev/ref/templates/builtins/
[customtags]: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/

The nature and purpose of AppleScript

An amusing sentence from the first chapter of *[AppleScript The Definitive Guide][oreilly]* by Matt Neuberg:

> To find reasons to use AppleScript, just leave your mental annoyance meter turned on.

But don’t forget to switch off your brain once you do start using AppleScript; the frustration of getting anything done with the miserable Macintosh applications that expose their workings via AppleScript never fails to kick my mental annoyance meter into the red.

The following paragraph employs sarcasm. I’ve just being having a wonderful time figuring out that [Adobe InDesign CS3][adobe] keeps the list of items on a page sorted by layer, but sorted in reverse layer order and then sorted forward within each layer. This makes it super sweet when you want to determine if box A in layer 1 overlaps box B in layer 2. Thanks Adobe! Another genius implementation from you guys! You guys fucking rock!

And it isn’t just the fault of the applications you want to script, the language itself is intentionally imprecise in trying to allow programs to be written in natural language. “Whether this English-likeness is a good thing is debateable,” writes Matt Neuberg, but he is being polite because if there is any debate on this question it is a fucking short debate: AppleScript’s English-likeness only serves to have you make mistakes with more confidence.

There is an interesting [history of AppleScript][history] which tantalizes the present-day scripter with the revelation that the language authors wrote a syntax “which resembled Java” but never released it, preferring to support scripts written in fucking French and fucking Japanese!

[oreilly]: http://oreilly.com/catalog/9780596102111/
[history]: http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf
[adobe]: http://www.adobe.com/products/indesign/