file

How can I check if the content of a folder was changed

I need a procedure that checks if new folders/files were added to a given selected folder. I need this procedure to run upon application start up so the processing time at this stage is important. I guess I can make a log of current state, log of the previous state, sort and compare them. First I need to know if there is another way. ...

Nesting appSettings with the file attribute

I'm trying to pull off an inheritance chain of appSetting sections (VS2010 C#) Given this, Base.config <appSettings> <add key="basekey" value="basevalue"/> </appSettings> Derived.config <appSettings file="Base.config"> <add key="derivedkey" value="derivedvalue" /> </appSettings> App.config <configuration> <appSetting...

Opening a file in 'a+ 'mode

If a file is opened using the following command: FILE *f1=fopen("test.dat","a+"); The man page reads: a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but...

Dangerous AVI files? Is any application which can open a media file under attack?

Can *.avi or any media file contain any script or dangerous code? Today i saw following message in Microsoft Security Essentials: Category: Trojan Downloader Description: This program is dangerous and downloads other programs. Recommendation: Remove this software immediately. Items: containerfile:C:\Users\...\amediafilename.avi file:...

Getting all lines from a file, and put unique lines in a new file.

Using PHP I have tried all day to get this done. I failed. I want to: open a directory and read all files there. read each files contents line by line (each line is a name with no spaces (single column)). put each line into a new file (newline by newline). remove duplicate lines. save the new file. Easy for the gurus, mind numbing fo...

I need to create a new sqlite database with all tables on the fly

Hello, when a user starts my app he can create a new project which means creating a new database with all tables. I do not want to copy the structure of the tables from an older database/older project because in the meantime due to an update of the programm the tables could have changed too... this would lead to chrashes. So with eve...

NetBeans 6.8 C++, files are being written and read in the wrong directory...

When i run my project with the "Run main project" mode, my program writes the .txt file to my /home directory. I found this extremely odd, so I ran the program with "Debug main project" mode and it wrote the .txt file to the project directory. Is there a setting in options that will fix this so both modes will write the file to the proje...

Extending the File class to provide user a consistent way on filesystems over network channels transparently

Dear all, I'm implementing a Java-based system which needs accessing both the native and networked filesystems. Using the Java File class is easy and straight forward in the native case, and I'd like to keep this consistency to user even the filesystem is connected over the network. e.g. File folder = new File("some_folder"); File[] fi...

Detect if stdin is a tty device (terminal) or pipe in PHP?

I wrote a php script. I want it show help message when called with standard input connected to a tty device (terminal) before reading and executing interactively, but dont show when called with a file or stream from pipe as standard input. Is there a way to detect this from PHP? ...

Large file parsing

I wasn't very bright and I deleted some files that I need for school. I need to parse a dump of my hard drive for the files. The file will be hundreds of gigabytes in size. Can anyone tell me a way to do this in c or python? I know that c can only handle files up to 2 gigabytes in size is there any way I can get Around this? My parsing w...

Creating a login page in java console application using a txt file

I am creating a java console application and i need to use a notepad (txt) file to store PIN, AccountNo and Balance. When the user enters the PIN (from BufferedReader) it should get validated from the notepad file and login to thge system. However, the code fragment which I used below only displays Enter PIN, and when i click on Enter, t...

How to count occurances of a character in file ?

I want to print no. of a, b, c,etc... Special characters, vowels, consonants in file using Java. how to do that? ...

How to get nested directories contents in Perl

Hello all, i'm trying to write a script which would process certain files. The data are organized like this: there is a folder (let's call it X) where my script will be placed. In this same folder there is a subfolder called 'data'. This contains several more subfolders with various names and each of these contains many files (no other ...

iOS - Initialising an Array from a file

Hi, I am trying to initialise an array from a file This is the file containing an array of strings .. this is the xml file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; <plist version="1.0"> <array> <string>ccccc</string> <string>ddddddd<...

How do I embed a file in an Excel spreadsheet using POI?

More specifically I would like to embed an XML document. The idea is either to display the XML in a text pane of some sort or have an icon which would open the XML document with the default system editor (Notepad, IE, XML Spy or whatnot). What I am looking for is what you get when you in Excel choose Insert -> Object... and then choose ...

put z-index of embedded windows media file always op 0 level (z-index)

With this code i'm trying to put a windows media file on a HTML page. I also have a menu on top of my page. Problem is my top menu dissapears behind media in FireFox. IE browsers working good on this problem. Somebody any ideas, please? ...

How can I use nftw(...) and define the block size for the stat function

Hi, I want to use nftw() to traverse my file system directory structure and sum up how many space each directory is using. I don't want to use du because it make fork call. I used nftw (with the flag - FTW_PHYS), nftw calls stat but i noticed that the default block size is 512bytes , while my file system use a different block size. any ...

Logging in a text file iPhone

Hi, I have a score system and I would like to log all scores in a text file separated by line breaks. Here is my current save code: NSData *dataToWrite = [[NSString stringWithFormat:@"String to write ID:%i \n",random] dataUsingEncoding:NSUTF8StringEncoding]; NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDir...

Codeigniter multiple file upload paths

I'm building an app which needs to take uploaded files and put them in separate directories for thumbnails and fullsize images. But $config['upload_path'] = './uploads/'; only allows me to select one upload path. How do I define two or more upload paths? ...

File.OpenWrite appends instead of wiping contents?

I was using the following to write to a file: using(Stream FileStream = File.OpenWrite(FileName)) FileStream.Write(Contents, 0, Contents.Length); I noticed that it was simply writing to file file correctly, but didn't wipe the contents of the file first. I then decided to simply use: File.WriteAllBytes(FileName, Contents); This...