I'm have been working on a project to create PDF forms using PDFView4Net. While the library is generally good, the forms creator is primitive and lacking basic features (such as copy/paste, alignment, formatting, etc.) when working with form fields (i.e. text boxes, check boxes, etc.).   The problem: I have been extending the functionality for field objects and getting tripped up on copy/paste. To do this, I need a deep copy of the object with no references to the original whatsoever. I emailed the vendor, requesting information about their recommended method for copying these objects, to which they replied I needed make a copy of each property by hand, manually ... beats head on desk. These are large classes, with multiple embedded classes as properties, as well as UI elements.  The question: Are there any good methods out there that perform a deep copy for complex objects that don't require serialization, doesn't require access to or changes to the source classes and doesn't require a default constructor?  What I have tried/reviewed: I have researched various ways to make a deep copy of an object and discarded them one by one:   Manually, Property by Painstaking Property: I attempted this with the first of 7 field objects (PDFTextBoxField), but it quickly got out of hand with the multitude properties that are also different types of classes. In the end, I still had lingering references to the original object where it a shallow copy was created instead of a deep copy as intended. Serialization: The classes are not marked as Serializable, nor will the vendor change this. I asked them to and they said no. ICloneable: Would need to be implemented by the vendor. AutoMapper: This seems to be for copying data from one or more object types into another object type. The objects I'm working with are the same type. Though I'm not opposed to using this if it is the best solution. Emit Mapper: This project appears to have been abandoned. MemberwiseClone: Does a shallow copy, not the deep copy I'm looking for, though this is suggested on a ton of other posts when the questioner specifically requests a deep copy. Value Injecter: I implemented FastDeepCloneInjection from  on CodePlex but the majority of the classes that need to be injected from do not have a 0 parameter constructor which is required when creating a new instance for the copy. ValueInjecter doesn't allow skipping of certain properties, or I would just skip the items with no default constructor and leave them set to null (the default). I ran into this right away with the very first class. To attempt to get around the issue, I created a wrapper class inherited from the original and cast the original into the wrapper (and vice versa on return), but I don't think that's a good solution.   Edit: I really do not feel this question is a duplicate. I've searched extensively for a solution, including the post marked as the duplicate/original, and was unable to find a satisfactory resolution. As stated, I don't have access to change the classes that I need to copy. This discounts DataContractSerializer, BinaryFormatter, and any other type of serialization. This also discounts the reflection examples I've seen using Activator.CreateInstance, as about 95% of the classes I need to copy don't have a constructor that takes 0 arguments. This is the same issue I ran into using ValueInjecter. This also discounts using ICloneable.
I want to do something like:  MyObject myObj = GetMyObj(); // Create and fill a new object MyObject newObj = myObj.Clone();   And then make changes to the new object that are not reflected in the original object.  I don't often need this functionality, so when it's been necessary, I've resorted to creating a new object and then copying each property individually, but it always leaves me with the feeling that there is a better or more elegant way of handling the situation.  How can I clone or deep copy an object so that the cloned object can be modified without any changes being reflected in the original object?
What is the most efficient way to concatenate strings in SQL Server? I have this code:  DECLARE @MyTable AS TABLE (    [Month] INT,    Salary INT );  INSERT INTO @MyTable VALUES (1,2000), (1,3100);  SELECT [Month], Salary FROM @MyTable;   Output:    I want to concat the Salary (grouping by month) so that it will be NVARCHAR like this: '2000,3100'  How would I do this efficiently? read only access to all files in a specific sub-folder I have got a specific folder located in "/home/.../reboot/".  I have a series of users that require read-only access to the ever changing files within.  My problem is that the same users are not authorized to view any of the parent directory files.  Right now, the only thing I have in place is that their starting folder is at "/home/.../reboot/" by changing the etc/passwd file; and I need to block all access to other folders.  How could I only give them access to this directory? Let $f$ be an entire function and $L$ a line in $\mathbb{C}$ such that $f(\mathbb{C})\cap L=\emptyset$. Show that $f$ is constant function.  If $f$ is not constant  then $f(\mathbb{C})$ is dense set in $\mathbb{C}$, but how can I use that line does not intersect the image set? Importing users that will be installed by programs Example of a domain where all irreducibles are primes and that is not a GCD domain One has the following relations for a domain $R$:  $R$ GCD domain $\Rightarrow$ All irreducible elements are prime  $R$ PID $\Rightarrow$ $(R$ GCD domain $\land$ $R$ statisfies ACCP$)$  $R$ UFD $\Leftrightarrow$ $(R$ GCD domain $\land$ $R$ satisfies ACCP$)$  $R$ satisfies ACCP $\Rightarrow$ $(R$ UFD $\Leftrightarrow$ All irreducible elements are prime$)$  $R$ GCD domain $\Rightarrow$ $(R$ UFD $\Leftrightarrow$ $R$ atomic domain$)$  So what is the difference between a GCD domain and a domain where all irreducible elements are prime? What is the "weakest" predicate $P$ such that  $R$ GCD domain $\Leftrightarrow$ $($All irreducible elements are prime $\land$ $P(R))$ ? Is the solution to a question regarding four smaller masses on a rotating hollow sphere accurate? I was doing the question :     A uniform 8.40-kg spherical shell, 50.0 cm in diameter has four small   2.00-kg masses attached to its outer surface and equally spaced around it. This combination is spinning about an axis running through the   center of the sphere and two of the small masses (see ). What friction torque is needed to reduce its angular speed   from 75.0 rpm to 50.0 rpm in 30.0 s?   I understand how to get $\alpha$, and how to get $\tau$ from $I$ and $\alpha$. What I do not understand is their computation of the moment of inertia. The question did not provide any information regarding the shapes of the masses, but the solution (which writes $I=\frac{2}{3}MR^2+2mR^2$) seems to assume that the masses are point particles. Thus, the two masses along the rotational axis have a moment of inertia of 0 ($r=0$), and each of the other two masses has a moment of inertia of $I=mr^2 =mR^2$, where $R$ is the radius of the sphere and $r$ is the distance from the axis.  But why are the masses considered to be point particles? I wanted to use the parallel-axis theorem to determine the moment of inertia about the rotational axis; not knowing the shape of the masses made this impossible, since I couldn’t find the moment of inertia about the CM. If I knew $I_{CM}$, then couldn’t I use $I_{axis}=I_{CM}+mR^2$ for the two masses not on the rotational axis and $I_{CM}$ for the two that are? That would make $I_{total}=\frac{2}{3}MR^2+4I_{CM,\:mass}+2mR^2$ Would that not be a better way of solving this problem? How to adjust font features in LuaTeX? As of version 2.7 of luaotfload the support for font feature files (.fea) .  On the  Hans showed how to make font substitution work through Lua.  More examples are available in the latest ConTeXt distribution (, , , , , , )  In the past I have been using font feature files to adjust the kerning of fonts on-the-fly.  From Hans' example it is not clear to me how to adjust kerning in the new syntax.  The below example does not work as intended.  \documentclass{article} \usepackage{fontspec} \directlua{ fonts.handlers.otf.addfeature {     name = "kern",     {         type = "pair",         data = {             [0x0041] = { [0x0056] = { false, { -200, 0, 0, 0 } } },         }     } } } \setmainfont{Latin Modern Roman} \begin{document} AV \end{document}   Can we have a comprehensive guide on how to adjust font features with LuaTeX with the fonts.handlers technique?    Related questions:  (These involve hooking into the luaotfload.patch_font callback) prove $\sqrt{a_n b_n}$ and $\frac{1}{2}(a_n+b_n)$ have same limit I am foreign graduate student in USA. I recently completed my undergrad (from USA) and have a bit of money saved up. I know that F1 students cannot work off campus and other business activities such stock trading etc are prohibited as well. I wanted to know if opening an account in an investment management firm like Charles Schwabb or Betterment is allowed. I would not be working but I will still be earning a small interest on my deposits. If that is not allowed, are there any good and legal ways for foreign students to earn a little interest on savings? Restore console session after remote desktop disconnects? I tried to fix my hard drive using Ubuntu but I encountered an error message and didn't know how to proceed. I need to fix my bad sectors   fsck /dev/sdb   fsck from util-linux 2.20.1   e2fsck 1.42.5 (29-Jul-2012)   fsck.ext2: Permission denied while trying to open /dev/sdb   You must have r/w access to the filesystem or be root What methods can I use to create balance and consistency between a group of differing logos? A regular challenge that I face is balancing two (or more) logos. Whether they need to be equal or one needs to be given priority. Some logos however might be squares, others rectangles, circles, etc...   As a quick sample I snagged a nice high resolution photo from  and pretend its going to be an advertisement that needs to show some footwear brand logos on it. In this case I used Adidas and Saucony.  This is certainly not balanced even though they're height is the same:    Likewise this is not balanced even though they're width is the same:    So then the question becomes when are they in balance, is this balance:    Maybe a little more adjustment, is this balance:    And in these examples I'm only working with two Black Logos. Factor in color and it can get even more difficult to balance. Another issue being when there's tiny text as part of the logo.  So the question is, other than estimating / eye-balling it, what tips, methods or even tools are there to balance different sized logos? What happens after I grapple as Attack of Opportunity? Chrome does not install on windows xp sp3 What could be the reason covid19 death data shows strong periodic trends? The covid19 death data for US shows strong periodic trends. It does not make sense to me that people die periodically.   What could be the reason to having such data? I thought it might be the reporting artifacts, for example, people always update data at Monday, but the period seems to be 3-4 days. What are the differences between the original Kaito Kid specials vs. the new Kaito Kid 1412 series? I am currently watching . Should I watch the other  anime films?  What's the difference between this version and the 1412 version?  And another question, what's the meaning of 1412? I have used the websites of SO a lot the past few months because I am busy with a large scale web project. I feel I get better answers here on SO than when I just do a Google search, maybe because I can be more specific here with my problem, and the responses are really fast.  Occasionally when I am not working I try to answer some questions, but the question almost always has an answer which is 'as good as' or 'better' than the answer I would supply.  So my question/answer ratio is about 20/1 something, if not more. When I look at my profile page I see a bucket-load of questions and almost nothing I answered myself.  Is this considered bad behaviour? I can see that this looks a little egoistic.  : One devoted to one's own interests and advancement. Suppose the default shell for my account is zsh but I opened the terminal and fired up bash and executed a script named prac002.sh, which shell interpreter would be used to execute the script, zsh or bash? Consider the following example:  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % sudo cat /etc/passwd | grep papagolf [sudo] password for papagolf:  papagolf:x:1000:1001:Rex,,,:/home/papagolf:/usr/bin/zsh # papagolf's default shell is zsh  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % bash # I fired up bash. (See that '%' prompt in zsh changes to '$' prompt, indicating bash.)  papagolf@Sierra:~/My Files/My Programs/Learning/Shell$ ./prac002.sh  Enter username : Rex Rex # Which interpreter did it just use?   **EDIT : ** Here's the content of the script  papagolf@Sierra ~/My Files/My Programs/Learning/Shell % cat ./prac002.sh  read -p "Enter username : " uname echo $uname In Bishop's book "Pattern Classification and Machine Learning", it describes a technique for regularization in the context of neural networks. However, I don't understand a paragraph describing that during the training process, the number of degrees of freedom increases along with the model complexity. The relevant quote is the following:     An alternative to regularization as a way of controlling the effective   complexity of a network is the procedure of early stopping. The   training of nonlinear network models corresponds to an iterative   reduction of the error function defined with respect to a set of   training data. For many of the optimization algorithms used for   network training, such as conjugate gradients, the error is a   nonincreasing function of the iteration index. However, the error   measured with respect to independent data, generally called a   validation set, often shows a decrease at first, followed by an increase as the network starts to over-fit. Training can therefore be   stopped at the point of smallest error with respect to the validation   data set, as indicated in Figure 5.12, in order to obtain a network   having good generalization performance. The behaviour of the network   in this case is sometimes explained qualitatively in terms of the   effective number of degrees of freedom in the network, in which this   number starts out small and then to grows during the training process,   corresponding to a steady increase in the effective complexity of the   model.   It also says that the number of parameters grows during the course of training. I was assuming that by "parameters", it refers to the number of weights controlled by the network's hidden units. Maybe I'm wrong because the weights are prevented to increase in magnitude by the regularization process but they don't change in number. Could it be referring to the process of finding a good number of hidden units?  What's a degree of freedom in a neural network? What parameters increase during  training? Don't heavier objects actually fall faster because they exert their own gravity? The common understanding is that, setting air resistance aside, all objects dropped to Earth fall at the same rate. This is often demonstrated through the thought experiment of cutting a large object in half. The halves clearly can't then fall more slowly just by being sliced in two.  However, I believe the answer is that when two objects fall together, attached or not, they do "fall" faster than an object of less mass alone does. This is because not only does the Earth accelerate the objects toward itself but the objects also accelerate the Earth toward themselves. Considering the formula: $$ F_{\text{g}} = \frac{G m_1 m_2}{d^2} $$  Given $F = ma$ thus $a = F/m$, we note that the mass of the small object doesn't seem to matter as when calculating acceleration the force is divided by the $m$ term, its mass. However, this overlooks that the force is actually applied to both objects, not just to the smaller one. The acceleration on the second, larger object is found by dividing $F$, in turn, by the larger object's mass. The two objects' acceleration vectors are exactly opposite, so closing acceleration is the sum of the two:  $$ a_{\text{closing}} = \frac{F}{m_1} + \frac{F}{m_2} $$  Since the Earth is extremely massive compared to everyday objects, the acceleration imparted on the object by the Earth will radically dominate the equation. As the Earth is $\sim 5.972 \times {10}^{24} \, \mathrm{kg} ,$ a falling object of $5.972 \, \mathrm{kg}$ (just over 13 pounds) would accelerate the Earth about $\frac{1}{{10}^{24}}$ as much, which is one part in a trillion trillion.  Of course in everyday situations, we can for all practical purposes treat objects as falling at the same rate because of this negligible difference—which our instruments probably couldn't even detect. But I'm hoping not for a discussion of practicality or what's measurable or observable, but what we think is actually happening.  Am I right or wrong?  What really clinched this for me was considering dropping a small Moon-massed object close to the Earth and a small Earth-massed object close to the Moon. This made me realize that falling isn't one object moving toward some fixed frame of reference, but that the Earth is just another object, and thus "falling" consists of multiple objects mutually attracting in space.