How to set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Rick Mann
Hi. I've got a popup button with a bunch of GMT offsets configured in  
IB, and bound via selectedTag to an NSArrayController's selection's  
gmtOffset property. Each item in the menu has a tag value set. The  
binding is properly setting the values of the selection, even if  
multiply selected, and the popup properly updates as the selection  
changes.


I'd like to display some custom text in that popup when there are  
multiple values in the selection. But I'm pretty sure I need to  
specify a tag value in the "Multiple Values Placeholder" field in IB  
(under the selectedTag binding of the NSPopupButton), but I don't want  
to create an item in the popup menu just for this value; that would  
imply (and allow) the user could select it, which wouldn't make sense.


What's the right way to do this?

TIA,
--
Rick

___

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: LMSetKey[Rep]Thresh

2009-05-18 Thread Jean-Daniel Dupas


Le 18 mai 09 à 08:27, Eric Schlegel a écrit :



On May 17, 2009, at 9:37 PM, Christopher Hansen wrote:

First of all, I want to be able to set them, so I primarily need  
the setters, but I also want the getters because I want to be able  
to restore the previous values when my app exits or is swapped out.


LMSetKeyRepThresh turns into this:

   NXEventHandle handle = NXOpenEventStatus();
   NXSetKeyRepeatThreshold( handle, inValue );
   NXCloseEventStatus( handle );

which I believe is all public API (if poorly/un-documented).  
However, I'm not sure if this has any effect if you're not running  
as root; you'll have to try it.


Second, my goal is to move entirely to Cocoa since, as I understand  
it, support for Carbon is being frozen with the release of Snow  
Leopard.  So, I'm currently in the process of removing all of my  
Carbon dependencies.  However, I'm just fine with C APIs, and, in  
fact, I'm retaining all of my CGL code since it would completely  
break my platform independent architecture -- which separates the  
rendering layer from the application/event handling layer -- to use  
Cocoa for my rendering.


In this particular case, I'd almost recommend sticking with  
LMSetKeyRepThresh. The NX-level APIs are nearly as deprecated as  
Carbon API in this case. Probably a good idea to file a bug  
requesting a Cocoa-level API to do this.


IIRC, you can also query these values using lower level functions (but  
I dont know if the setter works):


  kern_return_t kr =  
IOServiceGetMatchingServices(kIOMasterPortDefault,   
IOServiceMatching(kIOHIDSystemClass), &iter);

  service = IOIteratorNext(iter);
  kr = IOServiceOpen(service, mach_task_self(),   
kIOHIDParamConnectType, &sSystemService);
  kr = IOHIDGetParameter(service, CFSTR(kIOHIDKeyRepeatKey),  
(IOByteCount)sizeof(value), &value, &size);


___

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


iPhone Generating and displaying images using Bitmap

2009-05-18 Thread Shraddha Karwan
Hi,

I have a buffer containing JPEG image data. I need to display this buffer in
form of images. I copied this buffer to a file and then used the following:

CGDataProviderRef ref = CGDataProviderCreateWithFilename([appFile
UTF8String]);
CGImageRef imgRef =
CGImageCreateWithJPEGDataProvider(ref,NULL,YES,kCGRenderingIntentSaturation);
UIImage *theImage = [[UIImage alloc] initWithCGImage:imgRef];

Then displaying the image.
For some images I get the images but for some I get the JPEG Image corrupt
error message.
When I test the same data with Windows application it is able to display the
image without any error.
Is my conversion from JPEG buffer to UIImage file appropriate or am I
missing out some thing?
___

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: LMSetKey[Rep]Thresh

2009-05-18 Thread Chris Hanson

On May 14, 2009, at 10:45 AM, Christopher Hansen wrote:

I'm writing a game and I need to set the key and key repeat  
thresholds in my Cocoa application.  The functions needed to do to  
this under Carbon (Events.h) are:


LMGetKeyThresh
LMSetKeyThresh
LMGetKeyRepThresh
LMSetKeyRepThresh

I'm looking for the Cocoa equivalents.


Unlike the other responses, I'm going to take a different tack:

Since you're writing a game, you probably don't want to worry about  
key repeat thresholds, either getting or setting.  Instead, you should  
care about key/button down and key/button up events, and map those to  
state in your game engine.


The reason is that your game probably has its own internal concept of  
"repeating" that may not map at all to the typing concept of  
"repeating."  An example would be a first-person shooter that supplies  
an automatic weapon:  Different weapons will have different rates of  
fire.  You may even have an energy weapon that fires as long as the  
user is (conceptually) pulling the trigger.


This is a game-engine level concept, not something you should try to  
map to input handling necessarily.  Just use your input handling to  
supply your game engine with the necessary information.  For the most  
flexibility in doing this take a look at the HID Manager APIs,  
especially the new HID APIs introduced in Mac OS X 10.5 Leopard.


  -- Chris

___

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


How to implement to create a new directory in a specified path and....?

2009-05-18 Thread Bright
Hi ,all
I completed an application about tableview and audio files. Allow you to 
drag  audio files into the tableview .
It will play the audio file if you double click the tableview's cell.
Now, I want to implement this result. When I drag and drop a sound file 
into the tableview, I want
the App to create a new directory in a specified path and copy the audio file 
into the directory. 
In other words, I want to create a library to store my audio file. How to 
implement it?
Thank you.
Bright
   

___

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 implement to create a new directory in a specified path and....?

2009-05-18 Thread Chris Gardner

 

NSString * cPathName;// cPathName is your specified path

  

NSFileManager *fm = [NSFileManager defaultManager];
 [fm createDirectoryAtPath:cPathName withIntermediateDirectories:TRUE 
attributes:nil error:nil]; 

 

with which you can create any folder.

 

 
> Date: Mon, 18 May 2009 16:34:24 +0800
> From: ldl0313...@163.com
> To: cocoa-dev@lists.apple.com
> Subject: How to implement to create a new directory in a specified path 
> and?
> 
> Hi ,all
> I completed an application about tableview and audio files. Allow you to drag 
> audio files into the tableview .
> It will play the audio file if you double click the tableview's cell.
> Now, I want to implement this result. When I drag and drop a sound file into 
> the tableview, I want
> the App to create a new directory in a specified path and copy the audio file 
> into the directory. 
> In other words, I want to create a library to store my audio file. How to 
> implement it?
> Thank you.
> Bright
> 
> 
> ___
> 
> 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/chrisgardner%40live.com
> 
> This email sent to chrisgard...@live.com

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx
___

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


Positioning of autocomplete popups

2009-05-18 Thread Dave Robertson

Hi,

I've just implemented an NSSearchField control with autocomplete using  
the delegate method  
control:textView:completions:forPartialWordRange:indexOfSelectedItem:


It appears that the popup list of autocomplete candidate strings  
always pops up below the NSSearchField, even if the search field is  
very close to the bottom of the screen.
Popups for NSPopupButtons or contextual menus adjust their position in  
these circumstances, so that they appear above their base position to  
maximize their visibility.
The autocomplete list quite happily pops up completely off screen -  
but I'd like to provide a better user experience than that.


Is there a way to control the position or appearance of an  
autocomplete popup? I've noticed that autocompletion in Xcode does the  
right thing - is anyone able to suggest how this could be achieved?


Thanks,
Dave Robertson
___

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


Drag and drop query

2009-05-18 Thread Srinivasa Prabhu

Hi all,

	I am trying to drag image files from my application to other  
applications like Mail,iPhoto,TextEdit etc. I am using  
NSFilesPromisePboardType to do this.


This is the code snippet:

	 [inPasteboard declareTypes : [NSArray  
arrayWithObjects:NSFilesPromisePboardType, nil]  owner:self];
	 [inPasteboard setPropertyList:fileTypes  
forType:NSFilesPromisePboardType];


I implemented the following method in my dragSource(IkBrowserview)

 - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)  
dropDestination

{
// here I am creating actual image file
}

This works fine for applications like Mail,iPhoto.
But , when I try to drag files to applications like  
TextEdit,Thunderbird this method never gets called.


Does this mean that applications like TextEdit and Thunderbird do not  
support

NSFilesPromisePboadType ?
If yes, Is there any workaround for this issue?

Regards,
Srinivas.


---
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.
___

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: microsoft file formats in cocoa

2009-05-18 Thread Kirk Kerekes
-- And it is easy to wrap in a Cocoa wrapper -- I've done so. The  
interface is appended to this email.




The libxls open source project on sourceforge.net allows you to read
and parse .xls files. This library works under OSX - I know, I'm one
of the developers :-)



//
//  XLSWorkbook.h
//  PETool
//
//  Created by kkerekes on 12/27/08.
//  Copyright 2008 Safety Training Systems. All rights reserved.
//

#import 
#import "libXLS/xls.h"
@class XLSWorkbook;

@interface XLSWorksheet: NSObject
{
NSString * _name;
NSData * _worksheetRecordData;
NSArray * _rows;
}
+ (XLSWorksheet *) worksheetAtIndex: (uint32_t) idx fromWorkbook:  
(XLSWorkbook *) book;
+ (XLSWorksheet *) worksheetWithName: (NSString *) name fromWorkbook:   
(XLSWorkbook *) book;


- (NSArray *) rowAtIndex: (uint32_t) index;

@property (retain) NSString * name;
@property (retain) NSData * worksheetRecordData;
@property (retain) NSArray * rows;
@property (readonly) NSUInteger rowCount;
@property (readonly) NSUInteger columnCount;
@property (readonly) xlsWorkSheet * worksheetRecord;

@end

@interface XLSWorkbook : NSObject
{
NSString * _path;
NSData * _workbookRecordData;
NSArray * _workSheets;
NSDictionary * _workSheetsByName;
}
+ (NSStringEncoding) xlsStringEncoding;
+ (XLSWorkbook *) workbookAtPath: (NSString *) path;
- (XLSWorksheet *) worksheetAtIndex: (uint32_t) idx;
- (XLSWorksheet *) worksheetWithName: (NSString *) name;
- (NSArray *) worksheetNames;

