text:
Q: How to use @RenderPage to include CSS content inline - MVC Razor I am currently exporting a page from my project into Excel which will not allow the linking of external content e.g. external CSS.
What I am trying to achieve is a simple way to include a CSS file in my view but to have it called directly from a CSS file which will have automatically been minified by Visual Studio.
So, in my view I have tried this:
<style type="text/css">
   @RenderPage("~/CSS/_ExportStyles.min.css")
</style>

but doing this returns the following error:

Server Error in '/' Application.
The following file could not be rendered because its extension ".css"
  might not be supported: "~/CSS/_ExportStyles.min.css".

What I know will work would be to place the CSS in a normal .cshtml file and include that, but I would lose the ability to ".min" the file which keeps the file size small and allows me to automatically strip out comments etc.

A: So, it turns out that @RenderPage is not what I was looking for...
what I needed is this:
@Html.Raw(File.ReadAllText(Server.MapPath("~/CSS/_ExportStyles.min.css")))


text:
Q: auto pause iframe video and audio when another plays I'm having difficulty figuring this out. I'm new to JS so I need some help!
I've managed to auto-pause audio when another audio plays BUT I now need more than that. I need this to include audio and iframe videos.
My ask is, is it possible to auto-pause an iframe video if audio starts playing, and vice versa?
Thanks in advance.
I've tried the below and it doesn't do exactly what I need. Please help.
<script>
var audios = document.getElementsByTagName('audio');
for (var i = 0, len = audios.length; i < len;i++) {
  var audio = audios[i];
  audio.addEventListener('play', function() {
    var iframes = document.getElementsByTagName('iframe');
    for (var i = 0, len = iframes.length; i < len;i++) {
      var iframe = iframes[i];
      var src = iframe.src;
      if (src.indexOf('player.vimeo.com') > -1) {
        iframe.src = src + '&enablejsapi=1';
      }
    }
  });
}
</script>

UPDATE: I got this to work BUT it doesn't pause the iframe video when the audio starts. The only thing that works is that when playing the audio, the video pauses. I need it both ways.
 <script>
document.addEventListener('play', function(e) {
    var audios = document.getElementsByTagName('audio');
    var iframes = document.getElementsByTagName('iframe');
    if (e.target.tagName === 'IFRAME') {
        for (var i = 0, len = audios.length; i < len; i++) {
            audios[i].pause();
        }
    } else if(e.target.tagName === 'AUDIO'){
        for (var i = 0, len = iframes.length; i < len; i++) {
            iframes[i].contentWindow.postMessage('{"method":"pause"}','*');
        }
    }
}, true);
</script>

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python call multiprocessing.pool terminate method shut down the entire thread? I am using pool in multiprocessing and with django framework. I have the code like this
def tokenize(request) :
    global pool
    pool = Pool(processes=32,initializer= compute_customizedStopwords, initargs=())
    global canceled
    canceled = False
    for i in range(100) :
        pool.apply(sometask, someargs)
    if canceled :
        return HttpResponse("canceled")
    return HttpResponse("successful!")

def cancelTokenization(request):
    pool.terminate()
    canceled = True
    return HttpResponse()

When the user press the tokenize button, a new web request comes in, and the main process should make a new thread to address this request.But since this function using the multiprocessing. The main process should spwan a bunch of subprocess to run tokenization. But while the tokenization is running, when the urse press cancel, the tokenization process pool should teminate and return "canceled!". But it turns out the front-end never get any response, either successful or canceled. I wonder whether is pool.terminate should shut down the previous running thread in the main proces? How can i implement this  stop function.


text:
Q: Filtering matrices in matlab I'm a beginner in Matlab and I'm trying to filter a matrix
A=[104 104 100 108 108; 104 104 100 108 108; 99 99 106 98 98; 95 95 90 85 85; 95 95 90 85 85]

with the filter
B=[-0.1111111111111111 -0.1111111111111111 -0.1111111111111111; -0.1111111111111111 0.8888888888888889 -0.1111111111111111; -0.1111111111111111 -0.1111111111111111 -0.1111111111111111]

the method I have to use for padding is replication, so I changed the matrix A to become
A=[104 104 100 108 108; 104 104 100 108 108; 99 99 106 98 98; 95 95 90 85 85; 95 95 90 85 85]

when I tried to make the inner product between the matrix and the filter to get the filtered matrix
dot(A,B)

I got the error:
_________ Error using dot (line 33) A and B must be same size.
_________

What should I do?

A: Taking the dot product is not filtering an image. If you want to filter the image with the filter you've provided, you can use imfilter to do that.
Also, it handles the replication padding automatically by passing the replicate input parameter.
output = imfilter(A, B, 'replicate');


text:
Q: How to implement intervals in protractor/selenium I'm writing a series of automated tests and get intermittent timeout/synchronization errors. I looked online and was told that using intervals would solve this problem
https://github.com/angular/angular.js/blob/master/src/ng/interval.js
I was wondering how do I incorporate the interval.js file with the rest of the files? Do I add a line to protractor-config.js, or do I link it elsewhere. If so, how do I link it?

A: The $interval service comes bundled with Angular; you don't need to download any new files or integrate anything with Protractor. Your Protractor tests are most likely just fine the way they are.
What everyone means when they tell you to use $interval is that you (or your company's developers) need to look through the source code of your app for $timeout or $http requests that are happening repeatedly (in a recursive function, a loop, or two functions that mistakenly call each other), or possibly an $http request that is failing (this would show up in bright red in Chrome's developer console, under the Network tab).
The reason why looping $timeouts (and failing $http requests) are bad is that Protractor, by design, will wait for every $timeout callback and $http request to finish completely before it will do anything. However, it will not wait for $interval callbacks to complete. $interval has almost exactly the same syntax as $timeout, so it's not difficult to change from one to the other--the only difference is that $timeout executes once, and $interval executes on a continuous loop. Official docs are below:
$timeout
$interval
A few more possibilities are listed at another answer I posted, along with a link to Protractor's official list of reasons why this might happen:
Timed out waiting for Protractor to synchronize with the page after 50001ms
I give you my 90% guarantee that it is one of these issues, but if you provide more information about your situation, I can give some more specific tips.


text:
Q: Linking an Unused Object File Breaks the Program As a newbie to gcc and MCUs world, I am seeing a strange behavior I hope someone can help me with. I can create and execute a simple application for my armv7e-m board (CC3220S_LAUNCHXL) without any problem. However when I link an object file which is not referenced anywhere and does not reference any additional code, the program stops getting executed on the board. There are no compile or link time errors; Just the program won't work.
My question is how linking an unused object file would break the program execution?

A:
My question is how linking an unused object file would break the program execution?

There are many ways this could happen. Example:
#include <stdio.h>
int main()
{
  puts("Hello!");
  return 0;
}

gcc t.c && ./a.out
Hello!

So far, everything works as expected. Now for some breakage:
// t1.c
__attribute__((constructor))
void fn() { abort(); }

gcc -w -c t1.c && gcc t.c t1.o && ./a.out
Aborted (core dumped)

Voila: an unreferenced fn linked into the program causes it to die before reaching main.

Just the program won't work.

You will likely get a more useful answer if you provide details of what exactly "won't work" means, and do some debugging on your own.


text:
Q: Reload config file for a background process I have to reload a config file on demand while process is running in background.

*

*process should not be stopped and manually started after that.

*somehow I should ask for credentials or pass them to process

My idea is that I create a thread which is checking if config file is changed.
If this is the case:

*

*validate user (How to do that in a background process)

*do stuff which has to be done before config reload

*reload config

A: For checking which file is changed use the WatchService. Do not write your own thread for this.
https://docs.oracle.com/javase/tutorial/essential/io/notification.html
https://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchService.html


text:
Q: Load HTTP header information in a nice way after the page has loaded I've got an idea to add some information in the response headers of our servers. This information would only be visible from our offices and could easily be viewed via Chrome developer tools. BUT, I want to display this information on demand through a bookmark consisting of a javascript that could present it in a nicer way.
At the moment I've been able to populate a hash table with the headers so I can pick an chose in an easy way. That code looks like this:
var req = new XMLHttpRequest();
req.open('GET', document.location, false);
req.send(null);
var headers = req.getAllResponseHeaders().split("\n");

var headerdict = {};

for(x=0;x<headers.length;x++){
    header = headers[x].split(": ");
    headerdict[header[0]] = header[1];
}

Then I want to present this information in a nice way. It'd be awesome to use a pre-made framework for this, ie jquery or sweetalert but I have not managed to get it working (loading a js file post page load seems harder than I thought.
So instead of using a framework I decided to look into just adding a div on the existing page, but that also failed due to css taking over.
So my question is a bit non-exact. Do you experts have a suggestion of a way to solve my issue? Basically I could do it with a normal javascript alert, but it's so darn ugly.
Long story short, I want to present information from certain headers in a nice way after the page load. The information should be independent from existing CSS.
Please note that I do not have any control over the code itself so the solution must work independently of what content that is displayed.

