Re: Need HTTP Server & JSON recommendations

2010-12-06 Thread Ken Worley
There is a section in The iPhone Developer's Cookbook by Erica Sadun on 
building a simple web-based server for iPhone (chapter 13, page 582). All the 
same source from the book is available on github.com. Do a search there for 
"iPhone Developer's Cookbook" and you should be able to locate it - then look 
in chapter 13.

Hope this helps.

On Dec 6, 2010, at 10:21 AM, Todd Freese wrote:

> I have an existing CoreData app that now needs to share it's data via JSON. 
> Can anyone recommend a framework or sample code that would include a simple 
> HTTP server? I googled and found a bunch of JSON frameworks which look great. 
> The part I need help with is the HTTP server.
> 
> Any suggestions or recommendations would be appreciated!
> 
> Todd
> 
> __
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> __
> ___
> 
> 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/cocoadev%40tiberiusinc.com
> 
> This email sent to cocoa...@tiberiusinc.com

-- 
Ken Worley
k...@tiberiusinc.com

Why should I have to WORK for everything?! It's like saying I don't deserve it! 
-- "Calvin"


___

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: De-Mystifying NSCell

2009-03-23 Thread Ken Worley

VERY well done and informative. Thanks!

Ken

On Mar 23, 2009, at 3:10 AM, Kyle Sluder wrote:


Hi all,

I've noticed recently a few people have posted to the list in a state
of uncertainty regarding NSCell, particularly in the context of
NSTableView.  I was in much the same boat when I started out with
Cocoa; it takes a few runs through it before the scheme starts to make
sense.

I put together a short video to try to explain the rationale and
mechanisms of NSCell: http://www.cs.loyola.edu/~ksluder/NSCell.mov .
If you're confused about why NSCell exists and how it's used inside
NSTableView, I hope that my video is able to shine a bit of light.

If not, I hope I don't confuse you even more.  If you like or dislike
the video, please do let me know.

Thanks,
--Kyle Sluder


--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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: keyUp falling through to window when sheet dismissed

2008-10-21 Thread Ken Worley


On Oct 21, 2008, at 4:03 PM, Kyle Sluder wrote:

On Tue, Oct 21, 2008 at 5:35 PM, Ken Worley  
<[EMAIL PROTECTED]> wrote:
This, by the way, is a constant source of confusion for me in  
Cocoa. Why is
a delegate method specific to NSTextView listed under NSControl  
which is the

parent class?


You seem to be misunderstanding a bit.  The field editor is an
instance of NSTextView (or a subclass).  Any control, however, may
make use of the field editor, not just NSTextField.  More information
about the relationship between text views, the field editor, and
controls can be found in the Text System Overview:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/TextFieldsAndViews.html

--Kyle Sluder



You're right. I was somewhat confused. After looking at this in more  
detail, it seemed to me that the correct thing to do would be to  
specify a delegate to the NSTextField control and implement the - 
control:textView:doCommandBySelector: method that you suggested.


When I do that, however, the method never gets called, so I'm still  
not quite getting things. Still assimilating info though.


Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: keyUp falling through to window when sheet dismissed

2008-10-21 Thread Ken Worley


On Oct 21, 2008, at 4:17 PM, Ken Worley wrote:



On Oct 21, 2008, at 4:03 PM, Kyle Sluder wrote:

On Tue, Oct 21, 2008 at 5:35 PM, Ken Worley  
<[EMAIL PROTECTED]> wrote:
This, by the way, is a constant source of confusion for me in  
Cocoa. Why is
a delegate method specific to NSTextView listed under NSControl  
which is the

parent class?


You seem to be misunderstanding a bit.  The field editor is an
instance of NSTextView (or a subclass).  Any control, however, may
make use of the field editor, not just NSTextField.  More information
about the relationship between text views, the field editor, and
controls can be found in the Text System Overview:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/Concepts/TextFieldsAndViews.html

--Kyle Sluder



You're right. I was somewhat confused. After looking at this in more  
detail, it seemed to me that the correct thing to do would be to  
specify a delegate to the NSTextField control and implement the - 
control:textView:doCommandBySelector: method that you suggested.


When I do that, however, the method never gets called, so I'm still  
not quite getting things. Still assimilating info though.



In the end, I found this note in the documentation for the  
textDidEndEditing: method of NSTextField:


