Re: Autosave in place - common use case that makes me hate it

2012-09-21 Thread Michael Vannorsdel
I think if you have really good undo support people find autosave less of an annoyance. Most people took advantage of the save-before-experimenting method because several apps had bad or nonexistent undo support so saving was the only way to reliably go back. On Sep 21, 2012, at 10:05 AM,

Re: Entitlements and specific files/dirs

2011-08-18 Thread Michael Vannorsdel
official and unofficial docs and through trial and error. On Aug 18, 2011, at 10:08 AM, Sean McBride wrote: On Wed, 17 Aug 2011 03:17:30 -0600, Michael Vannorsdel said: Apologies if this has been covered in the past but my searches did not turn up anything as specific as I'm looking

Entitlements and specific files/dirs

2011-08-17 Thread Michael Vannorsdel
Apologies if this has been covered in the past but my searches did not turn up anything as specific as I'm looking for. Is there a way to refine sandbox entitlements to allow read/write access to specific files and directories instead of just all or none? For instance, only allowing RW to

Re: NSTrackingArea pending install

2010-06-11 Thread Michael Vannorsdel
I had this happen a couple times when dealing with threading accidents. If the tracking rects are added from a secondary thread or the window is ordered front by a secondary thread, then the tracking areas will be stuck in a pending state. There's probably more reasons for this but these are

CALayer mask issue

2010-03-30 Thread Michael Vannorsdel
I have a CALayer that is larger than the window and I move that layer around to view various sections of it. The layer is also masked by another CALayer. The problem I have is if I move half of the layer out of view the mask stops working right. As if the mask is transparent so none of the

Float constants

2010-03-17 Thread Michael Vannorsdel
I've been working on some 64bit code cleaning but need some advice on float constants. Currently on 32bit builds I use -fsingle-precision-constant since most of my code uses CGFloats and I'd like the constants to be the correct precision. But in some places I do work with doubles and would

Re: Float constants

2010-03-17 Thread Michael Vannorsdel
This is exactly why I do it for the 32bit builds. What I'm trying to avoid in the sections that use doubles is having the constant generate a float load, double store, double load for each constant. I'm still poking through the assembly to see if gcc is indeed doing this but I'm also checking

Re: Determine if only single instance is running.

2010-02-22 Thread Michael Vannorsdel
When I have a process that I really don't want running more than once (some people will run copies or use LaunchServices to launch multiples) I register a named mach port with NSConnection. When when an instance launches it checks for that connection and if it exists the new instance

Re: setAction:@selector is not working ?

2010-02-19 Thread Michael Vannorsdel
I would try and reset the target just after setting the action: [myMenuItem setAction:@selector(myFunction:)]; [myMenuItem setTarget:self]; I remember a long time ago I had a problem where if I reset the item's action, it would set the target to nil for some reason. So in practice I

Re: RegisterEventHotKey and keylogging

2010-02-06 Thread Michael Vannorsdel
I found that I can hotkey any keys and then use CGEventPost to post the key to the front application. This effectively lets me track all the keys the user presses from a non-privileged application while still sending input to the key window/process. I was also able to see my admin pass

RegisterEventHotKey and keylogging

2010-02-02 Thread Michael Vannorsdel
Can RegisterEventHotKey be used to log an admin password or other passwords? I accidentally hotkey'd some regular characters and had them trigger when typing in my admin pass on 10.5.8. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: RegisterEventHotKey and keylogging

2010-02-02 Thread Michael Vannorsdel
Ya makes sense and pretty much what I saw; input was getting absorbed by the hotkey app. I'm just thinking if a userland processed hotkeyed all keys when the pass window popped. I'm guilty of quickly typing my pass so I could get 3-4 characters into it before I'd notice input isn't

Re: Quick DO endian question

2009-06-25 Thread Michael Vannorsdel
Thanks for the confirmation. I did some testing using Rosetta and didn't see endian problems but I wanted to make sure this was intended and reliable on actual PPC and not just an anomaly leading me to believe the byte swapping was automatic for explicit types. On Jun 24, 2009, at 10:54

Re: Blur NSImage

