Re: How to manage creation of an unknown number of windows?

2009-10-05 Thread Jens Alfke
On Oct 5, 2009, at 7:20 AM, Rui Pacheco wrote: I've a class that extends NSWindowController and that class lists an unknown number of entries. Double clicking on an entry will open a window where it will be possible to interact with the real world object that entry represents. I plan to mak

Re: wait for the event?

2009-10-05 Thread Jens Alfke
On Oct 5, 2009, at 5:34 PM, jon wrote: and i put the rest in the selector method like so... to be executed when the page is fully loaded, which works... but the thing is, the code immediately following the main call to "loadThePage" isn't waiting, it keeps on executing... which defeats

Re: How to check if a class derives from another?

2009-10-05 Thread Jens Alfke
On Oct 5, 2009, at 6:35 PM, Rick Mann wrote: I have a need to tell if a class I'm loading dynamically is derived from another class. How do I do this? Class justLoadedClass = ... ; if ([justLoadedClass isSubclassOfClass: [MyBaseClass class]]) { ... } —Jens

Re: [Performance issue] Resizing an alert sheet => blinks

2009-10-06 Thread Jens Alfke
On Oct 6, 2009, at 3:29 PM, Iceberg-Dev wrote: The contents. It's a bit as if there was a patchwork of rectangles and a random set of these rectangles would not be redrawn when the window size increases by 1 pixel and then another set for the following pixel. That sounds like a graphics

Re: app delegate +initialize

2009-10-07 Thread Jens Alfke
On Oct 6, 2009, at 11:30 PM, John Baldwin wrote: When the application crashes on launch, there is no record of the +initialize method being called. When the application launches successfully, there is a record of the +initialize method being called. I haven't been following the whole thr

Re: NSAlert - multiple key equivalents for buttons?

2009-10-07 Thread Jens Alfke
On Oct 7, 2009, at 10:58 AM, David Reitter wrote: What is the easiest way to get my customized NSAlert to allow multiple key equivalents for its buttons? I think the best way is to create your own alert panel in a nib and run it modally. That way you have total control — you can set your o

Re: Hide an Item on Desktop

2009-10-09 Thread Jens Alfke
On Oct 9, 2009, at 10:37 AM, Maggie Zhang wrote: What I want is to hide existing mounted volumes whose names I don't want to change. Setting the HFS "invisible" bit is the way to go, then. I've done this before. You can do this from the command line: SetFile -a V /Volumes/HideMe D

Re: How to ease the burden on the Garbage Collector?

2009-10-09 Thread Jens Alfke
On Oct 9, 2009, at 7:23 AM, Gabriel Zachmann wrote: http://zach.in.tu-clausthal.de/tmp/malloc1.png http://zach.in.tu-clausthal.de/tmp/malloc2.png http://zach.in.tu-clausthal.de/tmp/malloc3.png Those are showing all malloc operations. Most of those are not garbage- collected, so they don't af

Re: Are these Apple or 3rd party classes?

2009-10-09 Thread Jens Alfke
On Oct 9, 2009, at 11:05 AM, Philip White wrote: The crash report is actually from my own crash reporter, not from Apple's and it doesn't report what libraries are loaded. I slapped together my own reporter because few users think to send the info from Apple's crash reporter to the develop

Re: Instance variables: access directly vs. getter / setter

2009-10-09 Thread Jens Alfke
On Oct 9, 2009, at 2:30 AM, Graham Cox wrote: In init and dealloc, it is usual & recommended to access the ivar directly - not because self isn't defined (it is), but because at those times you are usually only concerned with setting the ivar's initial value (possibly to an object), or rel

Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-09 Thread Jens Alfke
On Oct 8, 2009, at 7:33 PM, Glen Low wrote: 1. The code is not GC friendly as between the end of start and the beginning of finishWithSomething, there are no references to the object, so it may be collected. There must be references to it; otherwise how would that object's methods get ca

Re: real verses Virtual memory

