Posts Tagged ‘10.5’

During upgrade to snow leopard stuck on apple logo

Tuesday, March 15th, 2011

Yesterday I finally got around to updating the OS on my macbook pro from Leopard (mac os x 10.5) to Snow Leopard (mac os x 10.6). I had debated waiting until Lion (10.7), set to appear this summer, but while I would probably want to wait until it had stabilized in the fall and applications were already turning their backs on Leopard I decided to just give in early.

I bought the Snow Leopard DVD, inserted it, pushed start and let it go. For about 30 mins it had a standard dialog box and progress bar, reporting that it was busy unpacking and installing. Then it rebooted itself at hung on the apple logo start up screen for 3 hours.

I read a few other reports of this online and it seemed a lot of people had given up sooner than 3 hours and had lots of problems, so I let it go. The computer started getting warm after a few hours: the DVD drive seemed to be busy the entire time. Finally I gave up and held the power button to force a shutdown. When I restarted it never even got to the apple logo, just a grey screen.

At this point I really gave up. Being in New York, where there is a 24 hour apple store it’s easy to give up. I held the power button down to force another shutdown and biked my laptop to the Genius Bar.

There the clerk told me that the installation had paused for whatever reason only partly done. He force ejected the DVD then plugged in a Firewire drive and finished the installation booting from the Firewire device.

After 45 mins everything was installed and so far everything has been working fine.

Compiling and using ARPACK on Mac OS X

Saturday, November 27th, 2010

Computer programming paleontology

Recently we have been prototyping using MATLAB’s eigs. It is an extremely easy to use eigen-decomposition tool that works on sparse matrices. It allows you to choose how many eigenvalues you want from which end of the spectrum (smallest or largest magnitude). Here’s an example of how easy it is:


% Build a sparse 100 by 100 second-order finite-difference Laplacian matrix
A = delsq(numgrid('C',10));
% Get 5 smallest magnitude eigenvectors (columns of V) and eigenvalues
% (diagonal of D).
[V,D] = eigs(A,5,'sm')


After some digging around for a C/C++ equivalent I found that MATLAB is interfacing ARPACK. For some reason ARPACK feels ancient, but it’s actually been around since only 1996 and seemed to be maintained at least as recently as 2008. Trying to compile it though felt like what it must have felt like for Otto Lidenbrock to find dinosaurs living at present day (only near the center of the earth).

Compiling ARPACK

I loosely followed these helpful instructions. This also assumes that you have a universal (32-bit and 64-bit) build of f2c, if not I have previously posted instructions.

Use zcat to patch the directories. If Safari auto uncompresses the .zips you may have to start over with pure zips to be sure that it’s being done as instructed here.

Edit the ARmake.inc file, to look like this:


home = .
BLASdir      = $(home)/BLAS LAPACKdir =$(home)/LAPACK
UTILdir      = $(home)/UTIL SRCdir =$(home)/SRC
DIRS         = $(UTILdir)$(SRCdir)
ARPACKLIB  = $(home)/libarpack.a .SUFFIXES: .f .o .DEFAULT: @$(ECHO) "Unknown target $@, try: make help" F2C = f2c F2CFLAGS = -ARw8 -Nn802 -Nq300 -Nx400 CC = cc CFLAGS = -arch i386 -arch x86_64 -O CD = cd ECHO = echo MAKE = /usr/bin/make RM = rm RMFLAGS = -f help: @$(ECHO) "usage: make ?"


Edit Makefile, to look like this:


include ARmake.inc

PRECISIONS = single double complex complex16

all: lib

lib: arpacklib

clean: cleanlib

arpacklib:
@( \
for f in $(DIRS); \ do \$(CD) $$f; \ (ECHO) Making lib in$$f; \
$(MAKE)$(PRECISIONS); \
$(CD) ..; \ done ); cleanlib: ( cd$(BLASdir); $(MAKE) clean ) ( cd$(LAPACKdir); $(MAKE) clean ) ( cd$(UTILdir); $(MAKE) clean ) ( cd$(SRCdir); $(MAKE) clean ) help: @$(ECHO) "usage: make ?"


Edit SRC/Makefile to look like this:


include ../ARmake.inc

SOBJ  = sgetv0.o slaqrb.o sstqrb.o ssortc.o ssortr.o sstatn.o sstats.o \
snaitr.o snapps.o snaup2.o snaupd.o snconv.o sneigh.o sngets.o \
ssaitr.o ssapps.o ssaup2.o ssaupd.o ssconv.o sseigt.o ssgets.o \
sneupd.o sseupd.o ssesrt.o

