Bookmark this site!

2009-10-05

MacPorts on Snow

MacPorts on Ice?

the move from Leopard to Snow Leopard can be slippery

... emacs-app won't compile; different versions of python fall over each other; NLTK won't build ...

Here are some tips others have found helpful:

try

% sudo port selfupdate
% port installed
% sudo port uninstall installed
sudo port selfupdate
brings your MacPorts installation up to date. If this fails you should just start over
port installed
shows you what you currently have installed.
Much of what you see you won't recognise as this also lists the prerequisites installed to support the things you asked for explicitly.
sudo port uninstall installed
removes all your installed ports

or just start over

I had some problems when I moved to snow leopard, so I also removed all trace of macports

sudo rm -rf /opt/local \
/Applications/MacPorts \
/Applications/DarwinPorts \
/Library/Tcl/macports1.0 \
/Library/Tcl/darwinports1.0 \
/Library/LaunchDaemons/org.macports.* \
/Library/StartupItems/DarwinPortsStartup \
/Library/Receipts/MacPorts*.pkg \
/Library/Receipts/DarwinPorts*.pkg \
~/.macports

then reinstall MacPorts

use the Snow Leopard MacPorts disk image

then do

% sudo port selfupdate

check

which ports are available for snow-leopard? before you decide which ports to install.

% sudo port install  <????>
sudo port install <????>
will install whatever you specify
<????> should be a space- separated list of port names,
with no <   >

There is a problem with emacs-app—and we can't work without emacs...

install emacs-app

To install emacs-app, first download emacs-app-Portfile-snow-leopard.patch
and
emacs-23.1-snow-leopard.patch

% sudo port clean emacs-app
% sudo port install emacs-app
% cd $(port dir emacs-app)
% sudo patch -p0 < ~/Downloads/emacs-app-Portfile-snow-leopard.patch
% sudo cp ~/Downloads/emacs-23.1-snow-leopard.patch ./files/
% sudo port -D . install

Works for me, but your mileage may vary ....

2009-08-02

iPhone overheating

If the sun gets too hot, treat your iPhone to a moist towel and a hat.

The Tech Specs say: Operating temperature: 32° to 95° F (0° to 35° C). Summers in Greece are long and dry, with temperatures often exceeding extremes of 37°C (99°F).

Sailing in Greece the temperature went high, the iPhone overheated, and defensively stopped charging—it said it was charged, which was confusing, as it wasn't. When it got really hot it just gave up altogether and shut down. Our Humminbird Fishfinder GPS unit also shut down from overheating—even before the iPhone did.

How to keep your iPhone cool? Take a moist paper towel, folded to the size of the back of the phone. Put it on the back of the phone and ensure that the air can get to it so that the moisture evaporates gradually. You'll need to take the paper towel off from time to time to moisten it again.

I also used a hat to keep the phone in the shade.

This enabled me to keep navigating with Navionics GPS software in the relentless Greek sun.

2009-06-17

iPhone 3.0

released at 17:25 GMT 230.1MB

17:28 GMT still downloading ...

17:45 GMT up and running—it feels faster

Apple don't make it easy to find the instructions for using new features.

You can test MMS by sending a picture to yourself (the interface in messages, which was SMS, lets you take and send a picture, or send one from your photo album). If MMS doesn't work, prompt O2 to direct your MMS messages to your phone (instead of to a web page as before) by texting the message "MMS" to 1010.

To see Google StreetView on maps, drop a pin on the street you want to view. The StreetView icon appears on the pin label; click it. (This isn't new to 3.0, but it's new to me.)

2009-06-10

MacBook Air freeze: reset SMC

Daily, I take my MBA to work, and connect it to my 30" cinema display. At the end of the day I disconnect and take it home. Once back home, I plug into the 24" LED display and keep on working. The MBA sleeps while I'm cycling to and fro — and wakes up when I plug it in.

Today, I got home, plugged in, and found a blank screen. I waited; nothing happened. I waited some more. Eventually I gave up waiting and did a forced shut-down, by pressing and holding the power button.

To restart, I pressed the power button. The chimes, and the apple came up just as usual; then the little wheel thing came up, but it didn't move. I waited — nothing. I plugged in, unplugged, opened. closed, shut-down (again) etc. I tried all of this again, and again, in various permutations, and with plenty of waiting — nothing. Frozen as a dead parrot!

So, I reset the System Management Controller — that worked :-)

To reset the SMC: Shutdown; plug in to mains power; hold down shift-ctrl-alt (alt is aka option) on the left side of the keyboard, and press the power key once; then release the keys, wait 5 seconds, and press the power key to restart. Effective magic!

The SMC includes the Power Management Unit (PMU) you may be familiar with from other devices.

2009-06-04

Pipex > Tiscali >TalkTalk

I've been with Pipex for years. Tiscali took over in March. A couple of weeks ago my internet service went crazy.

Some sites worked: for example, Google seemed OK.

Some sites didn't: Facebook wouldn't load.

Others were erratic. The Guardian front page loaded fine — but none of the links. FirstDirect almost worked — I could look at my balances, and set up a transfer, but the final step of confirmation would hang, and hang, and never complete.

The solution: the MTU (Maximum Transmission Unit) on my Speedtouch 510 was set to 1500. Tiscali (or maybe its already TalkTalk) don't do 1500 — they do 1492 (familiar as the year Columbus set sail).

My configuration file now says (in ip.ini)

ifconfig intf=loop mtu=1492 group=local
ifconfig intf=eth0 mtu=1492 group=lan
ifconfig intf=pppoa mtu=16384 group=wan

and everything appears to be back in working order.

There's a lot of discussion of different values on the web. The 16384 above is 16K, the actual MTU used by the pppoa interface (which links me to my ISP) is negotiated down from this value by the Speedtouch 510. The ip iflist command (use this via the telnet interface to the Speedtouch 510) tells you this negotiated MTU value for the pppoa interface (and also the values you have specified for the loop and eth0 interfaces). The MTU for loop and eth0 should be set to the same value as is negotiated for pppoa.

=>ip iflist
Interface       GRP MTU   RX        TX        TX-DROP  STATUS
0  loop         1   1492  2147      0         0        UP   
1  eth0         2   1492  12453866  234402217 0        UP   
2  pppoa        0   1492  234257958 12256628  0        UP

2009-04-28

802.1X on iPhone

iPhone Device Configuration

This post can also be accessed from http://tinyurl.com/8021xiphone

You can download a configuration for the University of Edinburgh central-wpa wifi, eduroam and IPsec (Cisco) VPN from http://homepages.inf.ed.ac.uk/mfourman/iphone/UoE.mobileconfig
or http://tinyurl.com/uoecfg

This is signed by me with the self-signed certificate at http://homepages.inf.ed.ac.uk/mfourman/iphone/MichaelFourmanCA.cer
or http://tinyurl.com/ouosp5

You can first download and accept the certificate, and then install the profile, or just install the profile and accept the profile on a one-off ad hoc basis when asked.

When you install the profile, you'll be asked to provide your UUN and passwords for the UoE systems. For the VPN use your UUN and EASE password; for central-wpa use your UUN and EASE password; for eduroam use an extension of your UUN as follows: @ed.ac.uk and your EASE password.

Once installed you won't need to enter these again!

Let me know if this also works for iPod Touch!

If you want to check my certificate, you may need these:

SHA1 fingerprint 8F 89 CF 00 78 C8 31 B8 6A 56 93 99 
                               13 A6 8F 2B 3B C7 2A 29
MD5 fingerprint  95 80 D6 9C C4 60 4B 86 A0 8A  6F BA 
                              22 42 38 8D
Public Key signature 52 2C 64 BC DD 9B 55 F6 A4 96 36 02 
6D EE 3C DC CE B0 58 A5 C3 8C 9E 25 D3 DD 48 94 B3 3A 
48 05 A7 26 47 5F C7 03 29 0A 2F B0 A8 1D 7C C4 9B 20 
23 57 AA 42 06 3E 9B 94 E6 B2 9D 3D BA 33 39 FC BB 5D 
4C EC 5A B7 5F B0 B2 12 1F A2 8E 93 39 C1 C0 A2 3A F8 
3A 86 24 0C AC 16 A4 36 A7 B6 B1 A5 7D 55 AB 88 DE 
3F 2E 19 AC B3 BC E4 21 44 14 01 91 FF BD 6F D6 18 07 
4A E2 BE 8E E0 A8 57 4C F3 E9 62 5A 34 63 AE BC 84 6D 
DC 19 CF D8 4B 60 67 A1 D8 40 47 59 92 88 02 86 0B 89 
C0 A8 79 22 57 FF E7 77 5B BF 9C 49 FF A9 43 70 92 07 
10 A1 0C D6 67 73 5F 95 3F AE 5D 49 40 FC 0F 49 C1 9A 
5F C4 EC 9D 7A 5D 30 2B 5F F7 2A 26 CB 4C BE 96 3D A2 
0C 81 E3 44 D4 D6 70 31 D5 E1 37 C4 41 13 49 AD 5D F4 
2B A8 60 D5 EC 69 57 0F AB 7F 03 A1 75 85 55 75 F3 C4 
D7 2A 67 E8 66

The iPhone Configuration Utility allows you to set up and install profiles that give access to 802.1X authenticated WPA wifi. It also gives you access to the iPhone console log, so you have some chance of debugging your configurations when things go wrong.

To see the console log connect to your iPhone via USB cable, your phone appears as a DEVICE—select it and the Console tab.

A profile can include a number of sections: General, Passcode, Wi-Fi, VPN, Email, Exchange, Credentials, and Advanced. It is recommended to create a number of specific profiles for different tasks, rather than one mega profile including everthing, as a modular approach is easier to manage. In particular, if you change a profile and reinstall it, you have to enter all the passwords it requires anew, so the modular approach goes faster.

After some experimentation I now have three profiles: one for WiFi+VPN, and two more for IMAP configurations for staffmail and gmail.

The first (WiFi + VPN), includes the University certificate(s), configuration for our IPSec (Cisco) VPN, and two WiFi profiles. These are University of Edinburgh service central-wpa, and the confederated EDUcation ROAming service, eduroam which should allow me connect back to the same UoE service from almost any academic institution in Europe, Japan or Australia.

It's all a bit confusing, as the documentation for our 802.1 setup is sketchy. For example, I found that I had to install not just the self-signed University of Edinburgh CA root certificate authority, for the VPN, but also the intermediate certificate authority Cybertrust Educational CA, which is the issuer for the certificates presented by the WiFi servers, and is not in the standard Apple list of System Roots. Looking at the log helps.

To add a certificate, make sure it is in the System keychain (so not tied to your administrator account on the Mac) and is trusted. Then use Keychain Access to export it as a .cer file and then import this .cer file into a profile, under the Credentials tab. Note that, even if using multiple modular profiles, you cannot install the same certificate twice.

For the VPN use your UUN and EASE password; for central-wpa use your UUN and WiFi password; for eduroam use @ed.ac.uk and your EASE password.

To test eduroam, I switch between the two WiFi profiles. Switching doesn't work properly: each time I have to make (3) repeated attempts, leaving and returning to the Settings App between attempts. Nevertheless, at least this behaviour is repeatable. I look forward to trying eduroam on the road.

Once you've done this, setting up the two Email profiles seems easy. Just set up the account, working from a tried and tested setup, by looking at the account settings for Mail on your Mac - except the Mac doesn't tell you which port it uses for SMTP. On my University account I use imap.staffmail.ed.ac.uk:993 for incoming, and the authenticated smtp.inf.ed.ac.uk:465 for outgoing. For Gmail it's imap.gmail.com:993 and smtp.gmail.com:587. Note the small twist: secure SMTP on Gmail uses port 587, whereas the Informatics authenticated SMTP uses 465. It seems Google does the right thing and 465 is non-standard legacy stuff!

I can't get my Pipex mail set up this way because the Tiscali certificate presented doesn't match the server address. I can override this error if I install the setting by sync with the Mac in iTunes, or enter it manually, but if I set up a profile, it just fails—and the console log says, "an SSL error occurred".

2009-04-14

Wireless Keyboard lost?

How to make a bluetooth device a favorite






My MacBook Air has problems finding my wireless keyboard. It is paired, but not seen. I have to go through the whole rigmarole of adding a new device to make it visible. Why?

Sometimes Bluetooth preferences lets me connect; sometimes not.

My Keyboard isn't a favourite! Solving this should be easy—just use Bluetooth panel in System Preferences.

There's an obvious button to press in Tiger; but on Leopard it's hidden.

Solution

Open Bluetooth Preferences ...

Select your device (Keyboard or whatever).

For an immediate fix select Connect from the settings menu.

For something longer-lasting, select Show More Info

The trick: From the settings menu (which has now changed) select Add to Favorites. You're done.

Sometimes it shows connected but still no keystrokes appear: Disconnect and then Connect using the settings menu.

2009-04-01

MacTex

Finally, I found the solution for LaTeX on the Mac. I've been using MacTex for a month or so and it seems really solid. It has its own updater, the TeXLive utility, which allows you to keep your installation up to date. Your own local styles can be installed in ~/Library/texmf/tex/latex. BibTeX .bib files go in ~/Library/texmf/bibtex/bib or subfolders of this directory, and .bst files go in ~/Library/texmf/bibtex/bst or subfolders of this directory.

A system local texmf tree, which can be accessed by all users on a machine, can supposedly (untested by me) be placed in /usr/local/texlive/texmf-local.

This installation includes LaTeXiT, a utility I've mentioned before, that lets you easily produce PDF, EPS, TIFF, PNG, or JPEG files from LaTeX snippets. It can produce fully scalable PDFs with stroked fonts, for inclusin in presentations and posters. LaTeXiT also includes a LaTeX palette that allows you to select AMS symbols, operators, arrows, etc. from a graphical display.

LaTeXiT stores the LaTeX source within the PDF document it produces—if you want to edit your presentation later, just paste the PDF back into LaTeXiT and you can edit the source. Unfortunately, Keynote 5.0.1 doesn't seem able to access the LaTeXiT services, and LinkBack doesn't seem to work—but cut-and-paste isn't so hard.

The Grapher utility (in Applications/Utilities) also integrates with LaTex. Type a formula into Grapher, which provides a fairly intelligent wysiwyg interface (use ^ for exponents, / for fractions, "log" for log, "pi" for π, etc.). The arrow keys (all four of them) allow you to move around. Ctrl-(or right-)click on the selected equation will allow you to copy the LaTeX source for this equation (and it normally makes a better job of the latexography than I do).

2009-03-31

Skype on iPhone–iChat next?

VoIP on iPhone. Find free Skype for iPhone on the App Store.

It works–Skype calls over WiFi–and the quality seems better than Fring or TruPhone.

Why hasn't Apple got an iPhone version of iChat yet–or Gizmo5 to give us a free SIP phone?

2009-03-25

USB Ethernet "not connected"?

Oh, yes it is!

"Oh, no it isn't," says System Preferences.

Physically it is connected. The ethernet works fine when I try it with another laptop. But my MacBook Air has no network connection.

Solution

Not sure what causes this, but it seems to arise when moving from one network to another — work to home. Until Apple fix their bug, one workaround is as follows:

  • Open System Preferences >> Network
  • Select USB Ethernet in the ports list.
  • Click the - sign at the bottom of the ports list to delete your existing USB Ethernet port
  • Click the + sign, to add a new one; select the new one click Apply.

If you're lucky (it's worked for me a couple of times already) you will find that, after a short pause, the USB Ethernet n port you just created now works as normal.

If the option to create a USB Ethernet port doesn't appear, check that you have the ethernet adapter dongle plugged in. This seems to be neccessary.

If it still doesn't appear (sometimes it doesn't), restart and try again. This has always worked for me (so far).

2009-03-14

Wireless again

As long-time readers of this blog will know, I have an extended wireless network. It now includes two daisy-chains and one spur: a daisy-chain on 802.11n (5GHz) with a TimeCapsule (which has internet connection from my ADSL modem/router) and two Extremes; a daisy-chain on 802.11g (2.5GHz) with older kit — two Extremes (one connected by ethernet to the remote end of the 802.11n chain) and three Expresses.

Autoconfigure was a welcome feature of the 802.11n Express. It was great — when it worked — but it was always flakey.

With the 7.4.1 firmware update my setup became completely unstable. In particular, whenever Time Machine started a backup the network would auto-reconfigure, and break. I had to use an ethernet connection direct to the Time Capsule to make a backup. I've now reverted to a manual setup of the WDS with explicit MAC numbers. All appears stable, my iPhone is back on WiFi and backup over wireless is working again.

If you're having problems with an autoconfigured wireless network, try going back to manually configured WDS. Use Airport Utility. First make a note of the Airport ID (MAC number) for each of your devices. Then, one-by-one switch from Create a Wireless Network or Extend a Wireless Network to Participate in a WDS Network. A WDS tab will appear. Under this tab you can see (and manually adjust) the autoconfigured setup. In my case I found that two Extremes were trying to act as WDS main.

As usual, be careful to update the various access points in an order that doesn't leave you unable to access some device over wireless. If you do get into that sorry state, a direct ethernet connection can be used to reconfigure the lost device.

