• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
BOOL takeStupidRoad = NO (search app design question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOOL takeStupidRoad = NO (search app design question)


  • Subject: BOOL takeStupidRoad = NO (search app design question)
  • From: David Yamartino <email@hidden>
  • Date: Sat, 21 Mar 2009 20:24:13 +1000

Hi All,

I have a general design question. I'm going through the latest Hillegass and
Kochan programming books for the purpose of writing a simple search app. I
think I've figured out a way to do this, but having no experience in
programming, I have no idea if my approach is good or bad. I'd rather not
take the stupid road if I can avoid it, so I'm hoping someone may be able to
set me straight before I go too far down the road.

So if you're inclined to take a few minutes to consider what I've written
below, I'd appreciate it.

In any case, good luck with your projects,

 David

--------------------------------------------------------------------------------------------

*APPLICATION DESCRIPTION:*
I have a library of about 1,500 text files, about 93 MB total.

The application window opens with two views: left view shows the hierarchy
of folders/files, and when you click on a file, the text of the file appears
in the right view, where you can read, scroll, etc.

The user inputs a term into the search field, and when the search is
executed, the folders/files on the left view disappear and the view is
repopulated with a new hierarchy showing only the folders/files where the
search term appears. Below each file will be snippets of where the term
appears within the text. Click on a snippet and the right view will show the
entire text of the file zoomed to where the snippet appears.

For example, if the search term is "child education":

*Book X*
   The *child education* conference focused on two age groups: 5-7 years,
and 8-10 years.
     .  .  . because the *child* wasn't receiving the needed attention in
her *education*, her parents decided  .  .  .
     .  .  .  and over the years the *child education* policy was broadened
to include moral education and  .  .  .


*MY APPROACH*:
I can load the text of the 1,500 files into 1500 NSStrings with something
like

stringWithContentsOfFile


 Then I can search the 1,500 NSStrings to locate the position of the search
term within each string, then extract a range (including some words before
and some words after) to make the snippets. Using


 rangeOfString

NSMakeRange

etc.



*QUESTION:*

Would this be a workable approach? Or is it a really stupid idea to have to
load 93 MB of files into 1,500 NSStrings every time the program starts up?
If not this approach, what would be more efficient?


Thanks.
_______________________________________________

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

  • Follow-Ups:
    • Re: BOOL takeStupidRoad = NO (search app design question)
      • From: Izidor Jerebic <email@hidden>
  • Prev by Date: Avoiding Flicker with OpenGL View when Moving Divider of a Split View
  • Next by Date: Threaded Server using Distributed Objects
  • Previous by thread: [Solved] Need help animating a view-switch
  • Next by thread: Re: BOOL takeStupidRoad = NO (search app design question)
  • Index(es):
    • Date
    • Thread