Methods to reject mail to unknown recipients in Google Apps

Question: In Google Apps administration, under e-mail settings (Service Settings > Email), I have the option to specify a catch-all address or to discard the e-mail.
But, I'm wondering how I would configure rejection of the e-mail (i.e. 550 error) instead of simply discarding it, because I want people who send to an incorrect address to know they have sent to a wrong address.
What are methods for accomplishing this?  Do I set a catch-all address and then monitor that mailbox with a Daemon that generates 550 rejection notices?  Do I do something crazy with my MX records?
Answer: Google Apps already sends a 550 error if you don't have a catch-all address set.
Here is the results of a message I just sent to a invalid account on a Google Apps domain (example.org) from my gmail account.  Names have been changed to protect the guilty.  The domain is set to 'discard'.
<code>Delivered-To: email@example.com
Received: by 10.216.45.139 with SMTP id p11cs30689web;
        Tue, 21 Sep 2010 12:05:45 -0700 (PDT)
Received: by 10.216.176.83 with SMTP id a61mr9625704wem.47.1285095944841;
        Tue, 21 Sep 2010 12:05:44 -0700 (PDT)
MIME-Version: 1.0
Return-Path: <>
Received: by 10.216.176.83 with SMTP id a61mr12854859wem.47; Tue, 21 Sep 2010
 12:05:44 -0700 (PDT)
From: Mail Delivery Subsystem <firstname.lastname@example.com>
To: firstname.lastname@example.com
X-Failed-Recipients: email@example.com
Subject: Delivery Status Notification (Failure)
Message-ID: <email@example.com>
Date: Tue, 21 Sep 2010 19:05:44 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Delivery to the following recipient failed permanently:

     email@example.com

Technical details of permanent failure:=20
Google tried to deliver your message, but it was rejected by the recipient
domain. We recommend contacting the other email provider for further inform
ation about the cause of this error. The error that the other server return
ed was: 550 550-5.1.1 The email account that you tried to reach does not ex
ist. Please try
550-5.1.1 double-checking the recipient's email address for typos or
550-5.1.1 unnecessary spaces. Learn more at
550 5.1.1 http://mail.google.com/support/bin/answer.py?answer=3D6596 p70si1
2864980weq.200 (state 14).

----- Original message -----

MIME-Version: 1.0
Received: by 10.216.176.83 with SMTP id a61mr9625683wem.47.1285095944055; T
ue,
 21 Sep 2010 12:05:44 -0700 (PDT)
Received: by 10.216.45.139 with HTTP; Tue, 21 Sep 2010 12:05:44 -0700 (PDT)
Date: Tue, 21 Sep 2010 12:05:44 -0700
Message-ID: <email@example.com
>
Subject: invalid user test
From: Chris Francy <firstname.lastname@example.com>
To: firstname.lastname@example.com
Content-Type: text/plain; charset=3DISO-8859-1

