What is the difference between getDir and getFilesDir on Android?

getFilesDir() returns a File object to a directory that is private to your application only. When you use openFileOutput(String, int), the data you write is directly stored in this directory and is not accessible by any other application. It holds your application files. getDir() enables you to create any file or directory in the internal … Read more

Is there a way to make Rails ActiveRecord attributes private?

Jordini was most of the way there Most of active_record happens in method_missing. If you define the method up front, it won’t hit method_missing for that method, and use yours instead (effectively overwriting, but not really) class YourModel < ActiveRecord::Base private def my_private_attribute self[:my_private_attribute] end def my_private_attribute=(val) write_attribute :my_private_attribute, val end end

Eslint does not recognize private field declaration using nodejs 12

2021 Update: You do not need babel for this anymore! You can simply update eslint to v8.0.0 and above. See eslint release notes: https://eslint.org/blog/2021/10/eslint-v8.0.0-released#highlights Make sure this is in your .eslintrc file or similar: { “parserOptions”: { “ecmaVersion”: 13 } } You can also just use latest instead of specifically version 13.

access private members in inheritance

Quick answer: You don’t. Thats what the protected key-word is for, which you want to use if you want to grant access to subclasses but no-one else. private means that no-one has access to those variables, not even subclasses. If you cannot change code in A at all, maybe there is a public/protected access method … Read more

C++ compilers diverge in encapsulation behavior – which one gets it right?

The questions of A::f<int>() and A::B<0> are straightforward to answer. f and B are private, and neither has any other interesting dependencies. Accessing them should be ill-formed. gcc generally is very permissive about access control in templates, there is a metabug outstanding for all sorts of situations (I think all of them are of the … Read more

Quick Java question about private static final keywords for fields

I use Checkstyle with Eclipse, which results in a warning if the declaration is in a different order to the one you’ve specified, citing the Java Language Specification (JLS). For example, private final static String filename = “filename.txt”; results in ‘static’ modifier out of order with the JLS suggestions. They have this page which lists … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)