Just a reminder to me: to convert an IDL number to a string, use string! `` s = string(x,format='(F10.5)')`` Also, Julian Date conversion
.inputrc
New unix stuff! This is, again, stuff I'd searched for forever but never found the right collection of terms. This is what bash readline is REALLY all about. if you make an inputrc file, you can get awesome readline capabilities (similar to ipython). This post at lifehacker showed me how to do it. This site has a more complete description of how to use readline/inputrc. Even better: VI command line editing. There's also something called magic space but I don't know what purpose it serves all the time... it will replace 'magic' characters like !* and !& and !! with whatever command they represent if you hit space immediately after typing them (explained better here). Wow. Awesome.
Installing 64 bit tcl/tk on Mac OS X
Everything is described in this post: http://www.nabble.com/Error-compiling-tk-8.5.7-on-Mac-OS-X-10.5-td23790967.html
But here's a script too: curl -O 'http://osdn.dl.sourceforge.net/sourceforge/tcl/t{cl,k}8.5.7-src.tar.gz'for f in t*8.5.7*.gz; do tar zxf $f; done cd tcl8.5.7/unix/./configure --enable-framework --enable-64-bitcd tk8.5.7/unix/./configure --enable-framework --enable-64-bitmake -j 4 -C tcl8.5.7/unix make -j 4 -C tk8.5.7/unixsudo make install -C tcl8.5.7/unix sudo make install -C tk8.5.7/unix
Concerns:
- might be necessary to do this in the macosx directory for some reason, though Aqua doesn't support 64 bits
- have to recompile python to get _tkinter to work (see a later post)
Installing Snow Leopard
I'm going to attempt to install snow leopard today. This post will serve as a record of the difficulties I run into. Things to install (and ensure they are 64-bit):
- ipython
- numpy
- scipy
- matplotlib
- stsci-python
- starlink
- gfortran
- latex
- idl (check)
Things that have happened:
- Had to restart again (twice) to install additional updates
- My bash command line looked funny - something about bash changed, but I don't know what. The fix was easy: commented out some code from http://pseudogreen.org/blog/set_tab_names_in_leopard_terminal.html that I had been using to set the tab title
- My locate db broke. Needed repair: sudo /usr/libexec/locate.updatedb
- numpy svn failed to build: `` python setup.py buildRunning from numpy source directory.non-existing path in 'numpy/distutils': 'site.cfg'F2PY Version 2_8111numpy/core/setup_common.py:86: MismatchCAPIWarning: API mismatch detected, the C API version numbers have to be updated. Current C api version is 4, with checksum 59750b518272c8987f02d66445afd3f1, but recorded checksum for C API version 4 in codegen_dir/cversions.txt is 3d8940bf7b0d2a4e25be4338c14c3c85. If functions were added in the C API, you have to update C_API_VERSION in numpy/core/setup_common.pyc. MismatchCAPIWarning)blas_opt_info: FOUND: extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] define_macros = [('NO_ATLAS_INFO', 3)] extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']lapack_opt_info: FOUND: extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] define_macros = [('NO_ATLAS_INFO', 3)] extra_compile_args = ['-faltivec']running buildrunning config_ccunifing config_cc, config, build_clib, build_ext, build commands --compiler optionsrunning config_fcunifing config_fc, config, build_clib, build_ext, build commands --fcompiler optionsrunning build_srcbuild_srcbuilding py_modules sourcesbuilding library "npymath" sourcescustomize NAGFCompilerFound executable /usr/local/bin/f95customize AbsoftFCompilerCould not locate executable f90Found executable /usr/bin/f77absoft: no Fortran 90 compiler foundabsoft: no Fortran 90 compiler foundcustomize IBMFCompilerCould not locate executable xlf90Could not locate executable xlfcustomize IntelFCompilerCould not locate executable ifortCould not locate executable ifccustomize GnuFCompilerFound executable /usr/local/bin/g77gnu: no Fortran 90 compiler foundgnu: no Fortran 90 compiler foundcustomize Gnu95FCompilerFound executable /usr/local/bin/gfortrancustomize Gnu95FCompilercustomize Gnu95FCompiler using configC compiler: gcc -arch i386 -arch ppc -arch ppc64 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypescompile options: '-Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c'gcc: _configtest.cgcc _configtest.o -o _configtestld: library not found for -lcrt1.10.5.ocollect2: ld returned 1 exit statusld: library not found for -lcrt1.10.5.ocollect2: ld returned 1 exit statusfailure.removing: _configtest.c _configtest.oTraceback (most recent call last): File "setup.py", line 210, in setup_package() File "setup.py", line 203, in setup_package configuration=configuration ) File "/Users/adam/repos/numpy-svn/numpy/distutils/core.py", line 186, in setup return old_setup(new_attr) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 152, in setup dist.run_commands() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 975, in run_commands self.run_command(cmd) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command cmd_obj.run() File "/Users/adam/repos/numpy-svn/numpy/distutils/command/build.py", line 37, in run old_build.run(self) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/build.py", line 134, in run self.run_command(cmd_name) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/cmd.py", line 333, in run_command self.distribution.run_command(command) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/dist.py", line 995, in run_command cmd_obj.run() File "/Users/adam/repos/numpy-svn/numpy/distutils/command/build_src.py", line 152, in run self.build_sources() File "/Users/adam/repos/numpy-svn/numpy/distutils/command/build_src.py", line 163, in build_sources self.build_library_sources(*libname_info) File "/Users/adam/repos/numpy-svn/numpy/distutils/command/build_src.py", line 298, in build_library_sources sources = self.generate_sources(sources, (lib_name, build_info)) File "/Users/adam/repos/numpy-svn/numpy/distutils/command/build_src.py", line 385, in generate_sources source = func(extension, build_dir) File "numpy/core/setup.py", line 670, in get_mathlib_info raise RuntimeError("Broken toolchain: cannot link a simple C program")RuntimeError: Broken toolchain: cannot link a simple C program`` **SOLUTION: Use the Mac OS X 10.6 python (/usr/bin/python). I will do this until I run into another problem. Numpy build successfully
- Build/install matplotlib - failed! Completely!
- Acquired gcc/gfortran from hpc
- Followed instructions from hyperjeff on fortran install...
- Get rid of numpy 1.2.1: `` mv /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/numpy /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/.not_numpy.bak``
- Try to install scipy. Fail on missing umfpack, follow hyperjeff's instructions (but make sure to edit the site.cfg in scipy, not just the one in numpy). Had to add the following code: sudo cp AMD/Lib/libamd.a /System/Library/Frameworks/Python.framework/Versions/2.6/libsudo cp UMFPACK/Lib/libumfpack.a /System/Library/Frameworks/Python.framework/Versions/2.6/libsudo cp AMD/Include/amd.h /System/Library/Frameworks/Python.framework/Versions/2.6/includesudo cp UFconfig/UFconfig.h /System/Library/Frameworks/Python.framework/Versions/2.6/includesudo cp UMFPACK/Include/*.h /System/Library/Frameworks/Python.framework/Versions/2.6/include
- Installed fftw from fftw.org with simple ./configure, make, sudo make install - no compiler opts as they killed the install
- Get SoundSource from rogueamoeba
- Updated istatmenus
Listing variables (e.g IDL help) in Python
Again, IDL has the simple 'help' command to tell you all variables in your namespace. Python has the same thing, but the namespace tends to be cluttered with imported functions. The commands who, who_ls, and whos are meant for interactive use. They are a hell of a lot more useful than var, locals, globals, and dir. examples: whos floatwhos ndarraywho modulefloat_vars = %who_ls floatgrep('x',float_vars) I'm afraid I don't know how to make the last two lines into a one-liner, as would be desirable.
Mac stuff cont'd
Trying to get Apache server to run, and it's just a pain. I frequently forget how to update the locate database because it's different on macs. Marcos' Mac Singularity has the instructions. In short: sudo /usr/libexec/locate.updatedb
Mac terminal stuff
xterm-color has some annoying features when SSHing to other compys, including 'top' not functioning properly. The error I receive: top: no termcap entry for a `xterm-color' terminal The solution: From MacOSXhints, in bash just add export TERM="vt100" to your .profile file.
macvim crash
well, it finally happened.... my reliable, trusty editor crashed. That should be impossible. I am ready to call it quits for the week....
Process: MacVim [650]Path: /Applications/Vim.app/Contents/MacOS/MacVimIdentifier: org.vim.MacVimVersion: 7.2 (49)Code Type: X86 (Native)Parent Process: Vim [649]Date/Time: 2010-02-25 13:12:43.001 -0700OS Version: Mac OS X 10.6.2 (10C540)Report Version: 6Interval Since Last Report: 871676 secCrashes Since Last Report: 26Per-App Interval Since Last Report: 938504 secPer-App Crashes Since Last Report: 1Anonymous UUID: 03159B9E-2257-4E38-8C4A-4D4DAF5641A7Exception Type: EXC_BAD_ACCESS (SIGSEGV)Exception Codes: 0x000000000000000d, 0x0000000000000000Crashed Thread: 0 Dispatch queue: com.apple.main-threadThread 0 Crashed: Dispatch queue: com.apple.main-thread0 com.apple.CoreFoundation 0x99119480 __CFSetCallback + 01 com.apple.CoreFoundation 0x990c78bc ___CFBasicHashFindBucket1 + 4442 com.apple.CoreFoundation 0x990cfaac CFBasicHashFindBucket + 2523 com.apple.CoreFoundation 0x990e8293 CFSetGetValue + 1314 com.apple.AppKit 0x961bae7e -[NSWindow _discardTrackingRect:] + 595 com.apple.AppKit 0x961badca -[NSView(NSInternal) _uninstallTrackingArea:] + 1236 com.apple.AppKit 0x960d2c32 -[NSView(NSInternal) _uninstallRemovedTrackingAreas] + 2937 com.apple.AppKit 0x960dac40 -[NSView(NSInternal) _updateTrackingAreas] + 6468 com.apple.CoreFoundation 0x990ea4e0 CFArrayApplyFunction + 2249 com.apple.AppKit 0x960daefb -[NSView(NSInternal) _updateTrackingAreas] + 134510 com.apple.CoreFoundation 0x990ea4e0 CFArrayApplyFunction + 22411 com.apple.AppKit 0x960daefb -[NSView(NSInternal) _updateTrackingAreas] + 134512 com.apple.CoreFoundation 0x990ea4e0 CFArrayApplyFunction + 22413 com.apple.AppKit 0x960daefb -[NSView(NSInternal) _updateTrackingAreas] + 134514 com.apple.AppKit 0x960da8db _handleInvalidCursorRectsNote + 39215 com.apple.CoreFoundation 0x99135892 __CFRunLoopDoObservers + 118616 com.apple.CoreFoundation 0x990f218d __CFRunLoopRun + 55717 com.apple.CoreFoundation 0x990f1864 CFRunLoopRunSpecific + 45218 com.apple.CoreFoundation 0x990f1691 CFRunLoopRunInMode + 9719 com.apple.HIToolbox 0x936f6f0c RunCurrentEventLoopInMode + 39220 com.apple.HIToolbox 0x936f6bff ReceiveNextEventCommon + 15821 com.apple.HIToolbox 0x936f6b48 BlockUntilNextEventMatchingListInMode + 8122 com.apple.AppKit 0x960b0ac5 _DPSNextEvent + 84723 com.apple.AppKit 0x960b0306 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 15624 com.apple.AppKit 0x9607249f -[NSApplication run] + 82125 com.apple.AppKit 0x9606a535 NSApplicationMain + 57426 org.vim.MacVim 0x0000238b _start + 20927 org.vim.MacVim 0x000022b9 start + 41Thread 1: Dispatch queue: com.apple.libdispatch-manager0 libSystem.B.dylib 0x98d0c0ea kevent + 101 libSystem.B.dylib 0x98d0c804 _dispatch_mgr_invoke + 2152 libSystem.B.dylib 0x98d0bcc3 _dispatch_queue_invoke + 1633 libSystem.B.dylib 0x98d0ba68 _dispatch_worker_thread2 + 2344 libSystem.B.dylib 0x98d0b4f1 _pthread_wqthread + 3905 libSystem.B.dylib 0x98d0b336 start_wqthread + 30Thread 2:0 libSystem.B.dylib 0x98ce58da mach_msg_trap + 101 libSystem.B.dylib 0x98ce6047 mach_msg + 682 com.apple.CoreFoundation 0x990f277f __CFRunLoopRun + 20793 com.apple.CoreFoundation 0x990f1864 CFRunLoopRunSpecific + 4524 com.apple.CoreFoundation 0x990f1691 CFRunLoopRunInMode + 975 com.apple.Foundation 0x91b24430 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 3296 com.apple.Foundation 0x91aeb8d8 -[NSThread main] + 457 com.apple.Foundation 0x91aeb888 __NSThread__main__ + 14998 libSystem.B.dylib 0x98d12fbd _pthread_start + 3459 libSystem.B.dylib 0x98d12e42 thread_start + 34Thread 3:0 libSystem.B.dylib 0x98d04856 select$DARWIN_EXTSN + 101 com.apple.CoreFoundation 0x99131ddd __CFSocketManager + 10852 libSystem.B.dylib 0x98d12fbd _pthread_start + 3453 libSystem.B.dylib 0x98d12e42 thread_start + 34Thread 4:0 libSystem.B.dylib 0x98d0b182 __workq_kernreturn + 101 libSystem.B.dylib 0x98d0b718 _pthread_wqthread + 9412 libSystem.B.dylib 0x98d0b336 start_wqthread + 30Thread 0 crashed with X86 Thread State (32-bit): eax: 0x00515db0 ebx: 0x990c7711 ecx: 0x00516460 edx: 0xbfffcabc edi: 0x00001041 esi: 0x00504270 ebp: 0xbfffca38 esp: 0xbfffc99c ss: 0x0000001f efl: 0x00010246 eip: 0x99119480 cs: 0x00000017 ds: 0x0000001f es: 0x0000001f fs: 0x00000000 gs: 0x00000037 cr2: 0x97a20000
Major mac problems
The errors are, in short:
- Browser stops responding / starts returning "page not found" (indicating a failure of mDNSResponder)
- killing mDNSResponder sometimes brings browser back, but more often leads to a partial system freeze (some windows don't respond, can't switch between windows except by clicking)
- /var/log/system.log gets flooded with "too many files open" errors.
- somewhere in here the Dock fails
- killing Google Chrome and/or the Dock fails; the process never halts (even kill -9 + kill -s SIGCHLD)
- usually one or two crash reports pop up, at least one of which is for crash_reporter
- system.log stops getting flooded, but the browser and Dock never recover
The only message in system.log that gives me any hint about what might be happening is occasionally a freeze was resolved at the same time as this message: Jun 22 19:02:09 eta Quicksilver[93771]: Multiple Scans Attempted but it doesn't seem to change the situation if quicksilver is open or not. Google has nothing on this issue, either, except for the quicksilver source code, so evidently it has not caused problems for other people system.log was also being flooded with this message:
Jun 23 08:57:19 eta postfix/master[99954]: fatal: open /dev/null: Bad file descriptorJun 23 08:57:20 eta com.apple.launchd[1] (org.postfix.master[99954]): Exited with exit code: 1Jun 23 08:57:20 eta com.apple.launchd[1] (org.postfix.master): Throttling respawn: Will start in 9 seconds
so I disabled my postman:
Jun 23 08:57:27 eta sudo[99955]: adam : TTY=ttys006 ; PWD=/Users/adam/proposals/alma ; USER=root ; COMMAND=/bin/launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
These errors:
Jun 23 09:06:40 eta Dock[99877]: kCGErrorIllegalArgument: CGSSetWindowTransformAtPlacement: Singular matrix [nan 0.000 0.000 nan]Jun 23 09:06:40 eta com.apple.Dock.agent[99877]: Thu Jun 23 09:06:40 eta.colorado.edu Dock[99877] : kCGErrorIllegalArgument: CGSSetWindowTransformAtPlacement: Singular matrix [nan 0.000 0.000 nan]
are correlated with opening Chrome windows and/or Chrome's crash_inspector
Jun 23 09:06:09 eta [0x0-0x69e69e].com.google.Chrome[99995]: [99995:24579:485131152128125:ERROR:shared_memory_posix.cc(164)] Creating shared memory in /var/folders/ni/ni+DtdqFGMeSMH13AvkNkU+++TI/-Tmp-/.com.google.chrome.sHcu6r failed: Too many open files in system
This is the problem that really gets me... I think it's crash_inspector's fault. But there's definitely more going on here than just Chrome. Trying to change default browsers (by opening Safari and opening Preferences) led to a partial Dock crash (?!) in which I can alt-tab but can't see the Dock. Not clear at all what's going on.... argh.
mathematica
//. and /. use 'rules' of the form {x->y} for substitutions how do you make the layout of a page look nice? How do you change line spacing?