osx

OS X: Determine Trash location for a given path

Simply moving the file to ~/.Trash/ will not work, as if the file os on an external drive, it will move the file to the main system drive.. Also, there are other conditions, like files on external drives get moved to /Volumes/.Trash/501/ (or whatever the current user's ID is) Given a file or folder path, what is the correct way to dete...

Printing without Page Setup - reacting to paper size and orientation changes?

The AppKit release notes for Leopard say: In many applications it is not appropriate to present page setup panels to the user, or even include a Page Setup... item in the File menu, but there has been no other easy way to let the user specify page setup parameters to be used when printing. (New UI advice: if your applic...

What are these stray zero-byte files extracted from tarball? (OSX)

I'm extracting a folder from a tarball, and I see these zero-byte files showing up in the result (where they are not in the source.) Setup (all on OS X): On machine one, I have a directory /My/Stuff/Goes/Here/ containing several hundred files. I build it like this tar -cZf mystuff.tgz /My/Stuff/Goes/Here/ On machine two, I scp the t...

Clojure editor/IDE recommendations on Mac OS X

I am starting to learn the Clojure programming language. Are there any recommendations for Clojure editors/IDEs on Mac OS X? Update 2009-09-23: The Clojure space has changed tremendously since I originally posted this question. Many of the links below, especially those that refer to clojure-mode with Emacs, are out-of-date. The best Clo...

Finding DNS server settings programmatically on Mac OS X

I have some cross platform DNS client code that I use for doing end to end SMTP and on windows I can find the current DNS server ip addresses by looking in the registry. On the Mac I can probably use the SystemConfiguration framework as mentioned in the first answer, however the exact method of doing so is not immediately obvious. For i...

NSDateFormatter won't parse dates using locale settings?

I'm trying to parse dates using the user's date preferences [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateStyle:NSDateFormatterShortStyle]; NSDate *date = [ dateFormatter dateFromString:@"7/4/2008" ]; NSLog(@...

Force Apache HTTPD to run in 32bit

I have been running Apache HTTPD in 64bit mode by stripping out the 32bit architecture from the binary (along with the ppc parts). I did this to make it more compatible for python and mysql. However I have another machine that needs it to be run in 32bit mode (it has all four original architectures still in it). Is it possible to make s...

Best way to inject functionality into a binary...

What would be the best way of inserting functionality into a binary application (3d party, closed source). The target application is on OSX and seems to have been compiled using gcc 3+. I can see the listing of functions implemented in the binary and have debugged and isolated one particular function which I would like to remotely call....

Resolving AliasRecord with relative path on a new volume

I have an AliasRecord creating using the Alias Manager function FSNewAlias(fromFSRef, targetFSRef, &aliasRecordHandle). My understanding is that the resulting alias record will contain information for a relative path search (relative to fromFSRef). Because my users are on networked home directories and mobile accounts, these aliases do n...

NSColor and NSGradient as properties - any reason to copy?

I'm quite familiar with the reasons for wanting to copy a property vs. retain. (Essentially the value vs. relationship argument. You almost always want to copy strings, for example.) What about NSColor and NSGradient? They both conform to NSCopying, but as currently implemented, are immutable. Thoughts? ...

Linux equivalent of the Mac OS X "open" command

I've found the "open" command in Mac OS X very handy in the command line. From "man open": The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files. That is,...

Setting up a Python web development environment on OSX

I'm running Leopard and wanted to know what the easy way to setup a web development environment to use Python, MySQL, Apache on my machine which would allow me to develop on my Mac and then easily move it to a host in the future. EDIT: I've been trying to get mod_wsgi installed and configured to work with Django and have a headache now....

Using Mac OS X Services-menu from a Java/Swing application

I would like to make my Java/Swing application compatible with the Services-menu available on Mac OS X. For example, so that the user could select some text in JTextArea and have it converted into speech by Services -> Speech -> Start Speaking Text. Is there a simple way to achieve that? (The application should still be able to run on pl...

Creating an OS X Service

I'm trying to create an OS X Service. I found Providing System Services in Apple's documentation, however I'm finding it less than clear on what exactly I need to do. I'm currently using an application to register my service (thinking that would be more straight forward - eventually I'd like to create a .service), however even after a lo...

Tools to view/diagram function-call hierarchies for C or C++ source files in OSX

Are there any good source-code analyses tools for OSX. I am particularly interested in tools that are capable of diagramming function-call hierarchies for C and C++ source files. ...

Canvas3D and Swing

Hi, This question is regarding the performance issue in Mac OS X Canvas3D object is embedded in a JPanel; then the panel is integrated with the rest of the Swing-built application. Within that Canvas I am rendering a simple cube by applying certain transformations. At the initial launch It works fine. But when i try to resize the wind...

Cocoa/WebKit, having "window.open()" Javascipt links opening in an instance of Safari

I am building a really basic Cocoa application using WebKit, to display a Flash/Silverlight application within it. Very basic, no intentions for it to be a browser itself. So far I have been able to get it to open basic html links (<a href="..." />) in a new instance of Safari using [[NSWorkspace sharedWorkspace] openURL:[request URL...

How do you draw kanji using Mac OS X 10.5

I want to be able to draw in Kanji like you can with IME in Windows. Anyone know how? ...

Mach-O binary editor for OSX?

py-macholib does not work properly on osx (using darwin ports). I have not found any other alternative. Any ideas? ...

Battery status in OSX?

How can I read the status of the battery on my MacBookPro from my own application? Googling has so far only revealed APIs for device drivers to handle power events - there's nothing about user-land processes accessing this information. thanks. ...