Re: Looking for a FTP framework

2010-08-11 Thread Jean-Daniel Dupas

Le 11 août 2010 à 01:15, David Alter a écrit :

 I'm adding FTP support to a Mac application.  It actually needs to support
 SFTP. I need to support upload and downloading. If a connection is dropped I
 need to be able to re-establish a connection and finish the operation.
 
 It looks like there are some choices out there and I wanted to see what
 people where suggesting. Here are the choices I have come across.
 
 1) I have seen some information about ConnectionKit. It looks like this was
 written back in 2007. The original open source project appears to have
 vanished. However it looks like it was resurrected as a iOS framework.
 Sounds like it was well supported back in 2007. I'm wondering if it is still
 a good solution. I'm thinking changing it to work on the Mac would not be
 that hard to do. Here is where the project is hosted   connectionkit -
 Project Hosting on Google Code http://code.google.com/p/connectionkit/
 

Nope. This project at googlecode has nothing to do with the original connection 
kit which is still alive:

http://github.com/karelia/ConnectionKit



-- Jean-Daniel




___

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


Update Window of Snow Leopard's Dock Exposé

2010-08-11 Thread Manfred Schwind
Hi,

when holding down the mouse button on an running app in Snow Leopard's Dock, 
you get Exposé showing all the windows of that app.
Problem: when the app is hidden, the windows are not updated.

You can easily reproduce it e.g. with the QuickTime Player: Play a movie in 
QuickTime Player and try out the Dock Exposé feature. When QuickTime Player is 
not hidden, the movie plays well in the Exposé window. But when the QuickTime 
Player is hidden (Cmd+H), the movie does not play; Exposé is just displaying a 
frozen state of the video.

My question: Is there any way to update the window content that is displayed by 
Dock Exposé if my app is hidden?

Or can this be considered as a bug in Snow Leopard?

Regards,
Mani
--
http://mani.de - friendly software
iVolume - listen to music hands-free
LittleSecrets - the encrypted notepad
Sahara - sand in your pocket
Watchdog - baffle the curious

___

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: Custom zones...

2010-08-11 Thread Bill Bumgarner

On Aug 10, 2010, at 9:12 AM, Alastair Houghton wrote:

 That said, is the part about objects escaping zones really true for *NS*Zone? 
  It's true for malloc zones, for sure, but the docs for NSRecycleZone say:
 
  Frees zone after adding any of its pointers still in use to the default zone.
  (This strategy prevents retained objects from being inadvertently destroyed.)

Right -- I was talking about the historical, generic, use of NSZone.

 
 which seems to imply otherwise.
 
 You *are* just talking about *NS*Zone, right?  malloc zones are very useful 
 and I definitely don't want to see those go away (I'm thinking of a certain 
 million-plus node data structure we maintain that we'd have to go calling 
 free() a million or more times to release...)

Right.  Just NSZone.  Malloc zones aren't going anywhere.

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


Disable return-edit in text cell

2010-08-11 Thread slasktrattena...@gmail.com
Hello,

I've got a standard NSTableView with text cells. I want the field
editor to pop up when the user clicks on the cell, but not when
pressing the return key (which triggers another action). How can I
accomplish this? I've got a feeling there's a real simple solution,
but I just cannot find that magic button in IB.

-F
___

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: Disable return-edit in text cell

2010-08-11 Thread Kyle Sluder
On Wed, Aug 11, 2010 at 10:12 AM, slasktrattena...@gmail.com
slasktrattena...@gmail.com wrote:
 Hello,

 I've got a standard NSTableView with text cells. I want the field
 editor to pop up when the user clicks on the cell, but not when
 pressing the return key (which triggers another action). How can I
 accomplish this? I've got a feeling there's a real simple solution,
 but I just cannot find that magic button in IB.

This is discussed in the text view documentation:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextEditing/Tasks/InterceptKeys.html

--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: Updating timestamp on save = merge error

