text:
Q: Reactjs(v.15) make sibling component as children I have a component hierarchy like below(Source), My requirement is, while rendering would like to convert this into Target upon some property, here I am assuming as flag
Source:
<Parent>
   <Xyz flag={false}/>
   <One flag={true}/>
   <Two flag={true}/>
   <Three flag={true}/>
</Parent>

Target:
<Parent>
   <Xyz>
      <One />
      <Two />
      <Three />
   </Xyz>
</Parent>

My approach:
In side render of Parent
render() {
    const xyz = this.props.children.filter((children) => !children.props.flag);

    const kids = this.props.children.filter((children) => children.props.flag);

    const clonedXyz = React.cloneElement(xyz, [{...props}], [...kids]);
    return(
        <div>
            {clonedXyz}
        </div>
        );
}

Which is throwing error expected class/function but got undefined in react v15.x

A: Got the answer, https://codesandbox.io/s/7ww8n4my9x
it should be React.cloneElement(xyz[0], [{...props}], kids)


text:
Q: Select records from a specific key onwards I have a table that has more than three trillion records
The main key of this table is guid
As below
               GUID                       Value   mid  id
   0B821574-8E85-4FB7-8047-553393E385CB    4    51   15
   716F74B0-80D8-4869-86B4-99FF9EB10561    0    510  153
   7EBA2C31-FFC8-4071-B11A-9E2B7ED16B2B    2    5    3
   85491F90-E4C6-4030-B1E5-B9CA36238AE2    1    58   7
   F04FA30C-0C35-4B9F-A01C-708C0189815D    20   50  13

guid is primary key
I want to select 10 records from where the key is equal to, for example, 85491F90-E4C6-4030-B1E5-B9CA36238AE2

A: You can use order by and top. Assuming that guid defines the ordering of the rows:
select top (10) t.*
from mytable t
where guid >= '85491F90-E4C6-4030-B1E5-B9CA36238AE2'
order by guid

If the ordering is defined in an other column, say id (that should be unique as well), then you would use a correlated subquery for filterig:
select top (10) t.*
from mytable t
where id >= (select id from mytable t1 where guid = '85491F90-E4C6-4030-B1E5-B9CA36238AE2')
order by id

A: *

*To read data onward You can use OFFSET .. FETCH in the ORDER BY since MS SQL Server 2012. According learn.microsoft.com something like this:
-- Declare and set the variables for the OFFSET and FETCH values.
 DECLARE @StartingRowNumber INT = 1
       , @RowCountPerPage INT = 10;
 -- Create the condition to stop the transaction after all rows have been returned:
 WHILE (SELECT COUNT(*) FROM mytable) >= @StartingRowNumber
 BEGIN
 -- Run the query until the stop condition is met:
 SELECT *
 FROM mytable WHERE guid = '85491F90-E4C6-4030-B1E5-B9CA36238AE2'
 ORDER BY id
     OFFSET @StartingRowNumber - 1 ROWS
     FETCH NEXT @RowCountPerPage ROWS ONLY;
 -- Increment @StartingRowNumber value:
 SET @StartingRowNumber = @StartingRowNumber + @RowCountPerPage;
 CONTINUE
 END;

*In the real world it will not be enough, because another processes could (try)  read or write data in your table at the same time.
Please, read documentation, for example, search for "Running multiple queries in a single transaction" in the https://learn.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql

*Proper indexes for fields id and guid must to be created/applied to provide performance

redpajama_set_name: RedPajamaStackExchange


text:
Q: Como passar um objeto ou lista de objetos do Controller para View? Controller:
 [HttpPost]
        public ActionResult Create(Pedido pedido)
        {

            List<Produto> lista = new List<Produto>();

            if (ModelState.IsValid)
            {
                Cliente cliente = unitOfWork.ClienteRepository.Busca(pedido.ClienteId);
                Produto produto = unitOfWork.ProdutoRepository.Busca(pedido.ProdutoId);
                lista.Add(produto);
                pedido.produtos = lista;
                pedido.cliente = cliente;
                unitOfWork.PedidoRepository.Adiciona(pedido);
                unitOfWork.Salva();
                return RedirectToAction("Index");
            }

            ViewBag.ProdutoId = new SelectList(context.Produtos, "ID", "Nome", pedido.ProdutoId);
            ViewBag.ClienteId = new SelectList(context.Clientes, "ID", "NomeCliente", pedido.ClienteId);
            return View(pedido);

        }

Até ai OK...consigo salvar meu pedido com um cliente instanciado e uma lista de produtos...porém quando esse controller passa esse pedido para minha View INDEX...o objeto cliente e a lista de produtos chega vazia.
VIEW
@model IEnumerable<ProjetoZeus.Models.Pedido>

@{
    ViewBag.Title = "Index";
}

Lista de Pedidos

    @Html.ActionLink("Adicionar Novo", "Create")

<fieldset>
    <legend>Pedidos</legend>

            @Html.DisplayNameFor(model => model.ID)
            Produto
            Preço
            @Html.DisplayNameFor(model => model.cliente)

        @foreach (var item in Model)
        {

                   @Html.DisplayFor(model => item.ID)

                   @Html.DisplayFor(model => item.produtos[0].Nome)

                   @Html.DisplayFor(model => item.produtos[0].Preco)

                   @Html.DisplayFor(model => item.cliente.NomeCliente)

        }

</fieldset>

Action da Index
public ActionResult Index()
        {
            return View(unitOfWork.PedidoRepository.Pedidos);
        }

classe UnitOfWork
public PedidoRepository PedidoRepository
        {
            get
            {
                if (pedidoRepository == null)
                {
                    pedidoRepository = new PedidoRepository(context);
                }

                return pedidoRepository;
            }
        }

PedidoRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ProjetoZeus.Models
{
    public class PedidoRepository
    {
        private bool disposed = false;
        private Contexto context;

        public PedidoRepository(Contexto context)
        {
            this.context = context;
        }

        public void Salva()
        {
            context.SaveChanges();
        }

        public void Adiciona(Pedido pedido)
        {
            context.Pedidos.Add(pedido);
        }

        public Pedido Busca(int id)
        {
            return context.Pedidos.Find(id);
        }

        public void Remove(int id)
        {
            Pedido pedido = Busca(id);
            context.Pedidos.Remove(pedido);
        }

        public List<Pedido> Pedidos
        {
            get
            {
                return context.Pedidos.ToList();
            }

        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    context.Dispose();
                }
            }

            this.disposed = true;
        }
    }
}

A: Esta é mais uma das perguntas que mostram o despropósito (e a inutilidade) de implementar repositório com Entity Framework (que já é um repositório). Explico tudo aqui, mas como você está começando, vou explicar etapa por etapa do porquê.
Este é seu código principal:
        List<Produto> lista = new List<Produto>();

        if (ModelState.IsValid)
        {
            Cliente cliente = unitOfWork.ClienteRepository.Busca(pedido.ClienteId);
            Produto produto = unitOfWork.ProdutoRepository.Busca(pedido.ProdutoId);
            lista.Add(produto);
            pedido.produtos = lista;
            pedido.cliente = cliente;
            unitOfWork.PedidoRepository.Adiciona(pedido);
            unitOfWork.Salva();
            return RedirectToAction("Index");
        }

Em primeiro lugar, a maneira com que você formatou seu domínio só permite que um produto tenha um pedido. O correto seria definir uma entidade associativa entre produtos e pedidos, como, por exemplo:
public class ProdutoPedido
{
    [Key]
    public int ProdutoPedidoId { get; set; }
    public int ProdutoId { get; set; }
    public int PedidoId { get; set; }

    public virtual Produto Produto { get; set; }
    public virtual Pedido Pedido { get; set; }
}

Em segundo lugar, estes métodos são absolutamente inúteis:
    public void Salva()
    {
        context.SaveChanges();
    }

    public void Adiciona(Pedido pedido)
    {
        context.Pedidos.Add(pedido);
    }

    public Pedido Busca(int id)
    {
        return context.Pedidos.Find(id);
    }

    public List<Pedido> Pedidos
    {
        get
        {
            return context.Pedidos.ToList();
        }

    }

Você ocupa a pilha de chamadas pra realizar operações que o contexto já realiza. E agora vem o principal motivo de você jogar este repositório fora (além do contexto transacional que é impossível de acontecer com esta estrutura, mas isto é outro assunto). Aqui:
    public PedidoRepository(Contexto context)
    {
        this.context = context;
    }

Não há garantia alguma que, ao selecionar produtos e clientes, você esteja usando o mesmo contexto, o que causa vários problemas ao persistir os dados.
Uma solução que funciona, portanto, seria algo assim:
    [HttpPost]
    public ActionResult Create(Pedido pedido)
    {
        if (ModelState.IsValid)
        {
            var cliente = contexto.Clientes.FirstOrDefault(c => c.ClienteId = pedido.ClienteId);
            var produto = contexto.Produtos.FirstOrDefault(c => c.ProdutoId = pedido.ProdutoId);
            var lista = new List<ProdutoPedido> {
                new ProdutoPedido { Produto = produto }
            };

            pedido.produtoPedidos = lista;
            pedido.cliente = cliente;

            contexto.Pedidos.Add(pedido);
            contexto.SaveChanges();
            return RedirectToAction("Index");
        }

        ViewBag.ProdutoId = new SelectList(context.Produtos, "ID", "Nome", pedido.ProdutoId);
        ViewBag.ClienteId = new SelectList(context.Clientes, "ID", "NomeCliente", pedido.ClienteId);
        return View(pedido);
    }


text:
Q: Regex: account@domain (active directory) Something like testuser@test.local should be a match. The regex I use is:
\w[\w\.\- ]*$/@/^[a-zA-Z][a-zA-Z0-9\-\.]{0,61}[a-zA-Z]

What did I miss?
It's not like an E-Mail because it can be many sublevels in the domain e.g. test.local.country.city.street

A: You should also define, where in the text that address can appear. But if the address is on a separate line, then:
^[\w]+\@[\w]+\.[^\d\W]+$

The test is here.
If you want to accept complex names and domains of level above second, too, then:
^[\w]+(\.[\w]+)*\@[\w]+(\.[\w]+)*\.[^\d\W]+$


text:
Q: Fluent Assertions how to Exclude parameters with generic object I have this generic method for a test class that I want to exclude some common parameters between few entities.
private static bool IsEquivalentTo(object request, object expectedRequest)
{
    request.Should().BeEquivalentTo(expectedRequest, config => config.Excluding(c => c.SelectedMemberPath.EndsWith("Id"))
        .Excluding(c => c.SelectedMemberPath.EndsWith("Date"))
        .Excluding(c => c.SelectedMemberPath.EndsWith("Equipment"))
        .Excluding(c => c.SelectedMemberPath.EndsWith("Partners"))
        .Excluding(c => c.SelectedMemberPath.StartsWith("Warranty"))
    );
    return true;
}

Since the last versions, this SelectedMemberPath is deprecated. Did someone find a solution for generic objects with the latest version?
Thanks!

A: SelectedMemberPath has been replaced by Path in version 6.0:
request.Should().BeEquivalentTo(expectedRequest, config => config
    .Excluding(c => c.Path.EndsWith("Id"))
    .Excluding(c => c.Path.EndsWith("Date"))
    .Excluding(c => c.Path.EndsWith("Equipment"))
    .Excluding(c => c.Path.EndsWith("Partners"))
    .Excluding(c => c.Path.StartsWith("Warranty")));


text:
Q: Why wouldn't Latex balance my columns on *all pages* (acmart document class) We wrote a document using the acmart document class (double column).
On most pages, the two columns are balanced. However, in some places there are 2-5 lines difference between the two columns of a page.

Is there a way to force Latex to have same column lengths on every page of the document?

Ideally, I'd want the spacing between lines on the shorter column to increase slightly so that the columns will have exactly lengths.

To create an MWE, I shortened the document a lot, and this is not as severe as in some places, but sill bothers me:

Code:
\PassOptionsToPackage{warn}{textcomp}
\documentclass[sigconf,9pt]{acmart}

\usepackage{xspace}

\usepackage[noend]{algpseudocode}

