Help with Macintosh programming

macintosh programming, mac programming, mac os programming, mac os x programming, mac programming language, mac programing

Archive for May, 2013

Authorization Services

I’ve written a small program for our computer labs on campus and I need
to allow it to delete a directory in the /volumes directory if it is
present. Since this program is running as the user, it does not have the
rigths to do this. I have the admin account and password so, can I get
authorization from within the program w/o prompting the user?
I’m reading through the auth services docs right now, but it appears
there is no way to do that. Is this possible or should I just setiud the
program to root and have it run like that?

posted by admin in Uncategorized and have Comments (11)

Mixing Sounds

I’ve made a simple program to play notes at various frequencies using
the Sound Manager.
I need to use the Sound Manager because I require my program to run on
MacOS 9 still.

I construct the sound wave myself as a sine wave (or Sawtooth, Triangle
or Square, optionally).

The sounds produced sound very good.

However, I am also trying to make it play ‘chords’.
To do this, I am simply playing each sound through a separate sound
channel and playing them simultaneously.

When more than one note is played simultaneously, it sounds terrible.

I was thinking that if I mixed the sound myself and played it from a
single sound channel that the quality might improve.

Is there a correct method of mixing sounds together?
I thought of simply averaging the samples, but I’m not sure if that’s

Or, alternatively, is there some way to get my sounds to sound better
while still playing them through separate sound channels?


posted by admin in Uncategorized and have Comments (10)

Can't get application to use correct dynamic library

I have a complex Xcode projects that builds several dynamic libraries,
and applications that use those libraries.   The libraries need to
install in a certain location, and the applications need to install in
another location.

I set the "Installation Path" of the Build Style to the portion of the
path that is common between both the libraries and applications.  I
then created a Copy Build Phase for each target which uses  the
$(INSTALL_PATH) value defined in the Build Style to copy its product
to the correct subdirectory under the common installation path.

When I try to run an application, it complains that it can’t find the
needed library because that application expect the library to be at
the root of the common installation path instead of where I copied it.

How can I let the applications know the proper place of each library
without having to explicitly set the install path for each library.

posted by admin in Uncategorized and have Comments (2)

Looking for Open Source OS X Developers

Good-day Everyone:

        I am the project administrator of a large Java-based Open Source
Project called the jSyncManager (, which is
a pure-Java solution for synchronizing handheld systems based on
PalmSource’s PalmOS.

        It has been quite successful on many platforms, and I’ve been working
on making its functionality available on Mac OS X-based systems.  Being
pure Java this has mostly been simple — put the JARs on a Mac, and
they just work.

        Unfortunately, communications with USB ports isn’t something that the
standard Java APIs provide access to.  The project is currently using
the jUSB project ( to provide access to
USB-based devices, but it only has a full implementation for Linux.

        I’d like to be able to likewise allow the jSyncManager to synchronize
on Macs using USB-based handheld docks (the jSyncManager currently
works on Macs using TCP/IP-based network synchronization and RS-232
serial-based docks and modems).  To do this, I’m going to be starting
an Open Source project to implement the necessary JNI to port either
jUSB and/or JavaX-USB (a newer, more official standard for USB under
Java) for Mac OS X-based systems.

        I’m looking for experienced developers who are interested in working
with me on this project.  I’ve been pouring through Apple’s USB
development documentation and taking notes, but this will be my first
major development project for OS X, so help would be greatly

        If you’re interested in helping to bring USB access to Java
applications on OS X, please e-mail me at "bbarc…".  
I would really apperciate the help :).

Lead Developer & Project Administrator,
The jSyncManager Project.

From the Mac OS X Desktop of Brad BARCLAY
E-Mail:  bbarc…   Web:
AIM/iChat:  yaztr…

posted by admin in Uncategorized and have No Comments

NSString literals with unicode chars

i want to make some NSString literals that contain unicode characters.
for example, the ellipsis character.  a little googling seems to
indicate that people try @"\u2026" but it doesn’t work.  \x didn’t work,
either.  is there any way to do this?

i’d like to avoid directly typing an ellipsis into a source file,
because that seems a little dangerous and susceptible to
misinterpretation.  i’d rather keep my source files in plain ascii.

posted by admin in Uncategorized and have Comment (1)

Drawing an Image with CoreGraphics

I am developing a Cocoa Game and I want to draw an image (PNG would be
acceptable, TIFF better) into a View. I am using a subclass of NSView.
The application either doesn’t draw the image or crashes.

        CGContextRef graphicsContext = [[NSGraphicsContext currentContext]
graphicsPort];  NSString *imagePath = [NSString
        NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
//Loads the image.
        CGDataProviderRef source = (CGDataProviderRef)imageData;
        CGImageRef sprite;
        sprite = CGImageCreateWithPNGDataProvider (
//  Anzeigen des Bildes.
        CGContextDrawImage (
        CGImageRelease (  //Is this required?


Does anyone know what I made wrong? How can I use a (packed/unpacked?)

Thanks in advance

posted by admin in Uncategorized and have Comments (2)

Can't add application to Account Limitations

When adding limitations to a user account by granting access to only
specific applications, our application does not remained checked. You
can add a check in the checkbox next to the application name, but the
value is not retained and the application is not added to the list of
usable applications.

Is there some flag that needs to be present in the info.plist file or
some special permission set somewhere?


posted by admin in Uncategorized and have No Comments

decimal to hex util' for OS X?

Is there a standalone freeware, shareware, utility that is capable of
converting large decimal numbers to hexidecimal, that will work with OS
X ?

(numbers in the billions)


posted by admin in Uncategorized and have Comments (7)

NSWindow in new thread

Hello NG

In my application I have a NSWindowController class to have multiple windows doing
the same thing.
(like safari if you press command N)
Each window has it’s own set of resources and objects that is needs to run.
Now I want that they run in separate threads ( or task ?) . In the main nib I have a
instance of the controlling class that makes up a new window if you press command N.
The function to start the new window:

-(IBAction) newBrowser:(id)sender{
        servers * nServers = [nServerAction nServers];
        articleAction * newWindow = [[articleAction alloc]
initWithWindowNibName:@"NewsBrowser" andGroups:theGroups andServers:nServers];
        [newWindow showWindow:self];

is only the creation of a new instance of a NSWindowController subclass object with

How can i detach the new window and have it in a separate thread for live time?

Thank you for your time and help


posted by admin in Uncategorized and have Comments (11)

Question about Bindings and Archiving

I’m referring to the tutorial "Enhanced Currency Converter" (from ADCHome >
Documentation > Cocoa > Design Guidelines > Cocoa Bindings. I did it . Works
great. Now I’m trying to make it save and open files (since it is based on
an NSDocument class)
I defined an NSArrayController outlet in the ubiquitous "MyDocument.h" which
I connected to the NSArrayContoller instance in IB. Now , apparently, I can
archive the array content of the Controller and dearchive it ( so say the
NSLog’s I put for verifications) But when , on loading a file, the
unarchived array is loaded into the Controller by [myController
setContent:array] , the little TableView remains desperatly empty.
Looks like the table would need a reloadData but how , since it was created
in IB and got no name ?
Is there a simple way to do the trick ? ( without redoing a lot of code
which I could write of course – but then why bindings ? -)

What is still unclear to me is that Bindings allow to do a lot in IB without
much code but when you want to develop your app, you lack any code reference
to the objects you created in IB .
I’d appreciate very much the advice of the experts

posted by admin in Uncategorized and have No Comments