text:
Q: How to add button google search in this form? Hi there can someone help me, I want every keyword list, there is a google search button, and when I click on it, it will open a new browser tab, can anyone help me, I don't understand coding at all, so I ask for help here, I'm attaching a screenshot, thank you

<!DOCTYPE html>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>TRENDING</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap5.min.css">

keyword
products
date

smooth operator
583
1642435207616

horse
583
1642435207616

A: Here is an example -
note I cannot use the drawCallback but need to use on("draw" PLUS a draw()  to make sure the buttons are also added on the next page of the pagination
drawCallback is called for EACH row, so this code is not useful
$table = $('table').DataTable({"drawCallback": addButtons})
The opening of the window is blocked here at SO but works in the
jsfiddle

const addButtons = settings => {
  $('#dt1 tr td:nth-child(1)').html(function() {
    return `<button type="button" title="google search" class="py-0 btn btn-dark btn-sm search">${this.innerText}</button>`
  })
  $('#dt1 tr td:nth-child(4)').html(function() {
    return `<button type="button" title="google trends" class="py-0 btn btn-secondary btn-sm trends">${this.innerText}</button>`
  })
};

$(document).ready(function() {
  $table = $('table').DataTable();
  $table.on("draw", addButtons)
  $table.rows().invalidate().draw(); // not sure WHY I need to do this to have the FIRST draw trigger

  $table.on("click", ".search", function() {
    window.open(`https://google.com/search?q=${this.innerText}`, '_blank');
  })
  $('tbody').on("click", ".trends", function() {
    window.open(`https://trends.google.com/trends/explore?date=now 7-d&geo=US&q=${this.innerText}`, '_blank');
  })
});
.search, .trends {
  width: 70%;
}
<!DOCTYPE html>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>BACKUP</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap5.min.css">

Keyword
Products
Date
Google Trends

golf just play it
302
1642887886267
golf just play it

go little rockstar tiktok
980
1642888240211
go little rockstar tiktok

gorila
709
1642888326752
gorila

google arts and culture
23
1642888331842
google arts and culture

goat case
1099
1642888338561
goat case

goth youtuber
334
1642888346327
goth youtuber

goots
56
1642888351273
goots

godlike
360
1642888743165
godlike

very good very nice
3257
1642889189771
very good very nice

navy blue and gold
2613
1642889973714
navy blue and gold

its a good day to read a book bookworm book dragon
66
1642889988276
its a good day to read a book bookworm book dragon

peach and goma teddy
918
1642889994665
peach and goma teddy

i paused the golden girls to be here
91
1642890006415
i paused the golden girls to be here

A:

<!DOCTYPE html>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>TRENDING</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.0.1/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/dataTables.bootstrap5.min.css">

keyword
products
date

smooth operator Google search
583
1642435207616

horse Google search
583
1642435207616


text:
Q: QFJ Passes Messages in the Wrong Order I am using QFJ 2.1.1 and testing my application against a fix simulator (also running in QFJ 2.1.1)
There are two fix sessions.
An initiator and acceptor on both sides.
The problem workflow looks like this:
1. simulator/acceptor  <--- New Order Single <--- application/initiator
2. simulator/acceptor  ---> ACK              ---> application/initiator

3. simulator/initiator ---> New Order Single ---> application/acceptor
4. simulator/initiator <---              ACK <--- application/acceptor

The order of fix messages processed by QFJ in the simulator is 1,2,3,4
The order of fix messages processed by QFJ in the application is 1,3,2,4
The Application was called back with 3 (NewOrderSingle) before it was called back with 2 (ACK)
Here are the QFJ log snippets from the simulator showing 2 and 3 being sent on two sessions:
2
2019-12-12 10:23:12.820 [928630][QFJ Message Processor][INFO ] <-- OUTBOUND VENDOR: 8=FIX.4.2|9=180|35=8|34=2|
52=20191212-15:23:12.820|11=287:MACGREGOR-37392703:45037843|17=BYHWG|20=0|37=SIM:287:MACGREGOR-37392703:45037843|38=10000|39=0|54=2|55=MSFT|150=0|10=132|[:]

3
2019-12-12 10:23:12.820 [928630][QFJ Message Processor][INFO ] <-- OUTBOUND ATS: 8=FIX.4.2|9=208|35=D|34=2|52=20191212-15:23:12.820|11=GSET:287:MACGREGOR-37392703:45037843|18=M|21=1|38=10000|40=P|44=153.3
500|54=2|55=MSFT|60=20191212-15:23:09.205|110=0|8011=287:MACGREGOR-37392703:45037843|10=207|[:]

Here are the QFJ log snippets from the application showing 3 being received before 2 on the two sessions:
3
2019-12-12 10:23:12.824 [31181][QFIXManager][INFO ] FIX onAppReceived(): AQUA->GSET, message=[11=GSET:287:MACG
REGOR-37392703:45037843 35=D 18=M 44=153.3500] {11=GSET:287:MACGREGOR-37392703:45037843, 44=153.3500, 55=MSFT,
 34=2, 56=AQUA, 35=D, 8011=287:MACGREGOR-37392703:45037843, 49=GSET, 38=10000, 18=M, 110=0, 8=FIX.4.2, 9=208,
60=20191212-15:23:09.205, 40=P, 52=20191212-15:23:12.820, 21=1, 54=2, 10=207} [:]

2
2019-12-12 10:23:12.827 [31184][QFIXManager][INFO ] FIX onAppReceived(): AQUABORG->GSETBORG, message=[11=287:M
ACGREGOR-37392703:45037843 37=SIM:287:MACGREGOR-37392703:45037843 35=8 39=0 150=0] {11=287:MACGREGOR-37392703:
45037843, 55=MSFT, 34=2, 56=AQUABORG, 35=8, 37=SIM:287:MACGREGOR-37392703:45037843, 49=GSETBORG, 38=10000, 17=
BYHWG, 39=0, 150=0, 8=FIX.4.2, 9=180, 52=20191212-15:23:12.820, 20=0, 54=2, 10=132}

As you can see, the application messages 2 and 3 are received out of order.
How can I prevent this in my QFJ application?

redpajama_set_name: RedPajamaStackExchange


text:
Q: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure I have a problem when i try to run my api container that should connect to the db container.
The problem should be appearing when building the project or creating the image, because if i just run the project it successfully connect every time to the container.
Here i have my Dockerfile
FROM openjdk:11
RUN mkdir -p /app/
ADD build/libs/core-0.0.1-SNAPSHOT.jar /app/core-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "/app/core-0.0.1-SNAPSHOT.jar"]

Also here the docker-compose.yml file
version: '3.8'

services:
  book-catalog-db:
    container_name: mysqlbc
    image: mysql:latest
    volumes:
      - ./proyecto/sql-data/db:/var/lib/mysql
    ports:
      - 3306:3306
    hostname: localhost
    environment:
      MYSQL_USER: 'admin'
      MYSQL_PASSWORD: 'admin'
      MYSQL_ROOT_PASSWORD: 'root'
      MYSQL_ROOT_PASSWORD: 'root'
  book-catalog-angular:
    container_name: angularbc
    image: book-catalog-client:latest
    volumes:
     - ./proyecto/web-assets:/usr/share/nginx/html/assets
    ports:
     - 4200:80
  book-catalog-api:
    container_name: apibc
    image: coreapi:latest
    ports:
     - 8080:8080

I hope i get an answer fast since i dont have much time.
Good day to everyone!
i tried some things of this answer

A: ok, so i used
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysqlbc

i got ip address from mysql container and i changed ip address on project built image,
NOW IT WORKS


text:
Q: Repeating a user input throughout a Microsoft Word docment I am trying to create a document in which the user will be given the opportunity to enter some text and I would like to use that in the rest of the places in that same document.  The text entered by the user will be used in many places in the same document and changing the name at any time should be reflected in rest of the document.
For example, in the very first page of the document, I would like to get the user's name and age and use it in other places as shown in the following screenshot.

I tried to use plain text content control to get the name and age. But I could not find a way to insert those as fields in my text.
Any ideas on how I can achieve this? I am even ready to do a mailmerge, but I do not want the data to be from any place other than this document.  The screen shot was tried in Office 2013, but it would be great if it works right from 2007 onwards. I do not want to do it with macros.

A: I think you'll have to use the Word Template and DocVariables. This also means some VBa but this tutorial covers it
http://www.gmayor.com/BookmarkandVariableEditor.htm
However, as an example of making it read content from else where, this may get you going... This isn't perfect but, it may be a good start!
In word, add the developer toolbar to the ribbon.
From the developer toolbar, drop in 2 text boxes from the controls tab.
Click on the Insert toolbar.
Now, click on the first textbox (the one where text is to be copied too). Make sure you click on the 3 little dots on the left side so the entire textbox is selected. When you have selected it, the Bookmark (under Links) should become enabled. Click on it and give it an appropriate name.
Click on the second textbox, and do the same but this time, click on Cross Reference. In the drop down box, select bookmarks and then find the book mark in question.
This is set up, but, you have to manually update the field. So, type some text into the first textbox, then right click on the second and select Update Fields. As I said, not perfect, but hopefully a start!
This article explains it can be done with a Template and Macros. http://word.mvps.org/FAQs/Userforms/CreateAUserform.htm

A: For Windows Word 2007 and later, you can use some of the Content Controls that Word inserts from Insert->Quick Parts->Document Property... For example, if you insert the "Author" Document Property, Word inserts a content control that is connected to the built-in property. So when you change the value in one copy of the content control, the property value updates, then all other Author content controls are updated automatically. This is different from the pre-Word 2007 approach where you had to insert an { AUTHOR } field, then seleect it and update it.
Using the Developer tab, you can select the resulting content control and give it a new Title such as "Age". Then you can copy/paste copies of the control with that title. It's also usually helpful to make the controls non-deletable.
If you don't want to use the traditional built-in properties such as Author etc., there is a set of five "properties" called Cover Page Properties that you can use instead. These are also available from the Document Property... menu, but the values are stored in a different place, i.e. in a Custom XML part created by Word. I think these are Company Address, Company Email, COmpany Fax, Company Phone, and Publish Date. Again, you can modify the Title using the Developer tab.
Beyond that, you have to use VBA or some such. If you're using Content controls, you have to create your own Custom XML part to store the values, and connect the controls to that store. You'll find a good summary of various options for "repeating data" here
FWIW, if you need to use forms in Word, the most "compatible" type of form field is what are called "Legacy Form fields" in Windows Word, because these are the only type that also work in Mac Word. But if you only need stuff to work in Windows Word 2007 and later, content controls have some advantages.


text:
Q: For which value of $b$ the function $f(x)=b \sin(x)-x$ is one-one? I draw the graphs and the correct answer is $[0,1]$ the domain of $b$ for which $f$ is one-one. But i don't know how to prove this. Please somebody help me.

A: The function needs to be monotonic, meaning that the derivative shouldn't change sign.
$$f'(x)=b\cos x-1\leq 0$$
$$b\cos x \leq 1$$
Because $|\cos x|\leq 1$, you need $b\in [-1,1]$.


text:
Q: Ajax / jQuery Django refresh class of elements I was not able to come up with a more fitting title, but my issue is the following:
I generate a list of posts with the option to like and dislike them, depending on if they have already been liked.
{% for post in posts %}

        {{ post.owner }}

        {{ post.content }}

        {{ post.post_date }}

        <form action="{% url 'like' %}" method="post" class="likeform">
            {% csrf_token %}
            <input type="hidden" id="post_id" value="{{ post.id }}">
            {% if post.id not in liked_posts_ids %}
                <button type="submit" >Like</button>
            {% else %}
                <button type="submit" >Dislike</button>

            {% endif %}
        </form>
    {% endfor %}

