Sussex Wired Eduroam 802.1x

I’ve previously used eduroam for WiFi on campus, but as with every new academic year, Sussex uni wireless is broken again. As such I’ve switched over to using ethernet, but noticed that 802.1X doesn’t automatically authenticate like it does with wireless.
Some googling came up with the following,

I can authenticate onto the network just fine, by clicking the ‘Connect’ button in Network Preferences. That’s nice, but every time I boot up my Mac and log in, it doesn’t authenticate automatically

http://arstechnica.com/civis/viewtopic.php?f=19&t=1133237

No answers, but I was able to get it to work by disconnecting ethernet, deleting the RADIUS certificate in Keychain.app, then reconnecting. Authorised the certificate when the pop up asked me to, and now 802.1X seems to connect automatically, and without having to ask for my password.

It still asks for my password when connecting to the wireless access point, but I can live with that.

Advertisements

Romanised Pali Keyboard layout

I’ve created a British keyboard layout for Mac OSX that features romanised Pali diacritics.

Usage:

All of the characters are accessible by using the left Alt (aka option or ⌥) key plus a special key (tilde ~, full stop ., minus -) which represent the diacritic to apply. This changes the keyboard state so that if the next normal upper or lower case character pressed is one of the romanised Pali characters that uses diacritics, then the diacritic is applied to that character.

i.e.,

Press left Alt + minus, followed by a,A, i,I, u,U to get macron:
ā, Ā
ī, Ī
ū, Ū

Press left Alt + tilde, followed by n,N to get tilde:
ñ, Ñ

Press left Alt + full stop, followed by t,T, d,D, n,N, l,L, m,M to get dot-below:
ṭ, Ṭ
ḍ, Ḍ
ṇ, Ṇ
ḷ, Ḷ
ṃ, Ṃ

Press left Alt + shift + full stop (less than symbol <), followed by n,N to get dot-above:
ṅ, Ṅ

In the case of the dotted characters, you can remember the normal dot as being dot-below, and shift-dot as being dot-above, similar to how lower case characters which don't use the shift key are normally lower in height, and upper case characters which use the shift key normally occupy the upper, or higher part of the line.

It can be a bit tricky at first to get the dot-above with upper case characters.
e.g., to produce Ṅ you need to press left Alt + shift + full stop, then shift + n.

Installation:

Save the keyboard layout in ~/Library/Keyboard Layouts/
[EDIT: 2014-04-26] As pointed out by Christoph, some web browsers (such as Safari) might save the file as “British with Pali.keylayout.txt“. You must rename it to remove the “.txt”, so that it’s just “British with Pali.keylayout”.
Log out then log back in again.
Open System Preferences -> Language and Text -> Input Sources
Tick “British with Pali”

Tick “Show Input menu in menu bar”
Click on the Input menu bar and select “British with Pali”

From now on you will be able to enter the Pali diacritics.
Your keyboard layout will stay like this from now on.
If you don’t need to change the layout again, feel free to go back to the Input Sources panel of System Preferences and untick “Show Input menu in menu bar”.

About:
I made this layout with the brilliant Ukelele
For a US layout for OSX and Windows, and which also features Sanskrit diacritics, see Tipitika.org

10.6.8 Upgrade fail

Failed with the following console messages,

11/07/2011 09:52:08 installd[5068] /var/folders/zz/zzzivhrRnAmviuee+++++++++++/Cleanup At Startup/PKInstallSandbox-tmp/Root/private/etc/rc.deferred_install: set times: Operation not permitted

11/07/2011 09:52:08 installd[5068] PackageKit: Install Failed: (null)
Error Domain=PKInstallErrorDomain Code=114 UserInfo=0x1049a7c10 “An error occurred while setting up files for deferred installation.” Underlying Error=(Error Domain=NSCocoaErrorDomain Code=513 UserInfo=0x104c03d50 “You don’t have permission to save the file “rc.deferred_install” in the folder “etc”.” Underlying Error=(Error Domain=NSPOSIXErrorDomain Code=1 “The operation couldn’t be completed. Operation not permitted”)) {
NSLocalizedDescription = “An error occurred while setting up files for deferred installation.”;
NSUnderlyingError = “Error Domain=NSCocoaErrorDomain Code=513 UserInfo=0x104c03d50 \”You don\U2019t have permission to save the file \U201crc.deferred_install\U201d in the folder \U201cetc\U201d.\” Underlying Error=(Error Domain=NSPOSIXErrorDomain Code=1 \”The operation couldn\U2019t be completed. Operation not permitted\”)”;
}

The resolution is similar for the 10.6.3 problem described in https://discussions.apple.com/thread/2384304?threadID=2384304 i.e.,


sudo chflags -R nouchg /

iTunes crashing after Time Machine reinstall

After my laptop drive failure, installation of a new disk, and recovery from Time Machine, iTunes failed to open successfully, reporting,


"You Do Not Have Enough Access Privileges For This Operation"

I’d excluded my Shared user account from the Time Machine configuration, which apparently causes problems for iTunes.

The resolution is to execute the following shell script,


sudo mkdir -p /Users/Shared
sudo chmod -R 1777 /Users/Shared

As described in this article,

http://reviews.cnet.com/8301-13727_7-20051231-263.html

OSX problems

I’d like to be able to rearrange menulets without having to manually mess around with ~/Library/Preferences/com.apple.loginitems.plist

Annoyingly many 3rd party ones don’t seem to support cmd-drag.

It would also be particularly cool to manually open up a new application, then let me drag its menulet somewhere other than the far left (default position for most recently opened.) e.g., Pomodoro is handy, but I often can’t see its timer when other applications are using up the menu bar.

It would be nice if I could also (temporarily) hide some. For example, F.lux is a nice little app, but I don’t need a menulet taking up screen real estate.

Pomodoro

I’ve just started experimenting with Pomodoro.

Version 3.1 is available as a free download, though the more recent versions are commercial only.

It’s customisable, so I’ve configured it to play a nice meditation timer bell (extracted from the free Meditation Timer.app). I used Applescript to make it run, though Pomodoro makes this process harder than necessary:

  • You can’t use cmd-V to paste Applescripts into the box that says “– insert here your Applescript”
  • When opening up the drop-down box to browse for an existing applescript file, it will only allow you to select files that end in .pomo. This is strange and cumbersome because the Applescript Editor only lets you save scripts with extensions .scpt, .scptd, .app, and .applescript.

TeXShop autosave

My laptop overheated today, failed to wake from sleep, and eventually shut down. I lost some work in TeXShop. If it would auto-save this wouldn’t have been a problem. I’m sure this filthy hack has numerous problems, so please feel free to tell me about them in the comments.

$ defaults write TeXShop KeepBackup YES

TSDocument.h
- (void)mySaveTimer: (NSNotification *)aNotification;

TSDocument.m
//At the end of init,
[NSTimer scheduledTimerWithTimeInterval:300.0 // 300 seconds = 5 mins
target:self
selector:@selector(mySaveTimer:)
userInfo:nil
repeats:YES];

// At the end of the file
- (void)mySaveTimer: (NSNotification *)aNotification
{
// [GARETH] Just copy/pasted the content of -saveDocument, and replaced "sender" with "self" in this first line,
[super saveDocument: self];

// if CommandCompletion list is being saved, reload it.
if (!fileIsTex && [[self fileName] isEqualToString:
[CommandCompletionPath stringByStandardizingPath]])
[[NSApp delegate] finishCommandCompletionConfigure];
}

For reference,

“Configuring Run Loop Sources – Configuring Timer Sources”
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/RunLoopManagement.html

“NSTimer Class Reference”
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html%23//apple_ref/doc/uid/TP40003747

“keepBackupFile”
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSDocument_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSDocument/keepBackupFile

EAP Wireless Authentication

The university uses EduRoam for authentication, but it’s really flakey.
When I arrived this morning at 9, it took about 10 minutes until WiFi connected. Understandably there was hardly anyone around at that time of morning.
I did a little research and found a standalone command line client, wpa_supplicant 0.7.3, but had some problems compiling it.

In the end a couple of modifications made it work,

Remove scan_helpers.c from the project as the file doesn’t exist.

