Question about complex value functions

Question: Given a function from the extended complex plane to itself by $$f(z)=e^{i\theta  }\left(\frac{z-z_0}{z-\bar{z_0 }} \right)$$ where $\theta $ is real and $z_0 $ is in the upper half plane.
I am trying to show that $f$ maps the upper half plane onto the open unit disc and the real line to the unit cirlce.
To do this I wrote $$f(z)=e^{i\theta } \left( \frac{|z|^2-2z_0 \text{Re}(z)+z_0  ^2 }{|z-\bar{z_0}|^2 } \right).$$
Not sure how to proceed from here.
Answer: Start with $|f(z)|\le 1$ for all $z$.  Then $|f(z)|=1$ for real $z$. Finally show $(z-z_0)(z-\bar{z_0})=re^{ia}$ assumes all values of $a$ in range $(0,2\pi)$ for real $z$.
Comment: I switched up my approach. I let $z=x+yi$ and $z_0=a+bi $ and then I got $$|f(z)|^2 =1-\frac{4by}{(x-a)^2+(y+b)^2 } $$ so I can see why $|f(z)|<1 $ when $b>0$ but how to show it maps surjectively?
Answer: Here is a geometric vision.
Preliminary remark:
Let $M_0$ be a point of the upper half plane, $M'_0$ its symmetrical point wrt the real axis.
Saying that $dist(M,M_0)<dist(M,M'_0)$ ($M$ is closer to $M_0$ than to $M'_0$) is equivalent to say that $M$ belongs to the upper half plane.
(said otherwise, the real axis is the perpendicular bissector of line segment $[M_0,M'0]$, and point $M$ is on "the upper side" of it).

Let us concentrate now on
$$F(z)=\frac{z-z_0}{z-\bar{z_0 }} $$
(because the final multiplication is associated with a rotation that clearly will not impair the fact that we are in the unit disk).
We have to show that $F(z)$ belongs to the unit disk.
This will be done by taking the module
$$|F(z)|=\frac{|z-z_0|}{|z-\bar{z_0}|}<1$$
which amounts to say that (by associating $M_0, M'_0$ with $z_0,\bar{z_0}$, resp., with $M'_0$ symmetrical of $M_0$ wrt $x$ axis.)
$$\frac{dist(M,M_0)}{dist(M,M'_0)}<1 \ \iff \ dist(M,M_0)<dist(M,M'_0)\tag{1}$$
and we are in the situation depicted in the preliminary remark.
We have thus proved the "on" part. It remains to show that this "on" is in fact an  "onto", by showing that every given $Z$ in the (open) unit disk is reached i.e., that there exist a (unique) z such that
$$Z=\frac{z-z_0}{z-\bar{z_0 }} $$
This indeed gives rise to a first degree equation in variable $z$, with solution:
$$z=\dfrac{Z \overline{z_0}-z_0}{Z-1}$$
Remark: The frontier cases (real axis mapped onto unit circle) are obtained by replacing all $<$ sings by $=$ signs in the previous discussion.

Question about complex value functions


Reusing existing content types for very similar content

Question: Let's say I have n categories of "means of transport" I need to display on my site (aircrafts, cars, bikes...). They share a lot of attributes like "name", "weight", "manufacturer" etc. But each of them also has a small number of distinct attributes that they do not share with others (e.g. only an aircraft has an attribute "wingspan").
I've addressed this myself and seen this issue in related questions here, here and here (and many more) and I do understand that opinions vary as there is (probably) no definite right or wrong answer.
However, I'm still wondering if there exist Drupal-based pros and cons (in terms of performance, maintainability) instead of pure personal preferences for planning your content model one or the other way.
Approach 1: My first thoughts were similar to the following approach, which does not appear to be the optimal use case for the paragraphs module:

1 content type "means_of_transport" with a set of basic fields (name, manufacturer, weight...) that are shared by all.
1 field that references a taxonomy X with terms "bike", "car", "aircraft"... to tag each piece of content.
n fields that each reference a different paragraphs type, containing all the fields that are specific to a certain piece of content (e.g. the "wingspan" & "call_sign" compound field for aircrafts)

This results in 1 content type with n paragraphs types. As Hudri and Kevin already pointed out there does not seem to be much benefit in just shifting the complexity from content types to paragraphs types.
Approach 2:

n content types "bike", "aircraft"... with all the attributes
(fields) that are shared between them being reused, so that you don't
need to create a new field for "name", "weight" etc. each time, but
also each content type having a few unique fields that are specific
to it.

Let's say I'll go with approach 2 and n=50 content types and each means of transport only has 1 unique attribute, all the other ones are shared and their fields could be reused. To me that seems very inefficient and often you read one should try to reduce the number of content types when planning your site. But maybe that's the Drupal way to do it and by reusing most of the fields you do not create too much overhead anyway.
Is there any other possible solution to "reuse existing content types with different fields" as also indicated in this answer by Jaypan?
Again, I'm interested in facts that support one or the other approach (and I'm aware they might not exist at all and it comes down to personal taste).
Comment: Option 1 with paragraphs seems the cleanest to me. With the multiple content types method if you need to do changes that are common across all types you'd have to repeat yourself loads of times. So if this was me, I'd do option 1 as you suggest with 1 content type. Then you could potentially not need the taxonomy term part but instead have a paragraph field that allowed the user to select different paragraph types e.g. "Bike" with all its bike fields.Or "Plane" with all its plane field. Then just by looking at what paragraph was chosen will tell you what type it is. So no need for the taxonomy
Answer: Nodes are a generic entity, with each bundle (content type) being it's own type (ie - a means of transport). This is too generalized. As such, I would say that this is a case for a custom entity, rather than nodes. Your custom entity would be means of transport. You would then create base fields on the entity type for the fields common to each means of transport. You would then create bundles (which for nodes, are known as 'content types') for each separate means of transport (car, plane, bicycle etc) and add means-specific fields to the bundle.
Answer: You could use one content-type and as many fields needed to define all the unique features of each transport type.
Obviously, not all the fields will make sense for all type transports at that point.
Then you can use Conditional Fields module to organize availability of each fields based on the entries on the fields as you enter.
From the module description:

Conditional Fields allows you to manage sets of dependencies between fields. When a field is "dependent", it will only be available for editing and displayed if the state of the "dependee" field matches the right condition.
  When editing a node (or any other entity type that supports fields, like users and categories), the dependent fields are dynamically modified with the States API.
  A simple use case would be defining a custom "Article teaser" field that is shown only if a "Has teaser" checkbox is checked, but much more complex options are available.


Drumming rudiments & distribution

Question: I have recently gotten into rudiments in order to gain better grip control.  My practice pad works great for this and I can sit and watch tv or listen to music while going over the 40.
This has me wondering though, once my hands are used to these patterns, how do I apply them across the kit?  I'll say off the bat I'm not the most creative drummer so banging across back and forth doesn't really come naturally to me :)
Comment: 1. I wouldn't do this while watching TV because you're going to benefit more by listening carefully to what you're doing. 2. I don't think that applying rudiments on the drum set is the best way of extending your creativity on the drum set.
Comment: I'll just drop by and say that I've never heard of a drum-and-cymbal paradiddle. (I suspect all paradiddles are on one drum only, most likely a snare drum. ...But I guess toms are also a possibility?)
Comment: Paradiddles can run across anything, they're not limited to one surface. I haven't a clue how to teach anyone to do this, but I found a YouTube tut - https://www.youtube.com/watch?v=hHk7oChT4Ik Somewhere on there is one of the all-time greats doing this as a masterclass… but I can't remember who it is, so my google-fu failed :\
Comment: @Tetsujin - there's a great paradiddle lesson on youtube, Drumeo, given by Dorothea Taylor.
Comment: @Dekkadeci Actually the snare and cymbal or snare and hi hat are the basis of a lot of Dave Garibaldi's grooves in Tower of Power. It's also referred to as the King Kong beat. He credits Zigaboo, the drummer from The Meters and Pete DePoe from Redbone for the concept. Here's a great video where he breaks it down: https://youtu.be/JIemsK_0lXc
Comment: I've often thought for more realistic practice, using two, even three practice pads is more realistic. They would give some spaciality to your practice, just as you'd need on a real kit. Just gotta work out how they would be as cymbals!
Comment: @Dekkadeci I'm quite sure Thomas Lang plays pretty much every rudiment that exists on pretty much any combination of drums though ...
Comment: I'm sceptical that there are actually 40 rudiments. A lot of them are extensions of other rudiments. One day. I'm going to take some time to condense rudiments down to their component forms!
Comment: @Lazy - As in Lang hits the "pa" on a snare drum, then the "ra" on a high tom, then the "di" on the snare drum again, and finally the "ddle" on a low tom?
Answer: There are many ways to do it. It depends on many factors, like:

your actual skill level (confine yourself to what you mastered by today)
genre
kind of rhythmic feel to convey
etc.

Let's assume you practiced a paradiddle like RLRL LRLR. What can you do with it? (This holds for any other drum pattern besides paradiddles, too)

The obvious choice: all on-snare.

Variation on-snare: change accents, e.g. Rlrl lRlr.

Assign each hand to one drum/cymbal:

R = Tom, L = Snare
RLRL LRLR => TSTS STST
or L = Cymbal, R = Snare
RLRL LRLR => SCSC CSCS

You may also want to have a look at linear drumming, where you only hit one drum/cymbal at a time, e.g. split for L and R:

R: HT - LT - | -  CY -  CR

L: - SN - SN | SN - HT  -

You may want to decide wrt. HiHat and BassDrum to

include them in these distribution schemes
separate them, i.e. let them run in their steady pattern

And many more: just "walk around" the drumset.
Answer: The 40 standard drum rudiments (as listed by the Percussive Arts Society) make more sense in the context of "rudimental drumming"- think concert snare drum, drumlines (both corps-style and HBCU).  They weren't compiled for the drumset.  That isn't to say that you shouldn't learn them (they are great for developing coordination), or that can't use them, but applying all the rudiments to the drumset is probably not the best way to expand your drumming.  (I don't know what kind of music you're trying to play here).
Rudiments like the ratamacue, flam drag, triple stroke roll- I would only use that if I were trying to imitate the style of a rudimental drummer on the snare, or perhaps just trying to play something fast and weird for a drum solo.  It's totally not idiomatic for the music I play.  I believe that for drumset, by far the most useful rudiments are the single stroke roll, paradiddle (and all its variants), and flam (+ flam tap, flam accent).
Here's a few ways drummers commonly incorporate these rudiments-
Diddle rudiments effectively let you switch hands during a continuous string of notes.  For example, if you wanted to play RlrlRlrlRlrlRlrlr, but you also wanted the third accent to be on the left hand (maybe to hit an extra tom off to your left)- You can incorporate paradiddles (RlrlRlrrLrllRlrl).
They also let you conserve energy in fast continuous 16th note rhythms with accents (RlrlRlrlrlRlrlrl vs RlrlRlrrllRlrrll or RlrrLrllrrLrllrr).
Flams let you add a note on another piece of your set without breaking up the main rhythm.  For example, if you were playing a "march" style rhythm on the snare, and you wanted a crash cymbal on the downbeat, but didn't want to interrupt the march to hit the crash, I could play the crash as a "flam" with the grace note still on the snare.  Note that flams in a rudimental setting are normally played with the grace note slightly before the beat, and often with a grace note quieter than a typical tap.  When used on a drumset like I described, the grace note should fall exactly on the beat and be the same dynamic level as the other taps.
The multiple bounce roll does get used on the drumset, but typically only on the snare.  Same with the double stroke roll, although this one translates to cymbals well too.
The n-stroke rolls are just extensions of the double stroke roll in my mind.  Play the roll on a snare and the accented note on any other piece of the kick (probably a crash cymbal+kick).
Answer: When I took drum lessons as a kid one teacher used a book called "Traveling Around the Drums Rudimentally".  As I recall it had fills an solos written out using most of the rudiments... although there were only 26 rudiments at that time!
It's long out of print, but maybe you can find a copy.  It does have an Amazon page: Traveling Around the Drums Rudimentally

Drumming rudiments & distribution


Expose Custom Form in Block

Question: A form was created with codes in a custom module, with three items that must be filled. After submission, the code will do it's magic and return the result on the same page, below the form.
I'll like to have the form alone in a block so that it can be placed anywhere on the websites and when filled from there, it will redirect to the main page and show the results.
I don't know which way to go please.
Answer: First thing you have to do is to move the form into it's own block. That will require a hook_block_info(), to define the block, and hook_block_view(), to create the content of the block.
https://api.drupal.org/api/drupal/modules%21block%21block.api.php/function/hook_block_info/7.x
https://api.drupal.org/api/drupal/modules%21block%21block.api.php/function/hook_block_view/7.x
Define the block:
function my_module_block_info() {
  $blocks['your_block'] = array(
    // info: The name of the block.
    'info' => t('Your Block Name'),
  );

  return $blocks;
}

Then create the content. You can use another function that contains the form.
function my_module_block_view($delta = '') {
  // This example is adapted from node.module.
  $block = array();

  switch ($delta) {
    case 'your_block':
      $block['subject'] = t('My Form');
      $block['content'] = drupal_render(drupal_get_form('my_module_myform_form'));
      break;
  }
  return $block;
}

function my_module_myform_form() {
  // Your form will go here.
  $form['my_value'] = array
  (
    '#type' => 'select',
    '#options' => array('' => '---', 1 => t('One'), 2 => t('Two'), 3 => t('Three')),
    '#required' => TRUE,
  );
  $form['submit'] = array
  (
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}

Next is to create a submit callback which redirects to your page. You don't need to register the callback. Drupal looks for the form function name with '_submit' appended.
function my_module_myform_form_submit($form, &$form_state) {
  $form_state['redirect'] = 'some/path/' . $form_state['values']['my_value'];
}

And then we need to create the page:
function my_module_menu()
{
  $menu['some/path/%'] = array
  (
    'title' => 'My form submitted values',
    'page callback' => 'my_form_submitted_value_callback',
    // array(2) will pass the value of the wildcard to the callback function
    'page arguments' => array(2),
    'access callback' => TRUE,
  );
  return $menu;
}

function my_form_submitted_value_callback($submitted_value)
{
  return t('The value you submitted was: @value', array('@value' => $submitted_value));
}

If you need more than one value, there are more methods on this page like using $_GET and session variables:
https://www.drupal.org/node/1990276
Sources:

Form within a block
https://www.drupal.org/node/2064545
https://www.drupal.org/node/1990276
How to create a new block programmatically?

Expose Custom Form in Block


Convexity Of The Boundary Of Bounded Open Convex Sets

Question: $\;\;\;\;$ Assume $n>1$ and $U$ is a non-empty bounded open convex subset of $\Bbb R^n$. Is it possible that the boundary $\partial U$ of $U$ is also convex or must it be the case that $\partial U$ is not convex ?
$\;\;\;\;$ My intuition immediately says no. The question was asked by Cathy, but with no mention of openness, boundedness or dimension, and answered today in the affirmative by Achille Hui and Paul Frost using the open interval $(0,\infty)$ in the case $n=1$.
Comment: Look at a half-space. It is the same example, just multiply by the extra factors. $(0,+\infty)\times\mathbb{R}^{n-1}$. Its boundary is the subspace $\{0\}\times\mathbb{R}^{n-1}$.
Comment: Could it also be bounded? Take into account [this](https://en.wikipedia.org/wiki/Krein%E2%80%93Milman_theorem).
Comment: Well, the proof is not so simple. If the set is bounded, then its closure is convex and compact. By Krein-Milman, its boundary's closed convex hull is the entire set. But if the boundary is convex, then the set is its own boundary. This cannot be for a set with non-empty interior.
Comment: @conditionalMethod. Thank you for the simple generalization. I was imagining a bounded open convex set (non-empty). It seems clear to me in $\Bbb R^1$ that the boundary is not convex and intuitive for me in $\Bbb R^n$ but I want a simple proof.
Comment: @Matthew Daly. Sorry about the confusion. I am indeed asking a different question.
Comment: @conditionalMethod. Thanks. I think that was pretty straightforward even though you employed the Krein-Milman Theorem.
Answer: Choose $x$ be a point on the interior of $U$ (since it was given to be open and nonempty, it must have a non-empty interior).  Consider any line $\ell$ that passes through $x$.  This line must intersect $\partial U$ on each side of $x$ since $U$ is bounded.  Choose $y,z$ to be such points on either side of $x$.  Then $y,z\in\partial U$, but $[y,z]\not\subset\partial U$ since $x\in[y,z]$ and $x\not\in\partial U$.  Therefore $\partial U$ is not convex.


Error with icons in UE4 AR(Kit) development for iOS

Question: I want to compile the ARKit project for iOS on Windows. I intalled VMWare with Mac OS 10.15 Catalina. Also I installed XCode and accepted the license agreement. But when I'm starting compiling I get this error:
P.S. here is smaller log (it has only 1 line of error instead for every icon)
<code>   UATHelper: Packaging(iOS): 2019-11-25 20:42:57.845 IBCocoaTouchImageCatalogTool[917:9978] Unable to get image dimensions for file:///firstname.lastname@example.com
   UATHelper: Packaging(iOS): 2019-11-25 20:42:58.072 IBCocoaTouchImageCatalogTool[917:9998] CoreThemeDefinition: Unable to create image for file:///Users/damir/UE4/Builds/DESKTOP-DOB5C9P/D/Projects/UE4_Projects/ARTatar/Intermediate/IOS/Resources/Assets.xcassets/AppIcon.appiconset/IPadIcon20.png
UATHelper: Packaging(iOS): /* com.apple.actool.errors */
UATHelper: Packaging(iOS): /Users/damir/UE4/Builds/DESKTOP-DOB5C9P/D/Projects/UE4_Projects/ARTatar/Intermediate/IOS/Resources/Assets.xcassets: error: Distill failed for unknown reasons.
UATHelper: Packaging(iOS): /* com.apple.actool.document.notices */
UATHelper: Packaging(iOS): /Users/damir/UE4/Builds/DESKTOP-DOB5C9P/D/Projects/UE4_Projects/ARTatar/Intermediate/IOS/Resources/Assets.xcassets:./AppIcon.appiconset/[][ipad][76x76][][][1x][][]: notice: 76x76@1x app icons only apply to iPad apps targeting releases of iOS prior to 10.0.
UATHelper: Packaging(iOS): /* com.apple.actool.compilation-results */
   UATHelper: Packaging(iOS): /email@example.com
UATHelper: Packaging(iOS): /Users/damir/UE4/Builds/DESKTOP-DOB5C9P/D/Projects/UE4_Projects/ARTatar/Binaries/IOS/Payload/AugmentedImages.app/Assets.car
UATHelper: Packaging(iOS): /Users/damir/UE4/Builds/DESKTOP-DOB5C9P/D/Projects/UE4_Projects/ARTatar/Intermediate/IOS/Resources/assetcatalog_generated_info.plist
   PackagingResults: Error: Distill failed for unknown reasons.
UATHelper: Packaging(iOS): [Remote] Downloading C:\Users\DAM1R\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Unreal+Engine+4+UE_4.23\UBT-AugmentedImages-IOS-Development_Remote.txt
UATHelper: Packaging(iOS): Total execution time: 196,01 seconds
UATHelper: Packaging(iOS): Took 198,6845239s to run UnrealBuildTool.exe, ExitCode=7
UATHelper: Packaging(iOS): UnrealBuildTool failed. See log for more details. (C:\Users\DAM1R\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+Unreal+Engine+4+UE_4.23\UBT-AugmentedImages-IOS-Development.txt)
UATHelper: Packaging(iOS): AutomationTool exiting with ExitCode=7 (7)
UATHelper: Packaging(iOS): BUILD FAILED
   PackagingResults: Error: Unknown Error
</code>
And full log is here:
https://uengine.ru/forum/viewtopic.php?f=28&t=67350
Answer: Updating Mac OS and XCode fixes this.
Updating to 11 XCode and 10.15.2 Mac OS Catalina, for instance, fixes this issue.


changing the default port of Mcrosoft SQL Server

Question:
Possible Duplicate:
port number of SQL Server

Can any one guide me on How can I change the default port of Microsoft SQL Server in my Windows VPS?
I am using Windows 2008 as my operating System and Microsoft SQL 2008 in my VPS
please help me asap.
Comment: Before asking a question like this be sure to search the internet and ServerFault.  This is a common question and is well documented throughout the internet.
Answer: If you want to change alternative port for MSSQL remote access, please perform following steps :
Go to Start -> Programs -> Microsoft SQL Server -> Configuration Tools -> SQL Server Configuration Manager.
Under SQL Server Network Configuration -> Protocols for SQLEXPRESS -> TCP/IP -> under protocol tab Enable it.
-> Under IP Address Tab give Port Number in front of TCP Port field.
Click on Apply & OK.
Restart SQL Services.
Now you can login to your SQL Server using your given port.
Hope this helps you.
Answer: If you open Sql Server Confirguration Manager on the VPS (Start -> All Programs -> Microsoft SQL Server XXXX -> Configuration Tools -> SQL Server Configuration Manager).
Expand Native Configuration and select Client Protocols and then right click on TCP/IP on the right hand side.
Change the value in default port to whatever value you want it to be instead, apply and restart your SQL server.


Rearrange Formula with Division

Question: Could someone please help explain to me how I would solve this formula to get 'C1'?
$2000 = \frac{1.44}{1000+(2*47000)*C1}$

What I understand:
I understand rearranging formula with fractions when they are basic ones like:
$x= \frac{a}{b}$ where you would multiply by 'b' and divide by 'x' giving you : $b= \frac{a}{x}$
How I struggle:
But I do not understand how to do that in a situation like this.  If you divide by C1  you would get $\frac{2000}{C1}$ on one side but then how does the division work? Would you divide by 2000? and would that divide the whole other side by 2000? such as: $C1= \frac{(\frac{1.44}{1000+(2*47000)})}{2000}$
I also saw on a tutorial that you can swap the sides and make it: $1000+(2*47000)*C1= \frac{1.44}{2000}$ but I am still stuck on how to continue to divide when there is already division.
Any explination or better methods to solve this would be greatly appreciated thank you.
Comment: Multiply both sides by the whole denominator on the right.  That will clear the fraction.  Now you have a linear equation.
Comment: No, the right side becomes $1.44$  The left becomes $2000\cdot (1000+2\cdot 47000\cdot C_1)$.  I said the whole denominator.
Comment: Now you just unpack the $C_1$.  You can divide both sides by $2000$ (not $22000$), then subtract $1000$, then divide by $94000$
Comment: Would that mean make it 1.44/95,000*C1? and then multiply both by 95,000? making it: 2000*(95,000*C1) = 1.44?  Thank you for the reply.
Comment: Ok thank you, would you mind explaining how to solve for that?  Would it become: 22000*(1000+94,000*C1)? how do you move forward here?
Answer: Let $2000 = \frac{1.44}{(2*47000)C_1)}$. We can rewrite the fraction with whole numbers rather than decimals to make it simpler, therefore: $\frac{1.44}{2 * 47000C_1 + 1000} = \frac{36}{25(94000C_1 + 1000)}$.
Re-substitute and take the reciprocal we should get:
$2000 = \frac{36}{25(94000C_1 + 1000)} \implies \frac{1}{2000} = \frac{25}{36}(94000C_1 + 1000)$.
Multiplying both sides by $\frac{36}{25}$ gives us $94000C_1 + 1000 = \frac{9}{12500}$ and subtracting by $1000$ and dividing both sides by $94000$ should give you:
$C_1 = -\frac{
12499991}{1175000000} \approx -0.01$
Comment: Thank you for the very detailed explination and you definitely found the answer to solve for C.  unfortunately I think your process may be above my level.  I didn't understand how you got  36/25(94000C1+1000) in your first step and therefore I couldnt follow after.

Rearrange Formula with Division


Why does 'pkill /?' kill my SSH session?

Question: After running the following commands (bash) as root via SSH:
    pkill --help
    pkill -h
    pkill /?

The first two commands didn't provide me any information, that's why ran the third (kinda instinctively...).
What happened next is that my SSH session to the server closed, and it wouldn't reconnect. I'm guessing that it stopped all (or most of) the running processes, including the daemon in-charge for such sessions.
I would like to understand why this happened: What is the exact evaluation (step-by-step) of my input and what did it cause.
My best guess is that it has something to do with the shell's evaluation of the '?' character, which probably translated to a list of a few single-character expressions which were passed on to pkill, which in turn closed these PID's.
Comment: The command you were looking for was `man pkill`. :)
Comment: @scooz As a general rule, unix commands _almost never_ accept `/?` as a help command. Typically this also applies separately - they almost never use `/` for switches (`-` or `--` are more common), nor accept `-?` for help [though there are a few that do that IIRC]
Comment: Just wanted the basic usage, not the "entire man page", so it was kind of an instinct. However, when you play with fire, you just might get burned :)
Answer: On CentOS 5.2, the man page provided by running man pkill says it would interpret the /? as an extended regular expression for process names or command lines.
So the ? means the previous caracter may or may not appear. Since there was only one other character, the /, then pkill killed every process it could.
On linux systems, try to remember the man command to get documentation first.
Comment: @ablackhat Actually, it will match everything, since the "/" is optional in the process name.  You can use any other character followed by a "?" and get the same result: your matching logic will basically be "process name has character A or it doesn't have A", which is always true.  Run `pgrep -l /?` to see the names also; you'll find that these don't have "/" in the name.  `pgrep` doesn't match on the same things that your `ps auxw | egrep /` will, as `ps auxw` will show executable paths, which will have "/" in them.
Comment: @scooz, No, most of the process names don't include "/" at all.  As said, run `pgrep -l /?` to see this. Or, for that matter, `pgrep -l a?`.  You'll see that it'll match sshd, which obviously doesn't have an "a" in it, much less "/".  It's more the logic of the regex: the name is required to "have that character or not have that character", i.e., the conditional will always return true.  Actually, more in terms of how the regex docs are written: the name will have 0 or 1 "/" characters in it, as specified by the "?" modifier.
Comment: The '/?' evaluated to / (see http://www.regular-expressions.info/reference.html). Try running `ps awux | egrep /` and see what it matches. Almost everything. `pkill` pretty much does the same match, takes the PIDs and kills them.
Comment: You want to be very careful in a script that a variable argument is not empty: `pkill "$emptyvar"`
Comment: So '/?' evaluates to either '/' or ''. Why does this result in killing every process possible?
Comment: So it's because the `pgrep` or `pkill` pattern parameter also matches the process names or command lines (as mentioned in the man page). Since most commands include the `/` character (include paths), processes are matched almost all the time. Thanks
Comment: Actually, shouldn't "pgrep /?" return "pgrep: No match." because the shell interprets '?' before pgrep can?
Comment: @barrycarter, It did something like that when I tried `pgrep /*` (the shell evaluated multiple files under directory `/` and sent them as arguments to pgrep), but not with `/?`. I think its because the shell doesn't find any results for the `/?` evaluation, so it leaves it as is, and it is passed on to pgrep.
Comment: @scooz Hmmm, your shell settings might be different than mine. I actually ran the command and got "pgrep: No match". I think my shell settings (I'm using tcsh, BTW) abort a command when there's no match? When I do "pgrep /*" it gives me back a usage message, since pgrep accepts only one argument...
Answer: Run pgrep /?...
That will return the PIDs of processes matching that shell pattern. Running pkill with the same parameter will kill everything listed in the pgrep /? output.
I think you were killing your own session, as well as a number of other processes (all PIDs, in this case).
Comment: I'll remember to pgrep something in the future before running pkill :). However, see my comment to becomingwisest's answer - why does it evaluate to all the processes?
Comment: It does, at least on my system.  You just can't kill everything, and `pkill` won't be able to kill anything after it kills itself.
Answer: The syntax of command line expressions of /switch1 /switch2 is a Windows/DOS thing. On Linux, and all UNIXes I know off, the command line argument syntax is --switch -s. /? is being thought of as a regular expression. The regular expression /?, at least as far as I can tell from grep's man page, would match 0 or 1 /es. That doesn't seem to explain why that would kill SSH, but it does explain what happened.


How to change the order of content types

Question: How would one go about changing the order of the content types list on a multilingual site or non-english site?
For example, by adding a content type named Émission (with accentuated É), we see the following list on admin/structure/types page:

Article
Page
Émission

Same goes when translating a content type name (E.g.: Show => Émission) and changing language.
Answer: The function node_type_get_names() calls the utility function _node_types_build().  If you look at the source, there is a call to asort() at the bottom.
If you read the documentation for asort(), you will see that it isn't called with it's second parameter, $sort_flags.  This means that it will be called with the default, which is "normal" rules.  In this case, I am prety sure normal rules means ordering based on the value of the code point, which places the English alphabet first, then "specials".
To take your characters with diacriticals into account, you would have have a proper locale defined, and then call asort() with the SORT_LOCALE_STRING option.  For example,
$types = array('Émission', 'Page', 'Article');
print_r($types);

sort($types);
print_r($types);

setlocale(LC_ALL, 'fr');
sort($types, SORT_LOCALE_STRING);
print_r($types);

results in
Array
(
    [0] => Émission
    [1] => Page
    [2] => Article
)
Array
(
    [0] => Article
    [1] => Page
    [2] => Émission
)
Array
(
    [0] => Article
    [1] => Émission
    [2] => Page
)

That explains why the ordering isn't what you expect.  A quick look through the Drupal source only reveals a single call to setlocale(LC_ALL, 'C'); (it's in the bootstrap).  See https://stackoverflow.com/questions/5231620/what-does-set-localelc-ctype-c-actually-do for what this does.
All of this means that without doing a hook_menu_alter() on the 'admin/structure/types' to change the page callback to be your own, or to hook_pager_alter() the render array for the page, you can't change the ordering.
As a stupid American :) who doesn't really understand all of the implications of localization and internationalization, I cann't comment whether the Drupal behavior is by-design or is a bug.
Comment: And thanks to @AnilSagar whose answer prompted me to dig into this and so some experiments.


Regression and interactions

Question: I am trying to understand what is meant when I see something of the phrases like "full interactions between  group a, b, and c, as well as variable x fully interacted with with each group"  ( i just generalized the group names) for regressions.
If I am running a regression, and say the different groupings are white, black, urban, rural. does this mean the equation is, where black and rural are indicators for each group :
$y = \beta_0 + \beta_1 *Black + \beta_2*rural + \beta_3*(rural*black) + (\gamma_0 + \gamma_1 *Black + \gamma_2*rural + gamma_3*(rural*black)) * x + error$
am I correct in thinking this equation is essentially fitting 4 different lines in one regression? so each of the beta's represent an intercept for each group, and the each of the gammas are the differential slopes for each group?
Answer: The most general linear-in-parameters model would look like this:
$$y = \beta_0 + \beta_1 \cdot Black + \beta_2 \cdot Rural + \beta_3 \cdot Rural \times Black \\ + \beta_5 \cdot x + \beta_5 \cdot Black \times x + \beta_6 \cdot Rural \times x \\ + \beta_7 \cdot Rural \times Black \times x + error$$
Without additional context, I would interpret "full interactions between group a and b, as well as variable x fully interacted with each group" as the model above with $\beta_7=0$, which is equivalent to dropping $Rural \times Black \times x$ from the regression. I don't think there is a group $c$ in your model. I believe here "full" is a synonym for is sometimes called "factorial".
The expected value line for White urbanites is the same in both your and the general model: $$y = \beta_0 + \beta_5 \cdot x$$
For a rural Black observation, the expected value line is:
$$y = (\beta_0 + \beta_1 + \beta_2 + \beta_3) + (\beta_4 + \beta_5 + \beta_6 + \beta_7) \cdot x $$
In your model, $\beta_7=0$ would be set zero.
You can get the other 2 lines by plugging ones and zeros where appropriate.

Regression and interactions


localStorage values always Null with Javascript

Question: I use one function to submit values to localStorage, and another function to retrieve them and put them into their respective input fields on the webpage.
My problem is twofold. The retrieve() function does not appear to do do anything; not even Null is put into the input fields. Secondly, well, I want the onSubmit() funciton to actually store the input values.
These are the two functions. I declare elements and s_elements as you can see, and I attempt to retrieve them. But nothing happens!
function retrieve() {
    if (typeof(Storage) != "undefined") {
        var elements = document.getElementsByTagName('input');
        var s_elements = document.getElementsByTagName('select');
        for (var i=0; i<elements.length; i++) {
            if (elements[i].getAttribute("type") != "submit" && elements[i].getAttribute("type") != "button") {
                e = elements[i];
                e.setAttribute("value", localStorage[e.getAttribute("name")]);
            }
        }
        for (var i=0; i<s_elements.length; i++) {
            s_e = s_elements[i];
            s_e.setAttribute("value", localStorage[s_e.getAttribute("name")]);
        }
    }
}

function onSubmit() {
    var elements = document.forms["forsendur"].getElementsByTagName("input");
    var s_elements = document.forms["forsendur"].getElementsByTagName("select");
    for (var i=0; i<elements.length; i++) {
        if (elements[i].getAttribute("type") != "submit") {
                    e = elements[i];
                    localStorage[e.getAttribute("name")] = e.getAttribute("value");
        }
    }
    for (var i=0; i<s_elements.length; i++) {
                s_e = elements[i];
                localStorage[s_e.getAttribute("name")] = s_e.getAttribute("value");
    }
}

This is the form with the input values:
<form name="forsendur">
    < ... bunch of input and select fields >
    <input class="button2" type="submit" value="Calculate" onClick="onSubmit();"/>

</form>

This is the sole button that calls retrieve():
<input type="button" class="button2" value="Last session" onClick="retrieve();">

EDIT _ The retrieve() function now works. I fixed a lot of typos. Now only one problem remains.
Comment: Javascript doesn't have block scope. You're reusing the `i` variable in your inner loop. Also, adding some variables so you don't have to keep typing out the long property accesses like `elements[i].getAttribute("name")` would help a lot with readability.
Comment: Can we see the html for inputs as well? or a [jsfiddle](http://jsfiddle.net)
Comment: Indentation error upon copy pasting, sorry. I'll edit the code for readability.
Comment: @Gudmundur "The retrieve() function now works ... Now only one problem remains" - if retrieve is working, then obviously storage is also working. What's the remaining problem then..?
Comment: Storage is still storing values of "Null". I want them to store the input values of the fields. JSFiddle is coming up
Comment: JSfiddle http://jsfiddle.net/vnt62/
Comment: http://jsfiddle.net/vnt62/1/ This one is better, added the JS
Comment: @Gudmundur You're not closing the `onSubmit` function, is it a typo or the real thing?
Comment: Typo, sorry. I'll edit.
Comment: btw even after fixing it, i don't see the `retrieve` function is working in it as you said earlier..!
Comment: Maybe because the jsfiddle version doesn't store anything at all it seems? It works on my end and I copy pasted the code exactly as far as I can tell.
Answer: The crux of your problem is that you're trying to use HTML attributes instead of DOM properties to get your input values.
An HTML Attribute is something like this:

A DOM Property can be accessed like this:
document.querySelector('a').href = 'http://example.com'
HTML attributes are read by your browser as it parses the html text of your site. The browser creates a DOM Object representing your html element, and then sets the attributes in a way similar to this:
var a = document.createElement('a');
a.setAttribute('href', 'http://example.com')

There are often equivalent DOM properties to HTML attributes - like the .href property I described above.
The difference between these two things(besides the way you access them), is that most events after your HTML page is loaded modify DOM properties, not HTML attributes - e.g. typing in an input will change the .value property on the appropriate DOM Object, but it won't modify the HTML attribute:
<input type="text" value="hello"/> - The HTML attribute value will remain "hello", unless you explicitly set it. Meanwhile, as you type in the input, the DOM property .value will reflect the text in the input.
To give a specific example in your code, you'd want to change the line
localStorage[e.getAttribute("name")] = e.getAttribute("value"); <-- using the HTML attribute value
to
localStorage[e.getAttribute("name")] = e.value; <-- using the DOM property .value


No webpage was found for the web address: http://localhost:64256/Registration.html

Question: I have a asp.net core 2.1 app, where I wrote couple of API's. Now in same solution I added a html page to test the API's,

I also changes launch browser settings to the html page. Now while I'm trying to browse the page, I'm getting error over browser,

No webpage was found for the web address: http://localhost:64256/Registration.html

Can I do this, am I missing any settings? Thanks!
Answer: Static files should be added to wwwroot
In .net core you have to enable static files. You can do so by adding UseStaticFiles() to the application builder in your Configure method of your Startup class.
Startup.cs:
public void Configure(IApplicationBuilder app)
{
    app.UseStaticFiles();
}


How to compute the derivative of this matrix equation

Question: The matrix $\mathbf{A}(c)$ with the dimension $M \times N$, $c$ is a scalar variable. The matrix $\mathbf{d}$ is a constant matrix with the dimension $M \times 1$. If the formula $\frac{d\mathbf{A}(c)}{dc}$ has been known, I need to compute the derivative of $f(c)$
$$f(c) = \mathbf{A}(c)\Big( \mathbf{A}^T(c)\mathbf{A}(c) \Big)^{-1}\mathbf{A}^T(c)\mathbf{d}$$
Is there an expression $\frac{df}{dc}$ by $\frac{d\mathbf{A}(c)}{dc}$
Comment: If $\operatorname{inv} (S) = S^{-1}$ (for square, invertible $S$), then $D \operatorname{inv} (S)H = - S^{-1}HS^{-1}$. So, using the chain & product rule you can certainly compute ${df(c) \over dc}$, but it is messy.
Answer: From the Matrix Cookbook we see that the derivative of an inverse is
$$\frac{\partial Y^{-1}}{\partial c} = -Y^{-1}\frac{\partial Y}{\partial c}Y^{-1}$$
We can use that to get
$$\frac{d(A^TA)^{-1}}{dc} = -(A^TA)^{-1}(\frac{d(A^TA)}{dc})(A^TA)^{-1}$$
but we can just use the product rule on that to get:
$$\frac{d(A^TA)^{-1}}{dc} = -(A^TA)^{-1}(\frac{dA^T}{dc}A + A^T\frac{dA}{dc})(A^TA)^{-1}$$
Now we want to use the product rule again on the whole sequence to get:
\begin{align*}
f'(c) &= \frac{dA}{dc}(A^TA)^{-1}A^Td + A\frac{d(A^TA)^{-1}}{dc}A^Td + A(A^TA)^{-1}\frac{dA}{dc}d + 0
\end{align*}
Where the last term is zero because $d$ is a constant. Now we can plug in the earlier term and we get what I believe to be the most simplified form possible:
\begin{align*}
f'(c) &= \frac{dA}{dc}(A^TA)^{-1}A^Td - A(A^TA)^{-1}(\frac{dA^T}{dc}A + A^T\frac{dA}{dc})(A^TA)^{-1}A^Td + A(A^TA)^{-1}\frac{dA}{dc}d
\end{align*}
Since A just depends on c, let's replace the derivatives with just primes and we get something that looks prettier:
\begin{align*}
f'(c) &= A'(A^TA)^{-1}A^Td - A(A^TA)^{-1}({A'}^TA + A^TA')(A^TA)^{-1}A^Td + A(A^TA)^{-1}A'd
\end{align*}
Comment: Still not pretty, but I believe this is the best you can do.
Answer: This is not a complete derivation, but if you take PhysicsKid's answer and define
$$\eqalign{
\def\sym#1{\operatorname{sym}\left(#1\right)}
&\sym{X} = \tfrac12\left(X+X^T\right)
 \qquad&\big({\rm symmetric\;part\;of\;}X\big) \\
&A^+ = \left(A^TA\right)^{-1}A^T
 \qquad&\big({\rm pseudo\;inverse\;of\;}A\big) \\
&\dot A = \frac{dA}{dc}
 \qquad&\big({\rm dot\;notation\;for\;derivatives}\big) \\
&H = AA^+ = H^T
 \qquad&\big({\rm Hat\;matrix\;of\;}A\big) \\
&\dot H = 2\,\sym{(I-H)\dot AA^+}
 \qquad&\big(\ldots{\rm its\;derivative}\big) \\
&f = Hd
 \qquad&\big({\rm your\;function}\big) \\
}$$
Then the desired derivative can be written more concisely as
$$\eqalign{
{\dot f=\dot Hd}
\qquad\qquad\qquad\qquad\qquad
\qquad\qquad\qquad\qquad\qquad
\qquad\quad
\\
}$$
NB:$\,$ You can find derivations of the formula for $\dot H$ in some statistics textbooks such as Harville's$\,$ Matrix Algebra from a Statisticians's Perspective
$\,$but they are not as direct as PhysicsKid's answer.


Programmatically search nodes according to the value of fields in their bundle

Question: I am working on a script to search groups within the site according to criterias, such as group city, group languages and so on.
So far i am trying to do this by manually querying the database though it s seems to be an unnecessary hassle since the fields i am searching all live in different table like field_data_field_city, field_data_field_language and it can get very tedious task.
So i am wondering if i could to that programmaticaly using views so that it returns me all the NID according to the filters i mentioned above. i'd rather not use views UI as later this data is populated to the page via a Jquery templating system witch is already in place so the best would be to just get all the NID that match my selection.
If anyone had any incite / experience on how i should go to achieve this result would be much appreciated .
Answer: Personally I would stick to writing your query manually instead of using Views.
This way you have much more control over the final query, and in most scenarios you should be able to make it much smaller (and thus much faster) than that created by Views - by joining only with tables you really need to join in a specific situation, while Views will always do all the joins required by all possible scenarios.
Also, this way you could return the result formatted whichever way you want, without the need of installing additional modules, which is just unnecessary overhead.
IMHO. :)
Comment: Thanks for your input, i finaly just created a new table for my group that will index all the data i need for my search script, it s tedious to keep it well updated but ends up with a much faster script.
Answer: I think I would just create a view the normal way, using contextual filters (arguments) to filter the results, and use Views Datasource to make the view output json.
Comment: Thanks for that link marc, i am sure it'll come in handy at somt point though for now i am going to stick with the manual queries for the reasons mentioned by Maciej Zgadzaj. Thanks again for the help !
Comment: No problem, I'm glad you found the best tool for the job!


Text-Align de uma Label apenas

Question: Numa página web ".cshtml" tenho várias labels que declaram a classe form-horizontal e a classe control-label. Por padrão, essas classes alinham á direita no meu projeto, ou seja.. implementam a propriedade text-align: right, Porém eu necessito alterar o valor desta propriedade apenas para dois casos, e não estou conseguindo, não surte efeito.
O que eu já tentei:
CSS
.form-horizontal .control-label .text-left{
    text-align: left !important;
}

LABEL

        @Html.LabelFor(x => x.observacoes, "Observações Internas:", new { @class = "control-label text-left" })

Também já tentei atribuir ID e usar "#" na classe do CSS, sem sucesso e atribuir direto nos atributos Html do componente, inclusive com "!important" mas não funcionou.
Comment: Te respondi na minha resposta rss. Depois olha lá. Pesquise sobre "media query" no google que vc acha MUITA coisa e é fácil de entender vc vai ver!
Answer: Acredito que esse seja o seu problema, mas se não for me fala que eu removo a resposta.
A classe original no CSS do Bootstrap é assim, repare que ela está dentro de um @media, talvez esse seja seu problema:
@media (min-width: 768px) {
    .form-horizontal .control-label {
        padding-top: 7px;
        margin-bottom: 0;
        text-align: right; /* aqui define o alinhamento */
    }
}

Já em telas pequenas, menores que 768px o estilo original da label muda para:
label {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 5px;
    font-weight: 700;
}

Então confere se vc está setando o estilo no lugar certo.
Visto isso, acredito que vc resolve seu problema assim, crie a classe .form-horizontal .control-label.text-left da forma abaixo e veja se da certo!
@media (min-width: 768px) {
    .form-horizontal .control-label.text-left {
        padding-top: 7px;
        margin-bottom: 0;
        text-align: left; /* alinhado a esquerda */
    }
}
label.text-left {
    text-align: left; /* alinhado a esquerda */
}

Comment: Deu certo cara, muito obrigado.. se puder complementar a resposta com alguns links de conteúdo sobre CSS e o componente @media, ficaria grato.
Comment: Aqui tem um artigo da Mozilla em português de como usar @media https://developer.mozilla.org/pt-BR/docs/Web/Guide/CSS/CSS_Media_queries é bem simples de entender. Sobre CSS no geral o esquema é ler tudo que vc puder. Tente aprender um estilo por dia. Peque um tempo e estudo só background, depois só position, depois display flex, etc por ai vai. Mas no geral a Documentação da Mozilla é bem interessante e o W3School tb é bem didático com exemplos práticos etc

Text-Align de uma Label apenas


Is dynamic range compression used in classical music?

Question: In the era of "loudness war", a modern popular music song with no quiet passages generally has a flat dynamic range:

Clipping is also common - albums can be practically 100% distorted when record producers strive for maximal volume.
As acoustic music relies on shifts in dynamics, is dynamic range compression used by recording engineers in classical music recordings?
Comment: This may be better suited for the Sound Design SE.  I'm not an engineer or Classical musician but from my experience, I would guess that they do use compressors just not as drastically.  Classical music is probably the most dynamic, with drastic high/low volumes, so that needs to be represented in the final product, however, the music needs to be listenable in more than just a perfect setting, like in a car, so the quiet stuff needs to come up a bit.  I imagine there are some tricks to being able to get the low dynamics easily heard without taking away from the loud moments.
Comment: Compression might be used to a relatively small degree, but in the UK it's interesting to compare two "classical music" radio channels: BBC Radio 3 is often jokingly called "the quiet one" because their "normal" broadcasting level is -10dB below the peak signal level so that peaks in live broadcasts don't distort with no compression. Compare with the commercial station "Classic FM" which is aimed in part at listeners who are driving, and is notorious for compressing all the life out of classical recorded music when it broadcasts it - and their adverts are all compressed to the limit, of course
Comment: I don't think that an interlude is explicitly quiet, though it is usually not incredibly loud, but I can say for sure that not all quiet passages would be considered interludes.  If you look at modern Classical, basically anything from 20th century onward, the traditional forms became less common, so formal interludes are not necessarily even found.
Comment: Term for "quiet passages"? "Interlude"?
Comment: ... incidentally, Radio 3 are now experimenting with streaming 24-bit audio over their internet radio channel rather than 16-bit when broadcasting live performances, to maintain high quality at the lower signal levels. They are happy to broadcast long "quiet" passages of music at levels around -40 to -45 dB, and if anyone really wants to listen to that in their car, they can buy their own compressor!
Comment: I'm not a professional here, but I think "it depends" should be a decent answer. For serious recordings that are supposed to be listened seriously (i.e. Hi-Fi audiences), I don't think a compressor should ever be used. They just need high-sensitivity microphones to pick up every details in their own dynamics. But if a piece of recording is intended to be played in less responsive speakers, or in a noisier environment (e.g. in a cafe), it's definitely helpful to use a compressor, or at least an equivalent filter at the player side.
Comment: Pop music in general has rather little dynamic range to begin with.   What we're actually gettting more of these last couple decades or so is absurd amounts of bass-boost.
Answer: Yes, compression is used in classical recording, but not as heavily as in rock, and not as a weapon in 'loudness wars'.  Not everyone listens in a perfectly quiet environment, on high quality equipment.  A little compression, to bring the softest content up a bit, can be the lesser of two evils.
There was controversy recently when BBC Radio 3 took to compressing their output a little more during the 'drivetime' slots. Purists listening on their home audiophile systems lost a bit of quality.  The notable audience sector listing in their cars on the way to/from work could at least HEAR the soft flute solos!
Answer: It depends on how classical music is recorded. If it is recorded mainly with two aerial microphones, it does not need much compression, but if it is recorded with many microphones very close to the instruments, it is necessary to compress each microphone, each channel, separately. Failure to do so would be like listening by placing the ear 1 or 1 1/2 meters away from each instrument. Nobody could stand it. There are even musicians who get angry when you put a compressor on a channel, but they do not realize that one listens to the instruments, the orchestra, 20, 30,.. or 60 meters far away. And air is a natural compressor.
Comment: "Air is a natural compressor" is pretty much nonsense. At any sound-level achievable with acoustic instruments, air responds to an excellent approximation _linearly_. Even hundreds of metres from the source, the sound won't be measurably compressed, certainly not _audibly_. — What the room effects you get with ærial microphones do change, obviously, is the transient shape and to some degree frequency response. That is the reason such a recording is easier on the ears: it contains, in particular, less jarring high-frequency transients. But this is by itself completely unrelated to compression.
Comment: ...that said: if you set up lots of mics and put individual compressors on each, this also makes the recording more reverb-ey because whenever instrument _A_ plays loudly, the balance of its signal will shift _away_ from that instrument's own mic, towards the _other_ mics which don't pick up much of _A_ directly, but do pick up additional ambience, i.e. add reverb to _A_. But again, that's not really directly a compressor effect, just a consequence of the mixing of many mics.
Comment: BTW welcome to Music.SE. This is actually a reasonably nice answer,  just with details that aren't physically correct.
Comment: Sorry. This answer is not correct. This is not the way to record classical music. It is extremely rare to have a compressor on the close mics when recording classical. It may be used in a stage setting, but not in recording. The term aerial microphones is never used by recording engineers either.
Answer: As acoustic music relies on shifts in dynamics, is dynamic range compression used by recording engineers in classical music recordings?
Yes, although there is a school of using only two microphones and no processing. Generally, for records and TV music the dynamic range is reduced. It is of course dependant on the material, but if you look at symphonic works they often have a dynamic range much larger that a typical listener, equipment and surroundings can accommodate.
It is done, at least in the recordings I have done and the ones I have been involved in, more by "riding the faders" than by using a compressor. It might be that there are better compressors available, but the ones I have tested tend to give an unwanted signature modification of the sound. A limiter might be useful to contain some of the very strong accents, say that extra strong bass drum beat at the end of a symphony. In a DAW I instead use volume automation. The low pitched lyrical section will get a bit of volume boost, the fortissimo section will get a bit of volume decrease. How much to boost or decrease is all about taste. If using several microphones, a recording session today may use 50 or more microphones, you will probably raise an instrument mic slightly when playing a solo and turn it lower otherwise. This as well tends to reduce dynamic range.


Where is the seem in my proof?

Question: I tried to derive the area of a circle using proper calculus, but when I did so, I messed something up and got $A = 2 \pi r^2$, which is obviously wrong, but I can't figure out why this derivation fails.
Suppose there exists a circle with radius $r$.  The area of this circle can be represented as the sum of its sectors, where, when the circle is divided into $n$ sectors, each with area $A_m$, $A_{total} = \sum_{i=1}^n A_i$.
The area of a sector may be approximated by a rectangle whose sides are the arc length of the sector and the radius, meaning $A_{\theta} \approx \theta r^2$.  When $\theta = 0$, this approximate becomes accurate as a line segment may be thought of as a rectangle, in this case with dimensions $0 \times r$.  Therefore:
$$A_{total} = \lim_{||\theta|| \to 0} \sum_{i = 1}^{n} \theta r^2$$
$$= \int_0^{2 \pi}r^2d \theta $$
$$= \theta r^2 \bigg|_0^{2 \pi}=2 \pi r^2$$
What happened?  Why doesn't this derivation work?
Edit: I understand the approximating the area of a sector as a triangle with $base = \theta r$ and height $r$ is better, but why does the rectangle based derivation I did fail?
Comment: "The area of a sector may be **poorly** approximated by a rectangle whose sides are the arc length of the sector and the radius." The better approximation is by an isosceles triangle whose base is the arc length and height is the radius; the area of that triangle is $\frac{1}{2}\theta r^2$. Continuing from there, the proof gets the expected result.
Comment: *How* are you "pasting" together the rectangles?   Okay one side is the sector $\theta$; what are the other three sides?  You can't use a radius because that isn't perpendicular to the sector side.  And two radii are parallel to each other  You could take perpedinculars but they will not pass through the center.  and what is the side opposite the sector length.  You just can't cut a circle this way.
Comment: Sorry, where does the formula $A_{\theta}=\theta r^2$ come from?  If $\theta=2\pi$, isn't the sector the whole circle?
Comment: The area of a sector $A_{\theta} \approx \theta r^2$ comes from approximating the area of the sector as a rectangle of dimension $\theta r \times r$.
Comment: The following picture uses rectangles to compute the area of a circle https://en.wikipedia.org/wiki/Area_of_a_circle#/media/File:CircleArea.svg and neatly shows why you have an extra factor of 2!
Comment: Okay.  Let's try this with $n=12$.  What is our first rectangle.  It goes from (0,0) to (1,0).  Then from (1,0) to (1,sin 30) then... (1,sin 30) to (0, sin 30) and (0, sin 30) to (0,0).  That's the first rectangle.  What's the second?  You can't do (0,0) to (cos 30, sin 30) because that has overlap.  You can't do (0, sin30) to (cos 30, sin 30) because that isn't equal it area to your first.  Basically you don't have any *model* of how to do this.  If you don't have a *model* you can't actually do this.  This like assuming you can tesselate pentagons and not acknowledge that you can't.
Answer: Your are trying to estimate the area of the circle by adding up the areas of the rectangles.

But the area of the circle is not the sum of the rectangles.
It just isn't.  It's not that it is better to do it with triangles.  It's that it is possible to do it with triangles.  It is not possible to do it with rectangles.
The rectangles don't add up to the circle.
Answer: Simple: the initial formula is wrong. The area of a small sector can be approximated by the area of a triangle, with vertex  at the centre of the circle. The formula for the area of a triangle is half the area  of your rectangle, so there remains no factor $2$.
Comment: I understand that, but why does the rectangle proof not work?
Comment: What you need is an *equivalent* – in the mathematical sense: the ratio must  tend to $1$, not a loose approximation such as physicists can make. The rectangle does not satisfy this requirement, but the triangle does.
Comment: The rectangle approximation doesn't work because the error in estimating the area of the sector is too large.  Let $S_n=\pi r^2/n$ be the sector area and $A_n$ the approximation, then the approximation error $n(S_n-A_n))$ needs to go to zero for the approximation to converge.  With the rectangle the error is of the order of $\theta$ and $n\theta\rightarrow 2\pi\neq 0$ as $n\rightarrow \infty$, whereas for the triangle the error is of the order $\theta^2$ and $n\theta^2 = (2\pi)^2/n \rightarrow 0$ as $n\rightarrow \infty$ and therefore the argument is correct with the triangle calculation.
Comment: It's not just that the error is large.  It's that the rectangles overlap so that area of the circle isn't just the area of the rectangles plus the "rounding error"... the area of the circle is the area of the rectangles minus the area of the overlap.  The overlap is *huge*.  This just doesn't approximate a circle at all.  There is simply not correlation to the rectangles and a circle.  None at all.
Comment: The overlap, as you say, is  the area of the triangle, whence the factor $2$.

Where is the seem in my proof?


Server 2012 stuck in a reboot loop - lsass.exe failed

Question: My Server 2012 server boots up fine and the login screen is visible (from a local console). Password entry works but attempting to submit the password - either by clicking the arrow or pressing the Enter key - is futile. Nothing happens. After about 1 minute the computer immediately restarts - no blue screen or error message.
I can boot into Safe Mode and looking at the System event log I can see that a system-initiated restart has taken place. The Information message (Event ID: 1074) is as follows:
The process wininit.exe has initiated the restart of computer <computer name> on behalf of user  for the following reason: No title for this reason could be found
 Reason Code: 0x50006
 Shutdown Type: restart
 Comment: The system process 'C:\Windows\system32\lsass.exe' terminated unexpectedly with status code -1073740791.  The system will now shut down and restart.

I have tried to find the meaning of this error code online but it seems that no-one else has experienced this specific error.
What can I do to save my server?
Answer: This error is caused by LastPass. The login hooks used by LastPass seem to be incompatible with Server variants of Windows - causing lsass.exe to crash.
Note the following related error message (Event ID: 1000) in the Application event log:
Faulting application name: lsass.exe, version: 6.3.9600.17415, time stamp: 0x545042fe
Faulting module name: lplogin.dll, version: 0.0.0.0, time stamp: 0x56df0368
Exception code: 0xc0000409
Fault offset: 0x000000000000775b
Faulting process id: 0x1fc
Faulting application start time: 0x01d1d3659f61a068
Faulting application path: C:\Windows\system32\lsass.exe
Faulting module path: C:\Windows\System32\lplogin.dll
Report Id: 99b7a523-4174-11e6-80c8-3ca82a9ff999
Faulting package full name:
Faulting package-relative application ID:

Because the services required for uninstalling the LastPass application are not available in Safe Mode - the easiest way to resolve this issue is to rename the lplogin.dll to lplogin.dll.bak (thus preventing Windows from loading LastPass at boot-time). Once you have successfully booted into normal Windows - you can simply uninstall the LastPass application.


integral support for a density function

Question: $$f_{XYZ}(xyz)=ke^{-(x+y+z)}$$
$$ 0<x<y<z $$
I must find for which k this is a density function.
$$\int_{Rx}\int_{Ry}\int_{Rz} ke^{-(x+y+z)} dzdydx =1$$
$$k\int_{Rx}\int_{Ry}\int_{Rz} e^{-x}e^{-y}e^{-z} dzdydx =1$$
But I can't find which are supports of single variable.
I tried:
$$\int_0^y\int_0^z\int_0^\infty$$
But for this exercise I don't have solutions, so please help me.
This is a very stupid question, I know, I'm sorry.
Thanks.
Answer: You know that $x$ can take any value in $(0,\infty)$; given $x$, $y$ can take any value in $(x,\infty)$; and given $x$ and $y$, $z$ can take any value in $(y,\infty)$. This suggests that you must compute
$$
\int_0^\infty\int_x^{\infty}\int_{y}^{\infty}ke^{-x}e^{-y}e^{-z}\,dz\,dy\,dx=k\int_0^{\infty}e^{-x}\left[\int_x^{\infty}e^{-y}\left[\int_{y}^{\infty}e^{-z}\,dz\right]\,dy\right]\,dx.
$$
Comment: "Trust"? What the...
Comment: Thanks, I seriously think that yours is the right solution, I'm not sure but I think so.
Comment: or maybe not, in another exercise we had
$$f_{XYZ}(xyz)=k$$
with $ 0<x<y<z<1 $
and it was
$$k \int_0^1 \int_0^{1-y} \int_0^{1-y-z} dxdydz =1$$
Comment: @stat I assure you, the answer is correct.  Rather than trying to compare to a different exercise, just think through what I've done!  If you have a question on another exercise, feel free to ask it on this site and I'll be happy to try to explain it to you as well.
Comment: while with your method it would be:
x[0,1] y|x[x,1] z|yx[y,1]
Comment: Ok, I trust this one, thanks again Mr Peterson.
Comment: @Did sorry for my bad english.
I mean, thanks for the right answer.
Answer: Hint:
Try: $$k\int_{0}^{\infty}\int_{0}^{z}\int_{0}^{y}e^{-\left(x+y+z\right)}dxdydz$$
Comment: maybe your is the right answer, which is your idea of the other one?

integral support for a density function


DIV de subqueries falhando: Every derived table must have its own alias

Question: Numa tabela, possuo dois campos: entry_time e exit_time. Quero fazer a subtração de cada registro (exit - entry) pra achar a espera de cada cliente, somar todas as esperas, e tirar uma média dessa soma pelo número de clientes.
Existem algumas condições que já estão na query mas em essência o que quero é:
sum(exit_time - entry_time) div count(*)

Possuo uma query que me trás uma exibição nos dois campos gerados que preciso fazer o DIV():
SELECT SUM(espera) soma, COUNT(*) as totalregistros FROM
   (SELECT timestampdiff(minute,queue_entry_time,queue_exit_time) espera
       FROM queue_element where status='done') soma;

        +------+----------------+
        | soma | totalregistros |
        +------+----------------+
        |   45 |              8 |
        +------+----------------+

Se tento dividir um campo pelo outro recebo o seguinte erro:
SELECT soma div totalregistros from (
   SELECT SUM(espera) soma, COUNT(*) as totalregistros
      FROM (SELECT timestampdiff(minute,queue_entry_time,queue_exit_time) espera
         FROM queue_element where status='done') soma);

ERROR 1248 (42000): Every derived table must have its own alias

Porém não consigo ver qual subselect está sem alias. Vale lembrar que não posso utilizar procedures ou tabela temporária no meu cenário.
Alguém poderia apontar meu erro? Obrigado!
Answer: Seu erro esta que falta declarar um as XXX no fim
SELECT soma div totalregistros from (
   SELECT SUM(espera) soma, COUNT(*) as totalregistros
      FROM (SELECT timestampdiff(minute,queue_entry_time,queue_exit_time) espera
         FROM queue_element where status='done') soma) as Resultado;

Mas pra simplificar ja tentaste assim ?
SELECT (SUM(espera) div COUNT(*)) as resultado FROM
   (SELECT timestampdiff(minute,queue_entry_time,queue_exit_time) espera
       FROM queue_element where status='done') as reFinal;

Comment: Muito obrigado! Funcionou perfeitamente!


How do I actually run Rhino?

Question: I've read through the docs here: Mozilla's 'Scripting Java'
These examples don't answer my question either: Rhino Liveconnect example
How do my javascript files know where to find "java.lang" for example? Of course it works inside the Rhino shell, but I need to run java code from inside my javascript files, not from the shell. I can only see .java files in the downloaded source.
I want to call serverside java methods in my serverside nodejs javascript. Doesn't Rhino somehow need to be started up to provide my javascript with the ability to comprehend java?
Edit:
@eee So if I understand correctly, Rhino doesn't actually let me run java from javascript, it just translate all my javascript into java .class files...which I have to execute inside a java file after all? That kind of defeates the purpose of calling java from javascript. The whole idea is to be able to call any java code from inside my javascript code without having to build new java libraries.
Doesn't that mean that I can't use Rhino? Nodejs uses the V8 engine to execute javascript, so I assume that a single javascript file can't be used by both V8 and Rhino...I was hoping that I could call java methods, which would start up Rhino which would translate those calls to Java.
Java itself would then return the variables filles with some data.
@Peter: Why http calls? Both my javascript and my java lie on the same server for now. Anyway, what you are saying wouldn't exactly require Rhino, would it? I'd create a bunch of .class files and then call 'java myfile.class -v "firstvar" -x "secondvar"'.. am I understanding you correctly?
Comment: Running a JavaScript script with Java references won't work without Rhino as the script engine. Either you need: (1) to compile your Javascript script using Rhino compiler to become a Java .class file that can be executed using java.exe; or (2) to run the script through Rhino shell interpreter; or (3) to load Rhino engine using Java scripting support under Java app and execute `eval()` upon the script.
Comment: After reading your edited post: yes, it is exactly the case. It is the same if you try `Jython`, the Python engine for Java.
Comment: You need to "load" Rhino engine using Java Scripting API in your Java application before you can execute Javascript normally (as in the example above) under Java environment.
Comment: You cna only run `.class` files not `.java` as it not a scripting language.  If you want to run a methdo on the server you need to pass a request to the server. There must be a javascript library which makes this easier for you than having to do you own http calls, but I don't know what it is.
Comment: @eee @Peter: I'll edit my question because there is too little room here in the comments box.
Answer: Rhino does actually let me run java from javascript scripts. There is not much to do. LiveConnect gives you access to everything in the java.* package. If you want your own code to be accessible, you just need to add your class (compiled Java code) to the application's classpath.

I want to call serverside java methods in my serverside nodejs javascript.

Rhino is a javascript interpreter, meaning it runs javascript code. V8 is NodeJS' javascript interpreter. You must chose either Rhino or V8. V8 is in C++ and is deeply embedded in NodeJS. Rhino is in Java and can't replace V8 easily. There are projects (long term) to port NodeJS on Rhino, but don't wait for that unless you are ready to get involved.

How do I actually run Rhino?


Subspace of a consistent matrix

Question: Is the solution set of a consistent matrix equation $Ax=b$ always a subspace? The answer is false but I do not understand how, if we multiply a matrix with $x$ and get a solution won't we alway arrive at another matrix which passes through $\vec{0}$?
Answer: Suppose we are given a consistent system $Ax=b$
Suppose $x_1,x_2$ are solution, that is $Ax_1=b$ and $Ax_2=b$ then for solution set to form a subspace we must have $x_1+x_2$ should also be a solution.
But $A(x_1+x_2)=Ax_1+Ax_2=b+b=2b\neq b$
So in general solution set is not a subspace.
Answer: We are discussing about the solution set of a consistent matrix equation.
Consider the system $$x=1$$
Hence $x=1$ is a solution, but if we multiply it by $2$, it is no longer a solution.

Subspace of a consistent matrix


What are these pieces teaching actually?

Question: Wright Pianoforte Tutor -
Around a year and half back, after I started my tentative steps towards learning piano at the ripe age of 50, My then tutor in Mumbai suggested this book to me. While it was available in a city music store I was surprised to see very little reference of this book on the internet. Most recordings of from the book on the YouTube, although not many, came from India only. The book however is printed in England.
I had on my own purchase Alfred's adult all in one level 1.
Side by side, I preferred the latter much more but kept on persevering on the first book as well. However when there was the longish break in my lessons on account of move across the country,  I totally weaned off the first book.
I took another break, (not from playing) from my present tutor in this month, and on a whim, reopened the book - and faced these two pieces. And I am totally at a loss!!
My questions are:

Doesn't the first piece sound very un-melodic? In fact, I don't know what that 8th bar is doing?
What are these pieces teaching? Especially the LH movements in the second piece?
And, (I know that this is subjective), aren't these pieces a tad too difficult (technically) as early pieces in a beginner book?!
Comment: @jjmusicnotes curious why you posted an answer as comments?
Comment: 1. Odd - haven't heard of that book - definitely not standard for Piano teaching. Alfred's is much more mainstream. That 8th measure is leading back up to the beginning of the antecedent of the first phrase again.
Comment: 2. The first piece is likely trying to teach parallel 3rds like somebody said. I disagree with the 2nd piece teaching Alberti bass - that's not Alberti bass. That 2nd piece is unfocused and arbitrary.
Comment: 3. Not sure where you're at with learning, so hard to say if these pieces are too difficult. Surely there is more than 1 Piano teacher in Mumbai?
Comment: @jjmusicnotes, why do you consider the 2nd piece unfocused and arbitrary? There is certainly a discernible form and a singable melody.
Comment: I agree Heather. I found the RH of the second piece quite melodious. And the bass chord is in reasonable harmony with that.
Comment: @jjmusicnotes I'm curious why you say that the 2nd piece accompaniment isn't Alberti bass. It looks like Alberti bass to me.
Comment: I personally think the Alfred series is the best.
Answer: Good question; it's important to know what skills are being emphasized with etudes like these.

The first piece is a little un-melodic, but that's probably because this piece is designed to test right hand parallel thirds. In doing so, they wanted the notes themselves to be very easy, so they stuck with a clear five-finger setup. Notice how your right hand really never moves away from the C–G range; your thumb sticks on C, your pinky is on G, and the other fingers just fall right in place. (The only exception to this is when the thumb hops down to B a couple of times.) By sticking with this range limitation, it's understandably tough for them to create the most memorable melody. (Note: As Todd Wilcox correctly says in the comments, this piece may also serve to introduce the player to the waltz style.)
The second piece seems to be getting the player comfortable with the Alberti bass, a very common left hand arpeggiated figure in the Classical style. If you ever have intentions of playing any Classical piano sonatas, you must become comfortable with the Alberti bass.
Yes, they're probably a bit difficult for early pieces in a beginner's piano book. But that really all depends on how "early" it is and just how "beginner" of a book it is.
Comment: You could add that the first one seems to give a taste of a waltz rhythm also.
Comment: Thanks a lot for your valuable answer. Especially for introducing the concept of Alberti Bass. It is really emotionally difficult to play, tough not-so-musical pieces, if one does not even know what is it for. The problem with the first piece is at one end, it is difficult. And then there is no joy in the music as well. The difficulty of the piece comes from managing the parallel 3rds, along with the octave jump with small hand, especially the jump of the little finger back from the lower octave G to C.
Comment: Actually I got that I was playing some arpeggiated chord formations, like (CGEG - Cmaj), (FDAD - Dmin), (GFBF - G7maj), etc. The difficulty in this is the left hand jumps between scale positions. Given that I like to intellectualise music, I would now think this as a form of I-ii-V-I progression. That may take away my playing frustration. :-)
Comment: And -- this might be pushing it -- you can relate the title of the first piece "Hide and Seek," to the actual children's game, where one person is blindfolded and spun around, and then tries to find the others ("Blindman's Bluff"). See how the melody spins around and around? The "unmelodic" aspect may actually be what we call *tone painting*.
Answer: "The Wright Pianoforte Tutor" is a bit old-fashioned, but none the worse for that!  I've seen it in many British piano stools.  We still play melodies in 3rds and 'Alberti' patterns in the LH. (Not sure why @jjmusicnotes says it isn't Alberti?)
If these are too hard for you, come back to them later.
Comment: Thank you for your reassurance about the book, Laurence. It's actually quite significant. I love the oh-so-English expression "none the worse for that"! :-)
Answer: I would give my beginning students pieces like these a little bit after they finish book 1 (kid version) of the Alfred series.
I don't find those pieces to be too difficult for a beginner who has built up a little experience, though the second one is significantly more difficult than the first. They are probably grouped together for fitting on the page.
Any note on the piano can be played by any finger, so I try to get my students away from "positions" as soon as possible. What matters is what finger plays each note, because it is fingering that really sets up the pianist's ability to move from place to place on the piano.
Both these pieces are missing articulation, dynamic, and phrasing markings, which contribute to the impression of a lack of musicality. I believe if they were added in, the character of the pieces would improve.
I would recommend this book if you are looking for beginner classical pieces. The book contains pieces of a wide variety of difficulty, though all are at the beginner level.
https://www.amazon.com/Joy-First-Classics/dp/0825680662/ref=sr_1_1?ie=UTF8&qid=1532859942&sr=8-1&keywords=joy+of+classics+piano
Comment: Thank you Heather. The Joy Series is a welcome suggestion. I guess Amazon India imports the title, and I'll get it. BTW, I find the combination of left hand jumps, along with the 3rds on right, to be a bit difficult and frustrating.
Comment: @SubirNag, it is important to find out why you are finding that difficult, because it really is not. The LH fingering pattern is 5-1-1 the whole entire piece, and you only have three notes the whole time until the last measure when you have one additional new note. You are also always moving back to the same G on the top space in the bass clef. Try slurring the 1st two notes in each measure. (Again, the problem with the lack of articulation.) Try analyzing the piece to find the repeated patterns (not just within measures, but groups of measures.) This should help.
Comment: If you can't figure out on your own what is tripping you up, you need to make sure you get back to studying with a teacher.
Comment: Thanks for your suggestion again. I'm quite analytical in nature and thus realised the reason for my difficulty with the first one. The difficulty of the piece comes to me from managing the parallel 3rds, along with the octave jump with small hand, especially the jump of the little finger back from the lower octave G to C. Anyway, with perseverance, I'm making progress.
Comment: @SubirNag, that is great that you are sticking with it and making progress!