DOBJ  = dgetv0.o dlaqrb.o dstqrb.o dsortc.o dsortr.o dstatn.o dstats.o \
dnaitr.o dnapps.o dnaup2.o dnaupd.o dnconv.o dneigh.o dngets.o \
dsaitr.o dsapps.o dsaup2.o dsaupd.o dsconv.o dseigt.o dsgets.o \
dneupd.o dseupd.o dsesrt.o

COBJ  = cnaitr.o cnapps.o cnaup2.o cnaupd.o cneigh.o cneupd.o cngets.o \
cgetv0.o csortc.o cstatn.o

ZOBJ  = znaitr.o znapps.o znaup2.o znaupd.o zneigh.o zneupd.o zngets.o \
zgetv0.o zsortc.o zstatn.o

.f.o:
$(F2C)$(F2CFLAGS) $*.f$(CC) $(CFLAGS) -c$*.c
$(RM)$*.c

all: single double complex complex16

single: $(SOBJ) double:$(DOBJ)

complex: $(COBJ) complex16:$(ZOBJ)
#
#  clean	- remove all object files
#
clean:
rm -f *.o a.out core *.c


Edit UTIL/Makefile to look like this:


include ../ARmake.inc

OBJS  = icnteq.o icopy.o iset.o iswap.o ivout.o second.o

SOBJ  = svout.o  smout.o

DOBJ  = dvout.o  dmout.o

COBJ  = cvout.o  cmout.o

ZOBJ  = zvout.o  zmout.o

.SUFFIXES:      .o .F .f

.f.o:
$(F2C)$(F2CFLAGS) $*.f$(CC) $(CFLAGS) -c$*.c
$(RM)$*.c

#
#  make the library containing both single and double precision
#
all: single double complex complex16

single: $(SOBJ)$(OBJS)

double: $(DOBJ)$(OBJS) $(ZOBJ) complex:$(SOBJ) $(OBJS)$(COBJ)

complex16: $(DOBJ)$(OBJS) \$(ZOBJ)
#
#  clean	- remove all object files
#
clean:
rm -f *.o a.out core *.c


Now you can build all of the .o object files with:


make lib


So far we have not assembled the static library, to do this issue:


