Questions tagged [init]

May refer to Linux init, an abbreviation of initialization - giving variables a "starting" value, or Python's __init__ class initiation method.

May refer to :

  • Linux Init - the parent of all processes, which primary role is to create processes from a script stored in the file /etc/inittab.
  • variable init (abbreviation of initialization) - giving variables a "starting" value.
  • python magic __init__ - magic function that initializes an object.
1905 questions
20
votes
1 answer

Convenience Init Override

Problem Override a convenience initializer of a subclass and it produces a compile error. Detail I am having issues understanding why Swift (v4.1) is not letting me override my convenience initializer. Reading the documentation I found that these…
Jad
  • 413
  • 1
  • 5
  • 11
19
votes
4 answers

IOS: NSMutableArray initWithCapacity

I have this situation array = [[NSMutableArray alloc] initWithCapacity:4]; //in viewDidLoad if (index == 0){ [array insertObject:object atIndex:0]; } if (index == 1){ [array insertObject:object atIndex:1]; } if (index == 2){ [array…
cyclingIsBetter
  • 17,447
  • 50
  • 156
  • 241
19
votes
7 answers

Pycharm (Python IDE) doesn't auto complete Django modules

My Python IDE (pycharm) has stopped auto completing my modules (suggestions). I get unresolved references after every django module I try to import so: from django - works, however soon as I add a 'dot' it fails so from django.db import models gives…
deven677
  • 191
  • 1
  • 1
  • 3
17
votes
2 answers

TypeScript init: error TS6053: File 'init.ts' not found

If I run tsc init in a empty directory, I get the error: error TS6053: File 'init.ts' not found I have an understanding question: Shouldn't tsc init simply create a tsconfig.json file? If not, with which command can I create a tsconfig.json ? p.s.…
user2227400
17
votes
4 answers

Initialization of members when inheriting from extern C struct

In Mixing C and C++ Code in the Same Program the following example (slightly abbreviated here to the relevant parts) is given. Assume buf.h contains the following: struct buf { char* data; unsigned count; }; // some declarations of existing…
godfatherofpolka
  • 1,645
  • 1
  • 11
  • 24
17
votes
2 answers

no designated init for SKShapeNode(circleOfRadius: radius)

I'm trying to create a subclass of SKShapeNode in swift as SKShapeNode(circleOfRadius: radius) but there is no designated init for it. Anyone have any workarounds or info about why? I'm not sure if this is a bug or intentional. I found this…
Chris
  • 173
  • 1
  • 6
17
votes
5 answers

Generate custom init method automatically

Is it possible to generate custom init method automatically from Xcode, as Android Studio does for android? I mean, if I declare some properties in .h, for example: int a; int b; So, I would like to create automatically a init method as: -…
Javier Roberto
  • 1,293
  • 11
  • 17
16
votes
4 answers

Understanding method signature in NoSuchMethod exception

I got this exception but resolved it. java.lang.NoSuchMethodError: antlr.NoViableAltForCharException. (CLjava/lang/String;II)V But i'd like to know how to interpret these kind of messages: "(CLjava/lang/String;II)V" Also, does this "init"…
popcoder
  • 2,952
  • 6
  • 32
  • 47
16
votes
2 answers

Is it possible to write nonnull-annotation in init?

Now in objective-c there are two new annotations: nonnull and nullable. Which of them should I use for return type specification of init method? - (instancetype)init { if (self = [super init]) { // ... } } Voice for nullable: There…
Mikhail
  • 1,061
  • 2
  • 13
  • 30
15
votes
2 answers

Setting an NSDate to specific date, time and timezone

I need to set a NSDate to a specific date, time and timezone for an iPhone App. The example code below works fine on iOS 4 as the setTimeZone was introduced with iOS 4. How could I easily set a NSDate to a date, time and timezone without using…
Structurer
  • 694
  • 1
  • 10
  • 23
15
votes
3 answers

How to configure ElasticSearch to restart after crash

Using the apt-get package for ElasticSearh, how can I configure the service to restart itself automatically after crashing on Ubuntu?
Avishai
  • 4,512
  • 4
  • 41
  • 67
15
votes
7 answers

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 { …
André Hoffmann
  • 3,505
  • 1
  • 25
  • 39
14
votes
6 answers

Docker-Compose + Postgres: /docker-entrypoint-initdb.d/init.sql: Permission denied

I have the following docker compose file: version: "3" services: postgres: image: postgres:11.2-alpine environment: POSTGRES_PASSWORD: root POSTGRES_USER: root ports: - "5432:5432" volumes: -…
Ben-hur Ott
  • 189
  • 1
  • 1
  • 8
14
votes
2 answers

Python logging: Why is __init__ called twice?

I am trying to use python logging with a config file and an own handler. This works to some degree. What really puzzle me is __init__ being called twice and __del__ being called once. When I remove the whole config file stuff and create the handler…
uli42
  • 293
  • 2
  • 9
14
votes
1 answer

How to clear GPU memory occupied by zombie process if it's parent is init?

nvidia-smi screenshot The process with PID 14420 is a zombie process and its parent id is 1(init). I want to clear 4436MiB memory occupied by this zombie process without rebooting. How should I proceed?
vikasreddy
  • 339
  • 3
  • 7