self

Ruby class question

Possible Duplicate: class << self idiom in Ruby I have a quick Ruby question. I come from a Java/c background, so I understand in Ruby "self" when referenced inside a instance method acts like "this". And "self." prefix for method defines it as a class method. But what does this mean here?? class << self def some_method ...

How do I get user input in the Self language?

I'm experimenting with the Self language and I just past the point of easy canned stuff. I want to prompt the user for a number, or perhaps provide a form for several numbers. Is there an equivalent a scripting language's stdin-input, or a simple dialog, or do I have to grok Mophic and build it from scratch? p.s. This should be tagged...

Forgetting self qualifier: how to catch this mistake?

I understand why Python requires explicit self qualifier when referring to instance attributes. But I often forget it, since I didn't need it in C++. The bug I introduce this way is sometimes extremely hard to catch; e.g., suppose I write if x is not None: f() instead of if self.x is not None: f() Suppose attribute x is u...

How to get self into a Python method without explicitly accepting it

I'm developing a documentation testing framework -- basically unit tests for PDFs. Tests are (decorated) methods of instances of classes defined by the framework, and these are located and instantiated at runtime and the methods are invoked to execute the tests. My goal is to cut down on the amount of quirky Python syntax that the peopl...

How to count similar interests in MySQL

I have 2 tables, 'interests' and 'users_interests'. 'users_interests' just has userid and interestid fields. 'interests just has an id and a name. I simply need to find userid's who have more than 3 interest ID's in common. I have been told that a Self Join is involved, but I cannot seem to get this to work. Someone said something ...

How can I create a self closing tag using JDOM

Hi there, I could find in Jdom api any function to create self closing xml tag like the <selfClosingTag /> below. For example, I need to create the following content: <parentTag> <selfClosingTag /> <firstChild>...... </firstChild> <secondChild>...... </secondChild> </parentTag> Can someone please tell me how. Please te...

[self class] in Objective-C

I'm reading through Mark Dalrymple's Learn Objective-C on the Mac (only at the chapter on Protocols, so still relatively newbish) and trying to figure something out: Why would you ever reference a class by its own name? If I had a class called Foo, why would I ever want to write, say, [[Foo alloc] init] and not [[[self class] alloc...

Joomla. PHP self submitting forms.

Hi all, I have a PHP file that has a self submitting form. Does anyone know of any plugins that I could use in Joomla to directly use this file and show the results on the same page that it was called from? I've tried a few like DirectPHP and have the form showing on the page fine. The results from the PHP file show fine on the page e...

Python - Timeit within a class

I'm having some real trouble with timing a function from within an instance of a class. I'm not sure I'm going about it the right way (never used timeIt before) and I tried a few variations of the second argument importing things, but no luck. Here's a silly example of what I'm doing: import timeit class TimedClass(): def __init__(...

PHP - Self form submission: $_SERVER['PHP_SELF'] OR action="" ?

Hello all, I just realise that, for some weird circumstances, I was doing what I believe to be self submissions, without any reference to PHP_SELF on the action form attribute. I'm puzzled, can we either use <?php echo filter_var($_SERVER['PHP_SELF'], FILTER_SANITIZE_STRING); ?> Or action="" ? If not, on what circumstances sh...

Javascript use explicit self/window objects to improve performance

I read on MSDN that to improve scripting efficiency, you can use self to make implicit window references explicit. Do you know if this is true? Does this basically mean that for instance calling self.location is somewhay more efficient than calling simply location with no window opject before? Since the MSDN text is referred to the sel...

Python: using Self and adding methods to an object on the fly

Here's my idea: Start with a simple object: class dynamicObject(object): pass And to be able to add pre written methods to it on the fly: def someMethod(self): pass So that I can do this: someObject = dyncamicObject() someObject._someMethod = someMethod someObject._someMethod() Problem is, it wants me to specify the self...

Suicide: Objective-C objects calling their own -dealloc methods on themselves

Is it good practice for an object in Objective-C to commit suicide? That is, for an object to declare [self dealloc] where -dealloc permits an orderly wind down as usual? What are the principal risks? As it happens I have a specific example, a custom timer object that extends NSObject and comprises an NSTimer instance and an NSUInteger ...

Delphi Self-Pointer usage

I need to get pointer to my class instance inside this instance. I can't use "Self" directly, I need store pointer for future usage. I tried next code: type TTest = class(TObject) public class function getClassPointer: Pointer; function getSelfPointer: Pointer; end; class function TTest.getClassPointer: Poin...

How to call a self.value in a class function definition in python?

How could I call a self.value in a definition of a function? class toto : def __init__(self): self.titi = "titi" def printiti(self,titi=self.titi): print(titi) ...

Passing self into a constructor in python

I recently was working on a little python project and came to a situation where I wanted to pass self into the constructor of another object. I'm not sure why, but I had to look up whether this was legal in python. I've done this many times in C++ and Java but I don't remember ever having to do this with python. Is passing references to...

[obj-c] Catching cases of missing self when setting ivars

Does anyone know of a decent way to catch forgetting to use 'self.' when setting variables? Is there an xcode compiler setting that can trigger warnings? I'm trying to think of the easiest way to make ensuring there is a 'self.' in front of assignments foolproof. ...

self signed SSL Certificates & nginx issues

say,I've a domain abc.com,I've made a self signed SSL Certificate successfully for www.abc.com,(even *.abc.com),however it doesn't work for abc.com how to fix this issue? ...

PHP5 Class scope quirks

Hey php gurus. I'm running into some bizarre class scope problems that clearly have to do with some quirk in php. Can anyone tell me what out-of-the-ordinary situations might give the following error... Fatal error: Cannot access self:: when no class scope is active in MyClass.php on line 5 Now, obviously if I were to use self:: outs...