Re: Irregular layout of radio buttons

2010-11-08 Thread vincent habchi
Le 8 nov. 2010 à 22:22, Lee Ann Rucker a écrit :

> It is annoying that you can't do it; Java let you make a group of radio 
> buttons without affecting their layout.

Well… I've banned Java from my world a long time ago! :)

> We have several places where we need this, so I created a custom NSView 
> subclass that found all its radio buttons and added observers on "state" with 
> option NSKeyValueObservingOptionNew. When a button's state changed to 
> NSOnState, it set all the other buttons to NSOffState.

Nice trick! That's much more clever than programming the controller to do it 
"manually". Thanks for the hint!

Vincent

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CATransaction setCompletionBlock - Nested Transactions bug?

2010-11-08 Thread Seth Willits
On Nov 8, 2010, at 8:32 AM, Kyle Sluder wrote:

>>> But transactions aren't actions. I'd even argue that putting this 
>>> convenience method on CATransaction might have been a mistake.
>> 
>> 
>> It's not merely a convenience. We live in an age of blocks; we want the 
>> block-based approach to replace the old delegate-based approach. One is not 
>> merely a convenient form of the other; they are fundamentally different 
>> architectures. For true layer animation (as opposed to view animation) this 
>> *is* the block-based approach. Apple did not give a CAAnimation a completion 
>> block property, so you *have* to use CATransaction to get one. m.
> 
> As I mentioned before, we subclasses CAAnimationGroup to put the completion 
> handler in the "right" (logically consistent) place.


FYI - I filed an enhancement request to add a block to animations instead of 
having to use the delegate. It was closed and I was told to use a 
CATransaction's completion block.




> It's unsafe in the sense that if you call out to other code that
> creates nested transactions, the assumption that your completion
> handler will be called at the time that your last action finishes is
> no longer valid.


"your last action" wasn't quite clear to me, but I assume you meant the last 
action in the outer transaction only. In other words, if the nested 
transactions take longer than the outer actions, you expect the outer 
transaction's completion block to be called first? I don't. I expect it to be 
called after all nested actions occur. If you want to know when *only the 
specific actions* are done, you'd use the animation delegate callback stuff as 
you suggest. 

But the only way to know when all nested things are done, is the transaction's 
completion block. 



I guess since nobody else has chimed in on the behavior I'm seeing, I'll file 
report about it and see what Apple has to say about it.


--
Seth Willits



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Working with C-functions in separate NSThreads: via Stack or Heap?

2010-11-08 Thread Frederick C. Lee
My original reply was too long for Cocoa Dev; then I lost it.
So this is another (small draft)...

It appears I'll be working with blocks, keeping the data/functioning local 
to the stack & copying data out to the GUI:
typedef sat_t (^MyBlock)();

// C - function:
int addFoot(int k) {
return (++k);
}

// Block declaration:
MyBlock MakeSat() {
__block sat_t sat;
__block tle_t tle;
__block int k = 0;

return Block_copy( ^ {
sat.satName = "George";
sat.tsince += 1.0;
k = addFoot(k);
sat.footprint = k;
predict_calc1(2);   // ok.
predict_calc2(&sat, 2); //...passing struct{} ptr.
return sat;
}); 
} // end MyBlock().

// 
int main(void) {

MyBlock myBlock = MakeSat();

printf("\nMyBlock value: %s, since= %g, addFoot= %g TLE name= %s\n",
   myBlock().satName, myBlock().tsince, myBlock().footprint, 
myBlock().tle.name);

Block_release(myBlock);

return 0;
}

---

Output:
MyBlock value: Henry, since= 3, addFoot= 2 TLE name= Frederick C. Lee

... So I'll work with your (B) paradigm: keep the data 'regional' w/in a block.
That way, I can pass the data amongst functions w/in a block and copy
the result to the 'outside' calling ObjC object.

Ric.


On Nov 6, 2010, at 11:24 AM, lwj wrote:

> 
> There it too much missing here to really understand whats going on. There is 
> no context for 'sat_t workingSat'. This can mean very different things 
> depending on where it is.  When initSatWorkArea(&workingSat) is called you 
> are passing a pointer to workingSat and not the structure itself.
> 
> Based on what you have above I think there are 2 possibilities for where 
> workingSat 'lives'.
> 
> A.)
> 
> sat_t workingSat;
> 
> void someFunc(void) {
> 
>initSatWorkArea(&workingSat); 
> 
>...
> }
> 
> In this case workingSat exists in the data section (neither heap nor stack) 
> of your program. There is *only* 1 of them. You can share it between threads 
> but every thread will see the same thing. Unless you want every thread 
> working on the same thing this is *not* what you want.
> 
> 
> B.)
> 
> void someFunc(void) {
> 
>sat_t workingSat;
> 
>initSatWorkArea(&workingSat); 
> 
>...
> }
> 
> In this case workingSat exists on the stack. A new one is created every time 
> someFunc is called. *However*, when someFunc() returns workingSat *NO LONGER 
> EXISTS*. From your description it sounds like initSatWorkArea might pass a 
> pointer to workingSat to a thread but workingSat goes away once someFunc 
> returns.
> 
> There is a good chance that neither one of these is what you want.
> 
> Wayne
> 
> 
> 
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Red spelling underline draws incorrectly in layer-backed views

2010-11-08 Thread David F.
Kyle -- This probably won't help much.  But if the root problem was an 
unflipped context, then I would expect strikethrough and underline to be off as 
well.  I downloaded your test project and added underline and strikethrough to 
your text and they looked fine.

David

On Nov 8, 2010, at 5:05 PM, Kyle Sluder wrote:

> Hi list,
> 
> We've been trying to track down a bug in our CALayer-based view in
> which the red dotted underlines for misspellings appear in the wrong
> place. It looks like they're being drawn in an unflipped graphics
> context, even though we're drawing the text into a CABitmapContext
> we've created ourselves.
> 
> While working on an unrelated bug, I created a simple NIB file that
> contained a layer-backed NSTextView inside a layer-backed NSScrollView
> that's set to automatically resize with its window. Simulating the
> interface (Cmd-R in Interface Builder) showed that even this is
> broken. The red underlines repeat themselves horizontally across the
> view and leave artifacts around when the text is deleted. Furthermore,
> if you drag the window resize handle up to shrink the window, the text
> stays put but the red underlines start sliding about, fixing
> themselves when you let go of the resize handle.
> 
> It looks like NSLayoutManager and CALayer just don't mix. I've filed a
> radar at rdar://problem/8644121. I'm also curious if this is related
> to rdar://problem/8009542 (Scroll view misbehaves with flipped
> layer-hosting document view), since text views are flipped.
> 
> I've put a demo project up at
> http://dl.dropbox.com/u/9699077/CARedSpellingUnderline.zip and a
> screenshot at http://dl.dropbox.com/u/9699077/CARedSpellingUnderline.png
> .
> 
> Has anyone else seen anything similar to this and/or has ideas for a 
> workaround?
> 
> Thanks,
> --Kyle Sluder
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/davidf%40gmx.us
> 
> This email sent to dav...@gmx.us

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Red spelling underline draws incorrectly in layer-backed views

2010-11-08 Thread Kyle Sluder
Hi list,

We've been trying to track down a bug in our CALayer-based view in
which the red dotted underlines for misspellings appear in the wrong
place. It looks like they're being drawn in an unflipped graphics
context, even though we're drawing the text into a CABitmapContext
we've created ourselves.

While working on an unrelated bug, I created a simple NIB file that
contained a layer-backed NSTextView inside a layer-backed NSScrollView
that's set to automatically resize with its window. Simulating the
interface (Cmd-R in Interface Builder) showed that even this is
broken. The red underlines repeat themselves horizontally across the
view and leave artifacts around when the text is deleted. Furthermore,
if you drag the window resize handle up to shrink the window, the text
stays put but the red underlines start sliding about, fixing
themselves when you let go of the resize handle.

It looks like NSLayoutManager and CALayer just don't mix. I've filed a
radar at rdar://problem/8644121. I'm also curious if this is related
to rdar://problem/8009542 (Scroll view misbehaves with flipped
layer-hosting document view), since text views are flipped.

I've put a demo project up at
http://dl.dropbox.com/u/9699077/CARedSpellingUnderline.zip and a
screenshot at http://dl.dropbox.com/u/9699077/CARedSpellingUnderline.png
.

Has anyone else seen anything similar to this and/or has ideas for a workaround?

Thanks,
--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread Lee Ann Rucker

On Nov 8, 2010, at 11:17 AM, vincent habchi wrote:

> Le 8 nov. 2010 à 18:35, Keary Suska a écrit :
> 
>> Well, kind of. You can still use radio buttons--you will simply have to 
>> mimic the "radio" effect across the unrelated buttons. Not difficult 
>> really...
> 
> Indeed, that's not very hard to do. But I just expected to be able to define 
> radio button groups outside a well-defined-table-like-layout.

It is annoying that you can't do it; Java let you make a group of radio buttons 
without affecting their layout.

We have several places where we need this, so I created a custom NSView 
subclass that found all its radio buttons and added observers on "state" with 
option NSKeyValueObservingOptionNew. When a button's state changed to 
NSOnState, it set all the other buttons to NSOffState. 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
On 8 Nov 2010, at 20:11, Greg Parker wrote:
>> I now think that what I am seeing is a minor parsing sort of issue within 
>> the compiler (gcc 4.2) when mixing id with blocks. 
> The more fundamental problem is that gcc C++ does not fully support blocks, 
> period.
Indeed, as soon as it gets a sniff of c++ near a block things start to go badly 
wrong, but I would have hoped that "pure objC" compiled with a c++ compiler 
would pass - and especially pure objC in a .m file (which also leads to a 
different error). Oh well, I'll add another blocks-related bug report. I find 
blocks to be an endless source of bleeding-edge torment, but I like them too 
much to give them up!___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Greg Parker
On Nov 8, 2010, at 10:53 AM, Jonny Taylor wrote:
> I now think that what I am seeing is a minor parsing sort of issue within the 
> compiler (gcc 4.2) when mixing id with blocks. 

The more fundamental problem is that gcc C++ does not fully support blocks, 
period.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Launchd and terminal process launch - is there any difference from that process' viewpoint?

2010-11-08 Thread eveningnick eveningnick
Hi Ken, thanks for the answer

> > Does the first one has some restrictions when it calls Accessibility
> > functions?
> It may, depending on the session type.  Have you set LimitLoadToSessionType 
> in your agent's launchd plist?
>

no, i haven't specified that

>
> > This Launch Agent is supposed to be started everytime, when the system
> > starts.
>
> When the system starts, or when a user logs in to a GUI session?

it is a "Session-start" agent. But: i can start this agent by writing
"launchctl load ~/Library/LaunchAgents/com.my.agent.label.plist"
"launchctl start com.my.agent.label"
in terminal, and i will get the same behavior - in MacOS 10.5 i
experience troubles. If i start it via terminal, it works great.

>What's the point of your agent running for a given user when that user is not 
>logged in?  You may be configuring your agent to be always running at the cost 
>of full access to the Window Server and its services.
Is "session-kind" agent loaded when the user isnt logged in? Well i
didnt delve much into that, i only specify it's a "session-type" and
was glad it worked on Mac OS 10.6.

Maybe i should try some special options in plist? I only specified
there "Start On load", "Not On Demand", working directory and a path
to the binary.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread vincent habchi
Quincey:

> Ah, I see -- I think. You're saying that the radio buttons are aligned 
> normally (left alignment), but are unevenly spaced vertically due to 
> interspersed auxiliary controls for each button?

That's correct.

> In that case, I agree that you still have proper radio button behavior, and 
> your intended solution is the correct one.
> Your original post said the buttons were in "random places", which made me 
> imagine something like map pins. The scenario described above isn't what I 
> would call "random" placement. :)

You're right. That's what I was trying to temper by specifying "from the 
buttons point of view": I meant that the user still sees something ordered, 
while the buttons get kind of random Y coordinates.

Thanks again, have a nice afternoon (I suppose)
Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Launchd and terminal process launch - is there any difference from that process' viewpoint?

2010-11-08 Thread Ken Thomases
On Nov 8, 2010, at 1:10 PM, eveningnick eveningnick wrote:

> what is the difference between a process that was started by launchd and the
> same process, started via terminal (without sudo command) in Mac OS 10.5?

The execution context, as defined in this tech note: 
http://developer.apple.com/library/mac/#technotes/tn2005/tn2083.html

> Does the first one has some restrictions when it calls Accessibility
> functions?

It may, depending on the session type.  Have you set LimitLoadToSessionType in 
your agent's launchd plist?


> This Launch Agent is supposed to be started everytime, when the system
> starts.

When the system starts, or when a user logs in to a GUI session?  What's the 
point of your agent running for a given user when that user is not logged in?  
You may be configuring your agent to be always running at the cost of full 
access to the Window Server and its services.

Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
> On Mon, Nov 8, 2010 at 10:53 AM, Jonny Taylor  wrote:
>>// Both these have errors: "request for member 'frameNumber' 
>> in 'm', which is of non-class type 'objc_object* const'"
>>// when compiled as ObjC++ (.mm file).
> 
> Aha, this is an important point. That's why I didn't immediately pick
> up on the actual problem you were facing.
> 
> Clang parses this without error. It looks like GCC was just never
> updated to handle properties in protocol definitions.
Yes, sorry - I hadn't realised that bit was important at the time... though as 
I noted there is a different (and also, I believe, erroneous) error for a .m 
file___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Kyle Sluder
On Mon, Nov 8, 2010 at 10:53 AM, Jonny Taylor  wrote:
>                // Both these have errors: "request for member 'frameNumber' 
> in 'm', which is of non-class type 'objc_object* const'"
>                // when compiled as ObjC++ (.mm file).

Aha, this is an important point. That's why I didn't immediately pick
up on the actual problem you were facing.

Clang parses this without error. It looks like GCC was just never
updated to handle properties in protocol definitions.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread Quincey Morris
On Nov 8, 2010, at 11:16, vincent habchi wrote:

> What I have is a set of mutually exclusive options, but each one enables a 
> box that is located right under them, giving the user the possibility to 
> enter parameters needed by the option (s)he selected. For example, imagine it 
> is a French ;) restaurant menu dialog. The user could choose between three 
> different desserts, and, within each dessert, some custom items. Thus, for 
> example, a three-flavor ice cream could command a three pop-up box to select 
> each flavor, while a cake would have a single pop-up to choose between 
> chocolate, coffee or vanilla. Therefore, the radio buttons would have to be 
> unevenly spaced.

Ah, I see -- I think. You're saying that the radio buttons are aligned normally 
(left alignment), but are unevenly spaced vertically due to interspersed 
auxiliary controls for each button?

In that case, I agree that you still have proper radio button behavior, and 
your intended solution is the correct one.

Your original post said the buttons were in "random places", which made me 
imagine something like map pins. The scenario described above isn't what I 
would call "random" placement. :)


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Understanding the Run loop idea and the updating of controls during long operations

2010-11-08 Thread eveningnick eveningnick
Hello Fritz

> You are understood: You want to learn how the high-level application and
> event API works by trying to recreate (or at least explain) it using
> lower-level API.
>
> You can't do it. At least not in general.
>
> To provide the high-level functionality, Apple uses the published low-level
> API, but it also uses unpublished API, and adds functionality that isn't in
> any API, and the whole thing relies upon undocumented interactions between
> all the APIs it uses. Apple can do this because every time it revises the
> high-level calls, its engineers know what the low-level and private calls in
> the same OS release will do.
>
> You don't know what Apple knows, and the whole idea of a high-level
> framework is that you do not have to know, and you should not know. You can
> rely on what the documentation says the high-level API does, but you can't
> rely on (or, usually, accurately reproduce) how it does it. Anything you
> try, to duplicate the high-level functionality, is only a partial guess.
>
> The way to understand Cocoa is to use Cocoa as it comes to you. Using Cocoa
> means trusting it to do its job even though you can't see inside it. That is
> in the nature of any modern application framework.
>
> I programmed for the original Mac, in C. It had an API that could be fully
> documented in well under a thousand pages. It was implemented in code that
> was easy to disassemble and read. I could explain what was going on inside
> every call I made. I wrote my own event loop, and handled my own interrupts.
> Those days are gone, and it is horrible to think of going back to them.
>
> Thank you, that's really the topic i am interested in :). I am wondering,
if any kind of "Mac OS Internals" books exist,
except "Mac OS Internals: A system Approach" by Amit Singh? Maybe you know
some blogs of the developers, or something else to read? Or is this kind of
info "a top secret"?


> For your more-specific question, I found many promising leads by googling
> "cocoa application modal progress bar".
>
Yes, i should've typed that in search bar myself before asking the question.
I have found the answer.


> PS: Yes, you can — when necessary — substitute notionally lower-level API
> (ex: Core Foundation, Application Services, BSD) for many things that are in
> Cocoa. (I say "notionally lower-level," because that API is sometimes
> implemented in terms of Cocoa, and not the other way around.) In this
> particular context of learning Cocoa and duplicating the core of
> NSApplication, that's a bad approach.
>
>
That is nothing more than having a good feeling about understanding how
things work in real under the hood. Of course, these things may and will
change with every new version/patch/whatever, but still there are people who
hardly can write any highlevel line of code, without knowing what is really
going on inside the system. And of course, this is insane to put such adhocs
into production.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Understanding the Run loop idea and the updating of controls during long operations

2010-11-08 Thread eveningnick eveningnick
>
> On >10.6 you can safely execute Apple scripts from a secondary thread (see
> previous thread on this matter).
>
> Well, I just checked this using an NSOperation object which executes a
> script. The operation can be alternatively executed on the main thread
> scheduled by the global queue [NSOperation mainQueue] or it can be executed
> on a secondary thread scheduled by any queue which you get via
> [[NSOperationQueue alloc] init]. There is no noticeable difference in the
> execution time of the script, which takes about 15 seconds. (As a contrived
> example, the script launches TextEdit which itself opens a text file of
> about several kByte. The script counts the words, builds a list of words and
> an internal sort routine sorts these words and returns the sorted list.)
>
> The Cocoa app is just a few lines - and it doesn't require any thoughts on
> how to handle the run loop -- there is simply no need for this. There is no
> need for synchronization as well, unless you schedule a number of operations
> concurrently which modify the same object (say a file, or whatever).
>
> I should note however, that a script is not "cancelable" -- it performs
> "atomically" regarding the NSOperation's main method. So, in order to make
> the NSOperation's main method interruptible, you need to partition your work
> in a sequence of smaller actions executed by one or more scripts. Then call
> them in sequence -- preferable in a loop. Before you execute the next script
> you check the cancellation state of the NSOperation. Just return from -main
> when someone had cancelled the operation. The operation can send messages
> about the progress to its delegate (note: custom NSOperation, which defines
> also an appropriate delegate protocol) in every loop as well, and may return
> a result when it eventually finished.
>
> When the NSOperation executes on a secondary thread, the app's main thread
> isn't blocked and receives and processes input without any noticeable delay.
>
> The most challenging task is probably to partition a given script, so that
> the task becomes interruptible when executed in a NSOperation.
>

Thank you Andreas, i really appreciate your work. I dont really know, why
did it slow down in my case.
Well now we know it should work without any slowdown :)
My application has to be able to be launched in Leopard as well, therefore
i've left this multithreading approach and i just run the runloop
periodically inbetween "applescript chunks" during that long operation.
Fortunately, it works fine so far, updating all the controls "in time".
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread vincent habchi
Le 8 nov. 2010 à 18:35, Keary Suska a écrit :

> Well, kind of. You can still use radio buttons--you will simply have to mimic 
> the "radio" effect across the unrelated buttons. Not difficult really...

Indeed, that's not very hard to do. But I just expected to be able to define 
radio button groups outside a well-defined-table-like-layout.

Cheers!
Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread vincent habchi
Quincey:

> It sounds like you're trying to do something roughly analogous to pins in 
> MapKit. That is, you have a number of indicators, only one of which is in 
> some kind of distinguished state. I think it's a mistake to think of these as 
> radio buttons, even though radio button sets also have a number of 
> indicators, only one of which is in some kind of distinguished state.

Not really. What I have is a set of mutually exclusive options, but each one 
enables a box that is located right under them, giving the user the possibility 
to enter parameters needed by the option (s)he selected. For example, imagine 
it is a French ;) restaurant menu dialog. The user could choose between three 
different desserts, and, within each dessert, some custom items. Thus, for 
example, a three-flavor ice cream could command a three pop-up box to select 
each flavor, while a cake would have a single pop-up to choose between 
chocolate, coffee or vanilla. Therefore, the radio buttons would have to be 
unevenly spaced.
 
> Thus, I'd suggest you'd end up with a better user experience by using 
> something else (image views, or buttons with custom images) -- even something 
> dot-like -- that isn't recognizably a standard radio button.

That's what I did in fine, but why not give the standard buttons a radio button 
style, since they actually behave as true radio button, so they abide by the 
same semantics.

> Arranging for only one button to be selected at a time is fairly trivial, I 
> think, so you're not going to be investing a lot of time into reinventing the 
> wheel.
> 
> Incidentally, using a subview or control for each indicator is a fairly 
> heavyweight solution, with performance implications if there could be a lot 
> of them. It may also be better to integrate them into the drawing of the 
> underlying view (I'm assuming it's a custom view). That does mean reinventing 
> the correct tracking behavior when they're clicked on, but that's not too 
> hard either.

Well, it is just a matter of enabling or disabling the related box.

Thanks a lot again!
Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Launchd and terminal process launch - is there any difference from that process' viewpoint?

2010-11-08 Thread eveningnick eveningnick
what is the difference between a process that was started by launchd and the
same process, started via terminal (without sudo command) in Mac OS 10.5?
Does the first one has some restrictions when it calls Accessibility
functions?

Here is the Preface to my problem. (i apologize that it is a little
complicated and long but i didnt know which parts of the story are
insignificant)

I have three applications: A terminal application written in C (let's call
it a Launch Agent), a cocoa application (let's call it PlugIn) and some
third party GUI app (Master Application).
This Launch Agent, being launched, watches for all other process being
launched, and when it detects that third party Master Application has been
started, it launches PlugIn app.

This Launch Agent is supposed to be started everytime, when the system
starts. That is why i have created a launchd plist file, and i can
start/stop this agent using launchctl command. But of course, I still can
start Launch Agent by opening Terminal, changing directory to the folder
where is located and just typing its binarie's filename instead.

Thus, there are two way to start PlugIn Application:
1) LaunchD starts Launch Agent, which starts PlugIN when Master App is
started
2) a user from terminal starts Launch Agent, which starts PlugIN when Master
App is started

The PlugIn app installs "accessibility application state observers" into now
launched Master Application, using AXObserverAddNotification(myObserver,
thirdAppElement, kAXApplicationDeactivatedNotification, NULL); (actually, it
installs kAXApplicationDeactivatedNotification,
kAXApplicationActivatedNotification, kAXApplicationShownNotification,
kAXApplicationHiddenNotification).

Now the problem i am faced to:
In Mac OS 10.6 it all works great and i get error code 0 (NoError) after
calling AXObserverAddNotification, and my callbacks are called when the
status of Master Application changes (like activated/deactivated). No
matter, by whom the PlugIn app had been started - by started from a Terminal
manually Launch Agent, or by Launch Agent started using launchctl.

In Mac OS 10.5 i get a problem: the application still works flawlessly if i
Launch Agent is started from a Terminal, but  the function
 AXObserverAddNotification constantly returns kAXErrorCannotComplete. The
Master Application is already launched, it has displayed all its windows,
but i still can't register a callback. (interesting fact that i still can
successfully install EventTaps into that Master application though).

What can cause such a behaviour? The only sane explanation for me is
that in Leopard the process, started by launchd and by a user (via
terminal)  -- and therefore the processes (like, my PlugIN), spawned by such
a process, do not have equal privileges to call accessiblity functions. What
could i do to deal with this problem?

If what i described isn't clear enough, i can write a "model" of this
situation - two simple applications - to show "on a real example".

Thanks for any answer!
George
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
> I'm new at this too, so perhaps I am completely off here. My guess is that it 
> isn't the const that is messing this up, but the non-class type. The problem 
> I see is that "frame" is a pointer to an objc_object and objc_objects aren't 
> the same as NSObjects (but, like I said, I'm new, so maybe they are 
> interchangeable here). Does it work if you try declaring frame as a 
> NSObject instead of an id?
It was your suggestion here that got me thinking along the right track, in 
fact, but that declaration does not actually make any sense as far as I know - 
that is not the normal way of declaring a generic pointer that conforms to a 
protocol, and it leads to a whole load of warnings/errors elsewhere in the 
code...___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
Thankyou everybody for your help (and patience!) with this one. I have indeed 
been making some wrong assumptions and as I result much of what I was writing 
was incorrect. From the various helpful replies I have received, I have (I 
hope!) got a much clearer understanding of what is and isn't going on.

I now think that what I am seeing is a minor parsing sort of issue within the 
compiler (gcc 4.2) when mixing id with blocks. In the example 
code below, everything works ok except for two lines, which lead to compile 
errors. [The mention of 'const' in the error was what was leading to my 
incorrect claims earlier, since that had got me thinking the problem was 
related to how you can't by default modify variables declared outside blocks. 
Sorry!].

I believe the compiler should not be objecting to the lines that it reports 
errors for...
Jonny

= BEGIN CODE =

// Declare a class with a property
@interface MyClass
@property (readwrite) int frameNumber;
-(int)frameNumber2; // Try declaring a straight function 
just to see if it makes a difference
@end

void foo(MyClass *m)
{
printf("%d %d n", m.frameNumber, m.frameNumber2);   // ok

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
printf("%d %d\n", m.frameNumber, m.frameNumber2);   // ok
});
}

// Try the same, but with a protocol rather than a concrete class type
@protocol MyProtocol
@property (readwrite) int frameNumber;
-(int)frameNumber2;
@end

void foo2(id m)
{
printf("%d %d n", m.frameNumber, m.frameNumber2);   // ok
printf("%d %d\n", [m frameNumber], [m frameNumber2]);   // ok


dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
^{
// Both these have errors: "request for member 'frameNumber' in 
'm', which is of non-class type 'objc_object* const'"
// when compiled as ObjC++ (.mm file).
// I get a different error: "request for member 'frameNumber' 
in something not a structure or union"
// when compiled as ObjC (.m file).
printf("%d\n", m.frameNumber);
printf("%d\n", m.frameNumber2);
// Both these are ok
printf("%d %d\n", [m frameNumber], [m frameNumber2]);
});
}

= END CODE =

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread Quincey Morris
On Nov 8, 2010, at 07:01, Vincent Habchi wrote:

> roughly, I would like to set up a view with radio buttons laid out on random 
> places (well, actually not random, but from the buttons point of view, yes). 
> I suppose I can't use a NSMatrix, so I'll have to use regular buttons 
> (mimicking radio ones) and simulate radio behavior in my controller, is that 
> right?

FWIW, I think you're making a UI mistake -- admittedly (if it *is* a mistake) a 
fairly subtle one.

