file

unable to delete file (jpeg)

I implemented helper for showing thumbnails from here Next to thumbnail, there is delete link which calls this controller // // HTTP POST: /Photo/Delete/1 [AcceptVerbs(HttpVerbs.Post)] public ActionResult Delete(int id, string confirmButton) { var path = "~/Uploads/Photos/"; ...

Python: Most efficient way to concatenate and rearrange files

Hi, I am reading from several files, each file is divided into 2 pieces, first a header section of a few thousand lines followed by a body of a few thousand. My problem is I need to concatenate these files into one file where all the headers are on the top followed by the body. Currently I am using two loops; one to pull out all the h...

Sending a file over web service from java to .net

Hello, I have built .NET 1.1 Web Service which should accept files and save them. Here is the code of the webmethod: [WebMethod] public bool SaveDocument(Byte[] docbinaryarray, string docname) { string dirPath = @"C:\Temp\WSTEST\"; if(!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } strin...

Getting details of a DLL in C#/.NET

Is there a way to get the values of various properties of a (both .NET and non-.NET) DLL via C#? I'd like to read the 'Product name' field in particular. ...

How to enable fall-through directories in Linux, so if /path0/file doesn't exist, path1/file is used

I'm seeking way to have linux fall-through on directories so that with this structure: /dir0/a.txt: "A" /dir0/b.txt: "B" /dir1/c.txt: "C" /dir1/b.txt: "BBB" dir1 falls back to dir0, leading to: cat dir1/a.txt: "A" cat dir1/b.txt: "BBB" cat dir1/c.txt: "C" ...

Overwriting lines in file in C

Hi, I'm doing a project on filesystems on a university operating systems course, my C program should simulate a simple filesystem in a human-readable file, so the file should be based on lines, a line will be a "sector". I've learned, that lines must be of the same length to be overwritten, so I'll pad them with ascii zeroes till the en...

PHP File upload fails with blank screen when size exceeds 742 KB.

Hi friends, This is one of the most bizarre errors I've come across. So I've written a little file upload web app for my friend and it works fine for any file less than or equal to 742kB in size. Needless to say, I arrived at this precise number based on relentless testing. Weird part is that if the file size is just a few KB more, fo...

Getting Image size of JPEG from its binary

Hi I have a lot of jpeg files with varying image size. For instance, here is the first 640 bytes as given by hexdump of an image of size 256*384(pixels): 0000000: ffd8 ffe0 0010 4a46 4946 0001 0101 0048 ......JFIF.....H 0000010: 0048 0000 ffdb 0043 0003 0202 0302 0203 .H.....C........ 0000020: 0303 0304 0303 0405 0805 0504 0405 0a07 ...

How to automatically split git commits to separate changes to a single file

I'm prettyd comfortable with Git, an I've been using it for over a year now. Better yet, I've finally convinced a client to switch to it! However, I'm just plain stuck as to how to accomplish what I'm about to describe, or if it's even possible. Even it it can be done, I wonder if it could be setting us up for a messed-up, unmanageable r...

file descriptors and open files

Hello, I have two quick questions: When do two file descriptors point to the same open file ? When do two open files point to the same inode ? Also, if you happen to have some good documentation with graphs explaining this, i'll be very grateful if you show me the link to it :) Thanks! ...

java IO to copy one File to another

I have two Java.io.File objects file1 and file2. I want to copy the contents from file1 to file2. Is there an standard way to do this without me having to create a method that reads file1 and write to file2 ...

DOS batch file to read contents of a file and rename the file based on a condition

I need to create a batch file that reads a file with one line and then renames the same file based on the contents. The file will have one number and the condition to rename the file is this: If content of file > 100 then rename new.txt to old.txt else rename new.txt to new1.txt Thanks for the help! ...

Distributing a bundle of files across an extranet

I want to be able to distribute bundles of files, about 500 MB per bundle, to all machines on a corporate "extranet" (which is basically a few LANs connected using various private mechanisms, including leased lines and VPN). The total number of hosts is roughly 100, and the goal is to get a copy of the bundle from one host onto all the ...

PHP Read xlsx Excel 2007 file

I am using oleread to read uploaded xls file. But I am not able to read xlsx files saved in excel-2007 format. can someone help me on how to read xlsx file in PHP. ...

Silverlight 4 RC File Upload with Upload Progress: how to?

It's been stated that one of the new features of Silverlight 4 RC is that it now supports upload progress. I'm assuming this means it's possible to make an upload file progress bar without "chunking" but I can't figure out how to do this, so how do we do this? Source code examples would be great. Thanks! ...

Unknown symbols when I read file

I read file, but in the end of file i get unknown symbols: int main() { char *buffer, ch; int i = 0, size; FILE *fp = fopen("file.txt", "r"); if(!fp){ printf("File not found!\n"); exit(1); } fseek(fp, 0, SEEK_END); size = ftell(fp); printf("%...

Read options from file

I would like to write a function which will read values from a text file and write them to variables. For example my file is: mysql_server localhost mysql_user root mysql_passworg abcdefg mysql_database testgenerator log log.txt username admin password abcd and I have the same variables as the first word in the line. So how to make t...

fopen with/without @ before it

I've seen code samples that use an @ before fopen as in $fh = @fopen($myFile, 'w'); What's the significance of this @? ...

\n not working in my fwrite()

Not sure what could be the problem. I'm dumping data from an array $theArray into theFile.txt, each array item on a separate line. $file = fopen("theFile.txt", "w"); foreach ($theArray as $arrayItem){ fwrite($file, $arrayItem . '\n'); } fclose($file); Problem is when I open theFile.txt, I see the \n being outputted literally. A...

File in binary form

Dear All I want to write data into the file in binary form. I was trying using the mentioned below FILE *fp = fopen("binaryoutput.rgb888", "ab+"); for(int m=0; m<height; m++) { for (int n=0; n< width; n++) { temp = (pOutputImg+m*3+n*3); // here pOutputImg & temp is a pointer to a unsigned...