Re: How can I be so wrong about graphics?

2011-06-07 Thread Manfred Schwind
 Hmm... it looks like it does draw the line... way off in the ether 
 somewhere...
 I think I drew in the global coord system not the local to the view

Are you sure you are _not_ calling drawRect yourself, but let the system call 
it when needed?
If a view needs to be redrawn, the system sets up the correct graphics context, 
coordinate system transformations etc. and then calls drawRect. If you call 
drawRect yourself (what you should never do!), you end up drawing into 
somewhere.

Regards,
Mani
--
http://mani.de - friendly software

___

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: OS + iOS best practice

2011-06-07 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 6/6/11 10:51 PM, Amy Gibbs wrote:
 After the announcements about iCloud, should I just wait a while and
 I'll be able to build this in 'for free' (there will be a cocoa way to
 do this)?

While the iCloud announcement was obviously public, all the
implementation details are under NDA (and of course, like other such
subjects, cannot be discussed on this list).

I presume, though, that you are an iOS program member; login to the dev
center and you can read any pertinent documentation to your heart's
content.  (There are also NDA-cleared forums on the dev site you can use.)

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3tx8wACgkQaOlrz5+0JdWkagCfYtgxpBEUO4/QlR/Rb7i8flim
XqIAn3sC0x2oerMXa2GD8kokFnJ6j8yX
=5khG
-END PGP SIGNATURE-
___

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: iOS: Manually setting orientation makes a mess out of my interface

2011-06-07 Thread brodhage

It might be the wrong way to set the orientation manually?

Try to use shouldAutorotateToInterfaceOrientation and return NO  
for interfaceOrientation not being  
UIInterfaceOrientationLandscapeLeft or  
UIInterfaceOrientationLandscapeRight.


This way you have less code and it does not depend on any display size.

It is working in my apps.
___

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


Noob question in regards to NSXMLParser

2011-06-07 Thread Eric E. Dolecki
I am fetching some XML weather from Google:

xml_api_reply version=1
weather module_id=0 tab_id=0 mobile_row=0 mobile_zipped=1 row=0
section=0
forecast_information
city data=Framingham, MA/
postal_code data=01701/
latitude_e6 data=/
longitude_e6 data=/
forecast_date data=2011-06-07/
current_date_time data=2011-06-07 12:38:31 +/
unit_system data=US/
/forecast_information
current_conditions
condition data=Sunny/
temp_f data=69/
temp_c data=21/
humidity data=Humidity: 66%/
icon data=/ig/images/weather/sunny.gif/
wind_condition data=Wind: NW at 3 mph/
/current_conditions
forecast_conditions
day_of_week data=Tue/
...

What I am really after is the current_conditions data. How can one specify
WHERE in the XML to use the attributes from? A lot of the information is
repeated in other nodes so I can't just check (if([elementName
isEqualToString:@condition]){) , how can I check if the current element is
within a specific tag? (In this case the parent is current_conditions)?

Eric
___

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: Noob question in regards to NSXMLParser

2011-06-07 Thread Hank Heijink (Mailinglists)
Two ways that I've used:

1. Keep a boolean isInCurrentConditions that you set when you start the 
current_conditions element and reset when you end that element. Then every time 
you enter a condition element you check the boolean to see if you are where you 
need to be in the hierarchy. This works well enough if your hierarchy is not 
too complicated and you only need to know about a couple of elements. If it 
does get complicated, you'll end up tracking a dozen booleans, which I don't 
recommend.

