Send Cocoa-dev mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/cocoa-dev
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cocoa-dev digest..."
Today's Topics:
1. dumb bindings/user defaults question (Andrew R. Kinnie)
2. stringWithContentsOfURL:encoding:error weirdness (Doug Knowles)
3. Re: Multiple developers and nib files (Erik Buck)
4. Re: Multiple developers and nib files (Graham Perks)
5. Re: Multiple developers and nib files (Nick Zitzmann)
6. Current Hour & Minutes (???? ???????)
7. Re: How to make NSWindow redraw vacated rects "ifNeeded"?
(Andrew Farmer)
8. Re: Handle data disappearing out from underneath me
(Andrew Farmer)
9. Points (Ryan Brown)
10. Re: Multiple developers and nib files (Charles Srstka)
11. Re: Current Hour & Minutes (Nick Zitzmann)
12. Re: Multiple developers and nib files (Scott Anguish)
13. Re: Multiple developers and nib files (Graham Perks)
14. Re: Points (j o a r)
15. Re: Multiple developers and nib files (Nick Zitzmann)
16. Re: Multiple developers and nib files (Scott Anguish)
----------------------------------------------------------------------
Message: 1
Date: Sun, 8 Apr 2007 15:06:14 -0400
From: "Andrew R. Kinnie" <email@hidden>
Subject: dumb bindings/user defaults question
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Greetings:
I am working on a document based app, and I'm using the user defaults
bindings mechanism. I created a plist with the relevant key/value
combination (basically a string for a key and an int that corresponds
to the key). I loaded this as factory defaults, and created several
keys that can be reset by the user.
In my app I created a text field bound to one of these keys in the
user defaults. This works fine.
I decided it was better to put this on a separate preferences panel.
I created a panel in the MainMenu.nib and placed the text field bound
the same way on that panel (SharedUserDefaults -> values.myKey) The
panel is bound to the Preferences menu item (makeKeyAndOrderFront).
However, the initial values do not appear when the preference panel
is loaded. I can use my factory defaults button or my revert button
and this populates the field with values, and I can change them,
apply the changes, etc.
If I change the values, apply it, then reload it, the CHANGED values
appear, but still not the initial/factory ones.
Anyone have an idea what I might be missing? Here is my initialize
method (straight from the docs)
+ (void)initialize
{
[MyDocument setupDefaults];
}
+ (void)setupDefaults
{
NSString *userDefaultsValuesPath;
NSDictionary *userDefaultsValuesDict;
NSDictionary *initialValuesDict;
NSArray *resettableUserDefaultsKeys;
// load the default values for the user defaults
userDefaultsValuesPath=[[NSBundle mainBundle]
pathForResource:@"UserDefaults"
ofType:@"plist"];
userDefaultsValuesDict=[NSDictionary
dictionaryWithContentsOfFile:userDefaultsValuesPath];
// set them in the standard user defaults
[[NSUserDefaults standardUserDefaults]
registerDefaults:userDefaultsValuesDict];
resettableUserDefaultsKeys=[NSArray
arrayWithObjects:@"myKey1",@"myKey2",@"myKey3",nil];
initialValuesDict=[userDefaultsValuesDict
dictionaryWithValuesForKeys:resettableUserDefaultsKeys];
[[NSUserDefaultsController sharedUserDefaultsController]
setInitialValues:initialValuesDict];
}
Thanks.
------------------------------
Message: 2
Date: Sun, 8 Apr 2007 15:22:03 -0400
From: "Doug Knowles" <email@hidden>
Subject: stringWithContentsOfURL:encoding:error weirdness
To: "Cocoa Dev" <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I have been using, quite successfully, NSString's
stringWithContentsOfURL:encoding:error to read RSS feeds from various
sources. All of sudden, I'm getting errors when trying to process
CNN's feeds (which I used to read successfully): the method returns a
null result and an encoding error:
Error: NSError "File could not be opened using text encoding Unicode
(UTF-8)." Domain=NSCocoaErrorDomain Code=261
UserInfo={NSStringEncoding = 4; NSURL =
http://rss.cnn.com/rss/money_latest.rss; }
I can download the feed using curl from the command line, and it looks
OK; the HTTP header says the content is UTF-8, the XML header says its
UTF-8, and BBEdit doesn't have any trouble opening the curl-downloaded
content.
I've tried specifying other encodings, and at best I get garbage that
can't be parsed as XML.
Any ideas? My next idea is to open and process the URL connection
myself, but I'd rather keep the simple implementation and fry other
fish first.
TIA,
Doug Knowles
------------------------------
Message: 3
Date: Sun, 8 Apr 2007 15:54:42 -0400
From: Erik Buck <email@hidden>
Subject: Re: Multiple developers and nib files
To: Cocoa-Dev Mail <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Well, the problem is localization. Unless you're fluent in pretty
much every language, you're going to need to send your nib files to
someone else to translate them into Spanish, French, Japanese, etc.,
and when they send the modified versions back to you, they sometimes
end up lacking the .svn directory inside, which causes Subversion to
go into a *fit*.
If there's any way around this, I'd love to know about it as well.
The old solution for using CVS with nibs in the Nextstep days was to
have scripts which tared and untarred the nib as it was checked in
or out. That way CVS treated the entire nib directory as a single
binary file.
------------------------------
Message: 4
Date: Sun, 8 Apr 2007 15:08:08 -0500
From: Graham Perks <email@hidden>
Subject: Re: Multiple developers and nib files
To: Charles Srstka <email@hidden>
Cc: Apple Cocoa List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Charles,
There is the all-important setting that really ought to be part of
the XCode install:
defaults write com.apple.InterfaceBuilder VersionControlDirectory
"(CVS, .svn)"
If you do that, IB knows to keep the .svn folder intact inside
the .nib folder. Without it, as you say, Subversion goes frantic.
Why should a nib file be mergeable between multiple devs? One is
updating some bindings, another wrapping some view in a scroller,
another setting an NSView to a custom view. Who knows? There are
plenty of cases where multiple developers might need to be working on
the same nib file.
Cheers,
Graham Perks.
On Apr 8, 2007, at 1:15 PM, Charles Srstka wrote:
On Apr 8, 2007, at 12:59 PM, Scott Stevenson wrote:
On Apr 8, 2007, at 4:58 AM, Graham Perks wrote:
How do teams share nib files? Whether saved in text or binary, it
appears that if two people edit a nib, there is no way to merge
the changes together in, say, Subversion.
Conceptually, I don't think nibs are something that fit well with
the concept of merging. The user interface of a window should
really only be updated by one person at a time. From the user's
perspective all of the onscreen elements directly impact each other.
Well, the problem is localization. Unless you're fluent in pretty
much every language, you're going to need to send your nib files to
someone else to translate them into Spanish, French, Japanese,
etc., and when they send the modified versions back to you, they
sometimes end up lacking the .svn directory inside, which causes
Subversion to go into a *fit*.
If there's any way around this, I'd love to know about it as well.
Charles
------------------------------
Message: 5
Date: Sun, 8 Apr 2007 14:11:17 -0600
From: Nick Zitzmann <email@hidden>
Subject: Re: Multiple developers and nib files
To: Graham Perks <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Apr 8, 2007, at 2:08 PM, Graham Perks wrote:
There is the all-important setting that really ought to be part of
the XCode install:
defaults write com.apple.InterfaceBuilder VersionControlDirectory
"(CVS, .svn)"
If you do that, IB knows to keep the .svn folder intact inside
the .nib folder. Without it, as you say, Subversion goes frantic.
Really? IB by default hasn't trashed .svn directories inside nibs
since Xcode 1.1 or so.
Nick Zitzmann
<http://www.chronosnet.com/>
------------------------------
Message: 6
Date: Sun, 8 Apr 2007 23:15:58 +0300
From: ???? ??????? <email@hidden>
Subject: Current Hour & Minutes
To: Apple Mail List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Hi...
Hmm, this look easy, but I don't know why it doesn't work with me !!!
All what I need is the current hour & minutes as int.
====== ONE OF MY TRYING =======
I use NSDate and NSCalendar and some of the out resource classes, :
( but I didn't get what I want .
====== ONE OF MY TRYING =======
I use this: http://theocacao.com/document.page/389
It look like useful but when I do:
NSLog(@"+currentHour: %i", [THCalendarInfo currentHour]);
It show me the current hour, BUT when I do:
int currentHour = [[NSString stringWithFormat:@"%i",[THCalendarInfo
currentHour]] intValue];
currentHour valuable will get zeros. !!!
------------------------------
Message: 7
Date: Sun, 8 Apr 2007 13:23:05 -0700
From: Andrew Farmer <email@hidden>
Subject: Re: How to make NSWindow redraw vacated rects "ifNeeded"?
To: Jerry Krinock <email@hidden>
Cc: Cocoa Developers Developers <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On 08 Apr 07, at 08:36, Jerry Krinock wrote:
I often find myself needing to sprinkle in what I feel are extra -
display messages to NSWindows to when I want them to update.
Yesterday I isolated a demo which gets me closer to understanding
this.
<...>
// Update the window
[window displayIfNeeded] ; // Not good enough!!
// Uncomment the next line and it works as desired
// [window display] ;
// Show for 3 seconds
[NSThread sleepUntilDate:
[NSDate dateWithTimeIntervalSinceNow:3.0]];
AppKit depends on the presence of an event loop for a lot of things,
including redrawing views. I'm not exactly sure what you're trying to
accomplish here, but it'll probably work better if you avoid sleeping
outside the event loop. Use NSTimer and -[NSObject
performSelector:withObject:afterDelay:] to implement delayed events.
As a general point, BTW, you should never need to call
setNeedsDisplay, display, or displayIfNeeded on view objects. (Only
exception is a view calling setNeedsDisplay on itself.) The view
should otherwise be able to do redraw management for itself.
------------------------------
Message: 8
Date: Sun, 8 Apr 2007 13:23:34 -0700
From: Andrew Farmer <email@hidden>
Subject: Re: Handle data disappearing out from underneath me
To: Ken Tozier <email@hidden>
Cc: Cocoa-Dev Mail <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On 08 Apr 07, at 07:24, Ken Tozier wrote:
Being an autoreleased NSData probably has something to do with it
but I would have thought that PtrToHand did something internally to
prevent the deletion of the data it points to...
Nope. I'm pretty sure that, as part of the old Memory Manager,
PtrToHand doesn't do anything to retain data passed to it - it
assumes that the underlying data was allocated with NewPointer or
something similar. If the data was actually created as an NSData
instance and hasn't been retained, it will get deallocated and
(eventually) overwritten!
------------------------------
Message: 9
Date: Sun, 8 Apr 2007 13:26:13 -0700
From: Ryan Brown <email@hidden>
Subject: Points
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
[[NSScreen mainScreen] frame] reports the resolution of the main
screen in points. Points are defined to be 1/72th of an inch. If my
resolution is 1680x1050, [[NSScreen mainScreen] frame] returns (1680,
1050) and if my resolution (hypothetically) is 10x10 it returns (10,
10). But how can this be so? 10 pixels are being mapped onto to my
21" screen (making each pixel > 1in), so the number returned by
[[NSScreen mainScreen] frame] should be significantly higher. Why
isn't it? Is there some level of abstraction I'm missing?
Ryan
------------------------------
Message: 10
Date: Sun, 8 Apr 2007 15:29:41 -0500
From: Charles Srstka <email@hidden>
Subject: Re: Multiple developers and nib files
To: Nick Zitzmann <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Apr 8, 2007, at 3:11 PM, Nick Zitzmann wrote:
On Apr 8, 2007, at 2:08 PM, Graham Perks wrote:
There is the all-important setting that really ought to be part of
the XCode install:
defaults write com.apple.InterfaceBuilder VersionControlDirectory
"(CVS, .svn)"
If you do that, IB knows to keep the .svn folder intact inside
the .nib folder. Without it, as you say, Subversion goes frantic.
Really? IB by default hasn't trashed .svn directories inside nibs
since Xcode 1.1 or so.
All I know is that the .nib files I get back from my localizers often
lack those .svn directories, which causes me a lot of hassle in
fixing it.
I'll try asking my localizers to set that defaults key and see if it
improves things at all.
Charles
------------------------------
Message: 11
Date: Sun, 8 Apr 2007 14:34:45 -0600
From: Nick Zitzmann <email@hidden>
Subject: Re: Current Hour & Minutes
To: ???? ??????? <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed
On Apr 8, 2007, at 2:15 PM, Ù.ØÙ.د اÙ"رÙfÙSاÙ? wrote:
Hmm, this look easy, but I don't know why it doesn't work with me !!!
All what I need is the current hour & minutes as int.
Try: (warning - written in Mail, untested, use at your own risk, etc.)
NSCalendarDate *now = [NSCalendarDate date];
int hour = [now hourOfDay];
int minute = [now minuteOfHour];
Alternately, this will work in Tiger and later, and is probably more
future-proof:
NSCalendar *cal = [NSCalendar currentCalendar];
NSDateComponents *hourAndMinute = [cal components:NSHourCalendarUnit
| NSMinuteCalendarUnit fromDate:[NSDate date]];
int hour = [hourAndMinute hour];
int minute = [hourAndMinute minute];
Nick Zitzmann
<http://www.chronosnet.com/>
------------------------------
Message: 12
Date: Sun, 8 Apr 2007 16:35:44 -0400
From: Scott Anguish <email@hidden>
Subject: Re: Multiple developers and nib files
To: Graham Perks <email@hidden>
Cc: Apple Cocoa List <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
in addition to what Erik said..
remember that nibs aren't text configuration files. they're actually
object graphs (archived versions of the objects you create in IB)
that isn't something merge-able.
by and large Subversion/CVS is the way to go.
On Apr 8, 2007, at 7:58 AM, Graham Perks wrote:
How do teams share nib files? Whether saved in text or binary, it
appears that if two people edit a nib, there is no way to merge the
changes together in, say, Subversion.
------------------------------
Message: 13
Date: Sun, 8 Apr 2007 15:48:37 -0500
From: Graham Perks <email@hidden>
Subject: Re: Multiple developers and nib files
To: Nick Zitzmann <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
I was having trouble in XCode 2.4 until changing this default. Odd
that... it seems you're right after some googling.
Graham.
On Apr 8, 2007, at 3:11 PM, Nick Zitzmann wrote:
There is the all-important setting that really ought to be part of
the XCode install:
defaults write com.apple.InterfaceBuilder VersionControlDirectory
"(CVS, .svn)"
If you do that, IB knows to keep the .svn folder intact inside
the .nib folder. Without it, as you say, Subversion goes frantic.
Really? IB by default hasn't trashed .svn directories inside nibs
since Xcode 1.1 or so.
------------------------------
Message: 14
Date: Sun, 8 Apr 2007 22:52:00 +0200
From: j o a r <email@hidden>
Subject: Re: Points
To: Ryan Brown <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"
On 8 apr 2007, at 22.26, Ryan Brown wrote:
[[NSScreen mainScreen] frame] reports the resolution of the main
screen in points. Points are defined to be 1/72th of an inch.
-[NSScreen frame] returns the "dimensions" of your screen. Where do
you see that those are returned in points?
Read more about this here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaDrawingGuide/Transforms/chapter_4_section_2.html#//apple_ref/doc/
uid/TP40003290-CH204-DontLinkElementID_94>
j o a r
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2434 bytes
Desc: not available
Url :
http://lists.apple.com/pipermail/cocoa-dev/attachments/20070408/056944ef/smime.bin
------------------------------
Message: 15
Date: Sun, 8 Apr 2007 14:53:25 -0600
From: Nick Zitzmann <email@hidden>
Subject: Re: Multiple developers and nib files
To: Scott Anguish <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
On Apr 8, 2007, at 2:35 PM, Scott Anguish wrote:
remember that nibs aren't text configuration files. they're
actually object graphs (archived versions of the objects you create
in IB)
that isn't something merge-able.
Here's something I've always wondered: Are the XML versions of nibs
also unmergable, or is that only the binary nibs? I've never enabled
the XML option in IB because it doesn't say anything in IB about
their compatibility...
Nick Zitzmann
<http://www.chronosnet.com/>
------------------------------
Message: 16
Date: Sun, 8 Apr 2007 16:56:32 -0400
From: Scott Anguish <email@hidden>
Subject: Re: Multiple developers and nib files
To: Nick Zitzmann <email@hidden>
Cc: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On Apr 8, 2007, at 4:53 PM, Nick Zitzmann wrote:
On Apr 8, 2007, at 2:35 PM, Scott Anguish wrote:
remember that nibs aren't text configuration files. they're
actually object graphs (archived versions of the objects you create
in IB)
that isn't something merge-able.
Here's something I've always wondered: Are the XML versions of nibs
also unmergable, or is that only the binary nibs? I've never enabled
the XML option in IB because it doesn't say anything in IB about
their compatibility...
they're both object graphs.. both not merge-able.
------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins (at) lists.apple.com
http://lists.apple.com/mailman/listinfo/cocoa-dev
End of Cocoa-dev Digest, Vol 4, Issue 342
*****************************************