Integral with polylogarithm

Question: I have to calculate integral:
$$\int \frac{1}{x}\ln \left( \frac{x-a}{b}\right) \,dx.$$
I tried by substitution, but I did not receive such a result as wolfram.
Answer: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Lets $\ds{t \equiv {x - a \over b} \implies x = bt + a}$:

\begin{align}
\int{1 \over x}\ln\pars{x - a \over b}\,\dd x & =
\int{1 \over bt + a}\ln\pars{t}\,b\,\dd t =
-\int{\ln\pars{\bracks{-a/b}\bracks{-bt/a}} \over 1 - \pars{-bt/a}}
\,\pars{-\,{b \over a}}\dd t
\end{align}

Lets $\ds{y \equiv -\,{b \over a}\,t \implies t = -\,{a \over b}\,y}$:

\begin{align}
\int{1 \over x}\ln\pars{x - a \over b}\,\dd x & =
-\int{\ln\pars{-ay/b} \over 1 - y}\,\dd y
\,\,\,\stackrel{\mrm{IBP}}{=}\,\,\,
\ln\pars{1 - y}\ln\pars{-\,{a \over b}\,y} -
\int{\ln\pars{1 - y} \over y}\,\dd y
\\[5mm] & =
\ln\pars{1 - y}\ln\pars{-\,{a \over b}\,y} +
\mrm{Li}_{2}\pars{y} =
\ln\pars{1 + {b \over a}\,t}\ln\pars{t} +
\mrm{Li}_{2}\pars{-\,{b \over a}\,t}
\\[5mm] & =
\ln\pars{1 + {b \over a}\,{x - a \over b}}\ln\pars{x - a \over b} +
\mrm{Li}_{2}\pars{-\,{b \over a}\,{x - a \over b}}
\\[5mm] & =
\bbx{\ln\pars{x \over a}\ln\pars{x - a \over b} +
\mrm{Li}_{2}\pars{1 - {x \over a}} + \pars{~\mbox{a constant}~}}
\end{align}
Answer: According to Wolfram Alpha, the integral is:
$$\int \frac{\ln( \frac{x-a}{b}) }{x}dx = \ln\left(\frac{x}{a}\right)\ln\left(\frac{x-a}{b}\right)+Li_2\left(1-\frac{x}{a}\right)+c$$
where $Li_2(x)$ is the offset logarithmic integral:
$$Li_2(x) = \int_2^x \frac{1}{\ln(t)}dt$$
You can find more information about the logarithmic integral if you click on the above link, there are some ways to calculate it for certain values, but unfortunately it cannot be expressed with known functions in most cases (without using $\sum$'s).

Integral with polylogarithm


Implicit differentiation of an exponential with a function within a function

Question: $\frac{\mathrm d}{\mathrm dx}(y+1)^{x+1}$
I was wondering how to solve the question above, or approach this question.
I tried it this way, it was  wrong.
The first way I made $y=(y+1)^{x+1}$  (1) and then took the natural log on both sides differentiated, and then subbed (1) in, but it was not correct. So I was wondering why a) am I wrong b) how to solve this
Thank you!
Comment: You have to have an equation for implicit differentiation.
Comment: How do i do that @ParasKhosla
Comment: What was the question that you were trying to solve?
Comment: @ParasKhosla it says it at the top, I will make it more clear one second
Answer: $$\begin{aligned}y&=(y+1)^{x+1}\\ \ln y&=(x+1)\ln (y+1)\\ \frac{y'}{y}&=\ln(y+1)+\frac{x+1}{y+1}\cdot y'\\ y'\left[\frac{1}{y}-\frac{x+1}{y+1}\right]&=\ln(y+1)\\ y'&=\ln(y+1)\cdot \left[\dfrac{y(y+1)}{y-x}\right]\end{aligned}$$
Now all you have to do is solve for $y'$. Can you proceed?
Comment: I did this but I got the answer wrong! The answer is $y(lny)^2/(1-xlny)$
Comment: Try plotting the solution you got. Maybe they would be equivalent expressions or the solution in the book might be wrong. This logic I believe is correct.
Comment: Okay I will, I also wanted to add that for the fourth line shouldn't it be y'[1/y - .....] instead of y?
Comment: Yes. I'll edit it. Thanks


Is there any way to load csv data into a snowflake table and report if each record has been loaded successfully? (using Python)

Question: I'm trying to load data(csv file) into snowsql table using copy into command.
I also want to display/report a message to know if all the records are loaded successfully, if not loaded successfully which record is unable to load.
Answer: Snowflake table function VALIDATE, might be of help:
Validates the files loaded in a past execution of the COPY INTO  command and returns all the errors encountered during the load, rather than just the first error.
Return errors for the last executed COPY command:
<code>select * from table(validate(t1, job_id => '_last'));
</code>
Details: https://docs.snowflake.com/en/sql-reference/functions/validate.html#validate


Espresso: how to click on StickyListHeadersListView item inside viewpager

Question: I have ViewPager with N tabs with StickyListHeadersListView inside each of them. I'd like to perform click on one of the list item. How could I do that?
thanks!
PS: I'm interested in Espresso test code only
Comment: are you writing your own adapter?
Comment: What kind of elements / objects do your lists have?
Check this question http://stackoverflow.com/questions/22965839/espresso-click-by-text-in-list-view which should give you an idea about clicking on list items.
Also, swiping across tabs in the viewpager is pretty straightforward, there's a viewaction defined for that.
You need to provide more information (some code that you've tried) if you really need help. Why would I spend my time guessing what you're actually trying to achieve when your research/trial&error efforts are minimal?
Answer: I've found the solution myself.
The main issue - StickyListHeadersListView is a wrapper around ListView, it doesn't extend ListView. So we can't work with adapter directly, but we can do this:
onData(anything()).inAdapterView(allOf(
  isAssignableFrom(AdapterView.class),
  isDescendantOfA(withId(R.id.list)),
  isDisplayed()))
.atPosition(1).perform(click());

Answer: Put this code in method where you are adding your view in viewPager:-
for(int i=0;i<arrPagerItems.size();i++)
{
    View viewPager;
    ListView listView;

    viewPager = inflater.inflate(R.layout.layout_pager,null);

    listView = (ListView) viewPager.findViewById(R.id.listView);

    listChat.setOnItemClickListener(new OnItemClickListener(){
    @Override
    public void onItemClick(AdapterView<?> arg0, View listView,int position,long arg3) {

            //do your task

            }
    });

    viewPagerAdapter.addView(viewPager, i);
    viewPagerAdapter.notifyDataSetChanged();
}

Answer: With Listview, you put into fragment.view pager have fragment. after you can check click listitem in fragment.
Custom :https://github.com/JakeWharton/ViewPagerIndicator


Java how to transform List to Page from JPA pagination

Question: I have a problem with my custom search method from Jpa Repository. I implement this method to custom search and in this method I have List<Car> from my SQL database and I try to transform it to Page<Car> object from JPA pagination & sorting, but the way I'm trying to do this doesn't work. That is just an illusion of pagination because in postman/internet browser i see all elements from list and when I change page and size value in endpoint that change nothing.
Anybody know how to help?
GitHub project: https://github.com/s0bieskii/DemoCarRental
My endpoint from controller:
@GetMapping("/find")
ResponseEntity<Page<CarDTO>> readAllCarsFiltered(@RequestParam(defaultValue = "0") int page,
                                                 @RequestParam(defaultValue = "5") int size,
                                                 Pageable pageable,
                                                 @RequestParam(required = false) String brand,
                                                 @RequestParam(required = false) String model,
                                                 @RequestParam(required = false) String type,
                                                 @RequestParam(required = false) Integer registrationYear,
                                                 @RequestParam(required = false) String color,
                                                 @RequestParam(required = false) String fuel,
                                                 @RequestParam(required = false) String transmission,
                                                 @RequestParam(required = false) String doors,
                                                 @RequestParam(required = false, defaultValue = "9999999999") double price) {
    return ResponseEntity.ok(carService.customerSearch(pageable,
            brand, model, type, registrationYear, color, fuel, transmission, doors, price));
}

My service:
public Page<CarDTO> customerSearch(Pageable pageable, String brand, String model, String type, Integer registrationNumber, String color,
                                   String fuel, String transmission, String doors, double price){

    return carRepository.search(pageable, brand, model, type, registrationNumber, color, fuel, transmission, doors, price)
            .map(car -> carMapper.carToDto(car));
}

My custom search method from RepositoryImplementation:
 @Override
    public Page<Car> search(Pageable pageable, String brand, String model, String type, Integer registrationYear, String color,
                            String fuel, String transmission, String doors, double price) {
        int var = 0;
        CriteriaBuilder cb = entityManager.getCriteriaBuilder();
        CriteriaQuery<Car> query = cb.createQuery(Car.class);
        Root<Car> car = query.from(Car.class);
        query.select(car);
        Predicate predicate = cb.greaterThan(car.get("id"), var);

        if (brand != null) predicate = cb.and(predicate, cb.equal(car.get("brand"), brand));
        if (model != null) predicate = cb.and(predicate, cb.equal(car.get("model"), model));
        if (type != null) predicate = cb.and(predicate, cb.equal(car.get("type"), type));
        if (registrationYear != null)
            predicate = cb.and(predicate, cb.equal(car.get("registrationNumber"), registrationYear));
        if (color != null) predicate = cb.and(predicate, cb.equal(car.get("color"), color));
        if (fuel != null) predicate = cb.and(predicate, cb.equal(car.get("fuel"), Fuel.stringToFuelEnum(fuel)));
        if (transmission != null)
            predicate = cb.and(predicate, cb.equal(car.get("transmission"), Transmission.stringToTransmissionEnum(transmission)));
        if (doors != null) predicate = cb.and(predicate, cb.equal(car.get("doors"), doors));
        if (price != 0) predicate = cb.and(predicate, cb.lessThan(car.get("price"), price));
        //predicate = cb.and(predicate, cb.equal(car.get("available"), available));
        List<Car> carList=entityManager.createQuery(query.where(predicate)).getResultList();

        return new PageImpl<Car>(carList, pageable,carList.size());
    }
}

Comment: Have you considered using Querydsl instead of writing all this yourself?
Answer: When you do custom queries and want to use Pageable, it's up to you to implement a logic to create a paging for your result list. In your case you aren't doing that so it's probably (you said it isn't working, but didn't say what isn't working so I can only guess) just returning the entire result list without paging applied.
A simple solution would be to use sublist and use the result of that operation as your parameter for PageImpl. Big problem is that you are still getting the entire result list from the database in the background which creates uneceassary overhead.
You could also adjust your query using
em.createQuery(query.where(predicate))
      .setFirstResult(offset)
     .setMaxResults(limit)
     .getResultList()

