2009年11月12日 星期四

Linux 64 platform 下如何判斷 ELF 檔案是 64bits or 32bits

可以使用 file 這個指令
nysonchao@nysonchao-laptop:/usr/lib/mozilla/plugins$ file ./libnpWebATM.so
./libnpWebATM.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped

2009年10月27日 星期二

在NSTimer event內 用 abortModal 來停止 runModalForWindow

http://www.omnigroup.com/mailman/archive/macosx-dev/2004-January/050089.html

Are you calling stopModal from an IBAction method?

Quote from the NSApplication docs:

- (void)stopModal

Stops a modal event loop. This method should always be paired with a
previous invocation of runModalForWindow: or
beginModalSessionForWindow:. When runModalForWindow: is stopped with
this method, it returns NSRunStoppedResponse. This method stops the
loop only if it's executed by code responding to an event. If you need
to stop a runModalForWindow: loop outside of one of its event callbacks
(for example, a method repeatedly invoked by an NSTimer object or a
method running in a different thread), use the abortModal method.
(end quote)

So, it looks to me like you must invoke stopModal only in an IBAction.
Of course, if you're not, then this won't help, but it's all I could
come up with. Hope you get your problem sorted out.

David

2009年10月21日 星期三

Sheets and NSTimer

Re: Sheets and NSTimer


  • Subject: Re: Sheets and NSTimer
  • From: Bjoern Kriews <email@hidden>
  • Date: Mon, 23 Feb 2004 00:52:39 +0100

On 22.02.2004, at 22:01, David Dauer wrote:

Hello

I've got a little problem using an NSTimer while running a sheet.
I tried to create the timer using

myTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self
selector:@selector(myTimerAction:) userInfo:nil repeats:YES] retain];

I suppose you need:

NSTimer *timer = [[NSTimer timerWithTimeInterval: 1.0 target: self selector: @selector(countDown:) userInfo: nil repeats: YES] retain];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer: timer forMode: NSModalPanelRunLoopMode];
...
[timer invalidate];
[timer release];

(I used this one with NSEventTrackingRunLoopMode to make my Timer fire while dragging a slider).

The docs say that only the timer... (not the scheduledTimer...) methods return a Timer that
you can add to run loop afterwards. I did this before and it worked - now your question
led to me fix a possible problem in my code.

2009年9月17日 星期四

2009年9月4日 星期五

Mac OS X 開發筆記

  • Cocoa uses the bottom-left corner of the frame rectangle as the origin for the

    base coordinate system, unlike Carbon applications, which use the top-left corner. Views draw themselves

    in coordinate systems transformed from (and relative to) this base coordinate system.