realbasic-nug
[Top] [All Lists]

Re: Best way to handle loss of ResourceFork

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Best way to handle loss of ResourceFork
From: Joe Strout <joe@inspiringapps.com>
Date: Thu, 31 Jul 2008 08:45:24 -0600
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <p0600200cc4b777ca6932@[137.187.213.59]>
References: <mailman.3026.1217477886.19703.realbasic-nug@lists.realsoftware.com> <p0600200cc4b777ca6932@[137.187.213.59]>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
On Jul 31, 2008, at 8:25 AM, jda wrote:

I have a series of ancillary text files whose names my app displays to the user in a listbox. These files contain connection information that my app uses to access different Internet sites. There is one function (it doesn't matter what) that can be enabled or disabled, and I want the user to see that in the listbox display.

My solution has been to add a resource of my own making to each file that contains text, either "true" or "false". If "true", the name of the file is displayed in italics in the listbox. If "false" it is displayed in plain text. So all I need do is check the resource of each file (there may be many hundreds of them) and then set the text style of the listbox cell accordingly.

This was a good solution only if this enabled/disabled state wasn't particularly important to the function of the app. For example, BBEdit used to store a little data in the resource fork about the current cursor position and font size, but if that info got lost (as could easily happen to a text file when transmitted by ftp, checked in/ out of subversion, etc.), it was no big loss -- it was just "extra" data.

But if this is essential data, then I wouldn't consider this a very good solution, as users who do transmit your files by ftp or try to use them with svn or whatever will be disappointed when they break.

Without the resource fork, I can see only two solutions when I iterate over each of these files. One is to open each file, read in the data, determine if the function is enabled or not, close the file, and then set the listbox. This is clearly a poor solution with many hundreds of files to examine.

That's not so clear to me. If you can put this enabled/disabled flag at the start of the file, then it will be no slower to open the file and read that much of it than it would be to open the resource fork and read that resource.

If not, then I agree it's a somewhat harder case... but probably still not going to be so much slower that users would actually notice the difference.

Best,
- Joe


--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com




_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>