All the info I can find about burning cd's is for Windows, or about full programs to burn cd's.
I would however like to be able to burn an Audio CD directly from within my program.
I don't mind using Cocoa or Carbon, or if there are no API's available to do this directly, using a command-line program that can use a wav/aiff file as input would be a possibility too if it can be distributed with my application.
Because it will be used to burn dj mixes to cd, it would also be great if it is possible to create different tracks without a gap between them.
Command:
drutil burn -audio /path/to/folder
Check out the Apple-supplied drutil command. If you need more flexibility, the DiscRecording Framework is documented here.
Related
I have below requirement where I want to monitor a folder for file activity and user who is doing that.
I know something call inotify tools but will that work on all unix versions like HP, Solaris etc?
And how to track name of user/id who doing that file add/delete/modify?
I know something call inotify tools but will that work on all unix
versions like HP, Solaris etc?
inotify is a Linux-only solution. There are approximately similar solutions available for other operating systems (e.g., Solaris has file event notifications, but I don't know that there is anything available that wraps them up in a single API.
And how to track name of user/id who doing that file add/delete/modify?
You can't, at least not in a cross-platform manner. Under Linux you can probably accomplish a task like this using the audit subsystem, but that is again a Linux-only solution.
I have a 200mb zip file, which I want to extract to a temporary folder for processing. I have experience with rubyzip library before. However it seems that extracting all files using it is a bit of pain according to this blog post, needing to create directory before extracting individual files:
Is there an easier way to extract all things into a directory? It needs to work on both Mac OS X and Linux, but would be better if the solution is truly cross-platform.
Linux has a command line utility called unzip that will do it, IIRC. If that utility is available on Mac OS then you can just call it from ruby using system() or back ticks.
This may sound like a silly question but up until recently if you tried to unmount a volume that was in use the Finder reported that it was in use, but not by whom. This is simple Unix functionality, if a file is open on a mount point, do not allow it to eject. But now they seem to have added functionality that lets the user know what programs are currently using a mounted system, and I have been looking through man pages of fopen,stat, etc. for Unix like operating systems(distros of linux) and I can't seem to find similar functionality.
Is this functionality specialized, or am I just looking in the wrong place?
There are BSD-level calls (mainly lsof, whose source is at http://www.opensource.apple.com/source/lsof/) that let you examine the list of files open in a process. Activity Monitor, for example, uses them.
Using lsof as a starting point, you can iterate through processes and see if any of them are using a file under the mount point you're examining. There may be more efficient ways to do it though, of which I'm not aware. :)
It's somewhat specialized. Check out the lsof utility.
Check the man page for fuser, and run fuser -c /mountpoint
Windows lets you develop a filter driver to catch file I/O's on VFS. But I can't seem to find something similar for Mac. It does have something called Filter Schemes, but those are for HFS+. Anyone know if there is a way for me to intercept file I/O's on Mac without using programs like MacFUSE?
I found out that Mac OS X does not allow filter drivers at all.
“A stacking file system (sometimes called a filter file system) sits on top of another file system and modifies its behavior in some way. The canonical example of a stacking file system is an encryption file system. You could stack this file system on top of any existing file system to provide encryption support. Apple does not support the development of stacking VFS plug-ins on Mac OS X” (http://developer.apple.com/mac/library/qa/qa2001/qa1242.html)
kauth (introduced in OS X 10.4) is the closest thing to FS filter drivers.
Here is a nice write-up on the various APIs present on Mac OS X. It should be a good starting point.
Link
I'm not at all familier with the Windows technologies that you mention, but it sounds like you might be looking for FSEvents.
http://developer.apple.com/mac/library/documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html
The file system events API provides a
way for your application to ask for
notification when the contents of a
directory hierarchy are modified. For
example, your application can use this
to quickly detect when the user
modifies a file within a project
bundle using another application.
It also provides a lightweight way to
determine whether the contents of a
directory hierarchy have changed since
your application last examined them.
For example, a backup application can
use this to determine what files have
changed since a given time stamp or a
given event ID.
You should read this document if your
application works with a large number
of files—particularly if your
application works with large
hierarchies of files.
I want to make a script that automatically backs up my kindle files when I connect it to my macbook pro. Writing the script is well within my ability, but I don't know what's the best way to run a script on mount automatically.
You could either use AppleScript and attach a folder action to the /Volumes directory, or you could write a Launch Agent that watches that path.
For the latter, you can refer to Tutorial: Backups with Launchd on MacResearch. The gist of it is that you create a plist configuration file to be interpreted by launchd; then launchd will execute your script when the specified path has changed.
What kind of scripting did you have in mind? If you are using AppleScript, would it be possible to attach a folder action to the /Volumes directory (or maybe the specific subdirectory on which the Kindle mounts) to back up the files? I've never tried something like that, so use the idea at your own risk, but for what it's worth...
Other than that, I don't know of a general way to run a script on a mount in OS X. Kevent, which is OS X's version of Linux's inotify, would be a way something like that might be accomplished, but obviously you don't want to write a C program for all of this. One might be out there though.