2. The complicated case: keep a stack of element names. Every time you enter 
one, you push it, and every time you leave you pop it (it pays to check what 
you're popping, just in case). Then, whenever you encounter a condition 
element, you check the stack to see if you're at the right place in the 
hierarchy.

I'm sure there are other ways, but these have worked well for me.

Hope this helps,
Hank

On Jun 7, 2011, at 10:03 AM, Eric E. Dolecki wrote:

 I am fetching some XML weather from Google:
 
 xml_api_reply version=1
 weather module_id=0 tab_id=0 mobile_row=0 mobile_zipped=1 row=0
 section=0
 forecast_information
 city data=Framingham, MA/
 postal_code data=01701/
 latitude_e6 data=/
 longitude_e6 data=/
 forecast_date data=2011-06-07/
 current_date_time data=2011-06-07 12:38:31 +/
 unit_system data=US/
 /forecast_information
 current_conditions
 condition data=Sunny/
 temp_f data=69/
 temp_c data=21/
 humidity data=Humidity: 66%/
 icon data=/ig/images/weather/sunny.gif/
 wind_condition data=Wind: NW at 3 mph/
 /current_conditions
 forecast_conditions
 day_of_week data=Tue/
 ...
 
 What I am really after is the current_conditions data. How can one specify
 WHERE in the XML to use the attributes from? A lot of the information is
 repeated in other nodes so I can't just check (if([elementName
 isEqualToString:@condition]){) , how can I check if the current element is
 within a specific tag? (In this case the parent is current_conditions)?
 
 Eric
 ___
 
 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/hank.list%40runbox.com
 
 This email sent to hank.l...@runbox.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: Noob question in regards to NSXMLParser

2011-06-07 Thread Eric E. Dolecki
I went with the first solution and it works well enough for me. Anything
beyond this simple XML and I think I'd likely use a 3rd-party solution.

Thanks for the suggestion!



  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Tue, Jun 7, 2011 at 10:13 AM, Hank Heijink (Mailinglists) 
hank.l...@runbox.com wrote:

 Two ways that I've used:

 1. Keep a boolean isInCurrentConditions that you set when you start the
 current_conditions element and reset when you end that element. Then every
 time you enter a condition element you check the boolean to see if you are
 where you need to be in the hierarchy. This works well enough if your
 hierarchy is not too complicated and you only need to know about a couple of
 elements. If it does get complicated, you'll end up tracking a dozen
 booleans, which I don't recommend.

 2. The complicated case: keep a stack of element names. Every time you
 enter one, you push it, and every time you leave you pop it (it pays to
 check what you're popping, just in case). Then, whenever you encounter a
 condition element, you check the stack to see if you're at the right place
 in the hierarchy.

 I'm sure there are other ways, but these have worked well for me.

 Hope this helps,
 Hank

 On Jun 7, 2011, at 10:03 AM, Eric E. Dolecki wrote:

  I am fetching some XML weather from Google:
 
  xml_api_reply version=1
  weather module_id=0 tab_id=0 mobile_row=0 mobile_zipped=1
 row=0
  section=0
  forecast_information
  city data=Framingham, MA/
  postal_code data=01701/
  latitude_e6 data=/
  longitude_e6 data=/
  forecast_date data=2011-06-07/
  current_date_time data=2011-06-07 12:38:31 +/
  unit_system data=US/
  /forecast_information
  current_conditions
  condition data=Sunny/
  temp_f data=69/
  temp_c data=21/
  humidity data=Humidity: 66%/
  icon data=/ig/images/weather/sunny.gif/
  wind_condition data=Wind: NW at 3 mph/
  /current_conditions
  forecast_conditions
  day_of_week data=Tue/
  ...
 
  What I am really after is the current_conditions data. How can one
 specify
  WHERE in the XML to use the attributes from? A lot of the information is
  repeated in other nodes so I can't just check (if([elementName
  isEqualToString:@condition]){) , how can I check if the current
 element is
  within a specific tag? (In this case the parent is current_conditions)?
 
  Eric
  ___
 
  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/hank.list%40runbox.com
 
  This email sent to hank.l...@runbox.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


seeking to understand ABPeoplePickerView behavior

2011-06-07 Thread ronald b. kopelman
I have been trying to implement setNameDoubleAction:  setGroupDoubleAction: 
which I do in applicationDidFinishLaunching as follows:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
stuff
[pickerView setNameDoubleAction:@selector(doNameSelection:)];
[pickerView setGroupDoubleAction:@selector(doGroupSelection:)];
}

