Falsetto voice in women

Question: Can women have a falsetto voice?
If not, why not?
If yes, do they just have a deep enough voice or does it depend on something else?
Are there men that don't have a falsetto voice?
Edited to add a question from the discussion in the comments:
Is falsetto the same thing as "head voice"? At least in some usages?
My impression was that head voice refers to use of resonance cavities in your skull, while falsetto refers to a certain use of your vocal chords, but wikipedia differs here, so some expert references would be appreciated.
Comment: Related: A discussion regarding the difference between head and falsetto voice in men http://music.stackexchange.com/q/14834/6133?
Answer: Wikipedia says:

The issue of the female falsetto voice has been met with some
  controversy, especially among vocal pedagogists. Many books on the art
  of singing completely ignore this issue, simply gloss over it, or
  insist that women do not have falsetto. This controversy, however,
  does not exist within the speech pathology community and arguments
  against the existence of female falsetto do not align with current
  physiological evidence. Motion picture and video studies of laryngeal
  action reveal that women can and do produce falsetto, and
  electromyographic studies by several leading speech pathologists and
  vocal pedagogists provide further confirmation.
One possible explanation for this failure to recognize the female
  falsetto is the fact that the difference in timbre and dynamic level
  between the modal and falsetto registers often is not as pronounced in
  female voices as it is in male voices. This is due in part to the
  difference in the length and mass of the vocal folds and to the
  difference in frequency ranges. It is an established fact that
  women have a falsetto register and that many young female singers
  substitute falsetto for the upper portion of the modal voice.

So there you go. Females can and do achieve falsetto.
The Wikipedia article contains citations, should you wish to follow up.
Comment: Men need to go falsetto to reach those notes. Women can reach the notes in a more conventional way.
Comment: it is amazing that they don't make more experiments but rather argue and debate :)
Comment: As to why it's "commonplace among male singers" but not with females, the point is, men and women have different physiology. The female vocal system is substantially different than the male vocal system. This is obvious by listening. The difference between regular voice and falsetto is obvious and dramatic in men, and falsetto is easy to achieve. With women, the difference is subtle, but falsetto is difficult to achieve and rarely used to the point that it's not really worth considering. Thus it's not part of teaching people to sing (vocal pedagogy).
Comment: Ok, but this does not really explain why falsetto is commonplace among male singers and not well-known about female ones.
Comment: Glad to hear that! I was certain I had heard several females singing in falsetto!
Answer: I've always heard head voice as the term for falsetto in women. (I've sung in many choirs over the years.) The same Wikipedia article that slim referenced indicates that they do mean the same thing, or at least used to.
I don't know where you're located, but if you're outside of the US, maybe there is a different term instead of "head voice". But here, I think "head voice" is used rather than "female falsetto" - so the answer to your question is yes, it's possible, but it's not often discussed because there's another name for it.
(Also cited in that Wikipedia article: A woman's head voice isn't necessarily the same range as a man's falsetto. My speculation: maybe that's why there are two names for it depending on gender?)
Comment: I really don't think so. The literal translation of "head voice" to German certainly does not mean falsetto, it refers to which resonance parts of your body are primarily used which is either your chest or the hollow parts of your skull.
Comment: This is a perfect example of why we need a canonical answer; @MonicaCellio and I have different experiences with the terminology, and Wikipedia differs from what Phira has learned. I hope someone can come up with a definitive answer for us!
Comment: Like I said, I've heard them used interchangeably, but it would not surprise me if that was a regional thing. "Head voice" and "falsetto" certainly do not have the same *literal* meaning in English, either, but isn't singing in falsetto singing so that it resonates in your sinuses? (I'm really curious if someone else has a better answer for this question; it's a great question.)
Comment: I have added the question to the original question.
Comment: My choir director instructs both women and men to sing in head voice.  It's a different concept than falsetto, at least as I've been taught (US).
Answer: For a person to yodel it is necessary for the voice to achieve falsetto either in men or women.  If a woman cannot achieve falsetto then she cannot yodel — that has been proven untrue by women like Suzy Bogguss and Patsy Montana.  Could it be they have a lower voice range?
Answer: I'm recently learning how to sing, and where I live "head voice" and "falsetto" don't mean the same thing. As I understood, when a man sings using his falsetto voice, he's only making a fraction of the vocal chords vibrate, resulting in a higher note. This also makes the air rushing escape more easily, resulting in, from what I'm told, some kind of pattern in the sound, which identifies the falsetto and differs it from a man who can reach the same note using his entire vocal chord.
Head voice is to make the sinuses and nasal cavities resonate when performing, and as I stated before, doesn't seem to relate to the concept of falsetto by itself. I really don't know anything about falsetto among women, I will keep in touch with this question, as I really want to know how it turns out. Sorry if I misused any terms, not used to all the nomenclature in English, I hope to be of some help.
Answer: Again, from the wikipedia article referenced by slim:

It is an established fact that women have a falsetto register and that
  many young female singers substitute falsetto for the upper portion of
  the modal voice.

This means that many female singers tend to seamlessly switch to falsetto when it becomes too hard to reach the higher registers with their modal voice. The sound for a female modal register, and their falsetto register is quite similar, so it is often not recognized as falsetto even if it is. For men, the modal register and falsetto register are much more different in sound, and is more easily recognized.
Answer: It seems to make sense that people with lower voice, male or female, meaning with thicker vocal chord, to more easily produce falsetto sound. They partially vibrate their thinner edge of their vocal chords and can more easily make a more distinguished falsetto sound.
Answer: Falsetto is a vocal register, i.e. a way that the vocal folds vibrate.
There are four vocal registers:

the vocal fry register
the modal register
the falsetto register
the whistle register

(an interesting websites with examples of all the registers)
Women as well as men can phonate certainly phonate in the falsetto register. It's my understanding (but I cannot find any source on the topic, so I might be very wrong) that some women usually speak using the falsetto register.
However, the difference in sound between the modal register and the falsetto register is much more audible with men than women (at least with untrained singers).
Comment: Link is dead, and archive.org page is non-functional. Does anyone know of a replacement?
Answer: Well, I have a falsetto register (sometimes called a Whistle register, I believe). I know that I am a freak and that there are not many others like me about.
This means that I have 4 registers as opposed to the normal three (botttom, middle and top) for a soprano. I can sing about an octave and a bit above high C (yes you did hear right) - about an octave, in fact, above the Queen of the Night's high F. Weird, I know but a fact.
The definition of this falsetto register is that it is developed to the extent that it makes a substantial sound and differs in quality from the high register which a soprano would normally have.
Are there any other freaks out there like me? I wish someone would do some research in this area and, if there are any researchers interested, I would be happy to take part. Cheers
Comment: Which C is 'high C' actually? C6, maybe?
Comment: I don't think the whistle register and falsetto are the same thing, though.

Falsetto voice in women


Logit MLE in R and Finding the Odds-Ratio

Question: We know the Logit distribution is $\frac{exp(\beta'x_i)}{1+exp(\beta'x_i)}$
In R, if we want to execute a logit regression, we use:
glm.logit=glm(model,binomial(),Data.df)

This returns the relevant coefficients. How do we interpret these coefficients algebraically? I read another response which said that R returns the log odds, so each coefficient therefore has the interpretation of log$(\frac{p_i}{1-p_i})$? Where $p_i =\frac{exp(\beta'x_i)} {1+exp(\beta'x_i)}$ So p, the probability is equal to the distributional function?
If this is correct, then all I need to do to get the odds ratio is take the exponential of, i.e.
log$(\frac{p_i}{1-p_i})$ = $\beta'x_i$ $\implies$ $\frac{p_i}{1-p_i} = exp(\beta'x_i)$
in R:
exp(coefficients(glm.logit))

How would we calculate the logit model 'by hand'? Would you specify the logit distribution function, F(z) and then set z= linear model (OLS)?
Thank you
Comment: Relevant info [here](https://stats.stackexchange.com/a/211277/7071).
Answer: One way to find out what R has calculated is make a little experiment.  Here I simulate data according to the model
$$
\log\left(\frac{p_y}{1-p_y}\right) = b_0+ b_1x_1 + b_2x_2
$$
where I set b0=2, b1=-3, and b2=5.  I let x1 and x2 be normally distributed.
N <- 10000
b0 <-  2
b1 <- -3
b2 <-  5
x1 <- rnorm(N)
x2 <- rnorm(N)
logodds <- b0+b1*x1+b2*x2
py <- exp(logodds)/(1+exp(logodds))
y <- rbinom(N,1,py)
coef(glm(y~x1+x2,family=binomial))
# (Intercept)          x1          x2
#    2.029105   -3.072279    5.047870

That result shows that the coefficients returned by glm are indeed the linear coefficients connecting the Xs to the log odds of Y.
As for calculating by hand, the glm function works differently from OLS.  It maximizes a likelihood that depends on the distribution of error terms.  In the case of logistic regression, the error terms are logistically (not binomially) distributed and that is quite different from Normal, as assumed by OLS.
Comment: I think your statements about the error terms in the logit and OLS case are mistaken. The error has a logistic distribution, and OLS does not assume normality.
Comment: Fair enough on the logistic distribution, but for OLS, while calculation of the coefficients doesn't require normality, statistic inference does.  But maybe I'm unnecessarily conflating the issues.
Comment: I think you need normality if you want to do MLE assuming normal errors or if you want to derive the finite sample distribution of the OLS estimator to do inference. If you are OK with asymptotic approximations, normality is not required for inference.
Comment: The common assumption about normality in linear regression is that the error term is normally distributed in expectation. As an aside, while logistic regression can be motivated with an underlying latent variable which will have an error term, this is a fiction because error for a binary outcome can also only be binary. It's more natural to simulate realizations as binomial with probability equal to the inverse logit of the linear term (XB).


Call method whenever method in other class is called

Question: In given two classes:
class Person {
  constructor(name) {
    this.name = name;
  }

  feedCats() {
    console.log(this.name + ' fed the cats');
  }
}

and:
class Cat {
  constructor(name) {
    this.name = name;
  }

  meow() {
    console.log(this.name + ' says \'meow\'');
  }
}

I want method meow() in every Cat's instance to be called whenever any instance of Person is calling feedCats() method. How can I do this?
I assume maybe the events handling will be needed, however in JavaScript event type is needed when using addEventListener() method and I can't find the proper one. I need the fastest JavaScript or jQuery solution.
Answer: I believe that there's a very easy path to solve this problem.
Move feedCats to a new class called CatFeeder, and add which cats should be fed before feed gets called:
class CatFeeder extends Person {
    constructor(...args) {
         super(...args);

         this.cats = [];
    }

    addCat(name) {
         this.cats.push(new Cat(name));
    }

    feed() {
         this.cats.forEach(cat => cat.meow());

         console.log(`${this.name} fed the cats and they said meow!`);
    }
}

var catFeeder = new CatFeeder("Matías");
catFeeder.addCat("Inno");
catFeeder.addCat("Darky");

catFeeder.feed();

At the end of the day, a Person isn't a cat feeder per se, but is a CatFeeder (who's a person, but not any person). For me, this feels more natural than considerating that any person has the properties and behaviors to feed a cat.


Get base URL in a custom block

Question: How can I get the base URL in the custom block?
Comment: Welcome to Drupal Answers! In a custom block you cannot normally use Twig, but only HTML markup. Are you using any specific module to allow that?
Comment: No, I'm not using any specific module but I want the base URL in the block. Is this not possible in any way?
Comment: For the content of a custom block you create from the user interface, you cannot use Twig nor PHP on a standard installation. Just enter the correct path of the image.
Comment: Does this answer your question? [How do I get the base path?](https://drupal.stackexchange.com/questions/205289/how-do-i-get-the-base-path)
Comment: I want the dynamic website URL inside the custom block. In D7, it was possible with the $base_url function inside the body but now in D8 PHP text format has been removed, only HTML markups are allowed which is making it impossible to happen. I'm not able to find the solution for this.
Answer: First of all, don't prepend the base url by hand, use the core PHP function file_create_url or TWIG file_url:

And then, as commented, you can't use Twig out-of-the-box in Ckeditor. You need to install a module like Twig Input Filter and enable the Twig filter in /admin/config/content/formats for your text format.
Comment: This worked for me..thankyou so much!

Get base URL in a custom block


Permanent Cookie Contains Sensitive Session Information

Question: I have a cookie question in regards to a security scan (via IBM Rational AppScan) conducted on a drupal(7.43) site. The security scan failed with the following error: (Permanent Cookie Contains Sensitive Session Information) is POSITIVE on: http://site-name/user/login?ModPagespeed=noscript (cookie = SESSa020b17496f7fb76f92dd28c8d8341be).
How to resolve this?
Comment: Welcome to Drupal Answers :) I'm afraid none of the questions you're asking at the moment are in topic here, they're all general security related questions. The organisation that provided you with the scan results will be able to give you details of each problem, and let you know the general fix for each. If any of those require changes to Drupal, not just the web server config, we'll be able to help here, but we'll need to know the specifics of what you're trying to change. Thanks
Answer: Your app scanner is alerting you that cookie session data is being sent over an insecure channel (http://site-name/user/login?ModPagespeed=noscript) and is susceptible session hijacking.
One way to resolve this is to force your website to use HTTPS only, thus preventing anyone from sniffing out session data.


Why does Redis Server not allow me to connect to a node?

Question: On src directory, I am running below command
/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

but getting below error.
Creating cluster
[ERR] Sorry, can't connect to node 127.0.0.1:7000

However if I start the node at 7000 using command redis-server redis.conf where redis.conf is below
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 10
cluster-slave-validity-factor 0
appendonly yes

and similarly I started redis in all ports successfully.
Now when I run
/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005

I am getting another erorr.
Creating cluster [ERR] Node 127.0.0.1:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

please help.
Answer: The first error is because redis-trib create attempts to connect to the redis instances while creating the cluster- however you do not have any redis instances running at 127.0.0.1:7000.
The second error looks like you started your redis instance, but now your cluster cannot be created because you already tried to create a cluster on node 7000 (Probably allocated slots to your node) before you got the first error message. To wipe the node clean, run
$redis-cli -p 7000
127.0.0.1:7000> flushall
127.0.0.1:7000> cluster reset
127.0.0.1:7000> exit

then your redis-trib create will work.
Answer: Perform steps in the following manner
stop -> clean -> start -> create
of the servers.


How to display my prefered column in Table Reference Widget

Question: Service Now - Service Portal : How can I set my preferred column name for search option display name in Table Reference Widget.

/* Client Controller */
function ($scope) {
  $scope.table = "my_table";
  $scope.field = {};
  $scope.descriptor = {
    reference: $scope.table,
    attributes: '',
    name: '',
    searchField: 'my_field',
    qualifier: ''
  };

  $scope.valueSelected = function() {
    console.log($scope.field);
  }
}
/* Body HTML Template */

      <sn-reference-picker
        sn-options="{placeholder: 'Search here'}"
                           ed="descriptor"
                           field="field"
                           sn-on-change="valueSelected()" />

Above sample is from my cloned widget.
Let me know any suggestion on this.
Thanks in advance!
Comment: Any suggestion on this?
Answer: You should be able to use a combination of display-field, display_fields, and search-fields. Sadly the documentation on the ServicePortal is lacking.

display-field: Main field to display on the line for the record
display-fields: Sub fields that display below the display-field
search-fields: Fields that you search on in the box

Try something like this to test on the Incident table.
Template
<sn-record-picker
    field="field"
    table="table"
    display-field="'short_description'"
    display-fields="'number,opened_at'"
    default-query="'active=true'"
    value-field="'sys_id'"
    search-fields="'number'"
    page-size="100"
    sn-on-change="valueSelected()">
</sn-record-picker>

Client Script
function ($scope) {
  $scope.table = "incident";
  $scope.field = {
    displayValue: $scope.data.short_description,
    value: $scope.data.sys_id,
    name: 'field'
    };

  $scope.valueSelected = function() {
    console.log($scope.field);
  }
}

I'm not sure what the ed field is for with the OOTB version unfortunately.


É possivel uma aplicação em computadores distintos realizando CRUD simultaneamente?

Question: Eu estou criando uma aplicação em C# usando o VisualStudio 2015 enterprise junto do SQL Server 2016 para salvar os dados, mas eu estou quase finalizando o projeto e ainda não sei se ele realmente funcionará!
Eu preciso instalar essa aplicação em computadores diferentes do mesmo local de trabalho (mesma network), onde todos usaram a aplicação ao mesmo tempo e realizaram operações CRUD nele simultaneamente entre os computadores.
Minha dúvida é a seguinte, Existe a possibilidade de fazer isso acontecer? alguma outra linguagem que é mais indicada como Java ou outro banco de dados como MySQL, eu não tenho problemas quanto ao desenvolvimento mas não acho nada relacionado a como fazer essa ligação entre as aplicações em computadores diferentes com 1 unico banco de dados!
Comment: Você está no StackOverflow **em Português**, se não traduzir sua pergunta, ela será fechada. | You're in StackOverflow **in Portuguese**, if you don't translate your question, it'll be closed.
Comment: O banco de dados gerencia toda a concorrência, você precisa apenas apontar a aplicação para o mesmo banco de dados, seja SQL Server ou MySql.
Comment: Levino, não vejo problemas com a sua abordagem e na escolha das tecnologias, e acredito que a sua aplicação irá funcionar corretamente depois de feito o deploy, porém, caso decida mudar as tecnologias usadas (custo da licença do SGBD ou dá suporte a usuários linux), aconselho que dê uma olhada no Electron e no PosgreSql e passe longe do Java e MySQL.
Answer: Seu cenário é um dos mais comuns no desenvolvimento de software (principalmente comerciais e empresariais). Basicamente, é composto de um SGDB (Sistema Gerenciador de Banco de Dados) e máquinas que acessarão esse banco por meio de um software (desenvolvido por você).
Não há absolutamente nenhum problema em várias máquinas acessarem simultaneamente o banco de dados. Note que bancos de dados são em sua grande maioria projetados para aceitar muitas conexões simultâneas.
Por essa razão, o banco precisa prover mecanismos para lidar com a inevitável concorrência. O mecanismo mais importante dentro desse contexto é o de Transação.
Os quatro pilares de uma transação são Atomicidade, Consistência, Isolamento e Durabilidade (ACID). O Isolamento é o que garante que uma transação não pode alterar um dado enquanto outra estiver alterando o mesmo dado. O banco usa mecanimos de bloqueio para garantir isso.
Obviamente, é papel do programador estabelecer quando uma transação começa e quando termina. Portanto, embora o banco disponha de várias funcionalidades para garantir a consistência dos dados, se o programador não souber bem como usá-las, então certamente terá dor de cabeças.
Comment: Muito obrigado Cantoni, Eu realmente estou tendo esses tipos de problemas pois programei usando o Visual Studio 2008 em 2012, do 2008 pro 2015 mudou muita coisa, também não tive dificuldades em utilizar C#, onde minha zona de conforto seja java, muito obrigado pelo caminho, agora irei buscar na direção certa!
Answer: Se você precisa usar CRUD em vários dispositivos, você pode fazer usando um banco ou um arquivo (.txt por exemplo). Mas se você realmente precisa acessar os mesmo dados de diversos dispositivos simultaneamente pesquise sobre CONDIÇÃO DE CORRIDA.
É um problema comum e muitas frameworks já preveem esse problema. Pesquise também sobre semáforos e mutex (mutual exclusion - exclusão mutua).
Comment: Não precisa de resposta em inglês, uma vez que o site é voltado para aqueles que falam o idioma português.
Comment: Se entendi bem a pergunta do autor, acho mais apropriado ele procurar sobre transações (transactions) no banco SQL Server.
Comment: Obrigado vou pesquisar mais sobre condição de corrida, eu corrigi e escrevi novamente em português, não percebi que estava no pt.stack...


Is it advisable to provide only variables highly correlated with response to perform principal components regression?

Question: Let's say I have X variables that I want to use to predict Y (Response). Should I provide all X variables to perform Principal components regression (PCR) or should I provide only the significantly correlated variables (obtained from finding partial correlation for controlling confounding factors using Spearman correlation) for predicting the response using PCR? Would the results change? I'm a biologist and a novice in this field. Please help.
Answer: First, it's not clear that you should use principal components regression; partial least squares is often a better method when you have a lot of independent variables that you want to combine into a few in order to use them in regression.
Second, no, you shouldn't filter out the variables based on correlation with the DV, you should use any IVs that you are interested in.  For one thing, it could be that some combination of variables is a good predictor.
Comment: Was going to write pretty much the same answer.  I'd also mention ridge regression as a superior alternative.
Comment: @MatthewDrury  Hmm.  I hadn't heard of using ridge regression here.  I thought that was mostly used when there was collinearity.  Why does it work well here?
Comment: @Peter Flom Hmm. I forgot to mention that my variables are not independent. They are also correlated to each other. So if I have to make them uncorrelated, I need to perform a PCA. Correct me if I am wrong.

Also, if I don't pre-process the data using highly correlated variables to the response, won't I end up in choosing combination of variables that might not have any effect in reality and behave like an artifact. I might end up getting variance explained by inappropriate uncorrelated variables.
Comment: Ridge regression works well with correlated variables - I think that's what @MatthewDrury meant and I misunderstood.  With ridge regression you don't need PCA.  And partial least squares also works with correlated variables. Or you could drop some variables.


There's a way to download large files direct from server? (Without waiting for blob response)

Question: So, I'm working on the request of video files (using axios). I made the requests w/ the responseType: blob and wait for the response to create the video player with the window.URL.createObjectUrl(). But I've a button too, when the user click he can download the file.
The problem is: most files has big sizes, 150MB+, which turns out to be terrible for the user to wait for the blob response and start downloading.
There's a better way to do that? Without waiting for the response and making the browser handle the request?
Comment: Why can't you just link to it like anything else?
Answer: It's not possible to do better through an XHR request (beside displaying a loading element while waiting for request response).
But why can't you just pass it through the browser (using the  element on-the-fly creation trick)? If you paste your end-point on browser's location bar, doesn't it open or download it?
Comment: Well, then it's a backend issue. You've to send the file the right way. All I can say is our Java backend is sending a response (with content-type and content-disposition indeed) with the file content in the body using an org.springframework.core.io.InputStreamResource
Comment: Nope, the download doesn't start when I paste on the browser. And w/ the ````  element I've the same problem: need to wait for the blob response to link on the tag.


Date module shows time field +5:30 ahead from input

Question: I am using Date module with date popup . And I am creating these node pro grammatically and saving dates to them like:
<code>$node->field_task_time[LANGUAGE_NONE][0]['value'] = "2014-12-18 23:15:00";
$node->field_task_time[LANGUAGE_NONE][0]['timezone'] = "Asia/Kolkata";
$node->field_task_time[LANGUAGE_NONE][0]['timezone_db'] = "UTC/GMT";
$node->field_task_time[LANGUAGE_NONE][0]['date_type'] = "datetime";
</code>
The values in db are stored correctly but when I edit this node form the values in the date field shows 2014/12/18 and in time field it shows 4:15. i Don't know what's happening .
Answer: It seems as default behavior of date module if you check its documentation you can see:
Time zone handling
There are 5 different options for field Time zone handling:
Site's time zone - When entering data into the field, the data entered is assumed to be in the site's time zone. When the data is saved to the database, it is converted to UTC. When retrieved from the database, the data is converted to the Site's time zone for anonymous users or the User's time zone for logged in users when User-configurable time zones is enabled.
Date's time zone - With this option enabled, the date field adds a select box to explicitly specify the time zone for the date entered. When the date is saved to the database, it is not converted & the time zone information is saved with the date. When retrieved from the database, no conversion is performed and the date is displayed exactly as entered.
User's time zone - When entering data into the field, the data entered is assumed to be in the user's time zone. When the data is saved to the database, it is converted to UTC. When retrieved from the database, the data is converted to the Site's time zone for anonymous users or the User's time zone for logged in users when User-configurable time zones is enabled.
UTC - When entering data into the field, the data entered is assumed to be in UTC time zone. When the data is saved to the database, it is converted to UTC (e.g. no conversion necessary). When retrieved from the database, the data is converted to the Site's time zone for anonymous users or the User's time zone for logged in users when User-configurable time zones is enabled.
No time zone conversion - The date entered is not converted when saved to the database. When retrieved from the database, the data is NOT converted and is displayed exactly as entered.
so currently your settings are in site's timezone which is assuming that you entered date is in UTC hence the retrieved date is site's timezone which is UTC+5:30 switch setting s to No time zone conversion and you can see retrieved date as entered one.
Comment: I have solved the issue, The problem was in managed field I have selected site's timezome and saving the data in utc format. As soon as I changed this to utc the problem has gone away.


How to set Navbar to be a sidebar by default?

Question: Drupal 7's Navbar module is:

In wide windows, a bar across the top, with no dropdowns, just links to main sections like Content, Structure etc
In medium-width and narrow windows, a sidebar or dropdown menu, with accordion-style dropdowns allowing primary menu items to be expanded and secondary menu items shown without leaving the page.

I want to give users the sidebar view, even on wide screen devices, so they can use the secondary menu dropdowns it offers.
I want it to look like this when the menu is chosen, even in wide devices, similar to the old Admin module:

I can't find any way to do this within Navbar. What's the simplest way to do this, with minimal hacking to the Navbar module or hard-coded overrides?
Answer: I found a way to do this in a very simple custom module without any hacking or patching to Navbar code.
Just create and enable a custom module that contains (assuming your module is called custom):
/**
 * Implements hook_navbar_breakpoints_alter().
 *
 * Nullifies the breakpoint that switches the navbar to horizontal orientation
 */

function custom_navbar_breakpoints_alter( &$data ) {
    $data["wide"] = "not all";
}

The navbar module defines a hook, hook_navbar_breakpoints_alter, using drupal_alter, that allows its hard-coded breakpoints to be overwritten.
not all seems to me the cleanest and most intuitive way to implement an impossible media query condition (related: How to set a media query condition that is never met?).
This makes the switchable horizontal masthead view of the navbar menu, quite literally, the default on not any device.
Answer: With the navbar in horizontal format as on your widescreen devices, click this button in the top right corner of the window:

This will make the navbar show vertical, until the time when the user clicks the button at the end of the vertical sidebar to reverse this.
It's not by default vertical for widescreen devices with that, though. It still needs a user action to make it vertical.
Answer: If what you are looking for is having the navbar showing by default as vertical for any screen size, you can follow the suggestion presented here:
if(localStorage){
   localStorage.setItem('Drupal.navbar.trayVerticalLocked',true);
}
on
navbar/js/navbar.js

If you prefer, just grab this commit I made.


Let $A = \left[ \begin{matrix} I & X \\ 0 & -I \end{matrix} \right]$, $X\in\mathbb R^{m\times n}$ arbitrary. Need to show value of $e^A$.

Question:
Let $A = \left[ \begin{matrix} I & X \\ 0 & -I \end{matrix} \right]$, $X\in\mathbb R^{m\times n}$ arbitrary. Need to show value of $e^A = \left[ \begin{matrix} eI & \sinh 1X \\ 0 & \frac 1 e I\end{matrix} \right]$.

We know that $A^2 = I$ and $A^k = \begin{cases} A \quad &k\text{ odd} \\ I & k\text{ even}. \end{cases}$ for $k = 0, 1,\dots$. A plausible solution is so far
$$
\begin {split} e^{A} &= \sum_{k=0}^\infty \frac 1{k!}A^k \\ &= \left[ \begin{matrix} \sum_{k=0}^\infty \frac 1{k!}I & \sum_{k\text{ odd}} \frac 1{k!}X \\ 0 & \sum_{k=0}^\infty \frac { (-1)^k}{k!}I \end{matrix} \right] \\ &= \left[ \begin{matrix} eI & \frac 12\left(\sum_{k=0}^\infty \frac 1{k!}X - \sum_{k=0}^\infty \frac {(-1)^k}{k!}X\right) \\ 0 &  \frac 1eI \end{matrix} \right] \\ &\vdots \\ &= \left[ \begin{matrix} eI & \sinh 1X \\ 0 & \frac 1 e I\end{matrix} \right].\end{split}
$$
Note: The '$\vdots$' part is easily follows recognizing the power series expansion of $e^x$. What I don't understand is the following string of arguments in the upper right block regarding $X$ matrix. That is how does this work:
$$\sum_{k=0}^\infty \frac 1{k!}X = \sum_{k\text{ odd}} \frac 1{k!}X = \frac 12\left(\sum_{k=0}^\infty \frac 1{k!}X - \sum_{k=0}^\infty \frac {(-1)^k}{k!}X\right).$$
EDIT: I understand the last equality now considering the power series expansion of $\sinh$. Now I just need clarification on going from LHS to RHS:
$$\sum_{k=0}^\infty \frac 1{k!}X = \sum_{k\text{ odd}} \frac 1{k!}X $$
Any help is appreciated thanks!
Comment: $X\in \mathbb{R}^{m\times n}$?
Comment: I don't understand your question @xpaul.
Comment: X is a matrix with m rows and n columns.
Answer: $$\sum_{k=0}^\infty{1\over k!}A^k = \sum_{k\text{ even}}{1\over k!}I + \sum_{k\text{ odd}}{1\over k!}A$$
Answer: $ e^{A}=\sum \limits_{\underset{}{k=0}}^\infty \frac{A^{k}}{k!}= \sum \limits_{\underset{k  Odd}{k=0}}^\infty \frac{A}{k!} + \sum \limits_{\underset{k  even}{k=0}}^\infty \frac{I}{k!}.$
$\frac{1}{2}(e^1-e^{-1})=
\frac{1}{2}(\sum \limits_{\underset{}{k=0}}^\infty \frac{1}{k!}- \sum \limits_{\underset{}{k=0}}^\infty \frac{(-1)^k}{k!} )\\= \sinh(1) \\=\frac{1}{2}(2\sum \limits_{\underset{k  odd}{k=0}}^\infty \frac{1}{k!})\\= \sum \limits_{\underset{k  odd}{k=0}}^\infty \frac{1}{k!}.$
Comment: Ok, do you know how we go from LHS to RHS in the expression: "$\sum_{k=0}^\infty \frac 1{k!}X = \sum_{k\text{ odd}}\frac 1 {k!}X$" (in my original post at the bottom?
Comment: This equality is false.
Comment: We do not need the left member.
Comment: Ok, that would make sense. Then considering this expression: "$e^A = \sum_{k=0}^\infty \frac 1{k!}A^k = \left[ \begin{matrix} \sum_{k=0}^\infty \frac 1{k!}I & \sum_{k\text{ odd}} \frac 1{k!}X \\ 0 & \sum_{k=0}^\infty \frac { (-1)^k}{k!}I \end{matrix} \right]$", how does it get the right upper block in the matrix?


Communality and specific variance of observations in factor analysis

Question: I am new to factor analysis and I am a bit confused. In theory, it seems that we can partition the variance of each observation into communality and specific variance. However, in any example, people seem to calculate the communalities and specific variances of the variables (and not the observations). Is there a way to get the communalities and specific variances of the observations? Am I missing something?
Thank you !
Comment: The two variances pertain to a variable. How can an observation (an individual, for example) have variability? what do you mean saying it has it?
Comment: yes I think the question was not very clear. observations do not have variations. I wanted to see if there is a way to get the communality and the specific variance fro a group of observations (eg. a certain country)
Answer: I believe you are looking for Q-technique factor analysis (FA), which decomposes the data in terms of common people (or types of people) instead of common items. Put differently, traditional (R-technique) FA defines rows to be people and columns to be the variable. Q-technique does the opposite. Thompson (2004) provides an excellent non-technical description of Q-technique FA.
References
Thompson, B. (2004). Exploratory and confirmatory factor analysis. American Psychological Association.


Confusion on where my error is in my solution of $\lim_{x\to0^{+}}\frac{x}{\ln(x)}$ without the use of l'hospitals

Question: I would like to ask something with respect to the limit $$\lim_{x\to0}\frac{x}{\ln x}$$
so if I do it with a calculator I get $L=0$ but my question is why I can't do this
$$\lim_{x\to0}\frac{x}{\ln x}=\left(\frac{\ln x }{x}\right)^{-1} = \frac{\ln((x-1)+1)}{x-1}\frac{(x-1)}{x}\to1\times1=1$$
by using the notable limit $\lim_{x\to0}\frac{ln(x+1)}{x}=1$
where does this logic fall down
Edit: after reading the comments i realized that i was messing everything up, and confusing myself with the limt with basic problems.
Thank you
Comment: This question currently includes multiple questions in one. It should focus on one problem only.
Comment: Why $\lim_{h\to 0}\frac{\ln(1+h)}{h+1}=1$ and why $\lim_{h\to 0}\frac{h+1}{h}=1$ ? this is completely wrong...
Comment: I don't follow your logic. Why does $\frac{\ln((x-1)+1)}{x+1}\cdot\frac{x+1}{x}\to 1\cdot 1$?
Comment: "Why can't I do this?" I don't see how you think you can. There is a lot of abuse of notation there. The big question first: Does $\frac x{x+1}\to 1$ as $x\to 0?$ But also, it is not true that $$\lim_{x\to 0}\frac x{\log x}=\left(\frac {\log x}x\right)^{-1},\tag1$$ since the left side is a limit. Then you use an arrow $\to$ to somehow change the right side of $(1)$ to an expression with $\log$ in the numerator?
Comment: Given your edit: Does $$\lim_{x\to 0}\frac{x-1}x=1?$$ You might be misapplying L'Hopital here if you think it is.
Comment: Your edit is still abuse of notation. It is true that $\log x/x$ is the product of your terms, but $=$ is incorrect here, because the left side of the equality has that $(\cdot)^{-1}.$ Your original error was using an arrow to indicate your next step, when an arrow has a specific meaning when we are specifically writing out limits. Use words more often than symbols.
Answer: It really looks like your argument is trying to say: $$\frac{\log x}{x}=\frac{\log(1+(x-1))}{x-1}\cdot \frac{x-1}{x}\tag 1$$ and the two terms go to $1$ as $x\to 0.$
But the two terms don't go to $1.$ In the first term, it is true that $$\lim_{h\to0}\frac{\log(1+h)}{h}=1.\tag2$$ But if $h=x-1,$ then as $x\to 0,$ $h\to-1.$ So $(2)$ does not apply.
Similarly, $\frac{x-1}x$ does not converge to $1.$
You might be misapplying L'Hopital. L'Hopital requires $\frac{f(x)}{g(x)}$ to converge to an "indeterminate form," here requiring either both $f(x),g(x)\to 0$ or $f(x),g(x)\to\pm\infty.$
But $x-1\to-1$ as $x\to 0,$ so neither term qualifies for L'Hopital.

A quick argument that the limit of $\frac{\log(x)}x$ can't be $1$ (or positive) is that for $0<x<1,$ $\log(x)<0,$ so $\frac{\log x}x<0,$ and the limit, if it exists, can't be positive.
Comment: An easier proof is just to figure out $\lim_{x\to0+} x=0$ and $\lim_{x\to0+}\log x=-\infty$ Since the quotient $\frac{0}{-\infty}$  is not an indeterminate form, you can calculate the limit as $0.$
Comment: That's really a separate question. My first inclination is to let $x=e^{-y}$ then $y\to\infty$ and you want to compute: $$\lim_{y\to\infty}\frac{1}{-ye^y}$$ But $ye^y\to\infty.$
Comment: More generally, if $f:[0,a]\to\mathbb R$ for some $a,$ is bounded then $$\lim_{x\to0+}{f(x)}{\log x}=0.$$
Comment: Thank you very much! then if it isn't too much to ask, how should I proceed, because I'm not finding anthing to work with
Answer: Well, you can't apply l'Hôpital to this limit. The numerator has limit $0$ and the denominator has limit $-\infty$, hence you have
$$
\lim_{x\to0}\frac{1}{\ln x}=0
$$
and your limit is
$$
\lim_{x\to0}\frac{x}{\ln x}=\lim_{x\to0}x\frac{1}{\ln x}=0\cdot0=0
$$
Let's see where you went wrong. Transforming
$$
\dfrac{\ln x}{x}=\frac{\ln((x-1)+1}{x-1}\frac{x-1}{x}
$$
does not really simplify things, because for the first fraction you get
$$
\lim_{y\to-1}\frac{\ln(1+y)}{y}
$$
which is definitely not $1$, but $\infty$ (it's a limit from the right, of course). Similarly,
$$
\lim_{x\to0^+}\frac{x-1}{x}=-\infty
$$
so you can conclude that
$$
\lim_{x\to0}\frac{\ln x}{x}=-\infty
$$
Comment: @Ramirogenta I reversed the fraction like you did. Now I added the explicit computation at the beginning.
Comment: But when I calculate it with wolframalpha i get that the limit is equal to $0$, so isn't $-\infty$ wrong?


What are these two right-hand chords in Schubert's Piano Sonata No 20 D 959?

Question: I am not quite understanding the chord progression and the chord harmonies of the following two beats marked in the red rectangle.
Especially two right-hand chords. They sound very inharmony and strange to me. What do they try to represent?

Listen to 18 secs in Alfred Brendel's recording:
Answer: In addition to Lazy's great answer, note the larger pattern that's taking place in the bass:

Starting with the low E in the bass in m. 6, Schubert moves the bass through F♮ (m. 8), F♯ (m. 10), G and G♯ (m. 11), and finally A through B♭ to B♮ in m. 12. In other words, mm. 6–12 simply move chromatically from E up to B. This is a large-scale prolongation of that perfect fifth from E up to B, meaning it's a large-scale prolongation (what we call "composing out") of the dominant in preparation for the return to tonic in m. 16.
This is somewhat common in music of this time period, and it becomes much more prevalent later in the nineteenth century. It's akin to (but different from) the omnibus, a related idea of chromatic motion in the bass that I discuss in How do I use the Omnibus Progression to Modulate from I to iv?
Answer: Being confused about Schubert's harmonic progression seems to be a common thing. This sonata starts on a big cadenza on A major. But instead of resolving the dominant in measure 6 he delays resolution to then resolve to the IV in minor (d minor) with the third in the bass. This has a bit of a similar character to a deceptive cadence. Then comes the part you are confused about. The IV in minor gets sharpened to a dominant 7 on the IV. This then resolves to the VII (G major). We then get a chromatically rising bass which gives us G# diminished 7, D minor, Bb major, B diminished (II) upon which we get a dominant which finally resolves to to the tonic in measure 16.
So the whole thing can be seen as delaying the resolution of this beginning cadence. Now as the chord change you have given us is simply a change of mode it is by itself a bit quirky, but what makes this particularly unround is the way the alto rises in the same direction as the bass with the other voices remaining, especially since bass and alto move into a dissonance. If one were to voice this as f-a-d-a-d → f#-a-c-a-d it would sound much more rounded.
But if you take a look at the accent marks here (which Brendel absolutely fails to deliver) it should be clear that Schubert is not going for roundedness here, but for bite and harmonic instability.


Incircle defined by three lines expressed in normal form

Question: What are the coordinates and the radius of the incircle defined by three lines expressed in normal form?
The lines are $a_i x + b_i y + c_i = 0$, where $a_i^2 + b_i^2 = 1$ and $i = 1, 2, 3$.
The coordinates of the incircle are $(x_c, y_c)$ and the radius is $r_c$.
I found a solution based on finding the vertices of the triangle formed by the three lines expressed in standard form, but I suspect that it should be a simpler solution using the normal form of the lines.
Comment: You should give the solution you found, so that people don't duplicate your effort. (Also, it's easier to work a problem when you have a particular end-result in mind.)
Answer: Assuming none of the lines are parallel, the center of a circle which is tangent to all three lines at once will necessarily lie on the intersection of the angle bisectors of where the lines intersect. So let's find those bisectors.
For this to work nicely, we first need to normalize the three lines (i.e. multiply or divide each equation by separate constants so that $a_1^2 + b_1^2 = a_2^2 + b_2^2 = a_3^2 + b_3^2$). You have already done this, but it's important not to forget, so I mention it here.
Take the intersection of lines 1 and 2. The two angle bisectors of that intersection are
$$
a_1x + b_1y + c_1 = a_2x + b_2y + c_2\\ \tag{1}
a_1x + b_1y + c_1 = -a_2x - b_2y - c_2
$$
Similarily, we get that the two bisectors at the intersection of lines 2 and 3 are given by
$$
a_2x + b_2y + c_2 = a_3x + b_3y + c_3\\\tag2
a_2x + b_2y + c_2 = -a_3x - b_3y - c3
$$
(We don't need the bisectors of the intersection between 1 and 3, as that doesn't give us any new information).
Now, pick one of the two lines from $(1)$ and one of the lines from $(2)$, and find their intersection. Then do the same for the three other combinations. What you now have are the centers of the incircle and the three excircles. The one with the smallest radius is the incircle.
Answer: One approach is to work a bit backwards.
Consider the three lines with normal form
$$\begin{align}
x \cos 2\alpha + y \sin 2\alpha &= r \\
x \cos 2\beta + y \sin 2\beta &= r \\
x \cos 2\gamma + y \sin 2\gamma &= r
\end{align} \tag{1}$$
The incircle of the corresponding triangle has radius $r$ and center $(0,0)$.
We can get three lines whose incircle has radius $r$ and whose center is $(h,k)$ by translating the lines in $(1)$ via the substitution: $x\to x-h$, $y\to y-k$. We can write the results as
$$\begin{align}
x \cos 2\alpha + y \sin 2\alpha &= r + h \cos 2\alpha + k \sin 2\alpha  \\
x \cos 2\beta\, + y \sin 2\beta\, &= r + h \cos 2\beta + k \sin 2\beta\\
x \cos 2\gamma\, + y \sin 2\gamma\, &= r + h \cos 2\gamma + k \sin 2\gamma
\end{align} \tag{2}$$
Conveniently, these equations are already in normal form. If we assign $a$, $b$, $c$ to the "constant terms" (that is, the right-hand sides) of the equations in $(2)$, we have a linear system in $r$, $h$, $k$ that we can readily solve (via linear combinations, Cramer's Rule, or what-have-you). The result reduces with a bit of trig, and we find

The incircle of the triangle with side-lines
  $$\begin{align}
x \cos 2\alpha + y \sin 2\alpha &= a  \\
x \cos 2\beta\, + y \sin 2\beta\, &= b\\
x \cos 2\gamma\, + y \sin 2\gamma\, &= c
\end{align} \tag{3}$$
  has center $(h,k)$ and radius $r$, where
  $$\begin{align}
h &= \phantom{-}\frac{1}{2\sigma}\left(\;
  a \cos(\beta + \gamma)  \sin(\beta  - \gamma)
+ b \cos(\gamma + \alpha) \sin(\gamma - \alpha)
+ c \cos(\alpha + \beta)  \sin(\alpha - \beta)\;\right) \\[4pt]
k &= \phantom{-}\frac{1}{2\sigma}\left(\; a \sin(\beta + \gamma) \sin(\beta - \gamma) +
   b \sin(\gamma + \alpha) \sin(\gamma-\alpha) + c \sin(\alpha+\beta) \sin(\alpha-\beta)\;\right) \\[4pt]
r &= -\frac{1}{4\sigma}\left(\;a \sin 2 (\beta - \gamma) + b \sin 2 (\gamma - \alpha) + c \sin 2 (\alpha - \beta)\;\right) \\[4pt]
\sigma &= \phantom{-}\sin(\beta-\gamma)\sin(\gamma - \alpha) \sin(\alpha - \beta) \end{align}$$
Answer: The incircle center coordinates $q$ can be obtained solving a minimization problem.
Given the lines
$$
l_i\to p = p_i + \lambda_i\vec v_i,\ \ i = 1,2,3
$$
minimizing
$$
D(q,\lambda) = \sum_{i}^3||p_i+\lambda_i\vec v_i-q||^2
$$
Now solving
$$
D_q = \sum_i^3 p_i+\lambda_i \vec v_i - q=\vec 0\\
D_{\lambda_j} = \sum_i^3 p_i\cdot \vec v_j + \lambda_i \vec v_i\cdot \vec v_j -q\cdot \vec v_j = 0
$$
which is a linear system in $q,\lambda$ we obtain the incenter $q^*$ and the tangency points $p_i+\lambda_i^*\vec v_i$
or after substitutions
$$
\left(\begin{array}{ccc}
\vec v_1\cdot\vec v_1 & \vec v_1\cdot\vec v_2 & \vec v_1\cdot\vec v_3\\
\vec v_2\cdot\vec v_1 & \vec v_2\cdot\vec v_2 & \vec v_2\cdot\vec v_3\\
\vec v_3\cdot\vec v_1 & \vec v_3\cdot\vec v_2 & \vec v_3\cdot\vec v_3
\end{array}\right)\left(\begin{array}{c}\lambda_1\\ \lambda_2\\ \lambda_3\end{array}\right) = \left(\begin{array}{c}(p_1+p_2+p_3)\cdot \vec v_1\\ (p_1+p_2+p_3)\cdot \vec v_2\\ (p_1+p_2+p_3)\cdot \vec v_3\end{array}\right)
$$
Now considering that $\vec v_1\cdot\vec v_j = a_i a_j+b_i b_j$ and imposing $a_i^2+b_i^2 = 1$ we have
$$
M = \left(\begin{array}{ccc}
\vec v_1\cdot\vec v_1 & \vec v_1\cdot\vec v_2 & \vec v_1\cdot\vec v_3\\
\vec v_2\cdot\vec v_1 & \vec v_2\cdot\vec v_2 & \vec v_2\cdot\vec v_3\\
\vec v_3\cdot\vec v_1 & \vec v_3\cdot\vec v_2 & \vec v_3\cdot\vec v_3
\end{array}\right) = \left(\begin{array}{ccc}
1 & \cos u & \cos v\\
\cos u & 1 & \cos w\\
\cos v & \cos w & 1
\end{array}\right)
$$
and then
$$
M^{-1} = \frac{1}{\Delta}\left(
\begin{array}{ccc}
 \sin ^2(w) & \cos (v) \cos (w)-\cos (u) & \cos (u) \cos (w)-\cos (v) \\
 \cos (v) \cos (w)-\cos (u) & \sin ^2(v) & \cos (u) \cos (v)-\cos (w) \\
 \cos (u) \cos (w)-\cos (v) & \cos (u) \cos (v)-\cos (w) & \sin ^2(u) \\
\end{array}
\right)
$$
with $\Delta = \det M = 2 \cos (u) \cos (v) \cos (w)-\cos ^2(u)-\cos ^2(v)+\sin ^2(w)$
NOTE
$$
a_i x + b_i y + c_i = 0\equiv ((x,y)-(0,-\frac{c_i}{b_i}))\cdot(a_i,b_i)=0\equiv p = p_i+\lambda_i \vec v_i
$$
with
$$
p = (x,y)\\
p_i = (0,-\frac{c_i}{b_i})\\
\vec v_i = (a_i, b_i)
$$


Retornando JSON de uma factory para um controller com angularjs

Question: Estou começando a estudar angular mais a fundo, e estou tendo problemas ao processar dados JSON em uma factory e passá-los para um controller.
Minha ideia é: Um app simples, apenas para estudo, onde eu digito a capital e ele me retorna o estado. Simples, não?
Meu JSON está assim:
[
{ "state": "Rio Grande do Sul", "capital": "Porto Alegre " },
{ "state": "Santa Catarina", "capital": "Florianópolis" },
{ "state": "Paraná", "capital": "Curitiba" },
{ "state": "São Paulo", "capital": "São Paulo" },
{ "state": "Rio de Janeiro", "capital": "Rio de Janeiro" },
{ "state": "Minas Gerais", "capital": "Belo Horizonte" },
{ "state": "Espirito Santo", "capital": "Vitória" } ]

Minha factory:
angular.module('appUi')

.factory('CidadeService', ['$http', function($http) {
var vm = this;

var estados = {}

var dados  = [];
var teste = 4;
vm.dados = [];

return {
    retornaDados : function() {
        return $http({
            url: '../dados.json',
            method: 'GET'
    })
        .then(function(data) {
        vm.data = data;
        return vm.data;
    })
    }

}
}])

Meu controller:
.controller('CidadeCtrl', ['$scope','$http','CidadeService', function($scope, $http, CidadeService){

var vm = this;
var enteredcapitalCtrl = null;
vm.enteredcapitalShow = null;
vm.dados = {};

$scope.$watch('enteredcapital', function(enteredcapital) {
        enteredcapitalCtrl = enteredcapital;
});

vm.showState = function() {
    vm.dados = CidadeService.retornaDados();
console.log(vm.dados);
    vm.enteredcapitalShow = enteredcapitalCtrl;
}
}])

E meu html:
<form action="" ng-submit="cidade.showState()">
    <fieldset>
        Digite o nome de uma capital:
        <input type="text" ng-model="enteredcapital">
        <input type="submit" value="Ok">

O estado é: {{ '''AQUI VIRÁ O ESTADO''' }}

    </fieldset>
</form>

A lógica é simples (eu acho), a função retornaDados, que está no scope da factory retorna os objetos vindos do JSON pelo GET, e no meu controller, eu vou pegar a cidade, e retornar no meu array de objetos qual o estado relativo a capital.
Meus problemas:
1- O que eu retorno no console.log(vm.dados) no controller é o seguinte:
$$state: Object
status: 1
value: Object
config: Object
data: Array[7]
0: Object
capital: "Porto Alegre "
state: "Rio Grande do Sul"
__proto__: Object
1: Object
2: Object
3: Object
4: Object
5: Object
6: Object
 length: 7
__proto__:
array[0]
headers: (c)
 status: 200
statusText: "OK"
 __proto__: Object
__proto__: Object
 __proto__: d

E eu deveria retornar apenas o array de objetos, porque está acontecendo isso?
2- Com o array correto retornado, como eu vou fazer essa busca nos objetos? O underscore pode me ajudar? Não consegui encontrar nenhuma função que auxilie com isso.
Answer: Primeira coisa, quando você faz um request $http, você está trabalhando Assyncronamente, o que quer dizer que sua função.
retornaDados : function() {
    return $http({
        url: '../dados.json',
        method: 'GET'
})
    .then(function(data) {
    vm.data = data;
    return vm.data;
})
}

é Assyncrona, logo quando você chama o retornaDados, ele está te retornando a função e não o resultado da mesma, para deixar o mesmo "Sincrono" é necessário implementar uma PROMESSE, "$q" ou seja uma promessa de retorno. seu código ficaria da seguinte forma.
   retornaDados : function() {

        var deffered = $q.defer();
        $http({ url: '../dados.json', method: 'GET'})
          .then(function(response) {
             deffered.resolve(response.data);
          })

        return deffered.promise;
   }

Lembrando que quando você faz uma request $http, passando um JSON de configuração seu retorno é um objeto (response) com os as propriedades Data, Status, etc.
mais na ref.
https://docs.angularjs.org/api/ng/service/$http
A chamada desse método ficaria da seguinte forma.
    vm.showState = function() {
        CidadeService.retornaDados().then(function(retorno){
          console.log(retorno); // no retorno você vai ter o que veio do $http

          //vm.enteredcapitalShow = enteredcapitalCtrl;
    });
}

Agora com o array correto, precisa ver o que você precisa fazer .. você pode preencher uma variavel e utilizar o ng-repeat, em um Options de um selectBox para exibir ou jogar em um grid, depende da sua necessidade.
Comment: Entendi! Muito boa a explicação, realmente não tinha me atentado a esses detalhes.Obrigado
Comment: rsrs, sem problemas, qualquer dúvida estou a disposição @CarvBru


How can I detect if a user profile in Windows is a roaming profile?

Question: I have a user who is having some issues. In order for me to resolve it I need to know if he is on a roaming profile or not. I believe he is but I want to confirm it. What are some signs that will tell me?
Also he is using Windows XP Pro and we are on an Active Directory domain in Windows Server 2003.
Answer: If you have access to the user's machine, go to System Properties -> Advanced -> User profiles; there you will see if it's a local or roaming profile.
You can also have a look at the user's profile settings in Active Directory (they are in the user account's properties).
Comment: +1 - There isnt much more you can say for this one :)


Como selecionar um formulário de contato específico para formatar no CSS

Question: Estou trabalhando num formulário de contato rápido na minha página, e preciso formatá-lo no css com o seguinte código:

form.wpcf7-form {
position: absolute;
width: 250px;
top: 165%;
left: 65%;
text-align: center;
background-color: rgba(89, 89, 89, 0.5);
background-size: 300px 442.95px;
}

O código acima aplica a formatação para todos os formulários de contato no site, mas preciso que essa formatação se aplique apenas a esse formulário de contato.
Segue o short code dele.
[contact-form-7 id="4831" title="Contato Rápido"]

Como posso selecioná-lo no css?
Answer: Adicione uma classe diretamente no shortcode do seu form:
[contact-form-7 id="4831" title="Contato Rápido" html_class="form_rapido"]

E altere seu CSS:
form.form_rapido {
    position: absolute;
    width: 250px;
    top: 165%;
    left: 65%;
    text-align: center;
    background-color: rgba(89, 89, 89, 0.5);
    background-size: 300px 442.95px;
}

fonte: http://contactform7.com/faq/can-i-add-id-and-class-attributes-to-a-form-element/
Comment: Muito obrigado William! Usei sua dica e deu certo!
Answer: coloque assim:
form#4831.wpcf7-form {
    position: absolute;
    width: 250px;
    top: 165%;
    left: 65%;
    text-align: center;
    background-color: rgba(89, 89, 89, 0.5);
    background-size: 300px 442.95px;
}

o # indica o ID do elemento html que vc quer aplicar o estilo
Comment: Seria outro jeito de selecionar esse id, não pensei nisso. Obrigado!
Comment: Caso alguma das respostas seja útil não esqueça de aceitar e/ou dar upvote,  grato


How do I set the HTML5 date "min" attribute?

Question: I have a date field set up on a node in Drupal 8 using the default date time field formatter. I would like the date picker pop-up to start with a specific date I have defined in a config variable.
How can I do this? I have tried the code suggested on How to add select years and months select Drupal 8.1 date picker? but it doesn't do anything for me.
I have also looked for a way to pass datepicker options to the field element (looks like you could do that in Drupal 7 date module), but couldn't find a way to do that either.
Answer: In Drupal 8, the datetime fields are HTML5 inputs, so the popup is provided by the browser itself, or from a polyfill library for browsers that don't support these inputs (eg, Firefox).
If you want to provide a default value, you can do it from the settings for the field.  You can use the Current Date or a Relative Date as the default.  Despite the name and the docs on Relative Date, you can use this to set an actual date/time.
If you need to pull the default value from somewhere else (like config), you would hook_form_alter() the node form, and then check the field value.  If it is empty, you would set the value there.
Comment: When I have access to my dev machine later, I will post working code for the `hook_form_alter()` methods.
Comment: Sorry, replied to the wrong answer below (Monday mornings!). I borrowed some of the code from this article on how to make the date field use human formats. This works for all date fields:
Answer: From mpdonadio's tip above, I actually need to set the min attribute value on the HTML 5 date value. I came across this article, which includes code to remove the seconds from the time element.
Combining those two tips, the following code works to set the min attribute on the date field:
/**
 * Implements hook_element_info_alter().
 */
function mymodule_element_info_alter(array &$types) {
    // Alter dateteime fields
  $types['datetime']['#process'][] = 'mymodule_datetime_set_startdate';
}

/**
 * Custom function to alter HTML 5 date fields.
 */
function mymodule_datetime_set_startdate($element) {
  if ($element['#parents'][0] == 'field_my_date_field') {
    // get the start date config value
    $config = \Drupal::config('mymodule.config');
    $start_date = strtotime($config->get('mymodule_start_date'));

    // For browsers using the HTML 5 date pop-up, set the min attribute value
    $element['date']['#attributes']['min'] = format_date($start_date, 'html_date');

  }
  return $element;
}

This method works better in my case than a standard form alter because there is another date field in nested paragraphs that are tricky to form alter.
The min value seems to be picked up by the fallback jQuery UI datepicker too - it works in all the browsers I've checked (including IE 11).
Answer: In drupal 7 You Can use date moduel(https://www.drupal.org/project/date). This module provide Date Popup Timepicker option for date field.
Comment: Oooooh! I had no idea it did that. No wonder my jQuery attempts weren't working. It seems like I should be able to actually pass the date value to the min attribute on the date field, then that will trigger the pop-up to start on that date.

I am trying to avoid setting the default value on the field if I can. Then all new noes will save with the field populated and I don't necessarily want that.


Permission to Start activity denied Restarting appium server not helping

Question: When i am running this script in TestNG
<code>`package TrainingDay3;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.By;
import io.appium.java_client.android.AndroidDriver;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;

public class Test1 {

    private static WebDriver driver;

  @BeforeClass

  public void beforeClass() {

      //public static void main(String[] args) throws MalformedURLException {

            File file = new File("D:\\workspace\\AppiumTraining\\apk\\app-qa-debug_original.apk");
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("Version", "6.0.1");
            capabilities.setCapability("deviceName", "XT-1254");
            capabilities.setCapability("app", file.getAbsolutePath());
            capabilities.setCapability("appPackage", "org.aarp.careconnect");
            capabilities.setCapability("appActivity", "org.aarp.careconnect.activities.MainActivity");
            try {
                driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
            } catch (MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

  }

        @Test
          public void f() {

            //locate the Text on the app by using By.className()
                    //driver.findElement(By.className("android.widget.Button")).click();//("android.widget.Button")).click();
                    //driver.findElement(By.className("android.view.View")).click();
                    //driver.findElement(By.className("android.widget.EditText")).click();
                    //driver.findElement(By.className("android.widget.Button")).click();

          }

  @AfterClass
  public void afterClass() {
            // TODO: handle exception
            //close the app
            driver.quit();
  }
}`
</code>
getting exception FAILED CONFIGURATION: @BeforeClass beforeClass
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: Permission to start activity denied.) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700' although i have  restarted the appium server multiple times but it won't help.
Answer: You are launching activity which has android exported = True
To solve this issue, follow below steps:

Set path for SDK/build-tools
Now from command prompt run aapt dumb badging "path of apk"
Find Launchable activity

This will work


What is EntityStorage?

Question: I'm attempting to understand the concept of entity storage. For example in this tutorial
https://www.sitepoint.com/drupal-8-version-entityfieldquery/
it's using code to load the nodes from nids in a similar way to this
<code>$ids = \Drupal::entityQuery('node')
    ->condition('status', 1)
    ->execute();

$node_storage = \Drupal::entityManager()->getStorage('node');

// Load multiple nodes
$node_storage->loadMultiple($ids);
</code>
But I'm not sure exactly what this is doing
<code>$node_storage = \Drupal::entityManager()->getStorage('node');
</code>
My best guess is that it's loading the format of how the node is stored in the database so it knows how to load everything based on that format, but that's just a guess.
Also side note: the path I normally take is doing a foreach loop on the query results and loading the node based on the nid inside that. Like so. But I'm not sure what's best practice.
<code>        foreach ($ids as $nid) {
            $node  = Node::load($nid);
        }
</code>
What exactly is entityStorage, and what function is it providing?
Comment: It's literally an interface to the storage backend for the entity data. That could be MySQL, SQLite, mongo, hand-written and managed by a guy interpreting the blinking HDD lights as morse code, whatever. It exists so Drupal (and you) can call predictable methods to get data, but not worry about where or how the underlying data is stored. Loading entities in a loop like that is inefficient when you consider there's a `loadMultiple` method available
Comment: Couldn't find an example for the morse code, but this is also a nice one External Entities https://www.drupal.org/project/external_entities and @Matt Node::load() is only a shortcut to the entity storage, see https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21Entity.php/function/Entity%3A%3Aload/8.3.x
Comment: Also worth pointing out that Node::load() is simply a helper method that gets the entity storage handler to then call load on that. There aren't two different API's, it's just a shortcut. And there is a loadMultiple() too, you should never call load() in a loop
Comment: @Matt Only if the module was being "naughty" and not using the interface. All user space code should be using the interface, precisely so the underlying storage can change without breaking anything. Program to the interface, not the implementation, as they say
Comment: This is really cool, and I suppose I can see applications where it might come in handy, especially in all situations where morse code is the only option. But if I created my own entity storage interface how would I tell drupal to switch to using my own instead of the default one for nodes. For instance if I clicked add content and submitted a basic page. How do I tell it to save it in morse code instead. I'd want to switch to the new format site wide, not just for reading and saving things in a plugin.
Comment: However I can see how not using the default would be a problem if contributed modules depend on a specific interface. Unless this is already considered and remedied
Comment: @Matt, to answer the question in your comment, how to tell drupal to save nodes in morse code. First you need the morse storage and then alter the node entity type to use it. This hook has exactly this example code https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_type_alter/8.3.x
Comment: @4k4 would performing this action break every contributed module that relied on the original node storage method? Would using Node::load() instead get around this issue? Err nevermind I guess the method you showed changed what \Drupal::entityManager()->getStorage('node'); did
Answer: Entity storage is a storage controller for the entity that handles the actual CRUD operations of entity data in the storage. That means it is responsible for inserting and deleting the entity data in the actual storage/repository.
The storage can be a .yaml file (for config entities) or a SQL database (for content entities). There are some specific use cases for null storage (like e-mail message) which basically means no data is stored anywhere and entity with such storage is just virtual: It exists only per single request as you define it.
You can additionally write your own storage controller and use remote storage, a file, a stream or whatever the requirements are.
Comment: storage *handler*, we don't use the term controller anymore in the entity system to avoid confusion with routing and other uses of controller.

What is EntityStorage?


How useful is Turing completeness? are neural nets turing complete?

Question: While reading some papers about the Turing completeness of recurrent neural nets (for example: Turing computability with neural nets, Hava T. Siegelmann and Eduardo D. Sontag, 1991), I got the feeling that the proof which was given there was not really that practical. For example the referenced paper needs a neural network which neuron activity must be of infinity exactness (to reliable represent any rational number). Other proofs need a neural network of infinite size. Clearly, that is not really that practical.
But I started to wonder now if it does make sense at all to ask for Turing completeness. By the strict definition, no computer system nowadays is Turing complete because none of them will be able to simulate the infinite tape.
Interestingly, programming language specification leaves it most often open if they are turing complete or not. It all boils down to the question if they will always be able to allocate more memory and if the function call stack size is infinite. Most specification don't really specify this. Of course all available implementations are limited here, so all practical implementations of programming languages are not Turing complete.
So, what you can say is that all computer systems are just equally powerful as finite state machines and not more.
And that brings me to the question: How useful is the term Turing complete at all?
And back to neural nets: For any practical implementation of a neural net (including our own brain), they will not be able to represent an infinite number of states, i.e. by the strict definition of Turing completeness, they are not Turing complete. So does the question if neural nets are Turing complete make sense at all?
The question if they are as powerful as finite state machines was answered already much earlier (1954 by Minsky, the answer of course: yes) and also seems easier to answer. I.e., at least in theory, that was already the proof that they are as powerful as any computer.

Some other questions which are more about what I really want to know:

Is there any theoretical term which can say something more specific about the computational power of a computer? (given its limited memory space)
How can you compare the computational power of practical implementations of neural nets with computers? (Turing-completeness is not useful as argumented above.)
Comment: I'm voting to close this question because it's not a programming issue.
Answer: The point of stating that a mathematical model is Turing Complete is to reveal the capability of the model to perform any calculation, given a sufficient amount of resources (i.e. infinite), not to show whether a specific implementation of a model does have those resources. Non-Turing complete models would not be able to handle a specific set of calculations, even with enough resources, something that reveals a difference in the way the two models operate, even when they have limited resources. Of course, to prove this property, you have to do have to assume that the models are able to use an infinite amount of resources, but this property of a model is relevant even when resources are limited.
Comment: +1 like all things in math involving infinity, it may not be physically realizable, but that does not make it a physically useless concept.
Comment: I'm still a bit curious about what "given a sufficient amount of resources" exactly means (in a mathematically sense) and also what it would mean for a neural network (adding more neurons to it is not really comparable to adding more memory to a computer).
Comment: Well, in feedforward multi-layer neural networks, you can think of adding more neurons to the network as improving on the precision of the network. In other words, the precision of the network at a given problem is (non-linearly) correlated with the number of neurons and layers in the network. This comes in contrast with a traditional algorithm, where there is no precision issue: there is a certain threshold in the amount of resources, above which the problem can be solved, under which solving the problem with the given algorithm is impossible.
Comment: I'm not really having feedforward networks in mind. Those are clearly (under each relaxed interpretation) not Turing complete. You need a recurrent network to get the Turing computational power.
Comment: Ya and don't forget, your brain is not Turing complete. It doesn't make much sense to "give your brain more resources". Or rather, the "capability" and the "resources" can't be separated for the brain, since the capability is in the computational units themselves, so adding more of them changes the "computer" itself.
Comment: @SanjayManohar That's not true. The human brain is capable of simulating any Turing machine using a pen with enough ink and paper (i.e. the human brain can implement a universal Turing machine), so the human brain is Turing complete.
Comment: This is a very interesting comment. Functionalist philosophers will tell us that the system you described is "your brain plus pen plus paper" -- all of which are involved in the computing. They would allow seemingly inanimate objects (eg notepaper) to perform computational roles (eg short-term memory), blurring the bounds of what constitutes *"the turing machine"*. If I use a calculator or computer to solve a problem, is it **my brain** doing the computing? What if I look things up in a dictionary? Perhaps if we can externally augment memory arbitrarily, bar lifetime restrictions, we are TC?
Comment: PS I think it's also worth noting that the human brain, as it is currently wired up, is also intrinsically fallible in executing a sequence of computational steps. The underlying algorithm we implement becomes inherently fatigued and error-prone. We don't understand the algorithm well enough to say, but perhaps you are right that the system of "brain plus augmentations" is Turing complete
Comment: Even a computer is fallible though. A cosmic ray can hit your memory and flip a bit, corrupting a variable value. Of course, this is much less likely than good old human error.
Answer: After many years, let me give an answer to this question myself.
Turing completeness

As powerful as a Turing machine (TM).
Requires an infinite memory. I.e. in practice, no physical device ever can be Turing complete.
Consider a normal personal computer (PC):

A specific physical instance is not Turing complete, as it has finite memory.
However, consider the concept of a PC as something where you could add memory on demand. All programs will still work in the same way when you add more memory. For any given input, and any given program, there is a maximum amount of memory such that it should work. (Let's not be pedantic now about the int64 memory address limit or things like that. These are technical limits, which could be solved, e.g. by big ints, etc.) Thus, we can say that the concept of a PC is Turing complete. This is also called an abstract machine.
So, differentiate between a specific machine or device (PC, RNN, human brain) and a programming language or abstract machine for a programming language. A programming language usually does not have a restriction on the amount of memory it can use, thus programming languages can be Turing complete. See the official C language standard definition, which uses an abstract machine to define the semantics. The main question is, which of those specific classes (PC, RNN, human brain) allows to formulate abstract machine variants, and are those abstract machine variants Turing complete?

Turing completeness is really mostly about the memory concept. Consider any finite state machine/automaton (FSA), and some access to external memory. Depending on the type of memory, you end up in different classes of the Chomsky hierarchy:

no memory / finite memory: regular languages
single stack: pushdown automata, context-free languages
two or more stacks: Turing complete, recursively enumerable language

Recurrent neural networks (RNN)
On the computational power of neural nets
An often cited paper is On the computational power of neural nets, Siegelmann & Sonntag, 1992, which states that RNNs are Turing complete.
This paper assumes that we have rational numbers without limits in the nominator/denominator, i.e. the infinite memory is encoded as rational numbers, or floating point numbers of infinite precision. See also here. Usually we do not model a NN in a way that is operates with rational numbers (without limit). When we restrict ourselves to (R)NNs with finite precision weights and activations, the proof in the paper falls appart, and does not apply anymore. Thus, this paper is not so relevant.
There is a more recent paper, On the Practical Computational Power of Finite Precision RNNs for Language Recognition, Weiss et al, 2018, which exactly addresses this.
Universal approximator
It is well known that most standard NNs are universal approximators. This states, that given any function (nonconstant, bounded, and continuous), and given some allowed threshold, you can construct a NN which approximates this function within the allowed threshold.
This is about finite dimensional vector spaces. When we speak about computability, we speak about sequences, thus we have an infinite dimensional vector space. Thus this property is not so relevant.
Without external memory
The question is how to define the concept of a standard RNN. In the paper mentioned above, it assumes infinite precision in the activations. But I argue this is not a reasonable concept of a RNN as you never have this. And with this being limited, there is no other way how a concept of a standard RNN can have infinite memory.
Thus, to state it explicitly:
Without external memory, the standard RNN, and also LSTM is not Turing complete.
There is also no straight-forward way how you could define a concept of a RNN, where you could add memory on demand.
The memory of a RNN are the most recent hidden activations. Adding more memory means to change the NN, i.e. adding new neurons, thus adding the internal workings of it. This is like changing the program itself.
With external memory
There is the Neural Turing machine (NTM) and a few similar models, which have some sort of external memory.
Here it is straight-forward to think about a concept of a NTM where you would add memory on demand.
Thus we can say that the concept of a NTM is Turing complete.
There are some details like the type of attentions used in the heads, which needs some adaptation. There is a follow up on the model, the Differentiable neural computer (DNC) which explicitly addresses this, and also has some explicit mechanism to add memory.
Learning / training
We spoke mostly about the theoretic computation power.
A very different question is whether the NN can learn such a function. I.e. whether training (gradient search) leads to a NN which has learned a computable function.
Human brain
We might interpret the human brain (or any brain) as kind of a complex neural network. We can also ask the question, whether the human brain (model) is Turing complete. See e.g. here. This question is a tricky one. The intuition would say that we are able to perform any kind of computation, thus the human brain is Turing complete. However, the arguments we have outlined here shows that a RNN is not Turing complete. Important is again the memory effect. At some point, the memory capacity of a human brain is not enough to operate on some input. Thus we would need external memory. So, the human brain together with external memory is Turing complete, obviously. But this is maybe not the interesting question (and also assumes that a human brain could be as large as needed to encode any Turing machine program, so there is no upper size of a human brain, which is not really true). More interesting is the question of just the human brain itself, without any external memory. Or basically, how to define the abstract machine or the concept of a human brain? Does this concept allows for infinite memory? Is this straightforward to define?
There is one aspect of the memory in a human brain which is a bit different than in a standard RNN: It can generalize to a high degree, and the addressing mechanism to access certain activations is different. Also, it has some kind of adaptive weights (which however also only can store finite information). So, considering this, it's actually already more similar to a NTM than just a RNN. There are many different kinds of memory in the human brain. Some of it is just as static as a RNN (like the current activations) but other types allow for associative memory like a NTM. And thus the human brain is also similar to a PC, which also has finite memory, whereas the concept of a PC has infinite memory.
So maybe we can say that a concept of a human brain has infinite memory as well, due to the associative memory, and also can be as large as needed to encode any program, and thus the concept of a human brain is Turing complete. Maybe this should be called an abstract human brain (instance of an abstract machine).
Comment: Thank you for your answer. Taking off from your last section, I would also add that the finite amount of matter in the Universe prohibits Turing completeness of any machine. In order to add more memory, one would need to add more entropy, which would result in addition of more material in form of atoms or even elementary particles, which is impossible since there are approximately 10^80 atoms in the Universe.
Comment: "I.e. in practice, no physical device ever can be Turing complete." " the finite amount of matter in the Universe prohibits Turing completeness of any machine" - No, that's a conjecture without a proof. You can create infinite sequences in functional languages (Lambda Calculus is equivalent to Turing Machines). You could have a TC language that has an infinite number of variables A[1] to A[inf] that runs on your PC ... in all cases they ARE TC, you can reason about anything computable but for some algo's you might run out of resources such as memory or time.
Comment: @wentbackward A functional language is not a physical device.
Comment: @Albert the physical device doesn't actually need infinite memory to be turing complete, only some algorithm implementations might. The point I wanted to make is that lambda calculus is mathematically equivalent to a turing mahcine but does not need infinite memory.
Comment: @wentbackward No, every Turing complete machine needs infinite memory. Turing complete implies that you can simulate a Turing machine. A Turing machine itself has infinite memory.
Answer: When modern computers are said to be Turing Complete there is an unspoken exception for the infinite storage device Turing described, which is obviously an impossibilty on a finite physical computation device. If a computation device can do everything a Turing machine can do (infinite storage not withstanding) it is Turing complete for all practical intents and purposes. By this less strict definition of Turing completeness, yes, its possible that many neural networks are Turing complete.
It is of course possible to create one that is not Turing complete.
Answer: Regular feedforward neural networks are not turing complete. They are, in effect, equivalent to a single complicated mathematical function that may do quite a lot of calculations but doesn't have any ability perform looping or other control flow operations.
However, if you wire up a neural network with some way to access a stateful environment then it can be be made into a turing complete machine.
As a most trivial example, you could recreate a classic-style Turing machine where:

the input to the neural network is the value on the tape and the previous state
the output of the neural network is the next state and the action

You could then train the neural network to emulate the actions of any desired turing machine state table / configuration (perhaps by supervised learning on the actions of another turing machine?)
Note: The idea of running a feedforward net repeatedly with some form of state feedback is essentially equivalent to a recurrent neural network. So you can think of a recurrent neural network plus the logic that runs it repeatedly as being Turing complete. You need the extra logic (over and above the network itself) to ensure Turing completeness because it is necessary to handle things like termination, repetition and IO.
Comment: I fully agree about feed-forward nets but I was more interested about recurrent nets.
Comment: @Albert - that's the point I was making! A recurrent neural net is, after all, equivalent to a feed-forward net run repeatedly in a stateful environment with some form of feedback :-) I'll try to make the answer more clear though.....
Comment: If you mean an external memory by "access a stateful environment", you end up with a model like the Neural Turing Machine (NTM) or Differentiable Neural Computer (DNC), which are in fact stated to be as powerful as a Turing machine.
Answer: Turing-completeness of recurrent neural networks could mean: the (finite) transition tables of each and every Turing machine (with a finite-state head and an infinite tape) can be modelled by a finite recurrent neural network (finitely many neurons with finitely many states, especially only two states). The transition tables define three functions:

next-state(current-state,current-symbol)
next-symbol(current-state, current-symbol)
direction(current-state,current-symbol)

This is how a recurrent neural network may perform this task (just a very raw sketch):

The green neurons read the symbol in the current cell (in binary representation), the gray neurons (initally mute) determine the current state, the red neurons write the new symbol to the current cell, the yellow neurons determine whether to go left or right. The blue neurons are the inner neurons (initially mute).
The claim is, that for each and every Turing machine there is such a recurrent neural network.
I wonder if there is a systematic way to construct such a network from given transition tables.
Comment: An often cited paper is [On the computational power of neural nets, 1992](http://binds.cs.umass.edu/papers/1992_Siegelmann_COLT.pdf) which does such RNN construction. Note however, this assumes rational numbers, i.e. the infinite memory is encoded as rational numbers, or floating point numbers of infinite precision. See also [here](https://stats.stackexchange.com/questions/220907/meaning-and-proof-of-rnn-can-approximate-any-algorithm). This is not realistic in practice. That is why Neural Turing Machines (NTM) or Differential Neural Computers (DNC) are different. And the human brain as well.
Comment: In your construction, you assume that there is an external infinite tape, which is not part of your NN. So yes, a NN + external infinite tape is Turing complete. However, my question was about just a NN, without anything external.
Comment: But something must be infinite: if not the tape, then the NN. And if  not the number of neurons, then the number of states.
Comment: That's the point. The NN (as-is) is finite. Thus it is in fact not Turing complete, which was my original question. If you add something to it, of course you can make it TM-complete, but that is true for anything, right? I wrote a bit about this also now in an own answer to the question.
Comment: @Albert yes, in that sense, NN is not Turing complete, and neither is anything else in this universe, including my laptop. But NN and my laptop is Turing complete in a restricted sense that given infinite storage, both are Turing complete. Note that a calculator with infinite storage is not Turing complete even in the restricted sense. When people talk about Turing completeness of physical devices, they omit the word 'restricted', hoping that it is understood under the context.
Answer: To partially address your second question:
Neural Networks have the property of being universal approximators - that is, they can approximate any function to an arbitrary degree of precision. It's the "degree of precision" part that keeps the Neural Network from needing to be infinite.
Comment: Universal approximators of functions over finite dimensional vector spaces. When you speak about computability, you speak about sequences, thus you have an infinite dimensional vector space. Thus this property is not so relevant.
Answer: I think the concept of Turing completeness is not intended to tell us whether a particular computer can perform a particular task.
Rather, it purposes to tell whether a particular language is capable of expressing a particular task. That is, I'd say it's really about expressing an algorithm not performing it.
As neural networks don't have a language, it's a question of expressing an algorithm in terms of a neural network, rather than the capability of that network. So I don't know the answer to the last bit of your question!
Answer: I think an important point about the turing machine is that for any given input and program, the machine will only need a finite amount of tape, assuming it halts some time. That's why I would say the term "turing complete" is useful: You only need finite memory to run one specific turing complete program on some specific input (if the program halts). But if you have a non-turing-complete machine/language/technology, it won't be able to simulate certain algorithms, not matter how much memory you add.
Comment: +1 I was just in the process of writing almost exactly the same answer when yours came in.
Answer: It is almost always nice to know which class in the Chomsky hierarchy your system is. This is especially important in the more constricted classes, like regular languages / finite automata vs context-free languages. Also having the skill to recognize which class your the problem you are trying to solve is in is also important, otherwise one might try to do silly things like parsing HTML or XML with regular expressions only, which is impossible.
Having the knowlegde that your formalism or system is turing complete makes a statement that you can build whatever you want with it. It does not say anything about practicality, just the possibility or impossibility of solving problems. This is painfully true when considering turing tarpits, but there is also many turing complete systems which are specifically made for niche purposes that no one should ever dream of using for general purpose work in a production setting.
In short, good knowledge of the Chomsky hierarchy will help you out in very many situations, not only for choosing the right type of parser; regexp, pushdown, CFG or more powerful, but also for choosing the right type of machine or formalism for expressing processes in general.
Answer: Basically it means that with programming language or architecture which are Turing complete
you can execute wide variety of algorithms...   mostly -- any kind of them.
Non-Turing languages are greatly tighter in potential.
Answer: The answer is very simple. If you can emulate a NOR or a NAND gate with it, then it is Turing Complete, assuming that the rest is just a matter of combining things together.


How to execute parse cloud after each 5 minutes

Question: I am using parse in an ios app. We need a scheduled push notification implementation. but in ios , there is no API for scheduled push notification. So scheduled push notification can be achieved through cloud code. But we need that cloud code should  be called  after each five minutes.Somebody suggest me , How  can I get this ?
Answer: You can use Jobs -> Scheduled Jobs. This option is available in the Parse Dashboard (in the Core tab).
First create your function in cloud code javascript (I assume you know how to do this)
Parse.Cloud.job("sendPushNotifications", function(request, status) {
    // your code here
)}

Now go to Scheduled Jobs. You will find options there to schedule the sendPushNotifications  function you just created.


the orthogonal complement intersection of sets

Question: Let $\{C_\gamma\}$ be a net of subsets of a Hilbert space(or some other spaces). Do we have
$$(\wedge_\gamma C_\gamma )^\perp = \vee_\gamma  C_\gamma ^\perp?$$
It is known that
it works when $\{C_\gamma\}$ is a sequence of sets.
Comment: @Freeze_S  Thx, gay!
Comment: You may have a look into: [Hilbert vs. De Morgan](http://math.stackexchange.com/q/1408559/79762)
Comment: You're welcome! Gay?
Comment: @Freeze_S  sorry! GUY
Answer: Assuming that $\wedge_\gamma C_\gamma $ is the intersection, ie the inf, and $\vee_\gamma  C_\gamma ^\perp$ is the sup, ie the smallest closed subspace containing each $C_\gamma^\perp$, then yes. (The reason I'm not entirely sure is that this has nothing to do with nets, everything is the same for a family $C_\gamma$, directed or not.)
Since $C_\gamma^\perp$ is orthogonal to $C_\gamma$ it is orthogonal to the intersection of the $C_\gamma$. So $$C_\gamma^\perp\subset (\wedge_\gamma C_\gamma )^\perp, $$and since the right side is a closed subspace, the definition of $\vee$ shows that$$\vee_\gamma C_\gamma^\perp\subset (\wedge_\gamma C_\gamma )^\perp.$$
For the other inclusion we need only show that $$(\vee_\gamma C_\gamma^\perp)^\perp\subset\wedge_\gamma C_\gamma.$$But this is clear: If $x$ is orthogonal to $\vee_\gamma C_\gamma^\perp$ then $x$ is orthogonal to $C_\gamma^\perp$, so $x\in C_\gamma$.
Comment: It is very helpful! Wikipedia just has the case of sequence.THX!