invalid user test
</code>
Comment: I guess I had never tried because I feared dropping e-mail in the intermittent time.  Thanks!
Answer: I use a catch-all account that has a Vacation responder.
No backscatter is produced, because incoming spam is filtered by Google.  So the Vacation responder only replies to incorrectly addressed "real" messages.
The catch-all account also forwards a copy of all incoming mail to me, so I can monitor it.
Answer: The way Google Apps is configured is an increasingly common way of configuring mail. It is entirely possible for bad entities to perform what amounts to a directory attack by throwing commonly used usernames at a mail domain, and anything that doesn't produce a 550 error is considered to be a verified live address (we have a guy in the office who has "steve" as his account name. He gets more spam than you do). If you never return a 550, they can't know they found a bad one.
The utility of that is somewhat debatable in this era of IP-reputation based antispam systems, but it can matter to some.
Answer: Just create a catch-all address with an auto-responder.  You can use the auto-responder to let people know they've sent mail to a user that doesn't exist.
Comment: Please do not do this, the likely hood of you being a source of [backscatter](http://en.wikipedia.org/wiki/Backscatter_\(e-mail\)) is very high.


Rest Export View multilingual content taxonomy filter fails

Question: I am going to create a REST API using Drupal 8 Rest Export with Views.
It is working fine so far. I am showing some fields from content type article and added contextual filters for language and tags.
I get results like this
<code>[
   {
      "title": "Autem Camur Inhibeo Typicus",
      "field_tags": "restapi, test",
      "field_image": "http://localhost/drupal_8_api/sites/default/files/2016-12/gen5431.tmp.gif"
   }
]
</code>
I made every field of my article translatable except the tags (they should be the same in every language). This works fine, too, the correct translation is shown and the tags change for all translations if I change them in one translation (I have english and german right now)
My problem:
When I filter by language it works fine and I get only german/english nodes. But if I filter for the tags and for german language I get no results. I could locate the problem a bit. If I set the tags-field to translateable, it works. So I think the problem might be that the german translation has no "own" tags and the filtering fails with this. The strange thing is that the JSON result is correct. (If I just filter for language I can see the correct tags in the german JSON)
Any help is appreciated (the tags should really not be translatable)
Answer: Pretty sure that's "just" yet another variant of the bug that this issue is trying to fix: Views should not condition joins on the langcode of fields that are not translatable


LAME on a Shared Hosting?

Question: Hi is it possible to install LAME on a shared hosting via FTP or browser install? I need to convert wav file to mp3 they're small 10-90kb 2-3 second clips. If there is another way without LAME I'd be interested in knowing how. I don't have shell access.
Answer: It is very possible in theory, but depends on your provider. They may or may not provide what you need to do this.
Note that in some parts of the world (for example, the United States), there may be patent issues involved with using an mp3 encoder.
Comment: Other issues might be that it takes up lots of CPU and the provider may not like this either.
Comment: the CPU usage shouldn't be noticeable converting a 10-90kb wav to mp3 shouldn't take more than 1-2sec if that. any tips on how to install it without shell?

LAME on a Shared Hosting?


Magento 1.5.1 crashing after running index category/product association?

Question: I have a magento install, 1.5.1 with eight different multi-stores enabled and about 1,000 products. When I run indexing for category/products association the admin hangs and does not respond for 20+ minutes. Occasionally the server crashes entirely.
The server should have sufficient resources to run this index. Any ideas what might be causing the problem?
Answer: Trying running the reindex from the ssh shell.  Change into your home directory where you magento files are and then into the /shell directory.  From there run:
php indexer.php --reindexall
And look for any errors that display.
Comment: Or to be exact php shell/indexer.php --reindex catalog_category_product
Comment: Check any server logs for the domain as well.  I would have a timeout on your webserver as well.  You don't want requests to hang like that for so long.  I usually recommend 3-5 minutes.


Real world applications of regressing complex numbers?

Question: I recently extended a linear regression software I developed to include complex variables.  It works very well but I am not familiar with how this can be used in the real world.  I scoured the web to find out but there are maybe only only two or three research papers that I am having a hard time understanding.
What are some practical applications of performing a linear regression of complex variables?
Answer: In radar signal processing, we use regression analysis, such as least-squares, mean-squared error, etc. on complex numbers. This is because the signal that is transmitted can be expressed as a complex exponential signal, and this signal is perturbed by noise that is distributed as either complex Gaussian or Laplacian.


Retrieve field value in a view twig

Question: I would retrieve the value of a field of the first row, like this:
<code>rows[0].field_name..
</code>
but the 'array is too large and kint breaks.
Answer: You can look up the structure of the view result in your question Get result view with formatter programmattically. (there was no feedback, did it work?)
If you want to use this in twig, it would look like this:
<code>{{ view.field.field_name.value(view.result[0]) }}
</code>

Retrieve field value in a view twig


Horizontal scroll nav bar with dropdowns content outside scroll

Question: I need to design a nav bar menu with "n" dropdowns so I want to place a horizontal scroll to be able to scroll through each button, however with the code that I have at the moment it is working but the content of the dropdown remains inside the scrolly so no It's how I look for it.
Is like in this example but instead of links dropdown buttons,
Below I attach the code that I am using at the moment.
I would appreciate any help or suggestion.
<!DOCTYPE html>

Dropdown Menu

Move the mouse over the button to open the dropdown menu.

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

Comment: I'd get rid of the scrollbar and use a JS based carousel component instead. Or better, would reorganize the menu.
Answer: <!DOCTYPE html>

Dropdown Menu

Move the mouse over the button to open the dropdown menu.

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

  <button class="dropbtn">Dropdown</button>

  Link 1
  Link 2
  Link 3

i think you are looking for this..try this i hope this works...
Comment: Thanks for your reply. But this solution its not what im lookinf for, i want to scroll only the part of the dropdown buttoms. Like in [this](https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_menu_hor_scroll) expample but with dropdowns
Answer: I added another wrapper element for positioning, now the content is displayed as expected, also when scrolling horizontally:
.dropdown {
  // remove next line
  // position: relative;
  display: inline-block;
}

Here you can directly test it:
.scrollmenu {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  height: 200px;
}

Here you can directly test it:

.scrollmenu {
  white-space: nowrap;
}

.dropbtn {
  background-color: #4CAF50;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
  position: static;
}

.dropdown {
  display: inline-block;
  overflow-x: auto;
  overflow-y: hidden;
}

.dropdown-content-wrapper {
  position: absolute;
}

.dropdown-content {
  display: none;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  z-index: 1;
}

.dropdown-content a:hover {
  background-color: #f1f1f1
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown:hover .dropbtn {
  background-color: #3e8e41;
}

Dropdown Menu

Move the mouse over the button to open the dropdown menu.

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

    <button class="dropbtn">Dropdown</button>

        Link 1
        Link 2
        Link 3

Comment: The problem is that there are elements below the nav bar so you can't specify that height because it would move the content below
Comment: Now I understand what you need. I've updated my answer, should work for you as expected.
Comment: Yes it is something like that, however, I don't know if you noticed that your solution has problems with the content of the dropdown menus when you're scrolling to the right
Answer: try overflow-x: auto;:

.scrollmenu {
  overflow-x: auto;
  display: flex;
  flex-direction: row;
  height: 600px;
  white-space: nowrap;
}

.dropbtn {
  background-color: #4CAF50;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
  cursor: pointer;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}

.dropdown-content a:hover {
  background-color: #f1f1f1
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown:hover .dropbtn {
  background-color: #3e8e41;
}

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

    <button class="dropbtn">Dropdown</button>

      Link 1
      Link 2
      Link 3

Comment: Thanks for your reply. But this solution it doesnt work
Comment: can you please tell me what exactly you issue is with this one so I can fix or create another solution, I'm here to help :)
Comment: The content of the dropdown (Link1,Link2,Link3) is inside the scroll not outside, so I have to scroll in order to see the dropdown content, I really don't see any difference with the code I attached
Comment: do you want to make the dropdown content sticky? or what
Comment: I want the button to be inside the scroll but the content of the button (link1, link2,link3) appears outside the scroll, currently it appears inside
Comment: I want the content of the dropdown to appear outside the scroll so that I don't have to scroll to see the content when I mouse over the button.
Comment: then you just need to add height to it, because the browser trying to fit the content in very small height and this causes the horizontal scroll, check the edit.


Notation and construction of 13th chords

Question: Firstly, I would like to ask whether 13th chords by default have a minor, major or diatonic 13th or is it contextual to the 3rd used.
E.g.
Am13 in the Aeolian mode:
Is the 13th F or F# (F being diatonic)
Is that different in the dorian mode? (F# being diatonic)
Secondly what is the notation for using the other 13th? Is it like (m13) or (b13)?
Comment: It may be a good idea to specify what genre you are playing/analyzing these chords in.  In the comment threads below it seems that some people are answering from a Classical perspective, where 13 chords are relatively rare.  I assumed this question is from the Jazz perspective, where you are most likely to find such a chord symbol.
Answer: Minor 6th chords use the major 6 interval off the root, just like major 6ths. The minor bit is the minor 3rd.A minor 6th chord with a minor 6th interval doesn't sound good. So 13ths will use the same 6th interval, but usually an octave higher.Strictly speaking, a 13th should have 1,3,5,7,9,11 and 13 in it, but that's often impractical - on guitar, for instance, there's only 6 strings, so all couldn't be played anyway. The other problem is that the order ought to be notes in numerical order. Fine on keyboards, but that's about all.Often, a 7th (usually flat) and a sixth with the basic triad will sound fine.
I don't think chords need to be made from modes, as they already exist in the 'mother' (Ionian) key.
Comment: I don't agree.  A 13th chord does not need to have all the notes.  The notes also have no requirement to be stacked in order, in fact, that's probably the most boring way to voice such a chord.  The bit about a Minor6 chord with b6 not sounding good is entirely subjective as well.  I would express that concept by saying that adding a b6 is not functionally the same as a minor chord and would not be an appropriate substitution.
Comment: That is exactly my point.  In practice you will rarely find someone playing all of those notes.  Jazz is pretty much the place you find a 13 chord and almost no Jazz players play the 5th of a chord unless it is the result of voice leading.  I also find the #11 would be used, not natural 11, as that would change the functionality of the chord.
Comment: @TimHargreaves - first past the post  doesn't make it the best answer you're going to get.
Comment: It's way too soon to vote a 'favourite' answer. This debate may run...
Comment: From my experience and training, as well as studying on my own, I have found that there is no necessity to use all the notes.  Saying 13 does imply that the other extensions would be appropriate in the chord.  Saying 'no 9' typically means that there specifically should not be one, which would be implied without the note.
Comment: @Basstickler Theoretically chords should have all the degrees below the highest voice which is demonstrated by 'no' chords e.g. G11(no9).
Comment: That's probably why I said 'strictly'. It rarely does.There are as many ways of voicing a chord as skinning a cat. That's subjective. I tried to point out that a min6th chord doesn't have a m6 note in it.
Comment: @Basstickler - personally, I've never used all the notes - on guitar ! Couldn't, and wouldn't. Mostly, I put a b7 and a maj6 on the triad, and it works for me. No-one has ever complained about it !
Comment: @Tim Answers my question. First to answer my question. Why wouldn't I accept it.
Comment: @TimHargreaves -  It was actual Tim that suggested you should wait to choose an answer.  I would tend to agree based on the amount of debate that has already taken place.  It is generally good to wait to choose THE answer as better ones may come along that provide more in depth information or a more understandable wording or a chart... lots of reasons to wait.  I do think that you get what you need from Tim's answer; my comments are in response to thinking it is slightly misleading as a definition.
Comment: I do tend to like your answers Tim, I just get a little picky sometimes.  You are clearly knowledgeable!
Comment: I'll take that as a compliment. Ta. But I'm just about to become more knowledgeable, I hope !
Comment: Ok, so according to Mark Levine's The Jazz Piano Book, a 13 chord would be a Dominant chord and could include as little as Root, 3, 7 and 13, and 11 should always be omitted, as it would be an 'avoid note' (and as usual in a Jazz setting, the accompanist would only play the root in the absence of a bass player).  The Harvard Dictionary of Music states, in reference to 9th, 11th and 13th chords, "All such chords can be inverted, and in some circumstances, one or more pitches other than the highest may be omitted." Continued in next comment...
Comment: Though wikipedia is not the most reliable source, it seems to state that the 9 and 11 are often omitted, as well the 5.  Their example uses R, 3, 7, 13.
http://en.wikipedia.org/wiki/Extended_chord
And this random site I just found seems to say that it is assumed that all the notes are there but that the 11 is often omitted because of its harsh dissonance but is still a 13th chord.
http://www.dolmetsch.com/musictheory17.htm#extended
So it seems that from either Classical or Jazz, the 11 is usually omitted.
Comment: Re omitted chord tones: yes "13th" does "imply" 7, 9, 11, on top of the root, 3rd and 5th Howeverthat does not mean they all have to sound. Omitting chord tones is sometimes necessary due to to voice leading considerations, or constraints of the instrument. When you do omit chord tones, omit those that least contribute to the character of the chord. For that reason, you can't omit to top note: a 13th chord with omitted 13th doesn't make sense. The 5th is a good candidate to omit since it merges almost completely with the root. 3rd is not a good candidate since it establishes mood.
Answer:
Firstly, I would like to ask whether 13th chords by default have a
  minor, major or diatonic 13th or is it contextual to the 3rd used.

13th Chords always have a major 13. When altering the 13, the extension of your chord gets smaller. The 9th and/or 11th can be omitted. But when omitting both, it's probably better written as an add13 chord. The 3th and 5th can be omitted if they are respectively major and perfect. When omitting the 3th, but with either an 11 or 9, a sus chord is formed (11 has priority over 9). A sharp 11th is common for dominant 13 chords to avoid a clash between the 3th and 11th. The root can be omitted if it is implied by another instrument (like the bass).
Common 13th chords:

C△13 C (D) (E) (F) (G) A B
C-13 C (D) Eb (F) (G) A Bb
C13 C (D) (E) (F) (G) A Bb
C13♯11 C (D) (E) F# (G) A Bb
Cø13, C-13♭5 C (D) Eb (F) Gb A Bb
C-△13 C (D) Eb (F) (G) A B
C+△13, C△13♯5 C (D) (E) (F) G# A B
C+13 C (D) (E) (F) G# A Bb
Cº△13, C-△13♭5 C (D) Eb (F) Gb A B
Cº13 C (D) Eb (F) Gb A Bbb -> you will never encounter this chord because B𝄫 and A clash

Secondly what is the notation for using the other 13th? Is it like
  (m13) or (b13)?

You would use the highest extension below the 13th of the chord, with an altered 13th.
Examples:

C11♭13 C (D) (E) F (G) Ab Bb
C-9♭13 C D Eb (G) Ab Bb
Comment: I think this is the best answer, because it's much clearer that the 13th is assumed to be major (A), not ♭13 (A♭).
Answer: Most chords have a "key" feature that determines the character and musical function. For a 13th chord that's probably the diminished octave interval between the 7 and the 13. You'd also need the 3 to distinguish between major and minor. On the guitar, I'd typically play 1 7 11 13, which happens to fret pretty nicely too. So in C13 would be C Bb E A
Comment: The interval between 7 and 13 would be a Major 7, not a diminished octave.  The numbers you used to describe building this chord do not align with your example (E is 3) and I would disagree with the 11 being present.
Comment: @ Hilmar - 1,7,11,13.Would be C,B,F and A. Doesn't sound too good !  C,Bb,E and A will constitute C13, as we said before, G as 5 is not needed, and 9 and 11 can be missed out.Did you mean 1,b7,10 and 13 ?
Answer:
The character of the 13th is essentially determined by its third and seventh voices. In the key of C, the Aeolian mode has a b13 (F). The chord would be a min11(b13). The Dorian mode has a natural 13, so the chord would be a min13.
With html's superscripts, we can notate the chord and alterations appropriately.  In fact, I have created summary harmonization tables that may answer your underlying questions.

@user10304 asserted that you can't play an actual 13th chord on guitar. While it is true that guitarists cannot simultaneously finger all of the voices as a pianist would, guitarists can still play an abbreviated version that retains the character of the 13th chord. In these tables, I have illustrated voices omitted for guitar in the color gray. The retained 13th chord voices generally include the root, third, seventh, thirteenth, together with any altered voices. Sometimes the chords get too complex for the guitar, such as in the Locrian mode.
In these tables, the highlighted chords contain "avoid" notes illustrated in red; they generally sound dissonant, so treat them accordingly.
You may readily discover these 13ths on guitar ranging from Texas blues to straight-ahead jazz. One of my favorite examples would be SRV's Riveria Paradise.
Answer: You can't play an actual 13th chord on a guitar. Also a 13th chord is just the entire major scale played at the same time as one chord. You might me more interested in piano, but you can break down the chord into a guitar format by removing notes.
Comment: We CAN actually play 13th chords on guitar.  For example, we can play Cmaj13 (C - E - A - B - E), Dm13 (D - B - C - F), Em7 (b13) (E - C - D - G - B), Fmaj13 (F - A - E - A - D - E), G13 (G - B - F - G - B - E), Am7 (b13) (A - F - G - C - E), and Bm7 (b13) (B - G - A - D).
Comment: You can not unless you tune weird and use 7 strings. You need 7 notes for an actual 13th sort of chord. When you omit notes leading up to it such as the 2 or 4.. you are not playing a real 13th sort of chord.
Comment: I wouldn't accept a chord name for a chord that isn't containing the required notes of the chord. That would mean there is no system and music theory is not a science or shouldn't exist at all.


Using IMD in Statistical Models of Mortality

Question: It is common in the world of health to incorporate measures of socioeconomic deprivation into statistical models. One commonly used proxy-measure of deprivation is the UK's Indices of Multiple Deprivation (IMD) score.
As the name suggests, this score is derived from several different indices:

Income Score
Employment Score
Health Deprivation And Disability Score
Education Skills And Training Score
Barriers To Housing And Services Score
Crime And Disorder Score
Living Environment Score

What has been playing on my mind recently is the Health Deprivation and Disability domain (described below). The IMD score includes measures of mortality and morbidity, but is commonly used as an explanatory variable in statistical models which look at health measures such as ... mortality and morbidity.
An example of this can be seen here: Socioeconomic indicators of health inequalities and female mortality: a nested cohort study within the United Kingdom Collaborative Trial of Ovarian Cancer Screening (UKCTOCS)
Is this a flawed method? Should the Health Deprivation And Disability Score domain be excluded from analyses of variables which may overlap with this domain?

Health Deprivation and Disability Domain
This domain measures premature death and the impairment of quality of
  life by poor health. It considers both physical and mental health. The
  domain measures morbidity, disability and premature mortality but not
  aspects of behaviour or environment that may be predictive of future
  health deprivation. Four indicators are used to calculate this domain:

Years of Potential Life Lost – an age and sex standardised measure of    premature death
Comparative Illness and Disability Ratio – an age and sex standardised measure of morbidity and disability
Measures of acute morbidity – an age and sex standardised rate of emergency admissions to hospital
Proportion of adults under 60 suffering from mood or anxiety disorders – a modelled indicator for the proportion of adults suffering from mood and anxiety disorders.

The English Indices of Deprivation 2010
Answer: Having asked around some colleagues, I have been pointed towards this paper by Adams & White (2006): Removing the health domain from the Index of Multiple Deprivation 2004—effect on measured inequalities in census measure of health
Whilst this study has some limitations in terms of the variables investigated (IMD 2004, long-term limiting illness and less-than-good self-reported health), it does at least present some degree of investigation into the topic.
The paper makes the following recommendation:

Removing the health domain from IMD 2004 did require some technical
  expertise and time. Although our findings suggest that removing the
  health domain from IMD 2004 is unnecessary for routine public health
  analyses using census measures of health, mathematical coupling and
  the associated problems in interpreting results remain a potential
  issue when using IMD 2004 to investigate patterns in other measures of
  health. In the context of socioeconomic inequalities in health,
  removing the health domain from IMD 2004 probably represents best
  practice.


data directory "/usr/local/var/postgres" has wrong ownership

Question: When I put postgres -D /usr/local/var/postgres in terminal, I get this back:
FATAL:  data directory "/usr/local/var/postgres" has wrong ownership
HINT:  The server must be started by the user that owns the data directory.
How could I fix with that?
Thanks~
Answer: Check the what the owner is of that dir by doing
ls -l /usr/local/var/ | grep postgres

You should see something like
-rw-r--r-- 1 postgresuser postgresuser  285659 Sep  1 18:05 postgres

Assuming it's "postgresuser", then run your database with
sudo -u postgresuser postgres -D /usr/local/var/postgres

Comment: `sudo chmod -R 700 /usr/local/var/postgres`
Comment: Run `sudo chown -R YYY /usr/local/var/postgres` replacing `YYY` with your user name. Then you should be able to run `postgres -D /usr/local/var/postgres`.
Comment: and then I got FATAL:  data directory "/usr/local/var/postgres" has group or world access
DETAIL:  Permissions should be u=rwx (0700). how could I change it....
Comment: I try the first line, but the result I got was drwxr--r--+ 27 root  admin  918  1 28 23:31 postgres
Comment: but it says "root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent
possible system security compromise.
Comment: but FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 7671) running in data directory "/usr/local/var/postgres"?
Comment: It's mentioning that postgresql may already be running, check if `ps -e | grep 7671` returns anything.
Comment: It returns "7671 ??         0:00.02 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
 7685 ttys000    0:00.00 grep 7671" what does it mean?
Comment: It means your database is running - you should be able to use it


How to design 2 different many-to-many relationships between same 2 tables with backref's / back_populate's

Question: This is the situation I am trying to model:
There are users, which can be classified as rider or driver. Each ride has a rider and a driver. I can imagine working with a ride object, where I can call ride.driver or ride.rider. But I find it difficult to reason about it on the other direction. For any user u, when I call u.rides, it is not clear if it should return rides where u is the driver or the rider.
I can also seperately have two relationships, so that u.rides_as_driver returns rides where u is a driver and u.rides_as_rider to return rides where u is a rider.
Is this a good approach to model the relationship that I just described?
Update
If this is a good approach, how do I acheive this in SQLAlchemy? In particular, how do I use backref in this design?
What follows is my attempt:
class Ride:
    driver = db.Relationship('User', primaryjoin=driver_id==user.id)
    rider =  db.Relationship('User', primaryjoin=rider_id==user.id)
class User:
    rides_as_rider = db.Relationship('Ride', primaryjoin=id==ride.rider_id)
    rides_as_driver = db.Relationship('Ride', primaryjoin=id==ride.driver_id)

Answer: Indeed, your conclusion that you should use two relationships reflects that this is not only a good way to represent this connection, it is the only way
relationship models not the remote table, Ride in your case, but the connections between tables.  There are two connections between Ride and User, for the two roles each user may play in a ride.
For more evidence of this fact, notice that you also have two relationship's facing away from Ride, toward User, one for each branch of the connection.  Since you have two of those, you would also require distinct backref's, one for each.
But, your code is not quite enough.  You should tell sqlalchemy that "this relationship is that one, only backwards".  as it is, you have four relationships, none of whom know the existence of the other.  This will manifest as mysterious effect of changes in Ride.driver not reflected in User.rides_as_driver.
The fix is easy, though, add a back_populates to each relationship and sqlalchemy will keep them in sync:
class Ride:
    driver = db.Relationship('User', primaryjoin=driver_id==user.id, back_populates="rides_as_driver")
    rider =  db.Relationship('User', primaryjoin=rider_id==user.id, back_populates="rides_as_rider")
class User:
    rides_as_rider = db.Relationship('Ride', primaryjoin=id==ride.rider_id, back_populates="rider")
    rides_as_driver = db.Relationship('Ride', primaryjoin=id==ride.driver_id, back_populates="driver")


How do I count this?

Question:
I'm teaching myself to read music and I'm struggling how to count each top bar. It just keeps on being more than 3:( Any help would be much appreciated.:)
Comment: "One and two and three and one and two and three and..." isn't working for you? The rhythm in the treble clef would be (bold words indicate new notes): "**One** and two **and three** and **one** and to **and three** and..."
Answer: Think of the three beats as counted 1,2,3. Then the subdivisions can be counted as 1 & 2 & 3 &. So the dotted quarter takes up 1 & 2; then the eighth note the next & and the last quarter note as 3.(Quarter note = Crochet, Eighth note = Quaver) Actually, any short syllable can be used instead of "and."
The 3/4 means three main pulses; each pulse can have subdivisions or even have irregular connections between the notes.

How do I count this?


Let $\lambda$ be a real eigenvalue of matrix $AB$. Prove that $|\lambda| > 1$.

Question:
Let $A$ and $B$ be real symmetric matrices with all eigenvalues strictly greater than 1. Let
$\lambda$ be a real eigenvalue of matrix $AB$. Prove that $|\lambda| > 1$.

My solution:

Let $a$ and $b$ be eigenvalues of $A$ and $B$ corresponding the eigenvectors $y$ and $x$, respectively.
Looking at the following dot product:
$$\langle ABx,y \rangle = \langle Bx,A^Ty \rangle=\langle Bx,Ay \rangle = \langle bx,ay \rangle=ab\langle x,y \rangle=\langle abx,y \rangle$$
we get $$(AB)x=(ab)x$$ Therefore, $\lambda := ab$ is an eigenvalue of $AB$. Since $a>1$ and $b>1$, it follows that $\lambda > 1$

However, it doesn't seem ok as the problem was actually asking to prove $|\lambda|>1$. Indeed, $\lambda > 1 \implies |\lambda|>1$, but then the problem wouldn't write $|\lambda|$ in my opinion.

The given solution:

The transforms given by $A$ and $B$ strictly increase the length of every nonzero vector, this
can be seen easily on a basis where the matrix is diagonal with entries greater than $1$ in the diagonal.
Hence their product $AB$ also strictly increases the length of any nonzero vector, and therefore its real
eigenvalues are all greater than $1$ or less than $-1$.

Any help is appreciated.
Comment: You are already given a solution. What additional help do you need?
Comment: @user1551 I would appreciate any help on outlining why my solution yields just $\lambda > 1$ not $|\lambda| > 1$ as the problem asks
Comment: Your answer doesn't sound right. You've correctly shown that $\langle ABx,y\rangle=\langle abx,y\rangle$ when $(a,y)$ is an eigenpair of $A$ and $(b,x)$ is an eigenpair of $B$. However, the inference $ABx=abx$ is incorrect because it wrongly implies that $A(bx)=abx$, i.e. $x$ is an eigenvector of $A$.
Comment: @user1551 Thanks for catching that. Now I know my mistake, so will try to proceed that solution in a different direction.
Answer: $AB$ is similar to $A^{1/2}BA^{1/2}$. Hence its eigenvalues are positive.
Full solution:
Since $A$ and $B$ are positive definite, $AB$ is similar to the positive definite matrix $A^{1/2}BA^{1/2}$. Hence $AB$ has a positive spectrum.
Furthermore, since $A$ and $B$ are unitarily diagonalisable and their eigenvalues are greater than $1$, we have $\|Ax\|_2,\|Bx\|_2>\|x\|_2$ for all nonzero vector $x$. It follows that $\|ABx\|_2=\|A(Bx)\|_2>\|Bx\|_2>\|x\|_2$ for all nonzero $x$. As $AB$ has a positive spectrum, the eigenvalues of $AB$ must be positive numbers greater than $1$.
Alternative solution (that uses the induced $2$-norm for matrices). Since $A,B\succ I$, we have $0\prec A^{-1},B^{-1}\prec I$ and $\|A^{-1/2}B^{-1}A^{-1/2}\|_2\le\|A^{-1/2}\|_2^2\|B^{-1}\|_2=\|A^{-1}\|_2\|B^{-1}\|_2<1$. Hence $0\prec A^{-1/2}B^{-1}A^{-1/2}\prec I$ and $A^{1/2}BA^{1/2}\succ I$. Since $A^{1/2}BA^{1/2}$ is similar to $AB$, all eigenvalues of $AB$ are positive numbers greater than $1$.
Comment: Then the problem is not as strict as possible about the range of $\lambda$?
Comment: @VIVID The conditions allow a stronger result ($\lambda>1$), but the problem statement only asks for a weaker one ($|\lambda|>1$).
Comment: Thanks for the update! But it seems I'm not quite familiar with the notation $\|Ax\|_2$.
Comment: @VIVID It's the Euclidean norm of a vector, i.e. $\|(x_1,\ldots,x_n)^T\|_2=\sqrt{x_1^2+\cdots+x_n^2}$.
Comment: Ok got it! Your answer is like a more formal version of the *original solution* and also more clearer for me. Thanks again!


How to edit this very complicated Joomla query that kills the server

Question: I have to edit the query bellow on a Joomla site. This query is so slow and hard and it very often kills the server and I get errors Gateway timeout.. Please help me to edit it if possible to avoid so many Left Joins because I think the make it so "heavy".. The query is:
SELECT
o.*, o.price AS value, c.name AS catname, g.title AS groupname, u.name AS editor,
u.id AS userid, u.block as blockuser, t.name as typename, t.id as typeid,
a.name as agentname, a.id as agentid, image.path as imagepath,
image.fname as imagefilename, image.type as imagetype, l.title AS language_title,
l.image AS langImage, u.name AS editor
FROM (mytable_estateagent AS o, mytable_estateagent_categories AS c )
LEFT JOIN (
    SELECT * FROM mytable_estateagent_images AS img
        WHERE 1 AND (img.type = '.jpg' OR img.type = '.gif' OR img.type = '.png')
        AND ( img.ordering= 1 or img.ordering= 0 ) AND img.published = 1
        GROUP BY img.objid
    )
as image ON (image.objid = o.id)
LEFT JOIN mytable_estateagent_type AS t ON (o.type = t.id)
LEFT JOIN mytable_languages AS l ON l.lang_code = o.language
LEFT JOIN mytable_estateagent_agents AS a ON (o.agent = a.id)
LEFT JOIN mytable_viewlevels AS g ON (g.id = o.access)
LEFT JOIN mytable_users AS u ON (u.id = o.created_by)
LEFT JOIN mytable_users AS uc ON uc.id = o.checked_out
WHERE 1 AND (c.id = o.cat) ORDER BY id ASC

Comment: I'd need to see your tables structures, coulumn types and so on
Comment: Besides the query, you can improve the query's speed by setting good indexes
Comment: Michael, any concrete suggestions?
Comment: It will help to index the columns in your ON statements (like o.checked_out, o.created_by, ...)
Comment: Michael, this didn't help, still slow, any other suggestions please?
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/63691/discussion-between-europeuser-and-michael).
Comment: Also, as a start, rewrite your query without 'SELECT *'. Instead name and properly qualify the columns you want returned. This helps us too.
Comment: Note that you select no columns from the outer joined table instance `uc`, so you can remove that join without affecting the query result.
Answer: See comments above, but note also that this bit (edited)...
SELECT o.*
...
LEFT JOIN
 (  SELECT DISTINCT img.objid
       FROM mytable_estateagent_images img
      WHERE img.type IN('.jpg','.gif','.png')
        AND img.ordering IN(1,0)
        AND img.published = 1
 ) image
ON image.objid = o.id

... can be (further) rewritten as follows...
SELECT DISTINCT o.*
...
LEFT
JOIN mytable_estateagent_images image
  ON image.objid
 AND image.type IN('.jpg','.gif','.png')
 AND image.ordering IN(1,0)
 AND image.published = 1
...

Comment: Strawberry,sorry for the delay, I was away, thanks for the suggestions, image.type IN('.jpg','.gif','.png') saved some seconds, dont't you think instead of AND image.ordering IN(1,0) that AND image.ordering < 2 is faster? But still query takes alot of time - 23 seconds..
Comment: "Note that you select no columns from the outer joined table instance uc, so you can remove that join without affecting the query result" what you mean with this?
Comment: This bit "LEFT JOIN mytable_users AS uc ON uc.id = o.checked_out" is redundant - and switching from OR to IN wasn't the important bit. The important bit was removing the subquery!


How to add unique classes to FlexSlider slides? (default behavior in v 7.1.x - not in v 7.2.x)

Question: I just upgraded the flexslider module from 7.1.x to 7.2.x and it broke my styling because the old version gave unique classes to each slide (also odd and even row classes to every other slide), but the new version gives each slide the same classes.
I really need to style each slide differently so I was using these unique classes.
This "feature request" is in the module's issue queue but it hasn't been touched in a long time and I lack the skills to fix it myself.
Does anyone know how I can give each Flexslider slide a unique class, either using jQuery, PHP or maybe some other module?
Answer: OK - I was over thinking this. This script will add id 1, 2, 3 etc to my slides. The slides are just list items - I was all intimidated because only one li is visible at a time, but jQuery doesn't care...
<code>/*Script for assigning each flexslider slide a unique class*/
(function($){
$(document).ready(function(){
    $('.slides li').each(function(i,el){
        el.id = i+1;
        });
    });
})(jQuery);
</code>
Answer: You cannot start an ID with a number, which means that Anne's jquery will not work. Instead, assign the li a class - in this case, "slide-1", "slide-2", etc...
(having problems figuring out how to type a code block in this answer - what am I missing?)
/* --- Each flexslider slide gets it's own class ---*/
        (function($){
    $(document).ready(function(){
        $('.slides li').addClass(function(i){
            return "slide-" + (i + 1);
            });
        });
    })(jQuery);


Erro ao executar lista dart

Question: estou tentando fazer uma lista em dart/flutter, porém estou recebendo o seguinte erro ao executar a tela do app.

Classe Repositório:
chamarGetGaiola(String usuario, String token) async {
  http.Response response = await http.get(
  urlAPI + "/GaiolasDisponiveis?usuario=$usuario&token=$token",
  headers: {"Content-type": "application/json; charset=UTF-8"},
);

if (response.statusCode.toString() == "200") {
  List<dynamic> retorno = json.decode(response.body);

  List<Gaiola> lista = List<Gaiola>();

  for (final item in retorno) {
    Gaiola novoItem = Gaiola();
    novoItem.GaiolaId = item["gaiolaId"];
    novoItem.Nome = item["nome"];
    lista.add(novoItem);
  }

  return lista;

  // print("Resposata usuário: $usuario $senha $token");

}

Classe da Gaiola:
class Gaiola {

int GaiolaId;
String Nome;

}

Classe para montar a lista.
import 'package:projeto/Caixa.dart';
import 'package:flutter/material.dart';
import 'package:projeto/global.dart' as gv;
import 'dart:convert';
import 'Gaiola.dart';
import 'Repositorio.dart';

class Aspirar extends StatefulWidget {
String caixa;

 @override
 _AspirarState createState() => _AspirarState();
  }

    class _AspirarState extends State<Aspirar> {

     Repositorio repositorio = Repositorio();

     TextEditingController campoQtdAspirada = TextEditingController();
     Gaiola gaiola;

    @override
    Widget build(BuildContext context) {

    List<Gaiola> listaGaiola = repositorio.chamarGetGaiola(gv.usuarioLogado,
    gv.token);

    return Scaffold(
    appBar: AppBar(
      title:
          Text("Aspirar Caixa ${gv.codigoQrCodeCapturado.toUpperCase()}"),
      backgroundColor: Color(0xffccffcc),
    ),
    backgroundColor: Color(0xff263238),
    body: Column(
      children: <Widget>[
        Text(
          gv.codigoQrCodeCapturado.toUpperCase(),
          style: TextStyle(
            fontWeight: FontWeight.bold,
            color: Colors.white,
            fontSize: 25,
          ),
        ),
        Image.asset(
          "imagens/caixa.png",
          width: 240,
        ),
        Padding(
          padding: EdgeInsets.all(32),
          child: TextField(
            style: TextStyle(color: Colors.white),
            keyboardType: TextInputType.number,
            decoration: InputDecoration(
              labelText: "Quantidade Aspirada",
              labelStyle: TextStyle(fontSize: 20, color: Color(0xffccffcc)),
            ),
            controller: campoQtdAspirada,
          ),
        ),
        Container(
            child: DropdownButton<Gaiola>(
          items: listaGaiola.map((Gaiola gaiola) {
            return new DropdownMenuItem<Gaiola>(
              value: gaiola,
              child: new Text(
                gaiola.Nome,
                style: new TextStyle(color: Colors.black),
              ),
            );
          }).toList(),
          onChanged: (Gaiola value) {
            setState(() {
              gaiola = value;
            });
          },
          hint: Text(
            'Selecionar Gaiola',
          ),
          value: gaiola,
          underline: Container(
            decoration: const BoxDecoration(
                border: Border(
              bottom: BorderSide(color: Color(0xffccffcc)),
            )),
          ),
          style: TextStyle(
            fontSize: 20,
            color: Colors.black,
          ),
          iconEnabledColor: Color(0xffccffcc),
          iconSize: 20,
        )),
        Padding(
          padding: EdgeInsets.only(top: 16, bottom: 10),
          child: RaisedButton(
            child: Text(
              "Confirmar Aspiração",
              style: TextStyle(color: Colors.black, fontSize: 20),
            ),
            color: Color(0xffccffcc),
            padding: EdgeInsets.fromLTRB(32, 16, 32, 16),
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(32)),
            onPressed: () {
              print(
                  "Combo digitado: ${campoQtdAspirada.text}, GaiolaId: ${gaiola.GaiolaId}");
            },
          ),
        ),
      ],
    ));
     }
     }

Comment: Lendo novamente seu problema, acho que minha resposta não vai lhe ajudar muito. Melhore sua pergunta **EDITE** ela e coloque qual o tipo do retorno desse método `chamarGetGaiola` e coloque também o código de onde você usa o método.
Comment: @MatheusRibeiro conforme solicitado, essa é a estrutura do app na qual estou tentando criar uma lista do retorno da minha API.
Answer: Faltou apenas você tipar o retorno do seu método chamarGetGaiola, faça assim:
Future<List<Gaiola>> chamarGetGaiola(String usuario, String token) async {
  ...
}

Mas como seu método vai retornar um Future você irá precisar usar o FutureBuilder, modifique o seu combo de gaiolas da seguinte forma
Container(
      child: FutureBuilder(
        future: repositorio.chamarGetGaiola(gv.usuarioLogado, gv.token),
        builder: (context, snapshot) {
          if (!snapshot.hasData)
            return Container();

          return DropdownButton<Gaiola>(
          items: snapshot.data.map((Gaiola gaiola) {
            return new DropdownMenuItem<Gaiola>(
              value: gaiola,
              child: new Text(
                gaiola.Nome,
                style: new TextStyle(color: Colors.black),
              ),
            );
          }).toList(),
          onChanged: (Gaiola value) {
            setState(() {
              gaiola = value;
            });
          },
          hint: Text(
            'Selecionar Gaiola',
          ),
          value: gaiola,
          underline: Container(
            decoration: const BoxDecoration(
                border: Border(
              bottom: BorderSide(color: Color(0xffccffcc)),
            )),
          ),
          style: TextStyle(
            fontSize: 20,
            color: Colors.black,
          ),
          iconEnabledColor: Color(0xffccffcc),
          iconSize: 20,
        );
        }
      )
    )

E assim você não precisará mais utilizar isso
List<Gaiola> listaGaiola = repositorio.chamarGetGaiola(gv.usuarioLogado,
    gv.token);

Obs.: Não estou com Flutter no computador agora, então não cheguei a testar, talvez precise fazer alguma modificação.
Porque utilizar FutureBuilder?
Como a requisição feita a sua API é assíncrona e os dados serão recebidos em outro momento é necessário que seu método retorne um Future<T>.
O FutureBuilder vai aguardar essa chamada e assim que ela for finalizada, irá redesenhar o Widget que ele contém.
Fiz uma validação if (!data.hasData) return Container();, essa validação serve para que quando o FutureBuilder estiver aguardando a resposta da API ele desenhe um Container "nulo" assim não ocupando nenhum espaço e ficando imperceptível ao usuário.
Comment: O `AsyncSnapshot` não tem mesmo o `Map`, me esqueci de uma parte hahaha Já ajustei, confira a resposta novamente, o certo é `snpshot.data`
Comment: Fez certo carinha, era o que eu iria sugerir!
Comment: Show de bola Matheus, estou só travado no método que você utilizou logo acima o .map. Quando chamei ele me da um erro dizendo error: The method 'Map' isn't defined for the class 'AsyncSnapshot'.
Comment: Show de bola Matheus, deu certo a parte da tela do app, porém quando bate no meu repositório onde adicionamos o Future>chamarGetGaiola(String usuario, String token) async ele da o seguinte erro:

type 'List' is not a subtype of type 'List>'

Cara me desculpe tá te enchendo com isso é que estou completamente frustrado por não ter conseguido arrumado isto e sem contar que estou iniciando rsrs.

Vou colocar a imagem do erro para você acima.
Comment: Cara deu certo aqui, em minha classe que estou trabalhando o que monta a lista adicionei após o snapshot.data.map o > ficando da seguinte forma

items: snapshot.data.map>((Gaiola gaiola) {...

Muito obrigado pela ajuda meu amigo, valeu mesmo!

Erro ao executar lista dart


Is it possible to show road restrictions on the map?

Question: Is there a layer to show road restrictions on the map especially for trucks?
I'm using the Here Flutter Navigation SDK 4.6
Another question: given a position and a direction, is it possible to know if there are ahead restrictions, for example max height 2.5 meters or max weight, etc., using the Here SDK or APIs?
Answer: This seems to be available for the Maps API for JavaScript. Such a layer is not yet available for the HERE SDK for Flutter.


Probabilities of significance using sign test and Wilcoxon rank test

Question: I have a homework in a subject called "Non-parametric statistics", and it's causing me some difficulties at the moment. So I would be very glad if you could help me or give me some ideas. The task is as follows:
Pulse is being measured twice on the same test group - first at rest state and then after a 15-minute walk. We're interested to find out whether the pulse is different before and after the walk.
We have 4 observations. The task is to find all posible probabilities of significance for two-sided hypothesis (H0: the distribution of pulse doesn't change) using a) sign test and b) Wilcoxon rank sum test. Besides of finding the probabilities, a complete solution must be included.
Comment: You will get a cheerier reception here if you show what you have tried to solve the problem on your own, and then say why that is not sufficient. As it stands, your question get additional votes to 'close' or 'down-votes'. If you have additional thoughts please consider editing them into the question. // I am not sure what it means to find 'all possible probabilities', but my Answer below shows that four subjects are not enough to get a significant result using these nonparametric tests.
Answer: Suppose pulse rates are 58, 75, 62 and 63 initially, for subjects 1, 2, 3, 4.
Also, that their respective pulse rates are 63, 80, 71 and 77 after walking.
Sign test. We can see immediately that the pulse rate increased for all
four subjects--the signs of all four differences, After - Before, are
positive. Considering subjects to be independent, we can use the binomial
distribution $\mathsf{Binom}(n=4, p=.5)$ as the distribution of the number
of positive differences ("Successes") under the null hypothesis that
$p = .5$ (increases and decreases are equally likely). The distribution of
$X$ is given by the table:
 x    P(X = x)
 0      1/16
 1      1/4
 2      3/8
 3      1/4
 4      1/16

The P-value for our data is $2(1/16) = 1/8.$ (The P-value is the probability
under this null distribution of obtaining a result as far away from the
expected 2 Successes and 2 Failures as our result.)
Usually, one requires a P-value below 5% in order to reject the null
hypothesis. A design with four subjects is not adequate to get such a
small P-value. So there is no way for the sign test to reject the null
hypothesis (and thus give convincing evidence that walking changes pulse rate).
Note: If we had $n = 6$ subjects, all with increased pulse rates, then the
P-value for the two-sided alternative would be $2(1/64) = 1/32 < 5\%$
Wilcoxon Signed-Rank Test: This test looks at the absolute values of After - Before differences and ranks them (with half-ranks for ties). Our (absolute) differences are 5, 5, 19, 14,
and the corresponding ranks are 1.5, 1.5, 4, 3.
bef = c(58, 75, 52, 63)
aft = c(63, 80, 71, 77)
aft-bef
##  5  5 19 14
## rank(aft-bef)
## 1.5 1.5 4.0 3.0

Next, the procedure is to sum the ranks corresponding to differences that
are positive (for our data, all of them). Different sofware packages and texts
have slightly different methods of doing the rest of the test, so I can't
say exactly what your text does. Here is the result of the Wilcoxon Signed-Rank test is R statistical software:
wilcox.test(bef, aft, pair=T)

        Wilcoxon signed rank test with continuity correction

data:  bef and aft
V = 0, p-value = 0.09751
alternative hypothesis: true location shift is not equal to 0

Warning message:
In wilcox.test.default(bef, aft, pair = T) :
  cannot compute exact p-value with ties

R gives a provisional P-value of 0.975 < .05 showing that we cannot
reject the null hypothesis. On account of the tie, R does not try to
give an exact P-value.
Here are results from Minitab:
Wilcoxon Signed Rank Test: Diff

Test of median = 0.000000 versus median ≠ 0.000000

         N for   Wilcoxon         Estimated
      N   Test  Statistic      P     Median
Diff  4      4       10.0  0.100      8.000

Minitab shows a P-value = 0.1, which makes some attempt to deal with
the tie, but still does not lead to rejection.
In any case, even with four differences all of them positive, the
Wilcoxon Signed-Rank test cannot have a small enough P-value to find
a significant difference between pulse rates Before and After walking.
Paired t test. If we are willing to assume that differences in
pulse rates are normally distributed, we can also use a paired t test.
Here are results from R:
t.test(bef, aft, pair=T)

        Paired t-test

data:  bef and aft
t = -3.0952, df = 3, p-value = 0.0535
alternative hypothesis: true difference in means is not equal to 0
sample estimates:
mean of the differences
             -10.75

The assumption of normality adds information, and so we get a smaller P-value
here. Still not quite enough to reject at the 5% level of significance.
Note: If the values after walking had been  65, 82, 71, 77, then the sign
test and the Wilcoxon Signed-Rank test would give exactly the same P-values
(and error message) as before, but the t test would be significant at the
5% level with P-value= 0.028.

Summary: In summary, four subjects are not enough for either the Sign test or the Wilcoxon Signed-Rank to give a significant result no matter what the data.
These tests are less powerful than a paired t test because they look only
at the signs or the relative ranks of the four individual differences,
whereas the t test looks at the actual pulse rate values (assuming they
are normal).


Executing a Rule on a user(s) selected from a list

Question: I have created a user reference field on a node which lists (via Views) all the users the node author is related to in some way. If there is a better way to list users on node forms then I'm open to suggestions. In my particular case the field uses the autocomplete widget with the Views list, but a select list widget could also be used.
I would like to be able to execute a Rule on the user that is selected in the autocomplete/list by the node author. At the moment I am using the Button Field to trigger the Rule execution but I'm not sure how to get the Rule to apply to the specific chosen user. Some ideas are flagging the user when they are selected or doing a textual comparison between the autocomplete text and existing usernames. I have also tried the Relation module but still can't figure out how to get the selection recognized in Rules.
Answer: It sounds to me like you need to fetch the user as an entity in Rules, if you have multiple users use a loop. After this you should be able to apply the relevant action. Here is a stab at the Rule (note, this is untested but should point you in the right direction):
Event
- (Whatever trigger/s you want here)
Condition
- Entity is of type: Node
- Entity has field: (pick the user reference field here)
Action
- Loop(for multiple users)
- (Final action you want to take place. Add the new variable here)

Hope that makes sense. See how you go with this and let me know.
Comment: Thank you very much for this, I thought I'd never get a response. I've tried the above method but when I get to the last step and try to enter my token "variable" in the value field, it always tries to append "entity host" on the end and gives me a wrong parameter error when I try to save the action. Could this be because I'm using a field collection instead of a node?
Comment: I managed to fix the problem in my comment above, I was drilling too far down in the tokens list. Also I found that using "Fetch Entity" in the action isn't needed because the field is already referenced through the conditions before.   The problem though is that the Rule is calling the field before the new value in it is actually saved, which returns no result. If the node is first saved and then the Rule is triggered, it works perfectly. I tried adding a "Save entity" action before the final action is executed on the selected user but that didn't help. Any suggestions?
Comment: Ok, I updated the answer. You should be able to save the node via Rules and execute your final action after. Maybe you will need to Flag the node and then use a second Rule. I would suggest opening a new question for the saving part though.


Migrating from iptables to firewalld : commenting rules

Question: I'm migrating from iptables to firewalld, using Centos 7.
In the old times, I used to write the (permament) iptables rules in the /etc/sysconfig/iptables , which also served to place comments prepended by # (to remind us why we restricted this or that ip, etc).
Now, it seems that the current (permanent) configuration is read from /etc/firewalld/ files (especially /etc/firewalld/zones/*.xml). I guess I could add xml comments there, but it seems the good practice is not to edit those files directly but via firewall-cmd (no?).
Hence, I'm not sure which is the standard or recommended way to add comments to the rules.
Any suggestions?
Edited: For the record, I've verified that xml comments do not survive firewall-cmd modifications.
Comment: another example: allow users to see current firewall rules on a server with comments - if on the server they can easily see settings and related comments instead of having to go someplace else to get that info (useful for devs and devops)
Comment: I gave an example: I block an ip (place it inside a drop zone) and I want to remind me why. Also, I add acces to a non-standard tcp port that I use for a test service, etc. The general point is maintenance.
Comment: As a general rule, you don't. What are you trying to accomplish with comments? There may be a better way to reach the end goal, whatever it is.
Comment: OK, that does make sense. Though such comments are probably better suited for your configuration management system.
Answer: Thinking it over, I'm finding this firewalld-cmd thing slightly silly. After all, XML configuration files are human editable. It makes little sense to me, having to learn an extra layer of commands (well, one command, but with tons of arguments) only to edit some simple and neat XML files (*).
I fell slightly stupid typing
firewall-cmd --permanent --zone=work --add-port=445/tcp
just for addding the following line to /etc/firewalld/zones/work.xml
<port protocol="tcp" port="445"/>
Hence, at least for now, and considering that the XML elements don't include comment attributes (there are some requests in that direction) I'm leaning towards the following strategy: just forget about  firewalld-cmd (perhaps even delete it), edit the XML files yourself, and add XML comments freely.
(*) It's true that firewalld-cmd allows also to add dynamic (non permanent) rules. But I'd bet that that is not a very frequent scenario.
Comment: @user12345 Sure. I just try to become familiar with these new things, especially if they became more or less standard.
Comment: you could also just stick to iptables by [removing firewalld and installing iptables](https://www.digitalocean.com/community/tutorials/how-to-migrate-from-firewalld-to-iptables-on-centos-7)
Answer: As of 10/2022, I think firewalld use sufficiently widespread that ease of annotating rules either from firewall-cmd or from firewall-config is very important, for reasons discussed in the OP.
Suggestions that we document rules in a CMS, via firewall-cmd --direct, via ipsets, or edit zone files manually, all complicate management and defeat a purpose of firewalld, that of making firewall configuration more transparent.
Therefore, until firewall-cmd --comment becomes available, I will annotate my rules via the log prefix option to firewall-cmd --add-rich-rule.  For example,
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=192.168.103.224 reject log prefix='Onsite NIDS 1'"
firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=192.168.103.225 reject log prefix='Onsite NIDS 2'"

The resulting annotation appears in my system log as a side-effect, but now output of firewall-cmd --list-all-zones is self-documenting:
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources:
  services: dhcpv6-client http https ssh
  ports: 1515/tcp 1514/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
        rule family="ipv4" source address="192.168.103.224" log prefix="Onsite NIDS 1" reject
        rule family="ipv4" source address="192.168.103.225" log prefix="Onsite NIDS 2" reject

The comment is also recorded in my zone file as:
# cat /etc/firewalld/zones/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
  <short>Public</short>
  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>
  <service name="ssh"/>
  <service name="dhcpv6-client"/>
  <service name="http"/>
  <service name="https"/>
  <port protocol="tcp" port="1515"/>
  <port protocol="tcp" port="1514"/>
  <rule family="ipv4">
    <source address="192.168.103.224"/>
    <log prefix="Onsite NIDS 1"/>
    <reject/>
  </rule>
  <rule family="ipv4">
    <source address="192.168.103.225"/>
    <log prefix="Onsite NIDS 2"/>
    <reject/>
  </rule>
</zone>

I realize that even this approach overly complicates configuration by introducing rich rules, but believe the benefit in annotation worthwhile for now.
Comment: If one uses the "log prefix" workaround as shown above, is there a potential concern for performance? Wondering if I were to use this for opening a port on something like a home/remote server that's maintaining an active connection, if the system would be generating more log statements about the connection. Probably wouldn't be a big deal for a file server but something like a game server or a mumble server where there are long-ish active connections even with a small number of users (<5), I'm not sure. Any clues?
Comment: @zpangwin: Especially when relevant logs are written to a disk, there can be performance concerns.
Answer: Although in the firewall-cmd man page, there is a section on Direct Options, that allow you to give parameters, so you could do something like:
firewall-cmd --direct --add-rule
 <chain> <priority> <args> -c <some comment>
Although, as Michael Hampton said, probably not the best thing.


How to Associate Page Title with Author as Variable or Token or Relationship

Question: I have created a custom content type for each of several contributing users for multi-blog purposes. I then used Views to create a page for each content type and thus a "blog home page" for each user.  I have also modified my theme's node.tpl.php file to reflect the custom look I want for displaying the teasers for all the custom content that is created.
The current header portion of my node.tpl.php file:
<?php if (!$page): ?>

<?php endif; ?>

  <? print " | "; ?><? print render($date); ?>

<?php print render($title_prefix); ?>
<?php if (!$page): ?>
  <h2 class="title" <?php print $title_attributes; ?>>
    <a href="<?php print $node_url; ?>"><?php print $title; ?>

<?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($display_submitted): ?>
  By
    <?php print $submitted; ?>

<?php endif; ?>
<?php if (!$page): ?>

<?php endif; ?>

I can display the custom content title with $title, the date it was submitted by $date and the author by $submitted.  What I would like to include is the title/link to the page (that was created by the view of the custom content type associated with the author).
Is this something I can use relationships for to somehow generate a token and/or variable?
I don't really have any idea about how to approach this; any ideas or advice are much appreciate... thanks!
Answer:
In your theme template.php file add preprocess_node as below.
The below code will grab the author of current node for your custom content type.
And $node_author will be available to user on node.tpl.php
With the help of $node_author you can make the link
//
//Override or insert variables into the node template.
//
function MYTHEME_preprocess_node(&$variables) {
  //dpm($variables);
  if($variables['type'] == 'my_custom_content_type') {
    $node_author = $variables['uid'];
    $variables['home_page'] = $node_author;
  }
}

In your views add contextual filter for author uid to grab from url.
This should work for you.


Memory leak in sun.print.Win32PrintServiceLookup.notifyPrinterChange

Question: When I stop my Tomcat server in windows sometimes I have to wait long time, in these cases I got this warning:
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [ROOT] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak.
Stack trace of thread:
 sun.print.Win32PrintServiceLookup.notifyPrinterChange
 sun.print.Win32PrintServiceLookup.access$100(Unknown Source)
 sun.print.Win32PrintServiceLookup$PrinterChangeListener.run(Unknown Source)

The only printer-connected code in my web app is a reader of available printers with:
PrintService[] printServices = PrinterJob.lookupPrintServices();

Do you know how to avoid this problem?
Comment: What jvm\os version do you use?
Comment: Win10, but I have the same problem with Win7. JVM 32bit 8.0.1310.11
Answer: That thread is started by Win32PrintServiceLookup itself, unless it thinks you are on Windows 98, which it verifies by using system property os.name, so here is a funky (tentative) workaround:
String osName = System.getProperty("os.name");
if (osName.startsWith("Windows")) { // or SystemUtils.IS_OS_WINDOWS if you use commons-lang
    System.setProperty("os.name", "Windows 98");  // Pretend you're on Win98
}
PrinterJob.lookupPrintServices();
System.setProperty("os.name", osName); // Restore original value

I have not tested (no Windows system around today), so I just hope it still gets the list once. It also means you lose the ability to register changes of printers during the application lifetime.
Comment: A little update: it is better to wrap everything with `if(SystemUtils.IS_OS_WINDOWS){...}` otherwise in linux enviroment it tries to apply the windows methods and tomcat crashes...
Comment: Surely not a solution, but nice idea. I'm testing it and for now it is ok.
Comment: Wow yeah I was not expecting to get that answer accepted or get the bounty, it's just an ugly workaround that I wanted to share, mostly for its funky side... I also expect this to fail in later Java versions if/when they change `Win32PrintServiceLookup`. But I'm glad it helps now :)
Comment: For now it is the only/best solution :-)


Purely Algebraic Solution to a complex number problem

Question:
Question -  Let $z_1 , z_2 ,z_3 $ be 3 complex numbers satisfying
$|z|=1$ and $$4z_3=3(z_1+z_2)$$ Then find the value of $|z_1-z_2|$.

Looking at the question i could  immediately see a geometric solution that we can just rearrange the equation like
$$\dfrac{2}{3}z_3=\dfrac{z_1+z_2}{2}$$
Now midpoint of $Z_1Z_2$ divides $OZ_3$ in the ration $2/3$ ($O$ is origin $Z_i$ is the respective vertex).. Using this fact we get answer as $\boxed{\dfrac{2\sqrt{5}}{3}}$
I was wondering if there was any purely algebraic solution to this? I couldnt find any.
Answer: $$\left(\frac43\right)^2=|z_1+z_2|^2=2+2\Re(z_1\bar z_2)$$
hence
$$|z_1-z_2|^2=2-2\Re(z_1\bar z_2)=4-\left(\frac43\right)^2=\frac{20}9.$$
Comment: +1 That was quite simple yet good solution. Thanks!


Go: How to embed same interface twice?

Question: Suppose we have something like this:
type ReadHandler interface {
     Reader
     Reader
 }

Obviously, it will cause ambiguity when we call members of Reader interface on instances of ReadHandeler. So how can we achieve this in Golang?
Comment: Interfaces describe behaviour. Embedding an interface twice is like saying: "I want this behaviour and this behaviour again!" Which seems rather strange. If an interface supports `foo()` than demanding it also supports `foo()` is pretty redundant.
Answer: 1- Use io.MultiReader, see func MultiReader(readers ...Reader) Reader Docs:

MultiReader returns a Reader that's the logical concatenation of  the
  provided input readers. They're read sequentially. Once all  inputs
  have returned EOF, Read will return EOF.  If any of the readers
  return a non-nil, non-EOF error, Read will return that error.

2- or name it:
type ReadHandler interface {
    Read(p []byte) (n int, err error)
    Read2(p []byte) (n int, err error)
}

or:
type ReadHandler interface {
    io.Reader
    Read2(p []byte) (n int, err error)
}

Demonstration working sample code:
package main

import (
    "errors"
    "fmt"
    "io"
)

func main() {
    s := my{[]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, []byte{10, 20, 30, 40, 50}}
    buf := make([]byte, 5)
    n, e := s.Read(buf)
    fmt.Println(n, e, buf)
    n, e = s.Read2(buf)
    fmt.Println(n, e, buf)
}

type ReadHandler interface {
    io.Reader
    Read2(p []byte) (n int, err error)
}

type my struct {
    buf  []byte
    buf2 []byte
}

func (t *my) Read(p []byte) (n int, err error) {
    if len(p) > len(t.buf) {
        return 0, errors.New("len(p)>len(buf)")
    }
    m := copy(p, t.buf)
    return m, nil
}

func (t *my) Read2(p []byte) (n int, err error) {
    if len(p) > len(t.buf2) {
        return 0, errors.New("len(p)>len(buf2)")
    }
    m := copy(p, t.buf2)
    return m, nil
}

Output:
5 <nil> [1 2 3 4 5]
5 <nil> [10 20 30 40 50]

3- name it:

Looking for a general solution to embed an interface (with any number
  of methods), twice in a struct.

type my struct {
    io.Reader
    Rdr2 io.Reader
}

or
type my struct {
    Rdrs []io.Reader
}

Comment: Thanks, but I'm looking for a general solution. You have assumed that I want to use `Reader` interface but that was just an example. Suppose we want to embed an interface (with any number of methods), twice in a struct.
Comment: @mahdix : see new Edit (item 3)

Go: How to embed same interface twice?


Server RAID and Partition Config for Small SQL Environment

Question: I've got 5 databases that run on separate servers using SQL Express. Some of these include a Citrix Datastore, Citrix Edgesite Server, an AV db, Time and Billing App, and a document management program. These all currently run on separate servers using SQL Express as mentioned.
I'm considering consolidating to one central SQL database to provide larger DB sizes and other benefits to the full SQL 2008 R2 platform. To save money I want to use a server with one quad core CPU using a per socket SQL license. The server I have is stocked with SATA drives.
How exactly should I partition/RAID everything to provide the best performance? Should all the DBs be on a single RAID set or all separated? Most configs I see seem to show recommendations for partitioning a server running only a single database.
Any guidance would be greatly appreciated.
Comment: get as much RAM as you can afford to hold the dbs in memory to try and avoid having to go to those slow SATA disks as much
Comment: More RAM gives you the most bang for your buck, but don't forget having many fast disks. More spindles = more IOPS.
Answer: Database storage configuration is more of an art than a science. Some simple guidelines:

Keep your logs and data on separate raid groups
Choose your hard drives carefully: if you expect a lot of IO, pick smaller drives with faster spindle speeds
Raid is not a backup. Just because you can hotspare a drive doesn't mean your database doesn't need to be backed up :P

What I see a lot is the log file on a small raid 1 or raid 10, and the data on a larger raid 10. Raid 5 and 6 will give you a performance loss (in terms of IOs per second, or IOPS) compared to some non-parity based types of raid (like raid 1 and 10). The tradeoff is that you get to use more than half the capacity you bought. If you have a decent hardware raid controller, the performance loss is manageable, however you'd want to use raid 6 for any large drives (900GB and up).
Answer: From a 50,000 ft view you want to have a separate mirrored pair for logs and a RAID-10 for data.  The cost of backup media will far outweigh the difference in cost of storage media between a RAID-5 or RAID-10 setup.
Chances are that with modern storage the disks are so big you will be more constrained by bandwidth than capacity.  If you are worried about the data volumes then you may well find that a RAID-10 provides the same I/O bandwidth with fewer disks.  This is quite likely to become an issue before storage space does, particularly if you're using SATA disks.
If you have more log traffic than a single RAID-1 can handle you can expand it into multiple RAID-1 log volumes or a RAID-10 volume.
Unless one database is a much bigger resource hog than the others they can all reside on the same data and log volumes, providing the volumes have enough disk bandwidth.  If you have one database with particularly heavy usage you may with to move it onto its own disk volume.
Answer: Smaller Drives + more spindles = faster read / write times for any Raid 5.  Separate info by types of data.  Launch the OS from a totally separate Physical and Logical volume.


Add custom class to a particular menu

Question: I need to know how to add extra class to a perticular menu.For example i have custom menu "menu-header-let",This menu is rendering like below,

Help

Home

home2

Now i want add extra class to the ul like below

I used phptemplate_menu_tree(), but i need different class for each custom menu.If is override menu theme and adding same class for all custom menu.
I have no idea how to add different class when different custom menu renders in drupal.
please help me.
Answer: Well, the code in tutorial that beth mentioned has bugs and does not work. The best solution I've found up to now is this:
<?php
function YOUR_THEME_menu_tree($tree) {
  if (preg_match('/A unique string in your menu/', $tree)) {
      return '
' . $tree . '
';
  } else {
    return '
'. $tree .'
';
  }
}
?>

You can use any unique path or link title as string to identify the menu. This solution was inspired by a comment in the cited tutorial.
Comment: You're right, the tutorial contains an infinite loop (see [this question](http://drupal.stackexchange.com/questions/53809/compare-two-menu-tree-objects)).
Answer: There's a tutorial just for you: http://programmingbulls.com/complete-drupal-6-menu-theming
Answer: I should agree that theming of menu items in Drupal sucks.
There is a module Menu Attributes which does just that. You can also add Id,Name, Target, Rel,Class,Style,Accesskey attributes to the particular menus.

Add custom class to a particular menu


Representation Theory book other than Fulton's

Question: Fulton/Harris's book on representation theory seems to be the "definitive" introductory text on the subject. But is there perhaps a lower level introduction to the subject? Most of the very first examples in F/H are well beyond my knowledge. Thanks.
Comment: Although not directly about representation theory, I found Sagan's 'The Symmetric Group', a good introduction to the basic theorems and ideas of Representation Theory. It doesn't begin to cover everything you need to know, but it does give you enough to approach texts like Fulton's Representation Theory much more easily. Moreover, it's a cheap textbook.
Answer: Etingof's representation theory notes are a standard, they are freely available online. These are pretty terse so they require some work, but they don't assume many prerequisites. I personally like the treatment of representations of groups in Dummit and Foote and would read that before anything else.
Answer: There is a nice little book on the representation theory of finite groups by Serre, Linear Representations of Finite Groups, ISBN 0-387-90190-6.
Else often books in (abstract) algebra contain at least an introduction of the subject of group representations.
Answer: I enjoy Ronald Shaw's Linear Algebra and Group Representations.
It, as the title suggests, introduces a lot of linear algebra and group theory as it goes along. For example, the first two chapters are basically a condensed course (or two) of linear algebra and the third chapter starts by covering a lot of group theory. The later chapters then develop more advanced linear algebra (concerning the orthogonal group, spin group and unitary group) followed by material on multilinear algebra.
All in all it is a thorough introduction to the subject with minimal prerequisites.
Answer: I thought Gordon and Liebeck's book, available free here:
http://empslocal.ex.ac.uk/people/staff/rt300/teaching/Res_Math_Sci/Representations_and_Characters_of_Groups.pdf
Was pretty nice. And, in a Cuil search, I even found a solution's manual:
http://www.mathematik.uni-kl.de/~taylor/PDF/jamesliebeck.pdf
Answer: A book by Benjamin Steinberg, Representation Theory of Finite Groups: An Introductory Approach is an introductory book as the title suggests.


No team selected for iOS build with VS Cordova tools

Question: I am building an app for iOS with the Visual Studio Tools for Apache Cordova CTP3.1 from VS 2013. I have setup the environment on my Windows and Mac machines and I can build and run the app if I select an emulator. However, if I select Local Device then I get the following error:

1>MDAVSCLI : Code Sign error : No code signing identities found: No
  valid signing identities (i.e. certificate and private key pair)
  matching the team ID ΓÇ£(null)ΓÇ¥ were found. 1>MDAVSCLI : CodeSign
  error : code signing is required for product type 'Application' in SDK
  'iOS 8.3'

I have set-up a developer certificate and signing identity with XCode.
If I open the XCode project (available in builds\buildid\cordovaApp\platforms\ios) and go to General tab for the project and look at Identity I can see that no team is selected there. But I do have a team that I can select from the combo.

I suppose the error occurs because the actual team is not selected (therefore this ΓÇ£(null)ΓÇ¥ in the error message). I have seen others having similar problems and told to set the team from here. However, I cannot do that, because the project file is generated with each build. I must setup this somehow from the VS Cordova tools. How do I do that?
Thank you.
Comment: Maybe this could help: http://stackoverflow.com/a/29956568/4815066
Comment: I think you should be targeting "Remote Device", rather than "Local Device".  If the device is connected to your Mac then it's a remote device.  What happens when you do that?
Comment: The problem seem to be with the signing identity. With an iOS Development certificate you can only build debug configs, and that works. To build release or distribution configs you need an iOS Distribution certificate, which is missing in my keychain setup.
Answer: Yeah, starting 4.3 of Cordova, the debug build requires a "development certificate" while Release & Distribution, both need a "distribution certificate" and matching provisioning profiles installed on the build machine. You can refer to the documentation that explains the process of getting these signing assets here.
Comment: Thanks for the link. I wasn't actually aware of that document. It's the kind of documentation one needs when starting with vs cordova tools, but it's what I've already found from various sources.
Answer: I think you you should  confirm you certification is revoke. if it is revoke ,you should delete the old ceitification, then import the new one.
Comment: I don't have a problem with that. My problem was that I didn't have the iOS Distribution certificate in the keychain.


Flying Saucer PDF not showing color

Question: I have an html that is converted into a PDF with FlyingSaucer that is not displaying any color.  the HTML is simple:

Label Information

and the css is:
 .pdfLabel {
text-align:center;
background:#033c73;
color:#FFF;
padding-top:4px;
padding-bottom:4px;
padding-left: 5px;
padding-right: 5px;
width: 98%;
font-weight:bold;
font-size: 15pt;
border-radius: 15px;
 }

what's weird is that some of styles work, the text-align, padding, font-weight, font-size all work just fine, but my world is in back and white. :(
any ideas?
EDIT:
here is the code that produces the PDF:
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    try {
        ITextRenderer renderer = new ITextRenderer();
        renderer.setDocumentFromString(viewHtml);
        renderer.layout();
        renderer.createPDF(os);
    } finally {
        try {os.close();} catch (Exception eClose) {}
    }

the viewHtml is the  string mentioned above.
Comment: You're going to have to show more code and possibly and example.
Comment: I've tried to reproduce your problem, but it works fine for me. The color is correct in the resulting PDF.
Answer: I had the same problem. We are using Bootstrap in our application, and it turns out that it was Bootstrap's print css that caused this for us. Colors in the PDFs worked when we removed those styles.

Flying Saucer PDF not showing color


Como capturar valor do input radio de um objeto com ajax?

Question: Minha duvida é a seguinte. Tenho um código em PHP que cria card para cada registro que traz do banco. Nâo estou conseguindo capturar o valor do radio que foi selecionado. Consigo capturar o valor somente do primeiro card, dos demais não consigo. segue meus códigos.
PHP que cria os card
if ($resultado_id) {

while ($registro = mysqli_fetch_array($resultado_id, MYSQLI_ASSOC)) {
    echo '

    '.$registro['nome'].'

     '.$registro['idProfissao'].'
     '.$registro['idProfissao2'].'

     '.$registro['idCidade'].'
     '.$registro['telefone'].'

    Status:
     '.$registro['disponibilidade'].'

    <form id="estrela" method="post" action="like.php">
    Avaliação:
    <input type="radio" id="cm_star-empty-'.$registro['id'].'" name="fb" value="" checked/>

    <input type="radio" id="cm_star-1-'.$registro['id'].'" name="fb" value="1"/>

    <input type="radio" id="cm_star-2-'.$registro['id'].'" name="fb" value="2"/>

    <input type="radio" id="cm_star-3-'.$registro['id'].'" name="fb" value="3"/>

    <input type="radio" id="cm_star-4-'.$registro['id'].'" name="fb" value="4"/>

    <input type="radio" id="cm_star-5-'.$registro['id'].'" name="fb" value="5"/>

     <button type="submit" class="btn btn-info btn-sm btn-like" id="btn-like-'.$registro['id'].'" data-id_usuario="'.$registro['id'].'">Avaliar</button>
    </form>

    ';
}

JavaScript que passa os valores via ajax

OBS
Tentei no lugar de:
var estrela = document.querySelector('input[name="fb"]:checked').value;

Colocar:
var estrela = $(this)("input[name='fb']:checked").val();

Mas não funciona.
Comment: Tentou, var estrela = $("input[name='fb']:checked").val(); ?
Comment: Calma ae, esse alert é do retorno q traz o ajax?
Answer: Basta mudar o:
var estrela = $(this)("input[name='fb']:checked").val();

Para:
var estrela = $("input[name='fb']:checked").val()

Estava errado a forma como estava chamando.
Segue um exemplo funcionando:

function getRadios(){
    var radios = $("input[name='fb']:checked").val()
    alert(radios);
}

<input type="radio" id="cm_star-1-1" name="fb" value="1"/>

<input type="radio" id="cm_star-2-2" name="fb" value="2"/>

<input type="radio" id="cm_star-3-3" name="fb" value="3"/>

<input type="radio" id="cm_star-4-4" name="fb" value="4"/>

<input type="radio" id="cm_star-5-4" name="fb" value="5"/>

<button onclick="getRadios()">pegar selecionado</button>


Oxyplot BarSeries format function

Question: I need to format the label inside the BarItem so it can have a time format, like 00:10.
I'm using the BarSeries.Format function, but if I don't use the BarSeries.LabelFormatString the labels don't show and if I use  LabelFormatString all labels will have the same format/values.
Here's my code:
BarItem baritem = new BarItem {Value = 10};  //in seconds
Object[] time = new object[2];
time [0] = "00";
time [1] = "10";
barSeries.Format("{0}:{1}",baritem,time);

With this code it shows no labels. Using barSeries.LabelFormatString = "{0}" shows 10.
I've tried barSeries.LabelFormatString = barSeries.Format("{0}:{1}",baritem,time) but then all labels became the same...
Answer: For someone that had the same problem, the solution is simple, just subclass the BarItem Class, like this:
class TimeBarItem : BarItem {
  public TimeSpan Time { get { return TimeSpan.FromSeconds(this.Value); } }
}

After that we can do:
barSeries.LabelFormatString = "{Time}"

Oxyplot BarSeries format function


Proxy Plesk through apache alias

Question: I have a VPS that I installed Plesk into. It has an external IP but only ports 22,80,443 are allowed through the firewall. Plesk uses port 8443 so currently the only way to access it is to tunnel through SSH.
Is it possible to use a Alias to proxy to the plesk panel? Similar to the way phpmyadmin works. All articles I've read so far have you setup a domain, subdomain, create a vhost.conf file and forward through that. I'd prefer to access the server directly using https://Server_IP/plesk
Comment: [Administration panels are off topic](http://serverfault.com/help/on-topic). [Even the presence of an administration panel on a system,](http://meta.serverfault.com/q/6538/118258) because they [take over the systems in strange and non-standard ways, making it difficult or even impossible for actual system administrators to manage the servers normally](http://meta.serverfault.com/a/3924/118258), and tend to indicate low-quality questions from *users* with insufficient knowledge for this site.
Answer: I'm afraid I'm not au fait with plesk, but yes it may be possible that you cannot use it through an alias. Why? It depends on how it handles it links. It may expect to be the only thing on a domain and if it does, the links it generates may be absolute links. i.e. links start with a "/"
Your safest bet is to use a domain name. If you're worried about potential problems with DNS, you can always stick an entry into your hosts file on your own machine to overcome DNS problem if / when they should arise.
However, you can always try it:
<code>SSLProxyEngine on
ProxyRequests off
ProxyPass        /myalias/ https://184.108.40.206:8443/
ProxyPassReverse /myalias/ https://126.96.36.199:8443/
</code>
Comment: Almost there. I've added that bit of code to the /etc/httpd/conf/zzSA...conf.

But I'm getting a file not found login.php3 error.
Comment: This could be because the Plesk is simply not setup to do such a thing, I'm afraid I don't know enough about it, but as explained above, it's a distinct possibility (most apps wouldn't be!)

Proxy Plesk through apache alias


Chats Google: Exibir total acima da coluna e grid mostrar 1 a 1

Question: Tenho o seguinte chart:

Preciso exibir as linha de 1 a 1 e exibir o numero também do total no topo da coluna.
Sei que os dois darão o mesmo resultado, e que tenho 2 situações diferentes,pois em 1 caso terei que mostrar o total e no outro mudar a quantidade das linhas.
Estou usando o seguinte chart:
https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart
Answer: Para exibir os dados de um em um, você precisa personalizar o vAxis. Exemplo:
vAxis: {
    viewWindow: {
         min: 0,
         max: 10
     },
     ticks: [0,1,2,3,4,5,6,7,8,9,10]
},

E para exibir o número do total no topo da coluna, dentro das options coloque uma annotations com alwaysOutside: true:
annotations: {
    textStyle: {
         fontSize: 12,
    },
    alwaysOutside: true
}

Código exemplo completo:
google.charts.load("current", {packages:['corechart']});
google.charts.setOnLoadCallback(drawChart);

function drawChart() {
      var data = google.visualization.arrayToDataTable([
        ["Element", "Density", { role: "style" } ],
        ["Copper", 5, "#b87333"],
        ["Silver", 7, "silver"],
        ["Gold", 9, "gold"],
        ["Blue", 3, "blue"],
        ["Red", 2, "red"]
      ]);

      var view = new google.visualization.DataView(data);
      view.setColumns([0, 1,
           { calc: "stringify",
             sourceColumn: 1,
             type: "string",
             role: "annotation" },
            2]);

      var options = {
           title: "Teste Column Char",
           width: 600,
           height: 400,
           bar: {groupWidth: "95%"},
           legend: { position: "none" },
           vAxis: {
                viewWindow: {
                    min: 0,
                    max: 10
                },
                ticks: [0,1,2,3,4,5,6,7,8,9,10]
           },
           annotations: {
                textStyle: {
                   fontSize: 12,
                },
                alwaysOutside: true
           }
     };

     var chart = new google.visualization.ColumnChart(document.getElementById("columnchart_values"));
     chart.draw(view, options);
}

Veja funcionando no JSFiddle.


Find an example of functions $\int _1^{\infty }f(x)dx$ and $\int _1^{\infty }g(x)dx$ which converge, but $\int _1^{\infty }f(x)g(x)dx$ diverges

Question: I was going over some practice questions for an upcoming calculus exam and I came across this question: "Give an example of two functions $f(x)$ and $g(x)$ such that $\int _1^{\infty }f(x)dx$ and $\int _1^{\infty }g(x)dx$ both converge respectively, but $\int _1^{\infty }f(x)g(x)dx$ diverges." I am having a very difficult time with this question and cannot find a good answer. I've tried with polynomials, trigonometric functions, and exponential functions with no avail.
Comment: Also: https://math.stackexchange.com/q/3329279/42969.
Comment: The functions $f(x)$ and $g(x)$ can have bumps in their graphs as $x \to +\infty$ that are high but at the same time narrow enough that they don't prevent $\int f$ and $\int g$ from converging. If you pick the bumps in $f$ and in $g$  to be in the same places, then on multiplying $f$ and $g$ they may become so high that now $\int fg$ doesn'r converge.
Comment: The question doesn't required boundedness of the functions.  Let $f(x)=g(x)=\frac{1}{\sqrt{x-1}}$ for $1\le x\le 2$ and $=0$ otherwise.
Comment: For example, let $f=g=\sin(x)/\sqrt{x}$.
Comment: $\sin(x^2)$ definitely works by itself. $\int_0^{\infty}\sin^2(x^2)$ does not converge
Answer: Set f(x) = g(x) such that they are $n^2$ on each interval $[n,n + 1/n^{4}]$ and zero otherwise.
Comment: Did you read [How to write a good answer](https://meta.stackexchange.com/help/how-to-answer)?


Getting QueryString from with a module

Question: I've trying to get the querystring from within a module.
I've tried the following.  However the following always returns A
exporter/directory?l=o
$l = "A";
if ( !empty($_SERVER['l']) ) {
    $l = $_SERVER['l'];
}

/* edit */
    $l = "A";
if ( !empty($_GET ['l']) ) {
  $l = $_GET ['l'];

}

Answer: Oswald is correct. Alternatively, in Drupal 7, you can use drupal_get_query_parameters():
$query_parameters = drupal_get_query_parameters();
if (!empty($query_parameters['l'])) {
  $l = $query_parameters['l']
}

Answer: The query string is stored in $_SERVER['QUERY_STRING'], the same way as when not using Drupal. You can access the individual variables of the query string using the $_GET array, the same way as when not using Drupal (with one exception: $_GET['q'] is the canonical Drupal path, not the one assigned using the Path module).
Comment: thanks just changed above. Is there any reason the $_GET shouldn't work above? This is inside my module page function.

Getting QueryString from with a module