file

Fastest Sha1 Function (Linux, up to 2GB files)

Is there any linux command line implementation that performs exceptionally well for generating sha1's on large files (< 2GB)? I have played around with 'openssl sha1' and it takes minutes to get the sha1 for a 2GB file : /. ...

How to keep a file's format if you use the uniq command (in shell)?

In order to use the uniq command, you have to sort your file first. But in the file I have, the order of the information is important, thus how can I keep the original format of the file but still get rid of duplicate content? ...

file input optput

i want to read a microsoft word file without use of data connection, ...

Comparison of bmp files?

I want to compare two bmp files. I thought of two approaches: to compare the header as well as the information header of the two files convert the bmp file to binary and then do the above comparison But, I don't know how to start and which will be a better approach. I would be glad if someone could please help me! ...

Checking whether the file can be opened in portable C

I'd like to perform a quick check whether or not a file can be opened. It should be written in portable C, or at least to work on Win32 and POSIX systems. #ifdefs are acceptable. I'm trying to avoid this: int openable(const char*filename) { FILE *f = fopen(filename,"r"); if (!f) return 0; /* openable */ fclose(f); ...

What is event logging? and how do I write an event log file?

What is event logging? and how do I write an event log file for an application? I want to log all the activities of the application including when it uses a .dll, etc. and also show information of the application. ...

What happens if there are too many files under a single directory in Linux?

If there are like 1,000,000 individual files (mostly 100k in size) in a single directory, flatly (no other directories and files in them), is there going to be any compromises in efficiency or disadvantages in any other possible ways? ...

Secure PHP file uploading

I'm trying to develop a file uploading module on our new site that allows you to upload any file to our servers. The uploaded file is uploaded to /files, in which the following .htaccess to prevent users from executing i.e a .php file: <Files *.*> ForceType applicaton/octet-stream </Files> This triggers the browsers download window (a...

iexpress extract files then run script refering extracted file.

I was trying to deploy my project with IExpress. I have the following scenario. I want to extract some files to a location preferably c:\program files\. Then after it copies all the files i want it to run a .cmd file (which is a script). the script is also added in the project itself and it would refer to a file which is copied by IExpre...

determine if file is an image

I am looping through a directory and copying all files. Right now I am doing string.EndsWith checks for ".jpg" or ".png", etc . . Is there a more elegant way of determining if a file is an image (any image type) without the hacky check above? ...

How can I compare two files in a batch file?

Hello everyone! I recently found this site and thought I might try it out because it seemed very unique. How can I compare two files in a batch file, and perform an action based on whether or not they match? I've tried something like: if file1.txt NEQ file2.txt goto label but it compares the actual string "file1.txt" rather than the ...

File System TreeView

Im working with file systems and I have a List<> of file objects that have the file path as a property. Basically I need to create a treeview in .NET but im struggling to think of the best way to go about doing this as I need to create a tree structure from a list like: C:/WINDOWS/Temp/ErrorLog.txt C:/Program Files/FileZilla/GPL.html C:...

audio and video file compressor

Does anyone know a great audio and video file compressor? I currenting compressing wmv to 3gp with AVS software. when i compress the file its out 250kb and that only about 2mins and 30 sec of video. i would like to compress the sound and video smaller so that i can add more time to my video. ...

php fopen doesn't open the file, it permission to read is not given to the world/public?

the php fopen fails to open a file for reading, if the file permission is 440. I don't want to give 444 permission to the file, so that it can't be accessed directly through a URL. ...

The easiest way to write NSData to a file

NSData *data; data = [self fillInSomeStrangeBytes]; My question is now how I can write this data on the easiest way to an file. (I've already an NSURL file://localhost/Users/Coding/Library/Application%20Support/App/file.strangebytes) ...

Using MultipartPostHandler to POST form-data with Python

Problem: When POSTing data with Python's urllib2, all data is URL encoded and sent as Content-Type: application/x-www-form-urlencoded. When uploading files, the Content-Type should instead be set to multipart/form-data and the contents be MIME encoded. A discussion of this problem is here: http://code.activestate.com/recipes/146306/ To...

How to move a directory in C# .NET in a single atomic operation

I need to be able to move an entire directory in a single atomic operation, guaranteeing that nothing else on the system will be able to subvert the operation by creating new files after I start, having a lock on a file, etc. Presumably, I would use System.IO.Directory.Move() if the directories were on the same volume (if Directory.GetD...

Create thumbnail and reduce image size

I have very large images (jpg) and i want to write a csharp program to loop through the files and reduce the size of each image by 75%. I tried this: Image thumbNail = image.GetThumbnailImage(800, 600, null, new IntPtr()); but the file size is still very large. Is there anyway to create thumbnails and have the filesize be much small...

open file in exclusive mode in C#

Hello everyone, I want to open a file for read in exclusive mode, and if the file is already opened by some process/thread else, I want to receive an exception. I tried the following code, but not working, even if I opened the foo.txt, I still can reach the Console.WriteLine statement. Any ideas? static void Main(string[] args) { u...

transferring host and client

i have a local apache web server... i want to send a text file in the local host to the client.. ...