Just a note, the NSAssert() Foundation function should only be called
from inside an Objective-C method... if your code is somewhere in an
Object-C class, this is fine, but if you're calling from inside a C-
callback function or another C helper function (since you're creating
a Library, thi
On 12/06/2008, at 4:51 PM, Graham Cox wrote:
NSNumber* myNum = nil;
/* stuff */
NSAssert( myNum != nil, @"some error message");
[myClass calc:myNum];
Messages to nil are safe - it will treat your number as having a
value of 0. Thus as long as you initialise it to nil, your code will
When I add the recommended menu items
" Hide Toolbar "
" Customize Toolbar... "
to my app's View menu, I can give them any text I like, but the "Hide
Toolbar" string will be replaced by the system when the app is launched
and a document window has been opened. The Action toggleToolbarS
On Jun 12, 2008, at 00:25, Jens Alfke wrote:
On 11 Jun '08, at 1:14 PM, Manuel wrote:
But the IKImageBrowserView doesn't call these methods. I setup a
testmethod in the MYNSCollectionViewItem like the following code,
to verify that the imagebrowser outlet is set and to set again the
dat
On 12 Jun 2008, at 5:03 pm, Chris Suter wrote:
In the original example, myNum was being passed as a argument rather
than having a message to sent to it and it’s often not safe to pass
nil objects as arguments.
Hmmm... well, what's the function it's passed to going to do with it,
other t
I agree with Graham, although I misread the initial question as
well... if the person is passing a garbage pointer, there's really not
much you can do. All you can really do is assert that the object you
expected is not nil.
Why is it unsafe to pass nil? Many API in Cocoa tell you to pass n
It all makes sense now. Thanks.
On Jun 11, 2008, at 11:48 PM, Chris Suter wrote:
On 11/06/2008, at 3:19 PM, Lawrence Johnston wrote:
Hey everybody, I've got an issue that I can't figure out.
If I'm using this code:
NSString *XMLForDisplay {
NSXMLElement *root = [NSXMLNode elementWithName:
On 12/06/2008, at 5:29 PM, Graham Cox wrote:
On 12 Jun 2008, at 5:03 pm, Chris Suter wrote:
In the original example, myNum was being passed as a argument
rather than having a message to sent to it and it’s often not safe
to pass nil objects as arguments.
Hmmm... well, what's the function
Thank you, the process needs to be running permanently, the script was
just for testing. It works on both, 10.4 and 10.5 without throttling
now. I had used Lingon but that doesn't create the plist the way it
needed to be.
Alexander
On Jun 11, 2008, at 16:58 , Jens Alfke wrote:
On 11 J
On Jun 12, 2008, at 12:48 AM, Chris Suter wrote:
The documentation says that you need to pass the qualified name in.
So you need to do:
NSXMLElement *child = [NSXMLNode elementWithName:@"a:child" URI:@"http://www.tempurl.com
"];
You can look-up the prefix using NSXMLElement’s
resolvePre
On Wed, Jun 11, 2008 at 6:15 PM, Mattias Arrelid <[EMAIL PROTECTED]> wrote:
> Hi Douglas,
>
> On Wed, Jun 11, 2008 at 5:30 PM, Douglas Davidson <[EMAIL PROTECTED]> wrote:
>>
>> On Jun 11, 2008, at 3:24 AM, Mattias Arrelid wrote:
>>
>>> Haven't anyone stumbled upon something similar, or a solution t
On Thu, Jun 12, 2008 at 11:14 AM, Mattias Arrelid <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 11, 2008 at 6:15 PM, Mattias Arrelid <[EMAIL PROTECTED]> wrote:
>> Hi Douglas,
>>
>> On Wed, Jun 11, 2008 at 5:30 PM, Douglas Davidson <[EMAIL PROTECTED]> wrote:
>>>
>>> On Jun 11, 2008, at 3:24 AM, Mattias A
>From the archives, originally posted by Rob Keniger:
I had problems with this too, and I use a workaround I found somewhere
where you render to a CGImageRef in the context of the current window.
Here's a dump of the code:
//theImage is an existing NSImage
CIImage *outputImage = [CIImage imageWit
On 12.6.2008, at 7:48, Stefano Falda wrote:
On 12/giu/08, at 00:34, Nick Zitzmann wrote:
It's normal for physical memory sizes to go up, and not come down
until either the program is quit or the physical memory is needed
elsewhere. Activity Monitor is not a memory leak detector. If you
w
On 12 Jun 2008, at 5:47 pm, Chris Suter wrote:
Can you give me a counter-example?
Let’s say the function your calling uses one of the following:
-[NSDictionary setObject:forKey:]
-[NSMutableArray addObject:]
Raising an exception is a good response when a nil argument isn't
appropriate,
On 2008 Jun, 12, at 0:47, Chris Suter wrote:
On 12/06/2008, at 5:29 PM, Graham Cox wrote:
... implicitly allowing nil, unless it is specifically documented
otherwise.
Can you give me a counter-example?
-[NSDictionary setObject:forKey:]
-[NSMutableArray addObject:]
[These] raise exceptio
Hi All,
I want to know how we can get the file close event using
FSEventStreamEventFlags.
I have written the code for get the event when user write, open and
close the file. But we are not able to distinguish between which event
is for which purpose.
Shown below is the out put of functio
Hi John,
I hope you don't mind me cc'ing this to the list - I think it might be
helpful to others (if not, my apologies for the noise).
On 12 Jun 2008, at 9:43 pm, John Love wrote:
Hi, Graham ...
Graham, this is a condensed summary of my initial communication:
Call it my fetish or whateve
Definitely sounds like a bug - file it anyway, they can only say
"behaves as expected" (and probably will... ;-)
I would expect that if I set my foreground text to some pale colour, I
could set a different colour for selected text so it has contrast with
the background selection colour, not
On Thu, Jun 12, 2008 at 6:50 AM, Ashley Perrien <[EMAIL PROTECTED]> wrote:
> Noob question: I'm putting together a small code library and I'm trying to
> include some error checking in the methods; what I want to protect against
> is the following:
>
> NSNumber *myNum;
>
> // Lots of code where I'
Begin forwarded message:
From: Daniel Vollmer <[EMAIL PROTECTED]>
Date: 12 June, 2008 12:18:41 AM PDT
To: Jens Alfke <[EMAIL PROTECTED]>
Subject: Re: Troubles with CollectionView and IKImageBrowserView
On Jun 12, 2008, at 00:25, Jens Alfke wrote:
On 11 Jun '08, at 1:14 PM, Manuel wrote:
On 12 Jun '08, at 5:57 AM, santoshb wrote:
I want to know how we can get the file close event using
FSEventStreamEventFlags.
I have written the code for get the event when user write, open and
close the file. But we are not able to distinguish between which
event is for which purpose.
Yo
On 11 Jun '08, at 10:50 PM, Ashley Perrien wrote:
NSNumber *myNum;
// Lots of code where I've forgotten to actually do anything with
myNum
results = [myClass someCalculationUsing: myNum];
Turn on the "Uninitialized Automatic Variables" warning in your
project's build settings. (Actuall
>
> In general, you should not treat NSController-derived classes as holders of
> data. They are specifically for binding to.
>
Since the "shapeTreeController" gets its content by binding to something
> else, why don't you just directly access that something instead of trying to
> go through the c
> I'm not sure what you mean by shadow-object problem.
I'm referring to the 'brick' object returned by the tree controller in 10.4
which required hacks via a category and the private 'observedObject'
function.
In Leopard, [treeController arrangedObjects] returns a proxy object (the
> same way th
I¹m writing a simple demo application showing how to use some Exchange Web
Services (EWS) features in Cocoa. I am a total Cocoa n00b but have most of
the app and UI working, thanks to a lot of google-fu and my now-worn copy of
Hillegas' 3rd ed. I¹m having trouble authenticating to the actual EWS
se
> That's what I used to think, too, until someone on this list pointed out to
> me that this snippet is in the header for NSTreeController:
>
> // proxy for the root tree node responds to -childNodes and
> -descendantNodeAtIndexPath:(NSIndexPath *)indexPath
> - (id)arrangedObjects;
>
> So whereas p
On Jun 12, 2008, at 2:47 AM, Mattias Arrelid wrote:
It turns out that if you set the NSForegroundColorAttributeName of the
attributed string in NSTextView's text storage, the call to
setSelectedTextAttributes: doesn't have any effect when called as
described below:
File a bug and we'll look i
Hi,
When the computer goes into sleep mode my app also seems to be taking
forever in doing the current task.
So how can I prevent the computer from going into sleep mode when my
app is running?
Wishes,
Nick
___
Cocoa-dev mailing list (Cocoa-dev@l
On Thu, Jun 12, 2008 at 4:35 PM, Danny Price <[EMAIL PROTECTED]> wrote:
> What I don't understand is why the same binding returns a different object
> in two cases? Why don't get this proxy object when I bind the view directly
> to the controller?
Good question. I would guess that not everything
On Thu, Jun 12, 2008 at 5:40 PM, Douglas Davidson <[EMAIL PROTECTED]> wrote:
>
> On Jun 12, 2008, at 2:47 AM, Mattias Arrelid wrote:
>
>> It turns out that if you set the NSForegroundColorAttributeName of the
>> attributed string in NSTextView's text storage, the call to
>> setSelectedTextAttribute
Look into UpdateSystemActivity(). It's in the CoreServices framework.
If you call it with UsrActivity every 25 seconds or so, the display
won't dim and the computer won't go to sleep (unless it's forced to.
You can't prevent that).
What is your app doing that you want to resort to something
On 12 Jun '08, at 8:35 AM, Paul E. Robichaux wrote:
@implementation NSURLRequest(NSHTTPURLRequest)
+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
{
return YES;
}
@end
At the end of one of my .m files, the code builds, though I get
warnings
that some other methods aren't impleme
In the original example, myNum was being passed as a argument rather
than having a message to sent to it and its often not safe to pass
nil objects as arguments.
Hmmm... well, what's the function it's passed to going to do with it,
other than call a method on it? If it's doing anything else, it
Lately, I've started to see accessors of the following sort:
- (NSString *)foo
{
return [[foo retain] autorelease];
}
rather than just
- (NSString *)foo
{
return foo;
}
What is the purpose or benefit of doing this? It seems to me that this
would add things unnecessarily to th
Hi,
I have recently started programming on Mac using Objective-C and Cocoa. I am
coming from C++/C# world. So, its a fairly basic question. Please help me
understand the following code:
@implementation MyView /*MyView inherits from NSView */
-(void)drawRect: (NSRect)aRect {
Le 12 juin 08 à 19:21, Jeff LaMarche a écrit :
Lately, I've started to see accessors of the following sort:
- (NSString *)foo
{
return [[foo retain] autorelease];
}
rather than just
- (NSString *)foo
{
return foo;
}
What is the purpose or benefit of doing this? It seems to m
On Jun 12, 2008, at 10:26 AM, Vikas wrote:
I have recently started programming on Mac using Objective-C and
Cocoa. I am coming from C++/C# world. So, its a fairly basic
question. Please help me understand the following code:
@implementation MyView /*MyView inherits from NSView */
-(v
On Jun 12, 2008, at 1:21 PM, Jeff LaMarche wrote:
Lately, I've started to see accessors of the following sort:
- (NSString *)foo
{
return [[foo retain] autorelease];
}
I believe this is in case of something like this:
NSString *myFoo = [myObject foo];
// ... stuff that causes myObj
Hi Vikas,
On Thu, Jun 12, 2008 at 6:26 PM, Vikas <[EMAIL PROTECTED]> wrote:
> I have recently started programming on Mac using Objective-C and Cocoa. I am
> coming from C++/C# world. So, its a fairly basic question. Please help me
> understand the following code:
>
> @implementation MyView
On 6/12/08 12:44 PM, "Jens Alfke" <[EMAIL PROTECTED]> wrote:
>
> On 12 Jun '08, at 8:35 AM, Paul E. Robichaux wrote:
>
>> @implementation NSURLRequest(NSHTTPURLRequest)
>> + (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host
>> {
>>return YES;
>> }
>> @end
>>
>> At the end of one of my
On Jun 12, 2008, at 10:21 AM, Jeff LaMarche wrote:
Lately, I've started to see accessors of the following sort:
- (NSString *)foo
{
return [[foo retain] autorelease];
}
rather than just
- (NSString *)foo
{
return foo;
}
What is the purpose or benefit of doing this? It seems to
On Thu, Jun 12, 2008 at 10:26 AM, Vikas <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have recently started programming on Mac using Objective-C and Cocoa. I am
> coming from C++/C# world. So, its a fairly basic question. Please help me
> understand the following code:
>
> @implementation MyView /
> I have recently started programming on Mac using Objective-C and Cocoa. I am
> coming from C++/C# world.
Recant, heretic! ;-)
> In first line, I was expecting something like [self setColor:[NSColor
> blackColor]]; (similar to this.color = NSColor.blackColor; in C#/C++)
> how NSColor ob
On Jun 12, 2008, at 1:31 PM, Jean-Daniel Dupas wrote:
This is mainly to prevent this kind of issue:
NSString *foo = [myObject foo];
[myObject setFoo:nil]; // setter release the foo ivar => foo is no
longer pointing on a valid memory location.
I hadn't thought of this case.
Thanks for the po
O'kay, that was helpful.
I still have one doubt. The declaration of NSRectFill is as below:
void NSRectFill (
NSRect aRect
);
NSRectFill() is a C function, not part of any class e.g. NSView. aRect is
simply a struct which specify location points (doesnt contain reference of any
wind
On Thu, Jun 12, 2008 at 6:54 PM, Vikas <[EMAIL PROTECTED]> wrote:
> NSRectFill() is a C function, not part of any class e.g. NSView. aRect is
> simply a struct which specify location points (doesnt contain reference of
> any window). How the function knows about the drawing surface, in which
> win
On 12 Jun '08, at 10:35 AM, Paul E. Robichaux wrote:
After doing that, I now get a compiler warning that there's a
duplicate
interface defined for NSURLRequest(NSHTTPURLRequest),
You can get around that by changing the category name (the part in
parentheses) to anything different.
and
On Jun 12, 2008, at 08:35, Danny Price wrote:
So the object is single-level tree where each leaf is the actual item
selected?
What I don't understand is why the same binding returns a different
object
in two cases? Why don't get this proxy object when I bind the view
directly
to the contr
> NSRectFill() is a C function, not part of any class e.g. NSView. aRect is
> simply a struct which specify location points (doesnt contain reference of
> any window). How the function knows about the drawing surface, in which
> window/surface to paint? Does it implicitly make use of some self
On 12 Jun '08, at 10:41 AM, Andy Lee wrote:
I hadn't thought of this case.
Thanks for the pointer to the docs -- I now see there is a
vulnerability in the accessors I've been writing.
This is kind of a religious issue. Some people like the safer
accessors. Some people see them as a very e
On Thu, Jun 12, 2008 at 1:54 PM, Vikas <[EMAIL PROTECTED]> wrote:
> NSRectFill() is a C function, not part of any class e.g. NSView. aRect is
> simply a struct which specify location points (doesnt contain reference of
> any window). How the function knows about the drawing surface, in which
>
On 12 Jun 2008, at 10:54, Vikas wrote:
O'kay, that was helpful.
I still have one doubt. The declaration of NSRectFill is as below:
void NSRectFill (
NSRect aRect
);
NSRectFill() is a C function, not part of any class e.g. NSView.
aRect is simply a struct which specify location points (d
On 12 Jun '08, at 10:54 AM, Vikas wrote:
How the function knows about the drawing surface, in which window/
surface to paint?
There's always a current graphics context; it's global to each thread.
(See NSGraphicsContext if you want to look at its API; but if you're
looking for the low-lev
On 6/12/08 2:18 PM, "Jens Alfke" <[EMAIL PROTECTED]> wrote:
>
> On 12 Jun '08, at 10:35 AM, Paul E. Robichaux wrote:
>
>> After doing that, I now get a compiler warning that there's a
>> duplicate
>> interface defined for NSURLRequest(NSHTTPURLRequest),
>
> You can get around that by changing t
On Jun 12, 2008, at 2:20 PM, I. Savant wrote:
NSRectFill() is a C function, not part of any class e.g. NSView.
aRect is simply a struct which specify location points (doesnt
contain reference of any window). How the function knows about the
drawing surface, in which window/surface to paint?
Hello,
Although I prefer the safer accessors, there has been one case where I
had no choice but to return the main object pointer:
- (NSString *)foo
{
return foo;
}
In my app I had a method that was populating a custom cell with a few
elements. Depending on the data source, I had t
Hi -
I have openings for students and one post-doc in my lab at the
University of Montreal. We develop MRI and optical imaging techniques
for characterizing how the brain works, as well as a number of Cocoa-
based analysis and visualization tools. We are funded by the Canadian
Institute
Out of curiosity, does anyone know what the synthesized accessors look
like when you specify retain? Are they
The safe or unsafe ones?
Sent from my iPhone
On Jun 12, 2008, at 12:02 PM, Tito Ciuro <[EMAIL PROTECTED]> wrote:
Hello,
Although I prefer the safer accessors, there has been one cas
On Jun 12, 2008, at 1:30 PM, Larry Hendricks wrote:
I'd consider this a bug although it seems like it may be by design.
Should I file it, or is there a workaround?
Technically that's not a bug, but I'd suggest filing an enhacement
request asking that calendars become identity properties o
On Jun 12, 2008, at 12:20 PM, Jeff LaMarche wrote:
Out of curiosity, does anyone know what the synthesized accessors
look like when you specify retain? Are they
'
The retain/autorelease policy is dictated by the atomicity of the
property.
By default, object properties are returned with reta
Thank you for your tips! But I didn't understand everything. Do you
tried this in a sampleproject which you can send me?
If I initialize the imageBrowser in my MYNSCollectionViewItem and set
the datasource, the datasource methods will now be called correctly.
Thank you. But it seems that th
On Jun 12, 2008, at 2:29 AM, Graham Cox wrote:
On 12 Jun 2008, at 5:03 pm, Chris Suter wrote:
In the original example, myNum was being passed as a argument
rather than having a message to sent to it and it’s often not safe
to pass nil objects as arguments.
Hmmm... well, what's the functio
Am 28.02.2008 um 23:17 schrieb Quincey Morris
<[EMAIL PROTECTED]>:
On Feb 28, 2008, at 12:25, Mike Fischer wrote:
OK, nobody answered so I did a further test:
...
Then I relaunched the app, used the IBAction to remove the Auto Save
Name and quit the app again. The key was still there! So i
WOW it worked!
Thank you very much...
Anyone filed a bug notice of this to Apple?
Thanks to everybody for the suggestions
Stefano
On 12/giu/08, at 11:51, Fabian wrote:
From the archives, originally posted by Rob Keniger:
I had problems with this too, and I use a workaround I found somewhere
I am trying to understand the NIB/code connection. I have a couple of
windows in this project, one of which I am working on, the other I
have been leaving alone. For MyWindow, I have been adding methods in
my category.h file, and dragging that header to the nib, and linking
up the contro
On 12 Jun '08, at 4:43 PM, Paul Archibald wrote:
But what about a project like this, with a bunch of different header
files, all of which are part of the same controller? Do I select all
the header files in the Xcode project and drag all of them into the
nib-instance window? And, when I do
I thought ObjC used "#import", not "#include", so that multiple
copies of a header wouldn't appear, but maybe that's just for Cocoa
stuff, and not for "ordinary" C?
On Jun 12, 2008, at 1:05 AM, Jason Coco wrote:
#include
/* ... */
NSNumber *myNum = nil;
// Lots of code where you've forg
You can use #import in straight C applications from within Xcode, if
you like. There's also nothing stopping you from using the #include
directive in Objective-C. It's just more work than #import, which
handles include cycles for you.
--
m-s
On 12 Jun, 2008, at 21:37, William Squires wro
I'm new at programming in Cocoa, and if it is not rude to post a big
block of code to this list, I'd like to show you all a class I
developed and ask you to tell me about all the ways I've screwed it up!
BACKGROUND INFO
I'm trying to learn Chinese and I have a bunch of comic books to (try
Oops, I forgot to mention, I'm using garbage collection so that I
won't have to struggle with retention!
I wish I had edited my previous post a bit more for clarity, but it's
late and I gotta get to bed.
___
Cocoa-dev mailing list (Cocoa-dev@lists
Am I aloud to ask where I can submit my iPhone programming questions to?
___
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.app
On 12 Jun 08, at 21:09, Rick Langschultz wrote:
Am I aloud to ask where I can submit my iPhone programming questions
to
You're certainly allowed to ask. However, the answer is "nobody, for
now" - sorry. Hopefully this'll change in a month or so...
___
On Fri, Jun 13, 2008 at 12:43 AM, Andrew Farmer <[EMAIL PROTECTED]> wrote:
> You're certainly allowed to ask. However, the answer is "nobody, for now" -
> sorry. Hopefully this'll change in a month or so...
I thought the official answer was to e-mail DTS directly. Then again
I'm not an iPhone dev
On Thu, Jun 12, 2008 at 2:00 AM, Bob Warwick <[EMAIL PROTECTED]> wrote:
> Calling the NSMutableArray convenience method array will return an
> autoreleased object. You should do this instead:
>
>- (id) init
>{
>[super init];
>myNotes = [[NSMutableArr
On 12 Jun 08, at 22:16, Kyle Sluder wrote:
On Fri, Jun 13, 2008 at 12:43 AM, Andrew Farmer <[EMAIL PROTECTED]>
wrote:
You're certainly allowed to ask. However, the answer is "nobody,
for now" -
sorry. Hopefully this'll change in a month or so...
I thought the official answer was to e-mail D
Hey,
I have a Cocoa application that controls an external USB device. I
want to be able to turn the device off when the user performs some
action, like click a button. Is there a way in Cocoa or IOKit to
disable power to a USB Socket? The application runs on Leopard.
Thanks in advance,
Om
On Jun 12, 2008, at 10:38 PM, Omar Qazi wrote:
I have a Cocoa application that controls an external USB device. I
want to be able to turn the device off when the user performs some
action, like click a button. Is there a way in Cocoa or IOKit to
disable power to a USB Socket? The applicatio
On 12 Jun 2008, at 23:01, David Duncan wrote:
On Jun 12, 2008, at 10:38 PM, Omar Qazi wrote:
I have a Cocoa application that controls an external USB device. I
want to be able to turn the device off when the user performs some
action, like click a button. Is there a way in Cocoa or IOKit t
I assume you are talking about an external piece of equipment, not a
USB hub etc. Some pieces of equipment have USB interfaces, but I
suspect many can not turn themselves on and off in response to a USB
command. Macs can, but that may be rare. Even so it would be worth
checking the manual
On 13-Jun-08, at 2:21 AM, Kyle Sluder wrote:
On Thu, Jun 12, 2008 at 2:00 AM, Bob Warwick
<[EMAIL PROTECTED]> wrote:
Calling the NSMutableArray convenience method array will return an
autoreleased object. You should do this instead:
- (id) init
{
[super init];
81 matches
Mail list logo