init

What command(s) control the behavior of /etc/rc*.d on Redhat/CentOS?

/etc/init.d/* /etc/rc{1-5}.d/* ...

Servlet constructor and init() method

Why do we need an init() method in servlet? Can't we use the constructor to initialization? ...

init() method in servlet

can we change the name of the init() method of servlet? i mean to say the life should be- xyz()-service()-destroy() instead of init()-service()-destroy() ...

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...

question about ColdFusion component constructor name

hi all, i have some questions about constructors in ColdFusion : must i use the name init as the constructor name? if i create an instance of the component without invoking the init method, what is returned? instance=createObject("component","cfcName"); // what value now instance hold can i take the code in the init method out and d...

HttpModule Init method is called several times - why?

I was creating a http module and while debugging I noticed something which at first (at least) seemed like weird behaviour. When i set a breakpoint in the init method of the httpmodule i can see that the http module init method is being called several times even though i have only started up the website for debugging and made one single...

DOJO : How do you reinitiate form elements after ajax call ?

I'm trying to do a couple of things using Zend Framework & Dojo Toolkit, and any help would be appreciated. Here's the problem: I have a form that is rendered with the Zend Framework form class, which has an ajax radio button selection. Clicking one of these radio buttons will send an ajax request to another controller, which has no lay...

Check if a string contain Asterisk (*)

I want to check if my string contain one or more asterisk. I have tried this : if [[ $date_alarm =~ .*\*.* ]] then ... fi It worked when I launch directly the script, but not if this script is called during shutdown (script installed in run level 0 and 6 via update-rc.d) Any idea, suggestion ? Thanks ...

In Objective-C why should I check if self = [super init] is not nil?

Hey guys, I have a general question about writing init methods in Objective-C. I see it everywhere (Apple's code, books, open source code, etc.) that an init method should check if self = [super init] is not nil before continuing with initialisation. The default Apple template for an init method is: - (id) init { self = [super in...

How does inheriting from NSObject work?

There are a couple of things about Objective-C that are confusing to me: Firstly, in the objective-c guide, it is very clear that each class needs to call the init method of its subclass. It's a little bit unclear about whether or not a class that inherits directly from NSObject needs to call its init method. Is this the case? And if...

Can I you use __init__.py to define global variables?

I want to define a constant that should be available in all of the submodules of a package. I've thought that the best place would be in in the __init__.py file of the root package. But I don't know how to do this. Suppose I have a few subpackages and each with several modules. How can I access that variable from these modules? Of cours...

Why are alloc and init called separately in Objective-C?

Note: I'm relatively new to Objective-C and am coming from Java and PHP. Could someone explain to me why I always have to first allocate and then initialize an instance? Couldn't this be done in the init methods like this: + (MyClass*)init { MyClass *instance = [MyClass alloc]; [instance setFoo:@"bla"]; return instance; }...

initwithint warning, no method found?

I have a warning and just can't work out how to make it go away. In my .h I have this... -(void)restartTimer; Then the in my .m I have... -(void)restartTimer{ TimerViewController *TimerView = [[TimerViewController alloc] initWithInt:hStart number:mStart]; I get this error: Warning: no '-initWithInt:number.' method found. I a...

Cleanest way to define classes in Python?

I want to define classes in Python, but I'm currently putting them in modules, contained within packages. Is there a cleaner way of doing this? Is it okay to define classes in __init__.py of the package itself? I'm still learning how to arrange my Python source code, but this seems to be creating a slight ambiguity? Thanks to all! ...

Difference between defining a member in __init__ to defining it in the class body in python?

What is the difference between doing class a: def __init__(self): self.val=1 to doing class a: val=1 def __init__(self): pass ...

Django Admin: Getting request in ModelForm's constructor

The below code removes certain values from a drop down menu. It works fine but I want to remove the value if the user lacks certain permissions. How can I access request.user in the ModelForm's constructor? Or is there a better way to accomplish what I am trying to do? class AnnouncementModelForm(forms.ModelForm): def __init__(sel...

What is causing "unbound method __init__() must be called with instance as first argument" from this Python code?

I have this class: from threading import Thread import time class Timer(Thread): def __init__(self, interval, function, *args, **kwargs): Thread.__init__() self.interval = interval self.function = function self.args = args self.kwargs = kwargs self.start() def run(self): ...

C# Asp.Net User Control button click

In my code I load a user control (uc) in the page_load event. The uc contains a button which sets a label text to the textbox value. (lblTest.Text = txtText.Text) . This works fine in the load event of my page. But when I set the loading of the uc in my Init event, the label isn't set. When I set breakpoints, I see the button event is fi...

Confused when I see 'self' and '__init__'

I don't understand what these are used for, particularly the self argument? Could some please explain this to me and why on earth you would want to pass this in? Also, I've always thought __init__ was for 'initialisation', but it didn't occur to me that I've never had to put anything in here before. Could someone give me an easy example...

Is there any reason to choose __new__ over __init__ when defining a metaclass?

I've always set up metaclasses something like this: class SomeMetaClass(type): def __new__(cls, name, bases, dict): #do stuff here But I just came across a metaclass that was defined like this: class SomeMetaClass(type): def __init__(self, name, bases, dict): #do stuff here Is there any reason to prefer one ...