file

Detect if PDF file is correct (header PDF)

I have a windows application .NET that manages many PDF Files. Some files are corrupt. 2 issues: I'll try explain in my worst english...sorry 1.) How can I detect if any pdf file is correct ? I want read header of PDF and detect is correct. var okPDF = PDFCorrect(@"C:\temp\pdfile1.pdf"); 2.) How to know if byte[] (bytearray) of fi...

django upload text file not working

I am trying to upload text files to a specified location, but the file is uploading empty, in the root(not in the location i specified). in models: course = models.FileField(help_text=('Upload a course (max %s kilobytes)' %settings.MAX_COURSE_UPLOAD_SIZE),upload_to='cfolder/',blank=True) in forms: def handle_uploaded_file(f): d...

[C#] Make the file unreadeable. (some kind of encryption)

Hello there guys! I'm using encryption in my program, that decrypts files if it needs to use it, and encrypts it after it done with the file. But my files arouznd 100mb, and it takes more than a minute to crypt them. My question is, is it possible, to make my file unreadable, without encrypting the whole file? So , for example, just e...

How to set priorety of data you transfer? (So not to block other http connections) (in pair PHP<->Flash)

I have PHP script which takes some file (FLV for example) and returns it to Flash player (just opens and reads to end), and I have flash(mxml+as3) app that calls that php script in order to recive a file. Ho to make priorety of that connection so that if user goes to some other web page or dowhloads some file my pair (PHP <-> Flash) will...

How to have batch file code only copy the most recent .bak file from a directory

I recently had very kind assistance on how to make the below code copy the most recent file from a file on my C:\ called 'C:! BATCH' It's transpired that I now need to have the batch file only look for .bak files in this dorectory, and while I'm positive this is a relatively simple tweak, I've so far had no luck on finding how this is ...

How to limit speed of outgoing response from php script?

How to limit speed of outgoing response from php script? So I have a script generating data in keep-alive connection. It just opens file and reads it. How to limit outgoing speed (By now i have such code) if(isset($_GET[FILE])) { $fileName = $_GET[FILE]; $file = $fileName; if (!file_exists($file)) { print('<b>ERROR:</b> p...

File extention restriction to .cor (only)

How can I restrict only .cor files to be added to the list. The code bellow allows .corx, .corxx, .corxxx to be added to the list. I only want .cor files. Is that possible? private void btn_models_Click(object sender, EventArgs e) { DialogResult res = dlg_find_folder.ShowDialog(); if (res == DialogResul...

iphone asynchronous file load?

is there way to load local files in iphone asynchronously? I load uiimages for my uitableview using this: NSData *imageData = [[NSData alloc] initWithContentsOfFile:fileName]; UIImage *cachedImage = [[[UIImage alloc] initWithData:imageData] autorelease]; but it is slow, because main thread is locked or something until NSData finishes ...

Using Jquery and Ajax to save a file in ASP.Net

I have a button that uses jquery and ajax to call a server side script to create a text file and sends back the following response Response.ContentType = "csv"; Response.AddHeader("Content-disposition", "attachment; filename=" + fName); Response.ContentType = "application/octet-stream"; Response.BinaryWrit...

In a batch file, Combining two strings to create a combined path string

I need to take two strings and combine them into a single path string inside a batch file similar to the Path.Combine method in .Net. For example, whether the strings are "C:\trunk" and "ProjectName\Project.txt" or "C:\trunk\" and "ProjectName\Project.txt", the combined path will be "C:\trunk\ProjectName\Project.txt". I have tried using...

Why are Android layout file names so limited?

It's good to have consistency in file names. MyActivity.java contains the public class MyActivity I would like the xml file with its layout to be called res/layout/MyActivity.xml But I get an error message saying "Invalid file name: must contain only [a-z0-9_.]" So two questions: Why is the character set so limited (not even upper ...

Saving Multiple Images in a Single File

In my program i want the user to be able to take some images from a directory, and save them under a single file, that can be transferred to another computer possibly, and actually read and displayed(using the same program). How would i go about doing this, especially if i want to save other data along with it, perhaps objects and such....

How to write/read array to file in android

Hi, I am writing to file in android and read from the same file using the below code: //Write data on file FileOutputStream fOut = null; OutputStreamWriter osw = null; try { fOut = openFileOutput("gasettings.dat", MODE_PRIVATE); osw = new OutputStreamWriter(fOut); osw.write(data); osw.flus...

How to create an exe file in java

Hi I want to create an exe file for my java app. I tried with some third party softwares JEXECreator, successfully created the exe file and its working fine in my system, when I tried with another machine, it’s not working. I got the following error * The error occurred while running the application. The exit code is 0x10000223. ...

problem with Create File dynamically in php

Hi .. I want to create File that have Full permission dynamically, that means every change for ID of session create new file . Unfortunately I faced some problem . Warning: fopen(test.txt) [function.fopen]: failed to open stream: Permission denied in /home/teamroom/public_html/1/3.php on line 2 Warning: fwrite(): supplied argument is...

Free tool to watch directory and show changes in files

Im looking for a tool that will watch directory(with sub-dirs) and give me the list of files that has changed and what has changed in them. Ive found some tools that show me files that has changed, but that is not enough for me. P.S. I dont want to write it if someone has already written it. P.S.2. Feel free to close this question if y...

how to write iges file?

I would like to be able to write the .iges file format using c#. Can anyone help me with this? ...

Confirm that Python 2.6 ftplib does not support Unicode file names? Alternatives?

Can someone confirm that Python 2.6 ftplib does NOT support Unicode file names? Or must Unicode file names be specially encoded in order to be used with the ftplib module? The following email exchange seems to support my conclusion that the ftplib module only supports ASCII file names. Should ftplib use UTF-8 instead of latin-1 encodin...

How to store Propel objects into file?

I need to have option for Propel to store the data into database and file as well. Is there any way how to do that? I'll create the objects, fill the data and then need to store them into file (session) and be able to recreate the objects later. In some time it will go to database as well. Any idea? ...

Can I tell if a string corresponds to either a file or a directory in .NET?

If I have a string, I know I can use If System.IO.File.Exists(mystring) or System.IO.Directory.Exists(mystring) to see which it is. Is there a method I can use to make a single call to determine which type it is? Since, at least in Windows, you can't have both a file and a directory with the same name, it seems like there should be a fun...