Help with Macintosh programming

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

Archive for April, 2013

Cocoa File Copy with proper progress indication

I’m wondering if anyone has found away (maybe I missed a way) to get a
progress callback (selector) for a file copy in cocoa.
I’m going to be copying some large files, and there is a progress indicator
indicating the copy progress (duh), but I would like it to update during a
specific file copy, not just update after a copy has executed.
How can I get a message letting my app update the progress?

Any Ideas?
T

.
posted by admin in Uncategorized and have Comments (2)

How to select an item in Finder from a Cocoa application ?

How to select an item in Finder from a Cocoa application ?
Only the complete pathname of the item is know.

posted by admin in Uncategorized and have Comments (2)

Cocoa: how to temporarily disable a popup item ?

Cocoa: how to temporarily disable a popup item ?

posted by admin in Uncategorized and have Comment (1)

how to reset time base register? (os 9)

ok, this time i don’t mind answering the inevitable question
"why would anyone want to do that?".
i’m the hardware/software guy for a couple of electromechanical
and video art installations based on older mac hardware, under os 9.
one of them uses orbit quickcams, a small usb camera with a
built-in pan/tilt capability.  i found one, and only one, third-
party driver for this unit under os 9, which works great, except
for one small matter.  there’s a bug such that the driver disables
the video after 1/2 hour, even though a valid, paid-for serial
number has been entered.  repeated pleas to the driver people
have been met with a deafening silence.  now i can’t blame them,
twenty bucks is not enough to motivate the time required to repair
old software.  but i’m left with a real problem.  i don’t have
the time or money to follow the crowd and switch to linux, the
stuff is built, and i have to overcome the 1/2 hour time limit
if the setup is going to sit in an exhibition.

one unpleasant option is to learn some PPC assembler, and go through
the driver with a disassembler looking for the validation code,
and jump over it.  but i’m pretty sure the driver uses UpTime(),
which looks at the time base register (TBR), and it occured to me
that if i could reset this register every 15 minutes the driver
would be none the wiser.  this is a dedicated machine, and it doesn’t
matter if the time zone for abu dhabi gets messed up.  a preliminary
google search indicates that this might be possible, but i thought
i’d ask for any sample code or advice before i spend (any more)
time on this problem.

thanks!

rob shaw

posted by admin in Uncategorized and have Comments (4)

Linking to Mach-O bundle (libpq)

Hello.

I’m developing a generic unix console application. It is linked to a few
libraries including postgresql’s libpq.

When I check shared libraries my application uses with otools -L, it doesn’t
list libpq. Looked like it is linked with static library. so i checked if
dylib file exist in pgsql’s lib directory and found no dylib file but .so
file. file command says it is a Mach-O bundle file. I have no knowledge
regarding Mach-O bundle file.

How do you link bundle files into your application using commandline tools? My
application is not Xcode project but just a Makefile project.

Thanks.

Y. J. Chun

posted by admin in Uncategorized and have Comments (2)

application:openFile and delegate (Cocoa)

My Cocoa is not a document based application.
So in MenuController I use

   - (BOOL)application:(NSApplication *)sender openFile:(NSString *)pathname

In IB "Files’s Owner" is connected to "MenuController" by "delegete"

But when I drag and drop a document icon on the application icon
application:openFile is not called
the application do not open
the application icon is not highlited

Do I miss someting ?

posted by admin in Uncategorized and have Comments (3)

init in childclass is not called

Hello,

I have a class derived from NSImageView:

        @interface RWKImageView : NSImageView

Now I wanted to start a NSTimer in -(id)init:

But it is not called. Also – (id)initWithFrame:(NSRect)frameRect is not
called. And windowDidLoad is not called too. Where can I place the code
in my class to start the NSTimer?

Bye – Robert

posted by admin in Uncategorized and have Comments (4)

How to to display globals in gdb/xcode?

For whatever I try, I can’t see global variables in gdb under xcode. Surely,
there must be a way, but I don’t seem able to find it..

TIA for any help, Hans Otto

posted by admin in Uncategorized and have Comments (2)

How to link .o file build by "as" in xcode (with C file) ?

The "as" assembler was called in Terminal by

   as -L -n -static -o q_asm.o q_asm.s

and global declacred by

   .globl _func

q_asm.o is added to the project and func is declared in header by

   extern int func(int);

The linker complaint

   ld: warning prebinding disabled because of undefined symbols
   ld: Undefined symbols:  _func

I also try (from Terminal)

   ld -r -static -o q_asm.out q_asm.o

and I replace q_asm.o by q_asm.out but I got the same error message.

Next I try  (from Terminal)

   gcc-3.3 -x assembler -arch ppc -o q_asm.o q_asm.s

but I got thousand of syntax error (q_asm.s is a very large file).

I also try to install "Xcode Tools 1.1 Assembly Rule plug-in for Xcode 1.1"
I was able to link a small assemler file, but for q_asm.s I got the
same thousand of syntax error.

How to link .o file build by "as" in xcode (with C file) ?

posted by admin in Uncategorized and have Comment (1)

programming midi/quicktime on mac os 9 (actually 9.1)

Hi,

I would like to be able to access the musical instruments that are
part of Quicktime for mac os 9.1 (can’t remember which release of Quicktime –
I think 5 or 6). That is, I would like to execute procedures that play
various notes on various instruments. Imagine I’m about to try my luck at
music notation software for the mac (os 9.1). Does anybody out there know
where I could find documentation for this?

Another question (sorry for cheating) is, is there some documentation somewhere
about how to access/play the instruments/notes of some of the fancier
software synthesizers out there.

Thanks for ANY help.

Ken Quirici

posted by admin in Uncategorized and have Comments (2)