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 lik

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

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 vi

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 t

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 Cach

Re: Entitlements and specific files/dirs

2011-08-18 Thread Michael Vannorsdel
from 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

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) Please

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 workin

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 as

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 usually

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 exits

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 getti

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 dr

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 drawi

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: 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 co

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 wil

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 11

Re: Coming up with ideas

2009-06-12 Thread Michael Vannorsdel
Mostly listening to people going, hey I wish this was easier or if this program I always use had xyz and did abc better. Also ideas from yourself when you find something you need to make your life easier. I'm sure many developers have made their own various mini-tools to do random things f

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

Quick DO endian question

2009-06-24 Thread Michael Vannorsdel
Do messages to remote proxies (a vended DO object) need to have their arguments adjusted for endianness or does DO handle that on its own? ie: [rootProxy myNumberIs:someInt32]; would I need to standardize alignment in the above or leave it alone. __

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 P

Re: NSProgressIndicator not animating when part of NSAnimation

2009-08-16 Thread Michael Vannorsdel
I had this problem once when I had accidentally called makeKeyAndOrderFront: on the window from a secondary thread. Animated system controls and tracking rects would work. On Aug 15, 2009, at 7:45 PM, Thomas Bauer wrote: Thanks for your response. I am not quite sure if I understand you co

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, Uli

Re: any help with [NSThread initWithTarget:selector:object]???

2008-05-15 Thread Michael Vannorsdel
You might try using pthreads, they're easy to use but not NSThread easy. They have several more options and make the base NSThread is built upon. There's a join option with pthreads where one can wait for another to finish which might be what you're looking for. Look at pthread_join.

Re: glass effect - CG call to do this?

2008-05-15 Thread Michael Vannorsdel
You're probably thinking CoreImage. Checkout the CIFilter docs, there's a few builtin glass filters available. On May 15, 2008, at 3:01 AM, John Clayton wrote: A few months ago, while browsing code headers at random (lets just call this a little passtime of mine), I noticed a method call t

Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread Michael Vannorsdel
This has to do with non-printable characters in pathnames. Each application can different how they visually represent these characters. The terminal just replaces them with '?', the Finder might use a space. When you have a path from NSFileManager, leave it as is in the NSString if you'

Re: Dynamic message typing problem

2008-05-15 Thread Michael Vannorsdel
This block is probably causing some corruption. You're assigning 123 to a uchar pointer and not the uchar, then passing the address of a pointer to a method that tries to printout the pointer as an int rather than the intended uchar value. On May 14, 2008, at 7:19 PM, Julius Guzy wrote:

Re: iPhone SDK List?

2008-05-15 Thread Michael Vannorsdel
Currently NDA software from Apple is intended for you to quietly play with. No public or private forum exists for discussion on this SDK. On May 15, 2008, at 5:39 AM, Rich Curtis wrote: Been lurking on the list for a couple of days. Is there another list for iPhone SDK programmers? Doesn

Re: Password entry dialog

2008-05-15 Thread Michael Vannorsdel
Look at the Security framework and functions like AuthorizationExecuteWithPrivileges. On May 14, 2008, at 6:12 PM, Ron Aldrich wrote: Hello Folks, I'm trying to figure out where the API for the system's password entry dialog is defined. In particular, I'm interested in using the dialog

Re: Guidance for Cocoa's steep learning curve

2008-05-16 Thread Michael Vannorsdel
Tutorial examples don't really belong in API docs. Their ultimate goal is to state the purpose and usage as directly as possible so the developer can get what they need and move on. Continuously sifting through tutorial information and examples would be quite tedious and redundant for the

Re: Dynamic message typing problem

2008-05-16 Thread Michael Vannorsdel
I've tried the code here and it works as expected. Could you give more detail on your build setup? Like what arch you're building for, how you're executing the program, if you're executing code other than this, if this is actually running as a plugin or loaded bundle. On May 16, 2008, at

Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Michael Vannorsdel
How are you invoking rsync? With NSTask or system()? On May 16, 2008, at 8:28 AM, JanakiRam wrote: When i give this filename as part of rsync source file ( using -- files-from ) , rsync is treating this filename as 2 different file names , because rsync expects each filen name separated by

Re: Dynamic message typing problem

2008-05-16 Thread Michael Vannorsdel
Just to add, it's generally important to include compiler warnings with your problem description as they provide valuable clues. The compiler issues warnings when something doesn't look right, make sense, or lacking information. Usually the compiler will make guesses and assumptions as to

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 Obj

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 safe

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 w

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 manu

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 back

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 wr

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 th

Re: Delegates

2008-05-19 Thread Michael Vannorsdel
Delegates act like observers. They register with another object saying "hey, if you do something important I want to know about it and have a chance to act on it too". Each class that allows delegates have a list of delegate methods. These are the methods the class is willing to notify t

Re: Delegates

2008-05-19 Thread Michael Vannorsdel
Indeed. I was just trying to keep it in simple terms as not to overwhelm the OP with heavy details. I just wanted the concept to make some sense in better known terms at the risk of oversimplifying. On May 19, 2008, at 11:01 AM, I. Savant wrote: Well, no, not really. This is significantl

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 deleg

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

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 arg

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: 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 thread

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 auto

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 Alfk

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

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

2008-05-25 Thread Michael Vannorsdel
There's usleep, but sleeping a thread just for a very small amount of time in a loop is gonna force a context switch every iteration and really hurt performance. It might be better to poll or spin. On May 25, 2008, at 12:45 AM, Steve Steinitz wrote: This is hard to google for beca

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 specif

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

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: NSImage display quality and zooming

2008-05-28 Thread Michael Vannorsdel
Could you give more detail on what you're ultimately trying to and more on the problems you're seeing in the results? On May 27, 2008, at 8:13 PM, also wrote: I had noticed this flag, but it did not solve the problem. I think this must only effect scaling when the receiving view is resized

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 th

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 1

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 ar

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 dia

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 scheduleInRun

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 a

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 2008

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 u

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 Per

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, 2008

Re: Newbie Question on a method signature

2008-06-04 Thread Michael Vannorsdel
You have to make sure your header has - (UIColor *) returnUIColorForFont:(NSString *) theString in it so when you use the method in other source files the compiler will know what the arguments and return types to returnUIColorForFont: are. Without this the compiler has to make assumptions

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 compiler

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 w

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 cas

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-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 i

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 NS

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 hardcod

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 co

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: 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 p

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: 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: 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 suc

Re: CIRotatingCubeTransition

2008-08-25 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 dire

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.

Feedback-Directed Optimization problem

2008-04-04 Thread Michael Vannorsdel
I'm trying to generate a profile using the Feedback-Directed Optimization (-fprofile-generate) but when it gets to the linking stage it aborts with missing symbols _close$UNIX2003, _open$UNIX2003, _fcntl$UNIX2003. Any ideas what's causing this? I've used this option in the past many times

Re: NSTask failing

2008-04-04 Thread Michael Vannorsdel
The error 2 means tar is not happy with one of both provided paths. Try printing out both paths and make sure they're proper. Paths passed to NSTask should not have escapes such as "/Some\ Folder/ file.tar", it should be "/Some Folder/files.tar". On Apr 4, 2008, at 3:00 PM, Randall Meadow

Re: Newbie question

2008-04-07 Thread Michael Vannorsdel
Change the function declarations/definitions to - (NSString*)ChooseString:(int) IntVal (the * goes inside the parenthesis) On Apr 7, 2008, at 10:45 AM, john darnell wrote: Hello all: For those of you who do not like answering elementary questions, you might want to give this message a pas

Re: NSString format parameter order

2008-04-08 Thread Michael Vannorsdel
There's quite a few printf arguments the Mac OS doesn't support right now. An alternative is to shuffle pointers around: NSString * string1 = @"you", * string2 = @"hello"; ... if([language isEqualToString:@"Backwards Latin"]) { NSString * temp = string1; string1 = string2;

Re: NSString format parameter order

2008-04-08 Thread Michael Vannorsdel
You could load the strings into an NSArray and then use the proper indexes to print out the string you want. On Apr 8, 2008, at 3:48 AM, Jere Gmail wrote: Well, it's not a language thing at this moment but it started this way. Right now I have a txt file with one string with the places whe

Re: NSConnection registerName

2008-04-08 Thread Michael Vannorsdel
Mac OS X has layered bootstrap nameservers. The bottom layer is the root layer and all others like the console user's layer go on top. For security, layers can see connections at their level or below, but not above. This in short means the root layer cannot see any other connections not

Re: Saving NSFonts and changedFont: trouble

2008-04-08 Thread Michael Vannorsdel
Are you sending convertFont: to the sender of changedFont:? I think this is required or controls start to get confused. May or may not solve your problem though. On Apr 8, 2008, at 8:41 AM, Thomas Backman wrote: Hey everybody. I'm working on a small app - to make the post shorter, lets j

Re: Reformatting percent string to two decimal places

2008-04-08 Thread Michael Vannorsdel
For string formats there's "%.2f" which means show 2 places after the decimal, it's rounded as well. Also, you can use "%%" to print a literal % symbol. On Apr 8, 2008, at 9:07 AM, Lorenzo Thurman wrote: I have the string representation of a percentage value, that goes to 6 places beyond

Re: Saving NSFonts and changedFont: trouble

2008-04-08 Thread Michael Vannorsdel
The font panel sends it's messages to the shared font manager. You can make your own font panel subclass and tell the font manager to use it with setFontPanelFactory:. It's possible the textView is absorbing the changedFont: message, you might need to implement textView:shouldChangeTextIn

Re: missing (some) window names in Window menu

2008-04-08 Thread Michael Vannorsdel
You can use NSApplication's addWindowsItem:title:filename: to manually add windows to the list. Also make sure your windows don't have isExcludedFromWindowsMenu set to YES. On Apr 8, 2008, at 3:21 PM, Hal Mueller wrote: My NSPersistentDocument app has two kinds of windows that can be sho

Re: NSString stringWithFormat woes

2008-04-08 Thread Michael Vannorsdel
Try casting them to ints before formatting: returnString = [NSString stringWithFormat:@"%c-%i-%i-%f", asciiString, (int)firstDouble, (int)secondDouble, thirdDouble]; On Apr 8, 2008, at 1:33 PM, Stuart Green wrote: Hi, I have a string declaration of: returnString = [NSString stringWithFo

Re: NSUInteger question

2008-04-08 Thread Michael Vannorsdel
That's pretty much it. Since 64bit on mac are LP64, int is always 32bits. Using NSUInteger gives you an integer that behaves like ILP64, 32bit on 32bit arch, 64bit on 64bit arch, if you're looking for that behavior. On Apr 8, 2008, at 6:30 PM, Timothy Reaves wrote: What advantage does N

  1   2   3   >