write

Python: undo write to file

What is the best way to undo the writing to a file? If I'm going through a loop and writing one line at a time, and I want to undo the previous write and replace it with something else, how do I go about doing that? Any ideas? Thanks in advance! ...

Comma Separated Value Files (Read/Write) - C#

Hey all, I've been very interested in CSV files for a few years now, but I never needed to use them until now, so I'm pretty new to this. I have an application that stores information about Controls that were created by the user at run-time. I plan on using CSV files to store this information which will be extracted at a later date by ...

C#: How do I delete the first "X" lines of a text file?

Hello, For a project that I am doing, one of the things that I must do is delete the first X lines of a plaintext file. I'm saying X because I will need to do this routine multiple times and each time, the lines to delete will be different, but they will always start from the beginning, delete the first X and then output the results to ...

How to space a write file

Hello everyone I'm currently new to python, and I'm trying to write a program where the user can input a message and the output will show the numeric code of the message, but at the same time I need to write the numeric code to an additional file. So for example the user inputs the word "Hello" The user will see the output "72 101 108 1...

iPhone writing binary data

How do you write binary data to a file? I want to write floats to a file, raw, and then read them back as floats. How do you do that? ...

What is the correct way to write HTML using Javascript?

I see in some posts that people frown upon using document.write() in javascript when writing dynamic HTML. Why is this? and what is the correct way? ...

how can I put a breakpoint on "something is printed to the terminal" in gdb?

I would like to know from where inside a huge application a certain message is printed. The application is so big and old that it uses all conceivable ways of printing text to the terminal; for example printf(), fprintf(stdout, ...) etc. I write to put a breakpoint on the write() system call but then I'm flooded with too many breakpoint...

jQuery plugin callback

ok, so what i'm trying to do is a plugin that returns a jquery array to be used in a callback function. let's say that i have this code`` (function($){ $.fn.extend({ //plugin name myPlugin : function(needed){ var defaults = { path : 'action.php', source : '' } var needed = $.extend(defaults,needed); //return return...

programs running in parallel, read/writing in C

I'm considering a set of 4 programs: (Prog1, Prog2, Prog3, Prog4) interacting with 4 files (FileA, FileB, FileC, FileD) Prog1: writes (appends) to FileA Prog2: reads File A and writes (appends) to FileB Prog3: reads File A, and writes (appends) to FileC Prog4: reads File B, and writes (appends) to FileD or Potentially Prog1, might al...

C# - Save ListView contents as XML (With multicolumns) and read on Form_Load

My application has a ListView control that has data added to it across several columns and rows. When the form is closed (calling the Form_Closing event), the contents are saved to an XML file. Then, at the following run time, the XML document is read and its contents are displayed in the ListView control. For some reason, it only loa...

C++ Serial Port Only Responding Once Using Write()

All the code below works. My device responds, C,7 is a reset. When I run this the second time it doesn't respond. If I manually turn my device off and on, then run this script again it works. But not if I press the button to run the script the second time. RS232: 57600,8,N,1 Any ideas?? Is there any more information needed to solve thi...

How does NetworkStream work in two directions?

I've read an example of a Tcp Echo Server and some things are unclear to me. TcpClient client = null; NetworkStream netStream = null; try { client = listener.AcceptTcpClient(); netStream = client.GetStream(); int totalBytesEchoed = 0; while ((bytesRcvd = netStream.Read(rcvBuffer, 0, rcvBuffer.Length)) > 0) { netStream.Wri...

jquery $.function()

how can i write a plugin/function and then be able to call it like this(no selector required) $.function() noe i write my plugins something like this: (function($){ $.fn.extend({ //function name myFunction : function(){ //........... } }); })(jQuery); ...

Writing Encoded Objects to File

Hi all, I'm looking for a low-level encryption to write questions/answers for a test/exam application in Java. Both the questions and exam are objects. Basically, I need a way to serialize a object, write it to a file, whilst encrypting everything so no one can read the question/answers without my program. I've heard of Protocol Buffer...

Writing unicode characters with Batik doesn't work

Hi, I am writing a project with Batik, which is for multi-language image. Therefore I need signs like "sigma" or "alpha". I have to write the character as text - not as a polygon or as a glyph - because it has to be written by my project again. If I write a unicode character in my SVGDocument it is shown correctly in the debugger, but ...

How to store a variable in a file in MATLAB

In order to store a variable dist to a file preferably Excel file, we can use xlswrite('a.xls', dist) or dlmwrite('a.txt', dist, ',') Problem is suppose the variable dist is in a loop in a program and returns a different value each time the program runs as per the input then each time a.xls is overwritten and I get only the last v...

Overwriting files permission - C#/ASP.NET

While implementing XML file reading/writing in my application I saw that when I call XElement.Save("myfile.xml") it will overwrite an existing file. Is this behavior default for all methods that Save files in C#/ASP.NET or does it depend on the permissions given to ASP.NET? If my app will be deployed by different people on different ho...

iPhone sqlite3 locked, can only read, not write.

So I have been working on this project for a short while now. I have no problems with reading data from the DB, and formatting it into UITableViews and what not. But now I am wanting also to write to the DB as well. The problem is I keep getting a "Database is Locked" error from sqlite. After messing around with the original version I ha...

Checking a file for a certain string in Java.

I'm trying to have my application read through a text file and look for a string. If the string does not exist, it makes it using println. The only problem I'm having is that it doesn't seem to read the text file. What I have so far is: PrintWriter itemwriter = new PrintWriter(new FileOutputStream(items)); FileInputStream fstream = new ...

C# Write to Specific XML Node.

I have a xml database with the following format: <Students> <Student ID= *GUID NUMBER*> <FullName>John Smith</FullName> <Address>Blah blah blah</Address> and so on... <Student ID= *GUID NUMBER*> <FullName>Joe Blow</FullName> <Address>Blah Blah</Address> and so on... I have a combobox that will select from this xml data t...