python 3.x – How do I multiply two matrices using class and initialization method

So I write the following code
from tabulate import tabulate

class Matrix():

def __init__(self, matrix: list):
    self.matrix = matrix
    self.num_rows = len(matrix)
    self.num_columns = len(matrix(0))

def __str__(self):
    return tabulate(self.matrix)

def create_identity(self):
    '''Returns a new Matrix object that represent the identity matrix of same dimensions than self.matrix
    '''
    result =  ((0 for i in range(self.num_rows)) for j in range(self.num_rows))
    for i in range(0, self.num_rows):
        result(i)(i) = 1
    return Matrix(result)  

def multiplication(self, other):
    '''Returns a new Matrix object with the result of the matrix multiplication between self.matrix and other.matrix
    pre-req: self.num_columns == other.num_rows
    '''
    matrix = ()
    for m in range(len(self.num_rows)): 
        for p in range(len(self.num_coloumns(0))):
            for n in range(len(self.num_coloumns)):
                result (m)(p) += self.new_rows(m)(n) * self.new_coloumns(n)(p)

I am confused. I need to multiply two matrix X (m,p) and Y(p,n)

How should I multiply those in multiplication method?

Problem with Initialization cell and Manipulate

The following minimum failing example illustrates a problem that I am having building an application to simulate projectile motion.

In the notebook’s initialization cell, I have the definition of a function FlightDuration. It serves as a stand-in for a library function that computes the duration of the projectile’s flight from its initial conditions.

(* Initialization cell *)
FlightDuration((* arguments *)) := 16.3;

The main input cell of the notebook contains a Manipulate for setting the values of the initial conditions and a Trigger for running the simulation.

