Como colocar efeito no texto assim que o usuário rola a pagina

Question: Queria colocar o efeito de quando ele o usuário fosse descendo os textos na div aparecem subindo, aqui está um site que eu queria colocar essa função
HTML
<!DOCTYPE html>

    <title>Pagina inicial</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="estilo.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">

Inicio

Contato

Consultar preços

                    <button></button>
                    <button> </button>

Relatos dos clientes

Cliente Lorem ipsum

                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Cliente Lorem ipsum

                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Cliente Lorem ipsum

                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
                        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                        cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                        proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Nossos Preços

Lorem ipsum dolor<

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

                    <button class="botao">Veja mais</button>

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

                    <button class="botao">Veja mais</button>

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

Lorem ipsum dolor

                    <button class="botao">Veja mais</button>

 Facebook

 Instaram

 Yotube

CSS
*{padding: 0;margin: 0;}

body{
    background-color:#F2F2F2;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

ul{
    list-style: none;
    margin: 0;
    padding: 0;
}

.conteudo{
    width: 90%;
    /*border: 1px solid red;*/
    margin: 0 auto;
}

.navegacao{
    overflow-x: auto;
    background-color: #B33B3B;
    /*#9C1B1B*/

}

.navegacao li{
    float: left;
    /*margin-left: 300px;*/
}

.navegacao a{
    text-decoration: none;
    display: block;
    padding: 14px 16px;
    color: white;
    /*text-align: right;*/
    text-align: left;
}

.ativo{
    background-color: #7B3939;
}

.img-carrousel{
    width: 100%;
}

.carrousel-conteudo{
    display: none;
}

.ativado{
    display: block;
}

.flex-conteudo{
    display: flex;
    flex-direction: row;
     align-items: flex-start;
}

.caixa{
    width: 50%;
    /*background-color: red;*/
    /*margin-right: 30px;*/
}

.img-fluida{
    width: 100%;
}

.texto-formatado{
    text-align: justify;
    text-indent: 20px;
    margin-right: 10px;
}

.subtitulo-relato{
     font-size: 2.5rem;
    font-weight: 300;
    /*line-height: 1.2em;*/
}

.espacamento{
    margin-top: 30px;
    margin-bottom: 30px;
}

.titulo-relato{
    font-size: 3.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.preco{
    width: 33.3%;
    margin: 10px;
    text-align: center;
}

.titulo-preco{
    background-color: #D8D8D8;
    padding: 10px;
    font-weight: 400;
    text-align: center;
}

.botao{
    padding: 10px;
    border-radius: 10px;
    border: none;
    width: 100%;
    background-color: #fff;
    border-color: ;
    color: #693623;
    margin-top: 10px;
    outline: none;
    cursor: pointer;
    display: block;
    border: 1px solid #693623;
}

.botao:hover{
    background-color: #693623;
    color: white;
}

@media (max-width: 900px){
    .caixa, .preco,.conteudo{
        width: 100%;
        margin: 0;
        /*border: 1px solid red;*/
    }
    .flex-conteudo{
        flex-direction: column;
    }
    .caixa img{
        display: none;
    }
    .caixa{
        margin-bottom: 10px;
    }
}

Answer: Você consegue fazer esse efeito facilmente utilizando as bibliotecas wow.js e animate.css


Fourier synthesis of periodic signals

Question: I was reading the Fourier synthesis of periodic signals
But I didn't understand the sentence i.e. "Although  the calculation of $a_0, a_1, b_1, a_2, b_2$,  is a mathematically straightforward process, it may become rather tedious depending on the complexity and the discontinuities of $f(x)$

So can anybody explain about what is mean by discontinuities in the $f(x)$ ?

Also, how Fourier synthesis takes care of factors like different phase values  , different amplitude values and different frequency values of sinusoidal signals ?

![enter image description here][2]
Answer:
factors like different phase values

$A\sin x +B\cos x = C \sin (x+\phi)$
Or complex coefficients for $e^{i\omega t}$ convention

different amplitude values

Fourier transform/series are a linear transformation. You can multiply the series by a constant and its transform (forward or reverse) will be multiplied by the same constant.

different frequency values

$a_0$ refers to constant ($0$ frequency)
$a_1$ refers to component with frequency equal to original signal's period
$a_5$ refers to component with frequency equal to original signal's period/5

discontinuities in the f(x)"

https://en.wikipedia.org/wiki/Gibbs_phenomenon
Other than that, it is not complicated at all.
Comment: sir, will you explain it for example given in the question?
Comment: explain what?__
Comment: how will you represent above signal using sum of sinusoidal signals? you can take any amplitude values.
Comment: I can't just look at a signal with my eyes and and tell you the answer...
Comment: sir i have added new signal waveform now.Please go through it.
Comment: why down voted?

Fourier synthesis of periodic signals


intuition behind finding fixed lines

Question: OK, so if we have a a linear transformation $\phi_C$ described with the matrix $C$  in the extended Euclidean plane $E_2^*$ I understand why for finding fixed points we find Eigen-values and we form
$$
  (C-\lambda E) \begin{pmatrix}
    x\\
    y\\
    t
  \end{pmatrix}=\begin{pmatrix}
    0\\
    0\\
    0
  \end{pmatrix}
$$
But the process for finding coordinates of a fixed line is using the inverse matrix with the coordinates of the line being put before the matrix:
$$
  [u_1, u_2, u_3](C^{-1}-\lambda E)=\begin{pmatrix}
    0\\
    0\\
    0
  \end{pmatrix}
$$
What's the intuition behind this and why is the multiplication of the coordinates of the line before the matrix and why are we finding the inverse matrix?
Thanks in advance!
Answer: The vectors that represent lines are covariant—they don't transform the same way that points do.
A point $\mathbf p$ is on the line $\mathbf l$ iff $\mathbf l^T\mathbf p=0$. If we have the invertible point transformation $\mathbf p'=C\mathbf p$ then $$\mathbf l^T\mathbf p = \mathbf l^TC^{-1}C\mathbf p = (C^{-T}\mathbf l)^T(C\mathbf p) = (C^{-T}\mathbf l)^T\mathbf p'$$ therefore the line transforms as $\mathbf l'=C^{-T}\mathbf l$. Because of all those transposes, it's convenient to represent lines as row vectors, in which case the line transformation is $\mathbf l' = \mathbf lC^{-1}$.

intuition behind finding fixed lines


set size and position in flutter text field,which is the way

Question:
SizedBox(
                  width: double.infinity,
                  child: TextField(
                    decoration: InputDecoration(
                        hintStyle: TextStyle(height: 12),
                        isDense: true,
                        hintText: "Buraya yazın...",
                        border: OutlineInputBorder(
                          borderSide: BorderSide.none,
                          borderRadius: BorderRadius.circular(10),
                        ),
                        fillColor: Color(0xFFD8DDE0),
                        filled: true),
                  ),
                ),

how can i make this text field anyone can help me?
I tried to adjust the height of the text, but its position is centered, how can I make this text field this time?
Comment: Add your code snippet
Comment: please add  this  property "   maxLines : 4   "  inside the TextField
Answer: Use textAlign to align the text at the start and you can use the maxLines property of TextFormField to adjust its height.
Code Snipped:
TextFormField(
  maxLines: 8,
  textAlign: TextAlign.start,
  decoration: InputDecoration(
     hintText: "Buraya yazın...",
     fillColor: const Color(0xFFD8DDE0),
     filled: true,
     border: OutlineInputBorder(
        borderSide: BorderSide.none,
        borderRadius: BorderRadius.circular(15),
      ),
    ),
  ),

Answer: use maxlines properties and remove height from hintstyle
Output :-

Code:-
TextField(
          maxLines: 5,
          decoration: InputDecoration(
              isDense: true,
              hintText: "Buraya yazın...",
              border: OutlineInputBorder(
                borderSide: BorderSide.none,
                borderRadius: BorderRadius.circular(10),
              ),
              fillColor: Color(0xFFD8DDE0),
              filled: true),
        ),

Answer: Try below code:
TextField(
      textAlignVertical: TextAlignVertical.top,
      maxLines: 6,
      decoration: InputDecoration(
        isDense: true,
        hintText: "Buraya yazın...",
        border: OutlineInputBorder(
          borderSide: BorderSide.none,
          borderRadius: BorderRadius.circular(10),
        ),
        fillColor: Color(0xFFD8DDE0),
        filled: true,
      ),
    ),

Result Screen->


Why are marathon runners so tactical? Any reasonable reason?

Question: I wonder why marathon runners are so tactical.
As far as I watch them on TV, there seems no doubt to me
that they control their pace according to that of others.
I just suspect it would be better if they ignored others and focused their attention
on their own pace so that they could finish in the shortest possible time.
Why are marathon runners so tactical?
Any reasonable reason?
Comment: The goal is not to finish in the shortest possible time but to finish at the highest possible position.
Comment: Why race faster than you need to in order to win?
Comment: To finish at the highest possible position, you need to finish in the shortest possible time.
Comment: Maybe someone who actually runs long distance can chime in, but my understanding is that drafting is a factor like in cycling or auto racing.
Comment: The shortest possible time may be significantly lower than the time needed to win, and unless all runners are separated by intervals less than we can measure (which is absurd) every position has a range of values in which finishing faster does nothing to change the runner in that position.
Answer: Marathons are a competitive sport.  Runners want to finish with both the best time they can manage and ahead of other runners.  Long distance running is a juggle managing your energy and reserves while not hurting yourself.
Runners often find that the competition of pacing someone produces an overall pace a little faster than they might have thought possible.  Pacing the person directly behind you keeps him or her behind you.  As the runner in front you might find that you can maintain your position at a slightly easier pace, that is with less injury.  Even if the final time is only a second difference you are still ahead in the field (you know, 233rd instead of 234th out of 500).  Pacing a person in front of you keeps him or her in catching distance either at the end or at another key point like a water stop.
Drafting is when one runner is literally tailing the runner directly in front of him or her.  There is a benefit to drafting, but just like in cycling, constant drafting is both poor sportsmanship and dangerous.
Despite running being a solitary sport, it's still a competitive sport.  Your body has a little more energy with the motivation of a competitor.
Answer:
One would almost never know who are more prepared while running a marathon as opposed to many other physical sports.

The time is long and almost anything can happen to anyone. Therefore, almost nobody is there to "pose".

Usually we would section it into 4-8 parts, every 5km and every 10km.

The first 5 to 10km is to get ahead of the crowd.

The first two 10km sections are usually to get it done (following the group leader(s) - in whatever group one would be running).

The third 10km is a bit difficult to get ready for the final 10km.

Everything is in the final 5km and 10km, and I'd say 5km.

There is a good point in this answer about injuries.

I just suspect it would be better if they ignored others and focused their attention on their own pace so that they could finish in the shortest possible time.

That has been done before while practicing.

Every marathon is different, weather (temperature, humidity), roads, participants and the list goes on.


How to save data like value and key?

Question: I want to build an app to report revenues and expenses.
And I want to keep data like how much money comes in, when and how.
And build structured categories like 1 cola = -1.5 $ and the like. And when I close the app and restart the cell phone, the data is still saved. I'm only a beginner developer so I got stuck in the step of keeping data
And now what I'm trying to do is use SharedPreferences to save the budget, and then print it in TextView. And it does not work.
MY ACTIVITY:
public class Report extends AppCompatActivity {

Button mButton1;
EditText mEdit;
TextView mText;
Button mButton;

SharedPreferences menaPref;
SharedPreferences.Editor editor;

public static final String MY_PREFS_NAME = "My Money";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_report);

    mButton = (Button) findViewById(R.id.B_GetMoney);
    mEdit = (EditText) findViewById(R.id.T_InputMoney);
    mText = (TextView) findViewById(R.id.textView);
    mButton1 = (Button) findViewById(R.id.B_try);

    mButton.setOnClickListener(

            new View.OnClickListener() {
                public void onClick(View view) {
                    String value = mEdit.getText().toString();
                    ;

                    SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode
                    SharedPreferences.Editor editor = pref.edit();

                    editor.putString("My Money", value);
                    String Show_My_Money = pref.getString("My Money", null);

                    mText.setText(Show_My_Money);

                }

            });

}

}

Answer: You need to .commit() or .apply() the changes made to the editor first after you put something in it.
editor.putString("My Money", value);
editor.commit()
pref.getString("My Money", null);

Answer: You must use commit() or apply() to save your data ;)
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", 0); // 0 - for private mode
                    SharedPreferences.Editor editor = pref.edit();

                editor.putString("My Money", value);
                editor.commit();

Refer to this documentation:
https://developer.android.com/reference/android/content/SharedPreferences.Editor.html
Answer: Create a class PrefHelper
public class PrefHelper{

private static final String PREF_NAME = "my_pref";

public static final String MY_MONEY= "my_money";
// put your others key here

Preferences() {
}

public static void writeBoolean(Context context, String key, boolean value) {
    getEditor(context).putBoolean(key, value).commit();

}

public static boolean readBoolean(Context context, String key) {
    return getPreferences(context).getBoolean(key, false);
}

public static void writeString(Context context, String key, String value) {
    getEditor(context).putString(key, value).commit();
}

public static String readString(Context context, String key) {
    return getPreferences(context).getString(key, null);
}

private static SharedPreferences getPreferences(Context context) {
    return context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}

private static SharedPreferences.Editor getEditor(Context context) {
    return getPreferences(context).edit();
}
}

and just for read and write use these methods
// for write data
PrefHelper.writeString(getApplicationContext(), PrefHelper.MY_MONEY, "500 $");

// for read data
String money = PrefHelper.readString(getApplicationContext(), PrefHelper.MY_MONEY);

Comment: thanx, you know maybe how am i could to build report like: time: 1:30 am Category: Food

How to save data like value and key?


What are the (philosophical) assumptions behind GMM and Maximum Likelihood Estimation?

Question: As stated in the question.
In particular, how does a researcher know when to apply which estimation method and are there any examples that can show when one case is more appropriate than the other?
Maybe not just in terms of practical usage as in here, but also in terms of the philosophical basis and assumptions being made.
Comment: The origin of science is historically a subset of philosophy. The historical etymology of the Greek word 'philosophy' is philo ("love") plus sophia ("wisdom, A.K.A. knowledge"). The proper application of statistics to data is the extraction of order in chaotic systems and very much a search for knowledge.
Comment: https://stats.stackexchange.com/questions/112451/maximum-likelihood-estimation-mle-in-layman-terms/112480#112480
Comment: I do not understand how the choice of a statistical estimation technique relates to Philosophy...
Answer: Main idea in GMM is to have a bit relaxed view concerning data generation process since one does not need to specify full parametric density as in maximum likelihood estimation.
And there are possibilities to formulate theories which can be tested if they specify certain moment conditions.
Here is some discussion by LP Hansen who introduced this method to econometrics.
http://www.larspeterhansen.org/documents/2007_GMM_BookPDE_Generalized_Method_of_Moments_Estimation.pdf
This GMM actually looks quite a bit like M/Z - estimators in statistics.
Comment: GMM estimators are in fact a special case of M-estimators where the quantity being minimized is a quadratic form of the moment conditions.


Balls in a separable metric space

Question: Let $X$ be a separable metric space and let $(r_i)$ be a sequence of positive reals. Denote by $(x_n)$ a countable dense subset of $X$. Is it true that $X=\bigcup_{n=1}^\infty K(x_n, r_n)$?
Comment: So $K(x_n,r_n)$ is the open ball $B(x_n,r_n)$ I imagine.
Comment: Sure, the open ball.
Comment: What is true and somehow related is that the countable set of all open balls $B(x_n,2^{-k})$ for $n\geq 1$ and $k\geq 1$ is a basis for the topology induced by the metric, making it second countable. In particular, of course, $X=\bigcup_{n,k}B(x_n,2^{-k})$.
Answer: No. Take $X=\mathbb R$, $x_n$ to be the rationals and $r_i=2^{-i}$.
Comment: Is it clear that some irrational doesn't belong to the union?
Comment: @usao This set has finite measure.
Comment: The measure can be made as small as you wish!

Balls in a separable metric space


Dúvida em filtrar uma Query no SQL

Question: Como que eu posso filtrar uma Query para que não apareça os "Clientes" com mais de um telefone, que no caso seria o Carlos como segue a imagem abaixo. Estou quebrando a cabeça e não acho em lugar nenhum na net este comando.
Desde-já agradeço!

Query em causa:
SELECT      C.IDCLIENTE
        ,   C.NOME
        ,   C.SEXO
        ,   E.BAIRRO
        ,   T.TIPO
        ,   T.NUMERO
FROM        CLIENTE C
INNER JOIN  ENDERECO E ON C.IDCLIENTE = E.ID_CLIENTE
INNER JOIN  TELEFONE T ON C.IDCLIENTE = T.ID_CLIENTE

Answer: Acho que o metodo do Joao deve funcionar, mas nao vejo o porque de fazer um outro inner join, eu o faria assim:
SELECT      C.IDCLIENTE
        ,   C.NOME
        ,   C.SEXO
        ,   E.BAIRRO
        ,   T.TIPO
        ,   T.NUMERO
FROM        CLIENTE C
INNER JOIN  ENDERECO E ON C.IDCLIENTE = E.ID_CLIENTE
INNER JOIN  (   SELECT      T1.IDCLIENTE
                        ,   T1.TIPO
                        ,   T1.NUMERO
                FROM        TELEFONE T1
                GROUP BY    T1.IDCLIENTE
                HAVING      COUNT(1) <= 1
            ) T ON T.IDCLIENTE = C.IDCLIENTE

Estou fazendo um inner join com o que eu quero dos resultados da tabela Telefone, ou seja, me interessam somente os dados onde não exista mais de um IDCLIENTE igual na tabela TELEFONE.
Não testei o código, mas acho que esteja correto. Pelo menos a ideia do que se deve fazer você já tem
Comment: Ah sim, muito obrigado.
Answer: Penso que desta forma conseguirá chegar ao que pretende:
SELECT      C.IDCLIENTE
        ,   C.NOME
        ,   C.SEXO
        ,   E.BAIRRO
        ,   T.TIPO
        ,   T.NUMERO
FROM        CLIENTE C
INNER JOIN  ENDERECO E ON C.IDCLIENTE = E.ID_CLIENTE
INNER JOIN  TELEFONE T ON C.IDCLIENTE = T.ID_CLIENTE
INNER JOIN  (
                SELECT      C.IDCLIENTE
                        ,   COUNT(1)
                FROM        CLIENTE     C
                INNER JOIN  TELEFONE    T ON C.IDCLIENTE = T.ID_CLIENTE
                GROUP BY    C.IDCLIENTE
                HAVING      COUNT(1) <= 1
            ) C2 ON C2.IDCLIENTE = C.IDCLIENTE

Não testei no MySQL, mas penso que a sintaxe está correta.
Comment: Funcionou amigo, pô muito obrigado, tenho que estudar mais pois tem algumas coisas que você fez que eu não estudei ainda. Obrigado mesmo.
Comment: Ola Paulo, esse método do Joao, apesar de funcionar não tem uma boa performance, devido a quantidade de joins feitos que poderiam não existir.

Dúvida em filtrar uma Query no SQL


How to close port 80 in windows vista?

Question: i have a virtual machine with OS server 2003
connection bridged
i need to test if the webapplication on guest webserver will be available for users on the network, so i need to close port 80 on vista while still open on win server 2003, however, i can't close port 80 on vista
Comment: Which virtualization software are you using?
Comment: @Massimo: i am using vm player
Answer: If you are using a bridged connections, then the virtual machine will have its own IP address on the same network the host system is connected to. So, opening and closing ports on the host system should have no relationship at all to which ports are available to the guest system.
This could change if you are using some form of NAT for your virtual machine networks; but definitely not if you are using a bridged connection.
About your question: port 80 is usually used by IIS on Windows system, so you should check if it's installed and running; if this is the case, you can either stop IIS (by stopping the "World Wide Web Publishing Service") or uninstall it from "Programs and Features", provided you don't actually need it, of course.
If IIS is not installed and/or not started, then something else is using port 80; you can use the command netstat -nao to check the PID of the owner process, and then use the Task Manager (by adding the PID column to the process list) to check which process is associated with that PID.
Comment: @mokokamello that is what network bridging means in a VMware environment, the Virtual Nics bypasses most of the host's network stack, and blocking ports at a higher layer in the host (such as closing TCP port 80 on the hosts ip-addresses) has no effect on what VMware's bridging is doing at the network layer, or in the guest. On more recent operating systems, and with certain software firewalls that act at a lower level this might not be true, as explained in this vmware KB article http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004813
Comment: a friend of mine is not convinced with your opinion, can you provide an evidence
Comment: imean evidence that assures that VM ware can use the hardware regardless the setting of host OS
Comment: @Helvick: is there a way to bypass software / firewalls acting on lower levels.
Comment: @mokokamello - It depends on the implementation, that VMware link explains how to bypass the low level firewall on Vista\7\2008 if it is interfering with VMware Workstation\Player functionality, for other OS's or software firewalls that operate at lower levels there may be (probably will be) methods but they will be specific to each situation.
Answer: I am sorry, but VMWare company confess that the situation is different with windows vista
Troubleshooting blocked inbound network traffic on Windows Vista or 2008 after installing a VMware product
Symptoms
* Inbound network traffic stops after installing a VMware product.
* Networking fails.
*
  Blocked TCP/IP ports.
*
  Problems with networking on a Windows Vista or 2008 host.

Purpose
This article describes how to re-establish inbound network traffic to a computer with a Microsoft Vista or 2008 operating system that used to receive this traffic but suddenly stopped after a VMware product was installed.
Resolution
In some cases, the installation of a VMware product to a computer with a Microsoft Vista or 2008 operating system prevents all inbound networking traffic from reaching the computer. This is caused by the Windows Firewall assigning the VMware virtual NICs to the Public network.
Inbound networking traffic can be re-enabled by performing one of four corrective procedures.  Which procedure is performed depends on your environment and business requirements.  Each corrective procedure below has a summary of reasons for and against its use.
Reconfigure the Windows Firewall
This procedure requires extensive knowledge of the Windows Vista or 2008 operating system and its implementation of the Windows Firewall. Doing this ensures a permanent solution resulting in no unexpected behaviour in either the Windows operating system or the VMware product in use. Any description of the tasks required are beyond the scope of this article. For more information, refer to Windows operating system documentation.
Note: Only perform this if you have an in depth understanding of Windows Firewall.
Note: Modifying the access rules for the Public network will affect all NICs that belong to the Public network.
Move the VMware virtual NICs to the Private network
This procedure is simple to perform and has the least impact on both the Windows Vista or 2008 operating system and the VMware product in use. However, after any reboot of the operating system the NICs are moved back to the Public network again. Using this procedure requires supervision of the operating system to ensure that it is performed after every reboot.
To move the VMware virtual NICs to a Private network:

