text:
Q: Problem running syncdb in django I am trying to go through the django docs tutorial and having a problem syncing mysql.  On the command python manage.py syncdb I get the following error (note I'm running in windows 7):
...
File "C:\python27\lib\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
raise Improperlyconfigured("Error loading Mysqldb module: %s" % e)
django.core.excepions.Improperlyconfigured: Error loading Mysqldb module: No module named mySQLdb

I have initialized the db in setting.py as:
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mysite',    #the name I gave in Mysql with 'CREATE DATABASE mysite;'
'USER': 'root',
'PASSWORD': 'mypassword',   # as set in MysqlInstanceConfig
'HOST': '',
'PORT': '',

So how do I get syncdb to run correctly? What does the missing module error mean and how do I correct it?

A: You need to install the python mysql library.
Here is a django-related guide to do this on windows

A: You have to install the mySQLdb module.

A: You most probably haven't installed the Python module that handles the mysql connections. You can install it through the Cheeseshop with pip or easy_install and it's called MySQL-python.


text:
Q: Difference in initialazing objects in java Let's say I have an abstract class A and a class called B extending it. What's the difference between initializing like this:
A objectname=new B();

and this
B objectname=new B();

A: In both cases you'd be creating an instance of B. The only difference is where you assign this instance. In the first snippet, objectname is of type A, so you won't be able to use B's methods that aren't in A unless you explicitly cast it to B.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Set of convergent sequences is not dense in $(\ell^\infty, d_\infty)$ Let $c_c$ be the set of all sequences which converge with respect to the usual metric on $\mathbb{R}$. Since every convergent sequence is bounded, then we know that $c_c\subseteq \ell^\infty$, but would we show that $c_c$ is not dense in $(\ell^\infty,d_\infty)$? By definition, a subset $D$ of $X$ is dense in $X$ if $\overline{D}=X$, but what is the closure of $c_c$?

A: Since $\ell^\infty$ is a normed vector space, let us use the norm instead of the metric for convenience.
$c_c$ is not dense in $\ell^\infty$; consider $ y =(1,0,1,0,\dots) \in \ell^\infty$. If
$$ \| y - x \|_\infty<1/2$$
this implies $x(2n+1) > 1/2$ but also $x(2n)<1/2$, for large enough $n$. Consequently, there is no element of $c_c$ in the $\ell^\infty$ ball around $y$ of radius $1/2$.
$c_c$ is a closed space; suppose $x_n \in c_c$ and $x_n \to x \in \ell^\infty$. Then
\begin{align}
|x(k) - x(j)|
&\le |x(k) - x_n(k)| + |x_n(k) - x_n(j)| + |x_n(j) - x(j)| \\&\le 2\|x_n-x\|_\infty + |x_n(k) - x_n(j)| \end{align}
So for any $\epsilon>0$, we can choose a large $n$ so that$ \|x_n-x\|_\infty < \epsilon $ and then choose $M$ so that if $k,j>M$ then $|x_n(k) - x_n(j)|<\epsilon$. Thus, $x$ is Cauchy and thus convergent.

A: The closure of $c_c$ is again $c_c$. In other words, $c_c$ is a closed set. It is easy to show that $\ell^\infty\setminus c_c$ is open using that fact that a sequence doesn't belong to $c_c$ if and only if it is not a Cauchy sequence.


text:
Q: App Crash Due to Memory Issue on 'GET' request for many objects I have a method that retrieved a lot of data and stores it into an array, and then passes it to the completion handler:
[edcs getClinicalPatientDataWithDictionaryForPatientID:participant.participantNum withStartDate:pastDate withEndDate:currentDate completionBlock:^(NSDictionary *jsonDict) {
    if ([jsonDict[@"status"] isEqualToString:@"200"]) {
        if (jsonDict[@"body"]) {
            NSMutableArray *body = [NSMutableArray  arrayWithObject:jsonDict[@"body"]];
            if (body) {
                // Query all measurements
                for (NSArray *jsonArray in body) {
                    for (NSDictionary *measurementDict in jsonArray) {
                        // Separate Hydration measurements
                        if (![body.description containsString:@"<null>"]) {
                            if (measurementDict) {
                                if ([[measurementDict objectForKey:@"MeasureUnitID"] isEqualToString:@"Cups"]) {
                                    [cupsPastYearTotalArray addObject:measurementDict];
                                }
                            }
                        }
                    }
                }
         completionBlock(cupsPastYearTotalArray);

The issue is that my array "cupsPastYearTotalArray" has over 500 objects so my projects memory usage goes up to 600 MB and then crashes.
What is the best way for me to manage all this data so that my app doens't crash?

A: You can try using autoreleasepool block.
 [edcs getClinicalPatientDataWithDictionaryForPatientID:participant.participantNum withStartDate:pastDate withEndDate:currentDate completionBlock:^(NSDictionary *jsonDict) {
        if ([jsonDict[@"status"] isEqualToString:@"200"] && jsonDict[@"body"]) {
            NSMutableArray *body = [NSMutableArray  arrayWithObject:jsonDict[@"body"]];
            for (NSArray *jsonArray in body) {
                @autoreleasepool {
                    for (NSDictionary *measurementDict in jsonArray) {
                        @autoreleasepool {
                            if (![body.description containsString:@"<null>"] && measurementDict && [[measurementDict objectForKey:@"MeasureUnitID"] isEqualToString:@"Cups"]) {
                                [cupsPastYearTotalArray addObject:measurementDict];
                            }
                        }
                    }
                }
            }
        }
        completionBlock(cupsPastYearTotalArray)
    }];

A: "body.description" gives you a description of body, suitable for debugging. You should never, ever use this outside a debug statement. Most likely you want to check for [NSNull null] somewhere. And you definitely don't want to repeat that check again and again in a loop. That description that you calculate is big. Puneet's help avoids running out of memory, it doesn't stop your code wasting CPU time and battery life by producing 600+ MB of data.


text:
Q: Cypress: Is it possible to complete a test after failure Overview
I want to automatically test all 200 pages of our website every week after the update to see if the update broke any of them
The test case

*

*Login and go to the sitemap

*Get the URLs and check each for their HTTP status

The code
    it('check HTTP status', () => {
        cy.visit(Cypress.config('siteMapUrl'))

        cy.get('.portlet-separator').should('contain', 'Available Links')

        cy.get('.inputwrapper>a')
            .each(($el, index, $list) => {
                if($list){
                    cy.get($el)
                        .invoke('attr', 'href')
                        .then(href => {
                            cy.request(Cypress.config('url')+href)
                            .should('have.property', 'status', 200)
                        })
                }
        })

What happens:
Once an URL returns anything else than status 200 the test fails.
What I would like:
I would like Cypress to iterate through the complete list of URLs before returning the URLs that failed.
Why?
If more than one URL in the list is broken, I will not find the 2nd broken URL with this test until our devs have fixed the first one. Yet I need to produce a list with all broken URLs at the beginning of the week
I have already seen this answer but I would like to know if there is a different solution before I try to implement this

A: You should not use .should() after each URL - that will fail immediately, even if setting failOnStatus: false.
Instead save the results and check at the end.
const failed = []

cy.get(".inputwrapper>a").each(($el, index, $list) => {
  cy.get($el)
    .invoke("attr", "href")
    .then((href) => {
      cy.request({
        url: Cypress.config("url") + href,
        failOnStatusCode: false,
      })
      .its('status')
      .then(status => {
        if (status !== 200) {
          failed.push(href)
        }
      })
    })
  }
})
.then(() => {
  // check inside then to ensure loop has finished
  cy.log(`Failed links: `${failed.join(', ')`)
  expect(failed.length).to.eq(0)
})


text:
Q: Graph batch API throw error for update recurrent meeting with modifications I created recurrent meeting with attendee in Office365 calendar.

Then updated one of occurrence - change subject for creating modifications.

I found Id of master event by graph-explorer and want to update subject.
For updating I used GraphAPI batch:

and as response I got error with code ErrorInternalServerError.
I use batch API because I need to update few events for one time.
After some manipulation I found that if for header Prefer add value as 'outlook.body-content-type='html'' instead 'outlook.body-content-type='text'' or remove it then batch API works correct:

I need to use value of Prefer as 'outlook.body-content-type='text'' because business requirements for text only.
Do you have any idea how to use batch API for my case and with my options?
UPD:
I tried to use update API without batching but also got the same error as for batch API update.
In header I used Prefer as 'outlook.body-content-type='text''

So looks like any update of recurrent event with modifications and header Prefer as 'outlook.body-content-type='text'' finished as InternalServerError


text:
Q: How to spoof a tcp/http response in C# I have an app that makes a request to a server and gets authenticated.
I'm wondering if it is a possible to write a listener that listens for requests and if any request matches that particular request the listener sends back a message, without it actually getting to the server.
In essence I want to make the app. think it has been authenticated when it actually hasn't.
This is what the tcp stream looks like on WireShack. The highlighted response is exactly what I want my code to respond to.
Is this possible?

A: Yes. It's called a "proxy", and you can do that in C# by using System.Net.Sockets namespace. Or you can use Fiddler and forget about programming at all. :) (Btw - AFAIK Fiddler is written in C# too)


text:
Q: How should I cope with the clash between the package "xeCJK" and "mathspec"? I wanted to configure math fonts in my document, and tried with mathspec, only to find it clashed with fontspec. For I have to use Chinese in my document, I have to load xeCJK package which automatically loads fontspec. How could I avoid such a clash?
Example:
\documentclass{article}
\usepackage{xeCJK}   % Using XeLaTeX
\usepackage{mathspec}  % Clash!

\begin{document}

\end{document}

A: The problem is that mathspec and xeCJK both load fontspec but while xeCJK loads it without any options, mathspec by default loads fontspec with the no-math option.  That is an option clash.
To work around this you have to pass the no-math option also when loading fontspec the first time within xeCJK.  This can be done by means of \PassOptionsToPackage.
\documentclass{article}
\PassOptionsToPackage{no-math}{fontspec}
\usepackage{xeCJK}
\usepackage{mathspec}
\begin{document}
\end{document}


text:
Q: Pass Italian datetime string to date() I need to enter into a SQLite table a DATETIME value. The date is originally been published with Italian month names but in different formats (see below). I need then to pre process the string before send it to the database. I thought then of using strftime that would (hopefully) manage different formats after I specify that the locale for each format is Italian. This is what I tried
<?php

error_reporting(E_ERROR | E_PARSE);

$dates = array("16:19, 23 set 2010 (CEST)",
           "10:52, 9 dic 2006 (CEST)",
           "19:38, Ago 16, 2005 (CEST)",
           "12:34, Ago 8, 2005 (CEST)",
           "01:19, Apr 24, 2005 (CEST)");

print_r($dates);

foreach ($dates as $date) {
    setlocale(LC_TIME, "it_IT");
    $date = strftime($date);
    echo $date."\n";
    setlocale(LC_TIME, "en_AU");
    echo $date."\n";
}

?>

Still the dates are not converted in a time format. They are not converted at all. This is the ouput:
(
    [0] => 16:19, 23 set 2010 (CEST)
    [1] => 10:52, 9 dic 2006 (CEST)
    [2] => 19:38, Ago 16, 2005 (CEST)
    [3] => 12:34, Ago 8, 2005 (CEST)
    [4] => 01:19, Apr 24, 2005 (CEST)
)
16:19, 23 set 2010 (CEST)
16:19, 23 set 2010 (CEST)
10:52, 9 dic 2006 (CEST)
10:52, 9 dic 2006 (CEST)
19:38, Ago 16, 2005 (CEST)
19:38, Ago 16, 2005 (CEST)
12:34, Ago 8, 2005 (CEST)
12:34, Ago 8, 2005 (CEST)
01:19, Apr 24, 2005 (CEST)
01:19, Apr 24, 2005 (CEST)

A: $date = strftime($date);

This is not the correct usage for this function, you are passing in a date as a format which does nothing.
strftime — Format a local time/date according to locale settings
What I think you want is
strftime($date_format, strtotime($date));

However strtotime only parses dates in english (and assumes M/d/Y convention over d/M/Y)
So you will need to replace the months first
<?php

$dates = array("16:19, 23 set 2010 (CEST)",
    "10:52, 9 dic 2006 (CEST)",
    "19:38, Ago 16, 2005 (CEST)",
    "12:34, Ago 8, 2005 (CEST)",
    "01:19, Apr 24, 2005 (CEST)");

function convert_date_to_english($date_in_italian) {

    // TODO complete this table, I don't know italian sorry
    $months = array(
        'set' => 'sep',
        'dic' => 'dec',
        'apr' => 'apr',
        'ago' => 'aug'
    );

    return str_replace(array_keys($months), array_values($months), strtolower($date_in_italian));
}

foreach ($dates as $date) {
    $date = convert_date_to_english($date);
    $timestamp = strtotime($date);

    setlocale(LC_ALL, "it_IT");
    $date = strftime("%A %e %B %Y", $timestamp);
    echo $date."\n";

    setlocale(LC_ALL, 'en_AU');
    $date = strftime("%A %e %B %Y", $timestamp);
    echo $date."\n";
}


text:
Q: screenshot programmatically does not work I am doing this: but I always get a white picture.
Does anybody knows why?
- (void) screenshotButtonAction{
    UIGraphicsBeginImageContext(self.view.bounds.size);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
}

self is a uiviewcontroller and it holds a opengl view (UIView + CAEAGLLayer)
EDIT:
I have realized that only the gl view is not screenshot-ed.
Is strange, subviews and sublayers of the gl view shows fine but the opengl view is white in the taken picture. Does this have to be something with the current context?
This is an AR application and the gl view shows camera input + AR objects so, glview is always being rendered (refreshed)
What could be happening here?

A: Code looks good. Make sure you already added QuartzCore.framework and import it in your .m file.
#import <QuartzCore/QuartzCore.h>


text:
Q: React hooks, initialize and change state with onClick event using tables I am displaying a html table with a single field 'title'. Once the user clicks on one of the table rows I would like to display the corresponding title name below the table. It works fine using a dropdown list however when I try to convert it to a table, the state stops updating. (I've left the options attribute as a working example, however this needs to be removed or replaced). I would also like to display the first title in the table when the page first loads up (title[0]). I think this may require a useEffect. Any help would be appreciated.
import React, { useState } from 'react';

import data from '../../data-files/data.json';

const TestPage = () => {
  const [title, setTitle] = useState('');

  const handleClick = e => {
    const selected = e.target.value;
    setTitle(selected);
  };

  return (
    <>

            Title

          {data.data.map(i => (

                <option>{i.name}</option>

          ))}

{title}

    </>
  );
};

export default TestPage;

The data is coming from a local file:
{
  "data": [
    {
      "id": "1",
      "name": "title 1"
    },
    {
      "id": "2",
      "name": "title 2"
    },
    {
      "id": "3",
      "name": "title 3"
    },
    {
      "id": "4",
      "name": "title 4"
    },
    {
      "id": "5",
      "name": "title 5"
    }
  ]
}

A: That doesn't work without the <option> because the event isn't the same, you chould try passing the name as parameter to handle function:
  {data.data.map(i => (

       handleClick(i.name)} style={{ background: '#439981' }}>
        <option>{i.name}</option>

  ))}

Of course, if you do that change you will need to refactor handleClick


text:
Q: Extra blank page while designing front cover with tikz I'm trying to design the front cover of a book with tikz package. The following is my latex code:
\documentclass[b5paper,11pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\begin{document}
\newgeometry{top=0pt,bottom=0pt,left=0pt,right=0pt}
\thispagestyle{empty}
\setlength\parindent{0pt}
\begin{tikzpicture}[color=white,line width=.1em,font=\fontsize{90}{90}\selectfont]
\filldraw[color=blue] (0,0) rectangle (\paperwidth,\paperheight);
\draw (.05\paperwidth,0) -- (.05\paperwidth,\paperheight);
\draw (0,.1\paperheight) -- (.05\paperwidth,.1\paperheight);
\draw (0,.3\paperheight) -- (.05\paperwidth,.3\paperheight);
\draw (0,.5\paperheight) -- (.05\paperwidth,.5\paperheight);
\draw (0,.7\paperheight) -- (.05\paperwidth,.7\paperheight);
\draw (0,.9\paperheight) -- (.05\paperwidth,.9\paperheight);
\node[draw,align=center] at (.8\paperwidth,.5\paperheight) {B\\O\\O\\K};
\end{tikzpicture}
\end{document}

But after compiling the latex code, except the front cover, I get a extra blank page before it. What is the problem with it?

A: You rectangle larger than the paper by \pgflinewidth since the upper point for rectangle is at  (\paperwidth,\paperheight). You can either

*

*use fill instead of filldraw → \fill[color=blue,use as bounding box] (0,0) rectangle (\paperwidth,\paperheight);

*or use ($(\paperwidth,\paperheight)+(-\pgflinewidth,-\pgflinewidth)$) in the construction of rectangle. This needs calc library. → \filldraw[color=blue,use as bounding box] (0,0) rectangle ($(\paperwidth,\paperheight)+(-\pgflinewidth,-\pgflinewidth)$);
Also note that I have used the big blue rectangle as the bounding box.
Full code
\documentclass[b5paper,11pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\newgeometry{top=0pt,bottom=0pt,left=0pt,right=0pt}
\thispagestyle{empty}
\setlength\parindent{0pt}
\begin{tikzpicture}[color=white,line width=.1em,font=\fontsize{90}{90}\selectfont]
\fill[color=blue,use as bounding box] (0,0) rectangle (\paperwidth,\paperheight);
%%\filldraw[color=blue,use as bounding box] (0,0) rectangle ($(\paperwidth,\paperheight)+(-\pgflinewidth,-\pgflinewidth)$);
\draw (.05\paperwidth,0) -- (.05\paperwidth,\paperheight);
\draw (0,.1\paperheight) -- (.05\paperwidth,.1\paperheight);
\draw (0,.3\paperheight) -- (.05\paperwidth,.3\paperheight);
\draw (0,.5\paperheight) -- (.05\paperwidth,.5\paperheight);
\draw (0,.7\paperheight) -- (.05\paperwidth,.7\paperheight);
\draw (0,.9\paperheight) -- (.05\paperwidth,.9\paperheight);
\node[draw,align=center] at (.8\paperwidth,.5\paperheight) {B\\O\\O\\K};
\end{tikzpicture}
\end{document}

A short version:
\documentclass[b5paper,11pt]{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\newgeometry{top=0pt,bottom=0pt,left=0pt,right=0pt}
\thispagestyle{empty}
\setlength\parindent{0pt}
\begin{tikzpicture}[color=white,line width=.1em,font=\fontsize{90}{90}\selectfont]
\filldraw[color=blue,use as bounding box] (0,0) rectangle ($(\paperwidth,\paperheight)+(-\pgflinewidth,-\pgflinewidth)$);

\foreach \x in {0.1,0.3,...,0.9}{
   \draw (0,\x\paperheight) -- (.05\paperwidth,\x\paperheight);
}
\draw (.05\paperwidth,0) -- (.05\paperwidth,\paperheight);
\node[draw,align=center] at (.8\paperwidth,.5\paperheight) {B\\O\\O\\K};
\end{tikzpicture}
\end{document}

If you don't want to use calc library, just use
(\paperwidth-\pgflinewidth,\paperheight-\pgflinewidth)

as noted by  Torbjørn T.


text:
Q: How to redirect to the same page with custom params using search form? I have a page (get 'records/:id' => 'records#show', as: 'show_record'), with a long list of records of table "Page". I would like to be able to refine this list based on entered params. How can I add params to the end of the current url using a search form?
To illustrate:
<!--tentative search form
<%= form_tag show_record_path(@record), :method => :get do %>
  <%= text_field_tag :search, params[:x] %>
  <%= submit_tag "search" %>
<% end %>
-->

<!--set filter-->
<% if params[:x].nil? %>
  <% @pages = @record.pages %>
<% else %>
  <% @pages = @record.pages.where("name LIKE ?", params[:x]) %>
<% end %>
<!--list-->
<% @pages.each do |page| %>
  <%= page.name %>
<% end %>

A: In your illustration you're suggesting doing this logic in the view. I would suggest doing any filtering in your controller. I would suggest having a look at this RailsCast. This one is also very good.


text:
Q: Ícone de menu Action Bar sem dropdown Estou tentando remover o menu dropdown do ActionButton Overflow, da Action Bar.
No caso seria aquele que tem os 3 pontos, um em cima do outro, como padrão e como opção padrão, "Settings". Gostaria de remover esse item "Settings", fazendo com que, ao clicar no ícone do menu, ele já execute uma ação. Alguma ideia ?

A: No menu.xml você cria a opção
<item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:icon="@android:drawable/ic_settings"
        app:showAsAction="always"
        android:title="settings" />

E depois vai na sua Activity e
public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if(id == R.id.action_settings) {
                Intent intent = new Intent(this, SettingsActivity.class);
                startActivity(intent);
                return true;
        }
       return super.onOptionsItemSelected(item);
}

Implementei algo assim no meu app e funcionou, espero que funcione pra você.


text:
Q: A definite integral involve Logarithmic Functions Here is the integral body:
$$\int_0^m {{x^a}\ln \left( {x + b} \right)dx,a >  - \frac{3}{2},b > 0} $$

A: As mentioned in the comments, integration by parts is a good place to start. The $a= -1$ case has to be handled separately (and it's not difficult to show the integral diverges in this case), but otherwise,
$$I(m,a,b)=\int_{0}^{m}x^a\log{\left(x+b\right)}dx=\frac{1}{a+1}x^{a+1}\log{\left(x+b\right)}\big|_{0}^{m}-\frac{1}{a+1}\int_{0}^{m}\frac{x^{a+1}}{x+b}dx\\
=\frac{m^{a+1}\log{\left(m+b\right)}}{a+1}-\frac{1}{a+1}\int_{0}^{m}\frac{x^{a+1}}{x+b}dx.$$
Since by assumption $b>0$, it's a good candidate for a rescaling argument. Substituting $x=bu$ into the integral that resulted from IBPs abov: $~~dx=b\,du$, $u=\frac{x}{b}$, and so
$$\int_{0}^{m}\frac{x^{a+1}}{x+b}dx=\int_{0}^{\frac{m}{b}}\frac{(bu)^{a+1}}{bu+b}(b\,du)\\
=b^{a+1}\int_{0}^{\frac{m}{b}}\frac{u^{a+1}}{u+1}\,du.$$
Simplifications past this this point will depend a great deal upon the individual's opinion about what constitutes 'simpler'.

A: $\displaystyle\int_0^m\frac{x^{n-1}}{x+a}dx=\frac{m^n}{a\cdot n}\cdot~_{_2}F_{_1}\bigg(1,n~;~n+1~;-\frac ma\bigg),$ where $_{_2}F_{_1}$ is the Gaussian hypergeometric function. For large values of m, we have $\displaystyle\int_0^\infty\frac{x^n}{x+a}dx=-a^n\cdot\pi\cdot\csc(n\pi)$.


text:
Q: How to call a function on list item swipe on either left or right side in ionic mobile app I want to delete list item on left swipe.
How to call a function on list item swipe on either left or right side in ionic mobile app.

A: bower install random socket.io angular-socket-io
<script src="lib/sio-client/socket.io.js"></script>
<script src="lib/angular-socket-io/socket.js"></script>

<script src="lib/random/lib/random.min.js"></script>

(function(){
  angular.module('starter')
    .controller('CallController', ['$scope', '$state', '$timeout', '$ionicModal', 'SocketService', CallController]);

    function CallController($scope, $state, $timeout, $ionicModal, SocketService){
    ...
    }

})();


text:
Q: HTTP status 404 - Not Found while creating springBoot Application This a springboot Application. It run perfectly but did not get output (it shows me HTTP Status 404 error in browser)
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.exaample.demo</groupId>
  <artifactId>SpringBootMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven spring boot project</name>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

    <properties>
        <java.version>1.8</java.version>
    </properties>
</project>

Springboot start Class
    Main Method
package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class WebMainMethod {

    public static void main(String[] args) {
        SpringApplication.run(WebMainMethod.class, args);

    }

}

controller is loading after main class
**Rest Controller**

package com.example.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String sayHi() {
        return "Hi";
    }
}

Url :  http://localhost:8080/hello
output

A: Unable to reproduce problem.
This is not an answer, but I copied the 3 files from question, and built and ran code without problem. My console log is however a bit different, included below, and that's why I'm posting this as an answer.
Try doing a clean build. Maybe that will fix the problem.
Console Log
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.9.RELEASE)

2017-12-02 02:06:19.763  INFO 13268 --- [           main] com.example.demo.WebMainMethod           : Starting WebMainMethod on XXXX with PID 13268 (C:\Users\XXXX\SpringBootMaven\target\classes started by Andreas in C:\Users\XXXX\SpringBootMaven)
2017-12-02 02:06:19.765  INFO 13268 --- [           main] com.example.demo.WebMainMethod           : No active profile set, falling back to default profiles: default
2017-12-02 02:06:19.794  INFO 13268 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4f51b3e0: startup date [Sat Dec 02 02:06:19 EST 2017]; root of context hierarchy
2017-12-02 02:06:20.631  INFO 13268 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-12-02 02:06:20.641  INFO 13268 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-12-02 02:06:20.642  INFO 13268 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-12-02 02:06:20.751  INFO 13268 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-12-02 02:06:20.751  INFO 13268 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 959 ms
2017-12-02 02:06:20.824  INFO 13268 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-12-02 02:06:20.826  INFO 13268 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-12-02 02:06:20.827  INFO 13268 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2017-12-02 02:06:20.827  INFO 13268 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2017-12-02 02:06:20.827  INFO 13268 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2017-12-02 02:06:21.025  INFO 13268 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4f51b3e0: startup date [Sat Dec 02 02:06:19 EST 2017]; root of context hierarchy
2017-12-02 02:06:21.071  INFO 13268 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello]}" onto public java.lang.String com.example.demo.controller.HelloController.sayHi()
2017-12-02 02:06:21.074  INFO 13268 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-12-02 02:06:21.074  INFO 13268 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-12-02 02:06:21.095  INFO 13268 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-02 02:06:21.095  INFO 13268 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-02 02:06:21.119  INFO 13268 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-12-02 02:06:21.195  INFO 13268 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-12-02 02:06:21.271  INFO 13268 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2017-12-02 02:06:21.273  INFO 13268 --- [           main] com.example.demo.WebMainMethod           : Started WebMainMethod in 1.908 seconds (JVM running for 2.231)
2017-12-02 02:06:38.426  INFO 13268 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-12-02 02:06:38.426  INFO 13268 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-12-02 02:06:38.435  INFO 13268 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 9 ms

A: Maybe your template doesn't exist. Please specify file name of template which map with the retured value. Check this example
@Controller
public class HelloWorldController {
    @RequestMapping("/hello")
    public String hello(Model model, @RequestParam(value="name", required=false, defaultValue="World") String name) {

        String message="You just create Spring Boot Example successfully";
        model.addAttribute("name", name);
        model.addAttribute("message", message);

        return "hello";
    }
}

Found this from Spring Boot Maven Example Hello World

A: It's seems there is some problem at your port 8080.
please change port and try to restart your appliaction.
Example: Add below to your application.properties file
server.port = 8090

and then try hitting http://localhost:8090/hello

A: You can try this.
Using application.properties /yml
The most straightforward way of changing the context path is to set the property in the application.properties:
server.servlet.context-path=/demoApp
Instead of putting the properties file in src/main/resources, we can also keep it in the current working directory (outside of the classpath).
Java System Property.
http://localhost:8090/demoApp/hello
for more info.
 https://www.baeldung.com/spring-boot-context-path

A: Do you create a jsp or html page called hi... Check your views... You don;t have page to view.... Please create a jsp and put it on
   @RequestMapping("/hello")
        public String sayHi(Model model) {
        model.addAttribute("Hi","Hi")
       return "Hi";
        }

jsp page must be Hi


text:
Q: Disable/Enable Submit Button until all forms have been filled I want my form submit button to be disabled/enabled depending on if the form is completely filled.
When the inputs are filled, the disabled button changes to enabled. That works great.
But I would like it to disable the button when an input gets emtied.
This is my script:

<form name="theform">
<input type="text" onKeyup="checkform()" />
<input type="text" onKeyup="checkform()" />
<input id="submitbutton" type="submit" disabled="disabled" value="Submit" />
</form>

A: Just use
document.getElementById('submitbutton').disabled = !cansubmit;

instead of the the if-clause that works only one-way.
Also, for the users who have JS disabled, I'd suggest to set the initial disabled by JS only. To do so, just move the script behind the <form> and call checkform(); once.

A: Just add an else then:
function checkform()
{
    var f = document.forms["theform"].elements;
    var cansubmit = true;

    for (var i = 0; i < f.length; i++) {
        if (f[i].value.length == 0) cansubmit = false;
    }

    if (cansubmit) {
        document.getElementById('submitbutton').disabled = false;
    }
    else {
        document.getElementById('submitbutton').disabled = 'disabled';
    }
}

A: Put it inside a table and then do on her:
var tabPom = document.getElementById("tabPomId");
$(tabPom ).prop('disabled', true/false);

A: I just posted this on Disable Submit button until Input fields filled in.  Works for me.
Use the form onsubmit.  Nice and clean.  You don't have to worry about the change and keypress events firing.  Don't have to worry about keyup and focus issues.
http://www.w3schools.com/jsref/event_form_onsubmit.asp
<form action="formpost.php" method="POST" onsubmit="return validateCreditCardForm()">
   ...
</form>

function validateCreditCardForm(){
    var result = false;
    if (($('#billing-cc-exp').val().length > 0) &&
        ($('#billing-cvv').val().length  > 0) &&
        ($('#billing-cc-number').val().length > 0)) {
            result = true;
    }
    return result;
}

A: Here is the code

      <input type="text" name="name" id="name" required="required"                                    aria-required="true" pattern="[a-z]{1,5}" onchange="func()">

Using Javascript

A: You can enable and disable the submit button based on the javascript validation below is the validation code.

A: I think this will be much simpler for beginners in JavaScript
    //The function checks if the password and confirm password match
    // Then disables the submit button for mismatch but enables if they match
            function checkPass()
            {
                //Store the password field objects into variables ...
                var pass1 = document.getElementById("register-password");
                var pass2 = document.getElementById("confirm-password");
                //Store the Confimation Message Object ...
                var message = document.getElementById('confirmMessage');
                //Set the colors we will be using ...
                var goodColor = "#66cc66";
                var badColor = "#ff6666";
                //Compare the values in the password field
                //and the confirmation field
                if(pass1.value == pass2.value){
                    //The passwords match.
                    //Set the color to the good color and inform
                    //the user that they have entered the correct password
                    pass2.style.backgroundColor = goodColor;
                    message.style.color = goodColor;
                    message.innerHTML = "Passwords Match!"
 //Enables the submit button when there's no mismatch
                    var tabPom = document.getElementById("btnSignUp");
                    $(tabPom ).prop('disabled', false);
                }else{
                    //The passwords do not match.
                    //Set the color to the bad color and
                    //notify the user.
                    pass2.style.backgroundColor = badColor;
                    message.style.color = badColor;
                    message.innerHTML = "Passwords Do Not Match!"
 //Disables the submit button when there's mismatch
                    var tabPom = document.getElementById("btnSignUp");
                    $(tabPom ).prop('disabled', true);
                }
            }

A: <form name="theform">
    <input type="text" />
    <input type="text" />`enter code here`
    <input id="submitbutton" type="submit"disabled="disabled" value="Submit"/>
</form>

A: Here is my way of validating a form with a disabled button. Check out the snippet below:

var inp = document.getElementsByTagName("input");
var btn = document.getElementById("btn");
// Disable the button dynamically using javascript
btn.disabled = "disabled";

function checkForm() {
    for (var i = 0; i < inp.length; i++) {
        if (inp[i].checkValidity() == false) {
            btn.disabled = "disabled";
        } else {
            btn.disabled = false;
        }
    }
}
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>JavaScript</title>

Javascript form validation

Javascript constraint form validation example:

<form onkeyup="checkForm()" autocomplete="off" novalidate>
    <input type="text" name="fname" placeholder="First Name" required>

    <input type="text" name="lname" placeholder="Last Name" required>

    <button type="submit" id="btn">Submit</button>
</form>

Example explained:

*

*We create a variable to store all the input elements.

var inp = document.getElementsByTagName("input");

*We create another variable to store the button element

var btn = document.getElementById("btn");

*We loop over the collection of input elements

for (var i = 0; i < inp.length; i++) {
    // Code
}

*Finally, We use the checkValidity() method to check if the input elements
(with a required attribute) are valid or not (Code is inserted inside the
for loop). If it is invalid, then the button will remain disabled, else the
attribute is removed.

for (var i = 0; i < inp.length; i++) {
    if (inp[i].checkValidity() == false) {
        btn.disabled = "disabled";
    } else {
        btn.disabled = false;
    }
}


text:
Q: VBA Excel: Insert an extract of a spreadsheet into an Outlook email I want to be able to run a macro in Excel that copies specific areas of my excel spreadsheet, opens a new email, and pastes the areas in. So far I have got the following code:
Sub Macro2()
'
'Macro2 Macro
Dim objOutlook As Object
Dim objMail As Object
Dim TempFilePath As String
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)

Dim rng As Range
'Set rng = Selection.SpecialCells(xlCellTypeVisible)
Set rng = ActiveSheet.Range("A4:E200").Rows.SpecialCells(xlCellTypeVisible)

If rng Is Nothing Then
    MsgBox "The selection is not a range or the sheet is protected" & _
           vbNewLine & "please correct and try again.", vbOKOnly
    Exit Sub
End If

With objMail

    ActiveSheet.Range("$A$3:$P$197").AutoFilter Field:=4, Criteria1:="10"
    Range("B171:F184,I171:J184").Select
    Range("I171").Activate
    Range("B171:F184,I171:J184,M171:N184").Select
    Range("M171").Activate
    Selection.Copy

    .To = ""
    .CC = ""
    .Subject = ""
    .HTMLBody = RangetoHTML(rng)
    .Display
End With

Set objOutlook = Nothing
Set objMail = Nothing

End Sub

Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2013
Dim fso As Object
Dim ts As Object
Dim TempFile As String
Dim TempWB As Workbook

TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"

'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
    .Cells(1).PasteSpecial Paste:=8
    .Cells(1).PasteSpecial xlPasteValues, , False, False
    .Cells(1).PasteSpecial xlPasteFormats, , False, False
    .Cells(1).Select
    Application.CutCopyMode = False
    On Error Resume Next
    .DrawingObjects.Visible = True
    .DrawingObjects.Delete
    On Error GoTo 0
End With

'Publish the sheet to a htm file
With TempWB.PublishObjects.Add( _
     SourceType:=xlSourceRange, _
     Filename:=TempFile, _
     Sheet:=TempWB.Sheets(1).Name, _
     Source:=TempWB.Sheets(1).UsedRange.Address, _
     HtmlType:=xlHtmlStatic)
    .Publish (True)
End With

'Read all data from the htm file into RangetoHTML
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
RangetoHTML = ts.readall
ts.Close
RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
                      "align=left x:publishsource=")

'Close TempWB
TempWB.Close savechanges:=False

'Delete the htm file we used in this function
Kill TempFile

Set ts = Nothing
Set fso = Nothing
Set TempWB = Nothing
End Function

This code almost does what I want, it copies filters on criteria 10 in column D and copies and pastes this into an email.
But what I want is for the code to go through the filtered cells (could be criteria 1, 2, 3... etc. rather than a hard coded criteria as it is at the minute), and copy & paste specific columns into the email.
For example, I want to filter on Queen in the Band column below and copy & paste the columns C (Full Name) and D (Band) into an email.
     A            B              C               D
 1   First name:  Last name:     Full Name:      Band:
 2   Freddie      Mercury        Freddie Mercury Queen
 3   Brian        May            Brian May       Queen
 4   Kurt         Cobain         Kurt Cobain     Nirvana
 5   Roger        Taylor         Roger Taylor    Queen
 6   Dave         Grohl          Dave Grohl      Nirvana
 7   John         Deacon         John Deacon     Queen
 8   Kris         Novoselic      Kris Novoselic  Nirvana

Is there a way of doing this? Any help would be appreciated.

A: What I needed to do was change Set rng = ActiveSheet.Range("A4:E200").Rows.SpecialCells(xlCellTypeVisible)
to the range I needed, so Set rng = ActiveSheet.Range("B4:E200, I4:J200, M4:N200").Rows.SpecialCells(xlCellTypeVisible)
This was similar to the comment provided by @Ralph but with the different ranges.


text:
Q: JavaScript Object Key is not being assigned to variable? I am trying to assign the value of boxSpaces[0] to the variable result in the function decalreWinner() but the assignment is not taking place.
function assignSpace(mark, box) {
    const image = document.createElement("img");
    const src = mark === "x" ? X_IMAGE_URL : O_IMAGE_URL;
    image.src = src;
    box.appendChild(image);
    box.removeEventListener("click", changeToX);
    const id = parseInt(box.dataset.id);
    boxSpaces[id] = mark;
}

function isGameOver() {
    const length = emptyBoxes.length;

    if (length <= 0) {
        declareWinner();
        return true;
    } else {
        false;
    }
}

function declareWinner() {
    const result = "";
    if (boxSpaces["0"] === boxSpaces["1"] && boxSpaces["1"] === boxSpaces["2"]) {
        result = boxSpaces["0"];
        console.log(result);
    }

    return result;
}

A: You are using const to declare a variable and you are tring to update it which is not possible. change it to let or var
function declareWinner() {
  let result = ""; //change it to let or var
  if (boxSpaces["0"] === boxSpaces["1"] && boxSpaces["1"] === boxSpaces["2"]) {
    result = boxSpaces["0"];
    console.log(result);
  }

  return result;
}


text:
Q: Cylindrical limits of integration for a particular triple integral In cylindrical coordinates, what would be the limits of integration for the triple integral serving to find the volume of the region in $\mathbb R^3$ bounded by:
$x^2 + y^2 = y$ and the sphere of center $O$ and radius $1$, in the first octant?
$\theta$ moves between $0$ and $\pi/2$, and $z$ moves between $0$ and $\sqrt{1 - r^2}$; but what is the behaviour of $r$?
Thanks a lot.

A: $x^2+y^2 = y$ describes an infinite cylinder $$x^2 + \left(y - \frac{1}{2}\right)^2 = \left(\frac{1}{2}\right)^2$$
The interior of intersection of two regions is thus given by
$$
   \mathcal{R} = \left\{  x^2 + y^2 + z^2 \leqslant 1, x^2 + \left(y - \frac{1}{2}\right)^2 \leqslant \left(\frac{1}{2}\right)^2, x \geqslant 0, y \geqslant 0, z \geqslant 0 \right\}
$$
which is
$$
     \mathcal{R} = \left\{  x^2 + y^2 + z^2 \leqslant 1, x^2 + y^2 \leqslant y, x \geqslant 0, y \geqslant 0, z \geqslant 0\right\}
$$
Switching to polar coordinates $x = r \cos(\theta)$, $x = r \sin(\theta)$ we have
$$\begin{eqnarray}
   \mathcal{R} &=& \left\{ r^2 + z^2 \leqslant 1, r \leqslant \sin(\theta), 0 \leqslant \theta \leqslant \frac{\pi}{2}, r \geqslant 0, z \geqslant 0\right\} \\
  &=& \left\{0 \leqslant \theta \leqslant \frac{\pi}{2}, 0 \leqslant r  \leqslant \sin(\theta), 0 \leqslant z \leqslant \sqrt{1-r^2}  \right\}
\end{eqnarray}
$$
Therefore the volume
$$\begin{eqnarray}
   \operatorname{Vol}\left(\mathcal{R}\right) &=& \int_0^{\pi/2} \mathrm{d} \theta \int_0^{\sin \theta} r \mathrm{d} r \int_0^{\sqrt{1-r^2}} \mathrm{d} z \\
 &=& \int_0^{\pi/2} \mathrm{d} \theta \int_0^{\sin \theta} r \sqrt{1-r^2} \mathrm{d} r  \\
  &=& \int_0^{\pi/2} \frac{1}{3} \left(1-\cos^3(\theta)\right) \mathrm{d} \theta = \frac{\pi}{6} - \frac{2}{9} \approx 0.301377
\end{eqnarray}
$$
Confirming in Mathematica:
In[1]:= NIntegrate[1,
 Element[xvec,
  RegionIntersection[Cuboid[{0, 0, 0}, {1, 1, 1}], Ball[{0, 0, 0}],
   Cylinder[{{0, 1/2, 0}, {0, 1/2, 1}}, 1/2]]]]

Out[1]= 0.301377


text:
Q: homology group of mobius band and cylinder today one of my friends ask me what is the homology groups for mobius band and cylinder?
the first thing that comes to my mind is that both of them deformation retract to a circle,the circle is path component so $H_0(X)=\mathbb{Z}$ when $X$ is circle.for $H_1(X)$ ,the fundamental group of the circle is $\mathbb{Z}$ and because it is abelian so $H_1(X)=\mathbb{Z}$ and for $n \geq 2$ $H_n(X)$ is zero because there is no 2-simplex in a circle.
now please tell my Idea was right or wrong,actually I have doubt because mobius band is a circle with $z \rightarrow z^2$ ,so help me with your knowledge,thanks a lot.

A: Let
$M$
be a closed connected
$n$
manifold then $H_i(M;\mathbb Z)=0$ for each $i>n$. If in addition $M$ is orientable then $H_n(M;\mathbb Z)\cong \mathbb Z$.
For a proof see Hatcher Theorem 3.26.
Apply this to $M=S^1$ which is a closed connected orientable $1$-manifold.


text:
Q: Group Box in different Thread I have 5 Group Box in my software I want to run them differently for example I have one group box which takes lot of time around 20-30 minutes till then my software hangs. SO I want to make other functionality working when a particular group box is working any solution for it?

A: Group boxes don't "work". If they're just some GUI for a resource intensive task, you probably want to run that task asynchronously (or multi-threaded, depending on your requirements) and only use the GUI for settings / updates / whatever. The key is to never do much work on the GUI thread - if a GUI action takes more than say 50-100ms, it should probably be done elsewhere. Note that using await makes this very easy to do properly - if that's not available, a BackgroundWorker is probably the best option. Do note it doesn't shield you from synchronization issues, though!


text:
Q: Show that $\left|\dfrac{R(z-a)}{R^{2}-\overline{a}z}\right|$ is analytic for $|z| \leq R$, and maps the circle $|z| = R$ into the unit circle.
a) Suppose $|a| < R$, show that
  $$\left|\dfrac{R(z-a)}{R^{2}-\overline{a}z}\right|$$ is analytic for $|z| \leq
 R$, and maps the circle $|z| = R$ into the unit circle.
b) Suppose $|a_k| <R$ for $k=1,2,...,n$. Prove that (unless $|a_k| =
 0$ for all $k$) we have  $$\sqrt[n]{|z-a_1|\cdot|z-a_2|
 \cdot\cdot\cdot |z-a_n|}$$ assumes a maximum value greater than $R$,
  and a minimum value less than $R$ at some points $z$ on $|z| = R$.
   Hint: Consider applying Maximum and Minimum Modulus to
  $\prod_{k=1}^{n}(R^{2}-\overline{a_k}z)$

a) I would assume the question meant that $R>1$. Now to show $f(z) = \left|\dfrac{R(z-a)}{R^{2}-\overline{a}z}\right|$ is analytic in $|z| \leq R$, it suffices to check the denominators of $f$ are outside the range of $|z| = R$. Indeed, the pole $z = \dfrac{R^{2}}{\overline{a}}$ is outside the circle, as one can verify with $$\dfrac{|R^{2}|}{|\overline{a}|} > \dfrac{|R^{2}|}{R} = R$$
Next, we verify that the function $f$ indeed serves as a mapping from $|z| =R$ to $|z|=1$. It suffices to show that for $|a| < R$ and for all $|z| = R$, we have $|f(z)| = 1$.
To show $|f(z)| =1 1$, it suffices to show $\left|R(z-a)\right|^{2} -|R^{2}-\overline{a}z|^{2} = 0$ on $|z| = R$ and $|a| < R$.
After expanding out,
$\begin{aligned}
\left|R(z-a)\right|^{2} -|R^{2}-\overline{a}z|^{2}  & = R(z-a)\cdot R(\overline{z}-\overline{a}) - (R^{2}-\overline{a}z)(R^{2}-a\overline{z})\\
  &= R^{2}(z\overline{z}-z\overline{a}-a\overline{z}+a\overline{a})- (R^{4}-R^{2}a\overline{z}-\overline{a}zR^{2}+a\overline{a}z\overline{z})\\
  &= R^{4}-R^{2}\overline{a}z-R^{2}a\overline{z}+R^{2}|a|^{2}-R^{4}+R^{2}a\overline{z}+R^{2}\overline{a}z-|a|^{2}R^{2}\\
  &= R^{4}R^{2}|a|^{2}-R^{4}-|a|^{2}R^{2}\\
  &= R^{4}-R^{4} =0 \\
  &< 0
\end{aligned}$
Hence we have verified part a).
b) We need to show $$\left|\left(|z-a_1|\cdot |z-a_2| \cdot \cdot \cdot |z-a_n|\right)^{n}\right| < (R+\epsilon_1)$$
On $|z| = R$, we have $$\left|\dfrac{R(z-a_1)\cdot R(z-a_2) \cdot\cdot\cdot R(z-a_n)}{\prod_{k=1}^{n}\left(R^{2}-\overline{a_k}z\right)}\right| = 1 ~~~\text{ by part a) }$$
By simplifying, we have $$|z-a_1|\cdot |z-a_2| \cdot\cdot\cdot |z-a_n| = \left|\dfrac{\prod_{k=1}^{n}\left(R^{2}-\overline{a_k}z\right)}{R^{n}}\right|$$
$\left|\prod_{k=1}^{n}\left(R^{2}-\overline{a_k}z\right)\right| = \left|\prod_{k=1}^{n}R^{2}\left(1-\dfrac{\overline{a_k}z}{R^{2}}\right)\right| \leq R^{2n}\left|\prod_{k=1}^{n}\left(1+\overline{a_k}\right)\right|$
Thus it follows that $$|z-a_1|\cdot |z-a_2| \cdot\cdot\cdot |z-a_n| = \left|\dfrac{\prod_{k=1}^{n}\left(R^{2}-\overline{a_k}z\right)}{R^{n}}\right| \leq R^{n}\left|\prod_{k=1}^{n}\left(1+\overline{a_k}\right)\right|$$

For part $a)$, i am not even sure if i am right, can anyone please
  verify. For part b), i have some clue, but i cannot get to apply the
  max/min modulus principle hence there must be something wrong.
  Furthermore, the question says that it assumes a maximum value greater
  than $R$, however, my proof can only show that it is bounded by some
  bound and not really answering the question.
Please help me, it is from Bak and newman, chapter 7.

A: Your answer for part A seems to be correct, although there are likely shorter ways to do it.
For part B, I think the answer you are looking for is here:
Show that $\sqrt[k]{|z-a_1|\cdots |z-a_k|}$ has a max greater than $R$, and a min less than $R$
You don't actually need to convert $z = e^{\theta i} $ form.
Let $f(z) = \left| z - a _ { 1 } \right| \cdot \left| z - a _ { 2 } \right| \cdots \left| z - a _ { n } \right|$. You want to show that there exists a point in $|z| \leq R$ where $f(z) = R$. For instance, $f(0)$. If you plug $z = 0$ into $\prod _ { k = 1 } ^ { n } \left( R ^ { 2} - \overline { a _ { k } } z \right)$ since they are equivalent expressions, you will find that $|R^n|f(0) = \prod _ { k = 1 } ^ { n }  R ^ { 2 } = R^{2n} \implies f(0) = R^n$. So the function you care about is $g(z) = f(z)^{\frac{1}{n}}$, which means that $g(0) = R$. $z = 0$, however is not the boundary. So by Min/Max Mod Theorem, there must be a minimum or a maximum on the boundary such that it is less than/greater than $R$ and we are done.


text:
Q: Getting a list of productSKUs into one field in Bigquery SQL I am wrangling with a query in Google bigquery and hope someone can help.
Desired Output Columns:
visit id - ecommerce_actiontype - sku_list
example:
visit id: 123
ecommerce_actiontype: 6
sku_list: [SKU1,SKU2,SKU3]
I have tried the following two queries:
1)
SELECT
visitid,
eCommerceAction.action_type as ecommerce_actiontype,
(SELECT ARRAY_AGG(productSKU) from UNNEST(hits.product)) AS sku_list
FROM `test.1234.ga_sessions_*` as t, t.hits as hits, hits.product as p

This doesn't put the productSKUs into one list grouped by visitid and ecommat.
2)
SELECT
visitid,
eCommerceAction.action_type as ecommerce_actiontype,
ARRAY_AGG(productSKU) AS sku_list
FROM `oval-unity-88908.97547244.ga_sessions_*` as t, t.hits as hits, hits.product as p

This gives me the error "Error: SELECT list expression references column visitid which is neither grouped nor aggregated at [16:1]"
Anyone have any idea how to achieve the result I want?

A: Don't have schema details for ga_sessions tables but try below
#standardSQL
SELECT
  visitid,
  eCommerceAction.action_type AS ecommerce_actiontype,
  (SELECT ARRAY_AGG(product.productSKU) FROM UNNEST(t.hits) WHERE NOT product.productSKU IS NULL) AS sku_list,
  ARRAY(SELECT product.productSKU FROM UNNEST(t.hits) WHERE NOT product.productSKU IS NULL) AS sku_list2
FROM `test.1234.ga_sessions_*` AS t

as you can see - I presented two options for construction needed array - ARRAY_AGG within SELECT and ARRAY(SELECT

A: See if this works for you:
SELECT
  visitid,
  ARRAY(SELECT AS STRUCT ecommerceAction.action_type act_type, ARRAY_AGG(DISTINCT productSku IGNORE NULLS) skus_list FROM UNNEST(hits), UNNEST(product) GROUP BY 1) data
FROM `test.1234.ga_sessions_*`

The main difference between this query and yours is that it avoids using the outer UNNEST on the hits field which helps later on to aggregate on for each visitId all the ecommerceActions and the skus associated with them.


text:
Q: How to save the items that a user bought in the database and prevent him to buy it again I need some help storing the files a user bought and downloaded. I have a table with files and their ID. When users buy and file it's just redirecting him to the download link. But I want to make PHP script insert into the database the ID of the files that user bought. But how to do it with multiple files and store their ID in 1 field for each user. For example I have 10 files and the user bought files 1,2,3,8,9. I want to store in the database these numbers and do a while to show the link that corresponds to these ID's.

A: You need to create a table user_files that has two columns, user_id and file_id forming a composite primary key:
CREATE TABLE user_files (
  user_id         INT NOT NULL,
  file_id         INT NOT NULL,
  PRIMARY KEY (user_id, file_id),
  FOREIGN KEY (user_id) REFERENCES users(id),
  FOREIGN KEY (file_id) REFERENCES files(id),
);

If user 1 buys files 1,2,3,8,9, you would then do
INSERT INTO user_files (user_id, file_id) VALUES (1,1), (1,2), (1,3), (1,8), (1,9)

and then, when you need to check if a user has bought you just check if that user_id / file_id combination exists in the table.


text:
Q: Is there an in-built operation that will binarise a grayscale Bitmap with respect to an intensity threshold? Is there an in-built operation that will binarise a grayscale Bitmap with respect to an intensity threshold?

A: There is nothing built in, you will have to write your own.


text:
Q: How to find xpath of dynamic cell value in a table Can anyone give an example for the below scenario.
Website link: http://www.uitestingplayground.com/dynamictable
Scenario
For Chrome process get value of CPU load.

A: In case you are looking for the value inside the table you will need to get the number of header containing the CPU text since the columns order is changing in that table, as in the code below.
In case the aim element is the element below the table //p[@class="bg-warning"] XPath locator could be used.
Full Selenium code printing there texts could be as following:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

options = Options()
options.add_argument("--start-maximized")

s = Service('C:\webdrivers\chromedriver.exe')

driver = webdriver.Chrome(options=options, service=s)

url = 'http://www.uitestingplayground.com/dynamictable'

wait = WebDriverWait(driver, 10)
driver.get(url)

headers_locator = "//div[@role='row']//span[@role='columnheader']"
table_locator = "//div[@role='row' and(contains(.,'Chrome'))]//span[{0}]"
outer_locator = "//p[@class='bg-warning']"
cpu_column = 0

headers = wait.until(EC.visibility_of_all_elements_located((By.XPATH, headers_locator)))
for inx, header in enumerate(headers):
    if "CPU" in header.text:
        cpu_column = inx + 1
        break
table_locator = table_locator.format(cpu_column)
table_text = wait.until(EC.visibility_of_element_located((By.XPATH, table_locator))).text
outer_text = wait.until(EC.visibility_of_element_located((By.XPATH, outer_locator))).text
print("Table element text is " + table_text)
print("Outer element text is " + outer_text)

The output is changing from run to run, but it looks like:
Table element text is 7.1%
Outer element text is Chrome CPU: 7.1%

Process finished with exit code 0


text:
Q: Conditionally load router middleware Express JS I have a Express JS code where I load a middleware that defines certain end-points on a router. The endpoints are specific to the user login and logout. I am adding a new authentication in which case I receive my auth token from a different service. When I receive the token from a different service I don't want those end-points to be loaded.
This is my server.js file
let app = express();
const authEndpoints = require('auth');  // this defines router endpoints
const alreadyAuth = require('checkHeaders'); // this middleware checks if request
// already has the auth headers and set res.locals.alreadyAuthenticated to true else false

app.use('/', alreadyAuth);
app.use('/',function(req, res, next) {
  if(res.locals.alreadyAuthenticated === false)
    next();
else {
   console.log('authentication already exists skipping authEndpoints loading');
   next('route');
   }
}, authEndpoints); // login, logout

//continue here
app.use('/',nextMiddleware);

auth.js file
'use strict';

const express = require('express');
const path = require('path');
const router = express.Router();
router.get('/login', (req, res) => {
  // some code
  res.sendFile('login.html');
}
router.get('/logout', (req, res) => {
  // some code
});

module.exports = router;

I see the console log that prints 'authentication already exists skipping authEndpoints loading' but the endpoints /login and /logout are still accessible.
Also when I comment the whole section
app.use('/',function(req, res, next) {
  if(res.locals.alreadyAuthenticated === false)
    next();
else {
   console.log('authentication already exists skipping authEndpoints loading');
   next('route');
   }
}, authEndpoints); // login, logout

then the endpoints are not loaded.
Can someone please clarify If this not the way next('route') should be used.

A: From the top of my head, try adding a isAuthenticated (whatever is your equivalent to this) check to the /login and /logout routes code you listed. if it's authenticated, do a redirect to the protected page, else return the user the login form (or logout thing..). :)

A: I think that is better if you use the middleware "alreadyAuth" for every request, no matter the route:
app.use(alreadyAuth);

In this way you check the headers in every request for every route. In the "checkHeaders" middleware, you must use an if statement that redirect the user to the login page if is not authenticated, and use next() in the case that is already authenticated.
let checkHeaders = function(req, res, next) {
    //some code that check headers
    if(isAuthenticate === false) {
        res.redirect("/login");
    } else {
        next();
    };
}

Now, all the end points after this middleware are not accessible if the user is not authenticated. So you can use a logout endpoint, or whatever.
Good Luck!


text:
Q: Method that pass parameter to retrieve data from mysql java I want to create a method when i passed a value to the parameter, it will be passed to the sql statement.
here is what i've tried:
import java.sql.*;
import java.util.*;
import java.text.*;

public class cobadatabase{
    protected String sn,fn,ln;
    private Connection conn;
    private PreparedStatement st;
    public cobadatabase(String studentnumber)
    {

        try{
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://localhost/studentrecords","root","");
            st = conn.prepareStatement("SELECT * FROM student WHERE Student_Number=?");
            ResultSet rs = st.executeQuery();

            while (rs.next()){

                sn = rs.getString(1);
                fn = rs.getString(2);
                ln = rs.getString(3);
                SimpleDateFormat ft = new SimpleDateFormat("kk:mm:ss");
                ft.format(rs.getTime("Total Time").getTime());

            }
        }
        catch(Exception e){
            e.printStackTrace();

        }

i don't know what is wrong with my code. I just want to retrieve the data for printing

A: You haven't set parameter in prepareStatement
st = conn.prepareStatement("SELECT * FROM student WHERE Student_Number=?");
// You need to set the parameter for `?`
st.setString(1, studentnumber);  // Add this code in between..
ResultSet rs = st.executeQuery();

And actually that is not a method.. that is a Constructor you are using.. And you are using it for wrong purpose..
Technically, the sole purpose of a Constructor is to initialize the attributes of the object being created, or initialize the environment for use..
For using database query, or doing any other kind of task, you should use a method, and invoke that..

A: I guess you mean something like that:
public String Func (String par1, String par2) throws SQLException {
     String query;
     query ="SELECT ... WHERE COLUMN_NAME between  +"'"+par1+"'"+" AND " +"'"+par2+"'"+...";

    rs = st.executeQuery(query);   // get data or just Execute without getting results

Pay attention that Between a String there should be a " '' " (non-doubled quotes), whereas numeric values shouldn't.


text:
Q: ASP.Net Core 2.0 SignInAsync returns exception Value cannot be null, provider I have an ASP.Net Core 2.0 web application I am retrofitting with unit tests (using NUnit).  The application works fine, and most of the tests thus far work fine.
However, testing the authentication/authorization (does a user get logged in and can access [Authorize] filtered actions) is failing with...
System.ArgumentNullException: Value cannot be null.
Parameter name: provider

...after...
await HttpContext.SignInAsync(principal);

...but it is not clear what in fact is the underlying cause. Code execution stops in the called method here and no exception is shown in the IDE but code execution returns to the caller, then terminates (yet I still see The program '[13704] dotnet.exe' has exited with code 0 (0x0). in the output window of VS.)
The Test Explorer shows red and gives the exception referenced (otherwise I would have no idea as to the problem.)
I am working on creating a repro to point folks to (turning out to bit a bit involved thus far.)
Does anyone know how to pinpoint the underlying cause? Is this a DI related issue (something needed that isn't being provided in the test but is in normal execution)?
UPDATE1: Providing requested authentication code...
public async Task<IActionResult> Registration(RegistrationViewModel vm) {
    if (ModelState.IsValid) {
        // Create registration for user
        var regData = createRegistrationData(vm);
        _repository.AddUserRegistrationWithGroup(regData);

        var claims = new List<Claim> {
            new Claim(ClaimTypes.NameIdentifier, regData.UserId.ToString())
        };
        var ident = new ClaimsIdentity(claims);
        var principal = new ClaimsPrincipal(ident);

        await HttpContext.SignInAsync(principal); // FAILS HERE

        return RedirectToAction("Welcome", "App");
    } else {
        ModelState.AddModelError("", "Invalid registration information.");
    }

    return View();
}

The test code that fails...
public async Task TestRegistration()
{
    var ctx = Utils.GetInMemContext();
    Utils.LoadJsonData(ctx);
    var repo = new Repository(ctx);
    var auth = new AuthController(repo);
    auth.ControllerContext = new ControllerContext();
    auth.ControllerContext.HttpContext = new DefaultHttpContext();

    var vm = new RegistrationViewModel()
    {
        OrgName = "Dev Org",
        BirthdayDay = 1,
        BirthdayMonth = "January",
        BirthdayYear = 1979
    };

    var orig = ctx.Registrations.Count();
    var result = await auth.Registration(vm); // STEPS IN, THEN FAILS
    var cnt = ctx.Registrations.Count();
    var view = result as ViewResult;

    Assert.AreEqual(0, orig);
    Assert.AreEqual(1, cnt);
    Assert.IsNotNull(result);
    Assert.IsNotNull(view);
    Assert.IsNotNull(view.Model);
    Assert.IsTrue(string.IsNullOrEmpty(view.ViewName) || view.ViewName == "Welcome");
}

UPDATE3: Based on chat @nkosi suggested that this is a problem stemming from my not fulfilling the needs of the dependency injection requirements for HttpContext.
However, what isn't yet clear is: if it is, in fact, an issue of not providing the proper service dependency, why does the code work normally (when not being tested).  The SUT (controller) only accepts an IRepository parameter (so that is all that is provided in any case.)  Why create an overloaded ctor (or mock) just for test, when the existing ctor is all that is called when running the program and it runs without issue?
UPDATE4: While @Nkosi answered the bug/problem with a solution, I am still wondering why the IDE isn't accurately/consistently presenting the underlying exception.  Is this a bug, or due to the async/await operators and the NUnit Test Adapter/runner? Why aren't exceptions "popping" like I would expect while debugging the test, and the exit code is still zero (typically indicating a successful return state)?

A:
Is this a DI related issue (something needed that isn't being provided in the test but is in normal execution)?

YES
You are calling features that the framework would setup for you at run time. During isolated unit tests you will need to set these up yourself.
The Controller's HttpContext is missing an IServiceProvider which it uses to resolve IAuthenticationService. That service is what actually calls SignInAsync
In order to let....
await HttpContext.SignInAsync(principal);  // FAILS HERE

...in the Registration action to execute to completion during the unit test you will need to mock a service provider so that the SignInAsync extension method does not fail.
Update the unit test arrangement
//...code removed for brevity

auth.ControllerContext.HttpContext = new DefaultHttpContext() {
    RequestServices = createServiceProviderMock()
};

//...code removed for brevity

Where createServiceProviderMock() is a small method used to mock a service provider that will be used to populate the HttpContext.RequestServices
public IServiceProvider createServiceProviderMock() {
    var authServiceMock = new Mock<IAuthenticationService>();
    authServiceMock
        .Setup(_ => _.SignInAsync(It.IsAny<HttpContext>(), It.IsAny<string>(), It.IsAny<ClaimsPrincipal>(), It.IsAny<AuthenticationProperties>()))
        .Returns(Task.FromResult((object)null)); //<-- to allow async call to continue

    var serviceProviderMock = new Mock<IServiceProvider>();
    serviceProviderMock
        .Setup(_ => _.GetService(typeof(IAuthenticationService)))
        .Returns(authServiceMock.Object);

    return serviceProviderMock.Object;
}

I would also suggest mocking the Repository for the purposes of an isolated unit test of that controller action to make sure it flows to completion without any negative effects

A:
What isn't yet clear is: if it is, in fact, an issue of not providing the proper service dependency, why does the code work normally (when not being tested). The SUT (controller) only accepts an IRepository parameter (so that is all that is provided in any case.) Why create an overloaded ctor (or mock) just for test, when the existing ctor is all that is called when running the program and it runs without issue?

You are mixing up a few things here: First of all, you don't need to create separate constructors. Not for testing, and not for actually running this as part of your application.
You should define all the direct dependencies your controller has as parameters to the constructor, so that when this runs as part of the application, the dependency injection container will provide those dependencies to the controller.
But that's also the important bit here: When running your application, there is a dependency injection container that is responsible of creating objects and providing the required dependencies. So you actually don't need to worry too much about where they come from. This is different when unit testing though. In unit tests, we don't want to use dependency injection since that will just hide dependencies, and as such possible side effects that may conflict with our test. Relying on dependency injection within a unit test is a very good sign that you are not unit testing but doing an integration test instead (at least unless you are actually testing a DI container).
Instead, in unit tests, we want to create all objects explicitly providing all dependencies explicitly. This means that we new up the controller and pass all dependencies the controller has. Ideally, we use mocks so we don't depend on external behavior in our unit test.
This is all pretty straight forward most of the time. Unfortunately, there is something special about controllers: Controllers have a ControllerContext property that is automatically provided during the MVC lifecycle. Some other components within MVC have similar things (e.g. the ViewContext is also automatically provided). These properties are not constructor injected, so the dependency is not explicitly visible. Depending on what the controller does, you might need to set these properties too when unit testing the controller.

Coming to your unit test, you are using HttpContext.SignInAsync(principal) inside your controller action, so unfortunately, you are operating with the HttpContext directly.
SignInAsync is an extension method which will basically do the following:
context.RequestServices.GetRequiredService<IAuthenticationService>().SignInAsync(context, scheme, principal, properties);

So this method, for pure convenience, will use the service locator pattern to retrieve a service from the dependency injection container to perform the sign-in. So just this one method call on the HttpContext will pull in further implicit dependencies that you only discover about when your test fails. That should serve as a good example on why you should avoid the service locator pattern: Explicit dependencies in the constructor are much more manageable. – But here, this is a convenience method, so we will have to live with that and just adjust the test to work with this.
Actually, before moving on, I want to mention a good alternative solution here: Since the controller is a AuthController I can only imagine that one of its core purposes is to do authentication stuff, signing users in and out and things. So it might actually be a good idea not to use HttpContext.SignInAsync but instead have the IAuthenticationService as an explicit dependency on the controller, and calling the methods on it directly. That way, you have a clear dependency that you can fulfill in your tests and you don't need to get involved with the service locator.
Of course, this would be a special case for this controller and won't work for every possible call of the extension methods on the HttpContext. So let's tackle how we can test this properly:
As we can see from the code what SignInAsync actually does, we need to provide a IServiceProvider for HttpContext.RequestServices and make that be able to return an IAuthenticationService. So we'll mock these:
var authenticationServiceMock = new Mock<IAuthenticationService>();
authenticationServiceMock
    .Setup(a => a.SignInAsync(It.IsAny<HttpContext>(), It.IsAny<string>(), It.IsAny<ClaimsPrincipal>(), It.IsAny<AuthenticationProperties>()))
    .Returns(Task.CompletedTask);

var serviceProviderMock = new Mock<IServiceProvider>();
serviceProviderMock
    .Setup(s => s.GetService(typeof(IAuthenticationService)))
    .Returns(authenticationServiceMock.Object);

Then, we can pass that service provider in the ControllerContext after creating the controller:
var controller = new AuthController();
controller.ControllerContext = new ControllerContext
{
    HttpContext = new DefaultHttpContext()
    {
        RequestServices = serviceProviderMock.Object
    }
};

That's all we need to do to make HttpContext.SignInAsync work.
Unfortunately, there is a bit more to it. As I've explained in this other answer (which you already found), returning a RedirectToActionResult from a controller will cause problems when you have the RequestServices set up in a unit test. Since RequestServices are not null, the implementation of RedirectToAction will attempt to resolve an IUrlHelperFactory, and that result has to be non-null. As such, we need to expand our mocks a bit to also provide that one:
var urlHelperFactory = new Mock<IUrlHelperFactory>();
serviceProviderMock
    .Setup(s => s.GetService(typeof(IUrlHelperFactory)))
    .Returns(urlHelperFactory.Object);

Luckily, we don't need to do anything else, and we also don't need to add any logic to the factory mock. It's enough if it's just there.
So with this, we can test the controller action properly:
// mock setup, as above
// …

// arrange
var controller = new AuthController(repositoryMock.Object);
controller.ControllerContext = new ControllerContext
{
    HttpContext = new DefaultHttpContext()
    {
        RequestServices = serviceProviderMock.Object
    }
};

var registrationVm = new RegistrationViewModel();

// act
var result = await controller.Registration(registrationVm);

// assert
var redirectResult = result as RedirectToActionResult;
Assert.NotNull(redirectResult);
Assert.Equal("Welcome", redirectResult.ActionName);

I am still wondering why the IDE isn't accurately/consistently presenting the underlying exception. Is this a bug, or due to the async/await operators and the NUnit Test Adapter/runner?

I have seen something similar in the past too with my asynchronous tests, that I could not debug them properly or that exceptions wouldn't be displayed correctly. I don't remember seeing this in recent versions of Visual Studio and xUnit (I'm personally using xUnit, not NUnit). If it helps, running the tests from the command line with dotnet test will usually work properly and you will get proper (async) stack traces for failures.

A: as @poke mentioned you better not use Dependency Injection in unit tests and provide dependencies explicitly (using mocking) but however, I had this issue in my integration tests and I figured that the problem arises from RequestServices property of HttpContext which is not properly initialized in tests (since we don't use actual HttpContext in tests) so I registered my HttpContextAccessor like below and passed all of it's required service myself (manually) and problem solved. see code below
Services.AddSingleton<IHttpContextAccessor>(new HttpContextAccessor() { HttpContext = new DefaultHttpContext() { RequestServices = Services.BuildServiceProvider() } });

I agree it's not a very clean solution but note that I wrote and used this code only in my tests in order to provide required HttContext dependencies (which were not supplied automatically in test method), in your application IHttpContextAccessor, HttpContext and their required services are automatically provided by framework.
here is all of my dependency registration method in my tests base class constructor
 public class MyTestBaseClass
 {
  protected ServiceCollection Services { get; set; } = new ServiceCollection();
  MyTestBaseClass
 {

   Services.AddDigiTebFrameworkServices();
        Services.AddDigiTebDBContextService<DigiTebDBContext>
        (Consts.MainDBConnectionName);
        Services.AddDigiTebIdentityService<User, Role, DigiTebDBContext>();
        Services.AddDigiTebAuthServices();
        Services.AddDigiTebCoreServices();
        Services.AddSingleton<IHttpContextAccessor>(new HttpContextAccessor() { HttpContext = new DefaultHttpContext() { RequestServices = Services.BuildServiceProvider() } });
}
}


text:
Q: css selector: a class inside another class is not working I read somewhere a class inside another class is written in this way:
.class1 .class2 { style}.
But I found it counld not work.
For example:

Welcome to My Homepage

 My name is Donald

 I live in Duckburg.

As you can see, the following is supposed to be green. But it actually not.

 My name is Mike

Am I missing anything here?

A: You can't nest
 elements. Paragraphs can only contain phrasing content.
Change the outer paragraph to a
 and the styles will be applied correctly:

h1 p {
  background-color: yellow;
}

.a1 .a2 {
  background-color: green;
}

Welcome to My Homepage

 My name is Donald

 I live in Duckburg.

A: It's not an issue with the CSS, but rather the HTML:
You're nesting a
 tag inside of another
 tag.
See https://stackoverflow.com/a/12015809/7024837
Maybe you can try changing
 into ?


text:
Q: please explain every element of Java main ("public static void main(String[] args)")
*

*Explain Java main method?
2.Why main is always public in Java?
3.why main is always static?
4.why main always accepts String array as argument?
5.can we overload main method in java?

*can we override main method in java?

Please explain in detail

A: Hi Please find the answers below:
1.Explain Java main method?

Please find complete explanation in following video : https://www.youtube.com/watch?v=Z7rPNwg-bfk&feature=youtu.be

2.Why main is always public in Java?

So that main can be accessed by JVM.
    3.why main is always static?
    at RunTime JVM do not create any object and static method can be accessed by class name, so main is always static.
    4.why main always accepts String array as argument?
    it is a command line argument and any data type can be converted to string just by putting it in double quotes, so string is used.
    5.can we overload main method in java?
    Yes
    6. can we override main method in java?
    No Static methods can not be overridden.


text:
Q: Why is my crontab not working? I'm trying to get a cron job to run rsync. I started with this:
*/30 * * * * rsync -avz -e "ssh -i /home/ubuntu/ocf_dev_us"  ubuntu@10.0.12.76:/home/ubuntu/kumar/ /home/ubuntu/kumar/"

and it wasn't working, so I replaced it with this:
0 * * * * env > /tmp/env.output

and even that isn't working. How do I find out what's going on?

A: Your cronjob fires only every 60 minutes. Try this
* * * * * env > /tmp/env.output

to find out if your cronjob is working.


text:
Q: I don't know how to add an id to make relation between my post and my comment (React JS/Strapi) I use React JS and Strapi. I am trying to send comment to my API. I worked but without one essential thing : the post for which I am writing a comment. How can I possibly add the id of my post so that the relation is made between my comment and my post ?
import React, { useState } from 'react'
import { useParams } from 'react-router-dom'
import TextField from '@material-ui/core/TextField';
import { Button } from '@material-ui/core'
import CommentsAPI from '../../Services/CommentsAPI'

export default function CommentForm() {

    const [comment, setComment] = useState({})
    const {id} = useParams()

    const handleSubmit = async (event) => {
        event.preventDefault();
        try {
            CommentsAPI.create(JSON.parse(`{"data":${JSON.stringify(comment)}}`))
        } catch (error) {
            console.log(error)
        }
    }

    const handleChange = (event) => {
        const {name, value} = event.currentTarget
        setComment({
            ...comment,
            [name]: value
        })
    }

    return (
        <form onSubmit={handleSubmit}>

                <TextField
                    id="pseudo"
                    label="Pseudo"
                    type="text"
                    onChange={handleChange}
                    name="pseudo"
                />

                <TextField
                    id="comment"
                    label="Comment"
                    multiline
                    minRows={2}
                    onChange={handleChange}
                    name="content"
                />

                <Button variant="contained" color="primary" type="submit">
                    Send
                </Button>

        </form>
    )
}

import { URL_COMMENTS } from '../config'
import axios from 'axios'

function create(id_post, comment) {
    return axios.post(URL_COMMENTS, id_post, comment)
}

const CommentsAPI = {
    create
}

export default CommentsAPI

Thank you for your help.


text:
Q: Wrong number of arguments (1 for 2) for update method I'm having an issue tracking down why my update method isn't getting the needed arguments. I have a similar test for show and the payloads are working. In this scenario the route in question is invoice/invoice_id/trip/id. If you can help me spot the error and give any suggestions on how to troubleshoot this type of problem in the future that'd be great.
This is the update method.
def update
  if @trip.update(@trip.trip_id, trip_params)
    head :no_content
  else
    render json: [@invoice, @trip].errors, status: :unprocessable_entity
  end
end

With the following private methods.
private

  def set_trip
    @trip = Trip.where(:invoice_id => params[:invoice_id], :trip_id => params[:id] )
  end

  def trip_params
    params.require(:trip).permit(:trip_id, :depart_airport, :arrive_airport, :passenger_first_name, :passenger_last_name, :passenger_count, :departure_date, :merchant_id)
  end

  def load_invoice
    @invoice = Invoice.find(params[:invoice_id])
  end

end

My failing test looks like this.
test "should update trip" do
  put :update, invoice_id: @invoice.invoice_id, id: @trip,
   trip: {arrive_airport: @trip.arrive_airport,
   depart_airport: @trip.depart_airport,
   departure_date: @trip.departure_date,
   passenger_count: @trip.passenger_count,
   passenger_first_name: @trip.passenger_first_name,
   passenger_last_name: @trip.passenger_last_name}
 assert_response 204
end

A: if you are calling set_trip in before_action then update() method should look like this
def update
  if @trip.update(trip_params)
    head :no_content
  else
    render json: [@invoice, @trip].errors, status: :unprocessable_entity
  end
end

update() is an instance method that can be called using object, you only need to pass trip_params into it, Hope that helps!

A: You can get this error message when the method is calling another which is being passed the wrong number of arguments.

A: update takes a hash as its one and only argument, but you are are passing two arguments (@trip.trip_id, trip_params) in the update method.  This is why you are getting the "Wrong number of arguments (1 for 2) for update method" error message.  as @RSB said, just pass in the trip_params and the Trip instance will be updated.

A: RSB was right on the money. It turned out in this case that my issue was at the database level. The table didn't have a primary key so I was using
@trip = Trip.where in the private method and this was causing it to come back with an array of possible rows rather than the specific one. I changed things at the database level to have a primary key and updated the private method. Voilà RSB's code worked!


text:
Q: Keep getting redis error on Amazon EC2 I just moved my Magento site to Amazon EC2, but keep getting "Connection to Redis failed after 2 failures" error. I've tried to remove the redis configuration from app/etc/local.xml but still get that error.
I also tried to disable all the cache options directly from core_cache_option table. I have no idea how to clean the already cached files. No cache files under var/cache folder as expected and I've tried to flushall from redis-cli command prompt, but still keep getting this error.
Any idea what else should I try?
<cache>
  <backend_options>
    <server><![CDATA[/var/tmp/_cache.sock]]></server>
    <port><![CDATA[0]]></port>
    <persistent><![CDATA[]]></persistent>
    <database><![CDATA[0]]></database>
    <password><![CDATA[]]></password>
    <connect_retries><![CDATA[1]]></connect_retries>
    <read_timeout><![CDATA[10]]></read_timeout>
    <automatic_cleaning_factor><![CDATA[0]]></automatic_cleaning_factor>
    <compress_data><![CDATA[1]]></compress_data>
    <compress_tags><![CDATA[1]]></compress_tags>
    <compress_threshold><![CDATA[20480]]></compress_threshold>
    <compression_lib><![CDATA[gzip]]></compression_lib>
    <use_lua><![CDATA[0]]></use_lua>
  </backend_options>
  <backend><![CDATA[Cm_Cache_Backend_Redis]]></backend>
</cache>

A: Given EC2 instances are ephemeral, you should be able to regenerate the instance, right?  If that's not an option —
First, Check app/etc/ for other XML files.  Magento will parse any XML files it finds in this folder.  I've seen something like the following trip people up
$ ls app/etc/*.xml
local.xml
local.backup.xml

Magento parses both local.xml and local.backup.xml, and the backup values override the new values in local.xml.  Also, make sure you're working with the local.xml you think you are.  Magento loads the local configuration in the following location.  Add some temporary debugging to make sure it's doing what you think it's doing.
#File: app/code/core/Mage/Core/Model/Config.php
public function loadBase()
{
    $etcDir = $this->getOptions()->getEtcDir();
    $files = glob($etcDir.DS.'*.xml');
    $this->loadFile(current($files));
    while ($file = next($files)) {
        var_dump($file);
        $merge = clone $this->_prototype;
        $merge->loadFile($file);
        $this->extend($merge);
    }
    if (in_array($etcDir.DS.'local.xml', $files)) {
        $this->_isLocalConfigLoaded = true;
    }
    return $this;
}

Second, after you clear your cache, make sure Magento's reloading the configuration.  Add some temporary debugging to
#File: app/code/core/Mage/Core/Model/Config.php
public function init($options=array())
{
    $this->setCacheChecksum(null);
    $this->_cacheLoadedSections = array();
    $this->setOptions($options);
    $this->loadBase();

    $cacheLoad = $this->loadModulesCache();
    if ($cacheLoad) {
        var_dump("Loaded Config from Cache");
        return $this;
    }
    else
    {
        var_dump("Reloading configuration");
    }

    $this->loadModules();
    $this->loadDb();
    $this->saveCache();
    return $this;
}

Finally, if you suspect the problem is a file based cache not clearing, drop some debugging code in
#File: app/code/core/Mage/Core/Model/Config/Options.php
public function getCacheDir()
{
    //$dir = $this->getDataSetDefault('cache_dir', $this->getVarDir().DS.'cache');
    $dir = $this->_data['cache_dir'];
    $this->createDirIfNotExists($dir);
    var_dump($dir);
    return $dir;
}

This will let you know the cache directory Magento's reading from — if Magento can't read the local var, it'll pop up to the root level /var/ folder.


text:
Q: How do we know Aragorn's birthday? On the question How could Aragorn be 88 years old while he looks relatively young? there is the following comment :

One tiny bit of trivia: at that point in the books, he's actually 88 years old. His birthday was the day that they met Gandalf the White in Fangorn forest.
  - Plutor

Then :

How do you know his birthday?
  – Earendil 17 mins ago

Is there a quote or a something to support Plutor's affirmation?

A: In Appendix B of The Lord Of The Rings, titled "The Tale of Years", within the Third Age:

2931 . Aragorn son of Arathorn II born on March 1st.

Later, within March 3019:

1 . Frodo begins the passage of the Dead Marshes at dawn. Entmoot continues.
  Aragorn meets Gandalf the White. They set out for Edoras. Faramir leaves Minas
  Tirith on an errand to Ithilien.

Happy 88th, Aragorn!


text:
Q: Banning an IP address I banned an IP on my server, but I'd also like to ban using the CIDR method, e.g. IP/24.
My questions are:

*

*How do I find the CIDR range of the IP address.

*When banning the range, if the user has a dynamic IP given to them by their ISP. They would be able to bypass the ban, correct?

A: *

*whois <ip address> will typically show you the ip range associated with the IP address (you might have to put some of it into ipcalc or similar. There are a bunch of websites which will do a WHOIS on the IP address

*If you have banned a single ip address then chances are they can disconnect then reconnect and their ISP will hand them a different IP address. If you ban the entire ip range of an ISP then they would need to proxy through something (VPN) or switch ISP's. Note many of the larger ISP have multiple seemingly unconnected ip ranges as they have gone to their LIR over time to get more allocations.
Simply banning an IP address isn't always the best way forward


text:
Q: Creating a new list by dropping sub elements of the original list Suppose I have a nested listed as follows,
{{{1,2},{3,4,5},{2,3}},{{2,3,4},{5,4,1},{1,4,3}},{{3,4,5},{3,4,5}}}

Where the elements are,

{{1,2},{3,4,5},{2,3}}

{{2,3,4},{5,4,1},{1,4,3}}

{{3,4,5},{3,4,5}}

I would I create a new list where I drop any sub element that has 1 or 2 in its first part.  The output should then look like this,

{{{3,4,5}},{{5,4,1}},{{3,4,5},{3,4,5}}}

A:  lst = {{{1, 2}, {3, 4, 5}, {2, 3}}, {{2, 3, 4}, {5, 4, 1}, {1, 4,  3}},
        {{3, 4, 5}, {3, 4, 5}}};

 Select[#, FreeQ[#[[1]], 1 | 2] &] & /@ lst

or
 Pick[#, FreeQ[#[[1]], 1 | 2] & /@ #] & /@ lst

or
 Cases[#, _?(FreeQ[#[[1]], 1 | 2] &)] & /@ lst

or
 DeleteCases[#, _?(! FreeQ[#[[1]], 1 | 2] &)] & /@ lst

all give
{{3, 4, 5}}, {{5, 4, 1}}, {{3, 4, 5}, {3, 4, 5}}}

A: list = {{{1, 2}, {3, 4, 5}, {2, 3}}, {{2, 3, 4}, {5, 4, 1}, {1, 4, 3}}, {{3, 4, 5}, {3, 4, 5}}}

Then:
Cases[{Except[1 | 2], __}] /@ list  (* v10 syntax *)

{{{3, 4, 5}}, {{5, 4, 1}}, {{3, 4, 5}, {3, 4, 5}}}

OR
Map[Cases[{Except[1 | 2], __}]]@list  (* v10 operator form *)

OR
Select[#, #[[1]] != 1 && #[[1]] != 2 &] & /@ list

OR
Select[#[[1]] != 1 && #[[1]] != 2 &] /@ list  (* v10 syntax *)

A: DeleteCases with levelspec:
expr = {{{1, 2}, {3, 4, 5}, {2, 3}}, {{2, 3, 4}, {5, 4, 1}, {1, 4, 3}}, {{3, 4, 5}, {3, 4, 5}}};

DeleteCases[expr, {1 | 2, __}, {2}]

{{{3, 4, 5}}, {{5, 4, 1}}, {{3, 4, 5}, {3, 4, 5}}}

Or, inspired by RunnyKine's answer, in v10 operator syntax:
DeleteCases[{1 | 2, __}] /@ expr

{{{3, 4, 5}}, {{5, 4, 1}}, {{3, 4, 5}, {3, 4, 5}}}

A: If the list is all numbers, here's another way:
list = {{{1, 2}, {3, 4, 5}, {2, 3}}, {{2, 3, 4}, {5, 4, 1}, {1, 4, 3}}, {{3, 4, 5}, {3, 4, 5}}};
drop = {1, 2};

Pick[list,
 Unitize[
    Evaluate[Times @@ (# - drop)] & @
     Map[
      First,
      list,
      {2}]
  ],
 1
 ]
(*
  {{{3, 4, 5}}, {{5, 4, 1}}, {{3, 4, 5}, {3, 4, 5}}}
*)

Edit: changed the function applied to Map (thanks, Mr.Wizard), which originally was
Evaluate[ReleaseHold @ Fold[#1 (Hold[Slot][1] - #2) &, 1, drop]] &

A: Since all the good answers have been given, here's a dumb one:
expr = {{{1, 2}, {3, 4, 5}, {2, 3}}, {{2, 3, 4}, {5, 4, 1}, {1, 4, 3}}, {{3, 4, 5}, {3, 4, 5}}};
expr //. {pre___, {1 | 2, ___}, post___} :> {pre, post}


text:
Q: Image.Source (with binding) is blocking image file after binding is removed In a GridView, I've templated the items so an Image control inside that template receives an Uri  using a binding (also tried with BitmapImage) to show a picture file. It works, but I cannot delete those files because those files are blocked.  Even if I clear the collection feeding the GridView.ItemsSource, and even if I call GC.Collect(), they are still blocked.
Thanks to Philip for his working suggestion... as I used a Converter to feed a BitmapImage to every Image control, found some particular things had to do to make it work, and here it is for future reference:
InMemoryRandomAccessStream Ras = new InMemoryRandomAccessStream();
var archivo = CartoonsDownloader.FolderImagenes.GetFileAsync(TheFileName);

var fileStream = CartoonsDownloader.FolderImagenes.OpenStreamForReadAsync(TheFileName);
fileStream.Result.CopyTo(Ras.AsStreamForWrite());

BitmapImage MapaDeBits = new BitmapImage();
// Even it's RANDOM, I have to manually "Seek" it at 0.
Ras.Seek(0);
MapaDeBits.SetSource(Ras);
MapaDeBits.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
return MapaDeBits;

A: This could be a bug in the XAML stack (so you could report it on MSDN forums), or just a side effect of its nature of caching images. As an alternative - you can open the file yourself and set the image using the SetSource method. Then you should have better control over the file access.


text:
Q: Jquery AutoComplete Select Functionality I am developing a webpage in which I am using jquery autocomplete, the source of jquery autocomplete is an object literal of name and value. The name is showing in the autocomplete list. I want when the user click on the item of autocomplete, the page should be redirect to the link which I have store in the name field. How its possible?

A: You may use onChange event for the textfield selector and in that use window location  href with name of object literal.
       $('#textField').onChange(function() {
       window.location.href="location you want to redirect";
      });

Tell if this help or i have to make an edit


text:
Q: Can't Load And Parse DOM Object I am trying to load a dom object and to parse it for finding specific links
Here is my code:
$content = file_get_contents("http://www.example.com/example.php");
$dom = new DOMDocument();
$dom->loadHTML($content);
$dom->preserveWhiteSpace = false;
 var_dump($dom);

What I get is:

object(DOMDocument)#1 (0) { }

If i echo the $content I get all the html.
What is wrong in my code?

A: This is an example from the manual: DOMDocument
<?php
$content = file_get_contents("http://www.example.com/example.php");
$xml = new DOMDocument();
$xml->loadHTML($content);

// Empty array to hold all links to return
$links = array();

//Loop through each <a> tag in the dom and add it to the link array
foreach($xml->getElementsByTagName('a') as $link) {
    $links[] = array('url' => $link->getAttribute('href'), 'text' => $link->nodeValue);
}

print_r($links);
?>

A: Instead of var_dump($xml)
try:
echo $xml->saveHTML();


text:
Q: Simulating a hardware key press in Java without Robot I currently have a PS1 controller going through my Arduino sending messages to a Java program which then reads them and presses the correct key using a Robot. The problem with this is that the Robot class cannot send key presses to most applications and therefore will not send key presses to games which I would like to control using the PS1 controller. How are keyboard presses simulated without the use of a Robot, on a hardware level? I have previously tried having it run a Visual Basic Script, and it worked, but was much too slow. Is there any way to do it purely in java?

A: Java Native Access (JNA) enables to access the Native levels of Operating systems using Pure Java. You can access the JNA Project here.
Furthermore I found a sample which uses JNA to Hook on to Hardware Keyboard to listen to key presses. I think this is what you looking for.
If it is not what you are looking for, then you can definitely look through the reference and implement your own.


text:
Q: Can't catch an Invalid Form Body error discord.js I am trying to make a command to send an embed based on given JSON data, and it works, sort of.
I give the bot the data, and if it is correct, it will send it to the channel, which is perfect, exactly what I need it to do. BUT, if someone tries to put text in a link section, it will crash the bot. I tried try catch but it wont catch for some reason.
Error: Scheme "(my string that is not a url)" is not supported. Scheme must be one of ('http', 'https').
        try {
            let json = message.content.split(" ")
            json.shift() //get rid of the command bit, leaving the JSON
            let data = json.join(" ")
            let embedjson = new Discord.MessageEmbed(JSON.parse(data))
            message.channel.send({ embeds: [embedjson]}) //this works, unless it meets the problem listed above.
        } catch (error) { // >:( wont catch it
            let errorembed = new Discord.MessageEmbed()
            console.log(error)
            .setTitle('Error!')
            .setDescription(`Something went wrong! There are a few possible issues:\n1. You tried to put text in a link option (Like putting 'hello' in the image option, or 'never gonna give you up' in the thumbnail option.)\n2. Something else\nI'll attatch the error below:`)
            .addField('Error Message', error)
            message.channel.send({ embeds: [errorembed]})
        }

Any suggestions as to how I can catch the error? Any help is much appreciated.

A: I believe Discord.JS's client has an error event which could just log the error instead of crashing the node instance
Example:
client.on('error', (err) => {
    console.log(err)
})

Your code will still error, but your application will continue running. Not ideal, but a good solution if there is no other way.
You may also use process.on('error'), whichever floats your boat