Now, as it is with all websites that use stuff like this, I don't want to refresh the whole website everytime someone clicks the like/dislike button.
My current JS looks like the following:
 $(document).on('submit','.likeform',function(e){
        e.preventDefault();

        $.ajax({
            type:'POST',
            url:'{% url 'like' %}',
            data:{
                post_id: $('#post_id').val(),
                    csrfmiddlewaretoken:$('input[name=csrfmiddlewaretoken]').val()
                },
        success:function(){
            $(".likeform").load(" .likeform > *");
        }
    });

The POST request works fine, but the success:function()part does not. It refreshes all buttons, which is not that nice, but it also puts all buttons in all forms. Currently there are 6 posts in my database which results in 6 like/dislike buttons under every post after $(".likeform").load(" .likeform > *");has finished.
How can I only refresh the correct instance of the button, while keeping the buttons generated in the for loop?
Is there a way to leverage the #post_idto identify the relevant button?

A: Since you are saying that you have multiple of these forms on you page, lose the id attribute on the input and change it to a name attribute.
<input type="hidden" name="post_id" value="{{ post.id }}">

id's have to be unique and are invalid if they occur more than once. And the name attribute is a better identifier of an input element.
In your $.ajax function you'll want to get the values from the current form that you have submitted. In that form you want to select all the elements that you need.
Now for the request you need to do something differently. The request should go to a function on the server which updates the value on this post with the id that we sent, if it has been liked or disliked. Nothing further. It should then, as a response, send a text string back which will be the new text value of the submit button.
In your success handler you'll need to set the received text string to the button in the submitted form. So when you click Like, the server will send a request, the post will be liked on the server, and the server sends back Dislike, which is now the text on the button. And when clicking dislike it should do the same thing, disliking the post and returning the Like string.
$(document).on('submit', '.likeform', function(e) {
  e.preventDefault();

  // Get the currently submitted form and find the inputs
  // inside the form necessary to send the data with.
  var $form = $(this);
  var $postId = $form.find('input[name="post_id"]');
  var $csrf = $form.find('input[name="csrfmiddlewaretoken"]');
  var $button = $form.find('button');

  $.ajax({
    type: 'POST',
    url: '{% url 'like' %}',
    dataType: 'text',
    data: {
      post_id: $postId.val(),
      csrfmiddlewaretoken: $csrf.val()
    },
    success: function(response) {

      // Replace the current text of the button with a new
      // text based on if it was liked or disliked.
      $button.text(response);

    }
  });

});


text:
Q: How can I overwrite an existing file in 7zip? I'm trying this:
7za.exe a "C:\Disc.7z" "C:\test" -v20000000b -m0=BCJ -bd

But if I already have created the file C:\Disc.7z then 7zip doesn't compress anything and sends me this output:
System error:
File already exist.

I've tried with the switch -y, but 7zip does not do anything...
How can I overwrite the file?

UPDATE
I've tried the switch -aoa but it does not work either...

A: Try using 7za.exe u instead of 7za.exe a. The first one is specifically used to update an archive that already exists.

A: Currently there is no way to have this functionality with command line switches. Overwriting is supported only during archive extraction.

A: Your problem is that you're using -v to create a multi-volume archive. People have been requesting the author for the last 5 years to allow the program to modify multi-volume archives, but he has no plans to implement the feature any time soon. (It's open source, wish some enterprising programmer would do it already!)

A: Work-Around
To work around this problem, you could delete the archive files if they exist before you create them again. Here's one way to do this:
CMD /C FOR %i IN (C:\Disc.7z.???) DO DEL %i && 7za.exe a "C:\Disc.7z" "C:\test" -v20000000b -m0=BCJ -bd
Explanation

*

*The CMD /C ensures that the 7za command is only executed once rather than for each file.

*The FOR iterates through each destination archive file and deletes it. Note that the expression only covers volumes with three-digit suffixes. If you expect more (which I'm not sure is possible), you could replace the ??? with *.

*The && runs the second command after the first (if the first is successful).

A: I've noticed that this problem doesn't occur for me if I remove the -v switch. It appears that 7-Zip doesn't support updating archive volumes.


text:
Q: Search and replace with Regex with replace variables My company is using a third party for their mobile sites and we have a console to update some of the code and control stuff through them. One of the things is a search and replace feature that can update the code for the site. The only thing is: it uses a lot of complex regex code and I can't seem to find a good tutorial on the complex stuff. So here is the example he gave me that sticks grabs the paragraph tag and puts it in the link:
Search
(#d6d6d4.+?>.+?
.+?)(.+?)

Replace With
$1$2

What is the $1 and $2 representing? I know it probably has something to do with one of the .+? but I am unsure which one. I have added the code down below with numbers next to the regex variables
(#d6d6d4.+?**[1]**>.+?**[2]**
.+?**[4]**)(.+?**[5]**)

A: The $1 and $2 variables are captured matches for the patterns inside parentheses, i.e. ().
$1 is the first capturing group and $2 the second.

A: The $1 and $2 represent the text in capturing groups in the regex. Capturing groups are what is inside parentheses.
 (        // start first capture group
 #d6d6d4  // match #d6d6d4
 .+?>     // any character, non-greedy, up to '>'
 .+?
   // any character, non-greedy, up to

    // an  tag, consuming everything up to '>'
 .+?      // all characters from  to
 )        // close the first capture group before the ''
      // literal ''
 (        // start second capture group
 .+?      // match all, non-greedy up to '	'
 )        // close capture group before '	'
 	    // literal '	'

So you if you have this string: Hello, world
foo linksome more text
$1 matches: #d6d6d4 foo=bar>Hello, world
foo link
$2 matches: some more text
So the string is transformed into:
Hello, world
foo linksome more text
Which basically means the  tag is moved after some more text (or just before the 	 if you prefer)

A: I consider http://rubular.com/ to be a great training tool for regex's because it's interactive and you can keep trying different patterns against different text and you see the results immediately.
It includes a link to http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UJ which is a good basic guide to regular expressions.
There's also http://www.regular-expressions.info/
Why struggle to write your own when there's even a site for 3,500+ regex libraries at http://regexlib.com
The $ variables are used to store 'the match's that are made:- $1 for the first match; $2 for the second, etc.


text:
Q: Blur shadow on mdframed with rounded corners I got this definition for my mdframe style:
\documentclass[final]{beamer}
\mode<presentation> {
\usetheme{CambridgeUS}
  }
\usepackage[utf8]{inputenc}
  \usepackage{amsmath,amsthm, amssymb, latexsym}
  \usepackage[orientation=portrait,size=a0,scale=1%,debug]
  ]{beamerposter}                       % e.g. for DIN-A0 poster
  \usepackage{textpos}
%For Tikz
\usepackage{tikz}
\usetikzlibrary{arrows,snakes,shapes}
\tikzset{>=latex}
\usetikzlibrary{backgrounds}
\usetikzlibrary{decorations.text}
\usetikzlibrary{decorations}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{calc}
\usetikzlibrary{%
    calc,%
    fadings,%
    shadings%
}
\usetikzlibrary{arrows,snakes,shapes}
\usetikzlibrary{backgrounds}
\usetikzlibrary{
    shapes.geometric,
    decorations.pathreplacing
}
\usetikzlibrary{patterns}
\def\zangle{-20}
\def\xangle{20}
\usepackage[font={Large},labelfont={Large,color=MyBlue}]{caption}
\usepackage{lipsum}
%**************************************************************
\usepackage{setspace}
\definecolor{MyGreen-gray}{gray}{0.5383}
\definecolor{MyBlue}{RGB}{29,47,160}
\setbeamercolor{frametitle}{bg=MyBlue,fg=white}
\setbeamercolor{block title}{bg=MyBlue,fg=white}

\usetikzlibrary{shadows}
\usetikzlibrary{shadings}
\usetikzlibrary{shadows.blur}

\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{Blocco}{%
rightline=false,leftline=false,topline=false,bottomline=false, innerleftmargin=10,innerrightmargin=10,innertopmargin=10, innerbottommargin=10,linewidth=3.0pt, linecolor=black, roundcorner=4pt,frametitlefont=\Huge\textcolor{white} ,frametitlebelowskip=0.3cm,frametitleaboveskip=0.3cm, frametitlebackgroundcolor=MyBlue, backgroundcolor=MyBlue!7, shadow=true, shadowsize=5pt,middleextra={
\foreach \sshift/\svalue in {6/gray!10,5/gray!20,4/gray!30,3/gray!40,2/gray!50,1/gray!60}
  {
  \fill[\svalue]
    (P) --
    ([xshift=\sshift pt]P) --
    ([xshift=\sshift pt]P|-O) --
    (P|-O) -- cycle;
  }
},
secondextra={
\foreach \sshift/\svalue in {6/gray!10,5/gray!20,4/gray!30,3/gray!40,2/gray!50,1/gray!60}
  {
  \fill[\svalue,rounded corners]
    ([xshift=\sshift]O) --
    ([xshift=\sshift,yshift=-\sshift]O) --
    ([xshift=\sshift,yshift=-\sshift]P|-O)
    {[sharp corners] -- ([xshift=\sshift]P) --
    (P)} --
    (P|-O) -- ([xshift=\sshift]O);
  }
},
firstextra={
\foreach \sshift/\svalue in {6/gray!10,5/gray!20,4/gray!30,3/gray!40,2/gray!50,1/gray!60}
  {
  \fill[\svalue,rounded corners]
    ([yshift=-\sshift]P) --
    ([xshift=\sshift,yshift=-\sshift]P)
    {[sharp corners] -- ([xshift=\sshift]P|-O) --
    (P|-O)} -- ([yshift=-\sshift]P);
  }
},
singleextra={
\foreach \sshift/\svalue in {6/gray!10,5/gray!20,4/gray!30,3/gray!40,2/gray!50,1/gray!60}
  {
  \fill[\svalue,rounded corners]
    ([xshift=\sshift]O) --
    ([xshift=\sshift,yshift=-\sshift]O) --
    ([xshift=\sshift,yshift=-\sshift]P|-O) --
    ([xshift=\sshift,yshift=-\sshift]P) -- +(-6pt,0) --
    (P) --
    (P|-O) -- ([xshift=\sshift]O);
  }
}}

\begin{document}
\begin{frame}{}

%****************************************************************
%Titolo
\begin{textblock}{10.1}(2.6,-4)
{{\fontsize{120}{60}\selectfont S}}{{\fontsize{95}{60}\selectfont{\MakeUppercase{p }}}} {{\fontsize{120}{60}\selectfont A}}{{\fontsize{95}{60}\selectfont{\MakeUppercase{ct }}}}\\[1cm]
\begin{center}
{\huge{Quantum correlations}}
\end{center}
\end{textblock}
    %****************************************************************

\begin{textblock}{10}(2.6,-2.5)
\begin{mdframed}[style=Blocco,frametitle={Abstract}]
{\fontsize{44pt}{50pt}\selectfont
\lipsum[1]}
\end{mdframed}
\end{textblock}

\begin{textblock}{10}(2.6,4.5)
\begin{block}{Abc}
\lipsum[1]
\end{block}
\end{textblock}
\end{frame}
\end{document}

My problem is that the pdf result has a problem with the rounded corners, as shown in the picture. My idea is that the rounded corners of the shadow of the mdframed box should be like to the classic block.

If anybody could solve this it would be very nice!!


text:
Q: Exception on loading main window XamlParseException on startup getting and Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll additional information 'The invocation of the constructor on type 'Wpf.Controller' that matches the specified binding constraints threw an exception.'
Where Wpf.Controller is just a controller class.... so, I've re-targeted a WPF app as a dll, and have some environmental WPF applications using that XAML dll as the core UI. (minor changes to wpf.exe to help deployment).
This error isn't happening will all the wpf.exe projects... (3 of the 5 are running without issue - the code is the same, outside some app.config and properties which have deployment differences.

A: When I re-targeted the WPF.exe to a wpf.dll, I didn't change it's name, so the wpf.dll and wpf.exe project clashed. Once I renamed the dll to something else, it all worked. Error made sense, but a gotcha.


text:
Q: Filter Microsoft Graph List Messages API to only received messages Goal: I'd like to be able to filter the "List Messages" API to only return emails that are sent to the user rather than any messages that exist anywhere (such as ones sent out by the user).
Right now, if you query this particular API, you get a list of all of the messages in all folders (including Deleted Items and Clutter folders).
I know that I can filter on isDraft eq false to remove the drafts - but I don't know if there's any filter to say don't include messages sent by the user.
What I've Tried: I've looked over the examples and didn't see anything about filtering like this. I've also taken a look at the OData Query Params and dug into the filter param. The problem is I'm not quite sure what I could even filter on. I do see that there is a sender parameter - but given I've connected via OAuth and haven't asked users to provide their email address I'm not sure I have an easy way to filter on that.
Theoretically, I could first do a request to the https://graph.microsoft.com/beta/me/ endpoint to get the userPrincipalName and then add a filter on from/emailAddress/address ne '<userPrincipalName>' when I call the /me/messages endpoint - but that's going to double the number of API calls I'd need to make. Is that the only option I have or is there a better way to go about this?
Thanks for your time :)

A: There is no filter parameter that will achieve this directly. If you want to filter away sent messages - you'll need to either decode the base64 encoded JWT access token and extract the userPrincipalName or make a call to the /me endpoint and retrieve the userPrincipalName from that. Once you have that, you can add a filter of from/emailAddress/address ne '<userPrincipalName>'.
Please note that if you are filtering on many things and you have an "order by" param that you'll need to include that param in your filter or you'll receive an error about too many filters.


text:
Q: Make compiler options I am running a 32 bit machine with Ubuntu 14.04. I want to execute sudo make to generate a C++ compiled file (gcc-4.8.4). My Makefile is
Makefile (edited based on comments from ddumbugie):
CDefines = -DLINUXGXX
COMPFLAGS     =
FlameManCC = gcc
FlameManCCOpts = -O3

OBJECTS = alligator.o
COpts = $(COMPFLAGS) $(FlameManCCOpts) $(CDefines)
CC = $(FlameManCC)
alligator.o: alligator.c
    $(CC) $(COpts) -c $< -o $@

Executing
make -n

gives me
gcc  -O3 -DLINUXGXX -c alligator.c -o alligator.o

But
sudo make -n

gives me
DLINUXGXX -c alligator.c -o alligator.o

Definitely command DLINUXGXX is not understood. However, I need to remain a super-user for a subsequent command executed by make. How can I resolve this?

A: CDefines = -DLINUXGXX
COpts = -O3 $(CDefines)
alligator.o: alligator.c
    $(CC) $(COpts) -c $< -o $@

It requires -o compiler options.

*

*$@ means the target. That is alligator.o.

*$< means the dependency. That is alligator.c.


text:
Q: Lazy load images in table sorter From server I get html with table.
To render this table nicely I use table-sorter jquery plugin.
I faced the following issue:
When table enough long page loads really slow. Investigation result - issues related with images downloading. For example I have 100 table rows in my table. I have pagination by 5 lines.
Each line have image and initially when page loads in browser network I see that all 100 images loads.
I want to achieve that image loads only when it is really needs.
I have not expirience in resolving this task.
Please suggest solution.

A: At first you need to get only necessary html (first page of the table) from server side and update the DOM as required.. maybe ask the server side again.
Then you'd better lazy load those images by using sth like Lazy Load Plugin for jQuery.
Could be as simple as this one:
function init() {
    var imgDefer = document.getElementsByTagName('img');
    for (var i = 0; i < imgDefer.length; i++) {
        if (imgDefer[i].getAttribute('data-src')) {
            imgDefer[i].setAttribute('src', imgDefer[i].getAttribute('data-src'));
        }
    }
}
if (document.readyState == 'complete') {
    init();
} else {
    window.onload = init;
}

jsfiddle

A: After reading your question, I decided to add a lazyload widget to my fork of tablesorter... it is currently only in the master branch of the GitHub repository:

*

*widget-lazyload.js

*example-widget-lazyload.html
If you download or install the repository, run that demo to find documentation on how to setup and use the widget.
I plan on making a new release soon, in case you want to wait.


text:
Q: How is XP calculated for a hero's level after a match? After any match is played in Heroes of the Storm, you receive experience for the hero you just played which allows you gain levels (see Here)
How is the amount of XP you gain after each match calculated? Does it vary by game type?

A: That screenshot seems to be from pre-2.0 Heroes of the Storm.  Since 2.0 hit, there is no separate player XP bar.
Anyway, there are a few things that determine how much XP you get per match:

*

*Whether you won or lost

*The amount of in-game XP your team got (killing enemy heroes, minions, and buildings)

*Bonus XP (applied on top of the base XP as calculated from the two above)

*

*First win of the day gives +50% bonus.  Doesn't apply in Training mode, Custom Games, or the weekly Brawl.

*Hero League gives +25% bonus.

*Team League gives +50% bonus.

*Stimpacks gives +100% bonus.

*Playing with one or more friends gives +25% bonus.

*Party size provides a bonus based on how many people are in the party. +25% bonus for 2 people, +33% bonus for 3 people, +42% bonus for 4 people, and +50% bonus for 5 people.

All those percentage bonuses don't stack, which means that they are applied separately to the base XP of the game (without the win bonus).
The higher level your hero, the more XP it takes to earn a new level.  Each level you gain gives you one (or more) lootbox(es).  This lootbox will be an Epic lootbox if your player level if a multiple of 25, a Rare lootbox if your player level is a multiple of 5 (but not multiple of 25), or a Common lootbox for every level not mentioned above.
You also get a hero-specific lootbox if your hero's level is a multiple of 10.


text:
Q: Running plugins in child- from parent-pom in maven I want to create a parent pom which over 100 child poms will use it and I want each child using just maven install running the plugins from parent, but unfortunately it won't run parent plugins in child plugins.
This is my parent pom and my 2 checkstyle and spotbugs plugins are in it
  <build>
<pluginManagement>

  <plugins>

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-checkstyle-plugin</artifactId>
      <version>${maven.checkstyle.plugin}</version>

      <dependencies>
        <dependency>
          <groupId>com.puppycrawl.tools</groupId>
          <artifactId>checkstyle</artifactId>
          <version>${maven.puppycrawl.version}</version>
        </dependency>
      </dependencies>

      <configuration>
        <consoleOutput>true</consoleOutput>
        <failsOnError>true</failsOnError>
        <linkXRef>false</linkXRef>
        <violationSeverity>warning</violationSeverity>
      </configuration>

      <executions>
        <execution>
          <id>validate</id>
          <goals>
            <goal>check</goal>
          </goals>
          <phase>validate</phase>
        </execution>
      </executions>

    </plugin>

    <plugin>
      <groupId>com.github.spotbugs</groupId>
      <artifactId>spotbugs-maven-plugin</artifactId>
      <version>${spotbugs.plugin.version}</version>
      <configuration>
        <threshold>Low</threshold>
        <xmlOutput>true</xmlOutput>
      </configuration>

      <executions>
        <execution>
          <goals>
            <goal>check</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>

</pluginManagement>

and this is in my child pom
  <parent>
<groupId>org.parent</groupId>
<artifactId>parent_name</artifactId>
<version>0.0.1</version>
</parent>

now I want to use mvn install or mvn clean install to run the child pom and run these two plugins without rewriting them in each child pom, but it doesn't run the plugins.
can anyone tell me what should I do?


text:
Q: NGINX config for subdirectory website CMS doesn't removes /index.php/ My current NGINX config to hosting a website in a subdirectory on a Docker server doesn't seem to work. I tried several things but nothing concluding.
server {
    root /www;
    access_log /logs/access.log;
    error_log /logs/error.log debug;
    index index.html index.php;
    if ($bad_referer) { return 444; }

    # Enable PHP with path_info for any php subfolder
    location ~ ^(.+\.php)($|/) {
        fastcgi_pass archives_php:9000;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_intercept_errors on;
        include /nginx/fastcgi_params;
    }

    ###
    ### SPECIFIC SITE
    ###
    # Cockpit
    location = /site { try_files $uri /site/index.php$uri?$args; }
    location /site {
        try_files $uri $uri/ /site/index.php$uri?$args;
        location ~ ^(.+\.php)($|/) {
            fastcgi_pass archives_php:9000;
            fastcgi_index index.php;
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
            fastcgi_intercept_errors on;
            include /nginx/fastcgi_params;
        }
    }
    location /site/cockpit { try_files $uri $uri/ /site/cockpit/index.php; }

    # Assets disabled logging and expiration max
    include /nginx/assets.conf;
}

# Anti spam referrals
include /nginx/referral-spam.conf;

The website works when using dubsomain.site.com/site/index.php/page but this is not the behaviour I would like to have.
A similar website with the same CMS but in the root folder works like a charm.

A: If you need to append part of the URI to /site/index.php, you will need to use a regular expression.
For example:
location /site {
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    rewrite ^/site(.*)$ /site/index.php$1 last;
}

The location = /site is unnecessary, unless there is a specific action that URI needs to perform, and your second location ~ ^(.+\.php)($|/) block which is nested within the location /site block is never invoked, and being identical, is unnecessary anyway.


text:
Q: Preciso colocar 4 cards na mesma linha, estou usando: display: flex e flex-flow: row; mas eles ficam um abaixo do outro, alguem sabe o que fazer?

.carrosel {
  display: flex;
  flex-flow: row;
  margin-left: 160px;
}

.cards {
  width: 266px;
  height: 493px;
  border: 1px solid #FFFFFF;
  box-shadow: 0px 4px 8px -4px rgba;
  border-radius: 8px;
  box-shadow: 2px 4px 8px -4px rgba(0, 0, 0, 0.2);
}

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

      <button class="btncards">
        Saiba mais
      </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

        <button class="btncards">
          Saiba mais
        </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

          <button class="btncards">
            Saiba mais
          </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

            <button class="btncards">
              Saiba mais
            </button>

A: Estava faltando fechar as tags div das classes "cards", então o segundo card estava dentro do primeiro, o terceiro dentro do segundo e assim por diante. Não havia como ficar lado a lado dentro do "carrosel", já que só havia efetivamente, um card dentro do carrosel.
Segue o abaixo o código com as alterações de fechamento de tags seguidas do comentário

.carrosel {
  display: flex;
  flex-flow: row;
  margin-left: 160px;
}

.cards {
  width: 266px;
  height: 493px;
  border: 1px solid #FFFFFF;
  box-shadow: 0px 4px 8px -4px rgba;
  border-radius: 8px;
  box-shadow: 2px 4px 8px -4px rgba(0, 0, 0, 0.2);
}

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

      <button class="btncards">
        Saiba mais
      </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

      <button class="btncards">
        Saiba mais
      </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

      <button class="btncards">
        Saiba mais
      </button>

Teste A/B

Um teste A/B consiste em comparar o desempenho de uma ou mais versões (variantes) de uma página em relação à original por meio da análise de métricas como taxa de conversão, funil de vendas, dados de tráfego, entre outros.

      <button class="btncards">
        Saiba mais
      </button>


text:
Q: Offline Web Notifications Is it possible to send notification from web application to client browser when any event occured? Also is it possible when status of web page closed and even browser closed?
I did some research but ı'm not sure.


text:
Q: Does Earth's Rotation Affect Its Shape?
The question I am working on is, "Consider the following.
(a) Find the angular speed of Earth's rotation about its axis. rad/s
(b) How does this rotation affect the shape of Earth?"

I am fully capable of solving part (a); however, I am not sure how to describe the effect earth's rotation on its shape. I tried to search my textbook for the answer, but could not find anything. Is there an actual effect on the shape?

A: The Earth is mostly fluid. This may seem a strange claim but the rock in the mantle behaves like an extremely viscous fluid, which is why continental drift can happen.
Anyhow, if you imagine a stationary drop of liquid it will form a sphere. This is a bit of a cheat because small drops form spheres due to surface tension not gravity, but the end results are similar. If you start the drop rotating the water at the "equator" is going to feel an outwards force due to the rotation, so the drop will change shape and get bigger around the equator while the poles flatten. This shape is known as an oblate spheroid, and indeed it's the shape of the Earth because the Earth behaves like a rotating fluid drop.
To try and calculate the change of shape is a little messy, but luckily someone has done all the hard work for you and you can find the results:
Thayer Watkins: The shape of a rotating fluid mass.

A: I don't think it is difficult to derive analytically the shape of the Earth. Simply look for the shape of the surfaces of equal potential.
The geometrical symmetry reduces the calculation to a 2-dimensional problem. Assume the rotation axis is vertical. The potential is the sum of the gravitational plus centrifugal:
$\Phi=\Phi_{g}+\Phi_{c}=-\frac{GM_{(x,y)}}{\sqrt{x^2+y^2}}+\frac{\omega^{2}}{2}x^{2}=-\frac{GM_{r}}{r}+\frac{\omega^{2}}{2}r^{2} \cos^{2} l$
The angle $l$ is the same as the latitude, and $M_{r}$ is the mass enclosed by a spherical surface (but please see footnote) at the point, i.e $M_{r}=\frac{4}{3}\pi \rho r^{3}$ by assuming a constant density model. Therefore,
$\Phi= -\frac{4}{3} G \pi \rho r^{2} +\frac{\omega^{2}}{2}r^{2} \cos^{2} l = r^{2}(\frac{\omega^{2}}{2}\cos^{2} l -\frac{4}{3} G \pi \rho)$
Thus, the family of curves of constant (negative) potential $\Phi=-C^{2}$ is:
$ -C^{2} = r^{2}(\frac{\omega^{2}}{2}\cos^{2} l -\frac{4}{3} G \pi \rho) = r^{2}(A^{2} \cos^{2} l -B^{2}) $
Let's go back to rectangular coordinates, to see that this is indeed an ellipse:
$ C^{2} = r^{2}(B^{2} - A^{2} \cos^{2} l) = (x^{2}+y^{2})(B^{2} - A^{2} \frac{x^{2}}{x^{2}+y^{2}}) = (x^{2}+y^{2})B^{2} - A^{2} x^{2}$
$ C^{2} = (B^{2} - A^{2}) x^{2} + B^{2} y^{2} $
For that equation to be an ellipse, $B^{2} - A^{2}$ must be positive. This is natural, otherwise (see how we defined $A$ and $B$) the angular speed $\omega$ would make the centrifugal force stronger than the gravitational force. The semiaxis are then $1/B$ for the vertical direction, and $1/\sqrt{B^{2} - A^{2}}$, i.e. bigger, in the horizontal direction. Note too, that $A=0$ for $\omega = 0$, that is, you recover the spherical shape if there is no rotation.
Thus, an Earth with constant density that rotates as a rigid solid can be approximated by an ellipsoid shape, whose dimension along the rotation axis is smaller.
Additionally, we probably don't need the interior of the Earth to be molten, for the hydrostatic equilibrium assumption to be valid. It could be completely cold and solid and the model still would hold, because at that size scales, relative small deviations of matter distribution from the constant potential surfaces give rise to enormous shear stress that rocks, no matter how hard and solid, cannot resist. That is why the liquid model is a valid approximation (but I have not done any numbers on this).
NOTE: We have assumed that any point belongs to a spherical surface that is completely full of matter, therefore the potential gravitational energy is the same as if all matter inside that sphere were located at the Earth centre. If the Earth were much more flattened, this approximation would not be valid.

A: The explanation of ovality of earth surface is quite illustrative but needs further detailing to predict the geometry of the real surface. Because of the wide variations in the density of the earth from point to point the proportion of gravitational attraction and the centrifugal force over different elements of mass
$$dm=\rho\,dv$$
varied  from point to point. If this fact is taken in to considerations, the surface of earth shall not be a mathematical surface but the portion of earth having higher density will pop up to form mountains and the portion with lower density will depress down to accommodate the condensed water of globe. We named them sea and ocean.
This also implies that the  area beneath the Ocean will have lighter materials like coal, petroleum etc. and those beneath the mountains will have heavy elements like gold, platinum etc. This and the alubium deposits (at some places over flakes of shale) clearly implies that the whole water of the present oceans had condensed and flown through valleys within few days to form rivers and seas, when the Earth Environmental Temperatures had fallen down to condensation temp.
Let us generate data of density variation and carry out the  calculations to predict the real geometry of earth surface or vice versa.


text:
Q: Send Dictionary to Core Data I have a dictionary of key-value pairs that I am trying to save to core data.
let children = userSnap.children.allObjects as! [DataSnapshot]
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
let thisUser = ThisUser(context: context)
var data = [String: String]()
for child in children {
    data[child.key] = child.value as? String
}
data["uid"] = currentUser!.uid

The child.key string matches the attribute in CoreData and I want to put child.value as? String in as the value for each CoreData attribute.
Is there a way I can do this without having to create a line of code for each attribute ... ex) thisUser.uid = data["uid]
Here is my data model:

A: You should be able to do this via Core Data introspection. You'd do something like:

*

*Get the NSEntityDescription as thisUser.entity.

*Get a list of the properties in the entity, by calling attributesByName on the entity description to get a dictionary of [String: NSAttributeDescription].

*The keys for that dictionary are the names of your Core Data properties. Get values from your dictionary with that key. Assign values to your managed object with key-value coding, i.e. setValue(_:, forKey:).

*If necessary you can also use the results of attributesByName to find out the type of the property. Use the attributeType property of NSAttributeDescription.

Basically, find out what attributes your Core Data object has, get their names, and then run through those names to copy data from one place to another.


text:
Q: How to get CSV file data from an S3 bucket into an HTML table I have a pretty broad topic question that I'm hoping my  AWS/web developer friends can help me out with. I have an S3 bucket containing a CSV file of data. My goal is to display the data through the form of an HTML table on my website.
The CSV file consists of lists with several values each, which is how I am going to format it. I need to read the CSV file, separate the list by the first element value (a string), and then display data on separate pages associative to the first index element. I have used the boto3 library with Python for extracting the data and then formatting it myself, but I have no experience integrating Python functions with web pages so I am at a loss. Would a Lambda function be the best way to do this? Should I turn the data into a JSON array?
The CSV format is something like this (obviously not the actual data)
'''
['Apple', red, large, sweet],
['Apple', green, small, sour],
['Apple', red, small, sour],
['Orange', orange, medium, sweet] and so on...
'''

I intend to separate the data according to the value in the first index of the list. For my website, different pages will contain a table of the data correlative to the index. So, clicking on the 'Apple' page would display all the instances in the csv file with 'Apple' as the first index and the subsequent data, and so on for Orange. That would look something like
                        red       large       sweet
                        green     small       sour
                        red       small       sour

I know this is a very large question. I'm new to both AWS Lambda and to JavaScript and seeking some direction more than anything else. Thank you!


text:
Q: Pentaho parent-child hierarchy I have the following sql
select
  cd,
  ds,
  cod_unid_super,
  level
from  units
start with cod_unid_super is null
connect by prior cd = cod_unid_super

the unit cd has a superior unit attached to it on cod_unid_super
i want to transform it to a horizontal table like
lv0_cd | lv1_cd | lv2_cd | lv3_cd | lv4_cd | lv5_cd | lv6_cd

but i dont know how to do it using pentaho, any help is welcome
p.s. i know theres only 6 levels of depth.


text:
Q: Extracting a value from an integer Say if I had the value 9010 in Python,
How could I extra the number 10 from 9000 then assign 10 to a variable, such as b = 10.
Cheers.

A: I would stay away from string operations for this:
>>> a = 9010
>>>
>>> b = a % 100
>>>
>>> b
10

A: Here's a simple way to extract the last two digits of an integer:
n = 9010

int(str(n)[-2:])
=> 10

Using a similar idea you can extract any sequence of digits from a number, by first converting it to a string and then extract the required range of digits, by fiddling with the indexes.

A: The easiest way that I can see is to convert it to a string and extract the last two letters.
Like so:
a = 9010 # This is a integer.
b = str(a)[-2:] # str() converts to a string, and [-2:] returns the last two letters of the string.

b # Checking its value.
=> '10' # Now this is a string, if you want it to be a integer use the int() function.

b = int(b) # The old value of b is converted into an integer and saved back into b.
b # Checking its new value.
=> 10 # b is now an integer.

b would then be the string '10'. So use it as a integer, simply convert it by using the int() function. For example int(b)


text:
Q: Filter the results using n-hibernate via matching with another Db table I have already written Hbn & code to fetch the users from db.
with following info
userid, name,email,phone
now we have new requirement in which new table has been created with following fields
Table 1

*

*userid -- foreign key to above user table

*workinglocation

*WorkingStatusId

table 2

*

*WorkingStatusId

*workingstatus

filter criteria is workinglocation and workingstatus
i can not change my existing code.
either i have to write new hbn file and write the code
or should i fetch the data using earlier created hbn and filter it
Please suggest me with the code using linq etc (if possible)

A: either add a collection of Workplaces or whatever to the user and map it then it would be easy to query
from u in session.Query<User>()
from w in u.Workplaces
where ...
select u;

or filter with a correlated subquery after mapping Workplaces


text:
Q: Find value of $t$ between the difference of 3D vectors. Hint: The distance between $2$ vectors equals the magnitude of their difference.
What is the value of $t$ for which the vector
$\mathbf v = \begin{pmatrix} 2 \\ -3 \\ -3 \end{pmatrix} + \begin{pmatrix} 7 \\ 5 \\ -1 \end{pmatrix}t$
is closest to
$\mathbf a = \begin{pmatrix} 4 \\ 4 \\ 5 \end{pmatrix}?$
Using the hint, my idea is to find the difference of v and a and find the magnitude of the value. From there, I can use regular algebraic forms to solve for $t$.
This is what I have done so far:
$\mathbf v$ can be simplified down to $\begin{pmatrix} 2+7t \\ -3+5t \\ -3-t \end{pmatrix}$.
The difference of $\mathbf v$ and $\mathbf a$ is: $\begin{pmatrix} 2+7t \\ -3+5t \\ -3-t \end{pmatrix} - \begin{pmatrix} 4 \\ 4 \\ 5 \end{pmatrix} = \begin{pmatrix} -2+7t \\ -7+5t \\ -8-t \end{pmatrix}$.
Am I solving this problem correctly so far, and do I have the right idea as to how to properly approach this problem?
Thanks.
--Grace

A: Ok, it's long for comment. We should minimize
$$
|v−a|^2=(7t−2)^2+(5t−7)^2+(−t−8)^2=75t^2-82t+117
$$
(actually, it's distance from point $\vec a$ to the line $\vec v$). Without derivatives we can write
$$
75t^2-82t+117=75\left(t^2-\frac{82}{75}t + \frac{41^2}{75^2}\right) + \left(117 - \frac{41^2}{75}\right) =\\= 75\left(t-\frac{41}{75}\right)^2 + \left(117 - \frac{41^2}{75}\right) \ge 117 - \frac{41^2}{75}$$

A: For a straight line given by $x=b+\lambda u$ and a point $ a$ consider the area of the parallelogram spanned by $u$ and $a-b$.  Its area is the length of the cross product of those two.  Divide that area by the length of $u$ to get the height of the parallelogram which is the distance from $a$ to the straight line.


text:
Q: Is there a preferred method/format for replacing broken links with links to archived copies? Is there a preferred method/format for replacing broken links with links to archived copies.
I was viewing this question:
Get id of div from its class name
and found this answer: https://stackoverflow.com/a/6773767
I tried clicking on the (justswell.org) link near the end of the answer, and found the content of the linked page is gone, and the domain is "parked" and indicates it is "for sale".
I found that the page is archived on archive.org (Wayback Machine) so I edited the answer to include the link to the archived page. (At this time, my edit has just now been approved).
To add the archive link, I left the original link intact, but added "strikeout" tags surrounding it, and added the archive.org link following the original link.
The result is pretty ugly, so I'm wondering if it's okay as I did it, or if there is a better/preferred way to do it?

A: First of all, thanks for fixing the link. Not everybody on the Internet knows of the existing of the Wayback Machine, so this is definitely useful. Incidentally, this is why Stack Exchange answers (and questions) may never depend on an external link; those might be useful for further reference but the essence of the answer should be in the post itself. See also Your answer is in another castle: when is an answer not an answer?
You'll note that the Wayback Machine URLs already include the original URL at the end:
http://web.archive.org/web/20130910163544/http://blog.justswell.org/clientside-getelementsbyclassname-cross-browser-implementation/, so there's no need to leave the original link in the post; that's rather messy. I would rather opt for providing a link description like this:

Therefore if you are not supporting these browsers then you can use them else you would need a wrapper js function like one mentioned in this blog post originally found on justswell.org.

Note that if people are interested in how the previous versions of the post looked like, they can always check the revision history (by clicking on the 'edited x minutes/hours ago' link underneath the post); that's another reason why strikeout is generally only used by fools like me for irony.


text:
Q: struts2 UpDownselect not giving full ordered list on form submit I am using Struts2 UpDownSelect component.
But when i am submitting the form instead of getting the comma seperated sorted list I am geeting just one element which was last selected in the list.
JSp :

    <s:form id="saveTableOrder" method="post" action="save-operator-table-order" name="tableOrderForm" >

            <s:select id="operatorSelect" name="selectedOperator" value="selectedOperator" key="operator" list="operators" listKey="operatorName" listValue="operatorName" labelposition="left" onChange="this.form.submit()"/>

            <s:updownselect name="tableOrder" list="tablesOrder"  key="manageOrder" moveDownLabel="Down" moveUpLabel="Up" value="tableOrder" labelposition="left" ></s:updownselect>

            <s:submit key="general.button.save" />
            <input id="operator-table-order-cancel" type="submit" name="action:cancel-operator-table-order" value="<s:property value="getText('general.button.cancel')"/>" />

    </s:form>

Action Class :
public class ManageTableOrderAction extends BOActionSupport {

    private String tableOrder;

    private List<OperatorDTO> operators;

    private String selectedOperator;

    List<String> order = new ArrayList<>();

    @Override
    @SkipValidation
    public String execute() {
        init();
        return SUCCESS;
    }

    private void init() {
        //something
          order.add("one");
            order.add("one");
           .......
    }

    public String saveTableOrder() {
        if (tableOrder != null && !tableOrder.isEmpty()) {
            tableOrder = lobbyTableService.saveTableOrder(selectedOperator, tableOrder);
        }
        return SUCCESS;
    }

    public String cancelTableOrder() {
        return SUCCESS;
    }

    public List<OperatorDTO> getOperators() {
        init();
        return operators;
    }

    public void setOperators(List<OperatorDTO> operators) {
        this.operators = operators;
    }

    public String getSelectedOperator() {
        return selectedOperator;
    }

    public void setSelectedOperator(String selectedOperator) {
        this.selectedOperator = selectedOperator;
    }

    public String getTableOrder() {
        return tableOrder;
    }

    public void setTableOrder(String tableOrder) {
        this.tableOrder = tableOrder;
    }

    public List<String> getTablesOrder() {
       return order;
    }

    public void setTablesOrder(List<String> tablesOrder) {
        this.order = tablesOrder;
    }

Now when clicking submit button. My form is submitted but in tableOrder I get only one element of the list.
I was expecting full list in comma seperated form.
I searched a lot no where found anybody having the same issue
Thanks in advance for help.

A: You need to add <s:head/> tag to your JSP, which adds Struts2 utils.js. This file holds javascript functions which are required for <s:updownselect> tag to work properly.


text:
Q: erro de codigo matlab Alguém me pode dar uma ajuda por favor? Estou a tentar fazer um programa em octave e esta me a dar o seguinte erro:

max recursion depth exceeded
error caled from
size at line 3 column 3
gastos at line 2 column 5

Primeiro implementei uma função gasto para determinar o gasto de uma viatura, com um consumo c (em litros/100km) ao percorrer uma dada distância, dab (dada em km), entre duas cidades com altitudes ha e hb (medidas em metros).
function gc = gasto(ha,hb,dab,c)
  if dab == 0
    gc = 0;

  else
    gc = (c/100) * dab * (1+ 100*(hb-ha)/(1000*dab))^2;

  end;
end

Depois implementei uma função, gastos, para transformar uma matriz de distâncias, indicada pelo parâmetro Grafo, numa matriz de gastos, C, usando a função gasto, aplicável a distâncias não nulas.
function G = gastos(Grafo,Altitudes,consumo)
  n = size(Grafo,1);
  G = zeros(n,n);

  for i = 1 : n
    for j = 1 : n

     if Grafo(i,j) == 0;
       G(i,j) = Inf;

     else
       G(i,j) = gasto(Altitudes(i),Altitudes(j),Grafo(i,j),consumo);

     end;
  end;
end

eu utilizei Grafo = [0,102,89,0,136; 102,0,157,172,39; 89,157,0,58,0; 0,172,58,0,95; 136,39,0,95,0] Altitudes = [100, 160, 85, 90, 130] consumo = 6.5 e ao chamar a funcao gastos(Grafo,Altitudes,consumo) deu-me esse erro , mas nao percebi porque?

alguém consegue dizer-me porque é que está a aparecer este erro?

A: Isto me parece um erro na entrada da função size.
Qual o tamanho da variável Grafo?
Se a variável Grafo estiver vazia, ela tem dimensão zero. Se você pedir o numero de variáveis na dimensão 1 ela irá ter problemas.

max recursion depth

é uma variável do sistema que pode estar sendo chamada, se a Grafo estiver vazia, neste caso a dimensão 1 é maior que o limite de dimensões. Mas isto é apenas uma idea.
Infelizmente o manual da função size não dá mais detalhes.
Rodando com os valores adicionados a sua pergunta, obtive

G=[       Inf    7.4329    5.5916       Inf    9.2343
    5.8729       Inf    9.2533   10.2885    2.1600
    5.9816   11.2033       Inf    3.8353       Inf
       Inf   12.1085    3.7053       Inf    6.7059
    8.4543    2.9400       Inf    5.6659       Inf]

Que é o que eu esperava (não verifiquei os valores).


text:
Q: How do I put Spock interactions on multiple lines? I have a really long interaction in Spock
reallyLongVariable.reallyLongMethod(argument, _, _, _, _, _) >> {n, a, builder, c, d, e -> builder.anotherLongMethod(SomeClass.staticInitializer(trackId));}

I would like to put it on multiple lines but get a Groovyc: unexpected token >> error message when I try to break it into multiple lines here.
reallyLongVariable.reallyLongMethod(argument, _, _, _, _, _)
    >> {n, a, builder, c, d, e -> builder.anotherLongMethod(SomeClass.staticInitializer(trackId));}

Is there a way to break the statement into multiple lines before the >>?

A: Unlike Java, Groovy doesn't allow to break before an operator, but only after an operator. Another common solution is to break after the ->.


text:
Q: Asymptotic expansion of an integral, related to Maass forms I am trying to compute the asymptotic expansion of the integral
$I(t) = \int_{C} e^{\sqrt{1+u}(\frac{1}{t}+\frac{t^2}{\sqrt{u}})}\frac{u^\eta}{\sqrt{1+u}}du$
as $t$ is real and $t\rightarrow +\infty$, where $\eta$ a fixed complex number, and $C$ is a unit circle. It occurs in the theory of Maass forms/Automorphic forms.
I understand the Laplace method to compute the asymptotic expansion for the integral from 0 to
$\infty$ but here is in the unit circle and at the point $-1$ the denominator $\sqrt{1+u}=0$.
Do you have any suggestion to compute it?
Thank you very much.


text:
Q: How can I assign a class method to a value within a HashMap? I'm creating a text-based "Game of Real Life" program. I am struggling with finding an efficient way to allocate methods that will carry out the directions given by each tile of the game board (linear game board with definite start/finish points). Each player in the game is represented by an object of class "Player" containing variables for different game statistics (including a placeholder value for their position on the board), and every player object is contained within a hash map. I would like to create a loop that would cycle through each player object and, based on the respective placeholder value, reference a specific method for that tile of the board.
My Main class:
import java.util.Scanner;
import java.util.HashMap;

public class Main {

public static void main(String[] args) {
    Coin coin = new Coin();
    Die die = new Die();
    Scanner choice = new Scanner(System.in);

    System.out.println("Choose player amount:");
    int n = choice.nextInt();

    /*This map contains master list of all players and player values*/
    HashMap<Integer, Player> playerList = new HashMap<Integer, Player>();

    /*This map contains just the true_false value of life for each player*/
    HashMap<Integer, Boolean> lifeCheck = new HashMap<Integer, Boolean>();

    /*This section defines number/sex/name of each player*/
    for (int y = 1; y <= n; y++) {
        System.out.println("New player now flips a coin.");
        coin.flip();
        if (coin.get() == true) {
            System.out.println("You flipped heads! You are a man.");
        } else {
            System.out.println("You flipped tails! You are a woman.");
        }

        System.out.println("What is your name?");
        String user = choice.next();
        playerList.put(y, new Player(user));

        /*This adds a check functionality to ensure live players still exist*/
        lifeCheck.put(y, playerList.get(y).pulse());
    }

    /*This invokes a new instance of our game board*/
    GameSpace gameBoard = new GameSpace();/*Not yet defined*/

    /*This do_while loop checks that a live player exists after each turn*/
    do {
        /*This is where I think I would be putting the majority of
                   the game code*/

    } while (lifeCheck.containsValue(true));

    /*This tests to see if my player naming loop works properly*/
    /*
    int x = 1;
    for (int i = 1; i <= n; i++) {
        System.out.println("Player number " + x + " is named " + playerList.get(i).name);
        x++;
    }
    */

    choice.close();
}
}

My Player class:
public class Player {
public boolean gender;
public String name;
public int wealthClass;
public double income;
public double wealth;
public double health;
public boolean parent = false;
public boolean disabled = false;
public boolean alive = true;
public double placeHold = 1;

public Player(String playerName) {
    name = playerName;
}

public boolean getGender() {
    return gender;
}
public String getName() {
    return name;
}
public int getCaste() {
    return wealthClass;
}
public double getIncome() {
    return income;
}
public double getWealth() {
    return wealth;
}
public double getHealth() {
    return health;
}
public boolean getParent() {
    return parent;
}
public boolean getDisabled() {
    return disabled;
}
public boolean pulse() {
    return alive;
}
public double getPosition() {
    return placeHold;
}

public void move() {
    Die die1 = new Die();
    die1.roll();
    placeHold += die1.get();
    System.out.println("You moved forward " + die1.get() + " spaces.");
}

public void main(String[] args) {
    if (health <= 0) {
        alive = false;
    }
}
}

My Coin class:
public class Coin {
private boolean face;

public Coin() {
    flip();
}
public void flip() {
    double x = (Math.floor(Math.random()*2));
    if (x == 0) {
        face = true;
    } else {
        face = false;
    }
}
public boolean get() {
    return face;
}
}

Where would be the most logical place to go from here?

A: If the HashMap's value is the name of the method you want to call, you should be able to use reflection:
HashMap<Integer, String> map = new HashMap<>();
map.put(0, "methodName1");
map.put(1, "methodName2");

String methodName = map.get(player.getPosition());
Method method = Player.class.getDeclaredMethod(methodName);
method.invoke();

A: If I understand the question, you are asking how to store a method associated with each position on the board the specifies what to do at that position. If so, I would suggest you encapsulate it in the position. That would be best defined as an interface:
interface Position {
    void operateOnPlayer(Player player);
}

Then your board becomes a map from the distance from the start to a Position implementation:
Map<Integer,Position> board;

If you are using Java 8 then you can even use lambdas to define the positions:
board.put(17, player -> player.moveBack(4));
board.put(16, player -> player.skipATurn());

It will work just as well in previous versions of Java you'll just need to create (potentially anonymous) implementations of Position.
Calling these is then pretty trivial:
for (Player player: players)
    board.get(player.getPosition()).operateOnPlayer(player);

Or, even better, add that to the Player class so you don't need to expose the position field:
class Player {
    public takeTurn() {
        board.get(position).operateOnPlayer(this);
    }
}

There are other mechanisms, such as mapping to a Consumer<Player>, but I really don't think they are as good design as defining an explicit interface;


text:
Q: Постепенная отрисовка элементов в adapterView Всем доброго времени суток. Помогите пожалуйста решить проблему. Суть в следующем: создаю приложение для итернет магазина, продукты там распределены по подкатегориям (как и везде),которые в свою очередь распределены по общим категориям. Содержимое подкатегории я загружаю в gridView, т.е. для каждого продукта отрисовывается ячейка, которая содержит изображение продукта, цену, выпадающий список с весом(порцией), названием, ценой, изображением-гамбургером для popup меню, названием продукта, кнопкой "добавить в корзину" и ещё несколькими элементами. Все они безусловно нужны. При загрузке объемных подкатегорий появляется проблема, а именно - адаптер съедает всю оперативную память. И если он не съедает ее на первоначальной загрузке, то в процессе скролла съест точно:)
содержимое ячейки gridView создаётся программно (без xml шаблона), данные для продукта я получаю с сервера в JSON. Т.е. я делаю AsyncTask на запрос JSONa, который содержит все продукты категории, в onPostExecute на его основе создаю объекты Product, на основе массива Product создаю ячейки gridView, куда подгружаю картинки при помощи UniversalImageLoader. В адаптер передаю уже готовый ArrayList с View, которые возвращаю в getView по индексу.
Если создавать новый View для ячейки GridView в AsyncTask'е, то компилятор ругается, говорит, что вью необходимо создавать в основном потоке. если на рубеже - в onPostExecute, когда загружены данные и уже готовится содержимое GridView, то приходится очень долго ждать прежде, чем увидим содержимоое категории, и в итоге на больших категориях все равно рискуем получить коллапс памяти.
Чтобы не было коллапсов памяти возникла идея сделать постепенную отрисовку gridView, на манер того, что можно увидеть на PlayMarket, сначала загружается часть списка, после её загрузки - следующая, и так, пока не будут отображены все продукты. Каким образом можно научить адаптер работать таким образом? Буду очень признателен за ссылку на реализацию такой идеи или на библиотеку, которая может с этим помочь.
Обновление
Адаптер
private final class GridAdapter extends BaseAdapter {

    private ArrayList<ItemProductInGridView> views = new ArrayList<>();

    public GridAdapter(ArrayList<ItemProductInGridView> views) {
        this.views = views;
    }

    @Override
    public int getCount() {
        return views.size();
    }

    @Override
    public ItemProductInGridView getItem(int position) {
        return views.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public android.view.View getView(final int position, final View convertView, ViewGroup parent) {

        return views.get(position);

    }
}

таск
private final class ParseTask extends AsyncTask<Integer, Void, String> {

        @Override
        protected String doInBackground(Integer... params) {
            String category = null;
            try {
                category = Connection.getHttpString(Data.url_domain + Data.url_category + Data.CatalogData.gridview_parent); //getHttpString возвращает конвертированный в строку поток, полученный по юрлу
                JSONObject categoryJSON = new JSONObject(category);
                JSONArray productArray = categoryJSON.getJSONArray("product");
                int productCount = productArray.length();

                for (int position = 0; position < productCount; position++) {
                    allProductsInCurrentCategory.add(new Product(Data.CatalogData.gridview_parent, productArray.getJSONObject(position), null)); // парсим JSON и делаем объекты Product
                }
            } catch (JSONException | ParseException | IOException e) {
                e.printStackTrace();
            }
            return category;
        }

        @Override
        protected void onPostExecute(String strJson) throws RuntimeException {
            super.onPostExecute(strJson);

            bar.setVisibility(android.view.View.GONE);
            textView.setVisibility(android.view.View.GONE);
            gridView.setVisibility(android.view.View.VISIBLE);

            productsInGridView = setProductsList(allProductsInCurrentCategory); // сортировка продуктов (по доступности на текущую дату)
            for (Product p : productsInGridView) {

                viewsForCurrentCategory.add(new ItemProductInGridView(
                        getActivity(),
                        p
                )); // viewsForCurrentCategory это ArrayList с View, который в дальнейшем передаётся адаптеру, ItemProductInGridView - ячейка в GridView
            }
            gridAdapter = new GridAdapter(viewsForCurrentCategory);
            gridView.setAdapter(gridAdapter);
        }

    }

В общем то ничего необычного. Но если, как вы сказали, использовать convertView, или setTag-getTag - паттерн холдер, как я понимаю, то продукты начинают повторяться. Основная загрузка памяти приходится на onPostExecute, где сначала парсится json, потом сортируется, потом создаются вьюшки

A: Вы удивитесь, но в ListView (GridView) можно отображать хоть 100 миллионов записей и без тормозов и нехватки памяти вовсе. ListView содержит 10 (сколько влезает на экран плюс 1,2) view, при прокрутке в них меняются только данные.
Посмотрите ролик The world of ListView с Google IO 2010. В особенности обратите внимание на раздел Gotchas and don'ts - о том, что кэшировать view ни к чему, о том, что создание своих view плюс scrollview применимо для нескольких элементов, потому что listview слишком мощный инструмент. Т.е. вы изобретаете велосипед.
ЗЫ Вполне возможно, что стоит уже переходить на RecyclerView (в особенности если списки у вас редактируемые). Хотя там пока возможностей может каких-то не хватать...

A: GridView, как и ListView практикует повторное использование View. Поэтому вам ненужно пересоздавать View для каждой ячейки. В адаптер вам приходит convertView одним из параметров. Если он != null, значит нужно просто заполнить его правильными данными, а не создавать новый. К тому же, нет абсолютно никаких преймуществ в том, чтобы создавать View программно вместо того, чтобы использовать xml разметку.
Также вам необходимо использовать паттерн ViewHolder. Он ускорит работу. Еще хорошо бы организовать постраничную загрузку данных.


text:
Q: Getting active PostgreSQL connection username when stored through authentication configuration in QGIS 3.16 How do I get the username on the current layer PostGIS in QGIS 3.16.2-Hannover?
We tried examples: Getting active PostgreSQL connection username when stored through authentication configuration in QGIS 3, but they don't work.
When running this script, variable username is empty:
layer = iface.activeLayer()
provider = layer.dataProvider()
username = QgsDataSourceUri(provider.dataSourceUri()).username()
print (username)

This is result of provider.dataSourceUri()):

<QgsDataSourceUri: dbname='postgres' host= localhost port=5432
sslmode=disable key='id' srid=4326 type=Point
checkPrimaryKeyUnicity='1' table="locations"."airlines" (geom)>

The value of the username is missing, the question is how to get the username for the current layer?

A: You can select your PostgreSQL user using the 'PostgreSQL Execute SQL' command in the Processing toolbox.
Query:
SELECT user;


text:
Q: Permanent fix for "Do you want to change the color scheme to improve performance?" warning? I have a problem where dwm.exe keeps suggesting I disable Aero to improve my performance whenever I play either Battlefield 3 or Anno 2070.
I get three choices:

*

*Disable Aero

*Don't disable but ask again.

*Don't disable and never ask again.

The last one is the only acceptable choice. But still it doesn't keep the pop up from appearing every time I run a full-screen application.
I've tried:

*

*Changing Action Center settings to not show Windows Troubleshooting messages.

*Disabling Windows Performance Logging and Alerts in the service manager.

*Making changes to perfmon.

Disabling Desktop Composition, either on a by-program basis or completely, is NOT a valid solution to this problem.
There is no problem with my resources or performance, I just want to get rid of this Windows bug.
Again, to clarify: my rig can handle running Aero, VLC with a 1080p movie in one screen and Battlefield3 at 120fps in the other without as much as a hickup, I just want the pop-up gone for ever without having to sacrifice Aero.
I've had Windows 7 x64 on three machines by now, some much lower-performing than my current, and it is the first time I'm having this problem.
Please help!

A: I've finally found a solution!
Since Windows doesn't understand how resources work, you need to keep it from checking them:
In regedit go to:
HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM
(create if not already existent)
Set a new DWORD UseMachineCheck with a value of 0.
This will keep Windows from checking if your computer "performs slowly" and thus attempting to disable Aero.
Solved all my problems!

A: You need to disable the message itself, although this will most likely disable other messages relating to performance.
- Go to your Action Centre, type that into your Start Menu and open it.
- Choose "Change Action Centre Settings" from the sidebar on the left.
- Untick the "Windows Troubleshooting" checkbox near the bottom of the window.
- Click "OK".

That should subdue the message for you.

A: The solution comes in two steps:
step 1:

*

*Open up Quicktime

*Edit > Prefrences > QuickTime Preferences

*Advanced Tab

*Under Video in Advanced click Safe Mode

step 2:
Run menu > sysdm.cpl > Advanced Tab > performance > select adjust for best performance > make sure you do not allow Windows to choose for you because your computer does not know whats best --- Make sure Enable Aero Peek is checked
---- OR ---
Right click my computer > properties > Advanced System settings > performance > select adjust for best performance > make sure you do not allow Windows to choose for you because your computer does not know whats best --- Make sure Enable Aero Peek is checked
note: if you are using "Doublesight DS-70U" , a bad "smart USB monitor" driver might be the cause.
note2: this link might also be of help.
credits: forum link


text:
Q: CSS Image/Text Menu Cross Browser Issue I'm having an issue.
I'm trying to display some images alongside some text in a menu, however each image has a larger height than the text therefore the text is centered to the image.
Essentially, this is the site: http://www.sasstraliss.org/scme2202
And, it views perfectly fine in firefox.
In chrome, it displays vertically. In IE, the images are squashed.
Where has my CSS gone wrong?
I'm using this approach for the images...
#menu img {
min-height: 1em;
display: table-cell;
vertical-align: middle;
padding: 0px 0px 0px 10px;
}

A: I just tried removing min-height and the table cell display, and it works fine now.

A: I haven't looked at your code but assuming that you have something like this in your HTML:

    Some text
    Other text

The following CSS should do the trick:
div#menu {
overflow: auto;
}
    div#menu a {
    float: left;
    margin-left: 10px;
    }
        div#menu a img {
        height: 60px;
        width: 60px;
        margin-right: 10px;
        vertical-align: middle;
        }