If the user ended editing by pressing Return, this method tries to  
send the receiver’s action to its target; if unsuccessful, it sends  
performKeyEquivalent: to its NSView (for example, to handle the  
default button on a panel); if that also fails, the receiver simply  
selects its text.


I set an action and target for the NSTextField and it's called when  
the user presses Return or Enter. That's exactly what I needed in this  
case. I never did get anything working using  
control:textView:doCommandBySelector, but I'm not sure if I was using  
it correctly.


Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: keyUp falling through to window when sheet dismissed

2008-10-21 Thread Ken Worley


On Oct 21, 2008, at 3:20 PM, Ken Worley wrote:



On Oct 21, 2008, at 1:36 PM, Kyle Sluder wrote:

On Tue, Oct 21, 2008 at 1:43 PM, Ken Worley  
<[EMAIL PROTECTED]> wrote:
It seems like the correct solution is to somehow avoid the keyUp  
being sent
to the window/edit field after the sheet is dismissed, but I also  
wonder if

I'm catching the right event in the edit field.


Have you read the Text Editing Progamming Guide for Cocoa?  The
document specifically deals with handling the Return key:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/Tasks/InterceptKeys.html

Basically, don't handle -keyUp: or -keyDown:.  Use the
-control:textView:doCommandBySelector: delegate method.

--Kyle Sluder



I somehow managed to miss that or I read it long enough ago that I  
forgot. Thanks much!


Ken



This, by the way, is a constant source of confusion for me in Cocoa.  
Why is a delegate method specific to NSTextView listed under NSControl  
which is the parent class? Not to mention the fact that NSControl  
lists these delegate methods, but does not itself support a delegate.  
Looking at control:textView:doCommandBySelector:, textView is listed  
as an NSTextView* in the document mentioned above. NSTextView,  
however, doesn't derive from NSControl so is this really for  
NSTextView or is it for NSTextField which is mentioned at the top of  
the doc, but doesn't appear anywhere within. I'm using an NSTextField.


Those are rhetorical questions, by the way. Things I think about every  
time I'm frustrated because I've forgotten to search all the way up  
the inheritance chain looking for something I don't think should be up  
there :)


At least with this starting point thanks to Kyle, I should be able to  
find the correct way to do this.


--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: keyUp falling through to window when sheet dismissed

2008-10-21 Thread Ken Worley


On Oct 21, 2008, at 1:36 PM, Kyle Sluder wrote:

On Tue, Oct 21, 2008 at 1:43 PM, Ken Worley  
<[EMAIL PROTECTED]> wrote:
It seems like the correct solution is to somehow avoid the keyUp  
being sent
to the window/edit field after the sheet is dismissed, but I also  
wonder if

I'm catching the right event in the edit field.


Have you read the Text Editing Progamming Guide for Cocoa?  The
document specifically deals with handling the Return key:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/Tasks/InterceptKeys.html

Basically, don't handle -keyUp: or -keyDown:.  Use the
-control:textView:doCommandBySelector: delegate method.

--Kyle Sluder



I somehow managed to miss that or I read it long enough ago that I  
forgot. Thanks much!


Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


keyUp falling through to window when sheet dismissed

2008-10-21 Thread Ken Worley

Hi all,

Tried searching for answers to this and haven't come up with anything  
yet...


I'm displaying a sheet which has a default button. The default button  
dismisses the sheet. When the user presses Return to dismiss the sheet  
via the default button, the keyUp event for the Return key is sent to  
the window below. I happen to be looking at keyUp events in certain  
edit fields where the Return key triggers an action (much in the same  
way that the address field in a web browser does). When one of these  
edit fields is the first responder as the sheet is dismissed, the edit  
field gets the keyUp and triggers its action which is, obviously, not  
desirable.


It seems like the correct solution is to somehow avoid the keyUp being  
sent to the window/edit field after the sheet is dismissed, but I also  
wonder if I'm catching the right event in the edit field. keyDown  
doesn't work there because of the way edit fields work in Cocoa. I can  
try to look into the event queue for the keyUp in question, but I  
assume it isn't there yet at the point when I get the message that the  
default button's key equivalent was triggered...


Thanks in advance for any suggestions.

Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Removing Applications from the Dock Programmatically

2008-08-27 Thread Ken Worley


On Aug 27, 2008, at 12:05 PM, Sherm Pendley wrote:


On Wed, Aug 27, 2008 at 1:48 PM, Kevin Kicklighter
<[EMAIL PROTECTED]> wrote:


  NSDictionary *theError = [[[NSDictionary alloc] init]
autorelease];

  [quitScript executeAndReturnError:&theError];
  }


That still leaks the dictionary you created. Didn't you get my message
about that? You should do this instead:

  NSDictionary *theError = nil;
  [quitScript executeAndReturnError: &theError];

sherm--



It's autoreleased - how could that leak?

Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Problem with friend function and gcc 4.2 with objective-c++

2008-08-14 Thread Ken Worley
Just to close this out, it was confirmed that the current behavior in  
4.2 is correct. The flag -ffriend-injection can be used to work around  
it (i.e. retain the old 4.0 behavior), but fixing the code is the  
better route.


Ken

On Aug 8, 2008, at 4:41 PM, Ken Worley wrote:

Hmmm, no response as of yet. I went ahead and submitted a bug  
against Xcode: rdar://6135771

We'll see what happens.

Ken
On Aug 7, 2008, at 4:09 PM, Ken Worley wrote:


Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've  
run into a problem with friend functions when compiling in  
objective-c++. I contrived an example that illustrates the problem:


1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the  
compiler setting to use gcc 4.2, I get the errors listed below. Any  
clues would certainly be appreciated if I'm doing something wrong.  
If not, I guess I'll file a bug...


Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = x;
}
};

int main(int argc, char *argv[])
{
test1* tobj = newtest1(5);
delete tobj;

  return NSApplicationMain(argc,  (const char **) argv);
}


Here's the build log:

Building target “Untitled” of project “Untitled” with configuration  
“Debug” — (1 error)

cd /Users/ken/Desktop/Untitled
  /Xcode3.1/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 - 
fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm- 
blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Xcode3.1/ 
Developer/SDKs/MacOSX10.5.sdk -mfix-and-continue -fvisibility- 
inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/ 
ken/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/ 
Untitled-generated-files.hmap -I/Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-own-target- 
headers.hmap -I/Users/ken/Desktop/Untitled/build/Untitled.build/ 
Debug/Untitled.build/Untitled-all-target-headers.hmap -iquote / 
Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/Untitled-project-headers.hmap -F/Users/ken/Desktop/ 
Untitled/build/Debug -I/Users/ken/Desktop/Untitled/build/Debug/ 
include -I/Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/DerivedSources -include /var/folders/JE/ 
JEJ3RSLHE9uIDGjXTRTisTI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/Untitled_Prefix- 
brblicjbwwpqhfahflncgqpvarno/Untitled_Prefix.pch -c /Users/ken/ 
Desktop/Untitled/main.m -o /Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Objects-normal/i386/main.o
/Users/ken/Desktop/Untitled/main.m: In function 'int main(int,  
char**)':
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope
		/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope

Build failed (1 error)

Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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/cocoadev%40tiberiusinc.com

This email sent to [EMAIL PROTECTED]


--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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/cocoadev%40tiberiusinc.com

This email sent to [EMAIL PROTECTED]


--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Problem with friend function and gcc 4.2 with

2008-08-12 Thread Ken Worley


On Aug 11, 2008, at 6:18 PM, Jonathan Prescott wrote:

Operator signatures are already know by the compiler since they are  
defined in the standard, and are really global in scope.  Thus, you  
don't have to declare them prior to defining them.



Huh? The operator I added as a test was certainly not defined in the  
standard...not sure what you mean by that.


Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Problem with friend function and gcc 4.2 with

2008-08-11 Thread Ken Worley
First, I appreciate the response and discussion. Thank you. My  
response is not meant to be argumentative, but I'd like to get to the  
bottom of this.


The main thrust of that discussion (on bytes.com) seems to be that  
since the friend function is both declared and defined inline within  
the class test1 declaration, that it is trapped in test1's namespace  
and only usable from within the class. At least, that's the way I  
understand the discussion.


FWIW, using gcc 4.2, and it turns out it doesn't matter if I'm  
compiling the file as C++ or objective-C++, the following both fail  
with the same compile error:


1. Trying to call newtest1 from within a method of test1

2. Calling the friend function like this: test1* newobj =  
test1::newtest1(5); from within main.