(* Normal (Input) cell: *)
Manipulate(
 Module({sol=DSolve({y''(t)==-9.8,y'(0)==80,y(0)==0},y,t)},
  flightDuration=FlightDuration((* control values *));
  Plot(
   y(t)/.sol,
   {t,0.0001,time},
   PlotRange->{{0,flightDuration},{-50,400}},
   ImageSize->500
  )
 ),
 (* other controls supplying values to FlightDuration *)
 {{time,0.},0.,flightDuration,ControlType->Trigger},
 {{flightDuration,FlightDuration()},None}
)

When I close the normal cell, save the notebook, quit Mathematica and restart Mathematica by double clicking the notebook, the Output cell shows a red border and I see the error message:

General: Value of option PlotRange -> {{0,FlightDuration()},{-50,400}}
is not All, Full, Automatic, a positive machine number, or an
appropriate list of range specifications.

However, if I then click the Play button, the simulation works as expected.

My initial (naive) expectation was that the evaluation of the initialization cell should complete before any displays are updated. Further reflection suggested that perhaps the front end was trying to update the display at the same time that the kernel was evaluating the initialization cell. I tried various ways of delaying the re-display, such as using a semaphore, without success.

Q1: Does Mathematica provide an programmatic way for me to control when the initial display update takes place?

Q2: What is the best practice for initializing a notebook along the lines I am trying to do?

Note: Occasionally, when opening the notebook, the error does not occur. I take this to mean that there is some kind of timing dependency or race condition.

Environment: Mathematica: 12.1.0.0; MacBook Pro; Mac OS-X 10.13.4

unity graphics initialization

Pretty short question, when I load unity, I get this error:

Is this fixable with driver downloads, or do I need a new PC?*

*if so, how do I find out my computer’s default built-in graphics driver?

lightning network – Problem with the first Initialization of my LN node, dial tcp my-external-ip:9735: connect: connection timed out

Background

I was following 402 Payment Required’s LN video over here (https://www.youtube.com/watch?v=q0siLF9zmWo) and everything was good so far, until the moment of the first Initialization of my LN node, I got an (dial tcp my-external-ip:9735: connect: connection timed out) error.

I was starting the Initialization by the following way

lnd –externalip=X.X.X.X

And I’ve my lnd configuration file with the following attributes

alias=
debuglevel=debug
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind

I created the file (before) I started the Initialization.

Your environment

version of lnd: I don't know, I guess it's the latest version.
which operating system (uname -a on *Nix): Ubuntu 18.04
version of btcd, bitcoind, or other backend: bitcoind 0.19.1
any other relevant environment details: My Ubuntu is running on a VM machine with a (bridged) internet connection

Steps to reproduce

I don’t know how to reproduce the problem but here is a log with my issue

2020-08-14 20:33:16.008 (INF) BTCN: Server listening on (::):9735

2020-08-14 20:33:16.009 (INF) SRVR: Initializing peer network bootstrappers!

2020-08-14 20:33:16.009 (INF) SRVR: Creating DNS peer bootstrapper with seeds: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:16.010 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:33:16.022 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:16.426 (INF) DISC: Obtained 1 addrs to bootstrap network with

2020-08-14 20:33:19.428 (DBG) SRVR: Waiting 2s before trying to locate bootstrap peers (attempt #1)

2020-08-14 20:33:21.428 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:21.463 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:33:21.464 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:33:21.464 (DBG) SRVR: Waiting 4s before trying to locate bootstrap peers (attempt #2)

2020-08-14 20:33:25.464 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:25.504 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:33:25.504 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:33:25.504 (DBG) SRVR: Waiting 8s before trying to locate bootstrap peers (attempt #3)

2020-08-14 20:33:33.504 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed:
((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:33.539 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:33:33.539 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:33:33.539 (DBG) SRVR: Waiting 16s before trying to locate bootstrap peers (attempt #4)

2020-08-14 20:33:49.540 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:33:49.540 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:33:49.578 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:33:49.578 (DBG) SRVR: Waiting 32s before trying to locate bootstrap peers (attempt #5)

2020-08-14 20:34:21.579 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:34:21.580 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:34:21.735 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:34:21.735 (DBG) SRVR: Waiting 1m0s before trying to locate bootstrap peers (attempt #6)

2020-08-14 20:35:21.736 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:35:21.736 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed: ((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:35:22.280 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:35:22.280 (DBG) SRVR: Waiting 1m0s before trying to locate bootstrap peers (attempt #7)

2020-08-14 20:35:27.316 (ERR) SRVR: Unable to connect to ##################################################################@my-external-ip:9735: dial tcp my-external-ip:9735: connect: connection timed out

2020-08-14 20:36:22.280 (INF) DISC: Attempting to bootstrap with: BOLT-0010 DNS Seed:
((nodes.lightning.directory soa.nodes.lightning.directory) (lseed.bitcoinstats.com ))

2020-08-14 20:36:22.347 (INF) CRTR: Pruning channel graph using block 0000000000000000000f09423cef42338b27f29244a99deed77411cf2e6edb57 (height=643720)

2020-08-14 20:36:22.349 (INF) CRTR: Block 0000000000000000000f09423cef42338b27f29244a99deed77411cf2e6edb57 (height=643720) closed 0 channels

2020-08-14 20:36:22.461 (DBG) NTFN: Filtering 3178 txns for 0 spend requests at height 643720

2020-08-14 20:36:22.523 (INF) NTFN: New block: height=643720, sha=0000000000000000000f09423cef42338b27f29244a99deed77411cf2e6edb57

2020-08-14 20:36:22.523 (DBG) SWPR: New block: height=643720, sha=0000000000000000000f09423cef42338b27f29244a99deed77411cf2e6edb57

2020-08-14 20:36:22.523 (INF) UTXN: Attempting to graduate height=643720: num_kids=0, num_babies=0

2020-08-14 20:36:22.524 (DBG) DISC: New block: height=643720, hash=0000000000000000000f09423cef42338b27f29244a99deed77411cf2e6edb57

2020-08-14 20:36:22.757 (INF) DISC: Attempting to bootstrap with: Authenticated Channel Graph

2020-08-14 20:36:22.758 (ERR) SRVR: Unable to retrieve initial bootstrap peers: no addresses found

2020-08-14 20:36:22.758 (DBG) SRVR: Waiting 1m0s before trying to locate bootstrap peers (attempt #8)

I tried dig nodes.lightning.directory and got the following output

; <<>> DiG 9.11.3-1ubuntu1.12-Ubuntu <<>> nodes.lightning.directory

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48349

;; flags: qr rd ra; QUERY: 1, ANSWER: 25, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 65494

;; QUESTION SECTION:

;nodes.lightning.directory. IN A

;; ANSWER SECTION:

nodes.lightning.directory. 60 IN A 93.46.54.4

nodes.lightning.directory. 60 IN A 82.1.254.100

nodes.lightning.directory. 60 IN A 83.162.151.227

nodes.lightning.directory. 60 IN A 163.158.202.112

nodes.lightning.directory. 60 IN A 212.47.254.6

nodes.lightning.directory. 60 IN A 3.12.163.140

nodes.lightning.directory. 60 IN A 178.128.165.102

nodes.lightning.directory. 60 IN A 51.83.41.129

nodes.lightning.directory. 60 IN A 193.194.163.53

nodes.lightning.directory. 60 IN A 35.229.93.213

nodes.lightning.directory. 60 IN A 52.38.99.14

nodes.lightning.directory. 60 IN A 3.16.193.211

nodes.lightning.directory. 60 IN A 73.147.115.80

nodes.lightning.directory. 60 IN A 176.122.101.230

nodes.lightning.directory. 60 IN A 173.249.48.168

nodes.lightning.directory. 60 IN A 18.223.138.245

nodes.lightning.directory. 60 IN A 203.118.186.226

nodes.lightning.directory. 60 IN A 104.248.111.88

nodes.lightning.directory. 60 IN A 46.59.13.35

nodes.lightning.directory. 60 IN A 185.228.141.6

nodes.lightning.directory. 60 IN A 98.210.161.137

nodes.lightning.directory. 60 IN A 86.176.78.2

nodes.lightning.directory. 60 IN A 152.32.173.177

nodes.lightning.directory. 60 IN A 176.74.136.237

nodes.lightning.directory. 60 IN A 45.77.156.146

;; Query time: 154 msec

;; SERVER: 127.0.0.53#53(127.0.0.53)

;; WHEN: Fri Aug 14 23:13:30 EET 2020

;; MSG SIZE rcvd: 454

Expected behavior

I expected the Initialization would work normally without any issues.

Actual behavior

The first Initialization of the LN node didn’t happen, stuck in the loop of trying to locate bootstrap peers

port – unable to connect to Rserver using docker: “rstudio initialization error” and “r is taking longer to start than usual” messages

I am trying to use this docker image < https://hub.docker.com/r/natverse/r-natverse > which runs in an r server. However, I always get the error “rstudio initialization error, unable to connect to service” I then tried to see if i could connect by using the rocker/rstudio docker container, but this returns the message: “r is taking longer to start than usual” and just buffers continuously. In both cases I never make it to any kind of login screen. I would really appreciate some help with this. I am using docker desktop for windows. Thanks!

IBM x3400 M3: hangs on “UEFI Platform Initialization”

I am trying to set up an IBM x3400 M3 machine.

However, every time I boot and reboot, the machine displays: “UEFI Platform Initialization” for a while and nothing happens. Even the error LED gets on.

I’ve tried all the followings from the official source:

https://www.ibm.com/support/pages/system-hangs-startup-message-uefi-platform-initialization-ibm-system-x

Workaround 1

For this one, I don’t seem to find the “LPD Panel” neither the reset button, maybe I missed something

Workaround 2

I tried to add a jumper on the 2-3 pin on the jumper 29, but it only refused to boot. The power button did no longer work, therefore I removed it.
Further on, there was no jumper, to begin with, I fetched one from another computer, however no result.

Workaround 3

I remove the CMOS waited and put it back just as it is written, no luck.

I’ve also tried to play the memory in it. I tried the following combinations:
1 & 3, 1 & 4, all the slots an only in slot 1.

The server used to work around 6 months ago. Until then I haven’t boot it. However, I added another CPU, which after some hours of booting/stopping the server and removing it, I realized that the server was not accepting it. However, now it hangs at the message above.

Any other suggestions or any way to debug it?

array – Python string initialization [‘Hello World’] and the differences "Hello" World "

I started to learn Python, version 3, and I tried the following code in the interpreter

$ python3 
Python 3.6.8 (default, Apr  9 2019, 04:59:38) 
(GCC 8.3.0) on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> Justring = 'Hello World' 
>>> Justring(2)
'l'
>>> Justring = ('Hello World')
>>> Justring(0)
'Hello World'
>>> Justring(1)
Traceback (most recent call last):
  File "", line 1, in 
IndexError: list index out of range
>>> 

What is the difference in initializing the Justring chain for these cases

(& # 39; Hello world & # 39;)

& # 39; Hello world & # 39;

Where can I get such explanations.

creating a class attribute after initialization in python

I have a class in python, defined as follows:

class MyClass:
    def __init__(self, x, y):
        self.x = x
        self.y = y

I need the object to have an additional attribute, z, it depends on x, y. Normally, I would just define it in the initializer:

def MyClass:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.z = x + y

The problem is that in my real example, creating z takes a long time (it's long sympy operations on polynomials), and I need this value several times in the code, so calculating it each time is not an option. I was just thinking of creating a method

    ...
    def initialise_z(self):
        self.z = x+y

but calling MyClasS(1,2).z without initialization z first obviously returns a AttributeError. I could just use a try / catch when I need to, but I'm using in a different context, so I'm a little concerned about the proliferation of try. Is there a best practice for handling this in Python?

linux – What causes the initialization halt to fail?

I have a managed process that ends all child processes during post-shutdown:

post-stop exec killall my-process & exec sleep 10

It works as expected, but I'm not sure of the following two cases:

If the killall process is not running as a background process:

post-stop exec killall my-process && exec sleep 10

Or if I completely suppress the sleep process:

post-stop exec killall my-process

In these two scenarios, if I execute the initctl shutdown, it returns the following error:

initctl: Job failed while stopping

Why does the first example stop as expected, while the other two examples do not stop correctly?

unit – Initialization of variables, difference between waking up and initializing in class

public class ExampleClass: MonoBehaviour  
{  
   int exampleVariable = 0;  
   int exampleVariableForAwake;  
   void Awake()
   {  
      exampleVariableForAwake = 0;  
   }
}

What is the difference between initializing a variable at declaration against. initilize in Awake?
What I understand should be used in place of constructors in Unity C #, welcome to correct me if I'm wrong.

What use is considered an appropriate convention by the community, if any?

The same question could also be Properties, so I'm going to leave that open.