2010-08-11 Thread Jerry Krinock

On 2010 Aug 10, at 21:48, Gideon King wrote:

 I have a managed object I want to update with a last saved timestamp on 
 save. I have the update done on the NSPersistentDocument 
 -saveToURL:ofType:forSaveOperation:error: method. 
 
 This works fine, except on save as. I know that the save as creates a new 
 document and updates from the managed objects, and then saves, and it seems 
 that there is a managed object context merge happening in there. 
 
 In my case, the timestamp has changed, so I get an error message saying that 
 it can't merge the changes.
 
 Is there a way that I can tell that it's in the process of merging changes in 
 the middle of a save as, and therefore not update the timestamp? Or some 
 other method that I can accomplish my goal of having a save timestamp without 
 running into this issue that happens during a Save As operation.

I've probably oversimplified your problem, but it seems that not updating your 
timestamp in -saveToURL:ofType:forSaveOperation:error: if the forSaveOperation: 
parameter == NSSaveAsOperation would help.  Core Data doesn't do anything until 
you invoke super in there.  And/or as far as can't merge the changes, you can 
clear those with -[NSManagedObjectContext setMergePolicy:].



___

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: CGImage to NSImage, or PDFPage?

2010-08-11 Thread Brian Postow

On Aug 10, 2010, at 6:49 PM, Brian Postow wrote:


Also, I know that a PDF File stores the resolution for each image that's on a 
page, however, once I've turned it into a PDFDocument/PDFPage, is there any way 
to get the resolution out? 

I happen to know that every page in the document is a separate, single image 
with (probably) non-72DPI resolution, created with initWithImage, with an 
NSImage that has it's size in 72DPI points, but it's one representation's size 
in pixels.

I know that that information is in there somewhere, but all of the boxes are in 
user units (72dpi), not pixels... 

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: Disable return-edit in text cell

2010-08-11 Thread slasktrattena...@gmail.com
Thanks! I read that prior to posting, and tried to intercept the
keystroke with control:textView:doCommandBySelector: - but it's only
called when ending the editing session. Anyway, I found the solution I
was looking for by simply catching the return key in keyDown: in the
table view. Duh...

-F

On Wed, Aug 11, 2010 at 7:16 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 On Wed, Aug 11, 2010 at 10:12 AM, slasktrattena...@gmail.com
 slasktrattena...@gmail.com wrote:
 Hello,

 I've got a standard NSTableView with text cells. I want the field
 editor to pop up when the user clicks on the cell, but not when
 pressing the return key (which triggers another action). How can I
 accomplish this? I've got a feeling there's a real simple solution,
 but I just cannot find that magic button in IB.

 This is discussed in the text view documentation:
 http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextEditing/Tasks/InterceptKeys.html

 --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: CGImage to NSImage, or PDFPage?

2010-08-11 Thread Rafael Cerioli
Hi,

Images are stored as XObjects in the PDF Stream. Either you can parse the 
stream yourself, or you use the Voyeur.app sample code, and you will get the 
image with its size.

Regards,
Rafael

Le 11 août 2010 à 13:50, Brian Postow a écrit :

 
 On Aug 10, 2010, at 6:49 PM, Brian Postow wrote:
 
 
 Also, I know that a PDF File stores the resolution for each image that's on a 
 page, however, once I've turned it into a PDFDocument/PDFPage, is there any 
 way to get the resolution out? 
 
 I happen to know that every page in the document is a separate, single image 
 with (probably) non-72DPI resolution, created with initWithImage, with an 
 NSImage that has it's size in 72DPI points, but it's one representation's 
 size in pixels.
 
 I know that that information is in there somewhere, but all of the boxes are 
 in user units (72dpi), not pixels... 
 
 Brian Postow
 Senior Software Engineer
 Acordex Imaging Systems
 
 ___
 
 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/rafael.cerioli%40gmail.com
 
 This email sent to rafael.ceri...@gmail.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: Disable return-edit in text cell

2010-08-11 Thread Kyle Sluder
On Wed, Aug 11, 2010 at 11:02 AM, slasktrattena...@gmail.com
slasktrattena...@gmail.com wrote:
 Thanks! I read that prior to posting, and tried to intercept the
 keystroke with control:textView:doCommandBySelector: - but it's only
 called when ending the editing session. Anyway, I found the solution I
 was looking for by simply catching the return key in keyDown: in the
 table view. Duh...

Oh, you wanted Return to perform you action when the field editor
wasn't active? I'm sorry for misreading it as if you wanted it to do
something special from within the field editor.

--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: Handling NSManagedObjectContextDidSaveNotification from different threads

2010-08-11 Thread Keary Suska
On Aug 10, 2010, at 2:55 PM, Rick Mann wrote:

 We have an app that uses a main NSManagedObjectContext (MOC) for all 
 UI-related work, and has background threads that add and update data via 
 their own dedicated MOCs. When they call -save: on their MOC, the main MOC 
 gets the NSManagedObjectContextDidSaveNotification and calls 
 -mergeChangesFromContextDidSaveNotification:.
 
 The problem is, this actually happens on the thread that called -save:, not 
 on the main thread. We're seeing occasional crashes, and suspect that it is 
 due to this problem. However, I didn't see anything in the docs that said we 
 had to call -save: from the main thread, or take any special steps when 
 handling that notification.
 
 Did I just overlook something, or should this work safely always? It seems 
 like the latter is unlikely, since two threads could be accessing a MOC 
 simultaneously.

Are you following or taking into account everything shown here: 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW1
 ?

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: Handling NSManagedObjectContextDidSaveNotification from different threads

2010-08-11 Thread Rick Mann

On Aug 11, 2010, at 12:55:26, Keary Suska wrote:

 On Aug 10, 2010, at 2:55 PM, Rick Mann wrote:
 
 We have an app that uses a main NSManagedObjectContext (MOC) for all 
 UI-related work, and has background threads that add and update data via 
 their own dedicated MOCs. When they call -save: on their MOC, the main MOC 
 gets the NSManagedObjectContextDidSaveNotification and calls 
 -mergeChangesFromContextDidSaveNotification:.
 
 The problem is, this actually happens on the thread that called -save:, not 
 on the main thread. We're seeing occasional crashes, and suspect that it is 
 due to this problem. However, I didn't see anything in the docs that said we 
 had to call -save: from the main thread, or take any special steps when 
 handling that notification.
 
 Did I just overlook something, or should this work safely always? It seems 
 like the latter is unlikely, since two threads could be accessing a MOC 
 simultaneously.
 
 Are you following or taking into account everything shown here: 
 http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#//apple_ref/doc/uid/TP40003385-SW1
  ?

We did, as far as anyone here knows. I just find it interesting that the 
preferred approach, to use multiple MOCs and one PSC, creates a situation in 
which a MOC is likely to be manipulated by multiple threads: when handling the 
didSave notification.

 
 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: Handling NSManagedObjectContextDidSaveNotification from different threads

2010-08-11 Thread Kyle Sluder
On Wed, Aug 11, 2010 at 1:07 PM, Rick Mann rm...@latencyzero.com wrote:
 We did, as far as anyone here knows. I just find it interesting that the 
 preferred approach, to use multiple MOCs and one PSC, creates a situation in 
 which a MOC is likely to be manipulated by multiple threads: when handling 
 the didSave notification.

This question comes up on the list periodically.
-mergeChangesFromContextDidSaveNotification: is specifically designed
to handle multiple threads correctly. I filed rdar://problem/6933634
last May about this being poorly documented in response to this
thread, which contains a response from Ben Trumbull:
http://www.cocoabuilder.com/archive/message/cocoa/2009/5/29/237809

--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: Handling NSManagedObjectContextDidSaveNotification from different threads

2010-08-11 Thread Rick Mann
Thanks much for that!

On Aug 11, 2010, at 13:16:28, Kyle Sluder wrote:

 On Wed, Aug 11, 2010 at 1:07 PM, Rick Mann rm...@latencyzero.com wrote:
 We did, as far as anyone here knows. I just find it interesting that the 
 preferred approach, to use multiple MOCs and one PSC, creates a situation in 
 which a MOC is likely to be manipulated by multiple threads: when handling 
 the didSave notification.
 
 This question comes up on the list periodically.
 -mergeChangesFromContextDidSaveNotification: is specifically designed
 to handle multiple threads correctly. I filed rdar://problem/6933634
 last May about this being poorly documented in response to this
 thread, which contains a response from Ben Trumbull:
 http://www.cocoabuilder.com/archive/message/cocoa/2009/5/29/237809
 
 --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


iphone large image downloading

2010-08-11 Thread SanthoshKumarGundu

Hi,

Can any one  have an idea of  what is the maximum  image limit(size  
and resolution) in iphone?.


There are some images in web server. In my application , I am   
getting  these as NSData (one image at a time)  and displaying the  
image  using the following code


NSData *imageData = [[NSData alloc]initWithContentsOfURL:[NSURL  
URLWithString:imageURLString]];

UIImage *sampleImage = [UIImage imageWithData:imageData];

This is working fine for small images ( upto  1MB of size and  
resolution of 1024*1024).


But for large images ( 3MB size and resolution of 2500*2500), the  
application is getting crashed.


Can any one advise me on this.


Thanks in advance.



Thanks,
Santhosh Kumar Gundu


___

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


Split View

2010-08-11 Thread Gerd Moe-Behrens
Hi,

I am trying to make a drill down (table1  table2  detail view) using a split 
view template. I would like to reuse the same table view and the same table 
view controller.
The problem is that the cells are empty, if I drill down to the 2nd level.


I based my code on a nice tutorial 
http://www.iphonesdkarticles.com/2009/03/uitableview-drill-down-table-view.html.
It worked fine for a navigation based template. 
I tried to modify it for a split view template as following:

RootViewController.m
...
- (void)tableView:(UITableView *)TableView didSelectRowAtIndexPath:(NSIndexPath 
*)indexPath {   
//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource 
objectAtIndex:indexPath.row];
//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@Children];
if([Children count] == 0) {
  detailViewController.detailItem = [dictionary objectForKey:@Title]; 
}
else {
RootViewController *rvController = [RootViewController alloc]; 
  //Increment the Current View
rvController.CurrentLevel += 1;
  //Set the title;
rvController.CurrentTitle = [dictionary objectForKey:@Title];
   //Push the new table view on the stack
[self.navigationController pushViewController:rvController 
animated:YES];
rvController.tableDataSource = Children;
   [rvController release];
} 
}

How do I have to change the code? I guess the error is:
RootViewController *rvController = [RootViewController alloc];
 
Thanks in advance for your help.

Best

Gerd


Sent from my iPad___

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 large image downloading

2010-08-11 Thread David Duncan
On Aug 11, 2010, at 12:46 AM, SanthoshKumarGundu wrote:

 Can any one  have an idea of  what is the maximum  image limit(size and 
 resolution) in iphone?.
 
 There are some images in web server. In my application , I am  getting  these 
 as NSData (one image at a time)  and displaying the image  using the 
 following code
 
 NSData *imageData = [[NSData alloc]initWithContentsOfURL:[NSURL 
 URLWithString:imageURLString]];
 UIImage *sampleImage = [UIImage imageWithData:imageData];
 
 This is working fine for small images ( upto  1MB of size and resolution of 
 1024*1024).
 
 But for large images ( 3MB size and resolution of 2500*2500), the application 
 is getting crashed.


What kind of crash are you getting? I would bet that the exception code is 
0x8badf00d (see TN2151 for information on what that means and how to read crash 
reports).

You are actually pretty lucky that the first version works at all, and I bet 
that if you are on a slow or broken network that it won't work and you will get 
a similar crash.

Generally any using -initWithContentsOfURL: for remote URLs will fail if you 
are trying to do so on the main thread (and if you are using UIKit, you are 
probably trying to do so on the main thread, like the above code).

The correct solution here is to use asynchronous networking to download the 
data and once you finish the download you can create a UIImage from the 
gathered data. Using synchronous networking (like you are above) is generally 
discouraged.
--
David Duncan

___

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


NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread Sandro Noël
Greetings

I'm having problems unarchiving my data in the iphone.

here is the workout.

1: I archive a AttributedString to my CoreData NSData property using 
NSKeyedarchiver
2: Transfer the database to the iphone.
3: load the data using NSKeyedUnarchiver on the iphone.
NSAttributedString *as = (NSAttributedString*)[NSKeyedUnarchiver 
unarchiveObjectWithData:attributedStringData];

that crashes saying:
-[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFont)

I understand that the NSFont is UIFont on the iphone, or has similarities.
so i implemented a Delegate method to replace the class.
//--
- (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver 
cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray 
*)classNames{
if ([name isEqualToString:@NSFont])
return [UIFont class];

return nil;
}

but that never gets called because the class method does not allow for a 
delegate and instantiating the unarchiver class confuses me in how I should 
trigger the decoding once it is instantiated.

Any pointers ?
Sandro Noel.



___

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: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread glenn andreas

On Aug 11, 2010, at 3:53 PM, Sandro Noël wrote:

 Greetings
 
 I'm having problems unarchiving my data in the iphone.
 
 here is the workout.
 
 1: I archive a AttributedString to my CoreData NSData property using 
 NSKeyedarchiver
 2: Transfer the database to the iphone.
 3: load the data using NSKeyedUnarchiver on the iphone.
 NSAttributedString *as = (NSAttributedString*)[NSKeyedUnarchiver 
 unarchiveObjectWithData:attributedStringData];
 
 that crashes saying:
 -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class 
 (NSFont)
 
 I understand that the NSFont is UIFont on the iphone, or has similarities.
 so i implemented a Delegate method to replace the class.
 //--
 - (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver 
 cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray 
 *)classNames{
   if ([name isEqualToString:@NSFont])
   return [UIFont class];
 
   return nil;
 }
 
 but that never gets called because the class method does not allow for a 
 delegate and instantiating the unarchiver class confuses me in how I should 
 trigger the decoding once it is instantiated.
 
 Any pointers ?

You're going to run into worse problems - UIFont is not NSFont, nor can you 
trivially substitute one for the other.

In general, while you can archive an NSAttributedString on OS X and unarchive 
it on iOS, it's not going to work the way you want it to.  Any of the 
interesting properties that define things like appearance of the string, are 
platform specific.  There is no NSForegroundAttributeName, for example, on 
iOS, and even if you explicitly look for appropriate key, on OS X this will 
contain an NSColor, which, of course, does not exist on iOS (and UI color is 
similar, but the encoding of NSColor is undocumented, so even if you attempt to 
manually handle the decoding and try to make a UIColor, it would require that 
undocumented information - not to mention that there are parts of NSColor such 
as color space that don't exist at all on iOS).  Similarly for font 
information, paragraph style (including alignment, tabs, margins), embedded 
images, etc...

You might be able to get away with using CoreText and it's attributes (which 
are based on CG/CT objects like CGColor and CTFont), but obviously that's not 
what you're going to get from AppKits default attributed string support. So 
you'll probably have to give up on using AppKit's NSAttributedString extensions 
all together, and switch to the CoreText ones (and take advantage of the 
CFAttributedString/NSAttributedString toll free bridging).



Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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: Handling NSManagedObjectContextDidSaveNotification from different threads

