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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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 CommonCrypto/CommonCryptor.h. 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

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

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

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

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

2009-10-17 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 the

Re: Extract plain text content from a Text View

2009-10-17 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

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

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

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

2009-10-19 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

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

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]

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

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

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

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:

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

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

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 requests or moderator comments to the list

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

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

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”.

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

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

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

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

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

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

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

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

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

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

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 assumption

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 NSFontManager Class 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

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

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*

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

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

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

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

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

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

Re: PolKit for Leopard and later

2009-10-30 Thread Jens Alfke
On Oct 29, 2009, at 6:25 AM, Pierre-Olivier Latour wrote: The entire project is available open-source under GPLv3 license hosted on Google Code. If you are interested in using PolKit in a non-open- source project and need a commercial license, please contact me. This sounds like great

Re: EndianU32_NtoB

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 10:31 AM, Sean McBride wrote: I don't get why for ints they have host-big, host-little, etc. for the floats they don't. Instead they have those weird host- swapped. And though they take floats, they return structs. I think this is to avoid storing swapped floats in

Re: loading images from external disk

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 11:38 AM, Gabriel Zachmann wrote: Now, one user has reported that, occasionally, CGImageSourceCreateWithURL() fails -- I can tell from the log I received. I have never seen a case where -fileURLWithPath has failed. Maybe the file doesn't contain valid image data. The

Re: Inconsistency in handling of slashes and colons (bug in componentsJoinedByString ?)

2009-10-30 Thread Jens Alfke
On Oct 30, 2009, at 1:09 PM, Gabriel Zachmann wrote: 0. file = w: slash/detail_soldiers.jpg 1. file = w: slash/lot2.jpg 2. file = 2005-03-20 11-59-13.NEF etc. [imagefiles_ componentsJoinedByString: @\n] and print the result, and I get joined names = w\n slash/detail_soldiers.jpg\nw\n

Re: Asynchronous downloading again

2009-11-01 Thread Jens Alfke
On Oct 31, 2009, at 6:50 PM, DKJ wrote: All of the files have to be downloaded before the app can do anything. I get the connectionDidFinishLoading delegate method of my one and only NSURLConnection to call a downloadFinished method at the end of the synchronous downloads, so the app

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

2009-11-01 Thread Jens Alfke
On Oct 31, 2009, at 12:44 PM, Russell Finn wrote: -- i.e. key, object, key, object; this is what I tried to correct this in my post, as shown above. Yeah, sorry about that; my mistake. (I'm so used to using my $dict, which puts the keys/values in the 'correct' order...) —Jens

Re: Does [NSNetService getInputStream:outputStream:] really return retain objects and where does it say that

2009-11-01 Thread Jens Alfke
On Nov 1, 2009, at 1:30 PM, Markus Spoettl wrote: The documentation doesn't back this assertion, neither does the header comment in NSNetServices.h. According to the memory management rules the method should return autoreleased streams. Yes; but that doesn't necessarily mean the streams

Re: why use pow(x, 2)?

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 11:01 AM, Chunk 1978 wrote: why use this: float dist = pow(red - r, 2) + pow(green - g, 2) + pow(blue - b, 2); instead of: float dist = ((red - r) * 2) + ((green - g) * 2) + ((blue - b) * 2); Um, * is multiplication, not exponentiation. Maybe you're thinking of the

Re: why use pow(x, 2)?

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 2:01 PM, Chris Williams wrote: But it still does leave the style question: is pow(x,2) clearer than x*x? For arbitrary values of x they won't even give the same results. (Consider if the value being squared were q++.) And if the value being squared contains function

Re: Keeping NSTimeInterval updated with current time

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 3:10 PM, PCWiz wrote: What I want to do is around every 5 minutes, update the timeInterval to be consistent with the current time. The problem is that I need to do this update for a large number of instances of the object. One way I could think to do this would be to

Re: why use pow(x, 2)?

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 3:22 PM, Bob Smith wrote: True, and not true, IMHO. It can be a pitfall to worry about performance issues too early in a coding project. On the other hand, by the time you know there is a performance problem it can easily be too late for low-level code optimization,

Re: override behaviour of handling NSLinkAttributeName

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 8:01 PM, PCWiz wrote: By default the clicked URL just opens in the default web browser. Is there any way to override this behaviour and have my own code run in place of just opening the URL. There's an NSTextView delegate method for this: - (BOOL)textView:(NSTextView

Re: Commandline Tool Help - NSDistantObject and NSConnection

2009-11-02 Thread Jens Alfke
On Nov 2, 2009, at 9:36 PM, aaron smith wrote: There seems to be some kind of bug when passing around an NSURL through distributed objects. Oh, you've run into _that_! :-/ For some reason, NSURLs are unexpectedly not copied when sent over DO, the way other value objects like NSStrings

Cocoa HTML template engine?

2009-11-04 Thread Jens Alfke
I want to populate a WebView with some nicely-styled HTML depicting an Objective-C data model. The nicest way to do this is with some sort of template engine, so I can tweak the output by editing HTML-like templates rather than messing with code. I've already written this twice before, but

Re: Best pattern for similar objects with differences

2009-11-04 Thread Jens Alfke
On Nov 4, 2009, at 10:47 AM, Paul Bruneau wrote: So this is very attractive, but I keep worrying about how I would change a door from one type to another if I utilize these subclasses. Any ideas the best pattern to use? I can't figure out how I would take an existing object of say

Re: PolKit for Leopard and later

2009-11-04 Thread Jens Alfke
On Oct 31, 2009, at 5:43 PM, Pierre-Olivier Latour wrote: I'm actually fairly flexible on giving custom license (say BSD or LGPL) to project owners who contact me. However, depending on the case, I would ask for no compensation (say for a freeware or small shareware) or some reasonable

Re: NSString of selected text in NSTextView

2009-11-09 Thread Jens Alfke
On Nov 7, 2009, at 7:49 PM, Todd Heberlein wrote: Yeah, one of the concerns I had was whether the selected NSRange is preserved when -string is called. I've always assumed it is. That is, all character indexes that appear in the NSText[View] API correspond to character positions in the

Re: Creating a small timer?

2009-11-09 Thread Jens Alfke
On Nov 9, 2009, at 9:19 AM, Michael Abendroth wrote: How can I create such a timer? I mean, it probably isn't very efficient to redraw the whole view every second just to get the timer to update. Drawing a view once a second shouldn't be a problem. Look at all the stuff iTunes' pseudo-LCD

Re: Compile error using @synchronized on methods that return values

2009-11-09 Thread Jens Alfke
On Nov 8, 2009, at 12:11 PM, Stuart Malin wrote: But I suspect that from the posters comments in the post I reference below, it isn't a bug. The problem is, you can't return up the calling chain while being synchronized. Do whatever work it is that needs to be performed in a synchronized

Re: Pausing an NSThread

2009-11-09 Thread Jens Alfke
On Nov 8, 2009, at 2:17 AM, Roland King wrote: Or look at NSOperation/NSOperationQueue which absolves you of the need to care about threads, it's done for you (and I believe makes use of Grand Central Dispatch on current versions of OSX). Just package up whatever it is you need to do and

Re: Cocoa Sounds

2009-11-09 Thread Jens Alfke
I ran into this too. A decent workaround is to preload the sound: create an NSSound object for the audio file you want to play, set its volume to zero, then play it. After that it's warmed up and will play instantly. (Actually not entirely instantly on laptops, which will turn off the

Re: Cocoa Sounds

2009-11-09 Thread Jens Alfke
On Nov 9, 2009, at 3:35 PM, Chunk 1978 wrote: thanks. haven't had time to test the workaround yet. i'll check out coreaudio. You really don't want to get into CoreAudio unless you're planning on doing some serious audio work. The APIs are low-level and complex and will take quite a

Re: Cocoa Sounds

2009-11-09 Thread Jens Alfke
On Nov 9, 2009, at 4:43 PM, Chunk 1978 wrote: i've also only read about the complexity of OpenAL, which i assume is even more low level in the sense that CoreAudio to OpenAL it's anologous to CoreAnimation to OpenGL. Not really; it might even be the other way around. OpenAL is a cross-

Re: EXC_BAD_ACCESS mystery

2009-11-10 Thread Jens Alfke
On Nov 10, 2009, at 5:37 AM, Ian Piper wrote: Can anyone advise a good strategy for tracking down EXC_BAD_ACCESS crashes? I have an application that I can run quite happily two out of three times. Then it will crash with this error. By this I mean I can do Build and Run successively with

Re: Implicit @try/@catch?

2009-11-10 Thread Jens Alfke
On Nov 10, 2009, at 8:44 PM, Jim Kang wrote: I ran some code that apparently threw an exception of sorts, but it was caught without any code explicit @catch block. It was like this: Weird — I don't know of anything that would cause that. Is this a Release build? The code

Re: How do I get Lucida Grande italic into my application?

2009-11-12 Thread Jens Alfke
On Nov 12, 2009, at 9:39 AM, Eric Gorr wrote: Unfortunately, the link http://trac.webkit.org/projects/webkit/browser/trunk/WebCore/platform/mac/FontMac.mm#L583 is no longer valid The file's been moved in the WebKit source tree since that URL was posted. Searching for 'FontMac.mm' in

Re: How do I get Lucida Grande italic into my application?

2009-11-12 Thread Jens Alfke
On Nov 12, 2009, at 11:37 AM, Eric Gorr wrote: CGAffineTransformMake(1, 0, -tanf(SYNTHETIC_OBLIQUE_ANGLE * acosf(0) / 90), 1, 0, 0)); My matrix math is a bit rusty...how would I turn that into a series of method calls to NSAffineTransform? Looks like those parameters are the six

