copy

How to copy one file to many locations simultaneously

拟墨画扇 提交于 2019-12-22 07:27:07
问题 I want to find a way to copy one file to multiple locations simultaneously (with C#). means that i don't want the original file to be read only one time, and to "paste" the file to another locations (on local network). as far as my tests showed me, the File.Copy() will always read the source again. and as far as i understand, even while using memory, that memory piece gets locked. so basically, i want to mimic the "copy-paste" to the form of one "copy", and multiple "paste", without re

Copy Hash Table in Lisp

爱⌒轻易说出口 提交于 2019-12-22 06:58:58
问题 I have recently been working with hash tables in Common Lisp. I have been wondering how to make a separate copy of a hash table containing all the same values as the first. Is there an official way to do this? If not, can you give me an example using maphash? 回答1: As clhs does not list a copy table function I'd assume that maphash is the way to go. (defun copy-table (table) (let ((new-table (make-hash-table :test (hash-table-test table) :size (hash-table-size table)))) (maphash #'(lambda(key

Sample sql script to zip and transfer database backup file

家住魔仙堡 提交于 2019-12-22 06:06:07
问题 I was looking for a sample sql script to zip my database backup file (.bak) and transfer to a remote location. Please share if you have it with you. 回答1: You can use xp_cmdshell to invoke the commands for zipping and copying. In the sample here, I am using winzip command line (for zipping/unzipping) and xcopy for transferring files. EXEC master..xp_cmdshell 'C:\"Program Files"\WinZip\wzzip C:\Database.bak.zip C:\Database.bak'; EXEC master..xp_cmdshell 'C:\"Program Files"\WinZip\wzunzip -o "C:

Copy between two streams in .net 2.0

回眸只為那壹抹淺笑 提交于 2019-12-22 05:53:44
问题 I have been using the following code to Compress data in .Net 4.0: public static byte[] CompressData(byte[] data_toCompress) { using (MemoryStream outFile = new MemoryStream()) { using (MemoryStream inFile = new MemoryStream(data_toCompress)) using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress)) { inFile.CopyTo(Compress); } return outFile.ToArray(); } } However, in .Net 2.0 Stream.CopyTo method is not available. So, I tried making a replacement: public static byte[]

Determine the source application of current pasteboard content

不问归期 提交于 2019-12-22 05:45:12
问题 Several OSX clipboard managers from AppStore show the ability to determine the source-application of content that was copied to the clipboard. I am writing some simple clipboard observer and would like to show the source-application icon near the content, stored in general NSPasteboard. And I would like to know how this can be achieved. As far as I can see, NSPasteboard doesn't provide any additional info except types of data and data itself. Maybe there are some events or notifications to

JAVA - How to copy attributes of an object to another object having the same attributes?

一笑奈何 提交于 2019-12-22 05:39:18
问题 Let's say we have an Object A defined like this: public class ObjectA { private Attribute a1; private Attribute a2; private Attribute a3; } For some reason, I need to create a second object B with only the first two attriutes of the Object A : public class ObjectB { private Attribute a1; private Attribute a2; } So my question is: what is the best approach to copy an Object A to an Object B ? I've been copying the attributes by getters and setters one by one but something tells me there must

Operator overloading by value results in use of moved value

流过昼夜 提交于 2019-12-22 04:42:53
问题 Compiling the following Rust code that uses operator overloading use std::ops::{Add}; #[derive(Show)] struct Point { x: int, y: int } impl Add for Point { type Output = Point; fn add(self, other: Point) -> Point { Point {x: self.x + other.x, y: self.y + other.y} } } fn main() { let p: Point = Point {x: 1, y: 0}; let pp = p + p; } Results in compiler errors due to ownership of p: <anon>:21:18: 21:19 error: use of moved value: `p` <anon>:21 let pp = p + p; ^ <anon>:21:14: 21:15 note: `p` moved

clone flex component

不问归期 提交于 2019-12-22 01:01:00
问题 I am trying to duplicate a flex component at run time. For example if i have this mx:Button label="btn" id="btn" click="handleClick(event)"/> i should be able to call a function called DuplicateComponent() and it should return me a UI component thts exactly same as above button including the event listeners with it. Can some one help me please?? Thanks in advance 回答1: Do a Byte Array Copy. This code segment should do it for you: // ActionScript file import flash.utils.ByteArray; private

How can we copy the data of the datacolumn of the datatable to another datatable?

こ雲淡風輕ζ 提交于 2019-12-21 23:13:13
问题 How can we copy one datacolumn with data from one datatable to another datatable ? I have datatable like DataTable datatable1=new DataTable(); and there are four columns in that table but I want only one column.So I am doing like DataTable datatable2=new DataTable(); addressAndPhones2.Columns.Add(addressAndPhones.Columns[0].ColumnName,addressAndPhones.Columns[0].DataType); but this just adds the column but I want to copy the data for that column to the datatable2.That is I want to copy the

iOS copy multiple images to pasteboard

大兔子大兔子 提交于 2019-12-21 21:43:47
问题 I can copy one image to the pasteboard like so: UIPasteboard *pasteboard; pasteboard = [UIPasteboard generalPasteboard]; UIImage *image; [pasteboard setImage:image]; How can I copy two or three images to the pasteboard? 回答1: [[UIPasteboard generalPasteboard] setImages:[NSArray arrayWithObjects:firstImage, secondImage, nil]]; I think this is all you're looking for. It is also possible to set a single image with multiple types (PNG, JPG, etc.) so that it is more likely that another application