Search Results

Search found 34816 results on 1393 pages for 'copy on write'.

Page 12/1393 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Using write to print floating point numbers.

    - by Tom
    Hi, As an exercise to achieve something larger, i'm trying to use write to print a floating point number. I haven't done this in a while. I must be doing something wrong because I cant get it to work. Here is my code #include <unistd.h> int main(){ float f = 4.5; write(1,&f,sizeof float); return 0; } However, when running it im getting ?@ Any thoughts? Thanks in advance.

    Read the article

  • Most Efficient Way to Write to Fixed Width File (Ruby)

    - by Ruby Novice
    I'm currently working with extremely large fixed width files, sometimes well over a million lines. I have written a method that can write over the files based on a set of parameters, but I think there has to be a more efficient way to accomplish this. The current code I'm using is: def self.writefiles(file_name, positions, update_value) @file_name = file_name @positions = positions.to_i @update_value = update_value line_number = 0 @file_contents = File.open(@file_name, 'r').readlines while line_number < @file_contents.length @read_file_contents = @file_contents[line_number] @read_file_contents[@positions] = @update_value @file_contents[line_number] = @read_file_contents line_number += 1 end write_over_file = File.new(@file_name, 'w') line_number = 0 while line_number < @file_contents.length write_over_file.write @file_contents[line_number] line_number += 1 end write_over_file.close end For example, if position 25 in the file indicated that it is an original file the value would be set to "O" and if I wanted to replace that value I would use ClassName.writefiles(filename, 140, "X") to change this position on each line. Any help on making this method more efficient would be greatly appreciated! Thanks

    Read the article

  • how to copy from one column to another but with different format

    - by Bob
    I hv a table like this:- Item Model Remarks ----------------------------------------- A 10022009 B 10032006 C 05081997 I need to copy the info from "Model" to "Remarks" with the following format:- Item Model Remarks ----------------------------------------- A 10022009 20090210 B 10032006 20060310 C 05081997 19970805 Thanks

    Read the article

  • Is it possible to copy U1 files between two PCs locally when an Ubuntu user account is recreated?

    - by Federico Ghigo
    I have 2 Ubuntu 11.04 PCs (desktop and laptop), both synced via U1. Recently I completely rebuilt the user account (completely deleted the home directory) on one of the two (the desktop), and now I have to resync. Problem is that the PC is on a slow connection and I have difficulties resyncing the 14gb of data. Of course I have the opportunity of moving it to a place where the connection is faster, but it's not comfortable, and it will take some time. Since the laptop is in sync with the account I was wondering if stopping the service and copying the files + some database (which files is the question) could let me avoid resyncing everything.....

    Read the article

  • Python: slow read & write for millions of small files

    - by Jami
    I am building directory tree which has tons of subdirectories and files. The total directory count is somewhere along 256^32 subdirectories with 256 files in each end which are only a few bytes long. I did this so I would have fast access to these files (since i'm not searching and i'm just directly accessing then via a known file path) I have a python script that builds this filesystem and reads & writes those files. The problem is that when I reach more than 1Gb of total filesize, the read and write methods become extremely slow. Here's the function I have that reads the contents of a file (the file contains an integer string), adds a certain number to it, then writes it back to the original file. def addInFile(path, scoreToAdd): num = scoreToAdd try: shutil.copyfile(path, '/tmp/tmp.txt') fp = open('/tmp/tmp.txt', 'r') num += int(fp.readlines()[0]) fp.close() except: pass fp = open('/tmp/tmp.txt', 'w') fp.write(str(num)) fp.close() shutil.copyfile('/tmp/tmp.txt', path) I previously tried performing linux console commands but it was slower. I copy the file to a temporary file first then access/modify it then copy it back because i found this was faster than directly accessing the file. I think the cause of the slowdown is because there're tons of files. performing this function 1000 times sometimes reach 1 minute now, but before (when there were only a few files, 1000 calls was performed for only less than 1 second) How do you suggest I fix this?

    Read the article

  • Howto: Download local copy of Google's Pacman game

    - by macek
    It looks like this is HTML+JavaScript. Is there a way I can download a copy so I can continue playing after they take it down? Thanks for any help :) Edit Ok, ok, I wasn't completely forthcoming. Not only would I like to continue playing it, I kinda want to look at the source code, too... I was able to find this: Google pacman10-hp.2.js See it reformatted on Github here. Thanks @SteD Github repo I setup a github repo: macek/google_pacman. Check out the README, I think we're very close! Send me pull request if you make any progress. Put any useful details in the README. Let's get this working! :)

    Read the article

  • LLBLGen: Copy table from one database to another

    - by StreamT
    I have two databases (SQL Server 2005) with the same table schemes. I need to copy data from source table to destination with some modification of data along the way. And if destination table already contains some data, then rows from source table should not override, but be added to the destination table. In our project we use LLBLGen and LINQ to LLBLGen to as ORM solution. Example: Table 1: Table 2: Table 1: Key Value Key Value Key Value 1 One 1 T2_One Result=> 1 One 2 Two 2 T2_Two 2 Two 3 Three 3 Three 4 T2_One 5 T2_Two

    Read the article

  • custom Copy Responder in iphone

    - by sagar
    Hello ! I have a webview in my application. I want to handle when user copies something from web view, my custom method - should be triggered. I have tried following. I have placed following method in myViewCtr.m file -(void)copy:(id)sender{ NSLog(@"hi ! Hello "); } But nothing working - What should I do to implement the same ? Thanks in advance for sharing your great knowledge. Sagar

    Read the article

  • Controlling the scope of a document.write call coming from a third party

    - by pingrey
    Dear all, I'm writing a webpage that relies on an external javascript file (that I have no control of), which returns data by using document.write's. Is there any way to dynamically call the function without it overwriting the whole document? The most concise code I can think of is below: <html> <head> <script type="text/javascript"> function horriblefunction () { document.write("new text"); } </script> </head> <body> Starting Text... <div id="pleasewriteinme"></div> Other text... <button onclick="horriblefunction();">Click</button> </body> </html> The idea beginning that without altering "horriblefunction()" (as it's external) the new text could be placed in the div instead of overwriting the page. Is this possible or does the function have to be called inside the div as the page is created? Thanks for you help

    Read the article

  • MySQL: Copy a field to another table

    - by harpax
    I have a table posts that could look like this: id | title | body | created | .. ------------------------------------------- I would like to use the boolean search feature that is offered by a MyISAM Table, but the posts table is InnoDB. So I created another table 'post_contents' that looks like this: post_id | body -------------------- That table is already filled with some contents and I can use the boolean search. However, I need to move the title field in the post_contents table as well and then copy the existing title-data to the new field. I know about the INSERT .. SELECT syntax, but I don't seem to be able to create the correct query.

    Read the article

  • How do I write unescaped XML outside of a CDATA

    - by kazanaki
    Hello I am trying to write XML data using Stax where the content itself is HTML If I try xtw.writeStartElement("contents"); xtw.writeCharacters("<b>here</b>"); xtw.writeEndElement(); I get this <contents>&lt;b&gt;here&lt;/b&gt;</contents> Then I notice the CDATA method and change my code to: xtw.writeStartElement("contents"); xtw.writeCData("<b>here</b>"); xtw.writeEndElement(); and this time the result is <contents><![CDATA[<b>here</b>]]></contents> which is still not good. What I really want is <contents><b>here</b></contents> So is there an XML API/Library that allows me to write raw text without being in a CDATA section? So far I have looked at Stax and JDom and they do not seem to offer this. In the end I might resort to good old StringBuilder but this would not be elegant. Update I agree mostly with the answers so far. However instead of <b>here</b> I could have a 1MB HTML document that I want to embed in a bigger XML document. What you suggest means that I have to parse this HTML document in order to understand its structure. I would like to avoid this if possible.

    Read the article

  • md5hash performance with big files for check copy files in shared folder

    - by alhambraeidos
    Hi all, My app Windows forms .NET in Win XP copy files pdfs in shared network folder in a server win 2003. Admin user in Win2003 detects some corrupt files pdfs, in that shared folder. I want check if a fileis copied right in shared folder Andre Krijen says me the best way is to create a MD5Hash of original file. When the file is copied, verify the MD5Hash file of the copied one with the original one. I have big pdf files. apply md5 hash about big file, any performance problem ?? If I only check (without generate md5 hash) Length of files (original and copied) ?? Thanks in advanced.

    Read the article

  • Shallow Copy in Java

    - by Vilius
    Hello there! I already know, what a shallow copy is, but I'm not able to impliment it. Here's a short example. public class Shallow { String name; int number; public Shallow (String name, int number) { this.name = name; this.number = number; } } Test the implementation ... public class ShallowTest { public static void main (String[] args) { Shallow shallow = new Shallow("Shallow", 123); Shallow shallowClone = new Shallow(shallow); shallowClone.name = 'Peter'; shallowClone.number = 321; System.out.println(shallow.name + " - " + shallow.number); } } As I purpose, just the reference of the non primitive datatype String would be copied, so that by calling "shallowClone.name = 'Peter';" I would also change the name of "shallow". Am I right? But somehow, it just does not want to work ....

    Read the article

  • SQL Server 2005: When copy table structure to other database "CONSTRAINT" keywords lost

    - by StreamT
    Snippet of original table: CREATE TABLE [dbo].[Batch]( [CustomerDepositMade] [money] NOT NULL CONSTRAINT [DF_Batch_CustomerDepositMade] DEFAULT (0) Snippet of copied table: CREATE TABLE [dbo].[Batch]( [CustomerDepositMade] [money] NOT NULL, Code for copy database: Server server = new Server(SourceSQLServer); Database database = server.Databases[SourceDatabase]; Transfer transfer = new Transfer(database); transfer.CopyAllObjects = true; transfer.CopySchema = true; transfer.CopyData = false; transfer.DropDestinationObjectsFirst = true; transfer.DestinationServer = DestinationSQLServer; transfer.CreateTargetDatabase = true; Database ddatabase = new Database(server, DestinationDatabase); ddatabase.Create(); transfer.DestinationDatabase = DestinationDatabase; transfer.Options.IncludeIfNotExists = true; transfer.TransferData();

    Read the article

  • An exception to avoid copy and paste code?

    - by Jian Lin
    There are many files in our project that would call a Facebook api. And the call is complicated, spanning usually 8 lines or more, just for the argument values. In this case, we can make it into a function, and place that function in a common_library.php, but doing so would just change the name of the function call from the Facebook API function to our name, and we still need to repeat the 8 lines of arguments. Each time, the call is very similar, but with slight variations to the argument values. In that case, would copy and paste be needed no matter what we do?

    Read the article

  • Delete text from copied text

    - by riddle
    Hello, I would to use JavaScript to clean up text that’s being copied from my site. I use snippets like this: body { vertical-align: middle; ? } Where ? indicates comment later on. I want readers to copy this snippet and use it – so I need to delete that Unicode marker. How can I access text that’s being copied and make changes to it? I considered deleting marker(s) from snippet when user clicks (mousedown) on it, so she could select the text, copy it and then I would restore markers but it seems a really long way to do it.

    Read the article

  • Copy photos from memory card (How do I manually start the wizard?)

    - by Motti
    I want to copy photos from my camera's memory card using Windows photo copy wizard, however I'm not connecting the camera directly (I lost the cable) rather I'm inserting the camera's SD memory card into the memory card's slot. Windows (Vista) recognizes the memory card and I can explore the photos but it doesn't automatically launch the "Device connected, what do you want to do" wizard. How do I manually launch the photo copy wizard?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >