What is this scale? [Root , +1 , +3 , +1 , +2 , +1 , +3 , +1]

Question: Intervals (relative to previous note):
Root , +1 , +3 , +1 , +2 , +1 , +3 , +1 (Root again)
Example:
A, Bb, C#, D, E, F, G#
This scale is used often in Turkish Music. But I don't know if it has a name in Western Music.  Does it ?
Comment: I've only seen Phrygian Dominant used to describe a mode of the harmonic minor scale starting on the 5th scale degree, which would only have a single augmented second in it, not two as in the question.
Comment: @CengizFrostclaw, Agreed. I would say that it's the augmented seconds that make the strongest connection to harmonic minor though.
Comment: This scale is known as the Phrygian Dominant scale.
Comment: @PatMuchmore exactly. However, this scale feels very similar to the harmonic minor scale. I think this is because of the major 7th. And I think this scale is occasionally used in western music too, by mixing with other minor scales, just like harmonic minor.
Answer: The technical term for the scale seems to be the  Minor "Gypsy" Scale and it is also known as the Flamenco Mode.
The basic idea is it is a combination of two Phrygian Dominant tetrachords, or a Phrygian Dominant with a Major 7th scale degree.
Here are the links that show both scales match the pattern above and includes the root scale of it the Phrygian Dominant scale:
Minor Gypsy Scale
Flamenco Mode
Phrygian Dominant Scale
Answer: Maqam Suzidil (not a very Western name, but if you try to understand Turkish music, this might get you somewhere) says this and some other sites. Looks like they (Arabic, Persian, Turkish) have an interesting way of classifying the scales by decomposing them into (usually) tetrachords which all have their own "personality". I didn't explore this much but Wikipedia gives some introduction.
Answer: That scale is known as the Double Harmonic scale (at least that's the title of its Wikipedia page here).
Comment: This is also the name by which I know this scale, although it seems there are many alternative (equally valid) names.
Comment: +1 this is the name I've heard it called by most often. This video by 12-Tone does a great job explaining it: https://youtu.be/n7hSabSnCEg
Answer: As an answer to this question : What is this scale? Possibly an Indian Raga
In Indian classical music, this scale is of Raag Bhairav in Hindustani classical music (central and northern India).
It corresponds to Mayamalavagowla in Carnatic (south Indian) music.
Answer: Double Harmonic. Hijaz Kar (Arabic). Suzidil (Turkish). Chromatic, as per Byzantine Liturgical practice. As someone else noted earlier, Rhaag Bhairav. That intervallic pattern, even if the exact intonation is different from tradition to tradition, is quite common.
Answer: Closest I found was a Spanish Phrygian
1 - ♭2 - 3 - 4 - 5 - ♭6 - ♭7 - 1
only difference is the 7th degree...maybe your scale has accidental on the 7th


Twilio: Can a moderator mute specific participants in a conference call?

Question: I can use the Twilio JavaScript API to have a participant mute/unmute themselves, but I'm looking for a moderator to be able to mute specific participants, whether they dial in by phone or by clicking to call.
Thank you!
Answer: Twilio evangelist here.
You could build a UI that lets a "moderator" see all of the connected conference participants by using the Participants resource in the REST API.
You can POST to a specific participant to mute them.
Hope that helps.
Comment: Awesome-- exactly what I was looking for.
Comment: As a bonus feature, is there any way a moderator could see which participant was making noise?  This would be useful when one participant has tremendous background noise but you can't tell which one.
Comment: Sorry.  There is no way to get sound levels from participants.
Comment: Hi @Devin Rader, I've got another Twilio question here that slipped through the cracks: http://stackoverflow.com/questions/28666495/twilio-start-stop-recording-mid-call
Answer: it would seem this would have your answer:
http://www.twilio.com/docs/howto/moderated-conference
Right below the top tells you to call a noun in     {conference} to be able to mute a specific member.
Comment: Thank you, but it seems it's just for the participants to be able to mute themselves, no?  I'm looking for a way for a moderator to mute a participant.


jQuery check if at least two text inputs are filled

Question: This is my form :
<FORM id="form1">
            Fields :
                        <fieldset name="titles">

            <INPUT class = "fit" type="text" name="title">

            <INPUT class = "fit" type="text" name="title">

                        <INPUT class = "fit" type="text" name="title">

                        <INPUT class = "fit" type="text" name="title">
                        </fieldset>
            </FORM>

How can I check if at least two out of these four fields are filled? Here's what i'I've tried :
$('#form1').validate({ // initialize the plugin
    rules: {
        title: {
          required: "input[name='title']",
          minlength: 2
      },
      messages: {
            title: "You must fill at least two titles!"
        }
    }
});

But it's not working, it always returns a valid form... I'm a newbie to jQuery, any help would be appreciated.
Comment: Which plugin are you using, do you definitely have the validate plugin included on the page? Do you get any errors in your console?
Comment: The `name` attribute has to be unique or followed by square brackets to allow multiple values.
Comment: @IanJamieson the plugin is included, and i don't see any errors in the console...
Comment: Which plugin is it so I can check the documentation?
Comment: I have "http://jquery.bassistance.de/validate/jquery.validate.js" AND
"http://jquery.bassistance.de/validate/additional-methods.js"
Answer: For 1 statement to grab both 'select' and 'input' elements, simply change your single jQuery selector  to a multiple selector,
Eg:-
$(this).find('input[type=text], select').each(function(){
            if($(this).val() != "") valid+=1;
        });

Answer: Try this with the button:
$("#submit_button").click(function(){
        if($('input[text]').length < 2) {
                alert('at least two text inputs are filled');
               return false;
            }
      });


SubConsulta MySql 1

Question: Motta,
Obrigado pela agilidade, mas esta instrução esta aparecendo somente o maior salario. Tentei o INNER JOINT,  e quase consegui. Imagine que eu queira compara o salario de pessoas com o mesmo cargo. Veja se consegue entender com a imagem anexa.

Amigos,
Gostaria da Ajuda de vocês em MySql, tenho uma tabela de funcionários que tem apenas três colunas, NOME, CARGO e SALARIO, quero montar um consulta que me traga toda esta tabela e nela contenha o maior valor de salario para o cargo. Totalizando 4 Colunas (NOME, CARGO, SALARIO E MAIOR_SALARIO_P_CARGO. Isto é para verificar a variação.
Comment: Bem-vindo ao site! Por favor edite sua pergunta original com as informações adicionais, em vez de criar uma nova pergunta ou tentar editar uma das respostas. Esta possivelmente será fechada como duplicata, mas não se preocupe que isso é só uma questão de organização do site. Com o tempo você pega o jeito :)
Comment: Você também pode remover esta "pergunta", já que ela de fato não é uma pergunta.
Answer: Olá,
Acredito que essa query pode resolver, não cheguei a testá-la.
<code>SELECT
    T1.NOME,
    T1.CARGO,
    T1.SALARIO_ATUAL,
    (
        SELECT MAX(SALARIO_ATUAL)
        FROM TABELA T2
        WHERE T2.CARGO = T1.CARGO
    ) AS MAIOR_SALARIO_PARA_CARGO
FROM TABELA T1
</code>
Comment: Alan, funcionou perfeitamento...

SubConsulta MySql 1


What $X$ should be homeomorphic to?

Question: Consider $X = \{ (x,y,z) \in \mathbb C^3 \mid x^2 + y^2 + z^2 = 1 \}$.
I want to find a "known" space which is homeomorphic to $X$. A point in $X$ is two real vectors $a,b \in \mathbb R^3$ such that $\langle a,b \rangle = 0$ and $\sum a_i^2 = \sum b_i^2 + 1$.
I don't see what can I say more about the last equation ... I know a similar space was a disk bundle over a $3$-sphere, maybe this is the same here ?
Comment: Is this not $S^5$?
Comment: Perhaps make the space a bit larger. Let the sum of the squares equal any $w\in\mathbb{R}$ to get $X\times\mathbb{R}$ and that leaves the inner product as the only restriction. Then for each $a\in\mathbb{R}^3$, $b$ must lie in a plane orthogonal to $a$ homeomorphic to $\mathbb{R}^2$.  That would be $X\times\mathbb{R}$.
Comment: @Ashwin: I'm assuming that the problem means for $t^2$ to denote the square, not the square magnitude.
Comment: @AshwinTrisal : Hurkyl is right, I consider the sum of square.
Comment: @John : I think your idea is good but how to get back $X$ ?
Comment: Aye, there's the rub. This suggests at most that it's a four dimensional manifold. It's been 40 years since I studied topology so I have only my intuition to rely on.  It would have to be by doing the reverse, in some way, of what was done by replacing the $1$ with a general $w\in\mathbb{R}$. One would have to "take back the $w$" somehow and replace it with the $1$.
Comment: I think this is clear that this is a $4$ manifold since we have one complex equation (or two independant reals equations which drops dimension by $2$). I don't think you can take the reverse, for example I think the topology of the real algebraic variety $\sum x_i^2 - \sum y_i^2 = w $ should not be the same if $w < 0$, $w=0$ or $w > 0$.
Answer: Ok, let us start analysing a simpler case: the curve $x^2+y^2=1$ in $\mathbb{C}^2$. Denote it by $X'$.
The projection $(x,y) \mapsto x$ gives a map $X' \to \mathbb{C}$. This is a double branched cover with two singular points of multiplicity two at $\pm1$. Roughly, this is because the the equation $y^2=1-x^2$ has exactly two complex solutions except when $1-x^2=0$, i.e. $x= \pm 1$.
Now, the  double branched cover of the plane at two points with multiplicity two is the cylinder $\mathbb{R} \times S^1$. This is basic cut and paste that if you are familiar with branched covers you already know. If you are not, read chapter 12 of Kauffman's book "On Knots".
Using the same trick for the curve $X$ (by considering the projection $(x,y,z) \mapsto (x,y)$) we get a double cover $X \to \mathbb{C^2}$ branching at the curve $x^2+y^2=1$. Thus, we can conclude that $X$ is the double branched cover of $\mathbb{R}^4$ branching at the cylinder. Now you can have fun with your cut and paste once again and completely understand this space.
Another possibility is to do a linear change of coordinates ($p \mapsto i \cdot p$) and consider the complex hypersurface with eqauation $x^2+y^2+z^2=-1$. Its projective closure is the curve
$$\bar{X}: \ \ \ \ \ x^2+y^2+z^2+k^2=0\ \ \ \ \ \ \subset \mathbb{CP^3} \ , $$
and it is ismorphic to $\mathbb{CP}^1 \times\mathbb{CP}^1$. An explicit homeomorphism  $\mathbb{CP}^1 \times\mathbb{CP}^1 \to\bar{X}$ is given by:
$$f: \ ([a:b], [c:d]) \mapsto [ac:ad:bc:bd] \ . $$
Your original $X$ is the complement in $\bar{X}$ of the complex curve
$C= \{ x^2+y^2+z^2=0 , \ k=0 \}$. Thus $X= \mathbb{CP}^1 \times\mathbb{CP}^1 - f^{-1}(C)$ and you can do the explicit computation.
Comment: Ok this looks cool. I did also use a covering (I also try to project on the $x$ coordinates, you get a fiber with base $\mathbb C$, generic fibers a conics, except two fibers which are double line) and arrived at the same conclusion at you but couldn't conclude any further. Thanks for all the computations !
Comment: And thanks for the reference this looks also really cool !
Answer: The answer of Antonio Alfieri is really good but not explicit, and I found the answer so I'm just writing in case someone else is also looking for it : $X$ is homeomorphic to the tangent bundle of $S^3$.

What $X$ should be homeomorphic to?


Verificar se existem campos iguais em um form

Question: Tenho um form com 5 selects e estou tentando verificar se algum desses selects estão com o mesmo valor.
$('form').submit(function (event) {
    var $commitment = $("[name='commitment']").val();
    var $proActivity = $("[name='proActivity']").val();
    var $superation = $("[name='superation']").val();
    var $teamWork = $("[name='teamWork']").val();
    var $planningAndOrganization = $("[name='planningAndOrganization']").val();

    Object.prototype.in = function () {
        for (var i = 0; i < arguments.length; i++)
            if (arguments[i] == this) return true;
        return false;
    }

Porém quando preciso validar meu IF fica gigantesco;
    if ($commitment.in($proActivity, $superation, $teamWork, $planningAndOrganization) ||
        $proActivity.in($commitment, $superation, $teamWork, $planningAndOrganization) ||
        $superation.in($commitment, $proActivity, $teamWork, $planningAndOrganization) ||
        $teamWork.in($commitment, $proActivity, $superation, $planningAndOrganization) ||
        $planningAndOrganization.in($commitment, $proActivity, $superation, $teamWork)) {
        $('.alert').show();

        return false;
    }

Existe alguma maneira de fazer essa verificação usando o próprio DOM do form?
Answer: Você poderia verificar o valor de cada option e desabilitar os que possuem o mesmo valor, dessa forma o usuário só poderia adicionar opções diferentes:

$("form > select").change(function() {
  $("form > select > option").prop("disabled", false);
  var elem = $("form > select").not("[name='" + $(this).attr('name') + "']");
  for (var i = 0; i < elem.length; i++) {
    var options = document.getElementsByName(elem[i].name)[0].childNodes;
    for (var j = 0; j < options.length; j++) {
      if ($(this).val() == options[j].innerHTML) {
        options[j].disabled = true;
      }
    }
  }
})

<form>
  <select name="commitment">
    <option></option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
  </select>
  <select name="proActivity">
    <option></option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
  </select>
  <select name="superation">
    <option></option>
    <option>1</option>
    <option>2</option>
    <option>3</option>
  </select>
</form>
Answer: Eu faria da seguinte maneira:
Exemplo:
function validSelectsValues() {
    var domSelects = 'Seus selects aqui';
    var selected = [];
    $(domSelect).each(function() {
        if($.inArray($(this).val(), selected)) {
            continue;
        }
        $.merge(selected, $(this).val());
    });

    return $(select).size() == $(domSelects).size();
}

Dessa forma, a quantidade de selects será iterada dinamicamente e você poderá ter 5 ou 100. A formula sempre vai pegar o valor do select iterado e atribuirá a um array que grava os valores selecionados caso o mesmo não tenha sido gravado anteriormente. Depois é só vc comparar se a quantidade de valores escritos nesse array é equivalente a quantidade de select existentes no seu seletor.
Answer: Tem uma forma bem mais simples:
$("select").change(function() {
   var id =  $(this).attr('id');
   var valor = $(this).val();
   var selects = $('select').not('#' + id).find('option[value="' + valor + '"]:selected');
   if (selects.length > 0) {
      console.log('já selecionado');
   }
});

No exemplo, o seletor faz o seguinte:
Encontre todos os selects $('select') que não tenham certo id not('#' + id), neste caso, o id do select que acabou de ser mudado, depois encontro todos que tenham um option com o mesmo valor .find('option[value="' + valor + '"] e que já estejam selecionados :selected'. Pronto.
Aqui um fiddle funcionando:  https://jsfiddle.net/06tatn2n/


Getting null value for the objects while creating alert

Question: Hi I want to create a simple alert in grafana. Getting null value for the objects while creating alert.
Comment: Welcome to StackOverflow! Your question needs some work so the community can better help you. Take a look at [how to ask a good question](https://stackoverflow.com/help/how-to-ask) and give it another try.
Answer: I could use some more information, as Chris states in the comments, but your question is actually one I've tried myself and wondered why the H the alert wasn't triggered.
There can be multiple solutions to this (I need more info, if I should help you more specifically):

Try to change the time-condition, which you've set now to "now-10m". I myself haven't had any issues with "-10m", but the less range from now (fx "now-1m") the bigger the risks for insecurities.
Therefore try and change it to "now-1h" and see if there still isn't any data (don't mind if the alert isn't triggered, just check if there is data).
Check if your query is correct (and most importantly - post it here, so we can help you better. Are you fx using template variables in your query? If so, then it won't trigger an alarm.
What version of Grafana are you using? If not the newest, then try to update.

Other than that - what does the logs say? Are you sure, you are getting data returned when running it on the source itself (fx the database?)
Please try these steps and if none of them work, I will gladly try to help you further (given that you provide some more information).
Comment: Thanks for writting ..i have changed time correction (1step) but still having same issue.i am using Grafana v6.5.2. as i am fetching data from snmp, where data is written in influx db, when i run snmpwalk to get data from that particular mib,  getting this error  Wrong Type (should be INTEGER): i guess there is some issue with mibs .CISCO-UNIFIED-COMPUTING-COMPUTE-MIB::cucsComputeMbPowerStatsConsumedPower.14569438 = Wrong Type (should be INTEGER): STRING: "288.000000"


Passing data in modal with laravel

Question: I'm trying to pass data to a modal in laravel. I've created the foreach and modal in blade and the jQuery in a separate file. The modal opens but it doesn't pass the data through. I think my error is in jQuery.
Blade code
@foreach($course->activeLessons as $lesson)

    {!! $loop->iteration!!}.  id)}}">

 {!! $lesson->title!!}

 {!! $lesson->short_description !!}

            <button type="button" class="btn btn-primary" mytitle={{$lesson->title}} data-target="#show" data-toggle="modal">
                Start Lesson
            </button>

@endforeach

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

                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Send message</button>

jQuery Code
$('#show').on('show.bs.modal', function (event) {
    var button =(event.relatedTarget)
    var title = button.data('mytitle')
    var modal = $(this)
    modal.find('.modal-title, #title').val(title)
});

Answer: You need to add data before mytitle attribute.
<button type="button" class="btn btn-primary" data-mytitle={{$lesson->title}} data-target="#show" data-toggle="modal">
  Start Lesson
</button>

Answer: Here is how I've solved it:
Blade - View
@foreach($course->activeLessons as $lesson)

                                        {!! $loop->iteration!!}.  id)}}">

 {!! $lesson->title!!}

 {!! $lesson->short_description !!}

                                            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myCourse" data-myvalue="{{$lesson->title}}" data-myvar="{{$lesson->id}}">
                                                Start lesson
                                            </button>

                                @endforeach

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

Modal title

                                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                                <button type="button" class="btn btn-primary">Save changes</button>

In the Js file
var ATTRIBUTES = ['myvalue', 'myvar', 'bb'];

$('[data-toggle="modal"]').on('click', function (e) {

    var $target = $(e.target);

    var modalSelector = $target.data('target');

    ATTRIBUTES.forEach(function (attributeName) {

        var $modalAttribute = $(modalSelector + ' #modal-' + attributeName);
        var dataValue = $target.data(attributeName);
        $modalAttribute.text(dataValue || '');
    });
});

Answer: Try with this one:
$('#show').on('show.bs.modal', function (event) {
    $(this).find('.modal-title').load($(event.relatedTarget).attr('data-mytitle'));
});

Comment: You can try to debug this whith:
$('#show').on('show.bs.modal', function (event) {
$(this).find('.modal-title').addClass("test class");
alert($(event.relatedTarget).attr('data-mytitle'));
});
Comment: I've tried it and it doesn't display anything. I keep getting a blank modal
Answer: Create a modal for each record you've got, you can do this by giving each modal a unique id.
For instance:
id }}">Delete

id }}" tabIndex="-1">

Passing data in modal with laravel


Overriding custom page variable

Question: I created a template file (page-classifieds.tpl.php) for a classified page.  I would like to override variables of this particular page preferably using a preprocess function.
How can I do that?
hook_preprocess_page() overrides variables for all the pages. I don't want that to happen.
Comment: just check for `classifieds` type with `if else` statement :)
Answer: Try this:
/**
 * Variable preprocessor for the page template.
 */
function THEMENAME_preprocess_page(&$variables) {
  if (arg(0) == 'classified') {
    // Do things here.
    $variables['my_new_variable'] = 'Something';
  }
}

Note that the template page-classified.tpl.php will also match all sub paths of that page too, like:
yoursite.com/classified/something
yoursite.com/classified/something/something

Overriding custom page variable


Proving that a set of metric space is dense in $A$ iff there exists a sequence converging to $x\in A$

Question: I'm using the following definition:
A set $M$ of a metric space $(\frak M,\rho)$ is called dense in a set $A\subset\frak M$ if $$\forall \varepsilon>0,x\in A\exists y\in M:\rho(x,y)<\varepsilon.\tag1$$
I need to prove that $M$ is dense in $A$ iff
$$\forall x\in A\exists \{y_n\}_{n=1}^\infty\subset M:y_n\rightarrow x,\tag2$$
where $y_n\rightarrow x$ means that the sequence of $y_n$'s converges to $x$.
I want to be as rigorous as possible while proving this.
Here's how I approach this. First, I replace $y_n\rightarrow x$ with definition of limit of a sequence, so I have:
$$\forall x\in A\exists \{y_n\}_{n=1}^\infty\subset M:\forall\varepsilon>0\;\exists N\in\mathbb N:\forall n>N:\rho(x,y_n)<\varepsilon.\tag3$$
Now I move $\forall \varepsilon>0$ to the left (is it a valid operation here?) to make the statement closer to the form of $(1)$:
$$\forall\varepsilon>0, x\in A\exists \{y_n\}_{n=1}^\infty\subset M:\exists N\in\mathbb N:\forall n>N:\rho(x,y_n)<\varepsilon.\tag4$$
Now this seems to imply $(1)$, since if there's a subsequence of $y_n$'s, satisfying $\rho(x,y_n)<\varepsilon$, then there indeed exists a single such $y$. So, first half of proof is done.
But I have a hard time proving the converse — that $(1)$ implies $(4)$. It seems I have to move $\forall \varepsilon>0$ somewhere and somehow fold a statement about the sequence, but I don't quite understand how.
Could someone give some hints?
Comment: moving the $\forall$ quantor to the left is always valid. BUT: your statement after this move is: for any $\epsilon$ and $x$ there is a sequence such that from a certain index the sequence is closer to $x$ than $\epsilon$. THIS MEANS: you might have a different sequence for each epsilon
Answer: fix $\epsilon=\frac{1}{1}$ and find $y$ of your definition of density. define $y_{1}:=y$
fix $\epsilon=\frac{1}{2}$ and find $y$ of your definition of density. define $y_{2}:=y$
$\cdots$
fix $\epsilon=\frac{1}{k}$ and find $y$ of your definition of density. define $y_{k}:=y$
$\cdots$
this gives (one example for) your sequence.
CONVERSE:
by sequential definition of density you can find $\left(y_{n}\right)_{n\in\mathbb{N}}$ converging to $x$.
fix $\epsilon>0$. then by choice of the sequence there exists $n_{0}$ such that $\forall n\geq n_{0} : d\left(x,y_{n}\right)<\epsilon$. take $y:=y_{n_{0}}$ and you are done.
Comment: Considering a sequence of $\varepsilon$'s and letting it converge to $0$ was the step which I was failing to guess. Thanks.


convert days to weeks in python

Question: On the first line, ask the user how many days they've been driving for and declare the user input. It's an integer, so cast the string.
Then calculate the number of years in that set of days.
Next, convert the remaining days that weren't converted to years into weeks.
Then, get any remaining days that weren't converted to weeks.
I've done everything this asks, and my classes system is telling me i'm not doing any of it even though I get the same output it is looking for
'''The program converts days you have been driving for to weeks and years'''
print("Days you have been driving: 1000")
days=1000
years=days//365
weeks=days%365//7
consDays=days%365%7
print("You have been driving for:")
print("Years:" , years)
print("Weeks:" , weeks)
print("Days:" , consDays)

i get exactly the output i need but for some reason i'm not being credited for it.
Comment: Are you supposed to hard code `days` or accept it as a parameter, or get it from the user?
Comment: How do you suppose we're meant to know what is supposed to happen?
Comment: Where have you `ask the user how many days they've been driving` ??
Comment: That is part of my problem is I have no idea, coding is like a foreign language to me and this is my 2nd day in this class, and my professor has been completely unresponsive to any questions.
Comment: I'm assuming my issue lies somewhere in the area of asking the user how many day's they've been driving, and casting a string, but I have no idea what that evemn means
Comment: The directions I posted are the exact directions of my assignment copied and pasted
Answer: Your calculation is wrong.
days = int(input("Days you have been driving: "))
years=days//365
weeks=days//7
consDays=days%7
print("You have been driving for:")
print("Years:" , years)
print("Weeks:" , weeks)
print("Days:" , consDays)

OUTPUT (for input 1000)
You have been driving for:
Years: 2
Weeks: 142
Days: 6

convert days to weeks in python


Installing Packages from Multiple Servers from One or More Requirements File

Question: I have tried the following two approaches without success.
The first with Cascading Requirements Files.
# requirements.txt
-r requirements/req2.txt
-r requirements/req3.txt

# requirements/req2.txt
Django==1.7.7

# requirements/req3.txt
-i https://testpypi.python.org/pypi
foo-bar==0.4

pip install -r requirements.txt results in pip not finding Django.
The second attempt was to include both requirements in a single file:
-i https://pypi.python.org/pypi/
Django==1.7.7
-i https://testpypi.python.org/pypi
foo-bar==0.4

pip install -r requirements.txt results in the same error, pip not finding Django.
How can I use pip to install packages from different servers/index-urls?
Comment: I needed it for deployment to Heroku. To install application dependencies Heroku will call `pip install -r requirements.txt`, as such I needed to define packages on multiple indexs under one `pip` readable entry point. I can  image other uses too, but I am pretty new to the Python community so I am hesitant to speculate. I spent a couple of hours yesterday trying to figure out how to do this, so I though I would share the findings.
Answer: The solution in either case is to add --extra-index-url <url> at the beginning of the requirements.txt file.
Example:
# requirements.txt
--extra-index-url https://testpypi.python.org/pypi
Django==1.7.7
django-stackexchange-feed==0.4

Or to use Cascading Requirements Files:
# requirements.txt
--extra-index-url https://testpypi.python.org/pypi
-r requirements/req2.txt
-r requirements/req3.txt

# requirements/req2.txt
Django==1.7.7

# requirements/req3.txt
foo-bar==0.4

pip install -r requirements.txt will now work.
Comment: So theres no way to explicitly require that a package comes from a specific index, and fails if *that specific index* doesnt have it?


Capturing error logs in the email notification while deploying through octopus deploy

Question: I am using octopus deploy automation tool(V2020 1.14) for deploying my code.Email configuration through SMTP is already configured. Now while email is sent it should have the complete error log in case if deployment is failed at certain step. Could you please share me some thoughts how to do this ???
Comment: Hey, can you please be more specific and clear about your requirements to ease our understanding. Thanks!
Answer: There's a couple of things you could do here but the first thing that comes to mind is this example here which logs the error and error detail for each step that failed in a deployment.
To extend this further you could add a link to the full deployment log in the email by using other Octopus system variables. To create a link to the deployment the email step is running I've created an example below.
#{Octopus.Web.ServerUri}/app#/#{Octopus.Space.Id}/projects/#{Octopus.Project.Id}/releases/#{Octopus.Release.Number}/deployments/#{Octopus.Deployment.Id}?activeTab=taskSummary
Hopefully, this answers your question but if you need further information let me know.


Is $f(z)=z+1/z$ analytic?

Question: Is $f(z)=z+1/z$ analytic ?
Here $z$ is analytic and $1/z$ is analytic on $\mathbb{C}-\{0\}$, so their sum is analytic on $\mathbb{C}-\{0\}$.
Comment: But $z$ is analytic.
Comment: If you add a non-analytic function to its negative, then their sum is zero which **is** analytic. So the proposed argument is invalid and fails to answer the question.
Comment: @coffeemath, sorry my mistake
Comment: @Somos yet another error in this silly thread. Somos, 0 is holomorphic, in fact, f(z)=c is holomorphic for all constant c∈ℂ. If you add a holomorphic function g(z) to its negative −g(z), you get g_plus_negg(z)=0, which is NOT analytic (derivative of g_plus_negg(z) is 0) though all the functions are still holomorphic
Comment: since 1/z is not equal to −z,   f(z) = z + 1/z is not "0 for all z" or "constant for all z" therefore its derivative is not 0 therefore it is analytic (analytic means holomorphic AND nonzero derivative)
Comment: unless f(z)=0 is considered analytic despite being a useless function whose derivative is 0 and who cannot make a conformal map, in which case forgive me for not being well versed in the terminology of complex analysis, im just a guy fooling aroud with e to the i π to be honest
Answer: The function is analytic on the domain $\mathbb C\setminus \{0\}$, which is the most reasonable domain for the function to be defined on. Indeed, on this domain both $z$ and $1/z$ are analytic and thus their sum is, too. Note that the function is undefined at $z=0$.
Answer: $z$ is analytic.   $\dfrac 1z$ has a simple pole at $z=0$.  It is meromorphic, but not analytic.  Meremorphicity is a generalization of analyticity, from functions that equal their power series to functions that have a Laurent series (with possible negative power terms).
Now $z+\dfrac 1z$ is also meromorphic  but not analytic (since in fact we have $\dfrac {z^2+1}z$ and a simple pole at $z=0$).
Answer: This question does not make sense until unless you specify the domain of definition.
The function is not analytic on $\mathbb{C}$ but it is analytic on $\mathbb{C}\setminus\{0\}$

Is $f(z)=z+1/z$ analytic?


HTML Table not displaying MySQL data correctly

Question: A table is not rendering correctly while I'm trying to retrieve data from a MySQL table. Basically, I use an if statement to see if anything exists (if the user has posted information) and if they have I go to the else condition which displays the data in an HTML table. Here's the code I've started with for the else statement.
else{
//BEGIN JOB POSTING
echo "
";
while($row_job = mysqli_fetch_array($result_job))
{
echo "
".$row_job['subject']."
";
}
mysqli_free_result($result_job);
echo "
";
}

The reason I put the width and height and border is so you can see where the table is rendering and where the actual information is rendering. The information is being displayed, it's just being displayed side by side with no spaces and not in a
. Here's a screenshot:

The crazy thing is that if you check the source code of this page it looks like this:

twkjljl

lkjljl

But if you inspect the element in Google Chrome, it looks like this:

So I tried a couple things are I changed the code to have them display in  and it renders correctly. Here's that code and screenshot:
else{
//BEGIN JOB POSTING
echo "

";
while($row_job = mysqli_fetch_array($result_job))
{
echo "".$row_job['subject']."
";
}
mysqli_free_result($result_job);
echo "

";
}

While that's fine, I want the data to display in different rows not different columns and can't see where the error in the code is. What in the world is going on?
Comment: I have the strong feeling that it is a very good idea that you start to learn what valid HTML means and how you can validate your own scripts. A good place to start is http://validator.w3.org/
Comment: While your question has been already answered, I strongly suggest you to read documentation on HTML tables. You might learn a thing or two :). At least you should understand the difference between  and  and that  tag is placed always within  tag, but do really read that documentation :)
Comment: Ah, haha, I can't believe I overlooked that. I'm busy with MySQL and I completely blanked on my HTML. Thanks for all the answers!
Answer: After
 you need to encapsulate all data in .
else{
//BEGIN JOB POSTING
echo "
";
while($row_job = mysqli_fetch_array($result_job))
{
echo "
".$row_job['subject']."
";
}
mysqli_free_result($result_job);
echo "
";
}

Answer: You need both tr and td to display elements in a table:
     else{
         //BEGIN JOB POSTING
         echo "
";
        while($row_job = mysqli_fetch_array($result_job))
        {
           echo "
".$row_job['subject']."
";
        }
          mysqli_free_result($result_job);
        echo "
";
     }

The following is one row of a table.

row1

If you want add more columns, you add more two td's.
Answer: Try to use
 in pair:
else{
//BEGIN JOB POSTING
echo "
";
while($row_job = mysqli_fetch_array($result_job))
{
echo "
".$row_job['subject']."
";
}
mysqli_free_result($result_job);
echo "
";
}

Answer: TR is a table row, which consists of many table cells TD.
Thus an HTML table looks like:

Answer: I strongly recommend you to make use of PHP 5.4 for Iterator Support of Mysqli Results:
foreach ($result_job as $row)
{
    echo "
$row_job[subject]
";
}

If you can not use that PHP version - I assume you are not doing anything mysqli_* specific in the sense that you need exactly that extension - use the PDO extension instead. It has that support since much longer.


drupal.js is loading before jquery.js

Question: I have face this problem often in my drupal site. The drupal.js file is loading before jquery.js, so i get the "uncaught jQuery is not defined" error.
I have been using memcached also in my site.
But I can fix the error by the following steps

Restart memcached
Restart Apache
Cache clear
Run the cron