2009-06-13 Thread Michael Vannorsdel
To reiterate, this is probably the best solution if you want to blur all images that will be set on this image view. From IB you just activate the Core Animation layer for the image view and attach the gaussian blur filter to it. Then every image it displays will be blurred

Re: Drop dowm status menubar item while hovering cursor over it

2009-06-11 Thread Michael Vannorsdel
What Mr. Farmer was saying is this problem is a known bug with no workaround or quick fix. You will have to wait for Apple to fix this in a future system update. There is nothing you can do to your application to make this work properly. If you make a separate status item plugin, that

Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Michael Vannorsdel
Generally you subclass the control and implement whatever data association you want. On Jun 11, 2009, at 4:41 AM, Jo Meder wrote: I'm pretty sure I know the answer to this question, but I'll ask it anyway :-)... Is there a Cocoa equivalent to Carbon's Get|SetControlProperty() family of

Re: Get|SetControlProperty() equivalent

2009-06-11 Thread Michael Vannorsdel
Subclass NSView and use poseAsClass to replace the default implementation. You'll need to do the posing before running NSApplicationMain. You'll have to use a different approach if you're building for 64-bit. On Jun 11, 2009, at 7:25 AM, Jo Meder wrote: Hi Graham, On 11/06/2009, at

Re: NSDictionary dictionaryWithContentsOfURL problem

2009-06-03 Thread Michael Vannorsdel
Could be one of many network programs like LittleSnitch or NetBarrier. Could also be he's using a proxy. On Jun 2, 2009, at 9:37 PM, Mr. Gecko wrote: Hello. For some reason, one of my customers is having a problem which I determined to be NSDictionary dictionaryWithContentsOfURL can't

Re: Setting wantsLayer = YES; crashes on view load.

2009-06-02 Thread Michael Vannorsdel
Great glad you found it. Those are pretty hard to track down sometimes. On Jun 2, 2009, at 2:36 AM, Kevin Ross wrote: Turns out I did have an spurious NSNotificationCenter registration in a loaded view that was causing the crash. Thank you for your help Michael!

Re: Setting wantsLayer = YES; crashes on view load.

2009-06-01 Thread Michael Vannorsdel
Are you registering for any notifications? It looks like it's crashing while trying to notify an object. On Jun 1, 2009, at 12:31 AM, Kevin Ross wrote: Hi everyone, I have a Core Data document based app that I've been working on for a while and I now want to change some of the view

Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You're creating an NSImage and pretending it's an NSImageView which it's not. You'll need to create a new NSImageView and then the NSImage and set the image as the imageview's image. On May 30, 2009, at 8:27 AM, cocoa learner wrote: Thanx Nick for your reply.But in my window I am not

Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You'd really be better off making an NSView subclass and having it draw the image you want in drawRect:. - (void)awakeFromNib { myImage = [[NSImage alloc] init [self setNeedsDisplay:YES]; } - (void)drawRect:(NSRect)rect { NSSize isize = [myImage size]; [myImage

Re: Displaying a number with Quartz

2009-05-26 Thread Michael Vannorsdel
NSString's stringWithFormat:, or using sprintf/asprintf with the %d format: char * str; if(asprintf(str, %d, intval) 0) //error CGContextShowTextAtPoint... free(str); or if you know the possible max size of the text: char strbuffer[MAX]; if(snprintf(strbuffer, MAX, %d, intval)

Re: what am I missing with NSString ?

2009-05-26 Thread Michael Vannorsdel
rawFileName = [[NSString alloc] initWithString:[[files objectAtIndex:i] stringByStandardizingPath]]; Be sure to release rawFileName before you replace it with a new path. On May 26, 2009, at 7:33 AM, vinai wrote: think I am missing something really basic here with NSString. I am trying

Re: Save dictionary to local file please help!

2009-05-12 Thread Michael Vannorsdel
You need to retain destinationPath when you create it so it doesn't go away. You properly retain dataDict, now do the same with destinationPath and you should be ok. Also you don't need to retain newRecord; the dictionary will retain it when you add it. On May 11, 2009, at 3:10 AM, Ben

Re: [iPhone] Caching images fetched from a URL?

