Re: Download images and modify bundle?

2010-07-04 Thread Michael Watson
On 02 Jul, 2010, at 04:47, Andreas Mayer wrote: > > Am 02.07.2010 um 10:01 Uhr schrieb sebi: > >> When I download an image and want to keep it for further reference, I assume >> I have to store it in the documents directory and not in the app bundle, >> because otherwise I would invalidate the

Re: Custom control and cells

2010-07-09 Thread Michael Watson
In what way do you believe a custom NSCell-based replication of NSCollectionView will perform better than NSCollectionView itself? What performance issue have you seen? Are you sure the problem lies with NSCollectionView and not your own code surrounding it? (I.e., have you Sharked your applica

Re: detect "left mouse button clicked in menu bar"

2009-08-13 Thread Michael Watson
On Aug 13, 2009, at 16:56, "David M. Cotter" wrote: i know i can detect when a particular menu is about to be shown, but what I want is to run a quick process before any menus from the menu bar are shown Launching a process is by no means a "quick" operation. It is imperative that menus

Re: [ANN] BuildCleaner

2009-08-14 Thread Michael Watson
On Aug 14, 2009, at 17:58, Dave DeLong wrote: Hi everyone, I just wanted to let you know of a little utility app I've just posted, called BuildCleaner. As I explore example projects, open source frameworks, and test applications, I find that I usually have a lot of build folders clutter

Re: Create VNC Client iPhone

2009-08-24 Thread Michael Watson
On Aug 24, 2009, at 7:49, Joe Turner wrote: Hello, I've wanted to switch from bonjour to something more universal for a while now. And, I'm wondering about how to do VNC. I've seen that many apps on the iPhone use Apple's Screen-Sharing functionality as a VNC Server, and I would like to

Re: Determine encoding of file

2010-07-30 Thread Michael Watson
There's a good session from WWDC 2009, 112 - Text Processing in Cocoa, that has a segment about guessing encodings without having to read the entire file (in most cases). It's worth watching, even if it doesn't solve your problem directly. -- michael On 30 Jul, 2010, at 15:09, Dave DeLong wro

Re: Determine encoding of file

2010-07-30 Thread Michael Watson
And, of course, as Nick Z and that session point out, you may need to allow the user to choose the encoding somehow in your application, given you can't be 100% accurate when the encoding is unknown. -- michael On 30 Jul, 2010, at 17:35, Michael Watson wrote: > There's a good

Re: Make checkbox in table view uneditable

2010-09-15 Thread Michael Watson
On 15 Sep, 2010, at 02:11, jonat...@mugginsoft.com wrote: > On 15 Sep 2010, at 06:09, Shane Stanley wrote: > >> On 15/9/10 12:29 PM, "Keary Suska" wrote: >> >>> Checkboxes aren't edit controls, they are buttons, and to my knowledge don't >>> even have an "editable" property (even though the tab

Re: What's the point of @properties?

2010-09-24 Thread Michael Watson
On 21 Sep, 2010, at 18:48, Matt Neuburg wrote: > On Mon, 20 Sep 2010 03:56:20 -0700, Chris Hanson said: >> Don't think of dot syntax as syntactic sugar for sending messages. Think of >> dot > syntax as the way to access the state exposed by an object, and bracket syntax > as the way to have an o

Re: Instantly delete a directory without recursion?

2010-10-04 Thread Michael Watson
If you unlinked just the top-level directory node, you would leave all of its descendents with a link count > 0, and the corresponding blocks claimed by the descendents would never be freed. (Ever. No one would have a reference to them, and they'd never be found in subsequent traversals.) To reg

Re: Instantly delete a directory without recursion?

2010-10-05 Thread Michael Watson
You should /always/ perform I/O on a secondary thread whenever possible. Every I/O you perform on the UI thread is an opportunity for hangs or unresponsiveness. Grand Central Dispatch is your friend here. -- michael On 04 Oct, 2010, at 05:54, Guillem Palou wrote: > I don't think so, > > If t

Re: aborting init

2010-11-30 Thread Michael Watson
On 29 Nov, 2010, at 19:27, Graham Cox wrote: > > On 30/11/2010, at 1:59 PM, Rainer Standke wrote: > >> The intended behavior is not to get anything if the conditions are not met. >> >> >> Is this kosher? Do I have to do any kind of clean-up after doing something >> like that? > > > Yes, it'

Re: FSEvents eventid (or perhaps event)'s life

2012-07-31 Thread Michael Watson
On 30 Jul, 2012, at 17:53, Ron Hunsinger wrote: > > On Jul 30, 2012, at 4:47 AM, Robert Martin wrote: > >> Just keep track of the device UUID for each path and last event ID that >> you're tracking. EventID's are tied to each device, so you have to know that >> the device has not changed behi

Re: Mount Point

2008-05-28 Thread Michael Watson
Now you're depedent on shell output and running three separate processes (plus invoking pipes and regexes). If you look at the source for the mount utility, you'll find that it gets a list of mounted volumes with the getmntinfo() function and then iterates over the statfs structs to print i

Re: Leopard (10.5+): Any Upper-Level (Cocoa) access to Mail?

2008-06-02 Thread Michael Watson
Are you trying to talk to Mail.app, or are you looking for a generic e- mail framework? -- m-s On 02 Jun, 2008, at 11:34, [EMAIL PROTECTED] wrote: I'm searching for a Cocoa/ObjC routine to access/check Mail; specifically #read & #unread mail messages. Is there such a routine or need I go d

Re: Newbie Question on a method signature

2008-06-04 Thread Michael Watson
It's not the method order, it's declaration vs definition. The compiler scans the file top to bottom, so you must declare a method's prototype before you actually use it anywhere, otherwise the compiler will give you a warning because it hasn't seen the protoype yet. -- m-s On 04 Jun, 200

Re: NSSlider responding to superview's drawRect

2008-06-10 Thread Michael Watson
This is normally what I have to do as well, but is there a more optimized way to achieve the goal of drawing only the rect that needs redrawing? -- m-s On 10 Jun, 2008, at 12:05, Ken Ferry wrote: You're probably filling your gradient into the rect passed in drawRect. That rectangle jus

Re: argument checks

2008-06-12 Thread Michael Watson
You can use #import in straight C applications from within Xcode, if you like. There's also nothing stopping you from using the #include directive in Objective-C. It's just more work than #import, which handles include cycles for you. -- m-s On 12 Jun, 2008, at 21:37, William Squires wro

Re: getting free space available in a drive

2008-06-19 Thread Michael Watson
There are two NSFileManager methods for this: 10.4.11 and earlier: -[NSFileManager fileSystemAttributesAtPath:] 10.5 and later: -[NSFileManager attributesOfFileSystemForPath:error:] Each returns an NSDictionary containing a NSFileSystemFreeSize key. The value for this key is an NSNumber that

Re: Get the UUID of the current user

2008-06-25 Thread Michael Watson
Jean-Daniel already provided an answer, but it's worth reminding people that the source code to many of the utilities that come with Mac OS X is available for dissection, including the Directory Services utilities: http://www.opensource.apple.com/darwinsource/10.5/DSTools-109/dsmbrutil/dsmb

Re: initWithCoder in Nib object loading

2008-06-27 Thread Michael Watson
All view objects are sent -initWithCoder:, but the "custom view" object does something extra. After the custom view object is unarchived, it creates your view subclass, sends the

Re: Does this caution need fixed? (newb)

2008-07-03 Thread Michael Watson
Well, look at what you're doing: 1. First, you declare a pointer to an NSMutableString object called "theSettings". 2. You then allocate and initialize an empty NSMutableString object. A pointer to some address in memory is returned, and you assign theSettings to this value. Now theSettin

Re: Trashing files and undo

2008-07-11 Thread Michael Watson
Note that if a file is on a secondary volume, and you move the file to the Trash, it doesn't get moved to ~/.Trash; you'll find it in the .Trashes directory on the root of the volume on which it resides. -- m-s On 11 Jul, 2008, at 10:42, Abernathy, Joshua wrote: ~/.Trash? -Original M

Re: Relaunch Finder (without AppleScript)

2008-07-16 Thread Michael Watson
Someone correct me if I'm wrong, but surely this is a bad way to invoke the termination/relaunch a GUI application. -- m-s On 16 Jul, 2008, at 10:01, Dave DeLong wrote: You could use an NSTask to run "killall Finder" On Wed, Jul 16, 2008 at 7:57 AM, Piero Avola <[EMAIL PROTECTED]> wrote

Re: NSTask

2008-07-22 Thread Michael Watson
Why would you expect to get a pointer to an object that executes shell tasks? Threads aren't shell calls. What are you trying to do with this other thread? -- m-s On 22 Jul, 2008, at 17:31, Torsten Curdt wrote: When I do [NSThread detachNewThreadSelector:@selector(something)

Re: Accessing memory of another application?

2008-08-12 Thread Michael Watson
So what game are you trying to cheat at? -- m-s On 12 Aug, 2008, at 14:09, Josh wrote: I'm not creating both applications - The application I'm trying to access was written by someone else and has no developer documentation (it's a game) My application should read the memory of the game

Re: @try @catch

2008-08-14 Thread Michael Watson
Don't forget that many of Apple's own methods return nil on failure and don't implement an NSError reference mechanism. NSFileManager's - contentsAtPath: method returns either an NSData object on success or nil on failure. -- m-s On 14 Aug, 2008, at 08:45, Uli Kusterer wrote: On 14.08.20

Re: @try @catch

2008-08-14 Thread Michael Watson
Thanks for the heads-up. -- m-s On 14 Aug, 2008, at 14:55, Clark Cox wrote: On Thu, Aug 14, 2008 at 11:38 AM, Michael Watson [EMAIL PROTECTED]> wrote: Don't forget that many of Apple's own methods return nil on failure and don't implement an NSError reference mechanism. NS

Re: Quitting all active applications

2008-08-28 Thread Michael Watson
Even if this is the case, if you send a kill signal to a GUI Cocoa application, that application's app delegate will not receive - applicationWillTerminate:. If the application has any important cleanup/shut down code to run, it won't happen. I'd go with "don't kill GUI apps unless they're m

Re: accessing netinfo db from cocoa?

2008-08-31 Thread Michael Watson
If you want to do it fast, without shell output parsing, and in a way that will work on 10.4 *and* 10.5, use the Directory Services C API. The downside is that it's more complex than many of the Cocoa APIs you're likely used to. Docs:

Re: App names

2008-08-31 Thread Michael Watson
AppleScript isn't referring to a file path there, it's referring to a process name. The actual file name of "Finder" is "Finder.app", because it's a folder with an extension of ".app". If you have to reference its path or file name, you have to include ".app" because it's part of those. A

Re: how to get a particular icon from .icns file

2008-03-09 Thread Michael Watson
if you look at the count of representations of that NSImage, you will find several sizes. (Assuming, of course, that the original .icns file contained multiple representations of different sizes.) -- m-s On 09 Mar, 2008, at 09:28, Nick Rogers wrote: Hi, I have a icon file (.icns) with 10

Re: get currently logging in users

2008-03-13 Thread Michael Watson
Why not peruse the sources of the who utility and see how it finds the data you want? http://www.opensource.apple.com/darwinsource/10.5/shell_cmds-116/who/ -- m-s On 13 Mar, 2008, at 22:27, lazuardi wrote: On 2008/03/14, at 10:51, Kyle Sluder wrote: who (and last) use wtmp and utmp. ma

Re: get currently logging in users

2008-03-13 Thread Michael Watson
First, seconding what others are saying. This is not the right list for your problem if you go into the low-level APIs. The main difference between tiger and leopard's who source is the use of utmp and utmpx. utmp has been deprecated on leopard. leopard uses utmpx to retrieve currently logg

Re: usleep()

2008-03-15 Thread Michael Watson
Yes. Code in a method executes on a thread in order from top to bottom (taking into account flow control from while/do/etc). The usleep() function pauses the thread until the specified duration of time passes, at which point the next line of code is executed. And remember that the thread sl

Re: Another newbie, into and cry for help...

2008-03-16 Thread Michael Watson
For what it's worth, without meaning any offense, "another newbie, cry for help" is not a very good subject for your question. Remember that subjects are useful for searching and also determine who reads what sometimes. ;-) -- m-s On 16 Mar, 2008, at 16:43, Neil Jones wrote: On 16 Mar

Re: make a window not draggable in spaces

2008-03-17 Thread Michael Watson
Why do you want to do this? I would be pretty annoyed if I couldn't drag a window from space to space if it appeared in my zoomed-out spaces. -- m-s On 17 Mar, 2008, at 06:28, Cocoa Developer wrote: Hi, How to make a window not draggable in spaces. I used to set NSBorderlessWindowMask ma

Notification when a volume is renamed?

2008-03-23 Thread Michael Watson
Does anyone know of a way to be notified when a mounted local volume is renamed? The NSWorkspace mount notification isn't triggered when a volume is renamed, but I thought I'd try it anyway, just to see before posting. No dice. Ideas? -- mikey-san __

Re: Notification when a volume is renamed?

2008-03-23 Thread Michael Watson
callback you can subscribe to (you'll have to search for it, sorry... Sunday and all) Cheers, -H. On 23/03/2008, Michael Watson <[EMAIL PROTECTED]> wrote: Does anyone know of a way to be notified when a mounted local volume is renamed? The NSWorkspace mount notification isn't trigger

Re: How do I disable this warning: "local declaration of 'varname' hides instance variable"

2008-03-23 Thread Michael Watson
If you've rewritten your code to fix the conflict, you shouldn't be getting the warning. What does "coded around the namespace conflict" mean, exactly? -- m-s On 23 Mar, 2008, at 22:56, charlie wrote: Thanks. I understand the reason behind the warning. I've coded around the namrspace co

Re: Get root privileges with NSTask

2008-03-24 Thread Michael Watson
Search the list. This comes up often. When I say "it comes up often", I mean "this gets asked so often that it actually was talked about yesterday". Chris Hanson posted this: (1) Use Authorization Services to cr

Re: Newbie question

2008-04-07 Thread Michael Watson
I'd like to add that since you were confused by the error you were given, you might want to pick up a book on C, which will explain pointers and function declarations/definitions to you. Objective-C is a thin superset of C, so the rules that apply to ANSI C apply to Obj-C as well. Get a c

Re: Override AppleScrollBarVariant on NSScroller?

2008-04-09 Thread Michael Watson
I hope it isn't possible. I don't really want applications actively ignoring my scroll bar setting and enforcing its own. I prefer them at one end, together, at bottom. If suddenly one or two of my apps are different, it's going to drive me batty as I switch around between apps, and those w

Re: Override AppleScrollBarVariant on NSScroller?

2008-04-09 Thread Michael Watson
Not sure what you're talking about. iTunes respects my scroll bar arrow preference like any other application: http://www.mikey-san.net/itunestogether.png http://www.mikey-san.net/itunesapart.png -- m-s On 10 Apr, 2008, at 02:30, Bill Monk wrote: On Apr 9, 2008, at 10:41 PM, Mi

Re: Override AppleScrollBarVariant on NSScroller?

2008-04-11 Thread Michael Watson
Bill Monk wrote: On Apr 10, 2008, at 1:43 AM, Michael Watson wrote: Not sure what you're talking about. This: http://homepage.mac.com/billmonk/clips/scrollbarsTiger.png http://homepage.mac.com/billmonk/clips/scrollbarsLeopard.png ___ Coc

Re: Override AppleScrollBarVariant on NSScroller?

2008-04-12 Thread Michael Watson
On 12 Apr, 2008, at 06:33, [EMAIL PROTECTED] wrote: Guys, you are way off-topic, and you are offending me. Of course I have good reasons for wanting to do this. Trust me, I'm not tampering with user defaults for the sheer fun of it. If you can't provide me with an answer to my question, please sp

Re: HUD-style panel controls?

2008-04-12 Thread Michael Watson
You aren't missing anything. Apple gave us an official HUD panel and UI guidelines surrounding it, and failed to provide any HUD-style controls to go with it. If the idea is to give us something standard, so everyone's not rolling slightly different HUD panels, we should have at least /some

Re: Basic Core Animation question

2008-04-12 Thread Michael Watson
I noticed: //GameBoard.h* #import #import You've added QuartzCore.framework, but Quartz.h isn't the top-level header for QuartzCore. You're importing a header in a framework you aren't linking to. Either link to Quartz.framework and import ,

Re: Basic Core Animation question

2008-04-12 Thread Michael Watson
is listed in the "Link Binary With Libraries" phase? -- m-s On 13 Apr, 2008, at 02:29, Michael Watson wrote: I noticed: //GameBoard.h* #import #import You've added QuartzCore.framework, but Quartz.h isn't the top-level hea

Re: Window moved when dock appears.

2008-04-13 Thread Michael Watson
What is your window for, exactly? Why don't you want it to respect the Dock? Most users get annoyed when windows don't respect the Dock area. -- m-s On 13 Apr, 2008, at 13:56, Mohsan Khan wrote: Hi I have a window (NSBorderlessWindowMask), this window gets pushed away when my Dock appears

Re: Subclassing NSScroller

2008-04-13 Thread Michael Watson
You should find this thread of interest: http://www.cocoabuilder.com/archive/message/cocoa/2008/1/25/197293 -- m-s On 13 Apr, 2008, at 15:18, Jonathan Dann wrote: Hi All, I'm trying to re-create the iTunes and HUD window scrollbars for my project. I've managed to get a good looking NSScro

Determining which sheet closed with panels in separate nibs

2008-04-17 Thread Michael Watson
Inside of MainMenu.nib, I have my application's main window. Also in MainMenu.nib is an NSObject subclass instance that is the main window's delegate. In another nib, I have a panel and an NSObject subclass instance that is the panel's delegate. The panel is opened attached as a sheet to

Re: Determining which sheet closed with panels in separate nibs

2008-04-17 Thread Michael Watson
I don't know why this didn't occur to me originally, but it's exactly what I need. Thanks for the help, guys. -- m-s On 17 Apr, 2008, at 17:12, Jean-Daniel Dupas wrote: Le 17 avr. 08 à 22:44, Sherm Pendley a écrit : On Thu, Apr 17, 2008 at 3:49 PM, Michael Watson [EMAIL PRO

Re: Different ways of application installation

2008-04-18 Thread Michael Watson
It's worth noting that you also need to define more clearly what you mean by "remotely". Do you mean pushing software packages to clients on a network or over the Internet? An installer that pulls its payload from a remote server? Something else? -- m-s On 18 Apr, 2008, at 09:36, I. Savan

Re: AppleScript - occasional crashes on Leopard

2008-04-22 Thread Michael Watson
Sounds like you're using NSAppleScript from a non-main thread, which will result in random crashes like that. NSAppleScript is only designed to work from the main thread. -- m-s On 22 Apr, 2008, at 13:47, Steve Cronin wrote: Folks; I've seen some inconsistent behavior on AppleScript runni

Re: AppleScript - occasional crashes on Leopard

2008-04-22 Thread Michael Watson
For reference, you're not supposed to pass a pointer to a valid NSDictionary object in -executeAndReturnError:, you're supposed to pass a pointer to an NSDictionary pointer variable. On return, if there were errors encountered, errorDict will be a valid NSDictionary object. -- m-s On 22

Re: AppleScript - occasional crashes on Leopard

2008-04-22 Thread Michael Watson
Mark, So GC + NSAppleScript == avoid for now? -- m-s On 22 Apr, 2008, at 15:53, Mark Piccirelli wrote: Is this a garbage-collected app? If so the crash is a known bug. -- Mark On Apr 22, 2008, at 10:47 AM, Steve Cronin wrote: Folks; I've seen some inconsist

"Safe" frameworks for privileged tools?

2008-04-22 Thread Michael Watson
Hey all, I'm writing a privileged helper tool that at one point needs to determine if a given directory is a package. Normally, I'd use NSWorkspace, but that's part of AppKit, which is tied to Window Server. I don't link to AppKit in my privileged tool, so I don't get the oh-so-convenvien

Re: How to create shortcuts after installing the my package

2008-04-22 Thread Michael Watson
It's not standard practice on the Mac, and most will probably agree that it's not something your application should be doing. It's a presumptuous invasion of the user's desktop space, and most Mac users are very protective of that. -- m-s On 23 Apr, 2008, at 00:53, JanakiRam wrote: Hi Al

Re: "Safe" frameworks for privileged tools?

2008-04-22 Thread Michael Watson
ed it's enabled on a given machine.) -- m-s On 23 Apr, 2008, at 00:17, stephen joseph butler wrote: On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson [EMAIL PROTECTED]> wrote: I would like to use LaunchServices for this, but wasn't sure if it was kosher to link to Applicat

Re: "Safe" frameworks for privileged tools?

2008-04-22 Thread Michael Watson
SWorkspace or LaunchServices? (I'm also going to have to omit Spotlight, since I can't be guaranteed it's enabled on a given machine.) -- m-s On 23 Apr, 2008, at 00:17, stephen joseph butler wrote: On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson <[EMAIL PROTECTED] &g

Re: "Safe" frameworks for privileged tools?

2008-04-23 Thread Michael Watson
Yes, it's a helper tool. It runs for a couple of seconds (under normal conditions) and exits immediately. It interacts with the file system by reading information about some directories, so its launched duration is, of course, bound to the responsiveness of the hard drive on which it's oper

Re: Programmatic "Size To Fit"

2008-05-01 Thread Michael Watson
Others have mentioned -[NSControl sizeToFit], but I thought it was worth reminding that when you can't find a method to do what you want in a given class, remember to check its superclasses for methods the class inherits for what you seek. -- m-s On 01 May, 2008, at 13:39, Randall Meadow

Re: Sending an image to Preview to preview the image

2008-05-06 Thread Michael Watson
Thoughts: 1. Why not build your own preview panel/window? It's remarkably easy to do if you already have the image data in an NSData object. 2. If you must use Preview, you could write the image to a temp file and tell Preview to open that via NSWorkspace's - openFile:withApplication: meth

Re: Cocoa coding style (was Re: Did I reinvent the wheel?)

2008-05-09 Thread Michael Watson
And do not override any of the following to implement singletons! - allocWithZone: -copyWithZone: -retain -retainCount -release - autorelease Instead, just add a "+sharedWhatever" class method.

Re: Cocoa coding style (was Re: Did I reinvent the wheel?)

2008-05-09 Thread Michael Watson
may have arisen. Cheers, Andrew On May 9, 2008, at 8:32 PM, Michael Watson wrote: And do not override any of the following to implement singletons! -allocWithZone: -copyWithZone: -retain -retainCount -release - autorelease Instead, just add a "+sharedWhatever" class method. <ht

Re: How to tell if app launched via login item (versus manual launch)

2008-11-25 Thread Michael Watson
What are you actually trying to accomplish? -- m-s On 25 Nov, 2008, at 22:38, Mark Aufflick wrote: Hi all, I'm wondering if it's possible to tell if my application was launched normally by the user, or if it was launched by virtue of being in the login items. I don't see anything in NSAppli

Re: Excessive open gui graphics files on Mavericks

2014-04-10 Thread Michael Watson
when all you have is a rocket launcher, every problem looks like rocket bait. -- On 9 Apr, 2014, at 0:52, Maxthon Chan wrote: > LOL > > I actually used cramfs once in a game carried the rules database. The rules > are so complicated so I tried to make it smaller without sacrificing the > e