git clone fails with “index-pack” failed?

The way I solved this problem is this: My git daemon is running on windows, and clients are on other computers. I found a workaround (but it will only work on windows). Start git daemon with verbose from cmd.exe: “C:\Program Files\Git\bin\sh.exe” –login -i -c ‘git.exe daemon –verbose ‘ Not tested, if it works directly in … Read more

How to clone object in Kotlin?

For a data class, you can use the compiler-generated copy() method. Note that it will perform a shallow copy. To create a copy of a collection, use the toList() or toSet() methods, depending on the collection type you need. These methods always create a new copy of a collection; they also perform a shallow copy. … Read more

Serializable classes and dynamic proxies in EF – how?

If you want to serialize entities you can disable proxy creation before retrieving that object. You also need to eager load navigational properties if you want to serialize them as well. To disable proxy creation in EF 4.1 dbContext.Configuration.ProxyCreationEnabled = false; In EF 4 objectContext.ContextOptions.ProxyCreationEnabled = false; eg: var users = context.Users.Include(“Claims”).Where(/**/);

Set / Copy javascript computed style from one element to another

Update: As @icl7126 suggested, here is a shorter version for practically the same usage. good thing to remember that this code would not run on most/older browser if not pre-compiled. Original (ES 2017): function copyNodeStyle(sourceNode, targetNode) { const computedStyle = window.getComputedStyle(sourceNode); Array.from(computedStyle).forEach(key => targetNode.style.setProperty(key, computedStyle.getPropertyValue(key), computedStyle.getPropertyPriority(key))) } Precompiled (ES 5): function copyNodeStyle(sourceNode, targetNode) { var … Read more

Clone method for Java arrays

When the clone method is invoked upon an array, it returns a reference to a new array which contains (or references) the same elements as the source array. So in your example, int[] a is a separate object instance created on the heap and int[] b is a separate object instance created on the heap. … Read more

How to clone as derived object in C++

The virtual clone pattern is often used to solve problems such as these. Classic solutions tend to use co-variant return types for the clone() method. Other solution inject a factory type class (using CRTP) between the base and the derived classes. There are even solutions that just implement this functionality with macros. See the C++ … Read more