@property (retain) NSString * path;
@property (retain) NSData * workbookRecordData;
@property (retain) NSArray * worksheets;
@property (retain) NSDictionary * workSheetsByName;
@property (readonly) xlsWorkBook * workbookRecord;
@end
___

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: Invoice program made in Objective c/Cocoa

2009-05-18 Thread Andreas Grosam

On May 18, 2009, at 4:01 AM, Michael Ash wrote:

Perhaps you should have taken more than a first glance. For example,  
here:


http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBasics.html#/ 
/apple_ref/doc/uid/TP40001650


"Core Data is not a relational database or a relational database
management system (RDBMS)."
This is unrelated to the problem. Mike, I think you are using a straw  
man argument - or you totally misunderstood me.


Why would you think I had ever designed a database application or
framework? All I know is, CoreData is *not* a database framework, so
your whining about how it fails some fundamental requirement for
database frameworks makes no sense.
I think you misunderstood me. Core Data could be a very useful *part*  
of a database application framework. But it is not, because it  
apparently lacks the ability to interface to other related parts of a  
database application framework (ORM, data access layer, storage  
management) - at least this is what I conclude from this discussion.



Again, to make this clear: I don't claim that Core Data should  
implement all these layers of a database application framework  (or  
even a RDBMS). And honestly, it should not! Rather it should provide a  
means to interface with them.



And using your car example: having tires is certainly useful. But they  
become even more useful if you can mount them on your car. ;)




Andreas

___

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


Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Chris Idou


The database situation on Cocoa is not great. Apple should spend some of that 
cash hoard building or buying an object database.

If anyone wants an interesting project, the db4o object database which is 
written in Java and GPLed comes with a program called Sharpen which translates 
Java into C#. It occurs to me that translating it into C or objective-c would 
be possible. Nobody would give a rip about core-data if there was a real object 
database available.

On another note, Versant which seems to now run db4o has a very nice object 
database with c bindings that would probably be really easy to write 
objective-c bindings for, but its commercial and much too heavy weight for most 
of our purposes.






From: Andreas Grosam 
To: Cocoa-Dev List 
Sent: Monday, 18 May, 2009 10:47:44 PM
Subject: Re: Invoice program made in Objective c/Cocoa

On May 18, 2009, at 4:01 AM, Michael Ash wrote:

> Perhaps you should have taken more than a first glance. For example, here:
> 
> http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBasics.html#//apple_ref/doc/uid/TP40001650
> 
> "Core Data is not a relational database or a relational database
> management system (RDBMS)."
This is unrelated to the problem. Mike, I think you are using a straw man 
argument - or you totally misunderstood me.
> 
> Why would you think I had ever designed a database application or
> framework? All I know is, CoreData is *not* a database framework, so
> your whining about how it fails some fundamental requirement for
> database frameworks makes no sense.
I think you misunderstood me. Core Data could be a very useful *part* of a 
database application framework. But it is not, because it apparently lacks the 
ability to interface to other related parts of a database application framework 
(ORM, data access layer, storage management) - at least this is what I conclude 
from this discussion.


Again, to make this clear: I don't claim that Core Data should implement all 
these layers of a database application framework  (or even a RDBMS). And 
honestly, it should not! Rather it should provide a means to interface with 
them.


And using your car example: having tires is certainly useful. But they become 
even more useful if you can mount them on your car. ;)



Andreas

___

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/idou747%40yahoo.com

This email sent to idou...@yahoo.com



  Need a Holiday? Win a $10,000 Holiday of your choice. Enter 
now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline
___

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: NSURLConnection set to cache

2009-05-18 Thread Keary Suska

On May 17, 2009, at 9:07 PM, Eric E. Dolecki wrote:

I just want to be sure of something - if I set the images to cache,  
when I
load the same url again, the image is coming from memory - because I  
put in

a progress bar and the images loaded already I thought would have an
instantly populated progress bar, but they still load with progress  
(albeit

quicker).


If you are using the default cache policy, there is no guarantee  
whether the resource is in memory, on disk, or will be reloaded from  
its remote source (although you could make a reasonable assumption on  
the latter). Also, the cache is always validated in these cases, so  
there will always be some latency.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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: Positioning of autocomplete popups

2009-05-18 Thread Ross Carter


On May 18, 2009, at 5:09 AM, Dave Robertson wrote:

Is there a way to control the position or appearance of an  
autocomplete popup? I've noticed that autocompletion in Xcode does  
the right thing - is anyone able to suggest how this could be  
achieved?


IMHO, the default text completion list is uncommonly ugly. Here's one  
approach:


1. In your NSTextView subclass, override complete:. Get the array of  
hits using completionsForPartialWordRange:indexOfSelectedItem:.


2. Filter that list. I don't need the list to contain the word I've  
alrready typed, nor a bunch of words with apostrophe-s appended. Also  
limit the number of hits to a reasonable amount.


3. Put the filtered list in a popup button and draw it.

Ross Carter
___

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


Debugging Information

2009-05-18 Thread ALEXander

Hello,

when the objective C runtime engine throws an exception during  
runtime, I get messages like


2009-05-18 16:31:58.370 Control[27911:813] *** -[NSKeyedUnarchiver  
initForReadingWithData:]: data is NULL


in the console of Xcode. How do I find out where in my code this  
problem occured?


Thanks, ALEXander.

___

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: Debugging Information

2009-05-18 Thread Joar Wingfors


On 18 maj 2009, at 07.48, ALEXander wrote:

when the objective C runtime engine throws an exception during  
runtime, I get messages like
2009-05-18 16:31:58.370 Control[27911:813] *** -[NSKeyedUnarchiver  
initForReadingWithData:]: data is NULL
in the console of Xcode. How do I find out where in my code this  
problem occured?



Put a breakpoint on "objc_exception_throw" and launch your app under  
the debugger.


j o a r


___

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: Debugging Information

2009-05-18 Thread Chris Williams
Perhaps this is a tad simplistic, but have you searched your code for
NSKeyedUnarchiver?  Can't be too many instances of that...

> From: ALEXander 
> Subject: Debugging Information
> 
> Hello,
> 
> when the objective C runtime engine throws an exception during
> runtime, I get messages like
> 
> 2009-05-18 16:31:58.370 Control[27911:813] *** -[NSKeyedUnarchiver
> initForReadingWithData:]: data is NULL
> 
> in the console of Xcode. How do I find out where in my code this
> problem occured?

___

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 Generating and displaying images using Bitmap

2009-05-18 Thread Gwynne Raskind

On May 18, 2009, at 4:03 AM, Shraddha Karwan wrote:
I have a buffer containing JPEG image data. I need to display this  
buffer in
form of images. I copied this buffer to a file and then used the  
following:


CGDataProviderRef ref = CGDataProviderCreateWithFilename([appFile
UTF8String]);
CGImageRef imgRef =
CGImageCreateWithJPEGDataProvider 
(ref,NULL,YES,kCGRenderingIntentSaturation);

UIImage *theImage = [[UIImage alloc] initWithCGImage:imgRef];

Then displaying the image.
For some images I get the images but for some I get the JPEG Image  
corrupt

error message.
When I test the same data with Windows application it is able to  
display the

image without any error.
Is my conversion from JPEG buffer to UIImage file appropriate or am I
missing out some thing?


Wouldn't:

UIImage *theImage = [[UIImage alloc]  
initWithData:theJPEGDataBufferInMemory];


Be simpler and more effective?

That being said, your code looks correct. Can you give us the exact  
error message you get?


-- Gwynne, Daughter of the Code
"This whole world is an asylum for the incurable."

___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Mike Abdullah


On 18 May 2009, at 14:04, Chris Idou wrote:




The database situation on Cocoa is not great. Apple should spend  
some of that cash hoard building or buying an object database.


If anyone wants an interesting project, the db4o object database  
which is written in Java and GPLed comes with a program called  
Sharpen which translates Java into C#. It occurs to me that  
translating it into C or objective-c would be possible. Nobody would  
give a rip about core-data if there was a real object database  
available.


Except for, you know, all of us using Core Data for exactly what it  
was designed for.


___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Bill Bumgarner
I'm going to can the excerpts from other posts for a moment and bring  
this back around to helping to solve Cocoa development problems.   
Though you might have to scroll down a bit to get there... :)


There are actually four different specific technical issues that have  
been discussed concretely or alluded to:


(1) object graph management -- managing a bunch of objects with  
relatively complex connectivity between, including ability to do  
validation, undo tracking, user interface bindings, change  
propagation, grouping/filtering/organizing of subgraphs, etc...


(2) persistency of the object graph;  could be to memory, to permanent  
storage atomically, or to permanent storage incrementally.


(3) client/server style interaction with a remote store for pushing/ 
pulling bits of object graph to some server with multi-user access  
that includes ability to do conflict management, change integration,  
stale data detection, etc...


(4) mapping between the object graph and a schema that is defined  
outside of the framework that offers (1), (2), and (3).




Currently, Cocoa has (1) and (2) in the form of Core Data.  Cocoa has  
that in spades.  Having worked with many different object persistency  
management layers over the years (including designing & implementing a  
few), I'm pretty sure Cocoa has the best quality (1) that isn't a  
highly specific solution within a limited problem domain.


(1) is also one of the most difficult problems to solve, especially  
when aiming for a general purpose solution widely applicable to many  
different styles of applications.