Re: Vector images on Cocoa

2009-11-17 Thread Jens Alfke
PDF is the standard vector format. NSImage supports loading and drawing it. --Jens {via iPhone} On Nov 17, 2009, at 1:47 AM, Henri Häkkinen hen...@henuxsoft.com wrote: Hello. I would need some way of loading vectorized images from files and drawing them to my custom NSView derived

Re: Question about Style wrt private methods

2009-11-18 Thread Jens Alfke
On Nov 18, 2009, at 9:44 AM, Michael de Haan wrote: Names of most private methods in the Cocoa frameworks have an underscore prefix (for example, _fooData ) to mark them as private. From this fact follow two recommendations. • Don’t use the underscore character as a prefix for your

Re: Question about Style wrt private methods

2009-11-18 Thread Jens Alfke
On Nov 18, 2009, at 11:15 AM, Jim Correia wrote: This problem is just not restricted to private methods, or additions through categories. You can also run afoul of a namespace conflict with a public method in your subclass. Yes; but this is less likely because Apple engineers add public

Re: Help with Background Tasks

2009-11-18 Thread Jens Alfke
On Nov 18, 2009, at 11:21 AM, Mark Bateman wrote: I am developing an App with a table that will hold URL content. I want to download that in the background and then have it update the table as it arrives. Don't do this using threads. Cocoa's networking APIs are asynchronous, so you can

Re: Help with Background Tasks

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 10:42 AM, Mark Bateman wrote: All that said I would like to use URLconnection instead (as jens points out) they are asynch but again I have the problem of allocating the responses back to the correct index path object. Each NSURLRequest can have its own delegate. Store

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 1:28 PM, Dave DeLong wrote: I have an NSTextView that I need to resize dynamically. NSTextView appears to resize itself as I add text, but I also need it to shrink itself as I delete text. Here's what I've tried: Several of those look like reasonable calls for this

Re: NSRunloop + shared thread

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 2:54 PM, Colin Deasy wrote: I have a shared thread that is used to process multiple asynchronous tasks. But at some point, a task may need to 'pause' its execution, and cannot exit its method and wait to be re-called, how can I do this? They're not really asynchronous

Re: How to change TCP / IP settings using Cocoa

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 9:17 AM, Padmakumar T V wrote: I need to know the current TCP / IP configuration setting Configure IPv4 of current WiFi connection and change this settings from Using DHCP to Manually and configure IP settings like IPaddress and subnet using Cocoa API.

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote: When I print out the size or rect that these return, I invariably get either {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, {2.30359e-314, 2.1224e-314}} (that's just running the rect through NSStringFromRect()) Make sure the

Re: NSRunloop + shared thread

2009-11-19 Thread Jens Alfke
On Nov 19, 2009, at 3:40 PM, Colin Deasy wrote: This shared thread is actually handling potentially large numbers of concurrent url connections/downloads. The reason that I want a block in some of those at different times is a for a form of bandwidth control I am trying to do. I don't

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