libtool -o libarpack.a SRC/*.o UTIL/*.o


Using ARPACK

Travel to EXAMPLES/SIMPLE

Then you can convert the fortran file to a c file with:


f2c sssimp.f


Then compile with:


gcc -arch i386 -arch x86_64 -framework Accelerate -lf2c ../../libarpack.a sssimp.c -o sssimp


And finally run with:


./sssimp


You should see something like:



_saupd: number of update iterations taken
-----------------------------------------
1 -    1:     1

_saupd: number of "converged" Ritz values
-----------------------------------------
1 -    1:     4

_saupd: final Ritz values
-------------------------
1 -    4:   5.040E+02   5.050E+02   5.177E+02   5.475E+02

_saupd: corresponding error bounds
----------------------------------
1 -    4:   0.000E+00   0.000E+00   0.000E+00   0.000E+00

==========================================
= Symmetric implicit Arnoldi update code =
= Version Number: 2.4                    =
= Version Date:   07/31/96               =
==========================================
= Summary of timing statistics           =
==========================================

Total number update iterations             =     1
Total number of OP*x operations            =    20
Total number of B*x operations             =     0
Total number of reorthogonalization steps  =    20
Total number of iterative refinement steps =     0
Total number of restart steps              =     0
Total time in user OP*x operation          =      .000000
Total time in user B*x operation           =      .000000
Total time in Arnoldi update routine       =      .000000
Total time in saup2 routine                =      .000000
Total time in basic Arnoldi iteration loop =      .000000
Total time in reorthogonalization phase    =      .000000
Total time in (re)start vector generation  =      .000000
Total time in trid eigenvalue subproblem   =      .000000
Total time in getting the shifts           =      .000000
Total time in applying the shifts          =      .000000
Total time in convergence testing          =      .000000

Ritz values and relative residuals
----------------------------------
Col   1       Col   2
Row   1:    8.63063E+02   0.00000E+00
Row   2:    8.86061E+02   0.00000E+00
Row   3:    9.19768E+02   0.00000E+00
Row   4:    9.48391E+02   0.00000E+00

_SSIMP
======

Size of the matrix is  100
The number of Ritz values requested is  4
The number of Arnoldi vectors generated (NCV) is  20
What portion of the spectrum: LM
The number of converged Ritz values is  4
The number of Implicit Arnoldi update iterations taken is  1
The number of OP*x is  20
The convergence criterion is   0.


LaTeXiT on Mac OS X 10.5 with macports

Saturday, July 3rd, 2010

So I downloaded the LaTeXiT.app binary on my MacBook Pro running 10.5. It would run as if it were generating the images correctly but then not show anything. I had installed latex, pdflatex via macports, so I thought I had everything I needed.
It seems that I was missing dependencies: libpaper, ghostscript.
I found this out by trying to install latexit via macports directly:

sudo port install latexit

Surprisingly this command failed to build latexit, but the good news is that then the LaTeXiT.app binary worked as it should. Not really a solution, but worked for me.
Note: It’s worth noting that this did not happen on my 10.6 machine, where I had also installed everything via macports.

terminal slow on snow leopard

Saturday, July 3rd, 2010

On my Mac os X 10.6 machine at work I’ve suffered from slow scroll speed using vim with syntax highlighting in Terminal.app. The screen refreshes very slowly when using colored syntax highlighting in vim and only in Terminal.app (xterm is fine, but I don’t like to have to start x11 and all just for a terminal, and anyway Terminal.app is fine otherwise).

Apparently something got broken during Terminal.app version 2.0.2 and Terminal.app version 2.1, the latter even being 64-bit. Who knows what it was but I can find any reason to use the new Terminal so I will use the old one on the new machine.

I’m backing up my old copy of terminal, but you should probably find your own to be safe. The scroll speed works fine with the old Terminal.app. Just drag it over from an intel machine and it should work find. All my bash profiles and vimrc loaded just fine, so I didn’t need to set anything else up.

Monday, June 28th, 2010

I never had this trouble on my mac os x 10.5 machine, but now on 10.6 I’m getting errors when including X11 libraries. When I try to compile using -lX11 or -lXext I get complaints from the linker like




or




To fix this you could modify your environment paths, or add the following to your compile flags:


-L/usr/X11/lib


I do that and everything compiles and links fine.

Monday, June 21st, 2010

I’ve taken another swing at making a brightness menulet like the volume menulet. My old version could only toggle brightness (because of UI problems). But the new version is a full on slider!

Here’s the xcode project and intel/ppc builds for at least mac os x 10.5:

Note: This menulet (and the original brightness code) does not work with 10.6 on my Mac Cinema HD display, but it does work with 10.6 on my girlfriend’s MacBook.

Thursday, March 4th, 2010

I took a first crack at making a Cocoa menulet for Mac OS X. I wasn’t quite able to do what I wanted to do. But it looks like it might be possible.
What I wanted was to make a brightness slider menulet. It would function the same as the System Volume menulet:

I couldn’t yet figure out how to put the slider in the menu bar, so for now I have a brightness toggler:

It was also my first real coding with xcode. Here’s my project and the app for intel and power pc (not sure if ppc will work). I assume this will only work on OS X 10.5 but you tell me.

Most (almost all) of this code is unoriginal. See: the brightness source, the menulet tutorial.

Note: See the new version!

Repost of brightness binary

Thursday, February 4th, 2010

I’ve been searching in vain for a long time for a way to control my displays’ brightness via the command line (terminal). I finally found a small c program written by Nicholas Riley. I won’t repost the code, but here’s the intel binary (just in case I lose it, I guess).

Robo-poetry

Monday, January 18th, 2010

I challenge the internet to start a new genre of robot poetry. It can be humans reading robot generated poetry, robots reading human poetry, robots reading robots poetry or even just human poetry about robots and the reading there involved.

Here’s a little something to get the ball rolling as they say:

By the way, I generated the above on my Mac (10.5) using this command:


say -v Alex -o row-your-boat.aiff "Row, row, row your boat. Gently, down the stream. Merrily, Merrily? Merrily. Life, is but a dream"


Mac OS X 10.5 “Don’t save” keyboard shortcut

Monday, January 11th, 2010

On OS X 10.4 I used to be able to “tab through” the options of the “Don’t save, Cancel, Save…” dialog. On 10.5 the glowing tab tracer does not show up, but finally I’ve found the keyboard shortcuts to each.

Option Keyboard shortcut
Don’t save D
Cancel esc
Save… return or enter