As for (2), the incremental storage part is what is interesting.  Core  
Data solves that through the use of a SQLite backing store.  SQL based  
data storage is the standard means of achieving incremental retrieval  
and storage of data in our industry.  There are alternatives, but none  
that have gained anything near the pervasiveness of SQL based  
technologies.   SQLite is ideal for desktop use and it isn't really  
limited to single-user, simply limited to single machine (sticking a  
SQLite database on a network filesystem and trying to go multi-user  
is... just don't do it).   Anyone who claims that SQLite is a toy  
database hasn't really looked at SQLite;  it is a pretty darned  
amazing bit of code, that.


Now, what Core Data does not offer is (3) and (4).   In the case of  
(3), the assumption would be that -- like with the SQLite database --  
Core Data would manage the entire schema of the database on the  
server.   Certainly, that would be useful to a subset of developers,  
but how many?  In studying the problem, I come up with "not that  
many".  In almost cases where I have looked at problems that required  
client/server database access, one of the requirements was to  
interface with some kind of a reporting engine, web service/server, or  
something else that wants to go trolling through the data store and,  
more likely, edit stuff.


At that point, the choices are to fully document the schema and  
implement a whole bunch more code that tries to detect when someone  
has done something wrong in the database.   Combined with the need to  
provide some kind of a means of making access to many different  
vendor's databases transparent -- some of which have notoriously "odd"  
implementations of the SQL spec -- make implementing (3) extremely  
costly both in $$$ and engineering hours spent.


And for what gain?  Most of the potential users of (3) will  
immediately smack right up against the proprietary -- though  
documented, maybe -- schema and find it not-applicable.   "What?  I  
can't just integrate reporting tool X because it requires the schema  
to be in THIS form? Fail!".  That is, as soon as client/server stuff  
is in the mix, the overall design often becomes so business-case  
specific that the deployment can be thought of more as a "custom  
software technology ecosystem" than "a server and an app in a box".


So that brings up (4).   (4) is a really really really hard problem to  
solve. Stunningly hard. (4) is the kind of stuff that PHDs are written  
about and for which there are companies that sell very expensive  
products that do nothing but (4).


---

But the lack of (4) or, even, (3) should not be a deterrent to using  
CoreData within your application, necessarily.   Do not underestimate  
the value of (1).  Of all of the complex data management applications  
I have used that have underestimated (1) -- and that is most of them  
that try to re-invent (1) -- they have all had really nasty, off data  
destroying, bugs that make the user interface really painful to use.


What I have successfully used in the past (and will do so again, I'm  
certain), is to use CoreData as a local cache between the remote data  
server and my local Object Graph.


Thus, my client/server layer has been quite thin.  It simply grabs  
data from the remote server -- in my case, I have used XML-RPC, but  
u

Re: NSURLConnection set to cache

2009-05-18 Thread Eric E. Dolecki
Thanks - that's good information.

On Mon, May 18, 2009 at 10:35 AM, Keary Suska wrote:

> On May 17, 2009, at 9:07 PM, Eric E. Dolecki wrote:
>
>  I just want to be sure of something - if I set the images to cache, when I
>> load the same url again, the image is coming from memory - because I put
>> in
>> a progress bar and the images loaded already I thought would have an
>> instantly populated progress bar, but they still load with progress
>> (albeit
>> quicker).
>>
>
> If you are using the default cache policy, there is no guarantee whether
> the resource is in memory, on disk, or will be reloaded from its remote
> source (although you could make a reasonable assumption on the latter).
> Also, the cache is always validated in these cases, so there will always be
> some latency.
>
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
>
> ___
>
> 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/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
>



-- 
http://ericd.net
Interactive design and development
___

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: LMSetKey[Rep]Thresh

2009-05-18 Thread Christopher Hansen
Thanks, Chris.

I had actually started to wonder about that myself, and I think this is the 
right solution.  I haven't had to do event handling before (graphics are my 
norm), but I was given the task of replacing the portions of our Mac OS X code 
that are not supported for 64-bit since I'm the only one on the team currently 
that has Mac OS programming experience.

This approach makes a lot of sense to me.

Thank you,
Christopher




From: Chris Hanson 
To: Christopher Hansen 
Cc: Cocoa-dev@lists.apple.com
Sent: Monday, May 18, 2009 2:04:27 AM
Subject: Re: LMSetKey[Rep]Thresh

On May 14, 2009, at 10:45 AM, Christopher Hansen wrote:

> I'm writing a game and I need to set the key and key repeat thresholds in my 
> Cocoa application.  The functions needed to do to this under Carbon 
> (Events.h) are:
> 
> LMGetKeyThresh
> LMSetKeyThresh
> LMGetKeyRepThresh
> LMSetKeyRepThresh
> 
> I'm looking for the Cocoa equivalents.

Unlike the other responses, I'm going to take a different tack:

Since you're writing a game, you probably don't want to worry about key repeat 
thresholds, either getting or setting.  Instead, you should care about 
key/button down and key/button up events, and map those to state in your game 
engine.

The reason is that your game probably has its own internal concept of 
"repeating" that may not map at all to the typing concept of "repeating."  An 
example would be a first-person shooter that supplies an automatic weapon:  
Different weapons will have different rates of fire.  You may even have an 
energy weapon that fires as long as the user is (conceptually) pulling the 
trigger.

This is a game-engine level concept, not something you should try to map to 
input handling necessarily.  Just use your input handling to supply your game 
engine with the necessary information.  For the most flexibility in doing this 
take a look at the HID Manager APIs, especially the new HID APIs introduced in 
Mac OS X 10.5 Leopard.

  -- Chris



___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Jeffrey Oleander

Yah, it's getting there.  It's just not there yet.

The data modeling still isn't quite up to ORM 
standards we had nearly 30 years ago.

When we dink with PHP and Python which have 
handy APIs, it can get to be frustrating.

Just provide input via the bugreporter and 
comments to the docs, and strive for a bit of
patience.


  
___

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


NSPopupButton with blurry image

2009-05-18 Thread Gideon King
Hi, I have an NSPopupButton which I am populating programmatically.  
The button class is set to square because I need it to be bigger than  
the standard popup button. I am setting an image on each menu item  
(the images are produced as PDF images).


All the images appear correctly, but when I pop up the menu the first  
image is always blurry, and the remainder of the images are crisp.  
It's as if the first image has been stretched. As an experiment I put  
the second image as the same image as the first, and now it appeared  
stretched too, which appears to prove the point.


Is this a known issue? How should I ensure that my image is not  
stretched?


TIA
Gideon
___

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


Take over function keys

2009-05-18 Thread Brad Shappell
Hi,
I have an basic Cocoa app in which I'd like to take over the function keys
(F1-F12) whenever when my app is active.  For example, if my app is active
when F1 is pressed I'd like to detect, then "eat" that event so that it is
not processed by the system.

Any pointers would be much appreciated,
Brad S.
___

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


manually flush NSHTTPCookieStorage in Leopard

2009-05-18 Thread Russell Gray
is this possible, I have a cookie manager app (Safari Cookies), and  
ive only just noticed a bug, where if you delete some cookies, and  
then visit a secure site, all the previously deleted cookies will re- 
appear?


I know it was possible to flush the cookie cache under Tiger, but can  
it be done in Leopard?


Russell
___

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


Capturing key events in a menu

2009-05-18 Thread Adam Warski

Hello,

I'm quite new to Cocoa programming, and I've spent already some time  
looking for a solution - maybe somebody here will be able to help.


Basically, I want to do quite a simple thing: capture a "keyDown"  
event when a menu is opened. So the user opens a menu, presses a key  
and I want to know what key it was.
Unfortunately NSMenu isn't an NSResponder, so I can't capture it  
there. Also, the event isn't passed down to NSApp (where I could  
capture it in a subclass or delegate), as the menu handles it to  
position the higlight on the appropriate letter. Can I somehow  
override that behaviour?


--
Thanks,
Adam Warski
___

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


How to set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Rick Mann
Hi. I've got a popup button with a bunch of GMT offsets configured in  
IB, and bound via selectedTag to an NSArrayController's selection's  
gmtOffset property. Each item in the menu has a tag value set. The  
binding is properly setting the values of the selection, even if  
multiply selected, and the popup properly updates as the selection  
changes.


I'd like to display some custom text in that popup when there are  
multiple values in the selection. But I'm pretty sure I need to  
specify a tag value in the "Multiple Values Placeholder" field in IB  
(under the selectedTag binding of the NSPopupButton), but I don't want  
to create an item in the popup menu just for this value; that would  
imply (and allow) the user could select it, which wouldn't make sense.


What's the right way to do this?

TIA,
--
Rick

___

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: Capturing key events in a menu

2009-05-18 Thread Benjamin Stiglitz
> Basically, I want to do quite a simple thing: capture a "keyDown" event 
> when a menu is opened. So the user opens a menu, presses a key and I want 
> to know what key it was.
> Unfortunately NSMenu isn't an NSResponder, so I can't capture it there. 
> Also, the event isn't passed down to NSApp (where I could capture it in a 
> subclass or delegate), as the menu handles it to position the higlight on 
> the appropriate letter. Can I somehow override that behaviour?

When a menu is open the Menu Manager in HIToolbox handles incoming
events on its own. You be able to capture the events with an embedded
NSView, but I first need to ask the standard question: waht are you
trying to achieve?

-Ben
___

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


Programatically set file URL of Core Data Document?

2009-05-18 Thread Jerry Krinock
I'm trying to programatically set the initial file url (path,  
filename) of an Core Data NSPersistentDocument, or if that is not  
possible, at least populate the Save panel with an initial filename.


At first, I was using -[NSDocument  
saveToURL:ofType:forSaveOperation:error:].  That worked fine until I  
switched from XML to SQLite store, whereupon I began getting "Could  
not merge changes" errors when saving [1].


Then, I tried to implement -prepareSavePanel: and in there to  
setFileURL: if it is found to be nil, as it is for a new document.   
But this results in a "nil is not a valid persistent store" being  
logged upon saving. [1]


Then, I tried using -[NSPersistentStoreCoordinator  
migratePersistentStore:toURL:options:withType:error:].  But this  
results in a crash upon saving, in -[NSDocument  
_saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo 
:]. [2]