\newcommand{\sys}{\ensuremath{\mathit{AAAA}}\xspace}

\setcopyright{acmcopyright}
\acmPrice{}

\copyrightyear{2020}
\acmYear{2020}
\setcopyright{acmcopyright}\acmConference[Aaaaaaaaaaaaa '20]{aaaaaa aaaaaaaaaa aa aaa aaa aaaaaaa aaaaaaaa aaaaa aa aaaa aaaaaaaaaaaaa aa aaa aaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaa, aaa aaaaaaaaa aaa aaaaaaaa aaaaaaaaaaaaa}{aaaaaa 10--14, 2020}{aaaaaaa aaaaa, aa, aaa}
\acmBooktitle{Annual conference of the aaa aaaaaaa aaaaaaaa aaaaa aa aaaa aaaaaaaaaaaaa aa aaa aaaaaaaaaaaa, aaaaaaaaaaaa, aaaaaaaaaaaaa, aaa aaaaaaaaa aaa aaaaaaaa aaaaaaaaaaaaa (aaaaaaa '20), aaaaaa 10--14, 2020, aaaaaaa aaaaa, aa, aaa}
\acmPrice{15.00}
\acmDOI{aa.aaaa/aaaaaaa.aaaaaaa}
\acmISBN{aaa-a-aaaa-aaaa-a/aa/aa}

\ccsdesc[500]{aaaaaaaaaaaaa~Aaaaaaaaaaaaa aaaaaa}
\ccsdesc[500]{aaaaaaaaaaaaa~Aaaaaaaaaaaaa aaaaaa}
\ccsdesc[500]{aaaaaaaaaaaaa~Aaaaaaaaaaaaa aaaaaa}

\begin{document}
\title{\sys: aaaa aaaa-aaaa aaaa aaaa}
\author{aaaa aaaa}
\affiliation{%
\institution{aaaa University}
}
\email{aaaa@aaaa.aaaa.edu}
\author{aaaa aaaa}
%\authornote{The secretary disavows any knowledge of this author's actions.}
\affiliation{%
\institution{University of aaaa aaaa}
}
\email{aaaa@aaaa.edu}
\author{aaaa aaaa}
\affiliation{%
\institution{aaaa University}
}
\email{aaaa@aaaa.aaaa.edu}
\author{aaaa aaaa}
\affiliation{%
\institution{aaaa aaaa University aaaa aaaa}
}
\email{aaaa.aaaa@aaaa.ac.uk}

% \email{email@domain.com}

% The default list of authors is too long for headers}
\renewcommand{\shortauthors}{AAA AAAAA et al.}

\begin{abstract}
aaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaa aa-aaaa aaaaaaaaa aaaaa aaaa aaaa aaaaaaa, aaaaaaaa a aaaa aaaaa aa aaaaaaaaaaaa, aaaaaaaaa aaaaaaa aaaaaaaaaaaaaaa, aaaaaaaaaa aaaaaaa, aaa aaaa aaaaaaa. aaaaaaa, aaaaaaaaa aaaa aaaaaaaaaaa aa aaaaaaa aaaa aaaaaaaaaaa aaaaaaaa aaaa aaaaaaa aaaa aaaa aaaaaaaaaa aaaaa aaa {aaaaaaaaaaa-aaaaa aaaaaaaaaaa.}

aaaaaaaaa aaa, aa aa-aaaa aaaaaaaaa aaaaaaaaa aaaa aaaaaa aaa aaaaaa aa aaaaaaaaaaa aaaaa aa aaaa aaaaaa. AAAA aaaaaaa aaa aaaaaaaaa aaaa aa aaaaaaaa aaaaaaa, aaaaaaaa aaa-aaaaaa aaaaaaaa aaaaaa aaaa aaa aa aa aaa aa aaa aaa.
aa aaaaaaa aaa aaa aaaaa aaaaaaaaaaa aaaaaa,
aaaaaaaaa aaaaa aaaa aaaaaaaa aaaaaaa aaa aaaaaaa aaaaaaaaaaaaaa.
aaa aa aaaaaaaaaaa aa a4 aaa aaa aa aaaaaa aa aaaaaaa aaaaaaa.
aaaaa aaaa aaaaaaaaaa aaa aaaaaaa aaaaaaaaaaa,
{aa aaaa aaaa aaa
aaaaaaaaa aaaaaaa aaaaaaaaa aaaa aa aaaaaaaaaa aaaaaaa, aaaa aaaaaaa, aaa aaaaaaaaa aaaa aaaaaaaaa,} aaaaa aaaa aaaaaaa aaaa aaa aaaaaa, aaaa {aaaaaaaaaaa aaaaaaaaaa aa aaa aaaaa aa aaa aaa.}
\end{abstract}

\maketitle
\section{Introduction}
aaaaaaa aaaaaaaaa aa aaa aaaaa aaa a aaaaaaa aa aaaaaaa aaaaaaaaaa aaaaaaaaaaaa
aaaa aa aaaaaaa aaaaaa aaaaaaaaaa~\cite{aaaaaaaaa}, aaaaaaaaa~\cite{aaaaa}, aaaaa
aaaaaaaaaaaa~\cite{aaaaaaaaaaaaa}, aaaaaaaa aaaaaaaaaa aaa aaaaaaaa~\cite{aaaaaaaaaa},
aaaaaa aaaaaaaaa~\cite{aaaaaaaa,aaaaaaaaa}, aaaaaaaaaa aaaaaaa~\cite{aaaa}, aaaa
aaaaaaaaa~\cite{aaaaaaaaaa,aaaaaaa,aaaaaaa}, aaaa aaaaaaa~\cite{aaaaa}, aaa aaaa
aaaaaaa~\cite{aaaaaaaaaaa}.
a aaaaaaaaaaa aaaaaa aaaaaaa aa aaaaaaaa aa aaa aa-aaaa aaaaaaa aaaaaaaaa (aaa)~\cite{aaa}.
aaa aaaaaa aaaaaaaa aa aaa aaaaaaaaaaa aa aaaa aaaaaa,
aaaa aa aaaaaa aa, aaaa aaaaaaaaaaa, aa aaaaa aaaaaa, aa aa aaaaaa aa. aaaa aaaaaaaaa aaaaaaaaaaa aa aaaa aaaaaaaaa  %(aaa aaaaaaaaaa aaaaaaaa)
aa aaa aaaaaaa aaaaaa aaaaa aaaa aaa aaaaaaaaa aa aaa aaaaaa.

aaa aa aaaaaaa aaaaaaaaa aa aaaaaaaaaaaa aaaaaaaa aaa aaaaaaa aaaaaaaaa aaaaa (aaaa)~\cite{aaaaaaaa-aaa,aaaaaaaa-aaa,aaaaaaaaa-aaa,aaaaaa-aaa}, aaaaaaaa aa aaaaaaaaaaaaa aaaaa aa aaaaaaaaaa aaaa aaa aaaa aaaaa aaaaaaaa aaa aaaaaa aaaa aaaaaaaaaa aaaaaaaaaa aaa aaaa-aaaaa aaaaaaaaaaa~\cite{aaa-aaa,aaaa}.
a aaa aaaaaaaa aa aaa aa aaa aaaaaaaa aa aaaaaaa. aaaaa aaaa aaaaaa aaaa aaaaaaaaaaa aa aaa aaaaaa, aaa aaaaaa aaaa aaaaaaaa aaaaa aaaaaaaa aaaa aaa aaaa aaaaaa.
aaaaaaaa, aaa aaaa aaaaaaaaa aaaa aaaaaa aaa-aaaaaa, aaa aaaaaa aaa aaaaaaaa aa: aa a aaaaaaa aaaa aaaaaa aaaaaaaa aaaa a aaaa, aaaaaaaaaa aaa aaaaaa aaa aaaaaa aaaaaaaa aa aaaaa aa aaaaaaaa, aa a.a\% aa a aaaa aaaaa aaaaaa.
aaaa aa aaaaaaa, aaaaaaaaa aa aaa aaa aaaaaaaa~\cite{aaa}, aaaa aaaaa aaaaaaaa a aaaaa aaa aaa, aaa aaa aaa aaaaaa aaaaa aaaaaaa a aaaaa.
aaaa aaaa aaaa aaaa aa aaaaa aaaaaaaaa aaaa, aaaaa aaaa aaa aa aaaa aa aaaaa aaa aaaaaa aaaaaaa aaa aaaa aaaaaa aaa aaaaaaa aaaaaaaaaaaa aaaa (aaa).
aa a aaaaaa, aaaaaaaaaaaa aaa aaaa aa aaaaa a aaaaaaa, a.a., aa aaa aaaa, aaaa aaaaaaaa aaaaaaa, aaaaaa aa aaaaaa aa aaaaaaa aaa aaa-aa-aaaaaaaaaa aaaaa aaaa aaaa-aaaaaaaaaaa aaaaaaaaa aaa aaaa aaaa~\cite{aaaaaaaaaa}.
{aaaaaa, aaa aaaaaaaa aa aaa aaa aaaaaa aaaaaaaaaaa aaaaaaaaaaa, aaaaaaaaaaa aaaaaaa aa aaaa aaaaa aa a aa\% aaaaaaaa aaa aa\% aaaaaaaaaaa aa aaaa aaaaaaaaaa aaaa aaa aaaa, aaaaaaaaaaaa (\S\ref{aaaa}).
aaaaaaaaaaaa, aaaa aaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaa at aaaaaaaaaaaa aaa aaaa aaaa aaaaaaaaaaaa aaaaaaaa aaa aaaaaaaaaaaa aaa aaaaaaaaaaaa aaa aaaa (\S\ref{aaaa:aaaa}).}

aa aaaaa aaaa aaa aaaaaaaa aa aa-aaaa aaaaaaa aaaaaaaaa,
aaa aa aaaaaaa aaaaaaaa aaaa;  aa aaaaaaaaaa, aa aaaa aa
aaaaaaaa aaa aaa-aaaaaa aaa aaaaaaaa.
aa aaaaaa aaaaaaaaaaaaa aa-aaaa aaaaaaa aaaaaaaaa (\sys), a aaaaaaaaaaaaa aaaaaaaaa aa aaa, aaaa aaaaaaaa aaaaaaa aaaaaaaaaa aa aaa
aaaaa aaaaaaaa aaa aaa-aaaaaa aaaaaaaa aaaaaaaaa aa aaaaaa aaa
aa aaa aaaa.
{\sys aaaaaa aaa aaaaaaaa aaaaaa aa aa aa aaa aa aaa aaa, aaa aaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaa aa aaaa aa. aa aaaaa aaaa aaaaa aa aaaaaaaaaaaaa aa aaa aaaaaaaaa aaaa aaaaaaaa aaa aaa aaaaaaaaa aaaaaaaaaaa. aaa aaaaaaa, aaaaaaaaa-aaaaa aaaaaaaaaa aaaaaaa aaaaaaa aaaa aaaa~\cite{aaaa} aaa aa aaaaa aa aaaa aaaa aaaaaaaaaaa aaaaaaaaa, aa aa aaaaaaaaaaa aa aaaa aaaaa.}
aa aaaa aaa aaaaa, a aaaaaa aaa aaa aaaaaa aaaaaaaa. aaaa \sys, a aaaaa aa aaaaaaaaaa aaaa a aaaaaaa aaaaaaaa aaaaaaa aa aaaa aaaaaa. aaa aaaaaaaaa aaaaaaaaaaa aa aaaaaaaaaaaaaaaaa aaaaaaa aaaa aaaaaaa aaaaaaaaa aaaaaaa aa aaaa a \cite{aaaaaaaaaa} aa a aaaa'a aaaaaaa aaaa aaaaaaa aaa aaaaaaaa aaaa.
aa a aaaaaaaa, aaaaa aaaa aaa a aaaaa aaaaaaaa aaaaa aaaaaa aaaaa aaa aaaa aa aaaaa aaaaa aaa aaaaaaaaaaa, \sys aaaaaaa aaa aaa aaaaaaaaaaa aaaa aaaaaaaa aaaaaaa aaaaaaaa aaaaaaa aaaaaaaa aaaaaaa aaaaaaaa aaaaaaa aa aa aaaaaaaa aaa aaa-aaaaaa aaaaaaaa. aaa aaaaaaa aaaaaa aaaa aaaaaaaa aa aaaa,
aaa aaaa aaaaaaaaaaaa, aa aa aaa aaaaaaaa aa aaaa aaa aa aaa aaa-aaaaaa-aaa-aaa aaaaaaaaaaa aaaa aaa aaaaaaaa.
%
{aaaaaaaa aaaaaaaaaa aaaaa aaaa aaaaaaaaa aaa aa aaaaaaaaa aaaaaaa aaaaaaaaa aaaaaaaaaaa. aaa aaaaaaaaaaaa aaaaa aaaa aaaaaaaaaaaa aaaaa aa aaaaaaaaaa, aaaaa aaaaaaaaaa aaa aaaaa aaaaaaaaaaa aaaaaaaaa. \sys aa aaaaaaaa aaa aaaaaaaaa aaaa aaaaaaaaaaaa}
%
aaa aaaaaaa, aa aa aaaaaaaa aa aaaaa a aaaa'a aaaa aaaaaaaaaaa~\cite{aaaaaaaaaa,aaaaaaaaa,aaaaaaaaaa}, aa aaaaaaaaa aaa aaaa aaaa a aaaaaaaaaa aa aaa aaaaaaa. aaaaaaaaaaaaa, aaaaaaaaaa aaaaaaa aa aaaa aaaaaaaaa aaaaaaaaaa aaaa aaaa aa aaaaaaa aaaaaaaaaaaa aaaaaaaa aa aaa, a.a., aaaa~\cite{aaaa}, aaaaa~\cite{aaaaaaa} aaa aaaa aa aaaaaaa aaaaaa aaaaaaaaaaa aaaaa aaa aaaa'a aaaaaaaaaa, aaa aa aaa \mbox{aaaaaaa aaaaaaaaaaa aaaaa aaa aaaa.}

\end{document}


text:
Q: What are the things to avoid when using a IoC container? I'm introducing an IoC Container in an architecture for the first time. I'm looking for things that one should not do with an IoC Container. I want to avoid the pitfalls of using an IoC container. I don't want to misuse or overuse it.
Can you help me put up a list of things to avoid when using a IoC container?
I have on item on my list so far:

*

*Don't let every class access the container (don't make it a public Singleton). Only a few top level classes should access the container.

A: Maybe this is more simplistic than the kind of advice you're looking for, but my suggestion would be: don't get hung up on the container.
IoC is 1% about the container, and 99% about the components inside. They're what gives the application value - the container on the other hand is infrastructural junk ;)
You should be able to design those components in the most effective way for your application.
If you start out with what seems to be a good container, and have no trouble creating well-encapsulated, clean, natural components that don't depend heavily on the container API, then you're on the right track.
If, however, you find yourself jumping through hoops to fit your design into the container, and you don't think the problem is with your design, the immediately find a container without the limitation that's impacting you, and just keep moving forwards.
Hope this helps!
Nick

A: If you are putting an IoC in place, I suggest you to have a look at http://docs.codehaus.org/display/YAN/IoC+Container
Here are few interesting points

*

*The most obvious one, container should not require business objects
  assembled by it to implement any
  interface, to inherit any class, to
  call any API. This avoids direct
  dependency on the container.

*The container should not require business objects to conform to any
  coding convention, such as "you have
  to expose public constructor", "you
  have to expose Java Bean setters",
  "you have to have a method named like
  injectXXX", "you have to use a special
  annotation" etc. Such restriction
  places an implicit dependency on the
  container because the programmers of
  the business objects still have to be
  aware of the do's and dont's from the
  container.

*Do not depend on any IoC container API
  in your IoC objects. It is a tragedy
  to violate the principle of IoC by
  using an IoC container.

*IoC container
  is for the code that assembly objects
  together; it is for the configuration
  of the system. After all, it is not
  for the business objects.

*Declarative API is preferable. It is nice to expose a declarative API rather than one that requires procedural coding.

A: I'd say don't use config files for registering types unless you absolutely have to.  It makes refactoring hard and it's also harder to unit test with your default (non mock) mappings.

A: The IoC container.
No, seriously; start writing everything without an IoC container.  Once you've gotten the hang of how IoC works and started using it in your code, you'll start to see the areas where the container will help.  That is when you should add the container: when you are ready to solve a real issue with the container.  Don't use a container just because someone said containers are a Good Idea™.


text:
Q: Query on load/link/initialise phase of java class file Below is the code:
package packagename;

import java.lang.reflect.Method;

class Super{
    static{
        System.out.println("Super");
    }
    public void superMethod(){

    }
}

class Sub extends Super{
    static{
        System.out.println("Sub");
    }
    public void subMethod(){

    }
}

public class Example {
     static{
        System.out.println("In Example");
      }
     public static void main(String[] args){
        Class myClass = Sub.class;
        Method[] methods = myClass.getMethods();
        for(Method eachMethod :  methods){
            System.out.println(eachMethod.getName() + " with " + eachMethod.getParameterCount() + " parameters");
        }
    }
}

On compiling this code and executing,
> java Example,
class Example gets loaded\linked\initialised. When Java interpreter starts interpreting main() method of class Example, before evaluating  expression Sub.class and assign to Class myClass variable, class Super& class Sub are loaded & linked but not initialised. This is the reason static initialisation blocks of class Super & class Sub are not executed, as per below output.
In Example
subMethod with 0 parameters
superMethod with 0 parameters
wait with 0 parameters
wait with 2 parameters
wait with 1 parameters
equals with 1 parameters
toString with 0 parameters
hashCode with 0 parameters
getClass with 0 parameters
notify with 0 parameters
notifyAll with 0 parameters

Is my understanding correct on, load/link/initialise phase of class Example, Super & Sub?

A: Only Example is initialized. Class Sub is retrieved from Constant pool
Constant pool:
   #1 = Methodref          #16.#39        //  java/lang/Object."<init>":()V
   #2 = Class              #40            //  Sub

and relevant code from main
Code:
  stack=4, locals=4, args_size=1
     0: ldc_w         #2                  // class Sub
     3: astore_1
     4: aload_1
     5: invokevirtual #3                  // Method java/lang/Class.getMethods:()[Ljava/lang/reflect/Method;

So, bytecode confirms your observation that Sub was not initialised. Not required for execution of code.

A: See JVMS §5.5

5.5. Initialization
Initialization of a class or interface consists of executing its class or interface initialization method (§2.9).
A class or interface C may be initialized only as a result of:

*

*The execution of any one of the Java Virtual Machine instructions new, getstatic, putstatic, or invokestatic that references C (§new, §getstatic, §putstatic, §invokestatic). These instructions reference a class or interface directly or indirectly through either a field reference or a method reference.
Upon execution of a new instruction, the referenced class is initialized if it has not been initialized already.
Upon execution of a getstatic, putstatic, or invokestatic instruction, the class or interface that declared the resolved field or method is initialized if it has not been initialized already.

*The first invocation of a java.lang.invoke.MethodHandle instance which was the result of method handle resolution (§5.4.3.5) for a method handle of kind 2 (REF_getStatic), 4 (REF_putStatic), 6 (REF_invokeStatic), or 8 (REF_newInvokeSpecial).
This implies that the class of a bootstrap method is initialized when the bootstrap method is invoked for an invokedynamic instruction (§invokedynamic), as part of the continuing resolution of the call site specifier.

*Invocation of certain reflective methods in the class library (§2.12), for example, in class Class or in package java.lang.reflect.

*If C is a class, the initialization of one of its subclasses.

*If C is an interface that declares a non-abstract, non-static method, the initialization of a class that implements C directly or indirectly.

*If C is a class, its designation as the initial class at Java Virtual Machine startup (§5.2).
Prior to initialization, a class or interface must be linked, that is, verified, prepared, and optionally resolved.

Generally, there are specifications for the behavior. If you want to understand the details, you may consider studying The Java® Language Specification and The Java® Virtual Machine Specification first and come up with questions, if you don't understand a certain part, then with pointers to the section raising the question.


text:
Q: Error on accessing a public static method I've a .Net dll referenced in my application.
On accessing one of its method called XYZ in my C# code, I get an error:

Attempt by method 'MyClass.ABC()' to access method 'OtherClass.XYZ()' failed.

When I see the metadata in VS.Net, I see  that it shows this method XYZ as public static only.
What could I be missing here please?
Thanks.

A: You need to call it using the class name. For example
public static class MyClass
{
  public static void MyMethod()
  { // Do something
  }
}

When calling you need to use
MyClass.MyMethod();

A: I had the same problem - this is what happened in my case:

*

*I have an assembly my.dll which defines  internal static void Foo();

*my.dll defines [assembly:InternalsVisibleTo("unittests")]

*I have a test assembly unittests.dll which calls Foo().

*I have test.localtestsettings with deploys my.dll and unittests.dll.

Through some mumbo jumbo, the testsettings file was deploying a stale version of a.dll which didn't have the AttributeInternalsVisibleTo.
This put me in a position where the code passed the compile-time check but threw a MethodAccessException at run-time. The cause in my case was an internal method being invoked from an assembly for which it should not have been visible. This is a type of security exception which I did not enjoy debugging. Good luck.


text:
Q: selecting items in a comboBox How can I make my comboBox to allow me to select more than 1 item??
Or how can I simulate this behaviour with a comboBox from QtDesigner??
I would like the user to be able to click two or more items and I would be able to get the selected items.

A: It sounds like you want a list box, use the PyQt QListWidget:
http://pyqt.sourceforge.net/Docs/PyQt5/api/qlistwidget.html

A: if you really want to use comboBox to select more then one items here is how I've did it link1. Also here is solution how to get what is selected link2


text:
Q: Can not override a variable in Swift For example, I created base classes for all the views of my project used MVVM pattern, and it hasn't any problem yet.
class BaseView: UIView {
    var viewModel: ViewModelProtocol

    init(viewModel: ViewModelProtocol) {
        self.viewModel = viewModel

        super.init(frame: .zero)
    }
}

protocol ViewModelProtocol {
}

class BaseViewModel: ViewModelProtocol {
}

However, If I create a child class(CustomView) inherited from parent class(BaseView) and it has to have a seperate ViewModel(CustomViewModel), I will get an error Property 'viewModel' with type 'CustomViewModel' cannot override a property with type 'ViewModelProtocol' at override var viewModel: CustomViewModel line.
final class CustomView: BaseView {
    override var viewModel: CustomViewModel
}

final class CustomViewModel: BaseViewModel {
    var name: String

    init(name: String) {
        self.name = name

        super.init()
    }
}

How can I do to meet the following conditions below?

*

*Every custom views should have to inherit BaseView.

*BaseView should have BaseViewModel.

*Every custom views can have a custom view model inherited from BaseViewModel.

A: I would suggest making BaseView accept generic ViewModel as below so that you don't need to override the viewModel property and your viewModel will always be the same custom type provided while inheriting from BaseView.
class BaseView<ViewModel: ViewModelProtocol>: UIView {
    var viewModel: ViewModel

    init(viewModel: ViewModel) {
        self.viewModel = viewModel

        super.init(frame: .zero)
    }
}

final class CustomView: BaseView<CustomViewModel> {

     // viewModel is of type  'CustomViewModel'
}


text:
Q: Perfect 180 turns and aiming I've noticed when watching some films that some players are able to do instant and perfect 180 degree spins. For example, I come up from behind and start shooting and they instantly spin and are aiming right at me. Is there some kind of a mouse macro that they could be using for this? Is it just a result of the theater rendering the video incorrectly (I doubt this)?
I can't even move that fast without worrying about accuracy. Maybe if I turned the mouse sensitivity to max, but then I can't imagine aiming under normal conditions.
On a similar note, I also often see players whose aim seems almost mechanical. Not that I think that they're using an aimbot (they sometimes miss), but when faced with several enemies they aim at one perfectly, shoot a few times then the aim immediately "jolts" to the next enemy. Is this just a lot of practice or are there tricks to being able to do this?

A: Beyond setting your mouse sensitivity high, disabling the "enhance mouse precision" option on the Windows control panel (you may need to go into the Windows panel, even if your mouse has it's own) can help greatly for shooters.  What it does is essentially reduce the pointer sensitivity the slower you move the mouse, or conversely speed it up the faster the mouse moves.  With that done away with, when you move the mouse an inch in whatever direction at whatever speed, you will always turn the same amount.

The downside of this is that unless you have a mouse with high DPI, you may not be able to have both the sensitivity as high as you like and have your cursor move smoothly (it may skip pixels)

A: Well practice practice practice for one, second your going to have to set your sensitivity to max. It takes awhile to get used to but once you do your going to be able to whip around quite a bit faster. And third don't always take what you see on YouTube as truth they don't put up video's of them failing miserably.

A: Its all about practice. Find a sensitivity you're comfortable with for all situations since changing sensitivity on the fly will get you killed if you're under fire. Even though my mouse also permits changing the sensitivity on the fly, I never use it. I have one setting I'm most comfortable at (1200dpi) and thats what I stick at. 180 degree turns are easy at that sensitivity, but 360s, not so much.
Also, try fooling around during the pre-match. If you creep up behind someone, try doing a 360 and shooting him. Its very important you build an intrinsic sense of how your mouse's physical movement maps to the cursor's movement. It'll come with practice, and you'll find yourself snapping in on enemies a lot faster.
Finally, if you're taking fire from behind, jump make a 180 and hit he prone button. The second or so it'll take the opponent to readjust his aim on you is often more than enough time for you to get the kill.

A: Just a whole lot of practice... I recently bought a programable keyboard that did a 180 degree turn but like I feared when getting it, it was tuned for far less superior gamers and my aim reaction time just using a mouse was way faster. I can play max veteran bots on Black Ops 3 and be able to turn and aim as well as they can. Practice is all you need. Don't play scrubs seek a challenge and ye shall overcome.


text:
Q: In ObjectBox for Flutter, is there a way to compare two properties? I'm new to using ObjectBox, so I've been trying to do some experimenting with its query system to familarize myself with it. One of the queries I've been unable to do is a query comparing two properties. Ignoring the errors they throw, these are some examples of what I'm looking to do:
// Get objects where first number is bigger than second number
boxA.query(ObjectA_.firstNumber.greaterThan(ObjectA_.secondNumber))

// Get parent objects where one of its children has a specific value from the parent
parentBox.query().linkMany(ParentObject_.children, ChildObject_.name.equals(ParentObject_.favoriteChild));

I know based on this question that it's possible in Java using filters, but I also know that query filters are not in ObjectBox for Dart. One of the workaround I've been testing is querying for one property, getting the values, and using each value to query for the second property. But that becomes unsustainable at even moderately sized amounts of data.
If anyone knows of a "proper" way to do this without the use of Java filters, that would be appreciated. Otherwise, if there's a more performant workaround than the one I came up with, that would be great too.

A: There is no query filter API for Dart in ObjectBox, because Dart already has the where API.
E.g. for a result list write results.where((a) => a.firstNumber >= a.secondNumber).


text:
Q: Selenium getting value by skipping a tag in between This is from Redbus.in website
What i want to do is extract the travels list and store it in list..but I cant get the exact value from this.

         National Travels

         Seabird Tourists

       ...

This is the java code I used to at least print the first value..
List<WebElement> allElements = driver.findElements(By.xpath("//ul[@id='t1-travListing']/li"));
int i=0;
allElements.remove(allElements.size()-1);
for (WebElement element: allElements) {
    System.out.println(driver.findElement(By.xpath("//li[@id='t1-travls-0']/a/")).getText());
}

As there is span tag after  tag i don't know how to skip that and get value from that

A: You can select your nodes directly with xpath:
//ul[@id = 't1-travListing']/li/a

Using it with findElements, it will return a list of all a-Tags within li-tags.
Selenium's getText should get you the displayed text, doing the "skipping" of the empty span-Tags by itself:
List<WebElement> allElements = driver.findElements(By.xpath("//ul[@id = 't1-travListing']/li/a"));

for (WebElement element: allElements) {
    System.out.println(element.getText());
}

You could also try an expression like this to select not the elements, but the text in them:
//ul[@id = 't1-travListing']/li/a/text()

A: Please try this. This should work.
List<WebElement> allElements = driver.findElements(By.xpath("//ul[@id='t1-travListing']/li"));
int i=0;
allElements.remove(allElements.size()-1); // not sure why are you doing this
for (WebElement element: allElements) {
    System.out.println(element.findElements(By.xpath("./a")).getText());
}

A: This would also work for you
List<WebElement> allElements = driver.findElements(By.xpath("//*[contains(@id,'t1-travls')]"));
            for (WebElement element: allElements) {
                System.out.println(element.getText());
            }

or
List<WebElement> allElements = driver.findElements(By.cssSelector("a[onclick*='bindTrav']"));
            for (WebElement element: allElements) {
                System.out.println(element.getAttribute("title"));
            }


text:
Q: Auto Complete Hint with Material in Android I read doc in material-text-field and there is auto-complete-textView on editText as hint not dropdown. You can see image below. But I can't do it. I try some code with textinputlayout and material-auto-complete-text like this
<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/til"
        ..>

    <com.google.android.material.textfield.MaterialAutoCompleteTextView
       .../>

</com.google.android.material.textfield.TextInputLayout>

in fragment
    ArrayList<String> items = new ArrayList<>();
    items.add("Material");
    items.add("Design");
    items.add("Components");

    ArrayAdapter<String> adapter = new ArrayAdapter<>(this,R.layout.item, items);
    TextInputLayout textInputLayout = findViewById(R.id.til);

and set adapter
((MaterialAutoCompleteTextView) textInputLayout.getEditText()).setAdapter(adapter);
    ((MaterialAutoCompleteTextView) textInputLayout.getEditText()).setText(adapter.getItem(1),false);

BUT the auto-complete-textview is suggesting the item on dropdown not on editText as a hint.
I want AutoComplete as "AutoC" must be text and "omplete" must be hint
How can I do it ??

A: EDIT:
Is the following what you are looking for?
(It will set the hint depending on the user input. But this cannot be used for actual Auto completion, since you cannot change the suggestions on your keyboard, as far as I know):
TextInputEditText editText = ((TextInputEditText) textInputLayout.getEditText());
editText.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {}

    @Override
    public void afterTextChanged(Editable s) {
        try {
            String userInput = s.toString();
            userInput = userInput.trim().toLowerCase();

            String match = null;
            for (String item : items) {
                if (item == null) continue;
                String fItem = item.trim().toLowerCase();
                if (fItem.startsWith(userInput)) {
                    match = item;
                    break;
                }
            }
            if (match == null) editText.setHint(""); // Insert your default hint text here
            else editText.setHint(match);
        } catch (Throwable tr) {
            tr.printStackTrace();
        }
    }
});

PREVIOUS
add the following as an attribute to your TextInputLayout:
style="@style/Widget.MaterialComponents.TextInputLayout.*.ExposedDropdownMenu"

also did you implement your list_item.xml (which you called 'item' (R.layout.item from your code)) correctly?

That's what it says on the official page:
In the layout:
<com.google.android.material.textfield.TextInputLayout
    ...
    style="@style/Widget.MaterialComponents.TextInputLayout.*.ExposedDropdownMenu">

    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="none"
    />

</com.google.android.material.textfield.TextInputLayout>

In code:
val items = listOf("Material", "Design", "Components", "Android")
val adapter = ArrayAdapter(requireContext(), R.layout.list_item, items)
(textField.editText as? AutoCompleteTextView)?.setAdapter(adapter)

In the item layout (list_item.xml):
<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="16dp"
    android:ellipsize="end"
    android:maxLines="1"
    android:textAppearance="?attr/textAppearanceSubtitle1"
/>

(https://material.io/components/text-fields/android#using-text-fields)


text:
Q: Square Register API does not work. Is there a fix? [BUG] I have a problem with the Square Register API (docs.connect.squareup.com/articles/register-api-overview/). I want to use the Square Register API in my Ionic 2 iOS app.
What I want to do
I want to send a JSON with the data about a purchase to the Square Point of Sale (Square POS) App. The documentation of the Square Register API says that this should be easy to do. The app should open and the check out process of the Square POS App should be triggered with the data given by the JSON request from my app. After the check out is completed the Square POS App should redirect to my app to a success screen. In this case the Square POS app should redirect to "summitapp://page-success".
The current status
I have registered my own Square App (connect.squareup.com/apps/) and did the configuration which is needed for an iOS app (connect.squareup.com/apps/{appname}/register-api) [appname should be replaced with the square internal id which I replaced for security reasons]
I also edit the info.plist to match the data from the Square Register API with the data inside my app. This works fine.
I also build the code to do the things I describe @"What I want to do". You can see the code at the button of this stack overflow post. I managed to send a request from my app to the Square POS App. The Square POS App opens, but immediately after it opened it redirects back to my app. It than shows this error message: Apple Pay is not available when using "Point of Sale"
I have also made a video showing you the behavior of the app:
https://www.youtube.com/watch?v=xLpSmV1XXJ8
In this video the error message does not appear, because I already had opened it and did the process the second time. The error message just appears once when the Square POS app is opened the first time by my app.
This error message I get is strange, because Apple Pay is not activated for the german market and I don't use it. I tried many different solutions. I added different possible payment methods and tried everything, but the only error message I got was the desired "Apple Pay Error Message".
To give you a bit of background what stack the app is build on, here is a short description: I am using Ionic 2 with an iPad Air 2 or an iPhone 7 Plus as a test device. On both devices the same error message occurs. Both devices run on the latest iOS 10 version and have installed the latest Square POS App. I use Ionic 2 (Version 2.2.1) and Cordova (Version 6.5.0).
What I tried
I already tried all the tutorials at Square:
LINK => docs.connect.squareup.com/articles/register-api-ios
And some advice I got from Stack overflow articles
LINK => stackoverflow.com/questions/41188031/square-connect-api-navigate-back-to-app
I also tried to build a iOS with the SDK, but also that doesn't work.
To give you an overview how the Square Register API is integrated into my code here is a short code snippet.
The Code looks like this:
let params = {
      "amount_money": {
        "amount": 100,
        "currency_code": "USD"
      },
      "callback_url": "summitapp://page-success",
      "client_id": "sq0idp-xyz", // here goes the client_id
      "version": "1.2",
      "notes": "Shopping cart",
      "options": {
        "supported_tender_types": [
          "CREDIT_CARD"
        ],
        "auto_return": true
      }
};

let url = "square-commerce-v1://?data=" + encodeURIComponent(JSON.stringify(params));
let browser = open(url, "_system", "location=true");

My question / Where I need help
I don't understand why the app allay redirects me to my app without any interaction happening on the Square POS App. Any help how to implement the Square POS App in an Ionic iOS app would be awesome.
I don't know if the bug is on the Square Register Apps side or on my side. If you know anything about this issue or if you can show me a working sample code of an iOS app which can open the Square POS App from another app and then do the check out based on the data provided by this app I would appreciate your comment on this stack overflow post.
I already check out the different tutorials and nothing worked. I hope to find someone who can help me fix that problem. I am decently going to write a blog post about this, because I think all people wanting to implement the Square Register API face the same problem.


text:
Q: On using circular nodes on the path using`` \draw ... to node ..." without crossing the circles
*

*Let us assume that we have a line segment starting at (0,0) and stopping at (-2,-2).

*Suppose we want to add two circular nodes on the line segment, one near to start one near to end.

*In addition the circular nodes have some texts in them: for example the starting node has "x" in it and the stopping node has "+ -" in it.

*Also we desire that the line does not cross the inside of the circles.

*We also prefer to use the  \draw ... to node ...
Below is the first trial code:
\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node [anchor=south west]at (0,0) (start){Start};
\node [anchor=north east]at (-2,-2) (stop){Stop};
\draw (start) to node [circle, draw,near start] {x}  node [circle, draw,near end] {+ -}(stop);
\end{tikzpicture}
\end{document}

The result is:

In order to prevent the line crossing the circles I add fill=white in the node properties as below:
\draw (start) to node [circle, draw,near start, fill=white] {x}  node [circle, draw,near end, fill=white] {+ -}(stop);
And we nicely get:

My question is: Is there other simple way instead of fill=white to create the desired output?

A: Is this? two dashes -- looks better!

\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path
(3,3) node (start) {Start}
(0,0) node (stop)  {Stop};
\path (start) to
node[circle,draw,near start] (x) {x}
node[circle,draw,near end]   (pm) {+ --}
(stop);
\draw (stop)--(pm)--(x)--(start);
\end{tikzpicture}
\end{document}

Update:
\documentclass[tikz,border=0.5cm]{standalone}
\begin{document}
\begin{tikzpicture}
\path
(3,3) node (start) {Start}
(0,0) node (stop)  {Stop};
\draw[nodes={circle,draw,fill=white}]
(start) to
node[near start] (x) {x}
node[near end]   (pm) {+ --}
(stop);
\end{tikzpicture}
\end{document}


text:
Q: Caliburn Micro Conductor.Collection.AllActive not working I have tried to activate multiple windows in application using Caliburn Micro with Conductor.Collection.AllActive
Steps Followed:
Inhertited MainHomeViewodel from Conductor.Collection.AllActive
1)created property
public ExploreViewModel Explorer {
   get; private set;
 }

2) Created ContentControl with name as property name
<ContentControl x:Name="Explorer" />

3)Activated viewmodel with property
Explorer = new ExplorerViewModel();
ActivateItem(Explorer );

After execution of above mentioned code its instantiating ExplorerViewModel but doesnt go to View's constructor or showing View .
Any problem with above implementation or do i need to do anything more to activate item.
Please Help!
Thanks.
EDIT
    public class MainHomeWindowViewModel : Conductor<IScreen>.Collection.AllActive
    {
      protected override void OnInitialize()
      {
       base.OnInitialize();
       ShowExplorer();
       }
        public void ShowExplorer()
        {

            Explorer = new ExplorerViewModel();
            ActivateItem(Explorer );

        }
}

A: Conductor.Collection.AllActive uses Items property. If you want to display multiple Screens at once, you have to add them to Items property.
Then, because your views are stored in Items property, you want to bind your view to Items. This is an example:
Conductor:
public class ShellViewModel : Conductor<IScreen>.Collection.AllActive
{
    public ShellViewModel()
    {
        Items.Add(new ChildViewModel());
        Items.Add(new ChildViewModel());
        Items.Add(new ChildViewModel());
    }
}

Conductor view (note, because we show collection of items we want to use ItemsSource not ContentControl):
<Grid>
    <StackPanel>
        <ItemsControl x:Name="Items"></ItemsControl>
    </StackPanel>