2010-08-11 Thread Rick Mann

On Aug 11, 2010, at 13:16:28, Kyle Sluder wrote:

 http://www.cocoabuilder.com/archive/message/cocoa/2009/5/29/237809

This thread refers to a debug version of Core Data. I looked through my ADC 
assets, but don't see that anywhere. Does anyone know where I can find it?

-- 
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: Updating timestamp on save = merge error

2010-08-11 Thread Gideon King
Thanks Jerry

Yes, those are the things I had thought of - unfortunately the save type comes 
across as Save As for the first save too, and also I really should be setting 
it for a Save As anyway. I could get around it by using the merge policy, but 
that may well hide some other, real issues. It may be my best option though.

I'm surprised nobody else appears to have faced this problem, or even chimed in 
to say that they were setting a timestamp and didn't have the problem, in which 
case I would go looking elsewhere for the real cause, but from what I can see 
at the moment, it really does look like a simple case of you can't set a value 
between the saveDocument: and the actual saving of the document, without it 
giving the merge error.

Yes, I have tried moving the update right up to the saveDocument: and 
saveDocumentAs:, and I have another attribute that gets updated called 
saveCount, and if I only update that attribute, I still get the merge error, 
but if I update neither, then the Save As works fine. So I'm pretty sure I have 
narrowed it down to that one thing.

So I guess I'll just have to bite the bullet and change the merge policy.

Thanks again

 
 I've probably oversimplified your problem, but it seems that not updating 
 your timestamp in -saveToURL:ofType:forSaveOperation:error: if the 
 forSaveOperation: parameter == NSSaveAsOperation would help.  Core Data 
 doesn't do anything until you invoke super in there.  And/or as far as can't 
 merge the changes, you can clear those with -[NSManagedObjectContext 
 setMergePolicy:].
 
 

___

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: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread Ricky Sharp

On Aug 11, 2010, at 4:32 PM, glenn andreas wrote:

 
 On Aug 11, 2010, at 3:53 PM, Sandro Noël wrote:
 
 Greetings
 
 I'm having problems unarchiving my data in the iphone.
 
 here is the workout.
 
 1: I archive a AttributedString to my CoreData NSData property using 
 NSKeyedarchiver
 2: Transfer the database to the iphone.
 3: load the data using NSKeyedUnarchiver on the iphone.
 NSAttributedString *as = (NSAttributedString*)[NSKeyedUnarchiver 
 unarchiveObjectWithData:attributedStringData];
 
 that crashes saying:
 -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class 
 (NSFont)
 
 I understand that the NSFont is UIFont on the iphone, or has similarities.
 so i implemented a Delegate method to replace the class.
 //--
 - (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver 
 cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray 
 *)classNames{
  if ([name isEqualToString:@NSFont])
  return [UIFont class];
 
  return nil;
 }
 
 but that never gets called because the class method does not allow for a 
 delegate and instantiating the unarchiver class confuses me in how I should 
 trigger the decoding once it is instantiated.
 
 Any pointers ?
 
 You're going to run into worse problems - UIFont is not NSFont, nor can you 
 trivially substitute one for the other.
 
 In general, while you can archive an NSAttributedString on OS X and unarchive 
 it on iOS, it's not going to work the way you want it to.  Any of the 
 interesting properties that define things like appearance of the string, 
 are platform specific.  There is no NSForegroundAttributeName, for example, 
 on iOS, and even if you explicitly look for appropriate key, on OS X this 
 will contain an NSColor, which, of course, does not exist on iOS (and UI 
 color is similar, but the encoding of NSColor is undocumented, so even if you 
 attempt to manually handle the decoding and try to make a UIColor, it would 
 require that undocumented information - not to mention that there are parts 
 of NSColor such as color space that don't exist at all on iOS).  Similarly 
 for font information, paragraph style (including alignment, tabs, margins), 
 embedded images, etc...
 
 You might be able to get away with using CoreText and it's attributes (which 
 are based on CG/CT objects like CGColor and CTFont), but obviously that's not 
 what you're going to get from AppKits default attributed string support. So 
 you'll probably have to give up on using AppKit's NSAttributedString 
 extensions all together, and switch to the CoreText ones (and take advantage 
 of the CFAttributedString/NSAttributedString toll free bridging).


