file-io

Need to allow users to sort file order

Hi All, I have a website where an admin can login and upload photos. All the images are placed in a directory and then on another page, i am cycling through the images and displaying them. The client has asked if there is a way to move the images around and place them in any order they want. Now looking at the site, i'm not sure what o...

How to use a ~ (relative directory) in my java class?

Hi, I create a temporary file on the server, that someone uploads. While I was testing, It was fine to use the complete home directory path in my machine. But now that I have to deploy it to a server, I tried using a ~, but I get a java.io.FileNotFoundException: ~/test/csvFile.csv (No such file or directory) how do I use something ana...

200,000 images in single folder in linux, perfomance issue or not?

Hi, I have a php/mysql website with over 200,00 images in single folder (linux server). I don't think, that I will never need to see them in file explorer, instead they will be viewed on website on their individual pages. They are just displayed in product page on website. File system is ext3. so is it wise to save them in single fold...

What is the principle of VirtualBox's dynamic size hard disk?

Do you know TrueCrypt Project? It makes a container file and formats it. The container file will be seen as like a volume. An we do I/O to the volume, the I/O will be crypted. By the way, can the container file size be flexible like virtualbox's dynamic hard disk(.vdi file)? I made a crypt driver like the TrueCrypt. But my container f...

Fastest way to copy files in Java

Hi, What ist the fastest way to copy a big number of files in Java. So far I have used file streams and nio. Overall streams seem to be faster than nio. What experiences did you make so far? ...

C++ fstream Erase the file contents from a selected Point

I need to Erase the file contents from a selected Point (C++ fstream) which function should i use ? i have written objects , i need to delete these objects in middle of the file ...

Can't read appended data using pickle.load() method.

I have written two scripts Write.py and Read.py. Write.py opens friends.txt in append mode and takes input for name, email ,phone no and then dumps the dictionary into the file using pickle.dump() method and every thing works fine in this script. Read.py opens friends.txt in read mode and then loads the contents into dictionary using p...

Fastest way to deserialize objects from huge binary file

So the scenario is as follows: I have a 2-3 gb large files of binary serialized objects, I also have an index file which contains the id of each object and their offset in the file. I need to write a method that given a set of id's deserializes them into memory. Performance is the most important benchmark and keeping the memory requir...

How to read text files transfered as binary

My code copies files from ftp (using text transfer mode) to local disk and then trys to process them. All files contain only text and values are seperated using new line. Sometimes files are moved to this ftp using binary transfer mode and looks like this will mess up line-ends. Using hex editor, I compared line ends depending the transf...

Getting list of files in a folder using C

Hi I have path to a folder for example /myfolder or in Windows: C:\myfolder and I want to get a list of all files in that folder. How shall I do so in C? Is it different in C++ or C99? How can I get a list of its folders? Any help is appreciated. ...

The process cannot access the file because it is being used by another process.

Hello everyone! I am adding images to a FlowLayoutPanel control via the following code Dim WithEvents Pedit As DevExpress.XtraEditors.PictureEdit Private Sub LoadImagesCommon(ByVal fi As FileInfo) Pedit = New DevExpress.XtraEditors.PictureEdit Pedit.Width = 133 Pedit.Height = 98 Pedit.Image = Image.From...

Creating Lists from files in Scheme

I've worked out how to read in the file and it works using the following code: (define p (read(open-input-file "starbucks4.sxml"))) But how do i store p as a list with elements separated by \n characters. Thanks. ...

How to create a sparse file on NTFS?

I'm testing a sparse file. But my test code doesn't work well. HANDLE h = CreateFileW(L"D:\\sparse.test", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_SPARSE_FILE, 0); DWORD d = GetFileAttributes(L"...

Sparse Files and Disk Quotas

Suppose, My D: volume capacity is 100GB. And I'm using it 80GB now. The remain is only 20G. Now, I try to make a sparse file. DWORD written; std::wstring s = L"D:\\sparse9.test"; HANDLE h = CreateFileW(s.c_str(), GENERIC_WRITE, FILE_SHARE_DELETE, 0, CREATE_NEW, 0, 0); if(!DeviceIoControl( h, FSC...

How do I take integer keys in shelve ?

I want to store an integer key in shelve. But when I try to store integer key in shelve it give me an error Traceback (most recent call last): File "./write.py", line 12, in data[id] = {"Id": id, "Name": name} File "/usr/lib/python2.5/shelve.py", line 124, in __setitem__ self.dict[key] = f.getvalue() File "/usr/lib/pytho...

Ruby getting a particular line from a file?

Is it possible to extract a particular line from a file knowing it's line number? e.g just get the contents of line N as a string from file text.txt ...

Java file locking

Hi, I've written the following helper class that should allow me to get an exclusive lock on a file, then do something with it. public abstract class LockedFileOperation { public void execute(File file) throws IOException { if (!file.exists()) { throw new FileNotFoundException(file.getAbsolutePath()); ...

Java file locking

Hi, I've been trying to use FileLock to get exclusive access to a file in order to: delete it rename it write to it Because on Windows (at least) it seems that you cannot delete, rename, or write to a file that is already in use. The code I've written looks something like this: import java.io.File; import java.io.FileNotFoundExcept...

resize images and keep them with new size in new folder in matlab

Hi I write the following code in matlab. from this code I take sequence of images as input from a folder and resize these images. Now I need to store them with new size on output folder. any one help me to update this code. fileFolder = fullfile('D:','Texture DataBases','images3000'); dirOutput = dir(fullfile(fileFolder,'image*.jpg'...

iPhone sdk 4.1: Application CRASHES when i try to access a .plist file third time.

I have a menu scene, help scene, settings scene and game scene. When i enter into game scene, it loads some data string from a .plist file into a NSMutableArray. I am doing this reading and loading procedure as follows- + (void) addObjectsToArray:(NSMutableArray*) mutableArray fromFile:(NSString*) filePath { NSString *bundle = [[NSB...