</Grid>

Child screen:
public class ChildViewModel : Screen
{
}

Child view:
<Grid>
    <Border Width="50" Height="50" BorderBrush="Red" BorderThickness="5"></Border>
</Grid>

EDIT: Regarding discussion in comments, here is how you can use IWindowManager to show multiple windows:
public class ShellViewModel : Screen
{

    public ShellViewModel(IWindowManager windowManager)
    {
        var window1 = new ChildViewModel();
        var window2 = new ChildViewModel();

        windowManager.ShowWindow(window1);
        windowManager.ShowWindow(window2);

        window1.TryClose();
    }
}


text:
Q: return #ERROR Formula Parse error when trying to access data from a 2nd Sheet on the same file I'm pretty new to using Excel/Google Sheets as I've never needed it in previous jobs. This query isn't for a work project but for a personal record to keep information I want to record clear and concise, Kind of like keeping books for a business I am trying to record various income's and outgoing's in the form of "points" (Maybe Google Sheets isn't the best "free" tool to use) that will show how many "points" someone has accrued, How they earned them, and What if any they have spent them on, It will also be recording some cash transaction as well.
I have 2 sheets currently and I am trying to add all the data for a single person from 1 Sheet into the "Points Total" column on the other sheet taking into account what they have earned and what they have spent.
I'm not sure how else to explain it really, Here is my current butchered (seriously) formulae:
=sum(C2:F2), - 'Point Purchases'!C2
Link to the Google Sheet in question