Then, I tried removing the old persistent store with  
removePersistentStore:error: and adding a new one with  
addPersistentStoreWithType:configuration:nilURL:options:error:.  But  
that results upon saving in errors such as "The NSManagedObject with  
ID:0x16d22cb0  has been invalidated".


For brevity, I have omitted my arguments for and against each of the  
four approaches.


What is the correct approach to do programatically set the file URL of  
an NSPersistentDocument?  Or if someone could rule out one or more of  
my four approaches, at least I would know which to not waste any time  
beating on :)


Thank you,

Jerry Krinock


[1] In the error's userInfo, in the the 'conflictList', I see that the  
newVersion is 0 but the old version is 1.  That seems kind of weird  
but I'm just guessing...


conflictList:
(
  {
cachedRow = {
  configureAutomatically = 1;
  defaultSortable = 1;
  displaysFolders = 1;
  doExportAfterSave = ;
  doFindDupesAfterOpen = ;
  doImportAfterOpen = ;
  doOpenAfterLaunch = ;
  doSortAfterOpen = ;
  filterIgnoredPrefixes = 0;
  hasBar = 0;
  hasMenu = 0;
  hasOhared = 0;
  hasUnfiled = 0;
  ignoreDisparateDupes = 0;
  lastDupesDone = ;
  lastDupesMaybeMore = ;
  lastSortDone = ;
  lastSortMaybeNot = ;
  lastTouched = ;
  lastVerifyDone = ;
  lastVerifyMaybeNot = ;
  notes = "Document created 2009 May 17 17:40 by jk.";
  rootLeavesOk = 0;
  rootNotchesOk = 0;
  rootSoftainersOk = 0;
  rootSortable = 127;
  satchAll1 = 1;
  satchAll2 = 1;
  softainersAnyRootIndex = 0;
  sortBy = 0;
  sortFoldersAt = 0;
  tagDelimiter = 61441;
  uuid = "F1724F28-C8A1-4F92-9334-C1C48721868B";
  visitor = visitDB;
};
databaseRow = {
};
newVersion = 0;
object = Bookshig 0x2800630 owned by Bookshelf 0x165ecac0  
"untitled_5.bkmslf";

oldVersion = 1;
  }
)

[2]  Actually, the crash occurs in the next call, -[NSDocument  
_willPresentSavingError:forOperation:url:].  I suppose that the 'url'  
parameter may be invalid.


 
___


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: Take over function keys

2009-05-18 Thread Kevin Gessner

On May 17, 2009, at 4:40 PM, Brad Shappell wrote:


Hi,
I have an basic Cocoa app in which I'd like to take over the  
function keys
(F1-F12) whenever when my app is active.  For example, if my app is  
active
when F1 is pressed I'd like to detect, then "eat" that event so that  
it is

not processed by the system.

Any pointers would be much appreciated,
Brad S.


Look into creating a CGEventTap - http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html 
. You'll want your callback to look for F-key events, and return NULL  
to "eat" the event.


HTH.

-- Kevin

Kevin Gessner
http://kevingessner.com
ke...@kevingessner.com

___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 2:36 PM, Rick Mann  wrote:
> Hi. I've got a popup button with a bunch of GMT offsets configured in IB,
...

  Don't re-post. If someone has an answer, they'll answer. It's only
been 13 hours.

--
I.S.
___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Kyle Sluder
Please don't repost the same message with no added content.  If anyone
wants to help you, they will.

--Kyle Sluder
___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Rick Mann


On May 18, 2009, at 13:47:31, I. Savant wrote:

On Mon, May 18, 2009 at 2:36 PM, Rick Mann   
wrote:
Hi. I've got a popup button with a bunch of GMT offsets configured  
in IB,

...

 Don't re-post. If someone has an answer, they'll answer. It's only
been 13 hours.


Thank you for some reply. If I could tell that my message had appeared  
on the list, I wouldn't have re-posted. My list settings are set to  
send me copies of my own posts, and I also searched the archives. My  
post doesn't show up, and I never received a copy of it.


http://search.lists.apple.com/?q=How+to+set+multiple+values&cmd=Search%21&form=extended&m=all&ps=10&fmt=long&wm=wrd&wf=0020&sp=1&ul=cocoa-dev

Sorry, your search for How to set multiple values did not find any  
results.

No documents were found containing "How to set multiple values".



--
Rick

___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 4:56 PM, Rick Mann  wrote:

> Thank you for some reply. If I could tell that my message had appeared on
> the list, I wouldn't have re-posted. My list settings are set to send me
> copies of my own posts, and I also searched the archives. My post doesn't
> show up, and I never received a copy of it.

  Hmm ... strange. It shows up in cocoabuilder.com:

http://www.cocoabuilder.com/archive/message/cocoa/2009/5/18/236989

  ... but a search by subject didn't find it either. I just did a
browser-text-search of the home page for the archive (not a site
search).

  FWIW, the "send me a copy of my own posts" has *never* worked for
me. Don't know why.

--
I.S.
___

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: Capturing key events in a menu

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 3:14 PM, Benjamin Stiglitz  wrote:

> ...but I first need to ask the standard question: waht are you
> trying to achieve?

  Adding: mention the scope too - do you want to do this for your app
or all apps and maybe even the Apple menu too? What about context
menus? NSPopUpButton menus and the like?

--
I.S.
___

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: Take over function keys

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 3:54 PM, Kevin Gessner  wrote:

> Look into creating a CGEventTap -
> http://developer.apple.com/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html.
> You'll want your callback to look for F-key events, and return NULL to "eat"
> the event.

  Nah ... if he only wants to listen for the function keys when the
app is active, creating an NSApplication subclass and overriding
-sendEvent: is sufficient. If the key code / flags is what you want,
dispatch the message however you wish, otherwise call super.

  It depends, though, what behavior you're looking for. In the case of
laptops, the function keys control media playback, volume, display and
keyboard brightness, and a number of other things. Consider that when
dealing with function keys.

--
I.S.
___

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


Getting results from Spotlight Saved Searches

2009-05-18 Thread Mark Allan

Hello all,

I'm implementing something which requires me to perform various tasks  
on a collection of files supplied by the user.  I'd like to be able to  
offer my users the ability to select a ".savedSearch" file and perform  
those tasks on the files which result from that search.


What I'm doing so far is reading the .savedSearch file into an  
NSDictionary, obtaining from that the "RawQueryDict", extracting the  
values for "RawQuery" and "SearchScopes", and I'm using those to setup  
an MDQueryRef.  When I execute the query, it works, but I get back  
many more files than are visible when the query is run in the Finder  
(ie when the user double clicks their .savedSearch file).


The extra items all appear to be coming from within the Library  
directory, such as /Library/Caches and Application  
Support, which I'm fairly sure the Finder will never show in search  
results.  Without me having to modify the RawQuery string to add  
filename/path checks, does anyone know how I can exclude the extra  
files and just show exactly what the Finder shows?


There *are* two other keys in the RawQueryDict - FinderFilesOnly and  
UserFilesOnly - both with a value of "true" so I'm assuming this is  
where my answer lies, but I don't know where to add these into the  
query.  I've tried various ways of including them in the raw query  
string but that usually leaves me with 0 results!


Here's the code I'm working with just now:
// Get the file, query string and search scope
	NSDictionary *plistContents = [NSDictionary  
dictionaryWithContentsOfFile:savedSearchFile];
	NSDictionary *rawQueryDict = [plistContents  
valueForKey:@"RawQueryDict"];

NSString *theQuery = [rawQueryDict valueForKey:@"RawQuery"];
NSArray *theScope = [rawQueryDict objectForKey:@"SearchScopes"];

// Create and execute the query
MDQueryRef query;
	query = MDQueryCreate(kCFAllocatorDefault, (CFStringRef)theQuery,  
NULL, NULL);

MDQuerySetSearchScope(query, (CFArrayRef)theScope, 0);
MDQueryExecute(query, kMDQuerySynchronous);

	// Loop through and print the paths to see why I'm getting so many  
results!

NSLog(@"results found %d",MDQueryGetResultCount(query));
for (int j=0; j		NSLog(@"result %d: %@",j,(NSString *)MDItemCopyAttribute(item,  
kMDItemPath));

}

Any help would be greatly appreciated.
Many thanks
Mark


___

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: manually flush NSHTTPCookieStorage in Leopard

2009-05-18 Thread Jerry Krinock


On 2009 May 17, at 17:38, Russell Gray wrote:

is this possible, I have a cookie manager app (Safari Cookies), and  
ive only just noticed a bug, where if you delete some cookies, and  
then visit a secure site, all the previously deleted cookies will re- 
appear?


I know it was possible to flush the cookie cache under Tiger, but  
can it be done in Leopard?


If you have not, see what you can learn from the source code that  
comes with Nick Zitzmann's SafariCookieCutter.


  http://seiryu.home.comcast.net/~seiryu/scc.html

___

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: Take over function keys

2009-05-18 Thread Kyle Sluder
On Mon, May 18, 2009 at 5:12 PM, I. Savant  wrote:
>  Nah ... if he only wants to listen for the function keys when the
> app is active, creating an NSApplication subclass and overriding
> -sendEvent: is sufficient. If the key code / flags is what you want,
> dispatch the message however you wish, otherwise call super.

Is that going to take care of global hotkeys, like in System
Preferences or Spotlight?

--Kyle Sluder
___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Greg Guerin

Rick Mann wrote:


If I could tell that my message had appeared on the list, ...



List archives, most recent first:
  http://lists.apple.com/archives/cocoa-dev/2009/May/

It may take 15-20 minutes for the archives to update with recent  
posts, or even longer.




... and I also searched the archives.



Original post in the archives:
  http://lists.apple.com/archives/cocoa-dev/2009/May/msg01124.html

If you searched using the archive search form, then that's broken.   
You have to use google or some search engine that keeps itself up-to- 
date.


For some unknown reason, the Archive Search's index finds nothing for  
the past several years.  Simple test: search for the keyword "cocoa",  
then display the results by date.  Note nothing newer than 2005.


Yet going to the following URL clearly shows archives more recent  
than 2005.


  http://lists.apple.com/archives/cocoa-dev/

Conclusion: Apple's Archive Search is fubar.

  -- GG

___

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


Field Editor Changes Text Height

2009-05-18 Thread K. Darcy Otto
I need to trap-and-replace various keypresses in the field editor.  I  
do this with -controlTextDidChange: in my delegate.  So, when the user  
presses ">", I replace it with a "superset of" (⊃) character (in case  
this does not come out on the list, I'm going to represent the  
"superset of" character with *s*).  Here is the code:


-(void)controlTextDidChange:(NSNotification *)aNotification
{
// Set fieldString to the string showing in the field editor
	NSMutableString *fieldString = [NSMutableString stringWithString: 
[fieldEd string]];


// Change ">" to horseshoe in fieldString
[fieldString replaceOccurrencesOfString:@">"
withString:[NSString stringWithFormat:@"%C",0x2283] // 0x2283 is *s*
options:NSLiteralSearch
range:NSMakeRange(0,[fieldString length])];

	NSRange selectedRange = [fieldEd selectedRange]; // Where the cursor  
is before the changes
	[fieldEd setString:fieldString]; // Set field editor to new string.   
Cursor will be set to the end of the string
	[fieldEd setSelectedRange:selectedRange]; // Return cursor to where  
it should be

}

Now, this always makes the change.  The problem is that in certain  
circumstances, the font height of some characters in the string, not  
related to the search-and-replace function, is changed.  But only  
sometimes.  For example, if I enter:


C>C ... this becomes C*ss*C just as it should.

But if I enter:

>C> ... this becomes *ss*C*ss* as it should, except the C is a half- 
height C.  Everything else looks normal.


I also make other search-and-replaces in the -controlTextDidChange  
method (I've given only the basic snippet of code), some of which  
exhibit this problem, and others of which do not.  It seems to depend  
on the replacement string.


Some additional background:

(1) I have "no rich text" checked for the relevant text fields in IB.
(2) If I copy-and-paste from the field editor into TextEdit,  
everything looks normal in all cases.
(3) When the user presses return and the text is passed to the text  
field, everything looks normal in all cases.


I'm not sure why it is doing this; but more importantly, I'm not sure  
how to fix it.  Any help would be greatly appreciated.___


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: Take over function keys

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 5:32 PM, Kyle Sluder  wrote:

> Is that going to take care of global hotkeys, like in System
> Preferences or Spotlight?

 You have a point, and looking at the original post again, I see that
this appears to be what the OP is after. Sorry for the noise.

--
I.S.
___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread I. Savant
On Mon, May 18, 2009 at 5:39 PM, Greg Guerin  wrote:

> Conclusion: Apple's Archive Search is fubar.

  More to the point: Apple's list serve in general is fubar.

--
I.S.
___

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


Cancelling an animation in a UITableViewCell was Re: UITableViewCell instances

2009-05-18 Thread Mike Manzano
First, let me say thanks for your reply. I think I was able to  
implement a similar algorithm for detecting when a cell has gone off- 
screen by overriding the table view's -willRemoveSubview:.


What I'm doing is starting an animation by adding it to the cell's  
layer, and in response to the cell being removed, am removing the  
animation. However, in my case the animation doesn't actually seem to  
stop. The way I test this is to set the animation to 5 seconds so I  
can mess around with the interface. I then scroll an animating cell  
off the top. My log messages tell me the cell was removed and that the  
animation was removed from the cell's layer. I then scroll back to the  
row in question, and it's still animating! Further, if I scroll down a  
full page of cells (so that the tableview starts reusing my cells), I  
can see the same animation being performed in the re-used cells at  
page intervals. What am I doing wrong?


The animation is started in response to user input, and looks like this:

- (void) resetSlidingForCell: (NewsItemTableViewCell *) cell
{
_currentlySlidingCell = cell ;
	CABasicAnimation *theAnimation = [CABasicAnimation  
animationWithKeyPath:@"position.x"] ;

theAnimation.removedOnCompletion = YES ;
theAnimation.duration = 5.0f ;
theAnimation.repeatCount = 1 ;
theAnimation.autoreverses = NO ;
	theAnimation.fromValue = [NSNumber  
numberWithFloat:cell.layer.position.x] ;
	theAnimation.toValue = [NSNumber  
numberWithFloat:cell.layer.position.x - cell.frame.origin.x] ;

theAnimation.delegate = self ;
self.superview.userInteractionEnabled = NO ;
[cell.layer addAnimation:theAnimation forKey:@"slideResetAnimation"] ;
NSLog( @"Started animation on layer %x" , cell.layer ) ;
}


Here is the above-mentioned -willRemoveSubview: method:

- (void)willRemoveSubview:(UIView *)subview
{
if( subview == _currentlySlidingCell )
{
		NSLog( @"Cancelled animation on layer %x" ,  
_currentlySlidingCell.layer ) ;

[_currentlySlidingCell.layer removeAllAnimations] ;
}

[super willRemoveSubview:subview] ;
}

As expected, the animation's delegate is being called when the  
animation is removed:


- (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag
{
	NSLog( @"Animation did stop on layer %x, cancelled: %d" ,  
_currentlySlidingCell.layer, !flag ) ;

[...]
}

The output of this NSLog statement tells me that the animation did not  
finish, as expected.


Any ideas?

Thanks,

Mike


On May 15, 2009, at 1:40 PM, Luke the Hiesterman wrote:

I think a better solution is to not do whatever you're going to do  
if the cell has gone off screen. You could easily check when your  
timer fires if the relevant cell is in view. This is where, as I  
mentioned in another thread, I prefer holding onto a reference to  
the NSIndexPath of the row you're interested in rather than the  
UITableViewCell. Then, no matter what happens in the underlying API  
implementation, at the time you want to do something, you can query  
whether that NSIndexPath is currently visible and you can also  
retrieve the UITableViewCell that goes with that by calling  
cellForRowAtIndexPath:


Luke

On May 15, 2009, at 1:33 PM, Mike Manzano wrote:

Okay, so each row is its own cell instance, and when a cell goes  
off-screen UITableView re-queues it. What happens, however, if I  
want to, e.g., start a jack-in-the-box animation in a cell subview  
that pops after 10 seconds. If the 10 seconds hasn't elapsed yet,  
but the cell is scrolled off-screen, then basically the whole cell,  
including the subview performing the animation, is cleaned up. Is  
there a way to tell the table view "don't re-queue me just yet"?


On May 15, 2009, at 10:56 AM, Dave DeLong wrote:

A different cell instance is used for each visible row.  The point  
of the queue is so that you don't have to instantiate a new cell  
for every row in your table.  The UITableView will "recycle" old  
cells (ie, cells that are no longer visibly on the screen) when it  
is about to display a new cell.  This helps keep the overall  
memory footprint down.


Dave

On May 15, 2009, at 8:52 AM, Mike Manzano wrote:

In the template UITableViewController that instantiates cells by  
first attempting to dequeue them, is that same dequeued cell used  
to draw all visible rows, or is there a separate cell used for  
each row?  The docs I've read mention queueing different cells of  
different types, so it's obvious in that case that the cells are  
different.


If it's the case that only one cell is used, then how do you  
handle the state related to, e.g., animating or touch tracking?



Mike Manzano
Sent while mobile

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator 

Re: Field Editor Changes Text Height [solved]

2009-05-18 Thread K. Darcy Otto
A possible solution is to insert the following line between [fieldEd  
setString ... and [fieldEd setSelected ... (the two lines at the end  
of the code):


[fieldEd setFont:[NSFont fontWithDescriptor:[[fieldEd font]  
fontDescriptor] size:[[fieldEd font] pointSize]]];


This will set the font for the entire fieldEd to the same type and  
size as the first letter.  I haven't been able to create any resizing  
problems with this, presumably because my resizing problem does not  
crop up in the first character of the field.  Or at least, I haven't  
been able to make it crop up for the first character of the field.  I  
suppose to be safe, you might specify the font directly:


[fieldEd setFont:[NSFont fontWithDescriptor:  
size:]];


On 18-May-09, at 2:46 PM, K. Darcy Otto wrote:

I need to trap-and-replace various keypresses in the field editor.   
I do this with -controlTextDidChange: in my delegate.  So, when the  
user presses ">", I replace it with a "superset of" (⊃) character  
(in case this does not come out on the list, I'm going to represent  
the "superset of" character with *s*).  Here is the code:


-(void)controlTextDidChange:(NSNotification *)aNotification
{
// Set fieldString to the string showing in the field editor
	NSMutableString *fieldString = [NSMutableString stringWithString: 
[fieldEd string]];


// Change ">" to horseshoe in fieldString
[fieldString replaceOccurrencesOfString:@">"
withString:[NSString stringWithFormat:@"%C",0x2283] // 0x2283 is *s*
options:NSLiteralSearch
range:NSMakeRange(0,[fieldString length])];

	NSRange selectedRange = [fieldEd selectedRange]; // Where the  
cursor is before the changes
	[fieldEd setString:fieldString]; // Set field editor to new  
string.  Cursor will be set to the end of the string
	[fieldEd setSelectedRange:selectedRange]; // Return cursor to where  
it should be

}

Now, this always makes the change.  The problem is that in certain  
circumstances, the font height of some characters in the string, not  
related to the search-and-replace function, is changed.  But only  
sometimes.  For example, if I enter:


C>C ... this becomes C*ss*C just as it should.

But if I enter:

>C> ... this becomes *ss*C*ss* as it should, except the C is a half- 
height C.  Everything else looks normal.


I also make other search-and-replaces in the -controlTextDidChange  
method (I've given only the basic snippet of code), some of which  
exhibit this problem, and others of which do not.  It seems to  
depend on the replacement string.


Some additional background:

(1) I have "no rich text" checked for the relevant text fields in IB.
(2) If I copy-and-paste from the field editor into TextEdit,  
everything looks normal in all cases.
(3) When the user presses return and the text is passed to the text  
field, everything looks normal in all cases.


I'm not sure why it is doing this; but more importantly, I'm not  
sure how to fix it.  Any help would be greatly  
appreciated.___


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/dotto%40csusb.edu

This email sent to do...@csusb.edu


___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Chris Idou


>Core Data solves that through the use of a SQLite backing store.  SQL based 
>data storage is the standard means of achieving incremental retrieval 
>and storage of data in our industry.

If Core Data talked to standard databases like Oracle etc, then I can see that 
as a selling point. But since it doesn't, and since it tries to hide SQLite, 
it's hard to see how it is much of a selling point. That SQL is pervasive is 
irrelevant if you're hiding the existence of SQL. If you're going to make it 
look like an object database, but not talk to widely deployed SQL databases, 
then you really should make it an object database. I don't know how core-data 
handles inheritance, but all the ways of doing it with an SQL database make 
performance suck if you want to do anything serious, and they also make writing 
SQL queries intractable if one wanted to get some benefits of having an SQL 
back end. I guess some people don't want to use any inheritance because their 
problems are simple, and it *can* work for them, but having a proper object 
database with a query facility or SQL front to it could work for them too.

We're in an object world now, and SQL databases can't cut it for many many 
problems. Accounting style applications, yes they *can* work. But there are 
vast areas of computing where its just too inefficient. Goto the web site of an 
object database like Versant and look at the wide variety of customers they 
have. They don't buy it because they are geeky, but because SQL databases can't 
do it.

>At that point, the choices are to fully document the schema and implement a 
>whole bunch more code that tries to detect when someone has done 
>something wrong in the database.   Combined with the need to provide some kind 
>of a means of making access to many different vendor's databases 
>transparent -- some of which have notoriously "odd" implementations of the SQL 
>spec -- make implementing (3) extremely costly both in $$$ and 
>engineering hours spent.


It's not *that* hard. Java tools like Hibernate do it. They still have the 
sucky performance implied by mapping object graphs to relational databases, but 
it at least gives you the ability to talk to any SQL database you want to, 
while still having a core-data like object access. Anybody else looking for an 
interesting project to work on could well port Hibernate to objective-c.

>In the case of (3), the assumption would be that -- like with the SQLite 
>database -- Core Data would manage the entire schema of the database on 
>the server.  Certainly, that would be useful to a subset of developers, but 
>how many?  In studying the problem, I come up with "not that many".  In 
>almost cases where I have looked at problems that required client/server 
>database access, one of the requirements was to interface with some kind 
>of a reporting engine, web service/server, or something else that wants to go 
>trolling through the data store and, more likely, edit stuff.

Nobody wants multi-user access unless they can interface with some 3rd party 
report engine? Firstly, that's not even nearly true. Tons of companies are 
buying object databases, and a relatively small group of them actually use them 
with reporting engines. Secondly an object database has the ability to upload 
object schemas derived from the object source code to a server without any 
difficulty. This is easy stuff for an object database. Thirdly, any decent 
object database can offer a legacy SQL interface that 3rd party reporting 
engines can talk to.

>So that brings up (4).  (4) is a really really really hard problem to solve. 

It's not even an issue for object databases, and it's not *that* hard to solve 
for SQL databases as Hibernate shows.


  Need a Holiday? Win a $10,000 Holiday of your choice. Enter 
now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline
___

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: NSPopupButton with blurry image

2009-05-18 Thread Peter Ammon

Hi Gideon,

It sounds like the PDF image is being rasterized at the point you sent  
it on the menu item, and being cached into a NSCachedImageRep; for the  
subsequent menu items the cache is used.


If you can arrange for the image to be rasterized before the being set  
on the menu item, it would probably fix the problem.  The simplest way  
to rasterize the image is to draw it; or alternatively make a new  
image of the right size, lock focus onto it, draw your PDF into the  
new image, unlock focus, and set the new image on the menu item.


On May 18, 2009, at 10:26 AM, Gideon King wrote:

Hi, I have an NSPopupButton which I am populating programmatically.  
The button class is set to square because I need it to be bigger  
than the standard popup button. I am setting an image on each menu  
item (the images are produced as PDF images).


All the images appear correctly, but when I pop up the menu the  
first image is always blurry, and the remainder of the images are  
crisp. It's as if the first image has been stretched. As an  
experiment I put the second image as the same image as the first,  
and now it appeared stretched too, which appears to prove the point.


Is this a known issue? How should I ensure that my image is not  
stretched?


TIA
Gideon
___

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/pammon%40apple.com

This email sent to pam...@apple.com


___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Robert Martin
If you're trying to say what you think CoreData 'should' be - then  
take it up with Apple. (which is not this list, by the way)


This whole thread is depressing. Is anyone out there who is trying to  
say that CoreData should be an object database capable of reading the  
docs? If so, what part of the documentation is confusing you? The part  
that makes you think that CoreData is an object database, for example,  
is specifically what?




On May 18, 2009, at 9:07 PM, Chris Idou wrote:




Core Data solves that through the use of a SQLite backing store.   
SQL based data storage is the standard means of achieving  
incremental retrieval

and storage of data in our industry.


If Core Data talked to standard databases like Oracle etc, then I  
can see that as a selling point. But since it doesn't, and since it  
tries to hide SQLite, it's hard to see how it is much of a selling  
point. That SQL is pervasive is irrelevant if you're hiding the  
existence of SQL. If you're going to make it look like an object  
database, but not talk to widely deployed SQL databases, then you  
really should make it an object database. I don't know how core-data  
handles inheritance, but all the ways of doing it with an SQL  
database make performance suck if you want to do anything serious,  
and they also make writing SQL queries intractable if one wanted to  
get some benefits of having an SQL back end. I guess some people  
don't want to use any inheritance because their problems are simple,  
and it *can* work for them, but having a proper object database with  
a query facility or SQL front to it could work for them too.


We're in an object world now, and SQL databases can't cut it for  
many many problems. Accounting style applications, yes they *can*  
work. But there are vast areas of computing where its just too  
inefficient. Goto the web site of an object database like Versant  
and look at the wide variety of customers they have. They don't buy  
it because they are geeky, but because SQL databases can't do it.


At that point, the choices are to fully document the schema and  
implement a whole bunch more code that tries to detect when someone  
has done
something wrong in the database.   Combined with the need to  
provide some kind of a means of making access to many different  
vendor's databases
transparent -- some of which have notoriously "odd" implementations  
of the SQL spec -- make implementing (3) extremely costly both in $$ 
$ and

engineering hours spent.



It's not *that* hard. Java tools like Hibernate do it. They still  
have the sucky performance implied by mapping object graphs to  
relational databases, but it at least gives you the ability to talk  
to any SQL database you want to, while still having a core-data like  
object access. Anybody else looking for an interesting project to  
work on could well port Hibernate to objective-c.


In the case of (3), the assumption would be that -- like with the  
SQLite database -- Core Data would manage the entire schema of the  
database on
the server.  Certainly, that would be useful to a subset of  
developers, but how many?  In studying the problem, I come up with  
"not that many".  In
almost cases where I have looked at problems that required client/ 
server database access, one of the requirements was to interface  
with some kind
of a reporting engine, web service/server, or something else that  
wants to go trolling through the data store and, more likely, edit  
stuff.


Nobody wants multi-user access unless they can interface with some  
3rd party report engine? Firstly, that's not even nearly true. Tons  
of companies are buying object databases, and a relatively small  
group of them actually use them with reporting engines. Secondly an  
object database has the ability to upload object schemas derived  
from the object source code to a server without any difficulty. This  
is easy stuff for an object database. Thirdly, any decent object  
database can offer a legacy SQL interface that 3rd party reporting  
engines can talk to.


So that brings up (4).  (4) is a really really really hard problem  
to solve.


It's not even an issue for object databases, and it's not *that*  
hard to solve for SQL databases as Hibernate shows.



 Need a Holiday? Win a $10,000 Holiday of your choice. Enter 
now.http://us.lrd.yahoo.com/_ylc=X3oDMTJxN2x2ZmNpBF9zAzIwMjM2MTY2MTMEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzk3NwR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=14600t3ni/**http%3A//au.rd.yahoo.com/mail/tagline/creativeholidays/*http%3A//au.docs.yahoo.com/homepageset/%3Fp1=other%26p2=au%26p3=mailtagline
___

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/rob

Re: How to set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Scott Anguish
You should consider trying cocoabuilder.com. That list archive/search  
functionality is great.



On 18-May-09, at 5:39 PM, Greg Guerin wrote:


Rick Mann wrote:


If I could tell that my message had appeared on the list, ...



List archives, most recent first:
 http://lists.apple.com/archives/cocoa-dev/2009/May/

It may take 15-20 minutes for the archives to update with recent  
posts, or even longer.




... and I also searched the archives.



Original post in the archives:
 http://lists.apple.com/archives/cocoa-dev/2009/May/msg01124.html

If you searched using the archive search form, then that's broken.   
You have to use google or some search engine that keeps itself up-to- 
date.


For some unknown reason, the Archive Search's index finds nothing  
for the past several years.  Simple test: search for the keyword  
"cocoa", then display the results by date.  Note nothing newer than  
2005.


Yet going to the following URL clearly shows archives more recent  
than 2005.


 http://lists.apple.com/archives/cocoa-dev/

Conclusion: Apple's Archive Search is fubar.


___

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 set multiple values placeholder for NSPopupButton selectedTag binding?

2009-05-18 Thread Scott Anguish


On 18-May-09, at 5:02 PM, I. Savant wrote:

On Mon, May 18, 2009 at 4:56 PM, Rick Mann   
wrote:


Thank you for some reply. If I could tell that my message had  
appeared on
the list, I wouldn't have re-posted. My list settings are set to  
send me
copies of my own posts, and I also searched the archives. My post  
doesn't

show up, and I never received a copy of it.


 Hmm ... strange. It shows up in cocoabuilder.com:

http://www.cocoabuilder.com/archive/message/cocoa/2009/5/18/236989


CocoaBuilder is an excellent way to see if your message got propagated  
because it is external to our server here at Apple. If you ask on the  
admin address (and I see you did, I'm just getting to those now)  
that's where I check.




 ... but a search by subject didn't find it either. I just did a
browser-text-search of the home page for the archive (not a site
search).

 FWIW, the "send me a copy of my own posts" has *never* worked for
me. Don't know why.


I'm not clear on this either. I'll try and find out. I know that I get  
copies of my messages on my non-Apple account (which is of course  
entirely unhelpful to anyone who doesn't.)


BTW, list issues like this are best handled through the admin address  
below. Yes, it may take longer to get a response from just me  
(depending on workload), but it means that 8000 others aren't also  
getting copies. Also, there is no guarantee that I'll tweak to an list  
issue in a thread about multiplevalue placeholders for NSPopupButton's  
selectedTag binding.



___

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


NSEvent virtual keycodes

2009-05-18 Thread Christopher Hansen
Hello,

The NSEvent Reference documentation for the keyCode method states that "the 
value returned is the same value returned in the kEventParamKeyCode when using 
Carbon Events."

Are the virtual key codes available in a Cocoa-based header?  The only virtual 
keycode definitions I've been able to find are in Carbon/HIToolbox/Events.h.

Thanks,
Christopher




___

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: NSEvent virtual keycodes

2009-05-18 Thread Jim Correia
On Mon, May 18, 2009 at 10:44 PM, Christopher Hansen
 wrote:

> The NSEvent Reference documentation for the keyCode method states that "the
> value returned is the same value returned in the kEventParamKeyCode when using
> Carbon Events."
>
> Are the virtual key codes available in a Cocoa-based header?  The only virtual
> keycode definitions I've been able to find are in Carbon/HIToolbox/Events.h.

That is the only place they are currently defined.

Including that header will not give your code cooties. That's
currently the correct place to pick up the constants from.

Jim
___

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 specify the file type to Audio file when dragging...?

2009-05-18 Thread Bright
>On 5/13/09 9:58 AM, Nick Zitzmann said:

>
>>> But  how limit the file type to sound file only available when drag
>>> and drop files into tableview?
>>

>>You need to check for that in your validateDrop method, and return YES
>>if the desired file type is detected and NO otherwise.
>
>And you can check the file's type by using [NSWorkspace typeOfFile:error:].

>>
Hi
Thank you for your help.
I am a novice of Cocoa. So can you tell me detailed about the specify the 
file type to Audio File
when dragging a file to tableview?
I tried the "validateDrop method" and NSworkspace, but failed. Does this have 
relationship with UTIs?
thank you very much.


Bright
___

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 specify the file type to Audio file when dragging...?

2009-05-18 Thread Nick Zitzmann


On May 18, 2009, at 9:28 PM, Bright wrote:

I am a novice of Cocoa. So can you tell me detailed about the  
specify the file type to Audio File

when dragging a file to tableview?
   I tried the  "validateDrop method" and NSworkspace, but failed.



That depends. Can you please post your code?

Nick Zitzmann




___

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: NSEvent virtual keycodes

2009-05-18 Thread Christopher Hansen
Lol!  In the process of moving from Carbon to Cocoa, I ripped out the 
Carbon.framework.  I just thought there might be a better place to include them 
from.

Thanks, Jim.

Christopher




From: Jim Correia 
To: Cocoa-dev@lists.apple.com
Sent: Monday, May 18, 2009 9:08:08 PM
Subject: Re: NSEvent virtual keycodes

On Mon, May 18, 2009 at 10:44 PM, Christopher Hansen
 wrote:

> The NSEvent Reference documentation for the keyCode method states that "the
> value returned is the same value returned in the kEventParamKeyCode when using
> Carbon Events."
>
> Are the virtual key codes available in a Cocoa-based header?  The only virtual
> keycode definitions I've been able to find are in Carbon/HIToolbox/Events.h.

That is the only place they are currently defined.

Including that header will not give your code cooties. That's
currently the correct place to pick up the constants from.

Jim
___

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/christopher.hansen%40yahoo.com

This email sent to christopher.han...@yahoo.com




___

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:Re: How to specify the file type to Audio file when dragging...?

2009-05-18 Thread Bright


>On May 18, 2009, at 9:28 PM, Bright wrote:
>
>> I am a novice of Cocoa. So can you tell me detailed about the  
>> specify the file type to Audio File
>> when dragging a file to tableview?
>>I tried the  "validateDrop method" and NSworkspace, but failed.
>
>
>That depends. Can you please post your code?
>
Hi ,this is my code,but the code can not limit the file to Audio file :

- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id 
)info proposedRow:(int)row 
proposedDropOperation:(NSTableViewDropOperation)op

{

? ? [tv setDropRow:[tv numberOfRows] dropOperation:NSTableViewDropAbove];

? ? returnNSTableViewDropAbove;

}





- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id )info 
row:(int)row dropOperation:(NSTableViewDropOperation)op

{? 

? ? NSPasteboard *myPasteboard=[info draggingPasteboard];

//NSArray *typeArray=[NSSound soundUnfilteredTypes];

   NSArray *typeArray=[NSArrayarrayWithObjects:NSFilenamesPboardType,nil];

? ? NSString *filePath,*availableType,*lastPathOfFileName;

? ? NSArray *filesList;

? ? int i;

? ? availableType=[myPasteboard availableTypeFromArray:typeArray];

? ? filesList=[myPasteboard propertyListForType:availableType];

? ? for (i=0;i<[filesList count];i++)

? ? {

? ? ? ? filePath=[filesList objectAtIndex:i];

lastPathOfFileName=[filePath lastPathComponent];

[songsFullPathinsertObject:filePath atIndex:row+i];

? ? ? ? [songsinsertObject:lastPathOfFileName atIndex:row+i];

? ? }

? ? [songTablereloadData];

? ? [songTableselectRow:row+i-1byExtendingSelection:NO];

returnYES;

}


thank you very much.
___

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: NSEvent virtual keycodes

2009-05-18 Thread Kyle Sluder
On Mon, May 18, 2009 at 11:34 PM, Christopher Hansen
 wrote:
> Lol!  In the process of moving from Carbon to Cocoa, I ripped out the 
> Carbon.framework.  I just thought there might be a better place to include 
> them from.

You don't need to link against Carbon to include the header files.

--Kyle Sluder
___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Steve Steinitz

Hi Bill,

Thanks for your high-level assessment.  I've long admired your 
technical skills and writing, so it is with much respect that I  
offer some counterpoint.  I'm compelled because I have a vested 
interest and I love Core Data.


On 18/5/09, Bill Bumgarner  wrote:


sticking a SQLite database on a network filesystem and trying to go
multi-user is... just don't do it.


Oops, too late for me.  Its been in production at a busy retail 
shop for two years.  I started the project three years ago after 
reading one of your posts defending Core Data and sqlite's 
multi-user capability.  Then, when it was too late to turn back 
I saw your subsequent post warning that it would be a 
'nightmare'.  Gulp.  Its been a challenge but works surprisingly 
well, and fast -- dedicated, 'ultra fast' Synology network drive 
which claims to be able to saturate gigabit ethernet and has a 
buffer 5x the database size.



Combined with the need to provide some kind of a means of making
access to many different vendor's databases transparent


And for what gain?  Most of the potential users of (3) will  
immediately smack right up against the proprietary -- though  
documented, maybe -- schema and find it not-applicable.   
"What?  I  can't just integrate reporting tool X because it 
requires the schema  to be in THIS form? Fail!".


I'm grateful that EOF's developers and Mr Jobs, in his prime, 
didn't let such concerns kill their big dream.  At least we have 
a fading memory of a modern-day technical miracle.  And, of all 
the tens of thousands of WebObjects/EOF mailing list posts I 
read (many of the best ones authored by you), I don't remember 
proprietary database features as a standout issue.


What I have successfully used in the past (and will do so 
again, I'm  certain), is to use CoreData as a local cache 
between the remote data  server and my local Object Graph.


Thus, my client/server layer has been quite thin.  It simply


Maybe I've been a technocrat for too long, but when I hear the 
word 'simply', I begin stepping backward, slowly.



grabs data from the remote server -- in my case, I have used XML-RPC,
but using a SQL client/server would be no different -- and converts it
into the various entities to be shoved into the local CoreData store.


For propagating changes back, CoreData has a complete set of 
hooks for  figuring out exactly what has changed in the local 
store (see the  notifications on the various CoreData classes).


Tantalizing.  I've noted with interest your mention of those 
adventures over the years but have been disappointed that 
you've  lost the code and that neither you nor Apple, can 
provide any such sample code.


However, this brings up (5) :) -- conflict management, 
resolution, and  merging.  It is a hard problem.  Don't 
underestimate it.


Yesterday, I finished developing a merging system that seems to 
have eliminated optimistic-locking and object-inaccessible 
exceptions (but I did just see an NSRangeException - Cannot 
remove an observer).  Its too brute-force to qualify as a real 
(5).  I offered brief summaries in a recent thread -- basically, 
periodic idle-time and as-needed fetch and merge of objects with 
recent modification timestamps.  You're right though, even that 
was hard and is far from perfect (e.g. it may have ruled out 
ever implementing Core Data's undo).  Also, it can get sluggish 
when all the machines are busy.  I'm going to speed it up, now 
that its working.


Core Data is hot, amazing.  I confess sentimentality about how 
it carries a little pilot light for the memory of the 
magnificent and peerless EOF.  Lets leave the door open a crack.


All the best,

Steve

___

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 specify the file type to Audio file when dragging...?

2009-05-18 Thread Nick Zitzmann


On May 18, 2009, at 10:15 PM, Bright wrote:

Hi ,this is my code,but the code can not limit the file to Audio  
file :


- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id  
)info proposedRow:(int)row proposedDropOperation: 
(NSTableViewDropOperation)op


{

? ? [tv setDropRow:[tv numberOfRows]  
dropOperation:NSTableViewDropAbove];


? ? returnNSTableViewDropAbove;

}



That might be because you didn't actually do anything in this method.  
Here you need to check the dragging pasteboard via the NSDraggingInfo  
protocol object to see if it has a pasteboard you can read (which  
might be overly pedantic, but I'd do it anyway), and if it does, then  
you need to read it and check to see if the file path(s) in the  
pasteboard is/are valid, and if so, then you need to check the UTIs of  
each file to see if one identifies as an audio file as suggested  
earlier. If all of these are good, then you set the drop row to row  
(not -numberOfRows unless you really need it to go at the end), and  
return the appropriate NSDragOperation (not NSTableViewDropAbove,  
which is not an NSDragOperation). Otherwise, you return  
NSDragOperationNone.


That's what you need to do. Implementation is now an exercise for the  
reader. :)


Nick Zitzmann




___

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: Databases on Cocoa (was Re: Invoice program made in Objective c/Cocoa)

2009-05-18 Thread Bill Bumgarner

(trying to keep this on-topic...)

On May 18, 2009, at 9:21 PM, Steve Steinitz wrote:

On 18/5/09, Bill Bumgarner  wrote:

sticking a SQLite database on a network filesystem and trying to go

multi-user is... just don't do it.
Oops, too late for me.  Its been in production at a busy retail shop  
for two years.  I started the project three years ago after reading  
one of your posts defending Core Data and sqlite's multi-user  
capability.  Then, when it was too late to turn back I saw your  
subsequent post warning that it would be a 'nightmare'.  Gulp. Its  
been a challenge but works surprisingly well, and fast -- dedicated,  
'ultra fast' Synology network drive which claims to be able to  
saturate gigabit ethernet and has a buffer 5x the database size.


Good for you;  the problem isn't SQLite, the problem is network  
filesystems.   The situation has improved greatly in the last five  
years, but there are still many a network filesystem implementation  
that strays far from either the standard or, even, from "working".


If you are in a highly controlled environment with a really good  
network filesystem, it works just as well as it does when doing multi- 
user access from the local filesystem.


And it sounds like that is exactly the kind of environment you have  
created.   Instead of using some random Windows/Linux/*BSD server box  
sitting in a dusty closet running on cheap hardware with a flaky  
network, you appear to have actually considered and invested in the  
networking infrastructure to the point of eliminating that particular  
point of fragility.


This is one area that so many developers overlook (myself included --  
I can only say this with confidence because I made that mistake in the  
past and learned, painfully, from it).


On topic: Compared to the cost of engineering -- both for new features  
within software and for ongoing maintenance of existing systems --  
hardware is cheap.   If you are building something that requires  
networking between clients A and B, with server C somewhere else,  
throw the primo-dollars at C and the connections to A and B.


I'll take the rest of my response offline.  It isn't relevant to cocoa- 
dev.


I will say, though, that Steve is justified in calling me out on that  
stupid client/server example.  I wish I had time to make it into a  
modern example.  I don't, but I can bug some people about such an  
example...


b.bum
___

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 Generating and displaying images using Bitmap

2009-05-18 Thread Shraddha Karwan
Hi,

I get the following errors while displaying the JPEG buffered image.

: Corrupt JPEG data: 584 extraneous bytes before marker 0xc0
: Quantization table 0x00 was not defined

: Corrupt JPEG data: 446 extraneous bytes before marker 0xdb
: Bogus marker length
: CGImageCreate: invalid image size: 0 x 0.

What can be the cause for this error? Any ideas?



On Mon, May 18, 2009 at 8:33 PM, Gwynne Raskind wrote:

> On May 18, 2009, at 4:03 AM, Shraddha Karwan wrote:
>
>> I have a buffer containing JPEG image data. I need to display this buffer
>> in
>> form of images. I copied this buffer to a file and then used the
>> following:
>>
>> CGDataProviderRef ref = CGDataProviderCreateWithFilename([appFile
>> UTF8String]);
>> CGImageRef imgRef =
>>
>> CGImageCreateWithJPEGDataProvider(ref,NULL,YES,kCGRenderingIntentSaturation);
>> UIImage *theImage = [[UIImage alloc] initWithCGImage:imgRef];
>>
>> Then displaying the image.
>> For some images I get the images but for some I get the JPEG Image corrupt
>> error message.
>> When I test the same data with Windows application it is able to display
>> the
>> image without any error.
>> Is my conversion from JPEG buffer to UIImage file appropriate or am I
>> missing out some thing?
>>
>
> Wouldn't:
>
> UIImage *theImage = [[UIImage alloc]
> initWithData:theJPEGDataBufferInMemory];
>
> Be simpler and more effective?
>
> That being said, your code looks correct. Can you give us the exact error
> message you get?
>
> -- Gwynne, Daughter of the Code
> "This whole world is an asylum for the incurable."
>
>


-- 
Regards,
Shraddha Karwan

Success usually comes to those who are too busy to be looking for it.
___

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: Capturing key events in a menu

2009-05-18 Thread Adam Warski

Hello,


When a menu is open the Menu Manager in HIToolbox handles incoming
events on its own. You be able to capture the events with an embedded
NSView, but I first need to ask the standard question: waht are you
trying to achieve?


Well, I want to know what the user typed when a menu is open, so that  
I can narrow the items displayed.
How can I embed an NSView? I know I can do that for an NSMenuItem, but  
then the menu item must have focus for the view to receive the events,  
is it not so?


--
Thanks,
Adam Warski
___

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: Capturing key events in a menu

2009-05-18 Thread Adam Warski

Hello,


...but I first need to ask the standard question: waht are you
trying to achieve?


 Adding: mention the scope too - do you want to do this for your app
or all apps and maybe even the Apple menu too? What about context
menus? NSPopUpButton menus and the like?


I want to do this for one menu (not popup) of my application.

--
Adam
___

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: Programatically set file URL of Core Data Document?

2009-05-18 Thread Ben Trumbull

I'm trying to programatically set the initial file url (path,
filename) of an Core Data NSPersistentDocument, or if that is not
possible, at least populate the Save panel with an initial filename.


This is more an NSDocument / UI problem.  Pushing this down into the  
model layer will make Core Data unhappy, as you've discovered.


Do you just want to populate the initial Save dialog ?  You could  
probably just stash the desired URL as an ivar on your document  
subclass and customize the save dialog.



At first, I was using -[NSDocument
saveToURL:ofType:forSaveOperation:error:].  That worked fine until I
switched from XML to SQLite store, whereupon I began getting "Could
not merge changes" errors when saving [1].


It works for atomic stores because they've cached the entire file in  
memory, and will overwrite everything on each save.  For a store doing  
incremental operations like SQLite, this fails.  The original, or a  
copy, needs to exist at the destination.  Basically, the SQLite store  
is just fetching and saving deltas.  Applying deltas over an empty new  
file, or some random file, just doesn't work.



Then, I tried to implement -prepareSavePanel: and in there to
setFileURL: if it is found to be nil, as it is for a new document.
But this results in a "nil is not a valid persistent store" being
logged upon saving. [1]


The Core Data layer does not accept nil as a valid persistent URL.  We  
can't save or load stuff from nil.  Setting the URL for a persistent  
store only changes how we refer to the store.  The exact same original  
file MUST exist at the new URL location.  Basically setting the URL  
tells Core Data to update it's path because the file moved out from  
underneath us.



Then, I tried removing the old persistent store with
removePersistentStore:error: and adding a new one with
addPersistentStoreWithType:configuration:nilURL:options:error:.  But
that results upon saving in errors such as "The NSManagedObject with
ID:0x16d22cb0  has been invalidated".



If you remove a store, all the managed objects from that store are  
invalidated.  Yanking the store out of the stack makes everything from  
it poisoned fruit, so to speak.  Your code still has references to  
managed objects from the removed store, and when you use them they  
fail this way.



[1] In the error's userInfo, in the the 'conflictList', I see that the
newVersion is 0 but the old version is 1.  That seems kind of weird
but I'm just guessing...


The versions are always positive integers.  0 means it was deleted.   
The "new" version is non-existence.


What is the correct approach to do programatically set the file URL  
of  an NSPersistentDocument?


You need to actually have a document before you can change the URL.   
If you want to move the document, you can move the file and then call  
setURL.  If you want to make the default URL appear to be something  
particular for an unsaved document, I would recommend doing that as a  
UI artifact outside of Core Data.


Probably worth a bug.

- Ben

___

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


iPhone text on UIImage not getting displayed on device.

2009-05-18 Thread Shraddha Karwan
I used the following function to add text on UIImage. I can display the text
on iPhone Simulator but its not getting displayed on the actual device. What
can be the cause?

 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
 CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w,
colorSpace, kCGImageAlphaPremultipliedFirst);

 CGContextDrawImage(context, CGRectMake(0, 0, w, h), img.CGImage);
 CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1);

 char* text = (char *)[text1 cStringUsingEncoding:NSASCIIStringEncoding];//
"05/05/09";
 CGContextSelectFont(context, "Arial", 12, kCGEncodingMacRoman);
 CGContextSetTextDrawingMode(context, kCGTextFill);
 CGContextSetRGBFillColor(context, 255, 255, 255, 1);

  CGContextShowTextAtPoint(context, 4, 130, text, strlen(text));
  CGImageRef imageMasked = CGBitmapContextCreateImage(context);
 CGContextRelease(context);
 CGColorSpaceRelease(colorSpace);

  return [UIImage imageWithCGImage:imageMasked];
___

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