Now the paging is done in the database which is a lot better.
Or you save yourself some trouble and use Springs Specification interface instead of creating your own search method.
First your CarRepository needs to extend JpaSpecificationExecutor. Now spring will generate a findAll(Specification, Pageable) method for your repository.
Second step is to create your search specification:
public class SearchSpecification implements Specification<Car> {
    private final String brand;
    private final String model
    private final String type
    private final Integer registrationYear
    private final String color
    private final String fuel
    private final String transmission
    private final String doors
    private final double price

    // constructor & maybe getter
    public Predicate toPredicate(Root<Car> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
        // Create your search predicate
    }
}

Now you can simply call carRepository.findAll(new SearchSpecification (/* parameters */), pageable); and spring does the paging for you.
Comment: thanks a lot that work for me :)


Using $\leq$ as <

Question: Since $\le$ means less than or equal to. Can we use it when just one condition (less than) satisfies?
For example if $a + b \le 1$
can we say $a + b\leq 2$
instead of writing $a + b < 2?$
Comment: Yes. However $a+b<2$ gives more information.
Comment: $a+b \le 1$ and $a+b < 2$ are equivalent if $a,b$ are *integers,* but not for real numbers.
Comment: Since $1<2\le 2$ we have $a+b\le 1\implies a+b<2\implies a+b\le 2.$
Comment: Yes, as long as it holds by transitivity of $a+b\leq 1\leq 2$
Comment: @JohnGriffin But doesn't second equation add an extra info that $a+b$ may be equal to 2?
Comment: @piepi It adds extra possibilities, which limits how much information is provided. If I see a man with black hair, it is more informative to describe him as a "man with black hair" as opposed to "a man with dark hair".
Answer: If  $a+b \le 1$ is true then $a+b \le 2$ is also true.
But the assertion $a'+b' \le 2$ is weaker than the assertion $a'+b' < 2$.
For example if $a'=b'=1$ then the former is true while the latter is not.
Generally, asserting an inequality does not imply that the inequality is best possible. It is true that $12 \le 15$. It is also true that $12 \le 14$ and even that $12 < 14$.
But additionally note that while for  the integers the inequalities $a+b \le 1$ and $a+b < 2$ are equivalent (one is true exactly when the other is true), this is no longer the case for the inequalities $a+b \le 1$ and $a+b \le 2$.
Comment: @lakada The inequalities $a+b\le 1$ and $a+b\le 2$ are not equivalent even when $a$ and $b$ are assumed to be integers.
Comment: I don't understand what you mean at the end. When is it no longer the case?

Using $\leq$ as <


Preg_match pattern inside tag with regex

Question: I'm trying to use a regex to find a string. For example, my text is :
$text="
Introduction of Abdominal aortic aneurysm

In this section, we will learn about symptom, causes, and treatment of
AAA

This is Treatment for a burst AAA

.......

.........
"

I want to find :
$temp="
This is Treatment for a burst AAA

.......
"

I try this pattern :
Preg_match("/<h2(.*?)Treatment(.*?)
/i",$text,$matches);

if i echo $matches[1] it will return:
"Introduction of Abdominal aortic aneurysm

 In this section, we will learn about symptom, causes, and "

and if i echo $matches[2] it will return:
" of AAA
"

how to get $matches that match to this sentence :
"
This is Treatment for a burst AAA
"

Actually i want to make a pattern that match a text inside a  tag not a  tag.
Comment: Don't just post pictures. Write your question in the post.
Comment: Please read [ask], then [edit] your question and provide a [mcve] (this means, your _code must be in the question itself, **and your actual question must be in the question itself**_).
Comment: how to post question with a tag. it change my text. My  tag will return a bold text
Answer: Instead of using a regex to parse your html, you might use DOMDocument and C14N:
$dom = new DOMDocument();
$text="
Introduction of Abdominal aortic aneurysm

In this section, we will learn about symptom, causes, and treatment of
AAA

This is Treatment for a burst AAA

.......

.........
";

$dom->loadHTML($text);
$elms = $dom->getElementsByTagName("h2");
foreach($elms as $elm) {
    if (strstr($elm->nodeValue, "Treatment") !== false) {
        echo $elm->C14N();
    }
}

That will result in:

This is Treatment for a burst AAA

Demo


Simple variable(counter) in foreach in jsp

Question: I have simple question: Is possible in jsp make variable in foreach where I will store number of iteretion? The question also include how to do it? There is example how I wanna use it. It's this kind of problem that you will solve in few seconds if you know the answer, but its hard to find if you even know how to call it so the simple example explain everything ...

Description to the example: In arraylist list are href values for my tags  which are references for pages. NUMBER should represent my variable - something like list iterator.
So I will get: Page 1, Page 2, Page 3, ... Page x, where x is number of items in list list.
<c:forEach items="${requestScope.list}" var="listItem">
<a href="<c:out value="${listItem}" />">Page NUMBER
</c:forEach>
Answer: Use the 'varStatus' attribute, that will give you the counter.
<c:forEach items="${requestScope.list}" var="listItem" varStatus="counter" >
     <a href="<c:out value="${listItem}" />"><c:out value="${counter}" />
</c:forEach>

Comment: Thank to pointing me right direction but as I google, cause now I know what to google there should be actually  value="${counter.count}" for counting from 1 what I need or counter.index for counting from 0, but varStatus don't return integer, but some object. There are the another values of that object http://www.bmchild.com/2012/03/jstl-cforeach-varstatus-properties.html


Alterar mensagem do último commit no GIT e push no GITHUB

Question: Verificando o meu último push no github identifiquei kum erro de digitação na mensagem de commit, como alterar?
Comment: Você pode ver essa informação no link abaixo: https://docs.github.com/pt/github/committing-changes-to-your-project/changing-a-commit-message
Answer: Alterando o último commit no repositório Git...
1-Na linha de comando, navegue até o repositório que contém o commit que você deseja corrigir.
2-Digite git commit --amend e pressione Enter.
3-No editor de texto, edite a mensagem do commit e salve o commit.
Enviando para o Github o commit alterado
Agora Use o comando push --force para forçar o push sobre o commit antigo.
git push --force
Pronto... espero ter ajudado...
Na fonte você vai achar mais detalhes e alternativas ok!
Fonte: https://docs.github.com/pt/github/committing-changes-to-your-project/changing-a-commit-message
Comment: Legal, resolveu meu problema! Grato!


Busca Informação em campo XML em SQL

Question: Eu preciso efetuar uma busca dentro de um campo onde armazena um XML
O XML é de um CT-e e nele tem uma série de tags e preciso encontrar um dado dentro de uma tag específica.
Abaixo a estrutura da Tabela

O XML possui a seguinte estrutura e dentro dele o campo que eu preciso consultar é a tag "Chave".

É possivel uma busca, onde eu retorno o campo ChaveAcesso mas na clausula WHERE eu coloque pra buscar o valor da chave  que estou procurando dentro do xml?
Muito obrigado
Comment: o valor é o mesmo ?
Comment: Não. O valor do campo "ChaveAcesso" é o identificado do documento chamado CT-e. Já a tag chave, dentro do XML é referente a chave da nota fiscal que está sendo transportada pelo CTe.
Comment: você quer fazer um filtro para buscar o valor dentro do xml, isso vai ficar caro.
Comment: [Como recuperar um valor de dentro de uma tag no XML?](https://pt.stackoverflow.com/questions/227093/como-recuperar-um-valor-de-dentro-de-uma-tag-no-xml/227100#227100)
Answer: Você teria que fazer algo de tipo
DECLARE @document varchar(max);
SELECT @document = '<Username>testeyyytttyyyyyy</Username><chave>ef4dbf9f4b6c80fe03671cc476b29636</chave>';

DECLARE @tabela TABLE
(
  id int,
  xml nvarchar(max)
)

INSERT INTO @tabela VALUES (1, @document);
SELECT @document = '<Username>testeyyytttyyyyyy</Username><chave>ef4dbf9f4b6c80fe03671cc476b29637</chave>';
INSERT INTO @tabela VALUES (1, @document);
SELECT @document = '<Username>testeyyytttyyyyyy</Username><chave>ef4dbf9f4b6c80fe03671cc476b29638</chave>';
INSERT INTO @tabela VALUES (1, @document);

SELECT * FROM @tabela AS t
WHERE 'ef4dbf9f4b6c80fe03671cc476b29636'  =
(SELECT SUBSTRING(t.xml, (select PATINDEX('%<chave>%', t.xml) + len('<chave>')), 32))

Note que no WHERE estou passando uma chave para ser localizada no seu xml ef4dbf9f4b6c80fe03671cc476b29636
É necessário que você encontre ela dentro do seu xml para que depois faça o filtro
(SELECT SUBSTRING(t.xml, (select PATINDEX('%<chave>%', t.xml) + len('<chave>')), 32))

Estou usando o SUBSTRING que recebe 3 parâmetros o primeiro é seu campo xml da sua tabela o segundo o index inicial ,ou seja, o que tive depois do <chave> o terceiro parâmetro e o tamanho da string que você quer, aqui estou assumindo que você tem uma string sempre do tamanho de 32 caracteres, caso seja diferente veja como buscar o index final.
Comment: Só lembrando essa consulta dependendo da quantidade de registro vai sair cara a busca. talvez seria melhor criar um novo campo com o valor da chave com um index no campo. e fazer um update com esse select.
Answer: O SQLServer dispõe de algumas funções para extrair dados de tabelas com campos xml.
https://docs.microsoft.com/pt-br/sql/t-sql/xml/value-method-xml-data-type
https://sqlfromhell.wordpress.com/2011/08/02/lendo-xml-no-sql-server-iniciando-com-xquery/
https://pessoalex.wordpress.com/2012/01/24/extraindo-informacoes-de-arquivo-xml-para-o-sql-server/
Fiz um teste criando uma tabela contendo um campo id e outra para armazenar o XML:
create table cte (
    id INTEGER IDENTITY,
    campo_xml XML
)

Depois incluí alguns registros com o xml na mesma estrutura abaixo, somente modificando a chave do CTE:
insert into cte (campo_xml)
values (Cast(
    '<cteProc xmlns="http://www.portalfiscal.inf.br/cte" versao="2.00">
        <protCTe versao="1.03">
            <infProt>
                <tpAmb>2</tpAmb>
                <verAplic>SP_PL_CTe_103d</verAplic>
                <chCTe>99999994018888000349570040000165560001999999</chCTe>
                <dhRecbto>2011-07-05T14:42:56</dhRecbto>
                <nProt>135110011494444</nProt>
                <digVal>eFWH/VAzwb+MQuBSp9NWZdzXdL4=</digVal>
                <cStat>100</cStat>
                <xMotivo>Autorizado o uso do CT-e</xMotivo>
            </infProt>
        </protCTe>
    </cteProc>' as XML))

Por último fiz a consulta para retornar o registro corresponde a chave no XML:
WITH XMLNAMESPACES(DEFAULT 'http://www.portalfiscal.inf.br/cte')
select *
from cte
where
    campo_xml.value('(/cteProc/protCTe/infProt/chCTe)[1]', 'varchar(100)' )='99999994018888000349570040000165560001999999'

Para agilizar a consulta dos dados podem ser criados índices para esse campo XML, já que você vai precisar apenas de uma parte dos dados. Na documentação da Microsoft existem algumas informações sobre o uso e a sintaxe para a criação:
https://docs.microsoft.com/pt-br/sql/relational-databases/xml/xml-indexes-sql-server
https://docs.microsoft.com/pt-br/sql/t-sql/statements/create-xml-index-transact-sql
Comment: boa não sabia dessa.]

Busca Informação em campo XML em SQL


Botão não aparece em janela

Question: Meu botão chamado btnLimpar não aparece.
esse é o código:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Frame extends JFrame {
    private JButton btnEnviar = new JButton("EnviarMSG");
    private JButton btnLimpar = new JButton("Limpar");
    private JTextField txtCampo = new JTextField();
    private JLabel lblExibir = new JLabel();

    public Frame() {
        super("Meu JFrame executado em terminal");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLocationRelativeTo(getOwner());
        setSize(400, 330);
        setVisible(true);
        setLayout(null);

        txtCampo.setFont(new Font("arial", Font.PLAIN,40));
        txtCampo.setBounds(15, 20, 360, 70);
        add(txtCampo);

        btnEnviar.setBounds(210 ,110, 170, 70);
        add(btnEnviar);

         btnEnviar.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

          lblExibir.setText(txtCampo.getText());

            }
        });

        btnLimpar.setBounds(210 ,110, 170, 70);
        add(btnLimpar);

        btnLimpar.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                lblExibir.setText(null);
                txtCampo.setText(null);
                txtCampo.requestFocus();
            }
        });

        lblExibir.setFont(new Font("arial", Font.PLAIN, 20));
        lblExibir.setOpaque(true);
        lblExibir.setBackground(Color.gray);
        lblExibir.setForeground(Color.red);
        lblExibir.setBounds(15, 220, 360, 70);
        add(lblExibir);
    }

    public static void main(String[] args) {
        new Frame();
    }
}

