files

"listening" to file changes in C/C++ (on Windows)

Is their any way I can target a certain file and be able to receive all changes that are made to it? Such as a file called Names.txt. Could I watch that file for names added? and then write them to the console? The example code with not compile in Dev-C++ 4.9.9.2 #include <windows.h> #include <stdlib.h> #include <stdio.h> #include <tc...

Applescript in Finder: advance to next file

What I'm trying to do is: set x to current selection, then advance the selection to the next file and then delete x. I'm doing this because CMD-backspace clears the selection every time and that's annoying! ...

cross platform settings directory

Hi I am making a jython application that needs a config/settings file (and probably eventually directory) but I want it be stored in the expected/correct directory for each os. ~/.app_name/config in linux c:/documents and Settings/User/app_name ?? in windows. I have found this: http://snipplr.com/view/7354/home-directory-crossos/ b...

How should i save a HttpPostedFile

Situation, a user MAY upload a file and MAY trigger the spam filter. If it does trigger the spam filter i save all the post data and show a captcha. If the 'bot' doesnt succeed by the time the session times out the HttpPostedFile data (which includes uploaded file) should discard. I am assuming i dont want to put the uploaded data into ...

Why does reading a file into memory takes 4x the memory in Java?

I have the following code which reads in the follow file, append a \r\n to the end of each line and puts the result in a string buffer: public InputStream getInputStream() throws Exception { StringBuffer holder = new StringBuffer(); try{ FileInputStream reader = new FileInputStream(inputPath); BufferedReader br = new Buffe...

Compiling a set of NSIS scripts using Eclipse

Hi All, I have a script having dependencies to two other scripts. I'm using Eclipse as my NSIS editor. whenever I have changes to script3, I have to compile script1 and script2 first. And I do it manually. Other than creating a batch file, is there a way you could tell Eclipse that everytime you compile script3, it has to compile scri...

Search a folder for files like "/*tmp*.log" in Python

As the title says, I'm using Linux, and the folder could contain more than one file, I want to get the one its name contain *tmp*.log (* means anything of course!). Just like what I do using Linux command line. ...

Drag Drop to the Desktop after creation of the file? (C#)

Hi, I have a query about drag-drop in C# using .NET. My issue is with remote files. I have a list of remote files which the user can drag into an explorer window (desktop, etc). When such a drag occurs I want to be able to download the file and write it to the drop location. The normal method of dragging files: private void StartDra...

How to join filesystem path strings in php?

Is there a builtin function in php to intelligently join path strings? Like path_join("abc/de/","/fg/x.php") which should return "abc/de/fg/x.php", but path_join("abc/de","fg/x.php") should have the same result If not, is there a class availabel. Could also be valuable for splitting paths or removing parts of them. If you have written ...

Save a WAV file to disk

This is a web service call which I wrote that is intended to receive a WAV file via a POST and store it in the web-app server's local file system (IIS). Is there a simple method to store the file and if so would someone be so kind as to provide a C# example? ...

Visual Studio resource editor

I am trying to view a .resx file in the resource editor in Visual Studio, but Visual Studio is unable to open it with this program. I right clicked on the .resx file and then chose Open With. It gave me a list of different programs I could choose to open my .resx file with, including XML Editor, HTML Editor, Binary Editor and Resource Ed...

Link to Directory on Network in ASP.NET MVC [solved, kinda]

So I'm working on an Intranet web application using ASP.NET MVC, and I need to create a link to a folder on the network. So, as an example, let's say I wanted to create a link to "C:\", and this uri is stored in site.DocsPath. I figured the easiest way to do this was just create a regular link, like this: <a href="file:///<%= site.DocsP...

How do I store files or file paths in a java application?

I apologize if this is a really beginner question, but I have not worked with Java in several years. In my application, I need to keep up with a list of files (most, if not all, are txt files). I need to be able to add to this list, remove file paths from the list, and eventually read the contents of the files (though not when the file...

DOS COPY the first file in a directory

How to copy the first file in any directory starting with .rar extension? ...

Executing The Same Command In Multiple Shell Scripts

I'm using the following to to tee output of a command into a file: logs/`basename $0`-`basename $1`.`date +%F--%R\`.log And since this same syntax belongs in several different shell scripts, I'd really like it to only appear once. My first thought was to put it in another shell script: export LOGFILE=logs/`basename $0`-`basename $1`...

PHP (folder) File Listing in Alphabetical Order?

Hi all, I'm not sure how simple this would be, but I'm using a script which displays the files from a specific folder, however I'd like them to be displayed in alphabetical order, would it be hard to do this? Here's the code I'm using: if ($handle = opendir($mainframe->getCfg( 'absolute_path' ) ."/images/store/")) { while (false !=...

RandomAccessFile.write not writing what I tell it to

Hey all. I'm reading from one sql-format file to another, and two bytes in the middle are being corrupted, and I assume it's some preparation or safeguard that I didn't do. Example of corrupted data: //From the file that is read from. added ** to emphasize the corrupted byte insert into viruses (virusSig,virusHash) values ( X'579fdc56...

Remove File with white spaces on its name

I have a file named "my file.pdf" and I can't delete this file with this code: if (remove("/var/tmp/\"my file.pdf\"") != 0) printf( "Error deleting file\n"); Any suggestion different than do some regex to replace '{whitespace}' for '\{whitespace}'? ...

How to split a path platform independent?

I'm using the following code to get an array with all sub directories from a given path. String[] subDirs = path.split(File.separator); I need the array to check if certain folders are at the right place in this path. This looked like a good solution until findBugs complains that File.separator is used as a regular expression. It see...

CVS checkout ignore corrupted files

Is there a way to have CVS checkout everything and if it hits corrupted files it will just skip them and go on? ...