copy

Optimal way to return local value in C++11

流过昼夜 提交于 2019-12-22 15:25:14
问题 In the old days, if I wanted a string representation of an object A , I would write something with the signature void to_string(const A& a, string& out) to avoid extra copies. Is this still the best practice in C++11, with move semantics and all? I have read several comments on other contexts that suggest relying on RVO and instead writing string to_string(const A& a) . But RVO is not guaranteed to happen! So, how can I, as the programmer of to_string, guarantee the string is not copied

Copy to clipboard not working on FireFox

不想你离开。 提交于 2019-12-22 14:03:13
问题 I had implemented copy to clipboard functionality. It is working fine with all version on IE but not working in FireFox. Please help me solve out this problem. Detail are <script src="../../Scripts/JQPlugins/jquery.clipboard.js" type="text/javascript"></script> <script src="../../Scripts/JQPlugins/jquery.clipboard.pack.js" type="text/javascript"></script> <script type="text/javascript"> $.clipboardReady(function() { $("input#buttonid").bind('click', function() { var text = $("#url").attr(

copy Excel sheet to Word

青春壹個敷衍的年華 提交于 2019-12-22 11:20:56
问题 I need to export the sheet 'GreatIdea' to a Word document. 'GreatIdea' is divided into pages and my columns are based on these pages. A - C contain a table of contents, D - F contain chapter 1, ... Sub test() ' Open LOL.docx' Dim appWD As Word.Application Set appWD = New Word.Application Dim docWD As Word.Document Set docWD = appWD.Documents.Open("C:\Users\TOM\Desktop\LOL.docx") docWD.Activate Sheets("Sheet1").Select ' Copy from GreatIdea to LOL.docx' Range("A1:K40").Copy appWD.Selection

How to copy plots in R when working in Ubuntu?

半世苍凉 提交于 2019-12-22 11:01:15
问题 I am working on the most recent of R on Ubuntu. After I created some plots, the cursor became a '+' and won't let me access the copy and paste options. Moreover unlike the R in Windows, it does not have a toolbar that have the 'Copy' option. What can I do to copy my plots? Thank you. 回答1: The default graphics device when using R under Linux is something called "X11": basically, it creates the window in which you see your plot. It's a very basic window without many features so the answer is:

How to modify a value in one “cell” of a pandas data frame?

吃可爱长大的小学妹 提交于 2019-12-22 09:47:20
问题 I have a very simple problem. I would like to change a value in a given column of a given row of a pandas data frame. I try to do it in the following way: df['column3'].loc[this_date] = val As a result I get the following warning: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame My interpretation of this warning is that by using columns name ( 'column3' ) and loc I do not really access (refer to) the desired cell of the data frame. Instead, I create an

How can we copy the column data of one DataTable to another, even if there are different column names between DataTables?

两盒软妹~` 提交于 2019-12-22 09:41:28
问题 I have two DataTables. First is DataTable NameAddressPhones = new DataTable(); with Three columns Name, Address and PhoneNo .But I only want two columns Name and Address data so I want to copy those columns (with data) to the new DataTable. DataTable NameAddress = new DataTable(); For that I do foreach (DataRow sourcerow in NameAddressPhones.Rows) { DataRow destRow = NameAddress.NewRow(); foreach (string colname in columns) { destRow[colname] = sourcerow[colname]; } NameAddress.Rows.Add

Copy an array backwards? Array.Copy?

社会主义新天地 提交于 2019-12-22 08:27:53
问题 I have a List<T> that I want to be able to copy to an array backwards, meaning start from List.Count and copy maybe 5 items starting at the end of the list and working its way backwards. I could do this with a simple reverse for loop; however there is probably a faster/more efficient way of doing this so I thought I should ask. Can I use Array.Copy somehow? Originally I was using a Queue as that pops it off in the correct order I need, but I now need to pop off multiple items at once into an

Copy a file using a makefile at runtime

浪子不回头ぞ 提交于 2019-12-22 08:07:33
问题 I used to compile my programs with batch scripts on windows but I recently discovered makefiles which are much more efficient. I had this line in my .bat file that copied some dlls to the current directory at runtime and it worked perfectly. copy C:\lib\glfw\glfw.dll I tried the same line in my makefile and even tried the alternative cp but my terminal prints this error even tho the file is IN the location I specified process_begin: CreateProcess(NULL, copy C:\lib\glfw\glfw.dll, ...) failed

How do I copy files using Windows Batch?

泄露秘密 提交于 2019-12-22 08:05:48
问题 I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location? Edit: I do not want to copy the directories, just the files... As this is still on XP, I chose the below solution: for /D %S IN ("src\*.*") DO @COPY "%S\" "dest\" Thanks! 回答1: Ok. With your edit that says you don't want the directory structure, i think you're going to want to use something like this: for /F "usebackq" %s IN (`DIR /B /S /A-D SrcDir`) DO @( XCOPY %s

Method to copy down rows R

老子叫甜甜 提交于 2019-12-22 07:28:11
问题 Suppose we have a dataframe or matrix with one column specifying an integer value N as below (col 5). Is there a vector approach to repopulate the object such that each row gets copied N times? > y [,1] [,2] [,3] [,4] [,5] [1,] -0.02738267 0.5170621 -0.01644855 0.48830663 1 [2,] -0.30076544 1.8136359 0.02319640 -1.59649330 2 [3,] 1.73447245 0.4043638 -0.29112385 -0.25102988 3 [4,] 0.01025271 -0.4908636 0.80857300 0.08137033 4 The result would be as follows. [1,] -0.02738267 0.5170621 -0