What is the best way to read files in an EventMachine-based app?

EM. Attach/watch cannot be used on files, as select/epoll on a disk-based file descriptor will always return readable Ultimately, it depends on what you're trying to do. If it's a small file, just File.

Read it. If it is larger, you can read small chunks over time. For example, EM::FileStreamer does this to send large file over the network Another common use-case is to tail a file and read in new contents when it changes.

This can be achieved using EM. Watch_file: github.com/jordansissel/eventmachine-tail.

EM. Attach/watch cannot be used on files, as select/epoll on a disk-based file descriptor will always return readable. Ultimately, it depends on what you're trying to do.

If it's a small file, just File. Read it. If it is larger, you can read small chunks over time.

For example, EM::FileStreamer does this to send large file over the network. Another common use-case is to tail a file and read in new contents when it changes. This can be achieved using EM.

Watch_file: github.com/jordansissel/eventmachine-tail.

Basically I want to read a few moderately large files (up to 10 Mb) in parallel and extract a piece of each line. – Theo May 5 '10 at 18:48 If the operation you need to perform is per-line, then reading a line of the file on each tick seems to make the most sense. You'd get the benefit of all of Ruby's line-based IO methods, your event blocks would most closely reflect your business logic, and doing less in each block simply means the ticks would happen faster.

– SFEley Jun 4 '10 at 18:04 Reading a line on each tick is too slow because I spend time inside the reactor waiting for IO, and that's what I want to avoid, I want to do other things (like process the line) while waiting for IO. – Theo Jun 4 '10 at 20:39.

PDF files are by far the most used medium for reading e-books on desktop computers as well as on mobile devices. Adobe is the name that is sure to spring to your mind as soon as your hear the word PDF mentioned. Adobe Reader is, arguably, the most widely used PDF reader for desktop computers, and has had an Android client for quite some time now.

It took Adobe a lot of time to release a variant for iOS, maybe because of the Flash-point between Adobe and Apple (pun intended), but better late than never. The app does make up for being late by offering a variety of really cool features, and you can use it to manage every aspect of your PDF files rather than using it as a simple PDF reading app. On our iPad 2, the app looks positively luscious.

The interface is just marvelous and exactly what you would expect from Adobe. You can read PDF files in the app both in portrait and landscape view, and the scrolling is very smooth. The slider at the bottom of the screen lets you easily navigate between pages and displays a preview of each as you do.

In short, the interface of Adobe Reader is definitely its greatest strength. Now, let’s move on to some of the other features of the app. The app does give a roundup of its functionality in the help document that comes packed with it (which is in PDF format, of course), but here’s an overview just for your convenience.

Using the Open In button, you can use Adobe Reader to read files directly from mail, Safari or a third party app. It is also possible to get PDFs into your iOS device via iTunes. Once you have opened a document with Reader, it will become available in its library for later viewing as well.

You can add multiple bookmarks to a doc and choose between the kind of views you would want for a file. The app also offers pretty decent sharing options using which you can share a PDF via email or open it in any other app (including iBooks) which supports the file format. Adobe Reader for iOS also supports password protected files (which have been quite an issue in the past), plus enterprise clients can use the app to manage LiveCycle files.

You can grab this free app at the download link given below.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions