file

How to create a .py file for Google App Engine?

Hello everybody!!! I am just at the very start of what I think is gonna be a long journey exploring the world of applications in Google App Engine using Python. I have just downloaded Python 2.6.4 from the Python official website and installed it on my computer (I am using Windows XP). I also downloaded the App Engine Python software ...

How do I determine an open file's size in Python?

There's a file that I would like to make sure does not grow larger than 2 GB (as it must run on a system that uses ext 2). What's a good way to check a file's size bearing in mind that I will be writing to this file in between checks? In particular, do I need to worry about buffered, unflushed changes that haven't been written to disk ...

Which file locks can be ignored ... as a rule of thumb?

We have an app which needs to go through the file system and perform various operations on files (mostly copy). It's OK if we encounter a file lock "This process cannot access the file xxx because it is being used by another process" , because we will just skip it, but the app has to report it to the user. However we want to ...

Quickly alphabetize a large file via python

#!/usr/bin/python import random import string appendToFile = open("appendedFile", "a" ) # Generator for i in range(1, 100000): chars = "".join( [random.choice(string.letters) for i in xrange(15)] ) chars2 = "".join( [random.choice(string.letters) for i in xrange(15)] ) appendToFile.write(chars + ":" + chars2 + "\n") ap...

LINQ to SQL equivalent for XML file persistence.

Microsoft has made saving objects very easy with their LINQ to SQL mapping. However, I would sometimes like something a little more lightweight, i.e. the ability to save objects to a file when an application closes, and read them back in again. XML seems like a natural data format rather than inventing a new data format. (Of course, on...

java process is frozen(?) on linux

Hi, all. This is my first question on S.O. I have a very odd problem. Below is my problem... I write very simple method that write some text to a file. Of course it works well my machine(XP, 4CPU, jdk1.5.0_17[SUN]) But it somtimes freezes on operating server (Linux Accounting240 2.4.20-8smp, 4CPU, jdk1.5.0_22[SUN]). kill -3 doesn'...

File diff in MSBuild?

How do I diff two files in MSBuild? I cannot find any specific task to do it. If possible, is it also possible to exclude certain rows, or patterns in the files eg. 2009-12-09T10:03:07.6888125+02:00 ...

Loading text from a file into a 2-dimensional array (C++)

I'm making a game and I have stored the map data in a 2-dimensional array of size [34][10]. Originally I generated the map using a simple function to fill up the array and saved this data to a file using the following code: ofstream myFile; myFile.open("map.txt"); for ( int y = 0 ; y < MAP_HEIGHT ; ++y ) { for ( int x = 0 ; x < MAP_WI...

How to specify a physical path on disc to a file, but acces a memory location??

Hello Everyone, I'm trying to integrate several components to build a custom reporting solution. One of these components is a template-based report generator. It reads a template consisting on a RTF file with placeholders and perform the substitution. This works great, and generates an RTF report. Although it can generate the results a...

Can I use Eclipse JDT to create new 'working copies' of source files in memory only?

I'm using Eclipse JDT to build a Java refactoring platform, for exploring different refactorings in memory before choosing one and saving it. I can create collections of working copies of the source files, edit them in memory, and commit the changes to disk using the JDT framework. However, I also want to generate new 'working copy' sou...

What's Wrong? Question relied on: Files,Exceptions -> ERROR: EOFError

EDITED: import pickle filename=input('Enter a file name:') def entoles(): f=open(filename,'w') names=[] grades=[] while True: name=input("Give a student's name:") if name.lower()=='end': f.close() print("File closed") print("Back to M...

Question about file handling.

Hey, I wanted to know if anyone can tell me what the difference between "file.file" and "./file.file" is. It seems to make quite a significant difference in my programs to call OpenFile("./file.file"); EDIT: My mistake, I thought my question was a generic one. This is in C++ using standard library functions. ...

Count Parenthesis in a file with a Python program?

I Wanna fix a function through it i can count how many times are used the:(,),[,] if the counts of ( are equal to those of ) and if the counts of [ are equal to those of ] then i have valid syntax! my first -dissapointed- try: filename=input("Give a file name:") def parenthesis(filename): try: f=open(filename,'r') exc...

How to test file manipulation

I hear that accessing to database is wrong in testing. But what about file manipulation? Things like, cp, mv, rm and touch methods in FileUtils. If I write a test and actually run the commands (moving files, renaming files, making directories and so on), I can test them. But I need to "undo" every command I ran before running a test ag...

Using Python, how do I to read/write data in memory like I would with a file?

I'm used to C++, and I build my data handling classes/functions to handle stream objects instead of files. I'd like to know how I might modify the following code, so that it can handle a stream of binary data in memory, rather than a file handle. def get_count(self): curr = self.file.tell() self.file.seek(0, 0) count, = stru...

What is a good way to test whether a file has required permissions?

I see that ifstream::open() returns void and does not offer any way to see if the file did not open due to permissions. What is a good api to test whether read permission or alternatively write permissions are available on a file for the current process in C++? ...

problem completing renderResponse phase after redirecting to a servlet from a JSF page in portal environment

I have a commandLink in a JSF page in a portal environment. On clicking it, I redirect to a servlet (by calling facesContext.getExternalcontext().sendRedirect(//Servlet URL//)). the servlet is created for downloading an excel file from the server. A Save As File dialog opens up with the JSF Portal page in the background. This works f...

How can a Hashtable access data from a text file in Objective-C??

Hi, I have already created a project to read a file and also to display it. Now i need to create a hashtable and access the data from the created file( text file ) in Objective-C for iPhone-OS. Pls do give suggestion... ...

Visual Studio 6 : How to change the workspace file name?

When using VC++6 sp6, how can I change the workspace file name? The workspace directory contains three main files with the following file extensions. When I tried changing the filenames while preserving the respective file extension, I get a whole bunch of errors and warnings when I tried to recompile the projects contained in that wor...

FileBrowser/FileSelector for WPF

Hello, does anybody know, if there is a WindowsExplorer-like filebrowser which I can include in my WPF-window. I don't want use OpenFileDialog. I have searched a bit and only found simple directory-trees or lists. I want to have an interface like it is in OpenFileDialog. Would be great if there are any advices, Greetings, Martin ...