It sounds like you're trying to do something roughly analogous to pins in 
MapKit. That is, you have a number of indicators, only one of which is in some 
kind of distinguished state. I think it's a mistake to think of these as radio 
buttons, even though radio button sets also have a number of indicators, only 
one of which is in some kind of distinguished state.

The problem is that the matrix-like arrangement of radio buttons is part of 
what identifies them *as* radio buttons (along with their gum-drop appearance), 
and unambiguously delineates which buttons belong to a single group. As soon as 
you randomize the geometry, you lose a lot of those semantic cues.

Thus, I'd suggest you'd end up with a better user experience by using something 
else (image views, or buttons with custom images) -- even something dot-like -- 
that isn't recognizably a standard radio button. 

Arranging for only one button to be selected at a time is fairly trivial, I 
think, so you're not going to be investing a lot of time into reinventing the 
wheel.

Incidentally, using a subview or control for each indicator is a fairly 
heavyweight solution, with performance implications if there could be a lot of 
them. It may also be better to integrate them into the drawing of the 
underlying view (I'm assuming it's a custom view). That does mean reinventing 
the correct tracking behavior when they're clicked on, but that's not too hard 
either.

As I said: FWIW


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Irregular layout of radio buttons

2010-11-08 Thread Keary Suska
On Nov 8, 2010, at 8:01 AM, Vincent Habchi wrote:

> Hi everybody,
> 
> roughly, I would like to set up a view with radio buttons laid out on random 
> places (well, actually not random, but from the buttons point of view, yes). 
> I suppose I can't use a NSMatrix, so I'll have to use regular buttons 
> (mimicking radio ones) and simulate radio behavior in my controller, is that 
> right?

Well, kind of. You can still use radio buttons--you will simply have to mimic 
the "radio" effect across the unrelated buttons. Not difficult really...

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Understanding the Run loop idea and the updating of controls during long operations

2010-11-08 Thread Andreas Grosam

On Nov 7, 2010, at 4:35 PM, eveningnick eveningnick wrote:

>> - Multiple threads, figure out your bug with synchronization around
>> AppleScripts (there is no reason the library would run slower just because
>> you add a new thread).
>> 
> I am not doing no synchronization at all, nor i need any for my application.
> I was thinking this is done by the framework, only because i was reading
> that NSAppleScript wasn't thread safe, and became so only lately. But as
> long as "we shouldn't care how is it built inside", i only assumed this
> thread safety had been provided in exchange of performance (when the apple
> events - this is how NSAppleScript allows the application to retrieve result
> value from applescript - are still received in the main thread, which
> suspends both threads or something). Well actially i get a general
> performance slowdown.

On >10.6 you can safely execute Apple scripts from a secondary thread (see 
previous thread on this matter). 

Well, I just checked this using an NSOperation object which executes a script. 
The operation can be alternatively executed on the main thread scheduled by the 
global queue [NSOperation mainQueue] or it can be executed on a secondary 
thread scheduled by any queue which you get via [[NSOperationQueue alloc] 
init]. There is no noticeable difference in the execution time of the script, 
which takes about 15 seconds. (As a contrived example, the script launches 
TextEdit which itself opens a text file of about several kByte. The script 
counts the words, builds a list of words and an internal sort routine sorts 
these words and returns the sorted list.)

The Cocoa app is just a few lines - and it doesn't require any thoughts on how 
to handle the run loop -- there is simply no need for this. There is no need 
for synchronization as well, unless you schedule a number of operations 
concurrently which modify the same object (say a file, or whatever).

I should note however, that a script is not "cancelable" -- it performs 
"atomically" regarding the NSOperation's main method. So, in order to make the 
NSOperation's main method interruptible, you need to partition your work in a 
sequence of smaller actions executed by one or more scripts. Then call them in 
sequence -- preferable in a loop. Before you execute the next script you check 
the cancellation state of the NSOperation. Just return from -main when someone 
had cancelled the operation. The operation can send messages about the progress 
to its delegate (note: custom NSOperation, which defines also an appropriate 
delegate protocol) in every loop as well, and may return a result when it 
eventually finished.

When the NSOperation executes on a secondary thread, the app's main thread 
isn't blocked and receives and processes input without any noticeable delay.

The most challenging task is probably to partition a given script, so that the 
task becomes interruptible when executed in a NSOperation.


Regards,
Andreas___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Kyle Sluder
On Mon, Nov 8, 2010 at 8:37 AM, Jonny Taylor  wrote:
> I'm afraid I'm not sure if I understand exactly what you're asking. I would 
> like to be able access the "frame number" property (which is in fact stored 
> as a variable within the class, and is fixed soon after instantiation) in 
> spite of the fact that I only have a 'const' pointer to the object at the 
> time I want to access it. Semantically I don't see why it should be unsafe to 
> attempt to find out the value of that property.

Since you haven't posted enough code for me to reproduce your exact
scenario, I've made a different demo: https://gist.github.com/667967

I don't get the same error you get. Rather, when compiling with GCC I
get "request for member ‘blah’ in something not a structure or union".
With clang, I get no errors at all. Constness doesn't come up here.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: MapKit on iPad

2010-11-08 Thread Fritz Anderson
On 7 Nov 2010, at 8:41 PM, William Squires wrote:

> 1) I know that an MKMapView can display a location given GPS coords, and that 
> it can do reverse geo-caching to get the nearest address to a GPS coordinate. 
> Can it go the other way - i.e. can I feed it an address (in an NSString) of 
> the form: ",, " (these are all US 
> addresses) and get it to show that location directly, or at least give me the 
> GPS coords to feed to it? Will it work for addresses in Mexico (if I leave 
> off the zip code)?

No. Reading the MapKit docs will tell you affirmatively that MapKit does not 
geocode (the word you mean instead of geocache). Google for "free geocoding 
service." Further, examine the Google license referenced in most of the docs: I 
believe you are forbidden to use the reverse-geocoding service for any purpose 
other than use with a Google-provided map.

You can use the Google Static Map API directly to get a smallish PNG of a map 
centered on an address, if that's all you need.

> 2) Can I take a snapshot of an MKMapView (in a format UIImage can handle) and 
> use it to cache the display once the MKMapView loads and the user is finished 
> zooming in/out, sliding it around, etc... by touching a UIButton?

I believe the Apple/Google ecosystem intends that MapKit maps are to be used 
only for immediate display to the user. I don't see any way to capture a map 
image as data.

> 3) what are the odds Apple dev would be willing to update the iPhone 
> simulator to be initialized to display any GPS coords (when using an 
> MKMapView) instead of their corporate HQ if I file a feature request? Even 
> better if the simulator, on startup, would detect any iDevice (iPod 
> Touch/iPhone/iPad) and use its hardware features (GPS, accelerometer, mag 
> compass, camera, etc...) during the simulation if the device shows up in 
> Xcode's Organizer window. It would be OK if you had to load a special iOS 
> program onto the device (from the App store) to make this work as long as it 
> was free for those in the iOS dev program (i.e. they paid the $99 fee)

