Re: Reading Adobe Photoshop header, Obj-C
On 28.06.2011, at 15:23, Kevin Muldoon wrote: Was writing a program to create thumbnails using SIPS, GhostScript, ImageMagick. During testing I found I needed to read the header file of Adobe Photoshop native documents directly because Duotone image color mode simply wasn't returning the proper color mode (in a variety of programs). So I threw together this bit of code which works great for the first tag, but // References //http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/PhotoshopFileFormats.htm#50577409_pgfId-1055726 //http://www.adobe.com/content/dam/Adobe/en/devnet/photoshop/psir/ps_image_resources.pdf NSFileHandle *fileHandler = [NSFileHandle fileHandleForReadingAtPath:@/Users/kevin/Desktop/balloon.psd]; NSData *psdFileHeader = [NSData dataWithData:[fileHandler readDataOfLength:26]]; // read entire PSD header NSData *signature = [psdFileHeader subdataWithRange: NSMakeRange(0,4)]; NSData *version = [psdFileHeader subdataWithRange: NSMakeRange(4,2)]; NSData *reserved = [psdFileHeader subdataWithRange: NSMakeRange(6,6)]; You're doing the worst case for performancewise. The usual way would be to define a struct #pragma pack (push, 2) typedef struct { uint32_t psdMagic; uint16_t version; uint16_t reserved1; uint32_t reserved2; } PSDHeader; and use it with code like: NSData * psdHdrData = [NSData dataWithData:[fileHandler readDataOfLength:sizeof( PSDHeader )]]; // read entire PSD header PSDHeader *header = (psdHeader *) [psdHdrData bytes]; psdMagic = CFEndianBToN( header-psdMagic ); ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reading Adobe Photoshop header, Obj-C
On 28.06.2011, at 21:37, Charles Srstka wrote: On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: Another way (that I often use) is to define a C struct that matches the fields and layout of the header, then cast the bytes to a pointer to that struct and read the fields. It makes your code look a lot cleaner, but you have to be careful to (a) make sure the compiler packs the struct fields properly, and (b) you byte-swap all integer/float fields appropriately. It’s my understanding that reading/writing a struct directly to/from a file is considered poor practice, because of the two things you mentioned: endian issues, and the fact that you don’t know how the compiler will align the fields — and even if you test that, you don’t know that it’s not going to change in some future version of clang or gcc, or that Apple’s not going to switch to a new architecture or something in which the compilers will emit different output. - the endian issue you'll have to deal with anyway - regarding struct alignment: the 80ies file format had tons of of serialized struct data which usually better end up in a struct. Well, streamed reading has bad performance, so you'd not want to use it in image (or movie) manipulation code. Streamed reading just to put it back into a struct is another anti-pattern. The don't is to use binary structs for new defined protocols for transfer, for the given reasons. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reading Adobe Photoshop header, Obj-C
On 28.06.2011, at 21:57, Thomas Engelmeier wrote: On 28.06.2011, at 21:37, Charles Srstka wrote: On Jun 28, 2011, at 12:00 PM, Jens Alfke wrote: Another way (that I often use) is to define a C struct that matches the fields and layout of the header, then cast the bytes to a pointer to that struct and read the fields. It makes your code look a lot cleaner, but you have to be careful to (a) make sure the compiler packs the struct fields properly, and (b) you byte-swap all integer/float fields appropriately. It’s my understanding that reading/writing a struct directly to/from a file is considered poor practice, because of the two things you mentioned: endian issues, and the fact that you don’t know how the compiler will align the fields — and even if you test that, you don’t know that it’s not going to change in some future version of clang or gcc, or that Apple’s not going to switch to a new architecture or something in which the compilers will emit different output. - the endian issue you'll have to deal with anyway - regarding struct alignment: the 80ies file format had tons of of serialized struct data which usually better end up in a struct. Well, streamed reading has bad performance, so you'd not want to use it in image (or movie) manipulation code. P.S.: unless the structs have variable length data in the middle, i.e. can not be read in one read anyway. IIRC the PS structures are not organized that way, though. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: data over USB to iPhone
On 13.01.2011, at 20:19, Kyle Sluder wrote: On Thu, Jan 13, 2011 at 11:12 AM, Reaves, Timothy trea...@silverfieldstech.com wrote: That's not correct. There are Apple approved cables to allow you to do exactly that (there is a serial cable too). But my understanding is the cable itself is not certified by Apple, but the actual usage of the cable. You you can get one of the existing cables and see if you can use it for your purpose, or contact the cable manufacturer, and see what they would charge to provide cables to you that are certified by Apple. Are these cables part of the Made for iPhone program? Aside from USB audio and keyboards, there's no out-of-the-box support for communicating over USB with the iOS SDK. iPad iOS is able to work as an USB host for: - MTP devices - Mass Storage Devices If you want to ship an app using that feature, filing an bug reports / feature request to de-private ImageCapture.framework makes sense ;-) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to make 2D lines look 3D
Am 31.12.2010 um 16:29 schrieb Matthias Arndt: - Draw 2D lines in OpenGL I dropped the OpenGL approach due to too many drawbacks, e. g. missing round line caps, resolution-dependence of line width, ... The shadow approach looks best, but is out of question due to its bad performance. Which means you used OpenGL line drawing primitives. You could try to use pre-rendered images with transparency (=shadow), with linecaps separate and an stretchable image for the line. Google keywords: Texture2d, 2d texture drawing. If you don't want to use OpenGL directly, Quartz 2D and / or CoreAnimation will drill down to OpenGL based drawing rather sooner than later. HTH, Thomas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reading in UTF-8 to Data
Am 16.07.2010 um 14:58 schrieb Brad Stone: The XML file is from an app I wrote a long time ago and contains thousands of documents similar to this one. Once Nick mentioned quotable-printable I remembered I used that. It was so long ago I had forgotten. There are many users that use the app and each of them have hundreds, if not thousands, of individual XML files and they need this functionality. My last resort would be to send out update for the old app to all the users to reprocess their XML files w/o the quoted-printable but you know how that will go. If I could only get Cocoa to do it I'd be done. Run, don't walk, and find some code snippet that removes the bizarre QP reencoding from the data you get reading your XML, and don't reapply it saving (except in a backward compatibility mode for non-upgrading users). The whole idea of UTF-8 is to be able to represent about any glyph imaginable without requiring reencoding, and UTF8-encoded XML deals pretty well with it besides the requirement to escape ' under certain circumstances.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] File coping application
Am 26.04.2010 um 21:17 schrieb John Joyce: For your personal pleasure: The iPhone is a MTP device, so you can use ImageCapture to copy images from / to your phone. If you don't want Stanza-like trouble and stay in the AppStore: There is no official way. HTH, Thomas Translation: Though possible, this is in direct violation of the agreement for the iPhone OS SDK. @Thomas, Correct as you are here, this potentially also could get you bonked off of the mailing list. If mentioning the iPhone implements the _Multimedia_ Transfer Protocol (and not only the _Picture_ Transfer Protocol described in the 15470 standard) and it has a really good, brand new Cocoa counterpart with the new ImageCaptureCore in SnowLeopard brings me after nearly a decade on-list a ban, I've no problems with being not on this list - I'm here to discuss engineering topics, not to get a EULA lawyer for released, public APIs. To stay on topic: I really recommend anyone to check out the new Snow Leopard IMageCaptureCore for dealing with MTP devices. My recommendation to test is using an iPhone and a cradle - attached 3rd party cameras usually suffer from a drastic battery drain so you usually have to stop debugging after some hours (less than one hour for my DSLRs) for a recharging break. The testing drawback is the iPhone can not be remote controlled to take pictures (in contrary to most other PTP devices). Regards, TE ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] File coping application
On 26.04.2010, at 18:04, Arun wrote: Is it possible to copy files form iPhone on to a Mac when iPhone is connected to USB? If so how can we achieve this? For your personal pleasure: The iPhone is a MTP device, so you can use ImageCapture to copy images from / to your phone. If you don't want Stanza-like trouble and stay in the AppStore: There is no official way. HTH, Thomas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Private ivars, not marked as IBOutlet, visible in IB
Am 04.03.2010 um 19:58 schrieb Joanna Carter: I have no problem with this concept of default behaviour, if it is for legacy purposes but, with the new visibility specifiers, these should take precedence of the older legacy rules. Never mind, as long as you prepend the private ivar with an underscore, it disappears :-) Which is something some people at Apple encourage not to do. The leading underscore is seen as Library implementors naming space (also and especially for method signatures) so your code might break when you use that coding pattern. OTOH, enforcing would break many peoples codebase, so it is unlikely that will ever happen. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Animation vs. Basic Cocoa Graphics
Am 12.03.2010 um 03:13 schrieb Mazen M. Abdel-Rahman: For the calendar grid I was creating an NSTrackingArea for each cell - in my case (the calendar is for 7 days with 15 minutes per cell) there was 672 NSTrackingAreas. I will have to look at alternative solutions to all these NSTrackingAreas to improve the performance. Erm, you are using tracking areas to subdivide into a rectangular grid instead of dayOfWeek = x / dayItemWidth; selectedTime = 0.25f * ((dayHeight - y) / timeSectionHeight ); ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UINavigationController and UINavigationBar
Am 09.12.2009 um 02:02 schrieb Duccio: Yes, I know, but no backgroundImage property :-) And Apple documentations says, for example: It is permissible to modify the barStyle or translucent properties of the navigation bar but you must never change its frame,bounds, or alpha values directly. so very restrictive... Well, setting the frame or bounds simply will not work. Enjoy the case when UINavigationBar for some reason out of your control believes it is in a different UIInterfaceOrientation and you need some way to convince it to use the tall / small variant. Regards, Tom_E___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOperation cancellation
Am May 26, 2009 um 1:07 AM schrieb Kyle Sluder: On Mon, May 25, 2009 at 10:15 AM, Thomas Engelmeier te.mli...@googlemail.com wrote: My op polls isCancelled, returns from main and nothing more happens. Please post your code, it's the only real way to investigate the issue (especially since you're using operations/multithreading, where the errors can be extremely subtle). You were right. Copy-pasting the relevant code revealed that doing a [delegate performSelectorOnMainThread] while the main thread is blocked waiting for the last operation to finish is not a good idea ;-) Thanks, Thomas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSOperation cancellation
Hi, I'm running into some trouble with NSOperation / NSOperationQueue. In order to tear down everything gracefully, I use something like [queue cancelAllOperations]; [queue waitUntilAllOperationsAreFinished]; My NSOperation subclasses just have a straightforward -(void) main method. It works as advertised for me unless I'm trying to cancel the operations. Regular run: (MyOperation) change of isExecuting to 1 (MyOperation) change of isExecuting to 0 (MyOperation) change of isFinished to 1 Cancel run: (MyOperation) change of isExecuting to 1 ** Cancel... (MyOperation) change of isCancelled to 1 My op polls isCancelled, returns from main and nothing more happens. op.isFinished and op.isExecuting is not updated, bringing waitUntilAllOperationsAreFinished and other KVC observers to an halt. Do I really need to reimplement the whole state (isFinished, isExecuting) logic just in order to support cancellation? TIA, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bindings + NS{Secure}TextField validation - coerced value is not used
Hi, I have a NSSecureTextField combined with bindings I need to filter for allowed formats like ['0'-'9']* or ['0'-'9''a'-'f']*. The filter is set up like below and according to the NSLog working fine. According to the documentation Bindings Message Flow, the following should occur: [12] The validation result, value, and a possible error are returned by the controller’s validateValue:forKeyPath:error:method to the view. [13] If the validation result is YES, then the valid or coerced value are returned to Step 5, otherwise proceed to Step 14. [5] The view object invokes setValue:forKeyPath: on the controller object, passing the new, possibly transformed, object value and the binding’s key path as arguments. However, when e.g. 12xxx is coerced to 12, in the TextField still five bullets remain and entering another digit invokes the method with 12xxx1. How can I force the documented behavior? - (BOOL) validateValue:(id *) ioValue forKey:(NSString *) anKey error: (NSError **)outError { if( [anKey isEqualTo:@myKey] ) { NSString *value = *ioValue; unichar *buffer = (unichar *) malloc( [value length] * sizeof( unichar) ); unichar *dest = buffer; for( NSInteger i = 0; i [value length]; ++i ) { if( [oValidator inputMethodAllowsCharacter:[value characterAtIndex:i]] ) { *dest = [value characterAtIndex:i]; ++dest; } } NSUInteger len = (dest - buffer); NSString *coercedValue = [NSString stringWithCharacters:buffer length:len]; free( buffer ); *ioValue = coercedValue; NSLog( @%s %...@-%@, __PRETTY_FUNCTION__, value, coercedValue ); return (coercedValue != nil); } return YES; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Multiple NSTableViews in one NSScrollView
Hi, I have an UI where a bunch of NSTableViews plus extra title views are stacked in one NSScrollView. Currently each table is loaded from a subview NIB, populated, resized- to-fit and placed in a master documentview. That is working fine except IB generated TableViews reside already in a IB generated NSScrollView (unused, scrollview frame = table+header frame) which leads to a bunch of scrolling related artifacts (ScrollWheel etc..). How much is a NSTableView interacting with the enclosing scroll view? Can I get rid of the scrollview by programmatically creating the table view? Ar attach the shared parent scroll view to all tableviews? TIA, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ObjC data structure for C++/ObjC++ objects?
On 08.11.2008, at 02:41, Jonathan Bailey wrote: I am trying to find a way to create a dynamically-growable objective C data structure within objective C++ code, such as a NSMutableDictionary, that can store values that are pointers to an objective C++ or straight-up C++ object. Personally, I'd use the PIMPL idiom + std::map. It avoids the mess only ObjC++ sources can include foo.h. foo.h: @class Foo { struct FooPriv *priv_; }; foo.mm: struct { std::mapint, boost::shared_ptrCppBaseClass value_map; } FooPriv; - (id) init { if( self = [super init] ) { priv_ = new FooPriv(); } } - (void) dealloc { delete priv_; [super dealloc]; } etc... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: executables for OSX 10.4 vs 10.5
Am 17.10.2008 um 01:24 schrieb Stefan Werner: The only drawback is you get partially buggy, backward compatible behavior on Leopard when you link against the 10.4 SDK. Can you elaborate? I was under the naive assumption that as long as I don't use any 10.5-only APIs the 10.4 SDK and the 10.5 SDK should behave the same. Simple example: IIRC, the result of [[NSNumber numberWithUnsignedShort:0x8000] intValue]; varies depending on the SDK linked against. 10.4 gives you a sign extension and a negative value, 10.5 returns 0x8000. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: executables for OSX 10.4 vs 10.5
Am 15.10.2008 um 02:10 schrieb Michael Williamson: Or is there some way to build a single app that runs on both and if so are there any drawbacks to doing this? The only drawback is you get partially buggy, backward compatible behavior on Leopard when you link against the 10.4 SDK. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Animating view transitions with Core Animation (problems with BasicCocoaAnimations sample)
Am 14.10.2008 um 00:51 schrieb Jim Correia: Problem #3: My current hack is to begin the implicit animations in a group, and use a perform delayed action to cleanup after the animation (based on the groups interval.) This feels like a hack though. Is there a better way? I don't have a robust, good solution. but if you set the CAAnimationGroup delegate you might get the animationDidStop delegate method called. Based on my empiric testing the gotcha is a.) to know which views need cleanup one needs unique delegate objects b.) the delegates are not guaranteed to be called - when an animation gets reapplied during a running animation the delegate method is not invoked, which introduces the problem of releasing the cleanup- delegates... Maybe someone at Quartz-Dev has some better ideas (I need als a solution for #3. My hack to remove subviews after they are animated out - of - frame needs some serious improvement..) Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: While we're on the subject of DMG's for software distribution...
Am 09.09.2008 um 12:53 schrieb Bill Cheeseman: on 2008-09-08 11:31 PM, Chris Markle at [EMAIL PROTECTED] wrote: I'd prefer to ship this as a DMG... But if I understand DMG-based delivery correctly, the idea is that Mac users are used to this and know to copy the application bundle to the Applications folder. Apple currently recommends that ALL applications be delivered in the form of an installer. The quoted paragraph means an Apple installer, not an installer Leopard leverages these features to provide users an improved install experience. *LOL* Well, dreaming is legitimate... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: View animator, how to do explicit animations / animation groups?
Am 03.09.2008 um 17:06 schrieb Matt Long: Are you trying to remove views or animations? Animations are removed from a layer by default which can be overridden in the removedOnCompletion property (in CAAnimation) in an explicit animation. I need some trigger to remove views when their move out of sight view animation (not layer animation..) is done.. If you're trying to remove views, however, your code is wrong. You need to find the view you want to remove and remove it from its superview by calling -(void)removeFromSuperview. The question is how do I set up a explicit view animation (group) so I get an (delegate) callback once the animation is done.. My second code snippet should set an NSDictionary for animation, but that change still doesn't make it work... Also, why do you need to remove the view if it's not visible any longer? The view is moved to an active slot in another view. Actually, simultanous to the move out, a copy is animated to move in in another view... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Preventing windows from being dragged
Am 22.08.2008 um 05:31 schrieb Kyle Sluder: . In my mind, I have a choice: either make the control interface a standard OS X app, allowing users the full functionality of the computer, or make a kiosk app that runs on some stripped-down Linux distribution in single-user mode. I still haven't determined which I'll do. I opted for some CoreAnimation based simplified interface. Most striped down Linux installs I've seen tended to end up.. erm.. with plenty room for visual improvements. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: File Extensions Problem
Am 22.08.2008 um 17:23 schrieb Michael Ash: On Fri, Aug 22, 2008 at 6:23 AM, Graham Cox [EMAIL PROTECTED] wrote: safe to delete items in the array at or higher than the current index. By the definition of an array, removing an item only affects the indexes of objects with equal or greater indexes than the removed item. You are making a big, unwarranted assumption about how reverseObjectEnumerator works. Namely, you are assuming that it merely tracks an index, and uses -objectAtIndex: (or equivalent) to retrieve each object. actually, there was an extensive thread last year. It seemed each enumerator created surprisingly a copy of the array, giving the OP some memory (or performance?) related trouble. IIRC it was the combination of a tight loop with tons of enumerators w/o local autorelease pools. Fast enumerators probably changed the rules since Tiger. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Parse form values from HTTP POST
Am 20.08.2008 um 22:54 schrieb Jesse Grosjean: Does anyone know what the best way to parse form values from and HTTP Post is? I have a mini HTTP server in my app, and it needs to accept posts. I'm using CFHTTP to implement the server, so I have a CFHTTPMessageRef. I'm trying to figure out how to turn that into a dictionary of keys and values. Is there an API that can do this, or any example code around? No solution (debugging POST packets sucks IMO...) but all the Web API hype is now with AJAX + REST, which uses HTTP GET + everything is in the URI - are you sure you need POST? Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Parse form values from HTTP POST
Am 21.08.2008 um 04:07 schrieb Jesse Grosjean: So now at least I have a more specific question. Is there any OS X framework for decoding x-www-form-urlencoded, or sample code floating around. I've found what I need in Java: http://kickjava.com/src/java/net/URLDecoder.java.htm And while it's not that much code, it seems like the kind of thing that must have been done before. Anyway I'll start on my own implementation, but if someone can point me to an existing solution for decoding x-www-form-urlencoded that would make my day :) isn't that java code is just [urlString stringByReplacingPercentEscapesUsingEncoding:encodingFromHTTPHeader]; ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
Am 21.08.2008 um 05:03 schrieb Michael Ash: There was a common perception that NULL is not really the same as nil. But seems like in the end it really is (void*)0. They differ in type, not in value. NULL is (void *) 0. nil is (id) 0. Nil is (Class) 0. This is true conceptually but not as far as their actual definition. NULL can be either 0 or (void *)0. Let's be a little bit more precise, I'll try to paraphrase correctly from my memory: a.) (int) NULL is NOT required or guaranteed 0x0 by the standard. This is why one should never use if( anPtr == (void *) 0 ); instead of if( anPtr == NULL ); On modern machines, it usually is. b.) At least the C++ standard mandates for type conversion of an pointer to an boolean, that e.g. ( !anPtr ) is equivalent to ( ! (anPtr == NULL )). I didn't read the C99 spec but I'm sure there is something similar specified. This implementation detail does probably not matter on most platforms today as even microcontrollers have AFAIK linear address spaces. When I was writing my first C app on a DOS machine, there were segmented addresses. That meant it could happen that ((somePtr + offset) - offset) == somePtr evaluated to false - (somePtr + offset) changed the segment, anotherPtr - offset did not. Big debug surprise for poor little 68020 fanboy ;-) Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
Am 21.08.2008 um 05:25 schrieb Clark Cox: Not sure what you're trying to say. According to the C standard, given a variable (foo) the following are identical: if(!foo) if(foo == '0') YIKES! (NULL == (char_type_t) 0x30 ) != ( NULL == '0' ) ? C99 or C99 + C++98? Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: !foo vs foo == nil
Am 21.08.2008 um 11:04 schrieb Negm-Awad Amin: Sometimes you see in source code something like this: if( booleanVarOrExpression == YES ) (I think, Rentzsch does it that way, IIRC) and Ithink, that this is simply correct. Oh, that is another discussion. Bool != Boolean != bool, and sometimes that can introduce subtle errors if it's not only used to evaluate logical statements but by comparing values, especially to YES, true and TRUE. In an large C++ Cross-Platform project I spotted some subtle problems, IIRC from assignment of an bool to an Boolean for an API that evaluated the values by comparison to TRUE or some code assigned it to ints, giving different values for true (1 vs. 0xFF vs. 0x). I don't know any more, fixed it, was glad my own coding practices don't leave room for that problems, moved on ;-)... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ObjC 2.0, properties, KVC, special _ hacks etc.
Am 22.08.2008 um 00:59 schrieb Dave MacLachlan: Also, are the _ in front of member variables for Apple only (so we don't stomp on each other with member var names) or are they using them for the readability reason mentioned above? There is documentation where they have claimed _ at the beginning of method names as being Apple only, but nothing about method vars, and the KVC compliance docs seem to imply that it is fine to do. Officially it is Apple only, but everybody and his dog uses it - in consistency to quite some Apple-provided samples. Also, in C++ the _ variable prefix is reserved for stdlib- implementation. The reasoning why many people do not consider it as problematic if there is a collision with an Apple defined _ prefixed ivar is you will see an compiler error once there is a collision. For methods OTOH, you don't get an warning but potential runtime crashes and undefined behavior. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa and SOAP without WebServicesCore
Am 12.08.2008 um 22:26 schrieb patrick machielse: Now I find myself having to deploy to a platform where not even this feeble API is available. I've been investigating alternatives, and found the gSOAP library, which at the moment looks like the best candidate. However, ideally I would like to use a pure Cocoa solution, or a project which has existing Cocoa wrappers. Does anyone have experiences with gSOAP on OS X, or know of a good alternative? a.) it works but can be hell if you have to debug, especially if you have to load 100kb+ generated source files in Xcode. b.) IANAL, but a Cocoa enabled platform w/o WSCore might be in conflict with the GPL the royalty-free usage of gSOAP demands IIRC. c.) Alternatives also depend on how many calls the target API has. i.e. Setting up and compiling gSOAP takes some time. Packet-sniffing the communication of http://www.ditchnet.org/soapclient/ and creating the comm with a combination of printf' to a XML template string, NSURLRequest and parsing results with libXML takes another amount of time. Sometimes the later is more effective (e.g. for some primitive gimme weather at ZIP code 12345 SOAP API). SOAP was meant to be simple (the S in SOAP), and just became hard to deal with due to some overengineered parameter / packet format. With packet-to-send templates it should be straightforward to handle. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem with friend function and gcc 4.2 with objective-c++
Am 09.08.2008 um 16:32 schrieb Clark Cox: On Sat, Aug 9, 2008 at 2:20 AM, Thomas Engelmeier [EMAIL PROTECTED] wrote: Am 08.08.2008 um 00:09 schrieb Ken Worley: friend != static, and even then this probably would not be valid semantics. test1* tobj = newtest1(5); has nothing to do with test1::newtest1( int ) or aTest1Instance-newtest1( int ) I believe that you are incorrect. This is a perfectly valid way of defining friend functions in C++. Defined this way, newtest1 is a global function (i.e. it is not scoped to test) that is allowed to access the private/protected parts of test1 instances. From the C++ standard (11.4 paragraph 5): A function can be defined in a friend declaration of a class if and only if the class is a non-local class (9.8), the function name is unqualified, and the function has namespace scope. [Example: class M { friend void f() { } //definition of globalf, a friend ofM, //not the definition of a member function }; —end example] Such a function is implicitlyinline. Afriendfunction defined in a class is in the (lexical) scope of the class in which it is defined. OOPs.. OK, I just did some cursory research how the friend syntax (I rarely used) is like... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: DICOM images in Cocoa
Am 13.08.2008 um 10:55 schrieb Ken Ferry: Implementing an NSImageRep subclass is pretty similar to implementing a custom view. Is there an similar concept of QuickTime Graphics Importers, i.e. system wide extensible formats ImageIO and / or NSImage can handle, possible? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa and SOAP without WebServicesCore
Am 13.08.2008 um 11:06 schrieb patrick machielse: a.) it works but can be hell if you have to debug, especially if you have to load 100kb+ generated source files in Xcode. Hmm, thanks for the warning. On the other hand, the documentation of gSOAP, and the available recourses on the web, seem to be far superior to what's available for WebServicesCore. Yepp, still it's not a lightweight addition. IIRC I had some internal (resolvable) typedef conflicts compiling using CodeWarrior, and some sorts of trouble until generated stubs from some WSDL were OK. b.) IANAL, but a Cocoa enabled platform w/o WSCore might be in conflict with the GPL the royalty-free usage of gSOAP demands IIRC. gSOAP is available under several licenses (and is used by big name software houses) so I believe this should not be a problem (knock on wood...) I reread them and the MPL derivate seems to be fine. I wasn't aware of that option. c.) Alternatives also depend on how many calls the target API has. creating the comm with a combination of printf' to a XML template string, NSURLRequest and parsing results with libXML takes another amount of time. Sometimes the later is more effective (e.g. for some primitive gimme weather at ZIP code 12345 SOAP API). I have been considering this approach, and it could work for the simpler cases. However, I need to interact with more mature services as well, API that will return complex types and structured data, and it would be nice to have a more robust mechanism under the hood that would handle server communication, authentication, and the conversion to and from Cocoa objects automatically. Except for the later you probably will be fine.. Automatic Cocoa (de-)serialisation won't happen, you´ll need to write adapters manually for that. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problem with friend function and gcc 4.2 with objective-c++
Am 08.08.2008 um 00:09 schrieb Ken Worley: Hi all, I'm using Xcode 3.1 and just switched to gcc 4.2 from 4.0, but I've run into a problem with friend functions when compiling in objective- c++. I contrived an example that illustrates the problem: [...] This project builds fine using gcc 4.0, but when I switch the compiler setting to use gcc 4.2, I get the errors listed below. Any clues would certainly be appreciated if I'm doing something wrong. If not, I guess I'll file a bug... Here's main.m: #import Cocoa/Cocoa.h class test1 { public: friend test1* newtest1(int x) { test1* anobj = new test1(); anobj-finishinit(x); return anobj; } [...] }; int main(int argc, char *argv[]) { test1* tobj = newtest1(5); delete tobj; return NSApplicationMain(argc, (const char **) argv); } friend != static, and even then this probably would not be valid semantics. test1* tobj = newtest1(5); has nothing to do with test1::newtest1( int ) or aTest1Instance-newtest1( int ) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: autorelease CGImageRef?
Am 07.08.2008 um 17:24 schrieb Chris Hanson: This appears correct, except for the fact that, for reasons known only to Apple, although CFMakeCollectable is available in 10.4, the trivial NSMakeCollectable macro is available only in 10.5. If you build with the Mac OS X 10.5 SDK, you should be able to use NSMakeCollectable since it's declared as an inline function. The earliest release of Mac OS X you're targeting is a function of the Mac OS X Deployment Target build setting, not the SDK. In theory: - The Xcode 2.4 10.4 SDK allows deployment on ANY 10.4 version, - The Xcode 2.5 / 3.x SDKs for 10.4 and 10.5 SDKs allow deployment on recently updated 10.4 versions: http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/ These differences are AFAIK not covered in any release notes. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: autorelease CGImageRef?
Am 08.08.2008 um 16:23 schrieb Jean-Daniel Dupas: In theory: - The Xcode 2.4 10.4 SDK allows deployment on ANY 10.4 version, - The Xcode 2.5 / 3.x SDKs for 10.4 and 10.5 SDKs allow deployment on recently updated 10.4 versions: http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/ Only as long as you set the deployment target to 10.4 of course. An application compiled using 10.5 SDK and deployment target sets to 10.5 will not run on 10.4. Well, personally I'd expect an app linked against the 10.4 SDK from Xcode 3 / 2.5 to run on any version of 10.4, otherwise I'd expect it's name to be like 10.3.9 SDK. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Sign extension in NSNumber / 10.4 SDK???
Hi, I'm running into problems with [NSNumber numberWithUnsignedShort: 0x8000]. The following app returns the expected values when compiled against the Leopard SDK. Compiled against the 10.4 SDK, I get: NSNumberTest[6058:813] 8000 (expected:8000) 8000 (expected:8000) -32768 (expected:32768) int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; // insert code here... NSNumber *aNumber = [NSNumber numberWithUnsignedShort:0x8000]; NSLog(@%x (expected:8000) %x (expected:8000) %@ (expected:32768), [aNumber unsignedShortValue], [aNumber intValue], [aNumber description]); [pool drain]; return 0; } What are my best options to get around that? (Except of using the next larger NSNumber variants to store unsigned values in order to prevent unwanted sign expensions for unsigned values)? TIA, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Sign extension in NSNumber / 10.4 SDK???
Am 17.07.2008 um 18:55 schrieb Jens Alfke: What are my best options to get around that? (Except of using the next larger NSNumber variants to store unsigned values in order to prevent unwanted sign expensions for unsigned values)? Either require 10.5, or use a larger size. The problem is that NSNumber is just a bridge to CFNumber, which didn't support unsigned types until 10.5. So on 10.4, the fact that you were storing an unsigned 32-bit value got lost when you created the NSNumber. Thanks for confirming. I'll probably end up writing enhancement requests to documentation so this behavior gets documented. I can't demand Leopard in that case as it's a Tiger-targeting PTP implementation working around some Image Capture shortcomings. It ran into pretty some problems mixing and matching my stored (int based) key-value lookup tables with camera returned (uint16) values after switching from (Leopard only) prototype to an Tiger SDK elaborated prototype.. Best Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to tell if iTunes is running.
On 24.05.2008, at 21:05, Steve Christensen wrote: Would something like this work better? It should deal with localization or if the user renames iTunes for some reason. For third party software you'd be right - Apple does not localize the names of iTunes / iPhoto / iDVD (browse through the *.jproj/ infoPlist.strings) and AFIAK does not handle renamed or moved variants in their updaters, so people renamaing iApps face trouble anyway... Best regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ImageCapture API versions
On 21.05.2008, at 22:39, Rick Mann wrote: On May 20, 2008, at 12:28:22, A.M. wrote: Which camera is this? Image Capture has no native API for remote control Actually, PTP has an specified command (getProperty / setProperty) and IIRC Image Capture SDK for 10.4 had a functional equivalent. Unfortunately - ImageCapture grabs the few default properties it knows about at device connect time and caches them - Leopard IIRC deprecated the get/setProperty equivalents so one has to resort to PTP pass-through - Last !least Canon (in contrary to Nikon) uses custom commands to access most properties. you could potentially use PTP pass-through if you have the camera protocol docs or reverse-engineered protocol info. The protocol will definitely be PTP, so one has to reverse engineer only the transfered data. While it's trivial for most tasks, I couldn't get it to work yet for live video from my D300. I had hoped it would do better than what you're describing. Actually, it _is_ better. You really should try the (10.4) Image Capture SDK samples. Just don't waste your time trying to manipulate shutter speed / aperture etc. with it. My comments above regard _full_ control of a DSLR, like the 80 internal settings of a Nikon D80 or 100+ of a D300 DSLR Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Cocoa et al as HCI usability problem
On 22.05.2008, at 00:58, Rua Haszard Morris wrote: 1 Apple's docs, particularly in relation to Objective-C Cocoa, have some room for improvement: - e.g. navigation (can't go back to list of methods after clicking a method name hyperlink for example) - lack of and generally un-useful sample code Well, there are tons of samples. However they are scattered and if you don't need you need MagicFoo, you cannot use google to locate MagicFoo. And some people work on the road, sometimes without constant google access. I prefer for conceptual work to move to a 16th century monastry and sometimes can not prototype my ideas because some required samples that take conceptual doc role didn't make it yet to my harddisk... 2 Cocoa requires you when learning to implement things by clicking and dragging, which makes learning harder for some people (this is a real annoyance to me, why can we not see/edit these connections in a text file? why is there so much other crap in the nib xml? etc). That's only part of the issue. The sample code - the part one can read up - is only part of the equation. The setup, implicit code graph etc. is hidden in the nib and usually completely undocumented. There is the outline view depicting in Interface Builder the object interconnection. However, Interface Builder bottom line fails to provide an good overview of the NIB innards to navigate to points of interest: - an overview for bindings - small badges a view has associated bindings, core animation properties and IB connections. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: ImageCapture API versions
Am 20.05.2008 um 21:26 schrieb Matt Long: It's included for 10.5. I don't think you want Image Capture for your app, though as this API is mainly for downloading images from the camera after a photo shoot. I don't believe there is any mechanism for causing the picture to be taken (from a button click in your app for example). Believes won't help you ;) ImageCapture is an wrapper layer around PTP and Twain. Cameras are accessed via PTP. Whether a camera allows picture taking to be controlled (aka tethering) depends completely on the camera firmware. Just as a sample matrix for DSLRs: The Konika-Minolta / Sony implementation is pathetic. It allows to download taken images, no access to any camera internals Canon implementation is nice. They have a baseline feature set (download images, grab new pictures, change a few camera properties) Nikon implementation is also nice. Same as Canon with additional access to nearly all camera settings Olympus implementation: Designed with the low-end consumer in mind. Camera asks you which USB protocol (Mass storage or PTP) to use, then allows access to some properties and IIRC making remote shots. QTKit is probably more appropriate from what you're describing. You could start here: http://tinyurl.com/4rtab7 for that. QTKit allows to manage media in movies. QTCapture is an API for access to video cameras!?! Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: BLOBs, MySQL, hex. Oh my
On 08.05.2008, at 21:27, Ben Einstein wrote: I was very surprised that exactly what you're describing didn't work for me. I never tested it with an NSImage but it definitely fails with a zip archive. I get an unable to read pkzip package error from ditto. I'll try it with an image and see what happens. I still don't know why there would be a difference. The why is the secondary issue. The first question should be what + where is the difference. Dump both data to a binary file and compare them with a file comparison tool / binary diff. Every time I had a similar problem that was the first step to finding a solution. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: QTMovie grabing while playback
On 25.04.2008, at 11:17, Bob Smith wrote: Well, I'm glad I had an excuse to play around with Quartz Composer; I knew about it but had never spent any time with it, very cool! Unfortunately, it doesn't solve my immediate problem. As far as I can tell, compositions won't play streaming video at all. They work great with movies from files, and with local live sources (iSight, DV). But giving the Image With Movie patch an .sdp file just results in a static QuickTime logo, it never shows any actual video. IIRC QCPerformer is the sample that shows how to - use a CVDisplayLink for VBL-synched movie decoding - feed the result via OPenGL into Quartz Composer, that might be what you want to throw into the QCTV source mixer... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Getting current NSViewAnimation coordinates
Hi, I have some code that sometimes needs to cancel aka stop a running NSViewAnimation and start another. It seems on Tiger the real view coordinates are animated but on Leopard only an proxy is anmiated.. - on Leopard the view with the stopped animation is very visibly redrawn at the original coordinate and before the new animation starts. Is there any way to gather the calculated animation coordinates short of interpolating the (end - start) * currentValue coordintes myself? TIA, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to store NSRect as Core Data attribute?
On 02.04.2008, at 18:12, Ben Lachman wrote: I think the easiest way to encode/decode NSRects for storage is NSStringFromRect() and NSRectFromString(). Then you can just implement a custom accessor for the property that converts in the direction you need. That potentially means opening Pandoras can to localisation issues. Any time you go that route, be sure to check that code with switching decimal separators. In my opinion it sucks like hell when your Pages document containing a table has all numeric data messed up due to unparseable numbers... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Thread safe?
Am 30.03.2008 um 17:01 schrieb Adam R. Maxwell: On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote: On 29.03.2008, at 18:54, Adam R. Maxwell wrote: Drawing into an NSImage is explicitly documented to be thread safe in the article you linked to, and each thread has its own graphics context. The post I linked to does indicate that you might want to use [image setCacheMode:NSImageCacheNever]. If your goal is just to get an NSBitmapImageRep from a file, it's probably easier just to use +imageRepWithContentsOfFile:. While it is documented to be thread save you might get crashes later when an NSBitmapImageRep created by drawing into from an secondary thread gets drawn itself. The crash occurs when the image tries to access an NULL (offscreen) window context (it probably was originally drawn into). Tried to debug that on 10.5.2 (and simply worked around)... That's interesting. Was it an NSBitmapImageRep or NSImage/ NSCachedImageRep? I didn't think a bitmap context would be associated with a window context like that. Either way it doesn't sound good, though. Well, actually an NSTIFFImageRep. The crashing code (other thread, much later, ...): NSData *data = [anImage TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0]; /* gives an crash in FREED(id): message _tryLockViewHierarchyForModification sent to freed object=0xeee5b40 #1 0x90063ef0 in __objc_error () #2 0x900628f7 in _freedHandler () #3 0x92f807c2 in _NXAllocateImageCache () #4 0x92f83458 in -[NSCachedImageRep window] () #5 0x92f83202 in -[NSImage _getCacheWindow:andRect:forRep:] () #6 0x9307fa8e in -[NSImage TIFFRepresentationUsingCompression:factor:] () #7 0xcf13d7b4 in -[iMBMoviesView saveImageForPath:] (self=0xee42830, _cmd=0xcf1528f6, imagePath=0xeef4e60) at /Development/Sources/ googlecode/imedia-nsview-branch/branch20080218/iMBMoviesView.m:225 */ The creation code (two variants): /* TE: work around an NSImageCache bug !?! */ [image setScalesWhenResized:YES]; [image setSize:newSize]; #if 0 NSData *tiffData = [image TIFFRepresentation]; NSBitmapImageRep *tiffRep = [NSBitmapImageRep imageRepWithData:tiffData]; NSImage *newImage = [[NSImage allocWithZone:[self zone]] initWithSize:newSize]; [newImage setScalesWhenResized:YES]; [newImage addRepresentation:tiffRep]; #else NSImage *newImage = [[NSImage allocWithZone:[self zone]] initWithSize:newSize]; [newImage setScalesWhenResized:YES]; [newImage setDataRetained:YES]; //?[newImage setCachedSeparately:YES]; [newImage lockFocus]; [image drawInRect:NSMakeRect(0.0f, 0.0f, newSize.width, newSize.height) fromRect:NSMakeRect(0.0f, 0.0f, size.width, size.height) operation:NSCompositeCopy fraction:1.0f]; [newImage unlockFocus]; #endif return [newImage autorelease]; Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Thread safe?
On 29.03.2008, at 18:54, Adam R. Maxwell wrote: Drawing into an NSImage is explicitly documented to be thread safe in the article you linked to, and each thread has its own graphics context. The post I linked to does indicate that you might want to use [image setCacheMode:NSImageCacheNever]. If your goal is just to get an NSBitmapImageRep from a file, it's probably easier just to use +imageRepWithContentsOfFile:. While it is documented to be thread save you might get crashes later when an NSBitmapImageRep created by drawing into from an secondary thread gets drawn itself. The crash occurs when the image tries to access an NULL (offscreen) window context (it probably was originally drawn into). Tried to debug that on 10.5.2 (and simply worked around)... Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Best Way To Lookup From a Huge Table
On 21.03.2008, at 21:51, John Stiles wrote: std::map actually does more than NSDictionary—it sorts its entries instead of keeping them in random order. Also, it copies its keys instead of just keeping a reference to them, which is also more work— it would be a much fairer test if you used std::string* pointers for your keys and values instead of std::string objects, but it'd also be a little more work since you'd need a custom comparator and you'd need to consider memory management (which boost smart pointers apparently can manage pretty well). No need to pull in the whole boost overhead for smart(er) pointers as of gcc 4.0. #include tr1/memory using std::tr1::shared_ptr; And for the presorting time - TR1 includes also an unordered_map and unordered_set. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to make a UI like in Mail?
On 12.03.2008, at 23:54, Thomas Wickl wrote: I´m new to Cocoa and I really need a hint in UI Design. How can I create this Panel like it is shown in a lot of Application like Mail? That is not a panel (a panel is a window with a small title bar), it is a source list, a special case of a outline view. Starting with Leopard, you can use the system NSOutlineView. For Tiger there are some opensource implementations floating around. What you won't get with most implementations are the unread message badges. And also how do they make this Bar at the Bottom? The only real answer to that is Use FScript to find out. http://www.fscript.org . You'll need to download a separate version of FScript Anywhere for Leopard. Apple is usually not eating it's own dog food, Apple apps notoriously use their own UI implementation. If you are interested how _you_ can achieve something similar, there is a chance to build a view containing some NSButtons with gradient look and either add manually the pulldown functionality to them or use an NSPopupButton and tinker with the menu contents so it always shows the icon and not the selected item. The NSActionTemplate and NSAddTemplate should also be handy. Many goodies (gradient look, system provided images) are Leopard only. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: performSelectorOnMainThread problem
On 13.03.2008, at 02:27, Nick Rogers wrote: In my secondary thread I'm doing: [self performSelectorOnMainThread:@selector(updateProgress) withObject:data waitUntilDone:YES]; with the error that self does not recognize the selector updateProgress. I have imported the main AppController.h into this secondary class file. still the problem. You have two errors here: - regardless which object implements the method, you need to send the message _to that object_ and not to self. Importing some header is not the magic bullet, Objective-C can not guess which object might want to handle the message. - the signature in @selector() is for sure wrong when you supply an argument in withData:. It lacks the trailing ':'. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What is the status on the New Cocoa 2.0 Books?
On 13.03.2008, at 04:03, Jens Alfke wrote: Part of the fun of being an early adopter is that you have to figure stuff out before there are books to explain it. It's your choice; you could wait six months or a year for some books. But then you won't be one of the first. (Actually, the current docs are quite good, all things considered. Back in the day, the system documentation used to consist of badly- Xeroxed copies of napkins that the programmers had scrawled some instructions on, while suffering from exhaustion and caffeine psychosis. And the developer program charged you $1200 a year for those, and didn't even give you a damn binder to put them in. And we lapped it up!) Maybe it paid off to be a late adoptor. Inside Macintosh:AppleTalk and New Inside Macintosh:Quicktime / New Inside Macintosh:Interapplication Communication set a very high standard for documentation - far higher than the IBM UI guidelines and the Windows 3.x docs from that time. The current reference might be neat, but IMO it lacks severely what made up the NIM series: Describing the architectural goals of an given API. Frankly, I consider NSCollectionView displays an array of content as a grid of views. as sole overview and description less than sufficient. The intro in the headstart movie is at least more comprehensive but a text search won't find it. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: What is the status on the New Cocoa 2.0 Books?
On 13.03.2008, at 13:39, Jeff LaMarche wrote: On Mar 13, 2008, at 5:43 AM, Thomas Engelmeier wrote: Maybe it paid off to be a late adoptor. Inside Macintosh:AppleTalk and New Inside Macintosh:Quicktime / New Inside Macintosh:Interapplication Communication set a very high standard for documentation - far higher than the IBM UI guidelines and the Windows 3.x docs from that time. Inside Macintosh was a great series, but the versions you refer to really were a 2.0 version of the toolbox documentation. The original Inside Macintosh volumes, though far better than much of the developer documentation of the day, came in numbered volumes that were less than perfectly organized. Except the last IM volume (essentially describing System 7). We also had to contend with the fact that all the code examples were written in Pascal early on, long after most developers had switched to C. I considered the differences rather minor compared to e.g. other OOP languages vs. Objective-C. One could take the Pascal source and simply change some minor syntactic sugar... The current reference might be neat, but IMO it lacks severely what made up the NIM series: Describing the architectural goals of an given API. Pointing out a terse description in one fairly new class (it's new with Leopard) is hardly indicative of the overall quality of the developer documentation, which is excellent. In many places, Apple goes into great detail about the architecture underlying a particular framework. Fair enough, the Programming Guides and not References are the equivalent to NIM. [...] The fact that even before Leopard shipped to the public, we developers were able to option double click on that class in Xcode and get an accurate description of its methods and properties is pretty amazing, and I find it hard to believe anyone would prefer going back to the days of dead tree Inside Macintosh documentation. Call me old fashioned, I like the dead tree to grok an concept [i.e. read Programming Guide books]. Even with the chance to get all the NIM: QuickTime content as online docs I preferred to take out my dead tree version and enjoy reading it comfortable outdoors to refresh some details. 1200+ dpi is still far superior to 72dpi ;-) [...] but I still say we're spoiled. Exactly my point. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: runtime error
On 12.03.2008, at 14:34, Daniel Child wrote: In the process of parsing thousands and thousands of records and placing (most of) them in a table which I want to save to disk, Table you want to save to disk? DUH? You know, I'm currently programming the thingy that interacts with the great FooBar. Is that a good design, and if not, what shall I improve? Also, what tools might help? Object Alloc or Instruments I thought I was quite careful about the memory rules. Is it possible that I am simply building too large a table and need to change my approach? Potentially, if all your data management is based of creating tons of Foundation subobjects in whatever Foundation container. They have some associated memory footprint that might be highly reduced. You wouldn't, e.g., want to represent an image as an rows NSArray containing an columns NSArray containing NSNumbers. Regards, Tom_E ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]