files

File Read/Write Locks

I have an application where I open a log file for writing. At some point in time (while the application is running), I opened the file with Excel 2003, which said the file should be opened as read-only. That's OK with me. But then my application threw this exception: System.IO.IOException: The process cannot access the file because ...

Cannot Delete Zip file Created by SharpZipLib (FastZip)

I'm creating a zip file using the class FastZip from SharpZipLib and once I after I close the program, I cannot delete the file because: "Cannot delete zip.zip: It is being used by another person or program. Close any programs that might be using the file and try again." The code that is generating the file is simply this: fZip.Create...

PHP: Process a CSV or XLS file

I need to let users pick a CSV or XLS file from their filesystem and press Submit and have PHP open it, look at it, decide if it is valid and then put the data in MySQL. I am stuck on how the server gets the file they pick from their desktop? Do I have to upload the file they pick to a temp directory? Can I just take a copy and check...

Reading a large file into a Dictionary

Hi, I have a 1GB file containing pairs of string and long. What's the best way of reading it into a Dictionary, and how much memory would you say it requires? File has 62 million rows. I've managed to read it using 5.5GB of ram. Say 22 bytes overhead per Dictionary entry, that's 1.5GB. long is 8 bytes, that's 500MB. Average string len...

How can I make a text file with paths to all my files of a given extension?

I'm trying to use the freeware Multiple Find And Replace 1.00 suggested in this question. Unfortunately it requires that I explicitly select each file I'd like it to search. But, it does allow me to load in a text file of the file paths. C:\one.txt C:\two.txt C:\somedirectory\three.txt I'd like a text file of paths to all files...

C++ class header files organization

What are the C++ coding and file organization guidelines you suggest for people who have to deal with lots of interdependent classes spread over several source and header files? I have this situation in my project and solving class definition related errors crossing over several header files has become quite a headache. ...

Read file as string in python

I'm using urllib2 to read in a page. I need to do a quick regex on the source and pull out a few variables. I'm new to python so I'm struggling to see how I use a file object (that urllib2 returns) to do this. ...

Project layout using Wicket

Where should I put the .html files in a wicket Application? my current project layout is as follows: src/myproject --classes+ duplicated html files web --numerous .html files - previewed web/img --resource files such as css/png/js files i want to avoid putting the html files on dupliate locations. what is a good non-redundant strat...

What Java file synchronization/backup library do you recommend?

Do you know any (open source) Java library that provides file synchronization/backup functionality? Many thanks. ...

Inserting of file into an html page using Javascript?

I'm currently trying to read text from a file and append it to a element in my html page using the DOM and Javascript. I can't get the text to format though. I've tried using innerHtml but isn't formating at all( no line breaks ). Here is the javascript: http = new XMLHttpRequest(); http.open("GET",FILE,false); http.send(); documen...

Return file from python module

Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV ...

how to make a thread wait until a file is created in java

Hi All, i have a thread in java & i need this thread to wait until a file is exist or created. i write the following code: while(!receivedDataFile.isFileExists("receiveddata.txt")) { try { Thead.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStac...

Windows XP maxed out as a file server?

I am running Windows XP as a file server to 8 machines running real time applications. Three of the machines, also running XP, will open upwards of one thousand files each (and keep them open). Each of these machines are connected to the file server via the 'net use' command, all accessing the same shared folder. When these machines r...

How do I merge/compare files ignoring order?

I have two properties files that are not the same and I need to find the differences. The second file is sorted by key. Is there a tool that can help me with it? From what I've seen every merge tool cares very much about the order. ...

C# BinaryWrite over SSL

I am trying to respond back to a client with a PDF stored in a MSSQL varbinary(MAX) field. The response works on my localhost and a test server over http connection, but does not work on the production server over https connection. I am using just a simple BinaryWrite (code below). byte[] displayFile = DatabaseFiles.getPdfById(id); ...

Is it a bad practice to have multiple classes in the same file?

I used to have one class for one file. For example car.cs has the class car. But as I program more classes, I would like to add them to the same file. For example car.cs has the class car and the door class, etc. My question is good for Java, C#, PHP or any other language. Should I try not having multiple class in the same file or is it...

What is the best way to determine application root directory?

I need to get all dlls in my application root directory. What is the best way to do that? string root = Application.StartupPath; or string root = new FileInfo(Assembly.GetExecutingAssembly().Location).FullName; and after that Directory.GetFiles(root, "*.dll"); Which way is better? Are there better ways? ...

What is the best way to work with file paths in java?

I believe it's the File class but I heard that is very expensive in memory. Is there a better way to work with file paths? ...

Use Tomcat to serve a directory?

I have a directory on a linux box that I want to make publicly readable using Tomcat (5.5). I think this is easy to set up but can't find the appropriate documentation. Is there a simple way to accomplish this? ...

I need to do a fill pattern in Intel hex file. My question is how would I do a fill pattern of an arbitrary size?

I have been trying to do a fill using the open source Srecord Program. The thing is I need to do a fill that is 0xC2AF00. It appears the program can only do fills that are a byte long (ex: 0xff).If this is not possible with the Srecord program, then how would I go about writing my own algorithm to do what I want. I am not quite sure ho...