Allows Multiple Selection, Allows Group Selection,  Multiple Value Selection 
are set for the picker in IB. Everything wired up, classes included,   
nameDoubleAction works fine. So does groupDoubleAction but only when I choose 
All Contacts or more than 1 group. Choosing only 1 group (other than ll 
Contacts) always results in Abe[2333:903] Controller cannot be nil. However, 
this never occurs when I double click a single name!

Apple literature has been less than helpful in this so I have searched the web. 
I finally found an example at 
http://pommedev.mediabox.fr/utilisation-des-classes-cocoa/abpeoplepickerview-un-bug-dans-l'api/
 which suggested using [pickerView setTarget:self]; So…

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification 
//NSApplicationDelegate
{
stuff
[pickerView setTarget:self];
[pickerView setNameDoubleAction:@selector(doNameSelection:)];
[pickerView setGroupDoubleAction:@selector(doGroupSelection:)];
}

works like a charm!

Ok, it's running but I can't understand why this is needed for the 
groupDoubleAction but not the nameDoubleAction. Any hints or suggestions as to 
this behavior?

ronald b. kopelman___

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: Noob question in regards to NSXMLParser

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 7:03 AM, Eric E. Dolecki wrote:

 What I am really after is the current_conditions data. How can one specify
 WHERE in the XML to use the attributes from? A lot of the information is
 repeated in other nodes so I can't just check (if([elementName
 isEqualToString:@condition]){) , how can I check if the current element is
 within a specific tag? (In this case the parent is current_conditions)?

You _totally_ want to use XPath for this. It lets you write a simple query 
string that fetches arbitrarily nested data. What you’re asking for is a 
one-liner. There is a little bit of a learning curve for learning the syntax, 
but it’s really worth it (you can find online tutorials pretty easily by 
searching.)

So instead of NSXMLParser, use the higher level NSXMLDocument (which can even 
fetch the URL for you) and then use the XPath methods on it.

[Um, except now it occurs to me that you didn’t specify what OS you’re on, and 
last I heard iOS didn’t have NSXMLDocument yet… If you’re using iOS, it’s best 
to specify that explicitly, since a lot of us old crusties here will assume OS 
X unless otherwise stated.]

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: Noob question in regards to NSXMLParser

2011-06-07 Thread Eric E. Dolecki
This is for iOS. I've used XPath in other languages and it's totally
awesome. So I am using some flags and a counter to get things done... feels
like a total hack, but it's working.

Sorry, I'll specify in the future for sure...




  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Tue, Jun 7, 2011 at 2:03 PM, Jens Alfke j...@mooseyard.com wrote:


 On Jun 7, 2011, at 7:03 AM, Eric E. Dolecki wrote:

  What I am really after is the current_conditions data. How can one
 specify
  WHERE in the XML to use the attributes from? A lot of the information is
  repeated in other nodes so I can't just check (if([elementName
  isEqualToString:@condition]){) , how can I check if the current
 element is
  within a specific tag? (In this case the parent is current_conditions)?

 You _totally_ want to use XPath for this. It lets you write a simple query
 string that fetches arbitrarily nested data. What you’re asking for is a
 one-liner. There is a little bit of a learning curve for learning the
 syntax, but it’s really worth it (you can find online tutorials pretty
 easily by searching.)

 So instead of NSXMLParser, use the higher level NSXMLDocument (which can
 even fetch the URL for you) and then use the XPath methods on it.

 [Um, except now it occurs to me that you didn’t specify what OS you’re on,
 and last I heard iOS didn’t have NSXMLDocument yet… If you’re using iOS,
 it’s best to specify that explicitly, since a lot of us old crusties here
 will assume OS X unless otherwise stated.]

 —Jens
___

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: CoreData problem - AttributeDescription seems invalid --- What am I doing wrong?

2011-06-07 Thread Motti Shneor
Thanks everyone. I knew it had to be something stupid

I still feel that iterating over a dictionary means iterating over its 
CONTENTS, not its KEYS --- but that's just my weird brain. Finally I found it 
in the documentation as well. 
Following Evadne Wu's advice it now works flawlessly.