After doing the steps the jQuery is loading properly.
Now, i want to know the reason why the drupal.js loading before jquery.js?
FYI : This is happening, When I enable/disable any modules/features through UI
Comment: Have a look at [this](http://drupal.stackexchange.com/a/19906/10041) answer and [this comment](https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_js/7#comment-17039). Hope this helps.
Comment: are you using drupal_add_js() in any module file?
Answer: May be because of cache that might cause

Check if you installed jquery_update module
in themes info check if there you have declared jquery
3.check if in any module hook_init() you are adding your js with weight.

if you install jquery update module you dont need to add jquery plugin in info file
if you have any clarification regarding the js weight and so on read the following links will be helpful
https://www.drupal.org/node/756722
https://www.drupal.org/node/304255
Answer: Use hook_js_alter see the below example code.
function MODULENAME_js_alter(&$js) {
drupal_add_js('mise/drupal.js', 'external');
drupal_add_js('mise/jquery.js', 'external');
}

Comment: That's the problem @Leopathu: it's not normal behaviour, but we don't have access to your code, so it's pretty difficult to suggest what might be going wrong. However...check your codebase for `hook_js_alter()` implementations, maybe some rogue code is doing something it shouldn't. Also temporarily disable aggregation and any modules (e.g. advagg) that change that process. Check theme preprocesses for the html template, try with a different theme to see if the problem persists, and so on
Comment: It is not a drupal normal behavior, but something strange in my site. I need to find out that. your solutions is a temporary one.
Answer: Thanks @Clive, you comment help more to find out the issue.
In my case, we have used the drupal_add_js outside of the functions/hooks without any conditions as the following code,
<?php

// Adds the custom css file into the module.
$module_path = drupal_get_path('module', 'kf_book_quiz');
drupal_add_js($module_path . '/kf_book_quiz.js');
drupal_add_css($module_path . '/kf_book_quiz.css');
drupal_add_css($module_path . '/kf_book_quiz_rwd.css');
module_load_include('inc','quiz','quiz.admin');

/**
 * Implements hook_init()
 */
function kf_book_quiz_init() {

}

It is not a proper way to add the js into module. This would break the js queue structure.
We should add js only where it is needed, we could use hook_preprocess_page to add js for needed place with conditions.

drupal.js is loading before jquery.js


Replace Page Title with Image

Question: I'm attempting to replace the titles on my pages with images.
I've added an image field to my content type and have created a view that displays the image for the selected page with a contextual filter.
I am embedding the view in my page.tpl.php page with views_embed_view().
I'm having a problem with the conditional statement. If no image exists for the selected page, I want to show the regular page title. Currently, my code will print an empty
 tag on pages with no mages. Can I get some help with this?
I am using Drupal 7 and the Views module version 7.3.3.
<?php $TitleImage = views_embed_view('title_image', 'block'); //Embed View ?>

<?php if (!empty($TitleImage)): //Check to see of View is empty ?>

<?php print $TitleImage; ?>

<?php else: //Display regular title ?>
    <?php print render($title_prefix); ?>
    <?php if ($title): ?>

<?php print $title; ?>

    <?php endif; ?>
    <?php print render($title_suffix); ?>
<?php endif; ?>

I need to replace the page title in the page.tpl.php file. There are 3 content types that have the field_title_image field. I thought that creating a view with a contextual filter would be the best approach, to not display on content types that do not have the field_title_image field.
I came across this comment that helped me with displaying the image.
Below is my revised code. Is there a better solution?
<?php if (isset($node->field_title_image['und']['0']['filename'])): ?>

<img src="/sites/default/files/images/<?php print $node->field_title_image['und']['0']['filename']; ?>" alt="<?php print $node->field_title_image['und']['0']['alt']; ?>">

<?php else: ?>
<?php print render($title_prefix); ?>
<?php if ($title): ?>

<?php print $title; ?>

<?php endif; ?>
<?php print render($title_suffix); ?>
<?php endif; ?>

Comment: Hi Adrian, if you have a solution you are allowed to answer your own question, but putting an answer into the question just makes it difficult to read. Also try and work _with_ Drupal array rendering rather than pulling values from arrays `print render( $node->field_title_image )`.
Answer: To answer your specific question; clearly $TitleImage is not empty, views_embed_view is returning wrapper elements or a space. in the view settings make sure "no results" returns nothing using the no results behavior of the field and the view (under advanced).
Why use a view? If that image is on that piece of content then there is no need for a view at all, just use the field:
<?php hide($content['field_title_image']); // So it does not render elsewhere ?>
<?php if (!empty($content['field_title_image'])): ?>

      <?php print render($content['field_title_image']); ?>

<?php else: //Display regular title ?>
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>

<?php print $title; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>
<?php endif; ?>

(if you are on node.tpl.php the filed will be as above, if you are on page.tpl.php it will be inside $page['content'] array)
Answer: As already said from Duncanmoo, using a view to show the content of a field is a bit excessive. The purpose of the Views module is to show a list of entities, and using a view for getting the information of a single node is not using the module for the purpose it is thought.
You second snippet can be written in a better way.
The template file should just contain the code to show values, not the code to compute those values. You should also avoid to hard code the file path into the template file.
I would rather use the following code, if you need it in a theme.
template.php
function mytheme_preprocess_node(&$variables) {
  if (!empty($variables['node'])) {
    $images = field_get_items('node', $variables['node'], 'field_title_image');
    if (!empty($images)) {
      $image = array_shift($images);

      if ($wrapper = file_stream_wrapper_get_instance_by_uri($image['uri'])) {
        $variables['image_title_url'] = $wrapper->getExternalUrl();
        $variables['image_title_alt_text'] = $image['alt'];
      }
    }
  }
}

page.tpl.php
<?php if (!empty($image_title_url)): ?>

<img src="<?php print $image_title_url; ?>" alt="<?php print $image_title_alt_text; ?>">

<?php else: ?>
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>

<?php print $title; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>
<?php endif; ?>

If you need it in a module, then the module should contain the following code.
function mymodule_preprocess_node(&$variables) {
  if (!empty($variables['node'])) {
    $images = field_get_items('node', $variables['node'], 'field_title_image');
    if (!empty($images)) {
      $image = array_shift($images);

      if ($wrapper = file_stream_wrapper_get_instance_by_uri($image['uri'])) {
        $variables['image_title_url'] = $wrapper->getExternalUrl();
        $variables['image_title_alt_text'] = $image['alt'];
      }
    }
  }
}

The template file being used should contain the following code.
<?php if (!empty($image_title_url)): ?>

<img src="<?php print $image_title_url; ?>" alt="<?php print $image_title_alt_text; ?>">

<?php else: ?>
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>

<?php print $title; ?>

  <?php endif; ?>
  <?php print render($title_suffix); ?>
<?php endif; ?>

I am using $wrapper->getExternalUrl() because it doesn't take the assumption the file is local to the server, and it works also in the case stream wrappers are used to support remote file storage. See the documentation for drupal_realpath().
Comment: I could not get this to work. I tied adding the function to my template.php page and the conditional statement to my page.tpl.php. I would see a white screen. Do I need to make any changes to the code? Thanks
Comment: That is my bad: A parenthesis was missing.
Comment: I updated my pages (template.php, page.tpl.php), with the revisions and am no longer getting the white screen, but the image still does not display. I get the text title on all pages, even if there is an image available. I confirmed that my field name is correct and cleared my cache. Is there something else I am missing? Thanks again.

Replace Page Title with Image


Stone–Čech compactification of real line

Question: I know that $[0,1]$ and a unit circle $\mathbb{S}^1$ are one-point compactifications of $\mathbb{R}$ under some suitable homeomorphism. But how does one construct the Stone–Čech compactification?
Comment: The one-point compactification is unique and it's a circle. The closed interval is the **two-point** compactification of $\mathbb R,$ or the one-point compactification of $[0,1).$
Comment: No! $S^1,$ the one-point compactification, is the **smallest** compactification of $\mathbb R;$ the Stone–Cech compactification is the **biggest** compactification. It is much bigger.
Comment: I will appreciate if some can give a material that explained this.
Comment: Please shed more light on this.
Comment: Here some reading material: http://fa.its.tudelft.nl/~hart/37/publications/the_papers/betaR.pdf
Comment: There are a few related questions that might help you, such as http://math.stackexchange.com/questions/256021/the-%C4%8Cech-stone-compactification-of-the-real-line?rq=1
Comment: so can we say $\beta\mathbb{R}=S^1?$
Comment: Yea, I know it is maximal compactification for $\mathbb{R},$ but don't forget under partial order, we can have $\alpha\mathbb{R}\leq\beta\mathbb{R}.$  There is possibility for equality provided  $\alpha\mathbb{R},$ the one-point compactififation satisfies the extension property.
Comment: But then, how can one arrive at $\beta\mathbb{R}?$
Comment: How can one prove that the extension is unique?
Answer: You cannot really construct it, as such. You can define it, and prove its existence (using the Axiom of Choice) but you cannot give a concrete, definable example of a point in the remainder $\beta\mathbb{R}\setminus\mathbb{R}$. It is common to define the half-line $\mathbb{H} = [0,\infty)$ and consider $\beta\mathbb{H} \setminus \mathbb{H}$, because one can show that $\beta \mathbb{R} \setminus \mathbb{R}$ is a disjoint union of two copies of $\beta\mathbb{H} \setminus \mathbb{H}$ (one on the right, and one on the left). This sort of makes sense, because the reals have no holes to fill internally (it's already locally compact and complete), it's compactified at the boundaries, so to say. Adding a single point at infinity yields the (essentially unique) one-point compactification which is homeomorphic to $\mathbb{S}^1$, and because it is ordered we can add two points (at both ends) to get an orderable compactification which is homeomorphic to $[0,1]$.
The Cech-Stone compactification of $X$ is characterised by the function extension property (if we assume for simplicity that $X \subseteq \beta X$): every continuous function $f: X \rightarrow Y$, where $Y$ is any compact Hausdorff space, can be extended to $\beta f: \beta X \rightarrow Y$. This extension $\beta f$ is automatically unique because the co-domain $Y$ is Hausdorff and $X$ is dense in $\beta X$. In fact we could suffice to check this for $Y = [0,1]$ only, it turns out, to have it for all compact Hausdorff $Y$.
This gives unicity: if $\gamma X$ has the same property (where again we assume for simplicity that $X \subseteq \gamma X$), we extend $1_{X,\beta}: X \rightarrow \beta Y$ with $1_X(x) = x$ to $\gamma 1_{X,\beta} : \gamma X \rightarrow \beta X$, and in the same way we have a continuous $\beta 1_{X,\gamma} : \beta X \rightarrow \gamma X$. As these maps are each other's inverses on the dense set $X$ (which we have in both), because the maps are just the identity there, they are each other's inverses on $\gamma X$ and $\beta X$ as well, making these spaces homeomorphic.
This extension property means that we must extend $f(x) = \sin(x)$ from the reals to $[-1,1]$ to all of $\beta \mathbb{R}$, and it's clear we cannot extend it just using one or two points, so that the well-known compactifications are certainly not the Cech-Stone one. E.g. if $f(\infty)$ should equal the limit of $f(2n\pi)$ as well as $f(2n\pi + \frac{1}{2})$, and these are already different. A function can only be extended to the one-point compactification of the reals, if  the values outside of $f[-n,n]$ vary less and less for larger $n$, roughly speaking. So this is just a limit class. We need to be able to extend all bounded continuous functions.
Constructions (sketches of them) can be found on Wikipedia or good books like Engelking's "General Topology", or Gillman and Jerrison's "Rings of continuous functions". For the reals (which is normal) the new points of $\beta \mathbb{R}$ correspond to ultrafilters of closed subsets of $\mathbb{R}$ (free ones, i.e. their intersection is empty). But these cannot even be proved to exist without some form of the Axiom of Choice, and no explicit examples of these can be given.
We can e.g. define a filter base $\mathscr{F}$ of closed sets by taking the complements of all open intervals of the form $(a,b)$, where $a < b, a, b \in \mathbb{R}$. These have empty intersection in the reals (as $x \notin \mathbb{R}\setminus (x-1,x+1)$) but any two or finitely many of them intersect (as can easily be checked). Then Zorn's lemma (or some other such principle) tells us there exists some maximal filter of closed sets that contains $\mathscr{F}$, in fact plenty of them, and each of those gives us a point of $\beta \mathbb{R} \setminus \mathbb{R}$. Note that in a compact space any family of closed sets with the finite intersection property has non-empty intersection (so $\mathscr{F}$ witnesses the non-compactness of the reals), so the closure of the sets in $\mathscr{F}$ in $\beta \mathbb{R}$ should have non-empty intersection, and in fact those ultrafilters (considered as points) will be in that intersection in $\beta \mathbb{R}$.
In fact there are $2^\mathfrak{c}$ many new points in $\beta \mathbb{R} \setminus \mathbb{R}$ (as many as points added to $\mathbb{N}$, and as many as there are subsets of $\mathbb{R}$). It's a very large, very non-metrisable space, that still has the reals (and thus $\mathbb{Q} \subseteq \mathbb{R}$ as well) as a dense subspace.
One of the few spaces that we have that the Cech-Stone equals the one-point compactification is $\omega_1$ (the first uncountable ordinal in the order topology) which has $\omega_1+1$ as its unique compactification. So here it is concrete, but this situation is quite rare.
Comment: @TerezaTizkova it's an example of a function that is not clearly extendable to a larger space beyond $\Bbb R$. We have to chose some compact codomain and $[-1,1]$ is a natural one.
Comment: You said: "A function can only be extended to the one-point compactification of the reals, if the values outside of f[−n,n] vary less and less for larger n, roughly speaking." - why not take the average (such as Cesaro)? I think, it makes sense that $\sin(\infty)=0$
Comment: @Anixx there are sequences going to $+\infty$ where $\sin(x_n)= t$ for any fixed $t\in [-1,1]$. So $0$ is not a natural limit at all.
Comment: So what? It is not limit in the strict sense, but the average goes to zero.
Comment: I Fourier transforms and other areas, $\int_{-\infty}^\infty \sin x dx$ is usually taken to be $0$, the same with cosine.
Comment: @Anixx topology is about limits not integrals and averages.
Comment: @HennoBrandsma "This extension property means that we must extend $f(x)=sin(x)$ from the reals to $[−1,1]$ to all of $\beta \mathbb{R}$" Could you please explain, why we chose f as sin(x)? Is that the function from X to Y, just arbitrary chosen as sin(x), because $[−1,1]$ is just arbitrary compact space?
Comment: @HennoBrandsma Ah I see, so it is an argument for the claim that you can prove existence of Stone-Čech compactification, but you cannot find it among the usual examples of compactifications that are nice to construct and visualize, right
Answer: The Stone-Čech compactification of $\mathbb{R}$ can be functorially built as the maximal spectrum of $C_b(\mathbb{R})$, the ring of bounded continuous real functions on $\mathbb{R}$.
The maximal spectrum $\operatorname{Max}(R)$ of a commutative ring is the set of all maximal ideals, with the spectral topology, where a basis of closed sets is given by
$$
V(I)=\{\mathfrak{m}\in\operatorname{Max}(R):\mathfrak{m}\supseteq I\}
$$
where $I$ is any ideal of $R$. In general this topology is not Hausdorff, but it can be proved that if $X$ is a completely regular Hausdorff space, then the space $\beta X=\operatorname{Max}(C_b(X))$ is compact Hausdorff.
Suppose $f\colon X\to Y$ is a continuous map, where $Y$ is completely regular Hausdorff. Then we have an induced ring homomorphism $f^*\colon C_b(Y)\to C_b(X)$, mapping $\varphi\in C_b(Y)$ to $\varphi\circ f$. If $\mathfrak{m}$ is a maximal ideal of $C_b(X)$, then $\beta f(\mathfrak{m})=(f^*)^{-1}(\mathfrak{m})$ is a maximal ideal of $C_b(Y)$. It's easy to show that $\beta f$ is continuous under the spectral topology, so we get a continuous function $\beta f\colon\beta X\to\beta Y$.
Moreover we get an embedding $X\to \beta X$ by mapping $x\to\mathfrak{m}_x$ defined by
$$
\mathfrak{m}_x=\{\varphi\in C_b(X):\varphi(y)=0\}
$$
In the special case when $Y$ is compact, the maximal ideals of $C_b(Y)=C(Y)$ are all of the form $\mathfrak{m}_y$, for a unique $y\in Y$, so $Y$ can be identified with $\beta Y$. This shows that $\beta X$ indeed satisfies the universal property of the Stone-Čech compactification, that is, every continuous map $X\to Y$, where $Y$ is compact Hausdorff, can be extended to a continuous map $\beta X\to Y$.
You should be able to find this construction of the Stone-Čech compactification in several books on topology, I believe it is also in Kelley's book.
There's no "explicit" description, because the ideals of $C_b(X)$ can be described in terms of nonprincipal ultrafilters, whose existence depends on the axiom of choice. Only some cases admit an explicit description, because of special properties of $X$.
Comment: Now I got the idea


Erro em variavel

Question: Já tentei achar um erro que esta acontecendo comigo e não consegui,creio até que pode ser coisa boba.
 Erro:

Notice: Undefined variable: st in
  /var/www/html/perguntas/chk-gerente.php on line 143

A linha que ele esta apontando é essa:
$query_resp = mysql_query("SELECT *
     FROM
        respostas
             WHERE
               resp_usuario='$id_usuario'
                 AND resp_questionario='$quest'
                 AND resp_area='$area'
                 AND resp_subgrupo='$subgrupo'
                 AND resp_loja='$loja'
                 AND resp_pergunta_id='$idpergunta'")or die(mysql_error());
    while ($row = mysql_fetch_array($query_resp)) {
    $resposta   = $row['resp_resposta'];
    $st         = $row['resp_status'];
     }
    echo"
";
    echo"
";

$status=$st;

     if ($status == "1") {
        echo"
PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta
";
     } else {
        echo"<button  type='submit' class='btn btn-danger'>REPONDER</button>
";
       }
        echo"
";
     echo"
";
      var_dump($query_resp);

Segue meu código completo caso necessário:
<?php
ini_set('display_errors',true);
error_reporting(E_ALL);
?>

<?php
// A sessão precisa ser iniciada em cada página diferente
if (!isset($_SESSION)) session_start();
// Verifica se não há a variável da sessão que identifica o usuário
if (!isset($_SESSION['usu_login'])) {
  // Destrói a sessão por segurança
  session_destroy();
  // Redireciona o visitante de volta pro login
  header("Location: logout.php"); exit;
}
?>
<?php
require("conexao.php");
?>

    <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1">
            <title>CHECKLIST LOJAS</title>
            <link href="includes/bootstrap.min.css" rel="stylesheet">
            <link href="includes/css/bootstrap.min.css" rel="stylesheet">

<?php
// SESSIONS
  //$_SESSION['usu_nome']      = $nome;
  //$_SESSION['usu_senha']     = $senha;
  //$_SESSION['usu_setor']     = $nivel;
  // $login = $_SESSION['usu_login'];
  $id_usuario = $_SESSION['usu_id'];
  $loja       = $_SESSION['usu_loja_id'];
  $quest      = $_SESSION['quest'];
?>
<?php
 $query_count = mysql_query("SELECT
       COUNT(rp.id)  AS TOTAL_PERG
           FROM
              relacaoperg AS rp
                                INNER JOIN perguntas AS p   ON rp.id_pergunta = p.perg_id
                                INNER JOIN area      AS a   ON rp.id_area     = a.area_id
                                INNER JOIN sub_area  AS sb  ON rp.id_subgrupo = sb.sub_area_cod
                                WHERE
                                    a.area_id='1' AND sb.sub_area_cod='1'")or die(mysql_error());
    while ($row = mysql_fetch_array($query_count)) {
    $totalpergunta  = $row["TOTAL_PERG"];
    }
    ?>
    <?php
    $pergunta=1;
    while( $pergunta <= $totalpergunta ){
     $query_pesquisa = mysql_query("SELECT
       rp.id            AS ORDEM,
       a.area_id        AS AREA,
       sb.sub_area_cod  AS SUBGRUPO,
       sb.sub_area_nome AS DESC_SUBGRUPO,
       p.perg_id        AS ID_PEGUNTA,
       p.perg_desc      AS DESC_PERGUNTA,
       rp.foto          AS FOTO
           FROM
              relacaoperg AS rp
                                INNER JOIN perguntas AS p   ON rp.id_pergunta = p.perg_id
                                INNER JOIN area      AS a   ON rp.id_area     = a.area_id
                                INNER JOIN sub_area  AS sb  ON rp.id_subgrupo = sb.sub_area_cod

                                WHERE
                                    a.area_id='1' AND sb.sub_area_cod='1' AND rp.id='$pergunta' ")or die(mysql_error());

    if (empty($query_pesquisa)) {
    echo "Nenhum registro encontrado.";
    }
    while ($row = mysql_fetch_array($query_pesquisa)) {
    $ordem          = $row["ORDEM"];
    $area           = $row["AREA"];
    $subgrupo       = $row["SUBGRUPO"];
    $descsubgrupo   = $row["DESC_SUBGRUPO"];
    $idpergunta     = $row["ID_PEGUNTA"];
    $descpergunta   = $row["DESC_PERGUNTA"];
    $foto           = $row["FOTO"];
    }
    ?>

<?php echo"$descsubgrupo";?>

 <form class="form-horizontal" action="index.php" method="GET">
  <fieldset>
    <legend>Pergunta <?php echo"$ordem";?>/<?php echo"$totalpergunta";?></legend>

<?php echo"$descpergunta";?>

            <input type="radio" name="optionsRadios" id="optionsRadios1" value="5">
            OTIMO

            <input type="radio" name="optionsRadios" id="optionsRadios1" value="3">
            REGULAR

            <input type="radio" name="optionsRadios" id="optionsRadios1" value="1">
            RUIM

            <input type="radio" name="optionsRadios" id="optionsRadios2" value="0">
            NAO APLICADO

<?php
 $query_resp = mysql_query("SELECT *
     FROM
        respostas
             WHERE
               resp_usuario='$id_usuario'
                 AND resp_questionario='$quest'
                 AND resp_area='$area'
                 AND resp_subgrupo='$subgrupo'
                 AND resp_loja='$loja'
                 AND resp_pergunta_id='$idpergunta'")or die(mysql_error());
    while ($row = mysql_fetch_array($query_resp)) {
    $resposta   = $row['resp_resposta'];
    $st         = $row['resp_status'];
     }
    echo"
";
    echo"
";
    $status=$st;
     if ($status == "1") {
        echo"
PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta
";
     } else {
        echo"<button  type='submit' class='btn btn-danger'>REPONDER</button>
";
       }
        echo"
";
     echo"
";
      var_dump($query_resp);

?>
  </fieldset>

 </form>

<?php $pergunta++; } ?>

Qual é a ideia: se o usuário já tiver respondido irei trocar o botão por:

PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta
Comment: Observação:  Já tente mudar de:     $resposta   = $row['resp_resposta'];
    $st         = $row['resp_status']; para     $resposta   = $row["resp_resposta"];
    $st         = $row["resp_status"];
Answer:
Notice: Undefined variable: st in
  /var/www/html/perguntas/chk-gerente.php on line 143

"Variável indefinida $st na linha 143"
A linha 143:
$status=$st;

A variável está sendo inicializada dentro de um laço de repetição:
while ($row = mysql_fetch_array($query_resp)) {
$resposta   = $row['resp_resposta'];
$st         = $row['resp_status'];
 }

Se o laço de repetição não for executado, a variável $st não será definida.
Por dedução lógica, $row pode estar recebendo valor null ou false.
$row = mysql_fetch_array($query_resp)

Como resolver?
Crie uma lógica mais consistente, verificando a integridade dos dados antes de executar rotinas que dependam de tais dados.
[edit]
Sugestão de implementação
if ($row = mysql_fetch_array($query_resp)) {
    foreach ($row as $v) {
        $resposta   = $v['resp_resposta'];
        $st         = $v['resp_status'];
    }
    echo"
";
    echo"
";
    $status=$st;
    if ($status == "1") {
    echo"
PERGUNTA JA RESPONDIDA | RESPOSTA:$resposta
";
    } else {
    echo"<button  type='submit' class='btn btn-danger'>REPONDER</button>
";
    }
    echo"
";
    echo"
";
    var_dump($query_resp);
} else {
    echo 'A consulta não encontrou nada.'; exit;
}

Comment: Desculpe mais não entendi bem:Como resolver?

Crie uma lógica mais consistente, verificando a integridade dos dados antes de executar rotinas que dependam de tais dados.
Comment: exatamente isso, tente usar a lógica e perceber tudo o que o  Daniel disse.
Comment: @porfavorexcluam-me quem respondeu à pergunta perdeu tempo pata **te** ajudar. E tentou explicar. Se não compreendes diz, se achares que foi rude diz ao outro membro da comunidade ou a um moderador. Vais ver que vale a pena aprender com o que os membros da comunidade sabem....

Erro em variavel


how to match string in a list

Question: I'm having a list of string like
var target = new List<string>() { "C", "C-sharp", "java" };
I'm having a string request = "C is a programming language"
This list should match with the string and should return
C,C-sharp
How can i do this?
Comment: Why do you need regex for this? `string.StartsWith` is fine.
Comment: Your question is vague, but answered both in the comments and in the first answer. It's  probably inefficient to use regex so you should avoid it.
Answer: here is the solution with linq
var m = from t in target
                where t[0] == 'C'
                select t;

Answer: Using Linq and String.Contains:
var filtered = target.Where(str => str.Contains("C"));

Another option, without Linq, is to change the existing list using List<T>.RemoveAll:
target.RemoveAll(str => !str.Contains("C"));

If you really need a regex (for something more complex), you may also use:
Regex validate = new Regex(".a.", RegexOptions.IgnoreCase);
 var filtered = target.Where(str => validate.Match(str).Success);

Comment: @mekici - That is pure speculation, but you can easily adapt it. `:)` (hmm... I hope I'm not getting downvoted for a stupid "error" as this, the real question is about filtering the list...)
Comment: he means selecting first index of word if match 'c', not any word contains 'c' in the list

how to match string in a list


How to check if PostgreSQL installation supports SSL?

Question: In the PostgreSQL documentation is described that required to build PostgreSQL for SSL support:
http://www.postgresql.org/docs/9.1/static/ssl-tcp.html
Is it possible that PostgreSQL installation supports SSL out of the box from some CentoOS repository?
How to check if PostgreSQL installation supports SSL?
Comment: Check [this answer](https://dba.stackexchange.com/a/213128) out.
Answer: Pretty much any packaged PostgreSQL will support SSL.
That doesn't mean you can actually connect with SSL. For that, you need a private key and certificate to be configured for that install.
You really have:

Is not compiled with SSL support
Is compiled with SSL support but not configured for SSL
Is compiled with SSL support and configured for SSL, but does not allow SSL connections in pg_hba.conf from my current location
Is compiled with SSL support, configured for SSL, and pg_hba.conf allows (or requires) connections via ssl

The best way to see if it supports SSL, as a client, is to connect to it and see.
If you're checking to see if the server is compiled with SSL support, so SSL will work if you configure it, you can check pg_config.h from the development package; it will define USE_OPENSSL if it's enabled in the build. Or you can try to run the postgres executable with the ssl=on option set, e.g.
/path/to/postgres -c ssl=on

which will output:
FATAL:  SSL is not supported by this build

if SSL isn't available.


Missing "Clean URLs" option

Question: I have a new installation of Drupal 7. I was having a problem with administrative overlay URLs having URL encodings in them, which I asked about here. Another user suggested I confirm that I have clean URLs enabled.
When I went to Home » Administration » Configuration » Search and metadata » Cleanr URLs, all I see is this:

Use URLs like example.com/user instead of example.com/?q=user. If you are directed to a Page not found (404) error after testing for clean URLs, see the online handbook.

The message was followed by the button, "Run the Clean URL test." that seems to do nothing: The browser tells me it's loading something from the site, but the page doesn't change.
I have no options to enable or disable clean URLs.
I'm pretty sure it's disabled, because when I go to website.com/user, I get a 404.
How can I troubleshoot this?
Comment: Before jumping the gun and installing the patch listed below, please read the guidelines for configuring the clean URLS [here](https://www.drupal.org/getting-started/clean-urls). Definitely look at your server configuration to make sure things are set properly.
Answer: This is a known problem in Drupal 7. The "Run the Clean URL test" button does not behave like that page says it does, and this can be very confusing. Please see "Run the clean URL test" UX is broken; basically, what it comes down to is that the logic and UX of that page is broken, but the clean URL system itself (ie. the part in Drupal core that makes clean URLs work) does not contain any (known) bugs.
If you cannot enable clean URLs (you don't see the checkbox to enable it), this means that a test has already been run, it returned a negative result, and you should check your server configuration. See drupal.org - Clean URLs for documentation.
PS. If you can, test the patch from comment #87. This patch will improve the UX on the clean url's page, but it will not solve problems with an incompatible server configuration.
Comment: I followed your directions, and tried applying the patch, but I wasn't successful.
Answer: Is Drupal installed in a subfolder?
I had a similar problem using Drupal on a subfolder. Try this:

Open your .htaccess file
Look for the following line (line 100 on Drupal 7.4 .htaccess file):
# RewriteBase /drupal
Uncomment this line and change the "/drupal" to match your subfolder.
In my case, since Drupal was installed on a folder named "/public_html/test", I changed so:
RewriteBase /test
Try enabling Clean URLs again. You should now see the checkbox "Enable Clean URLs" available.

For me, this solved the problem.
Comment: I had to change my RewriteBase to ~username/drupal. I'm running MAC OS X.
Comment: Yup this solved it for me. Thanks a ton. Such a simple mistake too.
Answer: Are you using WAMP? You need to enable the Apache rewrite_module through the WAMP interface. When you do you will find the Clean URL's option under Search and Metadata heading of localhost/MYSITE/admin/config
Comment: Not using wamp.
Answer: When I ran the clean URLs test, nothing happened.
In order to correct the problem, I went to the directory where Drupal was installed (a subdirectory of my main site), and found the ".htaccess" file; this is a different ".htaccess" file than the one in the root directory of the web server, and it is part of the original install.
The file was named ".htaccess.txt"; I removed the ".txt" extension, then ran the clean URLs test again. It ran successfully and the Enable clean URLs check box showed up.
Answer: I had this problem in local, and i am using wamp, if you go in the apache directory in your wampserver, you look in "apache modules" and scroll down until you find rewrite_module, check it and it should work!
I hope it will help

Missing "Clean URLs" option


Duplicating an entire Django project

Question: Is it possible to duplicate an entire Django project and rename it?
For example, let's say Client1 asks me for a Django project. I would name the entire project Client1. Client2 now comes and asks for the exact same file. Can I simply copy and paste Client1's project and rename it to Client2, or do I need to rename a few other things?
Thank you in advance for the clarification!
Answer: Properly written django project will work from any directory.  The only thing you need to change is the database settings and, may be, some paths in settings.py.
Answer: You can easily just copy and paste the Root project folder and name it whatever you wish (here, in case which is Client2). The main changes you have to do is in inner project folder, just go through each file like settings.py,wsgi.py and all of them in it and replace Client1 to Client2. you can easily do it with Find and Replace feature. Dont forget to make the changes in manage.py file. Once you're done, you're good to go to clone your project.

Duplicating an entire Django project


Building a forecast model based on past year data in R

Question: I am attempting to build a model to forecast attendance in a given week in the current year based on this year's attendance values up until the present, and data from two previous years. My data looks like this:
<code>   Week 11-12 Cumulative ADA    12-13 Cumulative ADA    13-14 Cumulative ADA
   1    0.9941                  0.9941                  0.9914
   2    0.9907                  0.991                   0.989
   3    0.9888                  0.9888                  0.9879
   4    0.9877                  0.987                   0.9869
   5    0.9869                  0.9865                  0.9867
   6    0.9862                  0.985                   0.9859
   7    0.9856                  0.9842                  0.9857
   8    0.9856                  0.984                   NA
   9    0.9852                  0.9839                  NA
   10   0.9848                  0.9834                  NA
</code>
Any guidance on how to predict the three NAs based on the past two years data and this year's values would be much appreciated.
Thanks!
Comment: check out the *forecast* package - it's great.
Answer: Forecasting weekly data using weekly history is problematic as what we do in say week 4 is probably not what we did in week 4 last year whereas what we do in month 4 is probably systematic with what we did in month 4 last year ,save special effects such as Easter or Thanksgiving. Furthermore the different number of weeks in a year can throw a monkey-wrench into the analysis. More importantly the effect of holidays on weekly sums can be quite dependent on when the holiday occurs thus effectively distorting pattern. I have seen very few examples of where weekly data is consistent/predictable and can be used reliably to obtain weekly forecasts.
With the development of statistically aggressive daily models taking into account the window of response around each holiday/event, day-of-the-week effects,day-od-the-month effects,month-of-the-year effects,level shifts and or local time trends... users are now developing daily models to obtain weekly predictions. Additionally they can compute probabilities of making month-end numbers or of meeting a plan/goal number.
THe other item dealing with missing values is easily handled by Intervention Detection schemes which would identify pulses for the missing values and effectively replace the missing value with an imputed value based upon the full model.
Comment: We've actually counteracted the issue of weeks not lining up by munging the weeks to line up. For example, this year there would actually be an additional week so the first week's information includes 8 weekdays instead of 5. It's not a perfect system but the holiday weeks should match up, the final week should roughly correspond every year, and so on.

What I'm interested in is, is there a good method to build a model based on the trends from previous years to apply to this year's data?
Comment: Yes there is a good method to develop this structure. It is a combibation or ARIMA and regressor variables which can include all that I mentioned above. If tou wish you can contact me at my email address and I will try and give you more details. Just click on my name and you can get my email address. Alyternatively post your data and I will analyse it and show you precisely what can be done. Do not post the cumulative but do post the actual daily values.


Random variable modeling arthroscopic meniscal repair

Question: The below problem is from my introductory stats textbook, the chapter on random variables and probability distributions. I don't even know what's being asked, much less how to answer it. Any clues?
<code>   Arthroscopic meniscal repair was successful 70% of
   the time for tears greater than 25 millimeters (in 50 surgeries)
   and 76% of the time for shorter tears (in 100 surgeries).
   (a) Describe the random variable used in these probability
   statements.
   (b) Is the random variable continuous or discrete?
   (c) Explain why these probabilities do not add to 1.
</code>
So I've gone with (a) Binomial random variable (b) Discrete, because its binomial (c) They don't add to one as each is measuring the probability of a different thing.
I just want to make sure I'm not completely off-track here.
Comment: You might get a little more help if you show a little bit more effort (like what you've tried so far, etc)...
Comment: (a) and (b) are just a question of learning the jargon. You have the book, look them up. What about (c)? Have you tried to do that?
Comment: @almagest I wasn't sure with (a) if it was asking me to define a function or just describe which part of the question was the variable.

Am I right in thinking that the variable is success/failure (binomial)

And for (c) I'm assuming they don't add to 1 because they are two separate variables
Comment: The second. Your textbook has a particular way of approaching this kind of problem and it wants to make sure you have understood the definitions it uses ie do you know what a random variable is?
Comment: I think that last comment is the sort of thing people are looking for in a question.  You can edit the question to include those thoughts.
Answer: May I ask what is your student number? This is clearly for Introduction to Statistics 35151 at UTS, and it is an assignment that is meant to be your own individual work or from group members. The assignment is due at 11am in the morning, I hope you finish it according to academic policies outlined by UTS.
Comment: [Related](http://math.stackexchange.com/q/924776/)?
Comment: With all respect, but perhaps this would better be a comment.


Views skip contextual filter IF current user is Administrator

Question: I have a View that has a contextual filter that uses a token to get entity reference values on the current user to limit a view (that also points at the same reference type). If they match up, that is all the View will return in its results.
However, for Administrator roles, I do not want to apply the filter (bypass it) without duplicating the view and having different views to maintain. I tried adding the first argument of "Authored by" using the current user, and checking the role of that user in the validation. This appeared to work at first, but when a node is authored by a lower level user, the validation appears to not work (no result shows). If I change the author to another user, the node appears in the View results for that lower level user.
Without having to duplicate a View, how can I grant Administrators full access but apply the second contextual filter otherwise?
Answer: Based on a similar question I saw, I had to add this:
<code>function mymodule_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  try {
    $account = \Drupal::currentUser();
    // If user is not admin, remove the authored by argument
    if ($view->id() === 'portal' && $view->current_display == 'page_2' && !in_array('administrator', $account->getRoles())) {
      unset($query->where[0]["conditions"][0]);
      $query->where[0]["conditions"] = array_values($query->where[0]["conditions"]);
    }
  }
  catch(Error $e) {
    \Drupal::messenger()->addError('The server encountered a problem. Please contact the site\'s administrator.');
    \Drupal::logger('mymodule')->error("Error displaying Rate Manager: %e",
      ['%e' => $e]
    );
    return;
  }
}
</code>
This seems to support both cases, but now there is a code and argument position dependency that is not obvious from the UI. I wonder if there is a better solution?


Conditional indexing with python ndarray

Question: I have two python ndarrays p and q as follows:
import numpy as np
p = np.array([1.        , 1.        , 0.1862802 , 0.19957115, 0.18623812,
       0.1802321 , 0.17464815, 0.16460853, 0.1487719 , 0.12968006,
       0.10464501, 0.07183418, 0.00124706, 0.27353592, 0.81713212,
       0.23720725, 0.21802175, 0.21959138, 0.22401754, 0.22662527,
       0.22777369, 0.23269387, 0.23293132, 0.23374038, 0.24089565,
       0.19958937, 0.23910928, 0.24252447])

q = np.array([[ 1.        ,  1.        ],
       [-0.357316  ,  0.1862802 ],
       [-0.34402505,  0.19957115],
       [-0.35735808,  0.18623812],
       [-0.36336411,  0.1802321 ],
       [-0.36894805,  0.17464815],
       [-0.37898767,  0.16460853],
       [-0.3948243 ,  0.1487719 ],
       [-0.41391615,  0.12968006],
       [-0.4389512 ,  0.10464501],
       [-0.47176202,  0.07183418],
       [-0.54234915,  0.00124706],
       [ 0.27353592,  0.81713212],
       [-0.30638895,  0.23720725],
       [-0.32557445,  0.21802175],
       [-0.32400482,  0.21959138],
       [-0.31957866,  0.22401754],
       [-0.31697093,  0.22662527],
       [-0.31582252,  0.22777369],
       [-0.31090234,  0.23269387],
       [-0.31066488,  0.23293132],
       [-0.30985582,  0.23374038],
       [-0.30270055,  0.24089565],
       [-0.34400684,  0.19958937],
       [-0.30448692,  0.23910928],
       [-0.30107173,  0.24252447]])

I want to get (a) all the values in p where first value of corresponding tuple in q is >0 and (b) the index of all those values in p
Answer: Use np.where:
idx = np.where(q[:,0]>0)

print(idx, p[idx])

Output:
(array([ 0, 12]),) [1.         0.00124706]

Comment: Thanks @QuangHoang. However, not clear why `idx` in `idx = np.where(q[:,0]>0)` is a tuple of `ndarray` and not just instance of `ndarray`
Answer: Obtaining the values in p whose corresponding tuple has the first value > 0:
idx = np.where(q[:,0]>0)
p[idx]
##output [1.   0.00124706]

Finding the indices of these values in p
for val in p[idx]:
        print(val, "index", np.where(p == val))
##output
1.0 index array([0, 1]) # 1.0 appears twice in p
0.00124706 index array([12])


What part of Solaris version string IDs the update?

Question: Solaris 10 server. I need to determine if the server is Solaris 10 Update 9 or greater. Can someone interpret the version strings below? What part of those strings identifies the update that has, or has not, been applied to the server?
# uname -a
SunOS rcclab5 5.10 Generic_147440-01 sun4u sparc SUNW,Ultra-80
# cat /etc/release
                   Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC
  Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved.
                        Assembled 23 August 2011

Comment: You cannot "apply an update" with Solaris 10 and older. You either install a Solaris update from scratch or upgrade an existing installation to a newer Solaris update. What you can apply to an existing installation are patches and patches do not change the Solaris update that is installed and reported.
Answer: The line in /etc/release shows it was built in august 2011 and contains s10s_u10wos_17b which reads:
Solaris 10 for SPARC (would be s10x for x86), update 10, "wad of stuff" (just means it's not the initial release), 17th build since u10 development started, second respin (b).
Note that this doesn't reflect an update that has been applied or not to the server but the precise version of Solaris that was initially installed on that machine.
Kernel updates can be identified with the kernel patch version, here (147440-01) which is the one delivered with u10. That means it wasn't updated (patched).
Should you have patched the OS, an additional line would have appeared at the end of the file telling what Solaris update the update match.
Answer: s10s_u10wos_17b the u<#> is the update version. So that is Solaris 10 Update 10.
Answer: Generic_147440-01 shows the level of the kernel being used.  It IS possible to be running an up-to-date kernel w/o having to do an install of the released update by updating keeping current on all the patches.
Answer: uname -a shows the Kernel PatchID and the table in this link will show which Solaris 10 update version it us...
Anthony
Answer: Decoding the update string (e.g. s10s_u10wos_17b) is fine for newer update releases, but older and non-update products don't have something in this format in the /etc/release.
The Solaris version with month/year (e.g. Solaris 10 8/11) is frequently used in documentation and for customer support purposes. You can look up this value in a releases list (e.g. https://trent.utfs.org/wiki/Solaris/Releases) to find what update number it corresponds to (or to find out what other kind of product release it is if it's not an update).


what does $a = new $b() mean in PHP?

Question: Although I get it that
$a = new b()

would be initializing an object for the class b, but what would
$a = new $b()

mean because I came across some code that happens to work otherwise!
Comment: I'm not quite sure, as you've said $a = new b() would initialize class b, I don't actually think $a = new $b() should work...

Strange, I hope to find the answer also.
Answer: It's a reflexive reference to the class with a name that matches the value of $b.
Example:
$foo = "Bar";

class Bar
{
   ...code...
}

$baz = new $foo();

//$baz is a new Bar

Update just to support: you can call functions this way too:
function test(){
    echo 123;
}
$a = "test";
$a(); //123 printed

Comment: @LukeBerry, the advantages are in inheritance and extensibility. If I make a CMS i could allow users to provide plugin classes and specify the names of the enabled ones in a database. I could then instantiate *all* the enabled plugins reflexively by iterating over the names. It has niche uses, but *significantly* improves the modularity of code. I never need to know the name of the class I'm making in advance.
Comment: That's strange, but I suppose it makes sense, what possible advantage could that have over $baz = new Bar(); though?
Answer: This code:
$b = "Foo";
$a = new $b();

is equivalent to the following:
$a = new Foo();

Meaning that you can use syntax like $b() to dynamically refer to a function name or a class name.

what does $a = new $b() mean in PHP?


Show that if $A=\{1, 2,...\}$, then $S_A$ is an infinite group

Question: I want to show that if $A=\{1, 2,...\}$, then $S_A$ is an infinite group.
My proposed solution:
We consider the element $x=(1, 2,..., i, i+1,...)$ of $S_A$ , where we have used cyclic notation for representing elements of permutation groups, noting that there exists no positive finite integer $n$, such that $|x|=n$, we conclude that the cyclic subgroup of $S_A$ generated by $x$ is an infinite group, thus we conclude that $S_A$ is an infinite group.
Is my solution reasonable?
(This is not a Homework problem, that I want to get solved unfairly )
Comment: Your "solution" is wrong in this way: $(1,2,\dots,i, i+1,\dots)$ is not a permutation of $A$. [That is, if I have interpreted the notation correctly. If I haven't your solution is wrong because it is incomprehensible.]
Comment: You can have infinite cycles, but they have to be infinite at both ends: for example $x = (\ldots,8,6,4,2,1,3,5,7,\ldots)$
Comment: What does $S_A$ stand for?
Comment: If it were a homework problem, I would say that the "solution" is not written well, and that we just could list infinitely many transpositions $(i,i+1)$ for $i=1,2,3,\ldots $. But since it is not homework, it doesn't matter. By the way, $S_A={\rm Sym}(A)={\rm Sym}(\Bbb N)$.
Comment: If $S_A$ is the symmetric group permuting $A$ this works. Alternatively you could consider all the transpositions $(12),(23),(34),...$ which also gives you an  infinite collection of elements.
Comment: After you ask a question here, if you get an acceptable answer, you should "accept" the answer by clicking the check mark $\checkmark$ next to it. This scores points for you and for the person who answered your question. You can find out more about accepting answers here: [How do I accept an answer?](http://meta.math.stackexchange.com/questions/3286/), [Why should we accept answers?](http://meta.math.stackexchange.com/questions/3399/), [What should I do if someone answers my question?](https://math.stackexchange.com/help/someone-answers).
Comment: José Carlos Santos, $S_A$ is the group of all permutations of the set A.(Sorry for directly taking your name while replying, but I don't know exactly how should I respectfully greet you).
Comment: Dietrich Burde, so should I then consider my solution to be wrong?
Comment: Shaun, sir, For some technical reason , I couldn't do it, else I would have done that.Now I could and have done it.
Answer: You can have an infinite cycle,
but it needs to be infinite in both directions,  as in @Derek Holt's comment.  Otherwise not all  points are "hit".
Alternative argument:
For any $n\in \Bbb N,$ we have $S_n\le S_\Bbb N\implies \lvert S_\Bbb N\rvert \ge n!.$
Comment: @Devo $\lvert S_\Bbb N\rvert =2 n!$ can only hold for a fixed $n$. In fact, $S_{\Bbb N}$ doesn't depend on an integer $n$ at all. But the estimate holds for all $n$, so that it cannot have a finite value.
Comment: How does this rule out *per se*, e.g., $|S_{\Bbb N}|=2n!$ (i.e. finite)?
Comment: I don't understand what you mean, @Devo.
Answer: No.
Your $x$ is not a bijection from $A$ to $A$. What maps to $1$? Thus $x\notin S_A$.

There is infinitely many distinct elements of the form $(i,i+1)$ in $S_A$ for $i\in A$.


Entity Framework - link to all items in a table, then add a new one?

Question: I have 2 simple C# objects (user and department) as follows (using EF code first):
public class User
{
     int UserID {get; set;}
     string Name {get; set;}
     List<Department> Departments {get; set;}
}

public class Department
{
     int DepartmentID {get; set;}
     string Name {get; set;}
     List<User> Users {get;set}
}

I can create a user and add multiple departments to it, all great.
What I would like to do is set the user as connected to "All Departments".
Now although I could add all departments to a user, if later on I add a new department I would have to remember to add it to that user as well - not ideal.
My initial thought (rightly or wrongly) was to add a boolean AllDepartments property to the user.  However although I can make it work, its not clean at all.  I have to remember to check that boolean whenever I call a user, and build the department list as a separate query (so its not really relational in the database either).
My ideal would be to create a brand new department, and on retrieving that department it would already have all the users that are supposed to be connected to all departments, be navigable via the List property.
Has anyone come across this before and solved this situation cleanly?
Comment: What if you create a new column in the Department entity with the id of every user? at the end you want that anyway. Or create a third Entity called AssignedDepartment with the UserID and DepartmentID
Answer: facing the same problem I use a departmentGroup table, each department belonging/being to at least one group.

then a user belongs to a department group (and no more to a department).
then I have a business rule that add every new department to a 'All departments group'

All solutions have their pro and cons. The main con (imho) of this solution is that a user belonging to the all department belongs automatically to a new top secret department. Are you sure this is what you want ?
Comment: Actually this layer of abstraction would probably work for me.  It simplifies the extra code required to just adding/removing documents.  It isn't as "pretty" from the DB side but will work well.  I'm importing an old DB which uses 0 as the departmentID for all documents, and that causes lots of issues where the code is littered across every call.


Docker image + container vs. KVM / VMware / VirtualBox

Question: I'm trying to understand the difference between images used in KVM / VMware / VirtualBox and Docker images + containers.
I can use i.e. an Ubuntu ISO to install the entire operating system into i.e. VirtualBox, essentially writing everything into an image file stored somewhere on the machine. Now, if for whatever reason I decide that I want to move the Ubuntu image and run it on a different computer, I can just copy the image to that other computer and run it from there.
Now, Docker also has images that may also have Ubuntu inside running pretty much any application. I have to setup a container that stores all my changes and states. Now, if I want to do the same thing as I did with the VirtualBox image, transfer my Docker image + container to another computer and run it from there, this step seems to be pretty difficult. I can't really understand why.
So my question is, what exactly is the conceptional difference between Docker images and the other ones mentioned above? Why can't I just copy those images around machines as I please?
Comment: Just google "docker vs virtualbox" for example, you'll find plenty of information there. e.g.: https://www.smarthomebeginner.com/what-is-docker-docker-vs-virtualbox/ . (disclaimer: I didn't read the article, only the gist...)
Comment: @Lenniey Thanks for the link, I'll take a look at that.
Answer: Docker is used to run microservices, where it uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFSand others to allow independent "containers" to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines (VMs). It's quite different from VMs, moving docker image can be as easy, you just need to understand how docker works. Also you can use some orchestration manager that can orchestrate docker containers, such tool is kubernetes with it you get a lot of benefits, it managing of containers much easier.
Comment: Yes, @Socrates, there are ways. For example [docker commit](https://docs.docker.com/engine/reference/commandline/commit/). You create an image with your changes, move the image somewhere, create a new container using that image.
Comment: Thanks for your input. I understand that Docker has a lower overhead compared to traditional VMs. Is there an easy way to move a docker container without using kubernetes?
Comment: Yes docker container is ran by image, just run the image on another machine.
Comment: I mean, is there an easy way to transfer a container (with my changes, i.e. apps I installed) to another computer, so that I can continue my work on the exact same Docker container, but on the other computer?
Comment: I don't know of such way, other than building new image of your working container and just running it on new machine. I'm sorry if I'm not helpful enough.
Comment: @Lenniey There we go. So there is an easy way. Thanks a lot, just made my day! So, to transfer everything: `docker commit `, then `docker save `, and `docker load `. Fantastic! Thanks again to both of you!


Como exibir os valores do Cursor usando Debugger no Android Studio?

Question: Eu estou muito acostumado a usar apenas o Logcat, enquanto estou depurando um aplicativo. Mas percebo que o Debbuger é uma ferramenta muito mais poderosa. Eu posso pausar o estado da aplicação e observar suas variáveis.
Eu consigo obter a posição do cursor e a contagem de linhas que o cursor tem. Mas não consigo encontrar o valor de cada coluna da database usando o debugger.
Não seria lógico e possível fazer isso usando o debbuger?
Se não é possivel, por que?
Answer: Aquilo que consegue visualizar directamente pelo debugger, na aba Variables, é o valor dos campos de um objecto(variáveis).
O objecto Cursor não tem nenhum campo com os valores das colunas da posição actual. Eles são obtidos através do uso de métodos.
O debugger tem um recurso chamado Evaluate Expression  que permite o calculo de expressões Java, incluindo a chamada a métodos.
Use-o para inspeccionar o valor de cada coluna, chamando esses métodos.
Comment: Você tem razão, o cursor não armazena em nenhum lugar os valores de das colunas. Apenas a posição, a contagem de colunas e outras coisas. Obrigado!


Axios get dando network error

Question: Estou fazendo um curso de react native, mas como meu computador não rodou o Genymotion, tive que improvisar e baixei o BlueStacks para debugar os projetos. O problema é que quando meu programa faz requisições da internet, ele sempre me retorna Network Error. Estou usando o axios.
O erro completo é esse:

Já procurei em todos os lugares que consegui pensar, mas não achei nada que solucionasse esse problema.
edit: tinha esquecido de colocar o código
main.js:
import React, { Component } from 'react';
import api from '../services/api';

import { View, Text } from 'react-native';

export default class Main extends Component {
    static navigationOptions = {
        title: 'JSHunt'
    };

    componentDidMount() {
        this.loadProducts();
    }

    loadProducts = async () => {
        const response = await api.get('/products');

        //const { docs } = response.data;

        //console.log(docs);
    };

    render() {
        return (
            <View>
                <Text>Página Main</Text>
            </View>
        );
    }
}

api.js
import axios from 'axios';

const api = axios.create({
  baseUrl: 'https://rocketseat-node.herokuapp.com/api'
});

export default api;

Comment: E onde está o código em que você utiliza o AXIOS? Pela mensagem de erro dá a entender que uma exceção está sendo lançada e você não está a capturando, mas não dá para saber sem o seu código.
Comment: Me esqueci de colocar o código, agora editei. Obrigado pelo toque!
Answer: Esse erro está acontecendo por um erro de sintaxe. Ao se criar uma instancia do AXIOS, você deveria estar usando a propriedade baseURL, não baseUrl.
Outra melhoria que você poderia fazer no código é adicionar um bloco try/catch, pois do jeito que está, quando uma requisição falha, o único erro que você irá receber é que uma exceção foi lançada e não foi capturada, o que não é um feedback muito útil para descobrir a razão do erro.
loadProducts = async () => {
    try {
        const response = await api.get('/products');

        //const { docs } = response.data;

        //console.log(docs);

    } catch(err) {
        // TODO
        // adicionar tratamento da exceção
        console.error(err);
    }
};

Comment: Muito obrigado!!! Tem uns 2 dias que estou procurando o problema, nem acredito que era um errinho de escrita, E também obrigado pela dica, vou implementar no código.

Axios get dando network error


How to embed JSTL forEach in javascript

Question: I'm trying to loop through a list of objects (some measurements data) using JSTL forEach tag in javascript and display the data by using Google Charts API. The code is showing as following. But looks something wrong. As I double checked, the data in the list of measurements objects works fine to pass to html in ${listOfMeasurements}, ${measurements.measTime}, ${measurements.measS1raw} and ${measurements.measS2raw}. But in the javascript block, the forEach code is not working to execute data.addRow() as expected. My guess is, I'm not using forEach correctly in my javascript code, so data.addRow() was not executed as expected. How can I fix it?

Comment: Try it without the quotes inside the for. In the `forEach` eyes `data.addRow(...)` its already just some string.
Comment: You need to realise that JSP is a HTML code generator and that JS is part of HTML. Open JSP page in browser, rightclick and *View Source*. Look closer at the JSP-generated HTML/JS code syntax. Is it all right? If not, just fix the JSP code accordingly so that it generates exactly the desired HTML/JS code output. If still in vain, copypaste that HTML output instead of the JSP source code and reframe the question in HTML context instead of JSP context.
Comment: Check HTML source is very helpful. @BalusC, thanks for the suggestion.
Answer: Try it like this
<c:forEach items="${listOfMeasurements}" var="measurements">
   data.addRow(${measurements.measTime},${measurements.measS1raw},${measurements.measS2raw});
</c:forEach>

Otherwise you will obtain wrong code in your script, for example:
"data.addRow("+"measTimeValue-1"+","+"measS1raw-1"+","+"measS2raw-1"");";
"data.addRow("+"measTimeValue-2"+","+"measS1raw-2"+","+"measS2raw-2"");";
"data.addRow("+"measTimeValue-3"+","+"measS1raw-3"+","+"measS2raw-3"");";

...and that's incorrect javascript.
The problem with mixing JSP tags and Javascript is that they occur in two differents phases.
JSP Rendering comes first, so all html, css and javascript code is just another string. So after the JSP Rendering finishes, you have just HTML.
You may want to read this blog entry from BalusC about this topic.
Comment: Sorry, posted without wanting to. Edited.
Comment:
   data.addRow('${measurements.measTime}',${measurements.measS1raw},${measurements.measS2raw}); It works as show above. My Eclipse IDE complains for syntax errors though, a little weird.
Answer: This could be alternate solution....
function drawBasic() {

        var data = google.visualization.arrayToDataTable([
            ['Date', 'measurement1','measurement2']
            <c:forEach var="measurements" items="${listOfMeasurements}">
                ,[${measurements.measTime},${measurements.measS1raw},${measurements.measS2raw}]
            </c:forEach>
        ]);

      var options = {
        title: 'Change title Acoordingly',
        chartArea: {width: '50%'},
        hAxis: {
          title: 'Change title Acoordingly',
          minValue: 0
        },
        vAxis: {
          title: 'Change title Acoordingly'
        }
      };

      var chart = new google.visualization.BarChart(document.getElementById('chart_div'));

      chart.draw(data, options);
    }
</script>

How to embed JSTL forEach in javascript