Thursday, December 31, 2009

Monday, October 5, 2009

Projectors in os x on Advent

I found that when I connected a projector, display went all garbled. Found suggestions that this was the 'mirrored display' mode of OS X, which is known to be broken in the graphics drivers on the Wind/Advent 4211.

There was a suggestion to enable the "show display settings in menu bar" or somesuch, which I did, and then hover the mouse button over the icon when plugging a projector in, press down twice, then enter. That disables mirror mode, which seems to be enabled by default when a projector is plugged in.

Did that. It works.

Then had to use DisplayConfigX to remove the 100Hz settings that the monitor didn't like, reboot, mac says it's now at 1024x768 60 Hz, projector says 1280x768 (it is 1280x800 native), everything looks about right in terms of aspect ratio.

Sunday, August 16, 2009

Recovering Safari crash at startup

Found that Safari wasn't starting up after one of the annoying crashes I have had lately. Google turned up an article that proposed deleting a whole host of files. In the end I just had to delete com.apple.Safari.plist from ~/Library/Preferences/ and it came back to life. The file did look like it had non-ascii garbage at the front before it was deleted, but the fresh version didn't (though it had some at the end).

Had to reset home page, plus settings like opening up browser pages in a new tab, fill in usernames and passwords when known, in Safari->Preferences.

Friday, August 14, 2009

MacFuse

A while back I installed MacFuse from Google. Now I want SFTP installed. But after downloading binaries from googlecode's page as suggested, it was a bit tricky to get the right settings.

Macfusion helped, because it does it all via a GUI. I initially thought I had to do it by the command line using -p 2222 and adding the defer_permissions option, because when I didn't have that option it thought everything was unavailable. See this page. Then I found that I could add -o defer_permissions to the SSHFS options in MacFuse, for that connection. Now it works fine!

Tuesday, August 11, 2009

Image programs for OS X

Wanted The Gimp, downloaded binary package. Needs 10.5.7 to run best - I have been resisting this upgrade in case it breaks my install.

Installed Hugin, which works really nicely.

Tuesday, June 9, 2009

Automator workflow for interleaving odd and even pages of PDF scans

I have made an Automator workflow that combines two PDFs, by shuffling (interleaving them), but after reversing the second one (second in terms of creation time). This means that you can scan a whole lot of pages (odd sides), turn them over and scan the other sides (even sides), then right click, choose an Automator workflow to combine them. They become Combined.pdf in the same folder - the originals are moved to the Trash.

Uses the python script automator action

This was something also wanted here.

The automator action starts with a Get Selected Finder Items action, then has a Run Python Script action with the following code.

import os
from CoreGraphics import *

def createPDFDocumentWithPath(path):
print path
return CGPDFDocumentCreateWithProvider(CGDataProviderCreateWithFilename(path))
def duplexPages(writeContext, oddfile, evenfile):
# open PDFDocuments for each of the files.
odd = createPDFDocumentWithPath( oddfile )
even = createPDFDocumentWithPath( evenfile )

# confirm that the number of pages is the same
maxPages = odd.getNumberOfPages()
if ( maxPages <> even.getNumberOfPages() ):
print "Documents do not have the same number of pages"
else:
# Shuffle the pages
for pageNum in xrange(1, maxPages + 1):
# start at first odd page
page = odd.getPage(pageNum)
print 'Page', pageNum, 'from', oddfile
if page != None:
mediaBox = odd.getMediaBox(pageNum)
writeContext.beginPage(mediaBox)
writeContext.drawPDFDocument(mediaBox, odd, pageNum)
writeContext.endPage()
# start at last even page
page = even.getPage(maxPages + 1 - pageNum)
print 'Page', maxPages + 1 - pageNum, 'from', evenfile
if page != None:
mediaBox = even.getMediaBox(maxPages + 1 - pageNum)
writeContext.beginPage(mediaBox)
writeContext.drawPDFDocument(mediaBox, even, maxPages + 1 - pageNum)
writeContext.endPage()
def realFilesOnly( item ):
return item.find(".") <> 0

# from http://stackoverflow.com/questions/249785/os-x-determine-trash-location-for-a-given-path
def get_trash_path(input_file):
    path, file = os.path.split(input_file)
    if path.startswith("/Volumes/"):
        # /Volumes/driveName/.Trashes/
        s = path.split(os.path.sep)
        # s[2] is drive name ([0] is empty, [1] is Volumes)
        trash_path = os.path.join("/Volumes", s[2], ".Trashes", str(os.getuid()))
        if not os.path.isdir(trash_path):
            raise IOError("Volume appears to be a network drive (%s could not be found)" % (trash_path))
    else:
        trash_path = os.path.join(os.getenv("HOME"), ".Trash")
    return trash_path
def main(input, *args, **kwargs):
dirname = os.path.dirname(input[0])    # extract folder to work in
# print dirname
files = input
# print files
# files = os.listdir( dirname )
# files = filter(realFilesOnly, files) # filter out special files
# print files # enable to see which files are selected
if ( len(files) == 2 ):
# files[0] = os.path.join(dirname,files[0]) # add path to files 
# files[1] = os.path.join(dirname,files[1])

# odd file is assumed to be the earlier one
if ( os.path.getctime(files[1]) > os.path.getctime(files[0]) ):
odd = files[0]
even = files[1]
else:
odd = files[1]
even = files[0]

print "Identified Odd: ", odd
print "Identified Even: ", even

outputFilename = os.path.join(dirname, "Combined.pdf")
print "Output to: ", outputFilename

pageRect = CGRectMake (0, 0, 612, 792)
writeContext = CGPDFContextCreateWithFilename(outputFilename, pageRect)

duplexPages(writeContext, odd, even)

# delete the original files
trashPath = get_trash_path( odd ) # find location of trash
os.rename( odd, os.path.join(trashPath,os.path.split(odd)[1]) )
os.rename( even, os.path.join(trashPath,os.path.split(even)[1]) )
else:
print "Incorrect number of files"

return files


It can be saved as a Finder Plugin to appear on the context menu for Finder items.

Monday, June 8, 2009

VoodooHDA drivers for OS X

Some activity says that microphone-enabling drivers may be available:

http://forums.msiwind.net/osx-drivers/almost-fully-working-voodoohda-speakers-headphone-ext-mic-t10871.html

"system-library-extension; if you have applehda.kext/appleazaliaaudio,kext/voodoohda.kext back them up somewhere and then delete them, then download the voodoo kext. next step launch kext helper and add the kext to the box, enter your password, reboot and then try skype or audacity.

for further help, use the search box. all of these answers are in the forums somewhere. in fact if you go look at the original voodoo posting i think they posted directions in there. if you installed os x to your wind firsthand then im sure you used kext helper at some point. "

Then there is a "new version" that includes preference panels (but looks like pref panel is only update and is a separate file).
http://forum.voodooprojects.org/index.php/topic,139.0.htm

However, people reported problems with the new version and waking from sleep.