Rigid motion which is not a linear transformation

Question: From Linear Algebra Done Wrong:

Give an example of a rigid motion in $\mathbb{C}^{n}$, $T(\mathbf{0}) = \mathbf{0}$, which is not a linear transformation.

where a rigid motion was defined as a transformation $f : V \to V$ on an inner product space $V$ such that
\begin{align}
\left\Vert f(\mathbf{x}) - f(\mathbf{y}) \right\Vert = \left\Vert \mathbf{x} - \mathbf{y} \right\Vert && \text{$\forall\mathbf{x},\mathbf{y} \in V$}.
\end{align}
I've so far found examples of transformations which are linear and not rigid (such as $T(z) = \alpha \cdot z$, where $\alpha \in \mathbb{C}$, $z = x + iy$) and transformations that are neither linear nor rigid (such as $T(x + iy) = 2x - y + iy$). Translations ($T(z) = z + a$, $a \in \mathbb{C}$) appear to be ruled out by the condition that $T(\mathbf{0}) = \mathbf{0}$. Beyond this, I'm not sure how to proceed. Any hint would be greatly appreciated.
Answer: Hint: Look for a map that is linear with respect to coefficients from $\Bbb R$, but not linear with respect to coefficients from $\Bbb C$.
Answer: Consider the conjugation map $T: \mathbb{C} \to \mathbb{C}$ given by $z \mapsto \overline{z}$. This is a rigid motion, intuitively because conjugation corresponds to reflection through the real axis and formally since if we let $z = x_1 + iy_1$ and $w = x_2 + iy_2$, we have
\begin{align}\lVert \overline{z} - \overline{w} \rVert &= \lVert (x_1 - iy_1) - (x_2 - iy_2) \rVert \\
&= \sqrt{(x_1-x_2)^2+(y_2 - y_1)^2} \\
&= \sqrt{(x_1-x_2)^2 + (y_1-y_2)^2} \\
&=\lVert z-w \rVert
\end{align}
However, it is not linear since $T(\alpha z) = \overline{\alpha z} = \overline{\alpha} T(z)$. $T$ is in fact antilinear.


Probability that two persons are in the same point at the same time

Question: I am trying to figure out a real life probability problem. I am no mathematician, but I am an engineer, so I should be able to formulate the problem correctly.
I have been head banging the wall to solve this for few days and I am stuck -

The time space is 365 days.
A moves from one Point to another N times.
B moves from one Point to another M times.
There are P Points.
A and B don't have to move at the same time but they may
A and B don't know about each other
They can move to any point
Their choices are independent (They don't influence each others)
One move is instant.
At T=0, A and B are on separate point.
Thanks

What is the probability that A & B are on the same Point at least one time?
Is it solvable at all ?
EDIT 1
Thanks to @N.Bach answer, I add the following missing informations :

$N$ and $M$ are not random variables
Assuming $T_a$ and $T_b$ are the time A and B stay on a Point P, these are integer
All Points are equally probable

EDIT 2
Thanks so much to both of you.
I think we all have a different view of what the real life problem could be, as we would all try to assume A is us.
as an example,
You and your childhood mate you haven't seen in 10 years, both go on holidays for 2 weeks, leaving on the same date. What is the probability you both visit the same place at the same time?
Another case scenario, you go in holidays, and you land in the same city as an old colleague you haven't seen for ages, who has been living there for few years.
Taking a number of cities of 1000, the probability this happens, according to @NickG's answer, is around 0.01%.
Multiplying this result by the probability of you meeting him randomly in person while you both in the same city, makes the final odds very low.
Of course, there are few cities around with less than a thousand people, but there are so many of them.
I got interested by this question because this happened to few people I met, (including myself), and I definitely haven't got this conversation with  more than 100 person. (now that is online, this number drastically increased..)
An hypothesis would be that there is an hidden parameter that escapes our logic, which would explain why on earth it happened to me twice, and I met 3 person which had the same experience, and I am definitely not walking the street asking who else had this experience...
A realistic answer would be that the odds this happens often to a group of people, which I am part of, is statistically possible.
Comment: Somewhat like a random walk.  Might be worth looking at those.
Comment: During a move, can they move to any of the points? Also, if one move takes one day, and $A$ moves $N$ times and $B$ moves $M$ tones, and that's it, what does $365$ have to do with anything?
Comment: I see that you have edited the question but you don't seem to have answered Arthur's question.  Can they move to any point in one step?  It seems that they can opt to stay still.  They don't have to move at the same time but may they?  Do they have knowledge of each other's moves?  Are their choices independent?  Are they trying to meet or avoid each other?  It would seem that you could fix one of them with no effect.
Comment: "Of course N < 365 and M < 365 and P > (N + M)" - These sound like nontrivial and nonobvious conditions to me. Most people move more than once per day, and may well visit the same places many times each year. So I would have guessed N >> 365 (and a nonuniform distribution on the state space when moving around).
Comment: @Arthur Sorry I just updated the question.
One move is instant,
They can move to any points.
For example A moves 3 times in 365 days, therefore can stay in 4 points for a period of time T1 + T2 + T3 + t4 = 365 days
Comment: @badjohn Yes they can move to any point in one step, they may move at the same time, don't have knowledge of each other's move, independent choices that don't affect each other's move.
Comment: @badjohn
I just had an idea, would it simply be MAX(N,M)/(P-1) ?
Comment: @TMM For real world application, I was thinking that P is a city in the world, and plane tickets are expensive. I was thinking to multiply this probability by the probability that you meet B  in a city assuming both are in the same city.
Comment: I thought "same place" meant that people would run into each other. If P represents a set of cities, then clearly being in the "same place" means something else. And that still leaves the issue that a uniform distribution on places to move to is not very realistic. I would assume both persons had a "home town" which they'll be likely to visit after almost each trip, and some places are more often visited than others.
Comment: @TMM Sorry there was missing bits, The Real World scenario is that A&B know each other from school, one person changes home town and moves permanently abroad, time passes, they loose contact.
The probability they land in the same city the same day in a year.
Comment: Is time measured continuously and moves can occur at any time, or is time measured in discrete intervals with moves only occurring on those intervals? Can a person move more than once in a day?
Comment: @TMM I updated the question with an accurate description of the real life example I was referring to.
Comment: People you know/get along with probably have some common interests with you. Even without being in contact, the odds you visit similar places is higher compared to someone completely unrelated. There's also the vacation effect, there are dates at which people are more likely to travel, which increases the odds again. The hidden parameter would be culture, interest, upbringing, etc, basically the probability of when and where you travel. You can probably model that with Markov chains.
Answer: EDIT 2
After thinking for a while, it seems to me that part of the problem you're actually struggling with is how to state and specify the "real life" problem
that you want to solve, rather than actually solving it. One way to state and solve the problem is addressed below, here I'd like to discuss about other ways to specify the problem.
In short, you may want to have a look at Markov chains, or even hidden Markov chains.
One way to see Markov chains, is that you have a system that can evolve between certain states, with a certain probability. Here for example, person $A$ could be your system, and its state could be which city $A$ is currently in. You can make things non uniform by specifying the probabilities with which the system can transition from one state to another.
Want to include $B$? Make the system pairs of cities. Don't want to make the decision of $A$ and $B$ independent? That's already built-in with the probability to transition from one state to another. Want to have time play a role? One transition can be equivalent to one time unit, and a state can transition into itself to simulate that $A$ and $B$ do not move.
Want to simulate a 2-day vacation to another city (staying 2 days somewhere, coming back to hometown)? Make a special state that can only transition back to the state it came from...
I think you get the idea. To conclude, the approach below could be modeled by a Markov chain, but it would probably be very annoying. The more "natural" thing to do with Markov chain would be to have $N$ and $M$ as random variables, enforcing them to be constant would probably be annoying?
(Not sure, I haven't done any Markov chain in ages.)
Original answer
You need to specify in some way what the probabilities are when $A$ and $B$ move around...
For instance for $A$, is $N$ fixed or a random variable?
Assuming $N$ is fixed, $A$ will visit $N+1$ points, let $T_i$ be the number of days $A$ stay at the $i$-th point.
Can the $i$-th point and the $(i+1)$-th point be the same? I'll assume that they must be distinct.
I'll also assume that $T_i\ge 1$ for every $i$, and that every $T_i$ is an integer.
Just looking at the $T_i$, there is $364\choose N$ possible choices of them.
This corresponds to all the ways $A$ can choose to move around, without specifying where.
When looking at the locations, $A$ can choose between $P-1$ destinations, so if we disregard the "when", we have a choice between $(P-1)^N$ trajectories. I ignored the starting point, but if this is also a variable make that $(P-1)^{N+1}$.
If you put those together, there are ${364\choose N}(P-1)^N$ ways for $A$ to move around in the span of one year. Are all of these ways equally probable? Or is there some specific process for $A$ to choose when and where he moves?
Unless you specify this information, it will be difficult to solve your problem.
Ps: if $A$ and $B$ start on the same point, they will obviously be together on the same point on day 1... you may want to revise your problem statement.
EDIT 1
Nick G was faster than me, but I want to add a few remarks to his approach
(read his answer first).
When $A$ and $B$ move simultaneously, there are indeed $(p-1)^2$ possible pairs of destination, but only $p-2$ outcomes where $A$ and $B$ meet. Indeed $A$ can move to $p-1$ points, but that number includes the point where $B$ is currently at. Because they cannot meet there, only $p-2$ cities (and outcomes) remain.
So the probability that they do not meet right after they both move is
$$\frac{(p-1)^2-(p-2)}{(p-1)^2}$$
When $X=k$, the probability they do not meet during the course of one year then becomes
$$
P(\text{$A$ and $B$ do not meet}\mid X=k)=
\left(\frac{p-2}{p-1}\right)^{N+M-2X}\times \left(\frac{(p-1)^2-(p-2)}{(p-1)^2}\right)^X
$$
The last remaining problem is how to determine $X$.
Let $T^A_i$ be the number of days $A$ stays in the $i$-th city he visits, likewise for $T^B_i$. Given the values of $T^A_i$ and $T^B_i$ it is possible to compute $X$. You didn't provide any information on the probability of having one set of $T^A_i$, $T^B_i$ over another, so I'll just assume uniform distribution. Also dealing with the durations of the stay is annoying, so instead let $U^A_i$ be the night when $A$ travels from the $i$-th city to the $(i+1)$-th city.
The sequence $(U^A_i)_{1\le i\le N}$ is strictly increasing and has integer values between $1$ and $364$ (inclusive).
We have likewise a sequence $(U^B_i)_{1\le i\le M}$ for $B$.
Without loss of generality assume $N\le M$. For an integer $k$, $0\le k\le N$,
we want to compute
$P(X=k)$,
the probability that $X$ is equal to $k$. Because we assume uniform distribution, it is the number of ways to draw both
$(U^A_i)$ and $(U^B_i)$ such that they share exactly $k$ identical night values divided by the total number of ways to draw
$(U^A_i)$ and $(U^B_i)$.
There are $364\choose k$ ways to choose $k$ distinct nights on which $A$ and $B$ both move. Following this, $A$ still move $N-k$ times on the remaining $364-k$ nights, while $B$ move $M-k$ times. However, those
$(N-k)+(M-k)$ nights must be distinct, there are
$364-k\choose N+M-2k$ ways to chose the nights they move on, and
${N+M-2k\choose N-k} = {N+M-2k\choose M-k}$ ways to decide whether $A$ or $B$ is the one moving during those nights.
In the end there are
$$
{364\choose k}\times{364-k\choose N+M-2k}\times{N+M-2k\choose N-k}
=\frac{364!}{k!\,(364-N-M+k)!\,(N-k)!\,(M-k)!}
$$
different ways to draw the nights $(U^A_i)$ and $(U_i^B)$ so that $A$ and $B$ move the same night exactly $k$ times.
In total, there are ${364\choose N}\times{364\choose M}$ ways to draw the nights (without constraints). This means we can compute
$P(X=k)$.
To conclude,
$$
P(\text{$A$ and $B$ do not meet})
=\sum_{k=0}^N P(X=k)\times P(\text{$A$ and $B$ do not meet}\mid X=k)
$$
and you want to take $1$ minus the above to answer your problem.
I have no clue whether there is a nice simplification of the various formula, but at least a computer can do the work for you.
Also note that the assumption in this model are not very "realistic".
As TMM pointed out, most people should have some kind of pattern when travelling. Uniform distribution on the $(U^A_i)$ and $(U^B_i)$ also means
the below situations have the same likelihood:

$A$ visits one city per day $N$ days in a row then do not move the rest of the year
$A$ stays $365/(N+1)$ days in each city he visits
anything in between
and let's not forget it's the same for $B$
the model also assumes that $(U^A_i)$ and $(U^B_i)$ are independant by the way

Depending on the circumstances, those may not be desirable properties...
Comment: All your points and suggestions are valid. Originally, I though that all the ways for A & B to move around in the span of one year should be equally probable, but now you mention it... I think they should not be equally probable.  I will update this question accordingly to your suggestions.
Comment: I updated the question saying the ways for A & B to move around the span of one year were equally probable, simply because I don't know how to formulate the fact they are not...
Comment: @Cooluhuru read your edit, you specified how $A$ and $B$ decide **where** they move, but not **when**. I assumed a uniform distribution and included a possible answer (partial, see Nick G) in my edit.
Comment: this is (to my point of view) a god-like answer. I'd really like to mark @Nick G answer as correct as well, but unfortunately I cannot mark both as correct.
Comment: Also, I updated the question with a more acute description of the real life scenario I had in mind.
Answer: The length of time involved is irrelevant.
Whenever a person moves, whether it is $A$ or $B$, either they move to the point where the other person is or they don't. The probability they don't move to the other person's point on any one move is $\frac {p-2}{p-1}$, and this applies to $M+N$ moves.
Hence the probability that $A$ and $B$ meet at least once is $$1-\left(\frac {p-2}{p-1}\right)^{M+N}$$

There were different interpretations of how to measure time. What's above holds if time is measured continuously and the probability of simultaneous moves is zero. What's below isn't correct - see the comments - but I'll leave it here because edits and comments by the OP and N.Bach refer to it. N.Bach's answer contains a better analysis of simultaneous moves.

However, there is a complication when moves occur simultaneously.
Assumption: when $A$ and $B$ move simultaneously they only meet if they both move to the same point. Moving to the point that the other person leaves does not count as meeting.
In this case there are $(p-1)^2$ pairs of destination points and $p-1$ outcomes where $A$ and $B$ meet. (Analogy: you roll two dice; you meet when you roll a double.) In effect, simultaneous moves have the same outcome probabilities as a move by one person.
Let $X$ be the number of times $A$ and $B$ move simultaneuosly. Then the overall probability that $A$ and $B$ meet at least once becomes $$1-\left(\frac {p-2}{p-1}\right)^{M+N-X}$$
Comment: This is a very good observation.  It makes the problem much simpler.
Comment: There are p-2 outcomes where $A$ and $B$ meet, so you need to tweak the probability a little bit...
Also, the length of time is actually relevant in determining the value of X.
Comment: Yes, you are right. By my definition, both the points that $A$ and $B$ occupy are excluded, hence $p-2$ outcomes. On the other hand, if time is measured continuously, I could argue that the probability of simultaneous moves is zero. If time is measured in discrete intervals, then I agree I need to account for that too when considering simultaneous moves. I'm about to read your edited answer...


how to pass extra parameter in Ajax AutoComplete for jQuery?

Question: hi i am using Ajax AutoComplete for jQuery
in my jquery i am using
        options = { serviceUrl: "<? echo $this->config->item('base_url'); ?>index.php/welcome/autocomplete" };
        a = $('#query').autocomplete(options);

i saw that i can pass extra parameters like
var a = $('#query').autocomplete({
    serviceUrl:'service/autocomplete.ashx',
    minChars:2,
    delimiter: /(,|;)\s*/, // regex or character
    maxHeight:400,
    width:300,
    zIndex: 9999,
    deferRequestBy: 0, //miliseconds
    params: { country:'Yes' }, //aditional parameters
    noCache: false, //default is false, set to true to disable caching
    // callback function:
    onSelect: function(value, data){ alert('You selected: ' + value + ', ' + data); },
    // local autosugest options:
    lookup: ['January', 'February', 'March', 'April', 'May'] //local lookup values
  });

so i want to create n new parameter and pass it like this
         var a = $('#query2').autocomplete({
             serviceUrl: "<? echo $this->config->item('base_url'); ?>index.php/welcome/autocomplete",
             id:'query2'
            });

How can i access that extra parameter from the autocomplete code ?? i want to add that id to my
.autocomplete-w1

initially it looks like this

i want to change it to

please help................................
UPDATE
i tried to adding my id parameter to this function
  function Autocomplete(el, options) {
    this.el = $(el);
    this.el.attr('autocomplete', 'off');
    this.suggestions = [];
    this.data = [];
    this.badQueries = [];
    this.selectedIndex = -1;
    this.currentValue = this.el.val();
    this.intervalId = 0;
    this.cachedResponse = [];
    this.onChangeInterval = null;
    this.ignoreValueChange = false;
    this.serviceUrl = options.serviceUrl;
    this.isLocal = false;
    this.options = {
      autoSubmit: false,
      minChars: 1,
      maxHeight: 300,
      deferRequestBy: 0,
      width: 0,
      highlight: true,
      params: {},
      fnFormatResult: fnFormatResult,
      delimiter: null,
      zIndex: 9999,
      id:'test'
    };
    this.initialize();
    this.setOptions(options);
  }

i gave a default value test . when i alert $this.options.id i always getting 'test' the value i passig jquery2 is not getting . what is the problem there ????
Answer: hmmm. i have solved it .
i added extra parameter id
        a = $('#query').autocomplete({
                                        serviceUrl: "<? echo $this->config->item('base_url'); ?>index.php/welcome/autocomplete",
                                        id: 'query'
                                    });

in my jquery.autocomplete.js in
 function Autocomplete(el, options) {

i get that parameter like
  this.id = options.id;

now i can add it to div's id

thanks.................... :) :) :D


How do I migrate a multilingual site?

Question: I'm currently trying to migrate my Drupal 7 site, which has the Dutch language enabled, to Drupal 8. I have enabled the following modules as instructed in the docs: Configuration Translation, Content Translation, Interface Translation, Language. After running the migration, no nodes have been created on the Drupal 8 site. Moreover, the log contains lots of error messages similar to the ones underneath.

Migration d7_node_complete:webform did not meet the requirements.
  Missing migrations language. requirements: language.
Operation on Node complete (Webform) failed

Am I doing something wrong? How can I solve this?
Answer: It turned out that some of the migration processes were stuck after the first attempt. Here is how I solved the problem and completed the migration of my multilingual site:

Download and enable the Migrate Tools module and Drush 8
Run drush help to verify that new migration commands such as migrate-status and migrate-import are enabled
Run drush migrate-status and check the migration processes; all statusses should be Idle, but in my case some were stuck on Importing
Use migrate-stop to stop any running processes; according to the documentation, this ''cleanly stops a running operation''
Use migrate-reset-status to set the status of stopped processes back to Idle; according to the documentation, this ''sets a migration status to Idle if it's gotten stuck''
Continue the upgrade via the web browser or Drush

How do I migrate a multilingual site?


How to host multiple subdomain on another server

Question: I have one webserver and one Application server.
Webserver1 have FreeBSD 8.1, Apache, MySQL and PHP.
Application1 server have Centos 5.5, Apache, Mysql and PHP.
Both server running fine independently. My webserver1 is hosting my company website www.azrim.com which running good. Besides I have 2 online application which requires me to host them as a subdomains.
My questions is I want to make subdomains such as abc.azrim.com and xyz.azrim.com is accesscible from Application1 server. Can anyone pls help me on this. What should I do on apaches configuration on both webserver1 and Apps1 server. I only have 1 NIC card on my Apps1 server.
Really appreciate anyone who got the solution.
Thanks
Azrim
Comment: If you only have 1 NIC card, I'm not really sure what you can do.  Can the server without the NIC card connect to the network at all?
Answer: You'll need to setup virtualhosts on the apache server
The config will look something like this:
NameVirtualHost IP:80
<VirtualHost IP:80>
   ServerAdmin     EMAIL
   DocumentRoot    /PATH/TO/WEB/FILES
   ServerName      SERVERNAME
</VirtualHost>

It won't be exact, but that should get you on the right path.
Comment: hi jmort253. I got another questions. From the config that I have done was working fine where i can access abz.azrim.com and xyz.azrim.com....unfortunately i can't access it from the external IP. FYI I have done NAT IP in my firewall like others NAT server. Also configure my external DNS server to point to the correct Public IP. Others NAT Server working just fine but my subdomain server just not working to the outside world. Any idea where should I look into? really appreciate ur helps.
Comment: How does he get traffic to the machine that doesn't have a NIC card?
Comment: Nevermind, his question wasn't clear initially.  1 NIC card on the apps server should work for multiple domains.
Comment: @jmort253:  I think you misread his question.  Apps1 has only one NIC.
Comment: I sure did... now it's clear :)
Comment: Do I need to config that virtualhost on my webserver1 or apps1 server?
Comment: Appserver I believe, because that is where you're using two subdomains.
Comment: what about the webserver1 apache config? Do I need to do anything?
Comment: Does it already work?  If it ain't broke, don't fix it ;)
Comment: will try it now...will let u know :)
Comment: jmort253: finally its work. thanks for giving an advise. it works fantastic like what i really need. I dont have to do anything on my webserver1. just few configs on Apps1 server only. Now I can have multiple subdomains on my apps1 server. but dont know what is the max subdomain can I have. But for me less 10 is more than enough i think
Comment: @Azrim - Glad to hear it's working! :)
Answer: NameVirtualHost 172.16.4.18:80

<VirtualHost 172.16.4.18:80>
  ServerAdmin firstname.lastname@example.com
  DocumentRoot /var/www/html/abc
  ServerName abc.azrim.com
</VirtualHost>

<VirtualHost 172.16.4.18:80>
  ServerAdmin firstname.lastname@example.com
  DocumentRoot /var/www/html/xyz
  ServerName xyz.azrim.com
</VirtualHost>

Comment: above is my code...kindly advise..


Allow people to administer only on certain content type?

Question: Under "admin/people/permissions" there is a permission that allows users to administer all the content types.

I want to create a role that can only administer an "Article" content type.
How can I achieve this?
Comment: Are you interested in existing modules, or would you be interested in writing your own code for handling this?
Comment: @kiamlaluno I prefer writing own code for handling this.
Answer: The menu callback for "admin/structure/types/manage/%node_type" is defined in node_menu() using the following array item:
  $items['admin/structure/types/manage/%node_type'] = array(
    'title' => 'Edit content type',
    'title callback' => 'node_type_page_title',
    'title arguments' => array(4),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('node_type_form', 4),
    'access arguments' => array('administer content types'),
    'file' => 'content_types.inc',
  );

There are other two menu items that follow it, but they depend from that menu item for the access callback.
  $items['admin/structure/types/manage/%node_type/edit'] = array(
    'title' => 'Edit',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );
  $items['admin/structure/types/manage/%node_type/delete'] = array(
    'title' => 'Delete',
    'page arguments' => array('node_type_delete_confirm', 4),
    'access arguments' => array('administer content types'),
    'file' => 'content_types.inc',
  );

Once you change the access callback for the first menu item, the other two will use the same access callback.
The first step, for the custom module I would implement to achieve what you want is to implement hook_permission(). node_permission() is useful as guideline to write the code you need.
function mymodule_permission() {
  $perms = array();

  foreach (node_type_get_types() as $type => $info) {
    $perms["administer $type content type"] = array(
      'title' => t('%type_name: administer content type', array('%type_name' => $info->name)),
    );
  }

  return $perms;
}

The foreach() part could be rewritten as the following code:
  foreach (node_permissions_get_configured_types() as $type) {
    $info = node_type_get_type($type);

    $perms["administer $type content type"] = array(
      'title' => t('%type_name: administer content type', array('%type_name' => $info->name)),
    );
  }

The difference is that node_permissions_get_configured_types() is using some Drupal variables that are set in a settings page. The function is used also from the Node module when creating the list of the permissions associated to a node of a content type. The documentation for the function reports the following text:

To exclude a specific node from getting permissions defined for it, set the "node_permissions_$type" variable to 0. Core does not provide an interface for doing so; however, contrib modules may exclude their own nodes in hook_install(). Alternatively, contrib modules may configure all node types at once, or decide to apply some other hook_node_access() implementation to some or all node types.

The second step is to alter the menu item already defined by the Node module.
function mymodule_menu_alter(&$items) {
  if (isset($items['admin/structure/types/manage/%node_type']) {
    $items['admin/structure/types/manage/%node_type']['access callback'] = '_mymodule_content_type_access';
    $items['admin/structure/types/manage/%node_type']['access arguments'] = array(4);
  }
}

_mymodule_content_type_access() should contain code similar to the following one:
function _mymodule_content_type_access($type) {
  return user_access("administer {$type->type} content type");
}

Comment: +1 beat me to it by 4 minutes :) I'll leave mine up as a self-contained code example as it might come in handy for someone
Answer: The easiest way I can think would be to provide a new separate permission for each available content type which you can assign to arbitrary roles, then override the access callback for the content type edit form to use this new permission:
// Implements hook_permission()
function MYMODULE_permission() {
  $permissions = array();
  // Build up a permission for each content type
  foreach (node_type_get_types() as $type) {
    // Get the permission key
    $permission_string = _MYMODULE_permission_string($type->type);

    // Add the new permission
    $permissions[$permission_string] = array(
      'title' => 'Administer ' . $type->name . ' Content Type',
      'restrict access' => TRUE
    );
  }

  return $permissions;
}

// Implements hook_menu_alter()
function MYMODULE_menu_alter(&$items) {
  // Override the access callback
  $items['admin/structure/types/manage/%node_type']['access callback'] = 'MYMODULE_content_type_access';

  // Override the access arguments so we receive the content type object
  // rather than the standard permission name.
  $items['admin/structure/types/manage/%node_type']['access arguments'] = array(4);
}

// Access callback function
function MYMODULE_content_type_access($content_type, $account = NULL) {
  // If no account object is provided use the logged in user
  if (!$account) {
    global $user;
    $account = $user;
  }

  // If the user has access to edit all content types then we should return
  // TRUE.
  if (user_access('administer content types', $account)) {
    return TRUE;
  }

  // Otherwise create a permission string based on the provided content type.
  $permission_string = _MYMODULE_permission_string($content_type->type);

  // Return access based on the permission string
  return user_access($permission_string, $account);
}

// Helper function to build up a standardised permission string
function _MYMODULE_permission_string($type_name) {
  return 'administer ' . $type_name . ' content type';
}

Comment: Worked really great, except I had to override `$items['admin/structure/types']['access callback']` as well to check if the user had access to any of the content types before they could reach that page. I also had to override the table that is rendered to check for access to each content types. I need to see if there's a way to modify that table without overriding the page callback. If I get a chance, I'd love to roll this into a module at some point :-p
Comment: When using in a drupal instance based on an installation profile, I had to implements hook_module_implements_alter() (see http://docs.getdkan.com/dkan-documentation/dkan-developers/developing-dkan/overriding-dkan-forms).
Answer: You also have, on permissions, for each role:

Article: Create new content
Article: Edit own content
Article: Edit any content
Article: Delete own content
Article: Delete any content.

What else do you need?
Comment: 'Edit own content' is different with 'edit content type'
Comment: Users with the permission to administer content types change the settings for the content type; the users who can edit any content are the user with the permission to administer content. Being able to delete any article doesn't mean being able to change the settings for that content type, which are shown on admin/structure/types/manage/article.
Answer: Workbench module can also help here.  Different roles can have access to steps in Workbench, ie you can have different roles access different steps in workbench.


'Permission denied' to a file I own?

Question: My user, bob, can't access files that he (theoretically owns).  I'm running Fedora Core 8. It probably easier to shown than tell:
> ls -al .
total 32
drwxrwxr-x 7 bob bob 4096 May 18 14:33 .
drwxrwxr-x 4 bob bob 4096 May 12 15:44 ..
drwxr-xr-x 2 bob bob 4096 June 1 14:22 log

> cd ./log
-bash: cd: log/: Permission denied

> ls -al ./log
ls: cannot access log/..: Permission denied
ls: cannot access log/the.log: Permission denied
ls: cannot access log/.: Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
-????????? ? ? ? ?            ? the.log

> sudo ls -al ./log
drw-rw-r-- 3 bob bob      4096 Jun  2 04:11 .
drwxrwxr-x 7 bob bob      4096 May 18 14:33 ..
-rw-rw-r-- 1 bob bob         0 Jun  1 04:12 the.log

The ls -al stands out as very odd.  It will list the files that I don't have permissions to see, but not show me the permissions?
So the questions are, what would cause this?  And what can I do to repair it?
Answer: > sudo ls -al ./log
...
drw-rw-r-- 3 bob bob      4096 Jun  2 04:11 .

It doesn't look like Bob has execute permissions for ./log, so he can't cd to it.
But
> ls -al .
...
drwxr-xr-x 2 bob bob 4096 June 1 14:22 log

shows that he does. But it doesn't look like they are pointing to the same file (different permissions, different modtime).
Try sudo ls -ail ./log and ls -ail to see if the inode is the same.
Answer: Things are more simpler than filesystem corruption or selinux. As you can see you are missing the x (executable) permission on the log directory. Actually for directories x means that someone is able to change to that directory. Just do an "chmod +x log" to fix that perm and you should be able to access it.
Comment: > Actually for directories x means that someone is able to change to that directory

Wow. I keep forgetting that ; thanks.
Comment: THIS answer should be the top answer. Thank you (y).
Answer: I have seen things like that when the filesystem has been corrupted, or if you have a failing drive.  The fix usually is to run fsck against the filesystem and let it correct errors it has found.
Comment: I did this just about an hour ago on one of my file servers. +1
Answer: Also, check SE/Linux settings.  Sometimes the permissions on the file don't have anything to do with whether or not you can access it.
Comment: I Agree with @David Mackintosh. If SELinux is enabled and if the files/directories were created by someone else and then changed ownership to bob, this is likely to happen. as the context of files remains with the original author and wont be accessible till the context is also changed to Bob user.
Answer: The files may have the immutable or append only extended attributes set. I've had this happen before and not even root could delete the file.
Extended attributes can be views via "lsattr" and altered via "chattr"
Answer: A more concise answer IMO.
Your directory does not have executable permissions, which are required by cd.
Fix:
$ sudo chmod +x ./log

Recursively:
$ sudo chmod -R +x ./log

+x is adding the executable attribute. You can always remove the attribute by doing -x
Answer:
> sudo ls -al ./log
drw-rw-r-- 3 bob bob      4096 Jun  2 04:11 .

I am not sure why but the "." entry in ./log/ doesn't have execute permissions. The permissions should be identical to those for ./log.
Can you try chmod 755 ./log and chmod 755 ./log/. and see if either command fixes the access?
Other than that I would advise that you run an fsck on the filesystem because it looks like it is out of sync.
Answer: Have you tried changing ownership of the directory to someone else, then back to Bob?  Zoredache's advice is better, though - just fsck it!
Comment: This type of issue always ends up being directory permissions.

'Permission denied' to a file I own?


Pixel issue of characters in concatenation. Cols should be fixed as per the width for all the cols concatenated

Question: These values are stored as part of 1 column. They are actually 3 cols concatenated through sql oracle. How can I make these values look aligned as 3 different cols?
Currently, these numbers will be 3 characters for 1 col, 10 for second and 7 for 3rd col. For some reason I had to bring them in 1 column to use in my rtf template. I need a solution in SQL Oracle to set width in concatenated cols. I am using cast here but this is the output I am getting
CAST(TO_CHAR(G_WEIGHTAGE)||'%' as char(3))||'  '
||CAST(TO_CHAR(G_ACHIEVE , '990.00')||'%' as char(13)) ||'  '
||CAST( TO_CHAR(ROUND((G_ACHIEVE_FACTOR*(G_WEIGHTAGE/100)),2)*(TARGET_BONUS/100), '990.00')||'%' as char(8)) AS G_WAIT

This is for 1st line in this output. I have written for other lines as well same way.
This is how it is coming
 40% 96.79% 9.60%
 10% 99.89% 2.70%
20% NA/ 51.42% 0.00%
 10% 62.90% 0.00%
10% 112.77% 4.80%

Output I need :
 40%     96.79%     9.60%
 10%     99.89%     2.70%
 20%  NA/51.42%     0.00%
 10%     62.90%     0.00%
 10%    112.77%     4.80%

I believe this is due to different characters having different width. Like N has different width in comparison to 1.
Comment: Enter your data as `formatted text` please.
Comment: Please edit your question and add your SQL. Also text is better than images. I think you probably just want `RPAD()`, maybe with `SUBSTR()`. But a clear question will get you a clear answer.
Comment: Normally you would use lpad/rpad, but casting as `char` should work as well (it should be equivalent to `rpad`). Can you post a complete test case so I can see which step isn't working as expected?
Comment: I tried everything but it seems it is due to length of Sach character like N is big and 1 is small and
1 space charcuterie is if different length . This is pixel length due to which it looks tilted. If I use 0 instead of space it comes fine.
Comment: I don't think you mean "Pixel" (or "charcuterie"). Are you talking about aligning with variable-width fonts?
Comment: Yes variable width fonts of characters I mean...as N is big in comparison to space in terms of width... thus seems to be pixel issue
Answer: Yeah, you want a PAD function. They add spaces to make a string a specific width. Try this:
lpad(TO_CHAR(G_WEIGHTAGE)||'%',3) ||'  '
||lpad(TO_CHAR(G_ACHIEVE , '990.00')||'%',13) ||'  '
||lpad(TO_CHAR(ROUND((G_ACHIEVE_FACTOR*(G_WEIGHTAGE/100)),9)*(TARGET_BONUS/100), '990.00')||'%',7) AS G_WAIT

Comment: There is more than just SQL involved. While SQL can adjust the number of characters in the resulting columns, it cannot adjust for character width differences.  What tool are you using the display the results. Perhaps changing the FONT to a fixed or mono spaced font.
Comment: Hey I have applied lpad but the problem is this is adding spaces but still not making the values right aligned . Actually its gets aligned but the length of second col data makes the first col data move a bit more towards left like in 3rd row and 5th row as the length of second col data is different here.
Comment: @AlkaOjha you might need more padding - I'll edit my answer to increase the values
Comment: No I tried everything but it seems it is due to length of Sach character like N is big and 1 is small and
1 space charcuterie is if different length . This is pixel length due to which it looks tilted. If I use 0 instead of space it comes fine.
Comment: Hey ...I am using rtf template to display my output here ... RTF is created on word document with tags to generate the output.... I am using SQL in bi publisher tool which calls rtf template and prints the output as per the rtf layout. Plz help where sql or rtf how to make fixed or mono spaced font...
Comment: Also do confirm if whitespace or blank will also work with monospace font as I am gonna append lpad with blank in my sql query or do suggest if there is any other way to do it ?


Re-arranging Equation with Integer Division

Question: I have an equation that uses integer division (for calculating days in a number of months):
$x=30m
+\left\lfloor \frac{m+10}{11} \right\rfloor
+\left\lfloor \frac{m+8}{11} \right\rfloor
+\left\lfloor \frac{m+6}{11} \right\rfloor
+\left\lfloor \frac{m+5}{11} \right\rfloor
+\left\lfloor \frac{m+3}{11} \right\rfloor
+\left\lfloor \frac{m+1}{11} \right\rfloor
$
where $m$ is an integer in the range $0 \leq m \leq 11$. The year is taken to start at March 1st. So m=1 results in x=31 (Days in march), m=2 results in x=61 (days in March+April) and so on up to m=11 resulting in x=337 (Days in March through Dec plus Jan).
I was wondering how do you re-arrange the equation to solve for $m$? Re-arranging the equation normally does not work because it will end up containing $\frac{10+8+6+5+3+1}{11} = 3$, where as the integer division can make the fractional parts sum to as low as zero.
Comment: I think you're trying to pack too much into one formula. And I doubt the correctness anyway. $m = 0$ yields $0$; $m = 1$ yields $31$, $m = 2$ yields $61$. So I don't really understand what those numbers mean. (January has 31 days which corresponds to $m = 1$, first month; February has 28 or 29 days, but $m = 2$ doesn't correspond to the number of days at the end of February in either case).
Comment: The year is taken to start at March 1st. So m=1 results in x=31 (Days in march), m=2 results in x=61 (days in March+April) and so on up to m=11 resulting in x=337 (Days in March through Dec plus Jan). I am confident it works in that direction. But I don't understand how to go backwards, from x (number of days) back to a month (0 to 11).
Comment: @rubik what I meant was that the divisions ignore their remainder. So that 10/11 = 0, 11/11 = 1, 12/11 = 1.
Comment: I think you're missing " $+\left\lfloor \frac{m+0}{11} \right\rfloor$ " for the $31$ days in January. Also if you changed all denominators from $11$ to $12$ and increased the addition constants by $1$ also, you could add  " $-2\left\lfloor \frac{m+0}{12} \right\rfloor$ " to count a normal February also.
Comment: In my formula the months are March to Feb for m = 0 to 11 respectively. This is so that it works for both leap years and non leap years. Anyway that part is not really relevant. What I am wondering is how you do the formula back the other way, considering that the division is all interest division (that is the result of all divisions round down to the nearest int).
Answer: A suitable reverse function to return which month $m$ a particular given day $d$ is in, returning $m=1$ for March etc. can take advantage of the regular near-alternation of the longer and shorter months:
$$m=\left \lfloor \frac{d-0.5}{30.6}+1 \right\rfloor$$
where $\lfloor\cdot\rfloor$ rounds down to the nearest integer.
Comment: The problem with that is July/August does not alternate, they are both 31. So it fails from 1st August. However I have figured out that since average days is 30.6, and there is a need to remove rounding error, so multiple that by 5 to get 153. Then the first month (march) has 31 days, not 30, so add two, this results in: $$m=\left \lfloor \frac{5d + 2}{153} \right\rfloor$$ , m=0 for march, 1 for april and so on. unto 11 for feb. This also means my original equation can simplify down to $$d = \left \lfloor \frac{153m + 2}{5} \right\rfloor$$
Comment: Just to calarify, the two is from (31-30.6)*5= 2, since the first month needs to start at 31, not 30.6.


What one-octave set of notes is most comfortable for an SATB choir to sing in unison/octaves?

Question: I'm scoring a piece for SATB choir and there is a moment that I want a melody sung in unison/octaves by the whole choir.  The melody spans an octave.  I first conceived of the melody in A minor, where its range spans from E to E.  This would be perfectly fine for soprano and tenor, but sits too high for alto and bass.  But if I transpose the melody down much lower, the sopranos and tenors begin to bottom out their ranges.  I know that it will not be perfect.
What range for a one-octave melody is likely to be most successful and least uncomfortable for the singers in a standard SATB choir?  Are there examples in the literature that use choral unison/octave over a range this large?
I would rather not ask any voice part to change octave halfway through.
I'm thinking spanning from C to C is the most attractive option.  That notion is supported by this question (link), which mentions the same range but for amateur singers instead of trained musicians.  If it matters for this question, the choir is auditioned, professional ensemble.
Comment: Professional basses and altos should be able to sing an E.  This suggests that the tessitura is high.  Is it?
Comment: Not exactly a dupe, but very close: https://music.stackexchange.com/questions/114819/vocal-range-of-a-crowd
Comment: @ToddWilcox not for sopranos and tenors.
Comment: @ToddWilcox because middle C (written an octave higher in treble clef, the first ledger line above the staff in bass clef) is too high?  Are we talking about the same octave here?
Comment: @ToddWilcox linked from the third comment under [Accepted ranges for SATB choral works](https://music.stackexchange.com/q/5977/2257) is a PDF that compares the recommendations of eight books on orchestration and arranging.  For professional choral sopranos (first sopranos where distinct ranges are given), two list D4 as the lowest note for first sopranos and one lists D3 as the lowest note for tenors.  On the other end of the spectrum, only two sources give A3 and one gives Bb3 for sopranos while one gives Bb2 and one A2 for tenors.  You may be comfortable with Bb2 but a lot of tenors aren't.
Answer:
What range for a one-octave melody is likely to be most successful and least uncomfortable for the singers in a standard SATB choir?

It depends largely on the dynamic level and character of the melody.  If you look at the ranges in this PDF survey of orchestration texts (found in a comment on the question Accepted ranges for SATB choral works?), you will see that the upper limit for altos and basses is around D5/D4 (with a lot of variability from one source to another) and the lower limit for sopranos and tenors is given anywhere from A3/A2 to D4/C3.
So depending on which authors you choose to believe, you could go anywhere from A to D.  But look, you don't want basses and altos trying to sing the upper D quietly, and high sopranos are not going to have much to give below the lower D, certainly not loudly.  So if it's a loud passage, I'd go for D or D♭.  If it's quieter, lower will be better.  I have known quite a few sopranos and tenors who are unhappy down there, so I would not go below C or maybe B♮.
The choice of pitch with also depend on tessitura.  If the melody stays near the top of its one-octave range then you'll want to choose a lower pitch, and the converse is true as well.
Aaron's idea of having the basses two octaves below the sopranos is intriguing, but I'm unaware of any examples of this in the literature, and I suspect that you would have pervasive balance problems with the sopranos near the top of their range and the basses near the bottom of theirs.

Are there examples in the literature that use choral unison/octave over a range this large?

Well the first that springs to mind is Handel's Hallelujah chorus, which has the initial statement of "for the lord god omnipotent reigneth" in unison.  It's in D major.  The sopranos start on A4, ascend stepwise to D5, drop an octave and then back up, then descend stepwise to A4.  The basses and tenors double them an octave lower.  (The altos sing the first note in the soprano octave and then jump down to join the men, except for the low D, but this is possibly because many of them were men singing in falsetto).  Note that this music was probably performed around a half step below modern pitch.
There are quite a few passages in octaves in Beethoven's 9th symphony, including a few where the basses are two octaves below the sopranos, I just learned.  The ninth is notoriously difficult to sing, so take it with a grain of salt, but it will be helpful to have a look at it.
There's also a brief passage in the Dies Irae of Verdi's Requiem, starting (ppp) on a low B♭, but it doesn't span an octave.
Comment: Whether music is notated for basses to sing down two octaves from the women, or for upper sopranos to sing up an octave, I would view most unison music as though it included a direction "singers choose octave ad lib".  In some passages, it may be better for basses that can't sing high notes to drop out rather than sing down an extra octave, and it may be inappropriate for sopranos to sing up an octave, but for other passages adding the extra octaves would lead to a fuller sound.
Answer: B♭ to B♭ is safe for all voices.
Comment: Bb seems tricky for tenor/soprano to me.  If they sing in the lower octave, it's really pushing their low end; if the upper octave, yikes!  Wouldn't C be safer?
Answer: TL;DR: Write C-D(+oct), with sopranos and altos in unison on octave above the unison tenors and basses.

The accepted answer to What are the typical ranges of voice types? gives the following as the most comfortable ranges (tessituras) for each vocal part:

S: A4 - G5
A: D4 - C5
T: A3 - F4
B: E2 - G3

The overlap, without regard to octave, is either E to F (a minor second) or A to C (a minor third)

S-A overlap = D-G or A-C (fourth / third)
 -T overlap = D-F or A-C (third / third)
 -B overlap = E-F or A-C (second / third)

Obviously, this is insufficient.
Looking at the wider, standard range for each voice, we have (from the above-linked post):

S: C4 - G5
A: G3 - D5
T: C3 - G4
B: D2 - C4

Now the overlap (disregarding octave) works out to be:

S-A overlap = C-D(+oct) or G-G(+oct) (ninth / octave)
 -T overlap = C-D(+oct) or G-G(+oct) (ninth / octave)
 -B overlap = C-D(+oct) or G-G(+oct) (ninth / octave)

Thus, the overlap areas, mapped back to each voice's range, are:

S: C4 - D5 or D4 - D5 or G4 - G5
A: C4 - D5 or D4 - D5 or G3 - G4
T: C3 - D4 or D3 - D4 or G3 - G4
B: C3 - D4 or D2 - D3 or G2 - G3 (see note)

Notes outside these ranges will either be too low or too high for at least one vocal part, unless the part suddenly changes octave.
Finally, G-G is not ideal, because (as @the-baby-is-you points out in the comments) the high range is likely to be difficult for mezzos, baritones, or untrained singers, and the sopranos will tend to stick out in the texture, being one or two octaves higher than the other voices.
Conclusion: the best range is C - D, with alto-soprano and tenor-bass unisons.

Note: Wikpedia, via The New Grove Dictionary of Opera, cites the bass range as E2 - E4. My own experience is that E2 is comfortable for basses, but D2 is too low for some, so D3 - D4 might be the better range. Also, as @phoog points out, it would be more typical to have the basses one octave below the sopranos rather than two.
Comment: Tessitura isn't exactly the same as range. It's where more notes sit, so not the same.
Comment: @Tim indeed, tessitura is often used in contrast to range, as in "the part is entirely within the range of sopranos and altos, but because of the low tessitura most sopranos dislike singing it."
Comment: Unfortunately, the chart in the linked answer is somewhat flawed, so this answer is as well.  In an average professional bass section, approximately 100% of the singers will be able to sing D4 and maybe 20% to 30% D2.
Comment: @phoog I'd be happy to update my charts (only have time for a quick comment just now), but I don't think adjusting the bass range will change the answer, because the other voices will still limit the overall range. Let me know if you think otherwise.
Comment: @ToddWilcox According to the chart I based my answer on, C4 - G5 is the "core" soprano range. It would seem that head voice is being excluded.
Comment: Should your last code block have C for the lowest note in the range, rather than D?
Comment: @Edward No, because, according to the chart I based the answer on, that would be too low for the basses.
Comment: Oh, I see.  Then there is another available 1-octave range of C to C, with the basses up an octave.
Comment: "I don't think adjusting the bass range will change the answer, because the other voices will still limit the overall range": in most contexts where a melody spans an octave from D to D it would make more sense to have the basses in the range D3 to D4, not D2 to D3 (which is why I made that comment about typical availability of D2 and D3 in a professional bass section).
Comment: @phoog Got it. I've updated the answer, including a citation, to reflect that.
Comment: @Edward Thanks. I've updated the answer.
Comment: G-G is a terrible range for anyone who can't comfortably reach either extreme (baritone, mezzo, and the majority of untrained singers), and in practice is also terrible for sopranos, who will stick out like a sore thumb singing up an octave. Stick with D.
Comment: @the-baby-is-you That's a great point. May I add that to the answer?
Comment: @Aaron Go ahead
Answer: I'd advice to not have the sopranos and tenors go below a C4/C3, and to not have the Altos and Basses go over C5/C4. But also keep in mind that if you have the voices unisono the Altos can compensate for the sopranos in the low range, while the sopranos can compensate for the Altos in the high range (similar with the Tenors and Basses). So in the high range the Altos and Basses can try to sing as soft as possible or even stop singing at all.
Comment: @phoog That only somewhat true. The mechanics of the voice are a bit more complex, so I won't elaborate on this, but unless you are in a range where the only way to get the tone is to force it any decent choir singer should be able sing softly. And this is exactly the point, if the Alto or the Bass cannot do the high C without forcing it they can omit the notes.
Comment: It's generally easier to sing loudly near the top of one's range than softly.


How do you play left and right hand Piano according to this player?

Question: I am trying to mimic, or duplicate the style to this player.  I can't see what he is doing with his left hand?  And, any advise about how to learn his style?  As far as researching his style, yes I have and I believe I need assistance in figuring it out.  The second song can't tell how he is using octaves, doubling the base, and walking base.
Answer: This is not complicated. Yes, the left hand is playing the root notes of the chords throughout except in the two bars before the falsetto stuff where the right hand plays the chords F C F C F C. The left hand stays on C throughout those bars.
Apart from those two bars, where it plays on the same syncopated beats as the right hand, the left hand plays on all four beats of every bar - bonk bonk bonk bonk - mostly playing the root notes in octaves. Sometimes he may play the root and the fifth. You won't need more than three fingers on your left hand.
How to learn his style? While counting repeatedly from 1 to 8, practise (US: practice) playing a C in octaves with your left hand on 1 - 3 - 5 - 7 - Keep that going and add a chord of C in the right hand, playing on 1 2 - 4 - 6 - 8. When you can do that you've pretty much mastered what you call his style.
Comment: Thank you old Brixtonian!!  You appear to know your stuff !!  I will move ahead with your advice.
Comment: I was wondering Mr. Brixtonian, if you have time, look at second video, "Caught in a Trap", how he does the base, double base chords? How he is walking the base?
Comment: If you wanted to accept my answer I'd feel more like answering a second. But really it's as guest said, this stuff is not complicated. He seems like a nice guy but his pedalling is horrible! [I wish StackExchange wouldn't question British spellings. "Pedaling?!"]
Comment: I think you all are trying to tell me something....just kidding.  I get it.
Answer: You can see pretty well what his left hand is doing by looking at the reflection in the piano fallboard.
It's not doing anything so complicated that you need to track every single note.
Comment: Thank you, I was just wondering if his left hand is playing the same chord as his right hand, in different inversion or voice?  Same about of notes as right?


Condition for divergent series

Question: When studying the material of convergent series, I came up with a question.
Is $\lim_{n \to \infty}a_n \ne 0$ a sufficient and necessary condition for the series $∑a_n$ to be divergent?
Answer: It is sufficient, but not necessary, as $\lim_{n\to\infty}\frac{1}{n}=0$ but this gives the well-known harmonic series $$\sum\frac{1}{n}.$$We can check this diverges, for example, by the integral test.
Answer: If $a_n$ does not go to $0$ as $n\to\infty$, then the sum will not converge.
However, even if it goes to $0$, the sum could still diverge, say $a_n=\cfrac{1}{n}$.
Answer: It is sufficient, but not necessary.  For example, the harmonic series
$$\sum \frac{1}{n}$$
diverges, even though
$$\lim_{n \to \infty} \frac{1}{n} = 0.$$
Answer: not necessary since $\sum\frac{1}{n}$ diverges, it is sufficient though as if $\sum\frac{1}{n}$ converges, then $a_n=S_n-S_{n-1}$ converges to $0$ (here $S_n$ is the partial sum $a_1+\cdots +a_n$).

Condition for divergent series


how to reinstall grub on ESX 4 system?

Question: I rebooted my esx 4 server today and was greet by a single bit of text that said GRUB and it hung.  I am attempting to restore the MBR GRUB partition, but am having difficulties.  All i have is the ESX 4 installation ISO.  Can someone help me with the procedure to make this work?
Answer: I was able to fix it by booting from the ESX 4 DVD, then stepping through the install until it loaded the storage drivers.  Then, ctrl-alt-F2 and this procedure:
<code># grub
grub> root (hd0,0)
grub> setup (hd0)
</code>
then rebooted and all was good.
Answer: I've used this Super Grub Disk to repair a linux install's boot loader before.  Can anyone confirm that this will work with ESX?
Comment: Doesn't help when you're stuck in a data center with no way to burn disks.

how to reinstall grub on ESX 4 system?


Does each compact operator have a non–zero eigenvector?

Question: I have learned that 0 must be an eigehvalue for a compact operator. But I do not know if there exists a compact operator that have no non–zero eigenvector.
Any hint would be most appreciated.
Comment: $0$ is always in the *spectrum* of a compact operator (i.e. the set of $\lambda$-s such that $T-\lambda I$ is not bijective), but it needs not be an *eigenvalue* of $T$ (i.e. $T-\lambda I$ may be injective). The correct result is that, if $T$ is compact, then $\lambda\in\Bbb R\setminus\{0\}$ is in the spectrum $\sigma(T)$ if and only if it is a non-zero eigenvalue. Moreover, a terminological issue: eigen*vectors* are always non-zero.
Answer: First, it must be said that $0$ is not always an eigenvalue of a compact operator.  What is true is that $0$ is always in the spectrum  of a compact operator, when the space it acts on is infinite-dimensional.  For example, the operator $T\in\mathcal B(\ell^2)$ defined by $(Tx)(n)=\frac{1}{n}x(n)$ is compact, but $0$ is not an eigenvalue of $T$.
As for the main question, note that the zero operator is compact, and the spectrum of this operator is $\{0\}$.
EDIT I may have read the question wrong.  One can (relatively) easily construct a compact operator with empty point spectrum, hence no eigenvectors.  One example is given by the operator $S\in\mathcal B(\ell^2)$ defined by $(Sx)(n)=\frac{1}{n}x(n-1)$ for $n>1$ and $(Sx)(1)=0$.
It is the composition of the above mentioned compact operator $T$ (hence $S$ is compact), with  a shift operator.  One can show that $\sigma(S)=\{0\}$, but $0$ is not an eigenvalue of $S$.


Computing marginals on a graphical model in Python

Question: I am looking for libraries available from Python to compute marginals on an undirected graphical model (i.e. a random field) with loops.
Some algorithms for this could be LBP (loopy belief propagation) or GBP (generalized belief propagation), although I don't need to use a specific algorithm.
I checked SciKit learn but they don't seem to have much for graphical models.
Answer: Have a look at PyMC (documentation is available as pdf and html)
See also this section on using arbitrary factors.
Comment: for the example in the [tutorial](http://pymc-devs.github.com/pymc/tutorial.html), the plotting of the marginal posterior distribution for one of the parameters is shown in [section 3.5.3](http://pymc-devs.github.com/pymc/tutorial.html#sampling-output)
Comment: Thanks! On a quick look I didn't see anything to compute marginals. Perhaps I missed it?


If a definite integral produces a finite value, does that mean it's convergent?

Question: $\int{_0^5\frac{x}{x-2}dx}$
This integral produces a finite value of 5+ln(9/4). However, according to Wolfram Alpha, it diverges (http://www.wolframalpha.com/input/?i=integral+of+x%2F%28x-2%29+from+0+to+5). How can I tell that this integral is divergent without using Wolfram Alpha? Or is it actually convergent from 0 to 5?
Comment: Did you scroll down to the bottom of the Wolfram Alpha result? It provides the same principal value for the integral which you claimed.
Comment: How did you get the value $5+\ln(9/4)$?
Comment: @DavidH Yes, I did. Nevertheless, I was still confused by "integral does not converge". I assumed the Cauchy principle value is similar to the complex value solutions that Wolfram Alpha often gives.
Answer: We must be very careful with what we mean by "converges" when talking about improper integrals. The usual definition of $\int_a^b f(x)dx$ converging is that $\int_a^b f^+(x) dx$ and $\int_a^b f^-(x)dx$ are both finite, where $f^+(x) = \max\{f(x),0\}$ and $f^-(x) = \max\{-f(x),0\}$.
In the case of $\mathbb{R}$ (as opposed to $\mathbb{R}^n$)  if $a$ or $b$ is infinite it is common to say an integral converges if, e.g. the case where $b$ is infinite $\lim_{M \to \infty} \int_a^M f(x)dx$ exists in $\mathbb{R}$.
For the case you present we can talk about another kind of convergence, namely existence of the principal value of the integral. (Most would not call this "convergence" though I could see why some might.)
In your case, I would use the first (i.e. the most standard) definition of convergence to conclude that the integral diverges.
Comment: By "first definition", you mean when $\int_a^b f^+(x) dx$ and $\int_a^b f^-(x)dx$ are both finite right? Aren't they both finite in my example? If a=0 and b=5, then the integral produces 5+ln(9/4)
Comment: The integral does not produce $5 + \log (9/4)$. The integrand does not satisfy the hypotheses of the fundamental theorem of calculus, and so the calculation that you probably did to get that answer is not valid.
Comment: @MattSamuel see my second paragraph where I address exactly that case.


AngularJS - Hide/Show directive output based on expression

Question: I'm wanting to output some markup from a custom Directive, but only if the model contains some text.
I'm almost there, but I'm just not quite sure how to turn the template on/off when the model changes, and if this is even the most efficient way of doing it.
Here is the markup:

    <input type="text" id="search" maxlength="75" data-ng-model="keywords" />

<searched data-ng-model="keywords"></searched>

The JS:
var app = angular.module('myApp', []);

app.directive('searched', function(){
    return {
        restrict: 'E',
        replace: true,
        scope: {
            keywords: '=ngModel'
        },
        template: 'You searched for: {{ keywords }} ',
        link: function(scope, element, attrs) {
            scope.$watch('keywords', function(newVal, oldVal){
                if(newVal === null) {
                    // Output nothing!
                } else {
                    // Output Template as normal.
                }
            }, true);

        }
    };
});

app.controller("test", ['$scope', function($scope) {
    $scope.keywords = null;
}]);

And an example JSFiddle
Answer: If I'm understanding what you want to do, the easiest way would be with an ng-show. Then you don't even need the $watch (or the link function for that matter)
app.directive('searched', function(){
    return {
        restrict: 'E',
        replace: true,
        scope: {
            keywords: '=ngModel'
        },
        template: ' 0">You searched for: {{ keywords }} '
    };
});

Updated fiddle
Comment: Superb, thanks a lot for that. I knew I was over complicating it :)
Comment: On reflection, is a Directive even worth using for this? All I actually wanted to do is exactly what's now in the template. Should I just use what's in the template in the actual markup? I've tried it in  the markup and it does exactly what I want, so is a Directive overkill?
Comment: If you don't need to reuse the same markup anywhere else, then yes, the directive is probably overkill. The directive is handy when you don't want to repeat the same markup multiple places.
Comment: I am only using this in one place, so I'll ditch the Directive in this instance. Thanks again for your help, it's much appreciated.


Homothetic transformation in the Poincaré upper half plane

Question: I am interested in finding homothetic transformations in the Poincaré upper half plane. I heard that unlike $\mathbb{R}^n$ we don't have an homothetic transform for every $\lambda \in \mathbb{R}^+$.
So I have now two questions. Do homothetic transforms have a general expression? And what are the extremal possible ratios for homothetic transforms?
Thanks,
Emmanuel
Answer: A homothetic transformation of the Euclidean plane preserves the absolute values of angles but scales areas by $\lambda^2$. In hyperbolic geometry, the area of a polygon is equal to the its angle deficit. So as long as its angles don't change, its area can't change either. For this reason, the identity transformation with $\lambda=1$ is the only homothetic transformation matching your description. One might perhaps argue for $\lambda=0$ (maps the whole plane to a single point) or $\lambda=-1$ (reflection in a point) as valid alternatives, but since you restricted the setup to $\lambda\in\mathbb R^+$, those cases should be excluded.


For every closed set $C$, $f^{-1}(C)$ is closed. Is $f$ necessarily continuous?

Question: I am trying to prove this using the definition of continuity (and complements) where $f$ is continuous iff for every open set $U$, $f^{-1}(U)$ is also open. But I am uncertain about my proof when I try to write it formally. If somebody can present a formal proof, it will be really appreciated.
Thanks!
Answer: A function is continuous if and only if the pre-image of an open set is open. Let $f:X\to Y$ be such that for every closed set $C$ in $Y$ the set $f^{-1}(C)$ is closed. Now, consider an open set $U$. Then $Y-U$ is closed by definition, so $f^{-1}(Y-U)$ is closed. But $$f^{-1}(Y-U)=f^{-1}(Y)-f^{-1}(U)=X-f^{-1}(U).$$ Since $X-f^{-1}(U)=(f^{-1}(U))^c$ is closed, its complement, i.e., $f^{-1}(U)$ is open, thus $f$ is continuous.
Comment: it looks good at first sight but when you consider U as an open set and then conclude from there that Y-U is closed by definition (what definition are you talking about). If Y is the set of all reals and U = (0,infinity), then i think Y-U is not necessarily closed. what are your thoughts?
Comment: Closed means that it contains all of its limit points (where a limit point is defined to be a point such that any open set containing it contains a point distinct from it in the bigger set), so in fact $(-\infty,0]$ is closed, since for any point in $(-\infty,0]$, when we look at any open set containing it (even $0$), there are points in $(-\infty,0]$ that aren't $x$.
Comment: And one more thing, are you sure this equality holds for any function $f^{-1}(Y-U)=f^{-1}(Y)-f^{-1}(U)$ Can we just quote this?
Comment: Yes, it is fairly easy to prove even. I would guess it's fair game just to quote it.
Comment: do you mind writing a quick sketch just so we can "close" this matter? i will be very grateful. thanks!
Comment: Suppose $x\in f^{-1}(Y-U)$. Then $f(x)\in Y-U$, i.e., $f(x)\notin U$, so $x\notin f^{-1}(U)$, hence $x\in f^{-1}(Y)-f^{-1}(U)$. Conversely, let $x\in f^{-1}(Y)-f^{-1}(U)$. Then $x\notin f^{-1}(U)$, so $f(x)\notin U$. Therefore $f(x)\in Y-U$ so we have $x\in f^{-1}(Y-U)$. This gives us containment in both directions, so we have equality.
Answer: The two key facts are: (a) a set is open iff its complement is closed; and (b) inverse image preserves complements, i.e. if $f:X\to Y$, and $U \subseteq Y$, then $f^{-1}(U^c) = (f^{-1}(U))^c$.
Given this: suppose $U \subseteq Y$ is open.  We need to show that $f^{-1}(U)$ is open; equivalently, that its complement is closed.  But its complement is $(f^{-1}(U))^c = f^{-1}(U^c)$, the inverse image of a closed set, so is closed by the assumption on $f$.
Answer: Suppose that $f:X\to Y$ is such that $f^{-1}[F]$ is closed in $X$ whenever $F$ is closed in $Y$. Let $U$ be an arbitrary open set in $Y$. Then $Y\setminus U$ is closed in $Y$, so $f^{-1}[Y\setminus U]$ is closed in $X$, and therefore $X\setminus f^{-1}[Y\setminus U]$ is open in $X$. Now show that $X\setminus f^{-1}[Y\setminus U]=f^{-1}[U]$, and you're done.
Comment: Do you know how to prove the last equality you quote? because I am having the same problem with @clayton's solution below
Comment: @UH1: Just chase elements: $x\in f^{-1}[U]$ iff $f(x)\in U$ iff $f(x)\notin Y\setminus U$ iff $x\notin f^{-1}[Y\setminus U]$ iff $x\in X\setminus f^{-1}[Y\setminus U]$.
Comment: @UH1: Excellent!
Answer: Suppose $f:X \to Y$ satisfies the condition, and let $U \subset Y$ be an open set.  Then $U^c$ is closed subset of $Y$, and so we have that $f^{-1}(U^c)$ is closed in $X$.  But $f^{-1}(U^c) = f^{-1}(U)^c$, and so $f^{-1}(U)$ is open since its complement is closed.


Simplest conjunction (intersection) code

Question: I have two arrays and I wnat the simplest way of knowing if they have elements in common. So actually this question have to questions.
string[] countries1 = new string[] { "USA", "Uruguay", "India", "UK"};
string[] countries2 = new string[] { "Urguay", "Argentina", "Brasil", "Chile" };
foreach (string country in countries1)
    if (countries2.Contains(country))
        return true;
return false;

What's the simplest linq query that will let me know if any of the country1 countries is also in the country2 array?
What's the simplest linq query that will return an array of every repeated country?
Answer: 1) var isIntersection = countries1.Intersect(countries2).Any();
2) var intersectedCountries = countries1.Intersect(countries2);
Comment: In the first example there is an extra bracket!
Answer: For intersection between countries 1 and 2:
countries1.Intersect(countries2).ToArray()
Comment: Why should you use `Count` method? `Any` is better in my opinion. :)
Comment: I had missunderstood the "counting" question. It was counting the repeated items within the same array. Actually, the Any method is the best choice in this case.
Answer: Adilson's answer covers your question #2, and for question #1

What's the simplest linq query that will let me know if any of the country1 countries is also in the country2 array?

You would do:
countries1.Intersect(countries2).Any();

The .Any() will return true on the first instance of a match, whereas .Count() or .ToArray() will iterate the entire list.
Answer: With LINQ:
var commonCountries = countries1.Intersect(countries2);

if (commonCountries.Any())
    // There are common countries.

But, this doesn't take into consideration string casing etc. What you may want to do, is chuck together a quick IEqualityComparer<string>:
public class OrdinalStringComparer : IEqualityComparer<string>
{
    public bool Equals(string s1, string s2)
    {
        return string.Equals(s1, s2, StringComparison.OrdinalCultureIgnoreCase);
    }
    public int GetHashCode(string str)
    {
        return (str == null) ? 0 : str.GetHashCode();
    }
}

Then pass that in with your Intersect call:
var commonCountries = countries1.Intersect(countries2, new OrdinalStringComparer());


Problem with certificates issued this month (thawte) in apache

Question: We have issued a new certificate this month, and is giving us some problemas.
According to thawte, they migrated to 2048 the root, but we can't get the point to configure those new certificates in apache 2.2
Thwate Root Migration
¿Any advice or link that can help us on importing those root to the thrust of apache and implement the new certifcicate?
Thanks
Answer: After searching in documetation, in thawte and in openssl, I put here the solution in case anyone need it.
First Step
And you will probably, because all the entities will migrate to 2048 bit root soon (International recomendation).
First, you need all the root and intermeditate certificates, normally on .crt extension in BASE64 encoding.
Then you create a .pem file, copying all the certificates in one file
Second Step
Apache has 3 directives to manage SSL in this case:
<code>SSLCACertificateFile "SSL_CA_Bundle.pem"
SSLCertificateKeyFile "WebCertificate.key"
SSLCertificateFile "WebCertificate.crt"
</code>
You must configure them in each Virtual host (If used).
This way all the clients will get a correct certificate and they will trust on the entities that issued the certificate.


Right hand finger positions on a flute

Question: I was recently watching a video of Jethro Tull performing, with Ian Anderson on flute.
His right hand appears to use the pads of the medial, rather than distal, phalanges.
I.e. the left hand uses the end joint of each finger to cover the holes, but the right hand uses the second finger joint instead.
Is this standard technique for flute?
(I've found that it is standard for bagpipes, but can't find anything specifically for flutes.)
Comment: Watch a video of an orchestra playing Debussy's Prelude a l'apres-midi d'un faune, and observe. The ends of the fingers are used. Also the video shows a flute where the keys fully cover the holes and those used by top classical flautists have holes which must be sealed by the fingers.
Comment: You should be able to find a couple dozen "how to ... flute" websites which will explain proper finger positioning.
Answer: On the western C-flute it's standard to use the pads on the tips of the fingers, in fact on the open-hole flutes played by a lot of professionals that's the only way possible. The second joint is used on bagpipes and a lot of ethnic flutes Irish whistles, bansuris, neys etc. Ian Anderson developed his style of playing without any musical training and it wasn't until the 1990s when his daughter started taking flute lessons that he discovered his flute technique was 'wrong'. He always played the cheapest Yamaha student flutes. When he was going on tour he would order a box of about 20 flutes, and throw his flute into the audience at the end of each concert.
Comment: In the Irish tradition the use of the pads of the second joint to cover some holes is called 'The Pipers Grip', because of its use on the bagpipes.

Right hand finger positions on a flute


Submit só executa uma vez

Question: <code>$(document).ready(function(){
    //Função que ao clicar no botão, irá fazer.
    $("#logarsist").click(function(){
        var usuario = $("#usera").val();
        var password = $("#pass").val();

        if(usuario == ''){
            $("#formulariousuario").html("Campo Obrigatório*");
            setTimeout(function(){$("#formulariousuario").hide();}, 6000);};

        if(password == ''){
            $("#formulariopassword").html("Campo Obrigatório*");
            setTimeout(function(){$("#formulariopassword").hide();}, 6000);};

        return false;
    });
});
</code>
Comment: Não entendi sua pergunta. Você quer que o seu submit só seja executado uma vez ou ele só está executando uma única fez? Caso a resposta seja a primeira alternativa, basta alterar ".click" por ".one" na terceira linha. Caso não seja isso, verificou se o console exibe alguma mensagem de erro?
Comment: ele só executa uma vez, não tem erros no console .
Comment: na verdade ele executa mais de uma vez, só que as id com as mensagens só aparecem uma unica vez
Comment: Não acontece porque, depois da primeira vez, elas já estão hide(); ?
Answer: Pela descrição que me deu em sua pergunta, o código está sendo executado, porém você esqueceu de exibir novamente as divs que ocultou.
Acredito que isso resolve o seu problema:
<code>$(document).ready(function()
{
    $("#logarsist").click(function()
    {
        var usuario = $("#usera").val();
        var password = $("#pass").val();

        if(usuario == '')
        {
            $("#formulariousuario").html("Campo Obrigatório*");
            $("#formulariousuario").show(); // também pode usar o fadeIn()
            setTimeout(function()
            {
                $("#formulariousuario").hide(); // também pode usar o fadeOut()
            }, 6000);
        };

        if(password == '')
        {
            $("#formulariopassword").html("Campo Obrigatório*");
            $("#formulariopassword").show();

            setTimeout(function()
            {
                $("#formulariopassword").hide();
            }, 6000);
        };

        return false;
    });
});
</code>
Com um pouco mais de adaptação no seu código você consegue alguns resultados melhores. Veja:
<code>$(document).ready(function()
{
    var timeout = null;

    $("#logarsist").click(function()
    {
        var usuario = $("#usera").val();
        var password = $("#pass").val();

        if(usuario == '')
        {
            $("#formulariousuario").html("Campo Obrigatório*").show();
        };

        if(password == '')
        {
            $("#formulariopassword").html("Campo Obrigatório*").show();
        };

        // Cancele o timeout para evitar que ele oculte suas divs em momentos inesperados
        clearTimeout(timeout);
        timeout = setTimeout(function()
        {
            // Acrescente a classe "error" nas divs que deseja exibir as mensagens de erro.
            $('.error').hide();

        }, 6000);

        // Você só deve retornar false se o form tiver erros ou for chamar outra função para realizar o envio do formulário.
        return false;
    });
});
</code>
Usando um seletor de classes e acrescentando a classe em seu HTML, você evita código desnecessário, e pode ter um tratamento mais unificado.
O JQuery também permite que você combine vários métodos em um único seletor, reduzindo o processamento de buscar novamente o elemento e reduzindo seu código.
Comment: agora eles aparecem e some em segundos :/
Comment: como vc me recomendaria para enviar esses dados para o php?

Submit só executa uma vez


Prove if $k^\text{th}$ derivative of an entire function $f$ is polynomial, then $f$ itself is polynomial. Where's my mistake?

Question: The exact wording of the question is as follows:

Let $f$ be an entire function. Suppose there exists a positive integer $k$ such that $k^\text{th}$ derivative $f^{(k)}$ is a polynomial. Prove that $f$ is a polynomial.

Following the Taylor series representation of an arbitrary function $f(z) = \sum_{k \geq 0} c_k z^k$ and taking its derivative format as written in the textbook as an assumption, I provided the following as the solution:

Let $f^{(k)}(z) = \sum_{n\geq k} n(n-1)\ldots (n-k+1) c_k z^{n-k}$ and
  let $d_n = n(n-1)\ldots (n-k+1) c_k $. If $f^{(k)}$ is polynomial then
  $d_{k_0}$ is constant for each $k_0 \geq k$. Then $\underbrace{\int
 \ldots \int}_k f^{(k)} dz \ldots dz = \underbrace{\int \ldots \int}_k
 \sum_{n\geq k} d_n z^{n-k} dz \ldots dz = \sum_{n\geq k}
 \underbrace{\int \ldots \int}_k d_n z^{n-k} dz \ldots dz$
Since sum of polynomials is polynomial and $f = \underbrace{\int
 \ldots \int}_k f^{(k)} dz \ldots dz$, then $f$ is polynomial.

I was told the proof is wrong because I needed to show the Taylor series is finite; in other words, say $d_{k_0} = 0$ as opposed to just being a constant.
But now that I'm thinking about it:

What I said about $d_{k_0}$ is not wrong but it is redundant, since the coefficients of $z$ are constant by definition of the Taylor series.
I don't really see why it's necessary to write that the Taylor series is finite - even though it necessarily is. I'm showing it takes finitely many antiderivatives (i.e. $k$ many) of $f^{(k)}$ (which is assumed to be polynomial). Since I'm just adding and integrating terms of the Taylor series of some polynomial function (i.e. $f^{(k)}$), whatever property needed by a Taylor series to represent a polynomial function (i.e. $f$) must automatically be satisfied.

I'd very much appreciate it if anyone could specify my mistake.
Comment: Ah, you have to understand that with exam questions there is a marking scheme and the marks have to be consistent. So our opinion doesn't matter if this is the way it was marked for everyone.
Comment: @tst That makes sense and it's fine for me to even have it completely rejected on the basis of being unclear or something equivalent. But the invalidity of my solution should be demonstrable irrespective of the scheme.
Comment: To be honest I don't see the problem. You have that $f$ equals the antiderivarive plus a polynomial because of the integration constants. The antiderivarive is a polynomial, so you are done.
Comment: Mistake or not, using Taylor series for this feels like the long way around, inviting worry about convergence that could have been avoided. It would feel much more direct to use induction on $k$. For $k=1$, integrate the polynomial $f'(z)$ symbolically to get $g(z)$, also a polynomial. Since $(f-g)'=0$ and $f(z_0)=g(z_0)$ if you choose the right constant of integration, you must have $f-g=0$, so $f$ is the polynomial $g$.
Comment: First show that if $f^{(k)} = 0$ then $f$ is a polynomial.
Comment: @HenningMakholm Thanks. But this was an exam question for which I received 2 out of 10. I need to see where my mistake is because (i) I need to learn it and (ii) if there's no mistake, then the grading is problematic.
Comment: But your argument is somehow unclear. You can do it the opposite way. Assume the form of the derivative and integrate to get the function. I guess another way is Cauchy integral.
Comment: I think the actual problem is that you didn't really use the fact that the $k$th derivative has finite Taylor series. You have written only infinite sums.
Comment: @copper.hat Do you mean showing for a polynomial function like $f^{(k)}$ there'd be $m \geq 1$ such that $f^{(k+m)} = 0$ and then integrate $(m+n)$ times to get $f$? If so, that makes sense, but I don't see why would I need to do that as I still don't understand why I can't go from $f^{(k)}$ to $f$.
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/82330/discussion-between-tst-and-atonal).
Answer:
If $f^{(k)}$ is polynomial then $d_{k_0}$ is constant for each $k_0
> k$.

At this point you already started on the wrong path. Note that the series
$$\sum_{k=2}^\infty 2 x^k$$
for example satisfies your condition, but is not a polynomial!
Since you try to deduce from here that your function is a polynomial, your argument must be wrong, and here is why:
\smallskip

Since sum of polynomials is polynomial and $f=f = \underbrace{\int  \ldots \int}_k f^{(k)} dz \ldots dz$, then f is polynomial.

Here you make the second mistake. It is true that a finite sum of polynomials is a polynomial, BUT your sum is

$$\sum_{n\geq k}   \underbrace{\int \ldots \int}_k d_n z^{n-k} dz \ldots dz$$

is an infinite sum, and an infinite sum of polynomials is not always a polynomial.
Comment: @Atonal You are right about the comment, but that is not what you wrote in your solution. The simple fact that now you can explain how to solve the problem does not make the different answer you wrote correct.
Comment: Yes. I predicted one may raise these two issues. I addressed them in the two points I had at the end of the post.

My whole point is that if I have the Taylor series representing a polynomial function (f^k), then adding finitely many terms to it or integrating them so that I could get (f) wouldn't change the fact that it's a polynomial: Any property that a series must have for it to represent a polynomial would still be kept, including being finite. So since the series for f^k is polynomial (and is necessarily finite), the sum would still be valid. Isn't it?
Answer: Suppose $f(z) = \sum_{k=0}^\infty a_n z^n$, then $a_n = {1 \over n!} f^{(n)}(0)$.
If $p$ is a polynomial, then $p^{(m)} = 0$ for some $m$. Since $f^{(k)}$ is a polynomial,
there is some $m$ such that $f^{(k+m)} = 0$. Hence $a_n =0$ for $n \ge k+m$. Then
$f(z) = \sum_{k=0}^{k+m-1} a_n z^n$, which is a polynomial.
Another approach:
If $p$ is a polynomial, then $q(z) = c+\int_0^z p(w)dw$ is a polynomial.
Suppose $f^{(k)}$ is a polynomial. Then the fundamental theorem of calculus
gives us $f^{(k-1)}(z) = f^{(k-1)}(0) + \int_0^z f^{(k)}(w) dw$, and so
$f^{(k-1)}$ is a polynomial. Continue by induction to get that $f$ si a
polynomial.
Answer: I would prove it
by induction on $k$.
Base case -
$k=1$.
If
$f'(x)$
is a polynomial
then
$f'(x)
=\sum_{j=0}^d a_jx^j
$
so
$\begin{array}\\
f(x)
&=f(0)+\int_0^x f'(t) dt\\
&=f(0)+\int_0^x (\sum_{j=0}^d a_jt^j) dt\\
&=f(0)+\sum_{j=0}^d a_j\int_0^x t^j dt\\
&=f(0)+\sum_{j=0}^d a_j\dfrac{x^{j+1}}{j+1}\\
\end{array}
$
is a polynomial.
If true for $k$ then
if
$f^{(k+1)}(x)$
is a polynomial then
$f'(x)$
is a polynomial
by the induction hypothesis
for $k$
since
$(f'(x))^{(k)}
=f^{(k+1)}(x)
$.
Therefore
$f(x)$
is a polynomial
by the base case
with $k=1$.


How do you achieve this bass heavy effect?

Question: I noticed that a lot of modern metal songs sometimes have this booming drum sound (I think it's made on the toms and/or bass), for example before/during a breakdown in some metalcore songs.
It's a very loud, saturated drum beat (single beats only) that almost sounds like a cannonball being fired.
Very often, the drums are spiced up with a deep bass note to make it sound even more intense and I would love to know how the whole editing for the drum and bass sound is done. I'm not sure if it's rather an edited drum beat or a bass technique...
There is one song that comes in my mind: Crumble by Breakdown Of Sanity, the booming sound appears a few times throughout the whole song, there is one at 0:12 already
Comment: Are you talking about a bass drop?
Comment: Can you give some examples?
Comment: I edited my question a bit, I totally forgot to add a good example. My example would be Crumble by Breakdown Of Sanity.
Comment: I was attending Korn concert couple of years ago and noticed that Ray Luzier uses electronic drum pad with prerecorded bass drop sound, so that he could play on his drum set and produce this sound when needed. Of course, that sound was non-organic and definitely is software generated.
Comment: Would an example be: Critical Acclaim by Avenged Sevenfold around 2:53?
Answer: Well as far as I know that is what's referred to as a 'bass drop' (but I think that term gets thrown around for a few different effects).  There are probably a bunch of ways to do it: a fretless bass can simply slide down the lowest string with some nice EQ and that's about all it takes (provided the bass is tuned low enough).
The studio sound on your example was quite possibly created using a Low Pass Filter with an envelope trigger that moves the cutoff frequency from somewhere in the bass range all the way down to nothing over a half-second or so. The filter's resonance setting can be turned up to enhance the low frequency tone and give it some body as the cutoff is modulated.  You could use just about anything as audio input but probably a drum kick or sub bass oscillator from a synth.
Comment: It's not a drop - a [drop](https://en.wikipedia.org/wiki/Drop_(music)) is a separate section of a song, and in both of the examples above, the note doesn't fall at the start of a section. But your sound design parts could be on the ball. It could also just be a triggered 808 sample.
Comment: Most commonly it is just a triggered sample.  Filters don't give the same kind of consistent bass tone, and it's *definitely* not a low pass filter at 50Hz...
Answer: I think the accepted answer misses the mark.  There's a couple ways to do this.
The first, and probably most common, is to use a bass drop sample, or create a bass drop sound with a synthesizer.  Here is one I just made.  It's just a sine wave with a volume envelope (swell in, decay out) and pitch envelope (start low, gradually go even lower).
https://vocaroo.com/18kZGmPhiN9V (Volume warning if you have a good subwoofer)
And with music, it sounds like this
https://vocaroo.com/1i8lDpEc5ysR
Commonly, this drop will cause the master limiter to be pushed really hard, giving a crunchy distortion effect on top.
https://vocaroo.com/1d0BMWSgOGYa
Based on listening, I am confident that this is how the linked track achieved that effect.  But for the sake of completeness, there is another way to do it...
You can also get a similar effect with a resonant bell filter.  Boost sharply in the low bass and slowly lower the frequency of the filter.  I don't use this method, because it heavily depends on the content that's already in the recording.  But it can be done with a filter.

And with the limiter smashed:
https://vocaroo.com/1kavOC7heiGk
It is NOT done with a low pass filter, as suggested by the current accepted answer.  On the master, that would sound like this
https://vocaroo.com/18Os8MNiJAIM
If you did it just on a kick or bass track, you'd still be losing all the treble from that one track.
I suppose you could make a duplicate of a kick or bass track and do it, but then the low end of that track (below the filter cutoff) would suddenly be twice as loud until the filter closes... and you're creating excessive work setting this all up.
Answer: It could be a unmuffled bass drum or maybe like a 16 inch floor tom or maybe a even bigger floor tom
Comment: Nah, drums do have such a build in volume (the peak in the volume is a beat or two after the sound starts).


Cisco PIX land attack

Question: I am continouly getting errors log Deny IP due to Land Attack from IP to IP.
Both source and destination IP address are same.
Can any one please guide me what could be the issue and how I can fix this?
Comment: StackOverflow is for programming related questions.  You might want to ask this over on ServerFault or SuperUser...
Comment: What PIX OS are you using ? Answers are right but this may also be an false alert if your are running PIX one of the first v7 version
Answer: The Land Attack spoofs the source and destination IP to be the same basically causing the machine to continuously reply to itself causing a DOS.  It's a pretty old attack and most OS's are now patched to not be vulnerable to this.
In this case I think your PIX is doing what it's supposed to and dropping the traffic.  I don't think you have anything to worry about.
Answer: I'm not entirely sure there is something to "fix" in this case.  There are a number of baseline security protections that are enabled in PIXOS, Land Attack protection being one of them.
One possibility you could do is check the MAC table in the PIX for the offending and attempt to track it down for remediation.  However, I would not necessarily trust the results to be completely accurate.

Cisco PIX land attack


Exclusão ajax + jquery

Question: Qual método correto para conseguir deletar, a minha duvida está sendo como pega o id baseado na linha da tabela, e como enviar o mesmo para uma pagina que exclui de fato. Os códigos que já tenho feito estará á seguir.
listaUsuario.php

<?php

    // incluindo o arquivo que faz a conexao com o banco
    include ("../includes/conexao.php");

    // Listando os Cargos

    // executa  query de consulta e armazena o resultado devolvido na variável $resultado
     $resultado = mysql_query("SELECT TXT_NOMEX_USUAR, TXT_ENDER_EMAIL, FLG_STATU_USUAR, DAT_ULTIM_LOGIN, COD_IDENT_USUAR from tbl_USUARIOS");

    // se não existir cargos cadastrados exibe uma mensagem
    if(mysql_num_rows($resultado)<=0)
    {
        echo "
";
        echo "Atenção!
";
        echo "Não existe cargo cadastrado no momento.";
        echo "
";
    }

    // se existir produtos cadastrados lista-os
    else
    {
        echo "
";
        echo "Excluir	";
        echo "Alterar	";
        echo "Nome	";
        echo "Email	";
        echo "Status	";
        echo "Último Login	";

        while($linha = mysql_fetch_array($resultado))
        {
            echo "
";
            echo "
";
            echo "	";
            echo "	";
            echo "$linha[0]	";
            echo "$linha[1]	";
            echo "$linha[2]	";
            echo "$linha[3]	";
            echo "
";
        }
        echo "
";
    }
    mysql_close($conn);
?>

excluiUsuario.php
<?php
     // incluindo o arquivo que faz a conexao com o banco
    include ("../includes/conexao.php");

    // Recebendo o valor enviado pelo link
    $COD_IDENT_USUAR = isset($_POST['COD_IDENT_USUAR']) ? $_POST['COD_IDENT_USUAR'] : '';

    mysql_query("DELETE FROM tbl_Usuarios WHERE COD_IDENT_USUAR ='".$COD_IDENT_USUAR."'");

    //fechando a conexao com o banco
    mysql_close($conn);

?>

Utilizando estes códigos, não estou conseguinte efetuar o delete, ele envia a pagina excluirUsuario.php porem nada acontece.
Comment: Você não criou uma pergunta dessa ontem ?
Comment: Não, este é um novo erro, porque meu outro post foi desativado.
Comment: Transforme o `btn_Excluir` em id e coloque o script no final da pagina, se quiser colocar no começo use a função ready do JQuery.
Answer: (o botão de alterar aponta pra mesma página que o botão de apagar, eu acho que não é isso que você quer!)
Você está criando duas, não uma linha na tabela:
echo "
";
echo "
";

O $trPai faz referência ao segundo
, que não tem o data-id; se você tirar essa linha o problema deve se resolver.
Answer: Verifique se o id que está na tr, está sendo enviado mesmo pelo ajax, se não estiver sendo enviado tente mudar seu javascript. Se você se tem o .btn_Excluir dentro da tr, use ele como seletor e para pegar o id da tr através .closest().
$(function(){
    $(".btn_Excluir").on("click", function(){
        var id = $(this).closest("tr").attr("data-id");
        if(id != null){
           //Ajax aqui
        }
    });
});

Exclusão ajax + jquery


HAProxy listen with two arguments?

Question: I keep seeing HAProxy configuration examples with a two-argument syntax. Indeed, the default configuration file supplied with 1.4.18 contains this:
listen  appli1-rewrite 0.0.0.0:10001
    cookie  SERVERID rewrite
    balance roundrobin
    server  app1_1 192.168.34.23:8080 cookie app1inst1 check inter 2000 rise 2 fall 5
    server  app1_2 192.168.34.32:8080 cookie app1inst2 check inter 2000 rise 2 fall 5
    server  app1_3 192.168.34.27:8080 cookie app1inst3 check inter 2000 rise 2 fall 5
    server  app1_4 192.168.34.42:8080 cookie app1inst4 check inter 2000 rise 2 fall 5

I am noticing a complete lack of any bind option, so am I to believe that this is a shorthand for bind?
The HAProxy documentation (http://haproxy.1wt.eu/download/1.5/doc/configuration.txt) contains one unrelated example with this syntax, but does not specify, document or explain it anywhere.
The documentation simply shows listen   <name>:
All proxy names must be formed from upper and lower case letters, digits,
'-' (dash), '_' (underscore) , '.' (dot) and ':' (colon). ACL names are
case-sensitive, which means that "www" and "WWW" are two different proxies.

(i.e. no spaces, so this clearly isn't just part of the name)
Is there any official documentation for this syntax?
Thanks.
Comment: This is confusing the hell out of me too. It seems almost completely undocumented syntax, so why is it so commonly used?!
Answer: I think I just cracked this by finding this answer on superuser.com.  In HAProxy 1.3.x, the deprecated reference manual said:
2) Declaration of a listening service
=====================================

Service sections start with the 'listen' keyword :

    listen <instance_name> [ <IP_address>:<port_range>[,...] ]

By 1.4, this manual no longer existed, but it seems that this syntax continued to be accepted for backwards compatibility.  In 1.6, a listen section without a bind directive started to generate warnings.
So the answer is that it's old syntax which shouldn't be used any more.

HAProxy listen with two arguments?


Replicate local user policies between PC's

Question: I used the Local Policy Editor Management Console that applies local policies to a specific user on a Windows 10 PC.
After saving the new policies, I want to replicate it to other PCs.
When I opened it on another PC with the same user, I got an error saying that there was no mapping between the account names and security id.
How can I replicate those local policies for multiple PCs?
Comment: `error saying that there was no mapping between the account names and security id.` Correct. Windows 101: user accounts on different computers are not the same, even if the username is the same. That is why Active Directory was created, to have a central store of user accounts that would be recognized on all computers. Active Directory also has Group Policy, which is convenient for transparently replicating Group Policy to computers.
Comment: Unfortunately I can't use an AD with this network. There's simply none.
Comment: Consider scheduled tasks or a script on a file share in the network as alternatives
Answer: It's a bad idea, but..if the policy got corresponding registry value, then...
Take the two Registry.pol file under :\Windows\System32\GroupPolicy\ ref

The Group Policy Object Editor stores registry-based configuration
settings in two Registry.pol files, stored in folders under the
:\Windows\System32\GroupPolicy\ folder. One file contains
computer settings and the other file contains user settings. The Group
Policy Object Editor saves the settings to these files on exit, and
imports the settings on startup.

Better idea to manage your computer;
Create a GPO that target that computer and make it apply to other computers you want.
By copying the .pol file you fall like it was on older system like NT4 with poledit to make policies.. It's a way back to a nightmare for many tech that lived that period IMO, but welcome to the boat if you use that method I guess.
Answer: I have found PolicyPlus to be the best tool for my needs.
I began by importing a default user policy into PolicyPlus, subsequently refining specific policy settings. After making these adjustments, I proceeded to export the modified policies into a file and stored it on an external drive.
For each computer, I created a limited user account and imported the tailored user policy using PolicyPlus. By importing the previously saved file, I saved the modifications to user policies.
To complete the process, I utilized the MMC editor to craft a new snap-in designed for the user's local policy. This customized snap-in was saved and seamlessly integrated into the user policy configuration.