Custom field editor on NSSecureTextField?

2008-06-16 Thread John Stiles
I've got some code which subclasses NSTextView in order to provide a custom field editor for NSTextFields. It doesn't do anything too extraordinary, just allows for filtering out some characters, watching for certain events (like deleting characters or changing the selection), etc. It all works

Re: Custom field editor on NSSecureTextField?

2008-06-16 Thread John Stiles
in source control and dredge up my old code and try to repurpose it. On Mon, Jun 16, 2008 at 6:29 PM, Nick Zitzmann [EMAIL PROTECTED] wrote: On Jun 16, 2008, at 7:16 PM, John Stiles wrote: I've got some code which subclasses NSTextView in order to provide a custom field editor

Re: check if app opens with a document on startup

2008-05-23 Thread John Stiles
Note that these delegate methods will not work properly until your Info.plist has been updated to reflect the file types which your app supports. I've recently opened a radar on this because it doesn't appear to be well-documented and I spent a while trying to figure out why my delegates were

Re: Fullscreen on secondary displays

2008-05-13 Thread John Stiles
None of this really refutes what Ricky posted. You are just lucky that it works in the one-display case. It really isn't designed to work, and on some configurations, it just won't. Is there anything preventing you from following Ricky's advice? Dennis Munsie wrote: In this case, what I am

Re: Flash'In'App – Free Cocoa Framework

2008-05-12 Thread John Stiles
There are a couple of gotchas... trying to disable the right-click menu is one issue (maybe you can subclass the view for this, I haven't tried), and having the Flash app send messages back to the main app is another problem. Julia Rixon wrote: Ferhat Ayaz wrote: Why don't load flash via

Re: Crashes with NSOpenPanel and garbage collection

2008-05-09 Thread John Stiles
Though I guess he could make a LSUIElement application to handle this. Kinda clunky, but it would work. Michael Ash wrote: On Fri, May 9, 2008 at 8:17 AM, Daniel Parnell [EMAIL PROTECTED] wrote: Thanks for that. I was wondering if that might be the case, although I've not been able to

Re: How to send email without using email client

2008-05-09 Thread John Stiles
We have an internal app which sends emails in a similar fashion (all for automated stuff, not for users to see/touch) and we shell out to a Perl script which uses MIME::Lite to handle this. It works perfectly for us. I'm not sure how applicable it will be for you, but it's handled everything

Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread John Stiles
I think they are focusing on polishing up 2.0. I submitted an enhancement for FSA a while back and that seemed to be where all the focus was. Dave Dribin wrote: On May 8, 2008, at 7:53 PM, David Carlisle wrote: My file directory name says FScriptBin-20070421 My startup warning message says

Re: WebView does not expose bindings in IB 3

2008-05-07 Thread John Stiles
This was actually in a WWDC WebKit demo when WebKit was first announced—they set up a web browser on stage with no code, IIRC. Derek Chesterfield wrote: I don't think it's a bug. I think Apple just decided they didn't want to expose WebView with all the useful bindings. I used to love that

Re: BLOBs, MySQL, hex. Oh my

2008-05-07 Thread John Stiles
Have you tried running Shark? That might give you some insight as to what's going on. Ben Einstein wrote: Hi All, I have an enterprise DB application that once used DO to move some files around (images and zip files, mostly). After some serious testing and lots of reading, I decided to move

Re: User Preferences Causing Application to Crash

2008-05-06 Thread John Stiles
I'm going to guess that your preferences window is set to release-on-close. This can be set in Interface Builder; check the Inspector for this window and make sure that checkbox is not set. Patrick Altman wrote: I am very new to cocoa development but a rather seasoned software engineer in

Re: Programmatic Size To Fit

2008-05-01 Thread John Stiles
There is in fact an API, -sizeToFit. Randall Meadows wrote: I am creating a bunch of controls (at least NSTextfield, NSPopupButton, NSSlider, and perhaps others) programmatically (that will eventually be shown in an NSTableView), and would like to apply the Size To Fit feature that IB

Re: Programmatic Size To Fit

2008-05-01 Thread John Stiles
An NSView doesn't have an associated cell, so size to fit doesn't really have a meaningful answer. Size-to-fit works by asking the cell what size it should be. For a box, you could just enumerate the subviews and get the union of all the subview frames. Randall Meadows wrote: On May 1,

Re: NSPopUpButton doesn't show list when used inside a menu item

2008-05-01 Thread John Stiles
Recursive menu tracking? I can't say I'm surprised that this doesn't work :) Honestly I have to say that this sounds like a really weird UI. I would consider a more normal approach (submenus?) Angel Todorov wrote: Hi, I have a regular menu (File menu) for my app. One of the menu items (New

Re: Modal window and 'hanging' menu [SOLVED]

2008-04-30 Thread John Stiles
Manfred Schwind wrote: You probably shouldn't be putting up a modal dialog from within the menu-tracking runloop mode. You can use -performSelector:withObject:afterDelay:inModes: to defer the call that opens the modal dialog; use a delay of 0.0 but a modes array that includes only the default

Trouble with NSPopUpButton and hierarchical menus?

2008-04-30 Thread John Stiles
I've been trying to create an NSPopUpButton in IB3, in pull-down mode, that has a submenu. It doesn't seem to work properly though. After I drag in the Menu item into the pop-up button's menu, the pop-up seems to be irrevocably broken-it randomly neglects to display some items, or fails to show a

Re: autosizing problem

2008-04-29 Thread John Stiles
Kyle Sluder wrote: On Tue, Apr 29, 2008 at 3:59 AM, Yann Disser [EMAIL PROTECTED] wrote: Giving a minimum size to my drawer worked. However I think this absolutely is a bug. I would expect my views to vanish if the window is made too small and to reappear normally once the window is again

Re: How is Apple + Ctrl + D implemented?

2008-04-29 Thread John Stiles
Really? Does this actually work? I needed to find word boundaries to implement a Find panel which supports searching for Whole Words and I ended up using UCFindTextBreak based on advice from this list. It was a pain to implement (since it's not designed to mesh with Cocoa at all). Graham

Re: How is Apple + Ctrl + D implemented?

2008-04-29 Thread John Stiles
Man, what a bummer. I wish you had been around when I asked the question before :) Keith Blount wrote: Really? Does this actually work? I needed to find word boundaries to implement a Find panel which supports searching for Whole Words and I ended up using UCFindTextBreak based on advice

Re: NSTextView text coloring problem

2008-04-24 Thread John Stiles
Is the $ usage an extension? That doesn't sound like regular C to me. Alastair Houghton wrote: On 24 Apr 2008, at 16:10, Dave Jewell wrote: On 24 Apr 2008, at 8:42 am, Graham Cox wrote: Aside: your ivars shouldn't start with an underscore - Apple reserves such names for its own classes.

Re: Core Animation Deadlock

2008-04-24 Thread John Stiles
You could also show any other thread stuck trying to lock a mutex? I assume there's another thread holding this lock or stuck trying to lock something else. Colin Cornaby wrote: Hi, I'm currently trying to track down a deadlock. After adding a series of layers, CoreAnimation deadlocks here

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread John Stiles
Thirded. Matt Gough wrote: I'd second that. The OS (well, Finder) also adds things to the resource fork of files (custom icons, info about which app to open a file with when you changed it from the default etc). Just as long as you respect the existing contents this is exactly where you

Re: IB3 can't find my class

2008-04-23 Thread John Stiles
Nick Zitzmann wrote: On Apr 23, 2008, at 4:04 PM, John Stiles wrote: I have a class declared in code which, until recently, didn't have any IBActions in it. Recently I added some, and went to IB3, but it didn't notice that I had added the actions. I had to manually add them via the + button

Re: NSTextfields and keyboard equivalents - am I missing something?

2008-04-22 Thread John Stiles
Mattias Arrelid wrote: On Mon, Apr 21, 2008 at 7:05 PM, John Stiles [EMAIL PROTECTED] wrote: In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against

Re: NSTextfields and keyboard equivalents - am I missing something?

2008-04-21 Thread John Stiles
In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against the menus before passing it through the responder chain. I think your best bet is to dim your menu item or

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-21 Thread John Stiles
Corbin Dunn wrote: On Apr 18, 2008, at 3:37 PM, John Stiles wrote: Ben Lachman wrote: Well, you should be able to just override the drawing code, since thats really your problem. Going directly against the docs, while it may work fine now, is playing with fire in my opinion. Yeah

SynchroScrollView

2008-04-21 Thread John Stiles
Has anyone gotten this example to work in Leopard? http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html I just tried it and I'm having terrible luck. The view is just blanking itself out immediately. I can get it to sort-of work if I

Re: SynchroScrollView

2008-04-21 Thread John Stiles
that is shrunk to a degenerate rectangle loses its position size) John Stiles wrote: Has anyone gotten this example to work in Leopard? http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html I just tried it and I'm having terrible luck

Re: SynchroScrollView

2008-04-21 Thread John Stiles
for RBSplitView? I've seen web posts indicating that it exists but I can't find it. John Stiles wrote: I found thee things which, in conjunction, solve the problem: 1 - Rewrite synchronizedViewContentBoundsDidChange as follows. -scrollToPoint seems broken. (I am clamping the scroll view

Re: SynchroScrollView

2008-04-21 Thread John Stiles
NM that last part, I found the plugin. For the archives, it's at http://brockerhoff.net/src/RBSplitView.ibplugin.zip Sorry, all, for the multiple replies-to-self here :) John Stiles wrote: Oh, there was a fourth problem actually. This doesn't work in all cases: NSRect changedBounds

Re: Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
No, that's not the problem. The problem is that some combinations simply don't work. For instance, just as a random example, AppKit does not match option+, or shift+`. (Haven't tried adding command but offhand I don't have any reason to think that this would fix it.) My app supports

Re: [SOLVED] Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
Could you do something else to cause VoiceOver to explicitly say the string you want it to? Martin Wierschin wrote: The fake temporary item solution actually works pretty well. It's the last thing I'd call elegant, but here's how you can blink a menu title in Cocoa. Unfortunately that

NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
The docs for -editColumn:row:withEvent:select: ominously claim: The row at rowIndex must be selected prior to calling editColumn:row:withEvent:select:, or an exception will be raised. I'm implementing a subclass of NSTableView which behaves a little more like an Excel spreadsheet—it

Re: Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
equivalent and no target or action. Then use NSMenu -performKeyEquivalent: to simulate its selection. Wow, great choices here :| I'm going to try #2 first since it's not SPI. I'll inform the list of the results. John Stiles wrote: John Stiles wrote: Randall Meadows wrote: On Apr 17, 2008

[SOLVED] Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
]; } John Stiles wrote: Reading the list archives a little more, it looks like there may be two ways to do this: - _NSHighlightCarbonMenu and _NSUnhighlightCarbonMenu are SPIs which take an NSMenu* and do exactly what you'd expect - You can add a fake temporary menu item to your menu

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
on the header. Fortunately I don't need to worry about that in this case. Not a problem. But this should get you started, hopefully. -Ben -- Ben Lachman Acacia Tree Software http://acaciatreesoftware.com [EMAIL PROTECTED] 740.590.0009 On Apr 18, 2008, at 1:55 PM, John Stiles wrote: The docs

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
Ben Lachman wrote: Well, you should be able to just override the drawing code, since thats really your problem. Going directly against the docs, while it may work fine now, is playing with fire in my opinion. Yeah… that's why I posted :) I was hoping to get a oh yeah, that only applies if

-charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I have an NSEvent and I need to know what key the user has pressed, minus any of the modifiers. NSEvent -charactersIgnoringModifiers seems like a good place to start, but it has one serious flaw—it does not ignore the Shift key. So, for instance, it won't change ~ to `, ! to 1 or { to [. I

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
timeframe. John Stiles wrote: Sweet, I will take a look at this and post back when I have results or questions. Thanks! Greg Titus wrote: I think you'd ask the NSEvent for its -keyCode, then pass that key code to UCKeyTranslate() with all the modifier key state (including shift) turned off

RE: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I'm currently cribbing from here: http://lists.apple.com/archives/carbon-dev/2005/May/msg01062.html And I got rid of the non-uchr section. I can require Leopard in this case. From: Jean-Daniel Dupas [mailto:[EMAIL PROTECTED] Sent: Thursday, April 17, 2008 9:37 AM To: John Stiles Cc

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
with low-ASCII values, i.e. numbers under 32. I guess I could implement a hybrid approach where I only use UCKeyTranslate if the character appears to be letters or punctuation...? Seems doable but makes me wonder if I'm going down the wrong path. Is there a better way? John Stiles wrote: Sweet, I

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
version of another character. I'd go for the actual character and its meaning, not the key. Best, Hank On Apr 17, 2008, at 12:02 PM, John Stiles wrote: I have an NSEvent and I need to know what key the user has pressed, minus any of the modifiers. NSEvent -charactersIgnoringModifiers seems

Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa equivalent.

Re: Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
Randall Meadows wrote: On Apr 17, 2008, at 11:54 AM, John Stiles wrote: As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's FlashMenuBar(menuID

Re: Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
John Stiles wrote: Randall Meadows wrote: On Apr 17, 2008, at 11:54 AM, John Stiles wrote: As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
, John Stiles wrote: Quick question: in Leopard, are there any keyboards left which don't have a uchr? I found some sample code which includes a fallback case for if no 'uchr' resource is found (it uses plain KeyTranslate in this case) and I'm wondering whether this is still relevant

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
] initWithBytes:singleChar length:1 encoding:CFStringConvertEncodingToNSStringEncoding(keyboardEncoding)] autorelease]; } return result; } @end John Stiles wrote: Hmm, OK. I guess there's no harm in leaving

Re: binary search trees binning

2008-04-16 Thread John Stiles
Jean-Daniel Dupas wrote: Le 16 avr. 08 à 00:07, John Stiles a écrit : Hmm, setdouble sounds a lot easier than this to me. Just use insert to put all the doubles into the set (one line), then use lower_bound to find the delineations between each group (another one-liner, though of course

Re: binary search trees binning

2008-04-16 Thread John Stiles
Foundation is just ugly in comparison... :) Michael Ash wrote: On Wed, Apr 16, 2008 at 1:20 PM, John Stiles [EMAIL PROTECTED] wrote: The difference is, in STL, if you want an array where you can remove from the beginning, you would never use vector anyway. You'd use deque, which has different

Re: Using the debugger with local variables was Re: is this badly written code?

2008-04-15 Thread John Stiles
IS makes a good point. Moreover, if you have some method which has a side effect or which might not return the same result every time, po is no good for debugging it. These simplistic examples (creating a URL from a string) will work the same no matter how many times you execute them, but a

Re: binary search trees binning

2008-04-15 Thread John Stiles
Hmm, setdouble sounds a lot easier than this to me. Just use insert to put all the doubles into the set (one line), then use lower_bound to find the delineations between each group (another one-liner, though of course you'll need to loop over the number of groups you want). Then the distance

Re: NSTableView memory usage

2008-04-14 Thread John Stiles
I think Instruments could do a better job of telling you what's going wrong than we could. FWIW, the table view doesn't even know the contents of most of your 1500 rows. It asks for them from the data source as it needs them, and probably only knows the values of the currently visible cells.

Re: how should I go about downloading files

2008-04-14 Thread John Stiles
Laimonas Simutis wrote: On Fri, Apr 11, 2008 at 6:01 PM, Scott Anguish [EMAIL PROTECTED] wrote: On Apr 10, 2008, at 9:04 PM, Laimonas Simutis wrote: Hey, This is my first cocoa projects so I am kind of finding my way around the framework. The question I have is maybe more related to

Re: is this badly written code?

2008-04-14 Thread John Stiles
The chained approach is tempting since it's short and convenient, so if the code is not prone to failure, I'd say go for it. If you expect that you might need to see intermediate values in the debugger or there are weird edge cases where something might return nil, I'd break it out into

Re: is this badly written code?

2008-04-14 Thread John Stiles
with things like if treeController returned nil instead of a NSArray. NSManagedObject *selectedTreeObject = [self valueForKeyPath:@delegate.mainWindowController.treeController.selectedObjects.lastObject]; On Apr 14, 2008, at 10:05 PM, John Stiles wrote: The chained approach is tempting since

Re: Open-source NSToolbar?

2008-04-09 Thread John Stiles
This is very cool and I would have used it if I had known about it earlier, but it isn't a replacement for NSToolbar so much as a simpler way to create one (which is awesome and should have been there all along). Geoff Beier wrote: On Tue, Apr 8, 2008 at 12:25 PM, John Stiles [EMAIL

RE: Hide application from dock

2008-04-09 Thread John Stiles
You cannot tell your app to hide from the dock once it has shown. However, you can start hidden and become visible via the (IIRC) TransformProcessType API. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jere Gmail Sent: Wednesday, April 09, 2008 2:11 PM

Re: Hide application from dock

2008-04-09 Thread John Stiles
Even if you could change it, once your app is running it, changing the plist won't have any effect until the next time the app is run. So it's probably a moot point. glenn andreas wrote: On Apr 9, 2008, at 4:41 PM, Randall Meadows wrote: [resending with my subscribed address--grrr] On Apr

Re: Open-source NSToolbar?

2008-04-08 Thread John Stiles
Well, I was thinking more along the lines of an RBSplitView, something you can just drop into your nib/code and suddenly your toolbars are better :) Thanks for the pointers, everyone. [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 2008-04-07 17:47:30: I'm looking for an open-source

Re: Obj-C idioms for list based tasks

2008-04-07 Thread John Stiles
Cocoa doesn't have ordered sets. It has arrays (NSArray), unordered sets (NSSet), and unordered key-value tables (NSDictionary). Any of these can optionally be mutable. NSCountedSet also allows for the equivalent of a multiset, but for some reason there is no NSCountedDictionary, for the

Open-source NSToolbar?

2008-04-07 Thread John Stiles
I'm looking for an open-source NSToolbar-like toolbar implementation... do any exist? I haven't found any yet. I want to check it out and see how some things are done... I don't really need a ton of features outside the standard toolbar stuff, it's more for learning/research to see what can

Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
I am trying to add some hotkeys to buttons in my app, and I've hit a weird snag. Specifically, the shift modifier flag appears to be ignored for anything other than alphanumeric keys—i.e. I can't make a button that corresponds to cmd+F1 and a second button that corresponds to cmd+shift+F1.

Re: Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
For any curious Apple engineers, I've just filed this issue as rdar://5848023 and attached a test app (four lines of code). John Stiles wrote: I am trying to add some hotkeys to buttons in my app, and I've hit a weird snag. Specifically, the shift modifier flag appears to be ignored

Re: Objective-C Instance Variable Names

2008-04-06 Thread John Stiles
You can't be KVC compliant if you use prefixes like m_, so this limits your potential for using things like bindings. When I write C++, I am also a fan of m_, but it's just not appropriate for Cocoa since it basically means you're fighting against the frameworks. Scott Andrew wrote: See i

Re: Objective-C Instance Variable Names

2008-04-03 Thread John Stiles
I'd never heard the Smalltalk conventions before, but I have to admit I really like the sound of them. I'd love to see a block of code written to these rules to see how it plays out in practice. (ObjC or C++, that is, not Smalltalk.) Robert Claeson wrote: On 3 Apr 2008, at 19:58, Rob

Re: how to hack my own apps

2008-04-03 Thread John Stiles
I'm not a hacker, but if I had to figure out how a Cocoa app worked in a hurry, I'd check out F-Script Anywhere. justin webster wrote: just wondering how easy it is for would-be hackers to get inside my code. how meaningful and human-readable is a reverse engineered version of my app? is

Re: [NSPipe pipe] returning nil (running out of filehandles?)

2008-04-02 Thread John Stiles
Jens Alfke wrote: Also, you're aware that MD5 shouldn't be used for anything security-related anymore? Last I heard it's pretty close to being fully broken. SHA-1 is a lot more secure, and has a larger output which itself makes collisions less likely. Fully broken? I don't know about

Re: Name of NSTableView

2008-04-02 Thread John Stiles
Your delegate and data source can be the same object if you want. Nothing prevents it. Mr. Gecko wrote: What do you mean by the name? in the identity tab of Interface builder You could make one class that has all of the common code, and then subclass it for each table instance. That's a

Re: test if another app has hung

2008-04-01 Thread John Stiles
I have a vague recollection that the mechanism used by Activity Monitor and friends is not public API, unfortunately. Martin Redington wrote: I went to check the referenced thread, as this is something I wanted to do occasionally, when I noticed that I was the OP for it. The discussion

Re: [NSPipe pipe] returning nil (running out of filehandles?)

2008-04-01 Thread John Stiles
I haven't experimented with CC_MD5, but we do have code which calculates MD5s (calculated via simple C code). Is CC_MD5 optimized e.g. using SSE or AltiVec? Should I expect to see a perf boost if I swapped in this code instead of our regular C code? Jean-Daniel Dupas wrote: Le 2 avr. 08 à

Re: Subverting the first responder chain

2008-03-31 Thread John Stiles
that the message to super didn't work precisely because the next responder in my main application was accidentally swallowing all keyDowns. I apologize for the misinformation, but thank you for helping me find a bug. Allen -Original Message- From: John Stiles [mailto:[EMAIL PROTECTED] Sent: Fri

Subverting the first responder chain

2008-03-27 Thread John Stiles
I am implementing a custom NSView subclass (actually a simple subclass of NSOpenGLView) that implements -keyDown: in order to respond to user typing. Typically, this works great. However, I have a few menu items which respond to atypical hotkeys (e.g. one responds to space, another to

Re: Subverting the first responder chain

2008-03-27 Thread John Stiles
before handling -keyDown:, maybe I'll just keep doing that. It's gross but I guess all the potential solutions are gross. Ken Thomases wrote: On Mar 27, 2008, at 7:52 PM, John Stiles wrote: I am implementing a custom NSView subclass (actually a simple subclass of NSOpenGLView

Re: NSImage trapezium...

2008-03-23 Thread John Stiles
FWIW, if you find yourself needing to do much more in the way of distorting images, I'd recommend looking into OpenGL directly. It's extremely fast since it goes straight to the hardware, and doing something like map an image to a trapezoid is /very/ few lines of code. Much simpler than trying

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
Michael Ash wrote: On Thu, Mar 20, 2008 at 7:58 PM, E. Wing [EMAIL PROTECTED] wrote: You really should profile to find your bottlenecks, especially when the STL is concerned. My personal experience has been that gcc poorly optimizes STL code automatically for you and you must go in and

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
Michael Ash wrote: On Fri, Mar 21, 2008 at 12:13 PM, John Stiles [EMAIL PROTECTED] wrote: Michael Ash wrote: For what it's worth, I wrote a quick test program creating 50,000 random key/value pairs of NSStrings of around 500 characters each, then inserted them into an NSDictionary. My

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
the underlying guts were actually doing a more sophisticated task (copy instead of reference, sorted instead of unsorted). Other than that, you've been giving credit pretty much where it's due. Michael Ash wrote: On Fri, Mar 21, 2008 at 4:51 PM, John Stiles [EMAIL PROTECTED] wrote: It's fine that you

Re: dealloc methods not being called?

2008-03-21 Thread John Stiles
AppKit does an optimization where at app shutdown time, it stops dealloc'ing things. It does make app quitting faster, but it means that if your deallocs have side effects, the side effects will never occur. It also makes leak tracking difficult if you try to do a full-on leak check at

Re: Using C++ classes from Objective C

2008-03-20 Thread John Stiles
Without starting a religious war, I have to disagree with this. ObjC++ is probably a bad idea if you are a novice programmer in general, but I think it also has some really good things going for it, and having written huge amounts of ObjC++ code, I think it's perfectly straightforward to use.

Re: doubleValue (for an NSString)

2008-03-20 Thread John Stiles
You could always do this float value; if (1 == sscanf([myString UTF8String], %f, value)) { // the string was a valid float } else { // it wasn't } For integer, replace float with int and %f with %d. Localization concerns still apply in theory but in practice there are few locales which

Re: Using C++ classes from Objective C

2008-03-19 Thread John Stiles
Are you #including the header which declares MyClass? Jeremy wrote: Hi. I am just starting to learn Cocoa and would like to use standard C++ classes from my Objective C/C++ classes. Is there any known documentation on how to do this, or does anyone have any pointers? I tried creating a

Re: Equivalent to Carbon's TransitionWindow(); using genie when opening an NSWindow

2008-03-18 Thread John Stiles
TransitionWindow was never implemented well in OS X, as far as I know. Last I checked, it simply drew a few zoomrects using the look of the old OS 9 Finder. Not too impressive. It didn't do genie effects either. You might look into NSWindow's - (void)setFrame:(NSRect)windowFrame

Re: Adding spaces to an NSString

2008-03-18 Thread John Stiles
making it work and optimizing later.. Jason On 3/18/08 5:46 PM, John Stiles [EMAIL PROTECTED] wrote: Have you looked at NSMutableString? The APIs are pretty basic here. I'd recommend working from right-to-left; you'll find it probably makes the logic simpler. J. Todd Slack wrote: Hello

Re: Best Way To Lookup From a Huge Table

2008-03-16 Thread John Stiles
Well, at the risk of sounding silly, you call insert 41,000 times. Were you expecting a more exciting answer? :) Paul Thomas wrote: On 15 Mar 2008, at 02:35, Scott Ribe wrote: Of course, for me, the simplest way would probably be std::map int, string , but that's just my personal taste.

Re: Best Way To Lookup From a Huge Table

2008-03-13 Thread John Stiles
NSDictionary should be all you need here. It internally uses a hash table to find keys, so it should be extremely fast. Karan Lyons wrote: What's the best way to lookup something from a huge table? I'm trying to write a piece of code that checks weather data given a zipcode. But I

Re: [Q] How can I repair file name with wrong encoding?

2008-03-13 Thread John Stiles
Maybe it's treating the filename bytes as Latin-1? Just a guess, but that'd be the first thing I'd check. Second would be MacRoman. Aki Inoue wrote: Yes, sounds like there really is a bug. Please file a bug and attached the zip archive possible. Thank you, Aki On 2008/03/13, at 7:48,

Re: Cocoa-dev Digest, Vol 5, Issue 393

2008-03-12 Thread John Stiles
Daniel Child wrote: Each record is allocated and explicitly released at the end of the loop after adding it to the table. I thought autorelease might wait too long to get rid of it, so I do it explicitly. Just because you never autorelease it in your code, doesn't mean that it is never

Re: Controlling line tightening

2008-03-12 Thread John Stiles
Followup: this requires a bit of math but it works great in practice. I have a lot more control over the tightening now, which is just what I needed. Thanks! John Stiles wrote: Interesting! I didn't think to use kerning directly. Thank you for the idea!! It makes sense since obviously I am

Re: Controlling line tightening

2008-03-12 Thread John Stiles
/NSParagraphStyle_Class/Reference/Reference.html#//apple_ref/occ/instm/NSParagraphStyle/tighteningFactorForTruncation Aki On 2008/03/12, at 11:35, John Stiles wrote: Followup: this requires a bit of math but it works great in practice. I have a lot more control over the tightening now, which is just what

Re: runtime error

2008-03-12 Thread John Stiles
for me.) On Mar 12, 2008, at 1:47 PM, John Stiles wrote: Daniel Child wrote: Each record is allocated and explicitly released at the end of the loop after adding it to the table. I thought autorelease might wait too long to get rid of it, so I do it explicitly. Just because you never

Re: performSelectorOnMainThread problem

2008-03-12 Thread John Stiles
If -updateProgress is taking data as an argument, then you probably want @selector(updateProgress:) Note the colon. Nick Rogers wrote: Hi, In my secondary thread I'm doing: [self performSelectorOnMainThread:@selector(updateProgress) withObject:data waitUntilDone:YES]; with the error that

Controlling line tightening

2008-03-11 Thread John Stiles
I'm using line tightening in some of my dialogs and 99% of the time it works great, but there are a few aspects of it that don't work for my app. In particular, when line tightening kicks in, first it attempts to shrink the text to fit the box, which is awesome. But when it still doesn't fit

Re: Controlling line tightening

2008-03-11 Thread John Stiles
for my needs. The ellipsis was the big problem. John Stiles wrote: I'm using line tightening in some of my dialogs and 99% of the time it works great, but there are a few aspects of it that don't work for my app. In particular, when line tightening kicks in, first it attempts to shrink the text

Re: How to get the name of a method at runtime?

2008-03-10 Thread John Stiles
My experience with dladdr has been that it returns junk at least half of the time. IIRC, Tiger was worse than Leopard, but neither is as accurate as NSTask'ing out to atos (which basically works perfectly, albeit slow as dirt). I've got an open radar on it. stephen joseph butler wrote: On

Re: fileExistsAtPath with * to indicate random

2008-03-10 Thread John Stiles
You could use -directoryContentsAtPath: and check the array yourself for matches. Mr. Gecko wrote: Hello, I'm new to cocoa so any help will be appreciated. I'm needing my application to find out if ImageMagick is installed. It is usually installed in the root directory(/) and it has the

Re: fileExistsAtPath with * to indicate random

2008-03-10 Thread John Stiles
In general this is excellent advice, but I believe ImageMagick is not a Mac program but an X11 thing. Brian Stern wrote: On Mar 10, 2008, at 12:10 PM, Mr. Gecko wrote: I'm needing my application to find out if ImageMagick is installed. You should look at Launch Services. This Carbon API

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
, at 3:27 PM, John Stiles wrote: Interface Builder can easily make a small variant of NSSearchField—it's right there in the size popup—but I can't manage to reproduce the effect in code. The typical approach doesn't work: [[searchField cell] setControlSize:NSSmallControlSize]; does nothing

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
, cellSizeForBounds: doesn't give you the size you want. -Tom On Mar 10, 2008, at 3:45 PM, John Stiles wrote: I've done all of these things, and so far no dice. The small control clearly has a different overall look—for instance, the magnifying glass icon has a smaller variant which I do not see. Also, when

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
= cellSize.height; [searchField setFrame:searchFrame]; If you don't set the font first, cellSizeForBounds: doesn't give you the size you want. -Tom On Mar 10, 2008, at 3:45 PM, John Stiles wrote: I've done all of these things, and so far no dice. The small control clearly has a different overall look

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
BTW, this is now filed as rdar://5791056 [NSSearchFieldCell] Does not properly honor calls to -setControlSize: Thanks again for everyone's help debugging this issue! John Stiles wrote: OK, I figured it out. My control's frame was too tall! If you set the search field's frame

  1   2   >