files

Python - When to use file vs open

What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5) ...

How to create basic Adobe Illustrator files programatically?

I need to create a really basic Adobe Illustrator file on the clipboard that I can paste in Adobe Illustrator or Expression Design. I'm looking for code samples on how to programaticaly generate Adobe Illustrator Files, preferably from C# or some other .NET language (but at the moment any language goes). I have found the Adobe Illustrat...

How do I checkout files under Perforce from within Emacs?

I use Perforce for source control at work and I want to 'open for edit' files that under source control from within Emacs. How can that be done? What do I need to setup in Emacs? Is there a plug in? I also want to perform other p4 operations such as submitting my changes, etc. ...

Problem accessing file from different thread in Asp.net

I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows: Upload file Record and save info regarding file to database Import data from file into database Redirect to different page When run sequentially like this, everything works fine. However, since the files being imported can be ...

How do I get files in my own file format to have its own dynamic icon?

Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument) - i.e. zipped with a manifest file, a thumbnail image, etc. I notice that OpenOffice files have a preview image of the Open Office file as their icons, both in Windows and in Linux. Is there some way to accomplish th...

How do I get the modified date/time of a file in Python?

How do I get the modified date/time of a file in Python? ...

Pros and cons of using one file for entire webpage?

I'm not sure how I should express this, but I'll give it a try. I recently started coding my portfolio in object-oriented PHP and I'm wondering if it's according to best practices to use a single page where the content changes depending on SQL data and the $_GET variable? If so/not, why? Edit: Take a look at my next post, more in-dept...

How would you allow users to edit attachments in a web application?

We have created a web application, using ASP.NET, that allows users to upload documents and attach them to business entities, like customers, contacts and so on. The application runs on the intranet and all files are uploaded through the web application into a shared folder on the server. I would like, right from the web page, for the...

How to determine the OS path separator in JavaScript?

How can I tell in JavaScript what path separator is used in the OS where the script is runnning? ...

Sync File Modification Time Across Multiple Directories

I have a computer A with two directory trees. The first directory contains the original mod dates that span back several years. The second directory is a copy of the first with a few additional files. There is a second computer be which contains a directory tree which is the same as the second directory on computer A (new mod times an...

Algorithm for merging large files

I have several log files of events (one event per line). The logs can possibly overlap. The logs are generated on separate client machines from possibly multiple time zones (but I assume I know the time zone). Each event has a timestamp that was normalized into a common time (by instantianting each log parsers calendar instance with the ...

How do you handle attachments in your web application?

Due to a lack of response to my original question, probably due to poor wording on my part. Since then, I have thought about my original question and decided to reword it, hopefully for the better! :) We create custom business software for our customers, and quite often they want attachments to be added to certain business entities. F...

Get last n lines of a file with Python, similar to tail

I'm writing a log file viewer for a web application and for that I want to paginate through the lines of the log file. The items in the file are line based with the newest item on the bottom. So I need a tail() method that can read n lines from the bottom and supports an offset. What I came up with looks like this: def tail(f, n, off...

Is there a one-liner to read in a file to a string in C++?

I need a quick easy way to get a string from a file in standard C++. I can write my own, but just want to know if there is already a standard way, in C++. Equivalent of this if you know Cocoa: NSString *string = [NSString stringWithContentsOfFile:file]; ...

Detecting file being reopened in Java

I'm working on a small Java application (Java 1.6, Solaris) that will use multiple background threads to monitor a series of text files for output lines that match a particular regex pattern and then make use of those lines. I have one thread per file; they write the lines of interest into a queue and another background thread simply mon...

How to get create/last modified dates of a file in Delphi?

I want to get a files these attributes as integer values. ...

Linux configuration file libraries

Are there any good configuration file reading libraries for C\C++ that can be used for applications written on the linux platform. I would like to have a simple configuration file for my application. At best i would like to steer clear of XML files that might potentially confuse users. ...

How to upload files from ASP.NET to another web application

I have a scenario where I need to upload a file from one web application and use it in another one. My setup is the following. One server, hosting two web applications in IIS - both are ASP.NET One of the applications is used to administer the other one + a bunch more stuff I need to upload a file from this admin app, save the path i...

Storing database data in files?

I'm currently working on a school project, in java, and I'm coding a database application. Something like the MySQL Monitor where you type in queries and get results / whatever. In applications I've coded before, I used databases to store data, like user profiles, settings, etc. Now, obviously, I can't use a database to store data gener...

How can I test if a list of files exist?

I have a file that lists filenames, each on it's own line, and I want to test if each exists in a particular directory. For example, some sample lines of the file might be mshta.dll foobar.dll somethingelse.dll The directory I'm interested in is X:\Windows\System32\, so I want to see if the following files exist: X:\Windows\System32\...