I'm stuck in a part of an exercise where I'm asked to find a variance so that its confidence interval is within some bounds

Question: I'm trying to complete an exercise from my book, asking me to find
the variance to allow a sample of 49 items (that follows a normal law)
to stay in bounds of one confidence interval, at 95% of confidence.
The original question, in French: le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne entre 21.72 mm et 22.28 mm.
Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?
Translated in English: the workshop chief wishes that 95% of its samples of 49 items give an average height between 21.72 mm and 22.28 mm.
How the standard deviation of the height of an item must be modified to get this result?
(at the end of this post is the full text of the exercise)
But I'm stuck a the moment I've got $a$ and $b$ values, the bounds of my $\chi^2(48)$ distribution.
Allow me to explain what happens to me. My program is written in french, but I translate its logs in English, of course.
(here is now the corrected program, glad to your answers.
In comments at its end, are the original statements I once put for the question b of the exercise, and that led me to open this post because I wasn't able to complete it)
@Test @Order(8)
@DisplayName("Dans un atelier qui fabrique des pièces : estimation d'une variance")
public void dansUnAtelier() {
   LOGGER.info("==> Exercice 8 : Dans un atelier, on fabrique des pièces de bois d'espérance mathématique 22 mm et d'écart-type 2 mm.");
   // NormalDistribution N = new NormalDistribution(22, 2);

   LOGGER.info("On prélève un échantillon de 49 pièces.");
   LOGGER.info("a) Quelle est la probabilité que la hauteur moyenne sur cet échantillon dépasse 22.3 mm ?");

   // On sait que la moyenne est centrée sur 22 mm. Mais quel est son écart-type ?
   // ̅X ∼ N(µ, σ/√n) avec µ = 22 mm, σ = 2 mm, et n = 49
   double ecartTypeMoyenne = 2.0 / Math.sqrt(49.0);

   LOGGER.info("\tLa moyenne de cet échantillon de 49 pièces suit une loi ~ ̅X ∼ N(µ, {})", ecartTypeMoyenne);
   NormalDistribution NX = new NormalDistribution(22, ecartTypeMoyenne);

   // P(m > 22.3) = 1 - P(m ≦ 22.3)
   double hauteurMoyenneSuperieure = 1 - NX.cumulativeProbability(22.3);
   LOGGER.info("\tLa probabilité que la hauteur moyenne de cet échantillon dépasse 22.3 est de {}", hauteurMoyenneSuperieure);
   assertEquals(0.1469, hauteurMoyenneSuperieure, 0.01, "Mauvaise probabilité que P(m > 22.3)");

   // Quel écart-type pour une hauteur moyenne comprise entre 21.72 et 22.28 mm ?
   LOGGER.info("Le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne comprise entre 21.72 et 22.28 mm");
   LOGGER.info("b) Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?");

   double phi = (1 + 0.95) / 2; // L'on recherche un intervalle de confiance à 95%
   NormalDistribution NCentreeReduite = new NormalDistribution(0, 1); // Sur la loi normale centrée réduite
   double u = NCentreeReduite.inverseCumulativeProbability(phi);      // u est à lire sur la courbe
   double borneInfActuelle = 22.0 - u * ecartTypeMoyenne;
   double borneSupActuelle = 22.0 + u * ecartTypeMoyenne;
   LOGGER.info("\tL'actuel intervalle de confiance est, à 95%, de m = 22 ± {} × {} = 22 ± {}, soit [{},{}]",
      u, ecartTypeMoyenne, u * ecartTypeMoyenne, borneInfActuelle, borneSupActuelle);

   LOGGER.info("\tIl suffit de déterminer la valeur pour 22 - {} × σ = 21.72 et 22 + {} × σ = 22.28", u, u);
   LOGGER.info("\tau lieu de 22 - {} × {} = {} et 22 + {} × {} = {} comme actuellement.", u, ecartTypeMoyenne, borneInfActuelle, u, ecartTypeMoyenne, borneSupActuelle);

   double ecartTypeMoyenneCible = borneInfActuelle / (22 - u);
   LOGGER.info("\tσ = {22 - {}} = {}. ", u, ecartTypeMoyenneCible);

   LOGGER.info("L'écart-type qui convient pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm est σ = {}", ecartTypeMoyenneCible);
   assertEquals(1, ecartTypeMoyenneCible, 0.1, "Mauvais écart-type pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm");

   /* Cette partie était inexacte, avec une tentative échouée par le Khi-Deux :

      // à 95% de confiance, on aura α = 0.05 => a = α/2 = 0.025 et b = 1 - α/2 = 0.975 dans la courbe du χ²(48)
      LOGGER.info("\tà 95% de confiance, on aura α = {} => a = α/2 = {} et b = 1 - α/2 = {} dans la courbe du χ²({})", 0.05, 0.05/2.0, (1-0.05/2.0), 49-1);
      ChiSquaredDistribution Chi = new ChiSquaredDistribution(48);
      double a = Chi.inverseCumulativeProbability(0.025);
      double b =  Chi.inverseCumulativeProbability(0.975);
      LOGGER.info("\tc'est à dire : a = {} et b = {}", a, b); */
}

It's output, translated in English:
Exercise 8 : In a workshop we are crafting pieces of wood
of mathematical expectation 22 mm and standard deviation 2 mm.
We draw a sample of 49 pieces.
The mean of that sample of 49 piece follows a law ̅X ∼ N(µ, 0.2857142857142857)
The probability that the average height of that sample go over 22.3 mm is  0.14685905637589547

My trouble starts below:
I am in search of the standard deviation for an average height between 21.72 et 22.28 mm:
at 95% of confidence, we will have α = 0.05 => a = α/2 = 0.025 et b = 1 - α/2 = 0.975 on the χ²(48) curve.
namely : a = 30.754505709372623 and b = 69.02258578966595

From here, I'm unable to follow the good path.
With the formulas I know, I am willing to write something like:
$\begingroup \large \sigma^2 \in \big[\frac{(n-1)s^2}{b}, \frac{(n-1)s^2}{a}\big] \endgroup$
or
$\begingroup \large \sqrt{\frac{(n-1)s^2}{b}} \leq \sigma \leq \sqrt{\frac{(n-1)s^2}{a}} \endgroup$
but this leads me to a strange :
$\begingroup \sqrt{\frac{(48)s^2}{69.02}} \leq \sigma \leq \sqrt{\frac{(48)s^2}{30.75}} \endgroup$
I don't know what to do with, because I don't know with what I should replace $s^2$,
and whatever I try, I don't reach the solution my book is giving: 1 mm.

Here is the full text (in French) of the exercise my program tries to solve:

**and here's is the final output, when my program finishes successfully the exercise:
==> Exercice 8 : Dans un atelier, on fabrique des pièces de bois d'espérance mathématique 22 mm et d'écart-type 2 mm.
On prélève un échantillon de 49 pièces.
a) Quelle est la probabilité que la hauteur moyenne sur cet échantillon dépasse 22.3 mm ?
    La moyenne de cet échantillon de 49 pièces suit une loi ~ ̅X ∼ N(µ, 0.2857142857142857)
    La probabilité que la hauteur moyenne de cet échantillon dépasse 22.3 est de 0.14685905637589547
Le chef d'atelier souhaite que 95% des échantillons de 49 pièces donnent une hauteur moyenne comprise entre 21.72 et 22.28 mm
b) Comment faut-il modifier l'écart-type de la hauteur d'une pièce pour obtenir ce résultat ?
    L'actuel intervalle de confiance est, à 95%, de m = 22 ± 1.959963984540054 × 0.2857142857142857 = 22 ± 0.5599897098685869, soit [21.44001029013141,22.55998970986859]
    Il suffit de déterminer la valeur pour 22 - 1.959963984540054 × σ = 21.72 et 22 + 1.959963984540054 × σ = 22.28
    au lieu de 22 - 1.959963984540054 × 0.2857142857142857 = 21.44001029013141 et 22 + 1.959963984540054 × 0.2857142857142857 = 22.55998970986859 comme actuellement.
    σ = {22 - 1.959963984540054} = 1.0698588701932197.
L'écart-type qui convient pour une hauteur moyenne de pièce comprise entre [21.72, 22.28] mm est σ = 1.0698588701932197

It's more σ = 1.07 than σ = 1 (the solution of the book), whatever. But I think it's ok.

But can you explain me more two things?

Why are you telling me that $[21.72, 22.28]$ isn't a confidence interval?

I succeed with $N$ distribution. But my lessons (provided I've reported them correctly) are telling me this (sorry it's in French, but you will see the formulas):

