self

What does 'self' refer to in a @classmethod?

I thought I was starting to get a grip on "the Python way" of programming. Methods of a class accept self as the first parameter to refer to the instance of the class whose context the method is being called in. The @classmethod decorator refers to a method whose functionality is associated with the class, but which doesn't reference a s...

Python, __init__ and self confusion

Alright, so I was taking a look at some source when I came across this: >>> def __parse(self, filename): ... "parse ID3v1.0 tags from MP3 file" ... self.clear() ... try: ... fsock = open(filename, "rb", 0) ... try: ... fsock.seek(-128, 2) ... tagdata = fsock...

iPhone - HTTPS connection to Server with Self-Signed Certificate

How would I accept a self-signed server certificate? Using the code below, I can only connect/authenticate after I accept the Server Cert using Safari. (void)secure:(NSString *)username credentials:(NSString *)login { NSURLCredential *userCredentials = [NSURLCredential credentialWithUser:username pass...

Masters Degree with Experience. Would you hire me with a postgrad degree?

I'm looking to see how detrimental a postgrad degree can be to future career options. Sorry for the long read: I'm currently in the final year of my undergrad computer science degree. I've done one year in industry at one of the worlds most well known technology consultancies as part of an Industrial placement scheme while from Universi...

Self redirect an .Asp page and keep the same Request variables

Hello, Am trying to convert the content of a page to an Excel format, the problem is when I redirect the page I don't get my request variables so I found a solution that we should define a hiden variable for each request variable and then define the value after Get call. This is the code that am using now : <script language="Javascript...

Autonomous Software

Has anyone written any code where the application in its lifetime learn and improve itself (using observed data stored in a KB),are there any frameworks for this? ...

Why is Self assignable in Delphi?

This code in a GUI application compiles and runs: procedure TForm1.Button1Click(Sender: TObject); begin Self := TForm1.Create(Owner); end; (tested with Delphi 6 and 2009) why is Self writable and not read-only? in which situations could this be useful? Edit: is this also possible in Delphi Prism? (I think yes it is, see here) ...

Ruby Definition of Self

Hi, I was reading a Ruby book and came across this definition of the pseudo-variable self: self - receiver object of the current method Could someone break down that definition and explain what it means? I don't understand any of it. EDIT: I actually have a pretty good idea of what self is (and its applications) and I know how t...

Advantages of prototype based OO over class based

Why is class based OO so popular instead of prototype based OO? Do they teach the latter in schools? Javascript is object based, but people use it mostly functionally, or via frameworks. I know that Sun has had some research on Self, but is there any other source of knowledge; preferably something that is accessible for self learned. I...

Is it possible to look beyond self in self.posts.find?

Expanding on recent_posts_on_self below, I want to add an all_recent_posts_on_self method but I'm not sure if it's possible using the syntax self.posts.find. On the other hand, all_recent_posts_on_class seems straightforward. class User < ActiveRecord::Base has_many :posts, :class_name => "Post" , :foreign_key => "author_id" has_man...

(Ruby,Rails) Context of SELF in modules and libraries...?

Hi All, Quick question regarding the use of "SELF" inside a module or library. Basically what is the scope/context of "SELF" as it pertains to a module or library and how is it to be properly used? For an example of what I'm talking about, check out the "AuthenticatedSystem" module installed with "restful_authentication". Best NOTE:...

Wanted to share an important insigt I found out today about the .self notation in ObjC

Hi, First thanks so much to users in this site for many answers I stumble upon when investigating bugs... I am working now a few months on a Obj-C project (IPhone), today I made a big discovery (in a beginners PoV) while working with a singleton. In short if you are accessing a @property with self.someProperty it will use the "(nonato...

Why do pythonistas call the current reference "self" and not "this"?

Python is the language I know the most, and strangely I still don't know why I'm typing "self" and not "this" like in Java or PHP. I know that Python is older than Java, but I can't figure out where does this come from. Especially since you can use any name instead of "self" : the program will work fine. So where does this convention ...

Objective C : Release, Dealloc, and the Self reference.

So I thought I had all these questions all figured out. Then all of a sudden i get an error (a crash) i can't figure out. THen after doing research to remedy the crash, i notice everything that I thought i knew about these critical areas are somewhat wrong. Below are 8 questions im just going to shoot out there in hopes of somebody answ...

How do I release self (UIImageView) in touchesEnded?

I have an object that is a child of UIImageView. Before all these touches methods, I add this object to the superview and then user moves it. In touchesEnded, sometimes I want to release self. I've tried: - [self release] or - [self removeFromSuperview] But all these tries end up in exceptions. What's the right way to release self...

Python decorators in classes

Hi, can one write sth like: class Test(object): def _decorator(self, foo): foo() @self._decorator def bar(self): pass This fails: self in @self is unknown I also tried: @Test._decorator(self) which also fails: Test unknown If would like to temp. change some instance variables in the decorator and th...

How to call an Objective-C Method from a C Method?

I have an Obj-C object with a bunch of methods inside of it. Sometimes a method needs to call another method inside the same object. I can't seem to figure out how to get a C method to call a Obj-C method... WORKS: Obj-C method calling an Obj-C method: [self objCMethod]; WORKS: Obj-C method calling a C method: cMethod(); DOESN'T...

what is self? when should i use it?

can you explain me the self in the objective-C 2.0 ? when and where should i use? is it similar with this definition in java? ...

When to call self.myObject vs just calling myObject in Objective-C

This little bit of syntax has been a bit of a confusion for me in Objective-C. When should I call self.myObject vs just calling myObject. It seems redundant however they are not interchangeable. Would someone please enlighten me? ...

Assigning to self in Objective-C

I'm from the C++ world so the notion of assigning this makes me shudder: this = new Object; // Gah! But in Objective-C there is a similar keyword, self, for which this is perfectly acceptable: self = [super init]; // wait, what? A lot of sample Objective-C code uses the above line in init routines. My questions: 1) Why does assign...