Search Results

Search found 61 results on 3 pages for 'textfiles'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • I Need a Human Readable, Yet Parse-able Document Format

    - by macinjosh
    I'm working on one of those projects where there are a million better ways to accomplish what I need but I have no choice and I have to do it this way. Here it is: There is a web form, when the user fills it out and hits a submit a human readable text file is created using the form data. It looks like this: field_1: value for field one field_2: value for field two more data for field two (field two has a newline in it!) field3: some more data My problem is this: I need to parse this text file back into the web form so that the user can edit it. How could I, in a foolproof way, accomplish this? A database is not an option, I have to use these text files. My Questions: Is there a foolproof way to do this using the format in the example above? What human readable format would work better (in other words I can change the format) Human readable means that a non programmer could read it and know what is what. This project uses PHP.

    Read the article

  • Reading text files line by line, with exact offset/position reporting

    - by Benjamin Podszun
    Hi. My simple requirement: Reading a huge ( a million) line test file (For this example assume it's a CSV of some sorts) and keeping a reference to the beginning of that line for faster lookup in the future (read a line, starting at X). I tried the naive and easy way first, using a StreamWriter and accessing the underlying BaseStream.Position. Unfortunately that doesn't work as I intended: Given a file containing the following Foo Bar Baz Bla Fasel and this very simple code using (var sr = new StreamReader(@"C:\Temp\LineTest.txt")) { string line; long pos = sr.BaseStream.Position; while ((line = sr.ReadLine()) != null) { Console.Write("{0:d3} ", pos); Console.WriteLine(line); pos = sr.BaseStream.Position; } } the output is: 000 Foo 025 Bar 025 Baz 025 Bla 025 Fasel I can imagine that the stream is trying to be helpful/efficient and probably reads in (big) chunks whenever new data is necessary. For me this is bad.. The question, finally: Any way to get the (byte, char) offset while reading a file line by line without using a basic Stream and messing with \r \n \r\n and string encoding etc. manually? Not a big deal, really, I just don't like to build things that might exist already..

    Read the article

  • Comparing text files w/ Junit

    - by jon077
    I am comparing text files in junit using: public static void assertReaders(BufferedReader expected, BufferedReader actual) throws IOException { String line; while ((line = expected.readLine()) != null) { assertEquals(line, actual.readLine()); } assertNull("Actual had more lines then the expected.", actual.readLine()); assertNull("Expected had more lines then the actual.", expected.readLine()); } Is this a good way to compare text files? What is preferred?

    Read the article

  • Delphi - Sharing violation opening text file

    - by Simes
    I'm trying to open a text file for reading in a Delphi 7 app, but am getting I/O error 32 (sharing violation) because another application already has the file open. I've tried setting FileMode to "fmOpenRead or fmShareDenyNone" but now realise this doesn't apply to text files anyway. Is there a way of reading text files that are open by another application? var f: TextFile; begin FileMode := fmOpenRead or fmShareDenyNone; // FileMode IS NOT APPLICABLE TO TEXT FILES!! AssignFile(f, FileName); Reset(f);

    Read the article

  • How to retain similar character encoding

    - by Mystere Man
    I have a logfile that contains the half character ½, I need to process this log file and rewrite certain lines to a new file, which contain that character. However, when I write out the file the characters appear in notepad incorrectly. I know this is some kind of encoding issue, and i'm not sure if it's just that the files i'm writing don't contain the correct bom or what. I've tried reading and writing the file with all the available encoding options in the Encoding enumeration. I'm using this code: string line; // Note i've used every version of the Encoding enumeration using (StreamReader sr = new StreamReader(file, Encoding.Unicode)) using (StreamWRiter sw = new StreamWriter(newfile, false, Encoding.Unicode)) { while ((line = sr.ReadLine()) != null) { // process code, I do not alter the lines, they are copied verbatim // but i do not write every line that i read. sw.WriteLine(line); } } When I view the original log in notepad, the half character displays correctly. When I view the new file, it does not. Can anyone help me to solve this?

    Read the article

  • Using DirectoryInfo in C#

    - by pm_2
    If there a more efficient way to do the following: DirectoryInfo di = new DirectoryInfo(@"c:\"); newFileName = Path.Combine(di.FullName, "MyFile.Txt"); I realise that it’s only two lines of code, but given that I already have the directory, it feels like I should be able to do something like: newFileName = di.Combine(“MyFile.txt”);

    Read the article

  • Which would be better? Storing/access data in a local text file, or in a database?

    - by TerranRich
    Basically, I'm still working on a puzzle-related website (micro-site really), and I'm making a tool that lets you input a word pattern (e.g. "r??n") and get all the matching words (in this case: rain, rein, ruin, etc.). Should I store the words in local text files (such as words5.txt, which would have a return-delimited list of 5-letter words), or in a database (such as the table Words5, which would again store 5-letter words)? I'm looking at the problem in terms of data retrieval speeds and CPU server load. I could definitely try it both ways and record the times taken for several runs with both methods, but I'd rather hear it from people who might have had experience with this. Which method is generally better overall?

    Read the article

  • Search in big text log files

    - by 0xFF
    Hi, let's say you have an game server which creating text log files of gamers actions, and from time to time you need to lookup something in those logs files (like investigating an scam or loosing an item). Just for example you have 100 files and each file have size between 20MB and 50MB - How you would search them quickly? What I have already tried to do is create several threads and each invidual thread will map his own file to memory (let say memory should not be problem if it not exceed 500MB of ram) perform search here, result was something around 1 second per file : File:a26.log - read in: 0.891, lines: 625282, matches: 78848 Is there better way how to do that ? - because it seems to me kinda slow. thanks. (java was used for this case)

    Read the article

  • join 3 files by first Column with awk ?

    - by noinflection
    i have three similar files, they are all like this: File A ID1 Value1a ID2 Value2a . . . IDN Value2n and i want an output like this Output ID1 Value1a Value1b Value1c ID2 Value2a Value2b Value2c ..... IDN ValueNa ValueNb ValueNc Looking to the first line, i want value1A to be the value of id1 in fileA, value1B the value of id1 in fileB, and so on which each field and each line. I thougth it like a sql join. I've tried several things but none of them where even close.

    Read the article

  • Picking all the Text files from hard disk from c++

    - by muhammad-aslam
    Hello Frierndz u r very helping............. plz help me as i am doing my project where i have to search the user input from all the text files of hard disk in c++ i am not able to do so.... plz help what i have to do. which library will be helpful for me to pick text files directory from hard drive i m using visual studio C++

    Read the article

  • Reading bytes from a text file that has the form of machine code in C?

    - by rashid
    I have a text file with machine code in this form: B2 0A 05 B2 1A 01 B3 08 00 17 B2 09 18 where an instruction has this format: OP Mode Operand Note: Operand could be 1 or 2 bytes. Where:(example) OP = B2 Mode = 0A Operand = 05 How can I read the bytes in a variable? As shown in the above example. When i read the file I get individual characters. I have an array of pointers where I read individual line, but still cannot solve the problem of reading a byte. Any ideas,suggestions. I hope I am not confusing anyone here. Thank you.

    Read the article

  • Is there a generic class to write structured Text Files?

    - by Burnsys
    I have several projects that need to write structured Textfiles, some with fixed size fields, other delimited by characters. Is there a .net class that could be used for that? I know there is a "Microsoft.VisualBasic.FileIO.TextFieldParser" that is useful for reading textfiles, i am actually searching for a ""Microsoft.VisualBasic.FileIO.TextFieldWriter" Related: http://stackoverflow.com/questions/34182/reading-text-files-using-net

    Read the article

  • PHP: Problem with reading Files

    - by mathiregister
    hello guys, i wonder what i'm doing wrong! i want to read a folder and run through the existing files, checking if they are either images or textfiles. if there are textfiles they should be put into a div, if there are images the should be output as an image. <?php $path = 'thumbs'; if ($handle = opendir($path)) { while (false !== ($file = readdir($handle))) { $ext = pathinfo($file, PATHINFO_EXTENSION); if ($ext == "jpg" || $ext == "jpeg" || $ext == "gif" || $ext == "png") { print "<img class='thumb' src='$path/$file'/>"; } else if ($ext == "txt" || $ext == "rtf") { //read text $lines = file_get_contents($file); $lines = str_replace("\n","<br/>",$lines); print "<div class='text'>" . $lines . "</div>"; //read text } } closedir($handle); } ?> there seems to be a problem i can't find, because ALL IMAGES get put out, however only ONE of a few textfiles gets printed. Any ideas why it only prints out one textfile??? thank you for your help!

    Read the article

  • Can I do a "one-time" file content search in Windows Server 2008 without adding the folder to the index?

    - by G-.
    Can I search for files which contain a specific string in a folder if that folder is not in the search index? So, lets say folder 'textFiles' is not in the index. I navigate to this folder in windows explorer. I type '.ini' in the search box I want to see a result list containing only 'b.txt' FOLDER C:\textFiles\ FILE a.php CONTENT once twice thrice mice moose monkey FILE b.txt CONTENT mingle muddle middle.ini banana beer FILE c.spo CONTENT sellotape stapler phone book I do not have permission to add folders to the windows index and I do not have permission to install or run any executables that did not ship with the server or approved applications. I'd be happy with a windows native command line solution if necessary? Thanks G

    Read the article

  • Working with VSS and ASP.NET

    - by Tyzak
    hello, i created a project to search textfiles with lucene.net. [asp.net/vs08] these textfiles are in a VSS server. i'm looking for a way how to "check out" or "copy" a Document (later on the whole vss structure with documents) and put it on in a folder on an IIS Server. how can i do that? -- copy a document from vss TO Folder on IIS Server [ Later all documents in the original strucutre] bye the way, its important that the documents keep their original creationdate. thanks in advance

    Read the article

  • php cms withouth database

    - by user1791795
    A friend of mine asked me for a easy website for him. As it was just 3 subpages, no database need or anything, I've done it quite fast with plain PHP, HTML, JS and CSS. But then another and another friend showed up. They only wanted arrange differently they navigation, some different picutures etc. So I though, is there any kind of CMS, that allows build small business website (barbershop, local groceries shop), with small list of subpages, yet allowing us to arrange look'n'feel. There's no need for the databas as content won't change, or can be stored in simple textfiles for example. Things like WordPress might be simple overkill Does anyone know such cms?

    Read the article

  • What do you use to keep notes as a developer?

    - by Mike Duncan
    Where as a developer do like to you keep your code snippets, links, checklists, final solutions to problems etc? I've fooled with Google Notebook, MS Onenote, TreePad, textfiles, and Evernote a bit (currently leaning toward Evernote). All have pros and cons but none seem to be really suited to developers. Is anyone super-happy with a collection / note system that's not just generic GTD, but with developer-centric utility?

    Read the article

< Previous Page | 1 2 3  | Next Page >