Click Start > Control Panel > Network and Sharing Center.
Click Customize.
Click Private.
Click Next.
5.
  Click Close.

Disable the VMware virtual NICs
This procedure is simple to perform, but it prevents both NAT and Host Only networking from functioning in any virtual machine. Only Bridged networking is available. If neither NAT nor Host only networking is required, this is the simplest and most permanent procedure.
To disable the VMware virtual NICs:

Click Start > Control Panel > Network and Sharing Center.
2.
  Click Manage network connections.
3.
  Click VMware Network Adapter / VMnet1 / Unidentified network.
4.
  Click Disable this network device.
5.
  Click VMware Network Adapter / VMnet8 / Unidentified network.
6.
  Click Disable this network device.

Redefine the VMware virtual NICs as endpoint devices
This procedure is permanent and allows for the continued use of Bridged, NAT, and Host Only networking. However, doing this causes the VMware virtual NICs to disappear from the Network and Sharing Center, even though they remain visible under Network Connections. This also causes the VMware virtual NICs to be exempt from all Windows Firewall access rules. When implemented, the control of virtual machine network access must be done from the guest operating system of each virtual machine. This bypasses the default security model of Windows Vista with respect to the the VMware virtual NICs, and the implications of using this procedure must be carefully considered.
To redefine the VMware virtual NICs as endpoint devices:

Click Start > Run.
2.
  Type regedit and click OK.
3.
  Double-click HKEY_LOCAL_MACHINE>System>CurrentControlSet>Control>Class>{4D36E972-E325-11CE-BFC1-08002BE10318}.
Caution: VMware recommends that you back up this registry key before proceeding:
 1.
    If {4D36E972-E325-11CE-BFC1-08002BE10318} is not still highlighted, click it.
 2.
    Click File > Export.
 3.
    Pick a location and name for the Registration File (*.reg) .
 4.
    Click Save.

4.
  Click 0000.
5.
  Look at the content of the Data field associated with the DriverDesc entry.
6.
  If you see VMware Virtual Ethernet Adapter for VMnetx , where x is replaced by a number, then:
 1.
    Right-click an empty space in the right content pane.
 2.
    Click New > Dword.
 3.
    Type *NdisDeviceType and press Enter.

    Note: Ensure to include the asterisk (* ) at the beginning of the entry.

 4.
    Double-click *NdisDeviceType.
 5.
    Type 1 and press Enter.

7.
  Repeat steps 4-6, replacing 0000 in step 4 with the next entry in numerical order, until you have reached the end of all numerical entries.
8.
  Follow the Disable the VMware virtual NICs section of this article above.
9.
  Repeat step 8 but click Enable this network device instead.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004813
Answer: I think thhis may also imply on your case,
But I am sure now that VMWare on windows 7 connects far away from the Kernel of the Windows, that add space for firewalls to act

How to close port 80 in windows vista?


Why does waitForKeyElements need another timeout for Google search results?

Question: The following script does what I want it to do but not as fast as I'd like it to do it.  :-)
The goal is always show the search tools that become visible when the Search Tools button is clicked on Google Search results.
I can't get waitForKeyElements to work without applying a timer.
WaitForKeyElements was made for this purpose so I feel like I'm missing something.
This script works, sort of, but takes too long and seems brittle:
// ==UserScript==
// @name        GollyJer's Expand Google Search Tools
// @namespace   gollyjer.com
// @version     1.0
// @include      /^https?\:\/\/(www|news|maps|docs|cse|encrypted)\.google\./
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant       GM_addStyle
// ==/UserScript==

function expandSearchTools () {
    // Fires too soon?
    // var searchToolsButton = document.getElementById("hdtb-tls");
    // searchToolsButton.click();

    // Working but distracting.
    setTimeout(
        function(){
          var searchToolsButton = document.getElementById("hdtb-tls");
          searchToolsButton.click();

    }, 1000);
}

waitForKeyElements ("#ires", expandSearchTools);

Comment: You cannot get something that is not on the page yet.
Comment: Isn't that the purpose of waitForKeyElements?  It waits until the element exists, then fires? hdtb-tls is already on the page when ires reloads.
Comment: So it waits until `#ires` appears. Is `#hdtb-tls` there already after that?
Comment: Thanks @zerkms  Your comment caused me to rethink and devise a better solution.
Answer: Sometimes it's not enough to wait for a particular element, to click it. Sometimes you must also allow the javascript associated with that element to initialize.
This can be difficult on pages like Google's, where the javascript is very involved and not (easily) human readable.
A general way around this, when clicking nodes is to check for the expected effect of the click, and repeat the click until that happens.
In this case, the click is supposed to open the Search tools bar.  So we can check to see if that happens and keep clicking until the page's click event handler is ready and responds.
This also adds a timer, but it is faster and more flexible than the one-shot delay in the question.
It also has the advantage that, since we use the page's expected inputs to change things, the page's javascript won't get out of sync with the page or enter an unexpected state (crash, in the worst case).
Checking for the expected effect works in the general case, when a simple click is not working:
// ==UserScript==
// @name        GollyJer's Expand Google Search Tools
// @include      /^https?\:\/\/(www|news|maps|docs|cse|encrypted)\.google\./
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant       GM_addStyle
// ==/UserScript==

waitForKeyElements ("#hdtb-tls", clickNodeTilItSticks);

function clickNodeTilItSticks (jNode) {
    var srchToolBar = $("#hdtbMenus")[0];
    var sanityCount = 1;
    var menusVisiblePoller = setInterval ( function () {
            if (sanityCount < 20  &&  srchToolBar.offsetWidth === 0  &&  srchToolBar.offsetHeight === 0) {
                var clickEvent  = document.createEvent ('MouseEvents');
                clickEvent.initEvent ('click', true, true);
                jNode[0].dispatchEvent (clickEvent);
            }
            else {
                clearInterval (menusVisiblePoller);
            }
            sanityCount++;
        },
        88
    );
}

Comment: Brock.  Not sure if you'll see my github comment so posting here as well.
https://gist.github.com/BrockA/2625891
Comment: OK, I have to ask... why 88?
Comment: By the way... Thanks!  This works perfectly and answers the question directly.
Comment: You're welcome!  As for 88, I only did a few sanity checks on that value. It *should* work in all cases, but I did not test it rigorously.  Still, many people consider the number 8 to be lucky and 88 as well. :)
Comment: Thanks.  Still not getting Gist emails, though the ones from main GitHub come through just fine.  Anyway, I replied at gist.github.com.  Use whatever works for you.
Answer: OK, figured out a slightly different path with much more reliable results...
Clicking the Search Tools button does a few things in the DOM, but the most important for this issue is replacing one of the classes on #hdtbMenus which causes the search tools to show instead of the result count.
Simply changing this class myself has proven much more reliable.
This code now works great.
// ==UserScript==
// @name        GollyJer's Expand Google Search Tools
// @namespace   gollyjer.com
// @version     1.0
// @include      /^https?\:\/\/(www|news|maps|docs|cse|encrypted)\.google\./
// @require     http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant       GM_addStyle
// ==/UserScript==

// Hide the Search Tools button.
GM_addStyle("#hdtb-tls { display: none !important; }");

// Remove the menu animation for "instant" change to the menu.
GM_addStyle("#hdtbMenus { transition: none !important; }");

// Show the Search Tools menu.
waitForKeyElements ("#hdtbMenus", expandSearchTools);
function expandSearchTools (jNode) {
    jNode.removeClass("hdtb-td-c hdtb-td-h").addClass("hdtb-td-o");
}

Comment: Your answer is probably fine in this particular Google  case.  But this approach won't always work, generally, because the JS's internal state might track those classes and assume that they are unchanged (causing unexpected behavior).  Or, the click might create elements and/or other code -- rather than merely unhiding some nodes.
Comment: Good point.  The click event definitely wasn't reliable though.  Glad to have found the workaround in this case.


carregar div com ajax sem erro nas respostas

Question: estou com um problema com meu script ajax, a função dele é pegar o cep digitado e trazer os valores dele via API , porem ele esta apresentando um erro que nao consigo resolver, ao digitar o cep completo ele mostra exatamente as informações mas elas desaparecem em seguida! então como estou utilizando o método .keyup, ao apertar qualquer botão, as informações voltam a aparecer na tela e ai sim elas ficam fixas, quando o cep esta incompleto ou errado, ele me mostra a mensagem "nada encontrado" e quando o cep esta correto, ele retorna os valores do cep, mas como citei a cima, ao digitar o cep inteiro, ele mostra todas as informações e em uma fração de segundos, volta a mensagem "nada encontrado", entao ao apertar qualquer tecla, volta a mostrar os dados e finalmente fica fixo.
ja modifiquei o codigo varias vezes e nao consegui descobrir o erro, testando com o html e o ajax da o erro, testando com o arquivo php, nao da nada errado, entao creio que seja meu codigo ajax
$("document").ready(function(){
$(".cep").keyup(function(){

    var cep = $(".cep").val();
    console.log(cep);

            $.ajax({
                url: "content/plugin/cep/cep.php",
                type: "POST",
                data: {cep: cep},
                cache: false,

                success: function(res){

                    if(res.codigo == "1"){

                    $('.bairro').html('');
                    $('.bairro').html(res.resposta);
                    console.log(res.resposta);
                    return false;
                    }else if(res.codigo == "0"){

                    $('.bairro').html(res.resposta);

                    }
                }

            });

    });

});

cep.php

<?php

function busca_cep($cep){
    $resultado = @file_get_contents('http://republicavirtual.com.br/web_cep.php?cep='.urlencode($cep).'&formato=query_string');

    parse_str($resultado, $retorno);
    return $retorno;
}

$ceps = htmlspecialchars($_POST['cep']);
$resultado_busca = busca_cep($ceps);

$log   = $resultado_busca['tipo_logradouro'];
$logr  = $resultado_busca['logradouro'];
$bai   = $resultado_busca['bairro'];
$cid   = $resultado_busca['cidade'];
$uf    = $resultado_busca['uf'];

if($uf == null){
    $retorno2['codigo'] = 0;
$retorno2['resposta'] = "
Nada encontrado
";

                         header('Content-type: application/json');
                         echo json_encode($retorno2);
                         return false;
}else{
    $retorno2['codigo'] = 1;
$retorno2['resposta'] = "
$log $logr $bai $cid $uf
";

                         header('Content-type: application/json');
                         echo json_encode($retorno2);
                         return false;
   }
?>