This is why I were willing to search that standard deviation by the mean of a Chi squared. And I am left, a bit troubled.
Could you explain me more what happens? Thanks!
Comment: *"find the variance to allow a sample of 49 items (that follows a normal law) to stay in bounds of one confidence interval, at 95% of confidence."* This question makes no sense to me. Could you write the original question (in French if you like).
Comment: @SextusEmpiricus I wrote the original question and attempted to translate it. I hope it will be clearer.
Comment: Now it makes sense. Note that this is not a confidence interval.
Answer: You are using a $\chi^2$ distribution but you should use the normal distribution like you did in the first part of the exercise.
With the $N(22,\sigma/\sqrt{49})$ distribution you get that 95% of the sample means will be between $21.44$ and $22.56$ if $\sigma = 2$. Now you need to figure out by how much you should scale this $\sigma$ to end up with $21.72$ and $22.28$ instead.
Comment: Thanks! I resoived the exercise and edited the post accordingly with the corrected program. But also a question that I've added in this post. Because my lessons told me that for such a case I was to use the Chi squared distribution? But I can see that's your way that is working!
Comment: @MarcLeBihan you use the chi squared distribution when you are *estimating* a standard deviation. You do this estimation with the [sum of square residuals](https://en.m.wikipedia.org/wiki/Residual_sum_of_squares) statistic; The chi squared distribution is the sample distribution of that statistic when a sample follows the normal distribution. Your case is different. You are not *estimating* the standard deviation. Instead you are *computing* a desired cutoff values for the standard deviation below which the worshop needs to operate.


Visibility depending on several values of another field

Question: I'm having a form with two field. And visibility of the one is depending on the values of the other.
    $form['property'] = array(
    '#title' => t('Property'),
    '#type' => 'radios',
    '#options' => array(
        'private' => t('Private'),
        'bail' => t('Bail'),
        'lease' => t('Lease')
    ),
    '#required' => TRUE,
);

$form['bank'] = array(
    '#title' => t('Bank / leasing company'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#states' => array(
            'visible' => array(
                ':input[name="property"]' => array('value' => 'bail'),
            ),
        ),

);

What comes to ':input[name="property"]'. How do I make it visible when "bail" OR "lease" values are set?
Answer: The Conditional Fields module should be able to do that.
Answer: You need to use Ajax, both a Wrapper and a callback. The wrapper will be set to be hidden by default with a little function to determine the set value of $form['property'] if it is "bail" OR "lease"
Comment: Thank you very much. But I'm new to drupal and not very familiar with it.
Can you please show it to me?


Where can I get started with my improvisation?

Question: I have been playing the alto saxophone for a while now. I have also improvised from time to time and have some theoretical and practical background on the instrument, harmony, scales, etc.
I have played several pieces from the Real Book in many ways with different bands and ensembles.
But after all, I feel that I'm failing at the basics of improvisation, and sometimes feel that I'm just throwing out notes without much sense or that I get into a dead end.
Which are the basics for improvisation? Where should I start both in theory and practice?
Thanks!
Comment: I think you will get answers targeted to your ability level if you specify how long you've been playing the saxophone, how long you've been playing jazz and how in depth your theoretical knowledge is (grade school level knowledge vs taking a college level theory course, you've research this on your own vs you have a private teacher who knows a lot about jazz etc)  Just food for thought.
Answer: Great Question, Edgar!
I'm guessing if you've played some of the Real Book and such that you've heard of Jamey Aebersold.  If not, you definitely need to check him out and volumes 1, 2, 3, and 54 are very common for beginners.
However, if you've exhausted the Jamey Aebersold path and are still unsure of where to go, my best advice is to listen to Jazz Greats, listen to them again, and then listen some more.  The best jazz musicians constantly listened to recordings and played along with them and/or transcribed (analyzing, if you have the theoretical background to) the solos.  While you're listening you should be targeting your favorite licks.  For me this is one.  You need to find what saxophonists inspire you the most and learn their licks (such as Charlie Parker).  After you learn their licks, learn them in every key.  This is a common right of passage for all aspiring jazz musicians.  As far as the legality of the issue, I cannot make a fully informed comment, but I can tell you it'd probably be bad news to steal another players lick and use it in a recorded commercially released CD.  However, the culture of jazz is such that some players might do that and it'd be regarded as a "tip of the hat" to who ever you were quoting.  If you can't afford to buy an entire jazz library, YouTube has some great videos and you can ask your teachers about the best jazz saxophonists for you to listen to right now or explore the world wide web yourself.
While the above is the most important thing you should be doing, you have other things you can do to develop raw material.  The Vol 3 of the Aebersold has a variety of exercises over the ii-V-I progression (which is one of the most commom ones, you'll see in jazz.  The entirety of "Autumn Leaves" is a collection of ii-V-I progressions) that you should learn in every key.
Additionally, take all the jazz scales you know and play them in thirds.  For instance (in eighth notes):
Bb-D-C-Eb-D-F-Eb-G-F-A-G-Bb-A-C-Bb.  Bb-G-A-F-G-Eb-F-D-Eb-C-D-Bb-C-A-Bb.  You can do this same pattern with any of the scales that Jamey Aebersold includes in his books (though I think it sounds awkward used on the blues scale).
Lastly, using all of your new found knowledge of what is idiomatic to jazz, write your own licks, learn them in all keys.  While you are unlikely to ever hear someone call out "Autumn Leaves in Gb minor!" at a jam session, your hard work will allow you to take all of the fantastic ideas you have, and put them out on the horn.
What all of these activities have in common is they drill patterns into your fingers so that playing this lick or that scale become as automatic and easy to you as when you play a concert Bb scale.  I can't count the number of times I've found myself quoting another jazz head while improvising because I've played it so many times.  People quoting "If I Only Had a Brain" became an inside joke in my jazz band.
I will add one more thing, and that's imitation work.  If you can find a cooperative friend who wants to play material with you, challenge the other person by playing something and having them imitate you without looking or reading music.  Stat simple and get more complicated as you progress during the session.  However, the goal is to learn, so if the person didn't get the lick right, play it again, emphasizing what they missed.  Keep going (and simplifying if necessary) until they get it.  Use your best judgment when you're challenging your partner too much.
So in order of importance:

Listen to jazz! (transcribe and analyze as you are able)
Learn the licks (in all keys!)
Learn the scales (and what chords they go with)
Learn the songs; I highly recommend memorizing them)
Play with friends; it's a great way to get new material and it's much more fun than doing it by yourself.

For theory, this was recommended to me.  I honestly haven't read it, and can't vouch for it personally but it has been widely recommended to me and often referred to as "The Bible."  Jazz theory can get insanely complicated.  I'll leave pursuing it to your discretion. Keep in mind that jazz music start from and aural tradition, and very many jazz musicians haven't read music.  Buddy Rich being among one of the more recent ones I know of.  Learning by ear is something I fully endorse and is how I learned.  Music theory came from analyzing the works of those such as J.S. Bach and figuring out what they did where and why they did it.  Jazz theory has a history, and many players just toyed around with what they heard until they liked it (Notably, John Coltrane).
"If it sounds good, it is good"- Duke Ellington
Comment: The Jazz Theory Book is *great*. You should get around to reading it.
Answer: Other ideas that might help:
For all of the different types of chords that you know how to play, try out each of the twelve possible harmonic intervals that you can play above the root of that chord type, and understand the kind of sensations and emotions that each sound evokes.
Once you discover that you love the sounds of particular harmonic intervals played above a particular chord type, these have to become part of your vocabulary. These are the pitches that you will want to be able to grab and hold as you invent melodies. For myself, I especially love the sound of perfect 4ths held above minor chords and the sound of augmented 4ths above major chords.
You should practice how to approach and how to oscillate around these pitches melodically using both chromatic and diatonic motions.
For a chromatic approach, start a phrase a certain distance above or below  a goal pitch and move by a sequence of half steps until the goal is reached and then hold the goal pitch for longer. For a chromatic oscillation, start on a chord or scale pitch and move a half step away up or down, move back to the start, then move by half step in the opposite direction and move back to home. You can also leave out the middle visit to the home pitch and jump from one side of home to the other before returning.
For a diatonic approach, move towards a goal pitch playing all of the scale tones from a starting point above or below until the goal is reached. For a diatonic oscillation move from a chord or scale tone to its nearest scale neighbors before returning to your starting pitch.
You should try to categorize for yourself if a particular interval played above a chord creates a tense or relaxing sensation. If an interval releases tension, it will be natural to use it as a resting or stopping place in your lines. If it increases tension, you'll feel as though it's dangerous to hold that pitch and you'll want to move quickly to another interval.
Thinking in these terms, you'll notice that certain pitches in the context of a particular chord type are seemingly magnetically attracted to other intervals. If you hear one type of interval, it will really satisfying to hear it followed by another particular interval. You'll also notice that pitches in one chord will be attracted to entirely different pitches as chords change in the accompaniment.
You should build a vocabulary of move sequences between two, three and four harmonic intervals that sound good within the span of a particular chord and then other sequences that sound good as you move across chord boundaries.
For any harmonic interval you choose to create, you'll want to know several other intervals that you can move to leave that sound.
When you move from one pitch to another, a characteristic melodic interval will be formed. You should know the sensations and emotional connotations of each of the  different melodic intervals that you can produce. It's the combination of change of harmonic interval and simultaneous change of melodic interval that determines the meaning of each note that you play in a melody.
When you find a pitch that works over a particular chord in a chord progression, it helps to know what the lifetime of that pitch is as the progression is followed. If you hold a pitch as the accompanying chords change, each chord change will create a different harmonic interval between the chord root and the held pitch.
Your ear will tell you that once a particular successor chord arrives, it's not tenable to hold a particular pitch any longer. Any pitch that you hold will nearly always run into a musical wall if you hold it long enough, and you will need to know which pitches will sound good in the new chord change and move to one of those as you continue your line.
Rhythmically, you should eventually know what it feels like to start your line at any subdivision of a measure.  You should know what it feels like to start a phrase on any of the beats within a measure. You should know what it feels like to subdivide each beat by 2,3,4,5,6,7 and 8, and to start playing at any of those beat subdivisions. Being able to vary the starting points of the  phrases that you invent adds interest to a performance.
Melodic phrases in music  typically move quickly at the start, hold a steady speed and then slow down  or pause for longer duration to mark their end. You should study different ways to put a line in motion  and different ways to stop or pause within it.
It's interesting to experiment with successions of different sized phrases. Accomplished improvisors know how to balance long phrases with shorter phrases. Many times the phrase successions of good improvisor will sound conversational because of the variety and balance of phrase lengths that they use.
It's interesting to experiment with the amount of space that you leave  between phrases. Great improvisors have their own suprising ways to stop or pause as they play.
Answer: Improvisation begins with embellishment.  Enhance a memorized tune by reworking the notes according to your own preference.  Save the full out jazz solo for after you can personalize a tune.
Answer: As a complement to the other answers, have a look at Hal Crook's book "How To Improvise".


Kube API for Listing the CustomResource instances in a namespace (or on a cluster) in Kubernetes

Question: Using command-line utility kubectl we can list a custom resource instances as follows
kubectl get <customresource_kind>

In a similar fashion, do we have a REST API to achieve the same? i.e. the API takes the Kind of the CustomResource and lists all the instances created?
I am referring to this API Reference :
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/
Answer: You can list crds like every other API resources using Kubernetes REST API.
The final URL path will differ, depending on object's scope: Cluster or Namespaced.
The general rule for constructing the URL path is described here in official documentation.
Just to give you an example based on calico's clusterinformations.crd.projectcalico.org (v1):
kubectl proxy --port=8080 &

curl http://localhost:8080/apis/crd.projectcalico.org/v1/clusterinformations | jq '.items[].metadata.name

"default" <- I have only one instance of this type of custom resource


How do I get the current destination URL query parameter?

Question: Does anyone know to how to get the destination in a template file?
At the moment I an getting the destination parameters in a preprocess function.
// Get destination params.
$variables['destination_params'] = \Drupal::destination()->getAsArray();

The template file uses the following code.

You can try logging in to see if you have access.

Comment: What's wrong about the current approach? I guess it's caching, right?
Comment: Primarily to use in places where it is easier to not use preprocess- e.g. views custom text, Display Suite Custom token field using twig etc.
Answer: You can use path() function with '<current>' pseudo URI to generate current page relative URL.
For example:
{# in hard-coded path (bad practice) #}
<a href="/user/login?destination={{ path('<current>') }}" class="btn btn-sm btn-primary icon-before"> Sign-In

{# more proper twig-like way #}

You can try <a href="{{ path('user.login', {}, {'query': {'destination': path('<current>') }}) }}">logging in to see if you have access.

More about Drupal's twig built-in functions here: https://www.drupal.org/docs/theming-drupal/twig-in-drupal/functions-in-twig-templates
Comment: This seems fine, and bubbles cache metadata correctly (for the most parts - see below answer) but any extra query parameters are lost :-(
Comment: As Joshua said, it would be good to include query string in this answer.
Answer: Adding this here which expands on the answer given here by @MiSHuTka
(that answer work perfectly for most scenarios with cache data)
Noting that both answers will not provide any extra query parameters in the destination query parameter. (if you wanted them to persist)
Sometimes you need to add the html link to an render array item instead of the template itself to get cache data to work correctly (I believe this has something to do with #theme_wrappers and #theme on the same render array?). So use '#type': 'inline_template' + verbatim tag to force string, so it be reparsed to bubble cache data.
{% set login_link %}
  {# verbatim used to force a string, so it can be reparsed as twig later on, keeping cache metadata in the correct context #}
  {% verbatim  %}
    <a href="{{ path('user.login', {}, {'query': {'destination': path('<current>')} }) }}">{{ 'Login'|t }}
  {% endverbatim %}
{% endset %}

{% set extra_render = {'#type': 'inline_template', '#template': login_link} %}

Use like so:
{% extends "field.html.twig" %}
{% for key, item in items %}
    {# Add markup to the the render array - assume `extra_render` variable. #}
    {% set item_content = item.content|merge( {'extra_render': extra_render} ) %}
    {% set item = item|merge({'content': item_content }) %}
    {# Prepend to render array #}
    {% set items = {(key): item} + items %}
  {% endfor %}

Edit:
I have noted that for some reason. If variable is printed via twig white space control {{- render_var -}} then the verbatim string is not rendered, just printed as is. (regular set/end set works fine but renders too early of course for caching)
Solution: Use inline_template + #context: _context.
E.g. {% set extra_render = {'#type': 'inline_template', '#template': mysetverbatimstring, '#context': _context }
For {{- render_var -}} - twig white space control
@see https://www.drupal.org/docs/theming-drupal/twig-in-drupal/comparison-of-phptemplate-and-twig-theming-paradigms#whitespace
For _context
@see https://twig.symfony.com/doc/2.x/templates.html#global-variables


Cannot Export JDL from Latest JHipster 6.5.0. Error show "Cannot read property 'error' of undefined"

Question: I have updated to latest Jhipster 6.5.0. I have seen that the export option is not working
Below is the error message that I get. Even with -d (debug) option, nothing much is getting printed
<code>C:\ap\ap>jhipster -d export-jdl C:\ap\export-ap.jdl
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Debug logging is on
DEBUG!  cmd: export-jdl
DEBUG!  args: C:\ap\export-ap.jdl, commands: Object, options: Object, _execs: Object, _allowUnknownOption: true, _args: Object, _name: export-jdl, _noHelp: false, parent: Object, _description: Create a JDL file from the existing entities, _argsDescription: undefined, _events: Object, _eventsCount: 1
DEBUG!  opts: argument: Object, desc: Create a JDL file from the existing entities
DEBUG!  Arguments found
DEBUG!  cmdArgs: C:\ap\export-ap.jdl
INFO! Executing jhipster:export-jdl C:\ap\export-ap.jdl
INFO! Options: d: export-jdl, from-cli: true
ERROR! TypeError: Cannot read property 'error' of undefined
</code>
Comment: What does print `node --version` ? Are you using an LTS version of node as recommended in JHipster doc?
Comment: it is fixed in generator-jhipster 6.5.1, or you can upgrade to JHipster core 6.0.4 in your package.json
Answer: Yes. This is fixed is new Version of JHipster... Thanks for update


Creating a Date Field that will display 'Year' to 'Current'

Question: I want to create a field that will ask the user for the date they started their job to when they left. If they are still currently working at the job, the user will click 'I currently work there' or something similar.   The date module currently can be setup to have a 'to' and 'from' field.  The tricky part is how do I save 'Current/Present' to the database.  How do I go about this?

Answer: This is doable using Conditional Fields despite its rather minor limitation (http://drupal.org/node/360824). You can't trigger fields' display by a checkbox's off value. That will require you to negate the "I currently work here" checkbox to something like "Past position". You can still decide if you want it checked by default or not, and using JavaScript you can hide the "Past position" checkbox and control its value using the desired checkbox with the opposite meaning.
Saving 'Current/Present' to the database is not an issue really. You only need to check the value of the checkbox field and you can disregard the 'Current/Present' value if this is an ongoing position. To make the To date field work as expected, though, make it Required and choose an arbitrary Default value for it, which will be used even when the field is not displayed. Now would be a good bet.
Here's an image which pretty much wraps up the 5 minute content type setup.

It's obviously going to take a little more than that to make the form look and behave the exact way you want. For information on theming the resulting form, see Theming a form with conditional fields.
Also see Conditional Fields Docummentation
Answer: I would create 2 date fields to reproduce the "to-from" behavior of date: field_job_start and field_job_end. Then I'll create the checkbox and make it control field_job_end using Conditional Fields so that if it's checked field_job_end disappears.
Then a little theming for the node to show field_job_start to present if the checkbox is checked or field_job_start to field_job_end if not. You can also create this with a computed field.
Answer: I see two options...
1) You don't have to save "current/present" in your database. You can just determine if there's a "to" date on the Date field. If there isn't, they still work there. If there is a value for "to", then they don't still work there. That way you're just storing the date field instead of creating another field for "current/present". You can still use Conditional Fields for controlling whether the "to" part of the date is enabled or not.
2) Use that "I currently work here" check box (which can easily be created using a field, you probably already are) as your check for whether they currently work there. If the field is already in your form, go ahead and use it!
Answer: I am not fully aware of how to achieve this, but I am wondering if the CCK Select Other module might help.
Answer: @Jan Tomka has a great answer. Allow me to share an alternative and simpler solution that I used:
Install String Overrides to change the text "Show End Date" to "I no longer work here."
The downside of this approach is that it changes it site-wide, for all date fields. However it may be preferable to the conditional fields approach.


Como enviar imagens com dois inputs file?

Question: Tenho os seguintes dados e quero fazer o cadastro de dois inputs file ao mesmo tempo:
<form method="post" enctype="multipart/form-data">
   <input type="file" name="thumb">
   <input type="file" name="img">
   <input type="sumite" name="enviar" value="Cadastrar">
</form>

Sei fazer com uma imagem mas tenho que adicionar a galeria e uma thumb de destaque
<?php
 if(isset($_POST['enviar'])){
     $texto= trim(strip_tags($_POST['texto']));
     //Imagem
     $file      = $_FILES['img'];
     $numFile       = count(array_filter($file['name']));
     //PASTA
     $folder        = 'slide/';
     //REQUISITOS
     $permite   = array('image/jpeg', 'image/png');
     $maxSize   = 1024 * 1024 * 5;
     //MENSAGENS
     $msg       = array();
     $errorMsg  = array(
       1 => 'O arquivo no upload é maior do que o limite definido em upload_max_filesize no php.ini.',
       2 => 'O arquivo ultrapassa o limite de tamanho em MAX_FILE_SIZE que foi especificado no formulário HTML',
       3 => 'o upload do arquivo foi feito parcialmente',
       4 => 'Não foi feito o upload do arquivo'
     );
     if($numFile <= 0){
       echo '

             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
             Selecione pelo menos 1 foto para a postagem!

';
     }
     else if($numFile >=10){
       echo '

             <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
             Você ultrapassou o limite de upload. Selecione até 9 fotos e tente novamente!

';
     }else{
       for($i = 0; $i < $numFile; $i++){
         $name  = $file['name'][$i];
         $type  = $file['type'][$i];
         $size  = $file['size'][$i];
         $error = $file['error'][$i];
         $tmp   = $file['tmp_name'][$i];
         $extensao = @end(explode('.', $name));
         $novoNome = rand().".$extensao";
         if($error != 0)
           $msg[] = "$name : ".$errorMsg[$error];
         else if(!in_array($type, $permite))
           $msg[] = "$name : Erro imagem não suportada!";
         else if($size > $maxSize)
           $msg[] = "$name : Erro imagem ultrapassa o limite de 5MB";
         else{
           if(move_uploaded_file($tmp, $folder.'/'.$novoNome)){
             //$msg[] = "$name : Upload Realizado com Sucesso!";
             //Insert table
             $insert= "INSERT into slide (texto, img) VALUES(:texto, :img)";
             //Segunda validação
             try{
               $result= $conexao->prepare($insert);
               $result->bindParam(":texto",   $texto,  PDO::PARAM_STR);
               $result->bindParam(":img",     $novoNome,PDO::PARAM_STR);
               $result->execute();
               $contar= $result->rowCount();
               if($contar>0){
                 echo '

                     <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                       Postagem cadastrada com sucesso! Para visualizar clique aqui

                 ';
               }//Se realizado o cadastro
               else{
                 echo '

                   <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                   Falha ao cadastrar postagem.

               ';
               }//Mensagem de falha
             }catch(PDOException $erro){echo $erro;}
               }else{$msg[] = "$name : Desculpe! Ocorreu um erro...";}
               foreach($msg as $pop)
               echo $pop.'
'; //echo $pop.'
';
           }
         }
     }
 }
?>

Comment: Mas qual seria a dúvida?
Answer: É isto que queres?
 $file  = $_FILES['img'];
 $thumb = $_FILES['thumb'];


Como fazer um mapeamento de imagem ser responsivo?

Question:
            <map name="Calculadora">
                <area class="mapa" onclick="teste()" coords="252,953,647,1379" shape="rect">
                <area class="mapa" onclick="teste()" coords="746,952,1141,1375" shape="rect">
                <area class="mapa" onclick="teste()" coords="1258,954,1644,1377" shape="rect">
                <area class="mapa" onclick="teste()" coords="1752,941" shape="rect">
                <area class="mapa" onclick="teste()" coords="252,1469,638,1883" shape="rect">
                <area class="mapa" onclick="teste()" coords="746,1465,1132,1879" shape="rect">
                <area class="mapa" onclick="teste()" coords="1258,1465,1644,1879" shape="rect">
                <area class="mapa" onclick="teste()" coords="2156,745,2381,988" shape="rect">
                <area class="mapa" onclick="teste()" coords="1752,1469,2138,1883" shape="rect">
                <area class="mapa" onclick="teste()" coords="252,1976,638,2390" shape="rect">
                <area class="mapa" onclick="teste()" coords="746,1980,1132,2394" shape="rect">
                <area class="mapa" onclick="teste()" coords="1258,1976,1644,2390" shape="rect">
                <area class="mapa" onclick="teste()" coords="1752,1982,2138,2396" shape="rect">
                <area class="mapa" onclick="teste()" coords="252,2482,638,2896" shape="rect">
                <area class="mapa" onclick="teste()" coords="746,2484,1132,2898" shape="rect">
                <area class="mapa" onclick="teste()" coords="1258,2486,1644,2900" shape="rect">
                <area class="mapa" onclick="teste()" coords="1752,2484,2138,2898" shape="rect">
            </map>

Como posso fazer com que o mapping dessa imagem se torne responsivo junto da imagem?
Pois do jeito com que o codigo esta escrito, o mapeamento fica inteiramente errado dependendo da resolução do display/tela.
Imagem que estou utilizando: https://i.stack.imgur.com/PnMqG.jpg
OBS: Tentei usar porcentagem no lugar de pixeis, mas não funcionou.
Exemplo: A imagem a seguir tem 500px de largura e altura, as coordenadas do quadrado no centro é: 159,159,342,342. Usando porcentagem ficou: 31.80%,31.80%,68.40%,68.40%(Para definir o valor das primeiras porcentagens fiz uma regra de três, 500 estava para 159, tal como 100% estava para x)

E fazendo por esse metodo, não funcionou.
O codigo desse exemplo ficou assim:

   <map name="Calculadora">
      <area class="mapa" coords="31.80%,31.80%,68.40%,68.40%" shape="rect">
   </map>

Obs2: Se no exemplo a cima eu fizer: coords="159%,159%,342%,342%" funciona, mas não fica responsivo, se a imagem tem sua resulução mudada, o link fica no lugar errado.
Comment: Dica https://www.zaneray.com/responsive-image-map/
Comment: @hugocsl tentei usar esse site, mas não entendi onde colocar o codigo que ele me disponibilizou.
Answer: FOIIII!
Para fazer um mapeamento responsivo de uma imagem, utilizei javascript. Ele tinha a função de pegar a resoluçao da imagem(Usei "document.getElementById('Id da imagem').width") e de acordo com a proporção que eu dei em porcentagem, calcular qual seria a cordenada certa para o mapeamento.
Exemplo:

#Mapa
{
  cursor: pointer;
}

            <map id="Mapa" name='QuadradoMap'>
            </map>

O tamanho original da "Imagem.jpg" era de 500x500 e o mapping original era: 159,159,342,342. Utilizando regra de 3 descobri qual era o percentual de cada coordenada de acordo com o total(500), assim descobri a proporção da imagem para as coordenadas(Nesse exempo: 31,8% e 68,4%).
Vai dar um trabalho para escalar esse codigo, mas foi a unica resposta que consegui encontrar.


Views - get nodes flagged or created by me

Question: I want to list nodes flagged or created by me. You can think this as an "or" filter in views. is there a way to do in in views and flag ?
Answer: Views 3 supports groups of filters joined by OR.

Edit your View.
Under "Filter criteria" click the little down arrow next to "Add" and select "And/or, rearrange".
Create a new filter group with the filter(s) you want.
Change "operator" to "OR".
Save.

If you're using Drupal 6:

Views Or allows Views to
  combine filters or arguments with OR and fields with COALESCE.
Comment: Thanks for reply but it should have act like an argumant. Because ı want to list nodes created by me. How do I do that with filters.
Comment: That is a different question, already asked here: http://drupal.stackexchange.com/questions/32019/how-to-use-a-views-contextual-filter-or


Prove that if $\lim_{x\to a^+}f'(x)$ exists then $\lim_{x\to a^+}f(x)$ exists.

Question: Prove that if $\lim_{x\to a^+}f'(x)$ exists then $\lim_{x\to a^+}f(x)$ exists.
I am a high school math teacher, not a professional mathematician. I just thought of this question, in the context of trying to show that if $f''(a)>0$ then the curve does not necessarily have a U-shape around $x=a$, but that is not important here and I am not inviting discussion of that; I just mentioned that to add context.
I have searched for this question, here at MSE and also approachzero, but haven't found anything helpful.
The statement I'm trying to prove here seems intuitively obvious to me but difficult to prove. I have tried using the formal definition of limit, and differentiation from first principles, to no avail.
(I just asked a related question which turned out to be a flawed question, because what I was asking to be proved, is not true. Responders there said that the case with one-sided limits is true, so assuming that is correct, I am asking about that here. In that related question, I showed my flawed attempt at the proof.)
Feel free to let me know if there's anything I can do to improve this question.
Answer: Let $(a_n)$ be a sequence converging to $a$ with $a_n >a$, say $a_n=a+\frac 1 n$. Then, by MVT, $f(a_n)-f(a_m)=f'(t)(a_n-a_m)$ for some $t$ between $a_n$ an $a_m$. Let $l =\lim_{x \to a} f'(x) $. There exists $\delta >0$ such that  $|f'(x)|<l+1$ if $x>a,|x-a| <\delta$. If $n$ and $m$ are sufficiently large then $|t-a| <\delta$ so $|f(a_n)-f(a_m)| <(l+1)|a_n-a_m| \to 0$. Hence, $f(a_n)$ is Cauchy sequence. Let $L=\lim f(a_n)$. If $(x_n)$ is any sequence converging to $a$ from the right we can apply MVT again to show that $f(x_n)-f(a_n) \to 0$. Hence, $f(x_n) \to L$. It follows that $f(x) \to L$ as $ x \to a$.
Comment: Thanks. The part that I was missing was, why does a Cauchy sequence (was not familiar with the term) converge; now I know where to look. Small question: where you wrote |x-a|a,|x-a| <\delta$. @Dan
Answer: Since Kavi already demonstrated a simple proof, let me briefly explain why we expect the result to hold:

Suppose that $f : (a, b) \to \mathbb{R}$ is differentiable and $f'(x)$ converges as $x \to a^+$. Then $f'(x)$ is bounded near $a$, that is, there exist $c \in (a, b)$ and $M \in (0, \infty)$ such that $|f'(x)| \leq M$ whenever $x \in (a, c)$.

A differentiable function on an interval with bounded derivative is an example of uniformly continuous function. Recall that a function $f : E \subseteq \mathbb{R} \to \mathbb{R}$ is said to be uniformly continuous if
$$ \forall \varepsilon > 0, \ \exists \delta > 0, \ \text{s.t.} \ \forall x, y \in E \ : \, |x - y| < \delta \implies |f(x) - f(y)| < \varepsilon. $$
(That is, uniformly continuity requires that a single choice of $\delta$ should work for any point.) Then it is well-known that:

Theorem. Any uniformly continuous $f : E \subseteq \mathbb{R} \to \mathbb{R}$ extends to a uniformly continuous function on $\overline{E}$, the closure of $E$.

These two observations together immediately prove OP's claim.
Comment: +1 but the term convergence applies to sequences (or series), not to a real function. Although it is perceptible, I would avoid the phrasing "$f'(x)$ converges as $x \to a^+$".


Taft-Hopf Algebra has dimension $N^2$?

Question:
Definition of the Taft-Hopf Algebra
Let $k$ be a field. Let be $N$ a positive integer such that there exists a primitive $N$-th root of unitiy $\zeta$ over $k$.
Denote by $(H, \mu, 1_H)$ the unital, associative algebra over $k$ that is generated by elements $g$ and $x$, subject to the three relations:
$g^N=1$, $x^N=0$, $xg=\zeta gx$.
One can show that there are algebra maps:

$\eta: k \rightarrow H; 1 \mapsto 1_H$.
$\Delta: H \rightarrow H \otimes H; g \mapsto g\otimes g, x \mapsto 1 \otimes x + x \otimes g$.
$\epsilon: H \rightarrow k; g \mapsto 1, x \mapsto 0$.
$S: H \rightarrow H^{opp}; g \mapsto g^{-1}, x \mapsto -xg^{-1}$.

Then (one can show) that $(H, \mu, \eta, \Delta, \epsilon, S)$ is a Hopf algebra. We call it the Taft-Hopf Algebra.

Question(s)

In my lecture notes it says, for a given $N$ the Taft-Hopf algebra has dimension $N^2$. Why?
What would be a basis?
Answer: This has nothing to do with the Hopf algebra structure.
It follows from the relations $g^N = 1$ that we can define for every element $[n]$ of $\mathbb{Z}/N$ the power
$$
  g^{[n]} := g^n \,.
$$
We show in the following that the elements $g^{[n]} x^m$ with $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$ are a basis of $H$.

Vector space generating set
We first show that these elements span the algebra $H$ as a vector space.
We know from the construction of $H$ that it is spanned as a vector space by the monomials
$$
  p_1 \dotsm p_r
$$
with $r \geq 0$ and $p_i \in \{g, x\}$.
It follows from the relation $x g = \zeta g x$ that we can reorder the factors $z_i$ in any such monomial up to some nonzero factor (namely a power of $\zeta$).
It follows that $H$ is already spanned by those monomials of the form
$$
  g^n x^m
$$
with $n, m \geq 0$.
It follows from the relations $g^N = 1$ and $x^N = 0$ the vector space generators can equivalently be written as
$$
  g^{[n]} x^m
$$
with $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.

Linearly independent
To show that these monomials are linearly independent we use a standard trick from representation theory.
We first compute the action of the two algebra generators $g$ and $x$ on our vector space generating set.
We find from the relations $xg = \zeta gx$ and $x^N = 0$ that
\begin{align*}
  g \cdot g^{[n]} x^m
  &=
  g^{[n+1]} x^m \,,
  \\
  x \cdot g^{[n]} x^m
  &=
  \begin{cases}
    \zeta^n g^{[n]} x^{m+1} & \text{if $0 \leq m \leq N-2$,} \\
    0                       & \text{if $m = N-1$,}
  \end{cases}
\end{align*}
for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.
Let now $V$ be the free vector space with basis
$$
  G^{[n]} X^m
  \qquad
  \text{with $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.}
$$
We denote the free algebra on the generators $g$ and $x$ by $F$.
We can define an $F$-module structure on the vector space $V$ via
\begin{align*}
  g \cdot G^{[n]} X^m
  &=
  G^{[n+1]} X^m \,,
  \\
  x \cdot G^{[n]} X^m
  &=
  \begin{cases}
    \zeta^n G^{[n]} X^{m+1} & \text{if $0 \leq m \leq N-2$,} \\
    0                       & \text{if $m = N-1$,}
  \end{cases}
\end{align*}
for all $[n] \in \mathbb{Z}$ and $m = 0, \dotsc, N-1$.
This module structure is compatible with the relations of $H$ because
\begin{align*}
  xg \cdot G^{[n]} X^m
  &=
  x \cdot G^{[n+1]} X^m
  \\
  &=
  \zeta^{n+1} G^{[n+1]} X^{m+1}
  \\
  &=
  \zeta^{n+1} g \cdot G^{[n]} X^{m+1}
  \\
  &=
  \zeta g x \cdot G^{[n]} X^m
\end{align*}
for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-2$,
and similarly
\begin{align*}
  xg \cdot G^{[n]} X^{N-1}
  &=
  x \cdot G^{[n+1]} X^{N-1}
  \\
  &=
  0
  \\
  &=
  \zeta g \cdot 0
  \\
  &=
  \zeta g x \cdot G^{[n]} X^{N-1} \,,
\end{align*}
for all $[n] \in \mathbb{Z}/N$, as well as
$$
  g^N \cdot G^{[n]} X^m
  =
  G^{[n+N]} X^m
  =
  G^{[n]} X^m
$$
for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$, and
$$
  x^N \cdot G^{[n]} X^m
  =
  0
  =
  0 \cdot G^{[n]} X^m
$$
for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.
It follows that the $F$-module struture on $V$ descends to an $H$-module structure on $V$.
For this $H$-module structure on $V$ we now have
$$
  g^{[n]} x^m
  \cdot
  G^{[0]} X^{0}
  =
  \zeta^{0 \cdot m} g^{[n]} \cdot G^{[0]} X^m
  =
  g^{[n]} \cdot G^{[0]} X^m
  =
  G^{[n]} X^m
$$
for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.
The elements $G^{[n]} X^m$ are linearly independent in $V$ (since they form a basis).
It thus follows that the elements $g^{[n]} x^m$ are linearly independent in $H$.
Indeed, if we have some linear combination
$$
  0
  =
  \sum_{[n], m}
  \lambda_{[n], m}
  g^{[n]} x^m
$$
in $H$ then it follows that
$$
  0
  =
  \sum_{[n], m}
  \lambda_{[n], m}
  g^{[n]} x^m
  \cdot
  G^{[0]} X^{0}
  =
  \sum_{[n], m}
  \lambda_{[n], m}
  G^{[n]} X^m
$$
and therefore $\lambda_{[n], m} = 0$ for all $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$.
We have altogether shows that the elements $g^{[n]} x^m$ of $H$ with $[n] \in \mathbb{Z}/N$ and $m = 0, \dotsc, N-1$ are vector space generators for $H$ as well as linearly independent.
These elements are hence a basis of $H$, as claimed in the beginning.
Comment: I misread the question and worked with the relation $x^N = 1$ instead of $x^N = 0$. I have adjusted the calculations to the correct relation. I don't know a good reference for representation theory; I know the above trick only because I've seen it used a few times before in lectures.
Comment: Thanks a lot! I have never seen a proof of linear independence in that manner. Do you have any recommendations for an introduction to representation theory? The course I am taking repeatedly seems to expect some knowledge in it.
Comment: By the way, I think there are some minor typos in your answer. I edited it - maybe you can have a look, whether I was right on the edits? Thank you.

Taft-Hopf Algebra has dimension $N^2$?


Expected value of pair of success of

Question: I am working on a problem from Harvard Stat 110 problem set. One of the problem (1.7.a) asks to find $$E\binom{X}{2}$$ , where random variable X is from hypergeometric distribution. What does the above expression means?
Also, in the solution of the second part of the question (1.7.b)  it states that
$$E\binom{X}{2} = E(X(X-1)) $$ . How to prove this ?
Comment: Is this the binomial coefficient$${x \choose 2}=x(x-1)/2$$ in which case the second equation is missing a division by 2...?
Comment: And the $E$ would then be the expectation under the Hypergeometric distribution.
Comment: Oh...thanks Xi'an. I missed division by 2. It makes sense now.
Comment: @Xian, Saurabh -- One of you two should write an answer so this doesn't end up unanswered.
Answer: The problem asks to find $$E\binom{X}{2}$$. Random variable X is Hypergeometric. Expression can be interpreted as the expected number of pair of successes.
Expanding X choose 2 expression.
$$E\binom{X}{2} = E(X!/2!(X-2)!) = E(X(X-1))/2$$

Expected value of pair of success of


How many created graphics in a php file are allowed?

Question: While I am following the instructions for generating images I asked myself:
How many different images can I create in a php file, that will be referenced in a HTML file like ?
I have tried in images.php file
header(Content-type: image/png);
imagepng($img1);
imagepng($img2);
imagedestroy($img1);
imagedestroy($img2);

whitout success. only one image will be displayed.
For that, is it possible to reference an array in src?
Or do I need to put every single created image in a single php file?
Any hint is appreciated.
Comment: Think the part you are missing is... `\images.php?img=header`, `\images.php?img=fooImg`, etc. Use parameters, don't create essentially the same file over and over. https://www.php.net/manual/en/reserved.variables.get.php
Answer: No you can't pass an array as a src. Make the PHP script take parameters.
Here is the same script, taking a size parameter. You could easily also be passing something like a user ID or image ID. Then your one script becomes capable of serving requested images on demand. This is a common pattern with tracking pixels for use in things like recording email opens.
https://lh3.googleusercontent.com/-42t7l9U95R4/AAAAAAAAAAI/AAAAAAAAAAc/KvJidye2yro/photo.jpg?sz=24

https://lh3.googleusercontent.com/-42t7l9U95R4/AAAAAAAAAAI/AAAAAAAAAAc/KvJidye2yro/photo.jpg?sz=128


[ValidationException: HV000041: Call to TraversableResolver.isReachable() threw an exception.]

Question: I am learning play framework from
Play Framework
It gives an error on 1st line of this code.
Form<Task> filledForm = taskForm.bindFromRequest();
if(filledForm.hasErrors()) {
return badRequest(
  views.html.index.render(Task.all(), filledForm)
);
} else {
Task.create(filledForm.get());
return redirect(routes.Application.tasks());
}
}

Answer: try injecting the form factory in the class
@Inject
FormFactory formFactory;

and in action try like this
Form<Task> filledForm = formFactory.form(Task.class).bindFromRequest();


Analysis of ordinal patient data across 3 time points (ordinal regression vs. Wilcoxin rank sum)?

Question: I am conducting a study of a number of patients with a disease, and using an ordinal scale assessment of functional status at 3 different time points.
In this example we can say that I have 100 patients, and each one is measured at the three time points (no need for imputation).
Please see the graphical representation of the change in the frequencies of each of these 6 ordinal values across the three time points (top group has no patients with ordinal score 3,5,6):

I want to compare the overall difference between time point 1 and time point 2, time point 1 and time point 3, and time point 2 and timepoint 3 to see if the shifts observed are significant.
Additionally, if there is a way to determine changes between the specific ordinal levels that may be helpful as well.
I am planning on doing the analysis in R, but would like to make sure that I am using the appropriate test. Would some form of ordinal regression be appropriate here? Or is some version of a Wilcoxin rank sum better for this study paradigm?
Thank you for any assistance.
*UPDATE WITH DATASET
I have still been going through working to analyze this the best way.
Code for my dataset is below for reference:
mrsstat <-tibble(
  Patient = c(1:21),
  pMRS = c(0, 0,    0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  2,  0),
  dMRS = c(4, 2,    2,  4,  3,  6,  4,  1,  5,  0,  3,  0,  6,  1,  5,  3,  3,  1,  3,  4,  3),
  fMRS = c(1, 2,    2,  3,  2,  6,  3,  1,  2,  0,  3,  0,  6,  1,  5,  2,  0,  1,  3,  4,  0))

mrsstat<- mrsstat %>%
  pivot_longer(cols = c("pMRS", "dMRS", "fMRS"), names_to = "timepoint") %>%
  mutate(timepoint = factor(timepoint,
                            levels= c("fMRS",
                                      "dMRS",
                                      "pMRS")),
         value=  factor(value, levels = c("0", "1","2","3","4","5","6")),
         Patient= factor(Patient, levels = c(1:21)))

> mrsstat
# A tibble: 63 × 3
   Patient timepoint value
   <fct>   <fct>     <fct>
 1 1       pMRS      0
 2 1       dMRS      4
 3 1       fMRS      1
 4 2       pMRS      0
 5 2       dMRS      2
 6 2       fMRS      2
 7 3       pMRS      0
 8 3       dMRS      2
 9 3       fMRS      2
10 4       pMRS      0
# … with 53 more rows

I attempted to do an ordinal regression analysis with methods using the ordinal package et al. in R as described here:
Two-way Ordinal Regression with CLM
I am not sure that this is feasible with my dataset as each patient has only 1 recording of the functional outcome score (variable labled "value")  at each timepoint, so the when attempting to get to an ANOVA analysis of the data as seen in the link above for two-way ordinal regression, it wont work as there is obviously no variance with one measure per patient per timepoint.
I still feel like there should be some test to assess for changes in significance between the "value" proportions between the  3 timepoints and for multiple comparisons between the ordinal "value" groups.
Comment: Consider a random effects proportional odds model with time represented with 2 indicator variables.  You can form time differences using these indicators to assess what you want.
Comment: Thank you for this suggestion- Im still learning about some of these more in depth statistical analyses- based on the dataset above do you feel this would still be an option given the single observation for each patient at one of the three time points?
Comment: You originally stated that each patient is measured at all 3 time points so I'm not following this.
Comment: Sorry Frank, yes each patient is measured at each time point. I meant that each time point only has one measurement per patient. Using the link above for the two-way ordinal regression, there isnt a way I was finding to analyze the data using an ANOVA as it was set up a as follows:
```
model <- clm(value ~ Patient + timepoint + Patient:timepoint,
             data = mrsstat,
             threshold = "symmetric")

anova(model, type = "II")
``` . Thank you for your assistance and insight
Comment: `clm` does not allow for random effects. Try the `clmm` function from the `ordinal` package. Something like this: `clmm(value~timepoint + (1|Patient), data = mrsstat)`.
Comment: Hi CoolSerdash, thank you for this suggestion. It does return an analysis with the random effects standard deviation and variance, but not so much in the way of an interpretable p-value or the multiple comparisons? Below is the output from this suggestion:
Comment: `> clmm(value~timepoint + (1|Patient), data = mrsstat)
Cumulative Link Mixed Model fitted with the Laplace approximation
formula: value ~ timepoint + (1 | Patient)
data:    mrsstat

 link  threshold nobs logLik AIC    niter     max.grad
 logit flexible  63   -91.13 200.27 448(1671) 5.04e-06

Random effects:
 Groups  Name        Var Std.Dev.
 Patient (Intercept) 2.374    1.541
# of groups:  Patient 21
Coeff:
timepointdMRS timepointpMRS
        1.056        -3.753
Thresholds:
    0|1     1|2     2|3     3|4     4|5     5|6
-1.9095 -0.6485  0.3734  1.7801  2.9073  3.7345
Answer: Meta comment 1:  This thread is essentially about using the ordinal package in R, not about statistics per se.
Meta comment 2: This post is in response to the discussion under the original post as well as the response posted by @XFrost .
@XFrost , it sounds like you are trying to use the summary() function in ways it's not really designed for.  Instead, you can use the anova() function and emmeans package to get the information I think you're looking for.
BTW, since you cited my webpage earlier, I'll note that the relevant example for the clmm model is here: rcompanion.org/handbook/G_08.html  (As always, with the caveat that I wrote it.)
To continue the analysis in the response by @XFrost :
A p-value for the effect of timepoint can be determined with the anova() function:
    model.null = clmm(value ~ 1 + (1|Patient), data = mrsstat)

    anova(model, model.null)

       ### Likelihood ratio tests of cumulative link models:
       ###
       ###            no.par    AIC   logLik LR.stat df Pr(>Chisq)
       ### model.null      7 233.74 -109.870
       ### model           9 200.27  -91.135  37.472  2  7.296e-09 ***

And the pairwise comparisons of timepoint can be determined with the emmeans package:
    library(emmeans)

    marginal = emmeans(model, ~ timepoint)

    pairs(marginal, adjust="tukey")

    ### contrast    estimate    SE  df z.ratio p.value
    ###      pMRS - dMRS    -4.81 1.029 Inf  -4.672  <.0001
    ###      pMRS - fMRS    -3.75 0.931 Inf  -4.031  0.0002
    ###      dMRS - fMRS     1.06 0.584 Inf   1.808  0.1668
    ###
    ###     P value adjustment: tukey method for comparing a family
    ###      of 3 estimates

Comment: Thanks for the kind words. ... Yes, with an ordinal dependent variable with seven levels, ordinal regression is probably the best approach.  Using the mixed effects approach, with Patient as a random effect makes sense.  ...  I don't understand the last question: `Also are multiple comparisons possible btw the Score groups?`.  Does the *emmeans* output not address this question?
Comment: As a side note, the design the OP presents is an unreplicated complete block design.  In this example, Friedman's test with an appropriate post-hoc test works just as well as the ordinal regression approach.  I believe Friedman's test works for an ordinal dependent variable. ...  If the dependent variable were assumed to be interval in nature, rather than merely ordinal, other approaches  would be viable as well.
Comment: @XFrost , If I understand your question, I think you are switching from treating Value as an ordinal variable to a categorical variable.  You could do an analysis this way as well.  But I think a plot like what you presented in your original question, or using bar plots or plots commonly used for Likert-type items might tell the story.  (See next comment for examples).  If you want to look at if people changed from one category of response to another, you might use something like McNemar's test between two or multiple response categories.
Comment: Bar plot of ordinal responses example: [rcompanion.org/handbook/images/image052.png](https://rcompanion.org/handbook/images/image052.png).  I don't know if this plot has a specific name, but it is commonly used for Likert-type items: [reganmian.net/blog/images/2013-10-02-likert-graphs-in-r-embedding-metadata-for-easier-plotting-whole-04.png](http://reganmian.net/blog/images/2013-10-02-likert-graphs-in-r-embedding-metadata-for-easier-plotting-whole-04.png).
Comment: @ SalMagniafico -thank you so much for your comments and assistance, the use of the ordinal and emmeans package as you showed above was incredibly helpful. I also greatly appreciated your excellent website. I know that this is certainly an R heavy question, but I also would appreciate any guidance on the appropriate statistical analysis of this question as indicated in the question title, I.e., should analysis of this ordinal data across 3 timepoints be done with an ordinal regression as weve done here or with some other method? Also are multiple comparisons possible btw the Score groups?
Comment: The question  `Also are multiple comparisons possible btw the Score groups?` was meaning to ask if post hoc comparisons were possible/appropriate in this type of analysis, such that the significant differences indicated using the `emmeans` function were due to changes in different Scores across time points, i.e. that the Score of 0 in "pMRS" was significantly different from a Score of 0 in "dMRS, while a score of 1 in "pMRS" may not have significantly changed from a score of 1 in "dMRS".
Answer: So Ive continued to look at this further based on @FrankHarrell and @COOLSerdash's comments above.
I set the data analysis up attempting to use a Cumulative Link Mixed Model approach to analyze.
The Code below in R is what Ive got so far using data set above:
mrsstat <-tibble(
  Patient = c(1:21),
  pMRS = c(0, 0,    0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  2,  0),
  dMRS = c(4, 2,    2,  4,  3,  6,  4,  1,  5,  0,  3,  0,  6,  1,  5,  3,  3,  1,  3,  4,  3),
  fMRS = c(1, 2,    2,  3,  2,  6,  3,  1,  2,  0,  3,  0,  6,  1,  5,  2,  0,  1,  3,  4,  0))

mrsstat<- mrsstat %>%
  pivot_longer(cols = c("pMRS", "dMRS", "fMRS"), names_to = "timepoint") %>%
  mutate(timepoint = factor(timepoint,
                            levels= c("pMRS",
                                      "dMRS",
                                      "fMRS")),
         value=  factor(value, levels = c("0", "1","2","3","4","5","6")),
         Patient= factor(Patient, levels = c(1:21)))

mrs_numeric <- mrsstat %>%
  mutate(value= as.integer(value))

Summarize(value ~ Patient,
          data= mrs_numeric, digits=3)

Sum= Summarize(value ~ Patient + timepoint,
          data= mrs_numeric, digits=3)

model <- clmm(value~timepoint + (1|Patient), data = mrsstat)
summary(model)

which yields:
Cumulative Link Mixed Model fitted with the Laplace approximation

formula: value ~ timepoint + (1 | Patient)
data:    mrsstat

 link  threshold nobs logLik AIC    niter     max.grad cond.H
 logit flexible  63   -91.13 200.27 476(1772) 5.03e-06 1.9e+02

Random effects:
 Groups  Name        Variance Std.Dev.
 Patient (Intercept) 2.374    1.541
Number of groups:  Patient 21

Coefficients:
              Estimate Std. Error z value Pr(>|z|)
timepointdMRS    4.809      1.029   4.672 2.98e-06 ***
timepointfMRS    3.753      0.931   4.031 5.56e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Threshold coefficients:
    Estimate Std. Error z value
0|1   1.8433     0.7538   2.445
1|2   3.1043     0.8823   3.519
2|3   4.1262     0.9839   4.194
3|4   5.5329     1.1465   4.826
4|5   6.6601     1.2936   5.149
5|6   7.4873     1.4107   5.307

If I change the reference (first timepoint) to be "fMRS" instead of "pMRS", then the same approach gives the following:
Cumulative Link Mixed Model fitted with the Laplace approximation

formula: value ~ timepoint + (1 | Patient)
data:    mrsstat

 link  threshold nobs logLik AIC    niter     max.grad cond.H
 logit flexible  63   -91.13 200.27 448(1671) 5.04e-06 4.9e+01

Random effects:
 Groups  Name        Variance Std.Dev.
 Patient (Intercept) 2.374    1.541
Number of groups:  Patient 21

Coefficients:
              Estimate Std. Error z value Pr(>|z|)
timepointdMRS   1.0564     0.5842   1.808   0.0706 .
timepointpMRS  -3.7528     0.9310  -4.031 5.56e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Threshold coefficients:
    Estimate Std. Error z value
0|1  -1.9095     0.6643  -2.874
1|2  -0.6485     0.5744  -1.129
2|3   0.3734     0.5692   0.656
3|4   1.7801     0.6638   2.682
4|5   2.9073     0.7934   3.664
5|6   3.7345     0.9149   4.082

which from what I can surmise indicates that "pMRS" is significantly different than both "dMRS" (p<2.98e-06) and "fMRS" (5.56e-05), while "dMRS" and "fMRS" are not significantly different (p= 0.0706).
Still unclear on if multiple comparisons are possible between the timepoints for each score, or if this approach appropriately addresses the question (namely, that the summary is comparing the timepoints to single reference without possibly comparing all group?)
Comment: When you are posting code examples, please include some indication of the packages that need to be loaded.  As far as I can tell, this code uses the following packages:   *tibble*, *dplyr*, *tidyr*, *ordinal*, *FSA*.


move array objects into arrays

Question: I have an array of objects that look similar to this,
 [{
        name : Client 1,
        total: 900,
        value: 12000
    }, {
        name : Client 2,
        total: 10,
        value: 800
    }, {
        name : Client 3,
        total: 5,
        value : 0
}]

What I am wanting is to get 3 arrays from this, an array of name,
[Client 1, Client 2, Client 3]
and array of totals,
[900, 10, 5]
and an array of values,
[12000, 800, 0]
I thought I would be able to something like map or similar but I am very confused about how to use it. Can anyone help me out?
Answer: Use Array.prototype.map function

var arr = [{ name: "Client 1", total: 900, value: 12000 }, { name: "Client 2", total: 10, value: 800 }, { name: "Client 3", total: 5, value: 0 }];

var totals = arr.map(e => e.total);
var names = arr.map(e => e.name);
var values = arr.map(e => e.value);

document.write("
" + totals + "
");
document.write("
" + names + "
");
document.write("
" + values + "
");

Note from @Andy

This is ES6 so you might need a transpiler if your browsers don't support it yet.
Comment: @MatíasFidemraizer, its a short writing for prototype, read here `Array.prototype.map`
Comment: @isvforall Yeah, this is better!
Comment: Why `Array#map` and not `Array.prototype.map`?
Comment: I mean, why that `#` notation?
Comment: OP, note this is ES6 so you might need a transpiler if your browsers don't support it yet.
Comment: @isvforall orly ( o v o )? :D Yes, I know it. BTW it's not a JS notation. I find more useful to say `Array.prototype.map` because further readers can copy-paste it and look for docs like MDN easily than Array#map.
Answer: If you're fine with an object holding each of the arrays, the following Array.prototype.reduce will work:
var a = [{
        name : "Client 1",
        total: 900,
        value: 12000
    }, {
        name : "Client 2",
        total: 10,
        value: 800
    }, {
        name : "Client 3",
        total: 5,
        value : 0
}];

var res = a.reduce(function(a,b){
    return {
    name: a.name.concat(b.name),
    total: a.total.concat(b.total),
    value: a.value.concat(b.value)
  }
},{
    name: [],
    total:[],
    value:[]
})

console.log(res) // Object {name: Array[3], total: Array[3], value: Array[3]}

Comment: For me, this is the best answer ;P Reduce is the answer to produce different results from an array...
Answer: You can use an object with the wanted keys as arrays.

var data = [{ name: 'Client 1', total: 900, value: 12000 }, { name: 'Client 2', total: 10, value: 800 }, { name: 'Client 3', total: 5, value: 0 }],
    result = function (array) {
        var r = {};
        array.forEach(function (a) {
            Object.keys(a).forEach(function (k) {
                r[k] = r[k] || [];
                r[k].push(a[k]);
            });
        });
        return r;
    }(data);

document.write('
name: ' + JSON.stringify(result.name, 0, 4) + '
');
document.write('
total: ' + JSON.stringify(result.total, 0, 4) + '
');
document.write('
value: ' + JSON.stringify(result.value, 0, 4) + '
');
document.write('
the object: ' + JSON.stringify(result, 0, 4) + '
');
Answer: if i uderstood you right you need to create 3 arrays from 1? You can do somethink like this:
var names=[];
var totals=[];
var values=[];

for(var i=0; i<objectArray.length; i++){
  names.push(objectArray[i].name);
  totals.push(objectArray[i].total);
  values.push(objectArray[i].value);
}

move array objects into arrays


Remainder when $26^{3008} + 3008^{26}$ is divided by $4$

Question: I want to find the  Remainder when $26^{3008} + 3008^{26}$ is divided by $4$.
What should I do?
Even though I've included the tag modular arithmetic I've very limited knowledge about it.
How should I approach this problem?
Comment: An even number, raised to a power $> 1$, is it divisible by $4$?
Comment: @DanielFischer lol how could I not realize that ,  Thank you !
Answer: Hint:
$3008$ is divisible by $4$
$26^2$ is divisible by $4$
Comment: @Sreenidhi You can use the divisibility test for 4 which states if last two digits of a number are divisible by 4 then the number is divisible by 4 .In this case the last two digits are 08 which is clearly divisible by 4.
Comment: 3008 is divisible by 4. I am not sure about it.
Comment: $3008=4*752$ hence $3008$ is divisible by $4$.
Answer: 26 = 2 mod 4
26^2 = 0 mod 4
(26^2)^1504 = 0^1504 mod 4
26^3008 = 0 mod 4 ..................1
3008 = 0 mod 4.
therefore 3008^26 = 0^26 mod 4 ........2
adding 1 and 2
26^3008 + 3008^26 = 0 mod 4
Therefore remainder is 0.
Answer: Both 26 and 3008 contain factors of 2, so if they are raised to any power they will be divisible by 4. Thus, the remainder is 0.


O ViewData["ErrorMessage"] não aparece na view

Question: Olá, eu sou novo na linguagem c# e gostaria de saber o porque o meu ViewData["ErrorMessage"] não aparece na minha view.
Controller:
ViewData["ErrorMessage"] = "O e-mail digitado já se encontra registrado em nossa base de dados.";
return RedirectToAction("Index","Home");

View:
 <form asp-controller="Account" asp-action="Visitante" method="post" class="form-horizontal" role="form">
            @if (ViewData["ErrorMessage"] != null)
            {
                @ViewData["ErrorMessage"];

            }

                    <input asp-for="Nome" class="form-control" placeholder="Nome" />

                    <input asp-for="Sobrenome" class="form-control" placeholder="Sobrenome" />

                    <input asp-for="Email" class="form-control" placeholder="E-Mail" />

                    <input type="submit" class="btn btn-default" style="width: 100%" value="Cadastre-se agora!" data-toggle="tooltip" data-placement="bottom" data-original-title="Cadastre-se" />

        </form>

Veja que na minha view eu faço um @if para verificar se o meu ViewData é nulo, se não for quero que exiba a mensagem, mais pelo que eu vejo o ViewData não contem a frase que eu designei no controller.
Obrigado.
Answer: Como você está utilizando o RedirectToAction o ViewData se perde, para isso você deve usar o TempData.
O TempData usa Session para gravar os dados, ele se perde apos a exibição.
O tempo de vida do ViewData é apenas entre o envio através da Controller e a exibição na View.
Veja mais nesse artigo = http://eduardopires.net.br/2013/06/asp-net-mvc-viewdata-viewbag-tempdata/
Comment: Só complementando, tem esse link em português explicando as diferenças entre viewData, tempData :)) http://www.macoratti.net/15/06/mvc_conc1.htm
Comment: Valeu, muito bom o artigo, vou dar uma olhada


how to get tinymce value in javascript?+ Drupal7

Question: I am using drupal7 form
$form['subject'] = array('#type' => 'textfield',
        '#title' => t('Subject'),
        '#maxlength' => 200,
        '#size' => 100,
        '#required' => TRUE,
);

$form['body'] = array('#type' => 'textarea',
        '#title' => t('Body'),
        '#type' => 'text_format',
        '#base_type' => 'textarea',
        '#format' => 'full_html',
        '#required' => TRUE,

);

we used tinymce editor. Posting form with jquery like this
$.ajax({
            url: '/myevent/preview',
            data: $('#eventform').serialize(),
            type: 'POST',
            success: function(data){
                $('#eventdata').html(data);
            }
        });

At my local its working fine, but on server, I couldn't get value of body textarea.
Comment: "I couldn't get value of body textarea" - that's a bit broad statement. Your ajax request was not sent? Was sent, but without data needed? Was sent, but never reached the server? Was sent, but reached the server malformed? And so on... These things only you can test. And most of them is not Drupal-related anyway.
Answer: Try this I suppose this may help.

tinyMCE.triggerSave();
$('#textarea-selector-id).val();

i suppose that your text area would be inline:TRUE;
change the text area to a div this may work
or
var editor='textarea-selector-id';
var content =tinyMCE.activeEditor.getContent();
alert(content);

Comment: I am getting old content in post
Comment: I am  getting content - but its content which I first time added and in Post I get this content-
test email
Comment: Sorry for this am not clear with your comments but i suppose you are not getting the value  so better try this


Construir Densidade Acumulada Probabilidade usando R

Question: Tenho esse data frame de duas colunas (Y e X)
Com o pacote quantreg consigo estimar os quantis de Y dado x.
Feito isso não estou conseguindo construir a função de densidade ACUMULADA de Y condicional. Alguém poderia me ajudar?
Estimando os quantis:
library(quantreg)
taus=seq(0.1, 0.9, by = 0.01)
Quantis<-rq(data[,1] ~ data[,2],tau=taus,method="br")

Agora, como faço para gerar minha funcão densidade acumulada?
Segue o dataframe:
structure(list(Y = c(NA, -1.793, -0.642, 1.189, -0.823, -1.715,
1.623, 0.964, 0.395, -3.736, -0.47, 2.366, 0.634, -0.701, -1.692,
0.155, 2.502, -2.292, 1.967, -2.326, -1.476, 1.464, 1.45, -0.797,
1.27, 2.515, -0.765, 0.261, 0.423, 1.698, -2.734, 0.743, -2.39,
0.365, 2.981, -1.185, -0.57, 2.638, -1.046, 1.931, 4.583, -1.276,
1.075, 2.893, -1.602, 1.801, 2.405, -5.236, 2.214, 1.295, 1.438,
-0.638, 0.716, 1.004, -1.328, -1.759, -1.315, 1.053, 1.958, -2.034,
2.936, -0.078, -0.676, -2.312, -0.404, -4.091, -2.456, 0.984,
-1.648, 0.517, 0.545, -3.406, -2.077, 4.263, -0.352, -1.107,
-2.478, -0.718, 2.622, 1.611, -4.913, -2.117, -1.34, -4.006,
-1.668, -1.934, 0.972, 3.572, -3.332, 1.094, -0.273, 1.078, -0.587,
-1.25, -4.231, -0.439, 1.776, -2.077, 1.892, -1.069, 4.682, 1.665,
1.793, -2.133, 1.651, -0.065, 2.277, 0.792, -3.469, 1.48, 0.958,
-4.68, -2.909, 1.169, -0.941, -1.863, 1.814, -2.082, -3.087,
0.505, -0.013, -0.12, -0.082, -1.944, 1.094, -1.418, -1.273,
0.741, -1.001, -1.945, 1.026, 3.24, 0.131, -0.061, 0.086, 0.35,
0.22, -0.704, 0.466, 8.255, 2.302, 9.819, 5.162, 6.51, -0.275,
1.141, -0.56, -3.324, -8.456, -2.105, -0.666, 1.707, 1.886, -3.018,
0.441, 1.612, 0.774, 5.122, 0.362, -0.903, 5.21, -2.927, -4.572,
1.882, -2.5, -1.449, 2.627, -0.532, -2.279, -1.534, 1.459, -3.975,
1.328, 2.491, -2.221, 0.811, 4.423, -3.55, 2.592, 1.196, -1.529,
-1.222, -0.019, -1.62, 5.356, -1.885, 0.105, -1.366, -1.652,
0.233, 0.523, -1.416, 2.495, 4.35, -0.033, -2.468, 2.623, -0.039,
0.043, -2.015, -4.58, 0.793, -1.938, -1.105, 0.776, -1.953, 0.521,
-1.276, 0.666, -1.919, 1.268, 1.646, 2.413, 1.323, 2.135, 0.435,
3.747, -2.855, 4.021, -3.459, 0.705, -3.018, 0.779, 1.452, 1.523,
-1.938, 2.564, 2.108, 3.832, 1.77, -3.087, -1.902, 0.644, 8.507
), X = c(0.056, 0.053, 0.033, 0.053, 0.062, 0.09, 0.11, 0.124,
0.129, 0.129, 0.133, 0.155, 0.143, 0.155, 0.166, 0.151, 0.144,
0.168, 0.171, 0.162, 0.168, 0.169, 0.117, 0.105, 0.075, 0.057,
0.031, 0.038, 0.034, -0.016, -0.001, -0.031, -0.001, -0.004,
-0.056, -0.016, 0.007, 0.015, -0.016, -0.016, -0.053, -0.059,
-0.054, -0.048, -0.051, -0.052, -0.072, -0.063, 0.02, 0.034,
0.043, 0.084, 0.092, 0.111, 0.131, 0.102, 0.167, 0.162, 0.167,
0.187, 0.165, 0.179, 0.177, 0.192, 0.191, 0.183, 0.179, 0.176,
0.19, 0.188, 0.215, 0.221, 0.203, 0.2, 0.191, 0.188, 0.19, 0.228,
0.195, 0.204, 0.221, 0.218, 0.224, 0.233, 0.23, 0.258, 0.268,
0.291, 0.275, 0.27, 0.276, 0.276, 0.248, 0.228, 0.223, 0.218,
0.169, 0.188, 0.159, 0.156, 0.15, 0.117, 0.088, 0.068, 0.057,
0.035, 0.021, 0.014, -0.005, -0.014, -0.029, -0.043, -0.046,
-0.068, -0.073, -0.042, -0.04, -0.027, -0.018, -0.021, 0.002,
0.002, 0.006, 0.015, 0.022, 0.039, 0.044, 0.055, 0.064, 0.096,
0.093, 0.089, 0.173, 0.203, 0.216, 0.208, 0.225, 0.245, 0.23,
0.218, -0.267, 0.193, -0.013, 0.087, 0.04, 0.012, -0.008, 0.004,
0.01, 0.002, 0.008, 0.006, 0.013, 0.018, 0.019, 0.018, 0.021,
0.024, 0.017, 0.015, -0.005, 0.002, 0.014, 0.021, 0.022, 0.022,
0.02, 0.025, 0.021, 0.027, 0.034, 0.041, 0.04, 0.038, 0.033,
0.034, 0.031, 0.029, 0.029, 0.029, 0.022, 0.021, 0.019, 0.021,
0.016, 0.007, 0.002, 0.011, 0.01, 0.01, 0.003, 0.009, 0.015,
0.018, 0.017, 0.021, 0.021, 0.021, 0.022, 0.023, 0.025, 0.022,
0.022, 0.019, 0.02, 0.023, 0.022, 0.024, 0.022, 0.025, 0.025,
0.022, 0.027, 0.024, 0.016, 0.024, 0.018, 0.024, 0.021, 0.021,
0.021, 0.021, 0.022, 0.016, 0.015, 0.017, -0.017, -0.009, -0.003,
-0.012, -0.009, -0.008, -0.024, -0.023)), .Names = c("Y", "X"
), row.names = c(NA, -234L), class = "data.frame")

Answer: A função de distribuição acumulada, no seu caso, é uma função de x. Portanto, não existe só uma função de densidade acumulada e sim, uma para cada possível x.
Com o código a seguir você pode visualizar algumas distribuições acumuladas, para alguns svalores de x. Esse problema logo fica complicado, uma vez que geralmente você está ajustando a regressão quantílica para mais de uma variável, diferente do seu exemplo.
library(tidyverse)
df <- data.frame(X = c(0, 0.3))
bind_cols(
  df,
  predict(Quantis, df) %>% as.data.frame()
) %>%
  gather(quantil, valor, starts_with("tau")) %>%
  mutate(quantil = parse_number(quantil)) %>%
  ggplot(aes(x = valor, y = quantil, colour = as.factor(X))) +
  geom_line() +
  labs(y = "F(y)", x = "y", colour = "X")

Essas são as funções de sobrevivência estimadas pelo seu modelo de regressão quantílica. A regressão quantílica não assume nenhuma distribuição da variável resposta, por isso não existe uma fórmula fechada, para a distribuição acumulada. Você poderia assumir uma distribuição para Y e estimar um modelo paramétrico.
Por exemplo:
Ajuste uma regressão linear normal para `Y` dado X:

> reg <- lm(Y ~ X, data = dados)
> summary(reg)

Call:
lm(formula = Y ~ X, data = dados)

Residuals:
    Min      1Q  Median      3Q     Max
-8.6213 -1.7343  0.0677  1.4585  9.9230

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept)   0.1800     0.2017   0.892    0.373
X            -1.4715     1.7462  -0.843    0.400

Residual standard error: 2.461 on 231 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.003065,  Adjusted R-squared:  -0.001251
F-statistic: 0.7102 on 1 and 231 DF,  p-value: 0.4003

> sigma(reg)
[1] 2.461144

Agora a função de distribuição acumulada é dada por:

fonte: Wikipedia
A função de densidade acumulada no seu exemplo seria dada pela fórmula acima, substituindo u por 0.1800 - 1.4715*x e sigma por 2.461144.
As estimativas da função de distribuição acumulada usando esse modelo ficariam:
mu <- function(x){
  0.1800 - 1.4715*x
}
bind_rows(
  data.frame(
    X = 0,
    quantil = seq(0,1,by = 0.01),
    valor = qnorm(seq(0,1,by = 0.01), mean = mu(0), sd = sigma(reg))
    ),
  data.frame(
    X = 0.3,
    quantil = seq(0,1,by = 0.01),
    valor = qnorm(seq(0,1,by = 0.01), mean = mu(0.3), sd = sigma(reg))
  )
) %>%
  ggplot(aes(x = valor, y = quantil, colour = as.factor(X))) +
  geom_line() +
  labs(y = "F(y)", x = "y", colour = "X")

A função qnorm do R é exatamente a função de distribuição acumulada da Normal.
Comment: Sim, você está certo! O problema é que o modelo de regressão quantílica não faz nenhuma suposição com relação a isso. Como essa curva verde é a estimada para o valor 0.3 que é o máximo valor de `x` ela tende a ter mais variabilidade e fica com essa forma.
Comment: @DiogoBastos adicionei um exemplo de uma abordagem paramétrica para estimar a distribuição acumulada.
Comment: O bacana da da regressão quantilica é estimar os quantis. Quando tenho mqo assumo que o beta "serve" para todos os quantis, o que não é veradeiro. Além disso, a regressão me oferece assimetria. Dependendo da variável dependente isso pode ser muito bom. Ainda to tentqando entender regressão quantilica.
Comment: @DiogoBastos Isso com certeza é uma vantagem, faz todo sentido usá-la! Só que como ela não faz suposição para a distribuição, ela pode levar a alguns contra-sensos. Particularmente, eu não vejo nenhum problema nesses contra-sensos, mas as vezes é chato de explicar.
Comment: Entendi, obrigado @DanielFalbel ! . O fato da função acumulada, "acumular" probabilidades implica que essas quebras "para baixo"sejam um problema, pois implicam em redução da probabilidade, o que seria um contra senso. Certo? A vermelha é livre disso mas a azul não. Estou certo?


Windows Server 2012r2 virtualized domain controller

Question: My work environment contain a single forest with two domains DomainA and DomainB.
DomainA contain the following:
DC01 holds all FSMO roles for the domain and forest, Global catalog and is forest root
DC02 is Global catalog
DomainB
DC03 is hosting FSMO roles for the domain
DC04 is global catalog
All above domain controllers are virtualized and all running on w2k12r2 on two hyper-v nodes as follows:
HV01 Hosts:
DC01
DC03
HV02 Hosts:
DC02
DC04
I have the following backup plans running as follows:

HV01 and HV02 will be backed up on weekly basis the backup will be running on the hyper-V hosts
All domain controllers will be backed up on daily basis the backup will be ran on the domain controller itself

My question is how I should restore those backups for forest recovery on domain recovery?
When I try to restore them using full system recovery the domain controllers will stop replicating?
Any help or idea ?
Shad
Comment: Are you restoring the Hyper-V backup or the domain controller system state backup?
Comment: Hyper-V backup  please ?
Comment: Are you backing up your individual virtual machines like this?  http://blogs.msdn.com/b/virtual_pc_guy/archive/2013/02/18/windows-backup-and-hyper-v-in-server-2012.aspx
Comment: that's exactly what I'm doing , but using command line not GUI I think both are the same
at the end I will be havening the entire hyper-v and all its VM's
Comment: Are you restoring the individual virtual machines, or the host?
Comment: I would like to test both scenarios :
individual VMs and the entire Hyper-V host I case of hardware failure ?
Answer: Makle backup/restore from Hyper-V and do not bother about anything special - Hyper-V takes care of versioning and replication in this case. New functionality in 2012 R2 ;)
Comment: Many thanks for your Quick replay:
how about the restoration ?
I have tried the hyper V backup again it didn't work so well ?
any idea ?
Comment: Yeah. "It did not work so well" means what? Hyper-V level restore works like a charm here.... that said, I use DPM for backing up the complete infrastructure.


Solution verification: Finding orbit and stabelizer of group $G=\mathbb R_{>0}$ action on $X=\mathbb R$

Question: Find orbits and stabelizer of group $G=\mathbb R_{>0}$ action on $X=\mathbb R$ denoted by $g(x)=g\cdot x$.
So this was a quiz question, and I wanna see if my solution was correct.
$orb_G(x)=\{g\in G: gx\}\subseteq X$
So since field is closed under multiplication, for every $g \in G$ we will get that $gx \in X$, so that means $orb_G(x)=\mathbb R_{>0}$
Stabelizer is defined as all $g \in G: gx=x$, and in that case $g=1$.
So there's only one orbit with stabilizer = 1.
I'm not confident with these subjects, so I'm not sure I solved it correctly.
Thank you in advance for any input you can share.
Comment: And what is $orb_G(0)$?
Answer: Instead of working it out, let me give you some smaller questions to try to answer.  Consider the two elements $1$ and $-1$ in $X = \mathbb{R}$.  Is there a $g \in \mathbb{R}_{> 0}$ such that $-1 = g 1$?  What does that tell you about the orbits?
Once you understand that, picture the real line.  Think about what happens to an element of $\mathbb{R}$ when it is multiplied by an element of $\mathbb{R}_{> 0}$.  A single orbit is obtained by starting with one element $x \in \mathbb{R}$ and then considering all possible elements of the form $g x$ for $g \in \mathbb{R}_{> 0}$.  If you take $x = 1$, what is its orbit?  What if you take $x = -1$?  Are there any other orbits left?
(These questions will help you understand orbits.  After you understand orbits, you'll be better equipped to handle stabilizers.)


Reference request on centralizer of symmetric group

Question: I am trying to understand eq. 2.4 of the paper:
https://arxiv.org/pdf/hep-th/9608096.pdf . The statement is:
The centralizer subgroup of a permutation g in this conjugacy class takes the form
$C_g = S_{N_1} × (S_{N_2} \rtimes Z_2^{N_2}
) × . . . (S_{N_s} \rtimes Z_s^{N_s}
).$
(the conjugacy class is expressed as $[g]=(1)^{N_1}(2)^{N_2}....(s)^{N_s}.$)
I am looking for a proof of the formula. Also, intuitively how wreath product enters to the formula isn't clear to me.
Comment: Welcome to MSE. Please read this text about [how to ask a good question](https://math.meta.stackexchange.com/questions/9959/how-to-ask-a-good-question).
Answer: The basic idea of the proof is this. Set $\Omega = \{1,2,\ldots,n\}$.

You can write $\Omega$ as a disjoint union $\Omega = \Omega_1 \cup \Omega_2 \cup \cdots$, where $g \Omega_i = \Omega_i$ and $g$ acts on $\Omega_i$ as a product of $N_i$ cycles of length $i$.
If $S \subseteq \Omega$ is $g$-invariant and $z \in C_g$, then $zS$ is also $g$-invariant. Conclude that $z\Omega_i \subseteq \Omega_i$ for all $z \in C_g$ and $i$.
So $C_g = C_{Sym(\Omega_1)}(g_1) \times C_{Sym(\Omega_2)}(g_2) \times \cdots$ where $g_i$ is the image of $g$ in $Sym(\Omega_i)$.
What you still have to show that for $g_i \in Sym(\Omega_i)$ a product of $N_i$ cycles of length $i$, the centralizer is $S_{N_i} \wr \mathbb{Z}/i\mathbb{Z} = S_{N_i} \ltimes (\mathbb{Z}/i\mathbb{Z})^{N_i}$. I will leave the details to you, but here $(\mathbb{Z}/i\mathbb{Z})^{N_i}$ is the product of the cyclic subgroups generated by the disjoint cycles of $g$, and $S_{N_i}$ acts by permuting the cycles.
Comment: Thank you for your answer. I don't have the intuition why we need to introduce wreath product here. Are you aware of any reference where I can find some worked out examples?


Strange error when using Rails with Passenger

Question: I get the following Passenger error:
undefined method `post_reset' for Gem:Module

Someone knows what this could mean? Thanks!
Answer: I've got the very same error after performing a gem pristine --all to get rid of the annoying deprecation messages introduced with the latest rubygems update.
After that my mod_passenger.so got deleted resulting in this (misleading) error message. Try restarting Apache, it won't be possible if you are having the same problem.
The solution was to once again execute passenger-install-apache2-module. After that I could restart Apache and the error was gone.
Answer: i tried it myself and ended up with downgrading rubygems to 1.7.2, works again!


How to choose what tables to skip for drush sql-sync @dev @staging?

Question: Following my previous question
How to set Drush sql-sync not to clone users between @dev and @staging?
I have manually preselected over 80 tables that should not be automatically synced (content, roles and permissions, users, temporary, cache). I am not fully satisfied with this solution. Why? Because my filter decisions is based on experience, intuition and guess when I would like to use the best practice method.
How to properly choose what tables to skip for drush sql-sync @dev @tst and drush sql-sync @production @staging?
My setup:
git.drupal.org ==> local drupal git repository ==>  @dev -> @tst -> @staging -> @production (configuration, static content, roles and permissions)
@staging <- @production (content, production scenarios to be tested)

The Definitive Guide to Drupal 7 by Benjamin Melançon and others says:

Here is the list of tables that appears in example.drushrc.php:
$options['structure-tables'] = array(  'common' => array('cache',
  'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions',
  'watchdog'),
);

You may need to add some more tables to this list. A good place to
  start would be to consider the list of tables that contain cache in
  their name via drush sql-query 'show tables;' | grep cache
Remove from this list tables such as imagecache_action and so on, and
  add the remainder to your structure tables list.
After you do an sql-sync with skipped tables, you will need to clear
  the cache on the target site to make sure that things work right.

What are the other tables to consider? Why?
Comment: There is a patch (work in progress) called "Better handling of structure-tables and skip-tables options (including cache_* support!)" http://drupal.org/node/698264 would help a lot especially with cache_* and field_* tables to limit changes in drush data distribution filters.
Answer: Drush sql-sync does not support shared databases that use prefixes.  You might have some luck if you wrote a wrapper script that used drush sqlq 'show tables;' to get a list of available tables, filter them manually by prefix, and then pass them back to sql-sync via the --tables-list option.
Answer: In Drupal 7 these tables you should consider:
'cache', 'cache_field', 'cache_form', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'

In Drupal 8, these:
'cache', 'cache_bootstrap', 'cache_config', 'cache_container', 'cache_data', 'cache_default', 'cache_discovery', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'search_index', 'sessions', 'watchdog'

This doesn't include specific tables which are related to Migrate module or any other custom tables which may store some temporary data.
Example drush command to dump and skip these tables (create just a structure without data):
drush sql-dump --structure-tables-list=cache,cache_filter,cache_menu,cache_page,history,sessions,watchdog --result-file=dump.sql

Hint: Add --ordered-dump for nicer human output, but a bit slower on import.
Normally adding structure-table option should be enough for local operations ($options['structure-tables']), but for sql-sync, I think this should be added for specific alias in command-specific section, e.g.
$aliases['foo'] = array(
  // These options will only be set if the alias is used with the specified command.
  'command-specific' => array(
    'sql-sync' => array(
      'structure-tables-key' => 'common',
      'skip-tables-key' => 'common',
      'structure-tables' => array(
        // You can add more tables which contain data to be ignored by the database dump
        'common' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'search_index', 'sessions', 'watchdog'),
      ),
      'skip-tables' => array(
        'common' => array('field_deleted_revision_63'),
      ),
    ),
    'sql-dump' => array(
      'ordered-dump' => TRUE,
      'structure-tables-key' => 'common',
      'skip-tables-key' => 'common',
    ),
  ), // end: command-specific
  // Applied only if the alias is used as the source.
  'source-command-specific' => array(
  ),
  // Applied only if the alias is used as the target.
  'target-command-specific' => array(
  ),
);


Show that $\lambda \cdot z=z+\lambda$ gives an action of $\mathbb{Z}+\tau \mathbb{Z}$ on $\mathbb{C}$

Question:
Let $\tau=x+i y \in \mathbb{C}, x, y>0$. Show that $\lambda \cdot z=z+\lambda$ gives an action of $\mathbb{Z}+\tau \mathbb{Z}$ on $\mathbb{C}$. What does the decomposition into subclasses look like?

My thought's so far (Edit):
To demonstrate that the operation $\lambda \cdot z=z+\lambda$ defines an action of the group $\mathbb{Z}+$ $\tau \mathbb{Z}$ on $\mathbb{C}$, we need to verify the properties of a group action:

Well-defined operation: Showing that $ \left(\lambda_{1}+\lambda_{2}\right) \cdot z=\lambda_{1} \cdot\left(\lambda_{2} \cdot z\right)$ for all $\lambda_{1}, \lambda_{2} \in$ $\mathbb{Z}+\tau \mathbb{Z}$ and $z \in \mathbb{C} $.

Respects group structure: Demonstrating that $\lambda \cdot(\mu \cdot z)=(\lambda \cdot \mu) \cdot z$ for all $\lambda, \mu \in \mathbb{Z}+\tau \mathbb{Z}$ and $z \in \mathbb{C}$.

Trivial action of the neutral element: Showing that $0 \cdot z=z $ for all $z \in \mathbb{C}$.

Each coset represents an equivalence class of numbers in the complex plane generated by translations by elements of $\mathbb{Z}+\tau \mathbb{Z}$.
For $\lambda=0$, the coset $0+(\mathbb{Z}+\tau \mathbb{Z})$ is equivalent to the set $\mathbb{Z}+\tau \mathbb{Z}$ itself.
For $\lambda=1$, the coset $1+(\mathbb{Z}+\tau \mathbb{Z})=1+\mathbb{Z}+\tau \mathbb{Z}$.
For $\lambda=\tau$, the $\operatorname{coset} \tau+(\mathbb{Z}+\tau \mathbb{Z})=\tau+\mathbb{Z}+\tau \mathbb{Z}$.
This pattern continues, with each coset representing a translation of the lattice $\mathbb{Z}+$ $\tau \mathbb{Z}$, where $\tau$ determines the direction and $\mathbb{Z}$ determines the spacing in the respective directions.
Are my thought's now right so far?
Comment: What do you mean by your third point, associativity? It is verbatim the same requirement as "identity". Also, your characterisation of cosets is false. For example, $1+\Bbb{Z}+\tau\Bbb{Z} = 0 + \Bbb{Z}+\tau\Bbb{Z}$. Play around with this a bit more, and try to consider it geometrically. What does $\Bbb{Z}+\tau\Bbb{Z}$ look like inside $\Bbb{C}$?
Comment: $\mathbb{Z}+\mathbb{Z}\tau\simeq\mathbb{Z}^2$ is a subgroup of $\mathbb{C}=\mathbb{R}+\mathbb{R}\tau\simeq\mathbb{R}^2$. Every time you have a group $G$ and a subgroup $H$, $H$ acts on $G$ operating on the right.
Comment: @SomeCallMeTim: Ok - is this right?:
$\mathbb{Z}+\tau \mathbb{Z}$ forms a lattice in the complex plane, which is generated by the integer linear combinations of 1 and $\tau$. The equivalence $1+$ $ \mathbb{Z}+\tau \mathbb{Z}=0+\mathbb{Z}+\tau \mathbb{Z}$ shows that translations within this lattice lead to equivalent point sets.
Comment: Is this AI generated? Why are you being so formal about something that carries almost no information?
It is true that it forms a lattice. Now draw it. Pick up a few examples, try to figure out where the other points of its equivalence class lie (note: the lattice helps). To really appreciate the question, try to find a *fundamental domain*: I.e. a subset of $\Bbb{C}$ such that no two points in the set are equivalent, but every point of $\Bbb{C}$ is equivalent to some point in the set. Hint: you can see it from your drawing of the lattice.
Comment: @SomeCallMeTim I'm so formal because that's how it's usually specified ( by us at least) - every step has to be described exactly. But now I still don't understand what the illustration by the drawing brings me - I still have to give a formal proof?
Comment: @Euler007 That's okay. The problem is that your characterization is far from complete. You have not described the subclasses at all. Therefore, I hope a drawing would give you inspiration and insight into the problem.
Comment: @SomeCallMeTim: I've edited my new thoughts above - I'm on the right track now?
Answer: I will give you a full answer since it seems you have spent some time thinking about it.
Again, you have correctly shown it is an action. The second part, "...decomposition into subclasses..." is a little vague, but I interpret it as, "what does $\Bbb{C}$ quotiented by the action look like"? This question makes sense, as a group action $G\to \text{Aut}(S)$ induces an equivalence relation on the set $S$ given by $s_1\sim s_2$ if $\exists g\in G$ s.t. $g.z_1=z_2$.
Considering you action, $\phi:\Bbb{Z}+\tau\Bbb{Z}\to \text{Aut}(\Bbb{C})$, I see two ways of answering this, either by describing how $\Bbb{C}/\phi$ looks like geometrically or comparing it to another well known object, or describe how elements of this quotient looks like.
The latter is not too enlightening, an element $\alpha\in \Bbb{C}/\phi$ is literally $a+\Bbb{Z}+\tau\Bbb{Z}$ for $a\in \Bbb{C}$, i.e. it is $a$ translated by any $\Bbb{Z}$-linear combination of $1$ and $\tau$. But geometrically, it is a nice picture.
Consider the parallellogram spanned by $1$ and $\tau$ as vectors in $\Bbb{C}$. See the image below for a visual. This will be a fundamental domain of the action, i.e. no two points in the parallellogram are equivalent, but every point in $\Bbb{C}$ is equivalent to some point therein. In fact, $\Bbb{C}$ is tiled by translations of this parallellogram (let's call it F), and the translations are exactly $\alpha+F$ for $\alpha\in \Bbb{Z}+\tau\Bbb{Z}$.
In the picture below, $v_1 = 1$ and $v_2=\tau$.

(picture blatantly stolen from the web, found it here: https://www.chegg.com/homework-help/questions-and-answers/615-let-l-lattice-let-f-fundamental-domain-l-exercise-sketches-proof-lim-bronl-vol-br-0-1--q46910782).
Now, there is an obvious bijection between $\Bbb{C}/\phi$ and $F$, and it turns out to be a group isomorphism as well, if you turn $F$ into a group with "pac-man addition", i.e. going up through the top of the parallellogram puts you back at the bottom of the parallellogram, and analogously with the sides (formally, you take the usual sum in $\Bbb{C}$ and then translate it by $\Bbb{Z}+\tau\Bbb{Z}$ to get an element in the parallellogram).
These two objects are thus one and the same. Also, having this geometric picture is more than just a neat fact. It is also useful in characterising your lattice, and gives you geometric properties of the quotient. As maybe the primary example, it is easy to convince yourself that this is a torus, i.e. a donut.


How do I test for node type to print a variable from template.php?

Question: In Drupal 7, you can use the following in template.php to test for the presence of a node type:
function MYTHEME_preprocess_node(&$variables) {
if ($variables['type'] == 'NODETYPE') {
***CUSTOM CODE****
}

In Drupal 7, you can use the following in template to create a variable which can be printed out in your page.tpl.php file:
function MYTHEME_preprocess_page(&$variables) {
      $variables['greeting'] = 'Custom Greeting';
}

But how do you combine the two, to create a variable inside of template.php (that can be printed in page.tpl.php) which changes according to the node type?
I would have thought the following would work:
    function MYTHEME_preprocess_page(&$variables) {
              if ($variables['type'] == 'NODETYPE') {
  $variables['greeting'] = 'Custom Greeting';
    }
    }

But it doesn't work. Why is this? (Using the same code on MYTHEME_preprocess_node also does not work).
Thanks for any help!
Answer: Each template has a different set of variables available. The variables available in a given theme is generally documented in the comment section at the top of the file. You can consult this documentation on http://api.drupal.org.
The node type is not directly available as a variable in the page.tpl.php. However, you have the $node object which has a type property:
function MYTHEME_preprocess_page(&$variables) {
  if (!empty($variables['node']) && $variables['node']->type == 'NODETYPE') {
    $variables['greeting'] = 'Custom Greeting';
  }
}