2009-05-12 Thread Michael Vannorsdel
The UIImage is the object (inherits from NSObject), so yes you'd pass the pointer to it as the dict's object. And objectForKey: will pass back that pointer to the UIImage again. On May 12, 2009, at 10:00 PM, Eric E. Dolecki wrote: I like the cache without writing to the disk (for now

NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Does anyone know if NSArchiver's archive to file methods do atomic file writes? ___ 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

Custom windows and NSWindowBackingLocationVideoMemory

2009-03-29 Thread Michael Vannorsdel
I have a custom shaped window that refuses to use VRAM as its backing buffer. It's a relatively small borderless window with a semi transparent rounded rect shape. Are there certain things that will prevent a window from using VRAM on supported hardware? Other stock windows do this just

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Guess I should clarify. Has anyone verified it; I've had an issue with partial writes archiving built-in classes. The program used to get signals to terminate and archive some basic classes (NSArray, NSString, NSNumber) to disk. But these files would only contain some of the archive

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Yes no surprise.. But if NSArchiver is indeed atomic I would think the saved file would either be saved complete with new data or complete old data and not with partial data in situations like an untimely crash or resource loss. Unless I have the wrong expectation of atomic file writes,

Re: NSArchiver atomic?

2009-03-29 Thread Michael Vannorsdel
Alright thanks, what I was looking for. On Mar 29, 2009, at 1:41 PM, Clark Cox wrote: All bets are off if you do unsupported things inside of a signal handler. For instance it is possible that the routines used to write the file *seemed* to complete successfully when they, in fact, didn't. In

Re: Custom windows and NSWindowBackingLocationVideoMemory

2009-03-29 Thread Michael Vannorsdel
I've found the reason for it is that the window is not opaque (setOpaque:NO). So are all non-opaque windows ineligible for VRAM backing? I don't see any documentation on window attribute requirements for it, only GPU requirements. On Mar 29, 2009, at 2:23 PM, Michael Vannorsdel wrote

Re: Messages between Threads

2009-03-16 Thread Michael Vannorsdel
You'll need to use an atomic operation to access tempSum in the main thread as well and make sure tempSum is on a 4 byte boundary (required by atomic ops). But a cleaner method would be to keep a local running total in the worker thread and after your time period send a message to the main

Re: case-insensitive NSDictionary

2009-03-16 Thread Michael Vannorsdel
You could also just make your own wrapper class for NSDictionary with the usual set/remove methods and sub the key in the wrapper. On Mar 16, 2009, at 9:37 AM, Bill Bumgarner wrote: Wile certainly a creative solution, this suggestion is an 11 on the scale of 1 to 10 of bad ideas. Even if

Re: How to create an NSDecimal?

2009-03-14 Thread Michael Vannorsdel
Use the NSDecimalNumber class (subclass of NSNumber) and create it like you would any other NSNumber. Then use decimalValue to get the NSDecimal struct from it. There is no NSDecimalFromString, only the other way NSDecimalString. The only other way is to do it is manually by setting the

Re: Converting unicode strings to its values

2009-03-11 Thread Michael Vannorsdel
I could be remembering wrong but I think you can append unichars to mutable strings with [mstr appendFormat:@%C, theunichar]. Or use %S for a null terminated array of unichars. On Mar 11, 2009, at 4:00 AM, Ken Thomases wrote: If a string literal in your source code actually contains the

Re: Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Michael Vannorsdel
Use FSSetCatalogInfo and set the finderInfo (interpreted as a FolderInfo struct) and add the kHasBundle bit to the finderFlags of the FolderInfo. On Mar 6, 2009, at 8:31 PM, Graham Cox wrote: 'm implementing a plug-in scheme based on Rainer Brockerhoff's design at

Re: Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Michael Vannorsdel
This is the manual way to do it I might add. Not sure why the document type settings are not being used. Sometimes you need to rebuild launch services database. On Mar 6, 2009, at 9:02 PM, Michael Vannorsdel wrote: Use FSSetCatalogInfo and set the finderInfo (interpreted

Re: Date parsing problem (when running on iphone only)

2009-03-04 Thread Michael Vannorsdel
You're trying to print an NSDate object returned by dateFromString: with a %i format which is for integers. So the number you're seeing is the memory address of the returned date converted to an int. On Mar 4, 2009, at 4:15 AM, Jacob Rhoden wrote: Anyone experience this weird behaviour

Line height multiple and printing

2009-03-03 Thread Michael Vannorsdel
I have an NSTextFieldCell that draws attributed strings which have non- default kerning and line multiple heights (to tighten line spacing). This all draws as expected in the window but when these cells draw to the print operation context the line multiple is ignored (using default) while

Re: float from NSData

2009-03-03 Thread Michael Vannorsdel
float f; [myData getBytes:f length:sizeof(float)]; On Mar 3, 2009, at 9:51 AM, Jay Kickliter wrote: hat's what I'm doing. But don't understand how to get the 4 bytes I have in NSData into a float variable. ___ Cocoa-dev mailing list

Re: To run a block of code at every 1 second

2009-03-03 Thread Michael Vannorsdel
Make the main thread method something like this: - (void)myThreadStart { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(myFucntion) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] run];

NSAttributedDictionary crash

2009-02-28 Thread Michael Vannorsdel
I'm having a problem I'm not sure how to solve. I have a custom view which uses an NSAttributedString to draw text which works fine except when it draws to a printer context. The NSAttributedDictionary created inside the NSAttributedString's initWithString:attributes: gets over released

Re: NSAttributedDictionary crash

2009-02-28 Thread Michael Vannorsdel
Bingo, exactly what I was doing. Thanks a lot. On Feb 28, 2009, at 11:05 AM, Shawn Erickson wrote: I suggest you correct your (very likely is yours) over release issue. :) With that said I know of at least one quirk when working with attributed strings that can cause you something like

Re: NSTextView trackingArea problem

2009-02-26 Thread Michael Vannorsdel
You can check which tracking area triggered the entered/exited by examining the NSEvent's trackingArea and make sure it's yours. On Feb 26, 2009, at 7:06 PM, Xu ZiZhan wrote: thanks Douglas,but that's not the point. rather I override the - mouseMoved, and called [super mouseMoved:], the

Re: Question on threads running in my Foundation tool

2009-02-20 Thread Michael Vannorsdel
It should be more like: //create timer //add timer to runloop CFRunLoopRun(); //code blocks here (not really since the loop is running) until runloop exits due to no longer having observers or timers //do thread cleanup and exit When you start a new thread it has a

Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Michael Vannorsdel
Really it would be best to malloc the space, use it, and free it. Once you get to huge stack usage you gamble that you won't run out when there can be other higher up calls also consuming some (frameworks, libs, 3rd party code, ect). Also if you only use the large amount once in a while

Re: maximum theoretical speedup with dual quad processors

2009-01-31 Thread Michael Vannorsdel
If your original algorithm is scalar, you can get upto 4x increase by moving to SIMD (SSE2/3) if your algorithms can be paralleled. Add that to the 7 extra cores and you can get upto 32x speed up. In the real world you're very (very) unlikely to reach max throughput because of data

Re: NSURLConnection changing the URL

2009-01-20 Thread Michael Vannorsdel
I've looked into this quite some time ago and have seen NSURLConnection keep FTP and HTTP connections open even after the originating NSURLConnection had been deallocated. The same connection was reused for subsequent NSURLConnections to the same destination. I never did see these close

Re: Pasting into another app

2009-01-09 Thread Michael Vannorsdel
Checkout CGEventCreateKeyboardEvent and CGEventPost to synthesize keyboard events. You have to make and post an event for the key down and then the key up. So: command key down, V key down, V key up, command key up. There's also CGPostKeyboardEvent which is easier to use but not

Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Michael Vannorsdel
Have a look at vImagePermuteChannels_ARGB in the Accelerate framework. Should be the fastest and easiest option for reordering color components in pixel streams. On Jan 7, 2009, at 4:27 PM, Eric Gorr wrote: Well, I wrote the code to change the pixel format from BGRA to ARGB. Running

Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Michael Vannorsdel
vImage_Buffer struct has a field for row bytes as well as image dimensions. On Jan 8, 2009, at 6:54 AM, Eric Gorr wrote: Looks nearly perfect ... unfortunately, it does not look like it will take the rowBytes of the GWorldPtr data into account. But, it may still be faster to create a