On 02/06/2011, at 18:23, Evadne Wu wrote:

 Hello Motti,
 
 I believe -attributesByName returns a dictionary, where the keys are names 
 (NSStrings) and the objects are NSAttributeDescription objects, so when you 
 say `for (id something in aDictionary)` that `something` is going to be the 
 key, not the object value [1], and you will just get the attribute 
 description by using that key.
 
 This *might* work:
 
 - (NSMutableDictionary *)attributesAsDictionary {
  NSDictionary *attributesByName = self.entity.attributesByName
  NSMutableDictionary *returned = [NSMutableDictionary 
 dictionaryWithCapacity:[attributesByName count]];
  for (NSString *aKey in [attributesByName allKeys]) {
[returned setValue:[self valueForKey:aKey] forKey:aKey]; // nil allowed if 
 my memory stands
  }
  return returned;
 }
 
 [1]: I believe you’ve assumed that for…in enumerates object values for 
 NSDictionary objects?
 
 -ev
 
 On Jun 2, 2011, at 20:01, Motti Shneor wrote:
 
 Hello everyone. 
 
 We work with a CoreData model that is memory-based. However,  at times I 
 would want to (partially) save an entity to the UserDefaults, as a 
 dictionary.  For that, I wrote a little NSManagedObject extension (Category) 
 with the following method:
 
 @interface NSManagedObject (OURExtension) 
 @property (readonly) NSMutableDictionary *attributesAsDictionary;
 @end
 - (NSMutableDictionary *)attributesAsDictionary {
  NSMutableDictionary *attributesDictionary = [NSMutableDictionary 
 dictionaryWithCapacity:[self.entity.attributesByName count]];
  for (NSAttributeDescription* attribute in self.entity.attributesByName 
 ) {
  NSString *attribName = [attribute name];
  id attribValue = [self valueForKey:attribName];
  if (attribName  attribValue)
  [attributesDictionary setObject:attribValue 
 forKey:attribName];
  }
  return attributesDictionary;
 }
 
 Running the method for a nice entity that I just Saved (validated) and 
 Fetched again (to be sure it's in the store) --- the method crashes horribly 
 on the NSString *attribName = [attribute name];
 
 If I step inside with the debugger, I see things I can't understand.  I get 
 into the loop, and for the first attribute ---
 1. Debugger claims 'attribute's type is CFStringRef * instead of  
 NSAttributeDescription* 
 2. Summary for  attribute is telephoneID which is reasonable --- one of my 
 attributes is named like that.
 3. drilling down, the private _name  iVar for the attribute is nil but 
 when I try to get it :
 4. NSString *attribName = [attribute name] crashes and debugger looses all 
 track of stack or anything. 
 
 I looked for valid isValid or similar properties in 
 NSAttributeDescription and its ancestor NSPropertyDescription to no avail. 
 Nothing in the docs will tell me WHEN is it right to use the 
 NSAttributeDescription  in the above manner.
 
 Ideas anyone? 


Motti Shneor, 
Senior Software Engineer and Team Leader,  Spectrum Reflections LTD.
---
ceterum censeo microsoftiem delendam esse
---












___

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: Noob question in regards to NSXMLParser

2011-06-07 Thread Chris Ridd

On 7 Jun 2011, at 19:11, Eric E. Dolecki wrote:

 This is for iOS. I've used XPath in other languages and it's totally
 awesome. So I am using some flags and a counter to get things done... feels
 like a total hack, but it's working.
 
 Sorry, I'll specify in the future for sure...

You might want to check out the GDataXMLDocument class, as it is a drop-in 
(exact?) replacement for NSXMLDocument except it supports namespaces properly 
in XPath expressions.

It looks like it supports iOS.

See http://code.google.com/p/gdata-objectivec-client/

And instructions on getting *just* that class from the above: 
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml

Chris
___

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: Noob question in regards to NSXMLParser

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 11:41 AM, Chris Ridd wrote:

 You might want to check out the GDataXMLDocument class, as it is a drop-in 
 (exact?) replacement for NSXMLDocument except it supports namespaces properly 
 in XPath expressions.

Ooooh, that’s nice to know. I’ve had some really frustrating times in the past 
trying to work around the namespace bugs in NSXMLDocument on Mac OS. Thanks!

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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


Login item not hidden

2011-06-07 Thread Leonardo
Hi,
I add my app to the login items list. I mark the hidden check-box.
I re-login, my app gets properly launched but it clearly appears on the
screen, not hidden at all. What do I miss?
I compile with SDK 10.5, target 10.5.


Regards
-- Leonardo


___

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: Login item not hidden

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 3:13 PM, Leonardo wrote:

 I add my app to the login items list. I mark the hidden check-box.
 I re-login, my app gets properly launched but it clearly appears on the
 screen, not hidden at all. What do I miss?

Are you making any call at launch time that would activate the app?
For example, calling [NSApp activateIgnoringOtherApps:YES] in your 
-applicationDidFinishLaunching: method. If so, take this out.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: Login item not hidden

2011-06-07 Thread Leonardo
No I don't do that.
In the applicationDidFinishLaunching method I call
reply = [NSApp runModalForWindow:aboutWindow];
an I dismiss the about window with a timer 2 seconds later.
But even if I comment this line of code, at login, I see the Finder active,
so my app is not active, but the window of my app is clearly visible.
And I can click on it, activate my app and Quit. Which is not what I really
want.

So maybe I didn't understand a point. I explain:
I see in the login item list an Apple application called iTunesHelper.
This is marked as hidden. And when I login I don't see it at all. I cannot
activate nor quit it.
So, how to make my app behaving exactly like that?

Anyway, if I double click on the application iTunesHelper it doesn't get
launched or visible. Strange...


Regards
-- Leonardo


 Da: Jens Alfke j...@mooseyard.com
 Data: Tue, 7 Jun 2011 15:21:39 -0700
 A: Leonardo mac.iphone@gmail.com
 Cc: cocoa-dev@lists.apple.com
 Oggetto: Re: Login item not hidden
 
 
 On Jun 7, 2011, at 3:13 PM, Leonardo wrote:
 
 I add my app to the login items list. I mark the hidden check-box.
 I re-login, my app gets properly launched but it clearly appears on the
 screen, not hidden at all. What do I miss?
 
 Are you making any call at launch time that would activate the app?
 For example, calling [NSApp activateIgnoringOtherApps:YES] in your
 -applicationDidFinishLaunching: method. If so, take this out.
 
 ‹Jens


___

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: Login item not hidden

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 3:46 PM, Leonardo wrote:

 I see in the login item list an Apple application called iTunesHelper.
 This is marked as hidden. And when I login I don't see it at all. I cannot
 activate nor quit it.
 So, how to make my app behaving exactly like that?

If you want an app that has no Dock icon at all, but can still show windows 
when it needs to, you need to mark it as an LSUIElement. Search the developer 
docs for that keyword and read the info.

 In the applicationDidFinishLaunching method I call
reply = [NSApp runModalForWindow:aboutWindow];
 an I dismiss the about window with a timer 2 seconds later.

Why run it modally? Why not just show the window with makeKeyAndOrderFront:, 
and then have the timer dismiss it?

(Also, app splash screens are kind of frowned upon in the HI Guidelines, except 
in special cases like games. Your app should launch quickly enough that the 
user can start using it right away, i.e. in a second or two. )

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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


Malformed URL string in openURL

2011-06-07 Thread James Merkel
I am sending a URL string to NSWorkspace's  openURL method that has  
the bracket characters ( ) in it. The URL can't be opened by   
NSWorkspace. If I take out the ( ) characters NSWorkspace then opens  
the URL, so I guess NSWorkspace considers the string with ( ) a  
malformed URL.


Note, the ( ) characters are used by Mapquest to label a location. If  
I just enter the URL string with brackets in the browser , it opens  
mapquest ok.


Is there any way around this problem?

Thanks,
Jim Merkel
___

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


iOS: antialiasing text

2011-06-07 Thread Graham Cox
I'm rendering text into a bitmap image context (in fact just a single letter, 
with a small drop-shadow). I am unable to get this text to be drawn 
anti-aliased, despite turning on all the shoulds and allows that pertain to 
this. Is anti-aliasing supported in a bitmap context on iOS? It seems to render 
text to the screen anti-aliased, what' s the difference? Or have I missed 
something? Here's the code:

CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB();

CGContextRefcontext = CGBitmapContextCreate( NULL,

PLAYER_IMAGE_SIZE,

PLAYER_IMAGE_SIZE,

8,

PLAYER_IMAGE_SIZE * 4,

colourSpace,

kCGImageAlphaPremultipliedFirst | 
kCGBitmapByteOrderDefault);

CGColorSpaceRelease( colourSpace );

UIGraphicsPushContext( context );

CGContextSetAllowsAntialiasing( context, true );
CGContextSetShouldAntialias( context, true );
CGContextSetInterpolationQuality( context, kCGInterpolationHigh );

UIColor* textColour = [colour shadowWithLevel:0.25];
// category methods on UIColor
UIColor* shadowColour = [colour highlightWithLevel:0.5];

CGContextSetAllowsFontSmoothing( context, true );
CGContextSetShouldSmoothFonts( context, true );
CGContextSetShadowWithColor( context, CGSizeMake( 3, flipped? 3 
: -3 ), 4.0, [shadowColour CGColor]);

if( !flipped )
{
CGContextTranslateCTM( context, 0, PLAYER_IMAGE_SIZE );
CGContextScaleCTM( context, 1.0, -1.0 );
}

UIFont* font = [UIFont boldSystemFontOfSize:PLAYER_IMAGE_SIZE * 
0.5];
CGSize box = [is sizeWithFont:font];

