private

Private members when extending a class using ExtJS

不打扰是莪最后的温柔 提交于 2019-12-04 07:47:57
问题 I have done some research on the ExtJS forum regarding private methods and fields inside a extended class , and I couldn't find any real answer to this. And when I say an extended class I mean something like this: Ext.ux.MyExtendedClass = Ext.extend(Ext.util.Observable, { publicVar1: 'Variable visible from outside this class', constructor: function(config) { this.addEvents("fired"); this.listeners = config.listeners; }, // to show that I need to use the base class publicMethod1: function() {

Are private methods really safe?

人盡茶涼 提交于 2019-12-04 07:42:12
问题 In Java the private access modifier consider as safe since it is not visible outside of the class. Then outside world doesn't know about that method either. But I thought Java reflection can use to break this rule. Consider following case: public class ProtectedPrivacy{ private String getInfo(){ return "confidential"; } } Now from another class I am going to get Info: public class BreakPrivacy{ public static void main(String[] args) throws Exception { ProtectedPrivacy protectedPrivacy = new

Configuring composer.json with private Bitbucket Mercurial repository

有些话、适合烂在心里 提交于 2019-12-04 07:34:44
My project uses my own library which is in the private Mercurial repository placed on bitbucket.org. That library has no composer.json configured. I try to make that library as a dependency to my project. Firstly I wrote to composer.json the following strings: { "require": { "php": ">=5.4", "myname/mylibname": "dev" }, "repositories":[ { "type": "hg", "url" : "https://bitbucket.org/myname/mylibname" } ] } And running composer install I've got an error: [RuntimeException] Failed to clone https://bitbucket.org/myname/mylibname , could not read packages from it abort: http authorization required

How do I program android to look for a particular network?

蹲街弑〆低调 提交于 2019-12-04 06:24:14
问题 My application only works if it's on the campus network in order to access campus data. When running the application on public wifi or 3g network, the application will hang then force close. How do I program my application to check for that private network/wifi or check what connection android is currently using, if not equal to "campus wifi" then....? 回答1: From what you are saying i think you want to enforce application to use only Campus wifi. So here you go Create WifiConfiguration

Private inner class synthesizes unexpected anonymous class

一个人想着一个人 提交于 2019-12-04 05:29:31
When you compile a Java class with a private inner class, it appears that an anonymous class is automatically synthesized along with it for some reason. This class is sufficient to reproduce it: public class SynthesizeAnonymous { public static void method() { new InnerClass(); } private static class InnerClass {} } When compiled, this generates the expected SynthesizeAnonymous.class and SynthesizeAnonymous$InnerClass.class files, but it also generates a strange SynthesizeAnonymous$1.class file that corresponds to an anonymous subclass of java.lang.Object that was synthesized. If you look at

Can I transform an object and access the private data members in C++?

前提是你 提交于 2019-12-04 04:25:42
I want to access a private data member in a class. There is no member function in the class to access the private data member. It is private. I want to take the class and some how crack it open. One method was to copy the declaration of the class, make the private member public and call the new class class something_else. Then I do a reinterpret cast and copy the original object. This works. But I want something more elegant ... or perhaps generic ... or just another way. What options are there? Can I use void*? Can I memcpy the class into another empty class? What are ways to do this?? % I am

Java tool for testing private methods?

心不动则不痛 提交于 2019-12-04 04:15:57
There are different opinions on the meaningfulness of testing of private methods, e.g., here and here . I personally think it makes sense, the question is how to do it properly. In C++ you can use a #define hack or make the test class friend , in C# there's the InternalsVisibleToAttribute , but in Java we either have to use reflection or to make them "visible for testing" and annotate them as such in order to make the intent clear. The disadvantages of both should be quite clear. I think there should be something better. Starting with public class Something { private int internalSecret() {

Private operator delete triggers compile-time error with GCC and Clang but not with MSVC

北战南征 提交于 2019-12-04 04:08:27
问题 Motivated by this not very well asked duplicate, I believe the problem deserves a new standalone clearly titled question. The following code triggers a compilation error with GCC 8.1.0 and Clang 6.0.0, but not with MSVC 19.00: class X { public: X() /* noexcept */ { } private: static void operator delete(void*) { } }; int main() { X* x = new X{}; } From expr.new: If any part of the object initialization described above terminates by throwing an exception and a suitable deallocation function

Global and Local and Private Functions (Javascript)

帅比萌擦擦* 提交于 2019-12-04 03:09:55
问题 I am currently reading a book on Javascript by Pragmatic, and I'm confused about one thing. They have a section on how to make variables global, local, or private. What is the difference between local and private variables? Is there one? How does one make a variable global or local, They said something about putting 'var =' before it, but it was very vague. 回答1: None, People use "private" because they are mistaken and are meant to say "local" local variables are defined as var foo = "local";

Angular 6 private methods

百般思念 提交于 2019-12-04 02:43:32
We are upgrading to Angular 6 from 5. We have a shared library that we are getting build errors. Being a Java shop, we got in the habit of marking our component methods and attributes private. In Angular 6 when building our library (after converting and using the new library CLI capability), we get: Property 'getCurrentYear' is private and only accessible within class. In effect any attribute or method used in a template html cannot be marked private anymore on the component class. Of course we can fix this by removing the 'private' modifier. This was not the case in angular 5 when we produced