file

Javascript validation for invalid file type

I have a scenario wherein user is trying to view an invalid image file (for example an .dll file renamed to JPG extenstion). How to alert the user using javascript that this is an invalid file ...

Display an image in WPF without holding the file open

I'm working on an image management app in WPF that displays a number of images and allows the user to move them around the file system. The issue I've run into is that displaying a file with an <Image> element appears to hold the file open, so attempts to move or delete the file fail. Is there a way to manually ask WPF to unload or rel...

How to know what file is opened by an application at any time?

Hi, I'm new here, so I don't have the time to contribute before I ask for u guys' help, so pardon me for that. I'm not sure if this can be done, but I would like to find out the opened file(s) of an application. Here I don't mean the "internal" opened files, but are those that are opened by the end-user (either by invoking the handling...

where can I find graph input resources/files?

Hi! I want to test various algorithms on graphs. Does anyone know a web where I can get lots of examples in text files? I've found many examples but they are always images. I want a text description of a graph, by edge listing or whatever... do you know one such source? Thanks! Manuel ...

IIS7 Request Mapping, File Extensions

I have a website that used to have .dsp file extensions for all pages. There are alot of other sites referencing mine that reference the pages like that, but my pages are all actually .aspx pages. In IIS5, I was able to configure this to work. My problem is I've recently switched from IIS5 to IIS7, and I have no idea how to map these ...

Read first N lines of a file in python

We have a large raw data file that we would like to trim to a specified size. I am experienced in .net c#, however would like to do this in python to simplify things and out of interest. How would I go about getting the first N lines of a text file in python? Will the OS being used have any effect on the implementation? Thanks :) ...

Java: Why isn't my file writing working?

I'm trying to write a file from my Java program, but nothing happens. I'm not getting any exceptions or errors, it's just silently failing. try { File outputFile = new File(args[args.length - 1]); outputFile.delete(); outputFile.createNewFile(); PrintStream output = new PrintStream...

How to write into a file in PHP?

Hello everybody!!! I have this script on one free PHP-suppoting server: <html> <body> <?php $file = fopen("lidn.txt","a"); fclose($file); ?> </body> </html> it does create the lidn.txt file, but it's empty. I want to create a file and to write something into it, for example this line "Cats chase mice", how can I do it? ...

iPhone + file upload control

Hello, I have an application which uploads file from iPhone to web server. Problem is that I want to give users a control like from which they can select the file / photo from the device and which is than uploaded on server. Can anyone help me ...

Visual Studio Shortcut/Alias In .csproj

Within Visual Studio I'm pretty sure there is a way to "alias" a file among several projects. So in other words the actual file lives in only one place within the file system but has multiple references within two or more .csproj files. Short of opening the .csproj and creating such an alias, how would I do this within Visual Studio? ...

Overwriting an Open File in Windows

In what situations does Windows allow you to overwrite an open file? Is that ever allowed? This includes renaming a different file to the same name as an open file. ...

Java: Most efficient way to store/retrieve workout information from a file?

I'm working on a Java project for class that stores workout information in a flat file. Each file will have the information for one exercise (BenchPress.data) that holds the time (milliseconds since epoch), weight and repetitions. Example: 1258355921365:245:12 1258355921365:245:10 1258355921365:245:8 What's the most efficient way t...

detect UTF-16 file content

Is it possible to know if a file has unicode (16-byte per char) or 8-bit ASCII content ? ...

Is there something like Perl's Win32::FileNotify for Linux or OS X?

I've been using Win32::FileNotify on Windows, and I was curious to know if there were something similar for Linux and OS X. I haven't been able to find such a module using Google. Does anyone here know of such a thing? ...

Python importing & using cdll (with a linux .so file)

Hi all! After one of my last questions about python&c++ integration i was told to use dlls at windows. (Previous question) That worked ok doing: cl /LD A.cpp B.cpp C.pp in windows enviroment, after setting the include path for boost, cryptopp sources and cryptopp libraries. Now i'm tryting to do the same in linux, creating a .so fil...

Using file() returns nothing - PHP

Hi. I am currently writing a little application for my University radio station in PHP. It basically grabs the listener count from the status page (http://www.address.com:8000/status.xsl) and puts it in a database every minute. Now the script seems to work fine when it's run off of my home machine. I have no issues retriving the inform...

iphone file system save file from url

hello guys, i want to save a photo file from a given url to the documents folder of my app without giving it a filename just the url and it saves to disk, is that possible ? or do i have to get the data from the url and then parse it as UIImage then save that image to disk and give it a filename ? if there is no direct way, how can yo...

Replace a line in a text file

Hello I've a text file with a line default_color acolor and I want to replace this line with default_color anothercolor I don't know the first color and the second is contained in a variable. How can I do it in bash ? Thank you ...

alternative to file(1) for javascript/css mimetype

On win32 I'm using $ file -v file-5.03 magic file from C:\PROGRA~1\gnuwin32/share/misc/magic but its giving weird results foo.css; text/x-c; charset=utf-8 json2.js; text/x-c; charset=us-ascii foo.js; text/x-c++; charset=utf-8 bar.js; text/plain; charset=utf-8 Anyone get similar results? better results? Does anyone know of an altern...

php find oldest file in a folder

Hey, I need a PHP script that will find the date of the oldest file in a folder. Right now, I am iterateing over every file and comparing it's Date Modified to the previous file and keeping the oldest date stored. Is there a less disk/memory intensive way to do this? There are about 300k files in the folder. If I open the wolder in Wi...