So, in what circumstance _would_ I be able to call that friend  
function? It's not usable from within another method of that class and  
it is apparently not callable from outside the class without  
duplicating the function prototype outside the body of the class.  
Duplicating the prototype outside the class declaration DOES allow the  
example to compile (whether it's added before or after the class  
declaration).


So, is there some exception for operator friend functions? I can add  
an operator friend function declared and defined inline within the  
body of the class declaration (just like the newtest1 friend  
function). That type of friend function compiles and works just fine  
and is callable from main...


So I'm confused. The compiler allows the friend function to be  
declared and defined inline within the class declaration, but I'm not  
allowed to call it from anywhere without another declaration of the  
prototype elsewhere. That doesn't seem right to me, but I'll concede  
that it might be. If that's the case, then there must an exception for  
friend operators or that's another bug in the compiler except this  
one's not fixed in gcc 4.2.


Ken

On Aug 10, 2008, at 2:13 PM, Roni Music wrote:



You can read a discussion regarding this problem here:
http://bytes.com/forum/thread828536.html

it seems gcc 4.0 had a bug which is corrected in gcc 4.2



Message: 12
Date: Sat, 9 Aug 2008 09:36:17 -0600
From: Ken Worley <[EMAIL PROTECTED]>
Subject: Re: Problem with friend function and gcc 4.2 with
To: cocoa-dev cocoa-dev 
Cc: Roni Music <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

FWIW, it does in fact compile in 4.2 (and in 4.0) when formatted as
you suggest. I still believe the original format is correct and that
4.2 is the version with the bug. The info Clark Cox pointed out seems
to support that. In any case, a bug has been filed, so I'll know
Apple's point of view eventually :) Thanks for the input (and thanks
also to Clark and Thomas for responding).

rdar://6135771

Ken

On Aug 8, 2008, at 10:42 PM, Roni Music wrote:



I'm not a C++ expert but your code below should not compile (as I
see it)

You should declare the friend function inside the class:

class test1
{
public:

friend test1* newtest1(int x);
/*
the function newtest1() is now a friend to test1 class and may
access private member variables
and functions such as finishinit()
*/

snip
};

then define the function outside the class:

test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

So if you code worked with gcc 4.0 and not gcc 4.2, then it seems
gcc 4.2 now works according to the C++ standard
and gcc 4.0 did not

Rolf





Message: 10
Date: Fri, 8 Aug 2008 16:41:42 -0600
From: Ken Worley <[EMAIL PROTECTED]>
Subject: Re: Problem with friend function and gcc 4.2 with
objective-c++
To: cocoa-dev cocoa-dev 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed;
delsp=yes

Hmmm, no response as of yet. I went ahead and submitted a bug  
against

Xcode: rdar://6135771
We'll see what happens.

Ken
On Aug 7, 2008, at 4:09 PM, Ken Worley wrote:


Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but  
I've

run into a problem with friend functions when compiling in
objective-
c++. I contrived an example that illustrates the problem:

1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the
compiler setting to use gcc 4.2, I get the errors listed below.  
Any

clues would certainly be appreciated if I'm doing something wrong.
If not, I guess I'll file a bug...

Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = 

Re: Problem with friend function and gcc 4.2 with

2008-08-09 Thread Ken Worley
FWIW, it does in fact compile in 4.2 (and in 4.0) when formatted as  
you suggest. I still believe the original format is correct and that  
4.2 is the version with the bug. The info Clark Cox pointed out seems  
to support that. In any case, a bug has been filed, so I'll know  
Apple's point of view eventually :) Thanks for the input (and thanks  
also to Clark and Thomas for responding).


rdar://6135771

Ken

On Aug 8, 2008, at 10:42 PM, Roni Music wrote:



I'm not a C++ expert but your code below should not compile (as I  
see it)


You should declare the friend function inside the class:

class test1
{
public:

friend test1* newtest1(int x);
/*
the function newtest1() is now a friend to test1 class and may  
access private member variables

and functions such as finishinit()
*/

snip
};

then define the function outside the class:

test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

So if you code worked with gcc 4.0 and not gcc 4.2, then it seems  
gcc 4.2 now works according to the C++ standard

and gcc 4.0 did not

Rolf





Message: 10
Date: Fri, 8 Aug 2008 16:41:42 -0600
From: Ken Worley <[EMAIL PROTECTED]>
Subject: Re: Problem with friend function and gcc 4.2 with
objective-c++
To: cocoa-dev cocoa-dev 
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=WINDOWS-1252; format=flowed;
delsp=yes

Hmmm, no response as of yet. I went ahead and submitted a bug against
Xcode: rdar://6135771
We'll see what happens.

Ken
On Aug 7, 2008, at 4:09 PM, Ken Worley wrote:


Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've
run into a problem with friend functions when compiling in  
objective-

c++. I contrived an example that illustrates the problem:

1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the
compiler setting to use gcc 4.2, I get the errors listed below. Any
clues would certainly be appreciated if I'm doing something wrong.
If not, I guess I'll file a bug...

Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = x;
}
};

int main(int argc, char *argv[])
{
test1* tobj = newtest1(5);
delete tobj;

  return NSApplicationMain(argc,  (const char **) argv);
}


Here's the build log:

Building target "Untitled" of project "Untitled" with configuration
"Debug" - (1 error)
   cd /Users/ken/Desktop/Untitled
  /Xcode3.1/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 -
fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks
-O0 -Wreturn-type -Wunused-variable -isysroot /Xcode3.1/Developer/
SDKs/MacOSX10.5.sdk -mfix-and-continue -fvisibility-inlines-hidden -
mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/ken/Desktop/
Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-
generated-files.hmap -I/Users/ken/Desktop/Untitled/build/
Untitled.build/Debug/Untitled.build/Untitled-own-target-headers.hmap
-I/Users/ken/Desktop/Untitled/build/Untitled.build/Debug/
Untitled.build/Untitled-all-target-headers.hmap -iquote /Users/ken/
Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled-
project-headers.hmap -F/Users/ken/Desktop/Untitled/build/Debug -I/
Users/ken/Desktop/Untitled/build/Debug/include -I/Users/ken/Desktop/
Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources -
include /var/folders/JE/JEJ3RSLHE9uIDGjXTRTisTI/-Caches-/
com.apple.Xcode.501/SharedPrecompiledHeaders/Untitled_Prefix-
brblicjbwwpqhfahflncgqpvarno/Untitled_Prefix.pch -c /Users/ken/
Desktop/Untitled/main.m -o /Users/ken/Desktop/Untitled/build/
Untitled.build/Debug/Untitled.build/Objects-normal/i386/main.o
/Users/ken/Desktop/Untitled/main.m: In function 'int main(int,
char**)':
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not
declared in this scope
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not
declared in this scope
Build failed (1 error)

Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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/cocoadev%40tiberiusinc.com

This email sent to [EMAIL PROTECTED]


--
Ken Worley
Software Engineer, Tiberius, Inc.








--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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

Please do not post admin request

Re: Problem with friend function and gcc 4.2 with objective-c++

2008-08-08 Thread Ken Worley
Hmmm, no response as of yet. I went ahead and submitted a bug against  
Xcode: rdar://6135771

We'll see what happens.

Ken
On Aug 7, 2008, at 4:09 PM, Ken Worley wrote:


Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've  
run into a problem with friend functions when compiling in objective- 
c++. I contrived an example that illustrates the problem:


1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the  
compiler setting to use gcc 4.2, I get the errors listed below. Any  
clues would certainly be appreciated if I'm doing something wrong.  
If not, I guess I'll file a bug...


Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = x;
}
};

int main(int argc, char *argv[])
{
test1* tobj = newtest1(5);
delete tobj;

   return NSApplicationMain(argc,  (const char **) argv);
}


Here's the build log:

Building target “Untitled” of project “Untitled” with configuration  
“Debug” — (1 error)

cd /Users/ken/Desktop/Untitled
   /Xcode3.1/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 - 
fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks  
-O0 -Wreturn-type -Wunused-variable -isysroot /Xcode3.1/Developer/ 
SDKs/MacOSX10.5.sdk -mfix-and-continue -fvisibility-inlines-hidden - 
mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/ken/Desktop/ 
Untitled/build/Untitled.build/Debug/Untitled.build/Untitled- 
generated-files.hmap -I/Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-own-target-headers.hmap  
-I/Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/Untitled-all-target-headers.hmap -iquote /Users/ken/ 
Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Untitled- 
project-headers.hmap -F/Users/ken/Desktop/Untitled/build/Debug -I/ 
Users/ken/Desktop/Untitled/build/Debug/include -I/Users/ken/Desktop/ 
Untitled/build/Untitled.build/Debug/Untitled.build/DerivedSources - 
include /var/folders/JE/JEJ3RSLHE9uIDGjXTRTisTI/-Caches-/ 
com.apple.Xcode.501/SharedPrecompiledHeaders/Untitled_Prefix- 
brblicjbwwpqhfahflncgqpvarno/Untitled_Prefix.pch -c /Users/ken/ 
Desktop/Untitled/main.m -o /Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Objects-normal/i386/main.o
/Users/ken/Desktop/Untitled/main.m: In function 'int main(int,  
char**)':
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope
		/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope

Build failed (1 error)

Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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/cocoadev%40tiberiusinc.com

This email sent to [EMAIL PROTECTED]


--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Framework and NSApplication

2008-08-08 Thread Ken Worley


On Aug 7, 2008, at 5:55 PM, Kiel Gillard wrote:


@synthesize greeting;

I'm writing a Cocoa framework that links with an old Carbon  
application. The
Carbon application indirectly interacts with it through a wrapper  
framework.

Within the Cocoa framework, I want to observe the
NSApplicationWillTerminateNotification notification, posted by the
NSApplication to the default NSNotificationCenter. However, my  
method does

not seem to be invoked.

Figuring there was some incompatibility with NSApplication and the  
fact the

framework is being dynamically linked to an old Carbon application, I
installed a Carbon event handler for the application quitting. The  
callback

does not seem be invoked by the Carbon Event Manager.

Any suggestions as to how I could code the framework to notice when  
the

application it's linked to is quitting?

Thanks,

Kiel



Try specifying an application delegate and implement the  
applicationWillTerminate method which receives an NSNotification  
object as an argument.


Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Problem with friend function and gcc 4.2 with objective-c++

2008-08-07 Thread Ken Worley

Hi all,

I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've  
run into a problem with friend functions when compiling in objective-c+ 
+. I contrived an example that illustrates the problem:


1. Created new Cocoa project
2. Forced compilation of all files to use objective-c++
3. Changed content of main.m to below...

This project builds fine using gcc 4.0, but when I switch the compiler  
setting to use gcc 4.2, I get the errors listed below. Any clues would  
certainly be appreciated if I'm doing something wrong. If not, I guess  
I'll file a bug...


Here's main.m:

#import 

class test1
{
public:

friend test1* newtest1(int x)
{
test1* anobj = new test1();
anobj->finishinit(x);
return anobj;
}

virtual ~test1()
{
}

private:

int avalue;

test1()
{
avalue = 0;
}

void finishinit(int x)
{
avalue = x;
}
};

int main(int argc, char *argv[])
{
test1* tobj = newtest1(5);
delete tobj;

return NSApplicationMain(argc,  (const char **) argv);
}


Here's the build log:

Building target “Untitled” of project “Untitled” with configuration  
“Debug” — (1 error)

cd /Users/ken/Desktop/Untitled
/Xcode3.1/Developer/usr/bin/gcc-4.2 -x objective-c++ -arch i386 - 
fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks - 
O0 -Wreturn-type -Wunused-variable -isysroot /Xcode3.1/Developer/SDKs/ 
MacOSX10.5.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx- 
version-min=10.5 -gdwarf-2 -iquote /Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-generated-files.hmap -I/ 
Users/ken/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/ 
Untitled-own-target-headers.hmap -I/Users/ken/Desktop/Untitled/build/ 
Untitled.build/Debug/Untitled.build/Untitled-all-target-headers.hmap - 
iquote /Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/Untitled-project-headers.hmap -F/Users/ken/Desktop/ 
Untitled/build/Debug -I/Users/ken/Desktop/Untitled/build/Debug/include  
-I/Users/ken/Desktop/Untitled/build/Untitled.build/Debug/ 
Untitled.build/DerivedSources -include /var/folders/JE/ 
JEJ3RSLHE9uIDGjXTRTisTI/-Caches-/com.apple.Xcode.501/ 
SharedPrecompiledHeaders/Untitled_Prefix-brblicjbwwpqhfahflncgqpvarno/ 
Untitled_Prefix.pch -c /Users/ken/Desktop/Untitled/main.m -o /Users/ 
ken/Desktop/Untitled/build/Untitled.build/Debug/Untitled.build/Objects- 
normal/i386/main.o