CGRect isBox;

isBox.size = box;
isBox.origin.x = ( PLAYER_IMAGE_SIZE * 0.5 ) - ( box.width * 
0.5 );
isBox.origin.y = ( PLAYER_IMAGE_SIZE * 0.5 ) - ( box.height * 
0.5 );

[textColour set];

[is drawInRect:isBox withFont:font 
lineBreakMode:UILineBreakModeClip];

CGImageRef image = CGBitmapContextCreateImage( context );
CGContextRelease( context );

UIGraphicsPopContext();

return image;



--Graham


___

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: Malformed URL string in openURL

2011-06-07 Thread Jeffrey Walton
On Tue, Jun 7, 2011 at 7:42 PM, James Merkel jmerk...@mac.com wrote:
 I am sending a URL string to NSWorkspace's  openURL method that has the
 bracket characters ( ) in it. The URL can't be opened by  NSWorkspace. If I
 take out the ( ) characters NSWorkspace then opens the URL, so I guess
 NSWorkspace considers the string with ( ) a malformed URL.

 Note, the ( ) characters are used by Mapquest to label a location. If I just
 enter the URL string with brackets in the browser , it opens mapquest ok.

 Is there any way around this problem?
Forgive the obvious: have you tried an HTML escape - #40; and #41;?
___

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: Malformed URL string in openURL

2011-06-07 Thread Jeffrey Walton
On Tue, Jun 7, 2011 at 8:03 PM, Jeffrey Walton noloa...@gmail.com wrote:
 On Tue, Jun 7, 2011 at 7:42 PM, James Merkel jmerk...@mac.com wrote:
 I am sending a URL string to NSWorkspace's  openURL method that has the
 bracket characters ( ) in it. The URL can't be opened by  NSWorkspace. If I
 take out the ( ) characters NSWorkspace then opens the URL, so I guess
 NSWorkspace considers the string with ( ) a malformed URL.

 Note, the ( ) characters are used by Mapquest to label a location. If I just
 enter the URL string with brackets in the browser , it opens mapquest ok.

 Is there any way around this problem?
 Forgive the obvious: have you tried an HTML escape - #40; and #41;?
My bad - URL escapes: %28 and %29.
___

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: Malformed URL string in openURL

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 4:42 PM, James Merkel wrote:

 I am sending a URL string to NSWorkspace's  openURL method that has the 
 bracket characters ( ) in it. The URL can't be opened by  NSWorkspace. If I 
 take out the ( ) characters NSWorkspace then opens the URL, so I guess 
 NSWorkspace considers the string with ( ) a malformed URL.

That’s weird, since RFC 1738 explicitly says parentheses are legal and don’t 
need to be escaped:

Thus, only alphanumerics, the special characters $-_.+!*'(),, and
reserved characters used for their reserved purposes may be used
unencoded within a URL.

Could you show us one of these URLs?

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: Malformed URL string in openURL

2011-06-07 Thread James Merkel


On Jun 7, 2011, at 5:06 PM, Jeffrey Walton wrote:

On Tue, Jun 7, 2011 at 8:03 PM, Jeffrey Walton noloa...@gmail.com  
wrote:
On Tue, Jun 7, 2011 at 7:42 PM, James Merkel jmerk...@mac.com  
wrote:
I am sending a URL string to NSWorkspace's  openURL method that  
has the
bracket characters ( ) in it. The URL can't be opened by   
NSWorkspace. If I
take out the ( ) characters NSWorkspace then opens the URL, so I  
guess

NSWorkspace considers the string with ( ) a malformed URL.

Note, the ( ) characters are used by Mapquest to label a location.  
If I just
enter the URL string with brackets in the browser , it opens  
mapquest ok.


Is there any way around this problem?

Forgive the obvious: have you tried an HTML escape - #40; and #41;?

My bad - URL escapes: %28 and %29.


I tried %28 and %29 and that didn't work either.
___

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: Malformed URL string in openURL

2011-06-07 Thread James Merkel


On Jun 7, 2011, at 5:39 PM, Jens Alfke wrote:



On Jun 7, 2011, at 4:42 PM, James Merkel wrote:

I am sending a URL string to NSWorkspace's  openURL method that has  
the bracket characters ( ) in it. The URL can't be opened by   
NSWorkspace. If I take out the ( ) characters NSWorkspace then  
opens the URL, so I guess NSWorkspace considers the string with ( )  
a malformed URL.


That’s weird, since RFC 1738 explicitly says parentheses are legal  
and don’t need to be escaped:



  Thus, only alphanumerics, the special characters $-_.+!*'(),, and
  reserved characters used for their reserved purposes may be used
  unencoded within a URL.


Could you show us one of these URLs?

—Jens


The following works ok:

NSString * mapquestURLString;

mapquestURLString = [NSString stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916 
];


	if([[NSWorkspace sharedWorkspace] openURL:[NSURL  
URLWithString:mapquestURLString]]);

else NSLog(@Could not open mapquest);

But if I use the following string, I get the error message:

mapquestURLString = [NSString stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916(Test 
 point label)];


I got the examples from

http://www.mapquestapi.com/link-to-mapquest/#parameters

I'm noticing some of the other examples don't  work also.

Jim Merkel___

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: Malformed URL string in openURL

2011-06-07 Thread Jens Alfke

On Jun 7, 2011, at 6:17 PM, James Merkel wrote:

 The following works ok:
 
 NSString * mapquestURLString;
 
 mapquestURLString = [NSString 
 stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916;];

(Just FYI, the -stringWithString call is redundant. You can just assign the 
constant directly to the variable.)

 mapquestURLString = [NSString 
 stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916(Test 
 point label)”];

It’s not the parens that are illegal, it’s the spaces. Change them to %20 and 
you should be OK.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: Malformed URL string in openURL

2011-06-07 Thread James Merkel


On Jun 7, 2011, at 6:20 PM, Jens Alfke wrote:



On Jun 7, 2011, at 6:17 PM, James Merkel wrote:


The following works ok:

NSString * mapquestURLString;

mapquestURLString = [NSString stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916 
];


(Just FYI, the -stringWithString call is redundant. You can just  
assign the constant directly to the variable.)


mapquestURLString = [NSString stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916(Test 
 point label)”];


It’s not the parens that are illegal, it’s the spaces. Change them  
to %20 and you should be OK.


—Jens


Right you are -- thanks.

I was using stringWithString because I actually  was building  up a  
URL string by appending strings.

I simplified the code to show the problem.

Jim Merkel___

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: Malformed URL string in openURL

2011-06-07 Thread Howard Siegel
On Tue, Jun 7, 2011 at 18:20, Jens Alfke j...@mooseyard.com wrote:


 On Jun 7, 2011, at 6:17 PM, James Merkel wrote:

  mapquestURLString = [NSString stringWithString:@
 http://mapq.st/?maptype=hybridq=39.7452,-104.98916(Test point label)”];

 It’s not the parens that are illegal, it’s the spaces. Change them to %20
 and you should be OK.


 Or change the spaces to pluses (+).

- h
___

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: Login item not hidden

2011-06-07 Thread Jerry Krinock
On 2011 Jun 07, at 15:13, Leonardo wrote:

 I add my app to the login items list. I mark the hidden check-box.
 I re-login, my app gets properly launched but it clearly appears on the
 screen, not hidden at all. What do I miss?
 I compile with SDK 10.5, target 10.5.

There was a bug I reported in 2008, which would have been Mac OS X 10.5, which 
is that setting apps as hidden did not work.  This bug occurred when using 
the LSSharedFileList API; I'm not sure about the checkbox in System Preferences.

Anyhow the Bug ID number was 5901742.  It appears that Apple has marked it 
Closed with no explanation :(

But I also agree with Jens that there are better designs for what you want to 
do.

Jerry

___

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: Malformed URL string in openURL

2011-06-07 Thread Steve Christensen
On Jun 7, 2011, at 6:32 PM, James Merkel wrote:

 On Jun 7, 2011, at 6:20 PM, Jens Alfke wrote:
 
 On Jun 7, 2011, at 6:17 PM, James Merkel wrote:
 
 The following works ok:
 
 NSString * mapquestURLString;
 
 mapquestURLString = [NSString 
 stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916;];
 
 (Just FYI, the -stringWithString call is redundant. You can just assign the 
 constant directly to the variable.)
 
 mapquestURLString = [NSString 
 stringWithString:@http://mapq.st/?maptype=hybridq=39.7452,-104.98916(Test 
 point label)”];
 
 It’s not the parens that are illegal, it’s the spaces. Change them to %20 
 and you should be OK.
 
 —Jens
 
 Right you are -- thanks.
 
 I was using stringWithString because I actually  was building  up a URL 
 string by appending strings.
 I simplified the code to show the problem.

Is there some reason you're not using built-in support to properly escape 
strings that are part of URLs?

NSString* mapType = @hybrid;
NSString* location = @39.7452,-104.98916(Test point label);

mapquestURLString = [NSString 
stringWithFormat:@http://mapq.st/?maptype=%@q=%@;,
[mapType 
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
[location 
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

___

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: Malformed URL string in openURL

2011-06-07 Thread James Merkel


On Jun 7, 2011, at 9:52 PM, Steve Christensen wrote:


stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding


Yeah, I just found that method about an hour ago!

Not related to Cocoa -- but It turns out after playing around with  
this with mapquest and google maps, adding a label can change the view  
that you get (particularly in google maps).
So I probably won't add that. But at least I found out how to get a  
legal URL string in the process.


Thanks,

Jim Merkel
___

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


Determining bounds needed for a Core Image effect

2011-06-07 Thread Graham Cox
I'm using Core Image filters to apply real-time effects to vector objects.

I've run into the problem of determining just how much space I need to 
accommodate any given effect. Currently I just add a fixed percentage to the 
bounds I start with, but it's actually inadequate to do this for many effects, 
which frequently end up running off the edges of the space allotted.

The vector objects have a defined bounds which fully encloses all drawing that 
they do. When these objects are altered, that bounds is used to refresh just 
that part of the view as needed. When a CI Filter is applied, I use that 
bounds, multiply it by some scaling factor, and use that to create an offscreen 
image into which the vector object plus its CI effect is rendered. The 
resulting image is then drawn in the view. The needed space for a given effect 
varies depending on the effect and its parameters, but I see no way to compute 
that reliably. If I make the bounds some enormous scale-up of the original 
bounds to accommodate any potential effect, performance suffers dramatically 
because of all the wasted area of the view that has to be updated.

Is there any way to preflight a Core Image filter effect so I know how much 
space I'll need to draw it?


--Graham


___

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