osx

Avoiding, finding and removing memory leaks in Cocoa

Memory (and resource) leaks happen. How do you make sure they don't? What tips & techniques would you suggest to help avoid creating memory leaks in first place? Once you have an application that is leaking how do you track down the source of leaks? (Oh and please avoid the "just use GC" answer. Until the iPhone supports GC this isn't...

Does Objective-C compile to native code or byte-code?

On OS X, does Objective-C compile to native code or byte-code? Can Objective-C programs be compiled on Linux? ...

How to tell if the user's using 24 hour time using Cocoa

I'm trying to determine if the user is using 24 hour or 12 hour time, and there doesn't seem to be a good way to figure this out other than creating an NSDateFormatter and searching the format string for the period field ('a' character) Here's what I'm doing now: NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter s...

Why can't c++ ifstreams read from devices?

I knew I should never have started using c++ io, the whole "type safety" argument is a red herring (does anyone really find that it's one of their most pressing problems?). Anyhow, I did, and discovered a strange difference between ifstreams and FILE*s and plain old file descriptors: ifstreams cannot read from a device. Can anyone think ...

How do I blink/control Macbook keyboard LEDs programmatically?

Hi, I've googled for this, but no results, so I ask you guys for help. Do you know how I can switch on/off (blink) Macbook keyboard leds (capslock,numlock) under Mac OSX (preferably Tiger). I would like to add this feature as notifications (eg. new message received on Adium, new mail received). I would prefer applescript, python, but...

Using PHP to write to OS X's log database?

Do any apps/packages exist that will support writing to OS X's log database from external sources. I'm not too familiar with the specifics of the database, beyond the fact that you can view its contents from the Console app. I'm not even sure if it's just a version of some simple DB like SQLite or if it is some sort of proprietary/intern...

Specific help with Xcode Project Template that is not doing substitution in file contents

We are trying to make a project template, but the documentation on this is spotty or non-existent. Doing some reverse-engineering on some template files, we have come up with the following. However, it doen't actually work! First of all, we have figured out that project templates should be installed inside: ~/Library/Application Supp...

What's the best way to find out the installed version of the iPhone SDK?

What is the easiest way of finding out what version of the iPhone SDK is installed on my OS X? When you log into the Apple's iPhone Developer Center, you can see the build number of the current available version of the SDK, but you have to remember if you have already downloaded that version or not. What is the easiest way of staying ...

Xcode: attaching to a remote process for debugging

Using Xcode 3.1 on OSX 10.5; is it possible to attach (the debugger) to a running remote process? I know that it's possible to start and debug a remote process (as explained here), but it would be great if I could find a way to attach to an already running remote process... edit to add: Thanks. I've submitted a bug report to Apple. Wil...

Java Applet, AWT Refresh problem Mac OS X 10.4

We have a Java Applet built using AWT. This applet lets you select pictures from your hard drive and upload them to a server. The applet includes a scrollable list of pictures, which works fine in Windows, Linux and Mac OS X 10.5. We launch this applet via Java Web Start or within a web page. Our applet does not behave properly in Mac ...

How does the DropBox Mac client work?

I've been looking at the DropBox Mac client and I'm currently researching implementing a similar interface for a different service. How exactly do they interface with finder like this? I highly doubt these objects represented in the folder are actual documents downloaded on every load? They must dynamically download as they are needed...

What's the cheapest mac development box possible?

Simple question really, I would like to learn some cocoa, primarily for playing around with the Iphone SDK, but first i need a mac. Macs are expensive, but I don't know at what point an old mac moves from a bargain to a doorstop. How cheap and old can I go to have an ok mac development machine? Is there any other way to have a good de...

Why can I select aliases but not symbolic links in NSOpenPanel?

I want to create an NSOpenPanel that can select any kind of file, so I do this NSOpenPanel* panel = [NSOpenPanel openPanel]; if([panel runModalForTypes:nil] == NSOKButton) { // process files here } which lets me select all files except symbolic links. They're simply not selectable and the obvious setResolvesAliases does nothin...

Is there an alternative to RawInput in Mac OS X/Linux

I'm developing an application that runs on a machine that has several usb keyboards attached. Occasionally keyboards will added or removed. Each time a key is pressed, the application needs to find out which key was pressed, and which keyboard was used. I have got a working version of the application which uses RawInput under windows. ...

How can I get notified when the user finishes editing a cell in an NSTableView?

I need to know when the user finishes editing a cell in an NSTableView. The table contains all of the user's calendars (obtained from the CalCalendarStore), so in order for the user's changes to be saved I need to inform the CalCalendarStore of the changes. However, I can't find anything that gets called after the user finishes their edi...

Distinguishing between HFS+ and HFS Standard Volumes

IOKit and the DiskArbitration framework can tell me a lot of things about mounted volumes on a mac, but they don't seem to be able to differentiate between HFS+ and HFS Standard volumes. The IOKit/DA keys Content, DAVolumeKind and DAMediaContent are always Apple_HFS and hfs for both HFS Standard and HFS+ volumes. diskutil and DiskUtil...

How can I make the "find" Command on OS X default to the current directory?

I am a heavy command line user and use the find command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this: $ find -name \*.plist find: illegal option -- n find: illegal option -- a find: illegal option -- m find: illegal option -- e find: *.plist: No such file or directo...

How can I gain root access on a Mac OS X system without wiping the OS?

My father died recently and I've inherited his Mac. I'd love to put it to use in my own life, but I don't want to wipe its brains out just so I can reconfigure it to use in my network, etc. His old files are historically important to meI trust you can understand my desire to keep them. I can log in as I had an account on the machine bef...

Apache development config on OS X (again)

Hi All, I am trying to configure Apache2 on my Mac (running OS X 10.5) so I can use virtual hosts to develop a few different projects and be able to browse to them from other machines on my network. I've tried to use the following configuration in httpd.conf (boiled down a bit): ServerName macmini.local:80 Listen *:80 NameVirtualHost 1...

OSX lacks memalign

I'm working on a project in C and it requires memalign(). Really, posix_memalign() would do as well, but darwin/OSX lacks both of them. What is a good solution to shoehorn-in memalign? I don't understand the licensing for posix-C code if I were to rip off memalign.c and put it in my project- I don't want any viral-type licensing LGPL-i...