/Users/ken/Desktop/Untitled/main.m: In function 'int main(int, char**)':
/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope
		/Users/ken/Desktop/Untitled/main.m:43: error: 'newtest1' was not  
declared in this scope

Build failed (1 error)

Thanks,
Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: sorting an NSTableView

2008-05-30 Thread Ken Worley


On May 30, 2008, at 12:48 AM, James W. Walker wrote:

Hi.  I'm a Cocoa newbie, and I'm trying to figure out how to enable  
sorting columns of my table, but the NSTableView guide doesn't say  
anything about it.  I see that NSTableView has a setSortDescriptors  
method, NSTableColumn has a setSortDescriptorPrototype method, and  
that IB shows a "sort key" attribute for a table column, but I'm not  
clear on how to use them.  Any hints or examples?


I'm sure Vijay's solution is more correct than mine, but I implement the

-(void)tableView:(NSTableView *)tableView didClickTableColumn: 
(NSTableColumn *)tableColumn


delegate method and highlight the column header myself (reversing the  
sort as necessary and setting the right sort direction indicator).  
Then I sort my data source and call reloadData on the table object.


I found this MacTech article useful for getting to know NSTableView a  
little better also:


<http://www.mactech.com/articles/mactech/Vol.18/18.09/TableTechniques/index.html 
>


Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


NSTableView header offsets when scrolled

2008-05-23 Thread Ken Worley

Hi all,

I've got a strange problem with a programatically created NSTableView  
(inside a programatically created NSScrollView). The table is showing  
three columns and has a standard header, each showing the title of the  
column. Columns are set to resize proportionally with the table.


The problem: When I scroll the list, the header suddenly offsets to  
the left about the width of a scroll bar. Clicking in the header and  
rearranging or resizing columns (using the mouse) doesn't fix it, but  
resizing the list makes it pop back into place. It never moves any  
farther over and it leaves a blank space between the header view and  
the corner view.


I can't easily post the code that creates and manipulates the list  
because it's scattered about in a library. Also, I don't seem to be  
able to reproduce the problem in a small sample app. So, I'm not  
looking for specific solutions. I'm more hoping someone might have  
some idea where to look or what might cause this specific symptom...


Thanks for any help.

Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: programmatically placing GUIs

2008-02-27 Thread Ken Worley


On Feb 27, 2008, at 2:25 PM, Daniel Child wrote:

I am trying to place and size segmented controls programmatically on  
a window controlled by a subclass of NSWindowController. What I'm  
getting, however, is simply the window as it was initially drawn in  
IB. I think the problem has to do with loading the window properly  
and more specifically, getting the segmented control variables to  
know which window they are being redrawn in.


I declared an outlet "window" to match the nib outlet (window), and  
also physically drew in dummy controls on within IB. When I try to  
actually ruun the program and init the window controller using  
initWithNibName:, I notice that "window" has no memory associated  
it. Since I want to size my controls programmatically, this seems to  
be a problem, since their "_window" variable is naturally also null  
as a result. The controls are initially drawn in IB but are suppose  
to resize during -windowWillLoad.


In addition, I see that in the debugger there is both a "window" and  
a "_window" variable under self (the controller). Does this mean you  
are not supposed to formally declare an outlet for the controller's  
window?


Bottom line, I am getting a window that looks like what I drew in  
IB, not the one modified programmatically.


I feel I am going about this the wrong way but don't see any  
documentation on this particular issue. If anyone could shed some  
light on the procedure, it would be a big help. Thanks.




I'm going through some of the same stuff and it's not easy. It's hard  
for me to tell how far along you are, but some of Apple's sample code  
has helped me with programmatic creation of controls and their  
placement in the window. ButtonMadness in particular uses placeholders  
for some controls in the window nib and replaces them with  
programmatically created controls at runtime.


Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]


Re: Creating a NSTextField

2008-02-26 Thread Ken Worley


On Feb 26, 2008, at 9:13 AM, Felipe Monteiro de Carvalho wrote:


But there is no initialization method for a NSTextField. How can I
create a NSTextField? Just alloc?



Generally more like:

[[NSTextField alloc] initWithFrame:someRect];

Ken

--
Ken Worley
Software Engineer, Tiberius, Inc.



___

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 [EMAIL PROTECTED]