Help with Macintosh programming

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

Archive for April, 2011

Checking if ARA is connected?

    I’m writting a program which need to check if ARA is connected or
not. I’ve tried to create a PPP endpoint and then call the
OTOptionManagement function, but I don’t know which options are
available for a PPP endpoint. Does somebody knows the available options?

    Thanks in advance!
    Damien

.
posted by admin in Uncategorized and have Comment (1)

Disposing something twice — bad?

What happens if you dispose the same Pointer more than once? i.e.

  // We keep track of the memory in more than one variable
pointerA = NewPtr(kPtrSize);
pointerB = pointerA;

  // Then later, since the code doesn’t know any better…
DisposePtr(pointerA);
DisposePtr(pointerB);

In my example, it’s obvious that pointerA and pointerB are the same.
Yet, in my program, it would be quite difficult to ensure that the
memory referenced by a pointer has not already been disposed elsewhere.
(Setting a single pointer to NULL after disposing it isn’t the solution,
because there are other pointers to the same memory location.)

So my question: could the above code cause problems, or is it "safe"? In
other words, is the Memory Manager smart enough to know it has already
dispose the block referenced, and do nothing the second time DisposePtr
is called on an already-disposed block?

Or, should I bend over backwards to make sure this doesn’t happen?

-Vern


www.SpriteWorld.org – get the most powerful 2D animation library for the Mac —
soon to be carbonized!

To email me, replace REPLACEME with Jensen. (Sorry, but SPAM is annoying!)

posted by admin in Uncategorized and have Comments (4)

New To Cocoa – Need help with getting ARP information

Hi

Is there a way to read in the ARP cache, clear the cache, put an entry in
the cache etc from within Cocoa ?

I know from terminal.app you can do this… But cant figure out after 2 days
of reading the developer docs how to do this….

Any help would be appreciated.

Jim McMurry

posted by admin in Uncategorized and have Comments (2)

Recording sound from Cocoa?

Are there any frameworks or hidden calls to allow me to record sounds in
Cocoa apps?

A record option is conspiciously missing from the AppKit’s NSSound.

I’ve bee mucking around with the SoundKit (http://www.musickit.org),
which looked promising, but I can’t make it playback or record (although
it does load and recognise sound), and I now understand recording is
prolly broken under Cocoa.

I was also encouraged by the news the PortAudio (www.portaudio.com??)
libraries supported OS X, but it seems to be the Carbon libs they
support… and there’s no way to include Carbon calls in a Cocoa app,
right?

Angus

posted by admin in Uncategorized and have Comments (4)

plugin for ie

Dear all,

I want to write a plugin for IE/mac version.
But I am new in this field.
My questions are
1.Can I add plugin for IE/Mac?
2.How to do that?
3.Where can i find more help?

Thanks in advance,
comer

posted by admin in Uncategorized and have Comments (6)

Q: AppSwitcher

Hi —

Has anybody deciphered the App Switcher Preferences, stored as a ‘coln’
resource 23790? I try to find out what they mean and write a TMPL or
even a quick application to change them…

Thanks,

– Hans van Maanen

posted by admin in Uncategorized and have Comments (3)

AGL on Darwin: is aglGetCurrentContext broken?

aglGetCurrentContext() is segfaulting on me:

Bus Error


gdb> run

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x714d26d8 in aglGetCurrentContext ()

hmm,  the web docs on developer.apple.com say Carbon Status:
UNSUPPORTED.

how do I get the current openGL context then? (actually, just want to
see if it’s valid– (aglGetCurrentStatus() != NULL)).

thanks

reed

posted by admin in Uncategorized and have Comment (1)

Multiple dataSources for multiple TableViews

Is it possible to link multiple TableViews to one self-created class? I know
it’s possible physically, but how do you distinguish between views for
methods like numberOfRowsInTableView(NSTableView aTableView)? Is there a way
to identify the table so that the count from the correct dataSource can be
sent?

    Or should I just dataSource initiate a new class for each view?

    This is using Java with Project Builder & OS X.1

Jeff

posted by admin in Uncategorized and have Comments (10)

Multiprocessing link error

Hi,

I’m calling the function MPGetNextCpuID, which is in the system header file
MultiprocessingInfo.h.

(Actually, I have no interest in multiprocessing.  I’m interested in the
processor temperature.  Unfortunately, the function
GetCoreProcessorTemperature requires cpuID as one of its arguments).

I get a link error:

Link Error   : undefined ‘MPGetNextCpuID’ (code)
Referenced from ‘main’ in main.cpp

I’ve looked around for some sort of MultiprocessingLib to add to my project
but can’t find any.  What am I missing?

My application is PowerPC, and I’m using CodeWarrior 6 on Mac OS 9.2.

Thanks,

Jerry Krinock
San Jose, CA

Here is my code:

#include <power.h>
#include <Multiprocessing.h>
#include <MultiprocessingInfo.h>

void    InitializeToolbox( void ) ;

void  main( void )
{    
    InitializeToolbox();

    Str255 theString1 ;
    MPCpuID cpuID ;
    MPGetNextCpuID((OpaqueMPCoherenceID *)kMPInvalidIDErr, &cpuID) ;

    NumToString( GetCoreProcessorTemperature(cpuID), theString1) ;
    ParamText(theString1, "\p", "\p", "\p") ;

    NoteAlert(128, NULL) ;

}    

void  InitializeToolbox( void )
{
    InitGraf (&qd.thePort);
    InitFonts();
    InitWindows();
    InitMenus();
    TEInit();
    InitDialogs( NULL );
    InitCursor();
    FlushEvents(everyEvent, 0);

- — -

}

posted by admin in Uncategorized and have Comments (2)

How to detect an active Internet connection?

Hi,

does anyone here know how it is possible to detect an active Internet
connection under MacOS X?
Thanks for your help!

Daniel

posted by admin in Uncategorized and have Comment (1)