2005/06/18

Managing Finder Workflows

With the new Automator in Mac OS X 10.4 it's easy to add contextual menu items to the Finder. Just edit your workflow in Automator, Select "File->Save As Plug-in...", enter a name for the plug-in, and specify that the plug-in is for Finder. (Apple has posted some examples of how to create plug-ins.)

It's easy to add a workflow menu item. How do you remove one?

Intuition says that your personal workflows might be represented as files somewhere in your home directory. Finder's new Smart Folders should tell whether that's really the case.

Create a dummy workflow named "DeleteMe" and save it as a Finder Plug-in. Then switch to the finder and select "File->New Smart Folder". In the little brushed-metal "toolbar" which appears, select the "Home" folder. In the criteria list add the following criteria:

"Kind", "Any", "+"
"Last Modified", "Today"

Somewhere in the list of search results a Folder named "Finder" should appear. Hitting the info icon on that item doesn't tell much, but the "More Info..." button reveals that it's located in /Users/YourUsername/Library/Workflows/Applications/Finder. And lo, opening the folder shows an Automator Workflow named "DeleteMe".

Drag the workflow to the trash, right click anywhere in a Finder window, and select the "Automator" cascading menu item. The "DeleteMe" menu item should be gone.

The Short Form

Workflow menu items live in your ~/Library/Workflows/Applications/ folders. They can be removed from your context menus by dragging them to the trash.

There's probably a better way to discover all of this...

2005/06/16

Birds and wind farms

New Scientist News - Wind turbines a breeze for migrating birds

Migratory birds learn to avoid wind farms, at least in Denmark. But resident birds may not fare so well. For example, the wind farm in the Altamont pass in California has killed a lot of raptors.

The subsections in the reports on the Wind Power and Bird Studies page suggest there may be other environmental factors, e.g. grassland vs. desert vs. prey populations.

2005/06/12

Godfather of the Hybrid

According to TreeHugger, Victor Wouk has passed on.

I wasn't familiar with the name. Caltech, where he attended graduate school, provides more details. This year they hosted the inaugural Victor Wouk Lecture.

A Rich Life


The American Institute of Physics gives some idea of all the things Wouk accomplished.

He picked Caltech, in part, because they had open book exams. During WWII he worked on the separation of uranium isotopes. For the founder of Motorola, Russell Feldman, in the early 1960s he worked on designing a practical electric car. He eventually concluded that a hybrid vehicle would be more practical.

In 1970 the Clean Air Act was passed, following studies which showed the negative effects of smog. Wouk got a federal grant to build a hybrid electric vehicle. He built a Buick Skylark which got 30 mpg and could hit 85 mph. (But it didn't run on water. [1])

The EPA's Eric Stork opposed the hybrid approach. (I wonder why?) Only one car was built by Wouk and his company, Petro-Electric Motors.

Scientific American, Oct. 1997, pg. 71 makes reference to the Skylark.

The rest of his family has done alright, as well. His brother is author Herman Wouk.

[1] From the first season of "That 70's Show".
Hyde: "I heard about a car that runs on water, man."
Fez: "You mean a boat?"

2005/06/11

Dr. Sarah's Sum of Two Cubes Activity Sheet

Dr. Sarah's Sum of Two Cubes Activity Sheet

Obscure mathematics references may explain the demise of Futurama.

Installing PyOpenGL on Mac OS X 10.4.1

Update 2007/02/26



Mike Fletcher has been working on PyOpenGL 3, which uses ctypes instead of swig. As a result, installation and updating are a lot easier. See the SourceForge project page for more info, but here's a quick summary:

$ sudo easy_install PyOpenGL
Password:
Searching for PyOpenGL
Reading http://cheeseshop.python.org/pypi/PyOpenGL/
Reading http://pyopengl.sourceforge.net/ctypes/
Reading http://sourceforge.net/project/showfiles.php?group_id=5988
Reading http://cheeseshop.python.org/pypi/PyOpenGL/3.0.0a5
Best match: PyOpenGL 3.0.0a6
Downloading http://downloads.sourceforge.net/pyopengl/PyOpenGL-3.0.0a6.zip?modtime=1171556482&big_mirror=0
Processing PyOpenGL-3.0.0a6.zip
Running PyOpenGL-3.0.0a6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-9bs-Ie/PyOpenGL-3.0.0a6/egg-dist-tmp-1Y8vWy
Adding PyOpenGL 3.0.0a6 to easy-install.pth file

Installed /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyOpenGL-3.0.0a6-py2.5.egg
Processing dependencies for PyOpenGL


You can also install and run the demos:
$ sudo easy_install PyOpenGL-Demo


Once they're installed, how do you get at them?

$ cd /Library/Frameworks/Python.framework/Versions/Current/lib/python2.5/site-packages/PyOpenGL_Demo-3.0.0a6-py2.5.egg/PyOpenGL-Demo/
$ cd redbook
$ python movelight.py


Each demo pops up in its own lovely, top-level window.

Original Post



After upgrading to Mac OS X 10.4.1 I decided to install Python 2.4.1. Python made a framework install with no problem. But I ran into a small problem trying to install PyOpenGL-2.0.1.09.


I kept getting compile errors complaining about an incomplete definition for st_atimespec, et al. (Here comes another batch of extremely long lines...)





In file included from /Library/Frameworks/Python.framework/Versions/2.4/include/python2.4/pyport.h:155,
from /Library/Frameworks/Python.framework/Versions/2.4/include/python2.4/Python.h:55,
from src/config.h:1,
from _configtest.c:6:
/System/Library/Frameworks/Kernel.framework/Headers/sys/stat.h:225: error: field 'st_atimespec' has incomplete type
/System/Library/Frameworks/Kernel.framework/Headers/sys/stat.h:226: error: field 'st_mtimespec' has incomplete type
/System/Library/Frameworks/Kernel.framework/Headers/sys/stat.h:227: error: field 'st_ctimespec' has incomplete type





What was odd was that the build process was trying to include sys/stat.h from .../Kernel.framework/Headers, instead of from /usr/include.


I modified config/darwin.cfg and removed /System/Library/Frameworks/Kernel.framework/Headers from the list of include directories, and thereafter PyOpenGL built and installed without error.


The examples ran, too :)


Here's the context diff for config/darwin.cfg. Apologies, again, for the long lines -- I've tried to escape them using trailing backslashes.





*** darwin.cfg.orig Sat Jun 11 12:09:35 2005
--- darwin.cfg.new Sat Jun 11 12:19:42 2005
***************
*** 11,17 ****
[General]
build_togl=0
gl_platform=CGL
! include_dirs=/System/Library/Frameworks/OpenGL.framework/Headers:/System/Library/Frameworks/GLUT.framework/Headers:/System/Library/Frameworks/Kernel.framework/Headers
# Bob's OSX patch, comments out the library directories, adds -framework:GLUT
# for the *general* build parameters? Is that actually needed?
; Should make a 'frameworks= ' option!
--- 11,17 ----
[General]
build_togl=0
gl_platform=CGL
! include_dirs=/System/Library/Frameworks/OpenGL.framework/Headers:/System/Library/Frameworks/GLUT.framework/Headers
# Bob's OSX patch, comments out the library directories, adds -framework:GLUT
# for the *general* build parameters? Is that actually needed?
; Should make a 'frameworks= ' option!



2005/06/10

Trac, clearsilver and Python 2.4.1

Trac is an excellent web-based issue tracking system. It depends on clearsilver.

Clearsilver 0.9.14 doesn't like to configure with Python 2.4, due to changes in the internals of Python's site module.

The fix is easy enough, but for some reason it's hard to find via Google. (You can find it by searching for Python 2.4 within clearsilver's Yahoo Groups discussion forum.) Here's a context diff for clearsilver's configure script, showing the fix that worked for me. Apologies for the long lines...


*** configure Tue May 24 16:28:58 2005
--- configure.orig Tue May 24 16:24:45 2005
***************
*** 3084,3091 ****
PYTHON=$python_bin
PYTHON_INC="-I$python_inc"
PYTHON_LIB=$python_lib
! PYTHON_SITE=`$python_bin -c "import sys, os; print os.path.join(sys.prefix, 'lib', 'python%s' % sys.version[:3], 'site-packages')"`
! # PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[0]"`
BUILD_WRAPPERS="$BUILD_WRAPPERS python"
fi
fi
--- 3084,3090 ----
PYTHON=$python_bin
PYTHON_INC="-I$python_inc"
PYTHON_LIB=$python_lib
! PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[0]"`
BUILD_WRAPPERS="$BUILD_WRAPPERS python"
fi
fi


Here is the relevant discussion thread.

2005/06/09

Wired News: Tiger Tweaks Could Kill Folders

Wired News: Tiger Tweaks Could Kill Folders

A mantra from the late '90s: It's better to search than to browse.

"...he used Spotlight to find all the bulky QuickTime movie files scattered across many different folders. Then he created a Smart Folder for them so he'd always be able to quickly see which little-used files he could delete."

2005/06/07

WebObjects 5.3 is bundled with XCode

WebObjects 5.3 Release Notes

See previous post -- too much to learn.

Among others, Aaron Hillegass has praised WebObjects. He has held it up as a standard against which to measure recent changes to Cocoa (and its Controller layer), and has sometimes found the latter lacking.

Haven't yet had a chance to do much with CoreData and the modeling tools in XCode 2.0. Now XCode 2.1 may help me understand what the fuss was all about.

Fun times.

Webkit is wide-open

Surfin' Safari

My list of things to learn was big enough before reading this...