files

CreateFileMapping with multiple threads

hey. im trying to use 2 threads running simultaneously and both using FileMapping feature to map a file on memory via different handles. problem is the MapViewOfFile function sometimes allocates the mapping on both threads to the same offset of memory. i tried using mutex on those parts, but it seems after high usage i fail to write to t...

php file... how to spread my code around

hi, i am writing a web site with a php on the server side. which i have never used before. if i get it right it is procedural programming (which is another thing that i have never done) my question is how to write code: each procedure should be in a different file? to separate it to various files? maybe have one file that receive the...

php move_uploaded_file not working on Windows 7 only

I've got a project that I am setting up file uploads for. The project is in Zend, but I am using PHP's $_FILES array and move_uploaded_file to save the files. This was working perfectly on my Windows Vista computer but won't save the file on Windows 7. It creates a new folder for every upload no problem, but won't save the file and ...

Is a file available to be opened?

Short version: I think I'm asking for a file too soon, but it's pretending like it's ready. Am I missing something? Slightly longer version: I am writing files to disk. Before I do so, I have the user add some meta data, including the new file name. Once the user is done, the screen goes away and the program writes the file to disk. The...

C# accessing folder/files thru webservice

How can I have a webservice read/browse a folder content ? For instance this type of code: FolderBrowserDialog folderBrowser; folderBrowser = new System.Windows.Forms.FolderBrowserDialog(); folderBrowser.Description = "..."; folderBrowser.ShowNewFolderButton = false; folderBrowser.RootFolder = Environment.SpecialFo...

List of Current Folder files ONLY?

Hello I'm trying to get Perforce syntax to obtain (for example using "fstat") list of files only in given folder (depot), without rubbish from all sub-folders. But I was not able to find anything in the docs, nothing related when using Google, even experimenting with ".", ".../." etc. lead me to nowhere... Is that because it's not possi...

Java Export - Text Files

I tried to export a Java program from Eclipse to a .jar file, but I came across a problem. It ran fine, but for some reason it didn't find the text files it was supposed to get data from. If anyone could help with this, I would be very grateful. ...

cronned "cp *.html" is omitting new files on OSX

I have a cronned "cp *.html" command that runs every minute on an OSX box. The source files are regenerated from a database and written to the source directory just fine. The cp command usually picks them up and refreshes the copies in /Library/WebServer/Documents (this is for a quick-and-dirty internal website that monitors one of our...

Why I need to read file piece by piece to buffer?

Hi, I have seen following code for getting the file into array, which is in turn used as a parameter for SQL command inserting it into a blob column: using (FileStream fs = new FileStream(soubor,FileMode.Open,FileAccess.Read)) int length = (int)fs.Length; buffer = new byte[length]; int count; int sum = 0; while ((count = fs.Read(buffer...

Integrity and Authenticity

Hi!! Sorry to keep asking so many questions, but you guys always seem to be so nice and helpful... I need to do some application that imports data from a file. For instance, user selects one file and the application imports some data to database. But I've been thinking, and this kind of app leads to a problem of integrity and authenti...

django, runserver_plus - admin media files served from wrong path

The configuration below works fine on my remote host (same dir structure, same django), all admin media are served properly settings MEDIA_ROOT = '%s/static/' % FS_ROOT STATIC_DOC_ROOT = '%s/static/' % FS_ROOT MEDIA_URL = '/static/' ADMIN_MEDIA_PREFIX = '%smedia/' % MEDIA_URL urls (r'^admin/', include(admin.site.urls)), (r'^static/(...

why stream a file versus sending it at once?

Just looking at various ways of ftp'ing a file in c#. I noticed some examples do: streamReader.ReadToEnd() then convert to bytes, then send the file in one go. while others do a: while (contentLength != 0) stream.write(buff, 0, contentLength); contentLength = fileStream.Read(buff, 0, buffLength); Is sending the file 2048 a...

Xcode renames files when compiling?

Every time I compile my iPhone project, Xcode renames my Default.png to default.png The file name in my project is Default.png, so it's correct in my project. It gets renamed somewhere in the compile process; is there any way to stop Xcode from renaming this file? It's the only file that gets renamed for some reason, and my app wont di...

Why Subversion skips files which contain the @ symbol?

when I try to execute command like this (from a command-line or Perl script - it doesn't matter): svn revert "build\[email protected]" SVN skips this file and outputs: Skipped 'build\myfile' I tried doing: svn revert "build\*.meta" But it gives the same result. I can revert these files from the GUI. And I can revert these files...

Ruby Gems with Persistent data

I want to create ruby application (not rails). This is a console app which will need to persist some data. I'm using pstore as the database. I want to deploy this application as a gem. My question is: where does my data live? Currently I've created a data directory as a sibling to the bin directory in a standard gem layout. I would th...

Django FILES upload: path and filename

When an uploaded file is received by the Django server, its name can be read using UploadedFile.name If filename in the multipart-data content contains a path like: '/a/b/c', UploadedFile.name seems to contain '/c' . How can I retrieve the full path and not just the file name. Thanks. Laurent Luce ...

How to manage reports/files distribution to different destinations in Unix?

The reporting tools will generate a huge numbers of reports/files in the file system (a Unix directory). There's a list of destinations (email addresses and shared folders) where a different set of reports/files (can have overlap) are required to be distributed at each destinations. Would like to know if there's a way to efficiently man...

Is it better to use mysql or files to store data?

I'm wondering if it's better to use mysql or use files to store data? What is safer, what is faster? I'm talking about php and mysql. ...

Built in way to list directories in a directory in ruby

Is there a cleaner built-in way to do this? ree> Pathname.new('/path/to').children.select{|e| e.directory?}.map{|d| d.basename.to_s} => ["test1", "test2"] Ideally I would like to avoid the directory? call ...

Reading files multi-data-type (c++)

Dear all, I want to read from one file that has several kinds of data-types. I utilize ifstream (C++ language) but it can't read strings. In fact, I have written a code that has too many options and input parameters. Now, I want to read these parameters and (bool) options from an input file, then I can run my program by edition of inp...