osx

How to move up a directory with Terminal in OSX

Kiddie pool question. When I launch a new Terminal window, I starts me in 'Macintosh HD/Users/MyName'. How can I back out of my user directory back up to the top level? ...

Is there an Automator action for displaying large text?

I'm working on an Automator workflow in which I need to take in a text string, do some processing, and then display it to the user, preferably in a manner similar to Address Book's or Quicksilver's "Display in Large Type", but I haven't found any actions to do this. Does anyone know of any? ...

add mysqldump to MAMP (MySQL /w Apache PHP on MacOS X)

Hi all, I wonder how I can add mysqldump to my MAMP environment. I googled a bit and found only the community MySQL server version. But I do not want to install another MySQL – basically because I want to save my data first, before any experiment. thx for help in advance (probably it´s just a simple link :) ...

Where did the icon come from?

Is there a unix tool to which I can pass a file and have it tell me where the icon for the file is coming from? What I am looking for is something like this: $WhoProvidedIcon /Path/To/file.myex UTI: com.myapplication.document PLIST: /path/to/myapplication.app/Contents/Info.plist ICON: /path/to/myapplication.app/Contents/Resources/B...

OSX: programmatically get uptime?

Something similar to linux cat /proc/uptime which returns the uptime in seconds, and preferably not parsing uptime(1). ...

What can I do if getcwd() and getenv("PWD") don't match?

I have a build system tool that is using getcwd() to get the current working directory. That's great, except that sometimes people have spaces in their paths, which isn't supported by the build system. You'd think that you could just make a symbolic link: ln -s "Directory With Spaces" DirectoryWithoutSpaces And then be happy. But u...

Window disappears when resizing in Carbon Simulator

I'm trying to build a resizable Carbon window as part of a tutorial. I am using Interface Builder 3.2.3 on Snow Leopard 10.6.4. If I create an empty Carbon project and add a window object from the Library (with Close, Minimize, Resize and Zoom buttons in the Inspector all checked), run the Carbon Simulator and then attempt to resize the...

Can gdb make a function pointer point to another location?

I'll explain: Let's say I'm interested in replacing the rand() function used by a certain application. So I attach gdb to this process and make it load my custom shared library (which has a customized rand() function): call (int) dlopen("path_to_library/asdf.so") This would place the customized rand() function inside the process' m...

Java/AWT/Swing: how to distinguish the pressed enter or return key

It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the other time the default button is activated. How I can distinguish both key presses from Java/AWT/Swing? ...

Launchd.plist with WatchPaths key: How to set a minimum interval?

How would one set a minimum interval for a launchd.plist script with a WatchPath key? For example, I want to run a script every time new files appear in a directory, but I would like it to only run once an hour at maximum. The launchd.plist might look something like this: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "...

Install Ruby support for VIM on Mac OS X

Mac OS X 10.6 (Snow Leopard) has VIM pre-installed (version 7.2), which is great. It also has Ruby pre-installed (version 1.8.7) which is great too. However, I want Ruby autocompletion in VIM. Looking up the VIM version (vim --version) shows -ruby (i.e. ruby support isn't enabled). How to enable ruby for my VIM installation? ...

How to get started writing iCal plugins?

I'd like to write an iCal plugin to help me cope with the need to put most events I create onto two calendars. Google is uncharacteristically less than helpful in providing programming resources for this purpose. Can someone here provide pointer(s)? ...

How to limit memory of a OS X program? ulimit -v neither -m are working

My programs run out of memory like half of the time I run them. Under Linux I can set a hard limit to the available memory using ulimit -v mem-in-kbytes. Actually, I use ulimit -S -v mem-in-kbytes, so I get a proper memory allocation problem in the program and I can abort. But... ulimit is not working in OSX 10.6. I've tried with -s and...

custom behavior for the application icon in the mac os x dock

hello, I am trying to modify the default behavior of teh dock when you click on an icon of a started application. By default it bring the main window of the application to forefront. What I would like to be able to do is to be able to perform a custom operation when the icon is clicked. Any idea to achieve this? Thanks and regards, A...

Is there a version of Fixed 6x13 bitmap font with less whitespace (line spacing 0.8)?

I think the fixed 6x13 font, FixedMedium6x13.dfont, the default in X11, is the best programming font. All the others that people gush about (Consolas, Inconsolata, Proggy, Monaco) just aren't as compact (without sacrificing readability). Or maybe I just like it. For the purposes of this question, assume we want nothing less than the X11...

Programmatically adding glyphs (delete key, backspace, space, etc) to menu item

It used to be that in Carbon you could use SetMenuItemKeyGlyph. What's the alternative under 10.6? Will I need to use undocumented goodness or...? Thanks ...

FileMerge .nib file type cannot be merged

I am trying to merge two .nib files. FileMerge has no problem showing the comparison of the two files. I am trying to keep all the settings in one file (i.e. right side) except for two settings that I want to copy from the other file (i.e. left side). The differences are just one line of code each that changes the integer value of a a...

cocoa playing an mp3

Hello, Is there an easy way to load, play and control an mp3 file from cocoa? Tried googling it, but, as all things apple, i get messy results and have no idea where to start. As i understand, there's and NSSound, but it has lots of limitations and then there's CoreAudio, but it's very difficult. So can someone point me in a right direc...

Sync Services and iOS

Suppose I already have an OS X app which syncs its data using Sync Services with MobileMe. Is there an way to make my iPhone/iPad app to sync (using MobileMe or not) the data using what I already prepared for the Sync Services? I guess Apple already has the implementation inside iOS because iPhone/iPad does sync Safari bookmarks, but i...

Mac OS address book format

Hi, I want to write an application to work with adress books. My first try is with the apple adress book. My problem is that I didn't found an specification for the format. I looked a bit about it and found some things out: The adress book is a package (so you can access it like a folder in the file system) In the subfolder Images/ ...