Print
Answer: Um botão está em cima do outro, pois ao criá-los você definiu a mesma posição deles dentro do seu JFrame:
btnEnviar.setBounds(210 ,110, 170, 70);

...

btnLimpar.setBounds(210 ,110, 170, 70);

Uma possível solução é mudar a posição do btnLimpar assim:
btnLimpar.setBounds(20 ,110, 170, 70);

Onde os parâmetros são:
setBounds(int x, int y, int largura, int altura);

x e y são as coordenadas do plano da posição do elemento.
Resultado:
Comment: Obrigado, certo!!

Botão não aparece em janela


Index few attributes of document in hybris Solr

Question: We have around 100k products in our website and each product have around 30 attributes which are indexed. Most of the time we only update price of products but we still have to index the whole product. Is it possible in hybris to index only the price attribute(or description attribute) of all 100k products.
Answer: It is possible since Solr 4.0. This feature is called partial update, where you can update only the fields changed, in your case, price and description.
The official documentation is here.
Answer: Marco is right. You can do a Partial Update.
For Hybris, there is some documentation is in Creating and Configuring Indexed Types. SolrIndexerQuery.type attribute lets you choose partial_update.
You have the following values to choose from:
FULL: recreates the index
UPDATE: updates some documents in the index
PARTIAL_UPDATE: allows you to select the fields for the update
DELETE: deletes documents from the index


Quanteda: error message while tokenizing "unable to find an inherited method for function 'tokens' for signature '"corpus"'"

Question: I have been trying to tokenise and clean my 400 txt documents before using structured topic modelling (STM). I wanted to remove punctuations, stopwords, symbols, etc. However, I get the following error message:
"Error in (function (classes, fdef, mtable): unable to find an inherited method for function 'tokens' for signature '"corpus"'". This is my original code:
answers2 <- tokens(answers_corpus, what = c("word"), remove_numbers = TRUE, remove_punct = TRUE,
   remove_symbols = TRUE, remove_separators = TRUE,
   remove_twitter = TRUE, remove_hyphens = TRUE, remove_url = TRUE,
   ngrams = 1L, verbose = quanteda_options("verbose"), include_docvars = TRUE, text_field = "text")

I also tried to tokenize a simple string text - just to check if it was an encoding problem while importing my txt files - but I got the same error message, plus a couple of extra ones when I tried to tokenise the the text directly, without converting it to corpus: "Error: Unable to locate Ciao bella ciao" and "Error: No language specified!". Here is my example code in case someone wants to replicate the error message:
prova <- c("Ciao bella ciao")
prova2 <- "Ciao bella ciao"
prova_corpus <- corpus(prova)
prova2_corpus <- corpus(prova2)
prova_tok <- tokens(prova2_corpus)
prova2_tok <- tokens(prova_corpus)

