file

C#, Win CE 4.2, Write file, power loss

Hello programmers, I'm using C# & the compact framework on an embedded device to log data to a compact flash card. Because data integrity is of upper most importance, I'm wondering how to write the data to the flash disk. Will files get lost/damaged if power is lost during a write/flush or while the file is opened? What's the best way t...

Reading files in python

Trying to understand how you're supposed to read files in python. This is what I've done and it isn't working quite properly: import os.path filename = "A 180 mb large file.data" size = os.path.getsize(filename) f = open(filename, "r") contents = f.read() f.close() print "The real filesize is", size print "The read filesize is", len(...

c# Find a file within all possible folders?

I was wondering how I could use c# to find a specific file (example cheese.exe) within all possible directories? And then store the path to the directory it found it in? Any help is wonderful :) ...

write string to text file and ensure always overwriting

in csharp i have a string and i want to write it to a file and always overwrite the existing content. if the file isn't there it should create it as well (instead of throwing an exception) ...

Saving a file in Java

I have a String that holds a path to a file. I want the users to be able to select a path and filename with a file chooser and have the program save the file given in the String variable to a location of their choice. What is the best way to do this? ...

Sharepoint webpart upload file whitout using "runat server"

For uploading a file in sharepoint I use a webpart and an automatically generated form. the tag for the upload file: <input type="file" id="uploadfile" name="uploadfile" /> When I try to pick it up after posting, the file isn't accessible with the Request.Files attribute (Request.Files["uploadfile"]). (Request.Files looks like null o...

File modification date in Java

I set the modification date of a file created in Java to a specific number. When I read out that value on Windows, I get the same value out. However, on Linux (ubuntu) I get a different value. The value for File.lastModified() is off by 9 hours, yet when I look a the file properties I see that it's off by 1 hour only. I am expecting the ...

How to filter files when using scp to copy dir recursively?

I need to copy all the .class files from server to local with all dir reserved. e.g. server:/usr/some/unknown/number/of/sub/folders/me.class will be /usr/project/backup/some/unknown/number/of/sub/folders/me.class the problem is, there are many other useless files such as .svn-base files that i don't want. how can i filter them so I only ...

Problem with Twisted python - sending binary data

What I'm trying to do is fairly simple: send a file from client to server. First, the client sends information about the file - the size of it that is. Then it sends the actual file. This is what I've done so far: Server.py from twisted.internet import reactor, protocol from twisted.protocols.basic import LineReceiver import pickle i...

Can any one tell me how to write a simple C++ code to export my data(from variable) into PDF file without using any external libraries or utilities?

Can any one tell me how to write a simple C++ code to export my data(from variable) into PDF file without using any external libraries or utilities? ...

N:1 file descriptors???

Is it possible to have N file descriptors be seen to a program as 1 file descriptor such that data received on any of the N file descriptors (ie from N sockets) will be forwarded back to the calling API on the single file descriptor, hiding the fact that it may actually be coming from a different file descriptor? Is it also possible to h...

mysql ndb cluster add data node

Hi All, This is my config.ini file options affecting ndbd processes on all data nodes: [ndbd default] NoOfReplicas=1 # Number of replicas DataMemory=80M # How much memory to allocate for data storage IndexMemory=18M # How much memory to allocate for index storage # For DataMemory and IndexMemory, we have use...

"Upload" a file from django shell

I need to import some data from a excel file and a folder with images, every row in the excel describes every entry and have a list of filenames in the folder (photos related to the entry). I've done a script which creates every entry in the database and saves it trough the django shell, but i have no idea how to instantiate a InMemoryU...

Reading data from file into array of structs C++

I have a sample txt file and want to read the contents of the file into an array of structs. My persons.txt file contains 5 arbitrary nos one on each line. 7 6 4 3 2 My program looks like this: #include <iostream> #include <fstream> using namespace std; struct PersonId { typedef PersonId* ptr; PersonId(); int fId; }; ...

dsofile c# API / NTFS custom file properties

I'm searching for a good way to add meta data to a file. dsofile.dll works fine for NTFS. The meta data is lost, when one drops a copy on a FAT32 share (it uses NTFS hidden streams I guess). Microsoft Word documents contain meta data that are not lost, how do they do it? Similiar to FAT, sending the file via E-Mail strips of all meta dat...

Remote File Read

Hi All, How can I read a text file resides in a remote machine? There is no share exists in that machine and I am not allowed to create any share or file in the remote machine. Also I am not allowed to run any client program in the remote machine. My program is a ASP.net in C# residing in a IIS webserver. For linux machine we used ssh c...

Problem with directories and file selector (VC++ 2008)

Hi, I have implemented a file selector with a combobox. I want to write the selected filename to a log. The problem is that when I select a file from the original directory it goes well but when I choose a file from another directory it won't work. Can anybody help with this? Here is the code for the file selector, it is inside a dialog...

How / when to delete a file in java?

The problem is, user clicks a button in JSP, which will export the displayed data. So what i am doing is, creating a temp. file and writing the contents in it [ resultSet >> xml >> csv ], and then writing the contents to ServletResponse. After closing the respons output stream, i try to delete the file, but every time it returns false. ...

Force user to download .txt (php, file.txt)

Hello! I have a small script, which reads the data from DB, array them and save them as .txt file. At the end, user is redirected to that file. Now, how to achieve that when user is redirected on .txt file download box appears? <?php // Preden zacnemo, dobi novico iz baze! $MOD_NEWS_SAVETXT_getnews = mysql_query("SELECT * FROM NEWS...

Is there a File.AppendAllText() in Java?

Is there some clean static method to just dump (append) a string to a file? ...