Add to the project source the file bss.c
(Possibly also add wpa_supplicant.c & .h and bss.h?)

There are some problems with the sample .config file too.
Line 696: unknown EAP method 'SIM'
You may need to add support for this EAP method during wpa_supplicant
build time configuration.
See README for more information.

These sample blocks need to be commented out.
Similarly for PSK, IKEV2, and FAST.

Also, in order to build wpa_cli, you need to duplicate the wpa_supplicant target, then remove the original main.c and replace it with wpa_cli.c.
You’ll also need to add ../../src/common/wpa_ctrl.c & .h
Also, Right click and Get Info on the target wpa_client, then in the Build tab change Product Name from “wpa_supplicant” to “wpa_cli”

I still haven’t worked out how to configure it to get it running though…
Trying to run the service still fails,

$ ./wpa_supplicant -ien1 -c /etc/wpa_supplicant.conf -dd

WirelessAttach: IOServiceOpen error: e00002c7
OSX: WirelessAttach failed: -2013261827
Failed to initialize driver interface
Failed to add interface en1
Cancelling scan request
Cancelling authentication timeout

Looks like its a driver problem that’s unlikely to be fixed any time soon 😦
There’s a bug report for the macport of “airport”. Similarly QuickSilver had this problem too.

PDF Character encodings

I often try to quote sections of PDF documents into my own, but occasionally come across documents where this is not possible. For example, when I copy the text “Evaluating” from this PDF into another application, it comes out as “#$%&$'()*

I can look at the fonts used in the document,
File->Properties->Fonts

It seems that several font subsets have been embedded, and some of these appear to have random names like “TTE1AE5470t00 (Embedded Subset)”, “Type: TrueType”, “Encoding: Built-in”

The reason that the copied text appears as garbage is because there is no way to map this “Built-in” encoding to (for example) Unicode. However, this doesn’t strike me as a particularly difficult problem (though searching online I couldn’t find anyone who’s managed to resolve it.) Simply by inspection, we can see that there’s a simple pattern going from the “real” text to the encoded garbage:

Evaluating
"#$%&$'()*

i.e.,
E = "
v = #
a = $
l = %
u = &
a = $
t = '
i = (
n = )
g = *

It looks like the PDF format should be able to support a table to convert from this garbage (which is presumably actually something like an index into a glyph lookup table) to Unicode. This conversion table is called toUnicode.

See here for some further info,
http://www.foolabs.com/xpdf/download.html
http://www.perlmonks.org/?node_id=793929
http://www.axsl.org/font/encoding.html

http://www.pdflib.com/products/tet/
“Glyphs without appropriate Unicode mappings are identified as such, and are mapped to a configurable replacement character in order to avoid misinterpretation.”

http://itextpdf.com/
http://pdf.editme.com/font-glyph-encoding
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/5411.ToUnicode.pdf

It is possible to do this conversion with a bash script, but it does involve manually copy/pasting each character in the set like this,

#!/bin/bash
uppercaseSource="UGB<\"RMN)Cbc@_e8d?\`;"
lowercaseDest="abcdefghijklmnopqrstuvwxyz"

numberSource="IFQSWHYZEG"
numberDest="1234567890"

symbolSource="A=]^TOaLn!"
symbolDest=".,()&\-':/ "

fullSource=$uppercaseSource$lowercaseSource$numberSource$symbolSource
fullDest=$uppercaseDest$lowercaseDest$numberDest$symbolDest

# [GARETH] The tr -s bit is to remove duplicate spaces as sometimes my doc uses ! to represent space, but also uses ! followed by a space at other times.
tr "$fullSource" "$fullDest" | tr -s \

iWork Numbers

I’ve been trying to use iWork Numbers ’09 (V2.0.4 – 184) recently, and have some significant problems that have resulted in me transitioning to Open Office Calc instead.

  • Automatically recalculates all formulae on every single change, regardless of whether that’s necessary or not.
  • Maximum of 255 columns.
  • No Transpose feature.

These issues make it impractical to use Numbers for substantial spreadsheets. It’s really only useful for small, home use.
Any recommendations for a large-scale spreadsheet application for OSX?