Note: it is good practice to always set the dimensions of your images explicitly, this speeds up page rendering and stops things jumping around as the page is reflowed during loading.


text:
Q: pyodbc.OperationalError: ('HYT00', u'[HYT00] [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0) (SQLDriverConnect)') Using the SQL Server Management Studio (SSMS) Express, I can find the database and connect without problems.
But when I use pyodbc to connect to the same server using:
    import pyodbc
    Server = r"xxxER\xxxSQLSERV"
    db = "xxxDB"
    user = "xxx"
    password = "xxxx"
    conn = pyodbc.connect('DRIVER={SQL Server};SERVER='+server + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)

By Using Pyhton in my local i am able to connect but when i am trying in linux server getting below error
pyodbc.OperationalError: ('HYT00', u'[HYT00] [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

i tried with ODBC Driver 17 for SQL Server too but facing the same issue.Can any one please suggest me on this.

A: Microsoft's SQL Server ODBC drivers for Linux are unable to resolve instance names. You can use the free sqlserverport module to get the corresponding port number and use that to connect.

A: Try removing the instance from server and set it as
Server = "xxxER"
or if you have a port number append it as
Server = "xxxER,portNo"

A: I have this problem and solved my problem in  here.
Just add version.
conn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)

If not work change version 17 to 13 if not to 11 .
List versions of ODBC.