Comment: voce está rodando fora de um servidor quando faz o teste só em Ajax?
Comment: rodei so o arquivo php e retornou certo os dados, mas quando junto com o ajax e o html, da esse bug
Answer: O ideal sera você usar a função blur() do jquery para realizar o ajax.
A função do keyup() é de observar cada mudança do input, ou seja, cada tecla digitada, sendo assim seu ajax esta fazendo uma request cada vez que o usuário digita uma letra.
A função blur() é ativada apenas quando o usuário seleciona "outro campo" para preencher, ou seja, quando ele já terminou aquele campo em que estava, sendo assim, a requisição ajax só acontecera uma vez que é quando ele terminar de digitar.
Você também pode verificar a quantidade de caracteres no input antes de fazer a requisição ajax;
$('.input').keyup(function() {
    var length = $(this).val().length;
    // 8 é a quantidade de caracteres minima de um cep
    if (length >= 8) {
        // ... a requisição ajax
    }
});

Veja funcionando no JsFiddle
Comment: @JonnysJ. o `blur` vai funcionar quando o usuário trocar o foco do input; se ele clicar fora (não necessariamente em outro input) vai ativar, se der tab e etc, fiz uma alteração conforme seu comentario.
Comment: intendo man, porem nao existe outro campo a ser preenchido ate a resposta retornar, tem apenas 1 campo 'cep' , quando este campo retorna ok, ai libera os outros campos, do contrario, todos os outros campos ficam desativados, tem como eu colocar o blur() ser ativado somente quando o input estiver com determinado numero de caracteres?
Comment: eu tambem poderia colocar um botao com a função click() mas e que eu gostaria de deixar o mais dinamico possivel, bem botoes
Comment: eu tambem poderia tirar o keyup() e colocar algum tipo de contador de caracteres, por exemplo, se campo .cep tiver 8 caracteres, ai ele ativa o ajax, e assim eu acho que pode aparar de dar erro, pq ira fazer apenas uma consulta, mas eu nao tenho ideia como fazer essa função, estou pesquisando agora
Comment: eu testei com o blur e deu certo! entao realmente o problema e com o keyup, mas ainda sim eu precisava de outro metodo sem click, pq o blur so funciona se eu preencher a caixa e clicar em qualquer outro lugar, diferente do keyup que preenche a caixa automaticamente, se tiver que clicar, e melhor colocar um botao para facilitar o entendimento para o usuario.
Comment: @JonnysJ. você pode usar o keyup como no exemplo que coloquei.
Answer: bom pessoal, graças a o @Rafael Acioly, ele me deu uma ideia de ativar o ajax somente quando o campo cep for totalmente preenchido, bom fiz uma pequena alteração no codigo e finalizei da seguinte forma, a função php de buscar o cep so é ativada se o campo cep tiver exatamente 9 digitos ( contando com o '-' que separa os numeros ) do contrario, nao faz nada, o ajax envia sempre as informações mas o php barra ate ter exatamente oque ele precisa, isso ajudou ate pq se o usuario apagar algum numero do cep, ele bloqueia os campos ate o usuario preencher os campos de novo, e o usuário também pode mudar o cep sem dar nenhum erro no formulario. bom nao sei se no brasil temos ceps fora do padrao 99999-999, se tivermos, meu codigo nao vai funcionar :(
segundo esse site Padrao CEP Brasileiro, meu codigo vai funcionar!
irei postar o codigo para o pessoal que precisar
cepajax.js

$("document").ready(function(){

$(".cep").keyup(function(){

    var leg = $(this).val().length;
    console.log(leg);

    $('.bairro').html('Procurando');
    var cep = $(".cep").val();
    console.log(cep);

            $.ajax({
                url: "content/plugin/cep/cep.php",
                type: "POST",
                data: {cep: cep, leg: leg},
                cache: false,

                success: function(res){

                    if(res.codigo == "1"){

                    $('.bairro').html(res.resposta);
                    console.log(res.resposta);
                    $('.msg_input').addClass('disableding');
                    return false;
                    }else if(res.codigo == "0"){

                    $('.bairro').html(res.resposta);
                    $('.msg_input').removeClass('disableding');
                    return false;
                    }
                }

            });

});

});
cep.php
<?php

function busca_cep($cep){
    $resultado = @file_get_contents('http://republicavirtual.com.br/web_cep.php?cep='.urlencode($cep).'&formato=query_string');
parse_str($resultado, $retorno);
return $retorno;

}
$leg = $_POST['leg'];
$ceps = $_POST['cep'];
if ($leg == 9 ){
$resultado_busca = busca_cep($ceps);

$log   = $resultado_busca['tipo_logradouro'];
$logr  = $resultado_busca['logradouro'];
$bai   = $resultado_busca['bairro'];
$cid   = $resultado_busca['cidade'];
$uf    = $resultado_busca['uf'];
if($uf == null){
    $retorno2['codigo'] = 1;
$retorno2['resposta'] = "
Nada encontrado
";

                         header('Content-type: application/json');
                         echo json_encode($retorno2);

}else{
    $retorno2['codigo'] = 0;
$retorno2['resposta'] = "
$log $logr $bai $cid $uf
";

                         header('Content-type: application/json');
                         echo json_encode($retorno2);

}

} else {
$retorno2['codigo'] = 1;
$retorno2['resposta'] = "
Nada encontrado
";

                         header('Content-type: application/json');
                         echo json_encode($retorno2);

}
?>


Action Bar show after loading screen

Question: I made a loading screen/splash screen and deactivated the action bar in the styles.xml (with NoActionBar). But I want to have the Action Bar back after the loading screen is finished. I tried a method but after I applied this the app stops after the time that I set in the activity for the splash screen. So know I want to know what I can do that it function.
This is my code for the splash screen:
package com.example.jan.jhmtest;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

public class StartSreeen extends AppCompatActivity {

private TextView tv;
private ImageView iv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_start_sreeen);

        tv = (TextView) findViewById(R.id.textView2);
        iv = (ImageView) findViewById(R.id.imageView5);

        Animation myanmin = AnimationUtils.loadAnimation(this, R.anim.mytransition);

        tv.startAnimation(myanmin);
        iv.startAnimation(myanmin);

        final Intent i = new Intent(this, MainActivity.class);

        Thread timer = new Thread(){
            public void run(){
                try {
                    sleep(5000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                finally {
                    startActivity(i);
                    finish();
                }
            }
        };
        timer.start();
    }
}

And this is the code for the Main acitvity
package com.example.jan.jhmtest;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toolbar;

public class MainActivity extends AppCompatActivity {

    Toolbar toolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        toolbar =(Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(getResources().getString(R.string.app_name));
    }
}

Answer: The reason Your App is not rendering Toolbar is because your not setting toolbar as a action bar . sounds confusing right but bear with me and follow these steps .
you set

parent="@style/Theme.AppCompat.Light.NoActionBar" as a parent theme for your global app settings , this is the reason your splash has no action bar . Great this is what you wanted

Now for the rest of the screen you want toolbar as your action bar so lets just assume you add a toolbar to your layout like this
<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?android:attr/actionBarSize"
    android:background="@color/material_animations_primary"
    android:elevation="5dp">

Now your code I can see That initialised the toolbar properly like this
toolbar =(Toolbar) findViewById(R.id.toolbar);

but what you did wrong is not setting this toolbar as a support actionbar
N.B ToolBar is part of support library which is replacement Actionbar to make actionBar Backward compatible
FIX
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

this will render your toolbar as actionbar
for more details follow this blog post -> Using the App Toolbar
Comment: I did this and then it says at setSupportActionBar(toolbar) it cannot be appield to v7.widdget.Toolbar

Action Bar show after loading screen


How to move blobs from App_Data folder of episerver cms site to azure blob storage hosted in azure cloud

Question: How to move blobs stored in App_Data folder of episerver cms website to azure blob storage, hosted in azure cloud environment?
Comment: Does the `EPiCode.BlobConverter` library provided by Ted Nyberg could help you to solve your issue? If you encounter any issue when using this lib or you could provide more details (e.g. programmatically or manually move your blobs to azure blob storage) about your scenario for us to help you achieve your purpose.
Answer: There is a blob converter package on NuGet which migrates blobs from disk to another provider, e.g. Azure blob storage.


Fitting Poisson Distribution To Censored Data Repeat Experiments

Question: I am working on analyzing some data that come from the following experimental setup:
Imagine doing repeated trials of an experiment where a lever is pulled and a random number shows up drawn from a poisson distribution with parameter $\lambda$ (here representing the expected number/trial). Unfortunately you are really bad at reading numbers and so you are only able to ascertain if the number was 0 or $\ge 1$. What you are interested in though is deriving $\lambda$ from this censored data set.
For a single fixed value of $\lambda$ the current literature approach to solving this problem is to do the following: run the trials a large number of time and count how many times $\ge 1$ comes up and ratio that to the number of trials let's call this $\mu$. $\mu$ is then set equal to 1 - $p_0$ (the probability of getting 0) because it represents the sum of the probabilities of having gotten 1, 2, 3, etc and solved for $\lambda$ by the definition of the poisson distribution: $\lambda = -ln(1-\mu)$.
My question is this: is there a way to solve this problem if $\lambda$ is free to vary from trial to trial and I only care about getting the average value of $\lambda$?
As a note I realize the literature procedure doesn't work if $\lambda$ is large and so the experiments are usually configured to avoid that.
Answer: Perhaps to belabor the obvious: The success of estimating $E(\lambda)$ depends on the variability
of $\lambda.$
I tried a simulation in R choosing $\lambda \sim \mathsf{Gamma}(6, rate = 2),$ so that $E(\lambda) = 3.$ Then generating Poisson values with
such values of $\lambda$ gives a sample of $Y_i$s with mean near 3, but
the distribution of $Y$ is not $\mathsf{Pois}(3),$ and in particular
$P(Y=0) \ne e^{-3}.$
set.seed(1234)
m = 10^6
y = rpois(m, rgamma(m, 6, 2))
mean(y);  var(y)
[1] 3.001025
[1] 4.505838
mean(y==0)
[1] 0.088019
dpois(0, 3)
[1] 0.04978707

hist(y, prob=T, br=(-1:21)+.5, ylim=c(0,.25), col="skyblue2")
  points(0:21, dpois(0:21, 3), col="red")

By contrast, if $\lambda \sim \mathsf{Unif}(2.9,3.0),$ so that
$E(\lambda) = 3,$ with very little variability, then it seems
possible to estimate $E(\lambda)$ from $P(Y = 0).$
set.seed(1235)
m = 10^6
y = rpois(m, runif(m, 2.9, 3.1))
mean(y);  var(y)
[1] 2.998847
[1] 3.004599
mean(y==0)
[1] 0.049865
dpois(0, 3)
[1] 0.04978707

Comment: Thank you very much for that. My own thoughts were converging on a similar thought but wanted to be sure. I just wish the answer were different.


Surjective Morphism of sheaves

Question: I am currently working on surjective morphisms of sheaves and trying to understand the subtleties connected to the need for sheafification of the presheaf image.
By definition (e.g. in Hartshorne) $\beta: \mathcal{F} \to \mathcal{F}''$ is surjective iff $im(\beta) = \mathcal{F}''$.
In some posts, I read that this is equivalent to: For every open $U\subset X$ there is an open cover ${U_i}$ of $U$ s.t. there are $t_i \in \mathcal{F}(U_i): \beta(U_i)(t_i) = s|_{U_i}$.
I do not know how to prove this equivalent definition of surjectivity; I think that the sheafification of the presheaf image is crucial, however, I cannot find a way to explicitly show it.
Comment: Note $\beta$ is surjective iff the induced morphism on stalks $\beta_p : \mathcal{F}_p \to \mathcal{F}_p''$ is surjective. This will be useful in proving equivalence.
Answer: Assume $\beta$ is surjective and $U$ is open in $X$. Let $s\in \mathcal{F}''(U)$. If $p\in U$ the induced map $\beta_p$ on stalks is surjective, so there is a germ $t_p\in \mathcal{F}_p$ such that $\beta_p(t_p) = s_p$. Let the pair $(V, t)$ represent germ $t_p$. There is an open neighborhood $U_i$ of $p$ contained in $U\cap V$ such that $\beta(U_i)(t|_{U_i}) = s|_{U_i}$. Hence $U$ is covered by open sets $U_i$ for which there are sections $t_i\in \mathcal{F}(U_i)$ satisfying $\beta(U_i)t_i = s|_{U_i}$.
Conversely, suppose the covering condition holds. If $U$ is open in $X$ and $s\in \mathcal{F}''(U)$, then there is a cover $\{U_i\}$ of $U$ and sections $t_i\in \mathcal{F}(U_i)$ such that $\beta(U_i)(t_i) = s|_{U_i}$. If $p\in U$, then $p\in U_i$ for some $i$, and $\beta_p((t_i)_p) = s_p$. Thus $\beta_p$ is surjective. Since $p$ was arbitrary, $\beta$ is surjective.

Surjective Morphism of sheaves


Kernel of the tangent map

Question: If $\varphi:U\subset \mathbb{R}^n \to \mathbb{R}^m$ is $C^1$, let $\mathrm{T}\varphi:\mathrm{T}U \to \mathrm{T}R^m$ be its tangent map. The inverse function theorem tells us that if $\ker(\mathrm{T}\varphi(x))$ is zero, $\varphi$ is injective in some neighborhood of $x$. If the kernel is non-zero, what can we say about $\varphi$ near $x$ provided we know the kernel? In particular, can we say anything about curves through $x$ whose tangents belong to this kernel?
Comment: @Mariano: I don't know if mmm is in this position, but it can be difficult for someone unfamiliar with a particular field to know if their question related to it is a simple one with a concrete answer, or a fundamental problem upon which books have been written. Perhaps the best response in such a case is to leave a comment saying "Your question is a fundamental problem in [name of field]. A good reference is [citation of textbook]."
Comment: You can consider the Constant Rank Theorem: http://en.wikipedia.org/wiki/Derivative_rule_for_inverses#Constant_rank_theorem
Comment: You should be more concrete about what you want to know. Books have been written and careers built upon the study of singularities of smooth maps, so unless you are more specific it is hard to know what you are after!
Comment: @Rahul, but s/he is familiar with what he wants to know! "What can we say about X?" is quite non-descriptive about what he wants to know.
Comment: @Pierre-Yves, I would be happy if you would add that as an answer.
Comment: @mmm Thanks for your invitation. I've just posted an answer. I hadn't done it before because I hadn't received the notification of you comment.
Comment: The inverse function theorem says a bit more: $\varphi$ will be a diffeomorphism on a connected open subset of $U$.
Answer: As Wikipedia says:
"The inverse function theorem (and the implicit function theorem) can be seen as a special case of the constant rank theorem, which states that a smooth map with locally constant rank near a point can be put in a particular normal form near that point."
See http://en.wikipedia.org/wiki/Derivative_rule_for_inverses#Constant_rank_theorem
The Constant Rank Theorem is stated as Theorem (7.1) p. 47 of An Introduction to Differentiable Manifolds and Riemannian Geometry, Revised Second Edition, William M. Boothby, Academic Press. (This is the reference given by Wikipedia.)
Here is, for the reader's convenience, a statement of the Constant Rank Theorem.
Let $k,n$ and $r$ be positive integers, let $a$ be in $\mathbb R^n$, let $b$ be in $\mathbb R^k$, let $f$ be a smooth map from a neighborhood of $a$ to $\mathbb R^k$ sending $a$ to $b$, and let $\ell$ be the linear map from $\mathbb R^n$ to $\mathbb R^k$ sending $x$ to $(x_1,\dots,x_r,0,\dots,0)$. Assume that the rank of the tangent map to $f$ at $x$ is equal to $r$ for all $x$ in our neighborhood of $a$.
Then there is a diffeomorphism $g$ from a neighborhood of $a$ to a neighborhood of 0 in $\mathbb R^n$, and a diffeomorphism $h$ from a neighborhood of 0 in $\mathbb R^k$ to a neighborhood of $b$, such that the equality $f=h\circ\ell\circ g$ holds in some neighborhood of $a$.
EDIT OF MARCH 19, 2011
Here is a statement and a proof of the Constant Rank Theorem.

Theorem. Let $U$ be open in $\mathbb{R}^n$, let $a$ be a point in $U$, and let $f$ be $C^p$ map ($1\le p\le\infty$) of rank $r$ from $U$ to $\mathbb{R}^k$. Then there are open sets $U_1,U_2\subset\mathbb{R}^n$, $U_3\subset\mathbb{R}^k$ and $C^p$ diffeomorphisms $\varphi:U_1\to U_2$, $\psi:U_3\to U_3$ such that $a\in U_1$ and $(\psi\circ f\circ\varphi^{-1})(x)=(x_1,\dots,x_r,0,\dots,0)$ for all $x$ in $U_2$.

Proof. For $$x\in\mathbb{R}^r,\quad y\in\mathbb{R}^{n-r},\quad(x,y)\in U$$ write
$$f(x,y)=(f_1(x,y),f_2(x,y)),\quad f_1(x,y)\in\mathbb{R}^r,\quad f_2(x,y)\in\mathbb{R}^{k-r}.$$
We can assume that $\partial f_1(x,y)/\partial x$ is invertible for all $(x,y)\in U$. Define $$\varphi:U\to\mathbb{R}^n,\quad(x,y)\mapsto(f_1(x,y),y).$$ By the Inverse Function Theorem, there are open sets
$$U_1\subset\mathbb{R}^n,\quad U_4\subset\mathbb{R}^r,\quad U_5\subset\mathbb{R}^{n-r}$$ such that $a\in U_1\subset U$, $\varphi$ is a $C^p$ diffeomorphism from $U_1$ onto $U_2:=U_4\times U_5$, and $U_5$ is connected.
Then $f(\varphi^{-1}(x,y))=(x,g(x,y))$ for some $C^p$ map $g$ from $U_2$ to $\mathbb{R}^{k-r}$. As $\partial g/\partial y=0$, we can write $g(x)$ for $g(x,y)$, and it suffices to set $U_3:=U_4\times\mathbb{R}^{k-r}$ and $\psi(u,v):=(u,v-g(u))$ for $ u\in U_4$ and $v\in\mathbb{R}^{k-r}.$
Comment: While true, the constant rank condition is not usually satisfied in mmm's set-up, unless the map $\varphi$ already has maximal rank. Generically the map $\varphi$ won't have maximal rank in any neighbourhood of $x$ if its rank at $x$ is less than $\min(m,n)$.
Comment: @Robin Chapman : Your comment has been split into 5 comments. I mentioned the Const. Rk Thm in a comment to the question, and the OP kindly asked me to add it as an answer. I agree that my answer has not even an atom of originality, I'm sure there are more clever things to say about this, and I'd read with pleasure any further comment or answer you, or other users, may make. [I don't know if I'm the only one to see 5 comments instead of one, but otherwise, it would be clearer for the reader if you fixed that.]
Comment: Pierre-Yves, I'm a bit sceptical about how useful the constant rank theorem is. As far as I can see it won't be applicable in very many circumstances, save for the maximal rank case where it reduces to the familiar characterization of immersions and submersions....
Comment: @Robin Chapman - If I understand you correctly, you want statements which hold GENERICALLY. That was not the way I understood the question. Why don't you explain this genericity issue in an answer? Same thing for
"the familiar characterization of immersions and submersions" that you mention. [I just thought it couldn't hurt to state the Constant Rank Theorem, but I know that it doesn't answer all the questions.]

Kernel of the tangent map


Prove $\int_0^\infty \frac{dx}{x^{1/\alpha}(x+1)}$ goes to zero along countour circling branch point.

Question: Background: This is part of the countour integration problem where you show that the circle IV goes to zero as $\epsilon \to 0$. The branch cut is x>0, and solving the integration is not the question, It's proving the small circle goes to zero. Circle II goes to zero following the same proof as below, but I don't see how to show circle IV$\to 0$: $$\lim_{\epsilon \to 0}\int_0^{2\pi}\lvert\frac{\epsilon e^{i \theta} i d\theta}{\sqrt[\alpha]{\epsilon} e^{i \theta/\alpha}(\epsilon e^{i \theta}+1)}\rvert\le$$
$$\lim_{\epsilon \to 0}\int_0^{2\pi}\frac{\epsilon d\theta}{\sqrt[\alpha]{\epsilon} (\epsilon-1)}$$ After two applications of l'hopital's rule I get $\frac{\epsilon^{-1/\alpha}(\alpha-1)}{(1+\alpha)}$ which goes to infinity. What did I do wrong? Am I going about this wrong?
Answer: The key is to have
$$
\lim_{r\to0}\frac{2\pi r}{r^{1/a}}=0
$$
so you need $1-\frac1a\gt0$. That would be $a\lt0$ or $a\gt1$.
The $2\pi r$ is the circumference of the small circle and $r^{-1/a}$ is the absolute value of $\frac1{x^{1/a}}$ on the circle.
The factor of $\frac1{x+1}$ is near $1$ close to the branch point.
Comment: Of course. For the integral to disappear along the outer circle, we would need $a\gt0$, which would then imply that $a\gt1$.
Comment: a>1 in the problem description. Forgot to include that because I wasn't working on the integral anymore.


How To Add Field In Registration Page

Question: In user page, I want to add more field like username, contact number and address. What is the common way to do it?
Answer: You can either use Profile2, or you can add your fields in /admin/config/people/accounts/fields.
From Profile2 project page:

Designed to be the successor of the core profile module, which is
  deprecated for Drupal 7. In
  contrast to the deprecated module this module provides a new,
  fieldable 'profile' entity - leverage the power of fields!

You can find out how to create profiles in Profile2 documentation

How To Add Field In Registration Page


How to write Jest transformIgnorePatterns

Question: I have this excpetion
Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    C:\Code\SPFx\BCO\node_modules\@microsoft\sp-core-library\lib\index.js:11
    export { default as _BrowserDetection } from './BrowserDetection';
    ^^^^^^

    SyntaxError: Unexpected token export

      19 | } from 'office-ui-fabric-react/lib/Utilities';
      20 | import { IUserProvider } from "../UserProviders/IUserProvider";
    > 21 | import {
         | ^
      22 |   Environment,
      23 |   EnvironmentType
      24 | } from '@microsoft/sp-core-library';

      at ScriptTransformer._transformAndBuildScript (node_modules/jest/node_modules/jest-runtime/build/script_transformer.js:403:17)
      at Object.<anonymous> (src/webparts/BCO/components/EmployeeSelector/EmployeeSelector.tsx:21:1)
      at Object.<anonymous> (src/webparts/BCO/components/FieldMapping/FieldMapping.tsx:13:1)

And tried these transformIgnorePatterns expressions in config.json
"transformIgnorePatterns": [
  "\\node_modules\\@microsoft\\sp-dialog",
  "\\node_modules\\@microsoft\\sp-core-library",
  "node_modules/(?!sp-core-library)",
  "node_modules/(?!@microsoft/sp-core-library)"
],

and none of them worked. I run this on Windows 10 so I tried also this format
Comment: Anyone have a clue how to resolve this issue?  In my case, I have components that extend Vuetify components (aka import { VDataTable } from 'vuetify/lib').  The JEST documentation is seriously lacking on this complex configuration.  More practical, common examples would be helpful.
Comment: Try `"@microsoft[/\\]sp-dialog"` or more likely `"@microsoft[/\\\\]sp-dialog"`. I believe it needs to be double escaped here.
Answer: The transformIgnorePatterns means if the test path matches any of the patterns, it will not be transformed.
Note: DO NOT SPLIT MULTI-LINES.
The jest will ignore all node_modules via default.
So you must write like this:
"transformIgnorePatterns": [
  // all exceptions must be first line
  "/node_modules/(?!@microsoft/sp-core-library|sp-dialog|other_libs_need_transform)"
],

Answer: Actually, it seems like typescript is not going well with JEST test cases, so what i feel like either JEST need to ignore those files or those packages need to be transpiled to js code which JEST can understand,
you can try this
"transformIgnorePatterns": [ "node_modules/(?!(@microsoft/sp-core-library))" ],