What you could do is continue to use the best possible API on both OS flavors.  
Then, instead of archiving platform-specific objects, archive primitives that 
describe the object instead.

For example, if you have an NSColor on Mac OS X, archive the color components, 
etc. as needed.  Then, when unarchiving on iOS, rebuild up an appropriate 
UIColor.

This is I think the only thing you can do to basically future-proof your code 
(or come very close to it).  Attempting to pick a set of objects that just 
happen to be archived the same exact way between OS flavors just seems too 
fragile.  And, using those objects may not be the simplest thing to do on each 
specific OS.
___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.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: iphone large image downloading

2010-08-11 Thread Dave Camp
The UIImage class docs indicate you shouldn't create images larger than 1024 x 
1024. You will either need to make sure your server will never send down an 
image larger than that, or download the image and downsample it to a reasonable 
size.

Dave

On Aug 11, 2010, at 12:46 AM, SanthoshKumarGundu wrote:

 Hi,
 
 Can any one  have an idea of  what is the maximum  image limit(size and 
 resolution) in iphone?.
 
 There are some images in web server. In my application , I am  getting  these 
 as NSData (one image at a time)  and displaying the image  using the 
 following code
 
 NSData *imageData = [[NSData alloc]initWithContentsOfURL:[NSURL 
 URLWithString:imageURLString]];
 UIImage *sampleImage = [UIImage imageWithData:imageData];
 
 This is working fine for small images ( upto  1MB of size and resolution of 
 1024*1024).
 
 But for large images ( 3MB size and resolution of 2500*2500), the application 
 is getting crashed.
 
 Can any one advise me on this.

___

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 large image downloading

2010-08-11 Thread David Duncan
On Aug 11, 2010, at 3:31 PM, Dave Camp wrote:

 The UIImage class docs indicate you shouldn't create images larger than 1024 
 x 1024. You will either need to make sure your server will never send down an 
 image larger than that, or download the image and downsample it to a 
 reasonable size.


This particular language has been relaxed somewhat. As of iOS 3, creating and 
using images larger than 1024 in either dimension should work, as long as you 
have the memory for it.

Of course, a 2.5K square image consumes about 24MB when decompressed. That 
should generally work on devices that have more built in memory, but is almost 
certain to fail on older devices that do not. But 24MB is still a huge amount 
of memory to consume on a single image that the user can't even see all at once.
--
David Duncan

___

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: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread Sandro Noël
Glenn  Ricky thank you for the insight.

The reason I am trying to pass the attributed string from one platform to the 
other
is exactly because I am using CoreText to render the string.


is there a way to render plain RTF strings with core Text?

best regards. 

On 2010-08-11, at 5:32 PM, glenn andreas wrote:

 You might be able to get away with using CoreText and it's attributes (which 
 are based on CG/CT objects like CGColor and CTFont), but obviously that's not 
 what you're going to get from AppKits default attributed string support. So 
 you'll probably have to give up on using AppKit's NSAttributedString 
 extensions all together, and switch to the CoreText ones (and take advantage 
 of the CFAttributedString/NSAttributedString toll free bridging).
 
 
 
 Glenn Andreas  gandr...@gandreas.com 
 The most merciful thing in the world ... is the inability of the human mind 
 to correlate all its contents - HPL
 

___

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: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread Kyle Sluder
On Wed, Aug 11, 2010 at 3:56 PM, Sandro Noël apple.li...@gestosoft.com wrote:
 is there a way to render plain RTF strings with core Text?

