mac

fetch the path of the application

Hello All, I am using following code to fetch the path of the application. It works for all cases but fails for front row. CFStringRef cfStrAppShortName = NULL; FSRef appRef; CFURLRef cfAppUrlRef = NULL; CFBundleRef cfAppBundleRef = NULL; CFDictionaryRef cfAppDictRef = NULL; CFStringRef cfStrAppBundleName = NULL; OSErr osErr; c...

Using bts assembly instruction with gcc compiler

I want to use the bts and bt x86 assembly instructions to speed up bit operations in my C++ code on the Mac. On Windows, the _bittestandset and _bittest intrinsics work well, and provide significant performance gains. On the Mac, the gcc compiler doesn't seem to support those, so I'm trying to do it directly in assembler instead. Here's...

Xcode 3.1.2 locks up when loading C++ project...?

I have a project which builds correctly from the command line. On one of my Macs (10.5) running Xcode 3.1.2, I can load it and build it in the Xcode IDE. On my other Mac (same configuration of software), Xcode sometimes loads the project, but always locks up with a spinning beach ball at some point before the build is done. Sometimes ...

how to get Audio Device UID to pass into NSSound's setPlaybackDeviceIdentifier:

Hi All, How can i get audio device UID (USB speaker) to pass into NSSound's setPlaybackDeviceIdentifier: method Thanks ...

Event handler when user manually shutsdown system.

Hello All, I need a event handler when ever shutdown message is send to system. Can anyone help? When ever we try to shutdown a system, and if any dialog box is open shutdown process terminates. I don't want this to happen in my application. i.e if any dialog box is open from my application and I try to shutdown my system then it shoul...

Are there alternatives to ibtool for parsing NIB files?

As part of an i18n project, I need to extract strings from a NIB file programmatically. This can be done quite easily with ibtool, of course. But this is a cross-platform product, of which the NIB is only part. It would be nice if we didn't have to lock string extraction to a particular machine, or have to kludge together catalog-merg...

Sample a process on Mac OS X from a C/C++ program

The Sample Process feature in Activity Monitor is quite a useful thing. However, I need to do the same thing (take samples) of a certain process from another running process (C/C++) or a command line. Is there any way to do this? I have been googling for this since a few days without any luck. ...

Which version of Ruby should I be using now (Jan 2010)?

I have vanilla Mac OS X Leopard which comes with 1.8.6. I am new to RoR so will be following tutorials on the net. Am I likely to find problems following them when using later versions of Ruby? I am currently looking at this one which mentions 1.8.6 and 1.8.7 - http://www.railstutorial.org/book ...

C API with Mysql in XCode

Dear All, Setup: Running Mac OSX Snow Leopard, X Code 3.2.1, Mysql 5.1.42 and Mysql C-Connector 6.0.2, all 64-bit. I am having real difficulty configuring X-Code to run Mysql scripts. XCode is running fine (i.e. can Build and Run), MySQL server is running and I am confident on the installation of the programs listed under my Setup at t...

Parsing RealLegal's .PTX file format

Anyone have experience parsing the RealLegal PTX file format? I'm interested in creating a Mac reader client for this proprietary format. The PTX file format is in wide use for storing court and deposition transcripts. ...

NSString sizeWithAttributes: content rect

How do I get a NSString's size as if it drew in an NSRect. The problem is when I try -[NSString sizeWithAttributes:], it returns an NSSize as if it had infinite width. I want to give a maximum width to the method. Is there any way of doing so? (BTW: Mac OS, not iPhone OS) Thanks, Alex ...

Error On Say Function

I'm using the Apple Script Editor that came with Mac System 7.5.5 and trying to run a simple program: say "Starting to empty the trash." tell application "Finder" empty trash end tell say "Finished emptying the trash." But when I click in the run button, I got this: I got this code from the book AppleScript Language Guide from Ap...

Making a window pop in and out of the edge of the screen

I'm trying to re-write an application I have for Windows in Objective-C for my Mac, and I want to be able to do something like Mac's hot corners. If I move my mouse to the left side of the screen it will make a window visible, if I move it outside of the window location the window will hide again. (window would be pushed up to the left s...

How to compare two dates(dates only; not time) in cocoa?

Basically, I want to figure out if it's the next day. So, I'm storing the current date (e.g. Jan 2) constantly in a plist. But the next time the user opens the application, if the date has changed (e.g. Jan 3), I want to do something. Note that a simple ascending order check wouldn't work because I don't want to know if one date is later...

Unable to get xemacs working on a mac

I installed xemacs using macports, and then when I try to open it I see this - $xemacs Error: Shell widget xemacs has zero width and/or height I tried to google for this error message, but there were no helpful hits. How can I get xemacs to start without this error? Thanks ...

How do I handle multiple file drag/drop from Finder in Mac OS X 10.5?

I need to get the URLs of all files dragged/dropped into my application from Finder. I have a Cocoa app running on 10.6 which does this by using the new 10.6 NSPasteboard APIs which handle multiple items on the pasteboard. I'm trying to backport this app to 10.5. How do I handle this on 10.5? If I do something like below, I only get ...

Using OpenGL ES functions on a Mac

I am trying to draw opengl into 2d space, and am doing the following, however it wont compile: int vPort[4]; glGetIntegerv(GL_VIEWPORT, vPort); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrthof(0, vPort[2], 0, vPort[3], -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoad...

Manipulating WebKit CSS data before loading?

Is it possible to manipulate CSS data before it is parsed in WebKit? I've tried using the delegate method - (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataS...

Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X (10.6)?

It's hard to find Mac-specific answers to this question on the web, so I'm hoping someone out there can put this one to rest for me? My permissions are screwed up on my sites and I'm not sure how to fix them without just slamming a recursive 777 on everything which is quite obviously incorrect. Thanks! ...

[Cocoa OSX] Can't detect color of a pixel in a pixel that... changes color

Hello, I am trying to create an application that when the color of a pixel on screen changes to another one (that I know what it is) it does something, doesn't really matter to the question what it does. Anyway, I am using this: CGImageRef window283x420 = CGWindowListCreateImage(NSMakeRect(284, 420, 1, 1), kCGWindowListOptionOnScreen...