mac

Why is sysctl producing E_INVAL on Mac OS X?

Below is a pared-down (error/null checks omitted) snippet of C/Obj-C code that uses sysctl to get the argv of a particular process with PID 50. ... int getProcessArgs[3] = { CTL_KERN, KERN_PROCARGS, 50 }; sysctl(getProcessArgs, 3, NULL, &length, NULL, 0); char* processArgs = malloc(length * sizeof(char)); sysctl(getProcessArgs, 3, proce...

How does ps show the argv for all processes on Mac OS X?

I'm trying to identify when a particular process is running, based on its arguments, on Mac OS X. There may be several processes running with the same name, but only one will have the arguments I'm looking for. The processes are not owned by the same user who will be running my code. They will not have modified their argv in any way. ...

Error in python - don't understand

Hi, I'm creating a game, and am quite new to Python generally. I created a function 'descriptionGenerator()' which generates a description for characters and objects either randomly or using variables passed to it. It seemed to be working, but every now and then it wouldn't work correctly. So i placed it in a loop, and it never seems ...

fputs crashing in C on Mac with Xcode

Hi, I have a command line app and have the code chdir("/var"); FILE *scriptFile = fopen("wiki.txt", "w"); fputs("tell application \"Firefox\"\n activate\n",scriptFile); fclose(scriptFile); and when I run it in Xcode I get an EXC_BAD_ACCESS when it gets to the first fputs(); call ...

GDB Not Skipping Functions without Debug Info

I compiled GDB 7 on a Mac OS X Leopard system. When stepping through a C program, GDB fails to step through 'printf()' statements, which probably don't have associated debug information, and starts printing "Cannot find bounds of current function." Here's some output: $ /usr/local/bin/gdb try1 GNU gdb (GDB) 7.1 Copyright (C) 2010 Free...

How to allow click-through and a cursor in a background app while not taking the active appearance away from another app

Here are my goals: My application displays an overlay window above all applications' windows. The user can draw in the overlay window. The mouse cursor changes to a specific cursor while in the overlay window. The application that has the active appearance before summoning the overlay window still has it while the overlay window is up ...

Socket operation on non-socket

I'm running mysql5 on Mac os x 10.5.8 and got this error. How do I solve this? The DB worked fine but stopped working after system update. I think its something related to the socket file which is /tmp/mysql.sock do I need to give it special permissions and owner? Thanks ...

How to open multiple images and be able to drag them in Cocoa

Hello, I'm trying to make a board like that you can import as many pictures as you like to that board. How can I do that? handle multiple images? The other question is how to recognize a drag movement and move the image to the Cursor position? Thanks!! (Mac SDK) ...

Binding Many-to-Many Core Data relationships in UI

Basically my setup is this. I have a many-to-many relationship in Core Data where a student entity can have multiple courses, and a course entity can have multiple students. My problem is in trying to figure out how to bind this relationship to the UI in Interface Builder. I want to be able to add courses to a course array controller, t...

iPhone documentation image transformation

Hi, I would like to know if there is a programming guide or other documentation for image transformation (histogram, matrix black & white, etc ...). ...

How to animate the drawing of a CGPath?

I am wondering if there is a way to do this using Core Animation. Specifically, I am adding a sub-layer to a layer-backed custom NSView and setting its delegate to another custom NSView. That class's drawInRect method draws a single CGPath: - (void)drawInRect:(CGRect)rect inContext:(CGContextRef)context { CGContextSaveGState(context...

How do I properly embed third-party frameworks in my Cocoa application?

I am writing a Cocoa application that makes use of the ParseKit framework (http://www.parsekit.com/). I've included the Framework in the proper folder, added a Copy Files build phase, and added it to the build phase. I can build and launch the application on my Mac. However, when I try to run it on another Mac, it crashes. The Console ...

How do I get the server hostname from a mounted directory with cocoa/obj-c?

Currently when I open a file with my program I can select files on a server by clicking on the server name in the sidebar in an NSOpenPanel and then selecting the file. No problem, this works fine for using the file as long as the shared directory is mounted. I get a path like "/Volumes/SHARENAME/filename.bla". My question is how do...

Mac OS X 10.5 App "not supported on this architecture" cured by copying?

I have an app that updates itself over the internet, and the updated copy won't run on PowerPC machines (G5) running Leopard (10.5.8). Double-clicking the app produces a message saying "You can't open the application "appname" because it is not supported on this architecture." But here's the weird part: if I duplicate the app using th...

How to install launch agent on Mac os x 10.5 / 10.6

I have developed a launchAgent in cocoa. It works fine for me on dev environment, by placing the plist file in location /Library/LaunchAgents/.To distribute and install this on other laptops, I created the package using package maker tool. As part of installation process I want to change permission of the plist file and copy it to /Libra...

How does text-to-speech shortcut read any highlighted text?

Hi, I am trying to develop a cocoa application that requires to read highlighted text from any application. But so far I cannot find any decent solution because the accessibility API isn't always work. (e.g. Firefox) Does anyone know how it is implemented in text-to-speech included in Leopard? I have found this SO question but it isn't ...

How to change direction of Text in Xcode?

Hi all, I want to type in Arabic in Xcode. But I can't copy paste in the Xcode properly in right to left direction. Please help me out. Thanks in advance. ...

IOConnectCallStructMethod question

Hi, I am trying to pass a structure to IOConnectCallStructMethod.the structure declaration I got is below (I am not sure it is correct or not). struct JPEGDriverArgs { int must_be_zero_1; IOSurfaceID src_surface /*in*/; size_t src_size /*in*/; int must_be_zero_2; IOSurfaceID dest_surface /*in*/; size...

How to run an application as root without asking for an admin password?

I am writing a program in Objective-C (Xcode 3.2, on Snow Leopard) that is capable of either selectively blocking certain sites for a duration or only allow certain sites (and thus block all others) for a duration. The reasoning behind this program is rather simple. I tend to get distracted when I have full internet access, but I do need...

Xcode 3.2.2 and iPhone SDK 3.2 on Leopard?

Just a quick question of concern- the latest xcode and iphone sdk states 'Snow Leopard' beside it. Being new to Mac, does installing this on Leopard work? Please don't tell me to upgrade, I just want an answer. ...