A: You are mot that far off. Just remove the comma.
=sum(C2:F2) - 'Point Purchases'!C2


text:
Q: Using Dynamic url with retrofit I am using sign in with Slack API.
To obtain an access token, there is a HTTP GET request:

*

*https://slack.com/api/oauth.access?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&code=XXYYZZ
This is authorize url, I use this for login and implemented via WebView:

*

*https://slack.com/oauth/authorize?scope=identity.basic,identity.email,identity.avatar&client_id=something";

I am using WebView for login integration.
My classes are:
public class LoginApiClient {
 private static LoginService loginService;

 public static LoginService getLoginService(){
    if (loginService != null){
        Retrofit retrofitClient = new Retrofit.Builder()
                .baseUrl("https://slack.com/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        loginService = retrofitClient.create(LoginService.class);
    }
    return loginService;
 }
}

public interface LoginService {
    @FormUrlEncoded
    @GET("api/oauth.access")
    Call<LoginResponse> makeUserLogin(@FieldMap Map<String, String > parameter);
}

public class LoginResponse {
    .....
    @SerializedName("access_token")
    @Expose
    private String accessToken;
    .....
    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

}

In my activity class, inside shouldOverrideUrlLoading method:
public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (url.startsWith("http://localhost:8000/")) {

            UrlQuerySanitizer urlQuerySanitizer = new UrlQuerySanitizer(url);
            codeParams = urlQuerySanitizer.getValue("code");
            Log.e(TAG, "shouldOverrideUrlLoading: " + codeParams);
            retrieveToken();
            return true;
        } else {
            view.loadUrl(url);
            return true;
        }
    }

private void retrieveToken() {
    LoginService loginService = LoginApiClient.getLoginService();
    Map<String, String> urlParameter = new HashMap<>();
    urlParameter.put("client_id", StringConstant.CLIENT_ID);
    urlParameter.put("client_secret", StringConstant.CLIENT_SECRET);
    urlParameter.put("code", codeParams);
    Call<LoginResponse> call = loginService.makeUserLogin(urlParameter);
    call.enqueue(new Callback<LoginResponse>() {
        @Override
        public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
            //navigate to next activity after saving token
        }

        @Override
        public void onFailure(Call<LoginResponse> call, Throwable t) {

        }
    });
}

Now, it is throwing the nullpointer error and I think the request url not working, so I get this.

java.lang.NullPointerException: Attempt to invoke interface method 'retrofit2.Call com.loginApi.LoginService.makeUserLogin(java.util.Map)' on a null object reference

How can I know that, the HTTP GET request url is hitting ? How can I do to build the url and after login it get hit and I get token ?

A: You can use https://slack.com/ for base url as common and in apiinterface create all method with dynamic url like..
@GET("api/oauth.access")
Call<JsonElement> oauth.access(@QueryMap HashMap<String, String> body);

@GET("oauth/authorize")
Call<JsonElement> oauth.access(@QueryMap HashMap<String, String> body);

A: Possibly due to the following statement where the loginService object is retrieved.
Remove this check
if (loginService != null)

and see if that resolves. Probably the application would have cleared the variable due to memory allocation/de-allocation


text: Q: Ultraweak topology on C$^{*}$-algebras Let $U$ be a C$^{*}$-algebra of operators acting on a Hilbert space $H$ and let $\overline{U}$ be the weak-operator closure of $U$. I am wondering if the ultraweak topology on the closed unit ball $(U)_{1}$ coincides with the weak-operator topology on $(U)_{1}$ like it does for von Neumann algebras. I think it is true and follows from the fact that the ultraweak topology on $U$ is the relative topology with respect to the ultraweak topology on $\overline{U}$ (this is because every ultraweakly coninuous functional on $U$ extends uniquely to an ultraweakly coninuous functional on $\overline{U}$). Is this reasoning correct?


text:
Q: User account deleted but home directory still exists I just deleted a user account on a Windows Server 2008 R2. Yet her user home directory still stands at c:\Users\her-account-id.
Moreover, using regedit I can still see HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList\blah.... and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist\blah entries matching her account.
When I deleted her account (using Control Panel) I checked the "Delete files" check box also.
What can I do to remove her user home dir ?
Thanks in advance,
phep

A: On Windows 2000+ it is not possible to completely get rid of user's account. However it should be enough to simply delete it, from both security and licensing reasons.
As for Windows Server 2008+, to delete user with its home directory:

*

*Open System in Control Panel.

*Click Advanced Settings, and on the Advanced tab, under User Profiles, click Settings.

*Under "Profiles stored on this computer", click the user profile you want to delete, and then click Delete.

Or you can write a script in PowerShell, VBScript, JavaScript, batch or anything else, that will first delete user, and then delete its home directory, even on remote computers in your domain.

A: Yes, it retains these directories simply because you can have "system held files" that are not necessarily user files anymore.
Have you tried Right click c:\Users\her-account-id. >> Delete, if there is a lock, it will highlight


text:
Q: It's possible with a non-blocking SocketChannel to read all present buffered data while preventing further receiving from clients? The use case is, in an only reading server, when a shutdown request is received to prevent clients to send more data but do the best effort to process possible data in buffers.
I've tried with shutdownInput() and socket.close(), which successfully prevent further reading but also buffered content.
shutdownInput() was my first bet, but documentation clearly says that further read() will return -1, althought I've seen some code in Apache NIFI that seems to read data after shutdown.


text:
Q: Cannot change div background color I am trying to change the background color for my div's with the class "box" with javascript on page load. I am changing the document with getElementsByClassName, but when I load the page nothing happens. I've checked for typos and researched the internet, but really cannot figure this one out...and it's so simple too.
Please help

window.onload = function changeDivColor () {
  document.getElementsByClassName("box").style.backgroundColor = "blue";
};
.box {
  background-color: red;
  display: flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 5px;
  border-radius: 5%;
}

<link rel="stylesheet"
  type="text/css"
  href="/Users/skyler/Documents/GitHub/Code/style.css"/>

  <input type="checkbox">

A: document.getElementsByClassName return an array, you need get index 0 for first item
document.getElementsByClassName("box")[0].style.backgroundColor = "blue";

window.onload = function changeDivColor () {
  document.getElementsByClassName("box")[0].style.backgroundColor = "blue";
};
.box {
  background-color: red;
  display: flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 5px;
  border-radius: 5%;
}

<link rel="stylesheet"
  type="text/css"
  href="/Users/skyler/Documents/GitHub/Code/style.css"/>

  <input type="checkbox">

A: Alternatively You can use querySelector to get the first element with that class
window.onload = function changeDivColor () {
    document.querySelector(".box").style.backgroundColor = "blue";
};

A: You have a syntax error. The method
getElementsByClassName returns an array, so you have to target the index of the element you want to manipulate. In this case this should work:
window.onload = function changeDivColor () {
 document.getElementsByClassName("box")[0].style.backgroundColor = "blue";
};

A: Use
window.onload = function changeDivColor () {
  document.getElementsByClassName("box")[0].style.backgroundColor = "blue";
};

.box {
  background-color: red;
  display: flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin: 5px;
  border-radius: 5%;
}

<link rel="stylesheet"
  type="text/css"
  href="/Users/skyler/Documents/GitHub/Code/style.css"/>

  <input type="checkbox">


text:
Q: Calculating the limit $\lim\limits_{x \to 0^+} \frac{\sqrt{\sin x}-\sin\sqrt{ x}}{x\sqrt{x}}$
Calculate $$\lim\limits_{x \to 0^+} \dfrac{\sqrt{\sin x}-\sin \sqrt{x}}{x\sqrt{x}}$$
  without use Taylor serie and L'Hôpital.

$$\lim\limits_{x \to 0^+} \dfrac{\sqrt{\sin x}-\sin \sqrt{x}}{x\sqrt{x}}\cdot\dfrac{\sqrt{\sin x}+\sin \sqrt{x}}{\sqrt{\sin x}+\sin \sqrt{x}}=\lim\limits_{x \to 0^+} \dfrac{\sin x-\sin^2\sqrt{x}}{x\sqrt{x}(\sqrt{\sin x}+\sin \sqrt{x})}$$
now what ?

A: $$\mathrm L =\lim\limits_{x \to 0^+} \dfrac{\sqrt{\sin x}-\sin \sqrt{x}}{x\sqrt{x}}= \lim\limits_{x \to 0^+} \dfrac{(\sqrt{\sin x}- \sqrt{x}) -(\sin \sqrt{x} - \sqrt{x})}{x\sqrt{x}} \\=  \overbrace{\lim\limits_{x \to 0^+}\dfrac{(\sqrt{\sin x}- \sqrt{x})}{x\sqrt{x}}}^{\large \rm L^\prime} - \overbrace{\lim\limits_{x \to 0^+}\dfrac{(\sin \sqrt{x} -  \sqrt{x})}{x\sqrt{x}}}^{\large \rm L^{\prime\prime}}$$
Let $y = \sqrt{x}$
Then $${\rm L^{\prime\prime}} = \lim\limits_{x \to 0^+}\dfrac{(\sin \sqrt{x} -  \sqrt{x})}{x\sqrt{x}} = \lim\limits_{x \to 0^+}\dfrac{(\sin y -  y)}{y^3} = -\dfrac 16$$
For the other limit,
$${\rm L^{\prime}}=\lim\limits_{x \to 0^+}\dfrac{(\sqrt{\sin x}- \sqrt{x})}{x\sqrt{x}} =\lim\limits_{x \to 0^+}\dfrac{(\sin x- x)}{x^3}\dfrac{x\sqrt{x}}{(\sqrt{\sin x} + \sqrt{x})}= \dfrac {-1}6\lim\limits_{x \to 0^+}\dfrac{x}{\left(\sqrt{\dfrac{\sin x}{x}} + 1\right)} = 0$$
Hence our limit is $\mathrm L = \dfrac {1}{6}$.

I used $$\lim_{x \to 0} \dfrac{\sin x - x}{x^3} = \dfrac{-1}6$$
Are all limits solvable without L'Hôpital Rule or Series Expansion ?

A: The hint.
Prove that for all $x>0$ we have:
$$-\frac{1}{6}<\frac{\sin{x}-x}{x^3}<-\frac{1}{6}+\frac{x^2}{120}$$ and from this we obtain:
$$\lim_{x\rightarrow0^+}\frac{\sin{x}-x}{x^3}=-\frac{1}{6}.$$
Let $f(x)=\sin{x}-x+\frac{1}{6}x^3$, where $x>0$.
Thus, $f'''(x)=-\cos{x}+1\geq0$, which gives
$f''(x)>f''(0)=0$, $f'(x)>f'(0)=0$ and $f(x)>f(0)=0$,
which gives a proof of the left inequality.
By the same way we can prove the right inequality.

A: note that
$$
\begin{split}
\lim_{x\to0^{+}}
\frac{\sin x-\sin^2\sqrt{x}}{x^2}&\overset{t=\sqrt{x}}{=}
\lim_{t\to0^{+}}
\frac{\sin(t^2)-\sin^2t}{t^4}\\
&=\lim_{t\to0^{+}}
\frac{(t^2-\frac{t^6}{6}+\frac{t^{10}}{120}-\ldots)-(t^2-\frac{t^4}{3}+\frac{2t^{6}}{45}+\frac{t^8}{315}-\ldots}{t^4}\\
&=\lim_{t\to0^{+}}
\frac{\frac{t^4}{3}-\frac{19t^6}{90}+\frac{t^8}{315}+\ldots)}{t^4}\\
&=\frac{1}{3}
\end{split}
$$
Hence
$$
\lim_{x\to0^{+}}
\frac{\sin x-\sin^2\sqrt{x}}{x\sqrt{x}(\sqrt{\sin x}+\sin\sqrt{x})}=
\lim_{x\to0^{+}}
\frac{\frac{\sin x-\sin^2\sqrt{x}}{x^2}}{\sqrt{\frac{\sin x}{x}}+\frac{\sin\sqrt{x}}{\sqrt{x}}}
=\frac{\frac{1}{3}}{\sqrt{1}+1}=\frac{1}{6}
$$


text:
Q: Empty paragraphs around figure and figcaption tags when using markdown I'm using WP 3.8 and Markdown on Save Improved plugin and have following code for outputing HTML5 tags when inserting images via Media Uploader:
function html5_insert_image($html, $id, $caption, $title, $align, $url, $size, $alt) {
  $src  = wp_get_attachment_image_src( $id, $size, false );
  $html5 = "
";
  $html5 .= "";
  if ($caption) {
    $html5 .= "
$caption
";
  }
  $html5 .= "
";
  return $html5;
}
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );

And in editor output is fine, but on publish my code looks like this:

caption_txt

If I put div wrapper around figure then there are no empty paragraphs but I'm wondering why figure and figcaption aren't recognized as block elements? Also, this doesn't happen with wp-markdown plugin so it seems it's not markdown problem since both plugins use same parser.
When combining HTML and markdown in other ways, output is fine so I think that's not the issue.


text:
Q: Error:XMLHttpRequest cannot load http://dev...... Response for preflight has invalid HTTP status code 405 I am trying to load html page in (dev.project.....com/app/views/index.html/#eprj/1) from another project(http://dev.media.....com/app/views/services/...) of my solution structure using $http method.But i am getting error:XMLHttpRequest cannot load http://dev.media....com/app/views/services/tabs.html. Response for preflight has invalid HTTP status code 405.
var mediaUrl = "http://dev.media....com/app/views/services"
var url = mediaUrl + '/tabs.html'
$http({
    method: 'GET',
    url: url,
    headers: {
        "Access-Control-Allow-Origin": "*"
    }
}).then(function (html) {
    // Convert the html to an actual DOM node
    var template = angular.element(html.data);
    // Append it to the directive element
    element.append(template);
    return $compile(element.contents())(scope);
});

The above code is written in AngularJs CustomDirective.
And Also in web.config of (http://dev.media....com) added inside system.webserver    tag as
<httpProtocol>
    <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
        <add name="Access-Control-Allow-Headers" value="X-Requested-With, origin, content-type, accept" />
    </customHeaders>
</httpProtocol>


text:
Q: Converse of mean value theorem I am wondering if the following converse (or modification) of the mean value theorem holds. Suppose $f(\cdot)$ is continuously differentiable on $[a,b]$. Then for all $c \in (a,b)$ there exists $x$ and $y$ such that
$$
f'(c)=\frac{f(y)-f(x)}{y-x}
$$

A: Assume that $f''(c)\ne0$. Then one can find $x_1<c<x_2$ such that
$$f'(c)={f(x_2)-f(x_1)\over x_2-x_1}\ .$$
Proof. Assume $f''(c)>0$ and consider the auxiliary function
$$g(t):=f(c+t)-f(c)-t f'(c)\ ,\tag{1}$$
which is defined in a full neighborhood of $t=0$. By Taylor's theorem one has
$$g(t)=g(0)+t g'(0)+{t^2\over2}g''(0)+o(t^2)={t^2\over2}\bigl(f''(c)+o(1)\bigr)\qquad(t\to0)\ .$$
It follows that there is an $h>0$ with $g(t)>0$ for $0<|t|\leq h$. Assuming $g(h)\geq g(-h)$ put $t_1:=-h$, and choose $t_2\in\ ]0,h]$ such that $g(t_2)=g(t_1)$, which is possible by the intermediate value theorem.
Finally put $x_i:=c+t_i$ $(i=1,\>2)$. Then it follows from $(1)$ that
$$f(x_2)-f(x_1)=g(t_2)-g(t_1)+(t_2-t_1)f'(c)=(x_2-x_1) f'(c)\ ,$$
which is equivalent to the claim.

A: It is not true. Let $f(t)=t^3$. Then $f'(0)=0$, but $\frac{f(y)-f(x)}{y-x}$ is never $0$.


text:
Q: Rename autosummary toctree entries I have decided to use autosummary to create documentation of my module. In index.rst I have "imported" all relevant modules and submodules that I want documentation on. The modules are documented as expected, but one thing bothers me. The module paths are rather long, and they look repulsive in the toctree next to the documentation.
index.rst
Documentation
*************

Documentation of things.

.. toctree::

.. autosummary::
   :toctree: _autosummary

   module
   module.submodule
   module.submodule.sub

   module.long_submodule.sub_1
   module.long_submodule.sub_2
   module.long_submodule.sub_3
   module.long_submodule.sub_4

conf.py
project = 'Name'
author = 'Me'
version = '0.7'

extensions = ['sphinx.ext.autodoc', 'sphinxcontrib.fulltoc', 'sphinx.ext.autosummary']
templates_path = ['_templates']
autosummary_generate = True
master_doc = 'index'

Is there a way to rename the entries in the navigation bar, preferably in index.rst? I would also be willing to consider changing the approach from autosummary to some other system if that accomplishes the task.

I have also used a custom template for the modules named _templates/autosummary/module.rst. Its contents are as follows:
{{ fullname }}
{{ underline }}

.. automodule:: {{ fullname }}
   :members:
   :undoc-members:
   :show-inheritance:

A: One can extend sys.path to import submodules without refering to the parent. In conf.py:
import sys
sys.path.insert(0, 'D:/abs/path/to/module')

Then change module.long_sub.etc to long_sub.etc in index.rst. One can insert directories inside the root folder (e.g. D:/abs/path/to/module/long_sub) to have even shorter imports.


text:
Q: How do I add methods to Date, String, Array, Number Etc in TypeScript How do I tell TypeScript of additions to native types like Date,Number,String etc?
E.g. I want the following to compile (example from http://sugarjs.com/dates):
var date: Date = Date.create('tomorrow'); // I get a compile error
date.isAfter('March 1st') // I get a compile error

A: There are two kinds of extensions needed here.
1.) Static members addition to native types
e.g. create in the given example.
This can be done by adding to <type>Constructor interfaces. e.g.
interface DateConstructor {
    create(query: string): Date;
}

2.) Instance member additions to native types
e.g. isAfter in the given example.
This can be done by adding to <type> interface e.g.
interface Date {
    isAfter(query: string): boolean;
}

Complete example
interface DateConstructor {
    create(query: string): Date;
}
interface Date {
    isAfter(query: string): boolean;
}

var date: Date = Date.create('tomorrow'); // okay
date.isAfter('March 1st') // okay

This has been possible since TypeScript 1.4.


text:
Q: Downloading a pdf from a webpage with password protection So I've been trying to download a pdf from a url that is password protected. I can visit the webpage using Jsoup because this doesn't support PDF files (the URL is a link to a PDF file). How do I make sure I don't have to re-enter the username and password? I can't use URLConnection because that doesn't allow me to log into the website. Thanks for the help.
    System.out.println("opening connection");
    URL url = new URL("https://www.HIDDEN.com/ciqdotnet/login.aspx?redirect=%2fCIQDotNet%2fFilings%2fDocumentRedirector.axd%3fversionId%3d" + ID + "%26type%3dpdf%26forcedownload%3dfalse");
    InputStream in = url.openStream();
    FileOutputStream fos = new FileOutputStream("/Users/HIDDEN/Desktop/fullreport.pdf");

    System.out.println("reading file...");
    int length = -1;
    byte[] buffer = new byte[1024];// buffer for portion of data from
    // connection
    while ((length = in.read(buffer)) > -1) {
        fos.write(buffer, 0, length);
    }
    fos.close();
    in.close();
    System.out.println("file was downloaded");
    }

A: You need to add the credentials to the HTTP header of the URL connection.
If you're already logged in, you need to extract the cookie from the cookie store and send the cookie hash along with the request.
If all this sounds too complicated, use Apache HttpComponents. The framework has all kinds of support code to set up your request, add user/password credentials and/or handle cookies.
[EDIT] You can find sample code for Apache HttpClient (which uses HttpComponents) here: https://hc.apache.org/httpcomponents-client-ga/examples.html
HttpClient can do the "download" part of a web browser. In a nutshell, url.openStream() will send a GET request to the server.
You can find an example how to authenticate against a server here: https://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientAuthentication.java
If you're already logged in, you will have a cookie. Use this code to pass the cookie to HttpClient: Apache HttpClient 4.0.3 - how do I set cookie with sessionID for POST request


text:
Q: Single Sign on Asp.net mvc and wcf cross domain separate environments I am currently working on a requirement for the client. Let me brief the scenario
Web Application: Asp.net mvc 5.0 -- deployed on Prod in a web farm environment (BL, Infrastructure and EF DataAccess Layer deployed on these boxes).
Wcf Services - Wcf 4.0 -- deployed on a separate machine
There is a common BL.Services and BL.DataAccess(Entity framework & Sql Server) that is shared between the Wcf and MVC application.
The Wcf hooks into the BL.Services using a Service Facade that acts an interface between the wcf and BL.Services.
Since the authentication flow has to be handshaked across two different boxes or rather two different domains the best solution I could come up with was to build a custom authentication mechanism using single sign on.
For the Single Sign On I am going to create a gateway interface using web services and custom simple membership provider which would encrypt and decrypt the auth cookie. In the mvc app I am using forms authentication again just to pass the cookie across the application urls and I am also passing the same auth cookie to the wcf service using Soap headers when calling the wcf service methods in the business logic.
Questions:-
1.  How can I map the return call between the mvc app and wcf incase say suppose the user is authenticated user on the web box but is not a valid user on the wcf box. Where do I implement the redirect mechanism and do I redirect him back to page from where the call was made (displaying a friendly message)or back to the login page.

*Is there a way to authenticate the user when the authentication token passes from mvc to wcf through the soap header but before it can execute any business logic method calls on the wcf box(something like a module or a handler).

*Please guide as to whether I am taking the right track for the above scenario or are there any other ways and means to achieve this.


text:
Q: Stream content as Azure function output I am working with some files and converting from one format to another. My function is a step in a logic app and the output of my function results in a file being created, using the pre-defined step "Create file (FTP)" where the file content is the body of my function.
I am trying to change the way my function works at the moment to have a memory friendly version. I was trying to achieve some form of 'streaming' so that I essentially only have one object in memory at a given time when deserializing.
I have tried something along the lines of the below and while it doesn't throw any errors I am not getting the expected output.
[FunctionName("Transform")]
public static async Task<HttpResponseMessage> Import([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]HttpRequestMessage req, TraceWriter log)
{

    var doc = XDocument.Load(await req.Content.ReadAsStreamAsync());
    var memoryStream = new MemoryStream();

    if (doc.Root != null)
    {
        var ns = doc.Root.GetDefaultNamespace();
        var query = from c in doc.Descendants(ns + "person")
                    select c;

        var serializer = new XmlSerializer(typeof(Person));
        var persons = new List<Person>();

        foreach (var Person in query)
        {
            var personRecord = (Person)serializer.Deserialize(person.CreateReader());
            persons.Add(personRecord);
        }

        using (var streamWriter = new StreamWriter(memoryStream))
        using (var csvWriter = new CsvWriter(streamWriter))
        {
            csvWriter.WriteRecords(persons);
            streamWriter.Flush();
            memoryStream.Flush();
        }
    }

    return new HttpResponseMessage()
    {
        StatusCode = HttpStatusCode.OK,
        Content = new StreamContent(memoryStream)
    };
}

When I debug my function locally and make a request to it via Postman I simply get a "could not load response". I was, if all worked well, expecting something like a csv output e.g.
John, Doe, 123
Mary, Jane, 456

I am wondering if the idea is good at all? At least that's what I am thinking at the moment, I just can't figure out how to do it.
Cheers

A: The way you're using StreamWriter is causing the MemoryStream to be disposed of. By default the StreamWriter assumes ownership of the Stream it is handed and will dispose of it when it is disposed (or GC'd).
You'll need to use the constructor overload that takes (Stream, Encoding, int, bool) where the bool is named leaveOpen and you need to set that to true. I had to double check, but there is no simpler overload of just (Stream, bool). You'd probably want to do something like:
new StreamWriter(memoryStream, Encoding.UTF8Encoding, bufferSize:8192, leaveOpen:true)

However you should really decide what encoding works best for you and what bufferSize might make the most sense for your workload.


text:
Q: Hi I need to get text in center of dough nut like the image I need to get the label in the center of the doughnut as shown in second image. I tried some methods but it doesn't seem to work. I have also attached my current code. Thanks you for helping me.
export class DoughnutChartDemo extends Component {

    constructor(props) {
        super(props);

        this.chartData = {
            labels: ['A', 'B', 'C'],
            datasets: [
                {
                    data: [300, 50, 100],
                    backgroundColor: [
                        "#FF6384",
                        "#36A2EB",
                        "#FFCE56"
                    ],
                    hoverBackgroundColor: [
                        "#FF6384",
                        "#36A2EB",
                        "#FFCE56"
                    ]
                }]
        };

        this.lightOptions = {
            plugins: {
                legend: {
                    labels: {
                        color: '#495057'
                    }
                }
            }
        };
    }

    render() {
        return (

                <Chart type="doughnut" data={this.chartData} options={this.lightOptions} style={{ position: 'relative', width: '40%' }} />

        )
    }
}

   TO

A: I have create. please try this one. i hope this can help you guys.

import React, { useState } from "react";
import ReactDOM from "react-dom";
import { Doughnut } from "react-chartjs-2";
import "./styles.css";

function App() {
  const options = {
    cutoutPercentage: 60,
    tooltips: {
      callbacks: {
        label: (tooltipItem, data) => {
          // Get the dataset label, global label or fall back to empty label
          let label =
            (data.datasets[tooltipItem.datasetIndex].labels &&
              data.datasets[tooltipItem.datasetIndex].labels[
                tooltipItem.index
              ]) ||
            data.labels[tooltipItem.index] ||
            "";
          setChartText({
            label: label,
            value:
              data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]
          });
          return false;
        }
      }
    }
  };

  const data = {
    datasets: [
      {
        data: [6.5, 55, 180],
        backgroundColor: ["#5b7232", "#97012e", "#faab18"],
        labels: ["SCORE", "SCORE B", "SCORE C"],
        pointStyle: "circle"
      }
    ]
  };

  const [chartText, setChartText] = useState({
    label: data.datasets[0].labels[0],
    value: data.datasets[0].data[0]
  });
  return (

        <Doughnut data={data} options={options} height={400} width={400} />

{chartText.value}

{chartText.label}

  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

this preview : https://zw3zw7.csb.app/
and this my codesandbox : https://codesandbox.io/s/react-chart-js-doughnut-center-label-zw3zw7?file=/src/index.js:0-1646


text:
Q: Stream Live mp3 from Icecast to iPhone app I am trying to develop an app for the iPhone. This is my first iPhone app so please bear with me. I am currently streaming mp3 audio from Icecast to android quite easily. However I can not figure out how to do the same with the iPhone. I have read many articles on HLS, but can I do that from Icecast? Or is there another option?

A: AVPlayer *player = [[AVPlayer alloc]initWithURL:[NSURL URLWithString:urlString]];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(playerItemDidReachEnd:)
                                         name:AVPlayerItemDidPlayToEndTimeNotification
                                         object:[songPlayer currentItem]];

[player addObserver:self forKeyPath:@"status" options:0 context:nil];
[player play];

}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {

    if (object == player && [keyPath isEqualToString:@"status"]) {
    if (songPlayer.status == AVPlayerStatusFailed) {
        NSLog(@"AVPlayer Failed");

    } else if (songPlayer.status == AVPlayerStatusReadyToPlay) {
        NSLog(@"AVPlayerStatusReadyToPlay");

    } else if (songPlayer.status == AVPlayerItemStatusUnknown) {
        NSLog(@"AVPlayer Unknown");

    }
}

}


text:
Q: Trying to build an automation script on AWS Data Pipeline I am trying to use the AWS Data Pipeline service in the following manner:

*

*Select the activity type as Shell Command activity with the script uri set (to an s3 bucket) and Stage input set to true.

*Set the resource type of the activity as EC2.

*Use S3 as a data node.

*For the ec2 resource, I have selected the instance type as t2.medium and instance ID as a custom AMI created by me.

*Schedule the pipeline to run everyday at 10pm.

The script specified in step 1 (i.e. as part of script uri in the activity) has 2 lines:
1.  To copy the S3 bucket data to the instance.
2.  Run the python command to execute my program.
The AMI I have created is based on Ubuntu instance of ec2 and it consists of some python software and also the code I would like to run.
Now, on initiation of the pipeline I notice that ec2 instance is indeed created and the S3 data is copied and made available to the instance but the python command is not run. The instance is in running state and the pipeline is in waiting for runner state for some time and then data pipeline fails with the message: "Resource stalled".
Can someone please let me know if i am doing something wrong or why doesn't my python code is not being executed or why am I getting the Resource stalled error? The code works fine if I run it manually without the pipeline.
Thanks in advance!!

A: "Resource stalled" almost always means there is a problem with the setup of your custom AMI. The requirements are documented here. The short bullets:

A custom AMI must meet the following requirements for AWS Data Pipeline to use it successfully for Task Runner:

*

*Create the AMI in the same region that the instances will run in.

*Ensure that the virtualization type of the AMI is supported by the instance type you plan to use. For example, the I2 and G2 instance types require an HVM AMI and the T1, C1, M1, and M2 instance types require a PV AMI.

*Install the following software:

*

*Linux

*Bash

*wget

*unzip

*Java 1.6 or newer

*cloud-init

*Create and configure a user account named ec2-user.


text:
Q: how to display weekly attendance in rails for the selected month? iam having two dropdowns month dropdown and year dropdown. and submit button.i want to display the attendance for the selected month and selected year in dropdown. firstly when a month is selected i want to show  only the attendance for the first weak of the selected month in month dropdown.and i want to have to buttons left arrow and right arrow to see the attendance for the next weak and for the previous .  i want to have a tabular form which shows weak dates as columns in view.and i want to display attendance for that day in the corresponding columns.how can i implement this in rails? is there any plugin?
<- Previous Week  Next Week ->
Child   | Monday 5/6 | Tuesday 5/7 | Wednesday 5/8 | Thursday 5/9 so on...
child1  | __________ | ___________ | _____________ | ____________ |
child2  | __________ | ___________ | _____________ | ____________ |
Submit

A: What you might be looking for is fullcalendar, more specifically its "basic week" view (view all views here). Fullcalendar has a rails-specific gem which you can find here.


text:
Q: Groovy DSL: How I can overload any() in Groovy, when I create internal DSL I create Internal DSL and I would overload any() method from DefaultGroovyMethods.
class RulesProcessor {

}

Any live cell with fewer than two live neighbours dies

The last line is my DSL. I tried propertyMissing, methodMissing, create my Any class, RulesProcessor.metaClass.any, DefaultGroovyMethods.metaClass.any, but they doesn't work.
How I can write code to accept my DSL? Only first step with 'Any' word is complicated for me.

A: If you can put it in a closure, just delegate it to an object which responds to any method or, as in my example, invokeMethod:
class Dsl {
  def params = []
  def invokeMethod(String method, args) {
    params << [method, args]
    this
  }

  def propertyMissing(String prop) { prop }
}

a = {
  any live cell with fewer than two live neighbours dies
}

dsl = new Dsl()
a.delegate = dsl
a()

assert dsl.params == [
  ['any',   ['live']],
  ['cell',  ['with']],
  ['fewer', ['than']],
  ['two',   ['live']],
  ['neighbours', ['dies']],
]

If you are reading the script from a file, having a method explicitly called any seems necessary:
import org.codehaus.groovy.control.CompilerConfiguration

class Dsl {
  def params = []
  def invokeMethod(String method, args) {
    params << [method, args]
    this
  }

  def any(param) { invokeMethod('any', [param]) }

  def propertyMissing(String prop) { prop }
}

code = 'any live cell with fewer than two live neighbours dies'

parsed = new GroovyShell(
    getClass().classLoader,
    new Binding(),
    new CompilerConfiguration(scriptBaseClass : DelegatingScript.class.name)
).parse( code )

dsl = new Dsl()

parsed.setDelegate( dsl )
parsed.run()

assert dsl.params == [
  ['any',   ['live']],
  ['cell',  ['with']],
  ['fewer', ['than']],
  ['two',   ['live']],
  ['neighbours', ['dies']],
]

Kudos to mrhaki on CompilerConfiguration.


text:
Q: C++ problem trying to open a .txt file using Ifstream This small bit of code is designed to look through a text file and identify account numbers that have already been written so that later on in my program, you can find the correct account without the error of two accounts with the same account number(id). But no matter what i do, whether its using double backslashes, forward slashes, or double forward slashes in the location for the ifstream object; i always get "cannot find file" as the output.
#include <iostream>
#include <fstream>
using namespace std;

int main() {
    ifstream accountsread("G:/Coding/Test/test/test/accounts.txt");
    if (accountsread.is_open()) {
        int tempAccno;
        std::string tempname;
        char tempchar;
        int accountsfound = 0;
        int input;

std::cout << "Enter the ID of the account \n";
        cin >> x;

        while (!accountsread.eof()) {
            accountsread >> tempAccno;
            if (tempAccno == input) {
                accountsfound++;
            }
            else {}

        }
        if (accountsfound > 0) {
            cout << "number found";
        }
        else {
            cout << "number not found";
        }
    }
    else {
        cout << "cannot find file";
    }
}

in windows, the location of the text file is G:\Coding\Test\test\test\accounts.txt

A: std::ifstream can use relative paths as well as absolute ones. For your problem, I'd recommend looking into the <filesystem> header from the STL if you really need an absolute path to your file. However, if it's in the same directory as your working directory, you don't need to use absolute paths. Here's how I'd accomplish your task
#include <iostream>
#include <fstream>
#include <string>  // Should include since you're using std::string

// Note that I am NOT "using namespace std;"

int main()
{
    std::ifstream accountsRead("accounts.txt");
    if (accountsRead.is_open())
    {
        int account_id;
        bool account_found = false;

        std::cout << "Enter the ID of the account: ";
        while (!(std::cin >> account_id))
        { // This loop handles if the user inputs non-number
            std::cout << "Please enter a NUMBER below!\n";
            std::cout << "Enter: ";
            std::cin.ignore(10000, '\n');
            std::cin.clear();
        }

        int tmpAccNum;
        while (accountsRead >> tmpAccNum)
        { // This loop reads the file, line by line, into tmpAccNum
            if (tmpAccNum == account_id)
            {
                account_found = true;
                break;
            }
        }

        if (account_found)
        {
            std::cout << "Number found!" << std::endl;
        }
        else
        {
            std::cout << "Number not found..." << std::endl;
        }
    }
    else
    { // Error opening file
        std::cout << "File not found or is corrupted" << std::endl;
    }
}

A few things about your code stylistically speaking. First, you should never be using namespace std, and (if you are for some reason) there isn't a reason to mix and match specifying the std namespace on only some std members. Second, you don't need to specify an else for every if-statement, and you probably shouldn't unless there actually are commands to execute if the else case is reached.
Edit
If you still need an absolute path, here is how you can do that:
#include <filesystem>

int main()
{
    // Create path object for the file path
    std::filesystem::path file_path("G:\Coding\Test\test\test\accounts.txt");

    // The '.string()' method for a 'std::path' object returns the string
    // version of the path, so you can use it with an 'std::ifstream'
    std::ifstream accounts(file_path.string());  // Opens file via 'ifstream'
    /* And so on... */
}


text:
Q: grouping or bundling of notifications in iOS inbox style notification In My App I am using firebase push notification. Problem is when user connected to internet after long time they will receive lot of notifications as individual notification. Is it Possible to Receive Notification like whatsapp(You have 10 New Notification). Inbox style Notification like android

A: Multiple notifications with the same collapse identifier are displayed to the user as a single notification. This can be handled from server side not at client side. APNS header apns-collapse-id will be used to update previously sent notification.
Refer to this for further description:
Table 8-2APNs request headers
Apple Developer Guide


text:
Q: Instruction disassembly for ARM I just setup a raspberry pi machine and tried reverse engineering the following piece of code.
#include<stdio.h>
int main() {
printf("this is a test\n");
}

For the most part the following disassembly in gdb seemed to make sense.
   0x000083c8 <+0>: push    {r11, lr}
   0x000083cc <+4>: add r11, sp, #4
   0x000083d0 <+8>: ldr r0, [pc, #8]    ; 0x83e0 <main+24>
   0x000083d4 <+12>:    bl  0x82ec <puts>
   0x000083d8 <+16>:    mov r0, r3
   0x000083dc <+20>:    pop {r11, pc}
   0x000083e0 <+24>:    andeq   r8, r0, r4, asr r4

*

*However, I fail to understand why the instruction at 0x000083e0 exists. Is that instruction even a part of the main function? Wouldn't the value that was pushed in at 0x000083c8 be popped out into pc, immediately transferring control over to some other location?

*Also I tried setting a breakpoint at 0x000083e0 -- I seem to be getting a very strange SEGFAULT. Why would that be?

A: When this function is called (i.e. when execution begins at instruction 0x000083c8), the link register (LR) should already contain the return address.  Fast-forward to 0x000083d8: the puts function's return result is placed in R0 in accordance with the ARM C calling convention (link, link).  Then, the return address is popped from the stack into the PC - effectively ending execution of this function.  This implies that the instruction at 0x000083e0 is not a part of your program, and your inspection should be limited to instructions 0x000083c8 through 0x000083dc.
So to answer your questions:

*

*Correct.

*The "instruction" at 0x000083e0 is essentially junk. You may not even have execution and/or access privileges to this memory depending on the specifics of your ARM core (Does it have an MMU, etc?).  Thus, a seg fault is a reasonable outcome when attempting to inspect that location.
EDIT: in agreement with comments below, the contents of 0x000083e0 should be interpreted as data, not instructions.

A: Four bytes at 0x000083e0 isn't junk. It is part of the PC relative load at
0x000083d0 <+8>: ldr r0, [pc, #8]    ; 0x83e0 <main+24>

It is also visible in the comment as ; 0x83e0 <main+24>.
Problem here since you need to pass address of a string to puts, whose address might change during linking step, compiler needs to create suitable code for such further processing. Thus address of string ends up in instruction stream yet outside of any execution context.


text:
Q: What design pattern(s) would provide a better solution to this problem? I have a document object and a list of operations that can be applied to that document in sequence. The types of operations are known in advance, but not their parameters, the order of operations or their number. For instance there may be a DB from which we pull a specific list of operations and corresponding parameters for a given document.
The solution I've written in Java looks something like the following:
public interface Operation {

}

public class OperationA implements Operation {
    private String paramA;
    private String paramB;
}

public class OperationB implements Operation {
    private String paramA;
    private String paramB;
    private String paramC;
}

public OperationApplier {
    public Document apply(List<Operation> operations, Document inputDocument) {
        Document transformedDocument = inputDocument;
        for (Operation operation : operations) {
            if (operation instanceof OperationA) {
                OperationA operationA = (OperationA) operation;
                transformedDocument = apply(operationA, document);
            } else if (operation instanceof OperationB) {
                OperationB operationB = (OperationB) operation;
                transformedDocument = apply(operationB, document);
            }
        }
        return transformedDocument;
    }
}

private Document apply(OperationA operation, Document document) {
    ...
}

private Document apply(OperationB operation, Document document) {
    ...
}

Now to apply a list of operations on a document we can do:
OperationApplier operationApplier = new OperationApplier();
List<Operation> operations = Arrays.asList(
    new OperationA("foo", "bar"),
    new OperationB("foo", "bar", "baz"),
    new OperationA("hoge", "piyo")
);
Document inputDocument = ...;
Document outputDocument = operationApplier(operations, inputDocument);

Basically I see two smells in the solution I implemented above:

*

*The empty interface Operation is just there to allow the construction of an operation list, but it otherwise contains no shared contract between operation implementations.

*The use of instanceof and downcasting, which are also considered bad practices in Java.

Are there any design patterns I should consider to improve upon the implementation above?
Besides the two smells I mentioned, do you see any substantial issues with the solution I've adopted?

A: You could eliminate both the placeholder interface and the downcasting by adding a single apply method to the interface, and requiring each class to implement it.
public interface Operation {
    public Document apply(Document input);
}

That makes your loop a lot simpler too:
public OperationApplier {
    public Document apply(List<Operation> operations, Document inputDocument) {
        Document doc = inputDocument;
        for (Operation operation : operations)
            doc = operation.apply(doc);
        }
        return doc;
    }
}

The above requires you to move the apply logic out of the OperationApplying and into the OperationX class. If you don't think that is a good idea, you can make apply a simple passthrough.
public class OperationA implements Operation {
    private String paramA;
    private String paramB;

    public Document apply(Document input, OperationApplier applier) {
        return applier.apply(input);

}

And call with this:
for (Operation operation : operations)
    doc = operation.apply(doc, this);
}

A: You are describing a technique known as 'orchestration' which is really an Enterprise Design Pattern.
John Wu's approach is sound, the operation is the verb, and logically belongs in an interface. John's example is the classic 'builder' pattern where the Document is passed around.
If you want to take a different approach -- you could follow the approach used by a rules-processing engine. Rules-based processing is good for workflow's, which is what it sounds like you are hoping to accomplish.
https://kissflow.com/workflow/workflow-engine-business-rule-engine-difference/


text:
Q: Prove that $1+x+y$ not equal to $xy$, when $x$ and $y$ are positive odd numbers I was engaging in this equation and with the help of desmos.com I noticed it is not possible. So how can we prove? In which way it is easier, should I leave $x$ or $y$ alone, or is there any method different?

A: First of all we can define odd numbers:
$x=2m-1 \ \  \forall \ m \in \mathbb N \ \backslash \{0\}$ and $y=2n-1 \ \  \forall \ n \in \mathbb N \ \backslash \{0\}$
Then we have $1+x+y=x\cdot y\Rightarrow -1+2m+2n=(2m-1)(2n-1)$
$2m+2n-1=4mn-2m-2n+1$
$4m+4n=4mn+2$
$2(m+n)=2mn+1$
The LHS is always even and the RHS is always odd for all $n,m \in \mathbb N \ \backslash \{0\}$

A: Let's say $x \geq 3$ and $y \geq 3$ also. Then $x = 2m + 1$ with $m > 0$ and $y = 2n + 1$ likewise with $n > 0$. Then $1 + x + y = 1 + (2m + 1) + (2n + 1) = 2m + 2n + 3$. But $xy = (2m + 1)(2n$ $+ 1) = 4mn + 2m + 2n + 1$.
This means that $xy > 1 + x + y$, since $xy - (1 + x + y) = 4mn - 2$. Since $m$ and $n$ are both positive, $4mn$ has to be at least 4, which means a minimum difference of 2 between $xy$ and $1 + x + y$.
The case with either $x$ or $y$ equal to 1 should not present any special difficulty.

A: Just for fun, here is a somewhat convoluted proof, starting with a mod $6$ argument.
It is straightforward to see that the only way that $1+x+y\equiv xy$ mod $6$ with $x,y\in\{1,3,5\}$ (i.e., with $x$ and $y$ both odd) is if $\{x,y\}=\{3,5\}$.  Without loss of generality, let's suppose that $x=3u$ and $y=6v-1$, with $u$ odd. The equation now becomes
$$1+3u+(6v-1)=3u(6v-1)$$
which simplifies first to $u+2v=6uv-u$ and then to
$$u+v=3uv$$
But since $u\equiv1$ mod $2$ (i.e., since $u$ is odd), this implies $1+v\equiv v$ mod $2$, which is impossible. So there are no solutions to $1+x+y=xy$ with $x$ and $y$ both odd.
Remark: The argument here is related to the much simpler mod $4$ argument alluded to in dxiv's comment below the OP that the equation $1+x+y=xy$ can be rewritten as $(x-1)(y-1)=2$.

A: hint
$$1+x+y=xy \implies y=\frac{x+1}{x-1}$$
$$=1+\frac{2}{x-1}$$
thus
$$(x,y)=(2,3) \text{ or } (3,2)$$