How do I implement Ctools plugins from other modules?

Question: I have a module which defines a plugin. Using this code, I can easily load the plugin:
ctools_include('plugins');
ctools_get_plugins('mymodule','myplugin');

That works great, but I would like my module to use plugins from other modules of type 'myplugin'.
I can only seem to get it to load plugins defined by the module provided in the first argument whereas I want to get all modules that provide plugin "myplugin", is there any way to do this?
Answer: With the code you shown, you get all the plugins of that type implemented by any module, not just from one module. In fact, when I execute the following code, I get the plugins implemented also from the Views UI module.
ctools_include('plugins');
dpm(ctools_get_plugins('ctools', 'export_ui'));

The module name passed as first argument to ctools_get_plugins() is used to namespace the plugin type: There can be other modules that implement a "export_ui" plugin type, and that is the reason why the function requires the name of the module defining the plugin type.
See also the description given for hook_ctools_plugin_directory():

This hook is used to inform the CTools plugin system about the location of a directory that should be searched for files containing plugins of a particular type. CTools invokes this same hook for all plugins, using the two passed parameters to indicate the specific type of plugin for which it is searching.
Comment: Thanks for this. I realised that the issue I was having was that my plugin filenames were the same and so were getting merged. I still must be thinking of plugins in the wrong way though because I would have thought that I could have had plugins from multiple modules using the same filename but everytime I do they arent returned.


