Is there a general convention about exposing members in Python classes? I know that this is a case of "it depends", but maybe there is a rule of thumb.
Private member:
class Node:
def __init__(self):
self.__children = []
def add_children(self, *args):
self.__children += args
node = Node()
node.add_children("one", "two")
...
I want to access private methods and variables from outside the classes in very rare specific cases.
I've seen that this is not be possible although introspection is used.
The specific case is the next one:
I would like to have something like this:
class Console
{
final public static function run() {
while (TRUE != FAL...
I am using a bit of JavaScript to show/hide sections of a site when a tab is clicked. I'm trying to figure out if there is a way I can link back to the page and have a certain tab open based on that link.
Here is the JS:
var ids=new Array('section1','section2','section3','section4');
function switchid(id, el){
hideallids();
...
In my MVVM based WPF application I have a lot of different ViewModel types that dynamically loaded into ContentControls or ContentPresenters. Therefor I need to explictly set what DataTemplate is to be used in XAML:
<ContentControl Content={Binding SomePropertyOfTypeViewModel} ContentTemplate={StaticResource someTemplate} />
Now my pro...
If variables in Java are accessed from multiple threads, one must ensure that they are safely published. This usually means using synchronizedor volatile.
I have got the impression, that some of my colleagues do not take this issue seriously, since they "never heard of volatile before and their programs have worked for years".
So my qu...
Suppose I have the following Java file in a library:
package test;
public abstract class AbstractFoo {
protected static class FooHelper {
public FooHelper() {}
}
}
I would like to extend it from Scala:
package test2
import test.AbstractFoo
class Foo extends AbstractFoo {
new AbstractFoo.FooHelper()
}
I get an error, "...
Just like title.
How to prevent it?
...
Hello,
We're building our project (with Xcode 3.2.2 on Mac OS X 10.6.3, GCC 4.0.1) using the -fvisibility=hidden flag.
We mark the classes we want to be visible with __attribute__((visibility("default"))).
For further optimization, should we be marking with __attribute__((visibility("hidden"))) the methods inside these classes that shou...
Hello, everyone!
I know that I can specify the option SUPPORT_CLASS_VISIBILITY_PUBLIC = false; inside a .jj file. But this makes only the generated class itself package-private.
The "boilerplate" classes (such as ParseException) are still public. This is very annoying, since I use java.text.ParseException for public exposure of the API...
I'm getting these two warnings (with GCC 4.2 on MacOSX):
/Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154: warning: 'startMainLockDetector()::MainLockDetector' declared with greater visibility than the type of its field 'startMainLockDetector(...
I use the same constant in all my php files. I do not want to assign the value of this variable in all my files. So, I wanted to create one "parameters.php" file and to do the assignment there. Then in all other files I include the "parameters.php" and use variables defined in the "parameters.php".
It was the idea but it does not work. ...
I have a code similar to this:
$.ajax({
success: function(data) {
text = '';
for (var i = 0; i< data.length; i++) {
text = text + '<a href="#" id="Data_'+ i +'">' + data[i].Name + "</a><br />";
}
$("#SomeId").html(text);
for (var i = 0; i< d...
Hi,
Because of a strange C++ warning about the visibility of some symbols and an interesting answer, linking to a paper which describes the different visibility types and cases (section 2.2.4 is about C++ classes), I started to wonder if it is needed for a standalone application to export symbols at all (except main - or is that needed?...
Hi all!
I´m using a checkbox in my code that when its checked it makes a textview and a editText visibles, but if I uncheck de checkbox they continue being visible instead of dissapear.
Here is the code:
final CheckBox save = (CheckBox) findViewById(R.id.checkbox);
save.setOnClickListener(new OnClickListener() {
pu...
I can't get any images to show up when I'm using IE with these makeshift tabs I made, everything shows up and space is allocated for the image but the image doesn't show up when I change the class. I'm using the css property visiblity to make it work.
function findJournalId(d){
var parent=jQuery(d).parent(); ...
Hello,
I have a webform with a button and a textbox.
I want to set the textbox, in design time to Visible = false, and then in the onclick event of the button
in the client side using javascript, I want to set the visibility of the button back to true.
The problem is that I get a message saying that the object does not exist.
Any idea ...
Hi, I have 6 buttons on my GUI. The visibility of the buttons can be configured via checkboxes. Checking the checkbox and saving means the correpsonding button should be shown. I am wondering if it is somehow possible to have one TinyInt column in the database which represents the visibility of all 6 buttons.
I created an enum for the b...
I'm obviously brand new to these concepts. I just don't understand why you would limit access to properties or methods. It seems that you would just write the code according to intended results. Why would you create a private method instead of simply not calling that method? Is it for iterative object creation (if I'm stating that correc...
I have a file that contains the following:
#include <map>
class A {};
void doSomething() {
std::map<int, A> m;
}
When compiled into a shared library with g++, the library contains dynamic symbols for all the methods of std::map<int, A>. Since A is private to this file, there is no possibility that std::map will be instantiated i...
I have a form field in Drupal which I need some help with.
The requirement is to have the field show up as a simple input field, but to have a toggle button against it which would convert it into a multi-line text box for users who wish to enter more data.
In traditional PHP/HTML/Javascript this would be dead easy -- two fields; one st...