init

How do I call a property setter from __init__

I have the following chunk of python code: import hashlib class User: def _set_password(self, value): self._password = hashlib.sha1(value).hexdigest() def _get_password(self): return self._password password = property( fset = _set_password, fget = _get_password) def __init__(self, user...

Custom init method in Objective-C, how to avoid recursion?

I want to create a subclass of UINavigationController which always starts with the same root controller. Nothing special, so (to me) it makes perfect sense to override the init method like this: - (id) init { rootController = [[MyController alloc] init]; if (self = [super initWithRootViewController:rootController]) { // do...

init never reaping zombie/defunct processes

Hi, On my Fedora Core 9 webserver with kernel 2.6.18, init isn't reaping zombie processes. This would be bearable if it wasn't for the process table eventually reaching an upper limit where no new processes can be allocated. Sample output of ps -el | grep 'Z': F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 5 Z ...

jquery init function

I got a simple UI widget and i'd like it to alert() the "hello world!!!" when initialised. $.widget("ui.myWidget", { _init: function() { //start alert('Hello World!!!'); } } could some one explain how this init or _init function works.? if i was to call the ui just like the dialog ui would $('#selector').dialog() in...

Subclassing dict: should dict.__init__() be called?

Here is a twofold question, with a theoretical part, and a practical one: When subclassing dict: class ImageDB(dict): def __init__(self, directory): dict.__init__(self) # Necessary?? ... should dict.__init__(self) be called, just as a "safety" measure (e.g., in case there are some non-trivial implementation deta...

How to set which control has focus on Application start

In C#/Winforms how do I set the default focus when my application starts? ...

Guice call init method after instantinating an object

Is it possible to tell Guice to call some method (i.e. init()) after instantinating an object of given type? I look for functionality similar to @PostConstruct annotation in EJB 3. ...

Learning Haskell: How to implement my own version of init function

As part of learning Haskell, I am trying to implement my own version of various functions associated with Lists. Right now I am stuck on the init function. init function in Haskell returns all the elements in a List other than the last element. Here is what I have done so far. init' :: [Int] -> [Int] init' [] = error "This function ca...

start and call a method of seam component on jboss startup

Possible Duplicate: How can I start a process on the start of a Seam application Hi, I am using JBoss 4.2.1 GA. I want my jboss server to load and call a method in my seam component on the server startup I have used init-method in my components.xml and I also have used @create annotation tag. Can anyone help me or point me ...

iPhone initializing a UIViewController with additional data

Hi guys, I have a custom UIViewController subclass, which gets pushed on a UINavigationController stack. I want to add some data of my own at the time of initialization/pushing. Should I a) write a custom init method with my data as argument, like this? MyCustomViewControllerSubclass.m: -(id) initWithNibName: bundle: myCustomData: {...

friendly classes in c#

hey folks! actually i refactor some portion of code. what i want to do is to initialize an object "Task" with an object "TaskArgument". let s say "TaskArgument" is abstract and "Task" implements a method "OnEnterTask(TaskArgument args)" and is sealed (for some special behavior of the existing system, which is out of scope). old code: ...

Should I always release self for failed init methods?

Should I always release self when there is a failure inside init, or should I only do so if I have initialized instance variables first? To put it another way, is this pattern valid? Is there a time when I shouldn't release self inside an init method, or should I assume that if the control flow enters init, self has at least a retain co...

python __init__ how to return a value

I have a class with an __init__ function. How can I return an integer value from this function when an object is created? I wrote a program,where init does command line parsing and I need to have some value set. IS it OK set it in global variable and use it in other member functions ? If so how to do that? So far , i declared a variabl...

ExtJS accordion init component while collapsed

Hi everyone! I have following problem in EXTJS: I have an accordion layout with 2 panels. the first panel is for choosing an element and if you doubleclick the detail will be displayed in the second panel. However there is one problem: The elements of panel2 seems not to be initialised, so i get an "is undefined" error. When i open pa...

Call a non member function on an instance before is constructed.

Hi everyone. I'm writing a class, and this doubt came up. Is this undef. behaviour? On the other hand, I'm not sure its recommended, or if its a good practice. Is it one if I ensure no exceptions to be thrown in the init function? //c.h class C{ float vx,vy; friend void init(C& c); public: C(); }; //c.cpp C::C() { in...

Where should I init my data?

I am parsing a CSV file when my iphone app loads. This takes a few seconds I would like to throw up a splash screen while this is happening however because I am loading this data from wakeFromNib the splash screen is coming up after I am done. So where should I do this work? ...

how to init binary buffer in python

so, I read from DB binary field i.e. 'field1' to var Buf1, and then do something like: unpack_from('I', Buf1, 0) so, all is ok. but question is how can I ini Buf1 without going to DB? I can get value from DB manually and init my var statically, but how? in DB field 'field1' I see something like '0x7B0500000100000064000000B80100006'. ...

Init var without copy constructor

Hello, I have some class(Window) without copy constructor (it's private). I can't understand how to init var of this class in my own class: class MyClass { Window obj; // Hasn't copy constructor public: void init() { obj = Window(/* constructor params */); // [error] obj(/* constructor params */); // ...

Problem initialing a unicode string

Hey All. Atm im working with native API calls and i have to get RtlInitUnicodeString to work. The way i use: const WCHAR wcMutex[] = L"String1"; UNICODE_STRING unicodeMutexBuffer; RtlInitUnicodeString(&unicodeMutexBuffer,wcMutex); now my problem the project doesnt compile , i get this error: Error argument of type "UNICODE_ST...

AS3 function running before variables are defined!

I am trying to add an init() function to a MovieClip, but when I run the function from scene1 the variables that were set in the MovieClip are not defined yet... The MovieClip was dragged to the stage from the library. scene1: mc.init(null); MovieClip: var _default = 5; function init(num) { if(num == null) { trace(_d...