A: Check your mssql network config, my problem was there.
Enable port 1433 for all IPs.
Now is working with IP and host name.

A: I am using SSH Tunnel with remote server port forward to localhost,1433. This pyodbc connection intermittently fails if using the approach:
cnxn = pyodbc.connect('driver={ODBC Driver 17 for SQL Server};Server=localhost, 1433;'...

Replacing localhost with 127.0.0.1 seems to be working all the time
cnxn = pyodbc.connect('driver={ODBC Driver 17 for SQL Server};Server=127.0.0.1, 1433;'
Incidentally also did same using Ruby and FreeTDS, and Localhost,1433 worked all the time.. Must be something inside the pyodbc package or their approach that sometimes drop some info to make the DBMS on server fail to respond/timeout

A: This worked for me:
mssql://DRIVER={ODBC Driver 17 for SQL Server};SERVER={server_address,PORT};DATABASE=<my_database>;UID=<my_username>;PWD=<my_password>


text:
Q: python numpy find y value based on x value I want to get column y that has maximum x value.
If I have
arr = [[1, 1],[1, 2],[3, 0],[4, 7],[3, 1],[4, 6]]

Since the minimum x value is 1, I want the value 1 and 2.
So far, I got the minimum x value by
min = np.amin(arr, axis=0)

but I don't know how to get the other value which has the min value

A: Use np.min to find the minimum x-coordinate and then boolean indexing to find all the matching values.
import numpy as np

arr = np.array([[1, 1], [1, 2], [3, 0], [4, 7], [3, 1], [4, 6]])

# find the minimum across the x coordinate
mi = np.min(arr[:, 0])

# find all the positions equals to the minimum using boolean indexing and get the y coordinate
res = arr[arr[:, 0] == mi, 1]

print(res)

Output
[1 2]

Note: Don't use min as a variable name because it shadows the built-in function.


text:
Q: Get icon class name to list in c# from frontawesome I'd like to download list of all name icon class to list or array in c#.
I'm looking for help on how best to do this.
Is it best to use a css file for this, or can it be done directly on:
https://fontawesome.com/v5/cheatsheet
Best regards
Monika

A: Another way
var client = new HttpClient();
var result = await client.GetAsync("https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/metadata/icons.json");
var sdf = await result.Content.ReadAsStringAsync();
var names =JToken.Parse(sdf)
  .Children<JProperty>()
  .Select(x => x.Name);

Output
500px
accessible-icon
accusoft
acquisitions-incorporated
ad
address-book
address-card
adjust
adn
adversal
...

A: Full list of version 4.3 icon class names
fa-500px
fa-address-book
fa-address-book-o
fa-address-card
fa-address-card-o
fa-adjust
fa-adn
fa-align-center
fa-align-justify
fa-align-left
fa-align-right
fa-amazon
fa-ambulance
fa-american-sign-language-interpreting
fa-anchor
fa-android
fa-angellist
fa-angle-double-down
fa-angle-double-left
fa-angle-double-right
fa-angle-double-up
fa-angle-down
fa-angle-left
fa-angle-right
fa-angle-up
fa-apple
fa-archive
fa-area-chart
fa-arrow-circle-down
fa-arrow-circle-left
fa-arrow-circle-o-down
fa-arrow-circle-o-left
fa-arrow-circle-o-right
fa-arrow-circle-o-up
fa-arrow-circle-right
fa-arrow-circle-up
fa-arrow-down
fa-arrow-left
fa-arrow-right
fa-arrow-up
fa-arrows
fa-arrows-alt
fa-arrows-h
fa-arrows-v
fa-asl-interpreting
fa-assistive-listening-systems
fa-asterisk
fa-at
fa-audio-description
fa-automobile
fa-backward
fa-balance-scale
fa-ban
fa-bandcamp
fa-bank
fa-bar-chart
fa-bar-chart-o
fa-barcode
fa-bars
fa-bath
fa-bathtub
fa-battery
fa-battery-0
fa-battery-1
fa-battery-2
fa-battery-3
fa-battery-4
fa-battery-empty
fa-battery-full
fa-battery-half
fa-battery-quarter
fa-battery-three-quarters
fa-bed
fa-beer
fa-behance
fa-behance-square
fa-bell
fa-bell-o
fa-bell-slash
fa-bell-slash-o
fa-bicycle
fa-binoculars
fa-birthday-cake
fa-bitbucket
fa-bitbucket-square
fa-bitcoin
fa-black-tie
fa-blind
fa-bluetooth
fa-bluetooth-b
fa-bold
fa-bolt
fa-bomb
fa-book
fa-bookmark
fa-bookmark-o
fa-braille
fa-briefcase
fa-btc
fa-bug
fa-building
fa-building-o
fa-bullhorn
fa-bullseye
fa-bus
fa-buysellads
fa-cab
fa-calculator
fa-calendar
fa-calendar-check-o
fa-calendar-minus-o
fa-calendar-o
fa-calendar-plus-o
fa-calendar-times-o
fa-camera
fa-camera-retro
fa-car
fa-caret-down
fa-caret-left
fa-caret-right
fa-caret-square-o-down
fa-caret-square-o-left
fa-caret-square-o-right
fa-caret-square-o-up
fa-caret-up
fa-cart-arrow-down
fa-cart-plus
fa-cc
fa-cc-amex
fa-cc-diners-club
fa-cc-discover
fa-cc-jcb
fa-cc-mastercard
fa-cc-paypal
fa-cc-stripe
fa-cc-visa
fa-certificate
fa-chain
fa-chain-broken
fa-check
fa-check-circle
fa-check-circle-o
fa-check-square
fa-check-square-o
fa-chevron-circle-down
fa-chevron-circle-left
fa-chevron-circle-right
fa-chevron-circle-up
fa-chevron-down
fa-chevron-left
fa-chevron-right
fa-chevron-up
fa-child
fa-chrome
fa-circle
fa-circle-o
fa-circle-o-notch
fa-circle-thin
fa-clipboard
fa-clock-o
fa-clone
fa-close
fa-cloud
fa-cloud-download
fa-cloud-upload
fa-cny
fa-code
fa-code-fork
fa-codepen
fa-codiepie
fa-coffee
fa-cog
fa-cogs
fa-columns
fa-comment
fa-comment-o
fa-commenting
fa-commenting-o
fa-comments
fa-comments-o
fa-compass
fa-compress
fa-connectdevelop
fa-contao
fa-copy
fa-copyright
fa-creative-commons
fa-credit-card
fa-credit-card-alt
fa-crop
fa-crosshairs
fa-css3
fa-cube
fa-cubes
fa-cut
fa-cutlery
fa-dashboard
fa-dashcube
fa-database
fa-deaf
fa-deafness
fa-dedent
fa-delicious
fa-desktop
fa-deviantart
fa-diamond
fa-digg
fa-dollar
fa-dot-circle-o
fa-download
fa-dribbble
fa-drivers-license
fa-drivers-license-o
fa-dropbox
fa-drupal
fa-edge
fa-edit
fa-eercast
fa-eject
fa-ellipsis-h
fa-ellipsis-v
fa-empire
fa-envelope
fa-envelope-o
fa-envelope-open
fa-envelope-open-o
fa-envelope-square
fa-envira
fa-eraser
fa-etsy
fa-eur
fa-euro
fa-exchange
fa-exclamation
fa-exclamation-circle
fa-exclamation-triangle
fa-expand
fa-expeditedssl
fa-external-link
fa-external-link-square
fa-eye
fa-eye-slash
fa-eyedropper
fa-fa
fa-facebook
fa-facebook-f
fa-facebook-official
fa-facebook-square
fa-fast-backward
fa-fast-forward
fa-fax
fa-feed
fa-female
fa-fighter-jet
fa-file
fa-file-archive-o
fa-file-audio-o
fa-file-code-o
fa-file-excel-o
fa-file-image-o
fa-file-movie-o
fa-file-o
fa-file-pdf-o
fa-file-photo-o
fa-file-picture-o
fa-file-powerpoint-o
fa-file-sound-o
fa-file-text
fa-file-text-o
fa-file-video-o
fa-file-word-o
fa-file-zip-o
fa-files-o
fa-film
fa-filter
fa-fire
fa-fire-extinguisher
fa-firefox
fa-first-order
fa-flag
fa-flag-checkered
fa-flag-o
fa-flash
fa-flask
fa-flickr
fa-floppy-o
fa-folder
fa-folder-o
fa-folder-open
fa-folder-open-o
fa-font
fa-font-awesome
fa-fonticons
fa-fort-awesome
fa-forumbee
fa-forward
fa-foursquare
fa-free-code-camp
fa-frown-o
fa-futbol-o
fa-gamepad
fa-gavel
fa-gbp
fa-ge
fa-gear
fa-gears
fa-genderless
fa-get-pocket
fa-gg
fa-gg-circle
fa-gift
fa-git
fa-git-square
fa-github
fa-github-alt
fa-github-square
fa-gitlab
fa-gittip
fa-glass
fa-glide
fa-glide-g
fa-globe
fa-google
fa-google-plus
fa-google-plus-circle
fa-google-plus-official
fa-google-plus-square
fa-google-wallet
fa-graduation-cap
fa-gratipay
fa-grav
fa-group
fa-h-square
fa-hacker-news
fa-hand-grab-o
fa-hand-lizard-o
fa-hand-o-down
fa-hand-o-left
fa-hand-o-right
fa-hand-o-up
fa-hand-paper-o
fa-hand-peace-o
fa-hand-pointer-o
fa-hand-rock-o
fa-hand-scissors-o
fa-hand-spock-o
fa-hand-stop-o
fa-handshake-o
fa-hard-of-hearing
fa-hashtag
fa-hdd-o
fa-header
fa-headphones
fa-heart
fa-heart-o
fa-heartbeat
fa-history
fa-home
fa-hospital-o
fa-hotel
fa-hourglass
fa-hourglass-1
fa-hourglass-2
fa-hourglass-3
fa-hourglass-end
fa-hourglass-half
fa-hourglass-o
fa-hourglass-start
fa-houzz
fa-html5
fa-i-cursor
fa-id-badge
fa-id-card
fa-id-card-o
fa-ils
fa-image
fa-imdb
fa-inbox
fa-indent
fa-industry
fa-info
fa-info-circle
fa-inr
fa-instagram
fa-institution
fa-internet-explorer
fa-intersex
fa-ioxhost
fa-italic
fa-joomla
fa-jpy
fa-jsfiddle
fa-key
fa-keyboard-o
fa-krw
fa-language
fa-laptop
fa-lastfm
fa-lastfm-square
fa-leaf
fa-leanpub
fa-legal
fa-lemon-o
fa-level-down
fa-level-up
fa-life-bouy
fa-life-buoy
fa-life-ring
fa-life-saver
fa-lightbulb-o
fa-line-chart
fa-link
fa-linkedin
fa-linkedin-square
fa-linode
fa-linux
fa-list
fa-list-alt
fa-list-ol
fa-list-ul
fa-location-arrow
fa-lock
fa-long-arrow-down
fa-long-arrow-left
fa-long-arrow-right
fa-long-arrow-up
fa-low-vision
fa-magic
fa-magnet
fa-mail-forward
fa-mail-reply
fa-mail-reply-all
fa-male
fa-map
fa-map-marker
fa-map-o
fa-map-pin
fa-map-signs
fa-mars
fa-mars-double
fa-mars-stroke
fa-mars-stroke-h
fa-mars-stroke-v
fa-maxcdn
fa-meanpath
fa-medium
fa-medkit
fa-meetup
fa-meh-o
fa-mercury
fa-microchip
fa-microphone
fa-microphone-slash
fa-minus
fa-minus-circle
fa-minus-square
fa-minus-square-o
fa-mixcloud
fa-mobile
fa-mobile-phone
fa-modx
fa-money
fa-moon-o
fa-mortar-board
fa-motorcycle
fa-mouse-pointer
fa-music
fa-navicon
fa-neuter
fa-newspaper-o
fa-object-group
fa-object-ungroup
fa-odnoklassniki
fa-odnoklassniki-square
fa-opencart
fa-openid
fa-opera
fa-optin-monster
fa-outdent
fa-pagelines
fa-paint-brush
fa-paper-plane
fa-paper-plane-o
fa-paperclip
fa-paragraph
fa-paste
fa-pause
fa-pause-circle
fa-pause-circle-o
fa-paw
fa-paypal
fa-pencil
fa-pencil-square
fa-pencil-square-o
fa-percent
fa-phone
fa-phone-square
fa-photo
fa-picture-o
fa-pie-chart
fa-pied-piper
fa-pied-piper-alt
fa-pied-piper-pp
fa-pinterest
fa-pinterest-p
fa-pinterest-square
fa-plane
fa-play
fa-play-circle
fa-play-circle-o
fa-plug
fa-plus
fa-plus-circle
fa-plus-square
fa-plus-square-o
fa-podcast
fa-power-off
fa-print
fa-product-hunt
fa-puzzle-piece
fa-qq
fa-qrcode
fa-question
fa-question-circle
fa-question-circle-o
fa-quora
fa-quote-left
fa-quote-right
fa-ra
fa-random
fa-ravelry
fa-rebel
fa-recycle
fa-reddit
fa-reddit-alien
fa-reddit-square
fa-refresh
fa-registered
fa-remove
fa-renren
fa-reorder
fa-repeat
fa-reply
fa-reply-all
fa-resistance
fa-retweet
fa-rmb
fa-road
fa-rocket
fa-rotate-left
fa-rotate-right
fa-rouble
fa-rss
fa-rss-square
fa-rub
fa-ruble
fa-rupee
fa-s15
fa-safari
fa-save
fa-scissors
fa-scribd
fa-search
fa-search-minus
fa-search-plus
fa-sellsy
fa-send
fa-send-o
fa-server
fa-share
fa-share-alt
fa-share-alt-square
fa-share-square
fa-share-square-o
fa-shekel
fa-sheqel
fa-shield
fa-ship
fa-shirtsinbulk
fa-shopping-bag
fa-shopping-basket
fa-shopping-cart
fa-shower
fa-sign-in
fa-sign-language
fa-sign-out
fa-signal
fa-signing
fa-simplybuilt
fa-sitemap
fa-skyatlas
fa-skype
fa-slack
fa-sliders
fa-slideshare
fa-smile-o
fa-snapchat
fa-snapchat-ghost
fa-snapchat-square
fa-snowflake-o
fa-soccer-ball-o
fa-sort
fa-sort-alpha-asc
fa-sort-alpha-desc
fa-sort-amount-asc
fa-sort-amount-desc
fa-sort-asc
fa-sort-desc
fa-sort-down
fa-sort-numeric-asc
fa-sort-numeric-desc
fa-sort-up
fa-soundcloud
fa-space-shuttle
fa-spinner
fa-spoon
fa-spotify
fa-square
fa-square-o
fa-stack-exchange
fa-stack-overflow
fa-star
fa-star-half
fa-star-half-empty
fa-star-half-full
fa-star-half-o
fa-star-o
fa-steam
fa-steam-square
fa-step-backward
fa-step-forward
fa-stethoscope
fa-sticky-note
fa-sticky-note-o
fa-stop
fa-stop-circle
fa-stop-circle-o
fa-street-view
fa-strikethrough
fa-stumbleupon
fa-stumbleupon-circle
fa-subscript
fa-subway
fa-suitcase
fa-sun-o
fa-superpowers
fa-superscript
fa-support
fa-table
fa-tablet
fa-tachometer
fa-tag
fa-tags
fa-tasks
fa-taxi
fa-telegram
fa-television
fa-tencent-weibo
fa-terminal
fa-text-height
fa-text-width
fa-th
fa-th-large
fa-th-list
fa-themeisle
fa-thermometer
fa-thermometer-0
fa-thermometer-1
fa-thermometer-2
fa-thermometer-3
fa-thermometer-4
fa-thermometer-empty
fa-thermometer-full
fa-thermometer-half
fa-thermometer-quarter
fa-thermometer-three-quarters
fa-thumb-tack
fa-thumbs-down
fa-thumbs-o-down
fa-thumbs-o-up
fa-thumbs-up
fa-ticket
fa-times
fa-times-circle
fa-times-circle-o
fa-times-rectangle
fa-times-rectangle-o
fa-tint
fa-toggle-down
fa-toggle-left
fa-toggle-off
fa-toggle-on
fa-toggle-right
fa-toggle-up
fa-trademark
fa-train
fa-transgender
fa-transgender-alt
fa-trash
fa-trash-o
fa-tree
fa-trello
fa-tripadvisor
fa-trophy
fa-truck
fa-try
fa-tty
fa-tumblr
fa-tumblr-square
fa-turkish-lira
fa-tv
fa-twitch
fa-twitter
fa-twitter-square
fa-umbrella
fa-underline
fa-undo
fa-universal-access
fa-university
fa-unlink
fa-unlock
fa-unlock-alt
fa-unsorted
fa-upload
fa-usb
fa-usd
fa-user
fa-user-circle
fa-user-circle-o
fa-user-md
fa-user-o
fa-user-plus
fa-user-secret
fa-user-times
fa-users
fa-vcard
fa-vcard-o
fa-venus
fa-venus-double
fa-venus-mars
fa-viacoin
fa-viadeo
fa-viadeo-square
fa-video-camera
fa-vimeo
fa-vimeo-square
fa-vine
fa-vk
fa-volume-control-phone
fa-volume-down
fa-volume-off
fa-volume-up
fa-warning
fa-wechat
fa-weibo
fa-weixin
fa-whatsapp
fa-wheelchair
fa-wheelchair-alt
fa-wifi
fa-wikipedia-w
fa-window-close
fa-window-close-o
fa-window-maximize
fa-window-minimize
fa-window-restore
fa-windows
fa-won
fa-wordpress
fa-wpbeginner
fa-wpexplorer
fa-wpforms
fa-wrench
fa-xing
fa-xing-square
fa-y-combinator
fa-y-combinator-square
fa-yahoo
fa-yc
fa-yc-square
fa-yelp
fa-yen
fa-yoast
fa-youtube
fa-youtube-play
fa-youtube-square

A: I used this code to generate a class with const strings... should be easy to change to get an array (the .Dump() are for linqpad):
void Main()
{
    var text = File.ReadAllText(@"<path-to-fontawesome-css-file>\all.css");
    var allMatches = Regex.Matches(text, @"^\.fa\-(.*):", RegexOptions.Multiline);
    var ti = new CultureInfo("en-US",false).TextInfo;
    "public partial class Icon".Dump();
    "{".Dump();
    foreach(var match in allMatches.Cast<Match>().Select(x => x.Groups[1].Value)) {
        var name = ti.ToTitleCase(match.Replace("-", " ")).Replace(" ", "");
        if(Regex.IsMatch(name, "^[0-9]")) name = "_" + name;
        ("\t public const string " + name + " = \"" + match + "\";").Dump();
    }
    "}".Dump();
}

Generates this:
    public partial class Icon
    {
        public const string _500Px = "500px";
        public const string Abacus = "abacus";
        public const string AccessibleIcon = "accessible-icon";
        public const string Accusoft = "accusoft";
        public const string Acorn = "acorn";
        public const string AcquisitionsIncorporated = "acquisitions-incorporated";
        public const string Ad = "ad";
        public const string AddressBook = "address-book";
        public const string AddressCard = "address-card";
        public const string Adjust = "adjust";
        public const string Adn = "adn";
        public const string Adversal = "adversal";
        /* etc. */
    }

To create an array or list of unmodified strings should be way easier


text:
Q: Multiline regex layout I have a regex: Regex("((group1)(group2))(group3)")
I'd like to format it in a way that looks nice and clear, i.e.:
(
  (group1)
  (group2)
)
(group3)

For example I've tried this:
Regex("("
    +   "(group1)"
    +   "(group2)"
    + ")"
    + "(group3)")     //--> loses the syntax highlighting in Intellij and a bit messy

Regex("""(
           (group1)
           (group2)
         )
         (group3)""") //--> not bad, but not equivalent (adds spaces and \n characters)

Is there a way to have a clean layout while keeping the regex equivalent to the original and the syntax highlighting?

A: It looks like you still can use  the COMMENTS modifier (or (?x) inline version):
Regex("""(?x)(          # Group 1
              (group1)  # Group 2
              (group2)  # Group 3
             )
             (group3)  # Another group"""

See COMMENTS RegexOption reference:

Permits whitespace and comments in pattern.

The # symbols must be escaped if they denote a literal # symbol in the pattern.
Note that literal spaces are also considered to be formatting whitespace, even inside character classes. Escape them if you need to match a literal space: """(?x)free\ spacing""" or """(?x)[a-zA-Z\ ]+""".


text:
Q: Symfony 3.3.5 - Can't generate new bundle I've just installed new Symfony 3.3.5 project.
Now I'm trying to generate new bundle
php bin/console generate:bundle

But getting this:
> Generating a sample bundle skeleton into app/../src/Web/BaseBundle
  created ./app/../src/Web/BaseBundle/
  created ./app/../src/Web/BaseBundle/WebBaseBundle.php
  created ./app/../src/Web/BaseBundle/Controller/
  created ./app/../src/Web/BaseBundle/Controller/DefaultController.php
  updated ./app/../tests/WebBaseBundle/Controller/DefaultControllerTest.php
  created ./app/../src/Web/BaseBundle/Resources/views/Default/
  created ./app/../src/Web/BaseBundle/Resources/views/Default/index.html.twig
  created ./app/../src/Web/BaseBundle/Resources/config/
  created ./app/../src/Web/BaseBundle/Resources/config/services.yml
  created ./app/../src/Web/BaseBundle/Resources/config/routing.yml
> Checking that the bundle is autoloaded
FAILED
> Enabling the bundle inside app/AppKernel.php
  updated ./app/AppKernel.php
OK

So fixed it in composer.json like this:
"autoload": {
    "psr-4": { "": "src/" },
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
},

also tried like this:
"autoload": {
    "psr-4": { "WebBaseBundle": "src/Web/BaseBundle" },
    "classmap": [
        "app/AppKernel.php",
        "app/AppCache.php"
    ]
},

But if I try to launch my project, I'm getting this error:

Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to
  load class "WebBaseBundle" from namespace "Web\BaseBundle". Did you
  forget a "use" statement for another namespace? in
  /Volumes/U/Projects/e-shop/app/AppKernel.php on line 18

Here is my AppKernel
public function registerBundles()
{
    $bundles = [
        new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
        new Symfony\Bundle\SecurityBundle\SecurityBundle(),
        new Symfony\Bundle\TwigBundle\TwigBundle(),
        new Symfony\Bundle\MonologBundle\MonologBundle(),
        new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
        new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
        new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
        new Web\BaseBundle\WebBaseBundle(),
    ];

    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

        if ('dev' === $this->getEnvironment()) {
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
            $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
        }
    }

    return $bundles;
}

What can be possibly wrong in totally new project?
Thanks for help.

A: to fix this bug you must edit composer.json :

"autoload": {
        "psr-4": {
            "": "src/"
        }
    },

and after run in command :

composer install (if composer is installed)

or

php composer.phar (if you work with composer.phar)