file

Saving XML stream in C# says that it's being used by another process

I have this open-source library that I'm having some trouble fixing a problem... This library allows to easily create an XML file to store application settings. But I'm having an issue saving the changes. I have another application where I'm using this library and every time that application window is done resizing, I call the Save() me...

How to execute and get content of a .php file in a variable?

I want to get contents of a .php file in a variable on other page. I have two files, myfile1.php and myfile2.php. myfile2.php <?PHP $myvar="prashant"; // echo $myvar; ?> Now I want to get the value echoed by the myfile2.php in an variable in myfile1.php, I have tried the follwing way, but its taking all the contents includ...

Reading line X until line Y from file in C++

I have a relatively simple question. Say I have a file but I only want to access line X of the file until line Y, whats the easiest way of doing that? I know I can read in the lines one by one keeping count, until I reach the lines that I actually need, but is there a better more elegant solution? Thanks. ...

Directory.GetFiles() gives weird return values

This problem occurs when I try to hide a file in my directory with a tool named File Lock. This is not a regular hide as I can not see it in windows explorer. Code: string[] textFiles = Directory.GetFiles(@"c:\mydir") //0 files returned string[] textFiles = Directory.GetFiles(@"c:\mydir", "*.txt") //1 file returned: "c:\mydir\." File....

Flash ProgressEvent Not Showing Total Size

I'm using a ProgressEvent in Flash to determine how long something will take to download. I've got this: progress = event.target.bytesLoaded/event.target.bytesTotal; to set a percentage. After some scratching of my head, I did a trace on the two values - and it turns out that "event.target.bytesTotal" is always equaling zero. I ca...

SharePoint file size limit

I've tried many tutorials online on how to increase the upload file size for a SharePoint document library with no luck. Any ideas on how to increase the limit of file upload to a document library? I've tried: http://spsstuff.blogspot.com/2006/03/how-to-change-maximum-file-upload-size.html http://www.eggheadcafe.com/software/aspnet/29...

Replace two fields in perl

I have text file of this kind File 1 ------- ABC 123 DEF 456 GHI 111 And I have another file File 2 ------ stringaa ttt stringbb yyy Ouput ----- stringaa ABC stringbb 123 stringaa DEF stringbb 456 stringaa GHI stringbb 111 Reading the file File 1 update File2 such that the Ouput is produced, any ideas. ...

Trouble reading a line using fscanf()

I'm trying to read a line using the following code: while(fscanf(f, "%[^\n\r]s", cLine) != EOF ) { /* do something with cLine */ } But somehow I get only the first line every time. Is this a bad way to read a line? What should I fix to make it work as expected? ...

BizTalk : Removing "spam" messages on receive location using File adaptor

My customer sometimes receives "spam" messages on their BizTalk file drop locations i.e files not of the type expected by the receive location filter eg a .doc instead of a .xls. The file adaptor does not have an option to delete such "junk" - probably for good reason- , and we can not stop the sender of these files from occasionally sen...

How would you make a header that does a file reading function in c++

This may sound newbie but, I am trying to make an external header that does a function that is reading from a file a name like joey and saving it as a variable to the other code it read from but i cant figure it out...It will be like this...One code will get this name and it will write it to the file...Then i want to use this header to r...

Copy binary data from URL to file in Java without intermediate copy

I'm updating some old code to grab some binary data from a URL instead of from a database (the data is about to be moved out of the database and will be accessible by HTTP instead). The database API seemed to provide the data as a raw byte array directly, and the code in question wrote this array to a file using a BufferedOutputStream. ...

C#: Is there a way to check if a file is in use?

I'm writihg a program in C# that needs to repeatedly access 1 image file. Most of the time it works, but if my computer's running fast, it will try to access the file before it's been saved back to the filesystem and throw an error "File in use by another process". I would like to find a way around this, but all my Googling has only yie...

where is leak in my code?

Hello everyone, Here is my code which opens an XML file (old.xml), filter invalid characters and write to another XML file (abc.xml). Finally I will load the XML (abc.xml) again. When executing the followling line, there is exception says the xml file is used by another process, xDoc.Load("C:\\abc.xml"); Does anyone have any ideas wh...

Distinguishing a pipe from a file in windows

On Unix, everything is a file, so you can use file i/o functions with pipes, files, sockets, etc. But on windows, the api you use depends on the type of i/o HANDLE you have. My question is: given a HANDLE how do you determine what the underlying type is? For example, I have a HANDLE that's either real file, or a named/anonymous pipe. ...

C# Wrapper for Media File Meta Data

I am looking for a nice wrapper for extracting media file attributes dependent of file type. I am creating a bit of a generic media library that can handle video, audio, images etc. They are not just .wmv or .mp3, i would like to be able to support various formats and dont want to pigeon hole myself to an sdk like WMP SDK that seem to on...

Object reference not set to an instance of an object?

I wrote these lines but i have NullReferenceException. please help me how to fix it! string FullPath = TempPath + FileName; System.Drawing.Image Adimg = null; Adimg = System.Drawing.Image.FromFile(MapPath(FullPath)); I put these lines in a Public bool method and TempPath is class property and FileName is input for the method. excepti...

HTML input type = file in Adobe AIR does not present file browser

So the good old HTML file uploader tag only presents a browse button (without associated text input) when rendered in a HTML based Adobe AIR application. Upon clicking the browse button, nothing seems to happen. I would expect a popup window so I can select a file. I've seen examples of people using Javascript to call the AIR runtime...

Can I access Resources file from a View in MVC ?

Hi folks, I want to populate dropdownlist with values stored in a resource file. What's the best approach for this? I can create a SelectList and push it in Model in which case dropdown would be populated automatically. But can I access resource file from a View ? If yes, should I? ...

Waiting to get exclusive access of file before moving it in C#

Hi, I have a requirement to move certain files after they has been processed. Another process access the file and I am not sure when it releases them. Is there any way I can find out when the handle to the file has been released so I can move them at that time. I am using Microsoft C# and .Net framework 3.5. Cheers, Hamid ...

Comparing records in file and reporting stats - Scenario 1

The requirements are : Fact 1 : We have some data files produced by a legacy system Fact 2 : We have some data files produced by a new system that should eventually replace the legacy one Fact 3 : Both the files are text/ASCII files, with records being composed of multiple lines. Each line, within a record, consists of a fieldname a...