How can I add a Pathauto pattern for a content type depending on a reference field?

Question: On my site I have a content type 'Article' that has a reference field to a taxonomy vocabulary 'Type of Article' containing terms like 'Blog', 'News', etc.
Now I would like to have Pathauto form a different URL for each type of Article. E.g. /blog/article-title, /news/article-title, etc. Is it possible to set a pathauto pattern depending on the settings of that reference field?
Earlier I used different content types, with which it was no problem to get a different Pathauto pattern for each. But as the fields in the content types were the same I would like to solve it like this.
Answer: Right beneath the pattern input you have a link that opens a popup to let you choose tokens to be put in the pattern. For field values it normally goes along the line of <code>[node:field_foobar:value]</code>. Depending on the field value you may also consider to either provide your own custom token or to alter the current token with an alter hook to replace the value with an URL-safe value (like to prevent the URL contains an Emoji for example).


What is the correct answer for cross entropy in this case?

Question: I have two neural networks: NN1 and NN2, predicting Dog and Cat. The probabilities are below:
<code>        NN1    NN2
Dog 1   0.9    0.6
Cat 0   0.1    0.4

Dog 0   0.1    0.3
Cat 1   0.9    0.7

Dog 1   0.4    0.1
Cat 0   0.6    0.9
</code>
I calculated Cross Entropy for NN1 as below:
-1*ln(0.9) -1*ln(0.9) -1*ln(0.4) = 1.12
But the answer is 0.38 for NN1 and 1.06 for NN2. How come?
Answer: You probably need to divide by 3, as formally cross entropy is the average of each point's contribution.
To be clear, the $n$ is only necessary when you have test observations. The usual formula is $H:=-\sum_{x}p(x)\log(q(x))$, where the sum (or integral in the continuous case) is over the state space, so if you want to make an empirical estimate of cross entropy over your training set, then the formula is $H:=-\frac{1}{n}\sum_{i=1}^ny_i\log(f(x_i))$, where $x_i$ is each datapoint. For example if $P(1)=0.3$, then you typicall expect to see 30% of your data with $y=1$, so then out of 100 samples, you'd expect 30 $Y$'s, and $30/100=0.3$.
The logic is the same as say, finding the average of $n$ numbers from a distribution $p(x)$.
Note that many implementations don't bother dividing by $n$, since it is immaterial in the optimization that takes place to extremize $H$.
Comment: Thanks, Alex. Can you show me a link for that info? I did not find any `divide by n` in any Cross Entropy formula
Comment: @DamingLu: See edit.


Apache httpd.conf: Multiple virtualhosts on a single ip

Question: We have a local development server we have setup on a comcast business class connection with a single static ip. This is all routed through a DIR 655 router. Our issue is as follows: We have our main documentroot setup as /var/www/html of course, but the problem comes in when we try to setup our virtualhosts. We have a domain that resolves to the single static ip, and we need several sub domains. Normally you would just use a namevirtualhost pointed to the ip that you want to share, then setup the virtualhosts to meet your needs, but I don't see how this is possible with a single ip o nthe server. The ip is already sending everything to the /var/www/html documentroot directory. We're at a loss at this point. We figured an easy fix would be a second ip address, but how does one map two ip's to a single device on a low end router like the dir 655? Anyone out there have some advice?
Thanks in advance.
Answer: I'm not entirely sure that I understand your requirements… But, provided you don't need SSL, you can have as many virtual hosts on one IP as you'd like:
<code><VirtualHost *:80>
    ServerName example.com
    ServerAlias foo.example.com foo
    DocumentRoot /var/www/example/
</VirtualHost>
<VirtualHost *:80>
    ServerName spam.com
    ServerAlias eggs.spam.com
    DocumentRoot /var/www/spam/
</VirtualHost>
</code>
Answer: This is strange... I have precisely the same setup as you do (Comcast business, DIR-655, etc...).
In your httpd.conf file, have you set the following?
NameVirtualHost YOUR_IP_ADDRESS_HERE:80
Comment: I'm sorry if that seemed a little obvious, but your question is kind of vague. As long as you setup NameVirtualHost correctly and defined your VirtualHosts as David Wolever suggests, you should be set. The fact that you have only one IP address is not a problem.


Scotland the Brave - advice for newbie pianist

Question: I recently bought a synthesizer and my dream is to play "Scotland the Brave". What is the quickest way to achieve this goal? (e.g. should I just learn to play the keys and not the chords, is there a simpler song that you recommend I learn first, etc.)
I consider myself as having no musical background.

EDIT
In case you do want more specific info about my background and goals, here is my situation (note I'm now 32 years old):

I know how to read basic sheet music (from 5th grade at school)
I have negligible experience playing the piano/synthesizer etc. The closest I got were a few weeks of lessons as a 9 year old.
I played a recorder or violin for one school year (5th grade) approximately once a week. But I do not consider myself a musician.
I don't want to get sidetracked into playing classical or religious music as a way of learning (it will alter my long term goal in a way I don't want). I want to learn newer, exciting songs that others will enjoy hearing like patriotic marches or popular music. For example:

Happy birthday to You
America the Beautiful
No awa tae bide awa
Take on Me
100 Years
Final Countdown
Comment: I would remove all of point 4 as it just detracts from the question.
Answer: Scotland the Brave is relatively simple, but if you find it tricky to play both hands, starting with simpler music is a good idea.
Generally you would start with single hand practice, left and right, learning simple scales individually, then together, and working up to more complex figures.
Once you have note placement, chords can come later.
This is best approached with a teacher, who can help you get finger, wrist and arm placement correct, and make sure you don't end up with bad habits.


redirect based on content type using rules

Question: my problem is really silly and i know I must be missing something. All I want to do is redirect a user based on the type of node being viewed.
Here is what I tried with rules:
Event: content is viewed
Condition: Content is of type: my desired type
Action: Path redirect: my desired url
Problem: when i search for anything using the search form, I always get redirected to the url I specified in the Action part of the rule.
Please let me know how to get around this
Answer: That's happening because you're reacting on the content is viewed event, which means everytime a content of the type you're describing in the conditions is displayed. You need to extend more those conditions to add the search context.
You can either compare with the site path with a "Data comparison" condition on  site:current-page:path to node/[node:nid]
A better solution would be to filter out the view mode, I'm guessing you're looking for reacting on the "Full" view mode of the node, so just add a "Data comparison" condition on view-mode and set it to Full content
Something very similar has been answered before in: How to set Rules event for "Content is viewed" from excluding Teaser view?
In any case, if you want a node type to not have a final page, I recommend the Rabbit hole module.
Comment: thank you for your very clear guidance my friend.
ill have a look at these options and get back to you ASAP


Prevent items from being indexed so it won't come out on search

Question: Drupal 7 - Can you you exclude an entire content type (or just selected entries from it) from being indexed so they won't come up in a search result? I'm just assuming that indexing is the answer but the main point is that neither of the items will come up on a search result.
Answer: You can use the Search API module in Drupal 7 to give you this granular control over your search indexing and results.
You will need at least one other module to use the Search API,
namely one that defines a service class (e.g. search_api_db ("Database search"),
provided with this module).

Creating a server
(Configuration > Search API > Add server)

The most basic thing you have to create is a search server for indexing content.
Go to Configuration > Search API in the administration pages and select
"Add server". Name and description are usually only shown to administrators and
can be used to differentiate between several servers, or to explain a server's
use to other administrators (for larger sites). Disabling a server makes it
unusable for indexing and searching and can e.g. be used if the underlying
search engine is temporarily unavailable.
The "service class" is the most important option here, since it lets you select
which backend the search server will use. This cannot be changed after the
server is created.
Depending on the selected service class, further, service-specific settings will
be available. For details on those settings, consult the respective service's
documentation.

Creating an index
(Configuration > Search API > Add index)

For adding a search index, choose "Add index" on the Search API administration
page. Name, description and "enabled" status serve the exact same purpose as
for servers.
The most important option in this form is the indexed entity type. Every index
contains data on only a single type of entities, e.g. nodes, users or taxonomy
terms. This is therefore the only option that cannot be changed afterwards.
The server on which the index lies determines where the data will actually be
indexed. It doesn't affect any other settings of the index and can later be
changed with the only drawback being that the index' content will have to be
indexed again. You can also select a server that is at the moment disabled, or
choose to let the index lie on no server at all, for the time being. Note,
however, that you can only create enabled indexes on an enabled server. Also,
disabling a server will disable all indexes that lie on it.
The "Index items immediately" option specifies that you want items to be
directly re-indexed after being changed, instead of waiting for the next cron
run. Use this if it is important that users see no stale data in searches, and
only when your setup enables relatively fast indexing.
Lastly, the "Cron batch size" option allows you to set whether items will be
indexed when cron runs (as long as the index is enabled), and how many items
will be indexed in a single batch. The best value for this setting depends on
how time-consuming indexing is for your setup, which in turn depends mostly on
the server used and the enabled data alterations. You should set it to a number
of items which can easily be indexed in 10 seconds' time. Items can also be
indexed manually, or directly when they are changed, so even if this is set to
0, the index can still be used.

Indexed fields
(Configuration > Search API > [Index name] > Fields)

Here you can select which of the entities' fields will be indexed, and how.
Fields added by (enabled) data alterations will be available here, too.
Without selecting fields to index, the index will be useless and also won't be
available for searches. Select the "Fulltext" data type for fields which you
want search for keywords, and other data types when you want to use the field
for filtering (e.g., as facets). The "Item language" field will always be
indexed as it contains important information for processors and hooks.
You can also add fields of related entities here, via the "Add related fields"
form at the bottom of the page. For instance, you might want to index the
author's username to the indexed data of a node, and you need to add the "Body"
entity to the node when you want to index the actual text it contains.

Index workflow
(Configuration > Search API > [Index name] > Workflow)

This page lets you customize how the created index works, and what metadata will
be available, by selecting data alterations and processors (see the glossary for
further explanations).
Data alterations usually only add one or more fields to the entity and their
order is mostly irrelevant.
The order of processors, however, often is important. Read the processors'
descriptions or consult their documentation for determining how to use them most
effectively.
Comment: Wow, thank you for your very thorough answer. I'll look into it and let you know if it works. Although from your explanation I'm pretty sure that it will.
Comment: What service class would you suggest?
Comment: just a quick question, does this also work for preventing comments from being indexed?
Answer: This is a native feature of the https://drupal.org/project/apachesolr module.
Using apachesolr + the apachesolr module you can configure the content types that you wish to have indexed using checkboxes. No coding required here.
Plus you get the added bonus of a far more advanced search engine, with facets etc