2009-10-10 Thread Jens Alfke
A couple of points… [1] Yes, it is possible to allocate "wired" memory that is forced to stay in physical RAM and never be paged to disk. But this ability is pretty much used only by low-level software like kernel extensions, device drivers, and real-time audio processors. These are things

Re: How to allocate and delegate; or how to keep GC and the static analyzer happy

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 2:25 AM, Glen Low wrote: Not necessarily. In a pathological but presumably legit case, whatever happens in initDelegate: might only form a weak reference to the Something object, thus the Something object would be subject to GC. That's true, although unlikely. In that

Re: How to ease the burden on the Garbage Collector?

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 1:14 AM, Gabriel Zachmann wrote: So, is 20% CPU time for the GC thread normal? That's a lot more than I'd expect based on what you're doing. Either you've got code you haven't shown us that's allocating a ton of objects during the animation, or some system framework (C

Re: real verses Virtual memory

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 12:35 PM, Thomas Wetmore wrote: Please take this off list. Why? This seems like a relevant discussion for cocoa-dev. Just because you're not interested in it doesn't make it off-topic. —Jens___ Cocoa-dev mailing list (Cocoa-

Re: real verses Virtual memory

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 12:41 PM, jon wrote: oh... that is good to know... hmm, well it looks like i need to go lower in the mechanism, stuff i don't know anything about, so i'll do research on the best way to get the info off the website at a lower level. RSS or Atom feeds are often us

Re: real verses Virtual memory

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 1:01 PM, jon wrote: drives me crazy the documentation... it is there, but you have to know what to look for before you ever go down the correct tangent. There's certainly a lot of stuff, and it takes a while to learn what's in there. :/ The good part is that all th

Re: capturing special keys when focused in an NSTextField

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 1:13 PM, aaron smith wrote: Quick question - I have a window that I run as a sheet, which contains an NSTextField to enter a message. I have the window setup to close the sheet when the Escape key is pressed, however, when the text field is focused I can't figure out how to

Re: real verses Virtual memory

2009-10-10 Thread Jens Alfke
On Oct 10, 2009, at 2:54 PM, jon wrote: i was using a notification that was standard that told me when the page finished loading... does this have the same sort of mechanism? (or need it) when fetching the page? NSURLConnection has a delegate object you can set, which will get called

Re: Appropriate dealloc and finalize actions

2009-10-11 Thread Jens Alfke
On Oct 11, 2009, at 7:44 PM, Karolis Ramanauskas wrote: I have object1 that has a connection to object2, (object1.connection = object2). And at the same time object2.connection = object1: O1 -> O2 O2 -> O1 It's generally a bad idea to have two objects each retain the other. It prod

Re: Appropriate dealloc and finalize actions

2009-10-11 Thread Jens Alfke
On Oct 11, 2009, at 4:11 PM, Greg Guerin wrote: Why would you do this? You're making one object responsible for the internals of another object. This is a bad idea. It breaks the individual encapsulation of each object. But there are times you need to do this. One example is in some t

Re: NSCollectionView delegate methods aren't called

2009-10-11 Thread Jens Alfke
On Oct 11, 2009, at 12:28 PM, Rick Mann wrote: I'm trying to implement drag & drop in my NSCollectionView, following the 10.6 release notes. I've got my delegate set, but nothing was happening. I then implemented each of the methods to see if any were called, and none are. I've verified th

Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Jens Alfke
On Oct 12, 2009, at 4:26 AM, Karolis Ramanauskas wrote: As you can see each box has one or more little "inputs" and "outputs" in fact these inputs and outputs are instances of one class (KROMPort). When I drag a connection from output to an input, I set each "port's" connection property to

Re: Thread Safety - A Theoretical Question

2009-10-12 Thread Jens Alfke
On Oct 12, 2009, at 2:47 PM, Dave Keck wrote: I recommend adopting this rule too, and only making classes thread safe if it makes sense. +1 While making every class you ever write thread-safe might be a good intellectual exercise, it's hard and time consuming, and I doubt there's many of us

Re: [UTI] Anyway to retrieve the UTI of a file without having to use a FSRef?

2009-10-12 Thread Jens Alfke
On Oct 12, 2009, at 3:36 PM, Iceberg-Dev wrote: Wouldn't there be an API I didn't see in Foundation that lets you obtain the type without having to convert, at least, a NSURL to a FSRef? In 10.5 there were a bunch of mismatches between APIs like this, that required clients to convert bet

Re: Getting AAC tag information

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 2:12 AM, Sven wrote: I've found documentation on getting ID3 tag data from MP3s via QuickTime, but I'm having a hard time finding information on retrieving this data from AAC files. You can get at AAC tags via QuickTime's movie-metadata API — QTCopyMovieMetaData etc.

Re: Implementing Back and Forth Control.

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 2:53 AM, Philip Juel Borges wrote: But it would be better to have just one segmented control in the toolbar that can go back and forth in any of the views that is swapped in. You can either (1) Set the segmented control's target property to point to the active WebVie

Re: Code Sign verification on Leopard

2009-10-13 Thread Jens Alfke
This code sample seems to be designed to verify the binary that it's compiled into. That's sort of useless for security purposes, like yelling downstairs "are you a burglar?" If your own code's already been modified, it's easy enough for the hacker to disable the code that does the checking

Re: Should VM shrink to original when releasing huge memory

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 2:14 AM, Nick Rogers wrote: When my program runs the VM grows from 50MB to around 550MB. So when I release the memory, should VM shrink to the original 50MB, in this case it isn't so? Virtual size is not usually a useful value for telling you "how much memory am I usin

Re: Language based scanning

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 8:35 AM, John Joyce wrote: Part of the localization process in Cocoa is to create your localized nib/xib files. This includes adjusting interface elements and layout accordingly so that it makes sense for different languages/cultures. Even some ready-made interface elemen

Re: Getting AAC tag information

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 9:30 AM, Sven wrote: Thanks... I don't want to encode any audio files, I merely want to be able to get and set tag data. For MP3s I can use id3lib no problems, but that doesn't help me with AAC files. I guess if there's no way to edit tags via the Apple libraries (if I

Re: Code Sign verification on Leopard

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 9:25 AM, jonat...@mugginsoft.com wrote: But it's not useless in the sense that it provides feedback that the code IS signed. The code merely allows me to detect if I have screwed up my build settings and managed to break the code signing. Sure, it's useful for that. Bu

Re: Disabling clicking on links in webview

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 8:58 AM, Arun wrote: I have an application where i use webview to display links to websites. I need to know is there any way in which we can disable the clicking on the links in the webview or is it possible to disable actions on complete webview? Look at the WebView del

Re: How to iterate over all objects stored with NSCoder

2009-10-13 Thread Jens Alfke
On Oct 12, 2009, at 9:40 PM, Michael Robinson wrote: As I lost the source code, I would like to know if there is a way to dump all keys/values from NSCoder so I can use it to help me with my arduous rewrite. There is not any API for this. Parsing an archive is pretty difficult unless you

Re: arrayWithContentsOfFile

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 11:49 AM, I. Savant wrote: Nope. The docs are correct and I'm betting the file you specified in fact *doesn't* exist. The docs say it returns nil if the file doesn't exist, and he's getting an empty array. That was his question. "/Documents/file.plist" is probably n

Re: Property List Format vs NSKeyedArchiver Format

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 1:08 PM, Bridger Maxwell wrote: I would like to read more on the NSKeyedArchiver XML format, but can't find documentation on it. Is it open? No. It's undocumented and could change in the future; writing code for another platform that parses it would probably be a bad i

Re: NSString Class Instance Variables

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 4:29 PM, Graham Cox wrote: Apart from the class cluster answer you already got, the public headers don't need to include any instance variables even if they exist in reality. Only if the class cannot be subclassed. In the 32-bit runtime, instance variable offsets are d

Re: Property List Format vs NSKeyedArchiver Format

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 4:43 PM, Graham Cox wrote: While strictly true, it's not possible that Apple could really ever stop supporting it, due to the many millions of files out there that use it and will have to remain readable in their existing form. True, but it can change in ways that are b

Re: Handle multiple screens & mouse

2009-10-13 Thread Jens Alfke
On Oct 13, 2009, at 2:35 PM, Gabriel Höhener wrote: How do I handle multiple screens, if I want to drag a window programmatically from one screen [NSScreen mainscreen] to another [[NSScreen screens] objectAtIndex:x]? I know that I can access the frame from each screen and get like that the

Re: Handle multiple screens & mouse

2009-10-14 Thread Jens Alfke
On Oct 14, 2009, at 12:53 AM, Gabriel Höhener wrote: The problem is not about the window but about the mouse. When i programmatically move the mouse around and cross the borders of my screens, it jumps to (0,0) on the mainscreen.. Don't move the mouse cursor around! That's just annoying. N

Re: Positioning NSWindow center to Application main window?

2009-10-14 Thread Jens Alfke
On Oct 14, 2009, at 2:09 PM, Arun wrote: Is it possible to position the launched window to become exactly center to the Main application window? Get the frame of the main window. Get the frame of your new window. Figure out how far to offset the x,y of the new window's frame to center it.

Re: Help with NSURLConnection memory fault

2009-10-14 Thread Jens Alfke
It looks as though your object (the delegate) got dealloced too early, before the NSURLConnection finished loading. This shouldn't be possible, since the connection object retains the delegate, but you may have too many release calls to it someplace. What I would do next is set a breakpoint

Re: [SOLVED] Re: Help with NSURLConnection memory fault

2009-10-14 Thread Jens Alfke
On Oct 14, 2009, at 7:43 PM, Stuart Malin wrote: Just a "lucky" coincidence that the memory where the dealloc'd NSURLConnection had lived was still the (now defunct) object, so it went through its motions again, and tried to release the delegate a second time. The MallocScribble environm

Re: shared preferences.

2009-10-14 Thread Jens Alfke
On Oct 14, 2009, at 8:38 PM, Sandro Noel wrote: I'm experiencing problems with my application preference, some part of the preferences are user specific but the licensing part is meant to be global for the computer. I am looking for a document that would explain how I can get some preferen

Re: NSURLConnection timeout -- what happens?

2009-10-15 Thread Jens Alfke
On Oct 15, 2009, at 11:44 AM, Stuart Malin wrote: I have looked through the NSURLConnection class reference, the NSURLRequest class reference, the URL Loading System guide, queried Google, searched mailing list archives, and even looked through NSURLConnection.h, but can not find documenta

Re: language based scaning,

2009-10-15 Thread Jens Alfke
On Oct 15, 2009, at 12:33 PM, Nasser Al Zahrani wrote: so what classes should i be looking at ? NSString, mostly. Call -characters and loop over the UniChar[] array it returns. It's possible there are APIs for language/script detection at a lower level, like CoreText, but this may be th

Re: How to retrieve the font information from TrueType font file?

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 3:31 AM, XiaoGang Li wrote: other uncontained fonts which come from the system or third party application will be invalid in my application. when the users use my application to draw text, only the fonts contained in the bundle should be valid. This is the backgroud of my

Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 7:52 AM, Greg Hoover wrote: It's signed by Verisign. Where does NSURLRequest and its supporting routines find the CA root certs? In the Keychain. You can see the list of pre-installed root certs by launching Keychain Access and selecting "System Roots" from the keych

Re: A good Obc-C framework for sending email?

2009-10-16 Thread Jens Alfke
On Oct 15, 2009, at 4:34 PM, Peter Hudson wrote: The ED code looks like interesting and I will give it a try as well. Does anybody know of a good primer on creating / sending email ( possibly in a Cocoa / Objective-C environment ) I don't think there is one, given how hard it is to even fi

Re: A good Obc-C framework for sending email?

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 12:04 PM, Alastair Houghton wrote: Or you could do what we do and ask their mail client to deliver it for us. What if they don't have a mail client configured? As Andrew said in the message you replied to: an increasing number of users use webmail for everything, and

Re: Extract plain text content from a Text View

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 12:37 PM, Ian Piper wrote: Is there a way to get the plain text content out of an NSTextStorage object (displaying using a Text View) that contains rich text and images? I want to figure out a way to build a search predicate that will allow me to search a Text View and

Re: File Encryption / Decription

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 7:05 PM, Chunk 1978 wrote: what is the best way to encrypt and then decrepit a file in Cocoa? Look at . It's a plain C API. Warning: Encryption is only useful if you know what you're doing. If you're planning to do anything serious (certainly anything you want other p

Re: Simulating webpage clicks

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 7:20 PM, Charles Burnstagger wrote: I need to parse the content of the default page, find specific links I am looking for, then simulate clicks on those links in the page just as if the user was clicking it normally - and I need to do all this in Objective-C without any

Re: Sqlite and Core Data

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 7:43 PM, Thomas Hart wrote: Can I use Core Data to access the sqlite database that I've created? Are there any files I need to add, or code I need to write? Not directly. Core Data does use SQLite to store data, but it uses very specific conventions for names and relati

Re: Extract plain text content from a Text View

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 3:42 PM, Ian Piper wrote: The Text View is simply used as a place for the user to put any rich text and or images. Is there a way either to search or to get all of the plain text out from such a Text View? It's probably a simplistic question and I rather suspect that ul

Re: How to retrieve the font information from TrueType font file?

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 10:31 PM, Mike Wright wrote: 1. Single Fonts with the ".ttf" file extension have only a data fork, and the name of the file seems to be the name of the font. Not necessarily. The filename is not part of the font, so it can be arbitrary, and a lot of the time it's not th

Re: Extract plain text content from a Text View

2009-10-16 Thread Jens Alfke
On Oct 16, 2009, at 11:21 PM, Ian Piper wrote: That would suit me well if I could just understand how to tap into it. I can set up filterPredicates in IB for other attributes in my data model but not for the one that is displaying its content in the NSTextView. Why are you using predicat

Re: How to retrieve the font information from TrueType font file?

2009-10-17 Thread Jens Alfke
On Oct 17, 2009, at 8:09 AM, Mike Wright wrote: FYI, I haven't found any of the "Font Suitcase" files that have a data fork. The font is in the 'FOND' resource -- and all of those fonts work fine under Snow Leopard. Some of this legacy stuff is probably pretty hard to eliminate without nas

Re: Why does my font come out looking fuzzy?

2009-10-17 Thread Jens Alfke
On Oct 17, 2009, at 7:46 PM, Ben Haller wrote: Copied the TrueType font from Instruments into my project, added the necessary key to my Info.plist, set the font using [NSFont fontWithName:...], and hey presto, there the font is in my app. Only... it doesn't look as nice. It's less crisp.

Re: Curious about SSH --> actually about: Keychain

2009-10-18 Thread Jens Alfke
On Oct 18, 2009, at 12:50 PM, Stuart Malin wrote: Multiple keywords is good stuff: the first link served by a Google search of "keychain framework" scores a bullseye: Keychain Framework | Get Keychain Framework at SourceForge.net There's also MYCrypto (disclaimer: written by me) which is le

Re: OSX have that is equivalent to WaitMessage() Win32 API

2009-10-18 Thread Jens Alfke
You're looking for CFRunLoop (or NSRunLoop if you want to use Objective-C), which is the way event loops and event handling work on Mac OS X. But there isn't a function like WaitMessage, because the loop is inside-out — instead of writing your own event loop, the system runs it, and calls

Re: Cocoa Autosizing Control

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 12:29 PM, Rick Langschultz wrote: I am writing an application which can insert objects into a canvas. The application has an inspector like Dashcode or Interface Builder. Under the ruler view of Interface Builder 3.X there is an autosizing control with "springs" that a

Re: Webkit and SSL

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 12:57 PM, Lemon Obrien wrote: I've been making an application using webkit and it doesn't want to work with SSL certificates. I use cocoa and nothing happens, the url is just not navigated to It sounds like you didn't implement the WebFrameLoadDelegate or WebResourceLo

Re: Reading NSInputStream

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 1:04 PM, Ashley Perrien wrote: After initiating a connection (getStreamsToHost) I don't get an event that the input stream has bytes available, if I check it, it returns NO but if I go ahead and read it anyway, I get the usual banner. It sounds like you didn't call -

Re: Reading NSInputStream

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 4:48 PM, Ashley Perrien wrote: NSMutableData *returnMessage = [NSMutableData dataWithLength: 300]; [readStream read: [returnMessage mutableBytes] maxLength: 300]; NSMutableString *readData = [[[NSMutableString alloc] initWithBytes: [returnMessage bytes] le

Re: Cocoa-dev Digest, Vol 6, Issue 1522

2009-10-21 Thread Jens Alfke
OK, the reason reading data doesn't work is because you aren't waiting for the delegate calls to tell you that data is available; you're just opening the stream and then immediately trying to read. It takes time to open a socket and receive data over it. You should really read the conceptua

Re: NSInputStream / Eventqueue / run in Background

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 12:22 AM, co...@weblooks.ch wrote: It's blocking while I'm transferring some data from an iPhone to the mac via bonjour and press some button in the front... Bonjour doesn't transfer data. It's only for discovering what services are available, not for connecting to the

Re: Sending a Selector to another Class.

2009-10-21 Thread Jens Alfke
On Oct 21, 2009, at 9:43 AM, Jim Kang wrote: That selector is a unique index that points to a method of a specific class. No, that's not true of Objective-C (although it is of C++ method- pointers.) A selector is, basically, just a unique string: it defines a message, not a method, to use

Re: stringWithContentsOfURL with resulting error 256

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 7:16 AM, James Lin wrote: NSString *result = [NSString stringWithContentsOfURL:theURL encoding:NSUTF8StringEncoding error:&error]; However, the result comes back with an NSError as the following: Error Domain=NSCocoaErrorDomain Code=256 UserInfo=0x15d7b0 "Operation could

Re: NSTextField not getting mouseDown

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 7:08 AM, Sander Stoks wrote: But: if I cause editing to end by pressing the Enter key (instead of Tab), and then give another window the focus, clicking on the textfield doesn't cause a mouseDown to be receive anymore. The contents of the textfield stay selected (the f

Re: Sending a Selector to another Class.

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 5:54 AM, Jim Kang wrote: However, a selector is not a string. I was just listening to this podcast with Mike Ash, and he discusses this around the 9:23 mark or so: http://podcast.mobileorchard.com/episode-23-mike-ash-on-the-objective-c-runtime-objects-and-the-runtime-messa

Re: Professional Error Handling

2009-10-22 Thread Jens Alfke
On Oct 22, 2009, at 4:40 PM, Squ Aire wrote: And then of course return NO or nil from the method. Is this how the professionals would do it? Basically, although I have a utility function that does most of the work, so I don't have to dump ten lines of boilerplate into my code every time

Re: NSDate timeIntervalSinceNow problem

2009-10-23 Thread Jens Alfke
On Oct 22, 2009, at 9:02 PM, PCWiz wrote: Tried using %f to log it instead of %d, but it gives me this: 2009-10-22 22:01:55.459 TestApplication[8629:a0f] -2160.459210 "%f" is for float. Use "%d" for doubles. —Jens___ Cocoa-dev mailing list (Cocoa

Re: Professional Error Handling

2009-10-23 Thread Jens Alfke
On Oct 23, 2009, at 7:03 AM, Squ Aire wrote: I'm not much for the second suggestion of putting all the errors in one big header file (thanks for the idea nonetheless!). I like the idea of seperating it like you have, only that I'm not sure what purpose it serves to make it available to all

Re: NSDate timeIntervalSinceNow problem

2009-10-23 Thread Jens Alfke
On Oct 23, 2009, at 8:46 AM, Jens Alfke wrote: "%f" is for float. Use "%d" for doubles. Oops, I meant "%lf" for doubles. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin request

Re: Foundation Tool and NSDistributedNotificationCenter

2009-10-23 Thread Jens Alfke
On Oct 23, 2009, at 8:37 AM, Zephyroth Akash wrote: It works fine, the tool get the notification and do its work ... but I'm unable to notify the application that the work is done. Are you posting another notification from your tool back to the application? In the code you posted I'm not c

Re: stringWithContentsOfURL with resulting error 256

2009-10-23 Thread Jens Alfke
On Oct 23, 2009, at 9:23 AM, James Lin wrote: I tried curl and gotten "500 Internal Server Error-The server encountered an internal error or misconfiguration and was unable to complete your request." That is a server error, just like it says. Something probably went wrong inside your PHP

Re: Make an NSButton send a message on right click

2009-10-23 Thread Jens Alfke
On Oct 22, 2009, at 5:28 PM, Alexander Golec wrote: For the cells, I want to have a matrix of NSButtons, and I want each button to respond differently to right clicks and left clicks. Would I have to extend NSButton or something? Yup. Subclass NSButton, override -mouseDown: and check wheth

Re: Crash drawing image

2009-10-24 Thread Jens Alfke
On Oct 24, 2009, at 6:51 AM, slasktrattena...@gmail.com wrote: When the crash happens, I get the spinning beach ball until I terminate the process, so I cannot investigate it any further (I think?). Anyway, this is what I get from the debugger: Program received signal: “EXC_BAD_ACCESS”. Error

Re: Professional Error Handling

2009-10-26 Thread Jens Alfke
On Oct 25, 2009, at 3:44 PM, Dick Bridges wrote: FWIW, there are some people (myself included) that consider "error numbers" to be something of an anti-pattern when exception handling is available. Because of [IMHO] improvements in gcc, Objective-C now supports exception handling and it mi

Re: Transitioning to GC-supported

2009-10-26 Thread Jens Alfke
On Oct 26, 2009, at 6:45 AM, Dave Keck wrote: 1. Apply workaround for interior pointers by '[containingObject self];' at the end of the method, to keep the containing object alive. A valid point, but in my experience this is a rare problem: I have never run into an instance of a bug cause

Re: Transitioning to GC-supported

2009-10-26 Thread Jens Alfke
On Oct 26, 2009, at 8:43 PM, Dave Keck wrote: For example, I have an object that [self retain]; while it does some work that takes awhile. I don't hold a reference to this object anywhere after it's created - it simply notifies its delegate when its finished. I remember a thread about this a

Re: Mysterious crash in objc_msgSend in GC app

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 10:43 AM, Sean McBride wrote: Thread 0 Crashed: 0 libobjc.A.dylib 0x7fff81d86ad9 objc_msgSend + 41 1 com.apple.CoreFoundation0x7fff81eba969 __CFMessagePortPerform + 185 2 com.apple.CoreFoundation0x7fff81eda12c CFRun

Re: waiting for async callback in main thread

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 10:40 AM, Alexander Cohen wrote: Now, i would like to be able to wait for that callback on the main thread like this: [object addObserverForCallback] ... wait for callback ... continue on processing with the state of the object The only way i see i can do that is by runn

Re: Alternative to stringWithContentsOfURL

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 8:35 AM, James Lin wrote: The sticky point right now is: the same url string used with stringWithContentsOfURL works perfectly when accessed using a browser. Which means my php script is in perfect working order. Dude, I answered this for you last week, explaining plausi

Re: Bold and Italic For Dictionary Font Attributes (Hillegass Chapter 20, Challenge 2)

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 4:59 AM, Chunk 1978 wrote: attributes = [[NSMutableDictionary alloc] init]; [attributes setObject:[NSFont fontWithName:@"Helvetica" size:75] forKey: NSFontAttributeName]; [attributes setObject:[NSColor redColor] forKey: NSForegroundColorAttributeName]; [attributes setO

Re: waiting for async callback in main thread

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 12:11 PM, Alexander Cohen wrote: 100% agree with you, and that's what i would normally do. But unfortunately, this time i must wait in the mainthread for the callback. I know it's wrong, but this time i've gotta do it. Then use a while loop to run the runloop until your

Re: Alternative to stringWithContentsOfURL

2009-10-27 Thread Jens Alfke
On Oct 27, 2009, at 4:40 PM, John Pannell wrote: Some web servers are configured to compress the reply (i.e. zip/ gzip) for transmission, and then the client will decompress and display. NSString is not a client that is prepared to do this, however. Here is some old code: Are you sure th

Re: Detecting a network connection

2009-10-28 Thread Jens Alfke
On Oct 28, 2009, at 9:22 AM, colors wrote: Is there an API for determining a physical network connection (ethernet, WiFi, etc.)? Again, SystemConfiguration has APIs for that. But unless you're doing something unusual, you probably don't need to check for physical network interfaces. An a

Re: Odd window behavior LSUIElement=1

2009-10-28 Thread Jens Alfke
On Oct 28, 2009, at 5:37 AM, Matthew Lindfield Seager wrote: If that is the case it would seem to imply that when A quits the system looks for the "next" app. In this case "next" seems to be determined in the same way command-tab chooses the "next" app. Yup. This is basically the expected beh

Re: waiting for async callback in main thread

2009-10-28 Thread Jens Alfke
On Oct 27, 2009, at 11:13 PM, John Engelhart wrote: While Cocoa might do this, there's probably a few "important details" that you're glossing over. Using a different run loop mode for the the recursive run of the loop is a good example. I'd be willing to bet there's an implicit assumptio

Re: how to filter available fonts for my application?

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 1:34 AM, XiaoGang Li wrote: But the Reference> tells me that this delegate methods is not called in Mac OS X version 10.3 and later. I don't have any idea how to implement it now? does anyone know it? thanks Do you really need to support 10.3? I'm sure there are few

Re: how to filter available fonts for my application?

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 9:02 AM, Ross Carter wrote: Do you really need to support 10.3? I'm sure there are few copies of it still in the wild, and someone who hasn't even upgraded the OS in five years is unlikely to be installing new apps, anyway. I think the question is how to support post-10

Re: Showing activity indicator during data download

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 9:00 AM, Alastair Houghton wrote: If you insist on using threading, then yes, you could do this in the background with an NSOperationQueue (or by using NSThread directly). As for Foundation objects and thread-safety, note that immutable objects generally *are* thread-s

Re: Showing activity indicator during data download

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 9:40 AM, DKJ wrote: I did implement this, and got it to work. But some of the files I'm downloading are XML data that needs to be parsed. And the parser can't start until the file download is complete, which is what made the synchronous download so appealing. It's ann

Re: Changing the NSView bounds origin point

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 2:37 PM, Gustavo Pizano wrote: I have a custom NSView and Im drawing in it a glossy background, BUT it seems the algorithm that Im using assumes as coordinates origin to be on the upper left corner and the nsview origin start on the bottom left corner. Is there any work

Re: Detecting a network connection

2009-10-29 Thread Jens Alfke
On Oct 29, 2009, at 6:35 PM, colors wrote: So before I try to communicate with the server, I would like to know that I can actually get off the machine to some kind of network. This will help avoid having to wait for curl to timeout. It looks like NSHost and SCNetwork... depend on having

Re: Trying blocks

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 3:08 AM, Bill Cheeseman wrote: As far as I have been able to determine, you cannot include blocks- based code in a binary that runs on Leopard or older as well as on Snow Leopard. Testing for Leopard and older and branching around the blocks code does not solve the probl

Re: EndianU32_NtoB

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 8:56 AM, gMail.com wrote: In the past I have successfully used EndianU32_NtoB to read a "long" on a PPC machine. Now I need to read and write an array of "unsigned int" and an array of "float". May you please tell me how to do? Just write a 'for' loop to convert each e

Re: createbackupPath from boost library not working for MAC

2009-10-30 Thread Jens Alfke
On Oct 29, 2009, at 11:03 PM, Nikhil Khandelwal wrote: I am running unit test cases to check the functionality. In this I am checking createbackupPath of boost library. Its working well for windows platform but not able to create backupPath for MAC. It throws some exception If you want h

<    4   5   6   7   8   9   10   11   12   13   >