copy

Java: Copy array of non-primitive type

☆樱花仙子☆ 提交于 2019-12-04 03:45:40
What is the prefered way to copy an array of a non-primitve type in Java? How about performance issues? The old school way was: public static void java.lang.System.arraycopy(Object src, int srcPos, Object dest, int destPos, int length) This copys from one existing array to another. You have to allocate the new array yourself ... assuming that you are making a copy of an array. From JDK 6 onwards, the java.util.Arrays class has a number of copyOf methods for making copies of arrays, with a new size. The ones that are relevant are: public static <T> T[] copyOf(T[] original, int newLength) and

svn copy failing when trying to create branches

那年仲夏 提交于 2019-12-04 03:43:00
I created a repository in my local machine: svnadmin create /home/me/Desktop/svn_test/trunk Then import myDir directory to the repository. svn import myDir/ file://home/me/Desktop/svn_test/trunk So far svn checkout, commit, update works fine. Now, I want to create branch from the repository, so I followed the tutorial and executed: ( svn copy source destination ) svn copy file:///home/me/Desktop/svn_test/trunk file:///home/me/Desktop/svn_test/branches Then I got: svn: Unable to open an ra_local session to URL svn: Unable to open repository 'file:///home/me/Desktop/svn_test' What am I doing

How to make a .pkg that the Mac Installer will simply install (copy) files from?

杀马特。学长 韩版系。学妹 提交于 2019-12-04 03:41:15
My goal is to create a .pkg that will simply instruct the Mac Installer to simply install files, like fonts, from the .pkg to a directory when run. I've tried using Xcode, but it seems more application oriented. How do I configure Xcode with a generic document so I can Build and Archive, then Share using the Organizer to create the .pkg? The Copy Files Target appears to be in use only at build time, so that doesn't seem to be much help. You should use the PackageMaker application, not Xcode. You can find it under /Developer/Applications/Utilities. 来源: https://stackoverflow.com/questions

Copy java object/class from one classloader to another classloader

你离开我真会死。 提交于 2019-12-04 03:37:36
Hi is there a way to copy one class loaded context (atrributes etc) from one classloader (for instance a 'made' class Point) to another classloader? Making clear, Example: I have an object Point on CL 1. Now running on another CL2, I want to creat this object in CL 3. Some obj: class Point { int x; int y; public Point() {} //getters and setters Scenery: ... class CL2 { // Running on CL 2 ... // Point obj from CL 1 Object point = gotFromCL1(); // Want to create the object on Cl2 Object pointCL2 = point.conversion(); But I can't use sun.reflection (not available) and serialization doesn't work

Why doesn't this rule prevent duplicate key violations?

自古美人都是妖i 提交于 2019-12-04 03:36:51
(postgresql) I was trying to COPY csv data into a table but I was getting duplicate key violation errors, and there's no way to tell COPY to ignore those, so following internet wisdom I tried adding this rule: CREATE OR REPLACE RULE ignore_duplicate_inserts AS ON INSERT TO mytable WHERE (EXISTS ( SELECT mytable.id FROM mytable WHERE mytable.id = new.id)) DO NOTHING; to circumvent the problem, but I still get those errors - any ideas why ? Rules by default add things to the current action : Roughly speaking, a rule causes additional commands to be executed when a given command on a given table

Cloning an array with its content

做~自己de王妃 提交于 2019-12-04 03:24:04
I want to make a copy of an array, to modify the copy in-place, without affecting the original one. This code fails a = [ '462664', '669722', '297288', '796928', '584497', '357431' ] b = a.clone b.object_id == a.object_id # => false a[1][2] = 'X' a[1] #66X722 b[1] #66X722 The copy should be different than the object. Why does it act like if it were just a reference? You need to do a deep copy of your array. Here is the way to do it Marshal.load(Marshal.dump(a)) This is because you are cloning the array but not the elements inside. So the array object is different but the elements it contains

Docker Copying file from host to container

泄露秘密 提交于 2019-12-04 03:11:06
问题 I am trying to copy a set of files from docker host to container. On a AUFS system directly going into /var/lib/docker/aufs/... works. However I am another system with Fedora that has devicemapper as the storage driver. On this system if I do this: [root@myhost tmp]# docker inspect -f '{{.Id}}' 393ef4b9f485 393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24 [root@myhost tmp]# cd /var/lib/docker/devicemapper/mnt/393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24

Copy and overwrite a file in shell script

断了今生、忘了曾经 提交于 2019-12-04 03:00:06
I want to copy a certain file to a location, irrespective of that file already exists in the destination or not. I'm trying to copy through shell script.But the file is not getting copied. I'm using the following command /bin/cp -rf /source/file /destination but that doesn't work. This question has been already discussed, however you can write a little script like this: #!/bin/bash if [ ! -d "$2" ]; then mkdir -p "$2" fi cp -R "$1" "$2" Your problem might be caused by an alias for cp command created in your system by default (you can see al your aliases by typing "alias"). For example, my

Programmatically trigger copy menu in iOS safari using javascript?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 02:56:59
I'm trying to implement a user-friendly way to copy some text from a text input field to the clipboard on iOS/Safari. I understand there is no way to programmatically do it on this platform, but I was hoping I could guide the user experience as much as possible. On iOS/Safari, when a user manually highlights some text, a contextual Copy menu pops up. I was hoping the same menu would pop up when the text is selected programmatically, but it doesn't. Is it even possible to do that? If not, any advice on how to best implement a user-friendly experience to copy some text to the clipboard on iOS

Copy multiple directories with one command

吃可爱长大的小学妹 提交于 2019-12-04 02:44:41
问题 Is there any way to copy multiple directories in one command, to reduce the number of layers? E.g., instead of: COPY dirone ./dirone COPY dirtwo ./dirtwo COPY dirthree ./dirthree I want to do: COPY dirone/ dirtwo/ dirthree/ ./ However, this copies the contents of the directories... but I want to copy the directories themselves . 回答1: That's the documented behavior of the copy command: If <src> is a directory, the entire contents of the directory are copied, including filesystem metadata. Note