search string in html files in iphone - iphone

I am very new to iphone.In my iphone application there are about hundred html files.I would like to search a string that the user enters in all these hundred html files and return the files that contain the string specified.
Is there any way that i could attain this in iphone?
Please forward your valuable suggestions.
Thanks in advance:)

Searching directly from the filesystem may be possible, but will be tremendously processor intensive. I recommend that you add the searchable contents of the files into a Sqlite database, or use a full-text search library like Lucene, or both.

Related

PDF generation from templated Word documents

I have a Word document(some template format) where it containing some placeholders for the data to be filled in and there are several Word documents like this which lies in some directory. When data comes I will be choosing different templates (based on some criteria) and fill the data and the documents have to be converted to PDF format.
I have been investigating Apache POI for this. If anyone has a good suggestion, it would be much appreciated.
As mbeckish mentioned you should indicate how you are going to run/automate this. For example is it one-off, run by hand or part of another program (and if so what programming languages do you use)?
If you are trying to automate it JODReports and Docmosis are tools that can use templates like you require and can produce PDF. JODReports is free. Docmosis is not but has several APIs. Please note I work for the company that develops Docmosis.
Hope that helps.
I've just uploaded this presentation, which presents three approaches for doing this.
Why not use any of existing PDF virtual printers?

Full text search in iOS application bundle files

How would I go about doing a full text search across a bunch of html files in an iOS application bundle? I need to have a lot of web content available offline and I need to be able to do a full text search across all of it. I feel like storing that content in a database will get a little bulky and slow things down significantly.
Thoughts?
--
Thanks,
Brandon
Do keep in mind that, even though it's a mobile device, the iPhone does have a fairly fast processor. All you're doing [said tongue-in-cheek] is searching text. These devices are built for video, music, and images.
In order of increasing amounts of coding on your part, you can:
Use a 3rd-party library (the only one I found is Locayta)
Port a non-Objective C search library (such as Lucene)
Store your HTML files in a database, and do a SQL search for any search text. Without a bunch of extra coding, this will really only work easily with exact matching on a single search term.
Manually load each file into the app and search the text using NSString's rangeOfString. Add features at will.
Build your own search engine, built off (at least) an index of terms. Start by trimming stop words, stem if you feel the need, decide if you want document relevance or not and possibly pursue vector space algorithms. Adding in autocorrect is probably beyond your app's focus, but nonetheless building your own text search engine would be a fast (run-time) way of providing multi-word search and a big bullet on your resume.

Multi-language documents (RTF) in iOS : Files, SQLite, Core Data ? How?

I'm making my first iOS App, and I'm facing my first (little) issue.
The App will be a very classical iOS UI Experience : I mean, table views, tab bar, push controllers etc. displaying documents (from RTF files already existing), audio and video files.
My RTFs have mixed languages, all supported by iOS, I think it's important isn't it ?
Considering audio and video will obviously stored in the sandbox documents directory, I'm not so sure for the RTF.
I want it to be very reactive, on every devices, so my idea was to store my RTFs in a Core Data entity (using the binary type) and getting it in my application with NSAttributedString which can respond to the initWithRtf message.
I guess that after that I'll have to load it into a UIWebView ? Or simply displaying this NSAttributedString into a textview will preserve it's formatting ?
But I don't know how to ship my application with a Core Data pre-filled database.
So here are my questions :
Is it a good idea to store those RTFs in Core Data ? Is it really faster than a simple UIWebView where I would load the RTF file from documents folder directly ? Maybe SQLite is better for my case ?
How to pre-fill a database into my application ?
Any specific consideration about the multiple languages into my RTFs ? (Latin AND non latin languages into a same file for exemple).
Thanks a lot ! Bye.
getting it in my application with NSAttributedString which can respond to the initWithRtf message.
That won't work. -initWithRTF:documentAttributes: is currently only available on OS X. To convert an RTF file into an NSAttributedString on iOS requires manual parsing of the file at the moment (let's hope that changes with iOS 5).
I guess that after that I'll have to load it into a UIWebView ? Or simply displaying this NSAttributedString into a textview will preserve it's formatting ?
UIWebView can't display NSAttributedStrings. Neither can UITextView. You would have to use the Core Text functions to draw the text yourself. Or use HTML from the beginning and display the text in a web view.
Is it a good idea to store those RTFs in Core Data ? Is it really faster than a simple UIWebView where I would load the RTF file from documents folder directly ? Maybe SQLite is better for my case ?
What's wrong with plain files? That would be my first option because it seems to be the simplest. You shouldn't worry about optimizing something if you don't know if it needs optimizing at all. But since you can store arbitrary binary data with Core Data or plain SQLite, it's definitely possible.
How to pre-fill a database into my application ?
Just include the Core Data datastore file in your app's bundle. If this database needs to be written to, your code needs to copy the file from the bundle to your app's Documents directory on first launch.

Is there an alternative to open-xml sdk to generate word documents

I'm trying to generate word documents using open xml sdk. When the documents are small this is no problem (and rather easy). When the documents become larger (+500 pages) I notice the peformance (duration, memory usage, ...) goes down significantly.
Googling this problem I came across some posts that point out the same problem. For excel there is a solution with spreadsheetgear.
I would like to know if there is a word alternative to this or if there are other solutions to generate word documents?
Thanks,
Jelle
I've written a blog post series on generating Open XML WordprocessingML documents. The approach that I take is that you create a template Word document, insert content controls, and then write XPath expressions in those content controls to specify the XML to pull from a source XML data file. I've also explored another approach where you write C# code in Open XML content controls. That approach also works.
http://ericwhite.com/blog/map/generating-open-xml-wordprocessingml-documents-blog-post-series/
-Eric
You might look at http://docx.codeplex.com/
On Java, you could use docx4j. If you were brave, you could create DLLs for it via IKVM...
I decided to go with Aspose Words. It is really fast and not very demanding on resources (CPU, memory). It has the disadvantage that it is quite expensive. I also investigated Softartisans Office writer. The posibilities are the same but due to fact that the company I'm currently working for already used other Aspose components we decided to go with Aspose Word.

Search file content on iphone

Is there an Iphone SDK API to search resource files?
I have a set of html file resources that I'd like the user to be able to search in, but I want to avoid reading the files into memory and searching them one by one.
Is there any API that can help me do this?
No, you'll have to read the files in to search them. There's nothing like "Spotlight" on the phone.
I would suggest you using SQLite FTS3 extension for full text search through your documents. It has quite good capabilities for it. But you will need to strip HTML tags first so it can index only your text and don't bother with tags