file

Any way to get a File object from a JAR

I have a JAR file that contains an API that uses external model files. I would like to include the model files in the JAR itself so it easier to use for other developers. The API will accept a File object only, is there any way to do this? I have already tried the following, and they have failed: Using class.getResourceAsStream(). ...

Applescript Help : Copy file to a new Pluged USB Device.

Hi there I wanna do an Artist Instalation, that invites ppl to plug in theyr USB drive into my Piece of Art, when they do that I copy to theyr USB some of my artowrk. I wanna do this usign apple script but im not a programer, digging arroudn found this code that copy files to a directory, what I wanna change now is that directory, I nee...

Why would using File.open call once result in it being called 3 times according to rspec

Below you can see that I'm calling File.open only once but rspec is telling me it received it 3 times. def self.import_file(filename) current_file = filename.split('/').last destroy_all(["filename = ?",current_file]) unpack_format = "A#{INPUT_FILE_FORMAT.map{|element| element[1]}.join("A")}" debugger File.open(filename, 'r')....

python file reading

I have file /tmp/gs.pid with content client01: 25778 I would like retrieve the second word from it. ie. 25778. I have tried below code but it didn't work. >>> f=open ("/tmp/gs.pid","r") >>> for line in f: ... word=line.strip().lower() ... print "\n -->" , word ...

Leopard Console logs for common files reference

Hi, I am using plugins for one of my Mac OS X(desktop) application. These plugins refer to a common file that contains base class implementation of both the plugins. When the application refers to this common base class, the following message is displayed in the console by the system: " is implemented in both and . One of the two wil...

help me in this php code

see this http://stackoverflow.com/questions/2190540/adds-an-empty-directory-in-the-archive i cant use that code function addFolderToZip($dir, $zipArchive, $zipdir = ''){ if (is_dir($dir)) { if ($dh = opendir($dir)) { //Add the directory $zipArchive->addEmptyDir($dir); // Loop through all the files w...

Loading File in Flex without AIR?

i am using flexbuilder 3 now i need to load xml file from disk using flex without AIR i imported flash.filesystem.File but error occured. but AIR project,flash.filesystem.File was successfully imported. Cant i use flash.filesystem.File from flex without using AIR??? ...

ofstream - detect if file has been deleted between open and close

I'm wriiting a logger on linux. the logger open a file on init. and write to that file descriptor as the program run. if the log file will be deleted after the file descriptor was created, no exception/error will be detected . i have tried: out.fail() !out.is_open() i have google this and find this post . http://www.daniweb.com/forum...

NSFileHandle weird problem with iphone

Hi , i am downloading an mp3 file using NSURLConnection and saving it to a file . The problem is mp3 file is created (found the mp3 file created when using simulator), but i cannot access the mp3 file . Any ideas?!!!!! This is the code i'm using filename = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMas...

How to send a dynamically generated file in a rails app

I'm trying to serve a dynamically generated files in a rails app, so when the user clicks a specific link, the file is generated and sent to the client using send_data. The file is not intended to be reused: is a short text file and regenerating should be really inexpensive as it won't be donwloaded that much; but if it is necessary or ...

<input type=‘file’> for IE gives full path, need file name only

When perform uploading from IE browser, that my backend(org.apache.commons.fileupload) gets full file path. For other non-IE browsers it gets filename and it's OK because of security. How to get filename only from input for IE? Is it possible to do on UI, because I think it's not very graceful to edit apache lib. Maybe , some paramet...

memory, file size, and variables?

Does creating a lot of private variables that may never be used increase file size and or memory usage of your application? ...

PHP read from uploaded text file?

Hi, If I upload a text file via a form, is it possible to output its contents directly from the $_FILES variable rather than saving it onto the server first? I know this is a security risk, but it will only be run on a local machine. Any advice appreciated. Thanks. ...

iphone storing and then reading a file from Documents folder

this must be easy but I want to put a file in the Documents folder which is read in at start up. I have the code on how to read and have confirmed its looking in the correct directory. However the file I have ,RootList.txt when saved in the Resources folder in xcode, is stored under the Root.app folder and the Documents folder is empty. ...

writting to a XLS file using PHP

Hi there My application generates some .xls files and until now I was using PHPExcel lib. One of the SO has recommend me to use this approach. The problem is that I have to use some .xls templates and to append some data to them. Who can help me with some pointers. I don't get how xlsBOF() and xlsEOF() works or have to work in my case....

NSTreeController how to save to file

Hi I am using an NSTreeController to control an NSOutlineView. This application loads bookmarks from file to application. As in the SourceView example in ADC: http://developer.apple.com/mac/library/samplecode/SourceView/index.html My questions is how do I save the bookmark to file once user makes the changes. Should I maintain the arra...

Count lines in files in folders recursively

In C#, what is the best way to get a count of the total number of lines in all the files in a directory and all of its subdirectories? The obvious answer is to make a recursive function to go through all of the directories and use the strategy from this question to count the lines in each file. Is there a better/easier way? ...

flex flash xml file

I generated swf file from flex builder but not using AIR i have a data.xml file but flex builder`s generated swf file cant read the data xml file swf file and data.xml file are located into same directory how can i solve file? ...

Search a large file for data in C/C++

Hi all, I have a log file which has a format of this kind: DATE-TIME ### attribute1 ### attribute2 ###attribute3 I have to search this log file for a input attribute(entered from command line) and output the lines that match the entered attribute. A naive approach may be something like this: scan the entire file line by line searc...

How do I read a file's contents into a Perl scalar?

Hi, what i am trying to do is get the contents of a file from another server. Since im not in tune with perl, nor know its mods and functions iv'e gone about it this way: my $fileContents; if( $md5Con =~ m/\.php$/g ) { my $ftp = Net::FTP->new($DB_ftpserver, Debug => 0) or die "Cannot connect to some.host.name: $@"; $ftp->log...