2009-03-09

Google Base encoding woes

Google Base lets you upload descriptions of goods, services, publications—or whatever—to enable the world to find your stuff.

You can do this item-by-item, using a web form, or in bulk by submitting an RSS or Atom feed as an xml file.

So far, so good ...

But ...

If you want to use extended character sets (eg. characters, ξ € я þ ø æ œ and accents, å ç ê ñ ü ) you will naturally use utf-8 or unicode encoding.

So, I set up the feed for utf-8 encoding, and uploaded the xml using Direct Upload via Google Base, Google's file upload interface ...

Once my feed was processed, Google said, Your data feed contains an invalid character for the current encoding setting.

I tried File Transfer Protocol, uploading via ftp to google.uploads.com. Google still didn't get the right encoding (I think Google was at fault here).

I tried Automatic upload via scheduling. This probably failed because my ISP's server insists on sending a content header saying it is serving everything in ascii—Google did the "right thing" and believed this travesty.

So, nothing worked: Your data feed contains an invalid character for the current encoding setting.

Solution: use xsl:output to encode your feed in ascii

Here is a simple xsl transform to copy an xml file and change its encoding. The important line is the attribute encoding="us-ascii", in the xsl:output element.

toascii.xsl

<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output
     method="xml"
     version="1.0"
     encoding="us-ascii"
     />

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template 
     match="*|@*|comment()
             |processing-instruction()|text()">
    <xsl:copy>
      <xsl:apply-templates
    select="*|@*|comment()
             |processing-instruction()|text()"/>
    </xsl:copy>
  </xsl:template>
</xsl:transform>

utf8.xml

<?xml version="1.0" encoding="utf-8"?>
<sample>
  characters, ξ € я þ ø æ œ 
  and  accents, å ç ê ñ ü
</sample>

Executing the command

xsltproc -o ascii.xml toascii.xsl utf8.xml
produces an ascii-encoded version:

ascii.xml

<?xml version="1.0" encoding="us-ascii"?>
<sample>
  characters, &#958; &#8364; &#1103; &#254; &#248; &#230; &#339; 
  and  accents, &#229; &#231; &#234; &#241; &#252;
</sample>

If you are already using xsl to produce your feed, just add encoding="us-ascii" to the xsl:output element. If you have it by some other means you can use the identity transform given above.

2009-03-07

Adjust brightness for 24 inch LED Cinema Display?

I think that the F1/F2 keys on my MacBook Air used to adjust brightness of the primary display. In any event, they certainly don't now (10.5.6) allow me to adjust the brightness of my 24" LED display—they adjust the brightness of the MacBook Air screen, whichever display is selected as Primary.

However, the Display tabs of the Display panels of System Preferences allow you to adjust the brightness of each display independently.

2009-02-16

ant ftp task libraries:
jakarta-oro; commons-net

A problem

Update: 6 April 2012 This stopped working again. Adding ant-commons-net-1.7.1.jar to ~/.ant/lib resolved the problem.

My installed version of ant (I presume from Developer Tools) doesn't support the ftp task:

$ which ant
/usr/bin/ant
$ ant -version
Apache Ant version 1.7.0 compiled on August 25 2008
$ ant -diagnostics | grep ftp.*Available
ftp : Not Available (the implementation class is not present)
$

The manual says To use the FTP task, you need jakarta-oro 2.0.8 or later, and commons-net

Sounds simple—just find the right .jar files and put them in ~/.ant/lib

jakarta-oro-2.0.8.jar is easy to find.

commons-net-2.0.jar is also easy to find, as is commons-net-ftp-2.0.jar —but they don't work. For example:

$ ls ~/.ant/lib
commons-net-2.0.jar jakarta-oro-2.0.8.jar
$ /usr/bin/ant -diagnostics | grep ftp.*Avail
ftp : Not Available (the implementation class is not present)
$

ant-commons-net-1.7.1.jar does work with Ant version 1.7.0 — and you can find it if you look.

But there is an easier way...

The solution

Update to Ant version 1.7.1 (I did this from MacPorts with Porticus; Fink also has this version):

$ which ant
/opt/local/bin/ant
$ ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
$ant -diagnostics | grep ftp.*Available
$ ls ~/.ant/lib
$

The MacPorts installation includes the requisite java archives. (I haven't tested the Fink install.)