A: You can use a popup window instead of an alert dialog box. Check window.open() here:
http://www.w3schools.com/jsref/met_win_open.asp


text:
Q: How to recursively define a sum of any finite sequence I'm stuck at exercise 4.9 of chapter 3 in "Introduction to set theory" of Karel Hrbacek and Thomas Jech (Third revised edition)
The exercise is as follows:
For each finite sequence $\langle k_i: 0 \leq i < n \rangle$ of natural numbers define $\sum \langle k_i: 0 \leq i < n \rangle$ so that:

*

*$\sum\langle \rangle=0$

*$\sum\langle k_0 \rangle=k_0$

*$\sum\langle k_i: 0 \leq i <n \rangle = \sum\langle k_i: 0 \leq i <n-1 \rangle +k_n$ for $n \geq 1$
I know the idea is to recursively define a function such that for every finite sequence is image is the sum of the terms in the sequence, so I was trying to find in some way using the Recursion Theorem a unique function $\sum: Seq(\mathbb{N}) \longrightarrow \mathbb{N}$ that satisfies points 1 to 3, but I was not able to do it ($Seq(\mathbb{N})$ is the set of all finite sequences).
Any help would be apreciate, thanks.

A: Here is one way to do it. First two lemmas:
Lemma 1. Let $\langle a_n\rangle$ be an infinite sequence of natural numbers. There exists a unique infinite sequence of natural numbers $\langle b_n\rangle$ satisfying
(1) $b_0=a_0$
(2) $b_n=b_{n-1}+a_n$ for all $n> 0$.
We call $\langle b_n \rangle$ the cumulative sum of $\langle a_n\rangle$.
Proof. Apply the the recursion theorem from chapter 3 of Hrbacek and Jech with the function $g:\mathbb N \times \mathbb N \to \mathbb N$ defined by $g(m,n)=m+a_n$.
Lemma 2.  Let $\langle a_n\rangle$,$\langle a'_n\rangle$ be two infinite sequence of natural numbers, and let $\langle b_n\rangle$,$\langle b'_n\rangle$ denote respectively their cumulative sums. Suppose $a_n=a'_n$ for all $0\leq n \leq k$ for some fixed $k\in \mathbb N$. Then  $b_n=b'_n$ for all $0\leq n \leq k$.
Proof. By induction on $n$. For $n=0$ we have $b_0=a_0=a'_0=b'_0$ by condition (1). Suppose $b_{n-1}=b'_{n-1}$ for some $0< n\leq k$. Then $$b_n=b_{n-1}+a_n=b'_{n-1}+a_n=b'_n$$ by condition (2). By induction it follows that $b_n=b'_n$ for all $0\leq n \leq k$.
We can now prove the claim. Given an $n$-tuple $\langle a_0,\dots,a_n\rangle$ of natural numbers  we define $\sum\langle a_0,\dots,a_n\rangle$ to be $b_n$, where $b_n$ denotes the $n$th term in the cumulative sum of the sequence $a_0,\dots,a_n,0,0,\dots$. By condition (1) we have that $\sum \langle a_0\rangle=a_0$ for any natural number $a_0$. By condition (2) and Lemma 2 we have that $\sum \langle a_0,\dots,a_n\rangle=\sum \langle a_0,\dots,a_{n-1}\rangle +a_n$ for all $n$-tuples of natural numbers $\langle a_0,\dots,a_n\rangle$ with $n>0$. Finally we define the sum of the empty sequence as $\sum  \langle \rangle=0$. Note that $\sum \langle a_0, a_1\rangle=a_0+a_1$, so we have effectively extended the addition operation on $\mathbb N$.
The function $\sum: Seq(\mathbb{N}) \longrightarrow \mathbb{N}$ just defined satisfies all three points in the post. It is the unique function from $Seq(\mathbb{N})$ to $\mathbb{N}$ satisfying these three points. For suppose $\sum': Seq(\mathbb{N}) \longrightarrow \mathbb{N}$ is another such function with $\sum\neq \sum'$. Let $n_0$ denote the smallest $n\in\mathbb N$ for which there exists an $n$-tuple  $\langle a_0,\dots,a_{n}\rangle$ with $\sum  \langle a_0,\dots,a_n\rangle \neq  \sum'  \langle a_0,\dots,a_{n}\rangle$, and let $\langle a_0,\dots,a_{n_0}\rangle$ be any such $n_0$-tuple.  Clearly $n_0>0$. Then we obtain
$\sum  \langle a_0,\dots,a_{n_0}\rangle =\sum  \langle a_0,\dots,a_{n_0-1}\rangle+a_{n_0}=\sum'  \langle a_0,\dots,a_{n_0-1}\rangle+a_{n_0}=\sum  \langle a_0,\dots,a_{n_0}\rangle$
a contradiction.

A: Alphie answer is very elegant and a really natural way to get the desired function, but I will post another slightly different way of solving it (it is in fact very similar to Alphie's answer).
Let's take as in Theorem 3.6 of the book (parametric version of the Recursion theorem) the sets $P=\text{Seq}(\mathbb{N})$, $A=\mathbb{N}$, $a: P \longrightarrow A$ given by $a(p)=0$ and $g: P \times A \times \mathbb{N} \longrightarrow A$ given by $g(p,m,n)=m+p(n)$ if $n < \text{len}(p)$ and $g(p,m,n)=0$ in any other case.
Then, this theorem gives us a unique function $f:P \times \mathbb{N} \longrightarrow A$ satisfying
(a) $f(p,0)=0$ for all $p \in P$
(b) $f(p,n+1) = g(p,f(p,n),n) = f(p,n) + p(n)$ if $n < \text{len}(p)$.
Now, if we define $\sum:\text{Seq}(\mathbb{N}) \longrightarrow \mathbb{N}$ as $\sum(p)= f(p,\text{len}(p))$ we can prove that it is the desired function.

*

*$\sum\langle \rangle = f(\langle \rangle,0)=0$

*$\sum\langle k_0 \rangle = f(\langle k_0 \rangle, 1) = f(\langle k_0 \rangle, 0+1) = f(\langle k_0 \rangle, 0) + k_0 = k_0$
For proving 3, we need the following lemma which can be easily proven by induction.
Lemma: Given $p, q \in \text{Seq}(\mathbb{N})$, if $n \leq \text{len}(q) < \text{len}(p)$ and $p(k)=q(k)$ for every $k<n$, then $f(p,n)=f(q,n)$.

*Using the lemma in the fourth equality we get
$$\sum\langle k_0, \cdots, k_{n+1} \rangle = f\left(\langle k_0, \cdots, k_{n+1} \rangle, n+2 \right)=f\left(\langle k_0, \cdots, k_{n+1} \rangle, (n+1)+1 \right)=f\left(\langle k_0, \cdots, k_{n+1} \rangle, n+1 \right)+k_{n+1}=f\left(\langle k_0, \cdots, k_{n} \rangle, n+1 \right)+k_{n+1}=\sum \langle k_0, \cdots, k_{n} \rangle + k_{n+1}$$
Proving that it is unique can be done in the same way as in Alphie's answer.


text:
Q: How to refactor a class that contains many listener inner classes? I am writing an android application that receives location updates and sends requests to a web service. The application has several activities and uses a local Service as a controller. The problem is that this 'controller' service is rapidly turning into a Blob/God anti-pattern. I'm trying to figure out the best way to refractor the code.
Nearly all of the functionality is asynchronous as the http client needs to run in a separate thread. Most of the method calls pass listeners to receive the response from the server. The location updates are also received via a listener. All of these listeners are currently implemented as inner classes in my Local Service.  I now have about 10 inner classes inside my Local Service. I don't see how i can move these listeners into separate classes as they need access to the state stored in the Service. I have tried implementing a singleton/observer hybrid class that handles all the state, receiving updates from each of the listeners then passing it on to any registered observers but this is not a good solution either as it has all the problems associated with global state and it is difficult to follow the flow of the program from one place to another. After re-writing, refactoring and re-writing again i am now totally confused and don't know what to do. Any advice?

A: Two thoughts. 1) This apparent event handling code bloat is hidden in MS Net IDE, and optionally in the Mac IDE, by collapsing the event handlers and providing a icon to expand the event code section. So I do not see the event handling code bloat and it does not bother me. Out of sight out of mind.
2) for Android 1.6+ you could refactor to XML attributes
<Button android:text="@string/get_plain_text_button"
android:id="@+id/ButtonPlainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick= "plainTextOnClickHandler">

that corresponds to the method:
public voidplainTextOnClickHandler(View v){
    editTextPlainText.setText("Plain Text Button Clicked");
}

JAL


text:
Q: Set attribute disabled for checkbox i want to show the checkbox disabled when either of the values are coming, but it is working only for one value.
<ui:inputCheckbox value="{!product.productSelection}" disabled="{!
 or(product.orderLineStatus == 'Cancelled', product.orderLineStatus ==
 'Rejected',product.orderLineStatus == 'Scheduled to Ship')}"/>


text:
Q: Proving that a certain function is well-defined I would like to know how I prove that the map
$$T:C([0,1])\rightarrow C^1([0,1])$$ $$(Tf)(s):=\int_0^sf(t)dt$$
is well-defined.
I suspect that proving $Ran(T)\subset C^1([0,1])$ would be enough. Is this true?
For this I would start with an $f\in Ran(T)$, i.e. of the form $f(s)=(Tg)(s)=\int_0^sg(t)dt$ for some $g\in C([0,1])$. How do I prove this is continuously differentiable though?
Help would be very welcome.

A: The fundamental theorem of calculus tells you that
$$
f'(s) = (Tg)' (s) = g(s).
$$

A: Well, there are theorems which tell you when $s\mapsto \int_0^s f(t) dt $ is differentiable. For continuous $f$ this happens to be true, and the derivative is known to be
$$ \frac{d}{ds}\int_0^s f(t) dt = f(s)$$
which is continuous by assumption.


text:
Q: Profile c++ program in perf I am Ubuntu 16.04 user.
For profiling c++ program I use perf tool. So I run:
perf record ./myprogram myprogram_args
perf report

Now as output I have:
  14,52%  CSim2Sim  libsimgrid.so.3.13.90  [.] lmm_solve
   4,40%  CSim2Sim  libsimgrid.so.3.13.90  [.] lmm_update_modified_set_rec
   4,05%  CSim2Sim  libc-2.23.so           [.] _int_malloc
   3,30%  CSim2Sim  libsimgrid.so.3.13.90  [.] simgrid::surf::Model::next_occuring_event_lazy
   2,19%  CSim2Sim  libc-2.23.so           [.] _int_free
........................................................................

I see only "depth" and library calls from my program. How can I get report from perf similar to this template? (something like this):
  4,52%  CSim2Sim  my_function1(int argc, char* argv[])
  3,52%  CSim2Sim  my_function2(int argc, char* argv[])
  3,52%  CSim2Sim  my_function3(int argc, char* argv[])
  1,52%  CSim2Sim  my_function4(int argc, char* argv[])

A: Going from perf over info:perf to Perf Wiki, and finally to Tutorial - Perf Wiki

Source level analysis with perf annotate
  ...
  perf annotate can generate sourcecode level information if the application is compiled with -ggdb. The following snippet shows the much more informative output for the same execution of noploop when compiled with this debugging information.

So compiling (and maybe linking?) with option -ggdb should do the trick.
Then you can use perf record to collect runtime information, and later analyze this with perf annotate.

I just found this answer to Alternatives to gprof [closed]. It recommends using gcc's option -fno-omit-frame-pointer, if you want to get call graph information. So, depending on what you want to achieve and your optimization level, you might need to add this option too.

A: I would also recommend using gprof(1). You'll compile your C (or C++) program by passing -pg  (probably also with -O....) to gcc  and/or g++  (perhaps change some CFLAGS or CXXFLAGS  in your Makefile ). Read about instrumentation options of GCC.


text:
Q: Не могу понять почему не выводит результат. Не пойму в чем ошибка i
Import java.util.ArrayList;
    import java.util.Arrays;

    public class Main {
        private static Employee[] employees = new Employee[10];
        private static Employee employee;

        public static void main(String[] args) {
            Employee[] employees = new Employee[10];
            Employee e1 = new Employee("Ольга", "Олеговна", "Спицына", 1, 200);
            Employee e2 = new Employee("Виктори", "Игоревна", "Матыш", 1, 100);
            Employee e3 = new Employee("Елена", "Ботсовна", "Бабич", 1, 300);
            Employee e4 = new Employee("Светлана", "Васильевна", "Берестнева", 1, 400);
            Employee e5 = new Employee("Алексадр", "Юрьевич", "Попов", 1, 500);
            Employee e6 = new Employee("Аллексей", "Иванович", "Иванов", 1, 600);
            Employee e7 = new Employee("Леонид", "Ботсович", "Евглевский", 1, 700);
            Employee e8 = new Employee("Ольга", "Ивановна", "Воз", 1, 800);
            Employee e9 = new Employee("Таитьяна", "Леонидовна", "Петрова", 1, 900);
            Employee e10 = new Employee("Дмитрий", "Александрович", "Решетников", 1, 50);

            employees[0] = e1;
            employees[1] = e2;
            employees[2] = e3;
            employees[3] = e4;
            employees[4] = e5;
            employees[5] = e6;
            employees[6] = e7;
            employees[7] = e8;
            employees[8] = e9;
            employees[9] = e10;

            ArrayList<Employee> e = new ArrayList<Employee>();

            for (Employee employee : employees) {
                System.out.println(employee);
            }
        }

        public static void Employees() {
            for (Employee employee : employees) {
                System.out.println(employee);
            }
        }

        public static void fullName() {
            for (Employee employee : employees) {
                System.out.println(employee.getSurname());
            }
        }

        public static int calculatorTotalSalary() {
            int sum = 0;
            for (Employee employee : employees) {
                sum += employee.getSalary();
            }
            return sum;
        }

        public static Employee minSalary() {
            Employee result = employees[0];
            int minimalSalary = employees[0].getSalary();
            for (Employee employee : employees) {
                if (employee.getSalary() < minimalSalary) {
                    minimalSalary = employee.getSalary();
                    result = employee;
                }
            }
            return result;
        }

        public static Employee maxSalary() {
            Employee result = employees[0];
            int maxSalary = employees[0].getSalary();`введите сюда код`
            for (Employee employee : employees) {
                if (employee.getSalary() > maxSalary) {
                    maxSalary = employee.getSalary();
                }
                result = employee;
            }
            return result;
        }

        public static float averageSalary() {
            return calculatorTotalSalary() / (float) employees.length;
        }

    }
public class Employee {
    private static int counter = 0;
    private final String name;
    private final String lastname;
    private final String surname;
    private int department;
    private int salary;
    private final Integer id;

    // Геттеры
    public String getName() {
        return name;
    }

    public String getLastname() {
        return lastname;
    }

    public String getSurname() {
        return surname;
    }

    public int getDepartment() {
        return department;
    }

    public int getSalary() {
        return salary;
    }

    public static int getCounter() {
        return counter;
    }

    public int getId() {
        return id;
    }
    // Сеттеры

    public void setDepartment(int department) {
        this.department = department;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public Employee(String name, String lastname, String surname, int department, int salary) {
        this.name = name;
        this.lastname = lastname;
        this.surname = surname;
        this.department = department;
        this.salary = salary;
        this.id = counter++;
    }

    @Override
    public String toString() {
        return "Employee{" + "name='" + name + '\'' + ", lastname='" + lastname + '\'' + ", surname='" + surname + '\'' + ", department=" + department + ", salary=" + salary + ", id=" + id + '}';
    }

    }

A: В вашем коде три ошибки:

*

*первый импорт у вас с заглавной буквы, пропишите его с маленькой буквы:      import java.util.ArrayList;

*в методе      public static Employee maxSalary()  у вас вставлен просто текст, без комментария, его надо удалить (введите сюда код)

*второй класс у вас с модификатором public, в одном файле у вас не может быть два класса с этимм модификатором, поэтому у класса      public class Employee  уберите модификатор:       class Employee


text:
Q: python: list modules within the package I have a package with a few modules, each module has a class (or a few classes) defined within it. I need to get the list of all modules within the package. Is there an API for this in python?
Here is the file structure:
\pkg\
\pkg\__init__.py
\pkg\module1.py -> defines Class1
\pkg\module2.py -> defines Class2
\pkg\module3.py -> defines Class3 and Class31

from within module1 I need to get the list of modules within pkg, and then import all the classes defined in these modules
Update 1:
Ok, after considering the answers and comments below I figured, that it's not that's easy to achieve my need. In order to have the code I proposed below working, all the modules should be explicitly imported beforehand.
So now the new concept:
How to get the list of modules within a package without loading the modules? Using python API, i.e. - without listing all the files in the package folder?
Thanks
ak

A: One ad-hoc approach is list the files in the directory, import each file dynamically with __import__ and then list the classes of the resulting module.

A: ok, this was actually pretty straightforward:
import pkg

sub_modules = (
    pkg.__dict__.get(a) for a in dir(pkg)
    if isinstance(
        pkg.__dict__.get(a), types.ModuleType
    )
)

for m in sub_modules:
    for c in (
        m.__dict__.get(a) for a in dir(m)
        if isinstance(m.__dict__.get(a), type(Base))
    ):
        """ c is what I needed """


text:
Q: Prompt Linux login has this < character instead of username@machine: I have a problem with my Linux device.
After the boot-up sometimes the shell show me only this < character, I can run normal shell commands like ls/cat etc, but it shows me only 1 character. When I'm doing an echo I can see all the row (so only the  input has the issue of 1 character).
This is the example of my terminal after I executed the pwd command:
<d
/home/root
<

At the boot-up the device ran many shell scripts, so at the begging I thought was some script that didn't finish, but if a script is stack, I shouldn't be able to run normal shell command (I think). It's happening around 10% of the boot-up. If I ran echo $PS1:
<1
\u@\h:\w\$
<
echo $PS2 : $PS3 : $PS4   =>   > : : +

It seems correct.
I could access by ssh and the system looks good, I tried to kill many service/process to check if the prompt will recover, but I can recover the system  if I write 'exit' in the prompt or I kill /bin/login -f  or kill -sh processes (it will show me the username@machine).
I tried control+D first time and it failed with <logout   There are stopped jobs. The second time I pressed control+D I logout and automatic login, login: root (automatic login) and now it's in a good state (root@device:~#)
Has someone any suggestion that I can try? Does someone know why there is that character? there is a way to see the last commands executed to try to understand how the device finished in that status?
I don't think is a problem of the terminal, because depends of the boot sometime work and sometime no.
I ran printf '%s\n' "$COLUMNS":

6

My TERM environment variable:

TERM =   @BAUDRATE@

And stty -a:
speed 115200 baud;
rows 13; columns 6;
line = 0;
intr = ^C;
quit = ^\;
erase = ^?;
kill = ^U;
eof = ^D;
eol = <undef>;
eol2 = <undef>;
swtch = <undef>;
start = ^Q;
stop = ^S;
susp = ^Z;
rprnt = ^R;
werase = ^W;
lnext = ^V;
flush = ^O;
min = 1; time = 0;
-parenb
-parodd
cs8
hupcl
-cstopb
cread
clocal
-crtscts
-ignbrk
-brkint
-ignpar
-parmrk
-inpck
-istrip
-inlcr
-igncr
icrnl
ixon
ixoff
-iuclc
-ixany
-imaxbel
iutf8
opost
-olcuc
-ocrnl
onlcr
-onocr
-onlret
-ofill
-ofdel
nl0
cr0
tab0
bs0
vt0
ff0
isig
icanon
-iexten
echo
echoe
echok
-echonl
-noflsh
-xcase
-tostop
-echoprt
echoctl
echoke


text:
Q: SSRS export to xlsx broken? I have reports which I'd like to render to excel using just a link. In order to do this, I have a page (web application, actually) which uses the ReportViewer to select the parameters and then intercepts the rendering phase using the following piece of code:

    protected void ReportViewer_SubmittingParameterValues(object sender, Microsoft.Reporting.WebForms.ReportParametersEventArgs e)
    {
        //
        if (e.AutoSubmit == false)
        {
            // Only when default no parameters are set
            ReportViewer.ServerReport.SetParameters(e.Parameters);
            Session["Output"] = ReportViewer.ServerReport.Render("EXCELOPENXML");
            DateTime rendertime = DateTime.Now.ToUniversalTime(); // get the current time so we can add the timestamp to the file name
            Session["Rendertime"] = rendertime.ToString("yyyy-MM-ddTHHmmss");
            e.Cancel = true;    // holds the rendering to the reportviewer webform element
        }
    }

and send this to the user later on.
However, while the rendering to the old Excel format (using ReportViewer.ServerReport.Render("Excel") ) worked great, the rendering to the newer EXCELOPENXML file format delivers a file which Excel 2013 says is damaged.
After I let Excel repair the file, I can't really see any difference in contents of the files, except for some difference in layout. However, I can't deliver a broken application, so I have to make it work. Users won't accept this output. We do need the newer file format because of the large number of rows our reports produce.
Does anyone know if this is a bug in the reportviewer, or is it somthing I'm doing wrong here? Does anyone know a fix?

A: The answer, in case you're also struggling with this, is that the maximum size of the session is limited and that the export didn't fit within the session variable.


text:
Q: find (i,j) location of closest (long,lat) values in a 2D array I have multiple 2D arrays, three of which are LONG, LAT and HEIGHT. I would like to determine the closest index in these 2D arrays for a given (long,lat).
So, within my 2D HEIGHT array, what is the index of (-43.5,45)?

A: A few foolish minutes later; I have worked out an answer I believe sufficient:
a = abs( LAT-chosen_lat ) + abs( LONG-chosen_lon )

i,j = np_unravel_index(a.argmin(), a.shape)


text:
Q: Difference between passing function and the () => {} in express What is the difference between these two? Only (1) is working and (2) is stuck in the browser;
(1) app.get('/source*', createProxyMiddleware({ target: serviceProvider}))
(2) app.get('/source*', () => {
  createProxyMiddleware({ target: serviceProvider})
})

A: createProxyMiddleware({ target: serviceProvider})

this returns a function that is yet to be excuted with the parameters from express middleware.
to make second example to work, you will simply need to excute the returned function as following
2) app.get('/source*', (req, res, next) => {
  const func = createProxyMiddleware({ target: serviceProvider});
  func(req, res, next);
})

A: in option (2) you placed createProxyMiddleware({ target: serviceProvider}) INSIDE a function that doesn't handle the request nor returns a method that does.
() => {} is a shorthand for writing :
function()  {}
so in essence, the code in option (2) is the same as  :
app.get('/source*', function () {
  createProxyMiddleware({ target: serviceProvider})
});

and basically your own function took over as the renderer.
I haven't tried it yet, but consider trying to return createProxyMiddleware({ target: serviceProvider}) from your function.
Example:
app.get('/source*',  () =>  {
  // do here whatever you planned on doing inside your function before returning the renderer

  return createProxyMiddleware({ target: serviceProvider});
});

A: try :
app.get('/source*', (req,res,next) => {
  try {
    createProxyMiddleware({ target: serviceProvider})
  }
  catch(error) {
    next(error)
}
})

A: That second argument for get needs to match argument signature  (request, response, next), which is the signature for any middleware in express, including an endpoint controller. https://expressjs.com/en/guide/using-middleware.html
1 creates a standard middleware function that is correct.
2 doesnt return anything, doesn't return anything on the response, and doesn't  call "next()" to move onto the next request middleware.
Hope that helps. I'm answering from my phone.

A: Let's assume for a second that the createProxyMiddelware function returns the value "hello". Then we could re-write your two scnearios like this:
1. app.get('/source*', "hello")
2. app.get('/source*', () => "hello")

So you can see the difference now. In the first scenario, you are evaluating the createProxyMiddleware function. In the second case, the second argument is a callback function, which, when invoked, will call the createProxyMiddelware function


text:
Q: How to check if element of class array is empty? Originally I did
entity * Ptr[8] = { NULL, };

But when I bring  Ptr to another function by reference using
updateMap(&mapGrid, Ptr); //and
void updateMap(map * mapGridU, entity * entityPtr) //then
if (entityPtr[i] != NULL)// gives an error

It says no operator "!=" matches these operands of entity and int

A: The subscript operator indirects the pointer operand. The result is the value pointed by the pointer incremented by the integer operand.
Since entityPtr is entity *, it points to an entity object. Therefore the entityPtr[i] operation results in an lvalue of type entity. Since you're comparing that entity object with NULL, there must be an inequality operator that can take a entity and a pointer constant NULL as arguments. Your errors says that no such operator exists.
I suspect that your intention was something other than to compare the pointed entity object to NULL. My suspicion is that you intended to compare some pointer to NULL instead.


text:
Q: Sliding captions not working Im using a pure css sliding caption for one of my pages. The intention is for the whole caption to slide out from the right to left when the image is hovered over.
However, it doesnt seem to be working. I based my code on http://www.hongkiat.com/blog/css3-image-captions/ ,so that the fullwidth image will have a caption. It is the "programmesimages" and "programmesimagescaption" classes.

    * {
 margin: 0px;
 padding: 0px;
}
body{
 background: url(../images/subtle_white_mini_waves.png) repeat;
}
#wrapper{
 width:1180px;
 margin: 0 auto;
 overflow: hidden;
 position: relative;
}
#programmescontent{
 position:relative;
 width:100%;
 height:1000px;
 background:#333;
 z-index:-50;
 margin-top:-73px;
}
.programmesimages{
 position:relative;
 width:100%;
 height:600px;
 background:#fff;
 overflow:hidden;
}
.programmesimages img{
 position: absolute;
    left: 0;
    -webkit-transition: all 300ms ease-out;
    -moz-transition: all 300ms ease-out;
    -o-transition: all 300ms ease-out;
    -ms-transition: all 300ms ease-out;
    transition: all 300ms ease-out;
}
.programmesimagescaption{
 background-color:#CF0;
    position: absolute;
    color: #fff;
    z-index: 100;
    -webkit-transition: all 300ms ease-out;
    -moz-transition: all 300ms ease-out;
    -o-transition: all 300ms ease-out;
    -ms-transition: all 300ms ease-out;
    transition: all 300ms ease-out;
 width:1180px;
 height:600px;
 left:1180px;
}
.programmesimages:hover .programmesimagescaption{
 -moz-transform: translateX(-100%);
   -o-transform: translateX(-100%);
   -webkit-transform: translateX(-100%);
   opacity: 1;
   transform: translateX(-100%);
}
.programmesimages:hover img{
 -moz-transform: translateX(-100%);
  -o-transform: translateX(-100%);
  -webkit-transform: translateX(-100%);
   transform: translateX(-100%);
}

Caption


text:
Q: Variance of a difference in estimated proportions with trivariate discrete distributions Let a multivariate distribution be given by $P(Y,S_1,S_2)$, where all three variables are discrete, $Y$ is multivalued, $S_1=(0,1)$ and $S_2=(0,1)$, respectively, and all may be dependent. Define the quantity $X$ as
$$X=E(Y=y|S_1=1)-E(Y=y|S_2=1).$$
I estimate X by
$$\bar{x}=\frac{1}{\sum _{i=1}^{n}S_{1i}}\sum _{i=1}^{n} I(Y_i=y)S_{1i}-\frac{1}{\sum _{i=1}^{n}S_{2i}}\sum _{i=1}^{n} I(Y_i=y)S_{2i},$$
where $I$ is the indicator function and the sum is taken over a sample of size $n$, where $i=1,..,n$. Now find the variance of $\bar{x}$, $Var(\bar{x})$, in order to finally arrive at a s.e. estimate.
I would be thankful for any advice on how to approach this problem or a solution.


text:
Q: Offline Repository `sudo apt update fails` with cannot file icon 64x64 error I created an offline repository for Ubuntu 20.04 using the instructions provided in this link as it is. No changes there.
But, I create the sources.list file using file:/// notation instead of http:// notation, which gave me the following errors
Note: I have omitted some lines in the output because of SO restrictions, but I guess the question maintains it's essence and meaning.
File Notation
File: sources.list
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal main restricted
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates main restricted
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal universe
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates universe
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal multiverse
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates multiverse
deb file:///var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-backports main restricted universe multiverse

Output:
Get: 1 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal InRelease [265 kB]
Get: 2 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal InRelease [265 kB]
Get: 3 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates InRelease [111 kB]

Get: 10 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata

Get: 13 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted Translation-en [6,212 B]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted Translation-en

Get: 23 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 Packages [970 kB]
Get: 24 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 25 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main Translation-en [506 kB]
Get: 26 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata [29.5 kB]
Get: 27 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages [8,112 B]
Get: 28 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted amd64 Packages [22.0 kB]
Get: 29 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted Translation-en [6,212 B]
Get: 30 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted amd64 c-n-f Metadata [392 B]
Get: 31 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 Packages [8,628 kB]
Get: 32 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages [4,642 kB]
Get: 33 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe Translation-en [5,124 kB]

Get: 36 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse amd64 Packages [144 kB]
Get: 37 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse Translation-en [104 kB]
Get: 38 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse amd64 c-n-f Metadata [9,136 B]
Get: 39 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [930 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages

Get: 60 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata [1,179 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata
Get: 61 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse i386 Packages [88.9 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse i386 Packages
Get: 62 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse amd64 c-n-f Metadata [32.3 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse amd64 c-n-f Metadata
Get: 63 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [930 kB]
Get: 64 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata [111 kB]
Err file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata
  File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal/main/cnf/Commands-amd64 (2: No such file or directory)
Get: 65 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages [10.1 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages
Get: 66 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main i386 Packages [196 kB]
Get: 67 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 Packages [326 kB]
Get: 68 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main Translation-en [123 kB]

Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted amd64 c-n-f Metadata
Get: 86 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe i386 Packages [103 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe i386 Packages
Get: 87 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 c-n-f Metadata [19.6 kB]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 c-n-f Metadata

Get: 89 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse amd64 c-n-f Metadata [1,555 B]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse amd64 c-n-f Metadata
Get: 90 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main i386 Packages [248 kB]
Get: 91 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 c-n-f Metadata [29.9 kB]
Err file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 c-n-f Metadata
  File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-updates/main/cnf/Commands-amd64 (2: No such file or directory)
...
Get: 111 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/multiverse amd64 c-n-f Metadata [59 B]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/multiverse amd64 c-n-f Metadata
Get: 112 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/main amd64 c-n-f Metadata [53 B]
Err file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/main amd64 c-n-f Metadata
  File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-backports/main/cnf/Commands-amd64 (2: No such file or directory)
Get: 113 file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/restricted amd64 c-n-f Metadata [59 B]
Ign file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/restricted amd64 c-n-f Metadata
Err http://security.ubuntu.com/ubuntu focal-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease: Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable)
W: Failed to fetch file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal/main/cnf/Commands-amd64: File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal/main/cnf/Commands-amd64 (2: No such file or directory)
W: Failed to fetch file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-updates/main/cnf/Commands-amd64: File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-updates/main/cnf/Commands-amd64 (2: No such file or directory)
W: Failed to fetch file:/var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-backports/main/cnf/Commands-amd64: File not found - /var/www/html/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-backports/main/cnf/Commands-amd64 (2: No such file or directory)
W: Some index files failed to download. They have been ignored, or old ones used instead.`

and

When I tried with http://, I tried full address and local address
Static IP [Internet IP]
IP changed from the actual value.
I get that the address was not found.
File: sources.list
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal main restricted
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates main restricted
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal universe
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates universe
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal multiverse
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates multiverse
deb http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-backports main restricted universe multiverse

Output is:
Get: 1 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal InRelease [265 kB]

Get: 5 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 6 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 7 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Err http://security.ubuntu.com/ubuntu focal-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
Get: 8 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 9 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 10 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 11 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 12 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Get: 13 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [718 kB]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata
Get: 14 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages [8,112 B]
Get: 15 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages [8,112 B]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted amd64 c-n-f Metadata
Get: 16 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages [4,642 kB]
Get: 17 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages [4,642 kB]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages
Get: 18 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata [265 kB]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata
Get: 19 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse i386 Packages [74.7 kB]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted amd64 c-n-f Metadata

Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 c-n-f Metadata

Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse amd64 c-n-f Metadata
Get: 20 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages [930 kB]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main i386 Packages

Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/main amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe i386 Packages
Get: 21 http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe Translation-en [1,448 B]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe amd64 c-n-f Metadata

Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse amd64 c-n-f Metadata
Err http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/main amd64 c-n-f Metadata
  404  Not Found [IP: 154.11.35.52 80]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal/multiverse i386 Packages
Err http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/main amd64 c-n-f Metadata
  404  Not Found [IP: 154.11.35.52 80]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates/multiverse amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/main amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/multiverse amd64 c-n-f Metadata
Err http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/main amd64 c-n-f Metadata
  404  Not Found [IP: 154.11.35.52 80]
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/restricted amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe i386 Packages
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/universe amd64 c-n-f Metadata
Ign http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports/multiverse amd64 c-n-f Metadata
Fetched 475 kB in 0s (1,044 kB/s)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease: Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
W: Failed to fetch http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal/main/cnf/Commands-amd64: 404  Not Found [IP: 154.11.35.52 80]
W: Failed to fetch http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-updates/main/cnf/Commands-amd64: 404  Not Found [IP: 154.11.35.52 80]
W: Failed to fetch http://154.11.35.52/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-backports/main/cnf/Commands-amd64: 404  Not Found [IP: 154.11.35.52 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

Static IP local/loopback
I get the following,
File: sources.list
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal main restricted
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates main restricted
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal universe
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates universe
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal multiverse
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-updates multiverse
deb http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/ focal-backports main restricted universe multiverse

The output is
  Could not connect to 10.0.0.1:80 (10.0.0.1). - connect (111: Connection refused)
Err http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-updates InRelease
  Unable to connect to 10.0.0.1:http:
Err http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu focal-backports InRelease
  Unable to connect to 10.0.0.1:http:
Err http://security.ubuntu.com/ubuntu focal-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
W: Failed to fetch http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal/InRelease: Could not connect to 10.0.0.1:80 (10.0.0.1). - connect (111: Connection refused)
W: Failed to fetch http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-updates/InRelease: Unable to connect to 10.0.0.1:http:
W: Failed to fetch http://10.0.0.1/ubuntu/mirror/mirrors.piconets.webwerks.in/ubuntu-mirror/ubuntu/dists/focal-backports/InRelease: Unable to connect to 10.0.0.1:http:
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease: Could not connect to security.ubuntu.com:80 (91.189.88.142). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.88.152). - connect (111: Connection refused) Cannot initiate the connection to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable)
W: Some index files failed to download. They have been ignored, or old ones used instead.

The error is a lot smaller, that is the number of repositories read is also seems to be smaller.
How do I make the apt-mirror repository work as an offline repository for the system itsself and make it as a server for Intranet connection systems. (i.e., it will have a local IP)

Edit:
https://github.com/apt-mirror/apt-mirror/issues/113
This link seems to have a relevant discussion, but I don't know if it is solving the problem.

This seems like a huge issue:
https://gist.github.com/benjaoming/28b8ddc9f0ee6ef74d113625bd667d90
https://codereview.qt-project.org/c/qt/qt5/+/281447
How do I disable fetching of DEP-11 files
https://bugreports.qt.io/browse/QTQAINFRA-3351
https://github.com/apt-mirror/apt-mirror/issues/113

I tried this: https://github.com/apt-mirror/apt-mirror/pull/103

Other solutions, won't fix my problem, but available.
https://github.com/flavienbwk/debmirror
https://github.com/flavienbwk/apt-mirror-docker
I don't know how to use them.


text:
Q: Works in terminal but not in VS code I have a problem that just drives me crazy. I have a python script, that works when I run it in the terminal (ubuntu) but not in vscode.
The terminal code is just:
python helper.py
and the helper.py looks as follows:
from pynput.keyboard import Key, Controller
from pynput.keyboard import Listener

def on_press(key):
    print('{0} pressed'.format(
        key))

def on_release(key):
    print('{0} release'.format(
        key))
    if key == Key.esc:
        # Stop listener
        return False

# Collect events until released
with Listener(
        on_press=on_press,
        on_release=on_release) as listener:
    listener.join()

When I run it in the terminal it works fine, but in vscode it says
Traceback (most recent call last):
  File "/home/paul/Programming/statFit2/helper.py", line 1, in <module>
    from pynput.keyboard import Key, Controller
  File "/home/paul/anaconda3/lib/python3.7/site-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/home/paul/anaconda3/lib/python3.7/site-packages/pynput/keyboard/__init__.py", line 52, in <module>
    from ._xorg import KeyCode, Key, Controller, Listener
  File "/home/paul/anaconda3/lib/python3.7/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
    from pynput._util.xorg import (
  File "/home/paul/anaconda3/lib/python3.7/site-packages/pynput/_util/xorg.py", line 40, in <module>
    _check()
  File "/home/paul/anaconda3/lib/python3.7/site-packages/pynput/_util/xorg.py", line 38, in _check
    display = Xlib.display.Display()
  File "/home/paul/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/home/paul/anaconda3/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/home/paul/anaconda3/lib/python3.7/site-packages/Xlib/protocol/display.py", line 84, in __init__
    name, protocol, host, displayno, screenno = connect.get_display(display)
  File "/home/paul/anaconda3/lib/python3.7/site-packages/Xlib/support/connect.py", line 73, in get_display
    return mod.get_display(display)
  File "/home/paul/anaconda3/lib/python3.7/site-packages/Xlib/support/unix_connect.py", line 76, in get_display
    raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""

Its just one of those things that really don't make sense to me and which really want to make me just quit programming.

A: I understand that you are trying to write a script using Python and that if you run it with Terminal it works but if you run it inside the VS Editor it doesn't work! If this is what you say, there can be a difference in the default version that works on the terminal, and between the one that works on the VS, it may be the one that works on the terminal python 3, and the one that works in the editor is python 2.
I prefer that you try the development on the spyder program for python
You can install it by using this command :
sudo apt update && sudo apt install spyder && sudo pip install spyder
and you need add this line in start script
if you typing python 2  add "#!/bin/python2"
if you typing python 3  add "#!/bin/python3"
To tell bash what is version of python you need  to run
and Keep you learning bro


text:
Q: adding /std:c++17 to languages gives: Element  has an invalid value of /std:c++17 i added std:c++17 to the language option in
Project Options -> C/C++ -> Languages -> C++ language standard

and got the error: Element  has an invalid value of /std:c++17
it is the only error and i'm using vs 2017


text:
Q: Import Hyper-V guest when it wasn't gracefully exported? The export/import story provided by Hyper-V by default seems to be rather restrictive.
What if the Host A has a hardware failure? I will want to transplant the hard disks where the VHDs and config files reside into Host B, right?
But then there is seemingly no way to get those guests loaded back into the Hyper-V management console. The import tool just barfs when directed to the files.
Is this a joke or am I missing something?

A: Agreed. It's easier to just create a new VM, and mount the old guest's VHDs to the new VM.


text:
Q: Bash command to compress folder(s) with a password How can I compress two folders into archive file (zip, gzip or something like that) with a password on the files?
For example I have folder structure:

*

*rootDir

*

*dir1

*dir2

*dir3

*dir4

I need bash command to add dir2 and dir4 to same archive file compressed with a password on it.

A: zip -er filename.zip dir2 dir4
The zip command is widely available; if not on your system, look for a zip package or similar.
The -e flag specifies encryption is to be used on the zipfile; you'll be prompted for a password.
The -r flag specifies recursion; all the files in dir2 and dir4 will be included.
The resulting zipped, encrypted file containing dir2 and dir4 will be placed at filename.zip.

A: Compress with your favorite unix command (mine is 'tar cfj' for a BZip2 tarball).
Then encrypt with bcrypt.

Bcrypt is a cross platform file encryption utility.

But, they say bcrypt is no longer safe (! ;-)),
Well, change to TrueCrypt (it too is cross platform -- easycrypt).
Tip: Encryption after compression makes life much more interesting.


text:
Q: Class Reflection : Missing Properties I'm trying to get all properties of a Class using Reflection, but some properties are still messing.
Here a small exemple of what happens in my code
Class Test {
    public $a = 'a';
    protected $b = 'b';
    private $c = 'c';
}

$test = new Test();
$test->foo = "bar";

So at this point my $test object has 4 properties (a, b, c and foo).
The foo property is considered as a public property because I can do
echo $test->foo; // Gives : bar

On the contrary b or c are considered as private properties
echo $test->b; // Gives : Cannot access protected property Test::$b
echo $test->c; // Gives : Cannot access private property Test::$c

I tried two solutions to get all properties (a, b, c and foo) of my $test object
The first
var_dump(get_object_vars($test));

Which gives
array (size=2)
    'a' => string 'a' (length=1)
    'foo' => string 'bar' (length=3)

And the second solution
$reflection = new ReflectionClass($test);
$properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PRIVATE | ReflectionProperty::IS_PROTECTED);
foreach($properties as $property) {
    echo $property->__toString()."<br>";
}

Which gives
Property [ public $a ]
Property [ protected $b ]
Property [ private $c ]

In the first case, private properties are missing, and in the second case "after instantiation" properties are missing.
No idea of what can I do to get all properties ?
(preferably with Reflection, because I also want to know if a property is public, private...)

A: Use ReflectionObject instead of ReflectionClass if you also need to list dynamically created object properties:
$test = new Test();
$test->foo = "bar";

$class = new ReflectionObject($test);
foreach($class->getProperties() as $p) {
    $p->setAccessible(true);
    echo $p->getName() . ' => ' . $p->getValue($test) . PHP_EOL;
}

Note that I've used ReflectionProperty::setAccessible(true) in order to access the value of protected or private properties.
Output:
a => a
b => b
c => c
foo => bar

Demo


text:
Q: Bad state: add(NextMonthCalendar) was called without a registered event handler. Make sure to register a handler by((event, emit) How can I migrate to flutter_bloc latest version?
I am facing this error
════════ Exception caught by gesture ═══════════════════════════════════════════
Bad state: add(NextMonthCalendar) was called without a registered event handler.
Make sure to register a handler via on((event, emit) {...})
here is my code it was built on flutter_bloc before version  5.0
import 'package:equatable/equatable.dart';
import 'package:abushakir/abushakir.dart';

abstract class CalendarEvent extends Equatable {
  const CalendarEvent();

  @override
  List<Object> get props => [];
}

class TodaysCalendar extends CalendarEvent {
  final ETC currentMonth;

  const TodaysCalendar(this.currentMonth);

  @override
  List<Object> get props => [currentMonth];

  @override
  String toString() => "Today's Calendar { Calendar: $currentMonth }";
}

class NextMonthCalendar extends CalendarEvent {
  final ETC currentMonth;

  const NextMonthCalendar(this.currentMonth);

  @override
  List<Object> get props => [currentMonth.nextMonth];

  @override
  String toString() =>
      "Next Month's Calendar { Calendar: ${currentMonth.nextMonth} }";
}

class PrevMonthCalendar extends CalendarEvent {
  final ETC currentMonth;

  const PrevMonthCalendar(this.currentMonth);

  @override
  List<Object> get props => [currentMonth.prevMonth];

  @override
  String toString() =>
      "Previous Month's Calendar { Calendar: ${currentMonth.prevMonth} }";
}


text:
Q: When I am Installing "STRINGSIFTER", I am getting errors When I am trying to install STRINGSIFTER, I am getting the following two errors:

*

*Building wheel for fasttext (setup.py) ... error

*Running setup.py install for fasttext ... error

For more details, see this picture: https://drive.google.com/file/d/1eNYL9ncG9emJuHSWJ-ILakI-NYzuKe-1/view?usp=sharing
link for the STRINGSIFTER: https://github.com/fireeye/stringsifter

A: You need Visual C++ installed - the error message says explicitly that.
Using text rather than an image would make it easier to see what your problem is.


text:
Q: RegEx to match string between two strings in Powershell Here is my sample data:

Option failonnomatch on
  Option batch on
  Option confirm Off
  open sftp://username:password@host.name.net:22 hostkey="ssh-rsa 1024
  00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
get File*.txt \local\path\Client\File.txt
  mv File*.txt  /remote/archive/
close
  exit

I would like to create a powershell script to extract pieces of information out of this text file.
List of items I need:

*

*Username

*Password

*Host

*Port

*ssh key

*File Name

*Local Path

*Remote Path

I'm hoping that if I learn how to do a couple of these, the method will be applicable to all items. I attempted to extract the ssh key with the following powershell/regex:
$doc -match '(?<=hostkey=")(.*)(?=")'

$doc being the sample data
but it appears to be returning the whole line. Any help would be greatly appreciated. Thank you.

A: If -match is returning a whole line, the implication is that the LHS of your -match operation is an array, which in turn suggests that you used Get-Content without -Raw, which yields the input as an array of lines, in which case -match acts as a filter.
Instead, read your file as a single, multi-line string with Get-Content -Raw; with a scalar LHS, -match then returns a [bool], and the results of the matching operation are reported in automatic variable $Matches (a hashtable whose 0 entry contains the overall match, 1 what the 1st capture group matched, ...):
# Read file as a whole, into a single, multi-line string.
$doc = Get-Content -Raw file.txt

if ($doc -match '(?<=hostkey=")(.*)(?=")') {
   # Output what the 1st capture group captured
   $Matches[1]
}

With your sample input, the above yields
ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

You can then extend the approach to capture multiple tokens, in which case I suggest using named capture groups ((?<name>...)); the following example uses such named capture groups to extract several of the tokens of interest:
if ($doc -match '(?<=sftp://)(?<username>[^:]+):(?<password>[^@]+)@(?<host>[^:]+)'){
  # Output the named capture-group values.
  # Note that index notation (['username']) and property
  # notation (.username) can be used interchangeably.
  $Matches.username
  $Matches.password
  $Matches.host
}

With your sample input, the above yields:
username
password
host.name.net

You can extend the above to capture all tokens of interest.
Note that . by default doesn't match \n (newline) characters.

Optional reading: Using the x (IgnoreWhiteSpace) option to make regexes more readable:
Extracting that many tokens can result in a complex regex that is hard to read, in which case the x (IgnoreWhiteSpace) regex option, can help (as an inline option, (?x) at the start of the regex):
if ($doc -match '(?x)
    (?<=sftp://)(?<username>[^:]+)
    :(?<password>[^@]+)
    @(?<host>[^:]+)
    :(?<port>\d+)
    \s+hostkey="(?<sshkey>.+?)"
    \n+get\ File\*\.txt\ (?<localpath>.+)
    \nmv\ File\*\.txt\ (?<remotepath>.+)
  '){
    # Output the named capture-group values.
    $Matches.GetEnumerator() | ? Key -ne 0
}

Note how the whitespace used for making the regex more readable (spreading it across multiple lines) is ignored while matching, whereas whitespace to be matched in the input must be escaped (e.g., to match a single space, \  or [ ], or \s to match any whitespace char.)
With your sample input, the above yields the following:
Name                           Value
----                           -----
host                           host.name.net
localpath                      \local\path\Client\File.txt
port                           22
sshkey                         ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
remotepath                     /remote/archive/
password                       password
username                       username

Note that the reason the capture groups are out of order is that $Matches is a hash table (of type [hashtable]), whose key enumeration order is an implementation artifact: no particular enumeration order is guaranteed.
However, random access to capture groups works just fine; e.g., $Matches.port will return 22.

A: this uses named matches with flags set to singleline, multiline, case insensitive and then uses $Matches.MatchName to get the items into a custom object.
# fake reading in a text file as one string
#    in real life, use Get-Content -Raw
$InStuff = @'
open sftp://username:password@host.name.net:22 hostkey="ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"

get File*.txt \SERVER\Path\Client\File.txt
'@

$Null = $InStuff -match '(?smi).+//(?<UserName>.+):(?<Password>.+)@(?<HostName>.+):(?<Port>.+) hostkey="(?<SshKey>.+)".+get .+ (?<FullFileName>\\.+)$'

[PSCustomObject]@{
    UserName = $Matches.UserName
    Password = $Matches.Password
    Port = $Matches.Port
    SshKey = $Matches.SshKey
    PathName = Split-Path -Path $Matches.FullFileName -Parent
    FileName = Split-Path -Path $Matches.FullFileName -Leaf
    }

output ...
UserName : username
Password : password
Port     : 22
SshKey   : ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
PathName : \SERVER\Path\Client
FileName : File.txt


text:
Q: How to close or end an app without the operating system telling me that the event has happened? I have tried the following ways to finalize an application that is made in android studio:
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
System.exit(0);

All works, but the operating system shows me a message saying that the application has stopped and there is a button that says "restart application"
Is there a way to avoid that?

A: Did you tried ?
this.finishAffinity();
or
finishAndRemoveTask ();

Use System.exit(0); is a bad solution to finish an App.


text:
Q: Total digits number of $2^{1971}$ and $5^{1971}$ I think this is very interesting question. I'm trying to solve this problem for 3 hours. But now I accept the defeat...

Question:
$2^{1971}$ and $5^{1971}$  numbers are consistently (continuously) written. Find the total digits.

A: Let there is $k$ digit in $2^{1971}$ and there is $m$ digit in $5^{1971}$.
We must find $k+m$.
Given:
$$10^{k-1}<2^{1971}<10^{k}$$
$$10^{m-1}<5^{1971}<10^{m}$$
The above two relations imply:
$$10^{k+m-2}<10^{1971}<10^{k+m}$$
Finally, $k+m-1=1971 \Rightarrow k+m=1972$
Answer: $1972$ digits are written.

A: Let's take the base-10 logarithm of $2^{1971}$.
This is equal to $1971\log2$.
We have that $\log 2 = 0.30103$, so $1971\log 2 = 593.33$
So our number is $10^{593.33}$. We know that $10^{6}<x<10^{7}$ has $7$ digits.
Using that logic, this number has exactly $\boxed{594}$ digits.
Similarly, we rewrite $5^{1971}$ as $1971 \log 5 = 1377.67$, which has $
\boxed{1378}$ digits.
So $594+1378=\boxed{1972}$ digits.


text:
Q: Override Vuetify SASS variables Should I import the minified .css file when trying to override SASS variables ?
I followed this https://vuetifyjs.com/en/getting-started/installation/#webpack-install
// src/plugins/vuetify.js

import Vue from 'vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'

Vue.use(Vuetify)

const opts = {}

export default new Vuetify(opts)

And now I'm trying to override $body-font-family with no success, I've tried creating a variables.scss file and also tried overriding it in my main .scss file but I wonder if I should be importing the minified version like that or if I need to do something different ?

A: To override vuetify variables, just create a directory inside your src named scss and in there create a file called variables.scss
Inside that file you can change variables without importing anything.
For example my variables.scss
$container-max-widths: (
  md: 100%,
  lg: 1200px,
  xl: 1200px
);

$btn-text-transform: none;

$dialog-card-subtitle-padding: 0 56px 20px;
$dialog-card-title-padding: 36px 56px 10px;
$dialog-card-actions-padding: 8px 56px 36px;
$dialog-card-text-padding:0 56px 20px;


text:
Q: Someone reads to me vs someone reads for me what is the difference in the meaning between the following two sentences:

Someone reads to me.
Someone reads for me.

I think first sentence means someone reads something aloud for me or someone reads something so that I listen to him/ someone reads something and the destination of listening to him is me, And the second sentence means someone reads something for my sake. Am I on the right track ?

A: I'd say you're on the right track. The first phrase – reads to me – is very common for read-aloud situations.

Every day in fourth grade, our teacher read to us.

The second wording – reads for me – is less idiomatic and subject to interpretation. I'd interpret it to mean reading something so that you don't have to. It's an uncommon situation, but I can think of a few places one might say that. For example:

I couldn't understand all that legalese in the contract, so I had my lawyer read it for me.

The presumption would be that the lawyer would discuss any parts of the contract that might prevent me from signing it.


text:
Q: Pass php array to ajax I have this array:
    $users = array();
// Finally, loop over the results
foreach( $select as $email => $ip )
{
    $users[$email] = $ip;
}

Now i want to pass this array to ajax and print in another script:
$html="Check users for spam";

mcheck.php
echo $_POST['users'];

This code does not work. How can i do this?

A: The Best way is to encode array into JSON format.
In PHP:
$users_json = json_encode($users);

// To decode in javascript
var obj = JSON.parse(json_str);

A: As Sergiu Costas pointer out, the best way is to JSON encode it and then decode, but you can also try:
$html=" $users)) . "', success: function(data){ $('#results').html(data);}});\">Check users for spam";

If your $users array is:
$users = array( array('email' => 'a@email.com'), array('email' => 'b@email.com')));

then http_build_query('users' => $users) will generate:
users%5B0%5D%5Bemail%5D=a%40email.com&users%5B1%5D%5Bemail%5D=b%40email.com

which is the url-encoded version of:
 users[0][email]=a@email.com&users[1][email]=b@email.com

which will be decoded back to array in mcheck.php

A: if u want to pass php array to js you can json_encode the array to do that.
$html="Check users for spam";


text:
Q: How to run a Rspec scenario with multiple tags? I am using ruby client for web automation with selenium. I am running them parallel using parallel_rspec. I want to run the tests which has smoke and ae tags set.
My scenarios looks like:
scenario 'Test1', :smoke, :regression, :ae do
  "do something"
end

scenario 'Test2', :smoke, :bh do
  "do something"
end

scenario 'Test3', :smoke, :ae, :bh do
  "do something"
end

I am executing them like:
parallel_rspec spec/**/*_spec.rb -o '--tag smoke --tag ae --format progress --format ParallelTests::RSpec::RuntimeLogger --out tmp/parallel_runtime_rspec.log -f json -o tmp/AE/run$TEST_ENV_NUMBER.json' -n 3

But I found it does not pick the right candidates for run Test1 and Test3. my goal is to run only the tests which has tag smoke and ae.
Please suggest if you have done something similar to it.

A: You are looking for the propositional logic which combines the two (AND). In most runners this the space character as you've put.
Try just running `rspec . --tag smoke --tag ae and then go from there with your debugging.


text:
Q: How to listen for mspc messages and run an api server with actix rust? I am new to rust, just trying to figure out how to listen for mspc messages and run an API server with actix. Currently, the code stops in tokio::spawn which makes sense, not sure what is the right way to implement it.
My code:
#[actix_web::main]
async fn main() -> std::io::Result<()>  {
    let (tx, mut rx): (Sender<Message>, Receiver<Message>) = channel(30);
    let db_client = utils::connection::init()
        .await
        .expect("Failed to connect to DB");

    let _ = tokio::spawn(async move {
        while let Some(msg) = rx.recv().await {
            match msg.msg_type {
                Done => {
                    // Start again
                    println!("Start the task again")
                }
            }
        }
    })
    .await;

    println!("{}", "Server started! 8080");
    HttpServer::new(move || {
        App::new()
            .app_data(web::Data::new(db_client.postgres.clone()))
            .service(sample_api)
    })
    .bind(("127.0.0.1", 8080))?
    .run()
    .await
}

A: When you .await the result of spawn(), you wait for the spawned task to complete. But it runs infinitely, and by waiting for it you block the code that should send data to rx - so a deadblock.
Remove the .await from it.


text:
Q: How to read at least N bytes in Go How do you ensure you get at least n bytes when reading from a file in Go? The function seems to return the number of bytes you got, but I would rather just wait until more bytes are available. Is this possible without doing a bunch of manual plumbing?

A: Use io.ReadAtLeast() function: http://golang.org/pkg/io/#ReadAtLeast


text:
Q: how can i do to give background color to the headers using alasql? what is the right key word to give the header a bgcolor ?
window.exportExcel =     function exportExcel(listPersone) {
                var fileName=prompt();
                var opts = {
                  headers:true,
                  style:'background:#00FF00', //doesn't work
                  column: {style:{Font:{Bold:"1"}}},
                  rows: {1:{style:{Font:{Color:"#FF0077"}}}},
                  cells: {1:{1:{
                    style: {Font:{Color:"#00FFFF"}}
                  }}}
                };
                alasql('SELECT * INTO XLSXML("'+fileName+'.xls",?) FROM ?',[opts,listPersone ]);
}
example

A: this is the solution to give the header a background color !
var opts = {
              headers:true,
              column: {
                  style:{
                      Font:{
                          Bold:"1",
                          Color:"#3C3741",
                      },
                      Alignment:{
                          Horizontal:"Center"
                      },
                      Interior:{
                          Color:"#7CEECE",
                          Pattern:"Solid"
                      }
                  },
              },


text:
Q: Can't create selenium.NewRemote I need to use selenium in the Golang, I use the example from the repository https://github.com/tebeka/selenium
The "vender" directory with Selenium file and Driver file was added to the root directory of the project.
My code:
package main

import (
    "fmt"
    "os"
    "strings"
    "time"

    "github.com/tebeka/selenium"
)

func main() {
    // Start a Selenium WebDriver server instance (if one is not already
    // running).
    const (
        // These paths will be different on your system.
        seleniumPath     = "vendor/selenium-server-standalone-3.141.59.jar"
        geckoDriverPath  = "vendor/geckodriver-v0.26.0-linux64/geckodriver"
        port             = 8180
    )
    opts := []selenium.ServiceOption{
        selenium.StartFrameBuffer(),           // Start an X frame buffer for the browser to run in.
        selenium.GeckoDriver(geckoDriverPath), // Specify the path to GeckoDriver in order to use Firefox.
        //selenium.ChromeDriver(chromeDriverPath), // Specify the path to GeckoDriver in order to use Firefox.
        selenium.Output(os.Stderr), // Output debug information to STDERR.
    }
    selenium.SetDebug(true)
    service, err := selenium.NewSeleniumService(seleniumPath, port, opts...)
    if err != nil {
        panic(err) // panic is used only as an example and is not otherwise recommended.
    }
    defer service.Stop()

    // Connect to the WebDriver instance running locally.
    caps := selenium.Capabilities{"browserName": "firefox"}

    wd, err := selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", port))
    if err != nil {
        panic(err)
    }
    defer wd.Quit()

    // Navigate to the simple playground interface.
    if err := wd.Get("http://play.golang.org/?simple=1"); err != nil {
        panic(err)
    }

    // Get a reference to the text box containing code.
    elem, err := wd.FindElement(selenium.ByCSSSelector, "#code")
    if err != nil {
        panic(err)
    }
    // Remove the boilerplate code already in the text box.
    if err := elem.Clear(); err != nil {
        panic(err)
    }

    // Enter some new code in text box.
    err = elem.SendKeys(`
        package main
        import "fmt"
        func main() {
            fmt.Println("Hello WebDriver!\n")
        }
    `)
    if err != nil {
        panic(err)
    }

    // Click the run button.
    btn, err := wd.FindElement(selenium.ByCSSSelector, "#run")
    if err != nil {
        panic(err)
    }
    if err := btn.Click(); err != nil {
        panic(err)
    }

    // Wait for the program to finish running and get the output.
    outputDiv, err := wd.FindElement(selenium.ByCSSSelector, "#output")
    if err != nil {
        panic(err)
    }

    var output string
    for {
        output, err = outputDiv.Text()
        if err != nil {
            panic(err)
        }
        if output != "Waiting for remote server..." {
            break
        }
        time.Sleep(time.Millisecond * 100)
    }

    fmt.Printf("%s", strings.Replace(output, "\n\n", "\n", -1))

    // Example Output:
    // Hello WebDriver!
    //
    // Program exited.
}

If I sat "geckoDriverPath  = "vendor/geckodriver-v0.26.0-linux64/geckodriver"":
I take at line "selenium.NewRemote(...":
...
            {
                "fileName": "Thread.java",
                "methodName": "run",
                "className": "java.lang.Thread",
                "lineNumber": 834
            }
        ],
        "message": "invalid argument: can't kill an exited process\nBuild info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'\nSystem info: host: 'k8s-s1.me', ip: '192.168.88.10', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-72-generic', java.version: '11.0.6'\nDriver info: driver.version: unknown\nremote stacktrace: ",
        "error": "unknown error"
    },
    "status": 13

if I sat line "geckoDriverPath  = "vendor/geckodriver-v0.26.0-linux64"", than output:
...
            {
                "fileName": "Thread.java",
                "methodName": "run",
                "className": "java.lang.Thread",
                "lineNumber": 834
            }
        ],
        "message": "Unable to create new service: GeckoDriverService\nBuild info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'\nSystem info: host: 'k8s-s1.me', ip: '192.168.88.10', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-72-generic', java.version: '11.0.6'\nDriver info: driver.version: unknown",
        "error": "session not created"
    },
    "status": 33

What's the matter? How to find the cause of the error?

A: What version of Firefox you have installed? The error might be due to mismatch of the driver and the Firefox version. The geckodriver-v0.26.0-linux64/geckodriver you are trying to use requires Firefox version to be >= 60.
You could also check release notes: https://github.com/mozilla/geckodriver/releases to see if anything from Known problems applies to you.


text:
Q: Sql Server Replication running slow We set up replication on one of our database and in a publication there are 25 tables. In the replication monitor performance is showing excellent, but when i check in the details and went to undistributed commands it is still showing some 15 Mill.
Any one had this issue before.?