files

C#: How to use SHOpenFolderAndSelectItems

Could someone give an example on how to use the shell function SHOpenFolderAndSelectItems from C#? I don't quite get how to use these kind of functions and couldn't find it on pinvoke.net... =/ Say I have three files called X:\Pictures\a.jpg X:\Pictures\s.jpg X:\Pictures\d.jpg I then want to open up the X:\Pictures folder with a.jpg...

Generic file container for quick read of data

Since there are some major privacy issues with alot of social networking sites I am trying to think about alternatives. One is to let the user keep all the information stored in some kind of file container. Now, I haven't found a single type of container that can hold "generic" information. Only for audio/video. What I want is a containe...

How to identify/handle text file newlines in Java?

Hi Everyone! I get files in different formats coming from different systems that I need to import into our database. Part of the import process it to check the line length to make sure the format is correct. We seem to be having issues with files coming from UNIX systems where one character is added. I suspect this is due to the return ...

PHP: File exists and is in a certain sub-directory

I get a file path to a user file and I want to make sure that this path is to a valid existing user file and not to something bogus or a system file or something like that. I know I can use file_exists to check that it exists, but I'm not sure how I should make sure that the file is in a certain sub-directory... ...

How to evaluate bool statements

I have a piece of code which is said to return a bool value. I am a new programmer, so could someone give me code that will determine if the file at the path exists? NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *path = [docsDirectory stringByAppen...

Windows 7 recreate my .exes

hi, i have a few programs that check if file exist, and if its old version delete him and paste the new one. However under Windows 7 Professional i can't delete the file some System process is always restoring it (same with the dll files) and as you can imagine a lot of programs are crashing because of that behaviour. So WHAT SERVICE/PRO...

Android AVD Files - Browse?

How can I browse and copy out the files in my Android AVD? I wish to view the contents of the Sqlite file the app modifies. ...

File IO with Streams - Best Memory Buffer Size

I am writing a small IO library to assist with a larger (hobby) project. A part of this library performs various functions on a file, which is read / written via the FileStream object. On each StreamReader.Read(...) pass, I fire off an event which will be used in the main app to display progress information. The processing that goes on i...

How to change file contents in PHP ?

I save in a file some info about users (like number of times user passed the login page, last visited time, and so on). I want to read this info from the file, and update it (add 1 to the counter, and change the last visited time). My question is: can I do it without opening the file twice ? I open the first time to read the contents,...

How do I read a file from a package - something like a resource bundle in Java

I have a words.txt file that I have put in a particular java package and would need to read it from that same location. I do not control the deployment, so I don't know where the packages will be deployed. Example location: com/example/files/words.txt . I know how to use the ResourceBundle class to read properties file from the packag...

Deleting files when user logouts or session end

I'm trying to delete files created by current user when he/she clicks logout button Protected Sub OnLoggingOut(ByVal sender As Object, ByVal e As EventArgs) Handles LoginStatus1.LoggingOut Try Dim folder As String = Server.MapPath("~/uploads/") Dim files As String() = Directory.GetFiles(folder) ...

store/load numpy array from binary files

Dear all, I would like to store and load numpy arrays from binary files. For that purposes, I created two small functions. Each binary file should contain the dimensionality of the given matrix. def saveArrayToFile(data, fileName): with open(fileName, 'w') as file: a = array.array('f') nSamples, ndim = data.shape ...

File read fails when using Delayed Job

How to check that my params['Filedata'] is corrupted or not? I have function it's reading file from params['Filedata'] and writing it to the other file. File.open(upload_file, "wb") { |f| f.write(params['Filedata'].read) } this line working fine for me.. But when i am calling this function with delayed job function send_later than I...

[C++] Is it possible to use threads to speed up file reading ?

Hi there, I want to read a file as fast as possible (40k lines) [Edit : the rest is obsolete]. Edit: Andres Jaan Tack suggested a solution based on one thread per file, and I want to be sure I got this (thus this is the fastest way) : One thread per entry file reads it whole and stocks its content in a container associated (-> as ma...

jQuery if exist

How to check, is file exist on current site? Like: if ('http://site.com/girlfirend.png' exist) { // do something } Maybe I can use .get? But how to check its status (ok or 404)? Thanks. ...

Short writes to a UNIX file descriptor

When can a short write to a file descriptor occur in FreeBSD 7.2 ? I mean the situation when "write" system call returns less bytes written than requested. I'm speaking about descriptors to ordinary files in ufs filesystem which we can get with a call to open(). ...

Writing a new line to file in PHP

My code: $i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file); For some reason, it's writing \n as a string, so the file looks like this: 40119\n40122\n40120\n42155\n36925\n45881\n42145\n45880 Fro...

Mercurial client error 255 and HTTP error 404 when attempting to push large files to server

Problem: 19/06/10 Update: More evidence problem is server-side. Receiving this error on Windows 7 command line (see below for full traceback): URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host> abort: error: An existing connection was forcibly closed by the remote host When attem...

Does anyone know some Java class that return a operating system friendly filename?

I have an uploader in my web page, but some people upload files named like "compañia 15% *09.jpg" and i have problems when the filenames are like that one. I would like to found a class that returns for that example something like this: "compania1509.jpg". ...

Delphi - threads and FindFirst function

Hi, I'm encountering a big problem when i'm trying to make a recursive search function inside a thread (using delphi 7) bellow is the code: TParcFicDir = class(TThread) private several variables.. protected procedure Execute; override; public constructor Create(CreateSuspended: Boolean); constructor TParcFicDir.Create(Cr...