Re: CIRotatingCubeTransition

2008-08-26 Thread Michael Vannorsdel
Just start at inputTime 1.0 and increment down to 0.0. This will rotate opposite from 0.0 to 1.0. On Aug 25, 2008, at 11:42 PM, Seth Willits wrote: CIRotatingCubeTransition is semi-public which confuses me. IB3 exposes it, but it otherwise seems to be private. I'd like to change the

Re: CIRotatingCubeTransition

2008-08-26 Thread Michael Vannorsdel
Ah I see what you're doing. Off the top of my head you might be able to do this by rotating the two images 90 degrees and adding an affine transform filter to rotate back 90 (so images are upright again). In essence rotating the animation 90 degrees so it rotates on the horizontal axis.

Re: NSMutableDictionary autorelease chrashes application

2008-07-18 Thread Michael Vannorsdel
In my office we usually call objects returned directly without an autorelease as short returned and an retain-autoreleased object as pooled. Though these sound more slang than something that could be official. On Jul 18, 2008, at 3:10 PM, Andy Lee wrote: Unfortunately, there's no such

Re: Trigonometric Problem, Particularly tan() Function

2008-07-13 Thread Michael Vannorsdel
I don't think it's the cause but you should probably use tanf to avoid value casting to and from a double. On Jul 13, 2008, at 7:30 AM, Patrick Walker wrote: I can't post the whole thing because it's sort of large and integrated but here is what I have originally done. float radians;

Re: Where can I get some examples of if() conditionals being used with string variables in Objective-C

2008-06-25 Thread Michael Vannorsdel
You can do: if([theName isEqualToString:@John Lenon]) //do stuff NSString has some comparison methods in the class listing. The above example will ask two different NSString objects if they have the same string values. On Jun 25, 2008, at 8:24 AM, Papa-Raboon wrote: Hi All,

Re: Convert CGImageRef from BGR to RGB

2008-06-16 Thread Michael Vannorsdel
If you get your image data into a bitmap form you can use vImage's (Accelerate Framework) permute functions to quickly rearrange the channel ordering. There might be another way using color spaces, but none that I know off hand. On Jun 16, 2008, at 5:09 PM, Rodrigo Gutierrez wrote: I'm

Re: looking for a crc code

2008-06-14 Thread Michael Vannorsdel
I thought I saw a CRC32 implementation in zlib at one time. On Jun 14, 2008, at 9:25 AM, Jens Alfke wrote: On 14 Jun '08, at 4:59 AM, Ilan Volow wrote: No mention at all I can find (in the 20 seconds I scanned the first two result pages) of any cocoa CRC implementations. If a newbie were

Re: NSTextField setStringValue method - deallocates?

2008-06-14 Thread Michael Vannorsdel
In short yes. The long answer is the textfield will release the string when it's done with it and if no one else retained the string it will be deallocated. On Jun 14, 2008, at 9:35 PM, Christopher J Kemsley wrote: I'm new to Obj-C, and I'm trying to make sure I start off writing good

Re: using NSFileManager to read data

2008-06-14 Thread Michael Vannorsdel
NSFileHandle itself. Use seekToFileOffset: and readDataOfLength: to get the bytes you want. Or you can drop down to the BSD layer and use open/close, lseek, and read. On Jun 14, 2008, at 8:05 PM, Angelo Chen wrote: Hi, NSFileManager's contentsAtPath can read the entire file, is there a

Re: App hangs when displaying any sheet in 10.5 [SOLVED]

2008-06-10 Thread Michael Vannorsdel
Ah ok. I was bit by something similar a few years ago. I had forgotten to put the prototype in my class interface and believed the compiler was using a prototype from an unrelated class which had different arg and return types. But the twist was the missing prototype caused the default

Re: from CFDataRef to NSString

2008-06-10 Thread Michael Vannorsdel
Something like: messageString = [[NSString alloc] initWithData:(NSData*)data encoding:NSASCIIStringEncoding]; the encoding type will depend on what encoding you expect the data to be in. On Jun 10, 2008, at 4:08 AM, Angelo Chen wrote: What is the correct way to cast from CFDataRef to

Re: launching standard apps with NSTask

2008-06-10 Thread Michael Vannorsdel
[[NSWorkspace sharedWorkspace] launchApplication:@Safari]; On Jun 10, 2008, at 4:55 PM, Memo Akten wrote: Hi all, i'm writing an app that launches some default apps like safari, itunes, iphoto etc using NSTask. I was wondering if there is a way of writing the launch url not fully

Re: Cocoa n00b frustrations

2008-06-07 Thread Michael Vannorsdel
textShouldBeginEditing: and textDidBeginEditing: are generally methods you'd override in a subclass. By default they call the control:textShouldBeginEditing: and controlTextDidBeginEditing: of the delegate (if there is one). The latter are the methods your delegate needs to implement.

Re: App hangs when displaying any sheet in 10.5 [SOLVED]

2008-06-06 Thread Michael Vannorsdel
I suspect since the method had no prototype the compiler just assumed the default id return type, but due to a bug didn't generate a warning. The problem is most likely the calling method was expecting the return value to be an integer (id; pointer) but instead is a float. Even with a

Re: NSBundle getting location of file in bundle

2008-06-05 Thread Michael Vannorsdel
Try using NSURL's fileURLWithPath:, you won't need to preappend file://. On Jun 5, 2008, at 8:37 PM, Mark Bateman wrote: I'm currently hardcoding the file location just for debugging my app. It works great. I'm now trying to use NSBundle to insert the resource location string for a

Re: Newbie Question on a method signature