and in tsconfig.json
"allowJs": true,

for more details please check this post
https://github.com/SharePoint/sp-dev-docs/issues/2325#issuecomment-446416878
Comment: just want to highlight from this answer the `"allowJs": true` at `tsconfig.json`. In my case this was exactly what I was missing and no one was mentioning it. Thanks @Vinay !
Answer: I had a similar error while working on a project with jest, webpack, and vanilla js, so that error is thrown when jest encounters this line of code import '../css/styles.css';  in any /*?.js$/ file.
I solved it by moving the jest configurations from the package.json file into a jest.config.js file with the following minimal configuration:
// jest.config.js
module.exports =
  "moduleNameMapper": {
    "\\.(css|less|scss)$": "identity-obj-proxy"
  }
}

Then in babel.config.js:
module.exports = {
  presets: [
    [
      '@babel/preset-env',
      {
        targets: {
          node: 'current',
        },
      },
    ],
  ],
};


Erro ao abrir emulador no Android Studio

Question: Estou com um erro aqui no Android Studio, quando vou debuggar a App
no emulador, ele não abre e aparece o seguinte erro:

"emulator: ERROR: x86 emulation currently requires hardware acceleration! Please ensure Intel HAXM is properly installed and usable.
  CPU acceleration status: HAX kernel module is not installed!"

Alguém sabe como resolver isso?
Answer: Como diz a mensagem, você precisa instalar o módulo HAXM.

Abra o SDK Manager
Vá em SDK Tools
Marque a opção do HAXM Installer.
Vá na pasta apontada no seu Android SDK Location e execute o intelhaxm-android.exe para instalar.
Answer: Primeiramente, garante que o HAXM installer está insalado no seu SDK Manager, como na figura a seguir.

Após o download do componente, execute seu insalador via linha de comando:
{SDK_FOLDER}\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe
Observação: No Android Studio, o comando "intelhaxm.exe" fora trocado por "intelhaxm-android.exe"
Se lhe for mostrado o erro "VT not supported" durante a instalação, desabilite o Hiper-V em "Windows Features (Ativar ou desativar recursos do Windows)". Outra maneira de se desabilitar o Hiper-V é executando o seguinte comando: dism.exe /Online /Disable-Feature:Microsoft-Hyper-V. Finalmente, você necessita habilitar "Virtualization Technology" na sua BIOS.
Comment: valeu pela ajuda amigo , fiz o q vc mencionou , mas n consegui instalar o tal haxm :( .. aparece um erro , dizendo q eu tenho q ativar o VT , sendo q ja ativei o mesmo pela bios .. qual será a solução para isso?
Comment: Desculpe a demora em lhe responder... qual mensagem de erro aparece?


Identify first row amongst similar set of data from pandas dataframe

Question: I have a dataframe similar to the one shown below:
    BillNumber Description            LineAmount   TotalAmount
0   INV001     Line Item 1 of INV001  500          700
1   INV001     Line Item 2 of INV001  200          700
2   INV002     Line Item 1 of INV002  100          800
3   INV002     Line Item 2 of INV002  300          800
4   INV002     Line Item 3 of INV002  400          800

What I want is as follows:
    BillNumber Description            LineAmount   TotalAmount  NewBill
0   INV001     Line Item 1 of INV001  500          700          Yes
1   INV001     Line Item 2 of INV001  200          700
2   INV002     Line Item 1 of INV002  100          800          Yes
3   INV002     Line Item 2 of INV002  300          800
4   INV002     Line Item 3 of INV002  400          800

I want to identify the first row of every new BillNumber and mark the value 'Yes' for it under new column named 'NewBill'. How can we achieve this using pandas ?
Thanks in advance.
Answer: Use numpy.where with Series.duplicated:
df['NewBill'] = np.where(df['BillNumber'].duplicated(), '', 'Yes')
print (df)
  BillNumber            Description  LineAmount  TotalAmount NewBill
0     INV001  Line Item 1 of INV001         500          700     Yes
1     INV001  Line Item 2 of INV001         200          700
2     INV002  Line Item 1 of INV002         100          800     Yes
3     INV002  Line Item 2 of INV002         300          800
4     INV002  Line Item 3 of INV002         400          800

Answer: try with
df.loc[df['BillNumber'].duplicated(), 'NewBill'] = 'Yes'


Something like Haskell's MultiParamTypeClasses

Question: I am about to start learning Rust after programming in Haskell.
The trait Keyword interested me however I noticed you can only refer to one type (Self).
In Haskell there is a pragma for this behaviour:
{-# LANGUAGE MultiParamTypeClasses #-}

class ExampleBehaviour a b where
 combine :: a -> a -> b
 co_combine :: b -> b -> a

However I cannot see a way to achive this behaviour organically in Rust.
Comment: Not familiar with Haskell, would this be a generic trait? `trait ExampleBehavior` With some constraints?
Comment: Can you explain what behavior you are after without referencing Haskell? What kind of code would you like to write?
Answer: I think this is what you're looking for:
trait ExampleBehaviour<Other> {
    fn combine(x: Other, y: Other) -> Self;
    fn co_combine(x: Self, y: Self) -> Other;
}

And here's an example of a Haskell instance of that typeclass and a corresponding Rust implementation of the trait:
data Foo = Foo Int Int
newtype Bar = Bar Int

instance ExampleBehaviour Foo Bar where
    combine (Foo x1 y1) (Foo x2 y2) = Bar (x1 * x2 + y1 * y2)
    co_combine (Bar x) (Bar y) = Foo x y

struct Foo(i32, i32);
struct Bar(i32);

impl ExampleBehaviour<Foo> for Bar {
    fn combine(Foo(x1, y1): Foo, Foo(x2, y2): Foo) -> Self {
        Bar(x1 * x2 + y1 * y2)
    }
    fn co_combine(Bar(x): Self, Bar(y): Self) -> Foo {
        Foo(x, y)
    }
}

Comment: @Vye I think it's actually equivalent to omitting the *last* typeclass parameter, but yes, that's the basic idea.
Comment: So to conclude, I would omit the first typeclass parameter and use `Self`?


Relation between bivariate survial function and cumulative density function

Question: I am trying to understand why
$Pr(T_1> t_1,T_2 > 2)=1-F_1(t_1)-F_2(t_2)+F_{12}(t_1,t_2)$
My derivation is as follows:
\begin{align} Pr(T_1> t_1,T_2 > t_2) &=Pr(T_1> t_1\mid T_2> t_2)Pr(T_2> 2)\\&=(1-Pr(T_1\leq t_1\mid T_2> t_2))(1-Pr(T_2\leq t_2))
\end{align}
and
\begin{align} Pr(T_1> t_1,T_2> t_2) &=Pr(T_2> t_2\mid T_1> t_2)Pr(T_2> t_2)\\&=(1-Pr(T_2\leq t_2\mid T_1> t_1))(1-Pr(T_1\leq t_1))
\end{align}
By symmetry (or equality): $Pr(T\leq t_1)=Pr(T\leq t_1\mid T_2> t_2)$ (and likwise for $T_2$).
But, hey does not this imply that $T_1$ and $T_2$ are independent?
Answer: The equality $Pr(T_1\leq t_1)=Pr(T_1\leq t_1\mid T_2> t_2)$ for every $t_1,t_2$ is indeed equivalent to independence of $T_1$ and $T_2$. And the initial equality does not need any independence assumptions. It is an identity.
First, the events $T_1>t_1$ and $T_1\leq t_1$ are the opposite, so
$$
Pr(T_1>t_1, T_2> t_2)+Pr(T_1\leq t_1, T_2> t_2) = Pr(T_2> t_2) = 1-F_2(t_2).
$$
So,
$$
Pr(T_1>t_1, T_2> t_2)= 1-F_2(t_2) - Pr(T_1\leq t_1, T_2> t_2). \tag{1}\label{1}
$$
Next,
$$
Pr(T_1\leq t_1, T_2> t_2) +Pr(T_1\leq t_1, T_2\leq t_2) = Pr(T_1\leq t_1) = F_1(t_1),
$$
so
$$
Pr(T_1\leq t_1, T_2> t_2) = F_1(t_1) - Pr(T_1\leq t_1, T_2\leq t_2) = F_1(t_1)-F_{1,2}(t_1,t_2).
$$
Substitute the last value into \eqref{1} instead of $Pr(T_1\leq t_1, T_2> t_2)$:
$$
Pr(T_1>t_1, T_2> t_2)= 1-F_2(t_2) - \left(F_1(t_1)-F_{1,2}(t_1,t_2)\right) = 1-F_2(t_2) - F_1(t_1)+F_{1,2}(t_1,t_2).
$$
Answer: You can simply find it via De-Morgan's Law. Let $A=T_1>t_1,B=T_2>t_2$
$$P(A\cap B)=1-P(A'\cup B')=1-(P(A')+P(B')-P(A'\cap B'))$$


insert in Linked List Turbo C

Question: I am trying to program a text editor in C. I am having trouble with inserting an element in a linked list. The program simply won't insert anything in the middle of the linked list.
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>

I used singly linked list.
struct node {
struct node *previous;
int c;
int x;
int y;
struct node *next;
}*head;

this works fine:
void characters(int typed, int xpos, int ypos)      //assign values of a node
{
struct node *temp,*var,*temp2;
temp=(struct node *)malloc(sizeof(struct node));
temp->c=typed;
temp->x=xpos;
temp->y=ypos;

if(head==NULL)
{
    head=temp;
    head->next=NULL;
}

else
{
    temp2=head;
    while(temp2!=NULL)
    {
        var=temp2;
        temp2=temp2->next;
    }
    temp2=temp;
    var->next=temp2;
    temp2->next=NULL;
}

}

this works just fine too.
void printer()                          //to print everything
{
struct node *temp;
temp=head;
while(temp!=NULL)
{
    gotoxy(temp->x,temp->y);
    printf("%c",temp->c);
    temp=temp->next;
}

}

this works just fine too:
void deletesEnd                  //delete at the end
{
struct node *temp,*last;
temp=head;
last=temp;
while(temp!=NULL && temp->next!=NULL)
{
    last=temp;
    temp=temp->next;
}
if(last==temp)
    {
        free(temp);
        head=NULL;
    }
else{
free(last->next);
last->next=NULL;
}
}

THIS IS THE PROBLEM:
 void checker(int ch, int xpos, int ypos)
{
int flag=0;
struct node *temp,*temp1,*insert_node;
temp=head;
while(temp!=NULL)
{
    if(temp->x==xpos && temp->y==ypos)
    {
        temp1=temp;
        temp=insert_node;
        insert_node->c=ch;
        insert_node->x=xpos;
        insert_node->y=ypos;
        insert_node->next=temp1;
        flag=1;
        break;
    }

    else
        temp= temp->next;
}
free(temp);
free(temp1);
if(flag==0)
    characters(ch,xpos,ypos);
}

main()
{
int c;                          //for storing the character
int x,y;                    //for the position of the character
clrscr();
for(;;)
{
    c=getch();
    x=wherex();
    y=wherey();
    if(c==27)
        exit(0);

    else if(c==0|| c==224)
    {
        switch(getch())
        {
            case 72:                    //for up
                    gotoxy(x,y-1);
                    break;
            case 80:                    //for down
                    gotoxy(x,y+1);
                    break;
            case 75:                    //for left
                    gotoxy(x-1,y);
                    break;
            case 77:                    //for right
                    gotoxy(x+1,y);
                    break;
         }
    }

    else if(c==13)
    {
        printf("\n");
    }

    else if(c==8)                       //for backspace
    {
            deletesEnd();
            clrscr();
            printer();

    }

    else                        //for normal characters
    {
        checker(c,x,y);
           //   characters(c,x,y);
        printer();
    }
}
}

I tried to debug it, it goes inside the loop with the conditional statement of ((temp->x==xpos && temp->y==ypos)) Thus, the program is supposed to insert an element but it doesn't. :(
Comment: It means it is not entering in the if statements, let me check
Comment: I've checked it seriously - but I found myself unable to find the problem cause, In my opinion it is only possible if your linked list is empty, because only then control flow can skip through if statements, try to validate your x and y position data in your linked list.
Comment: First of all, stop using Turbo C (it is a 20 year old compiler). Also, the code you've written is non-standard C.
Answer: Maybe you have to malloc a struct node for the element you want to insert first, not just declare a struct node *.
Try to add struct node *insert_node = (struct node *)malloc(struct node) in your checker method.
Answer: Try concept of insertion from this one - It can insert a node from front end
Just make a new pointer to node and name it create
struct node *create;

int item;
printf("Enter a number you want to insert\n\t");
scanf("%d",&item);
create = (struct node*)malloc(sizeof(struct node*));
create->info = item;
create->ptr = first;
HEAD = create;

insert in Linked List Turbo C


Every set is a union of singleton sets

Question: Is it possible to prove this statement? What axioms are necessary to conclude that every set on, for instance, $\mathbb{R}$ can be expressed as a union of singleton sets (sets containing exactly one element)?
Let $X=\{x : P\}$ where $P$ is a defining property of the elements of $X$, for instance $P$ can be $x>2$.
Then I can simply state that $$X = \bigcup_{P} X_i$$ where $\{X_i : i \in \mathbb{R_+}\}$ is a collection of all singleton sets of $\mathbb{R}$.
By the way, there are sets of bigger cardinality than of cardinality of all real numbers. In this case, using $\mathbb{R_+}$ as indexes for all singleton sets from such sets wouldn't be sufficient, right?
Comment: @tomasz, I think that also extensionality. See my answer and comment if you want.
Comment: @Martín-BlasPérezPinilla: Yeah, that was a reflexive comment, you need only replacement and union to have the set on the right hand side, but without extensionality, there is no reason for anything to be equal to anything else, so to speak. I've deleted the comment before you posted yours (or at least before I've seen it). ;)
Comment: I'm not sure where this question is going when asking about axioms, but I think this statement is just about as uncontroversial as a statement that involves uncountably infinite sets can possibly be. That is, I very much doubt any non-fringe mathematician is going to question its truth in the slightest.
Comment: What about $\{0,\{0,\{0\}\}\}$?
Comment: @NoahSchweber yes, sorry - corrected.
Answer: Maybe I'm losing some obvious, but I think that in your informal proof you are using at least:
Replacement: The set $Z = \{\{x\}:x\in X\}$ is the image of $X$ by the function  $x\longmapsto \{x\}$.
Union: $\bigcup Z$ is a set.
Extensionality: $X = \bigcup Z$ because both have the same elements.
Comment: @LandonCarter, I'm **not** saying that are equal just *because* their cardinalities match. I'm saying that are equal because both *have the same elements*.
Comment: @LandonCarter: Where do you get that? He clearly says that they have the same elements. (Unless he edited it.)
Comment: Union is not being used here at all, because you already know that the union is a set.  Extensionality is also not really relevant; all it tells you is that $Z$ can't have two _different_ unions. Finally, you need some additional axiom to know that the set $\{x\}$ exists (e.g. Pairing, or the existence of any nonempty set together with Replacement again).
Comment: Your extensionality is probably wrong. You can't say two sets are equal just because their cardinalities match! Even if the two sets are bijective.
Comment: Oh, my bad. Sorry!
Answer: First of all, given two sets $A$ and $B$ we say that
$$\tag{1}
A=B
\quad\Longleftrightarrow\quad
A\subseteq B
~\text{ and }~
B\subseteq A
$$
That is, the sets coincide if every element of $A$ is in $B$ and every element of $B$ is in $A$.
As @MSE says, the intuition is that
$$\tag{2}
  M = \bigcup_{x\in M}\{x\}
\qquad\text{(to be proven)}
$$
To prove this, we shall show that both inclusions hold.
It is convenient to define
$$\tag{3}
\mathscr M := \bigl\{\{x\}:~x\in M\bigr\}
$$
and rewrite $(2)$ as
$$\tag{4}
  M = \bigcup_{S\in \mathscr M}S
\qquad\text{(equivalent to $(2)$, to be proven)}
$$
Now, let $x\in M$, then $\{x\}\in\mathscr M$ by definition $(3)$, and therefore
$
\{x\}\subseteq\bigcup_{S\in\mathscr M}S
$,
which implies
$
x\in\bigcup_{S\in\mathscr M}S
$.
Since $x\in M$ is arbitrary, this proves that
$$
  M \subseteq \bigcup_{S\in \mathscr M}S
$$
Conversely, let $x\in\bigcup_{S\in \mathscr M}S$, then $x\in S$ for some $S\in\mathscr M$.
By definition $(3)$ of $\mathscr M$, there exists $y\in M$ such that $S=\{y\}$.
Since $x\in\{y\}$, it follows that $x=y\in M$.
Again, from the arbitrarity of $x\in\bigcup_{S\in \mathscr M}S$ it follows that the other inclusion holds as well
$$
  \bigcup_{S\in \mathscr M}S \subseteq M
$$
This proves the sought identity $(4)$ and hence $(2)$.
Comment: No objection to your detailed proof, but the OP is specifically asking "what axioms are necessary to conclude...".
Comment: @Martín-BlasPérezPinilla I see.. you are right, I guess I cannot provide an answer to that :(
Answer: Let $M$ an unspecified set. Then, $$M=\bigcup_{x\in M}\{x\}.$$
Comment: You are using at least the union axiom. ("What axioms are necessary to conclude...")
Answer: I don't think the union axiom is needed.
You just need, for every set X, something to guarantee the existence of all singletons of the elements of X.
You can then see that X contains every element of all those singletons and nothing else, and conclude that, by definition of union, it's the union of all the singletons.
The union axiom guarantees the existence of particular union sets (the ones containing all elements of the elements of a set); it's not needed to allow the existence of sets that happen to be the union of other sets.
Example: if we accept the infinity axiom and the empty set axiom, we can say the set {{},{{}}} exists; for either the pair axiom or restricted comprehension, {{}} and {{{}}} also exist.
Let a set be an union of a family of sets if it contains all of the elements of the sets of the family and nothing else.
We can then see that {{},{{}}} is union of {{}} and {{{}}}.
So, if I didn't miss anything, my answer to:
"What's needed to prove that any set is union of the family of singletons of its elements?"
is:
"Either the pair axiom, or the axiom of restricted comprehension."
edit: or, as suggested in a comment of Eric Wofsey on another answer, "the existence of any nonempty set together with Replacement"
Comment: You need more than you're saying, because that just lets you know that each individual singleton exists.  To know that the set whose elements are _all_ the singletons exists, you need either Replacement or Power Set and Separation.
Comment: I'm not sure I see your point; for instance, In my example i don't really need {{{}},{{{}}}} to exist, i just need a "family" containing {{}} and {{{}}} to exist to be able to recognize an union; this family could very well be a class.
Comment: Ah, sure, if you're happy with a class-indexed union.  The question was vague about exactly what it was asking for.
Answer: It looks like you need:

Pairing — existence of unordered pairs, hence existence of singletons,
Union — obviously the union of a set has to exist,
Replacement, or Power set + Comprehension (= Separation),
Extensionality.

Clearly both 1. and 2. are required.
Given a set $X$, somehow you need to prove existence of $Y = \{\{x\}\mid x\in X\}$. That's where 3. comes in. Using Replacement, this is a set, because it's the image of the set $X$ under the function $x\mapsto \{x\}$. Another way to prove its existence: $\mathcal{P}(X)$ exists by Power set, hence by Comprehension so does the subset of things in it that are singletons: $Y = \{s\in \mathcal{P}(X) \mid (\exists u\in s)\, (\forall v\in s)\, u=v\}$ exists.
Now it's clear that $(\forall x)\,(x\in X\leftrightarrow x\in \bigcup Y)$, so by extensionality $X = \bigcup Y$.
Comment: You don't need Union, because here you are assuming the union you want to describe already is a set.  You also don't need Extensionality, because "$X=\bigcup Y$" is not actually a formula in the language of set theory, but rather a shorthand for the formula $(\forall x)\,(x\in X\leftrightarrow x\in \bigcup Y)$.  That is, there is no way to talk about $X$ being "equal" to the union of $Y$ other than via extensionality.
Comment: @EricWofsey Yep, I made my comment disappear.
Answer: Following the axioms in Kunen : Set Theory, and avoiding Power : (1) Pairing. $\ \forall x\;\exists y\; (y=\{x\})..\;$(2) Extensionality. $ \forall x\;\exists ! y\;(y=\{x\})$. (3) Replacement. $ (\forall A \; \forall x\in A \; \exists ! y\;y=\{x\}) \implies (\forall A \;\exists B\; \forall x\in A\; (\{x\}\in B)\;$. (4) Comprehension : Taking $A$ and $B$ as in (3), $\exists C=\{y\in B: \exists ! x\in A\; (y=\{x\})\; \}.$ (5). Union. Taking $A$ and $C$ as in (4), $\cup C=\{x : x\in A\}\;$. (6). Extensionality again. From (5) and (4), $\cup C=\{x :x\in A\}=A.$ I think that step (5) implicitly assumes Extensionality. Then the question is whether we can leave out any of these axioms, and add some other(s) and still succeed. We can omit Replacement with Power in step (3), and  re-write step (4) as $\exists C=\{y\in P(A):\exists ! x\in A \; x\in y\}\;$. Trying to omit any others makes me cross-eyed.

Every set is a union of singleton sets


How can I use htaccess to redirect an exisiting directory to a subdomain?

Question: In my site I have a directory called as.my, which actually houses the files for a subdomain on my site called my.example.com. If someone visits www.example.com/as.my they are shown the subdomain. What I'd like to do, if possible, would be to redirect any URL's beginning with as.my to the subdomain, and strip as.my from the URL. Is this possible?
I've been able to redirect the folder using
Redirect Permanent /as.my http://my.example.com

But that doesn't work properly if someone were to visit http://www.example.com/as.my/test/. I've also attempted to use
RewriteRule ^as.my(/.*)$ http://my.example.com/$1 [L,NC,QSA,R=301]

But that doesn't work properly, either. Is there a method available that I can use to accomplish what I'm attempting? URL's would act as follows:
http://www.example.com/as.my/      => http://my.example.com/
http://www.example.com/as.my/test/ => http://my.example.com/test/

Thank you for any help!
EDIT: Here's my directory layout, as well as the htaccess files that are within each.
The main directory has all of the files for example.com, as well as the directory as.my, which houses all of the files for the subdomain my.example.com. The htaccess file for example.com is as follows:
ErrorDocument 400 /pg.errors.php?eC=400
ErrorDocument 401 /pg.errors.php?eC=401
ErrorDocument 403 /pg.errors.php?eC=403
ErrorDocument 404 /pg.errors.php?eC=404
ErrorDocument 500 /pg.errors.php?eC=500

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Add WWW
RewriteCond %{HTTP_HOST} !^(my|www).
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]

# Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]

# URL Rewrites (There are a few like this, but they're all the same)
RewriteRule ^about/$    about.php    [L,NC,QSA]
RewriteRule ^contact/$  contact.php  [L,NC,QSA]

</IfModule>

<Files .htaccess>
Order Allow,Deny
Deny From All
</Files>

The htaccess file in the as.my directory is as follows:
ErrorDocument 400 /pg.errors.php?eC=400
ErrorDocument 401 /pg.errors.php?eC=401
ErrorDocument 403 /pg.errors.php?eC=403
ErrorDocument 404 /pg.errors.php?eC=404
ErrorDocument 500 /pg.errors.php?eC=500

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]

# URL Rewrites (There are a few like this, but they're all the same)
RewriteRule ^help/$ help.php [L,NC,QSA]

</IfModule>

<Files .htaccess>
Order Allow,Deny
Deny From All
</Files>

<Files ~ "\.tpl$">
Order Allow,Deny
Deny From All
</Files>

Comment: `Redirect permanent /as.my http://my.example.com`?
Comment: @MarcB Whoops! That's what I had meant to put before. I edited my answer.
Answer: You don't actually need mod_rewrite to do this. You're on the right track with Redirect Permanent.
RedirectMatch permanent ^as.my http://my.example.com/

Note the use of RedirectMatch instead of Redirect. According to the documentation,

This directive is equivalent to Redirect, but makes use of regular expressions, instead of simple prefix matching.

That means the match will glob on to the entire request URI and redirect all of them to the subdomain.
Comment: Thanks for the answer, but it doesn't seem to work. I'm assuming that I must have an issue elsewhere in some of my htaccess. I'll keep trying, though.
Comment: By "it doesn't seem to work" do you mean, "I'm getting the same results as before"? (An issue elsewhere would certainly explain that, so I'll see how that shakes out.)
Answer: Have this rule in your /as.my/.htaccess just after trailing slash rule:
RewriteEngine On
RewriteBase /as.my/

RewriteCond %{HTTP_HOST} !^my\.example\.com$ [NC]
RewriteRule ^(.*)$ http://my.example.com/$1 [L,NC,NE,R=301]

Comment: Thanks for the answer, but it doesn't seem to work. No redirect occurs unless I include something after `as.my`, and then it just redirects to the main site with the rest of the URL appended.
Comment: Do you have more rules or just use this rule? Where is this .htaccess located?
Comment: As I suggested in my answer this rule should be in root .htaccess
Comment: I've edited my answer to include the `htaccess` files, if that helps. I put what you suggested into the root `htaccess` but it wasn't working. I also tried the `as.my` `htaccess` file, and still no luck.


Remove fields(columns) in Django Models

Question: I am trying to remove some fields(columns) from the Models.py file. So, i make changes to the Models.py and ran makemigrations. It shows

django.core.exceptions.FieldError: Unknown field(s) (removed field
  names) specified for MODELNAME

I also tried running python manage.py dbshell and dropping the column from the table, made changes to remove the field from models.py and then running makemigrations. It still shows the same error. Thanks in advance for any help.
Comment: You are probably using those removed fields in the admin.
Comment: Thank you, That was the issue!!
Answer: If you've already removed the column from the database, then there probably isn't a lot of point anymore in making migrations. You should then just make sure that your models.py agrees with your database and you should be set.
I think initially there may have been some typo or other problem?
Comment: Yes, the formatting was not proper. I left it as you said without makemigrations(removed it from models.py too) and tried adding a dummy column into the model and did makemigrations, it shows the same error as i mentioned above although it is not present in models.py and the database. Thanks.

Remove fields(columns) in Django Models


Subir aplicação localhost para subdominio online (hospedado no meu computador)

Question: Sempre apanhei para tudo relacionado a servidores e essas coisas. Estou rodando uma aplicação que usa o famoso nodejs, e minha hospedagem não dá suporte para o mesmo. Então, apenas para testes "online" queria fazer minha aplicação "localizada localmente", ter acesso online com um subdomínio online, sendo o meu computador o servidor de tudo.
Li algumas coisas sobre alterar o arquivo "hosts" (eu uso Windows) mas não obtive muito sucesso.
Alguma alma pode me ajudar aqui?
Answer: Em primeiro lugar, o DNS (que você chama "subdomínio online") deve ter uma entrada apontando para o seu IP.
Em segundo lugar, ao subir uma aplicação escrita em nodejs, ela já está em teoria exposta à internet. O que seria necessário fazer é um reapontamento de porta, que pode ser feito por um software chamado de proxy reverso, como o Nginx, por exemplo, e a liberação da porta no Firewall.
Em terceiro lugar, o que o arquivo hosts faz é simular essa entrada DNS apenas na sua máquina. Ele não replica o DNS para a internet. Quem faz isso é a autoridade DNS que detém seu domínio.
Em quarto lugar, o interessante no seu lugar seria fazer o deploy da aplicação em uma máquina que não seja a sua. Aqui tem uma lista de servidores que suportam o Node.js.
Answer: Se você realmente deseja ver a sua aplicação na sua máquina online em algum domínio, já tentou DDNS? noip por exemplo? Já tornei minha máquina acessível online via subdomínio noip + configurações no meu roteador. Meu roteador utiliza DD-WRT e tem funcionalidade para atualização automática do meu ip em serviços tipo noip, assim que conecto, o roteador manda um comando com meu novo ip pro noip e o noip configura o domínio pra apontar pra minha máquina. Também é possível encontrar serviços de DDNS que aceitam domínio pessoal, antigamente se não me engano DNSPark oferecia isso e eu usava. Outra coisa é que, conexão DSL não empresarial, tipo speedy, vai bloquear acesso na porta 80, 8080 e outras comuns para servidores.


Event Object on Firefox

Question: Sorry, this seems to be a great crowd pleaser... That should be why firefox has not changed their code to be fully compliant with the Event object just like Chrome. I've done my homework, tried several solutions given here on StackOverflow, but nothing seems to work. I have this code:
function xpto(e) {
if( !e ) e = window.event;
  var x = e.target||e.srcElement;
alert(x);
    ........
}

The call is being made like:
<svg id="graph-svg" onclick="xpto(event)" style="outline: none;" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

Yes... It's an svg element that I'm trying to get on click. I have not put the complete code because it was not relevant to the question. Bottom line, the
alert(x)

is always alerting with undefined on Firefox, and working on Chrome like a charm. I can grab the Event on Firefox, but the "x" always cames undefined.
In firefox on the DOM description either Event and SVG are supported. Event is even defined with the "target" and "srcElement" properties for backwards compatibility.
I'm using Firefox 20 on Ubuntu... Can anyone help?
Comment: have you tried console.log(x); in firebug to see more detail?
Comment: Yes, even Firebug it says that "event" on the call is not defined... It show me an error where onclick is supposedly shown like:

        function onclick(evt) {
xpto(event)
}

I guess it is the definition of onclick on Firefox... Then it falls into the handler...
Comment: When I ran similar code in Firebug... like onclick="doSomething(event)" and in doSomething(event){console.log(event);} it does show up... (and has target by the way)
Comment: Mine has not... It could be because I'm running on Ubuntu, but with your answer I got a hint and exploited it.

After your reply I went to the code and found out that the argument that works in firefox is not "event" or "Event" but "evt"... The console in Firebug (which should be the real browser name...) showed this:

        function onclick(evt) { xpto(event) }

So with that I realized that the handler was being called with "event" rather than the original argument "evt". Then when it felled into the handler the "event" was passed as "null".

I really, really hope this helps someone.
Comment: The only reason this works in Chrome is that it copied IE's `window.event`, not because it's somehow more "compliant".
Answer: After a reply from d'alar'cop I went to the code and found out that the argument that works in firefox is not "event" or "Event" but "evt"... The console in Firebug showed this:
    function onclick(evt) { xpto(event) }

So with that I realized that the handler was being called with "event" rather than the original argument "evt". Then when it felled into the handler the "event" was going "null" ... undefined.
Comment: Yep.  The SVG spec defines that event handlers on SVG elements use `evt` for the argument instead of `event` like HTML does.  Why they decided to not do the same thing as HTML... who knows.  :(
Comment: We are using extensive SVG as well. We recently had to add an event to functions within the SVG. All major browsers were working on multiple OS/devices until we tried Firefox on Android. The error was event is null. Searched the net and found this link within minutes. Your fix undoubtedly saved us hours or days.
Answer: Many times I see event handler inlined in HTML code, instead to rely on the more powerful event listeners.
Instead to use onclick why don't you attach a listener to the SVG element? You could try this:
var addListener = function (element, event, callback) {
    // We define a cross-browser function
    if (window.addEventListener) {
        // Mozilla/Webkit/Opera
        element.addEventListener(event, callback, false);
    } else {
        // IE
        element.attachEvent('on' + event, callback);
    }
};

// Then we attach the event listener to the SVG element
addListener(document.getElementById('graph-svg'), 'click', function (evt) {
    // Here you can manage the fired event
    alert(evt);
});

or, using jQuery:
$('#graph-svg').on('click', function(evt){
    alert(evt);
});

You can try it with this fiddle (tested with FF 20.0 and Chrome 26 on Ubuntu 12.10).
Of course, inline handlers aren't always evil, but many times they're not the solution, IMHO.
Comment: Yes, FF uses `evt` as global event handler, but my point is that usually using inline code (which in some cases is also forbidden by the enviroment) for event handler is a *bad* habit, because brings to us tons of problems that using the event listener we won't had. You're welcome anyway :)
Comment: The problem was not the event handler done in that way... It was the "event" not being detected by my browser. I could do it in any way you told, jquery, raw javascript listener but as soon as I passed "event" it would came up empty on the "target". When I started to pass "evt" it worked.
My problem was with the browser itself, not the architecture :) But thanks for the suggestion.

Event Object on Firefox