The packages that are loaded are: data.table, ggplot2, quanteda, readtext, stm, stringi, stringr, tm, textstem. Any suggestion on how I could proceed to tokenise and clean my texts?
Comment: This is more appropriate as an issue on the [quanteda repository site](https://github.com/quanteda/quanteda/issues). Please file it there.
Comment: Thank you. I just did it, here is the link: https://github.com/quanteda/quanteda/issues/1408
Answer: After several attempts, I managed to find a solution. When several text analysis/topic modelling packages are loaded in Rstudio, the "tokens" functions can overlap. You need to force the command to be quantedas "tokens", ie quanteda::tokens(answers). Here is the updated code
answers2 <- quanteda::tokens(answers_corpus, what = c("word"), remove_numbers = TRUE, remove_punct = TRUE,
   remove_symbols = TRUE, remove_separators = TRUE,
   remove_twitter = TRUE, remove_hyphens = TRUE, remove_url = TRUE,
   verbose = quanteda_options("verbose"), include_docvars = TRUE, text_field = "text")

And the updated example code too:
prova <- c("Ciao bella ciao")
prova2 <- "Ciao bella ciao"
prova_corpus <- corpus(prova)
prova2_corpus <- corpus(prova2)
prova_tok <- quanteda::tokens(prova2_corpus)
prova2_tok <- quanteda::tokens(prova_corpus)

Quanteda: error message while tokenizing "unable to find an inherited method for function ‘tokens’ for signature ‘"corpus"’"


How do I find the range of the following function?

Question: The question says to find the range and domain of $$P(x) = \frac{\sin(x)-1}{\sqrt{3-2\sin(x)-2\cos(x)}}$$
How do I approach this problem? For domain, I know I should set the denominator $>0$ so that it doesn't become undefined...but not really how to proceed further.
Any help would be appreciated.
Comment: It probably helps to observe that $2 \sin x + 2 \cos x = 2 \sqrt{2}(\sin x \cos \frac{\pi}{4} + \cos x \sin \frac{\pi}{4}) = 2 \sqrt {2} \sin (x+ \frac{\pi}{4})$.
Comment: You would set the denominator $>0$ to find the domain, not range
Comment: @ShubhamJohri yes sorry it was a typo, I'm on mobile
Answer: Notice that
$$3-2\sin(x)-2\cos(x) = 2 + \sin^2(x)+\cos^2(x)-2\sin(x)-2\cos(x)$$ $$= (\sin^2(x) - 2\sin(x) + 1) + (\cos^2(x) - 2\cos(x) + 1) = (\sin(x)-1)^2 + (\cos(x)-1)^2$$
In other words our function can be rewritten as
$$P(x) = \frac{\sin(x)-1}{\sqrt{(\sin(x)-1)^2 + (\cos(x)-1)^2}}$$
The numerator is always nonpositive, at most $0$. To get the minimum negative value,
$$\frac{\sin(x)-1}{\sqrt{(\sin(x)-1)^2 + (\cos(x)-1)^2}} \geq \frac{\sin(x)-1}{\sqrt{(\sin(x)-1)^2}} = -1$$
which is okay because both squares inside the square root cannot be $0$ at the same time.
So the range of this function is $[-1,0]$.
Comment: Could you please explain the last step....how you got the minimum negative value
Comment: @Techie5879 Take absolute value instead and denote $a = 1-\sin(x)$ and $b=1-\cos(x)$. Then $\frac{a}{\sqrt{a^2+b^2}} \leq \frac{a}{\sqrt{a^2}} = 1$. The minus sign flips the inequality.


My form isn't saved in database based on my report

Question: I'm making a new report system, I'm at beginning, the design is already done, but when I press on submit, nothing is happening in database, I get 0 records.What's wrong in my code?Or maybe I need to add something more?
My view:

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

            <form role="form">

Why are you reporting this content :

    <input type="radio" id="box-9" name="why_reporting" value="Spam">
    Spam

    I consider this content irrelevant and annoying.

    <input type="radio" id="box-10" name="why_reporting" value="Fake Profile">
    Fake Profile

    This content was posted by way of a profile that clearly doesn't represent a real person.

    <input type="radio" id="box-11" name="why_reporting" value="Advertising">
    Advertising

    This content is or contains advertising.

    <input type="radio" id="box-12" name="why_reporting" value="Untrustworthy source">
    Untrustworthy source

    This content is from an untrustworthy source and contains unverifiable statements.

    <input type="radio" id="box-13" name="why_reporting" value="Defamatory">
    Defamatory

    The reported content is insulting or defamatory to me or other people.

    <input type="radio" id="box-14" name="why_reporting" value="Violence or pornography">
    Violence or pornography

    This content contains violence or pornography.

    <input type="radio" id="box-15" name="why_reporting" value="Violates IP rights">
    Violates IP rights

    This content includes third-party content (e.g. an image) posted under their own name.

    <input type="radio" id="box-16" name="why_reporting" value="Promotes structural distribution measures">
    Promotes structural distribution measures

    This content promotes a chain distribution system, multilevel selling or pyramid sales.

    <input type="radio" id="box-17" name="selector">
    Other

    <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Please let us know why you're reporting this content:
" style="resize: none" name="why_reporting_message"></textarea>

<button style="background-color: #18ba9b;border-color: white" type="button" class="btn btn-primary next-step">Save and continue</button>

Why would you like to report this?

    <textarea class="form-control" id="exampleFormControlTextarea1" rows="5" style="resize: none" placeholder="
Please let us know why you're reporting this content:" name="additional_message"></textarea>

<button type="button" class="btn btn-default prev-step">Previous</button>

<button type="button" class="btn btn-default next-step">Skip</button>

<button style="background-color: #18ba9b;border-color: white" type="submit" class="btn btn-primary btn-info-full next-step">Submit your report</button>

We'll look into this as soon as possible. Thanks for helping us improve the quality of content on Workstickers.

You have successfully completed all steps.Flagged content and users are reviewed by Workstickers staff 24 hours a day, seven days a week to determine whether they violate Community Guidelines. Accounts are penalized for Community Guidelines violations, and serious or repeated violations can lead to account termination.

If you've changed your mind -  Cancel report

            </form>

Model Reports
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Reports extends Model
{
    protected $table = 'reports';

    // public $timestamps = false;

    protected $fillable = [
        'user_id', 'news_id','opinion_id','event_id','career_solutions_id','why_reporting','why_reporting_message','additional_message','private'
    ];

    public function career_solutionReport()
    {
        return $this->belongsTo('App\CareerSolution','career_solution_id','id');
    }
     public function eventReport()
    {
        return $this->belongsTo('App\Event','event_id','id');
    }
     public function newsReport()
    {
        return $this->belongsTo('App\News','news_id','id');
    }
     public function opinionReport()
    {
        return $this->belongsTo('App\Opinion','opinion_id','id');
    }

    public function user()
    {
        return $this->belongsTo('App\User','user_id','id');
    }

}

My controller:
 public function careerReport(requ $request)
    {

        $report = \App\Reports::create([
                        'user_id' => $request['user_id'],
                        'career_solution_id' =>$request['career_solution_id'],
                        'why_reporting' =>$request['why_reporting'],
                        'why_reporting_message' =>$request['why_reporting_message'],
                        'additional_message' =>$request['additional_message'],

                    ]);

        if($report != ""){
            flash('Career solution report submited', 'success');
        }else{
            flash('Career solution report', 'warning');
        }

        return Redirect::back();

    }

Route:
Route::post('career_review', 'CareerSolutionController@careerReview');
Route::post('career_report', 'CareerSolutionController@careerReport');

I have tried to reproduce my review comments system, but I don't know why isn't working. At submit, my page is refreshing and nothing happens but in my link I have this ( for example ) : https://my-link.com/why_reporting=Spam&why_reporting_message=&additional_message=testarea+mea
Comment: Nothing in your log? `public function careerReport(requ $request)` What is `requ`?
Comment: @kerbholz `requ` is `use Illuminate\Http\Request as requ;` , I didn't make this code, I'm just trying to add something new here, based on the old content.
Comment: Do you get any errors, or simply page refreshes, and nothing happens?
Comment: @zlatan, only page refreshes, nothing happens but in my link I have this : `why_reporting=Spam&why_reporting_message=&additional_message=testarea+mea`
Comment: Missing `@csrf` in your form?
Answer: Add your form submit destination and submit type inside Form tag. Currently there is nothing inside form tag. And don't forget to add csrf field in form.
Example:
<form role="form" action="{{ action('CareerSolutionController@careerReport') }}" method="post">
{!! csrf_field() !!}

or
<form role="form" action="{{ url('career_report') }}" method="post">
{!! csrf_field() !!}

Comment: Hi, thank you for your answer.I added this and now, when I click on submit button, I'm redirectet to 404 page, but my link is something like `/career_report?_token=RT1DZZg2DmUrCxoi628og4sm7STKo4nV4AOGnONR&why_reporting=Untrustworthy+source&why_reporting_message=&additional_message=ewfwefew`
Comment: @AndreiNagy add csrf token in form. just after form tag use this `{!! csrf_field() !!}`
Comment: Yes, it's already here :( `
   {!! csrf_field() !!}`
Comment: there was a mistake, i've edited my answer. replace type with method
Comment: Yes, now I have only a little step :) `Integrity constraint violation: 1048 Column 'user_id' cannot be null` .`user_id` should be the user_id of auth user when the form is sent.
Comment: make `user_id` nullable in database or add some value in `user_id` while saving data.
Comment: Yes, it's saved.But do you know how to save user id of auth user in `user_id`?
Comment: It should `Auth::user()->id()` or `Auth::id()`
Comment: `'user_id' => Auth::user()->id()`, like this?
Answer: I see the problem, you never defined form action in your blade, so the form doesnt know what to do. Change your form opening to this:
<form role="form" action="{{ action('CareerSolutionController@careerReport') }}>

And don't forget to add crsf token right below it:
@csrf

Or for convinience, add custom name to your route:
Route::post('career_report', 'CareerSolutionController@careerReport')->as('career.report');

And use it in your form like this:
<form role="form" action="{{ route('career.report') }}" method=POST>

Comment: That route is `POST`, but the form method isn't
Comment: as @kerbholz said, change the form method to POST, see my updated answer
Comment: I made like this, but same problem as the next answer, at submit I'm redirected to 404 page.
Comment: `Integrity constraint violation: 1048 Column 'user_id' cannot be null`, now I have this problem :( `user_id` should be the user_id of auth user when the form is sent.
Comment: Can you `dd($request)`on top of your controller, and paste the output. I think you might be retreiving data incorrectly. Use `$request->` insted of `$request[]`
Comment: You don't have `user_id` in your request, and you're trying to save it. I don't see it defined anywhere in your form. If you want to save users id, make a hidden input with name `user_id` and value `Auth::user()->id`
Comment: @zlatan this ` ` or ` ` isn't working :(


django export csv issue while reading foreignkey field

Question: here is my models.py
class RegistrationOTP(models.Model):
    country = models.ForeignKey(Country,on_delete=models.CASCADE, related_name='otp_country', default=1)
    phone_number = models.CharField(max_length=13)#, unique=True, validators=[phone_regex],
    otp = models.PositiveIntegerField()
    created_date = models.DateTimeField(auto_now=True)
    is_verified = models.CharField(choices=YES_OR_NO, default='no', max_length=10)

    def __unicode__(self):
        return '%s : %s'% (self.phone_number, self.otp)

class Country(models.Model):
    name = models.CharField(max_length=20, unique=True)
    phone_code = models.CharField(max_length=20, unique=True)

here is my admin.py
class RegistrationOTPResource(resources.ModelResource):
    class Meta:
    model = RegistrationOTP
    fields = ('id','phone_number','otp','created_date','is_verified','country')

    def to_representation(self, instance):
    rep = super(RegistrationOTPResource, self).to_representation(instance)
    rep['country'] = instance.country.name
    return rep

class RegistrationOTPAdmin(ExportMixin, admin.ModelAdmin):
    resource_class = RegistrationOTPResource

admin.site.register(RegistrationOTP, RegistrationOTPAdmin)

id  country phone_number    otp created_date    is_verified
151 1   6800000000  289320  2018-09-06 10:50:27 yes
150 1   9586773322  660144  2018-09-06 10:50:02 yes
149 1   9653694645  846690  2018-09-06 10:45:23 yes
148 1   6800000000  224465  2018-09-06 10:43:40 yes
147 1   6800000000  386181  2018-09-06 10:41:57 yes
146 1   919829621000    882178  2018-08-21 13:04:39 no
145 1   7584858585  446125  2018-08-21 13:04:39 no
144 1   6112355184  411237  2018-08-21 12:59:31 no
143 1   919829621000    434132  2018-08-21 12:59:25 no
142 1   7584858585  281552  2018-08-21 12:59:25 no
141 1   6112355184  757004  2018-08-21 12:57:38 no

In my csv country field is showing country id instead of country name. how can i show country name..
please have a look into my code
Answer: def get_queryset(self, request):
    return super(RegistrationOTPResource, self).get_queryset(request).select_related('country')


How to get notified by eMail after someone edited his own webform submission?

Question: I have a webform, and I'd like to be notified whenever someone edited his own submits. I'm using the Webform module.
I found the Webform Rules module but I didn't get how to use it,
any way to set this up?
Comment: Thank you @Pierre.Vriens I greatly appreciate your instructions, i like your answer it's logical and very helpful, i will try it for my next project cause the technical specifications of this one have been changed, and they don't need this function any more
Answer: Using Webform Rules (and Rules of course), it's a peace of cake to send an eMail using Rules Event "After a webform submission is updated". To actually do so, refer to the answer from CodeNext. However, the real challenge in this question here, is to address this part of the question: "someone edited his own submits". Read on for more details on how to implement that part of it.
Assumptions:

It should also work for "someone edited 'her' own submits".
The question is NOT about anonymous users (for that you might need things like IP address, session API, etc ... be my guest to also get that to work ...).

With these assumptions in mind, you'll need to have something in your webform available to store, as part of the submitted webform, the uid of the user who actually submitted the webform. I've not found (yet) any such data that is available as a token to Rules (you'll need it in Rules to get this challenge to work). So therefor I'd use an approach like adding an extra (hidden?) webform field that is automatically set (eg using Rules) when the webform is first submitted, let's say using a field with machine name field_webform_submitter_uid.
After all the above is in place and agreed about, you're in good shape to address the challenge "someone edited 'his/her' own submits": all you'd have to do is to further enhance the rule detailed in the prior answer, by adding an appropriate Rules Condition, to check if the uid of the currently logged in user matches field_webform_submitter_uid.
But, there is 1 more challenge to implement that extra Rules Condition: how should the Rules token look like for the value of field_webform_submitter_uid? To find the answer to this, refer to the README.txt of Webform Rules: based on what's documented there, the token to be used in that extra Rules Condition should be [data:field_webform_submitter_uid-value].
Voilà ...
Note (about the token for the uid of the user who submitted the webform): each submission has data like "submitted by" and "submitted on", however from all uid-variations I've experimented with, none of them contain the value that always matches the "submitted by" (not to be confused by tokens like node:author:uid, those are for sure not what matches the "submitted by"). To convince yourself, try a scenario where the user who submitted the webform is different from the one who edits that submission ...
Comment: @NoSssweat : I did an experiment with various tokens I had available (about 4 I believe) , such as **node:author:uid** and by displaying their value via a Rules Action "Show a message on the site" (with no Rules Condition). However I did not find any that correspond with "the userid who submitted the webform". Are you sure node:author:uid contains a value of the user who submitted the webform? I think it is actually the uid of the creator of the webform itself ...
Comment: @NoSssweat : your last comment made me doubt (again). So I re-did various tests/scenarios. I'm testing with a submission from a user that is **different** from the currently logged in user. But in my scenario all uid-tokens always have a value of the uid I'm logged in with. So in your scenario, are you also testing with a current uid that is different from the uid who submitted the form? If you're using the same uid, then IMO your testcase works "by accident", understand what I mean?
Comment: Very smart and creative solution, thanks @Pierre.Vriens i will try it
Comment: Nice brainstorming at [Pierre.Vriens](http://drupal.stackexchange.com/users/39516/pierre-vriens) + [NoSssweat](http://drupal.stackexchange.com/users/27710/no-sssweat). Knowledgeable inputs, learned things. Pierre.Vriens..+1 for answer & explanation.
Comment: @CodeNext Merci for the kudos ... know however that I'm still struggling with the last comment from NoSsssssssssssssssweat ... as detailed in my latest comment before this one ... I'd be interested to learn from you also, if you can, what the value of node:author:uid actually is, in the scenario where the user who submitted the webform is different from the one who edits that submission ...
Comment: @Pierre.Vriens you're right, I take back what I've said, I was getting false positives. I have deleted my comments to avoid confusing future readers.
Answer: Note: Please Do not follow this Answer, as I misunderstood the requirement previously. You can follow this to get the general idea of how to create Rules
You have right module sets, You need Rules and Webform Rules, as webform rules module depends on rules module.
Now, if you go to Admin/Config/Workflow/rules.
1. Create a new Rule and select event, as shown in following image I have created a new rule named Webform Edit Notification. Then select a Event, as you can see in image, I have selected a option under Webform After a webform submission is updated

2. Select the Action, from options I did choose Send a mail as shown in following image. If you save a move to next step it will open a new page for sending a email setup.

3. TO: Now first field is TO whom you want to send. As you click the button switch to the direct input mode and click on the data selector the options as shown in image will open.
Now form the image I am selecting node:...(The webform node). After selection it will show options which are under that under that. So I am selecting node:author:...(Author). Then again same in next step I am selecting Email.
Hence, It will end up as node:author:email which translate, **Email address of Author of that particular node** So this will make a TO:

Then you can add,
Subject:
Add message:
From:
So, this way it will send a mail to the mail to the author of that webform.

I have not used this as I am not using in my site, But this is the logic. You can try it to validate it before finalizing for Live site.
Comment: No need to delete your answer, don't worry. I suggest I'll add an answer then with something like "to complete the answer fro Codenext, make sure to also do so and so" ... OK?
Comment: Hmmm.... and I just understand this question, you were right, it is not that way. It is like admin(One contact point) should be notified whenever someone updating his/her own created webform.
Comment: Aha, **now** you seem to get my point  (understanding the problem is often 50% of the solution, right?). Just in case you want some homework for the weekend: find the appropriate token that you can use in rules ... Actually, I might post that soon as a new question (related to this one) ... think it would be a good (though possibly tough) question?
Comment: Nice instructions, well done! Though I think you're still missing a crucial piece in it to address this part of the question: "***someone edited his own submits***". I trust you know how to further enhance your answer to also cover that. If not let me know. PS: no need for the introduction **note** (if you ask me), I would remove that from this answer ... but that's up to you of course.
Comment: That will be perfect, so questioner will get better knowledge. +1
Comment: Minor update: I did some rules experiment, but for now I can't find an appropriate token to use in an enhanced version of your rule (related to my first comment here). After (and "if") I find what I'm looking for, I'll post another update ... Webforms are great, but can be challenging sometimes ...
Comment: @NoSssweat see the bold in my first comment here ... IMO that's the real challenge ...
Comment: Hi Thanks for Attention. You can edit answer or copy paste if you need images Or In better case if you provide the fresh answer it will be far better, as I have read your many answers on Rules they are very good so you can better suggest on this subject. This was my try but I do not want to give any answers which leads to some error because this kind of thing deals with directly to user, So no error permissible. I provided answer as I wanted to make Questioner familiar with that. Please if you have time you provide answer, after that I will delete this one.
Comment: @Pierre.Vriens what's the hold up? On the last screen shot, for **TO** all you have to do is click `Switch to direct input mode` button, then type the e-mail, ex: email@example.com
Comment: Thank you @CodeNext I greatly appreciate your instructions, and thank's to all of you for taking the time to proofread and answer my questions :)
Comment: As a temporary solution,i use the private message module, so when the user edit his own Webform submits,he sent me a direct message, at the same time, i enable submissions to move after editing to the first state of the Webform Workflow.
Comment: @Pierre.Vriens doesn't the event/trigger cover that part? "After a webform submission is updated"
Comment: @NoSssweat : refer to my own answer I just added. You get "it" now? BTW: note the "yet" in it ... I'd love to see someone else post another answer how to simplify it further (I can't imagine you'd need such extra field, there has to be an easier way to retrieve the uid of the user who submitted the webfrorm, wouldn't you agree?).


Fields generated by inlineformset_factory disappears when validation fails

Question: I have a simple Book Author relationship
class Author(models.Model):
    first_name = models.CharField(max_length=125)
    last_name = models.CharField(max_length=125)
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)

class Book(models.Model):
    title = models.CharField(max_length=225)
    author = models.ForeignKey(Author)

class AuthorForm(forms.ModelForm):
    class Meta:
        model = Author

class BookForm(forms.ModelForm):
    class Meta:
        model = Book

This is what I have in my view
def addbook(request):

    BookFormSet = inlineformset_factory(models.Author, models.Book, extra=1)

    if request.method == 'GET':
        author = models.AuthorForm()
        books = BookFormSet()
    else:
        author = models.AuthorForm(request.POST)
        if author.is_valid():
            books = BookFormSet(request.POST)
            if books.is_valid():
                print(books)

    return render_to_response('bookadd.html', locals(), context_instance = RequestContext(request))

My template looks like this
<form action="/books/add_new" method="post">
      {% csrf_token %}

          First name:
          {{ author.first_name }}
          {{author.first_name.errors}}

          Last name
          {{ author.last_name }}
          {{author.last_name.errors}}

      {{ books.management_form }}
      {{ books.as_table }}

      <input type="submit" value="Submit" />
    </form>

If I leave the title field blank and hit enter, on post back the book title field disappears, and I cannot figure out what to do about it. I want the field to be there with any data that was entered by the user.
Answer: You might try
    author = models.AuthorForm(request.POST)
    books = BookFormSet(request.POST)
    if author.is_valid():

instead of
    author = models.AuthorForm(request.POST)
    if author.is_valid():
        books = BookFormSet(request.POST)


Ranks of Composition of Linear Transformations vs. Mapped Vector Space

Question: I'm having trouble with this proof:

Let $\mathbb{U, V, W}$ be finite dimensional vector spaces and let $L: \mathbb{V} \to \mathbb{U}$ and $M : \mathbb{U} \to \mathbb {W}$ be linear mappings
a) Prove that rank$(M \circ L) \leq $ rank$(M)$.
b) Prove that rank$(M \circ L) \leq $ rank$(L)$.

I've attempted a), I've gone as far as showing
rank$(M) \leq $ dim$(\mathbb{U})$ and rank$(M \circ L)$ $\leq $ dim$(\mathbb{V})$
with the Rank-Nullity theorem, and but that obviously doesn't get me very far. I'm not sure how else to approach this. Haven't attempted b), as I'd imagine it extends off of a).
Comment: How do you know $\dim U\le \dim V$?
Comment: Hint for (a) $L(\mathbb V) \subseteq \mathbb U \implies M(L(\mathbb V)) \subseteq M(\mathbb U)$.
Comment: @Bernard I just realized that was incorrect
Comment: Rank $(M\circ L)$ is at most the greater of the rank ($M$) or the rank ($L$). $(M\circ L)$ can only take vectors in the image of $L$ and take them to some place $\mathbb W.$ Similarly no matter how rich the image of $L$ is, if the rank of $M$ is smaller than the rank of $L$ then some of those vectors are in the kernel of $M.$
Comment: @DougM conceptually I understand why the inequality holds, I have no idea how to prove it though
Comment: @user251257 if that implies the dim$M(L\mathbb{V}) \leq m(\mathbb{U})$ does that complete the proof for part a?
Answer: Hints:
Consider the linear maps $f$ and $g$ associated to the matrices $L$ and $M$ respectively. $\DeclareMathOperator{\im}{Im}\DeclareMathOperator{\rk}{rank}$ We know $ML$ is associated to the composition $g\circ f$.
We know $\;\rk L=\dim\im f$,  $\;\rk M=\dim\im g$,  $\;\rk ML=\dim\im (g\circ f)$.

How do the subspaces $\im (g\circ f)$ and $\im g$ compare?
How do $\dim\im f$ and $\dim V$ compare? And $\dim\im(g\circ f)$ and $\dim V$?
Comment: I've come back to this question now... and I'm stuck again (this time on b). Your hint says to find the comparison between dim Im $f$ and dim $\mathbb{V}$, and dim Im $g \circ f$ and dim $\mathbb{V}$. The only thing I can really find is that they are both less than or equal to dim $\mathbb{V}$, which again doesn't give me anything. Is there something I'm not getting?
Comment: You have to use that the image of $g\circ f$ is the image of the *restriction of* $g$  to $\operatorname{Im}f$, so the dimension of this image is at most the dimension of the source, which is $\operatorname{rank}L$.
Comment: We haven't learned what restrictions are and it doesn't look like it's in the book. Is there an alternative way to arrive at that conclusion?
Comment: Is it fair to say that for some $\vec{v} \in \mathbb{V}$, $L\vec{v} = 0$ implies $M(L(\vec{v})) = 0$, so ker($L$) $\subseteq$ ker($ML$) and by Rank-Nullity Theorem, rank($ML$) $\leq$ rank($L$)?
Comment: A  restriction is a very general notion for *maps* between sets. It has nothing to do with linear algebra. It only means you restrict the domain to a subset (subspace in the present case). rank($ML$) $\le$ rank($L$) for a *much simpler* reason than the rank-nullity theorem: the image of $g\circ f$ is  the image by $g$ of  Im($f$).
Comment: Ok, that makes sense. The question was listed under the rank-nullity theorem section, so I assume that's the approach that was implied for me to take. I'll keep that property in mind for next time.


BAD DC transfering FSMO Roles to ADC

Question: I have a DC (FQDN:server.icmcpk.local) and an ADC (FQDN:file-server.icmcpk.local).
Recently my DC is facing a bad sector problem so I changed the Operation Masters to file-server for all five roles. but when ever i turn off the OLD DC the file-server also stops wroking with AD and GPMC further i m also unable to join any other computer to this domain.
For Test purpose i also added a new ADC (FQDN:wds-server.icmcpk.local) but no succes with the old DC off i had to turn the old DC on and then joined it.
I m attaching the Dcdiags for all three servers.
Kindly help me so that i b able to reinstall new HDD and it can go online again.
<code>---------------------------------------
Server
---------------------------------------

C:\Program Files\Support Tools>dcdiag

Domain Controller Diagnosis

Performing initial setup:
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\SERVER
      Starting test: Connectivity
         ......................... SERVER passed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\SERVER
      Starting test: Replications
         [Replications Check,SERVER] A recent replication attempt failed:
            From FILE-SERVER to SERVER
            Naming Context: DC=ForestDnsZones,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From WDS-SERVER to SERVER
            Naming Context: DC=ForestDnsZones,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From FILE-SERVER to SERVER
            Naming Context: DC=DomainDnsZones,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From WDS-SERVER to SERVER
            Naming Context: DC=DomainDnsZones,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From FILE-SERVER to SERVER
            Naming Context: CN=Schema,CN=Configuration,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From WDS-SERVER to SERVER
            Naming Context: CN=Schema,CN=Configuration,DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         [Replications Check,SERVER] A recent replication attempt failed:
            From WDS-SERVER to SERVER
            Naming Context: DC=icmcpk,DC=local
            The replication generated an error (1908):
            Could not find the domain controller for this domain.
            The failure occurred at 2012-05-04 14:07:13.
            The last success occurred at 2012-05-04 13:48:39.
            1 failures have occurred since the last success.
            Kerberos Error.
            A KDC was not found to authenticate the call.
            Check that sufficient domain controllers are available.
         ......................... SERVER passed test Replications
      Starting test: NCSecDesc
         ......................... SERVER passed test NCSecDesc
      Starting test: NetLogons
         ......................... SERVER passed test NetLogons
      Starting test: Advertising
         ......................... SERVER passed test Advertising
      Starting test: KnowsOfRoleHolders
         ......................... SERVER passed test KnowsOfRoleHolders
      Starting test: RidManager
         ......................... SERVER passed test RidManager
      Starting test: MachineAccount
         ......................... SERVER passed test MachineAccount
      Starting test: Services
         ......................... SERVER passed test Services
      Starting test: ObjectsReplicated
         ......................... SERVER passed test ObjectsReplicated
      Starting test: frssysvol
         ......................... SERVER passed test frssysvol
      Starting test: frsevent
         There are warning or error events within the last 24 hours after the
         SYSVOL has been shared.  Failing SYSVOL replication problems may cause
         Group Policy problems.
         ......................... SERVER failed test frsevent
      Starting test: kccevent
         ......................... SERVER passed test kccevent
      Starting test: systemlog
         An Error Event occured.  EventID: 0x80001778
            Time Generated: 05/04/2012   14:05:39
            Event String: The previous system shutdown at 1:26:31 PM on
         An Error Event occured.  EventID: 0x825A0011
            Time Generated: 05/04/2012   14:07:45
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0x00000457
            Time Generated: 05/04/2012   14:13:40
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0x00000457
            Time Generated: 05/04/2012   14:14:25
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0x00000457
            Time Generated: 05/04/2012   14:14:25
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0x00000457
            Time Generated: 05/04/2012   14:14:38
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0xC1010020
            Time Generated: 05/04/2012   14:16:14
            Event String: Dependent Assembly Microsoft.VC80.MFCLOC could
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:16:14
            Event String: Resolve Partial Assembly failed for
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:16:14
            Event String: Generate Activation Context failed for
         An Error Event occured.  EventID: 0xC1010020
            Time Generated: 05/04/2012   14:16:14
            Event String: Dependent Assembly Microsoft.VC80.MFCLOC could
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:16:14
            Event String: Resolve Partial Assembly failed for
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:16:14
            Event String: Generate Activation Context failed for
         An Error Event occured.  EventID: 0x825A0011
            Time Generated: 05/04/2012   14:22:57
            (Event String could not be retrieved)
         An Error Event occured.  EventID: 0xC1010020
            Time Generated: 05/04/2012   14:22:59
            Event String: Dependent Assembly Microsoft.VC80.MFCLOC could
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:22:59
            Event String: Resolve Partial Assembly failed for
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:22:59
            Event String: Generate Activation Context failed for
         An Error Event occured.  EventID: 0xC1010020
            Time Generated: 05/04/2012   14:22:59
            Event String: Dependent Assembly Microsoft.VC80.MFCLOC could
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:22:59
            Event String: Resolve Partial Assembly failed for
         An Error Event occured.  EventID: 0xC101003B
            Time Generated: 05/04/2012   14:22:59
            Event String: Generate Activation Context failed for
         ......................... SERVER failed test systemlog
      Starting test: VerifyReferences
         ......................... SERVER passed test VerifyReferences

   Running partition tests on : ForestDnsZones
      Starting test: CrossRefValidation
         ......................... ForestDnsZones passed test CrossRefValidation

      Starting test: CheckSDRefDom
         ......................... ForestDnsZones passed test CheckSDRefDom

   Running partition tests on : DomainDnsZones
      Starting test: CrossRefValidation
         ......................... DomainDnsZones passed test CrossRefValidation

      Starting test: CheckSDRefDom
         ......................... DomainDnsZones passed test CheckSDRefDom

   Running partition tests on : Schema
      Starting test: CrossRefValidation
         ......................... Schema passed test CrossRefValidation
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom

   Running partition tests on : Configuration
      Starting test: CrossRefValidation
         ......................... Configuration passed test CrossRefValidation
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom

   Running partition tests on : icmcpk
      Starting test: CrossRefValidation
         ......................... icmcpk passed test CrossRefValidation
      Starting test: CheckSDRefDom
         ......................... icmcpk passed test CheckSDRefDom

   Running enterprise tests on : icmcpk.local
      Starting test: Intersite
         ......................... icmcpk.local passed test Intersite
      Starting test: FsmoCheck
         ......................... icmcpk.local passed test FsmoCheck

----------------------
File-Server
----------------------
C:\Users\Administrator.ICMCPK>dcdiag

Directory Server Diagnosis

Performing initial setup:
   Trying to find home server...
   Home Server = FILE-SERVER
   * Identified AD Forest.
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\FILE-SERVER
      Starting test: Connectivity
         ......................... FILE-SERVER passed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\FILE-SERVER
      Starting test: Advertising
         Warning: DsGetDcName returned information for \\Server.icmcpk.local,
         when we were trying to reach FILE-SERVER.
         SERVER IS NOT RESPONDING or IS NOT CONSIDERED SUITABLE.
         ......................... FILE-SERVER failed test Advertising
      Starting test: FrsEvent
         ......................... FILE-SERVER passed test FrsEvent
      Starting test: DFSREvent
         ......................... FILE-SERVER passed test DFSREvent
      Starting test: SysVolCheck
         ......................... FILE-SERVER passed test SysVolCheck
      Starting test: KccEvent
         ......................... FILE-SERVER passed test KccEvent
      Starting test: KnowsOfRoleHolders
         ......................... FILE-SERVER passed test KnowsOfRoleHolders
      Starting test: MachineAccount
         ......................... FILE-SERVER passed test MachineAccount
      Starting test: NCSecDesc
         Error NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS doesn't have
            Replicating Directory Changes In Filtered Set
         access rights for the naming context:
         DC=ForestDnsZones,DC=icmcpk,DC=local
         Error NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS doesn't have
            Replicating Directory Changes In Filtered Set
         access rights for the naming context:
         DC=DomainDnsZones,DC=icmcpk,DC=local
         ......................... FILE-SERVER failed test NCSecDesc
      Starting test: NetLogons
         Unable to connect to the NETLOGON share! (\\FILE-SERVER\netlogon)
         [FILE-SERVER] An net use or LsaPolicy operation failed with error 67,
         The network name cannot be found..
         ......................... FILE-SERVER failed test NetLogons
      Starting test: ObjectsReplicated
         ......................... FILE-SERVER passed test ObjectsReplicated
      Starting test: Replications
         ......................... FILE-SERVER passed test Replications
      Starting test: RidManager
         ......................... FILE-SERVER passed test RidManager
      Starting test: Services
         ......................... FILE-SERVER passed test Services
      Starting test: SystemLog
         An Error Event occurred.  EventID: 0x00000469
            Time Generated: 05/04/2012   14:01:10
            Event String:
            The processing of Group Policy failed because of lack of network con
nectivity to a domain controller. This may be a transient condition. A success m
essage would be generated once the machine gets connected to the domain controll
er and Group Policy has succesfully processed. If you do not see a success messa
ge for several hours, then contact your administrator.
         An Warning Event occurred.  EventID: 0x8000A001
            Time Generated: 05/04/2012   14:07:11
            Event String:
            The Security System could not establish a secured connection with th
e server firstname.lastname@example.com. No authentication protocol
 was available.
         An Warning Event occurred.  EventID: 0x00000BBC
            Time Generated: 05/04/2012   14:30:34
            Event String:
            Windows Defender Real-Time Protection agent has detected changes. Mi
crosoft recommends you analyze the software that made these changes for potentia
l risks. You can use information about how these programs operate to choose whet
her to allow them to run or remove them from your computer.  Allow changes only
if you trust the program or the software publisher. Windows Defender can't undo
changes that you allow.
         An Warning Event occurred.  EventID: 0x00000BBC
            Time Generated: 05/04/2012   14:30:36
            Event String:
            Windows Defender Real-Time Protection agent has detected changes. Mi
crosoft recommends you analyze the software that made these changes for potentia
l risks. You can use information about how these programs operate to choose whet
her to allow them to run or remove them from your computer.  Allow changes only
if you trust the program or the software publisher. Windows Defender can't undo
changes that you allow.
         ......................... FILE-SERVER failed test SystemLog
      Starting test: VerifyReferences
         ......................... FILE-SERVER passed test VerifyReferences

   Running partition tests on : ForestDnsZones
      Starting test: CheckSDRefDom
         ......................... ForestDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... ForestDnsZones passed test
         CrossRefValidation

   Running partition tests on : DomainDnsZones
      Starting test: CheckSDRefDom
         ......................... DomainDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... DomainDnsZones passed test
         CrossRefValidation

   Running partition tests on : Schema
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Schema passed test CrossRefValidation

   Running partition tests on : Configuration
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Configuration passed test CrossRefValidation

   Running partition tests on : icmcpk
      Starting test: CheckSDRefDom
         ......................... icmcpk passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... icmcpk passed test CrossRefValidation

   Running enterprise tests on : icmcpk.local
      Starting test: LocatorCheck
         ......................... icmcpk.local passed test LocatorCheck
      Starting test: Intersite
         ......................... icmcpk.local passed test Intersite

---------------------
WDS-Server
---------------------
C:\Users\Administrator.ICMCPK>dcdiag

Directory Server Diagnosis

Performing initial setup:
   Trying to find home server...
   Home Server = WDS-SERVER
   * Identified AD Forest.
   Done gathering initial info.

Doing initial required tests

   Testing server: Default-First-Site-Name\WDS-SERVER
      Starting test: Connectivity
         ......................... WDS-SERVER passed test Connectivity

Doing primary tests

   Testing server: Default-First-Site-Name\WDS-SERVER
      Starting test: Advertising
         Warning: DsGetDcName returned information for \\Server.icmcpk.local,
         when we were trying to reach WDS-SERVER.
         SERVER IS NOT RESPONDING or IS NOT CONSIDERED SUITABLE.
         ......................... WDS-SERVER failed test Advertising
      Starting test: FrsEvent
         There are warning or error events within the last 24 hours after the
         SYSVOL has been shared.  Failing SYSVOL replication problems may cause
         Group Policy problems.
         ......................... WDS-SERVER passed test FrsEvent
      Starting test: DFSREvent
         ......................... WDS-SERVER passed test DFSREvent
      Starting test: SysVolCheck
         ......................... WDS-SERVER passed test SysVolCheck
      Starting test: KccEvent
         ......................... WDS-SERVER passed test KccEvent
      Starting test: KnowsOfRoleHolders
         ......................... WDS-SERVER passed test KnowsOfRoleHolders
      Starting test: MachineAccount
         ......................... WDS-SERVER passed test MachineAccount
      Starting test: NCSecDesc
         Error NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS doesn't have
            Replicating Directory Changes In Filtered Set
         access rights for the naming context:
         DC=ForestDnsZones,DC=icmcpk,DC=local
         Error NT AUTHORITY\ENTERPRISE DOMAIN CONTROLLERS doesn't have
            Replicating Directory Changes In Filtered Set
         access rights for the naming context:
         DC=DomainDnsZones,DC=icmcpk,DC=local
         ......................... WDS-SERVER failed test NCSecDesc
      Starting test: NetLogons
         Unable to connect to the NETLOGON share! (\\WDS-SERVER\netlogon)
         [WDS-SERVER] An net use or LsaPolicy operation failed with error 67,
         The network name cannot be found..
         ......................... WDS-SERVER failed test NetLogons
      Starting test: ObjectsReplicated
         ......................... WDS-SERVER passed test ObjectsReplicated
      Starting test: Replications
         ......................... WDS-SERVER passed test Replications
      Starting test: RidManager
         ......................... WDS-SERVER passed test RidManager
      Starting test: Services
         ......................... WDS-SERVER passed test Services
      Starting test: SystemLog
         An Error Event occurred.  EventID: 0x0000041E
            Time Generated: 05/04/2012   14:02:55
            Event String:
            The processing of Group Policy failed. Windows could not obtain the
name of a domain controller. This could be caused by a name resolution failure.
Verify your Domain Name Sysytem (DNS) is configured and working correctly.
         An Error Event occurred.  EventID: 0x0000041E
            Time Generated: 05/04/2012   14:08:33
            Event String:
            The processing of Group Policy failed. Windows could not obtain the
name of a domain controller. This could be caused by a name resolution failure.
Verify your Domain Name Sysytem (DNS) is configured and working correctly.
         ......................... WDS-SERVER failed test SystemLog
      Starting test: VerifyReferences
         ......................... WDS-SERVER passed test VerifyReferences

   Running partition tests on : ForestDnsZones
      Starting test: CheckSDRefDom
         ......................... ForestDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... ForestDnsZones passed test
         CrossRefValidation

   Running partition tests on : DomainDnsZones
      Starting test: CheckSDRefDom
         ......................... DomainDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... DomainDnsZones passed test
         CrossRefValidation

   Running partition tests on : Schema
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Schema passed test CrossRefValidation

   Running partition tests on : Configuration
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Configuration passed test CrossRefValidation

   Running partition tests on : icmcpk
      Starting test: CheckSDRefDom
         ......................... icmcpk passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... icmcpk passed test CrossRefValidation

   Running enterprise tests on : icmcpk.local
      Starting test: LocatorCheck
         ......................... icmcpk.local passed test LocatorCheck
      Starting test: Intersite
         ......................... icmcpk.local passed test Intersite
</code>
Comment: What exactly is an ADC?
Comment: Probably should check to see who has a Global Catalog, too
Comment: @charlesbridge I'd hope that they all hold a copy of the global catalog. The only time it makes sense for a DC to *not* hold a copy of the GC is when the Infrastructure Master needs to function as-expected in a multi-forest/multi-domain situation. In this the server holding the IM role for the forest shouldn't be a GC holder. In all other cases, there's usually not a good reason to leave it off.
Comment: True MDMarra, but it's not a default for some reason.  Someone has to check off the GC box on the DC after a dcpromo.
Comment: It's checked by default in 2008 and later. I'm not sure of OSes earlier than that.
Answer: If I had to guess, I would say that you probably have a screwed up DNS infrastructure.
The easiest thing to do is run DNS on all three Domain Controllers. Have 127.0.0.1 be the last entry in the list for each DC and have the other two DCs listed ahead of it.
Make sure that your clients are configured to use at least two of these, preferably more.
Comment: +1 It's always a DNS issue.
Comment: ok here are some more details
Comment: ok both @MDMarra and charlesbridge here are some more details: only Server is running MS Server2k3 remaining both File-server and WDS-server are running MS Server2k8 and all three servers have global catalog. for the DNS the Server and File-server both are configured as primary DNS servers but the WDS-server is configured as the secondary DNS server. Any tip on how check the DNS?[tag:DNS]
Comment: @mdmarra an ADC means (Additional Domain Controller)
Comment: There is no such thing as an Additional Domain Controller. They're all peers. I also have no idea what you mean by our comment about your DNS configuration.
Comment: sorry i misunderstood the DNS! So where can in start troubleshooting?
Comment: and DNS are configured as you suggested above!
Comment: So each domain controller is configured to use each other before itself? You should update your question with the IP/DNS settings for the network adapters in each domain controller.
Answer: The ForestDNSZones and DomainDNSZones both have their own FSMO Role Holders that were most likely on the Old DC as well.  Please see the article here: http://msmvps.com/blogs/ulfbsimonweidner/archive/2008/07/31/how-many-infrastructure-masters-do-you-have.aspx
Also this KB: http://support.microsoft.com/kb/949257

BAD DC transfering FSMO Roles to ADC


Would there be any alternatives to a Logistic Regression or way to modify the Regression for what I'm looking for?

Question: To provide more information I am looking for an alternative to logistic Regression or a way to modify it. This is because of two reasons:

My data is widely dispersed across the X axis for both my 1s and 0s however there is slightly more 1s the higher the X and slightly more 0s the lower the X. So the probabilities listed in a standard Logistic regression I feel are over/understated on both ends of the X axis.
I'm not very concerned with classifying future outcomes accurately, I'm more concerned in how movement along the X increases the probability for my 1 outcomes.

My main concern with a Logistic Regression is that the starting off point the probability of a 1 is close to 0% while the ending point the probability is 100% (given a positive relationship with the x).
With my data this isn't accurate as the probability of a 1 outcome would never hit 100%. I am wondering if there would a better method for me to utilize that would allow me to map out the relationship between my X variable against my 1 and 0 Y variables? Or a way to modify the regression to take into account that for my max X variable I will never have a 100% probability of getting a 1?
Basically I'm interested in knowing what my probability of a 1 outcome is for my max X while getting an accurate representation of how the probability will change with movement across my X axis.
Edit: Picture for example of a Logistic Regression (Not a picture of my actual data though)
Comment: "My main concern with a Logistic Regression is that the starting off point the probability of a 1 is close to 0% while the ending point the probability is 100% (given a positive relationship with the x)." - this is not a true statement about logistic regression.
Comment: But does the logistic regression run over your data actually predict the probabilities like 100%? That would be the case if you have no negative examples in your data for such cases--so from the data point of view, it is a reasonable answer. If you want to constrain it, you can always do arbitrary things like "rounding down" the probabilities to arbitrary values--it doesn't have much sense, but it illustrates the arbitrariness of such solutions. Better alternative is a Bayesian model, but do you have enough prior knowledge to decide on informative priors?
Comment: *"the starting off point the probability of a 1 is close to 0% while the ending point the probability is 100%"* That fact that this is false, that is already shown in your image. The end points are close but not exactly equal to 0% and 100%.
Comment: Try plotting this with confidence or prediction intervals and see if that eases your concerns. Also, it would help if you could add a plot of your actual data, so we could see exactly what the problem is.
Comment: I am not seeing the problem with logistic regression yet - maybe you underestimate it's flexibility. Does it have to be a parametric model or will lowess do?
Answer:
The probability will not hit 0% or 100% exactly, it approaches them asymptotically.
The uncertainty increases towards the extremes, which you will see if you include confidence intervals in your plot.

For these reasons, this is probably less of a problem than you think. But to answer your question: yes, there are alternatives to logistic regression. Probit regression is one, though it may actually be worse given your concerns, because the curve will approach the extremes more rapidly than with the logistic. GAMs can be used for binary data too. And even simpler, you can just use a moving-window mean.
Comment: A moving window mean typically performs less well than a logistic regression in a spline of X.
Answer:
My data is widely dispersed across the X axis for both my 1s and 0s
however there is slightly more 1s the higher the X and slightly more
0s the lower the X. So the probabilities listed in a standard Logistic
regression I feel are over/understated on both ends of the X axis.

I feel you have misunderstood logistic regression.  The model is fit to your data, so if at extremes of your training data you don't approach 0/100% in the raw data, then you won't with logistic regression either. But clearly if your training data is between +/-1 there will be some range outside your data set where you approach 0/100%, maybe its at +/-10, maybe its at +/-100...


Analytical solution to the equation $\sin(n \theta) / \sin(m \theta) = a$.

Question: I'm looking for an analytical solution to the equation $$\frac{\sin n\theta}{\sin m\theta}=a \quad (n,m\in\mathbb Z)$$
where the constant $a$ is real and can be both positive and negative.
The solution is needed for the unknown $\theta$; the rest of the parameters are known.
One approach I took was to write the sine functions as $\sim (e^{i x} - e^{-ix})$
which resulted in a polynomial equation of degrees set by $n$ and $m$, with
no apparent analytical solution.
Is there an alternative route that can be taken, even by using special functions?
Comment: You can write, using the Gauss hypergeometric function, $$
\frac{{\sin (n\theta )}}{{\sin (m\theta )}} = \frac{n}{m}{}_2F_1\! \left( {\frac{{1 + n/m}}{2},\frac{{1 - n/m}}{2};\frac{3}{2};\sin ^2 (m\theta )} \right).
$$ Now you may use series reversion to write ${\sin ^2 (m\theta )}$ as a power series in $a$. This can then be easily solved for $\theta$.
Comment: You use the power series of ${}_2 F_1$ and the [inversion](https://en.wikipedia.org/wiki/Lagrange_inversion_theorem).
Comment: I don't see what did you mean by analytical solution? Do you want to solve 'n' and 'm' in terms of a ?
Comment: @Gary How does one get this identity? Is it something standard? What surprises me is that the LHS might have a pole for $\sin(m \theta)=0$, but the RHS doesn't or am I missing something?
Comment: Substitute $x=\ln(w)$ to get a quadrinomial equation and use [this method](https://math.stackexchange.com/questions/4815107/is-there-any-way-to-solve-for-k-given-beta-sin-k-k-n-sin-k-nk-0/4816925#4816925) for a series solution
Comment: I want to solve for $\theta$, given the rest of the parameters.
Comment: @SeverinSchraven You are correct, the identity is true only if $|m\theta|<\pi/2$.
Comment: @Gary Sorry, I know nothing about the hypergeometric function except that is defined as a power series around the origin in the last coordinate. So if that identity holds and I sent $\theta$ to $\pi/(2m)$, then the RHS will converge to the constant term of the power series expansion of the hypergeometric function, but the LHS will blow up (for the correct choice of $n,m$). Maybe we need a bit more distance to the bad point? Or where am I going wrong?
Comment: @SeverinSchraven If $\theta=\pi/(2m)$ then $\sin(m\theta)=1$ so there is no blowup on the LHS. On the other hand there is a branch point of the hypergeometric function at $1$, so you cannot go beyond this disk of validity.
Comment: @Gary Right. I should go to bed. Thank you for your patience
Comment: Thanks much @Gary, @Severin! I'll need some time to digest this :)
Comment: @Gary, could you clarify the second step you suggested? Basically, if n, m, and a are known, doesn't the equation turn effectively into solving for z in: $_2 F_1(a,b,c;z) = d$, where all but $z$ is known? If so, is there an analytical way to solve for $z$? I couldn't find an inverse hypergeometric function that could do that. And if not, are you suggesting that the function form $\sin^2(m\theta)$ is important for finding $\theta$?
Comment: That's what I thought I was supposed to do. Thanks again!!
Comment: @Gary I have attempted without success to connect the hypergeometric formula I gave in my solution for $\sin(n \theta)$ to your formula upward for the quotient $\sin(n \theta)/\sin(m\theta)$. Do you know a way to do it ? Said otherwise, what are the general hypergeometric formulas that would give the result ? Thanks in advance.
Answer: You said you have attempted to convert your issue into a polynomial equation. But do you know that there already exists "on the shelf" Chebyshev polynomials of the second kind $U_n$ :
$$\displaystyle U_{n-1}(\cos \theta )=\frac {\sin  n \,\theta}{\sin \theta }$$
giving
$$U_{n-1}(x)=a U_{m-1}(x)$$
which is a $\max(n,m)-1$ polynomial equation in $x:=\cos \theta$, keeping the roots whose absolute values are at most $1$.
Therefore, your question has essentially a negative answer: looking for an explicit analytical formula is elusive, because in general, above degree 4, most polynomial equations do not have "formulas" for their roots...
Remark 1: connection with hypergeometric function $ {}_{2}F_{1}$ (you find it in the Wikipedia article):
$$U_{n}(x)=(n+1)\ {}_{2}F_{1}\left(-n,n+2;{\tfrac {3}{2}};{\tfrac {1}{2}}(1-x)\right)$$
Remark 2: A completely different approach would be to write your equation under a form involving the cardinal sine  function $\operatorname{sinc}$ i.e.,
$$ \frac{\operatorname{sinc}(n \theta)}{\operatorname{sinc}(m \theta)}=\frac{n}{m} a$$
Comment: A similar question [here](https://math.stackexchange.com/q/684154)


Run xterm script from /etc/profile leads to "cannot load font"

Question: I want to auto-start a shell script and therefore I added this line to my /etc/profile:
/bin/su -c "/path/to/my/script" user -

the script itself starts a xterm shell command and output following error during autostart:
xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'

=> if I manually start the xterm script I have no problems
How can I solve this issue?
Comment: Looking at tags I assume you are using a RedHat flavour. In this case your default shell is most likely BASH and you should take in consideration .bash_profile file. https://serverfault.com/questions/782433/how-to-run-a-shell-scripts-at-every-login-in-centos
Answer: Added the script to ~/.bash_profile solved the problem for me. No User change is needed. (Thanks to @user2965433)

So just append:
/path/to/my/script

to ~/.bash_profile of the desired user.


How are names of enharmonic notes determined?

Question: In our current 12TET system, is it really incorrect to refer to E♭ as D♯ if one mentions them standalone with no reference to tonality? I understand how the notes in a diatonic scale are named but I don't know whether there's a specific rule of thumb when it comes to naming them on the chromatic scale?
Perhaps an ascending chromatic scale has sharps and descending has flats? Any help would be appreciated!
Answer:
is it really incorrect to refer to E♭ as D♯ if one mentions them
  standalone with no reference to tonality?

If there's really "no reference to tonality," then the naming system is arbitrary, so E♭ and D♯ basically can be used interchangeably.

Perhaps an ascending chromatic scale has sharps and descending has
  flats?

When simply writing out chromatic scales, this is often the convention used.  Partly this is used because it avoids excessive accidentals (e.g., when ascending, one can write the natural form of a note and then the sharp, whereas if one wrote an ascending line using flats, the flat form would have to come first, then followed by a natural, requiring both a flat sign and a natural sign, instead of just one sharp for a similar passage -- you'd need about twice as many accidentals, including all the naturals, to write it the other way).
This desire for fewer accidentals can influence other notational choices, even outside of tonality.  For example, if one were writing out a trill-like figure moving from D up a half step, it would be more efficient to write "D-E♭-D-E♭-D" etc. rather than writing a string of D-naturals and D-sharps one after each other.  On the other hand, a neighbor tone before an E would be easier to write as a D♯ (i.e., E-D♯-E) for similar reasons.
The other issue is that even outside of tonality, sometimes a sharp or flat is preferred because of where the note leads to (or, less often, where it is coming from).  Sharps generally lead up, while flats lead down.
And sometimes it's helpful to choose accidentals based on the context, often to show a familiar interval or chord, even in an atonal piece.  For example, a leap from E♭ to A♯ can be hard to read, but write it as E♭ to B♭ and it can be easily identified as a perfect fifth.  (This can be particularly helpful for singers and instruments that have flexible pitch, like many string instruments, to be able to make connections and see common intervals to sing/play in tune.)  Similarly, if a chord is actually meant to sound like a major chord, it makes little sense to write it as D♯-G-B♭ rather than the more straightforward spelling as an E♭ chord.
That said, when working in a completely atonal context, some composers make arbitrary choices like using all sharps, regardless of context.  That can give some consistency as well, at the occasional expense of inefficiency in situations like those discussed above.
Comment: @awelotta: I'll admit that I've not done a survey of pieces that exclusively use one whole-tone scale (and I don't think many exist, as they tend to sound somewhat static harmonically -- instead, a whole-tone scale is more commonly used for effect in a section within a larger piece, or sometimes composers switch between the two versions of the scale).  Anyhow, I don't think there's necessarily consistency beyond trying to make things "easy to read," which in the whole-tone scale often means sticking with either sharps or flats for a particular version of the scale.
Comment: What sort of notation is preferred for using the whole tone scale? Is it mostly arbitrary as with completely atonal music, or is there some logic similar to the direction of tonality or with conserving sharps?
Answer: In total isolation, D♯ or E♭ are equally feasible. One is no more important or correct than the other. I guess since E♭ is found far more often than D♯, it may be used more. Guitarists may beg to differ!
It's really when a note ( that note here) is encountered in music that its name becomes more specific. It's rare to encounter D♯ in a lot of the flat keys, as that note will almost inevitably already be named E♭, and in sharp keys, it will more than likely be named D♯.
Depending on what harmony it presents in a piece will usually be the decider as to its name. For example, in C diminished, it'll be called E♭, whereas in G augmented it's D♯.
There are times - more and more as we get older, when writers will decide that convenience and clarity overpower technical correctness, and end up calling it its 'wrong' name, which actually makes reading easier. And at the end of the day, that's the no.1 job of written music. Analysis isn't usually the first thing one does with written sheet music!
Answer: In this kind of situation, I tend to label the black-key notes
C♯ E♭ F♯ G♯ B♭
The reason is that F♯, C♯ and G♯ are the first three sharps coming up in the circle of fifths, and B♭ and E♭ the first flats. These are thus particularly common, whereas e.g. D♯ is only the fourth sharp.
G♯/A♭ is the border case. I prefer G♯ because as a string instrument player I have some preference for sharp-keys, but G♯ is the third ♯ and A♭ the third ♭ so it's truely a matter of taste.


Curious folder on the root of volume on windows server 2008

Question: We have just set up a new windows 2008 R2 server with three separate raid arrays as drives C:, F: and I:. After installing all the windows updates and Trend Micro anti virus, we see at the root of our F: volume a folder named "c323e2a243c313f307e247fd" containing only an empty folder named "Sandbox". It has unique security applied
Where might it have come from? And what if we delete it?
Answer: These folders are often created by Windows when applying updates.  I have seen them created both on C: drives and on additional drives.  I wouldn't delete it, but then I don't like to delete anything unless I have to.  A hard lesson learned.