As David Duncan suggested in the previous thread you posted, you need
to write and read this information yourself. There is no RTF support
on iOS.

You might want to look into using a custom plist-based representation.

--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: CGImage to NSImage, or PDFPage?

2010-08-11 Thread Brian Postow

On Aug 11, 2010, at 2:03 PM, Rafael Cerioli wrote:

 Hi,
 
 Images are stored as XObjects in the PDF Stream. Either you can parse the 
 stream yourself, or you use the Voyeur.app sample code, and you will get the 
 image with its size.
 

Yeah, I was hoping there was a way to do it without doing that...

Using Voyeur, I was able to confirm that I am successfully putting the 
resolution INTO the PDF. The media box is correctly in pts, 612 x 792, and the 
images are correctly in pixels.

However, when I get the image OUT of the PDF, I lose the pixel data, only 
getting the media box size. 
I've tried getting the image out in two ways:

one was to get the datarepresentation of the PDFPage, and then put that into an 
NSImage. The NSImage is 612x792 pixels.

The other is to draw the PDFPage into an offscreen graphics context. 
Unfortunately, in order for that to work correctly, I need to know the size of 
the image in pixels before hand! 

Is there any way to get access to the xObjects in the PDFPage, other than 
parsing through the PDF data?

Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS

2010-08-11 Thread Sandro Noël
That's a good idea, i did not think of that, i could store the basic properties
and rebuild it on the other side... a little more work but independent.

thank you!
Sandro.

P.S. : I did look at the RTF Class from Omni, but it is tied to the framework
and I did not want to include a framework for just a little fancy text.


 
 You might want to look into using a custom plist-based representation.
 
 --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: CGImage to NSImage, or PDFPage?

2010-08-11 Thread John Calhoun
On Aug 11, 2010, at 5:27 PM, Brian Postow wrote:
 Is there any way to get access to the xObjects in the PDFPage, other than 
 parsing through the PDF data?

Unfortunately, no. Hackish as it may be, perhaps you can store the original 
image resolution/size as metadata in the PDF.

All this back and forth between bitmap formats and PDF-as-container format 
though has me wondering if there isn't a better way. I don't know what you're 
trying to accomplish though so perhaps you have the optimal solution.

John Calhoun—


___

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: CGImage to NSImage, or PDFPage?

2010-08-11 Thread Brian Postow

On Aug 11, 2010, at 8:42 PM, John Calhoun wrote:

 On Aug 11, 2010, at 5:27 PM, Brian Postow wrote:
 Is there any way to get access to the xObjects in the PDFPage, other than 
 parsing through the PDF data?
 
 Unfortunately, no. Hackish as it may be, perhaps you can store the original 
 image resolution/size as metadata in the PDF.
 

Am I allowed to invent metaData to put into my PDFs? hmmm, yeah, that's pretty 
hackish...

 All this back and forth between bitmap formats and PDF-as-container format 
 though has me wondering if there isn't a better way. I don't know what you're 
 trying to accomplish though so perhaps you have the optimal solution.

Oh, I realized that already. I got rid of the PDF as container. instead I have 
an NSMutableArray of CGImages. (actually a simple class with a CGImage and the 
resolution)
 Now I'm worried about loading PDF files that have been saved...


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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 Camera

2010-08-11 Thread koko

Can an iPhone app get input from the camera?

-koko
___

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 Camera

2010-08-11 Thread John C. Randolph

On Aug 11, 2010, at 6:24 PM, k...@highrolls.net wrote:

 Can an iPhone app get input from the camera?

Yes.

-jcr

___

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 Camera

2010-08-11 Thread Kyle Sluder
On Wed, Aug 11, 2010 at 6:24 PM,  k...@highrolls.net wrote:
 Can an iPhone app get input from the camera?

No, all of the easily-findable documentation about using the camera is
lying to you. As are all of the camera-using apps in the App store.

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