private

cloning error when checking out private github repo

拜拜、爱过 提交于 2019-11-28 12:35:00
问题 I get the following error while cloning a private repo on my colleagues computer: Cloning into xxx... remote: Counting objects: 7112, done. remote: Compressing objects: 100% (4870/4870), done. remote: Total 7112 (delta 2281), reused 6503 (delta 1672) Receiving objects: 100% (7112/7112), 10.88 MiB | 975 KiB/s, done. Resolving deltas: 100% (2281/2281), done. error: refs/remotes/origin/master does not point to a valid object! error: Trying to write ref refs/heads/master with nonexistant object

AutoMapper mapping properties with private setters

て烟熏妆下的殇ゞ 提交于 2019-11-28 11:55:59
Is it possible to assign properties with private setters using AutoMapper? If you set the value for this properties in the constructor like this public class RestrictedName { public RestrictedName(string name) { Name = name; } public string Name { get; private set; } } public class OpenName { public string Name { get; set; } } then you can use ConstructUsing like this Mapper.CreateMap<OpenName, RestrictedName>() .ConstructUsing(s => new RestrictedName(s.Name)); which works with this code var openName = new OpenName {Name = "a"}; var restrictedName = Mapper.Map<OpenName, RestrictedName>

If a private virtual function is overridden as a public function in the derived class, what are the problems?

五迷三道 提交于 2019-11-28 11:39:59
using namespace std; #include <cstdio> #include <iostream> class One{ private: virtual void func(){ cout<<"bark!"<<endl; } }; class Two: public One{ public: void func(){ cout<<"two!"<<endl; } }; int main(){ One *o = new Two(); o->func(); } Why is there an error on o->func() ? I don't know the mechanism behind it... In my opinion, o->func() should call the func() in the derived class, which is public, so there wouldn't be problems, but it says: error: ‘virtual void One::func()’ is private Accessibility check is performed based on the static type of the object. The type of o is One* . This means

'this' object can't be accessed in private JavaScript functions without a hack?

百般思念 提交于 2019-11-28 10:14:42
I was working on a project for a while, trying to figure out what I was doing wrong, when I finally narrowed "the bug" down to the fact that the below code doesn't work as I expected: function Alpha() { this.onion = 'onion'; function Beta() { alert(this.onion); } Beta(); } alpha1 = new Alpha(); // Alerts 'undefined' However, if I change the code to this: function Alpha() { var self = this; this.onion = 'onion'; function Beta() { alert(self.onion); } Beta(); } alpha1 = new Alpha(); // Alerts 'onion' it works like I would expect. After wasting a large portion of my life, can anyone explain why

Block a git branch from being pushed

断了今生、忘了曾经 提交于 2019-11-28 09:37:24
Here's the situation: I have a public repository for my open-source app on github.com. However, now I'd like to write some specific code that will not be public (I might use it in a commercial version of my application). I figured I could use the same repository, and I'd create a "private" branch in my git repository that I wouldn't push. But, mistakes happen. Is there some way to forbid git from ever pushing a branch to remote servers? If there's a better way to handle this situation, I would of course welcome any suggestions. A slightly hackish solution: Make a dummy branch on GitHub with

Is unit testing private methods a good practice?

风格不统一 提交于 2019-11-28 09:11:21
I am wondering if unit testing private methods is a good practice? Normally only public interface should be tested. However, I have found out that during complex calculation, which calls tons of different private methods, it is easier to unit test the private methods first, and then make a simple test for the public interface method. As an example let's say you have an audio player and you have functions: void play(){ ... } void pause(){ ... } void seek(time t) { //All Private methods checkIfValidTimeRange(...); moveToFilePos(...); fillBuffers(...); } Normally I would write unit tests for :

Reasons to avoid access modifiers in php [closed]

六眼飞鱼酱① 提交于 2019-11-28 08:49:43
What are valid reasons NOT to use keywords public, private, protected in php? The story: I've started a project with a team that actively uses access modifiers in their code (even "public" explicitly) and wants to convince me to do the same. I always find this kind of stuff totally useless in a dynamic language like php, but I realize that my gut feeling is hardly an argument in a technical discussion. Therefore I'm looking for a solid, clear explanation why access modifiers are useless (or even harmful) in php. I'm aware that some similar topics already exist Importance of protected/private

Check if an IP address is private

独自空忆成欢 提交于 2019-11-28 08:22:05
I like to check if an IP address is in a private network. It doesn't work. My code: <?php $ip = $_SERVER['REMOTE_ADDR']; function _isPrivate($ip) { $i = explode('.', $ip); if ($i[0] == 10) { return true; } else if ($i[0] == 172 && $i[1] > 15 && $i[1] < 32) { return true; } else if ($i[0] == 192 && $i[1] == 168) { return true; } return false; } ?> The other one: <?php $ip = $_SERVER['REMOTE_ADDR']; function _isPrivate($ip) { $ip = ip2long($ip); $net_a = ip2long('10.255.255.255') >> 24; $net_b = ip2long('172.31.255.255') >> 20; $net_c = ip2long('192.168.255.255') >> 16; return $ip >> 24 === $net

OpenSSL won't create private keys?

蓝咒 提交于 2019-11-28 07:58:10
问题 Okay, well, this is my first time working with encryption on a project. I am using my hosting provider for SSL, but I also want to encrypt portions of the database that are sensitive. For this, I was told to use OpenSSL. I am testing it on my localhost (WAMP), and have installed OpenSSL and turned on the PHP and Apache SSL mods. Okay, so i've been following tutorials and, using several suggested methods, have been able to generate the public key and store it as a file. For some reason, I can

JavaDoc: private fields and methods

百般思念 提交于 2019-11-28 07:54:11
问题 What JavaDoc tags should I use in private fields and methods in order to generate javaDoc descriptions? 回答1: See Java Javadoc include Private; you still use the standard JavaDoc comment form but you must instruct the JavaDoc tool to generate the documentation for private members using the -private switch. 来源: https://stackoverflow.com/questions/5655737/javadoc-private-fields-and-methods