I don't know the odds, but you can do something about it. File a bug at 
bugreporter.apple.com requesting the features. I have heard that Apple has a 
defaults switch for the simulator that allows it to use the Mac Location 
Services location instead of the static Cupertino one; there have been requests 
to expose/document that setting. Add your voice with a bug report.

But you'll have to test on a real device sooner or later. This is just one more 
thing you need to test.

— F

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread David Duncan
On Nov 8, 2010, at 9:04 AM, Jonny Taylor wrote:

> In this particular case I don't have much choice in the matter - the standard 
> behaviour of blocks is to provide 'const' access to variables declared 
> outside the block (and with good reason I think). In the example I gave, I 
> want to access the property from within a block. I can work around it as 
> shown in my example, or declare the function parameter (frame object pointer) 
> with the __block prefix, but I feel that neither should be necessary.

Blocks don't redeclare values as 'const', it makes copies of those values for 
the block's own use. That is what is meant by providing 'const' access – if you 
change the variables, you won't see that change reflected in the originals. For 
objects the copied value is just a pointer (the object will be retained) so the 
'const' access is usually a moot point, since you don't care about the pointer 
not changing, you care about the object not changing. There is no direct 
support for const objects in Blocks – if you have an object pointer, you are 
free to change the object to your heart's content.

So as I surmised when I asked the question, you don't need the 'const' modifier 
at all. Just declare and use the variable normally.
--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Interrupt copyItemAtPath

2010-11-08 Thread Kyle Sluder
On Mon, Nov 8, 2010 at 8:36 AM, gMail.com  wrote:
> Something like
>    if(stage == kFSOperationStageComplete){
>        go and copy the next file
>    }
>
> would make me redesign all of my code...
> So it doesn't sound as the best solution for me.

Sometimes you have to realize that the design you started with is the
wrong design.

This is why we have revision control.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
In this particular case I don't have much choice in the matter - the standard 
behaviour of blocks is to provide 'const' access to variables declared outside 
the block (and with good reason I think). In the example I gave, I want to 
access the property from within a block. I can work around it as shown in my 
example, or declare the function parameter (frame object pointer) with the 
__block prefix, but I feel that neither should be necessary.

I extended my question to the more general case of a getter on a const object 
because (maybe because I come from a c++ background?) I am in the habit of 
declaring object parameters as const if I do not expect them to change within a 
function, just to make it clear to myself what is or isn't happening, etc. I 
have situations where I don't see why I shouldn't declare a function parameter 
as 'const', because nothing within it is changing, but if I want to "read" 
*any* state of the object in objective c (via a getter) it seems that I cannot 
declare it const... which seems rather odd to me.

If you'll forgive my thinking in c++ terms, the equivalent in c++ would be to 
write something like:

int Frame::FrameNumber() const { return frameNumber; }

void SomeFunction(const Frame *frame)
{
int num = frame->FrameNumber(); // Would not be permitted in the objC 
equivalent, since 'frame' is const
}

// or one might alternatively write

void AnotherFunction(Frame *frame)
{
dispatch_async(analysisSerialQueue,
^{
// Do some processing
latestFrameNumberProcessed = frame->FrameNumber();  
// Would not be permitted either in objC since frame becomes const within the 
block
});
}


On 8 Nov 2010, at 16:53, David Duncan wrote:

> My question is why do you need to have a 'const' pointer.
> 
> On Nov 8, 2010, at 8:37 AM, Jonny Taylor wrote:
> 
>> I'm afraid I'm not sure if I understand exactly what you're asking. I would 
>> like to be able access the "frame number" property (which is in fact stored 
>> as a variable within the class, and is fixed soon after instantiation) in 
>> spite of the fact that I only have a 'const' pointer to the object at the 
>> time I want to access it. Semantically I don't see why it should be unsafe 
>> to attempt to find out the value of that property.
> 
> --
> David Duncan
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: Ping host and port

2010-11-08 Thread Shawn Bakhtiar


http://www.ntop.org

It is your friend. It is open source, and IMHO it incorporates a LOT of what 
you are asking for. 

I would simply run it in the background with the output redirected to a 
NSScanner, or something that could pars it out. 

At a deeper level, you can probably integrated directly into its library.


> From: tjo...@acworld.com
> Date: Sun, 7 Nov 2010 15:16:30 -0800
> To: d...@rudedog.org
> CC: cocoa-dev@lists.apple.com
> Subject: Re: Ping host and port
> 
> thanks a bunch, this is great!
> 
> tom
> On Nov 7, 2010, at 2:40 PM, Dave Carrigan wrote:
> 
> > 
> > On Nov 7, 2010, at 2:31 PM, Kyle Sluder wrote:
> > 
> >> On Nov 7, 2010, at 2:24 PM, Tom Jones  wrote:
> >> 
> >>> Ops, thanks! 
> >>> 
> >>> I have not really done much with sockets. Is there an example you know of 
> >>> that I can learn from?
> >> 
> >> THE guide to socket programming: http://beej.us/guide/bgnet/
> > 
> > Specifically, section 5.4 has pretty much all the code you need, other than 
> > checking the return result of connect and possibly looking at errno. Don't 
> > forget to call freeaddrinfo() at the end or you'll leak memory.
> > 
> > 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.com
  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread David Duncan
My question is why do you need to have a 'const' pointer.

On Nov 8, 2010, at 8:37 AM, Jonny Taylor wrote:

> I'm afraid I'm not sure if I understand exactly what you're asking. I would 
> like to be able access the "frame number" property (which is in fact stored 
> as a variable within the class, and is fixed soon after instantiation) in 
> spite of the fact that I only have a 'const' pointer to the object at the 
> time I want to access it. Semantically I don't see why it should be unsafe to 
> attempt to find out the value of that property.

--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread Jonny Taylor
I'm afraid I'm not sure if I understand exactly what you're asking. I would 
like to be able access the "frame number" property (which is in fact stored as 
a variable within the class, and is fixed soon after instantiation) in spite of 
the fact that I only have a 'const' pointer to the object at the time I want to 
access it. Semantically I don't see why it should be unsafe to attempt to find 
out the value of that property.

Either way, hopefully the actual code helps to answer your question:

-(void)analyzeFrameAsync:(id)frame
{
int num = frame.frameNumber;// Temporary variable avoid 
problems with calling method on 'frame' [const] from block
dispatch_async(analysisSerialQueue,
^{
[analyzer processFrame:frame];
self.latestFrameNumberProcessed = num;  // I can't call 
frame.frameNumber from within the block (compiler error)
});
}



On 8 Nov 2010, at 16:29, David Duncan wrote:

> It might be useful to know what you expect to get from the const reference in 
> the first place? Primarily because I highly suspect that it is not necessary 
> to ensure the semantics that you desire.
> 
> On Nov 8, 2010, at 4:59 AM, Jonny Taylor wrote:
> 
>> I have encountered what I presume is a common newcomer's problem, but I 
>> haven't had any luck with google (maybe I'm using the wrong search terms?). 
>> Suppose I have a const id, e.g. "const id frame". If I 
>> attempt to call a getter for the object I get the following compiler error:
>> request for member 'frameNumber' in 'frame', which is of non-class type 
>> 'objc_object* const'
> 
> --
> David Duncan
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Interrupt copyItemAtPath

2010-11-08 Thread gMail.com
I have verified that the waiting loop

while(!gFileCopiedDone && !mUserPressedStop){
 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5.0, true);
}

slows down the copy speed 3 times and more. I can't use that.
I have to copy a hierarchical list of files, and let the user make his
choice if a problem occurs during the copy of each file.
Is a different way to get a value returned at each file copied?

Something like
if(stage == kFSOperationStageComplete){
go and copy the next file
}

would make me redesign all of my code...
So it doesn't sound as the best solution for me.

--
Leo


> Da: Sherm Pendley 
> Data: Sun, 7 Nov 2010 19:33:26 -0500
> A: "gMail.com" 
> Cc: Ken Thomases , 
> Oggetto: Re: Interrupt copyItemAtPath
> 
> On Sun, Nov 7, 2010 at 6:06 PM, gMail.com  wrote:
>> 
>> A quick question more please.
>> As I have seen on the Apple sample code "FSFileOperation",
>> I can wait until FSCopyObjectAsync is done, using CFRunLoopRunInMode.
>> 
>>        while(!gFileCopiedDone && !mUserPressedStop){
>>            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 5.0, true);
>>        }
>>        if(mUserPressedStop){
>>            FSFileOperationCancel(fileOp);
>>            return -12;
>>        }
>> 
>> The user can press a button and set mUserDidStop = YES;
>> and I set the gFileCopiedDone to YES in the callback method,
>> when stage == kFSOperationStageComplete
>> 
>> Since I have several files to copy, one by one, this way I can better manage
>> each single copy. Everything seems to work flawlessly. But, I ask, do you
>> think it's ok with the Mac standards? I mean, I have checked and the menu
>> works, the other apps work... Could this waiting loop cause some problem?
> 
> Since the menu works - what happens if the user quits the app? You
> might want to call FSFileOperationCancel() then too, to make sure the
> partial copy gets cleaned up before your app exits.
> 
> sherm--
> 
> -- 
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Synchronizing iOS redraw

2010-11-08 Thread Matt Neuburg
On Sun, 7 Nov 2010 21:04:36 -0800, Rick Mann  said:
>I have a need to synchronize the actual display update of a UIView hierarchy 
>with real time. In my case, I update the display once per second, and I want 
>the display to update *on* the second.
>
>Since I don't really have control of when the draw happens, I don't know how 
>to do this. I update all the various UILabels in my view, and then exit the 
>current iteration of the run loop. Some time later iOS completes drawing and 
>the display updates.

To force a view to update right now instead of waiting for the next "redraw 
moment" (as I call it), you might be able to take advantage of the "back door" 
rule that says that a transaction block that orders an animation to a layer, if 
the block is not preceded by any changes to the layer, will cause animation to 
begin immediately when the CATransaction class method +commit+ is called, 
without waiting for the redraw moment. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CATransaction setCompletionBlock - Nested Transactions bug?

2010-11-08 Thread Kyle Sluder
On Nov 8, 2010, at 8:26 AM, Matt Neuburg  wrote:

> On Sun, 7 Nov 2010 14:28:46 -0800, Kyle Sluder  said:
> 
>> But transactions aren't actions. I'd even argue that putting this 
>> convenience method on CATransaction might have been a mistake.
>> 
> 
> It's not merely a convenience. We live in an age of blocks; we want the 
> block-based approach to replace the old delegate-based approach. One is not 
> merely a convenient form of the other; they are fundamentally different 
> architectures. For true layer animation (as opposed to view animation) this 
> *is* the block-based approach. Apple did not give a CAAnimation a completion 
> block property, so you *have* to use CATransaction to get one. m.

As I mentioned before, we subclasses CAAnimationGroup to put the completion 
handler in the "right" (logically consistent) place.

--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Calling getter on const object

2010-11-08 Thread David Duncan
It might be useful to know what you expect to get from the const reference in 
the first place? Primarily because I highly suspect that it is not necessary to 
ensure the semantics that you desire.

On Nov 8, 2010, at 4:59 AM, Jonny Taylor wrote:

> I have encountered what I presume is a common newcomer's problem, but I 
> haven't had any luck with google (maybe I'm using the wrong search terms?). 
> Suppose I have a const id, e.g. "const id frame". If I attempt 
> to call a getter for the object I get the following compiler error:
> request for member 'frameNumber' in 'frame', which is of non-class type 
> 'objc_object* const'

--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Synchronizing iOS redraw

2010-11-08 Thread David Duncan
On Nov 7, 2010, at 11:46 PM, Kyle Sluder wrote:

> Your solution is probably going to involve using OpenGL and a
> CADisplayLink:http://developer.apple.com/library/ios/#documentation/QuartzCore/Reference/CADisplayLink_ClassRef/Reference/Reference.html


While you probably will need CADisplayLink, you may or may not need OpenGL. You 
can experiment with using a CADisplayLink to update a view/layer hierarchy and 
see if that gets what you need.
--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CATransaction setCompletionBlock - Nested Transactions bug?

2010-11-08 Thread Matt Neuburg
On Sun, 7 Nov 2010 14:28:46 -0800, Kyle Sluder  said:

>But transactions aren't actions. I'd even argue that putting this convenience 
>method on CATransaction might have been a mistake.
>

It's not merely a convenience. We live in an age of blocks; we want the 
block-based approach to replace the old delegate-based approach. One is not 
merely a convenient form of the other; they are fundamentally different 
architectures. For true layer animation (as opposed to view animation) this 
*is* the block-based approach. Apple did not give a CAAnimation a completion 
block property, so you *have* to use CATransaction to get one. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CAShapeLayer curved path animation

2010-11-08 Thread David Duncan
Could you share the before & after curves then?

On Nov 6, 2010, at 6:36 PM, Gideon King wrote:

> Sorry, I must have not been clear - these are not before and after curve 
> definitions. They are two approaches I tried. First I was using the curve to 
> approach, and when that wasn't working nicely, I tried the quad curve.

--
David Duncan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Irregular layout of radio buttons

2010-11-08 Thread Vincent Habchi
Hi everybody,

roughly, I would like to set up a view with radio buttons laid out on random 
places (well, actually not random, but from the buttons point of view, yes). I 
suppose I can't use a NSMatrix, so I'll have to use regular buttons (mimicking 
radio ones) and simulate radio behavior in my controller, is that right?

Thanks!
Vincent___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mock the internet

2010-11-08 Thread Scott Andrew
There are a couple of options I have used..

1.) User your mac's local web server.
2.) MAMP which includes a full Web Server with mySQL. 
http://www.mamp.info/en/index.html. I use this later a lot for creating and 
testing custom backend services and client calls locally.

Scott Andrew

On Nov 8, 2010, at 1:53 AM, Yung-Luen Lan wrote:

> Hi,
> 
> I'm writing a framework for web API like flickr. However, I don't want
> my test failed depending on the server status.
> (And I don't want it hit the server every time I build my project.)
> 
> Is there any easy way to "fake" the network layer? I don't think
> swizzle the NSURLConnection is enough because the HTTP intermediate
> framework my project depends use CFNetwork.
> Conditional compile and mocking the response inside the HTTP
> intermediate framework is bad since it's not even my code.
> 
> Any suggestion for this?
> 
> Regards,
> yllan
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com
> 
> This email sent to scottand...@roadrunner.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Interrupt copyItemAtPath

2010-11-08 Thread gMail.com
Sherm,
I verified, if I quit, the file being copied gets properly deleted, because
before quitting, in the metho

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mock the internet (with my crumby native English corrected)

2010-11-08 Thread Jerry Krinock

On 2010 Nov 08, at 04:56, jonat...@mugginsoft.com wrote:

Jonathan gave good answers but you're probably going to need a little more help.

> During development can you not target a local httpd instance that doesn't 
> support the full API but simply returns an acknowledgment/error response?

These might get you started:
http://en.wikibooks.org/wiki/Mac_OS_X_Tiger/Using_your_Mac_as_a_Web_Server
http://techtrouts.com/mac-os-x-105-web-sharing-forbidden-403-on-httplocalhostusername/

> You could even build such a responder into your own app and activate it only 
> for development builds.

I considered doing that a year or so ago.  Search the archives of 
MacNetworkProg list .  Also, you should ask any 
further questions over there since it's a more appropriate list for this kind 
of thing.

Either way, you'll find it to be somewhat involved.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mock the internet (with my crumby native English corrected)

2010-11-08 Thread jonat...@mugginsoft.com


On 8 Nov 2010, at 09:53, Yung-Luen Lan wrote:

> Hi,
> 
> I'm writing a framework for web API like flickr. However, I don't want
> my test failed depending on the server status.
> (And I don't want it hit the server every time I build my project.)
> 
> Is there any easy way to "fake" the network layer? I don't think
> swizzle the NSURLConnection is enough because the HTTP intermediate
> framework my project depends use CFNetwork.
> Conditional compile and mocking the response inside the HTTP
> intermediate framework is bad since it's not even my code.
> 

A faked network layer doesn't sound appealing. If I read this right you require 
an efficient response from the server component.

During development can you not target a local httpd instance that doesn't 
support the full API but simply returns an acknowledgment/error response?

You could even build such a responder into your own app and activate it only 
for development builds.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Calling getter on const object

2010-11-08 Thread Jonny Taylor
I have encountered what I presume is a common newcomer's problem, but I haven't 
had any luck with google (maybe I'm using the wrong search terms?). Suppose I 
have a const id, e.g. "const id frame". If I attempt to call a 
getter for the object I get the following compiler error:
request for member 'frameNumber' in 'frame', which is of non-class type 
'objc_object* const'

Is there any way of declaring the getter (which in this case is just the 
auto-synthesized one...) as const (or otherwise express the fact that it can be 
safely called on a const object)? I assume that the auto-synthesized one *is* 
const - certainly there's no reason for it not to be that I can think of. 

The reason I am in fact encountering this is when I attempt to access 
properties from within a block, where the instance is treated as 'const' by 
default.

There are of course ways I can work around all this, I just feel that I am 
missing the 'right' way of doing this. Any comments?

Thanks
Jonny

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextFieldCell multi-line

2010-11-08 Thread jonat...@mugginsoft.com

On 8 Nov 2010, at 08:55, Micha Fuhrmann wrote:

> Dear All,
> 
> I'm stuck here and it seems so trivial...
> 
> I'm using NSTextFieldCell in a tableview and when the text takes the whole 
> cell, the cell size doesn't resize and add a line (which I would expect!!!). 
> Setting the text properties in NSCell doesn't cut it either. So I've tried 
> using 
> 
> - (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {
> 
> But how can I compute the amount screen pixels my NSString that's going into 
> the cell will take to return a height with the proper number of lines? I must 
> be missing something, it's just too silly.
> 
> Any help appreciated.
> 
> Michael
> 
> 
For cell text wrapping behaviour see the NSCell documentation: 
-setLineBreakMode, -setWraps, -setTruncatesLastVisibleLine:

To get the required size try NSString  -sizeWithAttributes: 

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com
> This email sent to jonat...@mugginsoft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextFieldCell multi-line

2010-11-08 Thread Vincent Habchi
Le 8 nov. 2010 à 09:55, Micha Fuhrmann a écrit :

> But how can I compute the amount screen pixels my NSString that's going into 
> the cell will take to return a height with the proper number of lines? I must 
> be missing something, it's just too silly.

Assuming that "font" is a NSFont * ivar on the font your using, and 
stringLength the length of your NSString,

size = stringLength * [font maximumAdvancement].width;

will return you the largest size, in pixels, for a string of stringLength chars.

Vincent ___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mock the internet

2010-11-08 Thread jonat...@mugginsoft.com

On 8 Nov 2010, at 09:53, Yung-Luen Lan wrote:

> Hi,
> 
> I'm writing a framework for web API like flickr. However, I don't want
> my test failed depending on the server status.
> (And I don't want it hit the server every time I build my project.)
> 
> Is there any easy way to "fake" the network layer? I don't think
> swizzle the NSURLConnection is enough because the HTTP intermediate
> framework my project depends use CFNetwork.
> Conditional compile and mocking the response inside the HTTP
> intermediate framework is bad since it's not even my code.
> 

During development cannot you not target a local http instance that doesn't 
support the full API but simply returns an acknowledgment/error response.

A faked network layer doesn't sound appealing.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Mock the internet

2010-11-08 Thread Yung-Luen Lan
Hi,

I'm writing a framework for web API like flickr. However, I don't want
my test failed depending on the server status.
(And I don't want it hit the server every time I build my project.)

Is there any easy way to "fake" the network layer? I don't think
swizzle the NSURLConnection is enough because the HTTP intermediate
framework my project depends use CFNetwork.
Conditional compile and mocking the response inside the HTTP
intermediate framework is bad since it's not even my code.

Any suggestion for this?

Regards,
yllan
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextFieldCell multi-line

2010-11-08 Thread Micha Fuhrmann
Dear All,

I'm stuck here and it seems so trivial...

I'm using NSTextFieldCell in a tableview and when the text takes the whole 
cell, the cell size doesn't resize and add a line (which I would expect!!!). 
Setting the text properties in NSCell doesn't cut it either. So I've tried 
using 

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row {

But how can I compute the amount screen pixels my NSString that's going into 
the cell will take to return a height with the proper number of lines? I must 
be missing something, it's just too silly.

Any help appreciated.

Michael

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com