2008-06-04 Thread Michael Vannorsdel
If the method is defined above the place you use it, you can avoid compiler warnings. But the most common and more correct thing to do is declare the method in the header with the rest of your class so anyone that imports that header will know the specifics of that method (and the

Re: how to run my app in privileged mode

2008-06-03 Thread Michael Vannorsdel
You can't really upgrade an already running process's privilege level. What I'd suggest is make a small launcher program that the user opens. This would ask for the admin password and then launch your main application using AuthorizationExecuteWithPrivileges and friends. On Jun 3,

Re: Main window disappears. Sometimes.

2008-06-02 Thread Michael Vannorsdel
This will happen if the window is deallocated. It's probably getting cleaned up by garbage collection. On Jun 2, 2008, at 2:36 AM, Francis Perea wrote: i Wayne, first of all thanks for your quick reply. Sorry to say that the Console says nothing :-( -- [Session started at

Re: Main window disappears. Sometimes.

2008-06-02 Thread Michael Vannorsdel
Retain and release have no effect on ObjC types when using garbage collection. If your code is written relying on retain counting then you should turn off garbage collection since you're trying to manage the memory yourself (and probably designed the code as such). Garbage collection has

Re: many-to-many relationships and retain cycles

2008-06-02 Thread Michael Vannorsdel
I've never tried it personally, but you might make a CFMutableArray with NULL callbacks and then cast it to an NSMutableArray since they're bridged types. On Jun 2, 2008, at 10:36 AM, Todd Ransom wrote: Unfortunately I need to target Tiger also. Thanks for the info, though, this will be

Re: Main window disappears. Sometimes.

2008-06-02 Thread Michael Vannorsdel
The retained option for windows in IB applies to the window's back buffer settings. Retained means it only buffers sections offscreen and onscreen drawing is done directly instead of to a back buffer first. Not related to the window's retain count. On Jun 2, 2008, at 5:24 AM, Francis

Re: Weird NSInvocationOperation init behavior

2008-05-31 Thread Michael Vannorsdel
If you method is something like: - (void)func1 then you should use @selector(func1) without the colon. On May 31, 2008, at 2:06 AM, Markus Spoettl wrote: NSInvocationOperation *theOp = [[NSInvocationOperation alloc] initWithTarget:self

Re: runloops and NSURLConnection

2008-05-31 Thread Michael Vannorsdel
I think you want to schedule the connection for the NSModalPanelRunLoopMode runloop mode. This is the mode that is used for modal windows. On May 31, 2008, at 7:28 AM, Torsten Curdt wrote: A bit puzzled ...seems like I need some advise here. From a NSWindowController I create a modal

Re: runloops and NSURLConnection

2008-05-31 Thread Michael Vannorsdel
I saw you using that in your included code so I thought you were ok with it. For Tiger I can only suggest using secondary thread processing as the cleanest approach. Or you can reconsider using a modal window. On May 31, 2008, at 9:07 AM, Torsten Curdt wrote: You mean with

Re: Converting string to double: NSString or NSScanner

2008-05-31 Thread Michael Vannorsdel
Basically NSString's floatValue and doubleValue methods only work when the numbers use the US style dot separator (as opposed to other locale separators such as a comma). If your NSString might contain non-US separators (or other formatting differences) you'll have to use NSScanner to do

Re: CGContextSetRGBFillColor() off by one?

2008-05-30 Thread Michael Vannorsdel
This is from the CGColorSpaceCreateDeviceRGB docs: In Mac OS X v10.4 and later, this color space is no longer device- dependent and is replaced by the generic counterpart— kCGColorSpaceGenericRGB—described in “Color Space Names”. If you use this function in Mac OS X v10.4 and later, colors

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Michael Vannorsdel
You can't init an object more than once (well not an intended use). You do: SimParamnames = [NSMutableDictionary dictionary]; and later: [SimParamnames initWithContentsOfFile: aFile]; which are both initializing the object. The second init is either being ignored or perhaps corrupting

Re: Another newbie question

2008-05-29 Thread Michael Vannorsdel
What I'd suggest is to assign each selection with a tag number in IB (or programatically if need be). Then in your code you can get the tag: int colorID = [[colorButton selectedItem] tag]; Assign each its corresponding ID as the tag like 4 for black, 1 for red, ect. On May 29, 2008, at

Re: NSImage display quality and zooming

2008-05-27 Thread Michael Vannorsdel
I think this is right as well. The image can be cached in a form best suited for the first draw of it. Any further draws will very likely use the cached version and the original resolution is gone. If you set it not to cache, the image will be drawn from the original data each time.

Re: Question concerning mouseDragged events.

2008-05-27 Thread Michael Vannorsdel
Generally you'd use the mouseDown to get when and where the drag started (may have). Then use the mouseDragged to track where the mouse is dragging to. Then on mouseUp you know it's done. Tracking area is only valid if a tracking rect you installed generated the event. On May 27, 2008,

Re: How to Delay, Wait, Pause...

2008-05-25 Thread Michael Vannorsdel
This is an important consideration. If you're relying on a specific event to finish within a finite amount of time, you're going to have a race condition where the event could finish later than expected and you may end up in an invalid state. Perhaps if you told us what it is you're

Re: How to capture data from NSImageView and display in NSView

2008-05-23 Thread Michael Vannorsdel
On May 23, 2008, at 3:32 PM, Stephen Herron wrote: The goal: A window with two views. The view on the left, NSImageView, displays the NSImage from - (void)openPanelDidEnd:. The right view, NSView, displays the result of a CIFilter using the pixel data displayed in the right-hand view.

Re: Trying to understand -- please help...

2008-05-21 Thread Michael Vannorsdel
You troubles are all in this method and how you handle cityArray. First you don't need to alloc and init a new array for cityArray as [NSArray arrayWithObjects: c0, ...c9, nil] gives you a new one already with the objects you specified. Another thing you should watch for is there's an

Re: Trying to understand -- please help...

2008-05-21 Thread Michael Vannorsdel
Would be like a cookbook including instructions on how to operate an oven and use a knife to cut vegetables in every single recipe. I think most would find that pretty redundant and diluting, especially when the preface covers these topics in detail. On May 21, 2008, at 8:37 PM, Jens

Re: NSApp with wrong _running count

2008-05-20 Thread Michael Vannorsdel
When you mention running count, are you keeping an int or something to keep track of thread progress? If so remember to use atomic operations to update the count from multiple threads to prevent data corruption. As for NSAlert, a general rule is not to interact with the UI from any

Re: Delegates

2008-05-19 Thread Michael Vannorsdel
Even delegation is not a commonly known term in my experience (it's used for several differing ideas in the US). I try my best to give terms and examples with the best chance of grasping, especially with beginner concepts. Even the truest term of delegate doesn't perfectly fit Cocoa

Re: Delegates

2008-05-19 Thread Michael Vannorsdel
There's nothing that guarantees a Cocoa delegate will act for another object and that the represented object won't act how it wants as well. Sometimes a delegate method is just a notification something happened/happening without the delegate having any say on the matter or affect on the

Re: Delegates

2008-05-19 Thread Michael Vannorsdel
Ditto, I'll surrender the last word to you. Though I'm interested to know if the OP is having any success or not. This thread got a little sidetracked. On May 19, 2008, at 2:23 PM, I. Savant wrote: I think that's the last I'll comment on the dictionary definition matter; it's a silly

Re: NSStream, NSInputStream, NSOutputStream

2008-05-19 Thread Michael Vannorsdel
How are you creating the stream? On May 19, 2008, at 7:07 PM, John MacMullin wrote: Continuing on my efforts re: my modified Echo Server, the following code is crashing. - (void)startStreamWrite:(NSOutputStream *)ostream { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Michael Vannorsdel
Well what can you do. Not sure why but lately many newcomers have been showing up and complaining about Cocoa's difficulty. I'm not sure if they've done GUI work before, but I remember my days with PowerPlant and spending a massive amount of time just creating the GUI and the code to

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Michael Vannorsdel
I'm also wondering if many of the people finding Cocoa difficult are also lacking OO programming experience. The docs teach Cocoa really well but if you're unfamiliar with OO design and concepts the Cocoa docs are going to be very daunting. On May 18, 2008, at 3:28 PM, Jason Stephenson

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Michael Vannorsdel
On May 18, 2008, at 7:39 PM, Julius Guzy wrote: So I wouldn't have much to say about it except that it does have a tendency to make things seem more exciting than they actually are. For instance I can refer here to the idea of dynamic typing which still requires us to have the header files

Re: XML schema support

2008-05-18 Thread Michael Vannorsdel
Checkout NSXML* and friends (NSXMLNode, NSXMLElement). Also there's Introduction to Tree-Based XML Programming Guide for Cocoa and Introduction to Event-Driven XML Programming Guide for Cocoa guides in the docs. On May 18, 2008, at 8:07 PM, David wrote: Is there a Cocoa package that

Re: Cocoa et al as HCI usability problem

2008-05-18 Thread Michael Vannorsdel
Nothing wrong with saying you should read such and such. But RTFM is the condescending way of saying it (just look what it stands for). Would be like asking someone where the restroom is and getting look at the building directory, you blind clueless moron. My point was about posts that

Re: Dynamic message typing problem

2008-05-17 Thread Michael Vannorsdel
The difficulty is methods in ObjC are dispatched messages rather than hardcoded functions so going from call to method execution has some hidden intermediate steps. And there can be more than one method with the same name from different classes/protocols. This is one of the pillars to

Re: PlotIconRefInContext doesn't work

2008-05-17 Thread Michael Vannorsdel
I'm thinking the window might be redrawing itself right after your own drawing and erasing it. You could try disabling the window's auto displaying and flush the window buffer after your draw to determine if this is the case. I don't know where you're doing the drawing to know if it's

Re: [SOLVED] PlotIconRefInContext doesn't work

2008-05-17 Thread Michael Vannorsdel
Well you didn't present the secret handshake that would open immediate access to such information. Actually, it was probably not brought up earlier as it's kind of an unsaid list etiquette rule exercised by some not to critique someone's choice of APIs unless specifically asked for. Most

Re: NSLevelIndicator

2008-05-17 Thread Michael Vannorsdel
Set its cell as not editable in IB or programatically with [[indicator cell] setEditable:NO]. On May 17, 2008, at 4:41 PM, Philip Bridson wrote: I have an NSLevelIndicator in a utility window that does the standard stuff, but I have just noticed that if I click on the indicator I can

  1   2   >