Re: Cocoa-dev Digest, Vol 8, Issue 941
Re: Cocoa-dev Digest, Vol 8, Issue 941
- Subject: Re: Cocoa-dev Digest, Vol 8, Issue 941
- From: Mazen Abdel-Rahman <email@hidden>
- Date: Tue, 29 Nov 2011 16:28:48 -0700
Sent from my iPhone
On Nov 29, 2011, at 1:01 PM, email@hidden wrote:
> Send Cocoa-dev mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
>
>
> Today's Topics:
>
> 1. Cocoa Resources (James Merkel)
> 2. NSTableView Bindings and Numbered Lines... (Ben)
> 3. How to display HTML in proper format in a NSTextView
> (Sandeep Mohan Bhandarkar)
> 4. Weird Core Data crash (Andrew Kinnie)
> 5. Re: NSTableView Bindings and Numbered Lines... (Fritz Anderson)
> 6. Re: How to display HTML in proper format in a NSTextView
> (Fritz Anderson)
> 7. Re: Weird Core Data crash (Fritz Anderson)
> 8. Re: NSTableView Bindings and Numbered Lines... (Ben)
> 9. Re: How to display HTML in proper format in a NSTextView
> (Jens Alfke)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 28 Nov 2011 17:25:43 -0800
> From: James Merkel <email@hidden>
> Subject: Cocoa Resources
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> For what it's worth, a couple of resources that I have recently run across that might be useful for Cocoa developers are:
>
> 1) An itunes video course on development for the iPhone by Dr Brad Larson:
> http://itunes.apple.com/itunes-u/advanced-iphone-development/id407243032
>
> Although a year old it has lots of useful information -- even if you are developing for the Mac rather than the iPhone/iPad.
>
> 2) Stackoverflow
> http://stackoverflow.com/
>
> Stackoverflow is a question/answer site that is not language specific.
> You can ask questions related to Cocoa, Xcode, OSX, iPhone, or iPad development.
> Or you can ask questions related to algorithms.
> If you do Google searches, a lot of hits will be to this site.
>
> Jim Merkel
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 29 Nov 2011 09:05:00 +0000
> From: Ben <email@hidden>
> Subject: NSTableView Bindings and Numbered Lines...
> To: cocoa-dev List <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> I have an NSTableView which gets it's data from Core Data via Bindings, and I want to give each row a line number. I'm not sure of the best way how.
>
> Had I have used a TableView Data Source (like I normally do) this task would be easy, but I'm struggling to do this 'the bindings way'.
>
> (before anyone suggests adding a extra attribute to my core data entity, this would not work because of the column ordering).
>
>
> Thanks in advance.
>
> ------------------------------
>
> Message: 3
> Date: Tue, 29 Nov 2011 01:27:41 -0800
> From: Sandeep Mohan Bhandarkar <email@hidden>
> Subject: How to display HTML in proper format in a NSTextView
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=us-ascii
>
> Hi All,
>
> I am trying to display HTML content in a NSTextView in such a way that the HTML content is visible within the Text area and the user can also edit the Non HTML sections. for doing this I have made use of the following
> code.
>
> NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:htmlData documentAttributes:NULL];
> [[responseTextView textStorage] setAttributedString:attrString];
>
> Here htmlData is an NSData object that has been initialized with the contents of an HTML File. However on doing this the HTML Displayed in the Text view does not seem to be formatted correctly. Please see the figure below.
>
>
>
>
> Can some one let me know how we can display the HTML with the appropriate spacing etc.
>
> Thanks and Regards,
> Sandeep Mohan Bhandarkar.
>
>
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Tue, 29 Nov 2011 08:21:35 -0500
> From: Andrew Kinnie <email@hidden>
> Subject: Weird Core Data crash
> To: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; CHARSET=US-ASCII
>
> Greetings,
>
> We have an app which uses Core Data as a data store for some of it's data, and had a crash with the following message:
>
> "NULL _cd_rawData but the object is not being turned into a fault"
>
> It LOOK like it is trying to turn a null into a fault, but this seems to be deep under the covers implantation stuff that I do not touch in general, so I am at a loss. I have looked it up on google, and basically have not found anywhere described anything similar, and we can't even replicate the crash. One possibility was multithreading issues, but as this is always run on its own thread with its own autorelease pool, I am not sure this is related.
>
> Our model has an Article entity which has an optional to-many to a MediaResource entity which has (optionally) a url, a url_small, a thumbnail_url and a thumbnail_url_small, all of which are strings.
>
> The app is multithreaded and we have a method we run in the background (performSelectorInBackground) returning an NSSet:
>
> {
> NSMutableSet *images = [[NSMutableSet alloc] init];
> for (NSArray *mediaArray in [[self favoriteArticles] valueForKey:@"media"]) {
> for (MediaResource *mediaObject in mediaArray) {
> if (NSSTRING_HAS_DATA(mediaObject.url)) [images addObject:mediaObject.url];
> if (NSSTRING_HAS_DATA(mediaObject.url_small)) [images addObject:mediaObject.url_small];
> if (NSSTRING_HAS_DATA(mediaObject.thumbnail_url)) [images addObject:mediaObject.thumbnail_url];
> if (NSSTRING_HAS_DATA(mediaObject.thumbnail_url_small)) [images addObject:mediaObject.thumbnail_url_small];
> }
> }
> return [images autorelease];
> }
>
> This method may be called from the main thread or from a background thread, but is always called using performSelectorInBackground.
>
> One thing we considered was adding the strings to the set using copy rather than directly adding the string. However, as we have not been able to replicate the crash, we have no idea if this would solve whatever problem there is.
>
> Anyone have any insight?
>
> Andrew
>
>
> ------------------------------
>
> Message: 5
> Date: Tue, 29 Nov 2011 07:30:50 -0600
> From: Fritz Anderson <email@hidden>
> Subject: Re: NSTableView Bindings and Numbered Lines...
> To: Ben <email@hidden>
> Cc: cocoa-dev List <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> On 29 Nov 2011, at 3:05 AM, Ben wrote:
>
>> I have an NSTableView which gets it's data from Core Data via Bindings, and I want to give each row a line number. I'm not sure of the best way how.
>>
>> Had I have used a TableView Data Source (like I normally do) this task would be easy, but I'm struggling to do this 'the bindings way'.
>
> Bindings don't break the table delegate and data source protocols. You can mix.
>
> � F
>
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 29 Nov 2011 07:40:40 -0600
> From: Fritz Anderson <email@hidden>
> Subject: Re: How to display HTML in proper format in a NSTextView
> To: Sandeep Mohan Bhandarkar <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> On 29 Nov 2011, at 3:27 AM, Sandeep Mohan Bhandarkar wrote:
>
>> Here htmlData is an NSData object that has been initialized with the contents of an HTML File. However on doing this the HTML Displayed in the Text view does not seem to be formatted correctly. Please see the figure below.
>
> The mailing list doesn't pass attachments. Could you post your picture to some publicly-available web site? And then post to the list the URL, and a better description of the problem than "not... formatted correctly." Perhaps your web posting could use the HTML (preferably on the same page) so we can see what you intend. But you should still describe what you feel is incorrect.
>
> Also, perhaps you could pass an NSDictionary* pointer into initWithHTML:attributes:, and tell us what the resulting attributes are.
>
> � F
>
>
>
> ------------------------------
>
> Message: 7
> Date: Tue, 29 Nov 2011 07:51:32 -0600
> From: Fritz Anderson <email@hidden>
> Subject: Re: Weird Core Data crash
> To: Andrew Kinnie <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> On 29 Nov 2011, at 7:21 AM, Andrew Kinnie wrote:
>
>> This method may be called from the main thread or from a background thread, but is always called using performSelectorInBackground.
>
> It's not enough that you divert the call to _a_ background thread. You must send it to _the_ background thread that owns the managed-object context.
>
> If necessary (you can't exchange the data between threads through non-CD immutable types), each thread that does business with your persistent store should have its own MOC, coordinate its content with NSManagedObjectContextDidSaveNotification, and query/update the store only through its MOC.
>
> � F
>
>
>
> ------------------------------
>
> Message: 8
> Date: Tue, 29 Nov 2011 14:04:28 +0000
> From: Ben <email@hidden>
> Subject: Re: NSTableView Bindings and Numbered Lines...
> To: cocoa-dev List <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
> Aha OK thanks, for some reason I was under the impression that it did.
>
> Just to expand my knowledge though, I would still be interested in how (or if) it would be possible to achieve in bindings...
>
>
> On 29 Nov 2011, at 13:30, Fritz Anderson wrote:
>
>> On 29 Nov 2011, at 3:05 AM, Ben wrote:
>>
>>> I have an NSTableView which gets it's data from Core Data via Bindings, and I want to give each row a line number. I'm not sure of the best way how.
>>>
>>> Had I have used a TableView Data Source (like I normally do) this task would be easy, but I'm struggling to do this 'the bindings way'.
>>
>> Bindings don't break the table delegate and data source protocols. You can mix.
>>
>> � F
>>
>
>
>
> ------------------------------
>
> Message: 9
> Date: Tue, 29 Nov 2011 09:31:51 -0800
> From: Jens Alfke <email@hidden>
> Subject: Re: How to display HTML in proper format in a NSTextView
> To: Sandeep Mohan Bhandarkar <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
>
> On Nov 29, 2011, at 1:27 AM, Sandeep Mohan Bhandarkar wrote:
>
>> Here htmlData is an NSData object that has been initialized with the contents of an HTML File. However on doing this the HTML Displayed in the Text view does not seem to be formatted correctly. Please see the figure below.
>
> An NSTextView isn�t a WebView; it�s an entirely different layout engine. It can�t display everything that can be represented in HTML, just the basics. If you need to display HTML content accurately you�ll need to use a WebView.
>
> �Jens
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: smime.p7s
> Type: application/pkcs7-signature
> Size: 4885 bytes
> Desc: not available
> Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20111129/d08a8059/smime.bin
>
> ------------------------------
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
> http://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
> End of Cocoa-dev Digest, Vol 8, Issue 941
> *****************************************
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden